author | zautrix <zautrix> | 2005-02-07 20:05:18 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-02-07 20:05:18 (UTC) |
commit | da5e47069d88fa9aa656423ce4c60bf505728e1c (patch) (unidiff) | |
tree | fdbaf29835a028f1204a19fc10dea97d469c0b29 /libkdepim | |
parent | 456b0246521847635fe98471691ceecae211e0c3 (diff) | |
download | kdepimpi-da5e47069d88fa9aa656423ce4c60bf505728e1c.zip kdepimpi-da5e47069d88fa9aa656423ce4c60bf505728e1c.tar.gz kdepimpi-da5e47069d88fa9aa656423ce4c60bf505728e1c.tar.bz2 |
fixes
-rw-r--r-- | libkdepim/ksyncmanager.cpp | 7 | ||||
-rw-r--r-- | libkdepim/phoneaccess.cpp | 2 |
2 files changed, 4 insertions, 5 deletions
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp index 3adbf61..df5a0d9 100644 --- a/libkdepim/ksyncmanager.cpp +++ b/libkdepim/ksyncmanager.cpp | |||
@@ -1,126 +1,126 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KDE-Pim/Pi. | 2 | This file is part of KDE-Pim/Pi. |
3 | Copyright (c) 2004 Ulf Schenk | 3 | Copyright (c) 2004 Ulf Schenk |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | // $Id$ | 21 | // $Id$ |
22 | 22 | ||
23 | #include "ksyncmanager.h" | 23 | #include "ksyncmanager.h" |
24 | 24 | ||
25 | #include <stdlib.h> | 25 | #include <stdlib.h> |
26 | 26 | ||
27 | #ifndef _WIN32_ | 27 | #ifndef _WIN32_ |
28 | #include <unistd.h> | 28 | #include <unistd.h> |
29 | #endif | 29 | #endif |
30 | 30 | ||
31 | 31 | ||
32 | #include "ksyncprofile.h" | 32 | #include "ksyncprofile.h" |
33 | #include "ksyncprefsdialog.h" | 33 | #include "ksyncprefsdialog.h" |
34 | #include "kpimprefs.h" | 34 | #include "kpimprefs.h" |
35 | #include <kmessagebox.h> | 35 | #include <kmessagebox.h> |
36 | 36 | ||
37 | #include <qdir.h> | 37 | #include <qdir.h> |
38 | #include <qprogressbar.h> | 38 | #include <qprogressbar.h> |
39 | #include <qpopupmenu.h> | 39 | #include <qpopupmenu.h> |
40 | #include <qpushbutton.h> | 40 | #include <qpushbutton.h> |
41 | #include <qradiobutton.h> | 41 | #include <qradiobutton.h> |
42 | #include <qbuttongroup.h> | 42 | #include <qbuttongroup.h> |
43 | #include <qtimer.h> | 43 | #include <qtimer.h> |
44 | #include <qmessagebox.h> | 44 | #include <qmessagebox.h> |
45 | #include <qapplication.h> | 45 | #include <qapplication.h> |
46 | #include <qlineedit.h> | 46 | #include <qlineedit.h> |
47 | #include <qdialog.h> | 47 | #include <qdialog.h> |
48 | #include <qlayout.h> | 48 | #include <qlayout.h> |
49 | #include <qtextcodec.h> | 49 | #include <qtextcodec.h> |
50 | #include <qlabel.h> | 50 | #include <qlabel.h> |
51 | #include <qcheckbox.h> | 51 | #include <qcheckbox.h> |
52 | 52 | ||
53 | #include <klocale.h> | 53 | #include <klocale.h> |
54 | #include <kglobal.h> | 54 | #include <kglobal.h> |
55 | #include <kconfig.h> | 55 | #include <kconfig.h> |
56 | #include <kfiledialog.h> | 56 | #include <kfiledialog.h> |
57 | 57 | ||
58 | QDateTime KSyncManager::mRequestedSyncEvent; | 58 | QDateTime KSyncManager::mRequestedSyncEvent; |
59 | 59 | ||
60 | 60 | ||
61 | KSyncManager::KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu) | 61 | KSyncManager::KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu) |
62 | : QObject(), mParent(parent), mImplementation(implementation), mTargetApp(ta), mPrefs(prefs ),mSyncMenu(syncmenu) | 62 | : QObject(), mPrefs(prefs ), mParent(parent),mImplementation(implementation), mTargetApp(ta), mSyncMenu(syncmenu) |
63 | { | 63 | { |
64 | mServerSocket = 0; | 64 | mServerSocket = 0; |
65 | bar = new QProgressBar ( 1, 0 ); | 65 | bar = new QProgressBar ( 1, 0 ); |
66 | bar->setCaption (""); | 66 | bar->setCaption (""); |
67 | mWriteBackInPast = 2; | 67 | mWriteBackInPast = 2; |
68 | int w = 300; | 68 | int w = 300; |
69 | if ( QApplication::desktop()->width() < 320 ) | 69 | if ( QApplication::desktop()->width() < 320 ) |
70 | w = 220; | 70 | w = 220; |
71 | int h = bar->sizeHint().height() ; | 71 | int h = bar->sizeHint().height() ; |
72 | int dw = QApplication::desktop()->width(); | 72 | int dw = QApplication::desktop()->width(); |
73 | int dh = QApplication::desktop()->height(); | 73 | int dh = QApplication::desktop()->height(); |
74 | bar->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 74 | bar->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
75 | if ( mPrefs->mPassiveSyncAutoStart ) | 75 | if ( mPrefs->mPassiveSyncAutoStart ) |
76 | enableQuick( false ); | 76 | enableQuick( false ); |
77 | 77 | ||
78 | } | 78 | } |
79 | 79 | ||
80 | KSyncManager::~KSyncManager() | 80 | KSyncManager::~KSyncManager() |
81 | { | 81 | { |
82 | delete bar; | 82 | delete bar; |
83 | } | 83 | } |
84 | 84 | ||
85 | 85 | ||
86 | void KSyncManager::fillSyncMenu() | 86 | void KSyncManager::fillSyncMenu() |
87 | { | 87 | { |
88 | if ( mSyncMenu->count() ) | 88 | if ( mSyncMenu->count() ) |
89 | mSyncMenu->clear(); | 89 | mSyncMenu->clear(); |
90 | 90 | ||
91 | mSyncMenu->insertItem( i18n("Configure..."), 0 ); | 91 | mSyncMenu->insertItem( i18n("Configure..."), 0 ); |
92 | mSyncMenu->insertSeparator(); | 92 | mSyncMenu->insertSeparator(); |
93 | QPopupMenu *clearMenu = new QPopupMenu ( mSyncMenu ); | 93 | QPopupMenu *clearMenu = new QPopupMenu ( mSyncMenu ); |
94 | mSyncMenu->insertItem( i18n("Remove sync info"),clearMenu, 5000 ); | 94 | mSyncMenu->insertItem( i18n("Remove sync info"),clearMenu, 5000 ); |
95 | clearMenu->insertItem( i18n("For all profiles"), 1 ); | 95 | clearMenu->insertItem( i18n("For all profiles"), 1 ); |
96 | clearMenu->insertSeparator(); | 96 | clearMenu->insertSeparator(); |
97 | connect ( clearMenu, SIGNAL( activated ( int ) ), this, SLOT (slotClearMenu( int ) ) ); | 97 | connect ( clearMenu, SIGNAL( activated ( int ) ), this, SLOT (slotClearMenu( int ) ) ); |
98 | mSyncMenu->insertSeparator(); | 98 | mSyncMenu->insertSeparator(); |
99 | if ( mServerSocket == 0 ) { | 99 | if ( mServerSocket == 0 ) { |
100 | mSyncMenu->insertItem( i18n("Enable Pi-Sync"), 2 ); | 100 | mSyncMenu->insertItem( i18n("Enable Pi-Sync"), 2 ); |
101 | } else { | 101 | } else { |
102 | mSyncMenu->insertItem( i18n("Disable Pi-Sync"), 3 ); | 102 | mSyncMenu->insertItem( i18n("Disable Pi-Sync"), 3 ); |
103 | } | 103 | } |
104 | mSyncMenu->insertSeparator(); | 104 | mSyncMenu->insertSeparator(); |
105 | mSyncMenu->insertItem( i18n("Multiple sync"), 1 ); | 105 | mSyncMenu->insertItem( i18n("Multiple sync"), 1 ); |
106 | mSyncMenu->insertSeparator(); | 106 | mSyncMenu->insertSeparator(); |
107 | KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); | 107 | KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); |
108 | config.setGroup("General"); | 108 | config.setGroup("General"); |
109 | QStringList prof = config.readListEntry("SyncProfileNames"); | 109 | QStringList prof = config.readListEntry("SyncProfileNames"); |
110 | mLocalMachineName = config.readEntry("LocalMachineName","undefined"); | 110 | mLocalMachineName = config.readEntry("LocalMachineName","undefined"); |
111 | if ( prof.count() < 2 ) { | 111 | if ( prof.count() < 2 ) { |
112 | prof.clear(); | 112 | prof.clear(); |
113 | QString externalName; | 113 | QString externalName; |
114 | #ifdef DESKTOP_VERSION | 114 | #ifdef DESKTOP_VERSION |
115 | #ifdef _WIN32_ | 115 | #ifdef _WIN32_ |
116 | externalName = "OutLook(not_implemented)"; | 116 | externalName = "OutLook(not_implemented)"; |
117 | #else | 117 | #else |
118 | externalName = "KDE_Desktop"; | 118 | externalName = "KDE_Desktop"; |
119 | #endif | 119 | #endif |
120 | #else | 120 | #else |
121 | externalName = "Sharp_DTM"; | 121 | externalName = "Sharp_DTM"; |
122 | #endif | 122 | #endif |
123 | prof << externalName; | 123 | prof << externalName; |
124 | prof << i18n("Local_file"); | 124 | prof << i18n("Local_file"); |
125 | prof << i18n("Last_file"); | 125 | prof << i18n("Last_file"); |
126 | KSyncProfile* temp = new KSyncProfile (); | 126 | KSyncProfile* temp = new KSyncProfile (); |
@@ -399,225 +399,224 @@ void KSyncManager::enableQuick( bool ask ) | |||
399 | changed = true; | 399 | changed = true; |
400 | bool ok; | 400 | bool ok; |
401 | mPrefs->mPassiveSyncAutoStart = false; | 401 | mPrefs->mPassiveSyncAutoStart = false; |
402 | Q_UINT16 port = mPrefs->mPassiveSyncPort.toUInt(&ok); | 402 | Q_UINT16 port = mPrefs->mPassiveSyncPort.toUInt(&ok); |
403 | if ( ! ok ) { | 403 | if ( ! ok ) { |
404 | KMessageBox::information( 0, i18n("No valid port")); | 404 | KMessageBox::information( 0, i18n("No valid port")); |
405 | return; | 405 | return; |
406 | } | 406 | } |
407 | //qDebug("port %d ", port); | 407 | //qDebug("port %d ", port); |
408 | mServerSocket = new KServerSocket ( mPrefs->mPassiveSyncPw, port ,1 ); | 408 | mServerSocket = new KServerSocket ( mPrefs->mPassiveSyncPw, port ,1 ); |
409 | mServerSocket->setFileName( defaultFileName() );//bbb | 409 | mServerSocket->setFileName( defaultFileName() );//bbb |
410 | //qDebug("connected "); | 410 | //qDebug("connected "); |
411 | if ( !mServerSocket->ok() ) { | 411 | if ( !mServerSocket->ok() ) { |
412 | KMessageBox::information( 0, i18n("Failed to bind or\nlisten to the port!")); | 412 | KMessageBox::information( 0, i18n("Failed to bind or\nlisten to the port!")); |
413 | delete mServerSocket; | 413 | delete mServerSocket; |
414 | mServerSocket = 0; | 414 | mServerSocket = 0; |
415 | return; | 415 | return; |
416 | } | 416 | } |
417 | mPrefs->mPassiveSyncAutoStart = autoStart; | 417 | mPrefs->mPassiveSyncAutoStart = autoStart; |
418 | if ( changed ) { | 418 | if ( changed ) { |
419 | mPrefs->writeConfig(); | 419 | mPrefs->writeConfig(); |
420 | } | 420 | } |
421 | connect( mServerSocket, SIGNAL ( request_file() ),this, SIGNAL ( request_file() ) ); | 421 | connect( mServerSocket, SIGNAL ( request_file() ),this, SIGNAL ( request_file() ) ); |
422 | connect( mServerSocket, SIGNAL ( file_received( bool ) ), this, SIGNAL ( getFile( bool ) ) ); | 422 | connect( mServerSocket, SIGNAL ( file_received( bool ) ), this, SIGNAL ( getFile( bool ) ) ); |
423 | } | 423 | } |
424 | 424 | ||
425 | void KSyncManager::syncLocalFile() | 425 | void KSyncManager::syncLocalFile() |
426 | { | 426 | { |
427 | 427 | ||
428 | QString fn =mPrefs->mLastSyncedLocalFile; | 428 | QString fn =mPrefs->mLastSyncedLocalFile; |
429 | QString ext; | 429 | QString ext; |
430 | 430 | ||
431 | switch(mTargetApp) | 431 | switch(mTargetApp) |
432 | { | 432 | { |
433 | case (KAPI): | 433 | case (KAPI): |
434 | ext = "(*.vcf)"; | 434 | ext = "(*.vcf)"; |
435 | break; | 435 | break; |
436 | case (KOPI): | 436 | case (KOPI): |
437 | ext = "(*.ics/*.vcs)"; | 437 | ext = "(*.ics/*.vcs)"; |
438 | break; | 438 | break; |
439 | case (PWMPI): | 439 | case (PWMPI): |
440 | ext = "(*.pwm)"; | 440 | ext = "(*.pwm)"; |
441 | break; | 441 | break; |
442 | default: | 442 | default: |
443 | qDebug("KSM::syncLocalFile: invalid apptype selected"); | 443 | qDebug("KSM::syncLocalFile: invalid apptype selected"); |
444 | break; | 444 | break; |
445 | 445 | ||
446 | } | 446 | } |
447 | 447 | ||
448 | fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename"+ext), mParent ); | 448 | fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename"+ext), mParent ); |
449 | if ( fn == "" ) | 449 | if ( fn == "" ) |
450 | return; | 450 | return; |
451 | if ( syncWithFile( fn, false ) ) { | 451 | if ( syncWithFile( fn, false ) ) { |
452 | qDebug("KSM::syncLocalFile() successful "); | 452 | qDebug("KSM::syncLocalFile() successful "); |
453 | } | 453 | } |
454 | 454 | ||
455 | } | 455 | } |
456 | 456 | ||
457 | bool KSyncManager::syncWithFile( QString fn , bool quick ) | 457 | bool KSyncManager::syncWithFile( QString fn , bool quick ) |
458 | { | 458 | { |
459 | bool ret = false; | 459 | bool ret = false; |
460 | QFileInfo info; | 460 | QFileInfo info; |
461 | info.setFile( fn ); | 461 | info.setFile( fn ); |
462 | QString mess; | 462 | QString mess; |
463 | bool loadbup = true; | ||
464 | if ( !info. exists() ) { | 463 | if ( !info. exists() ) { |
465 | mess = i18n( "Sync file \n...%1\ndoes not exist!\nNothing synced!\n").arg(fn.right( 30) ); | 464 | mess = i18n( "Sync file \n...%1\ndoes not exist!\nNothing synced!\n").arg(fn.right( 30) ); |
466 | int result = QMessageBox::warning( mParent, i18n("Warning!"), | 465 | QMessageBox::warning( mParent, i18n("Warning!"), |
467 | mess ); | 466 | mess ); |
468 | return ret; | 467 | return ret; |
469 | } | 468 | } |
470 | int result = 0; | 469 | int result = 0; |
471 | if ( !quick ) { | 470 | if ( !quick ) { |
472 | mess = i18n("Sync with file \n...%1\nfrom:\n%2\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); | 471 | mess = i18n("Sync with file \n...%1\nfrom:\n%2\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); |
473 | result = QMessageBox::warning( mParent, i18n("Warning!"), | 472 | result = QMessageBox::warning( mParent, i18n("Warning!"), |
474 | mess, | 473 | mess, |
475 | i18n("Sync"), i18n("Cancel"), 0, | 474 | i18n("Sync"), i18n("Cancel"), 0, |
476 | 0, 1 ); | 475 | 0, 1 ); |
477 | if ( result ) | 476 | if ( result ) |
478 | return false; | 477 | return false; |
479 | } | 478 | } |
480 | if ( mAskForPreferences ) | 479 | if ( mAskForPreferences ) |
481 | if ( !edit_sync_options()) { | 480 | if ( !edit_sync_options()) { |
482 | mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") ); | 481 | mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") ); |
483 | return false; | 482 | return false; |
484 | } | 483 | } |
485 | if ( result == 0 ) { | 484 | if ( result == 0 ) { |
486 | //qDebug("Now sycing ... "); | 485 | //qDebug("Now sycing ... "); |
487 | if ( ret = mImplementation->sync( this, fn, mSyncAlgoPrefs ) ) | 486 | if ( ret = mImplementation->sync( this, fn, mSyncAlgoPrefs ) ) |
488 | mParent->topLevelWidget()->setCaption( i18n("Synchronization successful") ); | 487 | mParent->topLevelWidget()->setCaption( i18n("Synchronization successful") ); |
489 | else | 488 | else |
490 | mParent->topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") ); | 489 | mParent->topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") ); |
491 | if ( ! quick ) | 490 | if ( ! quick ) |
492 | mPrefs->mLastSyncedLocalFile = fn; | 491 | mPrefs->mLastSyncedLocalFile = fn; |
493 | } | 492 | } |
494 | return ret; | 493 | return ret; |
495 | } | 494 | } |
496 | 495 | ||
497 | void KSyncManager::quickSyncLocalFile() | 496 | void KSyncManager::quickSyncLocalFile() |
498 | { | 497 | { |
499 | 498 | ||
500 | if ( syncWithFile( mPrefs->mLastSyncedLocalFile, true ) ) { | 499 | if ( syncWithFile( mPrefs->mLastSyncedLocalFile, true ) ) { |
501 | qDebug("KSM::quick syncLocalFile() successful "); | 500 | qDebug("KSM::quick syncLocalFile() successful "); |
502 | 501 | ||
503 | } | 502 | } |
504 | } | 503 | } |
505 | 504 | ||
506 | void KSyncManager::multiSync( bool askforPrefs ) | 505 | void KSyncManager::multiSync( bool askforPrefs ) |
507 | { | 506 | { |
508 | if (blockSave()) | 507 | if (blockSave()) |
509 | return; | 508 | return; |
510 | setBlockSave(true); | 509 | setBlockSave(true); |
511 | QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); | 510 | QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); |
512 | if ( QMessageBox::information( mParent, i18n("KDE-Pim Sync"), | 511 | if ( QMessageBox::information( mParent, i18n("KDE-Pim Sync"), |
513 | question, | 512 | question, |
514 | i18n("Yes"), i18n("No"), | 513 | i18n("Yes"), i18n("No"), |
515 | 0, 0 ) != 0 ) { | 514 | 0, 0 ) != 0 ) { |
516 | setBlockSave(false); | 515 | setBlockSave(false); |
517 | mParent->topLevelWidget()->setCaption(i18n("Aborted! Nothing synced!")); | 516 | mParent->topLevelWidget()->setCaption(i18n("Aborted! Nothing synced!")); |
518 | return; | 517 | return; |
519 | } | 518 | } |
520 | mCurrentSyncDevice = i18n("Multiple profiles") ; | 519 | mCurrentSyncDevice = i18n("Multiple profiles") ; |
521 | mSyncAlgoPrefs = mPrefs->mRingSyncAlgoPrefs; | 520 | mSyncAlgoPrefs = mPrefs->mRingSyncAlgoPrefs; |
522 | if ( askforPrefs ) { | 521 | if ( askforPrefs ) { |
523 | if ( !edit_sync_options()) { | 522 | if ( !edit_sync_options()) { |
524 | mParent->topLevelWidget()->setCaption( i18n("Syncing aborted.") ); | 523 | mParent->topLevelWidget()->setCaption( i18n("Syncing aborted.") ); |
525 | return; | 524 | return; |
526 | } | 525 | } |
527 | mPrefs->mRingSyncAlgoPrefs = mSyncAlgoPrefs; | 526 | mPrefs->mRingSyncAlgoPrefs = mSyncAlgoPrefs; |
528 | } | 527 | } |
529 | mParent->topLevelWidget()->setCaption(i18n("Multiple sync started.") ); | 528 | mParent->topLevelWidget()->setCaption(i18n("Multiple sync started.") ); |
530 | qApp->processEvents(); | 529 | qApp->processEvents(); |
531 | int num = ringSync() ; | 530 | int num = ringSync() ; |
532 | if ( num > 1 ) | 531 | if ( num > 1 ) |
533 | ringSync(); | 532 | ringSync(); |
534 | setBlockSave(false); | 533 | setBlockSave(false); |
535 | if ( num ) | 534 | if ( num ) |
536 | emit save(); | 535 | emit save(); |
537 | if ( num ) | 536 | if ( num ) |
538 | mParent->topLevelWidget()->setCaption(i18n("%1 profiles synced. Multiple sync complete!").arg(num) ); | 537 | mParent->topLevelWidget()->setCaption(i18n("%1 profiles synced. Multiple sync complete!").arg(num) ); |
539 | else | 538 | else |
540 | mParent->topLevelWidget()->setCaption(i18n("Nothing synced! No profiles defined for multisync!")); | 539 | mParent->topLevelWidget()->setCaption(i18n("Nothing synced! No profiles defined for multisync!")); |
541 | return; | 540 | return; |
542 | } | 541 | } |
543 | 542 | ||
544 | int KSyncManager::ringSync() | 543 | int KSyncManager::ringSync() |
545 | { | 544 | { |
546 | 545 | ||
547 | int syncedProfiles = 0; | 546 | int syncedProfiles = 0; |
548 | unsigned int i; | 547 | unsigned int i; |
549 | QTime timer; | 548 | QTime timer; |
550 | KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); | 549 | KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); |
551 | QStringList syncProfileNames = mSyncProfileNames; | 550 | QStringList syncProfileNames = mSyncProfileNames; |
552 | KSyncProfile* temp = new KSyncProfile (); | 551 | KSyncProfile* temp = new KSyncProfile (); |
553 | mAskForPreferences = false; | 552 | mAskForPreferences = false; |
554 | for ( i = 0; i < syncProfileNames.count(); ++i ) { | 553 | for ( i = 0; i < syncProfileNames.count(); ++i ) { |
555 | mCurrentSyncProfile = i; | 554 | mCurrentSyncProfile = i; |
556 | temp->setName(syncProfileNames[mCurrentSyncProfile]); | 555 | temp->setName(syncProfileNames[mCurrentSyncProfile]); |
557 | temp->readConfig(&config); | 556 | temp->readConfig(&config); |
558 | 557 | ||
559 | bool includeInRingSync; | 558 | bool includeInRingSync = false; |
560 | switch(mTargetApp) | 559 | switch(mTargetApp) |
561 | { | 560 | { |
562 | case (KAPI): | 561 | case (KAPI): |
563 | includeInRingSync = temp->getIncludeInRingSyncAB(); | 562 | includeInRingSync = temp->getIncludeInRingSyncAB(); |
564 | break; | 563 | break; |
565 | case (KOPI): | 564 | case (KOPI): |
566 | includeInRingSync = temp->getIncludeInRingSync(); | 565 | includeInRingSync = temp->getIncludeInRingSync(); |
567 | break; | 566 | break; |
568 | case (PWMPI): | 567 | case (PWMPI): |
569 | includeInRingSync = temp->getIncludeInRingSyncPWM(); | 568 | includeInRingSync = temp->getIncludeInRingSyncPWM(); |
570 | break; | 569 | break; |
571 | default: | 570 | default: |
572 | qDebug("KSM::ringSync: invalid apptype selected"); | 571 | qDebug("KSM::ringSync: invalid apptype selected"); |
573 | break; | 572 | break; |
574 | 573 | ||
575 | } | 574 | } |
576 | 575 | ||
577 | 576 | ||
578 | if ( includeInRingSync && ( i < 1 || i > 2 )) { | 577 | if ( includeInRingSync && ( i < 1 || i > 2 )) { |
579 | mParent->topLevelWidget()->setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... ")); | 578 | mParent->topLevelWidget()->setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... ")); |
580 | ++syncedProfiles; | 579 | ++syncedProfiles; |
581 | mSyncWithDesktop = false; | 580 | mSyncWithDesktop = false; |
582 | // mAskForPreferences = temp->getAskForPreferences(); | 581 | // mAskForPreferences = temp->getAskForPreferences(); |
583 | mWriteBackFile = temp->getWriteBackFile(); | 582 | mWriteBackFile = temp->getWriteBackFile(); |
584 | mWriteBackExistingOnly = temp->getWriteBackExisting(); | 583 | mWriteBackExistingOnly = temp->getWriteBackExisting(); |
585 | mIsKapiFile = temp->getIsKapiFile(); | 584 | mIsKapiFile = temp->getIsKapiFile(); |
586 | mWriteBackInFuture = 0; | 585 | mWriteBackInFuture = 0; |
587 | if ( temp->getWriteBackFuture() ) { | 586 | if ( temp->getWriteBackFuture() ) { |
588 | mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); | 587 | mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); |
589 | mWriteBackInPast = temp->getWriteBackPastWeeks( ); | 588 | mWriteBackInPast = temp->getWriteBackPastWeeks( ); |
590 | } | 589 | } |
591 | mFilterInCal = temp->getFilterInCal(); | 590 | mFilterInCal = temp->getFilterInCal(); |
592 | mFilterOutCal = temp->getFilterOutCal(); | 591 | mFilterOutCal = temp->getFilterOutCal(); |
593 | mFilterInAB = temp->getFilterInAB(); | 592 | mFilterInAB = temp->getFilterInAB(); |
594 | mFilterOutAB = temp->getFilterOutAB(); | 593 | mFilterOutAB = temp->getFilterOutAB(); |
595 | mShowSyncSummary = false; | 594 | mShowSyncSummary = false; |
596 | mCurrentSyncDevice = syncProfileNames[i] ; | 595 | mCurrentSyncDevice = syncProfileNames[i] ; |
597 | mCurrentSyncName = mLocalMachineName; | 596 | mCurrentSyncName = mLocalMachineName; |
598 | if ( i == 0 ) { | 597 | if ( i == 0 ) { |
599 | mIsKapiFile = false; | 598 | mIsKapiFile = false; |
600 | #ifdef DESKTOP_VERSION | 599 | #ifdef DESKTOP_VERSION |
601 | syncKDE(); | 600 | syncKDE(); |
602 | #else | 601 | #else |
603 | syncSharp(); | 602 | syncSharp(); |
604 | #endif | 603 | #endif |
605 | } else { | 604 | } else { |
606 | if ( temp->getIsLocalFileSync() ) { | 605 | if ( temp->getIsLocalFileSync() ) { |
607 | switch(mTargetApp) | 606 | switch(mTargetApp) |
608 | { | 607 | { |
609 | case (KAPI): | 608 | case (KAPI): |
610 | if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) ) | 609 | if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) ) |
611 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNameAB(); | 610 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNameAB(); |
612 | break; | 611 | break; |
613 | case (KOPI): | 612 | case (KOPI): |
614 | if ( syncWithFile( temp->getRemoteFileName( ), false ) ) | 613 | if ( syncWithFile( temp->getRemoteFileName( ), false ) ) |
615 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileName(); | 614 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileName(); |
616 | break; | 615 | break; |
617 | case (PWMPI): | 616 | case (PWMPI): |
618 | if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) ) | 617 | if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) ) |
619 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNamePWM(); | 618 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNamePWM(); |
620 | break; | 619 | break; |
621 | default: | 620 | default: |
622 | qDebug("KSM: invalid apptype selected"); | 621 | qDebug("KSM: invalid apptype selected"); |
623 | break; | 622 | break; |
diff --git a/libkdepim/phoneaccess.cpp b/libkdepim/phoneaccess.cpp index e24ad9e..89db22b 100644 --- a/libkdepim/phoneaccess.cpp +++ b/libkdepim/phoneaccess.cpp | |||
@@ -121,96 +121,96 @@ void PhoneAccess::writeConfig( QString device, QString connection, QString model | |||
121 | } | 121 | } |
122 | qDebug("Writing file %s ", fileName.latin1() ); | 122 | qDebug("Writing file %s ", fileName.latin1() ); |
123 | QTextStream ts( &file ); | 123 | QTextStream ts( &file ); |
124 | ts << content ; | 124 | ts << content ; |
125 | file.close(); | 125 | file.close(); |
126 | } | 126 | } |
127 | 127 | ||
128 | } | 128 | } |
129 | 129 | ||
130 | 130 | ||
131 | bool PhoneAccess::writeToPhone( QString fileName) | 131 | bool PhoneAccess::writeToPhone( QString fileName) |
132 | { | 132 | { |
133 | 133 | ||
134 | #ifdef DESKTOP_VERSION | 134 | #ifdef DESKTOP_VERSION |
135 | #ifdef _WIN32_ | 135 | #ifdef _WIN32_ |
136 | QString command ="kammu --restore " + fileName ; | 136 | QString command ="kammu --restore " + fileName ; |
137 | #else | 137 | #else |
138 | QString command ="./kammu --restore " + fileName ; | 138 | QString command ="./kammu --restore " + fileName ; |
139 | #endif | 139 | #endif |
140 | #else | 140 | #else |
141 | QString command ="kammu --restore " + fileName ; | 141 | QString command ="kammu --restore " + fileName ; |
142 | #endif | 142 | #endif |
143 | int ret = 1; | 143 | int ret = 1; |
144 | while ( ret != 0 ) { | 144 | while ( ret != 0 ) { |
145 | QLabel* status = new QLabel( i18n(" This may take 1-3 minutes!"), 0 ); | 145 | QLabel* status = new QLabel( i18n(" This may take 1-3 minutes!"), 0 ); |
146 | int w = 235; | 146 | int w = 235; |
147 | int h = status->sizeHint().height()+20 ; | 147 | int h = status->sizeHint().height()+20 ; |
148 | int dw = QApplication::desktop()->width(); | 148 | int dw = QApplication::desktop()->width(); |
149 | int dh = QApplication::desktop()->height(); | 149 | int dh = QApplication::desktop()->height(); |
150 | if ( dw > 310 ) | 150 | if ( dw > 310 ) |
151 | w = 310; | 151 | w = 310; |
152 | status->setCaption(i18n("Writing to phone...") ); | 152 | status->setCaption(i18n("Writing to phone...") ); |
153 | status->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 153 | status->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
154 | status->show(); | 154 | status->show(); |
155 | status->raise(); | 155 | status->raise(); |
156 | status->update(); | 156 | status->update(); |
157 | qApp->processEvents(); | 157 | qApp->processEvents(); |
158 | status->update(); | 158 | status->update(); |
159 | qApp->processEvents(); | 159 | qApp->processEvents(); |
160 | ret = system ( command.latin1()); | 160 | ret = system ( command.latin1()); |
161 | delete status; | 161 | delete status; |
162 | qApp->processEvents(); | 162 | qApp->processEvents(); |
163 | if ( ret ) { | 163 | if ( ret ) { |
164 | qDebug("Error S::command returned %d.", ret); | 164 | qDebug("Error S::command returned %d.", ret); |
165 | int retval = KMessageBox::warningContinueCancel(0, | 165 | int retval = KMessageBox::warningContinueCancel(0, |
166 | i18n("Error accessing device!\nPlease turn on connection\nand retry!"),i18n("KDE/Pim phone access"),i18n("Retry"),i18n("Cancel")); | 166 | i18n("Error accessing device!\nPlease turn on connection\nand retry!"),i18n("KDE/Pim phone access"),i18n("Retry"),i18n("Cancel")); |
167 | if ( retval != KMessageBox::Continue ) | 167 | if ( retval != KMessageBox::Continue ) |
168 | return false; | 168 | return false; |
169 | } | 169 | } |
170 | } | 170 | } |
171 | return true; | 171 | return true; |
172 | } | 172 | } |
173 | bool PhoneAccess::readFromPhone( QString fileName) | 173 | bool PhoneAccess::readFromPhone( QString fileName) |
174 | { | 174 | { |
175 | 175 | ||
176 | #ifdef DESKTOP_VERSION | 176 | #ifdef DESKTOP_VERSION |
177 | #ifdef _WIN32_ | 177 | #ifdef _WIN32_ |
178 | QString command ="kammu --backup " + fileName + " -yes" ; | 178 | QString command ="kammu --backup " + fileName + " -yes" ; |
179 | #else | 179 | #else |
180 | QString command ="./kammu --backup " + fileName + " -yes" ; | 180 | QString command ="./kammu --backup " + fileName + " -yes" ; |
181 | #endif | 181 | #endif |
182 | #else | 182 | #else |
183 | QString command ="kammu --backup " + fileName + " -yes" ; | 183 | QString command ="kammu --backup " + fileName + " -yes" ; |
184 | #endif | 184 | #endif |
185 | int ret; | 185 | int ret = 1; |
186 | while ( ret != 0 ) { | 186 | while ( ret != 0 ) { |
187 | QLabel* status = new QLabel( i18n(" This may take 1-3 minutes!"), 0 ); | 187 | QLabel* status = new QLabel( i18n(" This may take 1-3 minutes!"), 0 ); |
188 | int w = 235; | 188 | int w = 235; |
189 | int h = status->sizeHint().height()+20 ; | 189 | int h = status->sizeHint().height()+20 ; |
190 | int dw = QApplication::desktop()->width(); | 190 | int dw = QApplication::desktop()->width(); |
191 | int dh = QApplication::desktop()->height(); | 191 | int dh = QApplication::desktop()->height(); |
192 | if ( dw > 310 ) | 192 | if ( dw > 310 ) |
193 | w = 310; | 193 | w = 310; |
194 | status->setCaption(i18n("Reading from phone...") ); | 194 | status->setCaption(i18n("Reading from phone...") ); |
195 | status->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 195 | status->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
196 | status->show(); | 196 | status->show(); |
197 | status->raise(); | 197 | status->raise(); |
198 | status->update(); | 198 | status->update(); |
199 | qApp->processEvents(); | 199 | qApp->processEvents(); |
200 | status->update(); | 200 | status->update(); |
201 | qApp->processEvents(); | 201 | qApp->processEvents(); |
202 | ret = system ( command.latin1() ); | 202 | ret = system ( command.latin1() ); |
203 | delete status; | 203 | delete status; |
204 | qApp->processEvents(); | 204 | qApp->processEvents(); |
205 | if ( ret ) { | 205 | if ( ret ) { |
206 | qDebug("Error reading from phone:Command returned %d", ret); | 206 | qDebug("Error reading from phone:Command returned %d", ret); |
207 | int retval = KMessageBox::warningContinueCancel(0, | 207 | int retval = KMessageBox::warningContinueCancel(0, |
208 | i18n("Error accessing device!\nPlease turn on connection\nand retry!"),i18n("KDE/Pim phone access"),i18n("Retry"),i18n("Cancel")); | 208 | i18n("Error accessing device!\nPlease turn on connection\nand retry!"),i18n("KDE/Pim phone access"),i18n("Retry"),i18n("Cancel")); |
209 | if ( retval != KMessageBox::Continue ) | 209 | if ( retval != KMessageBox::Continue ) |
210 | return false; | 210 | return false; |
211 | 211 | ||
212 | } | 212 | } |
213 | } | 213 | } |
214 | qApp->processEvents(); | 214 | qApp->processEvents(); |
215 | return true; | 215 | return true; |
216 | } | 216 | } |