summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/mainwindow.cpp2
-rw-r--r--libkdepim/kpimprefs.cpp2
-rw-r--r--libkdepim/kpimprefs.h2
-rw-r--r--libkdepim/ksyncmanager.cpp87
-rw-r--r--libkdepim/ksyncmanager.h2
5 files changed, 64 insertions, 31 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index c3e9f75..02ca523 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -270,13 +270,13 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
270 } 270 }
271 271
272 //US listen for result adressed from Ka/Pi 272 //US listen for result adressed from Ka/Pi
273#ifndef DESKTOP_VERSION 273#ifndef DESKTOP_VERSION
274 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 274 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
275#endif 275#endif
276 276
277} 277}
278MainWindow::~MainWindow() 278MainWindow::~MainWindow()
279{ 279{
280 //qDebug("MainWindow::~MainWindow() "); 280 //qDebug("MainWindow::~MainWindow() ");
281 //save toolbar location 281 //save toolbar location
282 delete mCalendar; 282 delete mCalendar;
diff --git a/libkdepim/kpimprefs.cpp b/libkdepim/kpimprefs.cpp
index c21ebaa..a05e65f 100644
--- a/libkdepim/kpimprefs.cpp
+++ b/libkdepim/kpimprefs.cpp
@@ -44,12 +44,14 @@ KPimPrefs::KPimPrefs( const QString &name ) :
44 QString hdp= locateLocal("data","korganizer")+"/"; 44 QString hdp= locateLocal("data","korganizer")+"/";
45#endif 45#endif
46 config()->setGroup("SyncOptions"); 46 config()->setGroup("SyncOptions");
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
53KPimPrefs::~KPimPrefs() 55KPimPrefs::~KPimPrefs()
54{ 56{
55} 57}
diff --git a/libkdepim/kpimprefs.h b/libkdepim/kpimprefs.h
index 9346f7d..c177bd6 100644
--- a/libkdepim/kpimprefs.h
+++ b/libkdepim/kpimprefs.h
@@ -54,12 +54,14 @@ class KPimPrefs : public KPrefs
54 54
55 55
56 public: 56 public:
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
63 65
64 protected: 66 protected:
65 virtual void setCategoryDefaults(); 67 virtual void setCategoryDefaults();
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp
index 40d8e47..75c0b2b 100644
--- a/libkdepim/ksyncmanager.cpp
+++ b/libkdepim/ksyncmanager.cpp
@@ -45,12 +45,13 @@
45#include <qapplication.h> 45#include <qapplication.h>
46#include <qlineedit.h> 46#include <qlineedit.h>
47#include <qdialog.h> 47#include <qdialog.h>
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>
54#include <kconfig.h> 55#include <kconfig.h>
55#include <kfiledialog.h> 56#include <kfiledialog.h>
56 57
@@ -65,12 +66,14 @@ KSyncManager::KSyncManager(QWidget* parent, KSyncInterface* implementation, Targ
65 if ( QApplication::desktop()->width() < 320 ) 66 if ( QApplication::desktop()->width() < 320 )
66 w = 220; 67 w = 220;
67 int h = bar->sizeHint().height() ; 68 int h = bar->sizeHint().height() ;
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
74KSyncManager::~KSyncManager() 77KSyncManager::~KSyncManager()
75{ 78{
76 delete bar; 79 delete bar;
@@ -264,43 +267,67 @@ void KSyncManager::slotSyncMenu( int action )
264 } 267 }
265 } 268 }
266 delete temp; 269 delete temp;
267 setBlockSave(false); 270 setBlockSave(false);
268} 271}
269 272
270void KSyncManager::enableQuick() 273void KSyncManager::enableQuick( bool ask )
271{ 274{
272 QDialog dia ( 0, "input-dialog", true ); 275 bool autoStart;
273 QLineEdit lab ( &dia ); 276 if ( ask ) {
274 QVBoxLayout lay( &dia ); 277 QDialog dia ( 0, "input-dialog", true );
275 lab.setText( mPrefs->mPassiveSyncPort ); 278 QLineEdit lab ( &dia );
276 lay.setMargin(7); 279 QVBoxLayout lay( &dia );
277 lay.setSpacing(7); 280 lab.setText( mPrefs->mPassiveSyncPort );
278 int po = 9197+mTargetApp; 281 lay.setMargin(7);
279 QLabel label ( i18n("Port number (Default: %1)").arg(po), &dia ); 282 lay.setSpacing(7);
280 lay.addWidget( &label); 283 int po = 9197+mTargetApp;
281 lay.addWidget( &lab); 284 QLabel label ( i18n("Port number (Default: %1)").arg(po), &dia );
282 285 lay.addWidget( &label);
283 QLineEdit lepw ( &dia ); 286 lay.addWidget( &lab);
284 lepw.setText( mPrefs->mPassiveSyncPw ); 287
285 QLabel label2 ( i18n("Password to enable\naccess from remote:"), &dia ); 288 QLineEdit lepw ( &dia );
286 lay.addWidget( &label2); 289 lepw.setText( mPrefs->mPassiveSyncPw );
287 lay.addWidget( &lepw); 290 QLabel label2 ( i18n("Password to enable\naccess from remote:"), &dia );
288 dia.setFixedSize( 230,80 ); 291 lay.addWidget( &label2);
289 dia.setCaption( i18n("Enter port for Pi-Sync") ); 292 lay.addWidget( &lepw);
290 QPushButton pb ( "OK", &dia); 293 QCheckBox autostart(i18n("Automatically start\nat application startup"), &dia );
291 lay.addWidget( &pb ); 294 lay.addWidget( &autostart);
292 connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); 295 autostart.setChecked( mPrefs->mPassiveSyncAutoStart );
293 dia.show(); 296#ifdef DESKTOP_VERSION
294 if ( ! dia.exec() ) 297#ifdef _WIN32_
295 return; 298 QCheckBox syncdesktop( i18n("Automatically sync with Outlook\nwhen receiving sync request"),&dia );
296 dia.hide(); 299#else
297 qApp->processEvents(); 300 QCheckBox syncdesktop( i18n("Automatically sync with KDE-Desktop\nwhen receiving sync request"),&dia );
298 mPrefs->mPassiveSyncPw = lepw.text(); 301#endif
299 mPrefs->mPassiveSyncPort = lab.text(); 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 );
310 dia.setCaption( i18n("Enter port for Pi-Sync") );
311 QPushButton pb ( "OK", &dia);
312 lay.addWidget( &pb );
313 connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) );
314 dia.show();
315 if ( ! dia.exec() )
316 return;
317 dia.hide();
318 qApp->processEvents();
319 mPrefs->mPassiveSyncPw = lepw.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"));
304 return; 331 return;
305 } 332 }
306 //qDebug("port %d ", port); 333 //qDebug("port %d ", port);
@@ -310,12 +337,14 @@ void KSyncManager::enableQuick()
310 if ( !mServerSocket->ok() ) { 337 if ( !mServerSocket->ok() ) {
311 KMessageBox::information( 0, i18n("Failed to bind or\nlisten to the port!")); 338 KMessageBox::information( 0, i18n("Failed to bind or\nlisten to the port!"));
312 delete mServerSocket; 339 delete mServerSocket;
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}
319 348
320void KSyncManager::syncLocalFile() 349void KSyncManager::syncLocalFile()
321{ 350{
diff --git a/libkdepim/ksyncmanager.h b/libkdepim/ksyncmanager.h
index ffb1ea4..7b9c499 100644
--- a/libkdepim/ksyncmanager.h
+++ b/libkdepim/ksyncmanager.h
@@ -117,12 +117,13 @@ class KSyncManager : public QObject
117 void multiSync( bool askforPrefs ); 117 void multiSync( bool askforPrefs );
118 bool blockSave() { return mBlockSaveFlag; } 118 bool blockSave() { return mBlockSaveFlag; }
119 void setBlockSave(bool sa) { mBlockSaveFlag = sa; } 119 void setBlockSave(bool sa) { mBlockSaveFlag = sa; }
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; }
126 127
127 void showProgressBar(int percentage, QString caption = QString::null, int total=100); 128 void showProgressBar(int percentage, QString caption = QString::null, int total=100);
128 void hideProgressBar(); 129 void hideProgressBar();
@@ -157,13 +158,12 @@ class KSyncManager : public QObject
157 void readFileFromSocket(); 158 void readFileFromSocket();
158 void fillSyncMenu(); 159 void fillSyncMenu();
159 160
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;
167 QString mCurrentSyncName; 167 QString mCurrentSyncName;
168 void quickSyncLocalFile(); 168 void quickSyncLocalFile();
169 bool syncWithFile( QString fn , bool quick ); 169 bool syncWithFile( QString fn , bool quick );