-rw-r--r-- | libkdepim/kpimprefs.cpp | 2 | ||||
-rw-r--r-- | libkdepim/kpimprefs.h | 2 | ||||
-rw-r--r-- | libkdepim/ksyncmanager.cpp | 33 | ||||
-rw-r--r-- | libkdepim/ksyncmanager.h | 2 |
4 files changed, 36 insertions, 3 deletions
diff --git a/libkdepim/kpimprefs.cpp b/libkdepim/kpimprefs.cpp index c21ebaa..a05e65f 100644 --- a/libkdepim/kpimprefs.cpp +++ b/libkdepim/kpimprefs.cpp | |||
@@ -47,6 +47,8 @@ KPimPrefs::KPimPrefs( const QString &name ) : | |||
47 | addItemString("PassiveSyncPort",&mPassiveSyncPort,"9197" ); | 47 | addItemString("PassiveSyncPort",&mPassiveSyncPort,"9197" ); |
48 | addItemString("PassiveSyncPw",&mPassiveSyncPw,"abc" ); | 48 | addItemString("PassiveSyncPw",&mPassiveSyncPw,"abc" ); |
49 | addItemString("LastSyncedLocalFile", &mLastSyncedLocalFile ,hdp +"lastsync.ics" ); | 49 | addItemString("LastSyncedLocalFile", &mLastSyncedLocalFile ,hdp +"lastsync.ics" ); |
50 | addItemBool("PassiveSyncWithDesktop",&mPassiveSyncWithDesktop,false ); | ||
51 | addItemBool("PassiveSyncAutoStart",&mPassiveSyncAutoStart,false ); | ||
50 | addItemInt("RingSyncAlgoPrefs",&mRingSyncAlgoPrefs,3); | 52 | addItemInt("RingSyncAlgoPrefs",&mRingSyncAlgoPrefs,3); |
51 | } | 53 | } |
52 | 54 | ||
diff --git a/libkdepim/kpimprefs.h b/libkdepim/kpimprefs.h index 9346f7d..c177bd6 100644 --- a/libkdepim/kpimprefs.h +++ b/libkdepim/kpimprefs.h | |||
@@ -57,6 +57,8 @@ class KPimPrefs : public KPrefs | |||
57 | QStringList mCustomCategories; | 57 | QStringList mCustomCategories; |
58 | QString mPassiveSyncPort; | 58 | QString mPassiveSyncPort; |
59 | QString mPassiveSyncPw; | 59 | QString mPassiveSyncPw; |
60 | bool mPassiveSyncWithDesktop; | ||
61 | bool mPassiveSyncAutoStart; | ||
60 | int mRingSyncAlgoPrefs; | 62 | int mRingSyncAlgoPrefs; |
61 | QString mLastSyncedLocalFile; | 63 | QString mLastSyncedLocalFile; |
62 | 64 | ||
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp index 40d8e47..75c0b2b 100644 --- a/libkdepim/ksyncmanager.cpp +++ b/libkdepim/ksyncmanager.cpp | |||
@@ -48,6 +48,7 @@ | |||
48 | #include <qlayout.h> | 48 | #include <qlayout.h> |
49 | #include <qtextcodec.h> | 49 | #include <qtextcodec.h> |
50 | #include <qlabel.h> | 50 | #include <qlabel.h> |
51 | #include <qcheckbox.h> | ||
51 | 52 | ||
52 | #include <klocale.h> | 53 | #include <klocale.h> |
53 | #include <kglobal.h> | 54 | #include <kglobal.h> |
@@ -68,6 +69,8 @@ KSyncManager::KSyncManager(QWidget* parent, KSyncInterface* implementation, Targ | |||
68 | int dw = QApplication::desktop()->width(); | 69 | int dw = QApplication::desktop()->width(); |
69 | int dh = QApplication::desktop()->height(); | 70 | int dh = QApplication::desktop()->height(); |
70 | bar->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 71 | bar->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
72 | if ( mPrefs->mPassiveSyncAutoStart ) | ||
73 | enableQuick( false ); | ||
71 | 74 | ||
72 | } | 75 | } |
73 | 76 | ||
@@ -267,8 +270,10 @@ void KSyncManager::slotSyncMenu( int action ) | |||
267 | setBlockSave(false); | 270 | setBlockSave(false); |
268 | } | 271 | } |
269 | 272 | ||
270 | void KSyncManager::enableQuick() | 273 | void KSyncManager::enableQuick( bool ask ) |
271 | { | 274 | { |
275 | bool autoStart; | ||
276 | if ( ask ) { | ||
272 | QDialog dia ( 0, "input-dialog", true ); | 277 | QDialog dia ( 0, "input-dialog", true ); |
273 | QLineEdit lab ( &dia ); | 278 | QLineEdit lab ( &dia ); |
274 | QVBoxLayout lay( &dia ); | 279 | QVBoxLayout lay( &dia ); |
@@ -285,7 +290,23 @@ void KSyncManager::enableQuick() | |||
285 | QLabel label2 ( i18n("Password to enable\naccess from remote:"), &dia ); | 290 | QLabel label2 ( i18n("Password to enable\naccess from remote:"), &dia ); |
286 | lay.addWidget( &label2); | 291 | lay.addWidget( &label2); |
287 | lay.addWidget( &lepw); | 292 | lay.addWidget( &lepw); |
288 | dia.setFixedSize( 230,80 ); | 293 | QCheckBox autostart(i18n("Automatically start\nat application startup"), &dia ); |
294 | lay.addWidget( &autostart); | ||
295 | autostart.setChecked( mPrefs->mPassiveSyncAutoStart ); | ||
296 | #ifdef DESKTOP_VERSION | ||
297 | #ifdef _WIN32_ | ||
298 | QCheckBox syncdesktop( i18n("Automatically sync with Outlook\nwhen receiving sync request"),&dia ); | ||
299 | #else | ||
300 | QCheckBox syncdesktop( i18n("Automatically sync with KDE-Desktop\nwhen receiving sync request"),&dia ); | ||
301 | #endif | ||
302 | lay.addWidget( &syncdesktop); | ||
303 | #else | ||
304 | QCheckBox syncdesktop( i18n("Automatically sync\nwith KDE-Desktop"),&dia ); | ||
305 | syncdesktop.hide(); | ||
306 | #endif | ||
307 | syncdesktop.setChecked( mPrefs->mPassiveSyncWithDesktop ); | ||
308 | |||
309 | dia.setFixedSize( 230,120 ); | ||
289 | dia.setCaption( i18n("Enter port for Pi-Sync") ); | 310 | dia.setCaption( i18n("Enter port for Pi-Sync") ); |
290 | QPushButton pb ( "OK", &dia); | 311 | QPushButton pb ( "OK", &dia); |
291 | lay.addWidget( &pb ); | 312 | lay.addWidget( &pb ); |
@@ -297,7 +318,13 @@ void KSyncManager::enableQuick() | |||
297 | qApp->processEvents(); | 318 | qApp->processEvents(); |
298 | mPrefs->mPassiveSyncPw = lepw.text(); | 319 | mPrefs->mPassiveSyncPw = lepw.text(); |
299 | mPrefs->mPassiveSyncPort = lab.text(); | 320 | mPrefs->mPassiveSyncPort = lab.text(); |
321 | autoStart = autostart.isChecked(); | ||
322 | mPrefs->mPassiveSyncWithDesktop = syncdesktop.isChecked(); | ||
323 | } | ||
324 | else | ||
325 | autoStart = mPrefs->mPassiveSyncAutoStart; | ||
300 | bool ok; | 326 | bool ok; |
327 | mPrefs->mPassiveSyncAutoStart = false; | ||
301 | Q_UINT16 port = mPrefs->mPassiveSyncPort.toUInt(&ok); | 328 | Q_UINT16 port = mPrefs->mPassiveSyncPort.toUInt(&ok); |
302 | if ( ! ok ) { | 329 | if ( ! ok ) { |
303 | KMessageBox::information( 0, i18n("No valid port")); | 330 | KMessageBox::information( 0, i18n("No valid port")); |
@@ -313,6 +340,8 @@ void KSyncManager::enableQuick() | |||
313 | mServerSocket = 0; | 340 | mServerSocket = 0; |
314 | return; | 341 | return; |
315 | } | 342 | } |
343 | |||
344 | mPrefs->mPassiveSyncAutoStart = autoStart; | ||
316 | connect( mServerSocket, SIGNAL ( request_file() ),this, SIGNAL ( request_file() ) ); | 345 | connect( mServerSocket, SIGNAL ( request_file() ),this, SIGNAL ( request_file() ) ); |
317 | connect( mServerSocket, SIGNAL ( file_received( bool ) ), this, SIGNAL ( getFile( bool ) ) ); | 346 | connect( mServerSocket, SIGNAL ( file_received( bool ) ), this, SIGNAL ( getFile( bool ) ) ); |
318 | } | 347 | } |
diff --git a/libkdepim/ksyncmanager.h b/libkdepim/ksyncmanager.h index ffb1ea4..7b9c499 100644 --- a/libkdepim/ksyncmanager.h +++ b/libkdepim/ksyncmanager.h | |||
@@ -120,6 +120,7 @@ class KSyncManager : public QObject | |||
120 | void setDefaultFileName( QString s) { mDefFileName = s ;} | 120 | void setDefaultFileName( QString s) { mDefFileName = s ;} |
121 | QString defaultFileName() { return mDefFileName ;} | 121 | QString defaultFileName() { return mDefFileName ;} |
122 | QString syncFileName(); | 122 | QString syncFileName(); |
123 | void enableQuick( bool ask = true); | ||
123 | 124 | ||
124 | QString getCurrentSyncDevice() { return mCurrentSyncDevice; } | 125 | QString getCurrentSyncDevice() { return mCurrentSyncDevice; } |
125 | QString getCurrentSyncName() { return mCurrentSyncName; } | 126 | QString getCurrentSyncName() { return mCurrentSyncName; } |
@@ -160,7 +161,6 @@ class KSyncManager : public QObject | |||
160 | private: | 161 | private: |
161 | void syncPi(); | 162 | void syncPi(); |
162 | KServerSocket * mServerSocket; | 163 | KServerSocket * mServerSocket; |
163 | void enableQuick(); | ||
164 | KPimPrefs* mPrefs; | 164 | KPimPrefs* mPrefs; |
165 | QString mDefFileName; | 165 | QString mDefFileName; |
166 | QString mCurrentSyncDevice; | 166 | QString mCurrentSyncDevice; |