-rw-r--r-- | kaddressbook/kabcore.cpp | 23 | ||||
-rw-r--r-- | kaddressbook/viewmanager.cpp | 5 | ||||
-rw-r--r-- | kaddressbook/viewmanager.h | 1 |
3 files changed, 27 insertions, 2 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 2f00a09..ea87929 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -1291,52 +1291,54 @@ void KABCore::setDetailsToState() | |||
1291 | 1291 | ||
1292 | void KABCore::setDetailsVisible( bool visible ) | 1292 | void KABCore::setDetailsVisible( bool visible ) |
1293 | { | 1293 | { |
1294 | if (visible && mDetails->isHidden()) | 1294 | if (visible && mDetails->isHidden()) |
1295 | { | 1295 | { |
1296 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); | 1296 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); |
1297 | if ( addrList.count() > 0 ) | 1297 | if ( addrList.count() > 0 ) |
1298 | mDetails->setAddressee( addrList[ 0 ] ); | 1298 | mDetails->setAddressee( addrList[ 0 ] ); |
1299 | } | 1299 | } |
1300 | 1300 | ||
1301 | // mMultipleViewsAtOnce=false: mDetails is always visible. But we switch between | 1301 | // mMultipleViewsAtOnce=false: mDetails is always visible. But we switch between |
1302 | // the listview and the detailview. We do that by changing the splitbar size. | 1302 | // the listview and the detailview. We do that by changing the splitbar size. |
1303 | if (mMultipleViewsAtOnce) | 1303 | if (mMultipleViewsAtOnce) |
1304 | { | 1304 | { |
1305 | if ( visible ) | 1305 | if ( visible ) |
1306 | mDetails->show(); | 1306 | mDetails->show(); |
1307 | else | 1307 | else |
1308 | mDetails->hide(); | 1308 | mDetails->hide(); |
1309 | } | 1309 | } |
1310 | else | 1310 | else |
1311 | { | 1311 | { |
1312 | if ( visible ) { | 1312 | if ( visible ) { |
1313 | mViewManager->hide(); | 1313 | mViewManager->hide(); |
1314 | mDetails->show(); | 1314 | mDetails->show(); |
1315 | mIncSearchWidget->setFocus(); | ||
1315 | } | 1316 | } |
1316 | else { | 1317 | else { |
1317 | mViewManager->show(); | 1318 | mViewManager->show(); |
1318 | mDetails->hide(); | 1319 | mDetails->hide(); |
1320 | mViewManager->setFocusAV(); | ||
1319 | } | 1321 | } |
1320 | setJumpButtonBarVisible( !visible ); | 1322 | setJumpButtonBarVisible( !visible ); |
1321 | } | 1323 | } |
1322 | 1324 | ||
1323 | } | 1325 | } |
1324 | 1326 | ||
1325 | void KABCore::extensionChanged( int id ) | 1327 | void KABCore::extensionChanged( int id ) |
1326 | { | 1328 | { |
1327 | //change the details view only for non desktop systems | 1329 | //change the details view only for non desktop systems |
1328 | #ifndef DESKTOP_VERSION | 1330 | #ifndef DESKTOP_VERSION |
1329 | 1331 | ||
1330 | if (id == 0) | 1332 | if (id == 0) |
1331 | { | 1333 | { |
1332 | //the user disabled the extension. | 1334 | //the user disabled the extension. |
1333 | 1335 | ||
1334 | if (mMultipleViewsAtOnce) | 1336 | if (mMultipleViewsAtOnce) |
1335 | { // enable detailsview again | 1337 | { // enable detailsview again |
1336 | setDetailsVisible( true ); | 1338 | setDetailsVisible( true ); |
1337 | mActionDetails->setChecked( true ); | 1339 | mActionDetails->setChecked( true ); |
1338 | } | 1340 | } |
1339 | else | 1341 | else |
1340 | { //go back to the listview | 1342 | { //go back to the listview |
1341 | setDetailsVisible( false ); | 1343 | setDetailsVisible( false ); |
1342 | mActionDetails->setChecked( false ); | 1344 | mActionDetails->setChecked( false ); |
@@ -2023,48 +2025,51 @@ void KABCore::addActionsManually() | |||
2023 | mActionDetails->plug( tb ); | 2025 | mActionDetails->plug( tb ); |
2024 | settingsMenu->insertSeparator(); | 2026 | settingsMenu->insertSeparator(); |
2025 | mActionBR->plug(settingsMenu ); | 2027 | mActionBR->plug(settingsMenu ); |
2026 | settingsMenu->insertSeparator(); | 2028 | settingsMenu->insertSeparator(); |
2027 | 2029 | ||
2028 | mActionWhoAmI->plug( settingsMenu ); | 2030 | mActionWhoAmI->plug( settingsMenu ); |
2029 | mActionCategories->plug( settingsMenu ); | 2031 | mActionCategories->plug( settingsMenu ); |
2030 | 2032 | ||
2031 | 2033 | ||
2032 | mActionWN->plug( helpMenu ); | 2034 | mActionWN->plug( helpMenu ); |
2033 | mActionSyncHowto->plug( helpMenu ); | 2035 | mActionSyncHowto->plug( helpMenu ); |
2034 | mActionLicence->plug( helpMenu ); | 2036 | mActionLicence->plug( helpMenu ); |
2035 | mActionFaq->plug( helpMenu ); | 2037 | mActionFaq->plug( helpMenu ); |
2036 | mActionAboutKAddressbook->plug( helpMenu ); | 2038 | mActionAboutKAddressbook->plug( helpMenu ); |
2037 | 2039 | ||
2038 | if (KGlobal::getDesktopSize() > KGlobal::Small ) { | 2040 | if (KGlobal::getDesktopSize() > KGlobal::Small ) { |
2039 | 2041 | ||
2040 | mActionSave->plug( tb ); | 2042 | mActionSave->plug( tb ); |
2041 | mViewManager->getFilterAction()->plug ( tb); | 2043 | mViewManager->getFilterAction()->plug ( tb); |
2042 | if (KGlobal::getDesktopSize() == KGlobal::Desktop ) { | 2044 | if (KGlobal::getDesktopSize() == KGlobal::Desktop ) { |
2043 | mActionUndo->plug( tb ); | 2045 | mActionUndo->plug( tb ); |
2044 | mActionDelete->plug( tb ); | 2046 | mActionDelete->plug( tb ); |
2045 | mActionRedo->plug( tb ); | 2047 | mActionRedo->plug( tb ); |
2046 | } | 2048 | } |
2049 | } else { | ||
2050 | if (KABPrefs::instance()->mMultipleViewsAtOnce ) | ||
2051 | mActionSave->plug( tb ); | ||
2047 | } | 2052 | } |
2048 | //mActionQuit->plug ( tb ); | 2053 | //mActionQuit->plug ( tb ); |
2049 | // tb->insertWidget(-1, 0, mIncSearchWidget, 6); | 2054 | // tb->insertWidget(-1, 0, mIncSearchWidget, 6); |
2050 | 2055 | ||
2051 | //US link the searchwidget first to this. | 2056 | //US link the searchwidget first to this. |
2052 | // The real linkage to the toolbar happens later. | 2057 | // The real linkage to the toolbar happens later. |
2053 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); | 2058 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); |
2054 | //US tb->insertItem( mIncSearchWidget ); | 2059 | //US tb->insertItem( mIncSearchWidget ); |
2055 | /*US | 2060 | /*US |
2056 | mIncSearchWidget = new IncSearchWidget( tb ); | 2061 | mIncSearchWidget = new IncSearchWidget( tb ); |
2057 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 2062 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
2058 | SLOT( incrementalSearch( const QString& ) ) ); | 2063 | SLOT( incrementalSearch( const QString& ) ) ); |
2059 | 2064 | ||
2060 | mJumpButtonBar = new JumpButtonBar( this, this ); | 2065 | mJumpButtonBar = new JumpButtonBar( this, this ); |
2061 | 2066 | ||
2062 | //US topLayout->addWidget( mJumpButtonBar ); | 2067 | //US topLayout->addWidget( mJumpButtonBar ); |
2063 | this->layout()->add( mJumpButtonBar ); | 2068 | this->layout()->add( mJumpButtonBar ); |
2064 | */ | 2069 | */ |
2065 | 2070 | ||
2066 | #endif //KAB_EMBEDDED | 2071 | #endif //KAB_EMBEDDED |
2067 | 2072 | ||
2068 | mActionExport2phone->plug( ExportMenu ); | 2073 | mActionExport2phone->plug( ExportMenu ); |
2069 | connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); | 2074 | connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); |
2070 | syncManager->fillSyncMenu(); | 2075 | syncManager->fillSyncMenu(); |
@@ -2486,49 +2491,58 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo | |||
2486 | { | 2491 | { |
2487 | bool syncOK = true; | 2492 | bool syncOK = true; |
2488 | int addedAddressee = 0; | 2493 | int addedAddressee = 0; |
2489 | int addedAddresseeR = 0; | 2494 | int addedAddresseeR = 0; |
2490 | int deletedAddresseeR = 0; | 2495 | int deletedAddresseeR = 0; |
2491 | int deletedAddresseeL = 0; | 2496 | int deletedAddresseeL = 0; |
2492 | int changedLocal = 0; | 2497 | int changedLocal = 0; |
2493 | int changedRemote = 0; | 2498 | int changedRemote = 0; |
2494 | 2499 | ||
2495 | QString mCurrentSyncName = syncManager->getCurrentSyncName(); | 2500 | QString mCurrentSyncName = syncManager->getCurrentSyncName(); |
2496 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); | 2501 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); |
2497 | 2502 | ||
2498 | //QPtrList<Addressee> el = local->rawAddressees(); | 2503 | //QPtrList<Addressee> el = local->rawAddressees(); |
2499 | Addressee addresseeR; | 2504 | Addressee addresseeR; |
2500 | QString uid; | 2505 | QString uid; |
2501 | int take; | 2506 | int take; |
2502 | Addressee addresseeL; | 2507 | Addressee addresseeL; |
2503 | Addressee addresseeRSync; | 2508 | Addressee addresseeRSync; |
2504 | Addressee addresseeLSync; | 2509 | Addressee addresseeLSync; |
2505 | // KABC::Addressee::List addresseeRSyncSharp = remote->getExternLastSyncAddressees(); | 2510 | // KABC::Addressee::List addresseeRSyncSharp = remote->getExternLastSyncAddressees(); |
2506 | //KABC::Addressee::List addresseeLSyncSharp = local->getExternLastSyncAddressees(); | 2511 | //KABC::Addressee::List addresseeLSyncSharp = local->getExternLastSyncAddressees(); |
2507 | bool fullDateRange = false; | 2512 | bool fullDateRange = false; |
2508 | local->resetTempSyncStat(); | 2513 | local->resetTempSyncStat(); |
2509 | mLastAddressbookSync = QDateTime::currentDateTime(); | 2514 | mLastAddressbookSync = QDateTime::currentDateTime(); |
2510 | QDateTime modifiedCalendar = mLastAddressbookSync;; | 2515 | if ( syncManager->syncWithDesktop() ) { |
2516 | remote->removeSyncInfo( QString());//remove all info | ||
2517 | if ( KSyncManager::mRequestedSyncEvent.isValid() ) { | ||
2518 | mLastAddressbookSync = KSyncManager::mRequestedSyncEvent; | ||
2519 | qDebug("using extern time for calendar sync: %s ", mLastAddressbookSync.toString().latin1() ); | ||
2520 | } else { | ||
2521 | qDebug("ERROR: KSyncManager::mRequestedSyncEvent has invalid datatime "); | ||
2522 | } | ||
2523 | } | ||
2524 | QDateTime modifiedCalendar = mLastAddressbookSync; | ||
2511 | addresseeLSync = getLastSyncAddressee(); | 2525 | addresseeLSync = getLastSyncAddressee(); |
2512 | qDebug("Last Sync %s ", addresseeLSync.revision().toString().latin1()); | 2526 | qDebug("Last Sync %s ", addresseeLSync.revision().toString().latin1()); |
2513 | addresseeR = remote->findByUid("last-syncAddressee-"+mCurrentSyncName ); | 2527 | addresseeR = remote->findByUid("last-syncAddressee-"+mCurrentSyncName ); |
2514 | if ( !addresseeR.isEmpty() ) { | 2528 | if ( !addresseeR.isEmpty() ) { |
2515 | addresseeRSync = addresseeR; | 2529 | addresseeRSync = addresseeR; |
2516 | remote->removeAddressee(addresseeR ); | 2530 | remote->removeAddressee(addresseeR ); |
2517 | 2531 | ||
2518 | } else { | 2532 | } else { |
2519 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2533 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2520 | addresseeRSync = addresseeLSync ; | 2534 | addresseeRSync = addresseeLSync ; |
2521 | } else { | 2535 | } else { |
2522 | qDebug("FULLDATE 1"); | 2536 | qDebug("FULLDATE 1"); |
2523 | fullDateRange = true; | 2537 | fullDateRange = true; |
2524 | Addressee newAdd; | 2538 | Addressee newAdd; |
2525 | addresseeRSync = newAdd; | 2539 | addresseeRSync = newAdd; |
2526 | addresseeRSync.setFamilyName(mCurrentSyncName + i18n(" - sync addressee")); | 2540 | addresseeRSync.setFamilyName(mCurrentSyncName + i18n(" - sync addressee")); |
2527 | addresseeRSync.setUid("last-syncAddressee-"+mCurrentSyncName ); | 2541 | addresseeRSync.setUid("last-syncAddressee-"+mCurrentSyncName ); |
2528 | addresseeRSync.setRevision( mLastAddressbookSync ); | 2542 | addresseeRSync.setRevision( mLastAddressbookSync ); |
2529 | addresseeRSync.setCategories( i18n("SyncAddressee") ); | 2543 | addresseeRSync.setCategories( i18n("SyncAddressee") ); |
2530 | } | 2544 | } |
2531 | } | 2545 | } |
2532 | if ( addresseeLSync.revision() == mLastAddressbookSync ) { | 2546 | if ( addresseeLSync.revision() == mLastAddressbookSync ) { |
2533 | qDebug("FULLDATE 2"); | 2547 | qDebug("FULLDATE 2"); |
2534 | fullDateRange = true; | 2548 | fullDateRange = true; |
@@ -2584,48 +2598,50 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo | |||
2584 | //inL.setResource( 0 ); | 2598 | //inL.setResource( 0 ); |
2585 | //inR.setResource( 0 ); | 2599 | //inR.setResource( 0 ); |
2586 | if ( !inL.isEmpty() ) { // maybe conflict - same uid in both calendars | 2600 | if ( !inL.isEmpty() ) { // maybe conflict - same uid in both calendars |
2587 | if ( !inL.resource() || inL.resource()->includeInSync() ) { | 2601 | if ( !inL.resource() || inL.resource()->includeInSync() ) { |
2588 | if ( take = takeAddressee( &inL, &inR, mode, fullDateRange ) ) { | 2602 | if ( take = takeAddressee( &inL, &inR, mode, fullDateRange ) ) { |
2589 | //qDebug("take %d %s ", take, inL.summary().latin1()); | 2603 | //qDebug("take %d %s ", take, inL.summary().latin1()); |
2590 | if ( take == 3 ) | 2604 | if ( take == 3 ) |
2591 | return false; | 2605 | return false; |
2592 | if ( take == 1 ) {// take local | 2606 | if ( take == 1 ) {// take local |
2593 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2607 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2594 | inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); | 2608 | inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); |
2595 | inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); | 2609 | inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); |
2596 | local->insertAddressee( inL, false ); | 2610 | local->insertAddressee( inL, false ); |
2597 | idS = inR.externalUID(); | 2611 | idS = inR.externalUID(); |
2598 | OidS = inR.originalExternalUID(); | 2612 | OidS = inR.originalExternalUID(); |
2599 | } | 2613 | } |
2600 | else | 2614 | else |
2601 | idS = inR.IDStr(); | 2615 | idS = inR.IDStr(); |
2602 | remote->removeAddressee( inR ); | 2616 | remote->removeAddressee( inR ); |
2603 | inR = inL; | 2617 | inR = inL; |
2604 | inR.setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); | 2618 | inR.setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); |
2605 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2619 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2606 | inR.setOriginalExternalUID( OidS ); | 2620 | inR.setOriginalExternalUID( OidS ); |
2607 | inR.setExternalUID( idS ); | 2621 | inR.setExternalUID( idS ); |
2622 | if ( syncManager->syncWithDesktop() ) | ||
2623 | inR.setIDStr( "changed" ); | ||
2608 | } else { | 2624 | } else { |
2609 | inR.setIDStr( idS ); | 2625 | inR.setIDStr( idS ); |
2610 | } | 2626 | } |
2611 | inR.setResource( 0 ); | 2627 | inR.setResource( 0 ); |
2612 | remote->insertAddressee( inR , false); | 2628 | remote->insertAddressee( inR , false); |
2613 | ++changedRemote; | 2629 | ++changedRemote; |
2614 | } else { // take == 2 take remote | 2630 | } else { // take == 2 take remote |
2615 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2631 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2616 | if ( inR.revision().date().year() < 2004 ) | 2632 | if ( inR.revision().date().year() < 2004 ) |
2617 | inR.setRevision( modifiedCalendar ); | 2633 | inR.setRevision( modifiedCalendar ); |
2618 | } | 2634 | } |
2619 | idS = inL.IDStr(); | 2635 | idS = inL.IDStr(); |
2620 | local->removeAddressee( inL ); | 2636 | local->removeAddressee( inL ); |
2621 | inL = inR; | 2637 | inL = inR; |
2622 | inL.setIDStr( idS ); | 2638 | inL.setIDStr( idS ); |
2623 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2639 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2624 | inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); | 2640 | inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); |
2625 | inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); | 2641 | inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); |
2626 | } | 2642 | } |
2627 | inL.setResource( 0 ); | 2643 | inL.setResource( 0 ); |
2628 | local->insertAddressee( inL , false ); | 2644 | local->insertAddressee( inL , false ); |
2629 | ++changedLocal; | 2645 | ++changedLocal; |
2630 | } | 2646 | } |
2631 | } | 2647 | } |
@@ -2876,41 +2892,44 @@ bool KABCore::syncPhone() | |||
2876 | abLocal.findNewExtIds( fileName, mCurrentSyncDevice ); | 2892 | abLocal.findNewExtIds( fileName, mCurrentSyncDevice ); |
2877 | //abLocal.preparePhoneSync( mCurrentSyncDevice, false ); | 2893 | //abLocal.preparePhoneSync( mCurrentSyncDevice, false ); |
2878 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ); | 2894 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ); |
2879 | } | 2895 | } |
2880 | } | 2896 | } |
2881 | setModified(); | 2897 | setModified(); |
2882 | } | 2898 | } |
2883 | if ( syncOK ) | 2899 | if ( syncOK ) |
2884 | mViewManager->refreshView(); | 2900 | mViewManager->refreshView(); |
2885 | return syncOK; | 2901 | return syncOK; |
2886 | } | 2902 | } |
2887 | void KABCore::getFile( bool success ) | 2903 | void KABCore::getFile( bool success ) |
2888 | { | 2904 | { |
2889 | if ( ! success ) { | 2905 | if ( ! success ) { |
2890 | message( i18n("Error receiving file. Nothing changed!") ); | 2906 | message( i18n("Error receiving file. Nothing changed!") ); |
2891 | return; | 2907 | return; |
2892 | } | 2908 | } |
2893 | int count = mAddressBook->importFromFile( sentSyncFile() , false, true ); | 2909 | int count = mAddressBook->importFromFile( sentSyncFile() , false, true ); |
2894 | if ( count ) | 2910 | if ( count ) |
2895 | setModified( true ); | 2911 | setModified( true ); |
2896 | message( i18n("Pi-Sync successful!") ); | 2912 | message( i18n("Pi-Sync successful!") ); |
2897 | mViewManager->refreshView(); | 2913 | mViewManager->refreshView(); |
2898 | } | 2914 | } |
2899 | void KABCore::syncFileRequest() | 2915 | void KABCore::syncFileRequest() |
2900 | { | 2916 | { |
2917 | if ( KABPrefs::instance()->mPassiveSyncWithDesktop ) { | ||
2918 | syncManager->slotSyncMenu( 999 ); | ||
2919 | } | ||
2901 | mAddressBook->export2File( sentSyncFile() ); | 2920 | mAddressBook->export2File( sentSyncFile() ); |
2902 | } | 2921 | } |
2903 | QString KABCore::sentSyncFile() | 2922 | QString KABCore::sentSyncFile() |
2904 | { | 2923 | { |
2905 | #ifdef DESKTOP_VERSION | 2924 | #ifdef DESKTOP_VERSION |
2906 | return locateLocal( "tmp", "copysyncab.vcf" ); | 2925 | return locateLocal( "tmp", "copysyncab.vcf" ); |
2907 | #else | 2926 | #else |
2908 | return QString( "/tmp/copysyncab.vcf" ); | 2927 | return QString( "/tmp/copysyncab.vcf" ); |
2909 | #endif | 2928 | #endif |
2910 | } | 2929 | } |
2911 | 2930 | ||
2912 | void KABCore::setCaptionBack() | 2931 | void KABCore::setCaptionBack() |
2913 | { | 2932 | { |
2914 | mMessageTimer->stop(); | 2933 | mMessageTimer->stop(); |
2915 | topLevelWidget()->setCaption( i18n("KAddressbook/Pi") ); | 2934 | topLevelWidget()->setCaption( i18n("KAddressbook/Pi") ); |
2916 | } | 2935 | } |
diff --git a/kaddressbook/viewmanager.cpp b/kaddressbook/viewmanager.cpp index f4fb08b..81e0d99 100644 --- a/kaddressbook/viewmanager.cpp +++ b/kaddressbook/viewmanager.cpp | |||
@@ -279,48 +279,53 @@ void ViewManager::setActiveView( const QString &name ) | |||
279 | 279 | ||
280 | //US performance optimization. setActiveFilter calls also mActiveView->refresh() | 280 | //US performance optimization. setActiveFilter calls also mActiveView->refresh() |
281 | //US mActiveView->refresh(); | 281 | //US mActiveView->refresh(); |
282 | 282 | ||
283 | } | 283 | } |
284 | else | 284 | else |
285 | { | 285 | { |
286 | qDebug("ViewManager::setActiveView: unable to find view" ); | 286 | qDebug("ViewManager::setActiveView: unable to find view" ); |
287 | kdDebug(5720) << "ViewManager::setActiveView: unable to find view\n"; | 287 | kdDebug(5720) << "ViewManager::setActiveView: unable to find view\n"; |
288 | } | 288 | } |
289 | } | 289 | } |
290 | 290 | ||
291 | //US added another method with no parameter, since my moc compiler does not support default parameters. | 291 | //US added another method with no parameter, since my moc compiler does not support default parameters. |
292 | void ViewManager::refreshView() | 292 | void ViewManager::refreshView() |
293 | { | 293 | { |
294 | refreshView( QString::null ); | 294 | refreshView( QString::null ); |
295 | } | 295 | } |
296 | 296 | ||
297 | void ViewManager::refreshView( const QString &uid ) | 297 | void ViewManager::refreshView( const QString &uid ) |
298 | { | 298 | { |
299 | if ( mActiveView ) | 299 | if ( mActiveView ) |
300 | mActiveView->refresh( uid ); | 300 | mActiveView->refresh( uid ); |
301 | } | 301 | } |
302 | 302 | ||
303 | void ViewManager::setFocusAV() | ||
304 | { | ||
305 | if ( mActiveView ) | ||
306 | mActiveView->setFocus(); | ||
307 | } | ||
303 | void ViewManager::editView() | 308 | void ViewManager::editView() |
304 | { | 309 | { |
305 | if ( !mActiveView ) | 310 | if ( !mActiveView ) |
306 | return; | 311 | return; |
307 | 312 | ||
308 | ViewFactory *factory = mViewFactoryDict.find( mActiveView->type() ); | 313 | ViewFactory *factory = mViewFactoryDict.find( mActiveView->type() ); |
309 | ViewConfigureWidget *wdg = 0; | 314 | ViewConfigureWidget *wdg = 0; |
310 | ViewConfigureDialog* dlg = 0; | 315 | ViewConfigureDialog* dlg = 0; |
311 | if ( factory ) { | 316 | if ( factory ) { |
312 | // Save the filters so the dialog has the latest set | 317 | // Save the filters so the dialog has the latest set |
313 | Filter::save( mCore->config(), "Filter", mFilterList ); | 318 | Filter::save( mCore->config(), "Filter", mFilterList ); |
314 | dlg = new ViewConfigureDialog( 0, mActiveView->caption(), this, "conf_dlg" ); | 319 | dlg = new ViewConfigureDialog( 0, mActiveView->caption(), this, "conf_dlg" ); |
315 | wdg = factory->configureWidget( mCore->addressBook(), dlg,"conf_wid" ); | 320 | wdg = factory->configureWidget( mCore->addressBook(), dlg,"conf_wid" ); |
316 | } else { | 321 | } else { |
317 | qDebug("ViewManager::editView()::cannot find viewfactory "); | 322 | qDebug("ViewManager::editView()::cannot find viewfactory "); |
318 | return; | 323 | return; |
319 | } | 324 | } |
320 | if ( wdg ) { | 325 | if ( wdg ) { |
321 | dlg->setWidget( wdg ); | 326 | dlg->setWidget( wdg ); |
322 | 327 | ||
323 | #ifndef DESKTOP_VERSION | 328 | #ifndef DESKTOP_VERSION |
324 | //dlg.setMaximumSize( 640, 480 ); | 329 | //dlg.setMaximumSize( 640, 480 ); |
325 | //dlg->setGeometry( 40,40, 400, 300); | 330 | //dlg->setGeometry( 40,40, 400, 300); |
326 | dlg->showMaximized(); | 331 | dlg->showMaximized(); |
diff --git a/kaddressbook/viewmanager.h b/kaddressbook/viewmanager.h index 585f4e9..a03a83f 100644 --- a/kaddressbook/viewmanager.h +++ b/kaddressbook/viewmanager.h | |||
@@ -43,48 +43,49 @@ namespace KABC { class AddressBook; } | |||
43 | manager will load the views at startup and display a view when told to | 43 | manager will load the views at startup and display a view when told to |
44 | make one active. | 44 | make one active. |
45 | 45 | ||
46 | The view manager will also create and manage all dialogs directly related to | 46 | The view manager will also create and manage all dialogs directly related to |
47 | views (ie: AddView, ConfigureView, DeleteView, etc). | 47 | views (ie: AddView, ConfigureView, DeleteView, etc). |
48 | */ | 48 | */ |
49 | class ViewManager : public QWidget | 49 | class ViewManager : public QWidget |
50 | { | 50 | { |
51 | Q_OBJECT | 51 | Q_OBJECT |
52 | public: | 52 | public: |
53 | ViewManager( KABCore *core, QWidget *parent, const char *name = 0 ); | 53 | ViewManager( KABCore *core, QWidget *parent, const char *name = 0 ); |
54 | ~ViewManager(); | 54 | ~ViewManager(); |
55 | 55 | ||
56 | void restoreSettings(); | 56 | void restoreSettings(); |
57 | void saveSettings(); | 57 | void saveSettings(); |
58 | void doSearch( const QString& s ,KABC::Field *field ); | 58 | void doSearch( const QString& s ,KABC::Field *field ); |
59 | 59 | ||
60 | void unloadViews(); | 60 | void unloadViews(); |
61 | KSelectAction * getFilterAction() { return mActionSelectFilter; } | 61 | KSelectAction * getFilterAction() { return mActionSelectFilter; } |
62 | 62 | ||
63 | QStringList selectedUids() const; | 63 | QStringList selectedUids() const; |
64 | QStringList selectedEmails() const; | 64 | QStringList selectedEmails() const; |
65 | KABC::Addressee::List selectedAddressees() const; | 65 | KABC::Addressee::List selectedAddressees() const; |
66 | void setListSelected(QStringList); | 66 | void setListSelected(QStringList); |
67 | void setFocusAV(); | ||
67 | 68 | ||
68 | public slots: | 69 | public slots: |
69 | void scrollUP(); | 70 | void scrollUP(); |
70 | void scrollDOWN(); | 71 | void scrollDOWN(); |
71 | 72 | ||
72 | //US void setSelected( const QString &uid = QString::null, bool selected = true ); | 73 | //US void setSelected( const QString &uid = QString::null, bool selected = true ); |
73 | void setSelected( const QString &uid, bool); | 74 | void setSelected( const QString &uid, bool); |
74 | //US added another method with no parameter, since my moc compiler does not support default parameters. | 75 | //US added another method with no parameter, since my moc compiler does not support default parameters. |
75 | void setSelected(); | 76 | void setSelected(); |
76 | 77 | ||
77 | 78 | ||
78 | 79 | ||
79 | //US added another method with no parameter, since my moc compiler does not support default parameters. | 80 | //US added another method with no parameter, since my moc compiler does not support default parameters. |
80 | void refreshView(); | 81 | void refreshView(); |
81 | void refreshView( const QString &uid); | 82 | void refreshView( const QString &uid); |
82 | 83 | ||
83 | void editView(); | 84 | void editView(); |
84 | void deleteView(); | 85 | void deleteView(); |
85 | void addView(); | 86 | void addView(); |
86 | 87 | ||
87 | protected slots: | 88 | protected slots: |
88 | /** | 89 | /** |
89 | Called whenever the user drops something in the active view. | 90 | Called whenever the user drops something in the active view. |
90 | This method will try to decode what was dropped, and if it was | 91 | This method will try to decode what was dropped, and if it was |