Patch #1900 2007-02-24 21:36

dermeister

[ Feature Request #3165 ] direct access to directory on "add
Download
1900-Feature_Reques.patch (2.5 KB)
Category
Application::FeatureAdd
Status
Closed
Close date
2007-03-14 21:29
Assigned to
mortenmacfly
Index: src/sdk/projectmanager.cpp
===================================================================
--- src/sdk/projectmanager.cpp  (revision 3635)
+++ src/sdk/projectmanager.cpp  (working copy)
@@ -1828,21 +1828,35 @@
 void ProjectManager::OnAddFilesToProjectRecursively(wxCommandEvent& event)
 {
     cbProject* prj = 0;
+    wxString basePath;
+
     if (event.GetId() == idMenuAddFilesRecursively)
+    {
         prj = GetActiveProject();
+        if (prj)
+                       basePath = prj->GetBasePath();
+    }
     else
     {
         wxTreeItemId sel = m_pTree->GetSelection();
         FileTreeData* ftd = (FileTreeData*)m_pTree->GetItemData(sel);
         if (ftd)
+        {
             prj = ftd->GetProject();
+                       if (prj)
+                       {
+                               basePath = ftd->GetFolder();
+                               if (!wxDirExists(basePath))
+                                       basePath = prj->GetBasePath();
+                       }
+        }
     }
     if (!prj)
         return;
 
     wxString dir = ChooseDirectory(m_pTree,
                                     _("Add files recursively..."),
-                                    prj->GetBasePath(),
+                                    basePath,
                                     wxEmptyString,
                                     false,
                                     false);
@@ -1896,21 +1910,35 @@
 void ProjectManager::OnAddFileToProject(wxCommandEvent& event)
 {
     cbProject* prj = 0;
+    wxString basePath;
+
     if (event.GetId() == idMenuAddFile)
+    {
         prj = GetActiveProject();
+        if (prj)
+                       basePath = prj->GetBasePath();
+    }
     else
     {
         wxTreeItemId sel = m_pTree->GetSelection();
         FileTreeData* ftd = (FileTreeData*)m_pTree->GetItemData(sel);
         if (ftd)
+        {
             prj = ftd->GetProject();
+                       if (prj)
+                       {
+                               basePath = ftd->GetFolder();
+                               if (!wxDirExists(basePath))
+                                       basePath = prj->GetBasePath();
+                       }
+        }
     }
     if (!prj)
         return;
 
     wxFileDialog dlg(Manager::Get()->GetAppWindow(),
                     _("Add files to project..."),
-                    prj->GetBasePath(),
+                    basePath,
                     wxEmptyString,
                     FileFilters::GetFilterString(),
                     wxOPEN | wxMULTIPLE | wxFILE_MUST_EXIST
dermeister 2007-02-24 21:37

This patch implements feature request #3165 (direct access to directory on "add file").

julienlecomte 2007-03-01 11:36

The patch works fine. Could someone commit it?

mortenmacfly 2007-03-14 21:29

Applied in r3704, thanks a lot.