diff --git a/configuredialog.cpp b/configuredialog.cpp index a5d60b825..9f68b0a2f 100644 --- a/configuredialog.cpp +++ b/configuredialog.cpp @@ -432,11 +432,17 @@ AccountsPageReceivingTab::AccountsPageReceivingTab( QWidget * parent ) mAccountsReceiving.mFilterAccount->setProxy( mAccountsReceiving.mAccountList->agentFilterProxyModel() ); mAccountsReceiving.mFilterAccount->lineEdit()->setTrapReturnKey( true ); + KConfig specialMailCollection(QLatin1String("specialmailcollectionsrc")); + if(specialMailCollection.hasGroup(QLatin1String("SpecialCollections"))) { + KConfigGroup grp = specialMailCollection.group(QLatin1String("SpecialCollections")); + mSpecialMailCollectionIdentifier = grp.readEntry(QLatin1String("DefaultResourceId")); + } + ConfigAgentDelegate *configDelegate = new ConfigAgentDelegate( mAccountsReceiving.mAccountList->view() ); mAccountsReceiving.mAccountList->view()->setItemDelegate( configDelegate ); connect( configDelegate, SIGNAL(optionsClicked(QString,QPoint)), this, SLOT(slotShowMailCheckMenu(QString,QPoint)) ); - connect( mAccountsReceiving.mAccountList, SIGNAL(currentChanged(Akonadi::AgentInstance,Akonadi::AgentInstance)), + connect( mAccountsReceiving.mAccountList, SIGNAL(clicked(Akonadi::AgentInstance)), SLOT(slotAccountSelected(Akonadi::AgentInstance)) ); connect( mAccountsReceiving.mAccountList, SIGNAL(doubleClicked(Akonadi::AgentInstance)), this, SLOT(slotModifySelectedAccount()) ); @@ -578,7 +584,7 @@ void AccountsPage::ReceivingTab::slotAccountSelected(const Akonadi::AgentInstanc mAccountsReceiving.mRestartAccountButton->setEnabled( false ); } else { mAccountsReceiving.mModifyAccountButton->setEnabled( !current.type().capabilities().contains( QLatin1String( "NoConfig" ) ) ); - mAccountsReceiving.mRemoveAccountButton->setEnabled( true ); + mAccountsReceiving.mRemoveAccountButton->setEnabled( mSpecialMailCollectionIdentifier != current.identifier() ); // Restarting an agent is not possible if it's in Running status... (see AgentProcessInstance::restartWhenIdle) mAccountsReceiving.mRestartAccountButton->setEnabled( ( current.status() != 1 ) ); } diff --git a/configuredialog_p.h b/configuredialog_p.h index 3d8993bd2..66849cef1 100644 --- a/configuredialog_p.h +++ b/configuredialog_p.h @@ -214,6 +214,7 @@ private: //FIXME virtual void doResetToDefaultsOther(); private: + QString mSpecialMailCollectionIdentifier; Ui_AccountsPageReceivingTab mAccountsReceiving; };