00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <tqlayout.h>
00022
00023 #include "aboutpage.h"
00024 #include "groupitem.h"
00025 #include "syncprocessmanager.h"
00026
00027 #include "groupview.h"
00028
00029 GroupView::GroupView( TQWidget *parent )
00030 : TQWidget( parent ), mAboutPage( 0 )
00031 {
00032 mLayout = new TQVBoxLayout( this );
00033
00034 mWidgetList = new KWidgetList( this );
00035
00036 mLayout->addWidget( mWidgetList );
00037 }
00038
00039 SyncProcess* GroupView::selectedSyncProcess() const
00040 {
00041 GroupItem *item = static_cast<GroupItem*>( mWidgetList->selectedItem() );
00042 if ( item )
00043 return item->syncProcess();
00044 else
00045 return 0;
00046 }
00047
00048 void GroupView::clear()
00049 {
00050 mWidgetList->clear();
00051 }
00052
00053 void GroupView::updateView()
00054 {
00055 clear();
00056
00057 if ( SyncProcessManager::self()->count() == 0 ) {
00058 mWidgetList->hide();
00059
00060 if ( !mAboutPage ) {
00061 mAboutPage = new AboutPage( this );
00062 mLayout->addWidget( mAboutPage );
00063
00064 connect( mAboutPage, TQT_SIGNAL( addGroup() ), TQT_SIGNAL( addGroup() ) );
00065 }
00066
00067 mAboutPage->show();
00068
00069 } else {
00070 if ( mAboutPage )
00071 mAboutPage->hide();
00072 mWidgetList->show();
00073 }
00074
00075 for ( int i = 0; i < SyncProcessManager::self()->count(); ++i ) {
00076 SyncProcess *process = SyncProcessManager::self()->at( i );
00077
00078 GroupItem *item = new GroupItem( mWidgetList, process );
00079 connect( item, TQT_SIGNAL( synchronizeGroup( SyncProcess* ) ),
00080 TQT_SIGNAL( synchronizeGroup( SyncProcess* ) ) );
00081 connect( item, TQT_SIGNAL( abortSynchronizeGroup( SyncProcess* ) ),
00082 TQT_SIGNAL( abortSynchronizeGroup( SyncProcess* ) ) );
00083 connect( item, TQT_SIGNAL( configureGroup( SyncProcess* ) ),
00084 TQT_SIGNAL( configureGroup( SyncProcess* ) ) );
00085
00086 mWidgetList->appendItem( item );
00087 }
00088 }
00089
00090 void GroupView::updateSyncProcess( SyncProcess *syncProcess )
00091 {
00092 for ( int i = 0; i < (int)mWidgetList->count(); ++i ) {
00093 GroupItem *item = static_cast<GroupItem*>( mWidgetList->item( i ) );
00094 if ( item && item->syncProcess() == syncProcess )
00095 item->update();
00096 }
00097 }
00098
00099 #include "groupview.moc"