diff --git a/org.emptyflow.ArdorQuery.appdata.xml b/org.emptyflow.ArdorQuery.appdata.xml index c10a2ff..fc21f68 100644 --- a/org.emptyflow.ArdorQuery.appdata.xml +++ b/org.emptyflow.ArdorQuery.appdata.xml @@ -25,7 +25,11 @@ - + + +

This stable release fixes bugs.

+
+
diff --git a/src/ListModels/requestscommandpalettelistmodel.cpp b/src/ListModels/requestscommandpalettelistmodel.cpp index de5e70d..5233cfc 100644 --- a/src/ListModels/requestscommandpalettelistmodel.cpp +++ b/src/ListModels/requestscommandpalettelistmodel.cpp @@ -94,6 +94,12 @@ void RequestsCommandPaletteListModel::selectNext() refresh(); } +void RequestsCommandPaletteListModel::forceSelectItem(QUuid id) +{ + m_selected = m_history.indexOf(id); + selectItem(); +} + void RequestsCommandPaletteListModel::refresh(bool needRecreateHistory) { beginResetModel(); diff --git a/src/ListModels/requestscommandpalettelistmodel.h b/src/ListModels/requestscommandpalettelistmodel.h index 05fcce6..5936e23 100644 --- a/src/ListModels/requestscommandpalettelistmodel.h +++ b/src/ListModels/requestscommandpalettelistmodel.h @@ -48,6 +48,7 @@ class RequestsCommandPaletteListModel : public QAbstractListModel void selectItem(); void selectNext(); + void forceSelectItem(QUuid id); void refresh(bool needRecreateHistory = false); void recreateHistory(); diff --git a/src/ViewModels/backendviewmodel.cpp b/src/ViewModels/backendviewmodel.cpp index 33b5fd8..e591c94 100644 --- a/src/ViewModels/backendviewmodel.cpp +++ b/src/ViewModels/backendviewmodel.cpp @@ -42,7 +42,7 @@ void BackendViewModel::setFocusedHelpTextField(bool focusedHelpTextField) noexce emit focusedHelpTextFieldChanged(); } -void BackendViewModel::addNewRequest() +void BackendViewModel::addNewRequest(bool forceSelectedAddedItem) { auto model = new HttpRequestModel(this); @@ -51,6 +51,11 @@ void BackendViewModel::addNewRequest() request->setSelectedItem(0); // select first empty field for new request m_requests->addItem(model); + + if (forceSelectedAddedItem) { + m_requestsCommandPaletter->refresh(true); // recreate history + m_requestsCommandPaletter->forceSelectItem(model->requestId()); // force selection of added element + } } bool BackendViewModel::shortcutHandler(const QString &shortcut) noexcept @@ -111,7 +116,7 @@ bool BackendViewModel::shortcutHandler(const QString &shortcut) noexcept } else if (command == m_toggleTabsCommand) { m_tabs->toggleTabs(); } else if (command == m_addQueryCommand) { - addNewRequest(); + addNewRequest(true); } else if (command == m_deleteSelectedQueryCommand) { deleteCurrentRequest(); } else if (command == m_selectLastFieldCommand) { diff --git a/src/ViewModels/backendviewmodel.h b/src/ViewModels/backendviewmodel.h index b6f89ee..e2163cc 100644 --- a/src/ViewModels/backendviewmodel.h +++ b/src/ViewModels/backendviewmodel.h @@ -116,7 +116,7 @@ class BackendViewModel : public QObject bool focusedHelpTextField() const noexcept { return m_focusedHelpTextField; } void setFocusedHelpTextField(bool focusedHelpTextField) noexcept; - Q_INVOKABLE void addNewRequest(); + Q_INVOKABLE void addNewRequest(bool forceSelectedAddedItem = false); Q_INVOKABLE bool shortcutHandler(const QString& shortcut) noexcept; Q_INVOKABLE void refreshFindedIndex() noexcept; Q_INVOKABLE void openedFile(const QString& filePath) noexcept;