Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 255632
Collapse All | Expand All

(-)file_not_specified_in_diff (-13 / +82 lines)
Line  Link Here
0
-- src/gui/kernel/qapplication_x11.cpp
0
++ src/gui/kernel/qapplication_x11.cpp
Lines 632-637 Link Here
632
}
632
}
633
633
634
/*! \internal
634
/*! \internal
635
    Gets the current KDE 3 or 4 home path
636
*/
637
QString QApplicationPrivate::kdeHome()
638
{
639
    static QString kdeHomePath;
640
    if (kdeHomePath.isEmpty()) {
641
        kdeHomePath = QString::fromLocal8Bit(qgetenv("KDEHOME"));
642
        if (kdeHomePath.isEmpty()) {
643
            QString session = QString::fromLocal8Bit(qgetenv("DESKTOP_SESSION"));
644
            QDir homeDir(QDir::homePath());
645
            QString kdeConfDir(QLatin1String("/.kde"));
646
            if (session == QLatin1String("kde4") && homeDir.exists(QLatin1String(".kde4")))
647
                kdeConfDir = QLatin1String("/.kde4");
648
            kdeHomePath = QDir::homePath() + kdeConfDir;
649
        }
650
    }
651
    return kdeHomePath;
652
}
653
654
/*! \internal
635
    apply the settings to the application
655
    apply the settings to the application
636
*/
656
*/
637
bool QApplicationPrivate::x11_apply_settings()
657
bool QApplicationPrivate::x11_apply_settings()
Lines 689-699 Link Here
689
    if (groupCount == QPalette::NColorGroups)
709
    if (groupCount == QPalette::NColorGroups)
690
        QApplicationPrivate::setSystemPalette(pal);
710
        QApplicationPrivate::setSystemPalette(pal);
691
711
712
    QString session = QString::fromLocal8Bit(qgetenv("DESKTOP_SESSION"));
713
692
    if (!appFont) {
714
    if (!appFont) {
693
        QString str = settings.value(QLatin1String("font")).toString();
715
        QFont font(QApplication::font());
694
        if (!str.isEmpty()) {
716
        QString fontDescription;
695
            QFont font(QApplication::font());
717
        // Override Qt font if KDE4 settings can be used
696
            font.fromString(str);
718
        if (session == QLatin1String("kde4")) {
719
            QSettings kdeSettings(kdeHome() + QLatin1String("/share/config/kdeglobals"), QSettings::IniFormat);
720
            fontDescription = kdeSettings.value(QLatin1String("font")).toString();
721
            if (fontDescription.isEmpty()) {
722
                // KDE stores fonts without quotes
723
                fontDescription = kdeSettings.value(QLatin1String("font")).toStringList().join(QLatin1String(","));
724
            }
725
        }
726
        if (fontDescription.isEmpty())
727
            fontDescription = settings.value(QLatin1String("font")).toString();
728
        if (!fontDescription .isEmpty()) {
729
            font.fromString(fontDescription );
697
            QApplicationPrivate::setSystemFont(font);
730
            QApplicationPrivate::setSystemFont(font);
698
        }
731
        }
699
    }
732
    }
Lines 712-717 Link Here
712
745
713
    // read new QStyle
746
    // read new QStyle
714
    QString stylename = settings.value(QLatin1String("style")).toString();
747
    QString stylename = settings.value(QLatin1String("style")).toString();
748
    if (stylename.isEmpty() && !QApplicationPrivate::styleOverride && X11->use_xrender) {
749
        QStringList availableStyles = QStyleFactory::keys();
750
        // Override Qt style if KDE4 settings can be used
751
        if (session == QLatin1String("kde4")) {
752
            QSettings kdeSettings(kdeHome() + QLatin1String("/share/config/kdeglobals"), QSettings::IniFormat);
753
            QString kde4Style = kdeSettings.value(QLatin1String("widgetStyle"),
754
                                                  QLatin1String("Oxygen")).toString();
755
            foreach (const QString style, availableStyles) {
756
                if (style.toLower() == kde4Style.toLower())
757
                    stylename = kde4Style;
758
            }
759
        // Set QGtkStyle for GNOME
760
        } else if (X11->desktopEnvironment == DE_GNOME) {
761
            QString gtkStyleKey = QString::fromLatin1("GTK+");
762
            if (availableStyles.contains(gtkStyleKey))
763
                stylename = gtkStyleKey;
764
        }
765
    }
