kitchensync

overviewpart.cpp

00001 /*
00002     This file is part of KitchenSync.
00003 
00004     Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
00005     Copyright (c) 2002 Maximilian Reiß <harlekin@handhelds.org>
00006 
00007     This library is free software; you can redistribute it and/or
00008     modify it under the terms of the GNU Library General Public
00009     License as published by the Free Software Foundation; either
00010     version 2 of the License, or (at your option) any later version.
00011 
00012     This library is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015     Library General Public License for more details.
00016 
00017     You should have received a copy of the GNU Library General Public License
00018     along with this library; see the file COPYING.LIB.  If not, write to
00019     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00020     Boston, MA 02110-1301, USA.
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 OverviewPart::OverviewPart( QWidget *parent, const char *name,
00042                             QObject *, const char *,const QStringList & )
00043   : ActionPart( parent, name )
00044 {
00045   m_pixmap = KGlobal::iconLoader()->loadIcon( "kcmsystem", KIcon::Desktop, 48 );
00046   m_widget=0;
00047 
00048   connectPartChange( SLOT( slotPartChanged( ActionPart* ) ) );
00049   connectProfileChanged( SLOT( slotProfileChanged( const Profile& ) ) );
00050   connectSyncProgress( SLOT( slotSyncProgress( ActionPart*, int, int ) ) );
00051   connectStartSync( SLOT( slotStartSync() ) );
00052   connectDoneSync( SLOT( slotDoneSync() ) );
00053 }
00054 
00055 OverviewPart::~OverviewPart()
00056 {
00057   delete m_widget;
00058 }
00059 
00060 KAboutData *OverviewPart::createAboutData()
00061 {
00062   return new KAboutData( "KSyncOverviewPart", I18N_NOOP( "Sync Overview Part" ), "0.0" );
00063 }
00064 
00065 QString OverviewPart::type() const
00066 {
00067   return QString::fromLatin1( "Overview" );
00068 }
00069 
00070 QString OverviewPart::title() const
00071 {
00072   return i18n( "Overview" );
00073 }
00074 
00075 QString OverviewPart::description() const
00076 {
00077   return i18n( "This part is the main widget of KitchenSync" );
00078 }
00079 
00080 QPixmap* OverviewPart::pixmap()
00081 {
00082   return &m_pixmap;
00083 }
00084 
00085 QString OverviewPart::iconName() const
00086 {
00087   return QString::fromLatin1( "kcmsystem" );
00088 }
00089 
00090 bool OverviewPart::hasGui() const
00091 {
00092   return true;
00093 }
00094 
00095 QWidget* OverviewPart::widget()
00096 {
00097   if ( !m_widget )
00098     m_widget = new OverView::Widget( 0, "part" );
00099 
00100   return m_widget;
00101 }
00102 
00103 void OverviewPart::slotPartChanged( ActionPart* part )
00104 {
00105   kdDebug(5210) << "PartChanged" << part << " name" << part->name() << endl;
00106 }
00107 
00108 void OverviewPart::slotProfileChanged( const Profile & )
00109 {
00110   m_widget->setProfile( core()->currentProfile() );
00111   kdDebug(5210) << "Profile changed " << endl;
00112 }
00113 
00114 void OverviewPart::slotSyncProgress( ActionPart* part, int status, int percent )
00115 {
00116   m_widget->syncProgress( part, status, percent );
00117 }
00118 
00119 void OverviewPart::slotStartSync()
00120 {
00121   m_widget->startSync();
00122   kdDebug(5210) << "Start Sync " << endl;
00123 }
00124 
00125 void OverviewPart::slotDoneSync()
00126 {
00127   kdDebug(5210) << "Done Sync " << endl;
00128 }
00129 
00130 void OverviewPart::executeAction()
00131 {
00132   kdDebug(5210) << "OverviewPart::executeAction()" << endl;
00133 }
00134 
00135 #include "overviewpart.moc"
KDE Home | KDE Accessibility Home | Description of Access Keys