summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGleb Popov <6yearold@gmail.com>2015-10-21 11:30:36 (GMT)
committerGleb Popov <6yearold@gmail.com>2015-10-21 11:33:49 (GMT)
commitf8870e60f493dc31c004f17dc9e1e9121598eb7b (patch)
tree756bdc87902edd367c08d7cf32fc45dab805a2ae
parent2bbdb762eb7b57f89cd89140c55ff746b61b3451 (diff)
Revert "Use QFileDialog from Qt 5 for "File -> Open" dialog."
Unlike KFileDialog, QFileDialog doesn't add special "All supported types" filter.
-rw-r--r--shell/shell.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/shell/shell.cpp b/shell/shell.cpp
index 3c01e28..d0204f9 100644
--- a/shell/shell.cpp
+++ b/shell/shell.cpp
@@ -25,7 +25,7 @@
#include <QDBusConnection>
#include <QMenuBar>
#include <QApplication>
-#include <QFileDialog>
+#include <KFileDialog>
#include <KPluginLoader>
#include <KMessageBox>
#include <QMimeType>
@@ -392,16 +392,21 @@ void Shell::fileOpen()
if ( curPart->url().isLocalFile() )
startDir = curPart->url().toLocalFile();
#pragma message("KF5 check QUrl usage")
- QFileDialog dlg( this, i18n( "Open Document" ), startDir);
- dlg.setAcceptMode( QFileDialog::AcceptOpen );
+ KFileDialog dlg( QUrl(startDir), QString(), this );
+ dlg.setOperationMode( KFileDialog::Opening );
+
+ // A directory may be a document. E.g. comicbook generator.
+ if ( m_fileformats.contains( "inode/directory" ) )
+ dlg.setMode( dlg.mode() | KFile::Directory );
if ( m_fileformatsscanned && m_fileformats.isEmpty() )
- dlg.setNameFilter( i18n( "All Files (*)" ) );
+ dlg.setFilter( i18n( "*|All Files" ) );
else
- dlg.setMimeTypeFilters( m_fileformats );
+ dlg.setMimeFilter( m_fileformats );
+ dlg.setWindowTitle( i18n( "Open Document" ) );
if ( !dlg.exec() )
return;
- QUrl url = dlg.selectedUrls().at(0);
+ QUrl url = dlg.selectedUrl();
if ( !url.isEmpty() )
{
openUrl( url );