Author: aolk
Date: 2006-01-13 17:13:29 -0500 (Fri, 13 Jan 2006)
New Revision: 55555

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: Don't crash if InitialDirectory doesn't exist

2006-01-13  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-01-13 22:04:34 UTC (rev 55554)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-01-13 22:13:29 UTC (rev 55555)
@@ -1,5 +1,9 @@
 2006-01-13  Alexander Olk  <[EMAIL PROTECTED]>
 
+       * FileDialog.cs: Don't crash if InitialDirectory doesn't exist
+
+2006-01-13  Alexander Olk  <[EMAIL PROTECTED]>
+
        * ToolTip.cs: If SetToolTip is called from a control and the mouse
          is currently over that control, make sure that tooltip_window.Text
          gets updated

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FileDialog.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FileDialog.cs    
2006-01-13 22:04:34 UTC (rev 55554)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FileDialog.cs    
2006-01-13 22:13:29 UTC (rev 55555)
@@ -220,9 +220,11 @@
                        }
                        
                        set {
-                               initialDirectory = value;
+                               if (Directory.Exists (value)) {
+                                       initialDirectory = value;
                                
-                               fileDialogPanel.ChangeDirectory( null, 
initialDirectory );
+                                       fileDialogPanel.ChangeDirectory( null, 
initialDirectory );
+                               }
                        }
                }
                
@@ -1712,14 +1714,16 @@
        
        internal struct FileStruct
        {
-               public FileStruct( string fullname, FileAttributes attributes )
+               public FileStruct( string fullname, FileAttributes attributes, 
long size )
                {
                        this.fullname = fullname;
                        this.attributes = attributes;
+                       this.size = size;
                }
                
                public string fullname;
                public FileAttributes attributes;
+               public long size;
        }
        
        // MWFFileView
@@ -1752,6 +1756,8 @@
                        toolTip.InitialDelay = 300;
                        toolTip.ReshowDelay = 0; 
                        
+                       LabelWrap = true;
+                       
                        SmallImageList = MimeIconEngine.SmallIcons;
                        LargeImageList = MimeIconEngine.LargeIcons;
                        
@@ -1978,6 +1984,8 @@
                                fileLen = 1;
                        }
                        
+                       fileStruct.size = fileLen;
+                       
                        listViewItem.SubItems.Add( fileLen.ToString( ) + " KB" 
);
                        listViewItem.SubItems.Add( "File" );
                        listViewItem.SubItems.Add( 
fileInfo.LastAccessTime.ToShortDateString( ) + " " + 
fileInfo.LastAccessTime.ToShortTimeString( ) );
@@ -2167,8 +2175,16 @@
                                        
                                        FileStruct fileStruct = 
(FileStruct)fileHashtable [item.Text];
                                        
-                                       toolTip.SetToolTip (this, String.Format 
("File: \n {0}", fileStruct.fullname)); 
+                                       string output = String.Empty;
                                        
+                                       if (fileStruct.attributes != 
FileAttributes.Directory) {
+                                               output = String.Format ("File: 
{0}", fileStruct.fullname);
+                                       }
+                                       else
+                                               output = String.Format 
("Directory: {0}\n", fileStruct.fullname);
+                                       
+                                       toolTip.SetToolTip (this, output);      
+                                       
                                        toolTip.Active = true;
                                }
                        }

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

Reply via email to