diff --git a/subscriptiondialog.cpp b/subscriptiondialog.cpp index 8afa823e9..171c279fe 100644 --- a/subscriptiondialog.cpp +++ b/subscriptiondialog.cpp @@ -37,9 +37,11 @@ #include "kmmessage.h" #include "folderstorage.h" #include "listjob.h" +#include "imapaccountbase.h" #include #include +#include namespace KMail { @@ -47,7 +49,7 @@ namespace KMail { SubscriptionDialog::SubscriptionDialog( QWidget *parent, const QString &caption, KAccount *acct, QString startPath ) : KSubscription( parent, caption, acct, User1, QString::null, false ), - mStartPath( startPath ), mSubscribed( false ) + mStartPath( startPath ), mSubscribed( false ), mForceSubscriptionEnable( false) { // hide unneeded checkboxes hideTreeCheckbox(); @@ -255,6 +257,14 @@ void SubscriptionDialog::slotSave() static_cast(account())->changeSubscription(false, static_cast(it2.current())->info().path); } + + if( mForceSubscriptionEnable ) { + KMail::ImapAccountBase *account = static_cast(mAcct); + if( account ) + { + account->setOnlySubscribedFolders(true); + } + } } //------------------------------------------------------------------------------ @@ -356,6 +366,32 @@ void SubscriptionDialog::slotConnectionResult( int errorCode, const QString& err slotLoadFolders(); } +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?")); + switch(result) { + case KMessageBox::Yes: + mForceSubscriptionEnable = true; + break; + case KMessageBox::No: + break; + case KMessageBox::Cancel: + cancel(); + } + } + } +} + } // namespace #include "subscriptiondialog.moc" diff --git a/subscriptiondialog.h b/subscriptiondialog.h index 1f3a80ac5..85704f762 100644 --- a/subscriptiondialog.h +++ b/subscriptiondialog.h @@ -49,6 +49,8 @@ namespace KMail { SubscriptionDialog( QWidget *parent, const QString &caption, KAccount* acct, QString startPath = QString::null ); + void show(); + protected: /** * Find the parent item @@ -102,7 +104,7 @@ namespace KMail { uint mCount; QDict mItemDict; QString mStartPath; - bool mSubscribed; + bool mSubscribed, mForceSubscriptionEnable; QStringList mPrefixList; QString mCurrentNamespace; };