summaryrefslogtreecommitdiffabout
path: root/kaddressbook/kabcore.cpp
authorzautrix <zautrix>2005-01-17 18:22:47 (UTC)
committer zautrix <zautrix>2005-01-17 18:22:47 (UTC)
commit32479683283fc9f20d369ac9671ba0f8a33d3381 (patch) (unidiff)
tree0d764657db915bd2d2bf2fb751800eb14515626b /kaddressbook/kabcore.cpp
parent11e05160cda1571a208edbabc71f6d94e394d829 (diff)
downloadkdepimpi-32479683283fc9f20d369ac9671ba0f8a33d3381.zip
kdepimpi-32479683283fc9f20d369ac9671ba0f8a33d3381.tar.gz
kdepimpi-32479683283fc9f20d369ac9671ba0f8a33d3381.tar.bz2
fast set formatted name
Diffstat (limited to 'kaddressbook/kabcore.cpp') (more/less context) (show whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp28
1 files changed, 18 insertions, 10 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 9526f23..d393660 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -222,13 +222,14 @@ class KABFormatPrefs : public QDialog
222 QPushButton * ok = new QPushButton( i18n("Select contact list"), this ); 222 QPushButton * ok = new QPushButton( i18n("Select contact list"), this );
223 lay->addWidget( ok ); 223 lay->addWidget( ok );
224 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 224 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
225 lay->addWidget( cancel ); 225 lay->addWidget( cancel );
226 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 226 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
227 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 227 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
228 resize( 200, 200 ); 228 //resize( 200, 200 );
229
229 } 230 }
230public: 231public:
231 QRadioButton* simple, *full, *reverse, *company; 232 QRadioButton* simple, *full, *reverse, *company;
232 QCheckBox* setCompany; 233 QCheckBox* setCompany;
233}; 234};
234 235
@@ -1370,13 +1371,14 @@ void KABCore::save()
1370 return; 1371 return;
1371 1372
1372 syncManager->setBlockSave(true); 1373 syncManager->setBlockSave(true);
1373 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 "
1374 "address book. Please check that some \nother application is " 1375 "address book. Please check that some \nother application is "
1375 "not using it. " ); 1376 "not using it. " );
1376 message(i18n("Saving addressbook ... ")); 1377 message(i18n("Saving ... please wait! "));
1378 qApp->processEvents();
1377#ifndef KAB_EMBEDDED 1379#ifndef KAB_EMBEDDED
1378 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); 1380 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook );
1379 if ( !b || !b->save() ) { 1381 if ( !b || !b->save() ) {
1380 KMessageBox::error( this, text, i18n( "Unable to Save" ) ); 1382 KMessageBox::error( this, text, i18n( "Unable to Save" ) );
1381 } 1383 }
1382#else //KAB_EMBEDDED 1384#else //KAB_EMBEDDED
@@ -2360,20 +2362,23 @@ void KABCore::removeVoice()
2360void KABCore::setFormattedName() 2362void KABCore::setFormattedName()
2361{ 2363{
2362 KABFormatPrefs setpref; 2364 KABFormatPrefs setpref;
2363 if ( !setpref.exec() ) { 2365 if ( !setpref.exec() ) {
2364 return; 2366 return;
2365 } 2367 }
2366 KABC::Addressee::List list;
2367 XXPortSelectDialog dlg( this, false, this ); 2368 XXPortSelectDialog dlg( this, false, this );
2368 if ( dlg.exec() ) 2369 if ( !dlg.exec() )
2369 list = dlg.contacts();
2370 else
2371 return; 2370 return;
2372 KABC::Addressee::List::Iterator it; 2371 mAddressBook->setUntagged();
2373 for ( it = list.begin(); it != list.end(); ++it ) { 2372 dlg.tagSelected();
2373 int count = 0;
2374 KABC::AddressBook::Iterator it;
2375 for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2376 if ( (*it).tagged() ) {
2377 message(i18n("Changing contact #%1").arg( ++count ) );
2378 qApp->processEvents();
2374 QString fName; 2379 QString fName;
2375 if ( setpref.simple->isChecked() ) 2380 if ( setpref.simple->isChecked() )
2376 fName = NameEditDialog::formattedName( (*it), NameEditDialog::SimpleName ); 2381 fName = NameEditDialog::formattedName( (*it), NameEditDialog::SimpleName );
2377 else if ( setpref.full->isChecked() ) 2382 else if ( setpref.full->isChecked() )
2378 fName = NameEditDialog::formattedName( (*it), NameEditDialog::FullName ); 2383 fName = NameEditDialog::formattedName( (*it), NameEditDialog::FullName );
2379 else if ( setpref.reverse->isChecked() ) 2384 else if ( setpref.reverse->isChecked() )
@@ -2381,16 +2386,19 @@ void KABCore::setFormattedName()
2381 else 2386 else
2382 fName = (*it).organization(); 2387 fName = (*it).organization();
2383 if ( setpref.setCompany->isChecked() ) 2388 if ( setpref.setCompany->isChecked() )
2384 if ( fName.isEmpty() || fName =="," ) 2389 if ( fName.isEmpty() || fName =="," )
2385 fName = (*it).organization(); 2390 fName = (*it).organization();
2386 (*it).setFormattedName( fName ); 2391 (*it).setFormattedName( fName );
2387 addrModified((*it),false );
2388 } 2392 }
2393 }
2394 message(i18n("Refreshing view...") );
2395 mViewManager->refreshView( "" );
2389 Addressee add; 2396 Addressee add;
2390 mDetails->setAddressee( add ); 2397 mDetails->setAddressee( add );
2398 message(i18n("Setting formatted name completed!") );
2391} 2399}
2392 2400
2393void KABCore::clipboardDataChanged() 2401void KABCore::clipboardDataChanged()
2394{ 2402{
2395 2403
2396 if ( mReadWrite ) 2404 if ( mReadWrite )
@@ -3203,13 +3211,13 @@ bool KABCore::syncExternal(KSyncManager* manager, QString resource)
3203 return syncOK; 3211 return syncOK;
3204 3212
3205} 3213}
3206void KABCore::message( QString m ) 3214void KABCore::message( QString m )
3207{ 3215{
3208 topLevelWidget()->setCaption( m ); 3216 topLevelWidget()->setCaption( m );
3209 mMessageTimer->start( 15000, true ); 3217 mMessageTimer->start( 20000, true );
3210} 3218}
3211bool KABCore::syncPhone() 3219bool KABCore::syncPhone()
3212{ 3220{
3213 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); 3221 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice();
3214 QString fileName = getPhoneFile(); 3222 QString fileName = getPhoneFile();
3215 if ( !PhoneAccess::readFromPhone( fileName) ) { 3223 if ( !PhoneAccess::readFromPhone( fileName) ) {