From 4ca765ed6582abf5392df2ca03a183cea03d68d4 Mon Sep 17 00:00:00 2001
From: hjk <qtc-committer@nokia.com>
Date: Tue, 10 Mar 2009 19:54:41 +0100
Subject: [PATCH] Fixes:    projectexplorer: use QAction::setData instead of a
 helper map RevBy:    ossi

---
 src/plugins/projectexplorer/projectexplorer.cpp | 11 +++++------
 src/plugins/projectexplorer/projectexplorer.h   |  2 --
 2 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp
index 3d7011fefdb..a0f4016d33f 100644
--- a/src/plugins/projectexplorer/projectexplorer.cpp
+++ b/src/plugins/projectexplorer/projectexplorer.cpp
@@ -77,7 +77,6 @@
 #include <coreplugin/iversioncontrol.h>
 #include <coreplugin/vcsmanager.h>
 #include <extensionsystem/pluginmanager.h>
-#include <utils/listutils.h>
 #include <utils/qtcassert.h>
 
 #include <QtCore/QtPlugin>
@@ -1493,7 +1492,6 @@ void ProjectExplorerPlugin::updateRecentProjectMenu()
         Core::ICore::instance()->actionManager()->actionContainer(Constants::M_RECENTPROJECTS);
     QMenu *menu = aci->menu();
     menu->clear();
-    m_recentProjectsActions.clear();
 
     menu->setEnabled(!m_recentProjects.isEmpty());
 
@@ -1502,7 +1500,7 @@ void ProjectExplorerPlugin::updateRecentProjectMenu()
         if (s.endsWith(".qws"))
             continue;
         QAction *action = menu->addAction(s);
-        m_recentProjectsActions.insert(action, s);
+        action->setData(s);
         connect(action, SIGNAL(triggered()), this, SLOT(openRecentProject()));
     }
 }
@@ -1513,10 +1511,11 @@ void ProjectExplorerPlugin::openRecentProject()
         qDebug() << "ProjectExplorerPlugin::openRecentProject()";
 
     QAction *a = qobject_cast<QAction*>(sender());
-    if (m_recentProjectsActions.contains(a)) {
-        const QString fileName = m_recentProjectsActions.value(a);
+    if (!a)
+        return;
+    QString fileName = a->data().toString();
+    if (!fileName.isEmpty())
         openProject(fileName);
-    }
 }
 
 void ProjectExplorerPlugin::invalidateProject(Project *project)
diff --git a/src/plugins/projectexplorer/projectexplorer.h b/src/plugins/projectexplorer/projectexplorer.h
index b95c8b50198..b8f55ff3e55 100644
--- a/src/plugins/projectexplorer/projectexplorer.h
+++ b/src/plugins/projectexplorer/projectexplorer.h
@@ -38,7 +38,6 @@
 #include <coreplugin/icorelistener.h>
 
 #include <QtCore/QObject>
-#include <QtCore/QMap>
 #include <QtCore/QSharedPointer>
 #include <QtCore/QList>
 #include <QtCore/QQueue>
@@ -248,7 +247,6 @@ private:
 
     QStringList m_recentProjects;
     static const int m_maxRecentProjects = 7;
-    QMap<QAction*, QString> m_recentProjectsActions;
 
     QString m_lastOpenDirectory;
     QSharedPointer<RunConfiguration> m_delayedRunConfiguration;
-- 
GitLab