Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/desktop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudio Cambra <claudio.cambra@gmail.com>2022-02-15 15:53:39 +0300
committerClaudio Cambra <claudio.cambra@gmail.com>2022-03-18 14:08:12 +0300
commit97801a5acbbeb22c8c9280a69f7ef61aaaa8aabc (patch)
treec873a89ac1d9d537f7bcc4e3ed96306cc92cda5f
parent924d65e5f03d4dc103b518f6ab81f7bb90b28a91 (diff)
Fix warn colour in dark mode
Signed-off-by: Claudio Cambra <claudio.cambra@gmail.com>
-rw-r--r--src/gui/folderwizard.cpp27
-rw-r--r--src/gui/folderwizard.h6
2 files changed, 33 insertions, 0 deletions
diff --git a/src/gui/folderwizard.cpp b/src/gui/folderwizard.cpp
index b240d7235..b10752621 100644
--- a/src/gui/folderwizard.cpp
+++ b/src/gui/folderwizard.cpp
@@ -77,6 +77,8 @@ FolderWizardLocalPath::FolderWizardLocalPath(const AccountPtr &account)
_ui.warnLabel->setTextFormat(Qt::RichText);
_ui.warnLabel->hide();
+
+ changeStyle();
}
FolderWizardLocalPath::~FolderWizardLocalPath() = default;
@@ -141,6 +143,31 @@ void FolderWizardLocalPath::slotChooseLocalFolder()
emit completeChanged();
}
+
+void FolderWizardLocalPath::changeEvent(QEvent *e)
+{
+ switch (e->type()) {
+ case QEvent::StyleChange:
+ case QEvent::PaletteChange:
+ case QEvent::ThemeChange:
+ // Notify the other widgets (Dark-/Light-Mode switching)
+ changeStyle();
+ break;
+ default:
+ break;
+ }
+
+ FormatWarningsWizardPage::changeEvent(e);
+}
+
+void FolderWizardLocalPath::changeStyle()
+{
+ const auto warnYellow = Theme::isDarkColor(QGuiApplication::palette().base().color()) ? QColor(63, 63, 0) : QColor(255, 255, 192);
+ auto modifiedPalette = _ui.warnLabel->palette();
+ modifiedPalette.setColor(QPalette::Window, warnYellow);
+ _ui.warnLabel->setPalette(modifiedPalette);
+}
+
// =================================================================================
FolderWizardRemotePath::FolderWizardRemotePath(const AccountPtr &account)
: FormatWarningsWizardPage()
diff --git a/src/gui/folderwizard.h b/src/gui/folderwizard.h
index c6e7d48ce..72b83e3e3 100644
--- a/src/gui/folderwizard.h
+++ b/src/gui/folderwizard.h
@@ -60,10 +60,16 @@ public:
void cleanupPage() override;
void setFolderMap(const Folder::Map &fm) { _folderMap = fm; }
+
+protected:
+ void changeEvent(QEvent *) override;
+
protected slots:
void slotChooseLocalFolder();
private:
+ void changeStyle();
+
Ui_FolderWizardSourcePage _ui;
Folder::Map _folderMap;
AccountPtr _account;