Commit 031b794e authored by Michael Eden's avatar Michael Eden Committed by Albert Astals Cid

Expose 'change colors' through dbus interface

Summary:
This exposes the Okular's functionality of changing the document's colors
through its d-bus interface. This is mainly useful for scripting Okular to
switch to a 'day mode' or 'night mode'.

[Example] Switching themes of two applications with one hotkey:

{F5905771}

Reviewers: #okular, aacid

Reviewed By: #okular, aacid

Subscribers: okular-devel

Tags: #okular

Differential Revision: https://phabricator.kde.org/D13471
parent 862b2ab6
......@@ -2848,6 +2848,15 @@ void Part::slotPreferences()
dialog->show();
}
void Part::slotToggleChangeColors()
{
m_pageView->slotToggleChangeColors();
}
void Part::slotSetChangeColors(bool active)
{
m_pageView->slotSetChangeColors(active);
}
void Part::slotAnnotationPreferences()
{
......
......@@ -163,6 +163,8 @@ class OKULARPART_EXPORT Part : public KParts::ReadWritePart, public Okular::Docu
Q_SCRIPTABLE void slotGotoFirst();
Q_SCRIPTABLE void slotGotoLast();
Q_SCRIPTABLE void slotTogglePresentation();
Q_SCRIPTABLE void slotToggleChangeColors();
Q_SCRIPTABLE void slotSetChangeColors(bool active);
Q_SCRIPTABLE Q_NOREPLY void reload();
Q_SCRIPTABLE Q_NOREPLY void enableStartWithPrint();
Q_SCRIPTABLE Q_NOREPLY void enableExitAfterPrint();
......
......@@ -5498,13 +5498,18 @@ void PageView::slotProcessRenditionAction( const Okular::RenditionAction *action
};
}
void PageView::slotToggleChangeColors()
void PageView::slotSetChangeColors(bool active)
{
Okular::SettingsCore::setChangeColors( !Okular::SettingsCore::changeColors() );
Okular::SettingsCore::setChangeColors(active);
Okular::Settings::self()->save();
viewport()->update();
}
void PageView::slotToggleChangeColors()
{
slotSetChangeColors( !Okular::SettingsCore::changeColors() );
}
void PageView::slotFitWindowToPage()
{
PageViewItem currentPageItem = nullptr;
......
......@@ -124,6 +124,9 @@ Q_OBJECT
void openAnnotationWindow( Okular::Annotation *annotation, int pageNumber );
void reloadForms();
void slotToggleChangeColors();
void slotSetChangeColors(bool active);
Q_SIGNALS:
void rightClick( const Okular::Page *, const QPoint & );
void mouseBackButtonClick();
......@@ -269,7 +272,6 @@ Q_OBJECT
void slotAnnotationWindowDestroyed( QObject *window );
void slotProcessMovieAction( const Okular::MovieAction *action );
void slotProcessRenditionAction( const Okular::RenditionAction *action );
void slotToggleChangeColors();
void slotFitWindowToPage();
};
......
Markdown is supported
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