kitchensync

engine.h

00001 /*
00002     This file is part of KitchenSync.
00003 
00004     Copyright (c) 2004 Cornelius Schumacher <schumacher@kde.org>
00005 
00006     This library is free software; you can redistribute it and/or
00007     modify it under the terms of the GNU Library General Public
00008     License as published by the Free Software Foundation; either
00009     version 2 of the License, or (at your option) any later version.
00010 
00011     This library is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014     Library General Public License for more details.
00015 
00016     You should have received a copy of the GNU Library General Public License
00017     along with this library; see the file COPYING.LIB.  If not, write to
00018     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019     Boston, MA 02110-1301, USA.
00020 */
00021 #ifndef KSYNC_ENGINE_H
00022 #define KSYNC_ENGINE_H
00023 
00024 #include <konnector.h>
00025 #include <syncer.h>
00026 
00027 #include <qobject.h>
00028 #include <qptrlist.h>
00029 
00030 class KonnectorManager;
00031 class KonnectorPair;
00032 
00033 namespace KSync {
00034 
00035 class SyncUiKde;
00036 
00043 class Engine : public QObject
00044 {
00045   Q_OBJECT
00046 
00047   public:
00048     Engine();
00049     ~Engine();
00050 
00051     static QString progressId();
00052 
00053     void go( KonnectorPair *pair );
00054     void setResolveStrategy( int strategy );
00055 
00056   protected:
00057     void logMessage( const QString& );
00058     void logError( const QString& );
00059 
00060     void tryExecuteActions();
00061     void executeActions();
00062 
00063     void tryFinish();
00064     void finish();
00065 
00066     void disconnectDevice( Konnector *k );
00067 
00068   protected slots:
00069     void slotSynceesRead( KSync::Konnector * );
00070     void slotSynceeReadError( KSync::Konnector * );
00071     void slotSynceesWritten( KSync::Konnector * );
00072     void slotSynceeWriteError( KSync::Konnector * );
00073 
00074   signals:
00075     void error( const QString& );
00076     void doneSync();
00077 
00078   private:
00079     void doSync();
00080 
00081     Konnector::List mOpenedKonnectors;
00082     Konnector::List mProcessedKonnectors;
00083     uint mKonnectorCount;
00084 
00085     Konnector::List mKonnectors;
00086     KonnectorManager *mManager;
00087 
00088     Syncer mCalendarSyncer;
00089     Syncer mAddressBookSyncer;
00090 
00091     SyncUi *mSyncUi;
00092 };
00093 
00094 }
00095 
00096 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys