Changeset View
Changeset View
Standalone View
Standalone View
kcms/krdb/krdb.cpp
Show All 31 Lines | |||||
32 | 32 | | |||
33 | #include <QPixmap> | 33 | #include <QPixmap> | ||
34 | #include <QByteArray> | 34 | #include <QByteArray> | ||
35 | #include <QTextStream> | 35 | #include <QTextStream> | ||
36 | #include <QDateTime> | 36 | #include <QDateTime> | ||
37 | #include <QDBusConnection> | 37 | #include <QDBusConnection> | ||
38 | #include <klauncher_iface.h> | 38 | #include <klauncher_iface.h> | ||
39 | 39 | | |||
40 | #include <KColorUtils> | ||||
40 | #include <kcolorscheme.h> | 41 | #include <kcolorscheme.h> | ||
41 | #include <kconfig.h> | 42 | #include <kconfig.h> | ||
42 | #include <kconfiggroup.h> | 43 | #include <kconfiggroup.h> | ||
43 | #include <kprocess.h> | 44 | #include <kprocess.h> | ||
44 | #include <KLocalizedString> | 45 | #include <KLocalizedString> | ||
45 | #include <kdelibs4migration.h> | 46 | #include <kdelibs4migration.h> | ||
46 | #include <KWindowSystem> | 47 | #include <KWindowSystem> | ||
47 | 48 | | |||
▲ Show 20 Lines • Show All 347 Lines • ▼ Show 20 Line(s) | 344 | { | |||
395 | t << "}" << endl; | 396 | t << "}" << endl; | ||
396 | t << endl; | 397 | t << endl; | ||
397 | t << "class \"*MenuItem\" style \"MenuItem\"" << endl; | 398 | t << "class \"*MenuItem\" style \"MenuItem\"" << endl; | ||
398 | t << endl; | 399 | t << endl; | ||
399 | } | 400 | } | ||
400 | saveFile.commit(); | 401 | saveFile.commit(); | ||
401 | } | 402 | } | ||
402 | 403 | | |||
404 | // --------------------------------------------------------------------- | ||||
405 | | ||||
406 | QString gtkColorsHelper(const QString &name, const QString &color) | ||||
407 | { | ||||
408 | return QStringLiteral("@define-color %1 %2;\n").arg(name, color); | ||||
409 | } | ||||
410 | void checkGtkCss() | ||||
411 | { | ||||
412 | QFile gtkCss(QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + "/gtk-3.0/gtk.css"); | ||||
413 | if (gtkCss.open(QIODevice::ReadWrite)) { | ||||
414 | QTextStream gtkStream(>kCss); | ||||
415 | bool hasImport = false; | ||||
416 | while (!gtkStream.atEnd()) { | ||||
417 | QString line = gtkStream.readLine(); | ||||
418 | if (line.contains("@import 'colors.css';")) { | ||||
419 | hasImport = true; | ||||
420 | } | ||||
421 | } | ||||
422 | if (!hasImport) { | ||||
423 | gtkStream << "@import 'colors.css';"; | ||||
424 | } | ||||
425 | } | ||||
426 | } | ||||
427 | void exportGtkColors(QList<KColorScheme> activeColorSchemes, QList<KColorScheme> inactiveColorSchemes, QList<KColorScheme> disabledColorSchemes, KConfigGroup groupWMTheme, QTextStream& colorsStream) | ||||
428 | { | ||||
429 | /* | ||||
430 | Normal (Non Backdrop, Non Insensitive) | ||||
431 | */ | ||||
432 | | ||||
433 | // General Colors | ||||
434 | | ||||
435 | colorsStream << gtkColorsHelper("theme_fg_color", activeColorSchemes[1].foreground(KColorScheme::NormalText).color().name()); | ||||
436 | colorsStream << gtkColorsHelper("theme_bg_color", activeColorSchemes[1].background(KColorScheme::NormalBackground).color().name()); | ||||
437 | colorsStream << gtkColorsHelper("theme_text_color", activeColorSchemes[0].foreground(KColorScheme::NormalText).color().name()); | ||||
438 | colorsStream << gtkColorsHelper("theme_base_color", activeColorSchemes[0].background(KColorScheme::NormalBackground).color().name()); | ||||
439 | colorsStream << gtkColorsHelper("theme_view_hover_decoration_color", activeColorSchemes[0].decoration(KColorScheme::HoverColor).color().name()); | ||||
440 | colorsStream << gtkColorsHelper("theme_hovering_selected_bg_color", activeColorSchemes[3].decoration(KColorScheme::HoverColor).color().name()); | ||||
441 | colorsStream << gtkColorsHelper("theme_selected_bg_color", activeColorSchemes[3].background(KColorScheme::NormalBackground).color().name()); | ||||
442 | colorsStream << gtkColorsHelper("theme_selected_fg_color", activeColorSchemes[3].foreground(KColorScheme::NormalText).color().name()); | ||||
443 | colorsStream << gtkColorsHelper("theme_view_active_decoration_color", activeColorSchemes[0].decoration(KColorScheme::HoverColor).color().name()); | ||||
444 | | ||||
445 | // Button Colors | ||||
446 | colorsStream << gtkColorsHelper("theme_button_background_normal", activeColorSchemes[2].background(KColorScheme::NormalBackground).color().name()); | ||||
447 | colorsStream << gtkColorsHelper("theme_button_decoration_hover", activeColorSchemes[2].decoration(KColorScheme::HoverColor).color().name()); | ||||
448 | colorsStream << gtkColorsHelper("theme_button_decoration_focus", activeColorSchemes[2].decoration(KColorScheme::FocusColor).color().name()); | ||||
449 | colorsStream << gtkColorsHelper("theme_button_foreground_normal", activeColorSchemes[2].foreground(KColorScheme::NormalText).color().name()); | ||||
450 | colorsStream << gtkColorsHelper("theme_button_foreground_active", activeColorSchemes[3].foreground(KColorScheme::NormalText).color().name()); | ||||
451 | | ||||
452 | // Misc Colors | ||||
453 | QColor windowForegroundColor = activeColorSchemes[1].foreground(KColorScheme::NormalText).color(); | ||||
454 | QColor windowBackgroundColor = activeColorSchemes[1].background(KColorScheme::NormalBackground).color(); | ||||
455 | QColor bordersColor = KColorUtils::mix(windowBackgroundColor,windowForegroundColor, 0.25); | ||||
456 | | ||||
457 | colorsStream << gtkColorsHelper("borders", bordersColor.name()); | ||||
458 | colorsStream << gtkColorsHelper("warning_color", activeColorSchemes[0].foreground(KColorScheme::NeutralText).color().name()); | ||||
459 | colorsStream << gtkColorsHelper("success_color", activeColorSchemes[0].foreground(KColorScheme::PositiveText).color().name()); | ||||
460 | colorsStream << gtkColorsHelper("error_color", activeColorSchemes[0].foreground(KColorScheme::NegativeText).color().name()); | ||||
461 | | ||||
462 | /* | ||||
463 | Backdrop (Inactive) | ||||
464 | */ | ||||
465 | | ||||
466 | // General | ||||
467 | colorsStream << gtkColorsHelper("theme_unfocused_fg_color",inactiveColorSchemes[1].foreground(KColorScheme::NormalText).color().name()); | ||||
468 | colorsStream << gtkColorsHelper("theme_unfocused_text_color", inactiveColorSchemes[0].foreground(KColorScheme::NormalText).color().name()); | ||||
469 | colorsStream << gtkColorsHelper("theme_unfocused_bg_color", inactiveColorSchemes[1].background(KColorScheme::NormalBackground).color().name()); | ||||
470 | colorsStream << gtkColorsHelper("theme_unfocused_base_color", inactiveColorSchemes[0].background(KColorScheme::NormalBackground).color().name()); | ||||
471 | colorsStream << gtkColorsHelper("theme_unfocused_selected_bg_color_alt", inactiveColorSchemes[3].background(KColorScheme::NormalBackground).color().name()); | ||||
472 | colorsStream << gtkColorsHelper("theme_unfocused_selected_bg_color", inactiveColorSchemes[3].background(KColorScheme::NormalBackground).color().name()); | ||||
473 | colorsStream << gtkColorsHelper("theme_unfocused_selected_fg_color", inactiveColorSchemes[3].foreground(KColorScheme::NormalText).color().name()); | ||||
474 | | ||||
475 | // Button | ||||
476 | colorsStream << gtkColorsHelper("theme_button_background_normal_backdrop", inactiveColorSchemes[2].background(KColorScheme::NormalBackground).color().name()); | ||||
477 | colorsStream << gtkColorsHelper("theme_button_decoration_hover_backdrop", inactiveColorSchemes[2].decoration(KColorScheme::HoverColor).color().name()); | ||||
478 | colorsStream << gtkColorsHelper("theme_button_decoration_focus_backdrop", inactiveColorSchemes[2].decoration(KColorScheme::FocusColor).color().name()); | ||||
479 | colorsStream << gtkColorsHelper("theme_button_foreground_normal_backdrop", inactiveColorSchemes[2].foreground(KColorScheme::NormalText).color().name()); | ||||
480 | colorsStream << gtkColorsHelper("theme_button_foreground_active_backdrop", inactiveColorSchemes[3].foreground(KColorScheme::NormalText).color().name()); | ||||
481 | | ||||
482 | // Misc Colors | ||||
483 | QColor inactiveWindowForegroundColor = inactiveColorSchemes[1].foreground(KColorScheme::NormalText).color(); | ||||
484 | QColor inactiveWindowBackgroundColor = inactiveColorSchemes[1].background(KColorScheme::NormalBackground).color(); | ||||
485 | QColor inactiveBordersColor = KColorUtils::mix(inactiveWindowBackgroundColor,inactiveWindowForegroundColor, 0.25); | ||||
486 | | ||||
487 | colorsStream << gtkColorsHelper("unfocused_borders", inactiveBordersColor.name()); | ||||
488 | colorsStream << gtkColorsHelper("warning_color_backdrop", inactiveColorSchemes[0].foreground(KColorScheme::NeutralText).color().name()); | ||||
489 | colorsStream << gtkColorsHelper("success_color_backdrop", inactiveColorSchemes[0].foreground(KColorScheme::PositiveText).color().name()); | ||||
490 | colorsStream << gtkColorsHelper("error_color_backdrop", inactiveColorSchemes[0].foreground(KColorScheme::NegativeText).color().name()); | ||||
491 | | ||||
492 | /* | ||||
493 | Insensitive (Disabled) | ||||
494 | */ | ||||
495 | | ||||
496 | // General | ||||
497 | colorsStream << gtkColorsHelper("insensitive_fg_color",disabledColorSchemes[1].foreground(KColorScheme::NormalText).color().name()); | ||||
498 | colorsStream << gtkColorsHelper("insensitive_base_fg_color", disabledColorSchemes[0].foreground(KColorScheme::NormalText).color().name()); | ||||
499 | colorsStream << gtkColorsHelper("insensitive_bg_color", disabledColorSchemes[1].background(KColorScheme::NormalBackground).color().name()); | ||||
500 | colorsStream << gtkColorsHelper("insensitive_base_color", disabledColorSchemes[0].background(KColorScheme::NormalBackground).color().name()); | ||||
501 | colorsStream << gtkColorsHelper("insensitive_selected_bg_color", disabledColorSchemes[3].background(KColorScheme::NormalBackground).color().name()); | ||||
502 | colorsStream << gtkColorsHelper("insensitive_selected_fg_color", disabledColorSchemes[3].foreground(KColorScheme::NormalText).color().name()); | ||||
503 | | ||||
504 | // Button | ||||
505 | colorsStream << gtkColorsHelper("theme_button_background_normal_insensitive", disabledColorSchemes[2].background(KColorScheme::NormalBackground).color().name()); | ||||
506 | colorsStream << gtkColorsHelper("theme_button_decoration_hover_insensitive", disabledColorSchemes[2].decoration(KColorScheme::HoverColor).color().name()); | ||||
507 | colorsStream << gtkColorsHelper("theme_button_decoration_focus_insensitive", disabledColorSchemes[2].decoration(KColorScheme::FocusColor).color().name()); | ||||
508 | colorsStream << gtkColorsHelper("theme_button_foreground_normal_insensitive", disabledColorSchemes[2].foreground(KColorScheme::NormalText).color().name()); | ||||
509 | colorsStream << gtkColorsHelper("theme_button_foreground_active_insensitive", disabledColorSchemes[3].foreground(KColorScheme::NormalText).color().name()); | ||||
510 | | ||||
511 | // Misc Colors | ||||
512 | QColor disabledWindowForegroundColor = disabledColorSchemes[1].foreground(KColorScheme::NormalText).color(); | ||||
513 | QColor disabledWindowBackgroundColor = disabledColorSchemes[1].background(KColorScheme::NormalBackground).color(); | ||||
514 | QColor disabledBordersColor = KColorUtils::mix(disabledWindowBackgroundColor,disabledWindowForegroundColor, 0.25); | ||||
515 | | ||||
516 | colorsStream << gtkColorsHelper("insensitive_borders", disabledBordersColor.name()); | ||||
517 | colorsStream << gtkColorsHelper("warning_color_insensitive", disabledColorSchemes[0].foreground(KColorScheme::NeutralText).color().name()); | ||||
518 | colorsStream << gtkColorsHelper("success_color_insensitive", disabledColorSchemes[0].foreground(KColorScheme::PositiveText).color().name()); | ||||
519 | colorsStream << gtkColorsHelper("error_color_insensitive", disabledColorSchemes[0].foreground(KColorScheme::NegativeText).color().name()); | ||||
520 | | ||||
521 | /* | ||||
522 | Insensitive Backdrop (Inactive Disabled) These pretty much have the same appearance as regular inactive colors, but they're seperate in case we decide to make | ||||
523 | them different in the future. | ||||
524 | */ | ||||
525 | | ||||
526 | // General | ||||
527 | colorsStream << gtkColorsHelper("insensitive_unfocused_fg_color",disabledColorSchemes[1].foreground(KColorScheme::NormalText).color().name()); | ||||
528 | colorsStream << gtkColorsHelper("theme_unfocused_view_text_color", disabledColorSchemes[0].foreground(KColorScheme::NormalText).color().name()); | ||||
529 | colorsStream << gtkColorsHelper("insensitive_unfocused_bg_color", disabledColorSchemes[1].background(KColorScheme::NormalBackground).color().name()); | ||||
530 | colorsStream << gtkColorsHelper("theme_unfocused_view_bg_color", disabledColorSchemes[0].background(KColorScheme::NormalBackground).color().name()); | ||||
531 | colorsStream << gtkColorsHelper("insensitive_unfocused_selected_bg_color", disabledColorSchemes[3].background(KColorScheme::NormalBackground).color().name()); | ||||
532 | colorsStream << gtkColorsHelper("insensitive_unfocused_selected_fg_color", disabledColorSchemes[3].foreground(KColorScheme::NormalText).color().name()); | ||||
533 | | ||||
534 | // Button | ||||
535 | colorsStream << gtkColorsHelper("theme_button_background_normal_backdrop_insensitive", disabledColorSchemes[2].background(KColorScheme::NormalBackground).color().name()); | ||||
536 | colorsStream << gtkColorsHelper("theme_button_decoration_hover_backdrop_insensitive", disabledColorSchemes[2].decoration(KColorScheme::HoverColor).color().name()); | ||||
537 | colorsStream << gtkColorsHelper("theme_button_decoration_focus_backdrop_insensitive", disabledColorSchemes[2].decoration(KColorScheme::FocusColor).color().name()); | ||||
538 | colorsStream << gtkColorsHelper("theme_button_foreground_normal_backdrop_insensitive", disabledColorSchemes[2].foreground(KColorScheme::NormalText).color().name()); | ||||
539 | colorsStream << gtkColorsHelper("theme_button_foreground_active_backdrop_insensitive", disabledColorSchemes[3].foreground(KColorScheme::NormalText).color().name()); | ||||
540 | | ||||
541 | // Misc Colors | ||||
542 | QColor unfocusedDisabledWindowForegroundColor = disabledColorSchemes[1].foreground(KColorScheme::NormalText).color(); | ||||
543 | QColor unfocusedDisabledWindowBackgroundColor = disabledColorSchemes[1].background(KColorScheme::NormalBackground).color(); | ||||
544 | QColor unfocusedDisabledBordersColor = KColorUtils::mix(unfocusedDisabledWindowBackgroundColor,unfocusedDisabledWindowForegroundColor, 0.25); | ||||
545 | | ||||
546 | colorsStream << gtkColorsHelper("unfocused_insensitive_borders", unfocusedDisabledBordersColor.name()); | ||||
547 | colorsStream << gtkColorsHelper("warning_color_insensitive_backdrop", disabledColorSchemes[0].foreground(KColorScheme::NeutralText).color().name()); | ||||
548 | colorsStream << gtkColorsHelper("success_color_insensitive_backdrop", disabledColorSchemes[0].foreground(KColorScheme::PositiveText).color().name()); | ||||
549 | colorsStream << gtkColorsHelper("error_color_insensitive_backdrop", disabledColorSchemes[0].foreground(KColorScheme::NegativeText).color().name()); | ||||
550 | | ||||
551 | /* | ||||
552 | Ignorant Colors (These colors do not care about backdrop or insensitive states) | ||||
553 | */ | ||||
554 | | ||||
555 | colorsStream << gtkColorsHelper("link_color", activeColorSchemes[0].foreground(KColorScheme::LinkText).color().name()); | ||||
556 | colorsStream << gtkColorsHelper("link_visited_color", activeColorSchemes[0].foreground(KColorScheme::VisitedText).color().name()); | ||||
557 | | ||||
558 | QColor tooltipForegroundColor = activeColorSchemes[4].foreground(KColorScheme::NormalText).color(); | ||||
559 | QColor tooltipBackgroundColor = activeColorSchemes[4].background(KColorScheme::NormalBackground).color(); | ||||
560 | QColor tooltipBorderColor = KColorUtils::mix(tooltipBackgroundColor, tooltipForegroundColor, 0.25); | ||||
561 | | ||||
562 | colorsStream << gtkColorsHelper("tooltip_text", tooltipForegroundColor.name()); | ||||
563 | colorsStream << gtkColorsHelper("tooltip_background", tooltipBackgroundColor.name()); | ||||
564 | colorsStream << gtkColorsHelper("tooltip_border", tooltipBorderColor.name()); | ||||
565 | | ||||
566 | colorsStream << gtkColorsHelper("content_view_bg", activeColorSchemes[0].background(KColorScheme::NormalBackground).color().name()); | ||||
567 | | ||||
568 | // Titlebar colors | ||||
569 | colorsStream << gtkColorsHelper("theme_titlebar_background", "rgb(" + groupWMTheme.readEntry("activeBackground", "") + ")"); | ||||
570 | colorsStream << gtkColorsHelper("theme_titlebar_foreground", "rgb(" + groupWMTheme.readEntry("activeForeground", "") + ")"); | ||||
571 | colorsStream << gtkColorsHelper("theme_titlebar_background_light", activeColorSchemes[1].background(KColorScheme::NormalBackground).color().name()); | ||||
572 | colorsStream << gtkColorsHelper("theme_titlebar_foreground_backdrop", "rgb(" + groupWMTheme.readEntry("inactiveForeground", "") + ")"); | ||||
573 | colorsStream << gtkColorsHelper("theme_titlebar_background_backdrop", "rgb(" + groupWMTheme.readEntry("inactiveBackground", "") + ")"); | ||||
574 | colorsStream << gtkColorsHelper("theme_titlebar_foreground_insensitive", "rgb(" + groupWMTheme.readEntry("inactiveForeground", "") + ")"); | ||||
575 | colorsStream << gtkColorsHelper("theme_titlebar_foreground_insensitive_backdrop", "rgb(" + groupWMTheme.readEntry("inactiveForeground", "") + ")"); | ||||
576 | } | ||||
577 | void saveGtkColors(KSharedConfigPtr& config) | ||||
578 | { | ||||
579 | checkGtkCss(); | ||||
580 | QFile colorsCss(QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + "/gtk-3.0/colors.css"); | ||||
581 | | ||||
582 | if (colorsCss.open(QIODevice::WriteOnly | QIODevice::Truncate)) { | ||||
583 | QTextStream colorsStream(&colorsCss); | ||||
584 | /* | ||||
585 | 0 Active View | ||||
586 | 1 Active Window | ||||
587 | 2 Active Button | ||||
588 | 3 Active Selection | ||||
589 | 4 Active Tooltip | ||||
590 | 5 Active Complimentary | ||||
591 | */ | ||||
592 | | ||||
593 | QList<KColorScheme> activeColorSchemes{ | ||||
594 | KColorScheme(QPalette::Active, KColorScheme::View, config), | ||||
595 | KColorScheme(QPalette::Active, KColorScheme::Window, config), | ||||
596 | KColorScheme(QPalette::Active, KColorScheme::Button, config), | ||||
597 | KColorScheme(QPalette::Active, KColorScheme::Selection, config), | ||||
598 | KColorScheme(QPalette::Active, KColorScheme::Tooltip, config), | ||||
599 | KColorScheme(QPalette::Active, KColorScheme::Complementary, config) | ||||
600 | }; | ||||
601 | QList<KColorScheme> inactiveColorSchemes{ | ||||
602 | KColorScheme(QPalette::Inactive, KColorScheme::View, config), | ||||
603 | KColorScheme(QPalette::Inactive, KColorScheme::Window, config), | ||||
604 | KColorScheme(QPalette::Inactive, KColorScheme::Button, config), | ||||
605 | KColorScheme(QPalette::Inactive, KColorScheme::Selection, config), | ||||
606 | KColorScheme(QPalette::Inactive, KColorScheme::Tooltip, config), | ||||
607 | KColorScheme(QPalette::Inactive, KColorScheme::Complementary, config) | ||||
608 | }; | ||||
609 | QList<KColorScheme> disabledColorSchemes{ | ||||
610 | KColorScheme(QPalette::Disabled, KColorScheme::View, config), | ||||
611 | KColorScheme(QPalette::Disabled, KColorScheme::Window, config), | ||||
612 | KColorScheme(QPalette::Disabled, KColorScheme::Button, config), | ||||
613 | KColorScheme(QPalette::Disabled, KColorScheme::Selection, config), | ||||
614 | KColorScheme(QPalette::Disabled, KColorScheme::Tooltip, config), | ||||
615 | KColorScheme(QPalette::Disabled, KColorScheme::Complementary, config) | ||||
616 | }; | ||||
617 | KConfigGroup groupWMTheme(config, "WM"); | ||||
618 | exportGtkColors(activeColorSchemes, inactiveColorSchemes, disabledColorSchemes, groupWMTheme, colorsStream); | ||||
619 | } | ||||
620 | } | ||||
621 | | ||||
622 | void saveGtkColors() | ||||
623 | { | ||||
624 | checkGtkCss(); | ||||
625 | QFile colorsCss(QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + "/gtk-3.0/colors.css"); | ||||
626 | KConfigGroup groupWMTheme(KSharedConfig::openConfig(), "WM"); | ||||
627 | | ||||
628 | if (colorsCss.open(QIODevice::WriteOnly | QIODevice::Truncate)) { | ||||
629 | QTextStream colorsStream(&colorsCss); | ||||
630 | /* | ||||
631 | 0 Active View | ||||
632 | 1 Active Window | ||||
633 | 2 Active Button | ||||
634 | 3 Active Selection | ||||
635 | 4 Active Tooltip | ||||
636 | 5 Active Complimentary | ||||
637 | */ | ||||
638 | | ||||
639 | QList<KColorScheme> activeColorSchemes{ | ||||
640 | KColorScheme(QPalette::Active, KColorScheme::View), | ||||
641 | KColorScheme(QPalette::Active, KColorScheme::Window), | ||||
642 | KColorScheme(QPalette::Active, KColorScheme::Button), | ||||
643 | KColorScheme(QPalette::Active, KColorScheme::Selection), | ||||
644 | KColorScheme(QPalette::Active, KColorScheme::Tooltip), | ||||
645 | KColorScheme(QPalette::Active, KColorScheme::Complementary) | ||||
646 | }; | ||||
647 | QList<KColorScheme> inactiveColorSchemes{ | ||||
648 | KColorScheme(QPalette::Inactive, KColorScheme::View), | ||||
649 | KColorScheme(QPalette::Inactive, KColorScheme::Window), | ||||
650 | KColorScheme(QPalette::Inactive, KColorScheme::Button), | ||||
651 | KColorScheme(QPalette::Inactive, KColorScheme::Selection), | ||||
652 | KColorScheme(QPalette::Inactive, KColorScheme::Tooltip), | ||||
653 | KColorScheme(QPalette::Inactive, KColorScheme::Complementary) | ||||
654 | }; | ||||
655 | QList<KColorScheme> disabledColorSchemes{ | ||||
656 | KColorScheme(QPalette::Disabled, KColorScheme::View), | ||||
657 | KColorScheme(QPalette::Disabled, KColorScheme::Window), | ||||
658 | KColorScheme(QPalette::Disabled, KColorScheme::Button), | ||||
659 | KColorScheme(QPalette::Disabled, KColorScheme::Selection), | ||||
660 | KColorScheme(QPalette::Disabled, KColorScheme::Tooltip), | ||||
661 | KColorScheme(QPalette::Disabled, KColorScheme::Complementary) | ||||
662 | }; | ||||
663 | | ||||
664 | exportGtkColors(activeColorSchemes, inactiveColorSchemes, disabledColorSchemes, groupWMTheme, colorsStream); | ||||
665 | } | ||||
666 | } | ||||
667 | | ||||
403 | // ----------------------------------------------------------------------------- | 668 | // ----------------------------------------------------------------------------- | ||
404 | 669 | | |||
405 | void runRdb( uint flags ) | 670 | void runRdb( uint flags ) | ||
406 | { | 671 | { | ||
407 | // Obtain the application palette that is about to be set. | 672 | // Obtain the application palette that is about to be set. | ||
408 | bool exportColors = flags & KRdbExportColors; | 673 | bool exportColors = flags & KRdbExportColors; | ||
409 | bool exportQtColors = flags & KRdbExportQtColors; | 674 | bool exportQtColors = flags & KRdbExportQtColors; | ||
410 | bool exportQtSettings = flags & KRdbExportQtSettings; | 675 | bool exportQtSettings = flags & KRdbExportQtSettings; | ||
411 | bool exportXftSettings = flags & KRdbExportXftSettings; | 676 | bool exportXftSettings = flags & KRdbExportXftSettings; | ||
412 | bool exportGtkTheme = flags & KRdbExportGtkTheme; | 677 | bool exportGtkTheme = flags & KRdbExportGtkTheme; | ||
678 | bool exportGtkColors = flags & KRdbExportGtkColors; | ||||
413 | 679 | | |||
414 | KSharedConfigPtr kglobalcfg = KSharedConfig::openConfig( QStringLiteral("kdeglobals") ); | 680 | KSharedConfigPtr kglobalcfg = KSharedConfig::openConfig( QStringLiteral("kdeglobals") ); | ||
415 | KConfigGroup kglobals(kglobalcfg, "KDE"); | 681 | KConfigGroup kglobals(kglobalcfg, "KDE"); | ||
416 | QPalette newPal = KColorScheme::createApplicationPalette(kglobalcfg); | 682 | QPalette newPal = KColorScheme::createApplicationPalette(kglobalcfg); | ||
417 | 683 | | |||
418 | QTemporaryFile tmpFile; | 684 | QTemporaryFile tmpFile; | ||
419 | if (!tmpFile.open()) | 685 | if (!tmpFile.open()) | ||
420 | { | 686 | { | ||
▲ Show 20 Lines • Show All 47 Lines • ▼ Show 20 Line(s) | 732 | if ( dSys.exists() ) { | |||
468 | dSys.setSorting( QDir::Name ); | 734 | dSys.setSorting( QDir::Name ); | ||
469 | dSys.setNameFilters(QStringList(QStringLiteral("*.ad"))); | 735 | dSys.setNameFilters(QStringList(QStringLiteral("*.ad"))); | ||
470 | list += dSys.entryList(); | 736 | list += dSys.entryList(); | ||
471 | } | 737 | } | ||
472 | } | 738 | } | ||
473 | 739 | | |||
474 | for (QStringList::ConstIterator it = list.constBegin(); it != list.constEnd(); ++it) | 740 | for (QStringList::ConstIterator it = list.constBegin(); it != list.constEnd(); ++it) | ||
475 | copyFile(tmpFile, QStandardPaths::locate(QStandardPaths::GenericDataLocation, "kdisplay/app-defaults/"+(*it)), true); | 741 | copyFile(tmpFile, QStandardPaths::locate(QStandardPaths::GenericDataLocation, "kdisplay/app-defaults/"+(*it)), true); | ||
742 | | ||||
476 | } | 743 | } | ||
477 | 744 | | |||
478 | // Merge ~/.Xresources or fallback to ~/.Xdefaults | 745 | // Merge ~/.Xresources or fallback to ~/.Xdefaults | ||
479 | QString homeDir = QDir::homePath(); | 746 | QString homeDir = QDir::homePath(); | ||
480 | QString xResources = homeDir + "/.Xresources"; | 747 | QString xResources = homeDir + "/.Xresources"; | ||
481 | 748 | | |||
482 | // very primitive support for ~/.Xresources by appending it | 749 | // very primitive support for ~/.Xresources by appending it | ||
483 | if ( QFile::exists( xResources ) ) | 750 | if ( QFile::exists( xResources ) ) | ||
▲ Show 20 Lines • Show All 227 Lines • ▼ Show 20 Line(s) | 879 | #endif | |||
711 | //FIXME: this should somehow check if the kde4 version of the style is installed | 978 | //FIXME: this should somehow check if the kde4 version of the style is installed | ||
712 | kde4generalGroup.writeEntry("widgetStyle", kglobals.readEntry("widgetStyle", "breeze")); | 979 | kde4generalGroup.writeEntry("widgetStyle", kglobals.readEntry("widgetStyle", "breeze")); | ||
713 | 980 | | |||
714 | //toolbar style | 981 | //toolbar style | ||
715 | KConfigGroup toolbars4(&kde4config, "Toolbar style"); | 982 | KConfigGroup toolbars4(&kde4config, "Toolbar style"); | ||
716 | KConfigGroup toolbars5(kglobalcfg, "Toolbar style"); | 983 | KConfigGroup toolbars5(kglobalcfg, "Toolbar style"); | ||
717 | toolbars4.writeEntry("ToolButtonStyle", toolbars5.readEntry("ToolButtonStyle", "TextBesideIcon")); | 984 | toolbars4.writeEntry("ToolButtonStyle", toolbars5.readEntry("ToolButtonStyle", "TextBesideIcon")); | ||
718 | toolbars4.writeEntry("ToolButtonStyleOtherToolbars", toolbars5.readEntry("ToolButtonStyleOtherToolbars", "TextBesideIcon")); | 985 | toolbars4.writeEntry("ToolButtonStyleOtherToolbars", toolbars5.readEntry("ToolButtonStyleOtherToolbars", "TextBesideIcon")); | ||
719 | } | | |||
720 | 986 | | |||
987 | saveGtkColors(); | ||||
988 | } | ||||
989 | No newline at end of file |