kitchensync Library API Documentation

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., 59 Temple Place - Suite 330,
00020     Boston, MA 02111-1307, 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 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"
KDE Logo
This file is part of the documentation for kitchensync Library Version 3.3.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Oct 17 09:54:20 2007 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003