Docker: Add history to "Search in Selected Directories"

Also set focus to the line edit when this item gets selected,
and remove the arbitrary /usr/bin;/opt default.

Slightly better UX.

Change-Id: Icdc4e81d6cebd7aed1dd4999c4007a60c8ea53a2
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2022-03-14 12:10:59 +01:00
parent 8e16d45d4c
commit 2eca1c0ffc

View File

@@ -382,12 +382,12 @@ public:
searchDirsComboBox->addItem(tr("Search in PATH"));
searchDirsComboBox->addItem(tr("Search in Selected Directories"));
auto searchDirsLineEdit = new QLineEdit;
searchDirsLineEdit->setText("/usr/bin;/opt");
auto searchDirsLineEdit = new FancyLineEdit;
searchDirsLineEdit->setToolTip(
tr("Select the paths in the docker image that should be scanned for kit entries."));
searchDirsLineEdit->setHistoryCompleter("DockerMounts", true);
auto searchPaths = [this, searchDirsComboBox, searchDirsLineEdit, dockerDevice] {
auto searchPaths = [searchDirsComboBox, searchDirsLineEdit, dockerDevice] {
FilePaths paths;
if (searchDirsComboBox->currentIndex() == 0) {
paths = dockerDevice->systemEnvironment().path();
@@ -458,8 +458,10 @@ public:
}.attachTo(this);
searchDirsLineEdit->setVisible(false);
auto updateDirectoriesLineEdit = [this, searchDirsLineEdit](int index) {
auto updateDirectoriesLineEdit = [searchDirsLineEdit](int index) {
searchDirsLineEdit->setVisible(index == 1);
if (index == 1)
searchDirsLineEdit->setFocus();
};
QObject::connect(searchDirsComboBox, qOverload<int>(&QComboBox::activated),
this, updateDirectoriesLineEdit);