summaryrefslogtreecommitdiffabout
path: root/kaddressbook
authorzautrix <zautrix>2005-01-17 19:49:42 (UTC)
committer zautrix <zautrix>2005-01-17 19:49:42 (UTC)
commit522486966ecf041a6e49913b6e420d58d4284837 (patch) (unidiff)
treed15da3e6ef9ec4638eba4aaf9f14ef0c5eaecd04 /kaddressbook
parent32479683283fc9f20d369ac9671ba0f8a33d3381 (diff)
downloadkdepimpi-522486966ecf041a6e49913b6e420d58d4284837.zip
kdepimpi-522486966ecf041a6e49913b6e420d58d4284837.tar.gz
kdepimpi-522486966ecf041a6e49913b6e420d58d4284837.tar.bz2
const fixes
Diffstat (limited to 'kaddressbook') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp33
-rw-r--r--kaddressbook/kabcore.h2
2 files changed, 28 insertions, 7 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index d393660..42e147f 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -1281,194 +1281,194 @@ void KABCore::addEmail( QString aStr )
1281#endif //KAB_EMBEDDED 1281#endif //KAB_EMBEDDED
1282} 1282}
1283 1283
1284void KABCore::importVCard( const KURL &url, bool showPreview ) 1284void KABCore::importVCard( const KURL &url, bool showPreview )
1285{ 1285{
1286 mXXPortManager->importVCard( url, showPreview ); 1286 mXXPortManager->importVCard( url, showPreview );
1287} 1287}
1288void KABCore::importFromOL() 1288void KABCore::importFromOL()
1289{ 1289{
1290#ifdef _WIN32_ 1290#ifdef _WIN32_
1291 KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this ); 1291 KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this );
1292 idgl->exec(); 1292 idgl->exec();
1293 KABC::Addressee::List list = idgl->getAddressList(); 1293 KABC::Addressee::List list = idgl->getAddressList();
1294 if ( list.count() > 0 ) { 1294 if ( list.count() > 0 ) {
1295 KABC::Addressee::List listNew; 1295 KABC::Addressee::List listNew;
1296 KABC::Addressee::List listExisting; 1296 KABC::Addressee::List listExisting;
1297 KABC::Addressee::List::Iterator it; 1297 KABC::Addressee::List::Iterator it;
1298 KABC::AddressBook::Iterator iter; 1298 KABC::AddressBook::Iterator iter;
1299 for ( it = list.begin(); it != list.end(); ++it ) { 1299 for ( it = list.begin(); it != list.end(); ++it ) {
1300 if ( mAddressBook->findByUid((*it).uid() ).isEmpty()) 1300 if ( mAddressBook->findByUid((*it).uid() ).isEmpty())
1301 listNew.append( (*it) ); 1301 listNew.append( (*it) );
1302 else 1302 else
1303 listExisting.append( (*it) ); 1303 listExisting.append( (*it) );
1304 } 1304 }
1305 if ( listExisting.count() > 0 ) 1305 if ( listExisting.count() > 0 )
1306 KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() )); 1306 KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() ));
1307 if ( listNew.count() > 0 ) { 1307 if ( listNew.count() > 0 ) {
1308 pasteWithNewUid = false; 1308 pasteWithNewUid = false;
1309 pasteContacts( listNew ); 1309 pasteContacts( listNew );
1310 pasteWithNewUid = true; 1310 pasteWithNewUid = true;
1311 } 1311 }
1312 } 1312 }
1313 delete idgl; 1313 delete idgl;
1314#endif 1314#endif
1315} 1315}
1316 1316
1317void KABCore::importVCard( const QString &vCard, bool showPreview ) 1317void KABCore::importVCard( const QString &vCard, bool showPreview )
1318{ 1318{
1319 mXXPortManager->importVCard( vCard, showPreview ); 1319 mXXPortManager->importVCard( vCard, showPreview );
1320} 1320}
1321 1321
1322//US added a second method without defaultparameter 1322//US added a second method without defaultparameter
1323void KABCore::editContact2() { 1323void KABCore::editContact2() {
1324 editContact( QString::null ); 1324 editContact( QString::null );
1325} 1325}
1326 1326
1327void KABCore::editContact( const QString &uid ) 1327void KABCore::editContact( const QString &uid )
1328{ 1328{
1329 1329
1330 if ( mExtensionManager->isQuickEditVisible() ) 1330 if ( mExtensionManager->isQuickEditVisible() )
1331 return; 1331 return;
1332 1332
1333 // First, locate the contact entry 1333 // First, locate the contact entry
1334 QString localUID = uid; 1334 QString localUID = uid;
1335 if ( localUID.isNull() ) { 1335 if ( localUID.isNull() ) {
1336 QStringList uidList = mViewManager->selectedUids(); 1336 QStringList uidList = mViewManager->selectedUids();
1337 if ( uidList.count() > 0 ) 1337 if ( uidList.count() > 0 )
1338 localUID = *( uidList.at( 0 ) ); 1338 localUID = *( uidList.at( 0 ) );
1339 } 1339 }
1340 1340
1341 KABC::Addressee addr = mAddressBook->findByUid( localUID ); 1341 KABC::Addressee addr = mAddressBook->findByUid( localUID );
1342 if ( !addr.isEmpty() ) { 1342 if ( !addr.isEmpty() ) {
1343 mEditorDialog->setAddressee( addr ); 1343 mEditorDialog->setAddressee( addr );
1344 KApplication::execDialog ( mEditorDialog ); 1344 KApplication::execDialog ( mEditorDialog );
1345 } 1345 }
1346} 1346}
1347 1347
1348/** 1348/**
1349 Shows or edits the detail view for the given uid. If the uid is QString::null, 1349 Shows or edits the detail view for the given uid. If the uid is QString::null,
1350 the method will try to find a selected addressee in the view. 1350 the method will try to find a selected addressee in the view.
1351 */ 1351 */
1352void KABCore::executeContact( const QString &uid /*US = QString::null*/ ) 1352void KABCore::executeContact( const QString &uid /*US = QString::null*/ )
1353{ 1353{
1354 if ( mMultipleViewsAtOnce ) 1354 if ( mMultipleViewsAtOnce )
1355 { 1355 {
1356 editContact( uid ); 1356 editContact( uid );
1357 } 1357 }
1358 else 1358 else
1359 { 1359 {
1360 setDetailsVisible( true ); 1360 setDetailsVisible( true );
1361 mActionDetails->setChecked(true); 1361 mActionDetails->setChecked(true);
1362 } 1362 }
1363 1363
1364} 1364}
1365 1365
1366void KABCore::save() 1366void KABCore::save()
1367{ 1367{
1368 if (syncManager->blockSave()) 1368 if (syncManager->blockSave())
1369 return; 1369 return;
1370 if ( !mModified ) 1370 if ( !mModified )
1371 return; 1371 return;
1372 1372
1373 syncManager->setBlockSave(true); 1373 syncManager->setBlockSave(true);
1374 QString text = i18n( "There was an error while attempting to save\n the " 1374 QString text = i18n( "There was an error while attempting to save\n the "
1375 "address book. Please check that some \nother application is " 1375 "address book. Please check that some \nother application is "
1376 "not using it. " ); 1376 "not using it. " );
1377 message(i18n("Saving ... please wait! ")); 1377 message(i18n("Saving ... please wait! "), false);
1378 qApp->processEvents(); 1378 //qApp->processEvents();
1379#ifndef KAB_EMBEDDED 1379#ifndef KAB_EMBEDDED
1380 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); 1380 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook );
1381 if ( !b || !b->save() ) { 1381 if ( !b || !b->save() ) {
1382 KMessageBox::error( this, text, i18n( "Unable to Save" ) ); 1382 KMessageBox::error( this, text, i18n( "Unable to Save" ) );
1383 } 1383 }
1384#else //KAB_EMBEDDED 1384#else //KAB_EMBEDDED
1385 KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); 1385 KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook );
1386 if ( !b || !b->save() ) { 1386 if ( !b || !b->save() ) {
1387 QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok")); 1387 QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok"));
1388 } 1388 }
1389#endif //KAB_EMBEDDED 1389#endif //KAB_EMBEDDED
1390 1390
1391 message(i18n("Addressbook saved!")); 1391 message(i18n("Addressbook saved!"));
1392 setModified( false ); 1392 setModified( false );
1393 syncManager->setBlockSave(false); 1393 syncManager->setBlockSave(false);
1394} 1394}
1395 1395
1396 1396
1397void KABCore::undo() 1397void KABCore::undo()
1398{ 1398{
1399 UndoStack::instance()->undo(); 1399 UndoStack::instance()->undo();
1400 1400
1401 // Refresh the view 1401 // Refresh the view
1402 mViewManager->refreshView(); 1402 mViewManager->refreshView();
1403} 1403}
1404 1404
1405void KABCore::redo() 1405void KABCore::redo()
1406{ 1406{
1407 RedoStack::instance()->redo(); 1407 RedoStack::instance()->redo();
1408 1408
1409 // Refresh the view 1409 // Refresh the view
1410 mViewManager->refreshView(); 1410 mViewManager->refreshView();
1411} 1411}
1412 1412
1413void KABCore::setJumpButtonBarVisible( bool visible ) 1413void KABCore::setJumpButtonBarVisible( bool visible )
1414{ 1414{
1415 if (mMultipleViewsAtOnce) 1415 if (mMultipleViewsAtOnce)
1416 { 1416 {
1417 if ( visible ) 1417 if ( visible )
1418 mJumpButtonBar->show(); 1418 mJumpButtonBar->show();
1419 else 1419 else
1420 mJumpButtonBar->hide(); 1420 mJumpButtonBar->hide();
1421 } 1421 }
1422 else 1422 else
1423 { 1423 {
1424 // show the jumpbar only if "the details are hidden" == "viewmanager are shown" 1424 // show the jumpbar only if "the details are hidden" == "viewmanager are shown"
1425 if (mViewManager->isVisible()) 1425 if (mViewManager->isVisible())
1426 { 1426 {
1427 if ( visible ) 1427 if ( visible )
1428 mJumpButtonBar->show(); 1428 mJumpButtonBar->show();
1429 else 1429 else
1430 mJumpButtonBar->hide(); 1430 mJumpButtonBar->hide();
1431 } 1431 }
1432 else 1432 else
1433 { 1433 {
1434 mJumpButtonBar->hide(); 1434 mJumpButtonBar->hide();
1435 } 1435 }
1436 } 1436 }
1437} 1437}
1438 1438
1439 1439
1440void KABCore::setDetailsToState() 1440void KABCore::setDetailsToState()
1441{ 1441{
1442 setDetailsVisible( mActionDetails->isChecked() ); 1442 setDetailsVisible( mActionDetails->isChecked() );
1443} 1443}
1444void KABCore::setDetailsToggle() 1444void KABCore::setDetailsToggle()
1445{ 1445{
1446 mActionDetails->setChecked( !mActionDetails->isChecked() ); 1446 mActionDetails->setChecked( !mActionDetails->isChecked() );
1447 setDetailsToState(); 1447 setDetailsToState();
1448} 1448}
1449 1449
1450 1450
1451 1451
1452void KABCore::setDetailsVisible( bool visible ) 1452void KABCore::setDetailsVisible( bool visible )
1453{ 1453{
1454 if (visible && mDetails->isHidden()) 1454 if (visible && mDetails->isHidden())
1455 { 1455 {
1456 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 1456 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
1457 if ( addrList.count() > 0 ) 1457 if ( addrList.count() > 0 )
1458 mDetails->setAddressee( addrList[ 0 ] ); 1458 mDetails->setAddressee( addrList[ 0 ] );
1459 } 1459 }
1460 1460
1461 // mMultipleViewsAtOnce=false: mDetails is always visible. But we switch between 1461 // mMultipleViewsAtOnce=false: mDetails is always visible. But we switch between
1462 // the listview and the detailview. We do that by changing the splitbar size. 1462 // the listview and the detailview. We do that by changing the splitbar size.
1463 if (mMultipleViewsAtOnce) 1463 if (mMultipleViewsAtOnce)
1464 { 1464 {
1465 if ( visible ) 1465 if ( visible )
1466 mDetails->show(); 1466 mDetails->show();
1467 else 1467 else
1468 mDetails->hide(); 1468 mDetails->hide();
1469 } 1469 }
1470 else 1470 else
1471 { 1471 {
1472 if ( visible ) { 1472 if ( visible ) {
1473 mViewManager->hide(); 1473 mViewManager->hide();
1474 mDetails->show(); 1474 mDetails->show();
@@ -2204,287 +2204,297 @@ void KABCore::addActionsManually()
2204 //mActionConfigureToolbars->plug( settingsMenu ); 2204 //mActionConfigureToolbars->plug( settingsMenu );
2205 2205
2206 } else { 2206 } else {
2207 //US not implemented yet 2207 //US not implemented yet
2208 //mActionKeyBindings->plug( settingsMenu ); 2208 //mActionKeyBindings->plug( settingsMenu );
2209 } 2209 }
2210 2210
2211 settingsMenu->insertSeparator(); 2211 settingsMenu->insertSeparator();
2212 2212
2213 mActionJumpBar->plug( settingsMenu ); 2213 mActionJumpBar->plug( settingsMenu );
2214 mActionDetails->plug( settingsMenu ); 2214 mActionDetails->plug( settingsMenu );
2215 //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) 2215 //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop )
2216 mActionDetails->plug( tb ); 2216 mActionDetails->plug( tb );
2217 settingsMenu->insertSeparator(); 2217 settingsMenu->insertSeparator();
2218#ifndef DESKTOP_VERSION 2218#ifndef DESKTOP_VERSION
2219 if ( Ir::supported() ) mActionBR->plug(settingsMenu ); 2219 if ( Ir::supported() ) mActionBR->plug(settingsMenu );
2220#endif 2220#endif
2221 settingsMenu->insertSeparator(); 2221 settingsMenu->insertSeparator();
2222 2222
2223 mActionWhoAmI->plug( settingsMenu ); 2223 mActionWhoAmI->plug( settingsMenu );
2224 mActionEditCategories->plug( settingsMenu ); 2224 mActionEditCategories->plug( settingsMenu );
2225 mActionEditCategories->plug( changeMenu ); 2225 mActionEditCategories->plug( changeMenu );
2226 mActionCategories->plug( changeMenu ); 2226 mActionCategories->plug( changeMenu );
2227 mActionManageCategories->plug( changeMenu ); 2227 mActionManageCategories->plug( changeMenu );
2228 2228
2229 mActionCategories->plug( settingsMenu ); 2229 mActionCategories->plug( settingsMenu );
2230 mActionManageCategories->plug( settingsMenu ); 2230 mActionManageCategories->plug( settingsMenu );
2231 2231
2232 2232
2233 mActionWN->plug( helpMenu ); 2233 mActionWN->plug( helpMenu );
2234 mActionSyncHowto->plug( helpMenu ); 2234 mActionSyncHowto->plug( helpMenu );
2235 mActionKdeSyncHowto->plug( helpMenu ); 2235 mActionKdeSyncHowto->plug( helpMenu );
2236 mActionMultiSyncHowto->plug( helpMenu ); 2236 mActionMultiSyncHowto->plug( helpMenu );
2237 mActionFaq->plug( helpMenu ); 2237 mActionFaq->plug( helpMenu );
2238 mActionLicence->plug( helpMenu ); 2238 mActionLicence->plug( helpMenu );
2239 mActionAboutKAddressbook->plug( helpMenu ); 2239 mActionAboutKAddressbook->plug( helpMenu );
2240 2240
2241 if (KGlobal::getDesktopSize() > KGlobal::Small ) { 2241 if (KGlobal::getDesktopSize() > KGlobal::Small ) {
2242 2242
2243 mActionSave->plug( tb ); 2243 mActionSave->plug( tb );
2244 mViewManager->getFilterAction()->plug ( tb); 2244 mViewManager->getFilterAction()->plug ( tb);
2245 //LR hide filteraction on started in 480x640 2245 //LR hide filteraction on started in 480x640
2246 if (QApplication::desktop()->width() == 480 ) { 2246 if (QApplication::desktop()->width() == 480 ) {
2247 mViewManager->getFilterAction()->setComboWidth( 0 ); 2247 mViewManager->getFilterAction()->setComboWidth( 0 );
2248 } 2248 }
2249 mActionUndo->plug( tb ); 2249 mActionUndo->plug( tb );
2250 mActionDelete->plug( tb ); 2250 mActionDelete->plug( tb );
2251 mActionRedo->plug( tb ); 2251 mActionRedo->plug( tb );
2252 } else { 2252 } else {
2253 mActionSave->plug( tb ); 2253 mActionSave->plug( tb );
2254 tb->enableMoving(false); 2254 tb->enableMoving(false);
2255 } 2255 }
2256 //mActionQuit->plug ( tb ); 2256 //mActionQuit->plug ( tb );
2257 // tb->insertWidget(-1, 0, mIncSearchWidget, 6); 2257 // tb->insertWidget(-1, 0, mIncSearchWidget, 6);
2258 2258
2259 //US link the searchwidget first to this. 2259 //US link the searchwidget first to this.
2260 // The real linkage to the toolbar happens later. 2260 // The real linkage to the toolbar happens later.
2261//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); 2261//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE);
2262//US tb->insertItem( mIncSearchWidget ); 2262//US tb->insertItem( mIncSearchWidget );
2263/*US 2263/*US
2264 mIncSearchWidget = new IncSearchWidget( tb ); 2264 mIncSearchWidget = new IncSearchWidget( tb );
2265 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 2265 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
2266 SLOT( incrementalSearch( const QString& ) ) ); 2266 SLOT( incrementalSearch( const QString& ) ) );
2267 2267
2268 mJumpButtonBar = new JumpButtonBar( this, this ); 2268 mJumpButtonBar = new JumpButtonBar( this, this );
2269 2269
2270//US topLayout->addWidget( mJumpButtonBar ); 2270//US topLayout->addWidget( mJumpButtonBar );
2271 this->layout()->add( mJumpButtonBar ); 2271 this->layout()->add( mJumpButtonBar );
2272*/ 2272*/
2273 2273
2274#endif //KAB_EMBEDDED 2274#endif //KAB_EMBEDDED
2275 2275
2276 mActionExport2phone->plug( ExportMenu ); 2276 mActionExport2phone->plug( ExportMenu );
2277 connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); 2277 connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) );
2278 syncManager->fillSyncMenu(); 2278 syncManager->fillSyncMenu();
2279 2279
2280} 2280}
2281void KABCore::showLicence() 2281void KABCore::showLicence()
2282{ 2282{
2283 KApplication::showLicence(); 2283 KApplication::showLicence();
2284} 2284}
2285 2285
2286void KABCore::manageCategories( ) 2286void KABCore::manageCategories( )
2287{ 2287{
2288 KABCatPrefs* cp = new KABCatPrefs(); 2288 KABCatPrefs* cp = new KABCatPrefs();
2289 cp->show(); 2289 cp->show();
2290 int w =cp->sizeHint().width() ; 2290 int w =cp->sizeHint().width() ;
2291 int h = cp->sizeHint().height() ; 2291 int h = cp->sizeHint().height() ;
2292 int dw = QApplication::desktop()->width(); 2292 int dw = QApplication::desktop()->width();
2293 int dh = QApplication::desktop()->height(); 2293 int dh = QApplication::desktop()->height();
2294 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2294 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2295 if ( !cp->exec() ) { 2295 if ( !cp->exec() ) {
2296 delete cp; 2296 delete cp;
2297 return; 2297 return;
2298 } 2298 }
2299 int count = 0; 2299 int count = 0;
2300 int cc = 0;
2300 message( i18n("Please wait, processing categories...")); 2301 message( i18n("Please wait, processing categories..."));
2301 if ( cp->addCat() ) { 2302 if ( cp->addCat() ) {
2302 KABC::AddressBook::Iterator it; 2303 KABC::AddressBook::Iterator it;
2303 QStringList catList = KABPrefs::instance()->mCustomCategories; 2304 QStringList catList = KABPrefs::instance()->mCustomCategories;
2304 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 2305 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2306 ++cc;
2307 if ( cc %10 == 0)
2308 message(i18n("Processing contact #%1").arg(cc));
2305 QStringList catIncList = (*it).categories(); 2309 QStringList catIncList = (*it).categories();
2306 int i; 2310 int i;
2307 for( i = 0; i< catIncList.count(); ++i ) { 2311 for( i = 0; i< catIncList.count(); ++i ) {
2308 if ( !catList.contains (catIncList[i])) { 2312 if ( !catList.contains (catIncList[i])) {
2309 catList.append( catIncList[i] ); 2313 catList.append( catIncList[i] );
2310 //qDebug("add cat %s ", catIncList[i].latin1()); 2314 //qDebug("add cat %s ", catIncList[i].latin1());
2311 ++count; 2315 ++count;
2312 } 2316 }
2313 } 2317 }
2314 } 2318 }
2315 catList.sort(); 2319 catList.sort();
2316 KABPrefs::instance()->mCustomCategories = catList; 2320 KABPrefs::instance()->mCustomCategories = catList;
2317 KABPrefs::instance()->writeConfig(); 2321 KABPrefs::instance()->writeConfig();
2318 message(QString::number( count )+ i18n(" categories added to list! ")); 2322 message(QString::number( count )+ i18n(" categories added to list! "));
2319 } else { 2323 } else {
2320 QStringList catList = KABPrefs::instance()->mCustomCategories; 2324 QStringList catList = KABPrefs::instance()->mCustomCategories;
2321 QStringList catIncList; 2325 QStringList catIncList;
2322 QStringList newCatList; 2326 QStringList newCatList;
2323 KABC::AddressBook::Iterator it; 2327 KABC::AddressBook::Iterator it;
2324 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 2328 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2329 ++cc;
2330 if ( cc %10 == 0)
2331 message(i18n("Processing contact #%1").arg(cc));
2325 QStringList catIncList = (*it).categories(); 2332 QStringList catIncList = (*it).categories();
2326 int i; 2333 int i;
2327 if ( catIncList.count() ) { 2334 if ( catIncList.count() ) {
2328 newCatList.clear(); 2335 newCatList.clear();
2329 for( i = 0; i< catIncList.count(); ++i ) { 2336 for( i = 0; i< catIncList.count(); ++i ) {
2330 if ( catList.contains (catIncList[i])) { 2337 if ( catList.contains (catIncList[i])) {
2331 newCatList.append( catIncList[i] ); 2338 newCatList.append( catIncList[i] );
2332 } 2339 }
2333 } 2340 }
2334 newCatList.sort(); 2341 newCatList.sort();
2335 (*it).setCategories( newCatList ); 2342 (*it).setCategories( newCatList );
2336 mAddressBook->insertAddressee( (*it) ); 2343 mAddressBook->insertAddressee( (*it) );
2337 } 2344 }
2338 } 2345 }
2339 setModified( true ); 2346 setModified( true );
2340 mViewManager->refreshView(); 2347 mViewManager->refreshView();
2341 message( i18n("Removing categories done!")); 2348 message( i18n("Removing categories done!"));
2342 } 2349 }
2343 delete cp; 2350 delete cp;
2344} 2351}
2345void KABCore::removeVoice() 2352void KABCore::removeVoice()
2346{ 2353{
2347 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 ) 2354 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 )
2348 return; 2355 return;
2349 KABC::Addressee::List list; 2356 KABC::Addressee::List list;
2350 XXPortSelectDialog dlg( this, false, this ); 2357 XXPortSelectDialog dlg( this, false, this );
2351 if ( dlg.exec() ) 2358 if ( dlg.exec() )
2352 list = dlg.contacts(); 2359 list = dlg.contacts();
2353 else 2360 else
2354 return; 2361 return;
2355 KABC::Addressee::List::Iterator it; 2362 KABC::Addressee::List::Iterator it;
2356 for ( it = list.begin(); it != list.end(); ++it ) { 2363 for ( it = list.begin(); it != list.end(); ++it ) {
2357 if ( (*it).removeVoice() ) 2364 if ( (*it).removeVoice() )
2358 addrModified((*it), false ); 2365 addrModified((*it), false );
2359 } 2366 }
2360} 2367}
2361 2368
2362void KABCore::setFormattedName() 2369void KABCore::setFormattedName()
2363{ 2370{
2364 KABFormatPrefs setpref; 2371 KABFormatPrefs setpref;
2365 if ( !setpref.exec() ) { 2372 if ( !setpref.exec() ) {
2366 return; 2373 return;
2367 } 2374 }
2368 XXPortSelectDialog dlg( this, false, this ); 2375 XXPortSelectDialog dlg( this, false, this );
2369 if ( !dlg.exec() ) 2376 if ( !dlg.exec() )
2370 return; 2377 return;
2371 mAddressBook->setUntagged(); 2378 mAddressBook->setUntagged();
2372 dlg.tagSelected(); 2379 dlg.tagSelected();
2373 int count = 0; 2380 int count = 0;
2374 KABC::AddressBook::Iterator it; 2381 KABC::AddressBook::Iterator it;
2375 for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 2382 for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2376 if ( (*it).tagged() ) { 2383 if ( (*it).tagged() ) {
2377 message(i18n("Changing contact #%1").arg( ++count ) ); 2384 ++count;
2385 if ( count %10 == 0 )
2386 message(i18n("Changing contact #%1").arg( count ) );
2378 qApp->processEvents(); 2387 qApp->processEvents();
2379 QString fName; 2388 QString fName;
2380 if ( setpref.simple->isChecked() ) 2389 if ( setpref.simple->isChecked() )
2381 fName = NameEditDialog::formattedName( (*it), NameEditDialog::SimpleName ); 2390 fName = NameEditDialog::formattedName( (*it), NameEditDialog::SimpleName );
2382 else if ( setpref.full->isChecked() ) 2391 else if ( setpref.full->isChecked() )
2383 fName = NameEditDialog::formattedName( (*it), NameEditDialog::FullName ); 2392 fName = NameEditDialog::formattedName( (*it), NameEditDialog::FullName );
2384 else if ( setpref.reverse->isChecked() ) 2393 else if ( setpref.reverse->isChecked() )
2385 fName = NameEditDialog::formattedName( (*it), NameEditDialog::ReverseName ); 2394 fName = NameEditDialog::formattedName( (*it), NameEditDialog::ReverseName );
2386 else 2395 else
2387 fName = (*it).organization(); 2396 fName = (*it).organization();
2388 if ( setpref.setCompany->isChecked() ) 2397 if ( setpref.setCompany->isChecked() )
2389 if ( fName.isEmpty() || fName =="," ) 2398 if ( fName.isEmpty() || fName =="," )
2390 fName = (*it).organization(); 2399 fName = (*it).organization();
2391 (*it).setFormattedName( fName ); 2400 (*it).setFormattedName( fName );
2392 } 2401 }
2393 } 2402 }
2394 message(i18n("Refreshing view...") ); 2403 message(i18n("Refreshing view...") );
2404 qApp->processEvents();
2395 mViewManager->refreshView( "" ); 2405 mViewManager->refreshView( "" );
2396 Addressee add; 2406 Addressee add;
2397 mDetails->setAddressee( add ); 2407 mDetails->setAddressee( add );
2398 message(i18n("Setting formatted name completed!") ); 2408 message(i18n("Setting formatted name completed!") );
2399} 2409}
2400 2410
2401void KABCore::clipboardDataChanged() 2411void KABCore::clipboardDataChanged()
2402{ 2412{
2403 2413
2404 if ( mReadWrite ) 2414 if ( mReadWrite )
2405 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); 2415 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() );
2406 2416
2407} 2417}
2408 2418
2409void KABCore::updateActionMenu() 2419void KABCore::updateActionMenu()
2410{ 2420{
2411 UndoStack *undo = UndoStack::instance(); 2421 UndoStack *undo = UndoStack::instance();
2412 RedoStack *redo = RedoStack::instance(); 2422 RedoStack *redo = RedoStack::instance();
2413 2423
2414 if ( undo->isEmpty() ) 2424 if ( undo->isEmpty() )
2415 mActionUndo->setText( i18n( "Undo" ) ); 2425 mActionUndo->setText( i18n( "Undo" ) );
2416 else 2426 else
2417 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); 2427 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) );
2418 2428
2419 mActionUndo->setEnabled( !undo->isEmpty() ); 2429 mActionUndo->setEnabled( !undo->isEmpty() );
2420 2430
2421 if ( !redo->top() ) 2431 if ( !redo->top() )
2422 mActionRedo->setText( i18n( "Redo" ) ); 2432 mActionRedo->setText( i18n( "Redo" ) );
2423 else 2433 else
2424 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); 2434 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) );
2425 2435
2426 mActionRedo->setEnabled( !redo->isEmpty() ); 2436 mActionRedo->setEnabled( !redo->isEmpty() );
2427} 2437}
2428 2438
2429void KABCore::configureKeyBindings() 2439void KABCore::configureKeyBindings()
2430{ 2440{
2431#ifndef KAB_EMBEDDED 2441#ifndef KAB_EMBEDDED
2432 KKeyDialog::configure( actionCollection(), true ); 2442 KKeyDialog::configure( actionCollection(), true );
2433#else //KAB_EMBEDDED 2443#else //KAB_EMBEDDED
2434 qDebug("KABCore::configureKeyBindings() not implemented"); 2444 qDebug("KABCore::configureKeyBindings() not implemented");
2435#endif //KAB_EMBEDDED 2445#endif //KAB_EMBEDDED
2436} 2446}
2437 2447
2438#ifdef KAB_EMBEDDED 2448#ifdef KAB_EMBEDDED
2439void KABCore::configureResources() 2449void KABCore::configureResources()
2440{ 2450{
2441 KRES::KCMKResources dlg( this, "" , 0 ); 2451 KRES::KCMKResources dlg( this, "" , 0 );
2442 2452
2443 if ( !dlg.exec() ) 2453 if ( !dlg.exec() )
2444 return; 2454 return;
2445 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); 2455 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") );
2446} 2456}
2447#endif //KAB_EMBEDDED 2457#endif //KAB_EMBEDDED
2448 2458
2449 2459
2450/* this method will be called through the QCop interface from Ko/Pi to select addresses 2460/* this method will be called through the QCop interface from Ko/Pi to select addresses
2451 * for the attendees list of an event. 2461 * for the attendees list of an event.
2452 */ 2462 */
2453void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) 2463void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid)
2454{ 2464{
2455 QStringList nameList; 2465 QStringList nameList;
2456 QStringList emailList; 2466 QStringList emailList;
2457 QStringList uidList; 2467 QStringList uidList;
2458 2468
2459 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); 2469 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this);
2460 uint i=0; 2470 uint i=0;
2461 for (i=0; i < list.count(); i++) 2471 for (i=0; i < list.count(); i++)
2462 { 2472 {
2463 nameList.append(list[i].realName()); 2473 nameList.append(list[i].realName());
2464 emailList.append(list[i].preferredEmail()); 2474 emailList.append(list[i].preferredEmail());
2465 uidList.append(list[i].uid()); 2475 uidList.append(list[i].uid());
2466 } 2476 }
2467 2477
2468 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList); 2478 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList);
2469 2479
2470} 2480}
2471 2481
2472/* this method will be called through the QCop interface from Ko/Pi to select birthdays 2482/* this method will be called through the QCop interface from Ko/Pi to select birthdays
2473 * to put them into the calendar. 2483 * to put them into the calendar.
2474 */ 2484 */
2475void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid) 2485void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid)
2476{ 2486{
2477 // qDebug("KABCore::requestForBirthdayList"); 2487 // qDebug("KABCore::requestForBirthdayList");
2478 QStringList birthdayList; 2488 QStringList birthdayList;
2479 QStringList anniversaryList; 2489 QStringList anniversaryList;
2480 QStringList realNameList; 2490 QStringList realNameList;
2481 QStringList preferredEmailList; 2491 QStringList preferredEmailList;
2482 QStringList assembledNameList; 2492 QStringList assembledNameList;
2483 QStringList uidList; 2493 QStringList uidList;
2484 2494
2485 KABC::AddressBook::Iterator it; 2495 KABC::AddressBook::Iterator it;
2486 2496
2487 int count = 0; 2497 int count = 0;
2488 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 2498 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2489 ++count; 2499 ++count;
2490 } 2500 }
@@ -3096,189 +3106,200 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo
3096 mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n %d incoming filtered out\n %d outgoing filtered out"),addedAddressee, addedAddresseeR, changedLocal, changedRemote, deletedAddresseeL, deletedAddresseeR, filteredIN, filteredOUT ); 3106 mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n %d incoming filtered out\n %d outgoing filtered out"),addedAddressee, addedAddresseeR, changedLocal, changedRemote, deletedAddresseeL, deletedAddresseeR, filteredIN, filteredOUT );
3097 qDebug( mes ); 3107 qDebug( mes );
3098 mes = i18n("Local addressbook changed!\n") +mes; 3108 mes = i18n("Local addressbook changed!\n") +mes;
3099 if ( syncManager->mShowSyncSummary ) { 3109 if ( syncManager->mShowSyncSummary ) {
3100 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes, 3110 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes,
3101 i18n("KA/Pi Synchronization"),i18n("Write back"))) { 3111 i18n("KA/Pi Synchronization"),i18n("Write back"))) {
3102 qDebug("cancelled "); 3112 qDebug("cancelled ");
3103 return false; 3113 return false;
3104 } 3114 }
3105 } 3115 }
3106 return syncOK; 3116 return syncOK;
3107} 3117}
3108 3118
3109 3119
3110//this is a overwritten callbackmethods from the syncinterface 3120//this is a overwritten callbackmethods from the syncinterface
3111bool KABCore::sync(KSyncManager* manager, QString filename, int mode) 3121bool KABCore::sync(KSyncManager* manager, QString filename, int mode)
3112{ 3122{
3113 3123
3114 //pending prepare addresseeview for output 3124 //pending prepare addresseeview for output
3115 //pending detect, if remote file has REV field. if not switch to external sync 3125 //pending detect, if remote file has REV field. if not switch to external sync
3116 mGlobalSyncMode = SYNC_MODE_NORMAL; 3126 mGlobalSyncMode = SYNC_MODE_NORMAL;
3117 if ( manager != syncManager ) 3127 if ( manager != syncManager )
3118 qDebug("KABCore::sync:: ERROR! :: manager != syncManager "); 3128 qDebug("KABCore::sync:: ERROR! :: manager != syncManager ");
3119 QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); 3129 QString mCurrentSyncDevice = manager->getCurrentSyncDevice();
3120 3130
3121 AddressBook abLocal(filename,"syncContact"); 3131 AddressBook abLocal(filename,"syncContact");
3122 bool syncOK = false; 3132 bool syncOK = false;
3123 if ( abLocal.load() ) { 3133 if ( abLocal.load() ) {
3124 qDebug("AB loaded %s,sync mode %d",filename.latin1(), mode ); 3134 qDebug("AB loaded %s,sync mode %d",filename.latin1(), mode );
3125 bool external = false; 3135 bool external = false;
3126 bool isXML = false; 3136 bool isXML = false;
3127 if ( filename.right(4) == ".xml") { 3137 if ( filename.right(4) == ".xml") {
3128 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 3138 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
3129 isXML = true; 3139 isXML = true;
3130 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); 3140 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true );
3131 } else { 3141 } else {
3132 external = !manager->mIsKapiFile; 3142 external = !manager->mIsKapiFile;
3133 if ( external ) { 3143 if ( external ) {
3134 qDebug("Setting vcf mode to external "); 3144 qDebug("Setting vcf mode to external ");
3135 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 3145 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
3136 AddressBook::Iterator it; 3146 AddressBook::Iterator it;
3137 for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { 3147 for ( it = abLocal.begin(); it != abLocal.end(); ++it ) {
3138 (*it).setID( mCurrentSyncDevice, (*it).uid() ); 3148 (*it).setID( mCurrentSyncDevice, (*it).uid() );
3139 (*it).computeCsum( mCurrentSyncDevice ); 3149 (*it).computeCsum( mCurrentSyncDevice );
3140 } 3150 }
3141 } 3151 }
3142 } 3152 }
3143 //AddressBook::Iterator it; 3153 //AddressBook::Iterator it;
3144 //QStringList vcards; 3154 //QStringList vcards;
3145 //for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { 3155 //for ( it = abLocal.begin(); it != abLocal.end(); ++it ) {
3146 // qDebug("Name %s ", (*it).familyName().latin1()); 3156 // qDebug("Name %s ", (*it).familyName().latin1());
3147 //} 3157 //}
3148 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, mode ); 3158 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, mode );
3149 if ( syncOK ) { 3159 if ( syncOK ) {
3150 if ( syncManager->mWriteBackFile ) 3160 if ( syncManager->mWriteBackFile )
3151 { 3161 {
3152 if ( external ) 3162 if ( external )
3153 abLocal.removeSyncAddressees( !isXML); 3163 abLocal.removeSyncAddressees( !isXML);
3154 qDebug("Saving remote AB "); 3164 qDebug("Saving remote AB ");
3155 if ( ! abLocal.saveAB()) 3165 if ( ! abLocal.saveAB())
3156 qDebug("Error writing back AB to file "); 3166 qDebug("Error writing back AB to file ");
3157 if ( external ) { 3167 if ( external ) {
3158 // afterwrite processing 3168 // afterwrite processing
3159 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ,isXML); 3169 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ,isXML);
3160 } 3170 }
3161 } 3171 }
3162 } 3172 }
3163 setModified(); 3173 setModified();
3164 3174
3165 } 3175 }
3166 abLocal.removeResources(); 3176 abLocal.removeResources();
3167 if ( syncOK ) 3177 if ( syncOK )
3168 mViewManager->refreshView(); 3178 mViewManager->refreshView();
3169 return syncOK; 3179 return syncOK;
3170 3180
3171} 3181}
3172void KABCore::removeSyncInfo( QString syncProfile) 3182void KABCore::removeSyncInfo( QString syncProfile)
3173{ 3183{
3174 qDebug("AB:removeSyncInfo for profile %s ", syncProfile.latin1()); 3184 qDebug("AB:removeSyncInfo for profile %s ", syncProfile.latin1());
3175 mAddressBook->removeSyncInfo( syncProfile ); 3185 mAddressBook->removeSyncInfo( syncProfile );
3176 setModified(); 3186 setModified();
3177} 3187}
3178 3188
3179 3189
3180//this is a overwritten callbackmethods from the syncinterface 3190//this is a overwritten callbackmethods from the syncinterface
3181bool KABCore::syncExternal(KSyncManager* manager, QString resource) 3191bool KABCore::syncExternal(KSyncManager* manager, QString resource)
3182{ 3192{
3183 if ( resource == "phone" ) 3193 if ( resource == "phone" )
3184 return syncPhone(); 3194 return syncPhone();
3185 disableBR( true ); 3195 disableBR( true );
3186 if ( manager != syncManager ) 3196 if ( manager != syncManager )
3187 qDebug("KABCore::syncExternal:: ERROR! :: manager != syncManager "); 3197 qDebug("KABCore::syncExternal:: ERROR! :: manager != syncManager ");
3188 QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); 3198 QString mCurrentSyncDevice = manager->getCurrentSyncDevice();
3189 3199
3190 AddressBook abLocal( resource,"syncContact"); 3200 AddressBook abLocal( resource,"syncContact");
3191 bool syncOK = false; 3201 bool syncOK = false;
3202 message(i18n("Loading DTM address data..."), false);
3192 if ( abLocal.load() ) { 3203 if ( abLocal.load() ) {
3193 qDebug("AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1()); 3204 qDebug("AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1());
3194 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 3205 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
3206 message(i18n("Sync preprocessing..."),false);
3195 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, false ); 3207 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, false );
3208 message(i18n("Synchronizing..."),false);
3196 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); 3209 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs );
3197 if ( syncOK ) { 3210 if ( syncOK ) {
3198 if ( syncManager->mWriteBackFile ) { 3211 if ( syncManager->mWriteBackFile ) {
3199 abLocal.removeSyncAddressees( false ); 3212 abLocal.removeSyncAddressees( false );
3213 message(i18n("Saving DTM address data..."),false);
3200 abLocal.saveAB(); 3214 abLocal.saveAB();
3215 message(i18n("Sync postprocessing..."),false);
3201 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true ); 3216 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true );
3202 } 3217 }
3203 } else 3218 } else
3204 message( i18n("Sync cancelled or failed.") ); 3219 message( i18n("Sync cancelled or failed.") );
3205 setModified(); 3220 setModified();
3206 } 3221 }
3207 abLocal.removeResources(); 3222 abLocal.removeResources();
3208 if ( syncOK ) 3223 if ( syncOK ) {
3209 mViewManager->refreshView(); 3224 mViewManager->refreshView();
3225 message(i18n("DTM syncing finished."));
3226 }
3210 disableBR( false ); 3227 disableBR( false );
3211 return syncOK; 3228 return syncOK;
3212 3229
3213} 3230}
3214void KABCore::message( QString m ) 3231void KABCore::message( QString m, bool startTimer)
3215{ 3232{
3216 topLevelWidget()->setCaption( m ); 3233 topLevelWidget()->setCaption( m );
3217 mMessageTimer->start( 20000, true ); 3234 qApp->processEvents();
3235 if ( startTimer )
3236 mMessageTimer->start( 15000, true );
3237 else
3238 mMessageTimer->stop();
3218} 3239}
3219bool KABCore::syncPhone() 3240bool KABCore::syncPhone()
3220{ 3241{
3221 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); 3242 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice();
3222 QString fileName = getPhoneFile(); 3243 QString fileName = getPhoneFile();
3223 if ( !PhoneAccess::readFromPhone( fileName) ) { 3244 if ( !PhoneAccess::readFromPhone( fileName) ) {
3224 message(i18n("Phone access failed!")); 3245 message(i18n("Phone access failed!"));
3225 return false; 3246 return false;
3226 } 3247 }
3227 AddressBook abLocal( fileName,"syncContact"); 3248 AddressBook abLocal( fileName,"syncContact");
3228 bool syncOK = false; 3249 bool syncOK = false;
3229 { 3250 {
3230 abLocal.importFromFile( fileName ); 3251 abLocal.importFromFile( fileName );
3231 qDebug("AB phone loaded ,sync device %s",mCurrentSyncDevice.latin1()); 3252 qDebug("AB phone loaded ,sync device %s",mCurrentSyncDevice.latin1());
3232 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 3253 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
3233 abLocal.preparePhoneSync( mCurrentSyncDevice, true ); 3254 abLocal.preparePhoneSync( mCurrentSyncDevice, true );
3234 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); 3255 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true );
3235 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); 3256 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs );
3236 if ( syncOK ) { 3257 if ( syncOK ) {
3237 if ( syncManager->mWriteBackFile ) { 3258 if ( syncManager->mWriteBackFile ) {
3238 abLocal.removeSyncAddressees( true ); 3259 abLocal.removeSyncAddressees( true );
3239 abLocal.saveABphone( fileName ); 3260 abLocal.saveABphone( fileName );
3240 abLocal.findNewExtIds( fileName, mCurrentSyncDevice ); 3261 abLocal.findNewExtIds( fileName, mCurrentSyncDevice );
3241 //abLocal.preparePhoneSync( mCurrentSyncDevice, false ); 3262 //abLocal.preparePhoneSync( mCurrentSyncDevice, false );
3242 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true ); 3263 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true );
3243 } 3264 }
3244 } 3265 }
3245 setModified(); 3266 setModified();
3246 } 3267 }
3247 abLocal.removeResources(); 3268 abLocal.removeResources();
3248 if ( syncOK ) 3269 if ( syncOK )
3249 mViewManager->refreshView(); 3270 mViewManager->refreshView();
3250 return syncOK; 3271 return syncOK;
3251} 3272}
3252void KABCore::getFile( bool success ) 3273void KABCore::getFile( bool success )
3253{ 3274{
3254 if ( ! success ) { 3275 if ( ! success ) {
3255 message( i18n("Error receiving file. Nothing changed!") ); 3276 message( i18n("Error receiving file. Nothing changed!") );
3256 return; 3277 return;
3257 } 3278 }
3258 int count = mAddressBook->importFromFile( sentSyncFile() , false, true ); 3279 int count = mAddressBook->importFromFile( sentSyncFile() , false, true );
3259 if ( count ) 3280 if ( count )
3260 setModified( true ); 3281 setModified( true );
3261 message( i18n("Pi-Sync successful!") ); 3282 message( i18n("Pi-Sync successful!") );
3262 mViewManager->refreshView(); 3283 mViewManager->refreshView();
3263} 3284}
3264void KABCore::syncFileRequest() 3285void KABCore::syncFileRequest()
3265{ 3286{
3266 if ( KABPrefs::instance()->mPassiveSyncWithDesktop ) { 3287 if ( KABPrefs::instance()->mPassiveSyncWithDesktop ) {
3267 syncManager->slotSyncMenu( 999 ); 3288 syncManager->slotSyncMenu( 999 );
3268 } 3289 }
3269 mAddressBook->export2File( sentSyncFile() ); 3290 mAddressBook->export2File( sentSyncFile() );
3270} 3291}
3271QString KABCore::sentSyncFile() 3292QString KABCore::sentSyncFile()
3272{ 3293{
3273#ifdef DESKTOP_VERSION 3294#ifdef DESKTOP_VERSION
3274 return locateLocal( "tmp", "copysyncab.vcf" ); 3295 return locateLocal( "tmp", "copysyncab.vcf" );
3275#else 3296#else
3276 return QString( "/tmp/copysyncab.vcf" ); 3297 return QString( "/tmp/copysyncab.vcf" );
3277#endif 3298#endif
3278} 3299}
3279 3300
3280void KABCore::setCaptionBack() 3301void KABCore::setCaptionBack()
3281{ 3302{
3282 mMessageTimer->stop(); 3303 mMessageTimer->stop();
3283 topLevelWidget()->setCaption( i18n("KAddressbook/Pi") ); 3304 topLevelWidget()->setCaption( i18n("KAddressbook/Pi") );
3284} 3305}
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index ecfe6e9..786549a 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -407,113 +407,113 @@ class KABCore : public QWidget, public KSyncInterface
407 ViewContainer *mDetails; 407 ViewContainer *mDetails;
408 KDGanttMinimizeSplitter* mMiniSplitter; 408 KDGanttMinimizeSplitter* mMiniSplitter;
409 XXPortManager *mXXPortManager; 409 XXPortManager *mXXPortManager;
410 JumpButtonBar *mJumpButtonBar; 410 JumpButtonBar *mJumpButtonBar;
411 IncSearchWidget *mIncSearchWidget; 411 IncSearchWidget *mIncSearchWidget;
412 ExtensionManager *mExtensionManager; 412 ExtensionManager *mExtensionManager;
413 413
414 KCMultiDialog *mConfigureDialog; 414 KCMultiDialog *mConfigureDialog;
415 415
416#ifndef KAB_EMBEDDED 416#ifndef KAB_EMBEDDED
417 LDAPSearchDialog *mLdapSearchDialog; 417 LDAPSearchDialog *mLdapSearchDialog;
418#endif //KAB_EMBEDDED 418#endif //KAB_EMBEDDED
419 // QDict<AddresseeEditorDialog> mEditorDict; 419 // QDict<AddresseeEditorDialog> mEditorDict;
420 AddresseeEditorDialog *mEditorDialog; 420 AddresseeEditorDialog *mEditorDialog;
421 bool mReadWrite; 421 bool mReadWrite;
422 bool mModified; 422 bool mModified;
423 bool mIsPart; 423 bool mIsPart;
424 bool mMultipleViewsAtOnce; 424 bool mMultipleViewsAtOnce;
425 425
426 426
427 //US file menu 427 //US file menu
428 KAction *mActionMail; 428 KAction *mActionMail;
429 KAction *mActionBeam; 429 KAction *mActionBeam;
430 KToggleAction *mActionBR; 430 KToggleAction *mActionBR;
431 KAction *mActionExport2phone; 431 KAction *mActionExport2phone;
432 KAction* mActionPrint; 432 KAction* mActionPrint;
433 KAction* mActionPrintDetails; 433 KAction* mActionPrintDetails;
434 KAction* mActionNewContact; 434 KAction* mActionNewContact;
435 KAction *mActionSave; 435 KAction *mActionSave;
436 KAction *mActionEditAddressee; 436 KAction *mActionEditAddressee;
437 KAction *mActionMailVCard; 437 KAction *mActionMailVCard;
438 KAction *mActionBeamVCard; 438 KAction *mActionBeamVCard;
439 439
440 KAction *mActionQuit; 440 KAction *mActionQuit;
441 441
442 //US edit menu 442 //US edit menu
443 KAction *mActionCopy; 443 KAction *mActionCopy;
444 KAction *mActionCut; 444 KAction *mActionCut;
445 KAction *mActionPaste; 445 KAction *mActionPaste;
446 KAction *mActionSelectAll; 446 KAction *mActionSelectAll;
447 KAction *mActionUndo; 447 KAction *mActionUndo;
448 KAction *mActionRedo; 448 KAction *mActionRedo;
449 KAction *mActionDelete; 449 KAction *mActionDelete;
450 450
451 //US settings menu 451 //US settings menu
452 KAction *mActionConfigResources; 452 KAction *mActionConfigResources;
453 KAction *mActionConfigKAddressbook; 453 KAction *mActionConfigKAddressbook;
454 KAction *mActionConfigShortcuts; 454 KAction *mActionConfigShortcuts;
455 KAction *mActionConfigureToolbars; 455 KAction *mActionConfigureToolbars;
456 KAction *mActionKeyBindings; 456 KAction *mActionKeyBindings;
457 KToggleAction *mActionJumpBar; 457 KToggleAction *mActionJumpBar;
458 KToggleAction *mActionDetails; 458 KToggleAction *mActionDetails;
459 KAction *mActionWhoAmI; 459 KAction *mActionWhoAmI;
460 KAction *mActionCategories; 460 KAction *mActionCategories;
461 KAction *mActionEditCategories; 461 KAction *mActionEditCategories;
462 KAction *mActionManageCategories; 462 KAction *mActionManageCategories;
463 KAction *mActionAboutKAddressbook; 463 KAction *mActionAboutKAddressbook;
464 KAction *mActionLicence; 464 KAction *mActionLicence;
465 KAction *mActionFaq; 465 KAction *mActionFaq;
466 KAction *mActionWN; 466 KAction *mActionWN;
467 KAction *mActionSyncHowto; 467 KAction *mActionSyncHowto;
468 KAction *mActionKdeSyncHowto; 468 KAction *mActionKdeSyncHowto;
469 KAction *mActionMultiSyncHowto; 469 KAction *mActionMultiSyncHowto;
470 470
471 KAction *mActionDeleteView; 471 KAction *mActionDeleteView;
472 472
473 QPopupMenu *viewMenu; 473 QPopupMenu *viewMenu;
474 QPopupMenu *filterMenu; 474 QPopupMenu *filterMenu;
475 QPopupMenu *settingsMenu; 475 QPopupMenu *settingsMenu;
476 QPopupMenu *changeMenu; 476 QPopupMenu *changeMenu;
477 QPopupMenu *beamMenu; 477 QPopupMenu *beamMenu;
478//US QAction *mActionSave; 478//US QAction *mActionSave;
479 QPopupMenu *ImportMenu; 479 QPopupMenu *ImportMenu;
480 QPopupMenu *ExportMenu; 480 QPopupMenu *ExportMenu;
481 //LR additional methods 481 //LR additional methods
482 KAction *mActionRemoveVoice; 482 KAction *mActionRemoveVoice;
483 KAction *mActionSetFormattedName; 483 KAction *mActionSetFormattedName;
484 KAction * mActionImportOL; 484 KAction * mActionImportOL;
485 485
486#ifndef KAB_EMBEDDED 486#ifndef KAB_EMBEDDED
487 KAddressBookService *mAddressBookService; 487 KAddressBookService *mAddressBookService;
488#endif //KAB_EMBEDDED 488#endif //KAB_EMBEDDED
489 489
490 class KABCorePrivate; 490 class KABCorePrivate;
491 KABCorePrivate *d; 491 KABCorePrivate *d;
492 //US bool mBlockSaveFlag; 492 //US bool mBlockSaveFlag;
493 493
494#ifdef KAB_EMBEDDED 494#ifdef KAB_EMBEDDED
495 KAddressBookMain *mMainWindow; // should be the same like mGUIClient 495 KAddressBookMain *mMainWindow; // should be the same like mGUIClient
496#endif //KAB_EMBEDDED 496#endif //KAB_EMBEDDED
497 497
498 //this are the overwritten callbackmethods from the syncinterface 498 //this are the overwritten callbackmethods from the syncinterface
499 virtual bool sync(KSyncManager* manager, QString filename, int mode); 499 virtual bool sync(KSyncManager* manager, QString filename, int mode);
500 virtual bool syncExternal(KSyncManager* manager, QString resource); 500 virtual bool syncExternal(KSyncManager* manager, QString resource);
501 virtual void removeSyncInfo( QString syncProfile); 501 virtual void removeSyncInfo( QString syncProfile);
502 bool syncPhone(); 502 bool syncPhone();
503 void message( QString m ); 503 void message( QString m , bool startTimer = true);
504 504
505 // LR ******************************* 505 // LR *******************************
506 // sync stuff! 506 // sync stuff!
507 QString sentSyncFile(); 507 QString sentSyncFile();
508 QPopupMenu *syncMenu; 508 QPopupMenu *syncMenu;
509 KSyncManager* syncManager; 509 KSyncManager* syncManager;
510 int mGlobalSyncMode; 510 int mGlobalSyncMode;
511 bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode); 511 bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode);
512 KABC::Addressee getLastSyncAddressee(); 512 KABC::Addressee getLastSyncAddressee();
513 QDateTime mLastAddressbookSync; 513 QDateTime mLastAddressbookSync;
514 int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ); 514 int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full );
515 // ********************* 515 // *********************
516 516
517}; 517};
518 518
519#endif 519#endif