From 64f73ffb11de8b497c505b2e080add7e79a38fd8 Mon Sep 17 00:00:00 2001 From: Andreas Suter Date: Thu, 14 Feb 2019 09:35:32 +0100 Subject: [PATCH] find theme in case default channel fail. This is ugly and eventually needs a better solution. --- src/musredit_qt5/musredit/PTextEdit.cpp | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/musredit_qt5/musredit/PTextEdit.cpp b/src/musredit_qt5/musredit/PTextEdit.cpp index b88197ca..3f9d8ade 100644 --- a/src/musredit_qt5/musredit/PTextEdit.cpp +++ b/src/musredit_qt5/musredit/PTextEdit.cpp @@ -3093,8 +3093,31 @@ void PTextEdit::getTheme() fDarkToolBarIcon = false; // needed for ubuntu dark since there the menu icons are dark, however the toolbar icons are plain! QString str = QIcon::themeName(); + qDebug() << "debug> theme name=" << str << endl; - qDebug() << "debug> str=" << str << endl; + if (str.isEmpty()) { // this is ugly and eventually needs to be fixed in a more coherent way + str = QProcessEnvironment::systemEnvironment().value("HOME", QString("??")); + str += "/.kde4/share/config/kdeglobals"; + if (QFile::exists(str)) { + QFile fln(str); + fln.open(QIODevice::ReadOnly | QIODevice::Text); + QTextStream fin(&fln); + QString line(""); + bool done = false; + while (!fin.atEnd() && !done) { + line = fin.readLine(); + if (line.contains("ColorScheme")) { + if (line.contains("dark", Qt::CaseInsensitive)) { + fDarkTheme = true; + fDarkToolBarIcon = true; + } + done = true; + } + } + fln.close(); + } + return; + } if (str.contains("dark", Qt::CaseInsensitive)) { fDarkTheme = true;