[PATCH] qfiledialog fixes

Clement Vasseur <[email protected]>
Newsgroups gmane.comp.kde.devel.cygwin
Message-ID <[email protected]>
A patch for qt3-win is attached.

src/dialogs/qfiledialog_win.cpp:
  Fix dialog flags for the unicode version.
  Make multi-select dialogs support single-selection properly.

-- 
Clement Vasseur

_______________________________________________
kde-cygwin mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/kde-cygwin
qtwin-filedialog.patch (application/octet-stream, 1.8 KB)
diff -ru qt-3.orig/src/dialogs/qfiledialog_win.cpp qt-3/src/dialogs/qfiledialog_win.cpp
--- qt-3.orig/src/dialogs/qfiledialog_win.cpp	2005-04-23 00:01:28.000000000 +0200
+++ qt-3/src/dialogs/qfiledialog_win.cpp	2005-06-24 18:30:43.842652182 +0200
@@ -219,6 +219,11 @@
             // no need for slashify here
             offset += file.length() + 1; // this is correct!
         }
+
+        // if only one file is selected
+        // then lpstrFile is not in the same format
+        if ( ret.count() == 1 )
+                ret.first() = slashify( qt_winQString ( opfw.lpstrFile ) );
     }
     return ret;
 }
@@ -272,6 +277,11 @@
             // no need for slashify here
             offset += file.length() + 1;
         }
+
+        // if only one file is selected
+        // then lpstrFile is not in the same format
+        if ( ret.count() == 1 )
+                ret.first() = slashify( QFile::decodeName( opfa.lpstrFile ) );
     }
     return ret;
 }
@@ -301,7 +311,7 @@
         opfw.hwndOwner = parent ? parent->winId() : 0;
         opfw.lpstrInitialDir = ( LPCWSTR ) reslashify( *workingDirectory ).ucs2();
         opfw.lpstrTitle = ( LPCWSTR ) caption.ucs2();
-        opfw.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_ALLOWMULTISELECT;
+        opfw.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST;
         ,
         memset( &opfa, 0, sizeof( OPENFILENAMEA ) );
         opfa.lStructSize = sizeof( OPENFILENAMEA );
@@ -362,7 +372,7 @@
         opfw.hwndOwner = parent ? parent->winId() : 0;
         opfw.lpstrInitialDir = ( LPCWSTR ) reslashify( *workingDirectory ).ucs2();
         opfw.lpstrTitle = ( LPCWSTR ) caption.ucs2();
-        opfw.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_ALLOWMULTISELECT;
+        opfw.Flags = OFN_EXPLORER;
         ,
         memset( &opfa, 0, sizeof( OPENFILENAMEA ) );
         opfa.lStructSize = sizeof( OPENFILENAMEA );
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.