summaryrefslogtreecommitdiffabout
path: root/libkdepim
Side-by-side diff
Diffstat (limited to 'libkdepim') (more/less context) (show whitespace changes)
-rw-r--r--libkdepim/kpimprefs.cpp2
-rw-r--r--libkdepim/kpimprefs.h2
-rw-r--r--libkdepim/ksyncmanager.cpp33
-rw-r--r--libkdepim/ksyncmanager.h2
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 ) :
addItemString("PassiveSyncPort",&mPassiveSyncPort,"9197" );
addItemString("PassiveSyncPw",&mPassiveSyncPw,"abc" );
addItemString("LastSyncedLocalFile", &mLastSyncedLocalFile ,hdp +"lastsync.ics" );
+ addItemBool("PassiveSyncWithDesktop",&mPassiveSyncWithDesktop,false );
+ addItemBool("PassiveSyncAutoStart",&mPassiveSyncAutoStart,false );
addItemInt("RingSyncAlgoPrefs",&mRingSyncAlgoPrefs,3);
}
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
QStringList mCustomCategories;
QString mPassiveSyncPort;
QString mPassiveSyncPw;
+ bool mPassiveSyncWithDesktop;
+ bool mPassiveSyncAutoStart;
int mRingSyncAlgoPrefs;
QString mLastSyncedLocalFile;
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 @@
#include <qlayout.h>
#include <qtextcodec.h>
#include <qlabel.h>
+#include <qcheckbox.h>
#include <klocale.h>
#include <kglobal.h>
@@ -68,6 +69,8 @@ KSyncManager::KSyncManager(QWidget* parent, KSyncInterface* implementation, Targ
int dw = QApplication::desktop()->width();
int dh = QApplication::desktop()->height();
bar->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
+ if ( mPrefs->mPassiveSyncAutoStart )
+ enableQuick( false );
}
@@ -267,8 +270,10 @@ void KSyncManager::slotSyncMenu( int action )
setBlockSave(false);
}
-void KSyncManager::enableQuick()
+void KSyncManager::enableQuick( bool ask )
{
+ bool autoStart;
+ if ( ask ) {
QDialog dia ( 0, "input-dialog", true );
QLineEdit lab ( &dia );
QVBoxLayout lay( &dia );
@@ -285,7 +290,23 @@ void KSyncManager::enableQuick()
QLabel label2 ( i18n("Password to enable\naccess from remote:"), &dia );
lay.addWidget( &label2);
lay.addWidget( &lepw);
- dia.setFixedSize( 230,80 );
+ 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 );
@@ -297,7 +318,13 @@ void KSyncManager::enableQuick()
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 ) {
KMessageBox::information( 0, i18n("No valid port"));
@@ -313,6 +340,8 @@ void KSyncManager::enableQuick()
mServerSocket = 0;
return;
}
+
+ mPrefs->mPassiveSyncAutoStart = autoStart;
connect( mServerSocket, SIGNAL ( request_file() ),this, SIGNAL ( request_file() ) );
connect( mServerSocket, SIGNAL ( file_received( bool ) ), this, SIGNAL ( getFile( bool ) ) );
}
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
void setDefaultFileName( QString s) { mDefFileName = s ;}
QString defaultFileName() { return mDefFileName ;}
QString syncFileName();
+ void enableQuick( bool ask = true);
QString getCurrentSyncDevice() { return mCurrentSyncDevice; }
QString getCurrentSyncName() { return mCurrentSyncName; }
@@ -160,7 +161,6 @@ class KSyncManager : public QObject
private:
void syncPi();
KServerSocket * mServerSocket;
- void enableQuick();
KPimPrefs* mPrefs;
QString mDefFileName;
QString mCurrentSyncDevice;