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 /libkdepim/ksyncmanager.cpp | |
parent | 9fd09e806dfe3df5abdf70991b6ec170fed51078 (diff) | |
download | kdepimpi-0f35c6660ed4c304b7c75f2a607f0f27ba436601.zip kdepimpi-0f35c6660ed4c304b7c75f2a607f0f27ba436601.tar.gz kdepimpi-0f35c6660ed4c304b7c75f2a607f0f27ba436601.tar.bz2 |
added pisync auto start
-rw-r--r-- | libkdepim/ksyncmanager.cpp | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp index 40d8e47..75c0b2b 100644 --- a/libkdepim/ksyncmanager.cpp +++ b/libkdepim/ksyncmanager.cpp @@ -35,52 +35,55 @@ #include <kmessagebox.h> #include <qdir.h> #include <qprogressbar.h> #include <qpopupmenu.h> #include <qpushbutton.h> #include <qradiobutton.h> #include <qbuttongroup.h> #include <qtimer.h> #include <qmessagebox.h> #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> KSyncManager::KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu) : QObject(), mParent(parent), mImplementation(implementation), mTargetApp(ta), mPrefs(prefs ),mSyncMenu(syncmenu) { mServerSocket = 0; bar = new QProgressBar ( 1, 0 ); bar->setCaption (""); int w = 300; 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; } void KSyncManager::fillSyncMenu() { if ( mSyncMenu->count() ) mSyncMenu->clear(); mSyncMenu->insertItem( i18n("Configure..."), 0 ); mSyncMenu->insertSeparator(); @@ -254,78 +257,104 @@ void KSyncManager::slotSyncMenu( int action ) mActiveSyncIP = temp->getRemoteIPPWM(); } syncPi(); while ( !mPisyncFinished ) { //qDebug("waiting "); qApp->processEvents(); } } else syncRemote( temp ); } } 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); 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 ); + 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); mServerSocket = new KServerSocket ( mPrefs->mPassiveSyncPw, port ,1 ); mServerSocket->setFileName( defaultFileName() ); //qDebug("connected "); 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() { QString fn =mPrefs->mLastSyncedLocalFile; QString ext; switch(mTargetApp) { case (KAPI): ext = "(*.vcf)"; break; case (KOPI): |