]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/filectrlg.cpp
Add buildbot configuration.
[wxWidgets.git] / src / generic / filectrlg.cpp
index 44486c1bf97938723a5a8371148b8d353a5a1b0b..5427143e0121267ac1d39c42580bdc405979a05c 100644 (file)
@@ -393,9 +393,6 @@ void wxFileData::MakeItem( wxListItem &item )
 //  wxFileListCtrl
 //-----------------------------------------------------------------------------
 
-// FIXME: what is this for? It's never read
-static bool ignoreChanges = false;
-
 IMPLEMENT_DYNAMIC_CLASS(wxFileListCtrl,wxListCtrl)
 
 BEGIN_EVENT_TABLE(wxFileListCtrl,wxListCtrl)
@@ -542,11 +539,23 @@ void wxFileListCtrl::UpdateFiles()
     {
         wxArrayString names, paths;
         wxArrayInt icons;
-        size_t n, count = wxGetAvailableDrives(paths, names, icons);
+        const size_t count = wxGetAvailableDrives(paths, names, icons);
 
-        for (n=0; n<count; n++)
+        for ( size_t n = 0; n < count; n++ )
         {
-            wxFileData *fd = new wxFileData(paths[n], names[n], wxFileData::is_drive, icons[n]);
+            // use paths[n] as the drive name too as our HandleAction() can't
+            // deal with the drive names (of the form "System (C:)") currently
+            // as it mistakenly treats them as file names
+            //
+            // it would be preferable to show names, and not paths, in the
+            // dialog just as the native dialog does but for this we must:
+            //  a) store the item type as item data and modify HandleAction()
+            //     to use it instead of wxDirExists() to check whether the item
+            //     is a directory
+            //  b) store the drives by their drive letters and not their
+            //     descriptions as otherwise it's pretty confusing to the user
+            wxFileData *fd = new wxFileData(paths[n], paths[n],
+                                            wxFileData::is_drive, icons[n]);
             if (Add(fd, item) != -1)
                 item.m_itemId++;
             else
@@ -710,10 +719,8 @@ void wxFileListCtrl::GoToParentDir()
         long id = FindItem( 0, fname );
         if (id != wxNOT_FOUND)
         {
-            ignoreChanges = true;
             SetItemState( id, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED );
             EnsureVisible( id );
-            ignoreChanges = false;
         }
     }
 }
@@ -731,9 +738,7 @@ void wxFileListCtrl::GoToDir( const wxString &dir )
     m_dirName = dir;
     UpdateFiles();
 
-    ignoreChanges = true;
     SetItemState( 0, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED );
-    ignoreChanges = false;
 
     EnsureVisible( 0 );
 }
@@ -806,9 +811,7 @@ void wxFileListCtrl::OnListEndLabelEdit( wxListEvent &event )
     {
         fd->SetNewName( new_name, event.GetLabel() );
 
-        ignoreChanges = true;
         SetItemState( event.GetItem(), wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED );
-        ignoreChanges = false;
 
         UpdateItem( event.GetItem() );
         EnsureVisible( event.GetItem() );