[patch] Native mode for KFileDialog

Jarosław Staniek js at iidea.pl
Fri Jun 13 22:39:45 CEST 2008


(for review)

Add native mode to KFileDialog without affecting its API

It is useful for MS Windows (and Mac?) for improving native experience.
Users demanding powerful facilities of KDE dialogs can set the following in 
kdeglobals:

[KFileDialog Settings]
Native=false

The same setting shall be available in the forthcoming "Integration" page of 
KDE system settings on Windows/Mac.

Details:
- qtFilter() added for converting filters from KDE format to Qt format
- In KDE code, KFileDialog instances are allocated and QDialog::exec() is 
executed; since we are using static QDialog functions in the native mode, 
exec() is reimplemented  to call them
- KFileDialogPrivate::Native member added for storing information for 
KFileDialog instances so we know what to do when exec() is called; moreoved 
selectedUrl*() and selectedFile() methods work as expected for native mode too
- on the other hand, static functions like KFileDialog::getOpenFileName(), 
check the "native" setting directly using static bool 
KFileDialogPrivate::isNative()
- setMimeFilter() sets filter for use in Qt dialogs
- KFileWidget is instantiated as the code uses its subwidgets but we do not 
show any widget, it does not seem to be overhead
- to add more consistency, KFileDialog::getExistingDirectory*() functions use 
native dialog only for native mode (before native dialog was always used 
through #ifdef'd code on Windows)
- _qt_filedialog_*_hook hooks are now only used for KDE mode; and similarly to 
getExistingDirectory*() change, qt_filedialog_existing_directory_hook is set 
for KDE mode on Windows too; make KFileDialogQtOverride a class since it looks 
and smells like a class
- fix declaration of _qt_filedialog_*_hook functions: Qt exports them using 
Q_GUI_EXPORT, not C linkage as "extern" word would suggest before

-- 
regards / pozdrawiam, Jaroslaw Staniek
  Sponsored by OpenOffice Polska (http://www.openoffice.com.pl/en) to work on
  Kexi & KOffice (http://www.kexi.pl/en, http://www.koffice.org/kexi)
  KDE Libraries for MS Windows (http://windows.kde.org)
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: native_kfiledialog.patch
Url: http://mail.kde.org/pipermail/kde-windows/attachments/20080613/b4c0c6f4/attachment-0001.ksh 


More information about the Kde-windows mailing list