author | zautrix <zautrix> | 2005-04-03 09:34:07 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-04-03 09:34:07 (UTC) |
commit | 4f800d49800f8d0b1e7b0af8aacea6dbeb78e67c (patch) (side-by-side diff) | |
tree | 369a243d3cb006d330686368d5397e264947e38e /libkdepim | |
parent | 4017b5fccc188c74e971c573dbb6154ce877807b (diff) | |
download | kdepimpi-4f800d49800f8d0b1e7b0af8aacea6dbeb78e67c.zip kdepimpi-4f800d49800f8d0b1e7b0af8aacea6dbeb78e67c.tar.gz kdepimpi-4f800d49800f8d0b1e7b0af8aacea6dbeb78e67c.tar.bz2 |
fixes
-rw-r--r-- | libkdepim/ksyncmanager.cpp | 82 |
1 files changed, 58 insertions, 24 deletions
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp index 184cb39..85a2aeb 100644 --- a/libkdepim/ksyncmanager.cpp +++ b/libkdepim/ksyncmanager.cpp @@ -816,236 +816,270 @@ bool KSyncManager::edit_sync_options() QRadioButton f_loc( i18n("Force: Take local entry always"), &gr ); QRadioButton f_rem( i18n("Force: Take remote entry always"), &gr ); //QRadioButton both( i18n("Take both on conflict"), &gr ); QPushButton pb ( "OK", &dia); lay.addWidget( &pb ); connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); switch ( mSyncAlgoPrefs ) { case 0: loc.setChecked( true); break; case 1: rem.setChecked( true ); break; case 2: newest.setChecked( true); break; case 3: ask.setChecked( true); break; case 4: f_loc.setChecked( true); break; case 5: f_rem.setChecked( true); break; case 6: // both.setChecked( true); break; default: break; } if ( dia.exec() ) { mSyncAlgoPrefs = rem.isChecked()*1+newest.isChecked()*2+ ask.isChecked()*3+ f_loc.isChecked()*4+ f_rem.isChecked()*5;//+ both.isChecked()*6 ; return true; } return false; } QString KSyncManager::getPassword( ) { QString retfile = ""; QDialog dia ( mParent, "input-dialog", true ); QLineEdit lab ( &dia ); lab.setEchoMode( QLineEdit::Password ); QVBoxLayout lay( &dia ); lay.setMargin(7); lay.setSpacing(7); lay.addWidget( &lab); dia.setFixedSize( 230,50 ); dia.setCaption( i18n("Enter password") ); QPushButton pb ( "OK", &dia); lay.addWidget( &pb ); connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); dia.show(); int res = dia.exec(); if ( res ) retfile = lab.text(); dia.hide(); qApp->processEvents(); return retfile; } void KSyncManager::confSync() { static KSyncPrefsDialog* sp = 0; if ( ! sp ) { sp = new KSyncPrefsDialog( mParent, "syncprefs", true ); } sp->usrReadConfig(); #ifndef DESKTOP_VERSION sp->showMaximized(); #else sp->show(); #endif sp->exec(); QStringList oldSyncProfileNames = mSyncProfileNames; mSyncProfileNames = sp->getSyncProfileNames(); mLocalMachineName = sp->getLocalMachineName (); int ii; for ( ii = 0; ii < oldSyncProfileNames.count(); ++ii ) { if ( ! mSyncProfileNames.contains( oldSyncProfileNames[ii] ) ) mImplementation->removeSyncInfo( oldSyncProfileNames[ii] ); } QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); } void KSyncManager::syncKDE() { mSyncWithDesktop = true; emit save(); switch(mTargetApp) { case (KAPI): { #ifdef DESKTOP_VERSION - QString command = qApp->applicationDirPath () + "/kdeabdump"; + QString command = "kdeabdump33"; + QString commandfile = "kdeabdump33"; + QString commandpath = qApp->applicationDirPath () + "/"; #else - QString command = "kdeabdump"; + QString command = "kdeabdump33"; + QString commandfile = "kdeabdump33"; + QString commandpath = QDir::homeDirPath ()+"/"; #endif - if ( ! QFile::exists ( command ) ) - command = "kdeabdump"; + if ( ! QFile::exists ( commandpath+commandfile ) ) + command = commandfile; + else + command = commandpath+commandfile; + QString fileName = QDir::homeDirPath ()+"/.kdeaddressbookdump.vcf"; int result = system ( command.latin1()); - qDebug("AB dump command call result: %d ", result); + qDebug("AB dump 33 command call result: %d ", result); if ( result != 0 ) { - KMessageBox::error( 0, i18n("Error accessing KDE addressbook data.\nMake sure the file\n/opt/kdepimpi/kdeabdump\nexists.The standard version of this file\nis for syncing with KDE 3.4.x.\nIf you are running KDE 3.3.x please\ndownload the KDE 3.3.x version of this file\nat http://sourceforge.net/projects/kdepimpi/\nsection: general files for KDE/Pim.")); - return; + qDebug("Calling AB dump version 33 failed. Trying 34... "); + commandfile = "kdeabdump34"; + if ( ! QFile::exists ( commandpath+commandfile ) ) + command = commandfile; + else + command = commandpath+commandfile; + result = system ( command.latin1()); + qDebug("AB dump 34 command call result: %d ", result); + if ( result != 0 ) { + KMessageBox::error( 0, i18n("Error accessing KDE addressbook data.\nMake sure the file\n%1kdeabdump3x\nexists ( x = 3 or 4 ).\nSupported KDE versions are 3.3 and 3.4.\nUsed version should be auto detected.\n").arg( commandpath )); + return; + } } - if ( syncWithFile( fileName,true ) ) { - if ( mWriteBackFile ) { - command += " --read"; - system ( command.latin1()); - } + if ( syncWithFile( fileName,true ) ) { + if ( mWriteBackFile ) { + command += " --read"; + system ( command.latin1()); } + } } break; case (KOPI): { #ifdef DESKTOP_VERSION - QString command = qApp->applicationDirPath () + "/kdecaldump"; + QString command = "kdecaldump33"; + QString commandfile = "kdecaldump33"; + QString commandpath = qApp->applicationDirPath () + "/"; #else - QString command = "kdecaldump"; + QString command = "kdecaldump33"; + QString commandfile = "kdecaldump33"; + QString commandpath = QDir::homeDirPath ()+"/"; #endif - if ( ! QFile::exists ( command ) ) - command = "kdecaldump"; + if ( ! QFile::exists ( commandpath+commandfile ) ) + command = commandfile; + else + command = commandpath+commandfile; + QString fileName = QDir::homeDirPath ()+"/.kdecalendardump.ics"; int result = system ( command.latin1()); - qDebug("Cal dump command call result result: %d ", result); + qDebug("Cal dump 33 command call result result: %d ", result); if ( result != 0 ) { - KMessageBox::error( 0, i18n("Error accessing KDE calendar data.\nMake sure the file\n/opt/kdepimpi/kdecaldump\nexists.The standard version of this file\nis for syncing with KDE 3.4.x.\nIf you are running KDE 3.3.x please\ndownload the KDE 3.3.x version of this file\nat http://sourceforge.net/projects/kdepimpi/\nsection: general files for KDE/Pim.")); - return; + qDebug("Calling CAL dump version 33 failed. Trying 34... "); + commandfile = "kdecaldump34"; + if ( ! QFile::exists ( commandpath+commandfile ) ) + command = commandfile; + else + command = commandpath+commandfile; + result = system ( command.latin1()); + qDebug("Cal dump 34 command call result result: %d ", result); + if ( result != 0 ) { + KMessageBox::error( 0, i18n("Error accessing KDE calendar data.\nMake sure the file\n%1kdecaldump3x\nexists ( x = 3 or 4 ).\nSupported KDE versions are 3.3 and 3.4.\nUsed version should be auto detected.\n").arg( commandpath )); + return; + } } - if ( syncWithFile( fileName,true ) ) { - if ( mWriteBackFile ) { - command += " --read"; - system ( command.latin1()); - } + if ( syncWithFile( fileName,true ) ) { + if ( mWriteBackFile ) { + command += " --read"; + system ( command.latin1()); } + } } break; case (PWMPI): break; default: qDebug("KSM::slotSyncMenu: invalid apptype selected"); break; } } void KSyncManager::syncSharp() { if ( ! syncExternalApplication("sharp") ) qDebug("KSM::ERROR sync sharp "); } bool KSyncManager::syncExternalApplication(QString resource) { emit save(); if ( mAskForPreferences ) if ( !edit_sync_options()) { mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") ); return false; } qDebug("KSM::Sync extern %s", resource.latin1()); bool syncOK = mImplementation->syncExternal(this, resource); return syncOK; } void KSyncManager::syncPhone() { syncExternalApplication("phone"); } void KSyncManager::showProgressBar(int percentage, QString caption, int total) { if (!bar->isVisible()) { 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 ); bar->setCaption (caption); bar->setTotalSteps ( total ) ; bar->show(); } bar->raise(); bar->setProgress( percentage ); qApp->processEvents(); } void KSyncManager::hideProgressBar() { bar->hide(); qApp->processEvents(); } bool KSyncManager::isProgressBarCanceled() { return !bar->isVisible(); } QString KSyncManager::syncFileName() { QString fn = "tempfile"; switch(mTargetApp) { case (KAPI): fn = "tempsyncab.vcf"; break; case (KOPI): fn = "tempsynccal.ics"; break; case (PWMPI): fn = "tempsyncpw.pwm"; break; default: break; } #ifdef _WIN32_ |