From 03bc09ce5a259640f684b6e27dbce44ee3a21bb6 Mon Sep 17 00:00:00 2001 From: Espen Sand Date: Sun, 19 Mar 2000 18:50:14 +0000 Subject: [PATCH] A few fixes. Saving current identity to list before the "new identity" dialog box is opened. svn path=/trunk/kdenetwork/kmail/; revision=44045 --- configuredialog.cpp | 42 +++++++++++++++++++++++++++++++----------- configuredialog.h | 3 ++- 2 files changed, 33 insertions(+), 12 deletions(-) diff --git a/configuredialog.cpp b/configuredialog.cpp index e06462a8e..7e8649e3b 100644 --- a/configuredialog.cpp +++ b/configuredialog.cpp @@ -1630,16 +1630,10 @@ void ConfigureDialog::setupMiscPage( void ) } -void ConfigureDialog::setIdentityInformation( const QString &identityName ) -{ - if( mIdentity.mActiveIdentity == identityName ) - { - return; - } - // - // 1. Save current settings to the list - // + +void ConfigureDialog::saveActiveIdentity( void ) +{ IdentityEntry *entry = mIdentityList.get(mIdentity.mActiveIdentity); if( entry != 0 ) { @@ -1653,14 +1647,28 @@ void ConfigureDialog::setIdentityInformation( const QString &identityName ) mIdentity.signatureFileRadio->isChecked() ); entry->setUseSignatureFile( mIdentity.signatureFileRadio->isChecked() ); } +} + + +void ConfigureDialog::setIdentityInformation( const QString &identity ) +{ + if( mIdentity.mActiveIdentity == identity ) + { + return; + } - mIdentity.mActiveIdentity = identityName; + // + // 1. Save current settings to the list + // + saveActiveIdentity(); + + mIdentity.mActiveIdentity = identity; // // 2. Display the new settings // bool useSignatureFile; - entry = mIdentityList.get(identityName); + IdentityEntry *entry = mIdentityList.get( mIdentity.mActiveIdentity ); if( entry == 0 ) { mIdentity.nameEdit->setText(""); @@ -1697,8 +1705,19 @@ void ConfigureDialog::setIdentityInformation( const QString &identityName ) } + + void ConfigureDialog::slotNewIdentity( void ) { + // + // First. Save current setting to the list. In the dialog box we + // can choose to copy from the list so it must be synced. + // + saveActiveIdentity(); + + // + // Make and open the dialog + // NewIdentityDialog *dialog = new NewIdentityDialog( this, "new", true ); QStringList list; @@ -1723,6 +1742,7 @@ void ConfigureDialog::slotNewIdentity( void ) mIdentity.identityCombo->clear(); mIdentity.identityCombo->insertStringList(list); mIdentity.identityCombo->setCurrentItem( list.findIndex(identityText) ); + mIdentityList.add( identityText, dialog->duplicateText() ); slotIdentitySelectorChanged(); } diff --git a/configuredialog.h b/configuredialog.h index f0149c8b5..0231d6812 100644 --- a/configuredialog.h +++ b/configuredialog.h @@ -274,7 +274,8 @@ class ConfigureDialog : public KDialogBase void setupMimePage( void ); void setupSecurityPage( void ); void setupMiscPage( void ); - + + void saveActiveIdentity( void ); void setIdentityInformation( const QString &identityName ); private slots: