Commit c281bf82 authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇

Apply full screen color scheme also to window decoration

Makes use of the KDE_COLOR_SCHEME_PATH property that has KWin apply a given color scheme to the decoration.
Ensures there's no ugly white borders on the otherwise dark confirmation dialogs.

Differential Revision: https://phabricator.kde.org/D7994
parent daf56207
......@@ -64,6 +64,7 @@ struct GvCorePrivate
HistoryModel* mRecentFoldersModel;
RecentFilesModel* mRecentFilesModel;
QPalette mPalettes[4];
QString mFullScreenPaletteName;
bool showSaveAsDialog(const QUrl &url, QUrl* outUrl, QByteArray* format)
{
......@@ -128,14 +129,16 @@ struct GvCorePrivate
QString name = GwenviewConfig::fullScreenColorScheme();
if (name.isEmpty()) {
// Default color scheme
QString path = QStandardPaths::locate(QStandardPaths::AppDataLocation, "color-schemes/fullscreen.colors");
config = KSharedConfig::openConfig(path);
mFullScreenPaletteName = QStandardPaths::locate(QStandardPaths::AppDataLocation, "color-schemes/fullscreen.colors");
config = KSharedConfig::openConfig(mFullScreenPaletteName);
} else if (name.contains('/')) {
// Full path to a .colors file
config = KSharedConfig::openConfig(name);
mFullScreenPaletteName = name;
config = KSharedConfig::openConfig(mFullScreenPaletteName);
} else {
// Standard KDE color scheme
config = KSharedConfig::openConfig(QString("color-schemes/%1.colors").arg(name), KConfig::FullConfig, QStandardPaths::AppDataLocation);
mFullScreenPaletteName = QString("color-schemes/%1.colors").arg(name);
config = KSharedConfig::openConfig(mFullScreenPaletteName, KConfig::FullConfig, QStandardPaths::AppDataLocation);
}
mPalettes[GvCore::FullScreenPalette] = KColorScheme::createApplicationPalette(config);
......@@ -375,4 +378,9 @@ QPalette GvCore::palette(GvCore::PaletteType type) const
return d->mPalettes[type];
}
QString GvCore::fullScreenPaletteName() const
{
return d->mFullScreenPaletteName;
}
} // namespace
......@@ -33,6 +33,7 @@ class QUrl;
class QAbstractItemModel;
class QPalette;
class QString;
namespace Gwenview
{
......@@ -65,6 +66,7 @@ public:
void addUrlToRecentFiles(const QUrl &);
QPalette palette(PaletteType type) const;
QString fullScreenPaletteName() const;
public Q_SLOTS:
void saveAll();
......
......@@ -1278,7 +1278,9 @@ void MainWindow::toggleFullScreen(bool checked)
menuBar()->hide();
toolBar()->hide();
qApp->setProperty("KDE_COLOR_SCHEME_PATH", d->mGvCore->fullScreenPaletteName());
QApplication::setPalette(d->mGvCore->palette(GvCore::FullScreenPalette));
d->mFullScreenContent->setFullScreenMode(true);
d->mBrowseMainPage->setFullScreenMode(true);
d->mViewMainPage->setFullScreenMode(true);
......@@ -1293,7 +1295,9 @@ void MainWindow::toggleFullScreen(bool checked)
setAutoSaveSettings();
// Back to normal
qApp->setProperty("KDE_COLOR_SCHEME_PATH", QVariant());
QApplication::setPalette(d->mGvCore->palette(GvCore::NormalPalette));
d->mFullScreenContent->setFullScreenMode(false);
d->mBrowseMainPage->setFullScreenMode(false);
d->mViewMainPage->setFullScreenMode(false);
......
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