KDE/kdelibs/kio/kfile

Jaroslaw Staniek js at iidea.pl
Thu Jun 19 12:54:34 CEST 2008


SVN commit 822150 by staniek:


Add native mode to KFileDialog without affecting its API

It is useful for MS Windows (and Mac?) for improving native experience.
Native mode is the default on Windows. 
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 
- Native::startDir() and staticStartDir() are used for getting default start dir value when executing exec(). Thus we can call setSelection() before calling exec(). 
- QFileDialog handlers: clear hooks as soon as native mode is detected
  (we cannot check native setting in KFileDialogQtOverride() before
   KComponentData is instantiated)

CCMAIL:kde-windows at kde.org



 M  +387 -26   kfiledialog.cpp  
 M  +5 -0      kfiledialog.h  




More information about the Kde-windows mailing list