author | zautrix <zautrix> | 2004-10-07 07:28:54 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-07 07:28:54 (UTC) |
commit | 77280f6a176a15b60004f312e6cacdfbbd3909c1 (patch) (side-by-side diff) | |
tree | e074d4abedc2f4cc575e5655575e038b9d460106 /libkdepim/ksyncmanager.h | |
parent | f1eb5b74c962909851607c4b4cb05ee18a347d37 (diff) | |
download | kdepimpi-77280f6a176a15b60004f312e6cacdfbbd3909c1.zip kdepimpi-77280f6a176a15b60004f312e6cacdfbbd3909c1.tar.gz kdepimpi-77280f6a176a15b60004f312e6cacdfbbd3909c1.tar.bz2 |
sync changes
-rw-r--r-- | libkdepim/ksyncmanager.h | 107 |
1 files changed, 94 insertions, 13 deletions
diff --git a/libkdepim/ksyncmanager.h b/libkdepim/ksyncmanager.h index 6b10016..52e2772 100644 --- a/libkdepim/ksyncmanager.h +++ b/libkdepim/ksyncmanager.h @@ -11,93 +11,179 @@ 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. $Id$ */ #ifndef _KSYNCMANAGER_H #define _KSYNCMANAGER_H #include <qobject.h> #include <qstring.h> +#include <qsocket.h> +#include <qdatetime.h> +#include <qserversocket.h> +#include <qtextstream.h> +#include <qregexp.h> class QPopupMenu; class KSyncProfile; class KPimPrefs; class QWidget; class KSyncManager; class KSyncInterface; class QProgressBar; + +class KServerSocket : public QServerSocket +{ + Q_OBJECT + +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: + //void sendFile(QSocket*); + //void getFile(QSocket*); + void file_received( bool ); + //void file_sent(); + void saveFile(); + void endConnect(); +private slots: + void discardClient(); + void readClient(); + void readBackFileFromSocket(); + private : + bool blockRC; + void send_file(); + void get_file(); + void end_connect(); + QDialog* mSyncActionDialog; + QSocket* mSocket; + QString mPassWord; + QString mFileName; + QTime piTime; + QString piFileString; +}; + +class KCommandSocket : public QObject +{ + Q_OBJECT +public: + enum state { successR, errorR, successW, errorW, 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: + void commandFinished( KCommandSocket*, int ); +private slots: + void startReadFileFromSocket(); + void readFileFromSocket(); + void deleteSocket(); + void writeFileToSocket(); + private : + QSocket* mSocket; + QString mPassWord; + Q_UINT16 mPort; + QString mHost; + QString mFileName; + QTimer* mTimerSocket; + int mRetVal; + QTime mTime; + QString mFileString; + bool mFirst; +}; + + class KSyncManager : public QObject { Q_OBJECT public: enum TargetApp { KOPI = 0, KAPI = 1, PWMPI = 2 }; KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu); ~KSyncManager() ; 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 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 mLastSyncedLocalFile; // save! + QString mPassWordPiSync; + QString mActiveSyncPort; + QString mActiveSyncIP ; - + signals: + void save(); + void getFile( bool ); public slots: void slotSyncMenu( int ); private: // LR ******************************* // sync stuff! + void syncPi(); + void deleteCommandSocket(KCommandSocket*s, int state); + void readFileFromSocket(); + KServerSocket * mServerSocket; + void enableQuick(); + KPimPrefs* mPrefs; + QString mDefFileName; QString mCurrentSyncDevice; QString mCurrentSyncName; void quickSyncLocalFile(); bool syncWithFile( QString fn , bool quick ); void syncLocalFile(); void syncPhone(); void syncSharp(); bool syncExternalApplication(QString); void multiSync( bool askforPrefs ); int mCurrentSyncProfile ; void syncRemote( KSyncProfile* prof, bool ask = true); void edit_sync_options(); int ringSync(); QString getPassword( ); private slots: @@ -109,39 +195,34 @@ class KSyncManager : public QObject QWidget* mParent; KSyncInterface* mImplementation; TargetApp mTargetApp; QPopupMenu* mSyncMenu; QProgressBar* bar; }; -class KSyncInterface -{ - public: +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; } - //called by the syncmanager to indicate that the work has to be marked as dirty. - virtual void sync_setModified() = 0; - - //called by the syncmanager to ask if the dirty flag is set. - virtual bool sync_isModified() = 0; - - //called by the syncmanager to indicate that the work has to be saved. - virtual void sync_save() = 0; + }; #endif |