diff options
author | william <william.os4y@gmail.com> | 2015-03-14 22:06:55 +0100 |
---|---|---|
committer | william <william.os4y@gmail.com> | 2015-03-14 22:06:55 +0100 |
commit | f10cf7cbb193faf726f9413ff1b98aac25b7c036 (patch) | |
tree | d68be16507ace3a437bfde5e26468ab0017303e2 | |
parent | Merge remote-tracking branch 'upstream/master' into deskEditor (diff) | |
download | lumina-f10cf7cbb193faf726f9413ff1b98aac25b7c036.tar.gz lumina-f10cf7cbb193faf726f9413ff1b98aac25b7c036.tar.bz2 lumina-f10cf7cbb193faf726f9413ff1b98aac25b7c036.zip |
fix issues with pushbuttons (Command, WorkingDir and Icon) concerning the default values
-rw-r--r-- | desktop-editor/dialog.cpp | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/desktop-editor/dialog.cpp b/desktop-editor/dialog.cpp index a0cbb53e..b8f5733d 100644 --- a/desktop-editor/dialog.cpp +++ b/desktop-editor/dialog.cpp @@ -5,6 +5,7 @@ #include <QTemporaryFile> #include <QMessageBox> #include "LuminaUtils.h" +#include <LuminaOS.h> Dialog::Dialog(QWidget *parent) : QDialog(parent), @@ -101,10 +102,10 @@ void Dialog::LoadDesktopFile(QString input) void Dialog::on_pbCommand_clicked() { - QString commandFolder="~"; - if (!ui->lCommand->text().isEmpty()) { - commandFolder = ui->lCommand->text().section('/', 0, -2); - } + //the default directory is the user's home directory + QString commandFolder = "~"; + if (!ui->lCommand->text().isEmpty()) commandFolder = ui->lCommand->text().section('/', 0, -2); + if (commandFolder.isEmpty()) commandFolder = "~"; QString fileName = QFileDialog::getOpenFileName(this, tr("Open command"), commandFolder, tr("All Files (*)")); @@ -117,10 +118,14 @@ void Dialog::on_pbCommand_clicked() void Dialog::on_pbWorkingDir_clicked() { + //the default directory is / + QString workingDir = "/"; + if (ui->lWorkingDir->text().isEmpty()) workingDir = "/"; + else workingDir = ui->lWorkingDir->text(); QFileDialog::Options options = QFileDialog::DontResolveSymlinks | QFileDialog::ShowDirsOnly; QString directory = QFileDialog::getExistingDirectory(this, tr("Working Directory"), - ui->lWorkingDir->text(), + workingDir, options); if (!directory.isEmpty()) { ui->lWorkingDir->setText(directory); @@ -210,13 +215,11 @@ void Dialog::on_pbApply_clicked() void Dialog::on_pbIcon_clicked() { - QString iconFolder="~"; - if (!iconFileName.isEmpty()) { - iconFolder = iconFileName.section('/', 0, -2); - } - else if (!DF.icon.isEmpty()) { - iconFolder = DF.icon.section('/', 0, -2); - } + //the default directory is local/share/icons + QString iconFolder = LOS::AppPrefix()+"/share/icons"; + if (!iconFileName.isEmpty()) iconFolder = iconFileName.section('/', 0, -2); + else if (!DF.icon.isEmpty()) iconFolder = DF.icon.section('/', 0, -2); + if (iconFolder.isEmpty()) iconFolder = LOS::AppPrefix()+"/share/icons"; QString fileName = QFileDialog::getOpenFileName(this, tr("Open command"), iconFolder, tr("Image Files (*.png *.jpg *.bmp)")); |