-rw-r--r-- | libkdepim/ksyncmanager.h | 93 |
1 files changed, 37 insertions, 56 deletions
diff --git a/libkdepim/ksyncmanager.h b/libkdepim/ksyncmanager.h index 7027894..1f7c7e7 100644 --- a/libkdepim/ksyncmanager.h +++ b/libkdepim/ksyncmanager.h @@ -1,28 +1,28 @@ /* - This file is part of KDE-Pim/Pi. - Copyright (c) 2004 Ulf Schenk + This file is part of KDE-Pim/Pi. + Copyright (c) 2004 Ulf Schenk - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. -$Id$ + $Id$ */ #ifndef _KSYNCMANAGER_H #define _KSYNCMANAGER_H #include <qobject.h> #include <qstring.h> #include <qsocket.h> #include <qdatetime.h> @@ -38,28 +38,27 @@ class KSyncManager; class KSyncInterface; class QProgressBar; class KServerSocket : public QServerSocket { Q_OBJECT -public: + public: KServerSocket ( QString password, Q_UINT16 port, int backlog = 0, QObject * parent=0, const char * name=0 ); void newConnection ( int socket ) ; void setFileName( QString fn ) {mFileName = fn;}; - -signals: + signals: void file_received( bool ); void request_file(); void saveFile(); void endConnect(); -private slots: + private slots: void discardClient(); void readClient(); void readBackFileFromSocket(); private : bool blockRC; void send_file(); void get_file(); void end_connect(); @@ -69,27 +68,26 @@ private slots: QString mFileName; QTime piTime; QString piFileString; }; class KCommandSocket : public QObject { Q_OBJECT -public: + public: enum state { successR, errorR, successW, errorW, errorTO, quiet }; KCommandSocket ( QString password, Q_UINT16 port, QString host, QObject * parent=0, const char * name=0 ); void readFile( QString ); void writeFile( QString ); void sendStop(); - - -signals: + + signals: void commandFinished( KCommandSocket*, int ); -private slots: + private slots: void startReadFileFromSocket(); void readFileFromSocket(); void deleteSocket(); void writeFileToSocket(); private : QSocket* mSocket; QString mPassWord; Q_UINT16 mPort; @@ -100,127 +98,110 @@ private slots: QTime mTime; QString mFileString; bool mFirst; }; class KSyncManager : public QObject { - Q_OBJECT + Q_OBJECT - public: + public: enum TargetApp { - KOPI = 0, - KAPI = 1, - PWMPI = 2 }; - + KOPI = 0, + KAPI = 1, + PWMPI = 2 }; KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu); ~KSyncManager() ; void multiSync( bool askforPrefs ); bool blockSave() { return mBlockSaveFlag; } void setBlockSave(bool sa) { mBlockSaveFlag = sa; } void setDefaultFileName( QString s) { mDefFileName = s ;} QString defaultFileName() { return mDefFileName ;} QString syncFileName(); - void fillSyncMenu(); QString getCurrentSyncDevice() { return mCurrentSyncDevice; } QString getCurrentSyncName() { return mCurrentSyncName; } void showProgressBar(int percentage, QString caption = QString::null, int total=100); void hideProgressBar(); bool isProgressBarCanceled(); - // sync stuff + // sync stuff QString mLocalMachineName; QStringList mExternSyncProfiles; QStringList mSyncProfileNames; bool mAskForPreferences; bool mShowSyncSummary; - bool mShowSyncEvents; - bool mShowTodoInAgenda; bool mWriteBackExistingOnly; int mSyncAlgoPrefs; - int mRingSyncAlgoPrefs; bool mWriteBackFile; int mWriteBackInFuture; QString mPhoneDevice; QString mPhoneConnection; QString mPhoneModel; QString mPassWordPiSync; QString mActiveSyncPort; QString mActiveSyncIP ; signals: void save(); void request_file(); void getFile( bool ); - public slots: + public slots: void slotSyncMenu( int ); void deleteCommandSocket(KCommandSocket*s, int state); void readFileFromSocket(); + void fillSyncMenu(); private: - // LR ******************************* - // sync stuff! void syncPi(); KServerSocket * mServerSocket; void enableQuick(); KPimPrefs* mPrefs; QString mDefFileName; QString mCurrentSyncDevice; QString mCurrentSyncName; void quickSyncLocalFile(); - bool syncWithFile( QString fn , bool quick ); + bool syncWithFile( QString fn , bool quick ); void syncLocalFile(); void syncPhone(); void syncSharp(); bool syncExternalApplication(QString); int mCurrentSyncProfile ; void syncRemote( KSyncProfile* prof, bool ask = true); void edit_sync_options(); int ringSync(); QString getPassword( ); - private slots: + private slots: void confSync(); - // ********************* - private: bool mBlockSaveFlag; - - QWidget* mParent; KSyncInterface* mImplementation; TargetApp mTargetApp; QPopupMenu* mSyncMenu; - QProgressBar* bar; - - - - }; class KSyncInterface { - - public : virtual bool sync(KSyncManager* manager, QString filename, int mode) = 0; - virtual bool syncExternal(KSyncManager* manager, QString resource) - { - // empty implementation, because some syncable applications do not have an external(sharpdtm) syncmode, like pwmanager. - return false; - } + { + // empty implementation, because some syncable applications do not + // have an external(sharpdtm) syncmode, like pwmanager. + return false; + } }; #endif |