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) (unidiff)
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 )
166 if ( action > 999 ) { 166 if ( action > 999 ) {
167 syncDevice = mSyncProfileNames[action - 1000] ; 167 syncDevice = mSyncProfileNames[action - 1000] ;
168 } 168 }
169 169
170 170
171 171
172 int result = 0; 172 int result = 0;
173 QString sd; 173 QString sd;
174 if ( syncDevice.isEmpty() ) 174 if ( syncDevice.isEmpty() )
175 sd = i18n("Do you want to\nclear all sync info\nof all profiles?"); 175 sd = i18n("Do you want to\nclear all sync info\nof all profiles?");
176 else 176 else
177 sd = i18n("Do you want to\nclear the sync\ninfo of profile\n%1?\n"). arg( syncDevice ); 177 sd = i18n("Do you want to\nclear the sync\ninfo of profile\n%1?\n"). arg( syncDevice );
178 178
179 result = QMessageBox::warning( mParent, i18n("Warning!"),sd,i18n("OK"), i18n("Cancel"), 0, 179 result = QMessageBox::warning( mParent, i18n("Warning!"),sd,i18n("OK"), i18n("Cancel"), 0,
180 0, 1 ); 180 0, 1 );
181 if ( result ) 181 if ( result )
182 return; 182 return;
183 mImplementation->removeSyncInfo( syncDevice ); 183 mImplementation->removeSyncInfo( syncDevice );
184} 184}
185void KSyncManager::slotSyncMenu( int action ) 185void KSyncManager::slotSyncMenu( int action )
186{ 186{
187 qDebug("syncaction %d ", action); 187 qDebug("syncaction %d ", action);
188 if ( action == 5000 ) 188 if ( action == 5000 )
189 return; 189 return;
190 mSyncWithDesktop = false;
190 if ( action == 0 ) { 191 if ( action == 0 ) {
191 192
192 // seems to be a Qt2 event handling bug 193 // seems to be a Qt2 event handling bug
193 // syncmenu.clear causes a segfault at first time 194 // syncmenu.clear causes a segfault at first time
194 // when we call it after the main event loop, it is ok 195 // when we call it after the main event loop, it is ok
195 // same behaviour when calling OM/Pi via QCOP for the first time 196 // same behaviour when calling OM/Pi via QCOP for the first time
196 QTimer::singleShot ( 1, this, SLOT ( confSync() ) ); 197 QTimer::singleShot ( 1, this, SLOT ( confSync() ) );
197 //confSync(); 198 //confSync();
198 199
199 return; 200 return;
200 } 201 }
201 if ( action == 1 ) { 202 if ( action == 1 ) {
202 multiSync( true ); 203 multiSync( true );
203 return; 204 return;
204 } 205 }
205 if ( action == 2 ) { 206 if ( action == 2 ) {
206 enableQuick(); 207 enableQuick();
207 QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); 208 QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) );
208 return; 209 return;
209 } 210 }
210 if ( action == 3 ) { 211 if ( action == 3 ) {
211 delete mServerSocket; 212 delete mServerSocket;
212 mServerSocket = 0; 213 mServerSocket = 0;
213 QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); 214 QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) );
@@ -230,48 +231,49 @@ void KSyncManager::slotSyncMenu( int action )
230 mCurrentSyncName = mLocalMachineName ; 231 mCurrentSyncName = mLocalMachineName ;
231 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); 232 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) );
232 KSyncProfile* temp = new KSyncProfile (); 233 KSyncProfile* temp = new KSyncProfile ();
233 temp->setName(mSyncProfileNames[mCurrentSyncProfile]); 234 temp->setName(mSyncProfileNames[mCurrentSyncProfile]);
234 temp->readConfig(&config); 235 temp->readConfig(&config);
235 if (silent) { 236 if (silent) {
236 mAskForPreferences = false; 237 mAskForPreferences = false;
237 mShowSyncSummary = false; 238 mShowSyncSummary = false;
238 mWriteBackFile = true; 239 mWriteBackFile = true;
239 mSyncAlgoPrefs = 2;// take newest 240 mSyncAlgoPrefs = 2;// take newest
240 } 241 }
241 else { 242 else {
242 mAskForPreferences = temp->getAskForPreferences(); 243 mAskForPreferences = temp->getAskForPreferences();
243 mShowSyncSummary = temp->getShowSummaryAfterSync(); 244 mShowSyncSummary = temp->getShowSummaryAfterSync();
244 mWriteBackFile = temp->getWriteBackFile(); 245 mWriteBackFile = temp->getWriteBackFile();
245 mSyncAlgoPrefs = temp->getSyncPrefs(); 246 mSyncAlgoPrefs = temp->getSyncPrefs();
246 } 247 }
247 mWriteBackExistingOnly = temp->getWriteBackExisting(); 248 mWriteBackExistingOnly = temp->getWriteBackExisting();
248 mIsKapiFile = temp->getIsKapiFile(); 249 mIsKapiFile = temp->getIsKapiFile();
249 mWriteBackInFuture = 0; 250 mWriteBackInFuture = 0;
250 if ( temp->getWriteBackFuture() ) 251 if ( temp->getWriteBackFuture() )
251 mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); 252 mWriteBackInFuture = temp->getWriteBackFutureWeeks( );
252 253
253 if ( action == 1000 ) { 254 if ( action == 1000 ) {
255 mIsKapiFile = false;
254#ifdef DESKTOP_VERSION 256#ifdef DESKTOP_VERSION
255 syncKDE(); 257 syncKDE();
256#else 258#else
257 syncSharp(); 259 syncSharp();
258#endif 260#endif
259 261
260 } else if ( action == 1001 ) { 262 } else if ( action == 1001 ) {
261 syncLocalFile(); 263 syncLocalFile();
262 264
263 } else if ( action == 1002 ) { 265 } else if ( action == 1002 ) {
264 mWriteBackFile = false; 266 mWriteBackFile = false;
265 mAskForPreferences = false; 267 mAskForPreferences = false;
266 mShowSyncSummary = false; 268 mShowSyncSummary = false;
267 mSyncAlgoPrefs = 3; 269 mSyncAlgoPrefs = 3;
268 quickSyncLocalFile(); 270 quickSyncLocalFile();
269 271
270 } else if ( action >= 1003 ) { 272 } else if ( action >= 1003 ) {
271 if ( temp->getIsLocalFileSync() ) { 273 if ( temp->getIsLocalFileSync() ) {
272 switch(mTargetApp) 274 switch(mTargetApp)
273 { 275 {
274 case (KAPI): 276 case (KAPI):
275 if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) ) 277 if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) )
276 mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNameAB(); 278 mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNameAB();
277 break; 279 break;
@@ -861,53 +863,71 @@ void KSyncManager::confSync()
861{ 863{
862 static KSyncPrefsDialog* sp = 0; 864 static KSyncPrefsDialog* sp = 0;
863 if ( ! sp ) { 865 if ( ! sp ) {
864 sp = new KSyncPrefsDialog( mParent, "syncprefs", true ); 866 sp = new KSyncPrefsDialog( mParent, "syncprefs", true );
865 } 867 }
866 sp->usrReadConfig(); 868 sp->usrReadConfig();
867#ifndef DESKTOP_VERSION 869#ifndef DESKTOP_VERSION
868 sp->showMaximized(); 870 sp->showMaximized();
869#else 871#else
870 sp->show(); 872 sp->show();
871#endif 873#endif
872 sp->exec(); 874 sp->exec();
873 QStringList oldSyncProfileNames = mSyncProfileNames; 875 QStringList oldSyncProfileNames = mSyncProfileNames;
874 mSyncProfileNames = sp->getSyncProfileNames(); 876 mSyncProfileNames = sp->getSyncProfileNames();
875 mLocalMachineName = sp->getLocalMachineName (); 877 mLocalMachineName = sp->getLocalMachineName ();
876 int ii; 878 int ii;
877 for ( ii = 0; ii < oldSyncProfileNames.count(); ++ii ) { 879 for ( ii = 0; ii < oldSyncProfileNames.count(); ++ii ) {
878 if ( ! mSyncProfileNames.contains( oldSyncProfileNames[ii] ) ) 880 if ( ! mSyncProfileNames.contains( oldSyncProfileNames[ii] ) )
879 mImplementation->removeSyncInfo( oldSyncProfileNames[ii] ); 881 mImplementation->removeSyncInfo( oldSyncProfileNames[ii] );
880 } 882 }
881 QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); 883 QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) );
882} 884}
883void KSyncManager::syncKDE() 885void KSyncManager::syncKDE()
884{ 886{
887 mSyncWithDesktop = true;
885 emit save(); 888 emit save();
886 switch(mTargetApp) 889 switch(mTargetApp)
887 { 890 {
888 case (KAPI): 891 case (KAPI):
889 892 {
893#ifdef DESKTOP_VERSION
894 QString command = qApp->applicationDirPath () + "/kdeabdump";
895#else
896 QString command = "kdeabdump";
897#endif
898 if ( ! QFile::exists ( command ) )
899 command = "kdeabdump";
900 QString fileName = QDir::homeDirPath ()+"/.kdeaddressbookdump.vcf";
901 system ( command.latin1());
902 if ( syncWithFile( fileName,true ) ) {
903 if ( mWriteBackFile ) {
904 command += " --read";
905 system ( command.latin1());
906 }
907 }
908
909 }
890 break; 910 break;
891 case (KOPI): 911 case (KOPI):
892 { 912 {
893#ifdef DESKTOP_VERSION 913#ifdef DESKTOP_VERSION
894 QString command = qApp->applicationDirPath () + "/kdecaldump"; 914 QString command = qApp->applicationDirPath () + "/kdecaldump";
895#else 915#else
896 QString command = "kdecaldump"; 916 QString command = "kdecaldump";
897#endif 917#endif
898 if ( ! QFile::exists ( command ) ) 918 if ( ! QFile::exists ( command ) )
899 command = "kdecaldump"; 919 command = "kdecaldump";
900 QString fileName = QDir::homeDirPath ()+"/.kdecalendardump.ics"; 920 QString fileName = QDir::homeDirPath ()+"/.kdecalendardump.ics";
901 system ( command.latin1()); 921 system ( command.latin1());
902 if ( syncWithFile( fileName,true ) ) { 922 if ( syncWithFile( fileName,true ) ) {
903 if ( mWriteBackFile ) { 923 if ( mWriteBackFile ) {
904 command += " --read"; 924 command += " --read";
905 system ( command.latin1()); 925 system ( command.latin1());
906 } 926 }
907 } 927 }
908 928
909 } 929 }
910 break; 930 break;
911 case (PWMPI): 931 case (PWMPI):
912 932
913 break; 933 break;