766
715
    if (QCoreApplication::startingUp()) {
767
    if (QCoreApplication::startingUp()) {
716
        if (!stylename.isEmpty() && !QApplicationPrivate::styleOverride)
768
        if (!stylename.isEmpty() && !QApplicationPrivate::styleOverride)
717
            QApplicationPrivate::styleOverride = new QString(stylename);
769
            QApplicationPrivate::styleOverride = new QString(stylename);
Lines 859-872 Link Here
859
        XFree((char *)data);
911
        XFree((char *)data);
860
}
912
}
861
913
862
// Reads a KDE3 color setting
914
// Reads a KDE color setting
863
static QColor kdeColor(const QString &key)
915
static QColor kdeColor(const QString &key)
864
{
916
{
865
    QString kdeHome = QString::fromLocal8Bit(qgetenv("KDEHOME"));
917
    QSettings kdeSettings(QApplicationPrivate::kdeHome() +
866
    if (kdeHome.isEmpty())
918
                          QLatin1String("/share/config/kdeglobals"), QSettings::IniFormat);
867
        kdeHome = QDir::homePath() + QLatin1String("/.kde");
919
    QVariant variant = kdeSettings.value(key);
868
    QSettings settings(kdeHome + QLatin1String("/share/config/kdeglobals"), QSettings::IniFormat);
869
    QVariant variant = settings.value(key);
870
    if (variant.isValid()) {
920
    if (variant.isValid()) {
871
        QStringList values = variant.toStringList();
921
        QStringList values = variant.toStringList();
872
        if (values.size() == 3) {
922
        if (values.size() == 3) {
Lines 1088-1110 Link Here
1088
            // Setup KDE palette
1588
            // Setup KDE palette
1089
            QColor color;
1589
            QColor color;
1090
            color = kdeColor(QLatin1String("buttonBackground"));
1590
            color = kdeColor(QLatin1String("buttonBackground"));
1591
            if (!color.isValid())
1592
                color = kdeColor(QLatin1String("Colors:Button/BackgroundNormal"));
1091
            if (color.isValid())
1593
            if (color.isValid())
1092
                btn = color;
1594
                btn = color;
1093
1595
1094
            color = kdeColor(QLatin1String("background"));
1596
            color = kdeColor(QLatin1String("background"));
1597
            if (!color.isValid())
1598
                color = kdeColor(QLatin1String("Colors:Window/BackgroundNormal"));
1095
            if (color.isValid())
1599
            if (color.isValid())
1096
                bg = color;
1600
                bg = color;
1097
1601
1098
            color = kdeColor(QLatin1String("foreground"));
1602
            color = kdeColor(QLatin1String("foreground"));
1603
            if (!color.isValid())
1604
                color = kdeColor(QLatin1String("Colors:View/ForegroundNormal"));
1099
            if (color.isValid()) {
1605
            if (color.isValid()) {
1100
                fg = color;
1606
                fg = color;
1101
            }
1607
            }
1102
1608
1103
            color = kdeColor(QLatin1String("windowForeground"));
1609
            color = kdeColor(QLatin1String("windowForeground"));
1610
            if (!color.isValid())
1611
                color = kdeColor(QLatin1String("Colors:Window/ForegroundNormal"));
1104
            if (color.isValid())
1612
            if (color.isValid())
1105
                wfg = color;
1613
                wfg = color;
1106
1614
1107
            color = kdeColor(QLatin1String("windowBackground"));
1615
            color = kdeColor(QLatin1String("windowBackground"));
1616
            if (!color.isValid())
1617
                color = kdeColor(QLatin1String("Colors:View/BackgroundNormal"));
1108
            if (color.isValid())
1618
            if (color.isValid())
1109
                base = color;
1619
                base = color;
1110
        }
1620
        }
Lines 1121-1143 Link Here
1121
            highlight = QColor(selectBackground);
1161
            highlight = QColor(selectBackground);
1122
            highlightText = QColor(selectForeground);
1162
            highlightText = QColor(selectForeground);
1123
        }
1163
        }
1124
            // Use KDE3 color settings if present
1164
        // Use KDE3 or KDE4 color settings if present
1125
        if (kdeColors) {
1165
        if (kdeColors) {
1126
            QColor color = kdeColor(QLatin1String("selectBackground"));
1166
            QColor color = kdeColor(QLatin1String("selectBackground"));
1167
            if (!color.isValid())
1168
                color = kdeColor(QLatin1String("Colors:Selection/BackgroundNormal"));
1127
            if (color.isValid())
1169
            if (color.isValid())
1128
                highlight = color;
1170
                highlight = color;
1129
1171
1130
            color = kdeColor(QLatin1String("selectForeground"));
1172
            color = kdeColor(QLatin1String("selectForeground"));
1173
            if (!color.isValid())
1174
                color = kdeColor(QLatin1String("Colors:Selection/ForegroundNormal"));
1131
            if (color.isValid())
1175
            if (color.isValid())
1132
                highlightText = color;
1176
                highlightText = color;
1133
1177
1134
            color = kdeColor(QLatin1String("alternateBackground"));
1178
            color = kdeColor(QLatin1String("alternateBackground"));
1179
            if (!color.isValid())
1180
                color = kdeColor(QLatin1String("Colors:View/BackgroundAlternate"));
1135
            if (color.isValid())
1181
            if (color.isValid())
1136
                pal.setColor(QPalette::AlternateBase, color);
1182
                pal.setColor(QPalette::AlternateBase, color);
1137
            else
1183
            else
1138
                pal.setBrush(QPalette::AlternateBase, pal.base().color().darker(110));
1184
                pal.setBrush(QPalette::AlternateBase, pal.base().color().darker(110));
1139
1185
1140
            color = kdeColor(QLatin1String("buttonForeground"));
1186
            color = kdeColor(QLatin1String("buttonForeground"));
1187
            if (!color.isValid())
1188
                color = kdeColor(QLatin1String("Colors:Button/ForegroundNormal"));
1141
            if (color.isValid())
1189
            if (color.isValid())
1142
                pal.setColor(QPalette::ButtonText, color);
1190
                pal.setColor(QPalette::ButtonText, color);
1143
        }
1191
        }
1144
-- src/gui/kernel/qapplication_p.h
1192
++ src/gui/kernel/qapplication_p.h
Lines 183-188 Link Here
183
183
184
#if defined(Q_WS_X11)
184
#if defined(Q_WS_X11)
185
#ifndef QT_NO_SETTINGS
185
#ifndef QT_NO_SETTINGS
186
    static QString kdeHome();
186
    static bool x11_apply_settings();
187
    static bool x11_apply_settings();
187
#endif
188
#endif
188
    static void reset_instance_pointer();
189
    static void reset_instance_pointer();

Return to bug 255632