From 31555d3c36846f14506586ea38ab48b84bc4f5d4 Mon Sep 17 00:00:00 2001 From: william Date: Fri, 6 Mar 2015 21:50:53 +0100 Subject: automatically display correct folder when clicking command button --- desktop-editor/dialog.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/desktop-editor/dialog.cpp b/desktop-editor/dialog.cpp index e3aad0d3..a8d9861d 100644 --- a/desktop-editor/dialog.cpp +++ b/desktop-editor/dialog.cpp @@ -94,10 +94,13 @@ void Dialog::LoadDesktopFile(QString input) void Dialog::on_pbCommand_clicked() { - //TODO: detect Command directory - + QString commandFolder="~"; + if (!ui->lCommand->text().isEmpty()) { + commandFolder = ui->lCommand->text().section('/', 0, -2); + } + QString fileName = QFileDialog::getOpenFileName(this, - tr("Open command"), "~", tr("All Files (*)")); + tr("Open command"), commandFolder, tr("All Files (*)")); ui->lCommand->setText(fileName); } -- cgit