Commit fe123f3f authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Update color when theme changed

parent 2d6c1954
Pipeline #158687 passed with stage
in 1 minute and 13 seconds
......@@ -15,9 +15,9 @@ public:
~KNotesAkonadiTray() override;
void updateNumberOfNotes(int number);
void slotGeneralPaletteChanged();
private:
void slotGeneralPaletteChanged();
const QIcon mIcon;
QColor mTextColor;
};
......
......@@ -212,6 +212,9 @@ KNotesApp::KNotesApp(QWidget *parent)
QGuiApplication::setFallbackSessionManagementEnabled(false);
updateNoteActions();
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
connect(qApp, &QGuiApplication::paletteChanged, this, &KNotesApp::slotGeneralPaletteChanged);
#endif
}
KNotesApp::~KNotesApp()
......@@ -227,6 +230,22 @@ KNotesApp::~KNotesApp()
m_publisher = nullptr;
}
void KNotesApp::slotGeneralPaletteChanged()
{
mTray->slotGeneralPaletteChanged();
mTray->updateNumberOfNotes(mNotes.count());
}
bool KNotesApp::event(QEvent *e)
{
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
if (e->type() == QEvent::ApplicationPaletteChange) {
slotGeneralPaletteChanged();
}
#endif
return QWidget::event(e);
}
void KNotesApp::slotDeleteSelectedNotes()
{
QPointer<KNoteDeleteSelectedNotesDialog> dlg = new KNoteDeleteSelectedNotesDialog(this);
......
......@@ -52,6 +52,9 @@ public Q_SLOTS:
void setName(Akonadi::Item::Id id, const QString &newName);
void setText(Akonadi::Item::Id id, const QString &newText);
protected:
Q_REQUIRED_RESULT bool event(QEvent *e) override;
private:
void showNote(KNote *note) const;
......@@ -82,6 +85,7 @@ private Q_SLOTS:
void newNoteFromTextFile();
private:
void slotGeneralPaletteChanged();
void saveNotes(bool force = false, bool sync = false);
void updateNetworkListener();
void updateSystray();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment