Commit bd4d07e2 authored by Laurent Montel's avatar Laurent Montel 😁

Avoid to open 2 collection properties dialog for same collection.

Fix signal/slot
parent 1f8f804d
......@@ -3164,7 +3164,7 @@ void KMMainWidget::setupActions()
// slotExpireFolder() and FolderViewItem::slotShowExpiryProperties().
mExpireFolderAction = new KAction(i18n("&Expiration Settings"), this);
actionCollection()->addAction(QLatin1String("expire"), mExpireFolderAction );
connect(mExpireFolderAction, SIGNAL(triggered(bool)), mManageShowCollectionProperties, SLOT(slotExpireFolder()));
connect(mExpireFolderAction, SIGNAL(triggered(bool)), this, SLOT(slotExpireFolder()));
mAkonadiStandardActionManager->interceptAction( Akonadi::StandardMailActionManager::MoveToTrash );
......@@ -3486,7 +3486,7 @@ void KMMainWidget::setupActions()
{
mExpireConfigAction = new KAction( i18n( "Expire..." ), this );
actionCollection()->addAction( QLatin1String("expire_settings"),mExpireConfigAction );
connect( mExpireConfigAction, SIGNAL(triggered(bool)), this, SLOT(slotShowExpiryProperties()) );
connect( mExpireConfigAction, SIGNAL(triggered(bool)), mManageShowCollectionProperties, SLOT(slotShowExpiryProperties()) );
}
{
......
......@@ -70,9 +70,14 @@ void ManageShowCollectionProperties::showCollectionProperties( const QString &pa
{
if ( !mMainWidget->currentFolder() )
return;
if (mHashDialogBox.contains(mMainWidget->currentFolder()->collection().id())) {
if (mHashDialogBox.value(mMainWidget->currentFolder()->collection().id())) {
mHashDialogBox.value(mMainWidget->currentFolder()->collection().id())->activateWindow();
mHashDialogBox.value(mMainWidget->currentFolder()->collection().id())->raise();
return;
}
}
if ( Solid::Networking::status() == Solid::Networking::Unconnected ) {
KMessageBox::information(
mMainWidget,
i18n( "Network is unconnected. Folder information cannot be updated." ) );
......@@ -185,7 +190,7 @@ void ManageShowCollectionProperties::slotCollectionPropertiesFinished( KJob *job
<< QLatin1String( "KMail::CollectionShortcutPage" )
<< QLatin1String( "KMail::CollectionMaintenancePage" );
Akonadi::CollectionPropertiesDialog *dlg = new Akonadi::CollectionPropertiesDialog( collection, pages, mMainWidget );
QPointer<Akonadi::CollectionPropertiesDialog> dlg = new Akonadi::CollectionPropertiesDialog( collection, pages, mMainWidget );
dlg->setCaption( i18nc( "@title:window", "Properties of Folder %1", collection.name() ) );
......@@ -194,4 +199,5 @@ void ManageShowCollectionProperties::slotCollectionPropertiesFinished( KJob *job
dlg->setCurrentPage( pageToShow );
}
dlg->show();
mHashDialogBox.insert(collection.id(), dlg);
}
......@@ -23,6 +23,11 @@
#include <foldercollection.h>
#include <progresswidget/progressmanager.h>
namespace Akonadi {
class CollectionPropertiesDialog;
}
class KJob;
class KMMainWidget;
class ManageShowCollectionProperties : public QObject
......@@ -47,6 +52,7 @@ private:
void showCollectionPropertiesContinued(const QString &pageToShow, QPointer<KPIM::ProgressItem> progressItem);
private:
QHash<Akonadi::Collection::Id, QPointer<Akonadi::CollectionPropertiesDialog> > mHashDialogBox;
KMMainWidget *mMainWidget;
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment