Members of the KDE Community are recommended to subscribe to the kde-community mailing list at to allow them to participate in important discussions and receive other important announcements

Commit 17af9cd2 authored by David Narváez's avatar David Narváez

Beef Up the Default Dir Logic for Opening Files

The port introduced a regression where the Open File Dialog no longer
started on the Documents folder by default. The new behavior restores
this by default, but also takes you to the previously opened file, if
any, which is helpful if you are opening several files from the same
parent f0f72e73
......@@ -25,6 +25,7 @@
#include <qtimer.h>
#include <QAction>
#include <QStandardPaths>
#include <QFileDialog>
#include <QUrl>
#include <QMimeData>
......@@ -212,7 +213,19 @@ void Kig::dropEvent(QDropEvent* e)
void Kig::fileOpen()
// this slot is connected to the KStandardAction::open action...
QString file_name = QFileDialog::getOpenFileName(0, QString(), "kfiledialog:///document", m_mimeTypes.join( " " ) );
QString currentDir = m_part->url().isLocalFile() ? m_part->url().toLocalFile() : QString();
if ( currentDir.isNull() )
const QStringList documentsPath = QStandardPaths::standardLocations( QStandardPaths::DocumentsLocation );
if ( !documentsPath.empty() )
currentDir = documentsPath[0];
const QString file_name = QFileDialog::getOpenFileName(0, QString(), currentDir, m_mimeTypes.join( " " ) );
if (!file_name.isEmpty()) openUrl( QUrl::fromLocalFile( file_name ) );
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment