-rw-r--r-- | kaddressbook/imagewidget.cpp | 25 | ||||
-rw-r--r-- | kaddressbook/kabcore.cpp | 52 | ||||
-rw-r--r-- | kaddressbook/xxportselectdialog.cpp | 48 | ||||
-rw-r--r-- | kaddressbook/xxportselectdialog.h | 1 |
4 files changed, 87 insertions, 39 deletions
diff --git a/kaddressbook/imagewidget.cpp b/kaddressbook/imagewidget.cpp index 9ee4eac..1e9743c 100644 --- a/kaddressbook/imagewidget.cpp +++ b/kaddressbook/imagewidget.cpp @@ -55,3 +55,3 @@ ImageWidget::ImageWidget( QWidget *parent, const char *name ) QGroupBox *photoBox = new QGroupBox( 0, Qt::Vertical, i18n( "Photo" ), this ); - QGridLayout *boxLayout = new QGridLayout( photoBox->layout(), 4, 2, + QGridLayout *boxLayout = new QGridLayout( photoBox->layout(), 3, 2, KDialog::spacingHint() ); @@ -77,11 +77,10 @@ ImageWidget::ImageWidget( QWidget *parent, const char *name ) boxLayout->addWidget( mPhotoUrl, 0, 1 ); - - mUsePhotoUrl = new QCheckBox( i18n( "Store as URL" ), photoBox ); + QHBox *hb1 = new QHBox ( photoBox ); + mUsePhotoUrl = new QCheckBox( i18n( "Store as URL" ), hb1 ); mUsePhotoUrl->setEnabled( false ); - boxLayout->addWidget( mUsePhotoUrl, 1, 1 ); + boxLayout->addWidget( hb1, 1, 1 ); - QPushButton * pb = new QPushButton( i18n( "Remove" ), photoBox ); + QPushButton * pb = new QPushButton( i18n( "Remove" ), hb1 ); connect( pb, SIGNAL( clicked() ),this, SLOT( removePhoto() ) ); - boxLayout->addWidget( pb, 2, 1 ); - boxLayout->addWidget( new QLabel( photoBox ), 3, 1 ); + boxLayout->addWidget( new QLabel( photoBox ), 2, 1 ); @@ -90,3 +89,3 @@ ImageWidget::ImageWidget( QWidget *parent, const char *name ) QGroupBox *logoBox = new QGroupBox( 0, Qt::Vertical, i18n( "Logo" ), this ); - boxLayout = new QGridLayout( logoBox->layout(), 4, 2, KDialog::spacingHint() ); + boxLayout = new QGridLayout( logoBox->layout(), 3, 2, KDialog::spacingHint() ); boxLayout->setRowStretch( 2, 1 ); @@ -107,10 +106,10 @@ ImageWidget::ImageWidget( QWidget *parent, const char *name ) - mUseLogoUrl = new QCheckBox( i18n( "Store as URL" ), logoBox ); + QHBox *hb2 = new QHBox ( logoBox ); + mUseLogoUrl = new QCheckBox( i18n( "Store as URL" ), hb2 ); mUseLogoUrl->setEnabled( false ); - boxLayout->addWidget( mUseLogoUrl, 1, 1 ); + boxLayout->addWidget( hb2, 1, 1 ); - pb = new QPushButton( i18n( "Remove" ), logoBox ); + pb = new QPushButton( i18n( "Remove" ), hb2 ); connect( pb, SIGNAL( clicked() ),this, SLOT( removeLogo() ) ); - boxLayout->addWidget( pb, 2, 1 ); - boxLayout->addWidget( new QLabel( logoBox ), 3, 1 ); + boxLayout->addWidget( new QLabel( logoBox ), 2, 1 ); topLayout->addWidget( logoBox, 1, 0 ); diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 9526f23..d393660 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp @@ -227,3 +227,4 @@ class KABFormatPrefs : public QDialog connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); - resize( 200, 200 ); + //resize( 200, 200 ); + } @@ -1375,3 +1376,4 @@ void KABCore::save() "not using it. " ); - message(i18n("Saving addressbook ... ")); + message(i18n("Saving ... please wait! ")); + qApp->processEvents(); #ifndef KAB_EMBEDDED @@ -2365,27 +2367,33 @@ void KABCore::setFormattedName() } - KABC::Addressee::List list; XXPortSelectDialog dlg( this, false, this ); - if ( dlg.exec() ) - list = dlg.contacts(); - else + if ( !dlg.exec() ) return; - KABC::Addressee::List::Iterator it; - for ( it = list.begin(); it != list.end(); ++it ) { - QString fName; - if ( setpref.simple->isChecked() ) - fName = NameEditDialog::formattedName( (*it), NameEditDialog::SimpleName ); - else if ( setpref.full->isChecked() ) - fName = NameEditDialog::formattedName( (*it), NameEditDialog::FullName ); - else if ( setpref.reverse->isChecked() ) - fName = NameEditDialog::formattedName( (*it), NameEditDialog::ReverseName ); - else - fName = (*it).organization(); - if ( setpref.setCompany->isChecked() ) - if ( fName.isEmpty() || fName =="," ) + mAddressBook->setUntagged(); + dlg.tagSelected(); + int count = 0; + KABC::AddressBook::Iterator it; + for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { + if ( (*it).tagged() ) { + message(i18n("Changing contact #%1").arg( ++count ) ); + qApp->processEvents(); + QString fName; + if ( setpref.simple->isChecked() ) + fName = NameEditDialog::formattedName( (*it), NameEditDialog::SimpleName ); + else if ( setpref.full->isChecked() ) + fName = NameEditDialog::formattedName( (*it), NameEditDialog::FullName ); + else if ( setpref.reverse->isChecked() ) + fName = NameEditDialog::formattedName( (*it), NameEditDialog::ReverseName ); + else fName = (*it).organization(); - (*it).setFormattedName( fName ); - addrModified((*it),false ); + if ( setpref.setCompany->isChecked() ) + if ( fName.isEmpty() || fName =="," ) + fName = (*it).organization(); + (*it).setFormattedName( fName ); + } } + message(i18n("Refreshing view...") ); + mViewManager->refreshView( "" ); Addressee add; mDetails->setAddressee( add ); + message(i18n("Setting formatted name completed!") ); } @@ -3208,3 +3216,3 @@ void KABCore::message( QString m ) topLevelWidget()->setCaption( m ); - mMessageTimer->start( 15000, true ); + mMessageTimer->start( 20000, true ); } diff --git a/kaddressbook/xxportselectdialog.cpp b/kaddressbook/xxportselectdialog.cpp index 6282453..e7bc8c0 100644 --- a/kaddressbook/xxportselectdialog.cpp +++ b/kaddressbook/xxportselectdialog.cpp @@ -56,3 +56,3 @@ XXPortSelectDialog::XXPortSelectDialog( KABCore *core, bool sort, QWidget* parent, const char* name ) - : KDialogBase( Plain, i18n( "Choose which contacts to select" ), Help | Ok | Cancel, + : KDialogBase( Plain, i18n( "Choose contact selection" ), Help | Ok | Cancel, Ok, parent, name, true, true ), mCore( core ), @@ -111,5 +111,44 @@ QStringList XXPortSelectDialog::uids() } +void XXPortSelectDialog::tagSelected() +{ + if ( mUseSelection->isChecked() ) { + + QStringList selection = mCore->selectedUIDs(); + KABC::AddressBook::Iterator it; + for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) { + if ( selection.findIndex((*it).uid()) >= 0 ) + (*it).setTagged( true ); + } + } else if ( mUseFilters->isChecked() ) { + // find contacts that can pass selected filter + Filter::List::Iterator filterIt; + for ( filterIt = mFilters.begin(); filterIt != mFilters.end(); ++filterIt ) + if ( (*filterIt).name() == mFiltersCombo->currentText() ) + break; + KABC::AddressBook::Iterator it; + for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) { + if ( (*filterIt).filterAddressee( *it ) ) + (*it).setTagged( true ); + } + } else if ( mUseCategories->isChecked() ) { + QStringList categorieList = categories(); + KABC::AddressBook::Iterator it; + for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) { + QStringList tmp( (*it).categories() ); + QStringList::Iterator tmpIt; + for ( tmpIt = tmp.begin(); tmpIt != tmp.end(); ++tmpIt ) + if ( categorieList.contains( *tmpIt ) ) { + (*it).setTagged( true ); + break; + } + } + } else { + // create a string list of all entries: + KABC::AddressBook::Iterator it; + for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) + (*it).setTagged( true ); + } +} KABC::AddresseeList XXPortSelectDialog::contacts() { - QStringList selection = mCore->selectedUIDs(); @@ -118,2 +157,3 @@ KABC::AddresseeList XXPortSelectDialog::contacts() QStringList::Iterator it; + QStringList selection = mCore->selectedUIDs(); for ( it = selection.begin(); it != selection.end(); ++it ) { @@ -248,4 +288,4 @@ void XXPortSelectDialog::initGUI() - // if (QApplication::desktop()->height() == 480 ) - // mCategoriesView->setMaximumHeight( 240 ); + if (QApplication::desktop()->height() == 480 ) + mCategoriesView->setMaximumHeight( 240 ); topLayout->addWidget( mButtonGroup ); diff --git a/kaddressbook/xxportselectdialog.h b/kaddressbook/xxportselectdialog.h index 3bb696f..28b1fef 100644 --- a/kaddressbook/xxportselectdialog.h +++ b/kaddressbook/xxportselectdialog.h @@ -50,2 +50,3 @@ class XXPortSelectDialog : public KDialogBase KABC::AddresseeList contacts(); + void tagSelected(); QStringList uids(); |