author | zautrix <zautrix> | 2004-09-07 23:33:23 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-07 23:33:23 (UTC) |
commit | 199025628054eef739a261437a51a98f5218ab0f (patch) (unidiff) | |
tree | 75ec5c537ee789dbd3e1a87a2e7db9b29d44c626 /kaddressbook | |
parent | 2676646d4744ccceab1063dc02d772a26a203c61 (diff) | |
download | kdepimpi-199025628054eef739a261437a51a98f5218ab0f.zip kdepimpi-199025628054eef739a261437a51a98f5218ab0f.tar.gz kdepimpi-199025628054eef739a261437a51a98f5218ab0f.tar.bz2 |
Fixed default settings
-rw-r--r-- | kaddressbook/kabcore.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 6522ccc..5cd9649 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -1276,864 +1276,867 @@ void KABCore::extensionModified( const KABC::Addressee::List &list ) | |||
1276 | else | 1276 | else |
1277 | setModifiedWOrefresh(); | 1277 | setModifiedWOrefresh(); |
1278 | } | 1278 | } |
1279 | if ( list.count() == 0 ) | 1279 | if ( list.count() == 0 ) |
1280 | mViewManager->refreshView(); | 1280 | mViewManager->refreshView(); |
1281 | else | 1281 | else |
1282 | mViewManager->refreshView( list[ 0 ].uid() ); | 1282 | mViewManager->refreshView( list[ 0 ].uid() ); |
1283 | 1283 | ||
1284 | 1284 | ||
1285 | 1285 | ||
1286 | } | 1286 | } |
1287 | 1287 | ||
1288 | QString KABCore::getNameByPhone( const QString &phone ) | 1288 | QString KABCore::getNameByPhone( const QString &phone ) |
1289 | { | 1289 | { |
1290 | #ifndef KAB_EMBEDDED | 1290 | #ifndef KAB_EMBEDDED |
1291 | QRegExp r( "[/*/-/ ]" ); | 1291 | QRegExp r( "[/*/-/ ]" ); |
1292 | QString localPhone( phone ); | 1292 | QString localPhone( phone ); |
1293 | 1293 | ||
1294 | bool found = false; | 1294 | bool found = false; |
1295 | QString ownerName = ""; | 1295 | QString ownerName = ""; |
1296 | KABC::AddressBook::Iterator iter; | 1296 | KABC::AddressBook::Iterator iter; |
1297 | KABC::PhoneNumber::List::Iterator phoneIter; | 1297 | KABC::PhoneNumber::List::Iterator phoneIter; |
1298 | KABC::PhoneNumber::List phoneList; | 1298 | KABC::PhoneNumber::List phoneList; |
1299 | for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) { | 1299 | for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) { |
1300 | phoneList = (*iter).phoneNumbers(); | 1300 | phoneList = (*iter).phoneNumbers(); |
1301 | for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() ); | 1301 | for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() ); |
1302 | ++phoneIter) { | 1302 | ++phoneIter) { |
1303 | // Get rid of separator chars so just the numbers are compared. | 1303 | // Get rid of separator chars so just the numbers are compared. |
1304 | if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) { | 1304 | if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) { |
1305 | ownerName = (*iter).formattedName(); | 1305 | ownerName = (*iter).formattedName(); |
1306 | found = true; | 1306 | found = true; |
1307 | } | 1307 | } |
1308 | } | 1308 | } |
1309 | } | 1309 | } |
1310 | 1310 | ||
1311 | return ownerName; | 1311 | return ownerName; |
1312 | #else //KAB_EMBEDDED | 1312 | #else //KAB_EMBEDDED |
1313 | qDebug("KABCore::getNameByPhone finsih method"); | 1313 | qDebug("KABCore::getNameByPhone finsih method"); |
1314 | return ""; | 1314 | return ""; |
1315 | #endif //KAB_EMBEDDED | 1315 | #endif //KAB_EMBEDDED |
1316 | 1316 | ||
1317 | } | 1317 | } |
1318 | 1318 | ||
1319 | void KABCore::openConfigDialog() | 1319 | void KABCore::openConfigDialog() |
1320 | { | 1320 | { |
1321 | KABPrefs* kab_prefs = KABPrefs::instance(); | 1321 | KABPrefs* kab_prefs = KABPrefs::instance(); |
1322 | KPimGlobalPrefs* kpim_prefs = KPimGlobalPrefs::instance(); | 1322 | KPimGlobalPrefs* kpim_prefs = KPimGlobalPrefs::instance(); |
1323 | 1323 | ||
1324 | KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true ); | 1324 | KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true ); |
1325 | KCMKabConfig* kabcfg = new KCMKabConfig( kab_prefs, ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" ); | 1325 | KCMKabConfig* kabcfg = new KCMKabConfig( kab_prefs, ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" ); |
1326 | ConfigureDialog->addModule(kabcfg ); | 1326 | ConfigureDialog->addModule(kabcfg ); |
1327 | KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( kpim_prefs, ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" ); | 1327 | KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( kpim_prefs, ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" ); |
1328 | ConfigureDialog->addModule(kdelibcfg ); | 1328 | ConfigureDialog->addModule(kdelibcfg ); |
1329 | 1329 | ||
1330 | 1330 | ||
1331 | 1331 | ||
1332 | connect( ConfigureDialog, SIGNAL( applyClicked() ), | 1332 | connect( ConfigureDialog, SIGNAL( applyClicked() ), |
1333 | this, SLOT( configurationChanged() ) ); | 1333 | this, SLOT( configurationChanged() ) ); |
1334 | connect( ConfigureDialog, SIGNAL( okClicked() ), | 1334 | connect( ConfigureDialog, SIGNAL( okClicked() ), |
1335 | this, SLOT( configurationChanged() ) ); | 1335 | this, SLOT( configurationChanged() ) ); |
1336 | saveSettings(); | 1336 | saveSettings(); |
1337 | #ifndef DESKTOP_VERSION | 1337 | #ifndef DESKTOP_VERSION |
1338 | ConfigureDialog->showMaximized(); | 1338 | ConfigureDialog->showMaximized(); |
1339 | #endif | 1339 | #endif |
1340 | if ( ConfigureDialog->exec() ) | 1340 | if ( ConfigureDialog->exec() ) |
1341 | KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") ); | 1341 | KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") ); |
1342 | delete ConfigureDialog; | 1342 | delete ConfigureDialog; |
1343 | } | 1343 | } |
1344 | 1344 | ||
1345 | void KABCore::openLDAPDialog() | 1345 | void KABCore::openLDAPDialog() |
1346 | { | 1346 | { |
1347 | #ifndef KAB_EMBEDDED | 1347 | #ifndef KAB_EMBEDDED |
1348 | if ( !mLdapSearchDialog ) { | 1348 | if ( !mLdapSearchDialog ) { |
1349 | mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this ); | 1349 | mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this ); |
1350 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager, | 1350 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager, |
1351 | SLOT( refreshView() ) ); | 1351 | SLOT( refreshView() ) ); |
1352 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this, | 1352 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this, |
1353 | SLOT( setModified() ) ); | 1353 | SLOT( setModified() ) ); |
1354 | } else | 1354 | } else |
1355 | mLdapSearchDialog->restoreSettings(); | 1355 | mLdapSearchDialog->restoreSettings(); |
1356 | 1356 | ||
1357 | if ( mLdapSearchDialog->isOK() ) | 1357 | if ( mLdapSearchDialog->isOK() ) |
1358 | mLdapSearchDialog->exec(); | 1358 | mLdapSearchDialog->exec(); |
1359 | #else //KAB_EMBEDDED | 1359 | #else //KAB_EMBEDDED |
1360 | qDebug("KABCore::openLDAPDialog() finsih method"); | 1360 | qDebug("KABCore::openLDAPDialog() finsih method"); |
1361 | #endif //KAB_EMBEDDED | 1361 | #endif //KAB_EMBEDDED |
1362 | } | 1362 | } |
1363 | 1363 | ||
1364 | void KABCore::print() | 1364 | void KABCore::print() |
1365 | { | 1365 | { |
1366 | #ifndef KAB_EMBEDDED | 1366 | #ifndef KAB_EMBEDDED |
1367 | KPrinter printer; | 1367 | KPrinter printer; |
1368 | if ( !printer.setup( this ) ) | 1368 | if ( !printer.setup( this ) ) |
1369 | return; | 1369 | return; |
1370 | 1370 | ||
1371 | KABPrinting::PrintingWizard wizard( &printer, mAddressBook, | 1371 | KABPrinting::PrintingWizard wizard( &printer, mAddressBook, |
1372 | mViewManager->selectedUids(), this ); | 1372 | mViewManager->selectedUids(), this ); |
1373 | 1373 | ||
1374 | wizard.exec(); | 1374 | wizard.exec(); |
1375 | #else //KAB_EMBEDDED | 1375 | #else //KAB_EMBEDDED |
1376 | qDebug("KABCore::print() finsih method"); | 1376 | qDebug("KABCore::print() finsih method"); |
1377 | #endif //KAB_EMBEDDED | 1377 | #endif //KAB_EMBEDDED |
1378 | 1378 | ||
1379 | } | 1379 | } |
1380 | 1380 | ||
1381 | 1381 | ||
1382 | void KABCore::addGUIClient( KXMLGUIClient *client ) | 1382 | void KABCore::addGUIClient( KXMLGUIClient *client ) |
1383 | { | 1383 | { |
1384 | if ( mGUIClient ) | 1384 | if ( mGUIClient ) |
1385 | mGUIClient->insertChildClient( client ); | 1385 | mGUIClient->insertChildClient( client ); |
1386 | else | 1386 | else |
1387 | KMessageBox::error( this, "no KXMLGUICLient"); | 1387 | KMessageBox::error( this, "no KXMLGUICLient"); |
1388 | } | 1388 | } |
1389 | 1389 | ||
1390 | 1390 | ||
1391 | void KABCore::configurationChanged() | 1391 | void KABCore::configurationChanged() |
1392 | { | 1392 | { |
1393 | mExtensionManager->reconfigure(); | 1393 | mExtensionManager->reconfigure(); |
1394 | } | 1394 | } |
1395 | 1395 | ||
1396 | void KABCore::addressBookChanged() | 1396 | void KABCore::addressBookChanged() |
1397 | { | 1397 | { |
1398 | /*US | 1398 | /*US |
1399 | QDictIterator<AddresseeEditorDialog> it( mEditorDict ); | 1399 | QDictIterator<AddresseeEditorDialog> it( mEditorDict ); |
1400 | while ( it.current() ) { | 1400 | while ( it.current() ) { |
1401 | if ( it.current()->dirty() ) { | 1401 | if ( it.current()->dirty() ) { |
1402 | QString text = i18n( "Data has been changed externally. Unsaved " | 1402 | QString text = i18n( "Data has been changed externally. Unsaved " |
1403 | "changes will be lost." ); | 1403 | "changes will be lost." ); |
1404 | KMessageBox::information( this, text ); | 1404 | KMessageBox::information( this, text ); |
1405 | } | 1405 | } |
1406 | it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) ); | 1406 | it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) ); |
1407 | ++it; | 1407 | ++it; |
1408 | } | 1408 | } |
1409 | */ | 1409 | */ |
1410 | if (mEditorDialog) | 1410 | if (mEditorDialog) |
1411 | { | 1411 | { |
1412 | if (mEditorDialog->dirty()) | 1412 | if (mEditorDialog->dirty()) |
1413 | { | 1413 | { |
1414 | QString text = i18n( "Data has been changed externally. Unsaved " | 1414 | QString text = i18n( "Data has been changed externally. Unsaved " |
1415 | "changes will be lost." ); | 1415 | "changes will be lost." ); |
1416 | KMessageBox::information( this, text ); | 1416 | KMessageBox::information( this, text ); |
1417 | } | 1417 | } |
1418 | QString currentuid = mEditorDialog->addressee().uid(); | 1418 | QString currentuid = mEditorDialog->addressee().uid(); |
1419 | mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) ); | 1419 | mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) ); |
1420 | } | 1420 | } |
1421 | mViewManager->refreshView(); | 1421 | mViewManager->refreshView(); |
1422 | // mDetails->refreshView(); | 1422 | // mDetails->refreshView(); |
1423 | 1423 | ||
1424 | 1424 | ||
1425 | } | 1425 | } |
1426 | 1426 | ||
1427 | AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, | 1427 | AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, |
1428 | const char *name ) | 1428 | const char *name ) |
1429 | { | 1429 | { |
1430 | 1430 | ||
1431 | if ( mEditorDialog == 0 ) { | 1431 | if ( mEditorDialog == 0 ) { |
1432 | mEditorDialog = new AddresseeEditorDialog( this, parent, | 1432 | mEditorDialog = new AddresseeEditorDialog( this, parent, |
1433 | name ? name : "editorDialog" ); | 1433 | name ? name : "editorDialog" ); |
1434 | 1434 | ||
1435 | 1435 | ||
1436 | connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ), | 1436 | connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ), |
1437 | SLOT( contactModified( const KABC::Addressee& ) ) ); | 1437 | SLOT( contactModified( const KABC::Addressee& ) ) ); |
1438 | //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ), | 1438 | //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ), |
1439 | // SLOT( slotEditorDestroyed( const QString& ) ) ); | 1439 | // SLOT( slotEditorDestroyed( const QString& ) ) ); |
1440 | } | 1440 | } |
1441 | 1441 | ||
1442 | return mEditorDialog; | 1442 | return mEditorDialog; |
1443 | } | 1443 | } |
1444 | 1444 | ||
1445 | void KABCore::slotEditorDestroyed( const QString &uid ) | 1445 | void KABCore::slotEditorDestroyed( const QString &uid ) |
1446 | { | 1446 | { |
1447 | //mEditorDict.remove( uid ); | 1447 | //mEditorDict.remove( uid ); |
1448 | } | 1448 | } |
1449 | 1449 | ||
1450 | void KABCore::initGUI() | 1450 | void KABCore::initGUI() |
1451 | { | 1451 | { |
1452 | #ifndef KAB_EMBEDDED | 1452 | #ifndef KAB_EMBEDDED |
1453 | QHBoxLayout *topLayout = new QHBoxLayout( this ); | 1453 | QHBoxLayout *topLayout = new QHBoxLayout( this ); |
1454 | topLayout->setSpacing( KDialogBase::spacingHint() ); | 1454 | topLayout->setSpacing( KDialogBase::spacingHint() ); |
1455 | 1455 | ||
1456 | mExtensionBarSplitter = new QSplitter( this ); | 1456 | mExtensionBarSplitter = new QSplitter( this ); |
1457 | mExtensionBarSplitter->setOrientation( Qt::Vertical ); | 1457 | mExtensionBarSplitter->setOrientation( Qt::Vertical ); |
1458 | 1458 | ||
1459 | mDetailsSplitter = new QSplitter( mExtensionBarSplitter ); | 1459 | mDetailsSplitter = new QSplitter( mExtensionBarSplitter ); |
1460 | 1460 | ||
1461 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); | 1461 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); |
1462 | mIncSearchWidget = new IncSearchWidget( viewSpace ); | 1462 | mIncSearchWidget = new IncSearchWidget( viewSpace ); |
1463 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 1463 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
1464 | SLOT( incrementalSearch( const QString& ) ) ); | 1464 | SLOT( incrementalSearch( const QString& ) ) ); |
1465 | 1465 | ||
1466 | mViewManager = new ViewManager( this, viewSpace ); | 1466 | mViewManager = new ViewManager( this, viewSpace ); |
1467 | viewSpace->setStretchFactor( mViewManager, 1 ); | 1467 | viewSpace->setStretchFactor( mViewManager, 1 ); |
1468 | 1468 | ||
1469 | mDetails = new ViewContainer( mDetailsSplitter ); | 1469 | mDetails = new ViewContainer( mDetailsSplitter ); |
1470 | 1470 | ||
1471 | mJumpButtonBar = new JumpButtonBar( this, this ); | 1471 | mJumpButtonBar = new JumpButtonBar( this, this ); |
1472 | 1472 | ||
1473 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); | 1473 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); |
1474 | 1474 | ||
1475 | topLayout->addWidget( mExtensionBarSplitter ); | 1475 | topLayout->addWidget( mExtensionBarSplitter ); |
1476 | topLayout->setStretchFactor( mExtensionBarSplitter, 100 ); | 1476 | topLayout->setStretchFactor( mExtensionBarSplitter, 100 ); |
1477 | topLayout->addWidget( mJumpButtonBar ); | 1477 | topLayout->addWidget( mJumpButtonBar ); |
1478 | topLayout->setStretchFactor( mJumpButtonBar, 1 ); | 1478 | topLayout->setStretchFactor( mJumpButtonBar, 1 ); |
1479 | 1479 | ||
1480 | mXXPortManager = new XXPortManager( this, this ); | 1480 | mXXPortManager = new XXPortManager( this, this ); |
1481 | 1481 | ||
1482 | #else //KAB_EMBEDDED | 1482 | #else //KAB_EMBEDDED |
1483 | //US initialize viewMenu before settingup viewmanager. | 1483 | //US initialize viewMenu before settingup viewmanager. |
1484 | // Viewmanager needs this menu to plugin submenues. | 1484 | // Viewmanager needs this menu to plugin submenues. |
1485 | viewMenu = new QPopupMenu( this ); | 1485 | viewMenu = new QPopupMenu( this ); |
1486 | settingsMenu = new QPopupMenu( this ); | 1486 | settingsMenu = new QPopupMenu( this ); |
1487 | //filterMenu = new QPopupMenu( this ); | 1487 | //filterMenu = new QPopupMenu( this ); |
1488 | ImportMenu = new QPopupMenu( this ); | 1488 | ImportMenu = new QPopupMenu( this ); |
1489 | ExportMenu = new QPopupMenu( this ); | 1489 | ExportMenu = new QPopupMenu( this ); |
1490 | 1490 | ||
1491 | changeMenu= new QPopupMenu( this ); | 1491 | changeMenu= new QPopupMenu( this ); |
1492 | 1492 | ||
1493 | //US since we have no splitter for the embedded system, setup | 1493 | //US since we have no splitter for the embedded system, setup |
1494 | // a layout with two frames. One left and one right. | 1494 | // a layout with two frames. One left and one right. |
1495 | 1495 | ||
1496 | QBoxLayout *topLayout; | 1496 | QBoxLayout *topLayout; |
1497 | 1497 | ||
1498 | // = new QHBoxLayout( this ); | 1498 | // = new QHBoxLayout( this ); |
1499 | // QBoxLayout *topLayout = (QBoxLayout*)layout(); | 1499 | // QBoxLayout *topLayout = (QBoxLayout*)layout(); |
1500 | 1500 | ||
1501 | // QWidget *mainBox = new QWidget( this ); | 1501 | // QWidget *mainBox = new QWidget( this ); |
1502 | // QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); | 1502 | // QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); |
1503 | 1503 | ||
1504 | #ifdef DESKTOP_VERSION | 1504 | #ifdef DESKTOP_VERSION |
1505 | topLayout = new QHBoxLayout( this ); | 1505 | topLayout = new QHBoxLayout( this ); |
1506 | 1506 | ||
1507 | 1507 | ||
1508 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); | 1508 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); |
1509 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 1509 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
1510 | 1510 | ||
1511 | topLayout->addWidget(mMiniSplitter ); | 1511 | topLayout->addWidget(mMiniSplitter ); |
1512 | 1512 | ||
1513 | mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); | 1513 | mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); |
1514 | mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); | 1514 | mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); |
1515 | mViewManager = new ViewManager( this, mExtensionBarSplitter ); | 1515 | mViewManager = new ViewManager( this, mExtensionBarSplitter ); |
1516 | mDetails = new ViewContainer( mMiniSplitter ); | 1516 | mDetails = new ViewContainer( mMiniSplitter ); |
1517 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); | 1517 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); |
1518 | #else | 1518 | #else |
1519 | if ( QApplication::desktop()->width() > 480 ) { | 1519 | if ( QApplication::desktop()->width() > 480 ) { |
1520 | topLayout = new QHBoxLayout( this ); | 1520 | topLayout = new QHBoxLayout( this ); |
1521 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); | 1521 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); |
1522 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 1522 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
1523 | } else { | 1523 | } else { |
1524 | 1524 | ||
1525 | topLayout = new QHBoxLayout( this ); | 1525 | topLayout = new QHBoxLayout( this ); |
1526 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); | 1526 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); |
1527 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); | 1527 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); |
1528 | } | 1528 | } |
1529 | 1529 | ||
1530 | topLayout->addWidget(mMiniSplitter ); | 1530 | topLayout->addWidget(mMiniSplitter ); |
1531 | mViewManager = new ViewManager( this, mMiniSplitter ); | 1531 | mViewManager = new ViewManager( this, mMiniSplitter ); |
1532 | mDetails = new ViewContainer( mMiniSplitter ); | 1532 | mDetails = new ViewContainer( mMiniSplitter ); |
1533 | 1533 | ||
1534 | 1534 | ||
1535 | mExtensionManager = new ExtensionManager( this, mMiniSplitter ); | 1535 | mExtensionManager = new ExtensionManager( this, mMiniSplitter ); |
1536 | #endif | 1536 | #endif |
1537 | //eh->hide(); | 1537 | //eh->hide(); |
1538 | // topLayout->addWidget(mExtensionManager ); | 1538 | // topLayout->addWidget(mExtensionManager ); |
1539 | 1539 | ||
1540 | 1540 | ||
1541 | /*US | 1541 | /*US |
1542 | #ifndef KAB_NOSPLITTER | 1542 | #ifndef KAB_NOSPLITTER |
1543 | QHBoxLayout *topLayout = new QHBoxLayout( this ); | 1543 | QHBoxLayout *topLayout = new QHBoxLayout( this ); |
1544 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); | 1544 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); |
1545 | topLayout->setSpacing( 10 ); | 1545 | topLayout->setSpacing( 10 ); |
1546 | 1546 | ||
1547 | mDetailsSplitter = new QSplitter( this ); | 1547 | mDetailsSplitter = new QSplitter( this ); |
1548 | 1548 | ||
1549 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); | 1549 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); |
1550 | 1550 | ||
1551 | mViewManager = new ViewManager( this, viewSpace ); | 1551 | mViewManager = new ViewManager( this, viewSpace ); |
1552 | viewSpace->setStretchFactor( mViewManager, 1 ); | 1552 | viewSpace->setStretchFactor( mViewManager, 1 ); |
1553 | 1553 | ||
1554 | mDetails = new ViewContainer( mDetailsSplitter ); | 1554 | mDetails = new ViewContainer( mDetailsSplitter ); |
1555 | 1555 | ||
1556 | topLayout->addWidget( mDetailsSplitter ); | 1556 | topLayout->addWidget( mDetailsSplitter ); |
1557 | topLayout->setStretchFactor( mDetailsSplitter, 100 ); | 1557 | topLayout->setStretchFactor( mDetailsSplitter, 100 ); |
1558 | #else //KAB_NOSPLITTER | 1558 | #else //KAB_NOSPLITTER |
1559 | QHBoxLayout *topLayout = new QHBoxLayout( this ); | 1559 | QHBoxLayout *topLayout = new QHBoxLayout( this ); |
1560 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); | 1560 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); |
1561 | topLayout->setSpacing( 10 ); | 1561 | topLayout->setSpacing( 10 ); |
1562 | 1562 | ||
1563 | // mDetailsSplitter = new QSplitter( this ); | 1563 | // mDetailsSplitter = new QSplitter( this ); |
1564 | 1564 | ||
1565 | QVBox *viewSpace = new QVBox( this ); | 1565 | QVBox *viewSpace = new QVBox( this ); |
1566 | 1566 | ||
1567 | mViewManager = new ViewManager( this, viewSpace ); | 1567 | mViewManager = new ViewManager( this, viewSpace ); |
1568 | viewSpace->setStretchFactor( mViewManager, 1 ); | 1568 | viewSpace->setStretchFactor( mViewManager, 1 ); |
1569 | 1569 | ||
1570 | mDetails = new ViewContainer( this ); | 1570 | mDetails = new ViewContainer( this ); |
1571 | 1571 | ||
1572 | topLayout->addWidget( viewSpace ); | 1572 | topLayout->addWidget( viewSpace ); |
1573 | // topLayout->setStretchFactor( mDetailsSplitter, 100 ); | 1573 | // topLayout->setStretchFactor( mDetailsSplitter, 100 ); |
1574 | topLayout->addWidget( mDetails ); | 1574 | topLayout->addWidget( mDetails ); |
1575 | #endif //KAB_NOSPLITTER | 1575 | #endif //KAB_NOSPLITTER |
1576 | */ | 1576 | */ |
1577 | 1577 | ||
1578 | 1578 | ||
1579 | #endif //KAB_EMBEDDED | 1579 | #endif //KAB_EMBEDDED |
1580 | initActions(); | 1580 | initActions(); |
1581 | 1581 | ||
1582 | #ifdef KAB_EMBEDDED | 1582 | #ifdef KAB_EMBEDDED |
1583 | addActionsManually(); | 1583 | addActionsManually(); |
1584 | //US make sure the export and import menues are initialized before creating the xxPortManager. | 1584 | //US make sure the export and import menues are initialized before creating the xxPortManager. |
1585 | mXXPortManager = new XXPortManager( this, this ); | 1585 | mXXPortManager = new XXPortManager( this, this ); |
1586 | 1586 | ||
1587 | // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); | 1587 | // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); |
1588 | //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); | 1588 | //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); |
1589 | // mActionQuit->plug ( mMainWindow->toolBar()); | 1589 | // mActionQuit->plug ( mMainWindow->toolBar()); |
1590 | //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); | 1590 | //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); |
1591 | //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); | 1591 | //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); |
1592 | // mIncSearchWidget->hide(); | 1592 | // mIncSearchWidget->hide(); |
1593 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 1593 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
1594 | SLOT( incrementalSearch( const QString& ) ) ); | 1594 | SLOT( incrementalSearch( const QString& ) ) ); |
1595 | 1595 | ||
1596 | 1596 | ||
1597 | mJumpButtonBar = new JumpButtonBar( this, this ); | 1597 | mJumpButtonBar = new JumpButtonBar( this, this ); |
1598 | 1598 | ||
1599 | topLayout->addWidget( mJumpButtonBar ); | 1599 | topLayout->addWidget( mJumpButtonBar ); |
1600 | //US topLayout->setStretchFactor( mJumpButtonBar, 10 ); | 1600 | //US topLayout->setStretchFactor( mJumpButtonBar, 10 ); |
1601 | 1601 | ||
1602 | // mMainWindow->getIconToolBar()->raise(); | 1602 | // mMainWindow->getIconToolBar()->raise(); |
1603 | 1603 | ||
1604 | #endif //KAB_EMBEDDED | 1604 | #endif //KAB_EMBEDDED |
1605 | 1605 | ||
1606 | } | 1606 | } |
1607 | void KABCore::initActions() | 1607 | void KABCore::initActions() |
1608 | { | 1608 | { |
1609 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); | 1609 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); |
1610 | 1610 | ||
1611 | #ifndef KAB_EMBEDDED | 1611 | #ifndef KAB_EMBEDDED |
1612 | connect( QApplication::clipboard(), SIGNAL( dataChanged() ), | 1612 | connect( QApplication::clipboard(), SIGNAL( dataChanged() ), |
1613 | SLOT( clipboardDataChanged() ) ); | 1613 | SLOT( clipboardDataChanged() ) ); |
1614 | #endif //KAB_EMBEDDED | 1614 | #endif //KAB_EMBEDDED |
1615 | 1615 | ||
1616 | // file menu | 1616 | // file menu |
1617 | if ( mIsPart ) { | 1617 | if ( mIsPart ) { |
1618 | mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, | 1618 | mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, |
1619 | SLOT( sendMail() ), actionCollection(), | 1619 | SLOT( sendMail() ), actionCollection(), |
1620 | "kaddressbook_mail" ); | 1620 | "kaddressbook_mail" ); |
1621 | mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, | 1621 | mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, |
1622 | SLOT( print() ), actionCollection(), "kaddressbook_print" ); | 1622 | SLOT( print() ), actionCollection(), "kaddressbook_print" ); |
1623 | 1623 | ||
1624 | } else { | 1624 | } else { |
1625 | mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); | 1625 | mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); |
1626 | mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); | 1626 | mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); |
1627 | } | 1627 | } |
1628 | 1628 | ||
1629 | 1629 | ||
1630 | mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, | 1630 | mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, |
1631 | SLOT( save() ), actionCollection(), "file_sync" ); | 1631 | SLOT( save() ), actionCollection(), "file_sync" ); |
1632 | 1632 | ||
1633 | mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, | 1633 | mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, |
1634 | SLOT( newContact() ), actionCollection(), "file_new_contact" ); | 1634 | SLOT( newContact() ), actionCollection(), "file_new_contact" ); |
1635 | 1635 | ||
1636 | mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, | 1636 | mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, |
1637 | this, SLOT( mailVCard() ), | 1637 | this, SLOT( mailVCard() ), |
1638 | actionCollection(), "file_mail_vcard"); | 1638 | actionCollection(), "file_mail_vcard"); |
1639 | 1639 | ||
1640 | mActionBeamVCard = 0; | 1640 | mActionBeamVCard = 0; |
1641 | mActionBeam = 0; | 1641 | mActionBeam = 0; |
1642 | 1642 | ||
1643 | #ifndef DESKTOP_VERSION | 1643 | #ifndef DESKTOP_VERSION |
1644 | if ( Ir::supported() ) { | 1644 | if ( Ir::supported() ) { |
1645 | mActionBeamVCard = new KAction( i18n( "Beam selected v&Card(s)" ), "beam", 0, this, | 1645 | mActionBeamVCard = new KAction( i18n( "Beam selected v&Card(s)" ), "beam", 0, this, |
1646 | SLOT( beamVCard() ), actionCollection(), | 1646 | SLOT( beamVCard() ), actionCollection(), |
1647 | "kaddressbook_beam_vcard" ); | 1647 | "kaddressbook_beam_vcard" ); |
1648 | 1648 | ||
1649 | mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, | 1649 | mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, |
1650 | SLOT( beamMySelf() ), actionCollection(), | 1650 | SLOT( beamMySelf() ), actionCollection(), |
1651 | "kaddressbook_beam_myself" ); | 1651 | "kaddressbook_beam_myself" ); |
1652 | } | 1652 | } |
1653 | #endif | 1653 | #endif |
1654 | 1654 | ||
1655 | mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, | 1655 | mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, |
1656 | this, SLOT( editContact2() ), | 1656 | this, SLOT( editContact2() ), |
1657 | actionCollection(), "file_properties" ); | 1657 | actionCollection(), "file_properties" ); |
1658 | 1658 | ||
1659 | #ifdef KAB_EMBEDDED | 1659 | #ifdef KAB_EMBEDDED |
1660 | // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); | 1660 | // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); |
1661 | mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, | 1661 | mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, |
1662 | mMainWindow, SLOT( exit() ), | 1662 | mMainWindow, SLOT( exit() ), |
1663 | actionCollection(), "quit" ); | 1663 | actionCollection(), "quit" ); |
1664 | #endif //KAB_EMBEDDED | 1664 | #endif //KAB_EMBEDDED |
1665 | 1665 | ||
1666 | // edit menu | 1666 | // edit menu |
1667 | if ( mIsPart ) { | 1667 | if ( mIsPart ) { |
1668 | mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, | 1668 | mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, |
1669 | SLOT( copyContacts() ), actionCollection(), | 1669 | SLOT( copyContacts() ), actionCollection(), |
1670 | "kaddressbook_copy" ); | 1670 | "kaddressbook_copy" ); |
1671 | mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, | 1671 | mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, |
1672 | SLOT( cutContacts() ), actionCollection(), | 1672 | SLOT( cutContacts() ), actionCollection(), |
1673 | "kaddressbook_cut" ); | 1673 | "kaddressbook_cut" ); |
1674 | mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, | 1674 | mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, |
1675 | SLOT( pasteContacts() ), actionCollection(), | 1675 | SLOT( pasteContacts() ), actionCollection(), |
1676 | "kaddressbook_paste" ); | 1676 | "kaddressbook_paste" ); |
1677 | mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, | 1677 | mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, |
1678 | SLOT( selectAllContacts() ), actionCollection(), | 1678 | SLOT( selectAllContacts() ), actionCollection(), |
1679 | "kaddressbook_select_all" ); | 1679 | "kaddressbook_select_all" ); |
1680 | mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, | 1680 | mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, |
1681 | SLOT( undo() ), actionCollection(), | 1681 | SLOT( undo() ), actionCollection(), |
1682 | "kaddressbook_undo" ); | 1682 | "kaddressbook_undo" ); |
1683 | mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, | 1683 | mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, |
1684 | this, SLOT( redo() ), actionCollection(), | 1684 | this, SLOT( redo() ), actionCollection(), |
1685 | "kaddressbook_redo" ); | 1685 | "kaddressbook_redo" ); |
1686 | } else { | 1686 | } else { |
1687 | mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); | 1687 | mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); |
1688 | mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); | 1688 | mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); |
1689 | mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); | 1689 | mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); |
1690 | mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); | 1690 | mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); |
1691 | mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); | 1691 | mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); |
1692 | mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); | 1692 | mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); |
1693 | } | 1693 | } |
1694 | 1694 | ||
1695 | mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", | 1695 | mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", |
1696 | Key_Delete, this, SLOT( deleteContacts() ), | 1696 | Key_Delete, this, SLOT( deleteContacts() ), |
1697 | actionCollection(), "edit_delete" ); | 1697 | actionCollection(), "edit_delete" ); |
1698 | 1698 | ||
1699 | mActionUndo->setEnabled( false ); | 1699 | mActionUndo->setEnabled( false ); |
1700 | mActionRedo->setEnabled( false ); | 1700 | mActionRedo->setEnabled( false ); |
1701 | 1701 | ||
1702 | // settings menu | 1702 | // settings menu |
1703 | #ifdef KAB_EMBEDDED | 1703 | #ifdef KAB_EMBEDDED |
1704 | //US special menuentry to configure the addressbook resources. On KDE | 1704 | //US special menuentry to configure the addressbook resources. On KDE |
1705 | // you do that through the control center !!! | 1705 | // you do that through the control center !!! |
1706 | mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, | 1706 | mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, |
1707 | SLOT( configureResources() ), actionCollection(), | 1707 | SLOT( configureResources() ), actionCollection(), |
1708 | "kaddressbook_configure_resources" ); | 1708 | "kaddressbook_configure_resources" ); |
1709 | #endif //KAB_EMBEDDED | 1709 | #endif //KAB_EMBEDDED |
1710 | 1710 | ||
1711 | if ( mIsPart ) { | 1711 | if ( mIsPart ) { |
1712 | mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, | 1712 | mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, |
1713 | SLOT( openConfigDialog() ), actionCollection(), | 1713 | SLOT( openConfigDialog() ), actionCollection(), |
1714 | "kaddressbook_configure" ); | 1714 | "kaddressbook_configure" ); |
1715 | 1715 | ||
1716 | mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, | 1716 | mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, |
1717 | this, SLOT( configureKeyBindings() ), actionCollection(), | 1717 | this, SLOT( configureKeyBindings() ), actionCollection(), |
1718 | "kaddressbook_configure_shortcuts" ); | 1718 | "kaddressbook_configure_shortcuts" ); |
1719 | #ifdef KAB_EMBEDDED | 1719 | #ifdef KAB_EMBEDDED |
1720 | mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); | 1720 | mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); |
1721 | mActionConfigureToolbars->setEnabled( false ); | 1721 | mActionConfigureToolbars->setEnabled( false ); |
1722 | #endif //KAB_EMBEDDED | 1722 | #endif //KAB_EMBEDDED |
1723 | 1723 | ||
1724 | } else { | 1724 | } else { |
1725 | mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); | 1725 | mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); |
1726 | 1726 | ||
1727 | mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); | 1727 | mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); |
1728 | } | 1728 | } |
1729 | 1729 | ||
1730 | mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, | 1730 | mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, |
1731 | actionCollection(), "options_show_jump_bar" ); | 1731 | actionCollection(), "options_show_jump_bar" ); |
1732 | connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); | 1732 | connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); |
1733 | 1733 | ||
1734 | mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0, | 1734 | mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0, |
1735 | actionCollection(), "options_show_details" ); | 1735 | actionCollection(), "options_show_details" ); |
1736 | connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); | 1736 | connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); |
1737 | 1737 | ||
1738 | // misc | 1738 | // misc |
1739 | // only enable LDAP lookup if we can handle the protocol | 1739 | // only enable LDAP lookup if we can handle the protocol |
1740 | #ifndef KAB_EMBEDDED | 1740 | #ifndef KAB_EMBEDDED |
1741 | if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { | 1741 | if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { |
1742 | new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, | 1742 | new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, |
1743 | this, SLOT( openLDAPDialog() ), actionCollection(), | 1743 | this, SLOT( openLDAPDialog() ), actionCollection(), |
1744 | "ldap_lookup" ); | 1744 | "ldap_lookup" ); |
1745 | } | 1745 | } |
1746 | #else //KAB_EMBEDDED | 1746 | #else //KAB_EMBEDDED |
1747 | //qDebug("KABCore::initActions() LDAP has to be implemented"); | 1747 | //qDebug("KABCore::initActions() LDAP has to be implemented"); |
1748 | #endif //KAB_EMBEDDED | 1748 | #endif //KAB_EMBEDDED |
1749 | 1749 | ||
1750 | 1750 | ||
1751 | mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, | 1751 | mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, |
1752 | SLOT( setWhoAmI() ), actionCollection(), | 1752 | SLOT( setWhoAmI() ), actionCollection(), |
1753 | "set_personal" ); | 1753 | "set_personal" ); |
1754 | 1754 | ||
1755 | 1755 | ||
1756 | 1756 | ||
1757 | 1757 | ||
1758 | mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, | 1758 | mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, |
1759 | SLOT( setCategories() ), actionCollection(), | 1759 | SLOT( setCategories() ), actionCollection(), |
1760 | "edit_set_categories" ); | 1760 | "edit_set_categories" ); |
1761 | 1761 | ||
1762 | mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, | 1762 | mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, |
1763 | SLOT( removeVoice() ), actionCollection(), | 1763 | SLOT( removeVoice() ), actionCollection(), |
1764 | "remove_voice" ); | 1764 | "remove_voice" ); |
1765 | mActionImportOL = new KAction( i18n( "Import from OL..." ), 0, this, | 1765 | mActionImportOL = new KAction( i18n( "Import from OL..." ), 0, this, |
1766 | SLOT( importFromOL() ), actionCollection(), | 1766 | SLOT( importFromOL() ), actionCollection(), |
1767 | "import_OL" ); | 1767 | "import_OL" ); |
1768 | #ifdef KAB_EMBEDDED | 1768 | #ifdef KAB_EMBEDDED |
1769 | mActionLicence = new KAction( i18n( "Licence" ), 0, | 1769 | mActionLicence = new KAction( i18n( "Licence" ), 0, |
1770 | this, SLOT( showLicence() ), actionCollection(), | 1770 | this, SLOT( showLicence() ), actionCollection(), |
1771 | "licence_about_data" ); | 1771 | "licence_about_data" ); |
1772 | mActionFaq = new KAction( i18n( "Faq" ), 0, | 1772 | mActionFaq = new KAction( i18n( "Faq" ), 0, |
1773 | this, SLOT( faq() ), actionCollection(), | 1773 | this, SLOT( faq() ), actionCollection(), |
1774 | "faq_about_data" ); | 1774 | "faq_about_data" ); |
1775 | 1775 | ||
1776 | mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, | 1776 | mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, |
1777 | this, SLOT( createAboutData() ), actionCollection(), | 1777 | this, SLOT( createAboutData() ), actionCollection(), |
1778 | "kaddressbook_about_data" ); | 1778 | "kaddressbook_about_data" ); |
1779 | #endif //KAB_EMBEDDED | 1779 | #endif //KAB_EMBEDDED |
1780 | 1780 | ||
1781 | clipboardDataChanged(); | 1781 | clipboardDataChanged(); |
1782 | connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); | 1782 | connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); |
1783 | connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); | 1783 | connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); |
1784 | } | 1784 | } |
1785 | 1785 | ||
1786 | //US we need this function, to plug all actions into the correct menues. | 1786 | //US we need this function, to plug all actions into the correct menues. |
1787 | // KDE uses a XML format to plug the actions, but we work her without this overhead. | 1787 | // KDE uses a XML format to plug the actions, but we work her without this overhead. |
1788 | void KABCore::addActionsManually() | 1788 | void KABCore::addActionsManually() |
1789 | { | 1789 | { |
1790 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); | 1790 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); |
1791 | 1791 | ||
1792 | #ifdef KAB_EMBEDDED | 1792 | #ifdef KAB_EMBEDDED |
1793 | QPopupMenu *fileMenu = new QPopupMenu( this ); | 1793 | QPopupMenu *fileMenu = new QPopupMenu( this ); |
1794 | QPopupMenu *editMenu = new QPopupMenu( this ); | 1794 | QPopupMenu *editMenu = new QPopupMenu( this ); |
1795 | QPopupMenu *helpMenu = new QPopupMenu( this ); | 1795 | QPopupMenu *helpMenu = new QPopupMenu( this ); |
1796 | 1796 | ||
1797 | KToolBar* tb = mMainWindow->toolBar(); | 1797 | KToolBar* tb = mMainWindow->toolBar(); |
1798 | 1798 | ||
1799 | #ifdef DESKTOP_VERSION | 1799 | #ifdef DESKTOP_VERSION |
1800 | QMenuBar* mb = mMainWindow->menuBar(); | 1800 | QMenuBar* mb = mMainWindow->menuBar(); |
1801 | 1801 | ||
1802 | //US setup menubar. | 1802 | //US setup menubar. |
1803 | //Disable the following block if you do not want to have a menubar. | 1803 | //Disable the following block if you do not want to have a menubar. |
1804 | mb->insertItem( "&File", fileMenu ); | 1804 | mb->insertItem( "&File", fileMenu ); |
1805 | mb->insertItem( "&Edit", editMenu ); | 1805 | mb->insertItem( "&Edit", editMenu ); |
1806 | mb->insertItem( "&View", viewMenu ); | 1806 | mb->insertItem( "&View", viewMenu ); |
1807 | mb->insertItem( "&Settings", settingsMenu ); | 1807 | mb->insertItem( "&Settings", settingsMenu ); |
1808 | mb->insertItem( "&Change selected", changeMenu ); | 1808 | mb->insertItem( "&Change selected", changeMenu ); |
1809 | mb->insertItem( "&Help", helpMenu ); | 1809 | mb->insertItem( "&Help", helpMenu ); |
1810 | mIncSearchWidget = new IncSearchWidget( tb ); | 1810 | mIncSearchWidget = new IncSearchWidget( tb ); |
1811 | // tb->insertWidget(-1, 0, mIncSearchWidget); | 1811 | // tb->insertWidget(-1, 0, mIncSearchWidget); |
1812 | 1812 | ||
1813 | #else | 1813 | #else |
1814 | //US setup toolbar | 1814 | //US setup toolbar |
1815 | QMenuBar *menuBarTB = new QMenuBar( tb ); | 1815 | QMenuBar *menuBarTB = new QMenuBar( tb ); |
1816 | QPopupMenu *popupBarTB = new QPopupMenu( this ); | 1816 | QPopupMenu *popupBarTB = new QPopupMenu( this ); |
1817 | menuBarTB->insertItem( "ME", popupBarTB); | 1817 | menuBarTB->insertItem( "ME", popupBarTB); |
1818 | tb->insertWidget(-1, 0, menuBarTB); | 1818 | tb->insertWidget(-1, 0, menuBarTB); |
1819 | mIncSearchWidget = new IncSearchWidget( tb ); | 1819 | mIncSearchWidget = new IncSearchWidget( tb ); |
1820 | 1820 | ||
1821 | tb->enableMoving(false); | 1821 | tb->enableMoving(false); |
1822 | popupBarTB->insertItem( "&File", fileMenu ); | 1822 | popupBarTB->insertItem( "&File", fileMenu ); |
1823 | popupBarTB->insertItem( "&Edit", editMenu ); | 1823 | popupBarTB->insertItem( "&Edit", editMenu ); |
1824 | popupBarTB->insertItem( "&View", viewMenu ); | 1824 | popupBarTB->insertItem( "&View", viewMenu ); |
1825 | popupBarTB->insertItem( "&Settings", settingsMenu ); | 1825 | popupBarTB->insertItem( "&Settings", settingsMenu ); |
1826 | mViewManager->getFilterAction()->plug ( popupBarTB); | 1826 | mViewManager->getFilterAction()->plug ( popupBarTB); |
1827 | popupBarTB->insertItem( "&Change selected", changeMenu ); | 1827 | popupBarTB->insertItem( "&Change selected", changeMenu ); |
1828 | popupBarTB->insertItem( "&Help", helpMenu ); | 1828 | popupBarTB->insertItem( "&Help", helpMenu ); |
1829 | if (QApplication::desktop()->width() > 320 ) { | 1829 | if (QApplication::desktop()->width() > 320 ) { |
1830 | // mViewManager->getFilterAction()->plug ( tb); | 1830 | // mViewManager->getFilterAction()->plug ( tb); |
1831 | } | 1831 | } |
1832 | #endif | 1832 | #endif |
1833 | // mActionQuit->plug ( mMainWindow->toolBar()); | 1833 | // mActionQuit->plug ( mMainWindow->toolBar()); |
1834 | 1834 | ||
1835 | 1835 | ||
1836 | 1836 | ||
1837 | //US Now connect the actions with the menue entries. | 1837 | //US Now connect the actions with the menue entries. |
1838 | mActionPrint->plug( fileMenu ); | 1838 | mActionPrint->plug( fileMenu ); |
1839 | mActionMail->plug( fileMenu ); | 1839 | mActionMail->plug( fileMenu ); |
1840 | fileMenu->insertSeparator(); | 1840 | fileMenu->insertSeparator(); |
1841 | 1841 | ||
1842 | mActionNewContact->plug( fileMenu ); | 1842 | mActionNewContact->plug( fileMenu ); |
1843 | mActionNewContact->plug( tb ); | 1843 | mActionNewContact->plug( tb ); |
1844 | 1844 | ||
1845 | mActionEditAddressee->plug( fileMenu ); | 1845 | mActionEditAddressee->plug( fileMenu ); |
1846 | if ((KGlobal::getDesktopSize() > KGlobal::Small ) || | 1846 | if ((KGlobal::getDesktopSize() > KGlobal::Small ) || |
1847 | (!KABPrefs::instance()->mMultipleViewsAtOnce )) | 1847 | (!KABPrefs::instance()->mMultipleViewsAtOnce )) |
1848 | mActionEditAddressee->plug( tb ); | 1848 | mActionEditAddressee->plug( tb ); |
1849 | 1849 | ||
1850 | fileMenu->insertSeparator(); | 1850 | fileMenu->insertSeparator(); |
1851 | mActionSave->plug( fileMenu ); | 1851 | mActionSave->plug( fileMenu ); |
1852 | fileMenu->insertItem( "&Import", ImportMenu ); | 1852 | fileMenu->insertItem( "&Import", ImportMenu ); |
1853 | fileMenu->insertItem( "&Emport", ExportMenu ); | 1853 | fileMenu->insertItem( "&Emport", ExportMenu ); |
1854 | fileMenu->insertSeparator(); | 1854 | fileMenu->insertSeparator(); |
1855 | mActionMailVCard->plug( fileMenu ); | 1855 | mActionMailVCard->plug( fileMenu ); |
1856 | #ifndef DESKTOP_VERSION | 1856 | #ifndef DESKTOP_VERSION |
1857 | if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu ); | 1857 | if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu ); |
1858 | if ( Ir::supported() ) mActionBeam->plug(fileMenu ); | 1858 | if ( Ir::supported() ) mActionBeam->plug(fileMenu ); |
1859 | #endif | 1859 | #endif |
1860 | fileMenu->insertSeparator(); | 1860 | fileMenu->insertSeparator(); |
1861 | mActionQuit->plug( fileMenu ); | 1861 | mActionQuit->plug( fileMenu ); |
1862 | #ifdef _WIN32_ | 1862 | #ifdef _WIN32_ |
1863 | mActionImportOL->plug( ImportMenu ); | 1863 | mActionImportOL->plug( ImportMenu ); |
1864 | #endif | 1864 | #endif |
1865 | // edit menu | 1865 | // edit menu |
1866 | mActionUndo->plug( editMenu ); | 1866 | mActionUndo->plug( editMenu ); |
1867 | mActionRedo->plug( editMenu ); | 1867 | mActionRedo->plug( editMenu ); |
1868 | editMenu->insertSeparator(); | 1868 | editMenu->insertSeparator(); |
1869 | mActionCut->plug( editMenu ); | 1869 | mActionCut->plug( editMenu ); |
1870 | mActionCopy->plug( editMenu ); | 1870 | mActionCopy->plug( editMenu ); |
1871 | mActionPaste->plug( editMenu ); | 1871 | mActionPaste->plug( editMenu ); |
1872 | mActionDelete->plug( editMenu ); | 1872 | mActionDelete->plug( editMenu ); |
1873 | editMenu->insertSeparator(); | 1873 | editMenu->insertSeparator(); |
1874 | mActionSelectAll->plug( editMenu ); | 1874 | mActionSelectAll->plug( editMenu ); |
1875 | 1875 | ||
1876 | mActionRemoveVoice->plug( changeMenu ); | 1876 | mActionRemoveVoice->plug( changeMenu ); |
1877 | // settings menu | 1877 | // settings menu |
1878 | //US special menuentry to configure the addressbook resources. On KDE | 1878 | //US special menuentry to configure the addressbook resources. On KDE |
1879 | // you do that through the control center !!! | 1879 | // you do that through the control center !!! |
1880 | mActionConfigResources->plug( settingsMenu ); | 1880 | mActionConfigResources->plug( settingsMenu ); |
1881 | settingsMenu->insertSeparator(); | 1881 | settingsMenu->insertSeparator(); |
1882 | 1882 | ||
1883 | mActionConfigKAddressbook->plug( settingsMenu ); | 1883 | mActionConfigKAddressbook->plug( settingsMenu ); |
1884 | 1884 | ||
1885 | if ( mIsPart ) { | 1885 | if ( mIsPart ) { |
1886 | mActionConfigShortcuts->plug( settingsMenu ); | 1886 | mActionConfigShortcuts->plug( settingsMenu ); |
1887 | mActionConfigureToolbars->plug( settingsMenu ); | 1887 | mActionConfigureToolbars->plug( settingsMenu ); |
1888 | 1888 | ||
1889 | } else { | 1889 | } else { |
1890 | mActionKeyBindings->plug( settingsMenu ); | 1890 | mActionKeyBindings->plug( settingsMenu ); |
1891 | } | 1891 | } |
1892 | 1892 | ||
1893 | settingsMenu->insertSeparator(); | 1893 | settingsMenu->insertSeparator(); |
1894 | 1894 | ||
1895 | mActionJumpBar->plug( settingsMenu ); | 1895 | mActionJumpBar->plug( settingsMenu ); |
1896 | mActionDetails->plug( settingsMenu ); | 1896 | mActionDetails->plug( settingsMenu ); |
1897 | if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) | 1897 | if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) |
1898 | mActionDetails->plug( tb ); | 1898 | mActionDetails->plug( tb ); |
1899 | settingsMenu->insertSeparator(); | 1899 | settingsMenu->insertSeparator(); |
1900 | 1900 | ||
1901 | mActionWhoAmI->plug( settingsMenu ); | 1901 | mActionWhoAmI->plug( settingsMenu ); |
1902 | mActionCategories->plug( settingsMenu ); | 1902 | mActionCategories->plug( settingsMenu ); |
1903 | 1903 | ||
1904 | mActionLicence->plug( helpMenu ); | 1904 | mActionLicence->plug( helpMenu ); |
1905 | mActionFaq->plug( helpMenu ); | 1905 | mActionFaq->plug( helpMenu ); |
1906 | mActionAboutKAddressbook->plug( helpMenu ); | 1906 | mActionAboutKAddressbook->plug( helpMenu ); |
1907 | 1907 | ||
1908 | if (KGlobal::getDesktopSize() > KGlobal::Small ) { | 1908 | if (KGlobal::getDesktopSize() > KGlobal::Small ) { |
1909 | 1909 | ||
1910 | mActionSave->plug( tb ); | 1910 | mActionSave->plug( tb ); |
1911 | mViewManager->getFilterAction()->plug ( tb); | 1911 | mViewManager->getFilterAction()->plug ( tb); |
1912 | if (KGlobal::getDesktopSize() == KGlobal::Desktop ) { | 1912 | if (KGlobal::getDesktopSize() == KGlobal::Desktop ) { |
1913 | mActionUndo->plug( tb ); | 1913 | mActionUndo->plug( tb ); |
1914 | mActionDelete->plug( tb ); | 1914 | mActionDelete->plug( tb ); |
1915 | mActionRedo->plug( tb ); | 1915 | mActionRedo->plug( tb ); |
1916 | } | 1916 | } |
1917 | } | 1917 | } |
1918 | //mActionQuit->plug ( tb ); | 1918 | //mActionQuit->plug ( tb ); |
1919 | // tb->insertWidget(-1, 0, mIncSearchWidget, 6); | 1919 | // tb->insertWidget(-1, 0, mIncSearchWidget, 6); |
1920 | 1920 | ||
1921 | //US link the searchwidget first to this. | 1921 | //US link the searchwidget first to this. |
1922 | // The real linkage to the toolbar happens later. | 1922 | // The real linkage to the toolbar happens later. |
1923 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); | 1923 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); |
1924 | //US tb->insertItem( mIncSearchWidget ); | 1924 | //US tb->insertItem( mIncSearchWidget ); |
1925 | /*US | 1925 | /*US |
1926 | mIncSearchWidget = new IncSearchWidget( tb ); | 1926 | mIncSearchWidget = new IncSearchWidget( tb ); |
1927 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 1927 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
1928 | SLOT( incrementalSearch( const QString& ) ) ); | 1928 | SLOT( incrementalSearch( const QString& ) ) ); |
1929 | 1929 | ||
1930 | mJumpButtonBar = new JumpButtonBar( this, this ); | 1930 | mJumpButtonBar = new JumpButtonBar( this, this ); |
1931 | 1931 | ||
1932 | //US topLayout->addWidget( mJumpButtonBar ); | 1932 | //US topLayout->addWidget( mJumpButtonBar ); |
1933 | this->layout()->add( mJumpButtonBar ); | 1933 | this->layout()->add( mJumpButtonBar ); |
1934 | */ | 1934 | */ |
1935 | 1935 | ||
1936 | #endif //KAB_EMBEDDED | 1936 | #endif //KAB_EMBEDDED |
1937 | } | 1937 | } |
1938 | void KABCore::showLicence() | 1938 | void KABCore::showLicence() |
1939 | { | 1939 | { |
1940 | KApplication::showLicence(); | 1940 | KApplication::showLicence(); |
1941 | } | 1941 | } |
1942 | void KABCore::removeVoice() | 1942 | void KABCore::removeVoice() |
1943 | { | 1943 | { |
1944 | if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No ) | 1944 | if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No ) |
1945 | return; | 1945 | return; |
1946 | KABC::Addressee::List list = mViewManager->selectedAddressees(); | 1946 | KABC::Addressee::List list = mViewManager->selectedAddressees(); |
1947 | KABC::Addressee::List::Iterator it; | 1947 | KABC::Addressee::List::Iterator it; |
1948 | for ( it = list.begin(); it != list.end(); ++it ) { | 1948 | for ( it = list.begin(); it != list.end(); ++it ) { |
1949 | PhoneNumber::List phoneNumbers = (*it).phoneNumbers(); | 1949 | PhoneNumber::List phoneNumbers = (*it).phoneNumbers(); |
1950 | PhoneNumber::List::Iterator phoneIt; | 1950 | PhoneNumber::List::Iterator phoneIt; |
1951 | bool found = false; | 1951 | bool found = false; |
1952 | for ( phoneIt = phoneNumbers.begin(); phoneIt != phoneNumbers.end(); ++phoneIt ) { | 1952 | for ( phoneIt = phoneNumbers.begin(); phoneIt != phoneNumbers.end(); ++phoneIt ) { |
1953 | if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found | 1953 | if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found |
1954 | if ((*phoneIt).type() - PhoneNumber::Voice ) { | 1954 | if ((*phoneIt).type() - PhoneNumber::Voice ) { |
1955 | (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice ); | 1955 | (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice ); |
1956 | (*it).insertPhoneNumber( (*phoneIt) ); | 1956 | (*it).insertPhoneNumber( (*phoneIt) ); |
1957 | found = true; | 1957 | found = true; |
1958 | } | 1958 | } |
1959 | } | 1959 | } |
1960 | 1960 | ||
1961 | } | 1961 | } |
1962 | if ( found ) | 1962 | if ( found ) |
1963 | contactModified((*it) ); | 1963 | contactModified((*it) ); |
1964 | } | 1964 | } |
1965 | } | 1965 | } |
1966 | 1966 | ||
1967 | 1967 | ||
1968 | 1968 | ||
1969 | void KABCore::clipboardDataChanged() | 1969 | void KABCore::clipboardDataChanged() |
1970 | { | 1970 | { |
1971 | 1971 | ||
1972 | if ( mReadWrite ) | 1972 | if ( mReadWrite ) |
1973 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); | 1973 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); |
1974 | 1974 | ||
1975 | } | 1975 | } |
1976 | 1976 | ||
1977 | void KABCore::updateActionMenu() | 1977 | void KABCore::updateActionMenu() |
1978 | { | 1978 | { |
1979 | UndoStack *undo = UndoStack::instance(); | 1979 | UndoStack *undo = UndoStack::instance(); |
1980 | RedoStack *redo = RedoStack::instance(); | 1980 | RedoStack *redo = RedoStack::instance(); |
1981 | 1981 | ||
1982 | if ( undo->isEmpty() ) | 1982 | if ( undo->isEmpty() ) |
1983 | mActionUndo->setText( i18n( "Undo" ) ); | 1983 | mActionUndo->setText( i18n( "Undo" ) ); |
1984 | else | 1984 | else |
1985 | mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); | 1985 | mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); |
1986 | 1986 | ||
1987 | mActionUndo->setEnabled( !undo->isEmpty() ); | 1987 | mActionUndo->setEnabled( !undo->isEmpty() ); |
1988 | 1988 | ||
1989 | if ( !redo->top() ) | 1989 | if ( !redo->top() ) |
1990 | mActionRedo->setText( i18n( "Redo" ) ); | 1990 | mActionRedo->setText( i18n( "Redo" ) ); |
1991 | else | 1991 | else |
1992 | mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); | 1992 | mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); |
1993 | 1993 | ||
1994 | mActionRedo->setEnabled( !redo->isEmpty() ); | 1994 | mActionRedo->setEnabled( !redo->isEmpty() ); |
1995 | } | 1995 | } |
1996 | 1996 | ||
1997 | void KABCore::configureKeyBindings() | 1997 | void KABCore::configureKeyBindings() |
1998 | { | 1998 | { |
1999 | #ifndef KAB_EMBEDDED | 1999 | #ifndef KAB_EMBEDDED |
2000 | KKeyDialog::configure( actionCollection(), true ); | 2000 | KKeyDialog::configure( actionCollection(), true ); |
2001 | #else //KAB_EMBEDDED | 2001 | #else //KAB_EMBEDDED |
2002 | qDebug("KABCore::configureKeyBindings() not implemented"); | 2002 | qDebug("KABCore::configureKeyBindings() not implemented"); |
2003 | #endif //KAB_EMBEDDED | 2003 | #endif //KAB_EMBEDDED |
2004 | } | 2004 | } |
2005 | 2005 | ||
2006 | #ifdef KAB_EMBEDDED | 2006 | #ifdef KAB_EMBEDDED |
2007 | void KABCore::configureResources() | 2007 | void KABCore::configureResources() |
2008 | { | 2008 | { |
2009 | KRES::KCMKResources dlg( this, "" , 0 ); | 2009 | KRES::KCMKResources dlg( this, "" , 0 ); |
2010 | 2010 | ||
2011 | if ( !dlg.exec() ) | 2011 | if ( !dlg.exec() ) |
2012 | return; | 2012 | return; |
2013 | KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); | 2013 | KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); |
2014 | } | 2014 | } |
2015 | #endif //KAB_EMBEDDED | 2015 | #endif //KAB_EMBEDDED |
2016 | 2016 | ||
2017 | 2017 | ||
2018 | /* this method will be called through the QCop interface from Ko/Pi to select addresses | 2018 | /* this method will be called through the QCop interface from Ko/Pi to select addresses |
2019 | * for the attendees list of an event. | 2019 | * for the attendees list of an event. |
2020 | */ | 2020 | */ |
2021 | void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) | 2021 | void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) |
2022 | { | 2022 | { |
2023 | QStringList nameList; | 2023 | QStringList nameList; |
2024 | QStringList emailList; | 2024 | QStringList emailList; |
2025 | QStringList uidList; | 2025 | QStringList uidList; |
2026 | 2026 | ||
2027 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); | 2027 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); |
2028 | uint i=0; | 2028 | uint i=0; |
2029 | for (i=0; i < list.count(); i++) | 2029 | for (i=0; i < list.count(); i++) |
2030 | { | 2030 | { |
2031 | nameList.append(list[i].realName()); | 2031 | nameList.append(list[i].realName()); |
2032 | emailList.append(list[i].preferredEmail()); | 2032 | emailList.append(list[i].preferredEmail()); |
2033 | uidList.append(list[i].uid()); | 2033 | uidList.append(list[i].uid()); |
2034 | } | 2034 | } |
2035 | 2035 | ||
2036 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList); | 2036 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList); |
2037 | 2037 | ||
2038 | } | 2038 | } |
2039 | 2039 | ||
2040 | /* this method will be called through the QCop interface from other apps to show details of a contact. | 2040 | /* this method will be called through the QCop interface from other apps to show details of a contact. |
2041 | */ | 2041 | */ |
2042 | void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) | 2042 | void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) |
2043 | { | 2043 | { |
2044 | //qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); | 2044 | qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); |
2045 | 2045 | ||
2046 | QString foundUid = QString::null; | 2046 | QString foundUid = QString::null; |
2047 | if ( ! uid.isEmpty() ) { | 2047 | if ( ! uid.isEmpty() ) { |
2048 | Addressee adrr = mAddressBook->findByUid( uid ); | 2048 | Addressee adrr = mAddressBook->findByUid( uid ); |
2049 | if ( !adrr.isEmpty() ) { | 2049 | if ( !adrr.isEmpty() ) { |
2050 | foundUid = uid; | 2050 | foundUid = uid; |
2051 | } | ||
2051 | if ( email == "sendbacklist" ) { | 2052 | if ( email == "sendbacklist" ) { |
2053 | qDebug("ssssssssssssssssssssssend "); | ||
2052 | QStringList nameList; | 2054 | QStringList nameList; |
2053 | QStringList emailList; | 2055 | QStringList emailList; |
2054 | QStringList uidList; | 2056 | QStringList uidList; |
2055 | nameList.append(adrr.realName()); | 2057 | nameList.append(adrr.realName()); |
2056 | emailList = adrr.emails(); | 2058 | emailList = adrr.emails(); |
2057 | uidList.append( adrr.preferredEmail()); | 2059 | uidList.append( adrr.preferredEmail()); |
2058 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); | 2060 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); |
2061 | return; | ||
2059 | } | 2062 | } |
2060 | } | 2063 | |
2061 | } | 2064 | } |
2062 | 2065 | ||
2063 | if ( email == "sendback" ) | 2066 | if ( email == "sendback" ) |
2064 | return; | 2067 | return; |
2065 | if (foundUid.isEmpty()) | 2068 | if (foundUid.isEmpty()) |
2066 | { | 2069 | { |
2067 | //find the uid of the person first | 2070 | //find the uid of the person first |
2068 | Addressee::List namelist; | 2071 | Addressee::List namelist; |
2069 | Addressee::List emaillist; | 2072 | Addressee::List emaillist; |
2070 | 2073 | ||
2071 | if (!name.isEmpty()) | 2074 | if (!name.isEmpty()) |
2072 | namelist = mAddressBook->findByName( name ); | 2075 | namelist = mAddressBook->findByName( name ); |
2073 | 2076 | ||
2074 | if (!email.isEmpty()) | 2077 | if (!email.isEmpty()) |
2075 | emaillist = mAddressBook->findByEmail( email ); | 2078 | emaillist = mAddressBook->findByEmail( email ); |
2076 | qDebug("count %d %d ", namelist.count(),emaillist.count() ); | 2079 | qDebug("count %d %d ", namelist.count(),emaillist.count() ); |
2077 | //check if we have a match in Namelist and Emaillist | 2080 | //check if we have a match in Namelist and Emaillist |
2078 | if ((namelist.count() == 0) && (emaillist.count() > 0)) { | 2081 | if ((namelist.count() == 0) && (emaillist.count() > 0)) { |
2079 | foundUid = emaillist[0].uid(); | 2082 | foundUid = emaillist[0].uid(); |
2080 | } | 2083 | } |
2081 | else if ((namelist.count() > 0) && (emaillist.count() == 0)) | 2084 | else if ((namelist.count() > 0) && (emaillist.count() == 0)) |
2082 | foundUid = namelist[0].uid(); | 2085 | foundUid = namelist[0].uid(); |
2083 | else | 2086 | else |
2084 | { | 2087 | { |
2085 | for (int i = 0; i < namelist.count(); i++) | 2088 | for (int i = 0; i < namelist.count(); i++) |
2086 | { | 2089 | { |
2087 | for (int j = 0; j < emaillist.count(); j++) | 2090 | for (int j = 0; j < emaillist.count(); j++) |
2088 | { | 2091 | { |
2089 | if (namelist[i] == emaillist[j]) | 2092 | if (namelist[i] == emaillist[j]) |
2090 | { | 2093 | { |
2091 | foundUid = namelist[i].uid(); | 2094 | foundUid = namelist[i].uid(); |
2092 | } | 2095 | } |
2093 | } | 2096 | } |
2094 | } | 2097 | } |
2095 | } | 2098 | } |
2096 | } | 2099 | } |
2097 | else | 2100 | else |
2098 | { | 2101 | { |
2099 | foundUid = uid; | 2102 | foundUid = uid; |
2100 | } | 2103 | } |
2101 | 2104 | ||
2102 | if (!foundUid.isEmpty()) | 2105 | if (!foundUid.isEmpty()) |
2103 | { | 2106 | { |
2104 | 2107 | ||
2105 | // raise Ka/Pi if it is in the background | 2108 | // raise Ka/Pi if it is in the background |
2106 | #ifndef DESKTOP_VERSION | 2109 | #ifndef DESKTOP_VERSION |
2107 | #ifndef KORG_NODCOP | 2110 | #ifndef KORG_NODCOP |
2108 | //QCopEnvelope e("QPE/Application/kapi", "raise()"); | 2111 | //QCopEnvelope e("QPE/Application/kapi", "raise()"); |
2109 | #endif | 2112 | #endif |
2110 | #endif | 2113 | #endif |
2111 | 2114 | ||
2112 | mMainWindow->showMaximized(); | 2115 | mMainWindow->showMaximized(); |
2113 | mMainWindow-> raise(); | 2116 | mMainWindow-> raise(); |
2114 | 2117 | ||
2115 | mViewManager->setSelected( "", false); | 2118 | mViewManager->setSelected( "", false); |
2116 | mViewManager->refreshView( "" ); | 2119 | mViewManager->refreshView( "" ); |
2117 | mViewManager->setSelected( foundUid, true ); | 2120 | mViewManager->setSelected( foundUid, true ); |
2118 | mViewManager->refreshView( foundUid ); | 2121 | mViewManager->refreshView( foundUid ); |
2119 | 2122 | ||
2120 | if ( !mMultipleViewsAtOnce ) | 2123 | if ( !mMultipleViewsAtOnce ) |
2121 | { | 2124 | { |
2122 | setDetailsVisible( true ); | 2125 | setDetailsVisible( true ); |
2123 | mActionDetails->setChecked(true); | 2126 | mActionDetails->setChecked(true); |
2124 | } | 2127 | } |
2125 | } | 2128 | } |
2126 | } | 2129 | } |
2127 | 2130 | ||
2128 | 2131 | ||
2129 | void KABCore::faq() | 2132 | void KABCore::faq() |
2130 | { | 2133 | { |
2131 | KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" ); | 2134 | KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" ); |
2132 | } | 2135 | } |
2133 | 2136 | ||
2134 | 2137 | ||
2135 | 2138 | ||
2136 | 2139 | ||
2137 | #ifndef KAB_EMBEDDED | 2140 | #ifndef KAB_EMBEDDED |
2138 | #include "kabcore.moc" | 2141 | #include "kabcore.moc" |
2139 | #endif //KAB_EMBEDDED | 2142 | #endif //KAB_EMBEDDED |