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