diff --git a/kcms/lookandfeel/autotests/lookandfeel/metadata.desktop b/kcms/lookandfeel/autotests/lookandfeel/metadata.desktop index 85d0915ae..efee7a806 100644 --- a/kcms/lookandfeel/autotests/lookandfeel/metadata.desktop +++ b/kcms/lookandfeel/autotests/lookandfeel/metadata.desktop @@ -1,95 +1,95 @@ [Desktop Entry] -Comment=Test Look and Feel package +Comment=Test global theme package Comment[ast]=Paquete d'aspeutu y sentir de prueba Comment[bs]=Test paketa Pogledaj i Osjeti Comment[ca]=Prova el paquet d'aspecte i comportament Comment[ca@valencia]=Prova el paquet d'aspecte i comportament Comment[cs]=Otestovat balíček vzhledu a chování Comment[da]=Test pakke med udseende og fremtoning Comment[de]=Testpaket für das Erscheinungsbild Comment[el]=Δοκιμή του πακέτου εμφάνισης και αίσθησης Comment[en_GB]=Test Look and Feel package Comment[es]=Probar paquete de aspecto visual Comment[et]=Välimuse testimine Comment[fi]=Ulkoasun ja tuntuman testipaketti Comment[fr]=Tester le paquet d'apparence Comment[gl]=Paquete de aparencia e comportamento de probas Comment[hu]=A megjelenés csomag tesztelése Comment[id]=Paket Tes Lihat dan Rasakan Comment[it]=Prova il pacchetto dell'aspetto Comment[ja]=外観パッケージをテスト Comment[ko]=모습과 느낌 테스트 패키지 Comment[nb]=Test pakka Utseende og oppførsel Comment[nds]=Test-Utsehn- un Bedenen-Paket Comment[nl]=Pakket voor uiterlijk en gedrag testen Comment[nn]=Testpakke for utsjånad og åtferd Comment[pl]=Wypróbuj pakiet wrażeń wzrokowych i dotykowych Comment[pt]=Pacote de teste da Aparência e Comportamento Comment[pt_BR]=Pacote de teste de Aparência Comment[ru]=Тестовое оформление рабочей среды Comment[sk]=Balík pre vzhľad a nastavenie Comment[sl]=Preizkusni paket za Videz in občutek Comment[sr]=Пробни пакет изгледа и осећаја Comment[sr@ijekavian]=Пробни пакет изгледа и осећаја Comment[sr@ijekavianlatin]=Probni paket izgleda i osećaja Comment[sr@latin]=Probni paket izgleda i osećaja Comment[sv]=Prova paket för utseende och känsla Comment[tr]=Görünüm ve Duyum paketini dene Comment[uk]=Перевірка пакунка вигляду і поведінки Comment[x-test]=xxTest Look and Feel packagexx Comment[zh_CN]=测试观感包 Comment[zh_TW]=測試外觀與感覺套件 Name=Test Name[bs]=Test Name[ca]=Prova Name[ca@valencia]=Prova Name[cs]=Test Name[da]=Test Name[de]=Test Name[el]=Δοκιμή Name[en_GB]=Test Name[es]=Probar Name[et]=Test Name[fi]=Testi Name[fr]=Tester Name[gl]=Proba Name[hu]=Teszt Name[id]=Tes Name[it]=Prova Name[ja]=テスト Name[ko]=시험 Name[nb]=Test Name[nds]=Test Name[nl]=Test Name[nn]=Test Name[pa]=ਟੈਸਟ Name[pl]=Próba Name[pt]=Teste Name[pt_BR]=Teste Name[ru]=Тест Name[se]=Geahččaleapmi Name[sk]=Test Name[sl]=Preizkus Name[sr]=Проба Name[sr@ijekavian]=Проба Name[sr@ijekavianlatin]=Proba Name[sr@latin]=Proba Name[sv]=Prova Name[tr]=Test Name[uk]=Тест Name[x-test]=xxTestxx Name[zh_CN]=测试 Name[zh_TW]=測試 Type=Service X-KDE-ServiceTypes=Plasma/LookAndFeel X-KDE-ParentApp= X-KDE-PluginInfo-Author=KDE Visual Design Group X-KDE-PluginInfo-Category= X-KDE-PluginInfo-Email=plasma-devel@kde.org X-KDE-PluginInfo-License=GPL-2.0+ X-KDE-PluginInfo-Name=org.kde.test X-KDE-PluginInfo-Version=2.0 X-KDE-PluginInfo-Website=http://www.kde.org X-Plasma-MainScript=defaults diff --git a/kcms/lookandfeel/kcm.cpp b/kcms/lookandfeel/kcm.cpp index 1d3456178..738623d58 100644 --- a/kcms/lookandfeel/kcm.cpp +++ b/kcms/lookandfeel/kcm.cpp @@ -1,834 +1,834 @@ /* This file is part of the KDE Project Copyright (c) 2014 Marco Martin Copyright (c) 2014 Vishesh Handa This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License version 2 as published by the Free Software Foundation. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "kcm.h" #include "../krdb/krdb.h" #include "../cursortheme/xcursor/xcursortheme.h" #include "config-kcm.h" #include "config-workspace.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef HAVE_XFIXES # include #endif KCMLookandFeel::KCMLookandFeel(QObject* parent, const QVariantList& args) : KQuickAddons::ConfigModule(parent, args) , m_config(QStringLiteral("kdeglobals")) , m_configGroup(m_config.group("KDE")) , m_applyColors(true) , m_applyWidgetStyle(true) , m_applyIcons(true) , m_applyPlasmaTheme(true) , m_applyCursors(true) , m_applyWindowSwitcher(true) , m_applyDesktopSwitcher(true) , m_resetDefaultLayout(false) , m_applyWindowDecoration(true) { //This flag seems to be needed in order for QQuickWidget to work //see https://bugreports.qt-project.org/browse/QTBUG-40765 //also, it seems to work only if set in the kcm, not in the systemsettings' main qApp->setAttribute(Qt::AA_DontCreateNativeWidgetSiblings); qmlRegisterType(); qmlRegisterType(); - KAboutData* about = new KAboutData(QStringLiteral("kcm_lookandfeel"), i18n("Look and Feel"), + KAboutData* about = new KAboutData(QStringLiteral("kcm_lookandfeel"), i18n("Global Theme"), QStringLiteral("0.1"), QString(), KAboutLicense::LGPL); about->addAuthor(i18n("Marco Martin"), QString(), QStringLiteral("mart@kde.org")); setAboutData(about); setButtons(Apply | Default); m_model = new QStandardItemModel(this); QHash roles = m_model->roleNames(); roles[PluginNameRole] = "pluginName"; roles[DescriptionRole] = "description"; roles[ScreenhotRole] = "screenshot"; roles[FullScreenPreviewRole] = "fullScreenPreview"; roles[HasSplashRole] = "hasSplash"; roles[HasLockScreenRole] = "hasLockScreen"; roles[HasRunCommandRole] = "hasRunCommand"; roles[HasLogoutRole] = "hasLogout"; roles[HasColorsRole] = "hasColors"; roles[HasWidgetStyleRole] = "hasWidgetStyle"; roles[HasIconsRole] = "hasIcons"; roles[HasPlasmaThemeRole] = "hasPlasmaTheme"; roles[HasCursorsRole] = "hasCursors"; roles[HasWindowSwitcherRole] = "hasWindowSwitcher"; roles[HasDesktopSwitcherRole] = "hasDesktopSwitcher"; m_model->setItemRoleNames(roles); loadModel(); } KCMLookandFeel::~KCMLookandFeel() { } void KCMLookandFeel::getNewStuff(QQuickItem *ctx) { if (!m_newStuffDialog) { m_newStuffDialog = new KNS3::DownloadDialog( QLatin1String("lookandfeel.knsrc") ); - m_newStuffDialog.data()->setWindowTitle(i18n("Download New Look and Feel Themes")); + m_newStuffDialog.data()->setWindowTitle(i18n("Download New Global Themes")); m_newStuffDialog->setWindowModality(Qt::WindowModal); m_newStuffDialog->winId(); // so it creates the windowHandle(); connect(m_newStuffDialog.data(), &KNS3::DownloadDialog::accepted, this, &KCMLookandFeel::loadModel); } if (ctx && ctx->window()) { m_newStuffDialog->windowHandle()->setTransientParent(ctx->window()); } m_newStuffDialog.data()->show(); } QStandardItemModel *KCMLookandFeel::lookAndFeelModel() { return m_model; } QString KCMLookandFeel::selectedPlugin() const { return m_selectedPlugin; } void KCMLookandFeel::setSelectedPlugin(const QString &plugin) { if (m_selectedPlugin == plugin) { return; } const bool firstTime = m_selectedPlugin.isNull(); m_selectedPlugin = plugin; emit selectedPluginChanged(); emit selectedPluginIndexChanged(); if (!firstTime) { setNeedsSave(true); } } int KCMLookandFeel::selectedPluginIndex() const { for (int i = 0; i < m_model->rowCount(); ++i) { if (m_model->data(m_model->index(i, 0), PluginNameRole).toString() == m_selectedPlugin) { return i; } } return -1; } QList KCMLookandFeel::availablePackages(const QStringList &components) { QList packages; QStringList paths; const QStringList dataPaths = QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation); paths.reserve(dataPaths.count()); for (const QString &path : dataPaths) { QDir dir(path + QStringLiteral("/plasma/look-and-feel")); paths << dir.entryList(QDir::AllDirs | QDir::NoDotAndDotDot); } for (const QString &path : paths) { Plasma::Package pkg = Plasma::PluginLoader::self()->loadPackage(QStringLiteral("Plasma/LookAndFeel")); pkg.setPath(path); pkg.setFallbackPackage(Plasma::Package()); if (components.isEmpty()) { packages << pkg; } else { for (const auto &component : components) { if (!pkg.filePath(component.toUtf8()).isEmpty()) { packages << pkg; break; } } } } return packages; } void KCMLookandFeel::loadModel() { m_model->clear(); const QList pkgs = availablePackages({"defaults", "layouts"}); for (const Plasma::Package &pkg : pkgs) { if (!pkg.metadata().isValid()) { continue; } QStandardItem* row = new QStandardItem(pkg.metadata().name()); row->setData(pkg.metadata().pluginName(), PluginNameRole); row->setData(pkg.metadata().comment(), DescriptionRole); row->setData(pkg.filePath("preview"), ScreenhotRole); row->setData(pkg.filePath("fullscreenpreview"), FullScreenPreviewRole); //What the package provides row->setData(!pkg.filePath("splashmainscript").isEmpty(), HasSplashRole); row->setData(!pkg.filePath("lockscreenmainscript").isEmpty(), HasLockScreenRole); row->setData(!pkg.filePath("runcommandmainscript").isEmpty(), HasRunCommandRole); row->setData(!pkg.filePath("logoutmainscript").isEmpty(), HasLogoutRole); if (!pkg.filePath("defaults").isEmpty()) { KSharedConfigPtr conf = KSharedConfig::openConfig(pkg.filePath("defaults")); KConfigGroup cg(conf, "kdeglobals"); cg = KConfigGroup(&cg, "General"); bool hasColors = !cg.readEntry("ColorScheme", QString()).isEmpty(); if (!hasColors) { hasColors = !pkg.filePath("colors").isEmpty(); } row->setData(hasColors, HasColorsRole); cg = KConfigGroup(&cg, "KDE"); row->setData(!cg.readEntry("widgetStyle", QString()).isEmpty(), HasWidgetStyleRole); cg = KConfigGroup(conf, "kdeglobals"); cg = KConfigGroup(&cg, "Icons"); row->setData(!cg.readEntry("Theme", QString()).isEmpty(), HasIconsRole); cg = KConfigGroup(conf, "kdeglobals"); cg = KConfigGroup(&cg, "Theme"); row->setData(!cg.readEntry("name", QString()).isEmpty(), HasPlasmaThemeRole); cg = KConfigGroup(conf, "kcminputrc"); cg = KConfigGroup(&cg, "Mouse"); row->setData(!cg.readEntry("cursorTheme", QString()).isEmpty(), HasCursorsRole); cg = KConfigGroup(conf, "kwinrc"); cg = KConfigGroup(&cg, "WindowSwitcher"); row->setData(!cg.readEntry("LayoutName", QString()).isEmpty(), HasWindowSwitcherRole); cg = KConfigGroup(conf, "kwinrc"); cg = KConfigGroup(&cg, "DesktopSwitcher"); row->setData(!cg.readEntry("LayoutName", QString()).isEmpty(), HasDesktopSwitcherRole); } m_model->appendRow(row); } m_model->sort(0 /*column*/); emit selectedPluginIndexChanged(); } void KCMLookandFeel::load() { m_package = Plasma::PluginLoader::self()->loadPackage(QStringLiteral("Plasma/LookAndFeel")); KConfigGroup cg(KSharedConfig::openConfig(QStringLiteral("kdeglobals")), "KDE"); const QString packageName = cg.readEntry("LookAndFeelPackage", QString()); if (!packageName.isEmpty()) { m_package.setPath(packageName); } if (!m_package.metadata().isValid()) { return; } setSelectedPlugin(m_package.metadata().pluginName()); setNeedsSave(false); } void KCMLookandFeel::save() { Plasma::Package package = Plasma::PluginLoader::self()->loadPackage(QStringLiteral("Plasma/LookAndFeel")); package.setPath(m_selectedPlugin); if (!package.isValid()) { return; } m_configGroup.writeEntry("LookAndFeelPackage", m_selectedPlugin); if (m_resetDefaultLayout) { QDBusMessage message = QDBusMessage::createMethodCall(QStringLiteral("org.kde.plasmashell"), QStringLiteral("/PlasmaShell"), QStringLiteral("org.kde.PlasmaShell"), QStringLiteral("loadLookAndFeelDefaultLayout")); QList args; args << m_selectedPlugin; message.setArguments(args); QDBusConnection::sessionBus().call(message, QDBus::NoBlock); } if (!package.filePath("defaults").isEmpty()) { KSharedConfigPtr conf = KSharedConfig::openConfig(package.filePath("defaults")); KConfigGroup cg(conf, "kdeglobals"); cg = KConfigGroup(&cg, "KDE"); if (m_applyWidgetStyle) { setWidgetStyle(cg.readEntry("widgetStyle", QString())); } if (m_applyColors) { QString colorsFile = package.filePath("colors"); KConfigGroup cg(conf, "kdeglobals"); cg = KConfigGroup(&cg, "General"); QString colorScheme = cg.readEntry("ColorScheme", QString()); if (!colorsFile.isEmpty()) { if (!colorScheme.isEmpty()) { setColors(colorScheme, colorsFile); } else { setColors(package.metadata().name(), colorsFile); } } else if (!colorScheme.isEmpty()) { colorScheme.remove(QLatin1Char('\'')); // So Foo's does not become FooS QRegExp fixer(QStringLiteral("[\\W,.-]+(.?)")); int offset; while ((offset = fixer.indexIn(colorScheme)) >= 0) { colorScheme.replace(offset, fixer.matchedLength(), fixer.cap(1).toUpper()); } colorScheme.replace(0, 1, colorScheme.at(0).toUpper()); //NOTE: why this loop trough all the scheme files? //the scheme theme name is an heuristic, there is no plugin metadata whatsoever. //is based on the file name stripped from weird characters or the //eventual id- prefix store.kde.org puts, so we can just find a //theme that ends as the specified name bool schemeFound = false; const QStringList schemeDirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("color-schemes"), QStandardPaths::LocateDirectory); for (const QString &dir : schemeDirs) { const QStringList fileNames = QDir(dir).entryList(QStringList()<emitChange(KGlobalSettings::StyleChanged); } void KCMLookandFeel::setColors(const QString &scheme, const QString &colorFile) { if (scheme.isEmpty() && colorFile.isEmpty()) { return; } KSharedConfigPtr conf = KSharedConfig::openConfig(colorFile, KSharedConfig::CascadeConfig); foreach (const QString &grp, conf->groupList()) { KConfigGroup cg(conf, grp); KConfigGroup cg2(&m_config, grp); cg.copyTo(&cg2); } KConfigGroup configGroup(&m_config, "General"); configGroup.writeEntry("ColorScheme", scheme); configGroup.sync(); KGlobalSettings::self()->emitChange(KGlobalSettings::PaletteChanged); } void KCMLookandFeel::setIcons(const QString &theme) { if (theme.isEmpty()) { return; } KConfigGroup cg(&m_config, "Icons"); cg.writeEntry("Theme", theme); cg.sync(); for (int i=0; i < KIconLoader::LastGroup; i++) { KIconLoader::emitChange(KIconLoader::Group(i)); } } void KCMLookandFeel::setPlasmaTheme(const QString &theme) { if (theme.isEmpty()) { return; } KConfig config(QStringLiteral("plasmarc")); KConfigGroup cg(&config, "Theme"); cg.writeEntry("name", theme); cg.sync(); } void KCMLookandFeel::setCursorTheme(const QString themeName) { //TODO: use pieces of cursor kcm when moved to plasma-desktop if (themeName.isEmpty()) { return; } KConfig config(QStringLiteral("kcminputrc")); KConfigGroup cg(&config, "Mouse"); cg.writeEntry("cursorTheme", themeName); cg.sync(); // Require the Xcursor version that shipped with X11R6.9 or greater, since // in previous versions the Xfixes code wasn't enabled due to a bug in the // build system (freedesktop bug #975). #if HAVE_XFIXES && XFIXES_MAJOR >= 2 && XCURSOR_LIB_VERSION >= 10105 const int cursorSize = cg.readEntry("cursorSize", 0); QDir themeDir = cursorThemeDir(themeName, 0); if (!themeDir.exists()) { return; } XCursorTheme theme(themeDir); if (!CursorTheme::haveXfixes()) { return; } // Set up the proper launch environment for newly started apps OrgKdeKLauncherInterface klauncher(QStringLiteral("org.kde.klauncher5"), QStringLiteral("/KLauncher"), QDBusConnection::sessionBus()); klauncher.setLaunchEnv(QStringLiteral("XCURSOR_THEME"), themeName); // Update the Xcursor X resources runRdb(0); // Notify all applications that the cursor theme has changed KGlobalSettings::self()->emitChange(KGlobalSettings::CursorChanged); // Reload the standard cursors QStringList names; // Qt cursors names << QStringLiteral("left_ptr") << QStringLiteral("up_arrow") << QStringLiteral("cross") << QStringLiteral("wait") << QStringLiteral("left_ptr_watch") << QStringLiteral("ibeam") << QStringLiteral("size_ver") << QStringLiteral("size_hor") << QStringLiteral("size_bdiag") << QStringLiteral("size_fdiag") << QStringLiteral("size_all") << QStringLiteral("split_v") << QStringLiteral("split_h") << QStringLiteral("pointing_hand") << QStringLiteral("openhand") << QStringLiteral("closedhand") << QStringLiteral("forbidden") << QStringLiteral("whats_this") << QStringLiteral("copy") << QStringLiteral("move") << QStringLiteral("link"); // X core cursors names << QStringLiteral("X_cursor") << QStringLiteral("right_ptr") << QStringLiteral("hand1") << QStringLiteral("hand2") << QStringLiteral("watch") << QStringLiteral("xterm") << QStringLiteral("crosshair") << QStringLiteral("left_ptr_watch") << QStringLiteral("center_ptr") << QStringLiteral("sb_h_double_arrow") << QStringLiteral("sb_v_double_arrow") << QStringLiteral("fleur") << QStringLiteral("top_left_corner") << QStringLiteral("top_side") << QStringLiteral("top_right_corner") << QStringLiteral("right_side") << QStringLiteral("bottom_right_corner") << QStringLiteral("bottom_side") << QStringLiteral("bottom_left_corner") << QStringLiteral("left_side") << QStringLiteral("question_arrow") << QStringLiteral("pirate"); foreach (const QString &name, names) { XFixesChangeCursorByName(QX11Info::display(), theme.loadCursor(name, cursorSize), QFile::encodeName(name)); } #else KMessageBox::information(this, i18n("You have to restart the Plasma session for these changes to take effect."), i18n("Cursor Settings Changed"), "CursorSettingsChanged"); #endif } QDir KCMLookandFeel::cursorThemeDir(const QString &theme, const int depth) { // Prevent infinite recursion if (depth > 10) { return QDir(); } // Search each icon theme directory for 'theme' foreach (const QString &baseDir, cursorSearchPaths()) { QDir dir(baseDir); if (!dir.exists() || !dir.cd(theme)) { continue; } // If there's a cursors subdir, we'll assume this is a cursor theme if (dir.exists(QStringLiteral("cursors"))) { return dir; } // If the theme doesn't have an index.theme file, it can't inherit any themes. if (!dir.exists(QStringLiteral("index.theme"))) { continue; } // Open the index.theme file, so we can get the list of inherited themes KConfig config(dir.path() + QStringLiteral("/index.theme"), KConfig::NoGlobals); KConfigGroup cg(&config, "Icon Theme"); // Recurse through the list of inherited themes, to check if one of them // is a cursor theme. QStringList inherits = cg.readEntry("Inherits", QStringList()); foreach (const QString &inherit, inherits) { // Avoid possible DoS if (inherit == theme) { continue; } if (cursorThemeDir(inherit, depth + 1).exists()) { return dir; } } } return QDir(); } const QStringList KCMLookandFeel::cursorSearchPaths() { if (!m_cursorSearchPaths.isEmpty()) return m_cursorSearchPaths; #if XCURSOR_LIB_MAJOR == 1 && XCURSOR_LIB_MINOR < 1 // These are the default paths Xcursor will scan for cursor themes QString path("~/.icons:/usr/share/icons:/usr/share/pixmaps:/usr/X11R6/lib/X11/icons"); // If XCURSOR_PATH is set, use that instead of the default path char *xcursorPath = std::getenv("XCURSOR_PATH"); if (xcursorPath) path = xcursorPath; #else // Get the search path from Xcursor QString path = XcursorLibraryPath(); #endif // Separate the paths m_cursorSearchPaths = path.split(QLatin1Char(':'), QString::SkipEmptyParts); // Remove duplicates QMutableStringListIterator i(m_cursorSearchPaths); while (i.hasNext()) { const QString path = i.next(); QMutableStringListIterator j(i); while (j.hasNext()) if (j.next() == path) j.remove(); } // Expand all occurrences of ~/ to the home dir m_cursorSearchPaths.replaceInStrings(QRegExp(QStringLiteral("^~\\/")), QDir::home().path() + QLatin1Char('/')); return m_cursorSearchPaths; } void KCMLookandFeel::setSplashScreen(const QString &theme) { if (theme.isEmpty()) { return; } KConfig config(QStringLiteral("ksplashrc")); KConfigGroup cg(&config, "KSplash"); cg.writeEntry("Theme", theme); //TODO: a way to set none as spash in the l&f cg.writeEntry("Engine", "KSplashQML"); cg.sync(); } void KCMLookandFeel::setLockScreen(const QString &theme) { if (theme.isEmpty()) { return; } KConfig config(QStringLiteral("kscreenlockerrc")); KConfigGroup cg(&config, "Greeter"); cg.writeEntry("Theme", theme); cg.sync(); } void KCMLookandFeel::setWindowSwitcher(const QString &theme) { if (theme.isEmpty()) { return; } KConfig config(QStringLiteral("kwinrc")); KConfigGroup cg(&config, "TabBox"); cg.writeEntry("LayoutName", theme); cg.sync(); } void KCMLookandFeel::setDesktopSwitcher(const QString &theme) { if (theme.isEmpty()) { return; } KConfig config(QStringLiteral("kwinrc")); KConfigGroup cg(&config, "TabBox"); cg.writeEntry("DesktopLayout", theme); cg.writeEntry("DesktopListLayout", theme); cg.sync(); } void KCMLookandFeel::setWindowDecoration(const QString &library, const QString &theme) { if (library.isEmpty()) { return; } KConfig config(QStringLiteral("kwinrc")); KConfigGroup cg(&config, "org.kde.kdecoration2"); cg.writeEntry("library", library); cg.writeEntry("theme", theme); cg.sync(); // Reload KWin. QDBusMessage message = QDBusMessage::createSignal(QStringLiteral("/KWin"), QStringLiteral("org.kde.KWin"), QStringLiteral("reloadConfig")); QDBusConnection::sessionBus().send(message); } void KCMLookandFeel::setApplyColors(bool apply) { if (m_applyColors == apply) { return; } m_applyColors = apply; emit applyColorsChanged(); } bool KCMLookandFeel::applyColors() const { return m_applyColors; } void KCMLookandFeel::setApplyWidgetStyle(bool apply) { if (m_applyWidgetStyle == apply) { return; } m_applyWidgetStyle = apply; emit applyWidgetStyleChanged(); } bool KCMLookandFeel::applyWidgetStyle() const { return m_applyWidgetStyle; } void KCMLookandFeel::setApplyIcons(bool apply) { if (m_applyIcons == apply) { return; } m_applyIcons = apply; emit applyIconsChanged(); } bool KCMLookandFeel::applyIcons() const { return m_applyIcons; } void KCMLookandFeel::setApplyPlasmaTheme(bool apply) { if (m_applyPlasmaTheme == apply) { return; } m_applyPlasmaTheme = apply; emit applyPlasmaThemeChanged(); } bool KCMLookandFeel::applyPlasmaTheme() const { return m_applyPlasmaTheme; } void KCMLookandFeel::setApplyWindowSwitcher(bool apply) { if (m_applyWindowSwitcher == apply) { return; } m_applyWindowSwitcher = apply; emit applyWindowSwitcherChanged(); } bool KCMLookandFeel::applyWindowSwitcher() const { return m_applyWindowSwitcher; } void KCMLookandFeel::setApplyDesktopSwitcher(bool apply) { if (m_applyDesktopSwitcher == apply) { return; } m_applyDesktopSwitcher = apply; emit applyDesktopSwitcherChanged(); } bool KCMLookandFeel::applyDesktopSwitcher() const { return m_applyDesktopSwitcher; } void KCMLookandFeel::setResetDefaultLayout(bool reset) { if (m_resetDefaultLayout == reset) { return; } m_resetDefaultLayout = reset; emit resetDefaultLayoutChanged(); if (reset) { setNeedsSave(true); } } bool KCMLookandFeel::resetDefaultLayout() const { return m_resetDefaultLayout; } diff --git a/kcms/lookandfeel/kcm_lookandfeel.desktop b/kcms/lookandfeel/kcm_lookandfeel.desktop index cf774b872..efa838074 100644 --- a/kcms/lookandfeel/kcm_lookandfeel.desktop +++ b/kcms/lookandfeel/kcm_lookandfeel.desktop @@ -1,120 +1,120 @@ [Desktop Entry] Icon=preferences-desktop-theme-global Exec=kcmshell5 kcm_lookandfeel Type=Service X-KDE-ServiceTypes=KCModule X-KDE-Library=kcm_lookandfeel X-KDE-ParentApp=kcontrol X-KDE-System-Settings-Parent-Category=appearance X-KDE-Weight=1 -Name=Look and Feel +Name=Global Theme Name[ca]=Aspecte i comportament Name[ca@valencia]=Aspecte i comportament Name[cs]=Vzhled a dojem Name[da]=Udseende og fremtoning Name[de]=Erscheinungsbild Name[el]=Εμφάνιση και αίσθηση Name[en_GB]=Look and Feel Name[es]=Aspecto visual Name[eu]=Itxura eta izaera Name[fi]=Ulkoasu ja tuntuma Name[fr]=Apparence Name[gl]=Aparencia e comportamento Name[he]=מראה ותחושה Name[hu]=Megjelenés Name[id]=Nuansa Dan Suasana Name[it]=Aspetto Name[ja]=外観 Name[ko]=모습과 느낌 Name[lt]=Išvaizda ir turinys Name[nb]=Utseende og oppførsel Name[nl]=Uiterlijk en gedrag Name[nn]=Utsjånad og åtferd Name[pa]=ਦਿੱਖ ਅਤੇ ਛੋਹ Name[pl]=Wrażenia wzrokowe i dotykowe Name[pt]=Aparência e Comportamento Name[pt_BR]=Aparência Name[ru]=Оформление рабочей среды Name[sk]=Vzhľad a nastavenie Name[sl]=Videz in občutek Name[sr]=Изглед и осећај Name[sr@ijekavian]=Изглед и осећај Name[sr@ijekavianlatin]=Izgled i osećaj Name[sr@latin]=Izgled i osećaj Name[sv]=Utseende och känsla Name[tr]=Bak ve Hisset Name[uk]=Вигляд і поведінка Name[x-test]=xxLook and Feelxx Name[zh_CN]=观感 Name[zh_TW]=外觀與感覺 -Comment=Choose Look and Feel theme +Comment=Choose global look and feel Comment[ca]=Trieu el tema d'aspecte i comportament Comment[ca@valencia]=Trieu el tema d'aspecte i comportament Comment[de]=Erscheinungsbild-Design auswählen Comment[en_GB]=Choose Look and Feel theme Comment[es]=Escoger un tema para el aspecto visual Comment[eu]=Aukeratu itxura eta izaera gaia Comment[fi]=Valitse ulkoasuteema Comment[fr]=Sélectionnez le thème d'apparence Comment[gl]=Escolla un tema de aparencia e comportamento Comment[id]=Pilihlah tema Nuansa dan Suasana Comment[it]=Scegli tema dell'aspetto Comment[ja]=外観テーマを選択 Comment[ko]=모습과 느낌 테마 선택 Comment[nl]=Thema voor uiterlijk en gedrag kiezen Comment[nn]=Vel tema for utsjånad og åtferd Comment[pl]=Wybierz jak będą wyglądać wrażenia wzrokowe i dotykowe Comment[pt]=Escolher o tema de Aparência e Comportamento Comment[pt_BR]=Escolha o tema de aparência Comment[ru]=Выбор оформления рабочей среды Plasma Comment[sk]=Vyberte tému pre vzhľad Comment[sv]=Välj tema för utseende och känsla Comment[uk]=Вибір теми вигляду і поведінки Comment[x-test]=xxChoose Look and Feel themexx Comment[zh_CN]=选择观感主题 Comment[zh_TW]=選擇「外觀與感覺」的主題 X-KDE-Keywords=theme, look, feel X-KDE-Keywords[bs]=tema,pogledaj,osjeti X-KDE-Keywords[ca]=tema, aspecte, comportament X-KDE-Keywords[ca@valencia]=tema, aspecte, comportament X-KDE-Keywords[cs]=motiv,vzhled,chování X-KDE-Keywords[da]=tema, udseende, fremtoning, look, feel X-KDE-Keywords[de]=Design,Erscheinungsbild X-KDE-Keywords[el]=θέμα, εμφάνιση, αίσθηση X-KDE-Keywords[en_GB]=theme, look, feel X-KDE-Keywords[es]=tema, aspecto visual X-KDE-Keywords[et]=teema, välimus X-KDE-Keywords[eu]=gaia,itxura,izaera X-KDE-Keywords[fi]=teema, ulkoasu, tuntuma X-KDE-Keywords[fr]=thème, apparence, comportement, graphique X-KDE-Keywords[gl]=tema, aparencia, estilo, comportamento X-KDE-Keywords[hu]=téma, megjelenés X-KDE-Keywords[id]=tema, nuansa, suasana X-KDE-Keywords[it]=tema,aspetto X-KDE-Keywords[ko]=theme, look, feel,테마, 모습과 느낌,외형,외관 X-KDE-Keywords[nb]=tema, utseende, oppførsel X-KDE-Keywords[nds]=Muster, Utsehn, Bedenen X-KDE-Keywords[nl]=thema, uiterlijk, gedrag X-KDE-Keywords[nn]=tema, utsjånad, åtferd X-KDE-Keywords[pa]=ਥੀਮ, ਦਿੱਖ, ਰਵੱਈਆ X-KDE-Keywords[pl]=wystrój, wygląd, odczucia, wrażenia X-KDE-Keywords[pt]=tema, aparência, comportamento X-KDE-Keywords[pt_BR]=tema, visual, aparência X-KDE-Keywords[ru]=theme,look,feel,тема,внешний вид рабочей среды,ощущение,стиль виджетов X-KDE-Keywords[sk]=téma, vzhľad, nastavenie X-KDE-Keywords[sl]=tema, videz, občutek X-KDE-Keywords[sr]=theme,look,feel,тема,изглед,осећај X-KDE-Keywords[sr@ijekavian]=theme,look,feel,тема,изглед,осећај X-KDE-Keywords[sr@ijekavianlatin]=theme,look,feel,tema,izgled,osećaj X-KDE-Keywords[sr@latin]=theme,look,feel,tema,izgled,osećaj X-KDE-Keywords[sv]=tema, utseende, känsla X-KDE-Keywords[tr]=tema, görünüm, duyum X-KDE-Keywords[uk]=theme,look,feel,тема,вигляд,поведінка X-KDE-Keywords[x-test]=xxthemexx,xx lookxx,xx feelxx X-KDE-Keywords[zh_CN]=theme, look, feel, 主题, 观感 X-KDE-Keywords[zh_TW]=theme, look, feel Categories=Qt;KDE;X-KDE-settings-looknfeel; diff --git a/kcms/lookandfeel/lnftool.cpp b/kcms/lookandfeel/lnftool.cpp index a4edfd78d..8d0bf31a5 100644 --- a/kcms/lookandfeel/lnftool.cpp +++ b/kcms/lookandfeel/lnftool.cpp @@ -1,98 +1,98 @@ /* * Copyright 2017 Marco MArtin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2, * or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "kcm.h" #include #include #include #include // Frameworks #include #include #include #include int main(int argc, char **argv) { QApplication app(argc, argv); const char version[] = "1.0"; // About data - KAboutData aboutData("lookandfeeltool", i18n("Look and feel tool"), version, i18n("Command line tool to apply look and feel packages."), KAboutLicense::GPL, i18n("Copyright 2017, Marco Martin")); + KAboutData aboutData("lookandfeeltool", i18n("Global Theme Tool"), version, i18n("Command line tool to apply global theme packages for changing the look and feel."), KAboutLicense::GPL, i18n("Copyright 2017, Marco Martin")); aboutData.addAuthor(i18n("Marco Martin"), i18n("Maintainer"), QStringLiteral("mart@kde.org")); aboutData.setDesktopFileName("org.kde.lookandfeeltool"); KAboutData::setApplicationData(aboutData); const static auto _l = QStringLiteral("list"); const static auto _a = QStringLiteral("apply"); const static auto _r = QStringLiteral("resetLayout"); QCommandLineOption _list = QCommandLineOption(QStringList() << QStringLiteral("l") << _l, - i18n("List available Look and feel packages")); + i18n("List available global theme packages")); QCommandLineOption _apply = QCommandLineOption(QStringList() << QStringLiteral("a") << _a, - i18n("Apply a look and feel package"), i18n("packagename")); + i18n("Apply a global theme package"), i18n("packagename")); QCommandLineOption _resetLayout = QCommandLineOption(QStringList() << _r, i18n("Reset the Plasma Desktop layout")); QCommandLineParser parser; parser.addOption(_list); parser.addOption(_apply); parser.addOption(_resetLayout); aboutData.setupCommandLine(&parser); parser.process(app); aboutData.processCommandLine(&parser); if (!parser.isSet(_list) && !parser.isSet(_apply)) { parser.showHelp(); } if (parser.isSet(_list)) { QList pkgs = KPackage::PackageLoader::self()->listPackages("Plasma/LookAndFeel"); for (const KPluginMetaData &data : pkgs) { std::cout << data.pluginId().toStdString() << std::endl; } } else if (parser.isSet(_apply)) { KPackage::Package p = KPackage::PackageLoader::self()->loadPackage("Plasma/LookAndFeel"); p.setPath(parser.value(_apply)); //can't use package.isValid as lnf packages always fallback, even when not existing if (p.metadata().pluginId() != parser.value(_apply)) { - std::cout << "Unable to find the look and feel package named " << parser.value(_apply).toStdString() << std::endl; + std::cout << "Unable to find the theme named " << parser.value(_apply).toStdString() << std::endl; return 1; } KCMLookandFeel *kcm = new KCMLookandFeel(nullptr, QVariantList()); kcm->load(); kcm->setResetDefaultLayout(parser.isSet(_resetLayout)); kcm->setSelectedPlugin(parser.value(_apply)); kcm->save(); delete kcm; } return 0; } diff --git a/kcms/lookandfeel/lookandfeel.knsrc b/kcms/lookandfeel/lookandfeel.knsrc index ef050722b..c324f43d1 100644 --- a/kcms/lookandfeel/lookandfeel.knsrc +++ b/kcms/lookandfeel/lookandfeel.knsrc @@ -1,47 +1,47 @@ [KNewStuff3] -Name=Look and Feel +Name=Global Themes Name[ca]=Aspecte i comportament Name[ca@valencia]=Aspecte i comportament Name[cs]=Vzhled a dojem Name[da]=Udseende og fremtoning Name[de]=Erscheinungsbild Name[el]=Εμφάνιση και αίσθηση Name[en_GB]=Look and Feel Name[es]=Aspecto visual Name[eu]=Itxura eta izaera Name[fi]=Ulkoasu ja tuntuma Name[fr]=Apparence Name[gl]=Aparencia e comportamento Name[he]=מראה ותחושה Name[hu]=Megjelenés Name[id]=Nuansa Dan Suasana Name[it]=Aspetto Name[ja]=外観 Name[ko]=모습과 느낌 Name[lt]=Išvaizda ir turinys Name[nb]=Utseende og oppførsel Name[nl]=Uiterlijk en gedrag Name[nn]=Utsjånad og åtferd Name[pa]=ਦਿੱਖ ਅਤੇ ਛੋਹ Name[pl]=Wrażenia wzrokowe i dotykowe Name[pt]=Aparência e Comportamento Name[pt_BR]=Aparência Name[ru]=Оформление рабочей среды Name[sk]=Vzhľad a nastavenie Name[sl]=Videz in občutek Name[sr]=Изглед и осећај Name[sr@ijekavian]=Изглед и осећај Name[sr@ijekavianlatin]=Izgled i osećaj Name[sr@latin]=Izgled i osećaj Name[sv]=Utseende och känsla Name[tr]=Bak ve Hisset Name[uk]=Вигляд і поведінка Name[x-test]=xxLook and Feelxx Name[zh_CN]=观感 Name[zh_TW]=外觀與感覺 ProvidersUrl=https://autoconfig.kde.org/ocs/providers.xml Categories=121 StandardResource=tmp InstallationCommand=kpackagetool5 -t Plasma/LookAndFeel -i %f UninstallCommand=kpackagetool5 -t Plasma/LookAndFeel -r %f diff --git a/kcms/lookandfeel/package/contents/ui/main.qml b/kcms/lookandfeel/package/contents/ui/main.qml index c9197cf28..20e3868a5 100644 --- a/kcms/lookandfeel/package/contents/ui/main.qml +++ b/kcms/lookandfeel/package/contents/ui/main.qml @@ -1,120 +1,120 @@ /* Copyright (c) 2018 Marco Martin This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License version 2 as published by the Free Software Foundation. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import QtQuick 2.6 import QtQuick.Layouts 1.1 import QtQuick.Window 2.2 import QtQuick.Controls 2.3 as QtControls import org.kde.kirigami 2.4 as Kirigami import org.kde.kconfig 1.0 // for KAuthorized import org.kde.kcm 1.1 as KCM KCM.GridViewKCM { - KCM.ConfigModule.quickHelp: i18n("This module lets you choose the Look and Feel theme.") + KCM.ConfigModule.quickHelp: i18n("This module lets you choose the global look and feel.") view.model: kcm.lookAndFeelModel view.currentIndex: kcm.selectedPluginIndex view.delegate: KCM.GridDelegate { id: delegate text: model.display toolTip: model.description thumbnailAvailable: model.screenshot thumbnail: Image { anchors.fill: parent source: model.screenshot || "" sourceSize: Qt.size(delegate.GridView.view.cellWidth * Screen.devicePixelRatio, delegate.GridView.view.cellHeight * Screen.devicePixelRatio) } actions: [ Kirigami.Action { visible: model.fullScreenPreview !== "" iconName: "view-preview" tooltip: i18n("Preview Theme") onTriggered: { previewWindow.url = model.fullScreenPreview; previewWindow.showFullScreen(); } } ] onClicked: { kcm.selectedPlugin = model.pluginName; view.forceActiveFocus(); resetCheckbox.checked = false; } } footer: ColumnLayout { Kirigami.InlineMessage { Layout.fillWidth: true type: Kirigami.MessageType.Warning text: i18n("Your desktop layout will be lost and reset to the default layout provided by the selected theme.") visible: resetCheckbox.checked } RowLayout { Layout.fillWidth: true QtControls.CheckBox { id: resetCheckbox checked: kcm.resetDefaultLayout text: i18n("Use desktop layout from theme") onCheckedChanged: kcm.resetDefaultLayout = checked; } Item { Layout.fillWidth: true } QtControls.Button { - text: i18n("Get New Look and Feel Themes...") + text: i18n("Get New Global Themes...") icon.name: "get-hot-new-stuff" onClicked: kcm.getNewStuff(this); visible: KAuthorized.authorize("ghns") } } } Window { id: previewWindow property alias url: previewImage.source color: Qt.rgba(0, 0, 0, 0.7) MouseArea { anchors.fill: parent Image { id: previewImage anchors.centerIn: parent fillMode: Image.PreserveAspectFit width: Math.min(parent.width, sourceSize.width) height: Math.min(parent.height, sourceSize.height) } onClicked: previewWindow.close() QtControls.ToolButton { anchors { top: parent.top right: parent.right } icon.name: "window-close" onClicked: previewWindow.close() } Shortcut { onActivated: previewWindow.close() sequence: "Esc" } } } } diff --git a/kcms/lookandfeel/package/metadata.desktop b/kcms/lookandfeel/package/metadata.desktop index bb8a79984..1b3c4f861 100644 --- a/kcms/lookandfeel/package/metadata.desktop +++ b/kcms/lookandfeel/package/metadata.desktop @@ -1,81 +1,81 @@ [Desktop Entry] -Name=Look and Feel +Name=Global Theme Name[ca]=Aspecte i comportament Name[ca@valencia]=Aspecte i comportament Name[cs]=Vzhled a dojem Name[da]=Udseende og fremtoning Name[de]=Erscheinungsbild Name[el]=Εμφάνιση και αίσθηση Name[en_GB]=Look and Feel Name[es]=Aspecto visual Name[eu]=Itxura eta izaera Name[fi]=Ulkoasu ja tuntuma Name[fr]=Apparence Name[gl]=Aparencia e comportamento Name[he]=מראה ותחושה Name[hu]=Megjelenés Name[id]=Nuansa Dan Suasana Name[it]=Aspetto Name[ja]=外観 Name[ko]=모습과 느낌 Name[lt]=Išvaizda ir turinys Name[nb]=Utseende og oppførsel Name[nl]=Uiterlijk en gedrag Name[nn]=Utsjånad og åtferd Name[pa]=ਦਿੱਖ ਅਤੇ ਛੋਹ Name[pl]=Wrażenia wzrokowe i dotykowe Name[pt]=Aparência e Comportamento Name[pt_BR]=Aparência Name[ru]=Оформление рабочей среды Name[sk]=Vzhľad a nastavenie Name[sl]=Videz in občutek Name[sr]=Изглед и осећај Name[sr@ijekavian]=Изглед и осећај Name[sr@ijekavianlatin]=Izgled i osećaj Name[sr@latin]=Izgled i osećaj Name[sv]=Utseende och känsla Name[tr]=Bak ve Hisset Name[uk]=Вигляд і поведінка Name[x-test]=xxLook and Feelxx Name[zh_CN]=观感 Name[zh_TW]=外觀與感覺 -Comment=Choose Look and Feel theme +Comment=Choose global look and feel Comment[ca]=Trieu el tema d'aspecte i comportament Comment[ca@valencia]=Trieu el tema d'aspecte i comportament Comment[de]=Erscheinungsbild-Design auswählen Comment[en_GB]=Choose Look and Feel theme Comment[es]=Escoger un tema para el aspecto visual Comment[eu]=Aukeratu itxura eta izaera gaia Comment[fi]=Valitse ulkoasuteema Comment[fr]=Sélectionnez le thème d'apparence Comment[gl]=Escolla un tema de aparencia e comportamento Comment[id]=Pilihlah tema Nuansa dan Suasana Comment[it]=Scegli tema dell'aspetto Comment[ja]=外観テーマを選択 Comment[ko]=모습과 느낌 테마 선택 Comment[nl]=Thema voor uiterlijk en gedrag kiezen Comment[nn]=Vel tema for utsjånad og åtferd Comment[pl]=Wybierz jak będą wyglądać wrażenia wzrokowe i dotykowe Comment[pt]=Escolher o tema de Aparência e Comportamento Comment[pt_BR]=Escolha o tema de aparência Comment[ru]=Выбор оформления рабочей среды Plasma Comment[sk]=Vyberte tému pre vzhľad Comment[sv]=Välj tema för utseende och känsla Comment[uk]=Вибір теми вигляду і поведінки Comment[x-test]=xxChoose Look and Feel themexx Comment[zh_CN]=选择观感主题 Comment[zh_TW]=選擇「外觀與感覺」的主題 Icon=preferences-desktop-theme-style Keywords= Type=Service X-KDE-ParentApp= X-KDE-PluginInfo-Author=Marco Martin X-KDE-PluginInfo-Email=mart@kde.org X-KDE-PluginInfo-License=GPLv2 X-KDE-PluginInfo-Name=kcm_lookandfeel X-KDE-PluginInfo-Version= X-KDE-PluginInfo-Website=https://www.kde.org/plasma-desktop X-KDE-ServiceTypes=Plasma/Generic X-Plasma-API=declarativeappletscript X-Plasma-MainScript=ui/main.qml