-rw-r--r-- | kaddressbook/kabcore.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 3f7a7da..e8f6132 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -1350,192 +1350,197 @@ void KABCore::editContact( const QString &uid ) | |||
1350 | } | 1350 | } |
1351 | } | 1351 | } |
1352 | 1352 | ||
1353 | /** | 1353 | /** |
1354 | Shows or edits the detail view for the given uid. If the uid is QString::null, | 1354 | Shows or edits the detail view for the given uid. If the uid is QString::null, |
1355 | the method will try to find a selected addressee in the view. | 1355 | the method will try to find a selected addressee in the view. |
1356 | */ | 1356 | */ |
1357 | void KABCore::executeContact( const QString &uid /*US = QString::null*/ ) | 1357 | void KABCore::executeContact( const QString &uid /*US = QString::null*/ ) |
1358 | { | 1358 | { |
1359 | if ( mMultipleViewsAtOnce ) | 1359 | if ( mMultipleViewsAtOnce ) |
1360 | { | 1360 | { |
1361 | editContact( uid ); | 1361 | editContact( uid ); |
1362 | } | 1362 | } |
1363 | else | 1363 | else |
1364 | { | 1364 | { |
1365 | setDetailsVisible( true ); | 1365 | setDetailsVisible( true ); |
1366 | mActionDetails->setChecked(true); | 1366 | mActionDetails->setChecked(true); |
1367 | } | 1367 | } |
1368 | 1368 | ||
1369 | } | 1369 | } |
1370 | 1370 | ||
1371 | void KABCore::save() | 1371 | void KABCore::save() |
1372 | { | 1372 | { |
1373 | if (syncManager->blockSave()) | 1373 | if (syncManager->blockSave()) |
1374 | return; | 1374 | return; |
1375 | if ( !mModified ) | 1375 | if ( !mModified ) |
1376 | return; | 1376 | return; |
1377 | 1377 | ||
1378 | syncManager->setBlockSave(true); | 1378 | syncManager->setBlockSave(true); |
1379 | QString text = i18n( "There was an error while attempting to save\n the " | 1379 | QString text = i18n( "There was an error while attempting to save\n the " |
1380 | "address book. Please check that some \nother application is " | 1380 | "address book. Please check that some \nother application is " |
1381 | "not using it. " ); | 1381 | "not using it. " ); |
1382 | message(i18n("Saving ... please wait! "), false); | 1382 | message(i18n("Saving ... please wait! "), false); |
1383 | //qApp->processEvents(); | 1383 | //qApp->processEvents(); |
1384 | #ifndef KAB_EMBEDDED | 1384 | #ifndef KAB_EMBEDDED |
1385 | KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); | 1385 | KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); |
1386 | if ( !b || !b->save() ) { | 1386 | if ( !b || !b->save() ) { |
1387 | KMessageBox::error( this, text, i18n( "Unable to Save" ) ); | 1387 | KMessageBox::error( this, text, i18n( "Unable to Save" ) ); |
1388 | } | 1388 | } |
1389 | #else //KAB_EMBEDDED | 1389 | #else //KAB_EMBEDDED |
1390 | KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); | 1390 | KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); |
1391 | if ( !b || !b->save() ) { | 1391 | if ( !b || !b->save() ) { |
1392 | QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok")); | 1392 | QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok")); |
1393 | } | 1393 | } |
1394 | #endif //KAB_EMBEDDED | 1394 | #endif //KAB_EMBEDDED |
1395 | 1395 | ||
1396 | message(i18n("Addressbook saved!")); | 1396 | message(i18n("Addressbook saved!")); |
1397 | setModified( false ); | 1397 | setModified( false ); |
1398 | syncManager->setBlockSave(false); | 1398 | syncManager->setBlockSave(false); |
1399 | } | 1399 | } |
1400 | 1400 | ||
1401 | 1401 | ||
1402 | void KABCore::undo() | 1402 | void KABCore::undo() |
1403 | { | 1403 | { |
1404 | UndoStack::instance()->undo(); | 1404 | UndoStack::instance()->undo(); |
1405 | 1405 | ||
1406 | // Refresh the view | 1406 | // Refresh the view |
1407 | mViewManager->refreshView(); | 1407 | mViewManager->refreshView(); |
1408 | } | 1408 | } |
1409 | 1409 | ||
1410 | void KABCore::redo() | 1410 | void KABCore::redo() |
1411 | { | 1411 | { |
1412 | RedoStack::instance()->redo(); | 1412 | RedoStack::instance()->redo(); |
1413 | 1413 | ||
1414 | // Refresh the view | 1414 | // Refresh the view |
1415 | mViewManager->refreshView(); | 1415 | mViewManager->refreshView(); |
1416 | } | 1416 | } |
1417 | void KABCore::setJumpButtonBar( bool visible ) | 1417 | void KABCore::setJumpButtonBar( bool visible ) |
1418 | { | 1418 | { |
1419 | setJumpButtonBarVisible(visible ); | 1419 | setJumpButtonBarVisible(visible ); |
1420 | saveSettings(); | 1420 | saveSettings(); |
1421 | } | 1421 | } |
1422 | void KABCore::setJumpButtonBarVisible( bool visible ) | 1422 | void KABCore::setJumpButtonBarVisible( bool visible ) |
1423 | { | 1423 | { |
1424 | if (mMultipleViewsAtOnce) | 1424 | if (mMultipleViewsAtOnce) |
1425 | { | 1425 | { |
1426 | if ( visible ) | 1426 | if ( visible ) |
1427 | mJumpButtonBar->show(); | 1427 | mJumpButtonBar->show(); |
1428 | else | 1428 | else |
1429 | mJumpButtonBar->hide(); | 1429 | mJumpButtonBar->hide(); |
1430 | } | 1430 | } |
1431 | else | 1431 | else |
1432 | { | 1432 | { |
1433 | // show the jumpbar only if "the details are hidden" == "viewmanager are shown" | 1433 | // show the jumpbar only if "the details are hidden" == "viewmanager are shown" |
1434 | if (mViewManager->isVisible()) | 1434 | if (mViewManager->isVisible()) |
1435 | { | 1435 | { |
1436 | if ( visible ) | 1436 | if ( visible ) |
1437 | mJumpButtonBar->show(); | 1437 | mJumpButtonBar->show(); |
1438 | else | 1438 | else |
1439 | mJumpButtonBar->hide(); | 1439 | mJumpButtonBar->hide(); |
1440 | } | 1440 | } |
1441 | else | 1441 | else |
1442 | { | 1442 | { |
1443 | mJumpButtonBar->hide(); | 1443 | mJumpButtonBar->hide(); |
1444 | } | 1444 | } |
1445 | } | 1445 | } |
1446 | if ( visible ) { | ||
1447 | if ( mIncSearchWidget->currentItem() == 0 ) { | ||
1448 | message( i18n("Change search field enable jump bar") ); | ||
1449 | } | ||
1450 | } | ||
1446 | } | 1451 | } |
1447 | 1452 | ||
1448 | 1453 | ||
1449 | void KABCore::setDetailsToState() | 1454 | void KABCore::setDetailsToState() |
1450 | { | 1455 | { |
1451 | setDetailsVisible( mActionDetails->isChecked() ); | 1456 | setDetailsVisible( mActionDetails->isChecked() ); |
1452 | } | 1457 | } |
1453 | void KABCore::setDetailsToggle() | 1458 | void KABCore::setDetailsToggle() |
1454 | { | 1459 | { |
1455 | mActionDetails->setChecked( !mActionDetails->isChecked() ); | 1460 | mActionDetails->setChecked( !mActionDetails->isChecked() ); |
1456 | setDetailsToState(); | 1461 | setDetailsToState(); |
1457 | } | 1462 | } |
1458 | 1463 | ||
1459 | 1464 | ||
1460 | 1465 | ||
1461 | void KABCore::setDetailsVisible( bool visible ) | 1466 | void KABCore::setDetailsVisible( bool visible ) |
1462 | { | 1467 | { |
1463 | if (visible && mDetails->isHidden()) | 1468 | if (visible && mDetails->isHidden()) |
1464 | { | 1469 | { |
1465 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); | 1470 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); |
1466 | if ( addrList.count() > 0 ) | 1471 | if ( addrList.count() > 0 ) |
1467 | mDetails->setAddressee( addrList[ 0 ] ); | 1472 | mDetails->setAddressee( addrList[ 0 ] ); |
1468 | } | 1473 | } |
1469 | 1474 | ||
1470 | // mMultipleViewsAtOnce=false: mDetails is always visible. But we switch between | 1475 | // mMultipleViewsAtOnce=false: mDetails is always visible. But we switch between |
1471 | // the listview and the detailview. We do that by changing the splitbar size. | 1476 | // the listview and the detailview. We do that by changing the splitbar size. |
1472 | if (mMultipleViewsAtOnce) | 1477 | if (mMultipleViewsAtOnce) |
1473 | { | 1478 | { |
1474 | if ( visible ) | 1479 | if ( visible ) |
1475 | mDetails->show(); | 1480 | mDetails->show(); |
1476 | else | 1481 | else |
1477 | mDetails->hide(); | 1482 | mDetails->hide(); |
1478 | } | 1483 | } |
1479 | else | 1484 | else |
1480 | { | 1485 | { |
1481 | if ( visible ) { | 1486 | if ( visible ) { |
1482 | mViewManager->hide(); | 1487 | mViewManager->hide(); |
1483 | mDetails->show(); | 1488 | mDetails->show(); |
1484 | mIncSearchWidget->setFocus(); | 1489 | mIncSearchWidget->setFocus(); |
1485 | } | 1490 | } |
1486 | else { | 1491 | else { |
1487 | mViewManager->show(); | 1492 | mViewManager->show(); |
1488 | mDetails->hide(); | 1493 | mDetails->hide(); |
1489 | mViewManager->setFocusAV(); | 1494 | mViewManager->setFocusAV(); |
1490 | } | 1495 | } |
1491 | setJumpButtonBarVisible( !visible ); | 1496 | setJumpButtonBarVisible( !visible ); |
1492 | } | 1497 | } |
1493 | 1498 | ||
1494 | } | 1499 | } |
1495 | 1500 | ||
1496 | void KABCore::extensionChanged( int id ) | 1501 | void KABCore::extensionChanged( int id ) |
1497 | { | 1502 | { |
1498 | //change the details view only for non desktop systems | 1503 | //change the details view only for non desktop systems |
1499 | #ifndef DESKTOP_VERSION | 1504 | #ifndef DESKTOP_VERSION |
1500 | 1505 | ||
1501 | if (id == 0) | 1506 | if (id == 0) |
1502 | { | 1507 | { |
1503 | //the user disabled the extension. | 1508 | //the user disabled the extension. |
1504 | 1509 | ||
1505 | if (mMultipleViewsAtOnce) | 1510 | if (mMultipleViewsAtOnce) |
1506 | { // enable detailsview again | 1511 | { // enable detailsview again |
1507 | setDetailsVisible( true ); | 1512 | setDetailsVisible( true ); |
1508 | mActionDetails->setChecked( true ); | 1513 | mActionDetails->setChecked( true ); |
1509 | } | 1514 | } |
1510 | else | 1515 | else |
1511 | { //go back to the listview | 1516 | { //go back to the listview |
1512 | setDetailsVisible( false ); | 1517 | setDetailsVisible( false ); |
1513 | mActionDetails->setChecked( false ); | 1518 | mActionDetails->setChecked( false ); |
1514 | mActionDetails->setEnabled(true); | 1519 | mActionDetails->setEnabled(true); |
1515 | } | 1520 | } |
1516 | 1521 | ||
1517 | } | 1522 | } |
1518 | else | 1523 | else |
1519 | { | 1524 | { |
1520 | //the user enabled the extension. | 1525 | //the user enabled the extension. |
1521 | setDetailsVisible( false ); | 1526 | setDetailsVisible( false ); |
1522 | mActionDetails->setChecked( false ); | 1527 | mActionDetails->setChecked( false ); |
1523 | 1528 | ||
1524 | if (!mMultipleViewsAtOnce) | 1529 | if (!mMultipleViewsAtOnce) |
1525 | { | 1530 | { |
1526 | mActionDetails->setEnabled(false); | 1531 | mActionDetails->setEnabled(false); |
1527 | } | 1532 | } |
1528 | 1533 | ||
1529 | mExtensionManager->setSelectionChanged(); | 1534 | mExtensionManager->setSelectionChanged(); |
1530 | 1535 | ||
1531 | } | 1536 | } |
1532 | 1537 | ||
1533 | #endif// DESKTOP_VERSION | 1538 | #endif// DESKTOP_VERSION |
1534 | 1539 | ||
1535 | } | 1540 | } |
1536 | 1541 | ||
1537 | 1542 | ||
1538 | void KABCore::extensionModified( const KABC::Addressee::List &list ) | 1543 | void KABCore::extensionModified( const KABC::Addressee::List &list ) |
1539 | { | 1544 | { |
1540 | 1545 | ||
1541 | if ( list.count() != 0 ) { | 1546 | if ( list.count() != 0 ) { |