author | zautrix <zautrix> | 2004-10-19 00:37:51 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-19 00:37:51 (UTC) |
commit | 0f35c6660ed4c304b7c75f2a607f0f27ba436601 (patch) (side-by-side diff) | |
tree | b5e43d5bb00528d40eb0f94eeef5cf7d6cf00995 | |
parent | 9fd09e806dfe3df5abdf70991b6ec170fed51078 (diff) | |
download | kdepimpi-0f35c6660ed4c304b7c75f2a607f0f27ba436601.zip kdepimpi-0f35c6660ed4c304b7c75f2a607f0f27ba436601.tar.gz kdepimpi-0f35c6660ed4c304b7c75f2a607f0f27ba436601.tar.bz2 |
added pisync auto start
-rw-r--r-- | korganizer/mainwindow.cpp | 0 | ||||
-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 |
5 files changed, 36 insertions, 3 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index c3e9f75..02ca523 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp 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 ) : QString hdp= locateLocal("data","korganizer")+"/"; #endif config()->setGroup("SyncOptions"); 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); } KPimPrefs::~KPimPrefs() { } 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 public: QStringList mCustomCategories; QString mPassiveSyncPort; QString mPassiveSyncPw; + bool mPassiveSyncWithDesktop; + bool mPassiveSyncAutoStart; int mRingSyncAlgoPrefs; QString mLastSyncedLocalFile; protected: 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 @@ #include <qapplication.h> #include <qlineedit.h> #include <qdialog.h> #include <qlayout.h> #include <qtextcodec.h> #include <qlabel.h> +#include <qcheckbox.h> #include <klocale.h> #include <kglobal.h> #include <kconfig.h> #include <kfiledialog.h> @@ -65,12 +66,14 @@ KSyncManager::KSyncManager(QWidget* parent, KSyncInterface* implementation, Targ if ( QApplication::desktop()->width() < 320 ) w = 220; int h = bar->sizeHint().height() ; 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 ); } KSyncManager::~KSyncManager() { delete bar; @@ -264,14 +267,16 @@ void KSyncManager::slotSyncMenu( int action ) } } delete temp; 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 ); lab.setText( mPrefs->mPassiveSyncPort ); lay.setMargin(7); lay.setSpacing(7); @@ -282,25 +287,47 @@ void KSyncManager::enableQuick() 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 ); + 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 ) { KMessageBox::information( 0, i18n("No valid port")); return; } //qDebug("port %d ", port); @@ -310,12 +337,14 @@ void KSyncManager::enableQuick() if ( !mServerSocket->ok() ) { KMessageBox::information( 0, i18n("Failed to bind or\nlisten to the port!")); delete mServerSocket; 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 ) ) ); } void KSyncManager::syncLocalFile() { 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 void multiSync( bool askforPrefs ); bool blockSave() { return mBlockSaveFlag; } void setBlockSave(bool sa) { mBlockSaveFlag = sa; } 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; } void showProgressBar(int percentage, QString caption = QString::null, int total=100); void hideProgressBar(); @@ -157,13 +158,12 @@ class KSyncManager : public QObject void readFileFromSocket(); void fillSyncMenu(); private: void syncPi(); KServerSocket * mServerSocket; - void enableQuick(); KPimPrefs* mPrefs; QString mDefFileName; QString mCurrentSyncDevice; QString mCurrentSyncName; void quickSyncLocalFile(); bool syncWithFile( QString fn , bool quick ); |