Skip to content

Commit

Permalink
#3066 fix: Check for script updates sub-button in settings dialog
Browse files Browse the repository at this point in the history
Signed-off-by: Patrizio Bekerle <[email protected]>
  • Loading branch information
pbek committed Aug 1, 2024
1 parent aa17954 commit d664e65
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 8 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
- In addition, a button to search the *Script repository* was added
- A problem with the script settings for some users in the `Ollama AI backend integration`
script was fixed (for [#3052](https://github.com/pbek/QOwnNotes/issues/3052))
- The `Check for script updates` sub-button in the *Scripting settings* was fixed
(for [#3064](https://github.com/pbek/QOwnNotes/issues/3064))

## 24.8.0
- In the *AI settings* there now are buttons to test the connection to the AI services
(for [#3062](https://github.com/pbek/QOwnNotes/issues/3062))
Expand Down
11 changes: 11 additions & 0 deletions src/dialogs/scriptrepositorydialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <QtWidgets/QMessageBox>
#include <QtWidgets/QSplitter>

#include "services/scriptingservice.h"
#include "ui_scriptrepositorydialog.h"

ScriptRepositoryDialog::ScriptRepositoryDialog(QWidget *parent, bool checkForUpdates)
Expand Down Expand Up @@ -467,3 +468,13 @@ void ScriptRepositoryDialog::on_searchScriptEdit_textChanged(const QString &arg1
}

Script ScriptRepositoryDialog::getLastInstalledScript() { return _lastInstalledScript; }

void ScriptRepositoryDialog::checkForScriptUpdates(QWidget *parent) {
auto *dialog = new ScriptRepositoryDialog(parent, true);
dialog->searchForUpdates();
dialog->exec();
delete (dialog);

// Reload the scripting engine
ScriptingService::instance()->reloadEngine();
}
1 change: 1 addition & 0 deletions src/dialogs/scriptrepositorydialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class ScriptRepositoryDialog : public MasterDialog {

void searchForUpdates();
void searchForUpdatesForScripts(const QList<Script> &scripts);
static void checkForScriptUpdates(QWidget *parent = nullptr);

signals:
void updateFound();
Expand Down
4 changes: 3 additions & 1 deletion src/dialogs/settingsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3778,7 +3778,9 @@ void SettingsDialog::searchScriptInRepository(bool checkForUpdates) {
/**
* Opens a dialog to check for script updates
*/
void SettingsDialog::checkForScriptUpdates() { searchScriptInRepository(true); }
void SettingsDialog::checkForScriptUpdates() {
ScriptRepositoryDialog::checkForScriptUpdates(this);
}

/**
* Saves the enabled state of all items and reload the current script page to
Expand Down
8 changes: 1 addition & 7 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11139,13 +11139,7 @@ void MainWindow::setMenuEnabled(QMenu *menu, bool enabled) {
}

void MainWindow::on_actionCheck_for_script_updates_triggered() {
auto *dialog = new ScriptRepositoryDialog(this, true);
dialog->searchForUpdates();
dialog->exec();
delete (dialog);

// Reload the scripting engine
ScriptingService::instance()->reloadEngine();
ScriptRepositoryDialog::checkForScriptUpdates(this);
}

/**
Expand Down

0 comments on commit d664e65

Please sign in to comment.