patch for gideon to remove nonexists projects from recently opened list

Caleb Tennis caleb at aei-tech.com
Wed Jul 24 21:42:05 UTC 2002


Attached is a patch which allows a user to remove a project from the
"recently opened" list upon selecting it if it doesn't exist, like was
available with older versions.  I kind of missed that feature.

One problem lies in that in the KRecentOpenAction (or whatever that class is
called) has a small glitch that won't allow this to follow through.  So,
this patch is 1 of 2 that will be necessary (the other being one I must
submit to the kdelibs folks) in order for this feature to work.

If something about this patch isn't acceptable, someone please let me know.
Otherwise I'd appreciate it if someone would commit.  It goes in /src.

Thanks!
Caleb

---

--- projectmanager_orig.cpp	Wed Jul 24 14:30:59 2002
+++ projectmanager.cpp	Wed Jul 24 13:34:57 2002
@@ -90,7 +90,7 @@

   m_openRecentProjectAction =
     new KRecentFilesAction(i18n("Open &Recent Project..."), 0,
-                          this, SLOT(loadProject(const KURL &)),
+                          this, SLOT(loadRecentProject(const KURL &)),
                           ac, "project_open_recent");
   m_openRecentProjectAction->setStatusText(i18n("Opens a recent project"));

@@ -165,6 +165,45 @@
       loadProject(KURL(project));
     }
   }
+}
+
+void ProjectManager::loadRecentProject(const KURL &url)
+{
+  QString fileName = url.path();
+
+  closeProject();
+
+  m_info = new ProjectInfo;
+
+  if (!loadProjectFile(fileName))
+  {
+    delete m_info;
+    m_info = 0;
+
+    if(KMessageBox::questionYesNo(TopLevel::getInstance()->main(), i18n("Do
you want to remove it from the list?"))==
+       KMessageBox::Yes)
+    {
+      m_openRecentProjectAction->removeURL(url);
+      saveSettings();
+     }
+  return;
+  }
+
+  m_info->m_fileName = fileName;
+
+  getGeneralInfo();
+
+  loadProjectPart();
+  loadLanguageSupport();
+  loadLocalParts();
+
+  initializeProjectSupport();
+
+  ProjectWorkspace::restore();
+
+  m_openRecentProjectAction->addURL(KURL(projectFile()));
+  m_closeProjectAction->setEnabled(true);
+  m_projectOptionsAction->setEnabled(true);
 }

 void ProjectManager::loadProject(const KURL &url)
--- projectmanager_orig.h	Wed Jul 24 14:31:17 2002
+++ projectmanager.h	Wed Jul 24 12:27:27 2002
@@ -35,7 +35,8 @@

 public slots:

-  void loadProject( const KURL& url );
+  void loadProject( const KURL& url);
+  void loadRecentProject( const KURL& url);
   void closeProject();

 private slots:





More information about the KDevelop-devel mailing list