overviewpart.cpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include <kiconloader.h>
00024 #include <kparts/genericfactory.h>
00025
00026 #include <konnector.h>
00027 #include <konnectorinfo.h>
00028 #include <konnectormanager.h>
00029
00030 #include <mainwindow.h>
00031
00032 #include "overviewwidget.h"
00033
00034 #include "overviewpart.h"
00035
00036 typedef KParts::GenericFactory< KSync::OverviewPart> OverviewPartFactory;
00037 K_EXPORT_COMPONENT_FACTORY( liboverviewpart, OverviewPartFactory )
00038
00039 using namespace KSync;
00040
00041 namespace {
00042
00043 kdbgstream operator<<( kdbgstream str, const Notify& no )
00044 {
00045 str << no.code() << " " << no.text();
00046 return str;
00047 }
00048
00049 kndbgstream operator <<( kndbgstream str, const Notify & )
00050 {
00051 return str;
00052 }
00053
00054 }
00055
00056 OverviewPart::OverviewPart( QWidget *parent, const char *name,
00057 QObject *, const char *,const QStringList & )
00058 : ActionPart( parent, name )
00059 {
00060 m_pixmap = KGlobal::iconLoader()->loadIcon( "kcmsystem", KIcon::Desktop, 48 );
00061 m_widget=0;
00062
00063 connectPartChange( SLOT( slotPartChanged( ActionPart* ) ) );
00064 connectPartProgress( SLOT( slotPartProgress( ActionPart*, const Progress& ) ) );
00065 connectPartError( SLOT( slotPartError( ActionPart*, const Error& ) ) );
00066 connectKonnectorProgress( SLOT( slotKonnectorProgress( Konnector *, const Progress& ) ) );
00067 connectKonnectorError( SLOT( slotKonnectorError( Konnector *, const Error& ) ) );
00068 connectProfileChanged( SLOT( slotProfileChanged( const Profile& ) ) );
00069 connectSyncProgress( SLOT( slotSyncProgress( ActionPart*, int, int ) ) );
00070 connectStartSync( SLOT( slotStartSync() ) );
00071 connectDoneSync( SLOT( slotDoneSync() ) );
00072 }
00073
00074 OverviewPart::~OverviewPart()
00075 {
00076 delete m_widget;
00077 }
00078
00079 KAboutData *OverviewPart::createAboutData()
00080 {
00081 return new KAboutData( "KSyncOverviewPart", I18N_NOOP( "Sync Overview Part" ), "0.0" );
00082 }
00083
00084 QString OverviewPart::type() const
00085 {
00086 return QString::fromLatin1( "Overview" );
00087 }
00088
00089 QString OverviewPart::title() const
00090 {
00091 return i18n( "Overview" );
00092 }
00093
00094 QString OverviewPart::description() const
00095 {
00096 return i18n( "This part is the main widget of KitchenSync" );
00097 }
00098
00099 QPixmap* OverviewPart::pixmap()
00100 {
00101 return &m_pixmap;
00102 }
00103
00104 QString OverviewPart::iconName() const
00105 {
00106 return QString::fromLatin1( "kcmsystem" );
00107 }
00108
00109 bool OverviewPart::hasGui() const
00110 {
00111 return true;
00112 }
00113
00114 QWidget* OverviewPart::widget()
00115 {
00116 if ( !m_widget )
00117 m_widget = new OverView::Widget( 0, "part" );
00118
00119 return m_widget;
00120 }
00121
00122 void OverviewPart::slotPartChanged( ActionPart* part )
00123 {
00124 kdDebug(5210) << "PartChanged" << part << " name" << part->name() << endl;
00125 }
00126
00127 void OverviewPart::slotPartProgress( ActionPart* part, const Progress& prog )
00128 {
00129 kdDebug(5210) << "PartProg: " << part << " " << prog << endl;
00130 m_widget->addProgress( part, prog );
00131 }
00132
00133 void OverviewPart::slotPartError( ActionPart* part, const Error& err )
00134 {
00135 kdDebug(5210) << "PartError: " << part << " " << err << endl;
00136 m_widget->addError( part, err );
00137 }
00138
00139 void OverviewPart::slotKonnectorProgress( Konnector *k, const Progress& prog )
00140 {
00141 kdDebug(5210) << "KonnectorProgress: " << prog << endl;
00142 m_widget->addProgress( k, prog );
00143 }
00144
00145 void OverviewPart::slotKonnectorError( Konnector *k, const Error& prog )
00146 {
00147 kdDebug(5210) << "KonnectorError : " << prog << endl;
00148 m_widget->addError( k, prog );
00149 }
00150
00151 void OverviewPart::slotProfileChanged( const Profile & )
00152 {
00153 m_widget->setProfile( core()->currentProfile() );
00154 kdDebug(5210) << "Profile changed " << endl;
00155 }
00156
00157 void OverviewPart::slotSyncProgress( ActionPart* part, int status, int percent )
00158 {
00159 m_widget->syncProgress( part, status, percent );
00160 }
00161
00162 void OverviewPart::slotStartSync()
00163 {
00164 m_widget->startSync();
00165 kdDebug(5210) << "Start Sync " << endl;
00166 }
00167
00168 void OverviewPart::slotDoneSync()
00169 {
00170 kdDebug(5210) << "Done Sync " << endl;
00171 }
00172
00173 void OverviewPart::executeAction()
00174 {
00175 kdDebug(5210) << "OverviewPart::executeAction()" << endl;
00176 }
00177
00178 #include "overviewpart.moc"
This file is part of the documentation for kitchensync Library Version 3.3.2.