Commit 22d1bab9 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

not necessary to use a list here

parent 3e34c9f0
......@@ -197,8 +197,7 @@ using KPIM::ProgressManager;
using MessageViewer::AttachmentStrategy;
using PimCommon::BroadcastStatus;
Q_GLOBAL_STATIC(KMMainWidget::PtrList, theMainWidgetList)
static KMMainWidget *myMainWidget = nullptr;
//-----------------------------------------------------------------------------
KMMainWidget::KMMainWidget(QWidget *parent, KXMLGUIClient *aGUIClient, KActionCollection *actionCollection, const KSharedConfig::Ptr &config)
: QWidget(parent)
......@@ -243,7 +242,7 @@ KMMainWidget::KMMainWidget(QWidget *parent, KXMLGUIClient *aGUIClient, KActionCo
mPluginCheckBeforeDeletingManagerInterface->setActionCollection(mActionCollection);
mPluginCheckBeforeDeletingManagerInterface->initializePlugins();
theMainWidgetList->append(this);
myMainWidget = this;
readPreConfig();
createWidgets();
......@@ -375,7 +374,7 @@ void KMMainWidget::restoreCollectionFolderViewConfig()
// perform all cleanup that requires the kernel in destruct()
KMMainWidget::~KMMainWidget()
{
theMainWidgetList->removeAll(this);
myMainWidget = nullptr;
qDeleteAll(mFilterCommands);
destruct();
}
......@@ -4232,13 +4231,13 @@ void KMMainWidget::updateFileMenu()
}
//-----------------------------------------------------------------------------
const KMMainWidget::PtrList *KMMainWidget::mainWidgetList()
const KMMainWidget *KMMainWidget::mainWidgetList()
{
// better safe than sorry; check whether the global static has already been destroyed
if (theMainWidgetList.isDestroyed()) {
if (!myMainWidget) {
return nullptr;
}
return theMainWidgetList;
return myMainWidget;
}
QSharedPointer<FolderSettings> KMMainWidget::currentFolder() const
......
......@@ -96,8 +96,6 @@ class KMAIL_EXPORT KMMainWidget : public QWidget
Q_OBJECT
public:
using PtrList = QList<KMMainWidget *>;
KMMainWidget(QWidget *parent,
KXMLGUIClient *aGUIClient,
KActionCollection *actionCollection,
......@@ -141,7 +139,7 @@ public:
Returns a list of all KMMainWidgets. Warning, the list itself can be 0.
@return the list of all main widgets, or 0 if it is not yet initialized
*/
static const PtrList *mainWidgetList();
static const KMMainWidget *mainWidgetList();
QWidget *vacationScriptIndicator() const;
QWidget *dkimWidgetInfo() const;
......
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