diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -197,7 +197,7 @@ core/chooseenginewidget.ui ) -kconfig_add_kcfg_files(okularcore_SRCS conf/settings_core.kcfgc ) +kconfig_add_kcfg_files(okularcore_SRCS conf/settings_core.kcfgc) add_library(okularcore SHARED ${okularcore_SRCS}) generate_export_header(okularcore BASE_NAME okularcore EXPORT_FILE_NAME "${CMAKE_CURRENT_BINARY_DIR}/core/okularcore_export.h") @@ -323,7 +323,7 @@ conf/dlgpresentationbase.ui ) -kconfig_add_kcfg_files(okularpart_SRCS conf/settings.kcfgc ) +kconfig_add_kcfg_files(okularpart_SRCS conf/settings.kcfgc) add_library(okularpart SHARED ${okularpart_SRCS}) generate_export_header(okularpart BASE_NAME okularpart) diff --git a/conf/dlggeneral.h b/conf/dlggeneral.h --- a/conf/dlggeneral.h +++ b/conf/dlggeneral.h @@ -24,6 +24,9 @@ explicit DlgGeneral( QWidget * parent, Okular::EmbedMode embedMode ); virtual ~DlgGeneral(); + public slots: + void setCustomBackgroundColorButton( bool value ); + protected: void showEvent( QShowEvent * ) override; diff --git a/conf/dlggeneral.cpp b/conf/dlggeneral.cpp --- a/conf/dlggeneral.cpp +++ b/conf/dlggeneral.cpp @@ -14,13 +14,16 @@ #include #include "ui_dlggeneralbase.h" +#include "settings.h" DlgGeneral::DlgGeneral( QWidget * parent, Okular::EmbedMode embedMode ) : QWidget( parent ) { m_dlg = new Ui_DlgGeneralBase(); m_dlg->setupUi( this ); + setCustomBackgroundColorButton( Okular::Settings::useCustomBackgroundColor() ); + if( embedMode == Okular::ViewerWidgetMode ) { m_dlg->kcfg_SyncThumbnailsViewport->setVisible( false ); @@ -48,3 +51,7 @@ #endif } +void DlgGeneral::setCustomBackgroundColorButton( bool value ) +{ + m_dlg->kcfg_BackgroundColor->setEnabled( value ); +} diff --git a/conf/dlggeneralbase.ui b/conf/dlggeneralbase.ui --- a/conf/dlggeneralbase.ui +++ b/conf/dlggeneralbase.ui @@ -2,12 +2,15 @@ DlgGeneralBase + + true + 0 0 558 - 575 + 632 @@ -140,6 +143,30 @@ + + + + 6 + + + 0 + + + + + false + + + + + + + Use custom background color + + + + + @@ -439,9 +466,39 @@ + + + KColorButton + QPushButton +
kcolorbutton.h
+ + useDefaultBackgroundColor() + +
+
kiconloader.h - + + + kcfg_UseCustomBackgroundColor + toggled(bool) + DlgGeneralBase + setCustomBackgroundColorButton(bool) + + + 130 + 229 + + + 203 + -9 + + + + + + setCustomBackgroundColorButton(bool) +
diff --git a/conf/okular.kcfg b/conf/okular.kcfg --- a/conf/okular.kcfg +++ b/conf/okular.kcfg @@ -290,6 +290,11 @@ false + + false + + + diff --git a/ui/pageview.cpp b/ui/pageview.cpp --- a/ui/pageview.cpp +++ b/ui/pageview.cpp @@ -3416,7 +3416,12 @@ void PageView::drawDocumentOnPainter( const QRect & contentsRect, QPainter * p ) { - QColor backColor = viewport()->palette().color( QPalette::Dark ); + QColor backColor; + + if ( Okular::Settings::useCustomBackgroundColor() ) + backColor = Okular::Settings::backgroundColor(); + else + backColor = viewport()->palette().color( QPalette::Dark ); // when checking if an Item is contained in contentsRect, instead of // growing PageViewItems rects (for keeping outline into account), we