summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-01-14 19:02:53 (UTC)
committer zautrix <zautrix>2005-01-14 19:02:53 (UTC)
commit620f8de219ee34c209960f02c8296c0568dd5d8b (patch) (side-by-side diff)
tree772170b3b9ceaf8c204e2bdd9cbb333427de30cd
parent61c95ce0295f1397db6499c5b468a9fb3d32a0f4 (diff)
downloadkdepimpi-620f8de219ee34c209960f02c8296c0568dd5d8b.zip
kdepimpi-620f8de219ee34c209960f02c8296c0568dd5d8b.tar.gz
kdepimpi-620f8de219ee34c209960f02c8296c0568dd5d8b.tar.bz2
formatted name fixes
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--bin/kdepim/WhatsNew.txt5
-rw-r--r--kaddressbook/addresseeeditorwidget.cpp6
-rw-r--r--kaddressbook/extensionmanager.cpp7
-rw-r--r--kaddressbook/filter.cpp3
-rw-r--r--kaddressbook/kabcore.cpp81
-rw-r--r--kaddressbook/kabcore.h3
-rw-r--r--kaddressbook/kabprefs.cpp2
-rw-r--r--kaddressbook/kcmconfigs/addresseewidget.cpp11
-rw-r--r--kaddressbook/nameeditdialog.cpp8
9 files changed, 106 insertions, 20 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt
index ff87423..5be1d28 100644
--- a/bin/kdepim/WhatsNew.txt
+++ b/bin/kdepim/WhatsNew.txt
@@ -12,8 +12,13 @@ not only those listed in the contact list.
Made is possible to inline a picture in a vcard on the Z.
This was only possible on the desktop, now is it possible on the Z as well.
Fixed of missing save settings after filter configuration.
Made saving of addressbook much faster.
+Fixed extension widget layout problem.
+Fixed saving of default formatted name settings.
+Fixed formatted name handling in edit dialog.
+Added an option for changing formatted names of many contacts
+(menu: File - Change - Set formatted name).
QWhatsThis was not working on the Z ( only black rectangle was shown).
This is Fixed.
diff --git a/kaddressbook/addresseeeditorwidget.cpp b/kaddressbook/addresseeeditorwidget.cpp
index 3397e06..c6993e9 100644
--- a/kaddressbook/addresseeeditorwidget.cpp
+++ b/kaddressbook/addresseeeditorwidget.cpp
@@ -980,13 +980,13 @@ void AddresseeEditorWidget::load()
mNameEdit->setText( mAddressee.assembledName() );
if ( mAddressee.formattedName().isEmpty() ) {
//US KConfig config( "kaddressbookrc" );
- KConfig config( locateLocal("config", "kaddressbookrc") );
+ KConfig config( locateLocal("config", "kabcrc") );
config.setGroup( "General" );
mFormattedNameType = config.readNumEntry( "FormattedNameType", 1 );
mAddressee.setFormattedName( NameEditDialog::formattedName( mAddressee, mFormattedNameType ) );
- } else {
+ } else {;
if ( mAddressee.formattedName() == NameEditDialog::formattedName( mAddressee, NameEditDialog::SimpleName ) )
mFormattedNameType = NameEditDialog::SimpleName;
else if ( mAddressee.formattedName() == NameEditDialog::formattedName( mAddressee, NameEditDialog::FullName ) )
mFormattedNameType = NameEditDialog::FullName;
@@ -1184,8 +1184,10 @@ bool AddresseeEditorWidget::dirty()
}
void AddresseeEditorWidget::nameTextChanged( const QString &text )
{
+ if ( mBlockSignals )
+ return;
// use the addressee class to parse the name for us
mAConfig->setUid( mAddressee.uid() );
if ( mAConfig->automaticNameParsing() ) {
if ( !mAddressee.formattedName().isEmpty() ) {
diff --git a/kaddressbook/extensionmanager.cpp b/kaddressbook/extensionmanager.cpp
index 98561dc..efbdf17 100644
--- a/kaddressbook/extensionmanager.cpp
+++ b/kaddressbook/extensionmanager.cpp
@@ -57,8 +57,9 @@ ExtensionManager::ExtensionManager( KABCore *core, QWidget *parent,
connect( mActionExtensions, SIGNAL( activated( int ) ),
SLOT( setActiveExtension( int ) ) );
mWidgetBox = new QWidget( viewport() );
+ new QHBoxLayout (mWidgetBox );
addChild( mWidgetBox );
setResizePolicy(AutoOneFit);
createExtensionWidgets();
hide();
@@ -157,9 +158,9 @@ void ExtensionManager::createExtensionWidgets()
QStringList extensionNames( i18n( "None" ) );
// add addressee editor as default
- QHBoxLayout *hbl = new QHBoxLayout (mWidgetBox );
+ QHBoxLayout *hbl = (QHBoxLayout *) mWidgetBox->layout();;
wdg = new AddresseeEditorWidget( mCore, true, mWidgetBox );
hbl->addWidget( wdg );
//wdg->hide();
@@ -179,16 +180,16 @@ void ExtensionManager::createExtensionWidgets()
continue;
KLibFactory *factory = KLibLoader::self()->factory( (*it)->library().latin1() );
if ( !factory ) {
- kdDebug(5720) << "ExtensionManager::loadExtensions(): Factory creation failed" << endl;
+ //kdDebug(5720) << "ExtensionManager::loadExtensions(): Factory creation failed" << endl;
continue;
}
ExtensionFactory *extensionFactory = static_cast<ExtensionFactory*>( factory );
if ( !extensionFactory ) {
- kdDebug(5720) << "ExtensionManager::loadExtensions(): Cast failed" << endl;
+ //kdDebug(5720) << "ExtensionManager::loadExtensions(): Cast failed" << endl;
continue;
}
if ( !activeExtensions.contains( extensionFactory->identifier() ) )
diff --git a/kaddressbook/filter.cpp b/kaddressbook/filter.cpp
index b0d04ca..39d2ae4 100644
--- a/kaddressbook/filter.cpp
+++ b/kaddressbook/filter.cpp
@@ -179,8 +179,9 @@ Filter::List Filter::restore( KConfig *config, QString baseGroup )
list.append( f );
}
+ if ( list.isEmpty()) {
QStringList cats = KABPrefs::instance()->mCustomCategories;
for ( QStringList::Iterator it = cats.begin(); it != cats.end(); ++it ) {
Filter filter;
filter.mName = *it;
@@ -189,9 +190,9 @@ Filter::List Filter::restore( KConfig *config, QString baseGroup )
filter.mMatchRule = Matching;
filter.mInternal = true;
list.append( filter );
}
-
+ }
return list;
}
void Filter::setMatchRule( MatchRule rule )
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index e14e579..c6288fa 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -150,8 +150,9 @@ $Id$
#include "incsearchwidget.h"
#include "jumpbuttonbar.h"
#include "extensionmanager.h"
#include "addresseeconfig.h"
+#include "nameeditdialog.h"
#include <kcmultidialog.h>
#ifdef _WIN32_
@@ -195,8 +196,43 @@ class KABCatPrefs : public QDialog
private:
QRadioButton* addCatBut;
};
+class KABFormatPrefs : public QDialog
+{
+ public:
+ KABFormatPrefs( QWidget *parent=0, const char *name=0 ) :
+ QDialog( parent, name, true )
+ {
+ setCaption( i18n("Set formatted name") );
+ QVBoxLayout* lay = new QVBoxLayout( this );
+ lay->setSpacing( 3 );
+ lay->setMargin( 3 );
+ QLabel * lab = new QLabel( i18n("You can set the formatted name\nfor a list of contacts in one go."), this );
+ lay->addWidget( lab );
+ QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("Set formatted name to:"), this );
+ lay->addWidget( format );
+ format->setExclusive ( true ) ;
+ simple = new QRadioButton(i18n("Simple: James Bond"), format );
+ full = new QRadioButton(i18n("Full: Mr. James 007 Bond I"), format );
+ reverse = new QRadioButton(i18n("Reverse: Bond, James"), format );
+ company = new QRadioButton(i18n("Organization: MI6"), format );
+ simple->setChecked( true );
+ setCompany = new QCheckBox(i18n("Set formatted name to\norganization, if name empty"), this);
+ lay->addWidget( setCompany );
+ QPushButton * ok = new QPushButton( i18n("Select contact list"), this );
+ lay->addWidget( ok );
+ QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
+ lay->addWidget( cancel );
+ connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
+ connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
+ resize( 200, 200 );
+ }
+public:
+ QRadioButton* simple, *full, *reverse, *company;
+ QCheckBox* setCompany;
+};
+
class KAex2phonePrefs : public QDialog
{
@@ -1147,8 +1183,13 @@ bool KABCore::modified() const
}
void KABCore::contactModified( const KABC::Addressee &addr )
{
+ addrModified( addr );
+}
+
+void KABCore::addrModified( const KABC::Addressee &addr ,bool updateDetails )
+{
Command *command = 0;
QString uid;
@@ -1162,8 +1203,9 @@ void KABCore::contactModified( const KABC::Addressee &addr )
}
UndoStack::instance()->push( command );
RedoStack::instance()->clear();
+ if ( updateDetails )
mDetails->setAddressee( addr );
setModified( true );
}
@@ -1995,8 +2037,11 @@ void KABCore::initActions()
mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this,
SLOT( removeVoice() ), actionCollection(),
"remove_voice" );
+ mActionSetFormattedName = new KAction( i18n( "Set formatted name..." ), 0, this,
+ SLOT( setFormattedName() ), actionCollection(),
+ "set_formatted" );
mActionManageCategories= new KAction( i18n( "Manage new categories..." ), 0, this,
SLOT( manageCategories() ), actionCollection(),
"remove_voice" );
@@ -2135,8 +2180,9 @@ void KABCore::addActionsManually()
mActionDelete->plug( editMenu );
editMenu->insertSeparator();
mActionSelectAll->plug( editMenu );
+ mActionSetFormattedName->plug( changeMenu );
mActionRemoveVoice->plug( changeMenu );
// settings menu
//US special menuentry to configure the addressbook resources. On KDE
// you do that through the control center !!!
@@ -2301,13 +2347,44 @@ void KABCore::removeVoice()
return;
KABC::Addressee::List::Iterator it;
for ( it = list.begin(); it != list.end(); ++it ) {
if ( (*it).removeVoice() )
- contactModified((*it) );
+ addrModified((*it), false );
}
}
-
+void KABCore::setFormattedName()
+{
+ KABFormatPrefs setpref;
+ if ( !setpref.exec() ) {
+ return;
+ }
+ KABC::Addressee::List list;
+ XXPortSelectDialog dlg( this, false, this );
+ if ( dlg.exec() )
+ list = dlg.contacts();
+ else
+ 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 =="," )
+ fName = (*it).organization();
+ (*it).setFormattedName( fName );
+ addrModified((*it),false );
+ }
+ Addressee add;
+ mDetails->setAddressee( add );
+}
void KABCore::clipboardDataChanged()
{
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index 85ffbdb..0d5891e 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -277,8 +277,9 @@ class KABCore : public QWidget, public KSyncInterface
Called whenever an contact is modified in the contact editor
dialog or the quick edit.
*/
void contactModified( const KABC::Addressee &addr );
+ void addrModified( const KABC::Addressee &addr, bool updateDetails = true );
/**
DCOP METHODS.
*/
@@ -372,8 +373,9 @@ class KABCore : public QWidget, public KSyncInterface
void clipboardDataChanged();
void updateActionMenu();
void configureKeyBindings();
void removeVoice();
+ void setFormattedName();
#ifdef KAB_EMBEDDED
void configureResources();
#endif //KAB_EMBEDDED
@@ -476,8 +478,9 @@ class KABCore : public QWidget, public KSyncInterface
QPopupMenu *ImportMenu;
QPopupMenu *ExportMenu;
//LR additional methods
KAction *mActionRemoveVoice;
+ KAction *mActionSetFormattedName;
KAction * mActionImportOL;
#ifndef KAB_EMBEDDED
KAddressBookService *mAddressBookService;
diff --git a/kaddressbook/kabprefs.cpp b/kaddressbook/kabprefs.cpp
index db123da..a2095d4 100644
--- a/kaddressbook/kabprefs.cpp
+++ b/kaddressbook/kabprefs.cpp
@@ -59,9 +59,9 @@ KABPrefs::KABPrefs()
#ifdef KAB_EMBEDDED
addItemBool("AskForQuit",&mAskForQuit,true);
addItemBool("ToolBarHor",&mToolBarHor, true );
addItemBool("ToolBarUp",&mToolBarUp, false );
- addItemBool("SearchWithReturn",&mSearchWithReturn, true );
+ addItemBool("SearchWithReturn",&mSearchWithReturn, false );
addItemFont("DetailsFont",&mDetailsFont);
#endif //KAB_EMBEDDED
diff --git a/kaddressbook/kcmconfigs/addresseewidget.cpp b/kaddressbook/kcmconfigs/addresseewidget.cpp
index eb5bdd9..168d39e 100644
--- a/kaddressbook/kcmconfigs/addresseewidget.cpp
+++ b/kaddressbook/kcmconfigs/addresseewidget.cpp
@@ -217,26 +217,21 @@ void AddresseeWidget::restoreSettings()
mPrefix->setNameParts( config.readListEntry( "Prefixes" ) );
mInclusion->setNameParts( config.readListEntry( "Inclusions" ) );
mSuffix->setNameParts( config.readListEntry( "Suffixes" ) );
-
- KConfig cfg( locateLocal("config","kaddressbookrc") );
- cfg.setGroup( "General" );
- mFormattedNameCombo->setCurrentItem( cfg.readNumEntry( "FormattedNameType", 1 ) );
+ mFormattedNameCombo->setCurrentItem( config.readNumEntry( "FormattedNameType", 1 ) );
}
void AddresseeWidget::saveSettings()
{
+ qDebug("AddresseeWidget::saveSettings() ");
KConfig config( locateLocal("config","kabcrc") );
config.setGroup( "General" );
config.writeEntry( "Prefixes", mPrefix->nameParts() );
config.writeEntry( "Inclusions", mInclusion->nameParts() );
config.writeEntry( "Suffixes", mSuffix->nameParts() );
-
- KConfig cfg( locateLocal("config","kaddressbookrc") );
- cfg.setGroup( "General" );
- cfg.writeEntry( "FormattedNameType", mFormattedNameCombo->currentItem() );
+ config.writeEntry( "FormattedNameType", mFormattedNameCombo->currentItem() );
}
#ifndef KAB_EMBEDDED
#include "addresseewidget.moc"
diff --git a/kaddressbook/nameeditdialog.cpp b/kaddressbook/nameeditdialog.cpp
index 8213c2b..f5dba0f 100644
--- a/kaddressbook/nameeditdialog.cpp
+++ b/kaddressbook/nameeditdialog.cpp
@@ -224,24 +224,26 @@ bool NameEditDialog::changed() const
}
QString NameEditDialog::formattedName( const KABC::Addressee &addr, int type )
{
+ QString retval;
switch ( type ) {
case SimpleName:
- return addr.givenName() + " " + addr.familyName();
+ retval = addr.givenName() + " " + addr.familyName();
break;
case FullName:
- return addr.prefix() + " " + addr.givenName() + " " +
+ retval =addr.prefix() + " " + addr.givenName() + " " +
addr.additionalName() + " " + addr.familyName() + " " +
addr.suffix();
break;
case ReverseName:
- return addr.familyName() + ", " + addr.givenName();
+ retval = addr.familyName() + ", " + addr.givenName();
break;
default:
return "";
break;
}
+ return retval.stripWhiteSpace ();
}
void NameEditDialog::parseBoxChanged( bool value )
{