diff options
author | william <william.os4y@gmail.com> | 2015-03-06 21:42:28 +0100 |
---|---|---|
committer | william <william.os4y@gmail.com> | 2015-03-13 20:51:55 +0100 |
commit | f55033465893e71970a9a11fa0a7c048d4014ab5 (patch) | |
tree | 929ede8f224a8e71eb58c3597175e4084ab45884 | |
parent | detect the type of desktop file and adapt the layout accordingly (diff) | |
download | lumina-f55033465893e71970a9a11fa0a7c048d4014ab5.tar.gz lumina-f55033465893e71970a9a11fa0a7c048d4014ab5.tar.bz2 lumina-f55033465893e71970a9a11fa0a7c048d4014ab5.zip |
automatically display the correct folder when clicking on Icon button
-rw-r--r-- | desktop-editor/dialog.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/desktop-editor/dialog.cpp b/desktop-editor/dialog.cpp index 232e645c..e3aad0d3 100644 --- a/desktop-editor/dialog.cpp +++ b/desktop-editor/dialog.cpp @@ -94,6 +94,8 @@ void Dialog::LoadDesktopFile(QString input) void Dialog::on_pbCommand_clicked() { + //TODO: detect Command directory + QString fileName = QFileDialog::getOpenFileName(this, tr("Open command"), "~", tr("All Files (*)")); ui->lCommand->setText(fileName); @@ -177,17 +179,14 @@ void Dialog::on_pbApply_clicked() tempFile.setAutoRemove(false); tempFile.open(); tempFile.close(); - qDebug() << "temp file:" << tempFile.fileName(); //TODO: capture errors QString cmd = "mv"; cmd = cmd + " " + desktopFileName + " " + tempFile.fileName(); - qDebug() << "cmd:" << cmd; int ret = LUtils::runCmd(cmd); cmd = "mv"; cmd = cmd + " " + tempFile.fileName() + " " + desktopFileName; - qDebug() << "cmd:" << cmd; ret = LUtils::runCmd(cmd); } } @@ -195,8 +194,16 @@ 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); + } + QString fileName = QFileDialog::getOpenFileName(this, - tr("Open command"), "~", tr("Image Files (*.png *.jpg *.bmp)")); + tr("Open command"), iconFolder, tr("Image Files (*.png *.jpg *.bmp)")); qDebug() << "icon:" << fileName; ui->pbIcon->setIcon(QPixmap(fileName)); iconFileName=fileName; |