Implement wish 67038: Managing subscriptions shows no result

On showing of this dialog the user is asked if this means he wants to use
subscriptions, after pressing 'yes' (and OK-ing this dialog) the
subscriptions are enabled for the account.

svn path=/trunk/KDE/kdepim/; revision=423007
wilder-work
Thomas Zander 21 years ago
parent 7a49f05c41
commit 42c1b47c49
  1. 38
      subscriptiondialog.cpp
  2. 4
      subscriptiondialog.h

@ -37,9 +37,11 @@
#include "kmmessage.h"
#include "folderstorage.h"
#include "listjob.h"
#include "imapaccountbase.h"
#include <klocale.h>
#include <kdebug.h>
#include <kmessagebox.h>
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<ImapAccountBase*>(account())->changeSubscription(false,
static_cast<GroupItem*>(it2.current())->info().path);
}
if( mForceSubscriptionEnable ) {
KMail::ImapAccountBase *account = static_cast<KMail::ImapAccountBase*>(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<KMail::ImapAccountBase*>(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"

@ -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<GroupItem> mItemDict;
QString mStartPath;
bool mSubscribed;
bool mSubscribed, mForceSubscriptionEnable;
QStringList mPrefixList;
QString mCurrentNamespace;
};

Loading…
Cancel
Save