Author: aolk
Date: 2006-06-08 16:58:17 -0400 (Thu, 08 Jun 2006)
New Revision: 61587

Modified:
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FileDialog.cs
Log:
        * FileDialog.cs: Append a number when creating a new folder if the
          folder already exists (use parenthesis instead of square brackets)

2006-06-08  Alexander Olk  <[EMAIL PROTECTED]>



Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-06-08 20:49:05 UTC (rev 61586)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-06-08 20:58:17 UTC (rev 61587)
@@ -1,5 +1,10 @@
 2006-06-08  Alexander Olk  <[EMAIL PROTECTED]>
 
+       * FileDialog.cs: Append a number when creating a new folder if the
+         folder already exists (use parenthesis instead of square brackets)
+
+2006-06-08  Alexander Olk  <[EMAIL PROTECTED]>
+
        * FileDialog.cs:
          - Disabled registry support for windows and added better registry
            error checking for other systems (need to investigate why it

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FileDialog.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FileDialog.cs    
2006-06-08 20:49:05 UTC (rev 61586)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FileDialog.cs    
2006-06-08 20:58:17 UTC (rev 61587)
@@ -1906,7 +1906,6 @@
                
                private string currentFolder;
                private string currentRealFolder;
-               private string currentTopFolder;
                private FSEntry currentFolderFSEntry;
                
                // store DirectoryInfo for a back button for example
@@ -2125,15 +2124,30 @@
                        
                        TextEntryDialog ted = new TextEntryDialog ();
                        ted.IconPictureBoxImage = 
MimeIconEngine.LargeIcons.Images.GetImage (fsEntry.IconIndex);
-                       ted.FileName = "New Folder";
                        
+                       string folder = "";
+                       
+                       if (currentFolderFSEntry.RealName != null)
+                               folder = currentFolderFSEntry.RealName;
+                       else
+                               folder = currentFolder;
+                       
+                       string tmp_filename = "New Folder";
+                       
+                       if (Directory.Exists (Path.Combine (folder, 
tmp_filename))) {
+                               int i = 1;
+                               
+                               tmp_filename = tmp_filename + " (" + i + ")";
+                               
+                               while (Directory.Exists (Path.Combine (folder, 
tmp_filename))) {
+                                       i++;
+                                       tmp_filename = "New Folder" + " (" + i 
+ ")";
+                               }
+                       }
+                       
+                       ted.FileName = tmp_filename;
+                       
                        if (ted.ShowDialog () == DialogResult.OK) {
-                               string folder = "";
-                               if (currentFolderFSEntry.RealName != null)
-                                       folder = currentFolderFSEntry.RealName;
-                               else
-                                       folder = currentFolder;
-                               
                                string new_folder = Path.Combine (folder, 
ted.FileName);
                                
                                if (vfs.CreateFolder (new_folder)) {
@@ -2257,11 +2271,11 @@
                                        if (collection.Contains (fileName)) {
                                                int i = 1;
                                                
-                                               while (collection.Contains 
(fileName + "[" + i + "]")) {
+                                               while (collection.Contains 
(fileName + "(" + i + ")")) {
                                                        i++;
                                                }
                                                
-                                               fileName = fileName + "[" + i + 
"]";
+                                               fileName = fileName + "(" + i + 
")";
                                        }
                                        
                                        fsEntry.Name = fileName;
@@ -2742,7 +2756,7 @@
                {
                        try {
                                if (Directory.Exists (new_folder)) {
-                                       string message = "Folder \"" + 
new_folder + "\" exists already.";
+                                       string message = "Folder \"" + 
new_folder + "\" already exists.";
                                        MessageBox.Show (message, new_folder, 
MessageBoxButtons.OK, MessageBoxIcon.Warning);
                                        return false;
                                } else

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to