summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore 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.cpp21
-rw-r--r--kaddressbook/kabcore.cpp87
-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, 118 insertions, 32 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
@@ -4,24 +4,29 @@ Info about the changes in new versions of KDE-Pim/Pi
KO/Pi:
Fixed that tooltips were not updated after moving an item in agenda view.
Fixed a bug in sorting start date for recurring events in list view.
KA/Pi:
All fields search does now actually search all the (possible) fields,
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.
KDE-Sync:
Now readonly KDE resources are synced as well.
(They are not changed in KDE itself, of course).
********** VERSION 1.9.16 ************
diff --git a/kaddressbook/addresseeeditorwidget.cpp b/kaddressbook/addresseeeditorwidget.cpp
index 3397e06..c6993e9 100644
--- a/kaddressbook/addresseeeditorwidget.cpp
+++ b/kaddressbook/addresseeeditorwidget.cpp
@@ -972,29 +972,29 @@ void AddresseeEditorWidget::load()
{
// Block signals in case anything tries to emit modified
// CS: This doesn't seem to work.
bool block = signalsBlocked();
blockSignals( true );
mBlockSignals = true; // used for internal signal blocking
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;
else if ( mAddressee.formattedName() == NameEditDialog::formattedName( mAddressee, NameEditDialog::ReverseName ) )
mFormattedNameType = NameEditDialog::ReverseName;
else
mFormattedNameType = NameEditDialog::CustomName;
}
mFormattedNameLabel->setText( mAddressee.formattedName() );
@@ -1176,24 +1176,26 @@ bool AddresseeEditorWidget::dirty()
"%Y-%m-%d"))
mDirty = true;
}
else {
mAnniversaryPicker->clear();
}
}
return mDirty;
}
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() ) {
QString fn = mAddressee.formattedName();
mAddressee.setNameFromString( text );
mAddressee.setFormattedName( fn );
} else {
// use extra addressee to avoid a formatted name assignment
Addressee addr;
addr.setNameFromString( text );
mAddressee.setPrefix( addr.prefix() );
diff --git a/kaddressbook/extensionmanager.cpp b/kaddressbook/extensionmanager.cpp
index 98561dc..efbdf17 100644
--- a/kaddressbook/extensionmanager.cpp
+++ b/kaddressbook/extensionmanager.cpp
@@ -49,24 +49,25 @@ ExtensionManager::ExtensionManager( KABCore *core, QWidget *parent,
QWidget *settingsmenu = (QWidget*)mCore->getSettingsMenu();
#endif //KAB_EMBEDDED
mActionExtensions = new KSelectAction( i18n( "Show Extension Bar" ), 0,
mCore->actionCollection(),
"options_show_extensions" );
mActionExtensions->plug( settingsmenu );
connect( mActionExtensions, SIGNAL( activated( int ) ),
SLOT( setActiveExtension( int ) ) );
mWidgetBox = new QWidget( viewport() );
+ new QHBoxLayout (mWidgetBox );
addChild( mWidgetBox );
setResizePolicy(AutoOneFit);
createExtensionWidgets();
hide();
}
ExtensionManager::~ExtensionManager()
{
}
void ExtensionManager::restoreSettings()
{
@@ -149,54 +150,54 @@ void ExtensionManager::createExtensionWidgets()
mExtensionWidgetList.setAutoDelete( true );
QPtrListIterator<ExtensionWidget> wdgIt( mExtensionWidgetList );
ExtensionWidget *wdg = 0;
while ( ( wdg = wdgIt.current() ) != 0 )
mExtensionWidgetList.remove( wdg );
mExtensionWidgetList.setAutoDelete( false );
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();
connect( wdg, SIGNAL( modified( const KABC::Addressee::List& ) ),
SIGNAL( modified( const KABC::Addressee::List& ) ) );
mExtensionWidgetList.append( wdg );
extensionNames.append( wdg->title() );
// load the other extensions
QStringList activeExtensions = KABPrefs::instance()->mActiveExtensions;
#ifndef KAB_EMBEDDED
KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/Extension" );
KTrader::OfferList::ConstIterator it;
for ( it = plugins.begin(); it != plugins.end(); ++it ) {
if ( !(*it)->hasServiceType( "KAddressBook/Extension" ) )
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() ) )
continue;
wdg = extensionFactory->extension( mCore, this );
if ( wdg ) {
//wdg->hide();
connect( wdg, SIGNAL( modified( const KABC::Addressee::List& ) ),
SIGNAL( modified( const KABC::Addressee::List& ) ) );
mExtensionWidgetList.append( wdg );
diff --git a/kaddressbook/filter.cpp b/kaddressbook/filter.cpp
index b0d04ca..39d2ae4 100644
--- a/kaddressbook/filter.cpp
+++ b/kaddressbook/filter.cpp
@@ -171,35 +171,36 @@ Filter::List Filter::restore( KConfig *config, QString baseGroup )
count = config->readNumEntry( "Count", 0 );
}
for ( int i = 0; i < count; i++ ) {
{
KConfigGroupSaver s( config, QString( "%1_%2" ).arg( baseGroup ).arg( i ) );
f.restore( config );
}
list.append( f );
}
- QStringList cats = KABPrefs::instance()->mCustomCategories;
- for ( QStringList::Iterator it = cats.begin(); it != cats.end(); ++it ) {
- Filter filter;
- filter.mName = *it;
- filter.mEnabled = true;
- filter.mCategoryList = *it;
- filter.mMatchRule = Matching;
- filter.mInternal = true;
- list.append( filter );
+ if ( list.isEmpty()) {
+ QStringList cats = KABPrefs::instance()->mCustomCategories;
+ for ( QStringList::Iterator it = cats.begin(); it != cats.end(); ++it ) {
+ Filter filter;
+ filter.mName = *it;
+ filter.mEnabled = true;
+ filter.mCategoryList = *it;
+ filter.mMatchRule = Matching;
+ filter.mInternal = true;
+ list.append( filter );
+ }
}
-
return list;
}
void Filter::setMatchRule( MatchRule rule )
{
mMatchRule = rule;
}
Filter::MatchRule Filter::matchRule() const
{
return mMatchRule;
}
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index e14e579..c6288fa 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -142,24 +142,25 @@ $Id$
#include "addresseeutil.h"
#include "undocmds.h"
#include "addresseeeditordialog.h"
#include "viewmanager.h"
#include "details/detailsviewcontainer.h"
#include "kabprefs.h"
#include "xxportmanager.h"
#include "incsearchwidget.h"
#include "jumpbuttonbar.h"
#include "extensionmanager.h"
#include "addresseeconfig.h"
+#include "nameeditdialog.h"
#include <kcmultidialog.h>
#ifdef _WIN32_
#include "kaimportoldialog.h"
#else
#include <unistd.h>
#endif
// sync includes
#include <libkdepim/ksyncprofile.h>
#include <libkdepim/ksyncprefsdialog.h>
@@ -187,24 +188,59 @@ class KABCatPrefs : public QDialog
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 );
}
bool addCat() { return addCatBut->isChecked(); }
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
{
public:
KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) :
QDialog( parent, name, true )
{
setCaption( i18n("Export to phone options") );
QVBoxLayout* lay = new QVBoxLayout( this );
lay->setSpacing( 3 );
lay->setMargin( 3 );
@@ -1137,42 +1173,48 @@ void KABCore::setModified( bool modified )
if ( modified )
mJumpButtonBar->recreateButtons();
mViewManager->refreshView();
}
bool KABCore::modified() const
{
return mModified;
}
-void KABCore::contactModified( const KABC::Addressee &addr )
+void KABCore::contactModified( const KABC::Addressee &addr )
+{
+ addrModified( addr );
+}
+
+void KABCore::addrModified( const KABC::Addressee &addr ,bool updateDetails )
{
Command *command = 0;
QString uid;
// check if it exists already
KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() );
if ( origAddr.isEmpty() )
command = new PwNewCommand( mAddressBook, addr );
else {
command = new PwEditCommand( mAddressBook, origAddr, addr );
uid = addr.uid();
}
UndoStack::instance()->push( command );
RedoStack::instance()->clear();
- mDetails->setAddressee( addr );
+ if ( updateDetails )
+ mDetails->setAddressee( addr );
setModified( true );
}
void KABCore::newContact()
{
QPtrList<KABC::Resource> kabcResources = mAddressBook->resources();
QPtrList<KRES::Resource> kresResources;
QPtrListIterator<KABC::Resource> it( kabcResources );
KABC::Resource *resource;
@@ -1532,25 +1574,25 @@ QString KABCore::getNameByPhone( const QString &phone )
}
void KABCore::openConfigDialog()
{
KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true );
KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" );
ConfigureDialog->addModule(kabcfg );
KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" );
ConfigureDialog->addModule(kdelibcfg );
connect( ConfigureDialog, SIGNAL( applyClicked() ),
- this, SLOT( configurationChanged() ) );
+ this, SLOT( configurationChanged() ) );
connect( ConfigureDialog, SIGNAL( okClicked() ),
this, SLOT( configurationChanged() ) );
saveSettings();
#ifndef DESKTOP_VERSION
ConfigureDialog->showMaximized();
#endif
if ( ConfigureDialog->exec() )
KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") );
delete ConfigureDialog;
}
void KABCore::openLDAPDialog()
@@ -1987,24 +2029,27 @@ void KABCore::initActions()
mActionCategories = new KAction( i18n( "Set Categories" ), 0, this,
SLOT( setCategories() ), actionCollection(),
"edit_set_categories" );
mActionEditCategories = new KAction( i18n( "Edit Categories" ), 0, this,
SLOT( editCategories() ), actionCollection(),
"edit__categories" );
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" );
mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this,
SLOT( importFromOL() ), actionCollection(),
"import_OL" );
#ifdef KAB_EMBEDDED
mActionLicence = new KAction( i18n( "Licence" ), 0,
this, SLOT( showLicence() ), actionCollection(),
@@ -2127,24 +2172,25 @@ void KABCore::addActionsManually()
#endif
// edit menu
mActionUndo->plug( editMenu );
mActionRedo->plug( editMenu );
editMenu->insertSeparator();
mActionCut->plug( editMenu );
mActionCopy->plug( editMenu );
mActionPaste->plug( editMenu );
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 !!!
mActionConfigResources->plug( settingsMenu );
settingsMenu->insertSeparator();
mActionConfigKAddressbook->plug( settingsMenu );
if ( mIsPart ) {
//US not implemented yet
//mActionConfigShortcuts->plug( settingsMenu );
@@ -2293,29 +2339,60 @@ void KABCore::removeVoice()
{
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 )
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 ) {
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()
{
if ( mReadWrite )
mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() );
}
void KABCore::updateActionMenu()
{
UndoStack *undo = UndoStack::instance();
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index 85ffbdb..0d5891e 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -269,24 +269,25 @@ class KABCore : public QWidget, public KSyncInterface
void setModified( bool modified );
/**
Returns whether the address book is modified.
*/
bool modified() const;
/**
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.
*/
void addEmail( QString addr );
void importVCard( const KURL& url, bool showPreview );
void importVCard( const QString& vCard, bool showPreview );
void newContact();
QString getNameByPhone( const QString& phone );
/**
END DCOP METHODS
*/
@@ -364,24 +365,25 @@ class KABCore : public QWidget, public KSyncInterface
void receive( const QCString& cmsg, const QByteArray& data );
void toggleBeamReceive( );
void disableBR(bool);
void setJumpButtonBarVisible( bool visible );
void setCaptionBack();
void importFromOL();
void extensionModified( const KABC::Addressee::List &list );
void extensionChanged( int id );
void clipboardDataChanged();
void updateActionMenu();
void configureKeyBindings();
void removeVoice();
+ void setFormattedName();
#ifdef KAB_EMBEDDED
void configureResources();
#endif //KAB_EMBEDDED
void slotEditorDestroyed( const QString &uid );
void configurationChanged();
void addressBookChanged();
private:
void resizeEvent(QResizeEvent* e );
bool mBRdisabled;
#ifndef DESKTOP_VERSION
@@ -468,24 +470,25 @@ class KABCore : public QWidget, public KSyncInterface
KAction *mActionDeleteView;
QPopupMenu *viewMenu;
QPopupMenu *filterMenu;
QPopupMenu *settingsMenu;
QPopupMenu *changeMenu;
QPopupMenu *beamMenu;
//US QAction *mActionSave;
QPopupMenu *ImportMenu;
QPopupMenu *ExportMenu;
//LR additional methods
KAction *mActionRemoveVoice;
+ KAction *mActionSetFormattedName;
KAction * mActionImportOL;
#ifndef KAB_EMBEDDED
KAddressBookService *mAddressBookService;
#endif //KAB_EMBEDDED
class KABCorePrivate;
KABCorePrivate *d;
//US bool mBlockSaveFlag;
#ifdef KAB_EMBEDDED
KAddressBookMain *mMainWindow; // should be the same like mGUIClient
diff --git a/kaddressbook/kabprefs.cpp b/kaddressbook/kabprefs.cpp
index db123da..a2095d4 100644
--- a/kaddressbook/kabprefs.cpp
+++ b/kaddressbook/kabprefs.cpp
@@ -51,25 +51,25 @@ KABPrefs::KABPrefs()
mDetailsFont = QFont("helvetica",12);
KPrefs::setCurrentGroup( "Views" );
addItemBool( "HonorSingleClick", &mHonorSingleClick, false );
KPrefs::setCurrentGroup( "General" );
addItemBool( "AutomaticNameParsing", &mAutomaticNameParsing, true );
addItemInt( "CurrentIncSearchField", &mCurrentIncSearchField, 0 );
#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
KPrefs::setCurrentGroup( "MainWindow" );
bool m_visible = false;
#ifdef DESKTOP_VERSION
m_visible = true;
#endif
addItemBool( "FullMenuBarVisible", &mFullMenuBarVisible, m_visible );
addItemBool( "JumpButtonBarVisible", &mJumpButtonBarVisible, false );
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
@@ -209,35 +209,30 @@ AddresseeWidget::AddresseeWidget( QWidget *parent, const char *name )
AddresseeWidget::~AddresseeWidget()
{
}
void AddresseeWidget::restoreSettings()
{
KConfig config( locateLocal("config", "kabcrc") );
config.setGroup( "General" );
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"
#endif //KAB_EMBEDDED
diff --git a/kaddressbook/nameeditdialog.cpp b/kaddressbook/nameeditdialog.cpp
index 8213c2b..f5dba0f 100644
--- a/kaddressbook/nameeditdialog.cpp
+++ b/kaddressbook/nameeditdialog.cpp
@@ -216,40 +216,42 @@ QString NameEditDialog::customFormattedName() const
int NameEditDialog::formattedNameType() const
{
return mFormattedNameCombo->currentItem();
}
bool NameEditDialog::changed() const
{
return mChanged;
}
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 )
{
//AddresseeConfig::instance()->setUid( addr.uid() );
AddresseeConfig::instance()->setAutomaticNameParsing( value );
}
void NameEditDialog::typeChanged( int pos )
{
mFormattedNameEdit->setEnabled( pos == 0 );
}