summaryrefslogtreecommitdiffabout
path: root/libkdepim/ksyncmanager.cpp
authorzautrix <zautrix>2004-10-27 12:27:39 (UTC)
committer zautrix <zautrix>2004-10-27 12:27:39 (UTC)
commit2f3396d84d2f3c92e1e0e420d677892c1f9c0778 (patch) (side-by-side diff)
tree1ebab5dc6d00cb09720789897ce2c86df05cc9ab /libkdepim/ksyncmanager.cpp
parentf73d249579d52d7aeaacde2dcb23abeb42f9ee95 (diff)
downloadkdepimpi-2f3396d84d2f3c92e1e0e420d677892c1f9c0778.zip
kdepimpi-2f3396d84d2f3c92e1e0e420d677892c1f9c0778.tar.gz
kdepimpi-2f3396d84d2f3c92e1e0e420d677892c1f9c0778.tar.bz2
completed KDE AB sync. but will it work ...?
Diffstat (limited to 'libkdepim/ksyncmanager.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/ksyncmanager.cpp22
1 files changed, 21 insertions, 1 deletions
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp
index e09050e..17e6c75 100644
--- a/libkdepim/ksyncmanager.cpp
+++ b/libkdepim/ksyncmanager.cpp
@@ -166,48 +166,49 @@ void KSyncManager::slotClearMenu( int action )
if ( action > 999 ) {
syncDevice = mSyncProfileNames[action - 1000] ;
}
int result = 0;
QString sd;
if ( syncDevice.isEmpty() )
sd = i18n("Do you want to\nclear all sync info\nof all profiles?");
else
sd = i18n("Do you want to\nclear the sync\ninfo of profile\n%1?\n"). arg( syncDevice );
result = QMessageBox::warning( mParent, i18n("Warning!"),sd,i18n("OK"), i18n("Cancel"), 0,
0, 1 );
if ( result )
return;
mImplementation->removeSyncInfo( syncDevice );
}
void KSyncManager::slotSyncMenu( int action )
{
qDebug("syncaction %d ", action);
if ( action == 5000 )
return;
+ mSyncWithDesktop = false;
if ( action == 0 ) {
// seems to be a Qt2 event handling bug
// syncmenu.clear causes a segfault at first time
// when we call it after the main event loop, it is ok
// same behaviour when calling OM/Pi via QCOP for the first time
QTimer::singleShot ( 1, this, SLOT ( confSync() ) );
//confSync();
return;
}
if ( action == 1 ) {
multiSync( true );
return;
}
if ( action == 2 ) {
enableQuick();
QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) );
return;
}
if ( action == 3 ) {
delete mServerSocket;
mServerSocket = 0;
QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) );
@@ -230,48 +231,49 @@ void KSyncManager::slotSyncMenu( int action )
mCurrentSyncName = mLocalMachineName ;
KConfig config ( locateLocal( "config","ksyncprofilesrc" ) );
KSyncProfile* temp = new KSyncProfile ();
temp->setName(mSyncProfileNames[mCurrentSyncProfile]);
temp->readConfig(&config);
if (silent) {
mAskForPreferences = false;
mShowSyncSummary = false;
mWriteBackFile = true;
mSyncAlgoPrefs = 2;// take newest
}
else {
mAskForPreferences = temp->getAskForPreferences();
mShowSyncSummary = temp->getShowSummaryAfterSync();
mWriteBackFile = temp->getWriteBackFile();
mSyncAlgoPrefs = temp->getSyncPrefs();
}
mWriteBackExistingOnly = temp->getWriteBackExisting();
mIsKapiFile = temp->getIsKapiFile();
mWriteBackInFuture = 0;
if ( temp->getWriteBackFuture() )
mWriteBackInFuture = temp->getWriteBackFutureWeeks( );
if ( action == 1000 ) {
+ mIsKapiFile = false;
#ifdef DESKTOP_VERSION
syncKDE();
#else
syncSharp();
#endif
} else if ( action == 1001 ) {
syncLocalFile();
} else if ( action == 1002 ) {
mWriteBackFile = false;
mAskForPreferences = false;
mShowSyncSummary = false;
mSyncAlgoPrefs = 3;
quickSyncLocalFile();
} else if ( action >= 1003 ) {
if ( temp->getIsLocalFileSync() ) {
switch(mTargetApp)
{
case (KAPI):
if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) )
mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNameAB();
break;
@@ -861,53 +863,71 @@ 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";
+#else
+ QString command = "kdeabdump";
+#endif
+ if ( ! QFile::exists ( command ) )
+ command = "kdeabdump";
+ QString fileName = QDir::homeDirPath ()+"/.kdeaddressbookdump.vcf";
+ 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";
#else
QString command = "kdecaldump";
#endif
if ( ! QFile::exists ( command ) )
command = "kdecaldump";
QString fileName = QDir::homeDirPath ()+"/.kdecalendardump.ics";
system ( command.latin1());
if ( syncWithFile( fileName,true ) ) {
if ( mWriteBackFile ) {
command += " --read";
system ( command.latin1());
}
}
}
break;
case (PWMPI):
break;