From b246c66ee0ddaf08667268362c3631c9209290ba Mon Sep 17 00:00:00 2001 From: Patrizio Bekerle Date: Mon, 18 Mar 2024 19:19:08 +0100 Subject: [PATCH] #2986 add: line-edit clear icon for dark-mode to dialogs --- CHANGELOG.md | 7 ++++++- src/dialogs/aboutdialog.cpp | 1 + src/dialogs/actiondialog.cpp | 1 + src/dialogs/attachmentdialog.cpp | 1 + src/dialogs/dictionarymanagerdialog.cpp | 1 + src/dialogs/evernoteimportdialog.cpp | 1 + src/dialogs/imagedialog.cpp | 1 + src/dialogs/issueassistantdialog.cpp | 1 + src/dialogs/joplinimportdialog.cpp | 1 + src/dialogs/linkdialog.cpp | 1 + src/dialogs/localtrashdialog.cpp | 1 + src/dialogs/masterdialog.cpp | 5 +++++ src/dialogs/masterdialog.h | 2 ++ src/dialogs/nextclouddeckdialog.cpp | 1 + src/dialogs/notedialog.cpp | 1 + src/dialogs/notediffdialog.cpp | 1 + src/dialogs/passworddialog.cpp | 1 + src/dialogs/scriptrepositorydialog.cpp | 1 + src/dialogs/serverbookmarksimportdialog.cpp | 1 + src/dialogs/settingsdialog.cpp | 1 + src/dialogs/sharedialog.cpp | 1 + src/dialogs/storedattachmentsdialog.cpp | 1 + src/dialogs/storedimagesdialog.cpp | 1 + src/dialogs/tabledialog.cpp | 1 + src/dialogs/tagadddialog.cpp | 1 + src/dialogs/tododialog.cpp | 1 + src/dialogs/trashdialog.cpp | 1 + src/dialogs/updatedialog.cpp | 1 + src/dialogs/versiondialog.cpp | 1 + src/dialogs/websockettokendialog.cpp | 3 ++- src/dialogs/websockettokendialog.h | 4 +++- src/dialogs/welcomedialog.cpp | 1 + 32 files changed, 45 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4094f90179..eedf6ab142 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,12 @@ # QOwnNotes Changelog +## 24.3.4 +- For the dark-mode there now is a new icon for the clear button for all line edits, + like the note search field, in the main window and all dialogs + (for [#2986](https://github.com/pbek/QOwnNotes/issues/2986)) + ## 24.3.3 -- added a **new editor color schema** *VSCodium* by @nkahe +- Added a **new editor color schema** *VSCodium* by @nkahe (for [#2982](https://github.com/pbek/QOwnNotes/issues/2982)) ## 24.3.2 diff --git a/src/dialogs/aboutdialog.cpp b/src/dialogs/aboutdialog.cpp index b3f183ab28..3462b50887 100644 --- a/src/dialogs/aboutdialog.cpp +++ b/src/dialogs/aboutdialog.cpp @@ -13,6 +13,7 @@ AboutDialog::AboutDialog(QWidget *parent) : MasterDialog(parent), ui(new Ui::AboutDialog) { ui->setupUi(this); + afterSetupUI(); // load the about.html QFile f(QStringLiteral(":/html/about.html")); diff --git a/src/dialogs/actiondialog.cpp b/src/dialogs/actiondialog.cpp index 4de6f62d35..1111922881 100644 --- a/src/dialogs/actiondialog.cpp +++ b/src/dialogs/actiondialog.cpp @@ -12,6 +12,7 @@ ActionDialog::ActionDialog(QMenuBar *menuBar, QWidget *parent) : MasterDialog(parent), ui(new Ui::ActionDialog) { _menuBar = menuBar; ui->setupUi(this); + afterSetupUI(); refreshUi(); } diff --git a/src/dialogs/attachmentdialog.cpp b/src/dialogs/attachmentdialog.cpp index 2644a1b4c8..ac404534c4 100644 --- a/src/dialogs/attachmentdialog.cpp +++ b/src/dialogs/attachmentdialog.cpp @@ -13,6 +13,7 @@ AttachmentDialog::AttachmentDialog(QWidget *parent) : MasterDialog(parent), ui(new Ui::AttachmentDialog) { ui->setupUi(this); + afterSetupUI(); ui->fileEdit->setFocus(); ui->downloadButton->hide(); ui->downloadFrame->hide(); diff --git a/src/dialogs/dictionarymanagerdialog.cpp b/src/dialogs/dictionarymanagerdialog.cpp index f0fc2e3d18..d3197e19e9 100644 --- a/src/dialogs/dictionarymanagerdialog.cpp +++ b/src/dialogs/dictionarymanagerdialog.cpp @@ -18,6 +18,7 @@ DictionaryManagerDialog::DictionaryManagerDialog(QWidget *parent) : MasterDialog(parent), ui(new Ui::DictionaryManagerDialog) { ui->setupUi(this); + afterSetupUI(); setupMainSplitter(); _networkManager = new QNetworkAccessManager(this); diff --git a/src/dialogs/evernoteimportdialog.cpp b/src/dialogs/evernoteimportdialog.cpp index 430bed763e..f5de6ff6f8 100644 --- a/src/dialogs/evernoteimportdialog.cpp +++ b/src/dialogs/evernoteimportdialog.cpp @@ -22,6 +22,7 @@ EvernoteImportDialog::EvernoteImportDialog(QWidget *parent) : MasterDialog(parent), ui(new Ui::EvernoteImportDialog) { ui->setupUi(this); + afterSetupUI(); setupMetaDataTreeWidgetItems(); resetNoteCount(); _mediaFileDataHash.clear(); diff --git a/src/dialogs/imagedialog.cpp b/src/dialogs/imagedialog.cpp index 19405ae57c..151b483558 100644 --- a/src/dialogs/imagedialog.cpp +++ b/src/dialogs/imagedialog.cpp @@ -18,6 +18,7 @@ ImageDialog::ImageDialog(QWidget *parent) : MasterDialog(parent), ui(new Ui::Ima _rubberBand = nullptr; ui->setupUi(this); + afterSetupUI(); ui->fileEdit->setFocus(); ui->previewFrame->setVisible(false); ui->toolFrame->hide(); diff --git a/src/dialogs/issueassistantdialog.cpp b/src/dialogs/issueassistantdialog.cpp index 5972b7ccd4..a34dbd6ebd 100644 --- a/src/dialogs/issueassistantdialog.cpp +++ b/src/dialogs/issueassistantdialog.cpp @@ -17,6 +17,7 @@ IssueAssistantDialog::IssueAssistantDialog(QWidget *parent) : MasterDialog(parent), ui(new Ui::IssueAssistantDialog) { ui->setupUi(this); + afterSetupUI(); ui->backButton->setEnabled(false); ui->nextButton->setEnabled(false); diff --git a/src/dialogs/joplinimportdialog.cpp b/src/dialogs/joplinimportdialog.cpp index c6ba35227f..0fd9eaca50 100644 --- a/src/dialogs/joplinimportdialog.cpp +++ b/src/dialogs/joplinimportdialog.cpp @@ -16,6 +16,7 @@ JoplinImportDialog::JoplinImportDialog(QWidget* parent) : MasterDialog(parent), ui(new Ui::JoplinImportDialog) { ui->setupUi(this); + afterSetupUI(); ui->progressBar->hide(); ui->progressBar->setMinimum(0); diff --git a/src/dialogs/linkdialog.cpp b/src/dialogs/linkdialog.cpp index 8e5b3a57e3..6f5a063621 100644 --- a/src/dialogs/linkdialog.cpp +++ b/src/dialogs/linkdialog.cpp @@ -21,6 +21,7 @@ LinkDialog::LinkDialog(int page, const QString &dialogTitle, QWidget *parent) : MasterDialog(parent), ui(new Ui::LinkDialog) { ui->setupUi(this); + afterSetupUI(); ui->tabWidget->setCurrentIndex(page); on_tabWidget_currentChanged(page); ui->downloadProgressBar->hide(); diff --git a/src/dialogs/localtrashdialog.cpp b/src/dialogs/localtrashdialog.cpp index 3647097f55..c10f08871c 100644 --- a/src/dialogs/localtrashdialog.cpp +++ b/src/dialogs/localtrashdialog.cpp @@ -31,6 +31,7 @@ class LocalTrashTreeWidgetItem : public QTreeWidgetItem { LocalTrashDialog::LocalTrashDialog(QWidget *parent) : MasterDialog(parent), ui(new Ui::LocalTrashDialog) { ui->setupUi(this); + afterSetupUI(); // init the note browser search frame ui->noteBrowser->initSearchFrame(ui->noteBrowserSearchFrame); diff --git a/src/dialogs/masterdialog.cpp b/src/dialogs/masterdialog.cpp index 840f8bcd5e..ef227f5522 100644 --- a/src/dialogs/masterdialog.cpp +++ b/src/dialogs/masterdialog.cpp @@ -7,6 +7,7 @@ #include #include "services/metricsservice.h" +#include "utils/gui.h" MasterDialog::MasterDialog(QWidget *parent) : QDialog(parent) { installEventFilter(this); } @@ -15,6 +16,10 @@ void MasterDialog::closeEvent(QCloseEvent *event) { QDialog::closeEvent(event); } +void MasterDialog::afterSetupUI() { + Utils::Gui::fixDarkModeIcons(this); +} + void MasterDialog::resizeEvent(QResizeEvent *event) { // save the geometry of the dialog storeGeometrySettings(); diff --git a/src/dialogs/masterdialog.h b/src/dialogs/masterdialog.h index 99e6c74796..974e7806c7 100644 --- a/src/dialogs/masterdialog.h +++ b/src/dialogs/masterdialog.h @@ -31,6 +31,8 @@ class MasterDialog : public QDialog { virtual void keyPressEvent(QKeyEvent *keyEvent) override; + void afterSetupUI(); + public: void setIgnoreReturnKey(bool ignore); }; diff --git a/src/dialogs/nextclouddeckdialog.cpp b/src/dialogs/nextclouddeckdialog.cpp index d8808c9c47..d229b29d5c 100644 --- a/src/dialogs/nextclouddeckdialog.cpp +++ b/src/dialogs/nextclouddeckdialog.cpp @@ -9,6 +9,7 @@ NextcloudDeckDialog::NextcloudDeckDialog(QWidget *parent) : MasterDialog(parent), ui(new Ui::NextcloudDeckDialog) { ui->setupUi(this); + afterSetupUI(); ui->dueDateTimeEdit->setDateTime(QDateTime::currentDateTime()); ui->saveButton->setEnabled(false); ui->dueDateTimeCheckBox->setChecked(true); diff --git a/src/dialogs/notedialog.cpp b/src/dialogs/notedialog.cpp index 5c31286a65..7f9d295071 100644 --- a/src/dialogs/notedialog.cpp +++ b/src/dialogs/notedialog.cpp @@ -12,6 +12,7 @@ NoteDialog::NoteDialog(QWidget *parent) : MasterDialog(parent), ui(new Ui::NoteDialog) { ui->setupUi(this); + afterSetupUI(); ui->textEdit->initSearchFrame(ui->searchFrame); ui->textEdit->setReadOnly(true); ui->tabWidget->setCurrentIndex(QSettings().value("NoteDialog/tabWidgetIndex").toInt()); diff --git a/src/dialogs/notediffdialog.cpp b/src/dialogs/notediffdialog.cpp index a574a68096..a89ff7fdd6 100644 --- a/src/dialogs/notediffdialog.cpp +++ b/src/dialogs/notediffdialog.cpp @@ -13,6 +13,7 @@ NoteDiffDialog::NoteDiffDialog(QWidget *parent, const QString &html) : MasterDialog(parent), ui(new Ui::NoteDiffDialog) { ui->setupUi(this); + afterSetupUI(); _notificationButtonGroup = new QButtonGroup(this); _notificationButtonGroup->addButton(ui->ignoreAllExternalChangesCheckBox); diff --git a/src/dialogs/passworddialog.cpp b/src/dialogs/passworddialog.cpp index 9c4acac3f5..8f0ed2dad9 100644 --- a/src/dialogs/passworddialog.cpp +++ b/src/dialogs/passworddialog.cpp @@ -9,6 +9,7 @@ PasswordDialog::PasswordDialog(QWidget *parent, const QString &labelText, bool d _doubleEnterPassword = doubleEnterPassword; ui->setupUi(this); + afterSetupUI(); // Set focus to the password line edit manually, because focus by tab order // was not working for release builds diff --git a/src/dialogs/scriptrepositorydialog.cpp b/src/dialogs/scriptrepositorydialog.cpp index 177bc6caa5..2dbecc3fdf 100644 --- a/src/dialogs/scriptrepositorydialog.cpp +++ b/src/dialogs/scriptrepositorydialog.cpp @@ -26,6 +26,7 @@ ScriptRepositoryDialog::ScriptRepositoryDialog(QWidget *parent, bool checkForUpdates) : MasterDialog(parent), ui(new Ui::ScriptRepositoryDialog) { ui->setupUi(this); + afterSetupUI(); setupMainSplitter(); _codeSearchUrl = QLatin1String("https://api.github.com/search/code"); diff --git a/src/dialogs/serverbookmarksimportdialog.cpp b/src/dialogs/serverbookmarksimportdialog.cpp index 07765c9ad8..45313b40fc 100644 --- a/src/dialogs/serverbookmarksimportdialog.cpp +++ b/src/dialogs/serverbookmarksimportdialog.cpp @@ -12,6 +12,7 @@ ServerBookmarksImportDialog::ServerBookmarksImportDialog(const QJSValue &bookmarks, QWidget *parent) : MasterDialog(parent), ui(new Ui::ServerBookmarksImportDialog) { ui->setupUi(this); + afterSetupUI(); ui->infoLabel->clear(); // init the iterator for the versions diff --git a/src/dialogs/settingsdialog.cpp b/src/dialogs/settingsdialog.cpp index 6d8be0883b..980a8cb42b 100644 --- a/src/dialogs/settingsdialog.cpp +++ b/src/dialogs/settingsdialog.cpp @@ -60,6 +60,7 @@ SettingsDialog::SettingsDialog(int page, QWidget *parent) : MasterDialog(parent), ui(new Ui::SettingsDialog) { ui->setupUi(this); + afterSetupUI(); bool fromWelcomeDialog = parent->objectName() == QLatin1String("WelcomeDialog"); diff --git a/src/dialogs/sharedialog.cpp b/src/dialogs/sharedialog.cpp index dbf43f0391..3f714c9de2 100644 --- a/src/dialogs/sharedialog.cpp +++ b/src/dialogs/sharedialog.cpp @@ -11,6 +11,7 @@ ShareDialog::ShareDialog(const Note ¬e, QWidget *parent) : MasterDialog(parent), ui(new Ui::ShareDialog) { ui->setupUi(this); + afterSetupUI(); this->note = note; // update the share link checkbox and link url line edit diff --git a/src/dialogs/storedattachmentsdialog.cpp b/src/dialogs/storedattachmentsdialog.cpp index c569ce5724..0e40f6c572 100644 --- a/src/dialogs/storedattachmentsdialog.cpp +++ b/src/dialogs/storedattachmentsdialog.cpp @@ -25,6 +25,7 @@ StoredAttachmentsDialog::StoredAttachmentsDialog(QWidget *parent) : MasterDialog(parent), ui(new Ui::StoredAttachmentsDialog) { ui->setupUi(this); + afterSetupUI(); ui->infoFrame->setEnabled(false); ui->fileTreeWidget->installEventFilter(this); diff --git a/src/dialogs/storedimagesdialog.cpp b/src/dialogs/storedimagesdialog.cpp index 536a30398a..d589281239 100644 --- a/src/dialogs/storedimagesdialog.cpp +++ b/src/dialogs/storedimagesdialog.cpp @@ -22,6 +22,7 @@ StoredImagesDialog::StoredImagesDialog(QWidget *parent) : MasterDialog(parent), ui(new Ui::StoredImagesDialog) { ui->setupUi(this); + afterSetupUI(); ui->fileTreeWidget->installEventFilter(this); ui->noteTreeWidget->installEventFilter(this); diff --git a/src/dialogs/tabledialog.cpp b/src/dialogs/tabledialog.cpp index 9653f67d08..ff033e2c19 100644 --- a/src/dialogs/tabledialog.cpp +++ b/src/dialogs/tabledialog.cpp @@ -12,6 +12,7 @@ TableDialog::TableDialog(QWidget *parent) : MasterDialog(parent), ui(new Ui::TableDialog) { ui->setupUi(this); + afterSetupUI(); // ignore the return key so we can better edit text in the table setIgnoreReturnKey(true); diff --git a/src/dialogs/tagadddialog.cpp b/src/dialogs/tagadddialog.cpp index 9def86c8a7..a942d43eae 100644 --- a/src/dialogs/tagadddialog.cpp +++ b/src/dialogs/tagadddialog.cpp @@ -4,6 +4,7 @@ TagAddDialog::TagAddDialog(QWidget *parent) : MasterDialog(parent), ui(new Ui::TagAddDialog) { ui->setupUi(this); + afterSetupUI(); ui->nameLineEdit->setFocus(); resize(1, 1); } diff --git a/src/dialogs/tododialog.cpp b/src/dialogs/tododialog.cpp index 5805f15801..efd67d3c90 100644 --- a/src/dialogs/tododialog.cpp +++ b/src/dialogs/tododialog.cpp @@ -20,6 +20,7 @@ TodoDialog::TodoDialog(const QString &taskUid, QWidget *parent) : MasterDialog(parent), ui(new Ui::TodoDialog) { ui->setupUi(this); + afterSetupUI(); setupUi(); connect(ui->todoItemTreeWidget, &TodoItemTreeWidget::calendarItemUpdated, this, diff --git a/src/dialogs/trashdialog.cpp b/src/dialogs/trashdialog.cpp index ef3a1ef44d..cd03a56cd6 100644 --- a/src/dialogs/trashdialog.cpp +++ b/src/dialogs/trashdialog.cpp @@ -17,6 +17,7 @@ TrashDialog::TrashDialog(const QJSValue ¬es, QWidget *parent) : MasterDialog(parent), ui(new Ui::TrashDialog) { ui->setupUi(this); + afterSetupUI(); // init the note browser search frame ui->noteBrowser->initSearchFrame(ui->noteBrowserSearchFrame); diff --git a/src/dialogs/updatedialog.cpp b/src/dialogs/updatedialog.cpp index 172cd43217..0b8d01a1b5 100644 --- a/src/dialogs/updatedialog.cpp +++ b/src/dialogs/updatedialog.cpp @@ -23,6 +23,7 @@ UpdateDialog::UpdateDialog(QWidget *parent, const QString &changesHtml, const QS const QString &releaseVersionString) : MasterDialog(parent), ui(new Ui::UpdateDialog) { ui->setupUi(this); + afterSetupUI(); ui->downloadProgressBar->hide(); #if !defined(Q_OS_WIN) diff --git a/src/dialogs/versiondialog.cpp b/src/dialogs/versiondialog.cpp index 6af5390a1d..bface0adee 100644 --- a/src/dialogs/versiondialog.cpp +++ b/src/dialogs/versiondialog.cpp @@ -15,6 +15,7 @@ VersionDialog::VersionDialog(const QJSValue &versions, QWidget *parent) : MasterDialog(parent), ui(new Ui::VersionDialog) { ui->setupUi(this); + afterSetupUI(); setWindowTitle(Utils::Misc::replaceOwnCloudText(windowTitle())); ui->tabWidget->setCurrentIndex(0); diff --git a/src/dialogs/websockettokendialog.cpp b/src/dialogs/websockettokendialog.cpp index 09bc65f7e2..0329428f53 100644 --- a/src/dialogs/websockettokendialog.cpp +++ b/src/dialogs/websockettokendialog.cpp @@ -8,8 +8,9 @@ #include "ui_websockettokendialog.h" WebSocketTokenDialog::WebSocketTokenDialog(QWidget *parent) - : QDialog(parent), ui(new Ui::WebSocketTokenDialog) { + : MasterDialog(parent), ui(new Ui::WebSocketTokenDialog) { ui->setupUi(this); + afterSetupUI(); QSettings settings; QString token = settings.value(QStringLiteral("webSocketServerService/token")).toString(); diff --git a/src/dialogs/websockettokendialog.h b/src/dialogs/websockettokendialog.h index a295edd511..4a938bb3c4 100644 --- a/src/dialogs/websockettokendialog.h +++ b/src/dialogs/websockettokendialog.h @@ -3,11 +3,13 @@ #include +#include "masterdialog.h" + namespace Ui { class WebSocketTokenDialog; } -class WebSocketTokenDialog : public QDialog { +class WebSocketTokenDialog : public MasterDialog { Q_OBJECT public: diff --git a/src/dialogs/welcomedialog.cpp b/src/dialogs/welcomedialog.cpp index 7464480296..d3488b3283 100644 --- a/src/dialogs/welcomedialog.cpp +++ b/src/dialogs/welcomedialog.cpp @@ -14,6 +14,7 @@ WelcomeDialog::WelcomeDialog(QWidget *parent) : MasterDialog(parent), ui(new Ui::WelcomeDialog) { ui->setupUi(this); + afterSetupUI(); ui->layoutWidget->setManualSettingsStoring(false); // replace ownCloud text