summaryrefslogtreecommitdiffabout
path: root/libkdepim/ksyncmanager.cpp
Side-by-side diff
Diffstat (limited to 'libkdepim/ksyncmanager.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/ksyncmanager.cpp87
1 files changed, 58 insertions, 29 deletions
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp
index 40d8e47..75c0b2b 100644
--- a/libkdepim/ksyncmanager.cpp
+++ b/libkdepim/ksyncmanager.cpp
@@ -49,4 +49,5 @@
#include <qtextcodec.h>
#include <qlabel.h>
+#include <qcheckbox.h>
#include <klocale.h>
@@ -69,4 +70,6 @@ KSyncManager::KSyncManager(QWidget* parent, KSyncInterface* implementation, Targ
int dh = QApplication::desktop()->height();
bar->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
+ if ( mPrefs->mPassiveSyncAutoStart )
+ enableQuick( false );
}
@@ -268,35 +271,59 @@ void KSyncManager::slotSyncMenu( int action )
}
-void KSyncManager::enableQuick()
+void KSyncManager::enableQuick( bool ask )
{
- QDialog dia ( 0, "input-dialog", true );
- QLineEdit lab ( &dia );
- QVBoxLayout lay( &dia );
- lab.setText( mPrefs->mPassiveSyncPort );
- lay.setMargin(7);
- lay.setSpacing(7);
- int po = 9197+mTargetApp;
- QLabel label ( i18n("Port number (Default: %1)").arg(po), &dia );
- lay.addWidget( &label);
- lay.addWidget( &lab);
-
- QLineEdit lepw ( &dia );
- lepw.setText( mPrefs->mPassiveSyncPw );
- QLabel label2 ( i18n("Password to enable\naccess from remote:"), &dia );
- lay.addWidget( &label2);
- lay.addWidget( &lepw);
- dia.setFixedSize( 230,80 );
- dia.setCaption( i18n("Enter port for Pi-Sync") );
- QPushButton pb ( "OK", &dia);
- lay.addWidget( &pb );
- connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) );
- dia.show();
- if ( ! dia.exec() )
- return;
- dia.hide();
- qApp->processEvents();
- mPrefs->mPassiveSyncPw = lepw.text();
- mPrefs->mPassiveSyncPort = lab.text();
+ bool autoStart;
+ if ( ask ) {
+ QDialog dia ( 0, "input-dialog", true );
+ QLineEdit lab ( &dia );
+ QVBoxLayout lay( &dia );
+ lab.setText( mPrefs->mPassiveSyncPort );
+ lay.setMargin(7);
+ lay.setSpacing(7);
+ int po = 9197+mTargetApp;
+ QLabel label ( i18n("Port number (Default: %1)").arg(po), &dia );
+ lay.addWidget( &label);
+ lay.addWidget( &lab);
+
+ QLineEdit lepw ( &dia );
+ lepw.setText( mPrefs->mPassiveSyncPw );
+ QLabel label2 ( i18n("Password to enable\naccess from remote:"), &dia );
+ lay.addWidget( &label2);
+ lay.addWidget( &lepw);
+ QCheckBox autostart(i18n("Automatically start\nat application startup"), &dia );
+ lay.addWidget( &autostart);
+ autostart.setChecked( mPrefs->mPassiveSyncAutoStart );
+#ifdef DESKTOP_VERSION
+#ifdef _WIN32_
+ QCheckBox syncdesktop( i18n("Automatically sync with Outlook\nwhen receiving sync request"),&dia );
+#else
+ QCheckBox syncdesktop( i18n("Automatically sync with KDE-Desktop\nwhen receiving sync request"),&dia );
+#endif
+ lay.addWidget( &syncdesktop);
+#else
+ QCheckBox syncdesktop( i18n("Automatically sync\nwith KDE-Desktop"),&dia );
+ syncdesktop.hide();
+#endif
+ syncdesktop.setChecked( mPrefs->mPassiveSyncWithDesktop );
+
+ dia.setFixedSize( 230,120 );
+ dia.setCaption( i18n("Enter port for Pi-Sync") );
+ QPushButton pb ( "OK", &dia);
+ lay.addWidget( &pb );
+ connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) );
+ dia.show();
+ if ( ! dia.exec() )
+ return;
+ dia.hide();
+ qApp->processEvents();
+ mPrefs->mPassiveSyncPw = lepw.text();
+ mPrefs->mPassiveSyncPort = lab.text();
+ autoStart = autostart.isChecked();
+ mPrefs->mPassiveSyncWithDesktop = syncdesktop.isChecked();
+ }
+ else
+ autoStart = mPrefs->mPassiveSyncAutoStart;
bool ok;
+ mPrefs->mPassiveSyncAutoStart = false;
Q_UINT16 port = mPrefs->mPassiveSyncPort.toUInt(&ok);
if ( ! ok ) {
@@ -314,4 +341,6 @@ void KSyncManager::enableQuick()
return;
}
+
+ mPrefs->mPassiveSyncAutoStart = autoStart;
connect( mServerSocket, SIGNAL ( request_file() ),this, SIGNAL ( request_file() ) );
connect( mServerSocket, SIGNAL ( file_received( bool ) ), this, SIGNAL ( getFile( bool ) ) );