From c022a2942de9701a0cb40f8a3e667f391850ea4a Mon Sep 17 00:00:00 2001 From: Carsten Burghardt Date: Tue, 13 Dec 2005 16:16:25 +0000 Subject: [PATCH] Fix UI bug as reported by Casey Allen Shobe: when you click OK on the dialog that tells you that subscriptions are not enabled but then do not save the subscription dialog nothing is changed. Therefore show the dialog only when something actually changed and subscriptions are needed. CCMAIL: cshobe@seattleserver.com svn path=/branches/KDE/3.5/kdepim/; revision=488215 --- subscriptiondialog.cpp | 50 ++++++++++++++++++------------------------ 1 file changed, 21 insertions(+), 29 deletions(-) diff --git a/subscriptiondialog.cpp b/subscriptiondialog.cpp index 358e64c28..3c31a7900 100644 --- a/subscriptiondialog.cpp +++ b/subscriptiondialog.cpp @@ -241,11 +241,28 @@ void SubscriptionDialog::findParentItem( QString &name, QString &path, QString & //------------------------------------------------------------------------------ void SubscriptionDialog::slotSave() { + KMail::ImapAccountBase *account = static_cast(mAcct); + if( !account->onlySubscribedFolders() ) { + int result = KMessageBox::questionYesNoCancel( this, + i18n("Currently subscriptions are not used for server %1\ndo you want to enable subscriptions?") + .arg( account->name() ), + i18n("Enable Subscriptions?"), i18n("Enable"), i18n("Do Not Enable")); + switch(result) { + case KMessageBox::Yes: + mForceSubscriptionEnable = true; + break; + case KMessageBox::No: + break; + case KMessageBox::Cancel: + cancel(); + } + } + // subscribe QListViewItemIterator it(subView); for ( ; it.current(); ++it) { - static_cast(account())->changeSubscription(true, + account->changeSubscription(true, static_cast(it.current())->info().path); } @@ -253,16 +270,12 @@ void SubscriptionDialog::slotSave() QListViewItemIterator it2(unsubView); for ( ; it2.current(); ++it2) { - static_cast(account())->changeSubscription(false, + account->changeSubscription(false, static_cast(it2.current())->info().path); } - if( mForceSubscriptionEnable ) { - KMail::ImapAccountBase *account = static_cast(mAcct); - if( account ) - { - account->setOnlySubscribedFolders(true); - } + if ( mForceSubscriptionEnable ) { + account->setOnlySubscribedFolders(true); } } @@ -368,27 +381,6 @@ void SubscriptionDialog::slotConnectionResult( int errorCode, const QString& err void SubscriptionDialog::show() { KDialogBase::show(); - KMail::ImapAccountBase *account = static_cast(mAcct); - if( account ) - { - if( !account->onlySubscribedFolders() ) - { - kdDebug() << "Not subscribed!!!" << endl; - int result = KMessageBox::questionYesNoCancel( this, - i18n("Currently subscriptions are not used for server %1\ndo you want to enable subscriptions?") - .arg( account->name() ), - i18n("Enable Subscriptions?"), i18n("Enable"), i18n("Do Not Enable")); - switch(result) { - case KMessageBox::Yes: - mForceSubscriptionEnable = true; - break; - case KMessageBox::No: - break; - case KMessageBox::Cancel: - cancel(); - } - } - } } } // namespace