summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGleb Popov <6yearold@gmail.com>2015-10-21 05:57:35 (GMT)
committerGleb Popov <6yearold@gmail.com>2015-10-21 05:57:35 (GMT)
commit2bbdb762eb7b57f89cd89140c55ff746b61b3451 (patch)
tree6a7ecb4da37ae25e83ab0c1234b5f518d124f229
parent8445660539256c96c47718873d4ec6164e37f471 (diff)
Use QFileDialog from Qt 5 for "File -> Open" dialog.
REVIEW: 125683
-rw-r--r--shell/shell.cpp17
1 files changed, 6 insertions, 11 deletions
diff --git a/shell/shell.cpp b/shell/shell.cpp
index d0204f9..3c01e28 100644
--- a/shell/shell.cpp
+++ b/shell/shell.cpp
@@ -25,7 +25,7 @@
#include <QDBusConnection>
#include <QMenuBar>
#include <QApplication>
-#include <KFileDialog>
+#include <QFileDialog>
#include <KPluginLoader>
#include <KMessageBox>
#include <QMimeType>
@@ -392,21 +392,16 @@ void Shell::fileOpen()
if ( curPart->url().isLocalFile() )
startDir = curPart->url().toLocalFile();
#pragma message("KF5 check QUrl usage")
- 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 );
+ QFileDialog dlg( this, i18n( "Open Document" ), startDir);
+ dlg.setAcceptMode( QFileDialog::AcceptOpen );
if ( m_fileformatsscanned && m_fileformats.isEmpty() )
- dlg.setFilter( i18n( "*|All Files" ) );
+ dlg.setNameFilter( i18n( "All Files (*)" ) );
else
- dlg.setMimeFilter( m_fileformats );
- dlg.setWindowTitle( i18n( "Open Document" ) );
+ dlg.setMimeTypeFilters( m_fileformats );
if ( !dlg.exec() )
return;
- QUrl url = dlg.selectedUrl();
+ QUrl url = dlg.selectedUrls().at(0);
if ( !url.isEmpty() )
{
openUrl( url );