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 
00026 #include <qobject.h>
00027 #include <qptrlist.h>
00028 #include <kdepimmacros.h>
00029 
00030 namespace KSync {
00031 
00032 class ActionPart;
00033 
00040 class KDE_EXPORT Engine : public QObject
00041 {
00042    Q_OBJECT
00043   public:
00044     Engine( QPtrList<ActionPart> &parts );
00045     ~Engine();
00046 
00047     Konnector::List konnectors();
00048 
00063     void go();
00064 
00065   protected:
00066     void logMessage( const QString & );
00067 
00068     void tryExecuteActions();
00069     void executeActions();
00070 
00071     void tryFinish();
00072     void finish();
00073 
00074     void disconnectDevice( Konnector *k );
00075 
00076   protected slots:
00077     void slotSynceesRead( KSync::Konnector * );
00078     void slotSynceeReadError( KSync::Konnector * );
00079     void slotSynceesWritten( KSync::Konnector * );
00080     void slotSynceeWriteError( KSync::Konnector * );
00081 
00082   signals:
00083     void doneSync();
00084 
00085   private:
00086     QMap<QString,Konnector *> mKonnectorMap;
00087 
00088     Konnector::List mOpenedKonnectors;
00089     Konnector::List mProcessedKonnectors;
00090     uint mKonnectorCount;
00091 
00092     QPtrList<ActionPart> &mParts;
00093     Konnector::List mKonnectors;
00094 };
00095 
00096 }
00097 
00098 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys