author | zautrix <zautrix> | 2004-10-07 19:42:44 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-07 19:42:44 (UTC) |
commit | 0a661f5800b86df385cc23f4c9a8324bd0b50a5c (patch) (unidiff) | |
tree | fcc17cfad0ffd022a4b92974bc53d39ba3f650de | |
parent | 1f1538e5707b59bfcff2014901f29a65589229e3 (diff) | |
download | kdepimpi-0a661f5800b86df385cc23f4c9a8324bd0b50a5c.zip kdepimpi-0a661f5800b86df385cc23f4c9a8324bd0b50a5c.tar.gz kdepimpi-0a661f5800b86df385cc23f4c9a8324bd0b50a5c.tar.bz2 |
sync fix
-rw-r--r-- | libkdepim/ksyncmanager.cpp | 126 | ||||
-rw-r--r-- | libkdepim/ksyncmanager.h | 93 |
2 files changed, 100 insertions, 119 deletions
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp index 568c2a9..01309d5 100644 --- a/libkdepim/ksyncmanager.cpp +++ b/libkdepim/ksyncmanager.cpp | |||
@@ -1,24 +1,24 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KDE-Pim/Pi. | 2 | This file is part of KDE-Pim/Pi. |
3 | Copyright (c) 2004 Ulf Schenk | 3 | Copyright (c) 2004 Ulf Schenk |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | // $Id$ | 21 | // $Id$ |
22 | 22 | ||
23 | #include "ksyncmanager.h" | 23 | #include "ksyncmanager.h" |
24 | 24 | ||
@@ -70,13 +70,13 @@ KSyncManager::KSyncManager(QWidget* parent, KSyncInterface* implementation, Targ | |||
70 | bar->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 70 | bar->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
71 | 71 | ||
72 | } | 72 | } |
73 | 73 | ||
74 | KSyncManager::~KSyncManager() | 74 | KSyncManager::~KSyncManager() |
75 | { | 75 | { |
76 | delete bar; | 76 | delete bar; |
77 | } | 77 | } |
78 | 78 | ||
79 | 79 | ||
80 | void KSyncManager::fillSyncMenu() | 80 | void KSyncManager::fillSyncMenu() |
81 | { | 81 | { |
82 | if ( mSyncMenu->count() ) | 82 | if ( mSyncMenu->count() ) |
@@ -162,13 +162,13 @@ void KSyncManager::slotSyncMenu( int action ) | |||
162 | mServerSocket = 0; | 162 | mServerSocket = 0; |
163 | QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); | 163 | QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); |
164 | return; | 164 | return; |
165 | } | 165 | } |
166 | 166 | ||
167 | if (blockSave()) | 167 | if (blockSave()) |
168 | return; | 168 | return; |
169 | 169 | ||
170 | setBlockSave(true); | 170 | setBlockSave(true); |
171 | 171 | ||
172 | mCurrentSyncProfile = action - 1000 ; | 172 | mCurrentSyncProfile = action - 1000 ; |
173 | mCurrentSyncDevice = mSyncProfileNames[mCurrentSyncProfile] ; | 173 | mCurrentSyncDevice = mSyncProfileNames[mCurrentSyncProfile] ; |
174 | mCurrentSyncName = mLocalMachineName ; | 174 | mCurrentSyncName = mLocalMachineName ; |
@@ -297,28 +297,28 @@ void KSyncManager::enableQuick() | |||
297 | void KSyncManager::syncLocalFile() | 297 | void KSyncManager::syncLocalFile() |
298 | { | 298 | { |
299 | 299 | ||
300 | QString fn =mPrefs->mLastSyncedLocalFile; | 300 | QString fn =mPrefs->mLastSyncedLocalFile; |
301 | QString ext; | 301 | QString ext; |
302 | 302 | ||
303 | switch(mTargetApp) | 303 | switch(mTargetApp) |
304 | { | 304 | { |
305 | case (KAPI): | 305 | case (KAPI): |
306 | ext = "(*.vcf)"; | 306 | ext = "(*.vcf)"; |
307 | break; | 307 | break; |
308 | case (KOPI): | 308 | case (KOPI): |
309 | ext = "(*.ics/*.vcs)"; | 309 | ext = "(*.ics/*.vcs)"; |
310 | break; | 310 | break; |
311 | case (PWMPI): | 311 | case (PWMPI): |
312 | ext = "(*.pwm)"; | 312 | ext = "(*.pwm)"; |
313 | break; | 313 | break; |
314 | default: | 314 | default: |
315 | qDebug("KSyncManager::syncLocalFile: invalid apptype selected"); | 315 | qDebug("KSyncManager::syncLocalFile: invalid apptype selected"); |
316 | break; | 316 | break; |
317 | 317 | ||
318 | } | 318 | } |
319 | 319 | ||
320 | fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename"+ext), mParent ); | 320 | fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename"+ext), mParent ); |
321 | if ( fn == "" ) | 321 | if ( fn == "" ) |
322 | return; | 322 | return; |
323 | if ( syncWithFile( fn, false ) ) { | 323 | if ( syncWithFile( fn, false ) ) { |
324 | qDebug("syncLocalFile() successful "); | 324 | qDebug("syncLocalFile() successful "); |
@@ -387,13 +387,13 @@ void KSyncManager::multiSync( bool askforPrefs ) | |||
387 | return; | 387 | return; |
388 | } | 388 | } |
389 | mCurrentSyncDevice = i18n("Multiple profiles") ; | 389 | mCurrentSyncDevice = i18n("Multiple profiles") ; |
390 | mSyncAlgoPrefs = mPrefs->mRingSyncAlgoPrefs; | 390 | mSyncAlgoPrefs = mPrefs->mRingSyncAlgoPrefs; |
391 | if ( askforPrefs ) { | 391 | if ( askforPrefs ) { |
392 | edit_sync_options(); | 392 | edit_sync_options(); |
393 | mRingSyncAlgoPrefs = mSyncAlgoPrefs; | 393 | mPrefs->mRingSyncAlgoPrefs = mSyncAlgoPrefs; |
394 | } | 394 | } |
395 | mParent->topLevelWidget()->setCaption(i18n("Multiple sync started.") ); | 395 | mParent->topLevelWidget()->setCaption(i18n("Multiple sync started.") ); |
396 | qApp->processEvents(); | 396 | qApp->processEvents(); |
397 | int num = ringSync() ; | 397 | int num = ringSync() ; |
398 | if ( num > 1 ) | 398 | if ( num > 1 ) |
399 | ringSync(); | 399 | ringSync(); |
@@ -517,18 +517,18 @@ int KSyncManager::ringSync() | |||
517 | } | 517 | } |
518 | 518 | ||
519 | void KSyncManager::syncRemote( KSyncProfile* prof, bool ask) | 519 | void KSyncManager::syncRemote( KSyncProfile* prof, bool ask) |
520 | { | 520 | { |
521 | QString question; | 521 | QString question; |
522 | if ( ask ) { | 522 | if ( ask ) { |
523 | question = i18n("Do you really want\nto remote sync\nwith profile \n")+ prof->getName()+" ?\n"; | 523 | question = i18n("Do you really want\nto remote sync\nwith profile \n")+ prof->getName()+" ?\n"; |
524 | if ( QMessageBox::information( mParent, i18n("Sync"), | 524 | if ( QMessageBox::information( mParent, i18n("Sync"), |
525 | question, | 525 | question, |
526 | i18n("Yes"), i18n("No"), | 526 | i18n("Yes"), i18n("No"), |
527 | 0, 0 ) != 0 ) | 527 | 0, 0 ) != 0 ) |
528 | return; | 528 | return; |
529 | } | 529 | } |
530 | 530 | ||
531 | QString preCommand; | 531 | QString preCommand; |
532 | QString localTempFile; | 532 | QString localTempFile; |
533 | QString postCommand; | 533 | QString postCommand; |
534 | 534 | ||
@@ -736,31 +736,31 @@ void KSyncManager::syncPhone() | |||
736 | syncExternalApplication("phone"); | 736 | syncExternalApplication("phone"); |
737 | 737 | ||
738 | } | 738 | } |
739 | 739 | ||
740 | void KSyncManager::showProgressBar(int percentage, QString caption, int total) | 740 | void KSyncManager::showProgressBar(int percentage, QString caption, int total) |
741 | { | 741 | { |
742 | if (!bar->isVisible()) | 742 | if (!bar->isVisible()) |
743 | { | 743 | { |
744 | bar->setCaption (caption); | 744 | bar->setCaption (caption); |
745 | bar->setTotalSteps ( total ) ; | 745 | bar->setTotalSteps ( total ) ; |
746 | 746 | ||
747 | bar->show(); | 747 | bar->show(); |
748 | } | 748 | } |
749 | 749 | ||
750 | bar->setProgress( percentage ); | 750 | bar->setProgress( percentage ); |
751 | } | 751 | } |
752 | 752 | ||
753 | void KSyncManager::hideProgressBar() | 753 | void KSyncManager::hideProgressBar() |
754 | { | 754 | { |
755 | bar->hide(); | 755 | bar->hide(); |
756 | } | 756 | } |
757 | 757 | ||
758 | bool KSyncManager::isProgressBarCanceled() | 758 | bool KSyncManager::isProgressBarCanceled() |
759 | { | 759 | { |
760 | return !bar->isVisible(); | 760 | return !bar->isVisible(); |
761 | } | 761 | } |
762 | 762 | ||
763 | QString KSyncManager::syncFileName() | 763 | QString KSyncManager::syncFileName() |
764 | { | 764 | { |
765 | 765 | ||
766 | QString fn = "tempfile"; | 766 | QString fn = "tempfile"; |
@@ -804,29 +804,29 @@ void KSyncManager::syncPi() | |||
804 | void KSyncManager::deleteCommandSocket(KCommandSocket*s, int state) | 804 | void KSyncManager::deleteCommandSocket(KCommandSocket*s, int state) |
805 | { | 805 | { |
806 | qDebug("MainWindow::deleteCommandSocket %d", state); | 806 | qDebug("MainWindow::deleteCommandSocket %d", state); |
807 | 807 | ||
808 | //enum { success, errorW, errorR, quiet }; | 808 | //enum { success, errorW, errorR, quiet }; |
809 | if ( state == KCommandSocket::errorR ||state == KCommandSocket::errorTO ) { | 809 | if ( state == KCommandSocket::errorR ||state == KCommandSocket::errorTO ) { |
810 | mParent->topLevelWidget()->setCaption( i18n("ERROR: Receiving remote file failed.") ); | 810 | mParent->topLevelWidget()->setCaption( i18n("ERROR: Receiving remote file failed.") ); |
811 | delete s; | 811 | delete s; |
812 | if ( state == KCommandSocket::errorR ) { | 812 | if ( state == KCommandSocket::errorR ) { |
813 | KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this ); | 813 | KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this ); |
814 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); | 814 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); |
815 | commandSocket->sendStop(); | 815 | commandSocket->sendStop(); |
816 | } | 816 | } |
817 | return; | 817 | return; |
818 | 818 | ||
819 | } else if ( state == KCommandSocket::errorW ) { | 819 | } else if ( state == KCommandSocket::errorW ) { |
820 | mParent->topLevelWidget()->setCaption( i18n("ERROR:Writing back file failed.") ); | 820 | mParent->topLevelWidget()->setCaption( i18n("ERROR:Writing back file failed.") ); |
821 | 821 | ||
822 | } else if ( state == KCommandSocket::successR ) { | 822 | } else if ( state == KCommandSocket::successR ) { |
823 | QTimer::singleShot( 1, this , SLOT ( readFileFromSocket())); | 823 | QTimer::singleShot( 1, this , SLOT ( readFileFromSocket())); |
824 | 824 | ||
825 | } else if ( state == KCommandSocket::successW ) { | 825 | } else if ( state == KCommandSocket::successW ) { |
826 | mParent->topLevelWidget()->setCaption( i18n("Pi-Sync succesful!") ); | 826 | mParent->topLevelWidget()->setCaption( i18n("Pi-Sync succesful!") ); |
827 | } | 827 | } |
828 | 828 | ||
829 | delete s; | 829 | delete s; |
830 | } | 830 | } |
831 | 831 | ||
832 | void KSyncManager::readFileFromSocket() | 832 | void KSyncManager::readFileFromSocket() |
@@ -1153,21 +1153,21 @@ void KCommandSocket::readFileFromSocket() | |||
1153 | deleteSocket(); | 1153 | deleteSocket(); |
1154 | } | 1154 | } |
1155 | 1155 | ||
1156 | void KCommandSocket::deleteSocket() | 1156 | void KCommandSocket::deleteSocket() |
1157 | { | 1157 | { |
1158 | if ( mTimerSocket->isActive () ) { | 1158 | if ( mTimerSocket->isActive () ) { |
1159 | mTimerSocket->stop(); | 1159 | mTimerSocket->stop(); |
1160 | KMessageBox::information( 0, i18n("ERROR:\nConnection to remote host timed out!\nDid you forgot to enable\nsyncing on remote host? ")); | 1160 | KMessageBox::information( 0, i18n("ERROR:\nConnection to remote host timed out!\nDid you forgot to enable\nsyncing on remote host? ")); |
1161 | mRetVal = errorTO; | 1161 | mRetVal = errorTO; |
1162 | if ( mSocket ) { | 1162 | if ( mSocket ) { |
1163 | mSocket->close(); | 1163 | mSocket->close(); |
1164 | if ( mSocket->state() == QSocket::Idle ) | 1164 | if ( mSocket->state() == QSocket::Idle ) |
1165 | deleteSocket(); | 1165 | deleteSocket(); |
1166 | return; | 1166 | return; |
1167 | } | 1167 | } |
1168 | } | 1168 | } |
1169 | //qDebug("KCommandSocket::deleteSocket() %d", mRetVal ); | 1169 | //qDebug("KCommandSocket::deleteSocket() %d", mRetVal ); |
1170 | if ( mSocket) | 1170 | if ( mSocket) |
1171 | delete mSocket; | 1171 | delete mSocket; |
1172 | mSocket = 0; | 1172 | mSocket = 0; |
1173 | emit commandFinished( this, mRetVal ); | 1173 | emit commandFinished( this, mRetVal ); |
diff --git a/libkdepim/ksyncmanager.h b/libkdepim/ksyncmanager.h index 7027894..1f7c7e7 100644 --- a/libkdepim/ksyncmanager.h +++ b/libkdepim/ksyncmanager.h | |||
@@ -1,26 +1,26 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KDE-Pim/Pi. | 2 | This file is part of KDE-Pim/Pi. |
3 | Copyright (c) 2004 Ulf Schenk | 3 | Copyright (c) 2004 Ulf Schenk |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | 19 | ||
20 | $Id$ | 20 | $Id$ |
21 | */ | 21 | */ |
22 | #ifndef _KSYNCMANAGER_H | 22 | #ifndef _KSYNCMANAGER_H |
23 | #define _KSYNCMANAGER_H | 23 | #define _KSYNCMANAGER_H |
24 | 24 | ||
25 | #include <qobject.h> | 25 | #include <qobject.h> |
26 | #include <qstring.h> | 26 | #include <qstring.h> |
@@ -40,24 +40,23 @@ class QProgressBar; | |||
40 | 40 | ||
41 | 41 | ||
42 | class KServerSocket : public QServerSocket | 42 | class KServerSocket : public QServerSocket |
43 | { | 43 | { |
44 | Q_OBJECT | 44 | Q_OBJECT |
45 | 45 | ||
46 | public: | 46 | public: |
47 | KServerSocket ( QString password, Q_UINT16 port, int backlog = 0, QObject * parent=0, const char * name=0 ); | 47 | KServerSocket ( QString password, Q_UINT16 port, int backlog = 0, QObject * parent=0, const char * name=0 ); |
48 | 48 | ||
49 | void newConnection ( int socket ) ; | 49 | void newConnection ( int socket ) ; |
50 | void setFileName( QString fn ) {mFileName = fn;}; | 50 | void setFileName( QString fn ) {mFileName = fn;}; |
51 | 51 | signals: | |
52 | signals: | ||
53 | void file_received( bool ); | 52 | void file_received( bool ); |
54 | void request_file(); | 53 | void request_file(); |
55 | void saveFile(); | 54 | void saveFile(); |
56 | void endConnect(); | 55 | void endConnect(); |
57 | private slots: | 56 | private slots: |
58 | void discardClient(); | 57 | void discardClient(); |
59 | void readClient(); | 58 | void readClient(); |
60 | void readBackFileFromSocket(); | 59 | void readBackFileFromSocket(); |
61 | private : | 60 | private : |
62 | bool blockRC; | 61 | bool blockRC; |
63 | void send_file(); | 62 | void send_file(); |
@@ -71,23 +70,22 @@ private slots: | |||
71 | QString piFileString; | 70 | QString piFileString; |
72 | }; | 71 | }; |
73 | 72 | ||
74 | class KCommandSocket : public QObject | 73 | class KCommandSocket : public QObject |
75 | { | 74 | { |
76 | Q_OBJECT | 75 | Q_OBJECT |
77 | public: | 76 | public: |
78 | enum state { successR, errorR, successW, errorW, errorTO, quiet }; | 77 | enum state { successR, errorR, successW, errorW, errorTO, quiet }; |
79 | KCommandSocket ( QString password, Q_UINT16 port, QString host, QObject * parent=0, const char * name=0 ); | 78 | KCommandSocket ( QString password, Q_UINT16 port, QString host, QObject * parent=0, const char * name=0 ); |
80 | void readFile( QString ); | 79 | void readFile( QString ); |
81 | void writeFile( QString ); | 80 | void writeFile( QString ); |
82 | void sendStop(); | 81 | void sendStop(); |
83 | 82 | ||
84 | 83 | signals: | |
85 | signals: | ||
86 | void commandFinished( KCommandSocket*, int ); | 84 | void commandFinished( KCommandSocket*, int ); |
87 | private slots: | 85 | private slots: |
88 | void startReadFileFromSocket(); | 86 | void startReadFileFromSocket(); |
89 | void readFileFromSocket(); | 87 | void readFileFromSocket(); |
90 | void deleteSocket(); | 88 | void deleteSocket(); |
91 | void writeFileToSocket(); | 89 | void writeFileToSocket(); |
92 | private : | 90 | private : |
93 | QSocket* mSocket; | 91 | QSocket* mSocket; |
@@ -102,50 +100,45 @@ private slots: | |||
102 | bool mFirst; | 100 | bool mFirst; |
103 | }; | 101 | }; |
104 | 102 | ||
105 | 103 | ||
106 | class KSyncManager : public QObject | 104 | class KSyncManager : public QObject |
107 | { | 105 | { |
108 | Q_OBJECT | 106 | Q_OBJECT |
109 | 107 | ||
110 | public: | 108 | public: |
111 | enum TargetApp { | 109 | enum TargetApp { |
112 | KOPI = 0, | 110 | KOPI = 0, |
113 | KAPI = 1, | 111 | KAPI = 1, |
114 | PWMPI = 2 }; | 112 | PWMPI = 2 }; |
115 | |||
116 | 113 | ||
117 | KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu); | 114 | KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu); |
118 | ~KSyncManager() ; | 115 | ~KSyncManager() ; |
119 | 116 | ||
120 | void multiSync( bool askforPrefs ); | 117 | void multiSync( bool askforPrefs ); |
121 | bool blockSave() { return mBlockSaveFlag; } | 118 | bool blockSave() { return mBlockSaveFlag; } |
122 | void setBlockSave(bool sa) { mBlockSaveFlag = sa; } | 119 | void setBlockSave(bool sa) { mBlockSaveFlag = sa; } |
123 | void setDefaultFileName( QString s) { mDefFileName = s ;} | 120 | void setDefaultFileName( QString s) { mDefFileName = s ;} |
124 | QString defaultFileName() { return mDefFileName ;} | 121 | QString defaultFileName() { return mDefFileName ;} |
125 | QString syncFileName(); | 122 | QString syncFileName(); |
126 | void fillSyncMenu(); | ||
127 | 123 | ||
128 | QString getCurrentSyncDevice() { return mCurrentSyncDevice; } | 124 | QString getCurrentSyncDevice() { return mCurrentSyncDevice; } |
129 | QString getCurrentSyncName() { return mCurrentSyncName; } | 125 | QString getCurrentSyncName() { return mCurrentSyncName; } |
130 | 126 | ||
131 | void showProgressBar(int percentage, QString caption = QString::null, int total=100); | 127 | void showProgressBar(int percentage, QString caption = QString::null, int total=100); |
132 | void hideProgressBar(); | 128 | void hideProgressBar(); |
133 | bool isProgressBarCanceled(); | 129 | bool isProgressBarCanceled(); |
134 | 130 | ||
135 | // sync stuff | 131 | // sync stuff |
136 | QString mLocalMachineName; | 132 | QString mLocalMachineName; |
137 | QStringList mExternSyncProfiles; | 133 | QStringList mExternSyncProfiles; |
138 | QStringList mSyncProfileNames; | 134 | QStringList mSyncProfileNames; |
139 | bool mAskForPreferences; | 135 | bool mAskForPreferences; |
140 | bool mShowSyncSummary; | 136 | bool mShowSyncSummary; |
141 | bool mShowSyncEvents; | ||
142 | bool mShowTodoInAgenda; | ||
143 | bool mWriteBackExistingOnly; | 137 | bool mWriteBackExistingOnly; |
144 | int mSyncAlgoPrefs; | 138 | int mSyncAlgoPrefs; |
145 | int mRingSyncAlgoPrefs; | ||
146 | bool mWriteBackFile; | 139 | bool mWriteBackFile; |
147 | int mWriteBackInFuture; | 140 | int mWriteBackInFuture; |
148 | QString mPhoneDevice; | 141 | QString mPhoneDevice; |
149 | QString mPhoneConnection; | 142 | QString mPhoneConnection; |
150 | QString mPhoneModel; | 143 | QString mPhoneModel; |
151 | QString mPassWordPiSync; | 144 | QString mPassWordPiSync; |
@@ -154,73 +147,61 @@ class KSyncManager : public QObject | |||
154 | 147 | ||
155 | signals: | 148 | signals: |
156 | void save(); | 149 | void save(); |
157 | void request_file(); | 150 | void request_file(); |
158 | void getFile( bool ); | 151 | void getFile( bool ); |
159 | 152 | ||
160 | public slots: | 153 | public slots: |
161 | void slotSyncMenu( int ); | 154 | void slotSyncMenu( int ); |
162 | void deleteCommandSocket(KCommandSocket*s, int state); | 155 | void deleteCommandSocket(KCommandSocket*s, int state); |
163 | void readFileFromSocket(); | 156 | void readFileFromSocket(); |
157 | void fillSyncMenu(); | ||
164 | 158 | ||
165 | private: | 159 | private: |
166 | // LR ******************************* | ||
167 | // sync stuff! | ||
168 | void syncPi(); | 160 | void syncPi(); |
169 | KServerSocket * mServerSocket; | 161 | KServerSocket * mServerSocket; |
170 | void enableQuick(); | 162 | void enableQuick(); |
171 | KPimPrefs* mPrefs; | 163 | KPimPrefs* mPrefs; |
172 | QString mDefFileName; | 164 | QString mDefFileName; |
173 | QString mCurrentSyncDevice; | 165 | QString mCurrentSyncDevice; |
174 | QString mCurrentSyncName; | 166 | QString mCurrentSyncName; |
175 | void quickSyncLocalFile(); | 167 | void quickSyncLocalFile(); |
176 | bool syncWithFile( QString fn , bool quick ); | 168 | bool syncWithFile( QString fn , bool quick ); |
177 | void syncLocalFile(); | 169 | void syncLocalFile(); |
178 | void syncPhone(); | 170 | void syncPhone(); |
179 | void syncSharp(); | 171 | void syncSharp(); |
180 | bool syncExternalApplication(QString); | 172 | bool syncExternalApplication(QString); |
181 | int mCurrentSyncProfile ; | 173 | int mCurrentSyncProfile ; |
182 | void syncRemote( KSyncProfile* prof, bool ask = true); | 174 | void syncRemote( KSyncProfile* prof, bool ask = true); |
183 | void edit_sync_options(); | 175 | void edit_sync_options(); |
184 | int ringSync(); | 176 | int ringSync(); |
185 | QString getPassword( ); | 177 | QString getPassword( ); |
186 | 178 | ||
187 | private slots: | 179 | private slots: |
188 | void confSync(); | 180 | void confSync(); |
189 | // ********************* | ||
190 | |||
191 | private: | 181 | private: |
192 | bool mBlockSaveFlag; | 182 | bool mBlockSaveFlag; |
193 | |||
194 | |||
195 | QWidget* mParent; | 183 | QWidget* mParent; |
196 | KSyncInterface* mImplementation; | 184 | KSyncInterface* mImplementation; |
197 | TargetApp mTargetApp; | 185 | TargetApp mTargetApp; |
198 | QPopupMenu* mSyncMenu; | 186 | QPopupMenu* mSyncMenu; |
199 | |||
200 | QProgressBar* bar; | 187 | QProgressBar* bar; |
201 | 188 | ||
202 | |||
203 | |||
204 | |||
205 | |||
206 | }; | 189 | }; |
207 | 190 | ||
208 | 191 | ||
209 | class KSyncInterface | 192 | class KSyncInterface |
210 | { | 193 | { |
211 | |||
212 | |||
213 | public : | 194 | public : |
214 | virtual bool sync(KSyncManager* manager, QString filename, int mode) = 0; | 195 | virtual bool sync(KSyncManager* manager, QString filename, int mode) = 0; |
215 | |||
216 | virtual bool syncExternal(KSyncManager* manager, QString resource) | 196 | virtual bool syncExternal(KSyncManager* manager, QString resource) |
217 | { | 197 | { |
218 | // empty implementation, because some syncable applications do not have an external(sharpdtm) syncmode, like pwmanager. | 198 | // empty implementation, because some syncable applications do not |
219 | return false; | 199 | // have an external(sharpdtm) syncmode, like pwmanager. |
220 | } | 200 | return false; |
201 | } | ||
221 | 202 | ||
222 | 203 | ||
223 | }; | 204 | }; |
224 | 205 | ||
225 | 206 | ||
226 | #endif | 207 | #endif |