pgmargs.cpp (kdbg-3.0.0) | : | pgmargs.cpp (kdbg-3.0.1) | ||
---|---|---|---|---|
skipping to change at line 200 | skipping to change at line 200 | |||
QString newDir = QFileDialog::getExistingDirectory(this, {}, wd()); | QString newDir = QFileDialog::getExistingDirectory(this, {}, wd()); | |||
if (!newDir.isEmpty()) { | if (!newDir.isEmpty()) { | |||
setWd(newDir); | setWd(newDir); | |||
} | } | |||
} | } | |||
void PgmArgs::on_insertFile_clicked() | void PgmArgs::on_insertFile_clicked() | |||
{ | { | |||
QString caption = i18n("Select a file name to insert as program argument"); | QString caption = i18n("Select a file name to insert as program argument"); | |||
// use the selection as default | QFileDialog dlg(this, caption); | |||
QString f = programArgs->selectedText(); | dlg.setFileMode(QFileDialog::AnyFile); | |||
f = QFileDialog::getSaveFileName(this, caption, f); | dlg.setLabelText(QFileDialog::Accept, | |||
// i18n: replacement text for the "Open" button in a file dialog | ||||
// the selected file name will be inserted in a text box | ||||
i18nc("@action:button file name into text box", "Insert")); | ||||
if (dlg.exec() != QDialog::Accepted) | ||||
return; | ||||
auto names = dlg.selectedFiles(); | ||||
// don't clear the selection if no file was selected | // don't clear the selection if no file was selected | |||
if (!f.isEmpty()) { | if (names.count() > 0) | |||
programArgs->insert(f); | programArgs->insert(names.first()); | |||
} | ||||
} | } | |||
void PgmArgs::on_insertDir_clicked() | void PgmArgs::on_insertDir_clicked() | |||
{ | { | |||
QString caption = i18n("Select a directory to insert as program argument"); | QString caption = i18n("Select a directory to insert as program argument"); | |||
// use the selection as default | // use the selection as default | |||
QString f = programArgs->selectedText(); | QString f = programArgs->selectedText(); | |||
f = QFileDialog::getExistingDirectory(this, caption, f); | f = QFileDialog::getExistingDirectory(this, caption, f); | |||
// don't clear the selection if no file was selected | // don't clear the selection if no file was selected | |||
End of changes. 2 change blocks. | ||||
6 lines changed or deleted | 13 lines changed or added |