diff --git a/kcm_sddm.desktop b/kcm_sddm.desktop index 45bae61..78bfdd7 100644 --- a/kcm_sddm.desktop +++ b/kcm_sddm.desktop @@ -1,134 +1,135 @@ [Desktop Entry] Exec=kcmshell5 kcm_sddm Icon=preferences-system-login Type=Service Categories=Qt;KDE;X-KDE-settings-system; X-KDE-ServiceTypes=KCModule X-KDE-Library=kcm_sddm X-KDE-ParentApp=kcontrol X-KDE-System-Settings-Parent-Category=session X-KDE-Weight=10 X-KDE-Keywords=sddm,display manager,theme X-KDE-Keywords[ar]=sddm,مدير عرض,سمة X-KDE-Keywords[ast]=sddm,pantalla,xestor,tema X-KDE-Keywords[bs]=sddm,menadžer ekrana,teme X-KDE-Keywords[ca]=sddm,gestor de sessions,tema X-KDE-Keywords[ca@valencia]=sddm,gestor de sessions,tema X-KDE-Keywords[cs]=sddm,správce obrazovky,motiv X-KDE-Keywords[da]=sddm,display manager,tema,login skærm X-KDE-Keywords[de]=SDDM,Display-manager,Design X-KDE-Keywords[el]=sddm,διαχειριστής εμφάνισης,θέμα X-KDE-Keywords[en_GB]=sddm,display manager,theme X-KDE-Keywords[es]=sddm,gestor de pantallas,tema X-KDE-Keywords[et]=sddm,kuvahaldur,teema X-KDE-Keywords[eu]=sddm,bistaratze kudeatzailea,gaia X-KDE-Keywords[fi]=sddm,display manager,theme,kirjautumisruutu,kirjautumisohjelma,sisäänkirjautumisruutu,sisäänkirjautumisohjelma,teema X-KDE-Keywords[fr]=sddm,gestionnaire d'affichage,thème X-KDE-Keywords[gl]=sddm,xestor de pantallas,tema X-KDE-Keywords[he]=sddm,display manager,theme,מנהל תצוגה,ערכת נושא X-KDE-Keywords[hu]=sddm,bejelentkezéskezelő,téma X-KDE-Keywords[id]=sddm,pengelola display,tema X-KDE-Keywords[it]=sddm,gestore dello schermo,tema X-KDE-Keywords[ko]=sddm,display manager,theme,디스플레이 관리자,테마 X-KDE-Keywords[lt]=sddm,ekrano tvarkytuvė,tema X-KDE-Keywords[nb]=sddm,vindusbehandler,tema X-KDE-Keywords[nl]=sddm,displaymanager,thema X-KDE-Keywords[nn]=sddm,innloggingshandsamar,tema X-KDE-Keywords[pa]=sddm,ਡਿਸਪਲੇਅ ਮੈਨੇਜਰ,ਥੀਮ X-KDE-Keywords[pl]=sddm,menadżer wyświetlania,motyw,wystrój, zarządzanie wyświetlaniem X-KDE-Keywords[pt]=sddm,gestor de autenticação,tema X-KDE-Keywords[pt_BR]=sddm,gerenciador de tela,tema X-KDE-Keywords[ro]=sddm,gestionar de afișaje,temă X-KDE-Keywords[ru]=sddm,display manager,theme,users,login,greeting,logo,styles,background,wallpapers,sessions, shutdown,restart,диспетчер сеанса,диспетчер входа в систему,пользователи,логин,вход в систему,приветствие,логотип,лого,стили,тема курсоров мыши,указатели мыши,фон,обои,сессии,сеансы,завершение работы,перезагрузка,выключение,автоматический вход в систему X-KDE-Keywords[sk]=sddm,správca obrazovky,téma X-KDE-Keywords[sl]=sddm,upravljalnik zaslona,tema X-KDE-Keywords[sr]=sddm,display manager,theme,СДДМ,менаџер пријављивања,тема X-KDE-Keywords[sr@ijekavian]=sddm,display manager,theme,СДДМ,менаџер пријављивања,тема X-KDE-Keywords[sr@ijekavianlatin]=sddm,display manager,theme,SDDM,menadžer prijavljivanja,tema X-KDE-Keywords[sr@latin]=sddm,display manager,theme,SDDM,menadžer prijavljivanja,tema X-KDE-Keywords[sv]=sddm,skärmhanterare,tema X-KDE-Keywords[tr]=sddm, görüntü yöneticisi, tema X-KDE-Keywords[uk]=sddm,display manager,theme,керування входом,сддм,тема X-KDE-Keywords[x-test]=xxsddmxx,xxdisplay managerxx,xxthemexx X-KDE-Keywords[zh_CN]=sddm,display manager,theme,显示管理器,主题 X-KDE-Keywords[zh_TW]=sddm,display manager,theme Name=Login Screen (SDDM) Name[ar]=مدير الولوج (SDDM) Name[ast]=Pantalla d'aniciu de sesión (SDDM) Name[bs]=Prijavni ekran (SDDM) Name[ca]=Pantalla d'inici de sessió (SDDM) Name[ca@valencia]=Pantalla d'inici de sessió (SDDM) Name[cs]=Přihlašovací obrazovka (SDDM) Name[da]=Login-skærm (SDDM) Name[de]=Anmeldebildschirm (SDDM) Name[el]=Οθόνη εισόδου (SDDM) Name[en_GB]=Login Screen (SDDM) Name[es]=Pantalla de inicio de sesión (SDDM) Name[et]=Sisselogimisekraan (SDDM) Name[eu]=Saio hasteko pantaila (SDDM) Name[fi]=Kirjautumisruutu (SDDM) Name[fr]=Écran de connexion (SDDM) Name[gl]=Pantalla de identificación (SDDM) Name[he]=מסך התחברות Name[hu]=Bejelentkező képernyő (SDDM) Name[id]=Layar Log Masuk (SDDM) Name[it]=Schermata di accesso (SDDM) Name[ko]=로그인 화면(SDDM) Name[lt]=Prisijungimo langas (SDDM) Name[nb]=Loginn-skjerm (SDDM) Name[nl]=Aanmeldscherm (SDDM) Name[nn]=Innloggingsbilete (SDDM) Name[pa]=ਲਾਗਇਨ ਸਕਰੀਨ (SDDM) Name[pl]=Ekran logowania (SDDM) Name[pt]=Ecrã de Autenticação (SDDM) Name[pt_BR]=Tela de autenticação (SDDM) Name[ro]=Ecran de autentificare (SDDM) Name[ru]=Вход в систему (SDDM) Name[sk]=Prihlasovacia obrazovka (SDDM) Name[sl]=Prijavni zaslon (SDDM) Name[sr]=Пријавни екран (СДДМ) Name[sr@ijekavian]=Пријавни екран (СДДМ) Name[sr@ijekavianlatin]=Prijavni ekran (SDDM) Name[sr@latin]=Prijavni ekran (SDDM) Name[sv]=Inloggningsfönster (SDDM) Name[tr]=Oturum Ekranı (SDDM) Name[uk]=Вікно входу (SDDM) Name[x-test]=xxLogin Screen (SDDM)xx Name[zh_CN]=登录屏幕 (SDDM) Name[zh_TW]=登入畫面(SDDM) Comment=Configure Login Manager +Comment[ar]=اضبط مدير الولوج Comment[ca]=Configura el gestor d'accés Comment[ca@valencia]=Configura el gestor d'accés Comment[cs]=Nastavit správce přihlášení... Comment[da]=Indstil loginhåndtering Comment[de]=Anmeldungsverwaltung einrichten Comment[en_GB]=Configure Login Manager Comment[es]=Configurar el gestor de inicio de sesión Comment[eu]=Konfiguratu saio-hasteko kudeatzailea Comment[fi]=Kirjautumisikkunan asetukset Comment[fr]=Configurer le gestionnaire de connexion Comment[gl]=Configurar o xestor de identificación Comment[hu]=A bejelentkezéskezelő beállításai Comment[it]=Configura gestore degli accessi Comment[ko]=로그인 관리자 설정 Comment[nl]=Aanmeldbeheerder configureren Comment[nn]=Set opp innloggingshandsamar Comment[pl]=Ustawienia zarządzania logowaniem Comment[pt]=Configurar o Gestor de Autenticação Comment[pt_BR]=Configurar o gerenciador de login Comment[ru]=Настройка диспетчера входа в систему Comment[sk]=Nastaviť správcu prihlásenia Comment[sl]=Nastavi upravljalnika prijav Comment[sr]=Подесите менаџер пријављивања Comment[sr@ijekavian]=Подесите менаџер пријављивања Comment[sr@ijekavianlatin]=Podesite menadžer prijavljivanja Comment[sr@latin]=Podesite menadžer prijavljivanja Comment[sv]=Anpassa inloggningshanterare Comment[tr]=Giriş Yöneticisini Yapılandır Comment[uk]=Налаштування керування входом до системи Comment[x-test]=xxConfigure Login Managerxx Comment[zh_CN]=配置登录管理器 Comment[zh_TW]=配置登入管理器 diff --git a/src/themeconfig.cpp b/src/themeconfig.cpp index 5e76810..9722216 100644 --- a/src/themeconfig.cpp +++ b/src/themeconfig.cpp @@ -1,238 +1,240 @@ /* Copyright 2013 by Reza Fatahilah Shah 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 of the License, 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 General Public License along with this program. If not, see . */ #include "themeconfig.h" #include "ui_themeconfig.h" #include "themesmodel.h" #include "themesdelegate.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "config.h" ThemeConfig::ThemeConfig(QWidget *parent) : QWidget(parent) { mConfig = KSharedConfig::openConfig(SDDM_CONFIG_FILE, KConfig::SimpleConfig); configUi = new Ui::ThemeConfig(); configUi->setupUi(this); configUi->messageWidget->setVisible(false); ThemesModel *model = new ThemesModel(this); configUi->themesListView->setModel(model); ThemesDelegate *delegate = new ThemesDelegate(configUi->themesListView); delegate->setPreviewSize(QSize(128,128)); configUi->themesListView->setItemDelegate(delegate); model->populate(); connect(this, &ThemeConfig::themesChanged, model, &ThemesModel::populate); connect(configUi->themesListView, SIGNAL(activated(QModelIndex)), SLOT(themeSelected(QModelIndex))); connect(configUi->themesListView, SIGNAL(clicked(QModelIndex)), SLOT(themeSelected(QModelIndex))); connect(configUi->selectBackgroundButton, SIGNAL(imagePathChanged(QString)), SLOT(backgroundChanged(QString))); connect(configUi->getNewButton, &QPushButton::clicked, this, &ThemeConfig::getNewStuffClicked); connect(configUi->installFromFileButton, &QPushButton::clicked, this, &ThemeConfig::installFromFileClicked); connect(configUi->removeThemeButton, &QPushButton::clicked, this, &ThemeConfig::removeThemeClicked); prepareInitialTheme(); } ThemeConfig::~ThemeConfig() { delete configUi; } QVariantMap ThemeConfig::save() { QModelIndex index = configUi->themesListView->currentIndex(); if (!index.isValid()) { return QVariantMap(); } QVariantMap args; args["sddm.conf/Theme/Current"] = index.data(ThemesModel::IdRole); if (!mThemeConfigPath.isEmpty()) { if (!mBackgroundPath.isEmpty()) { args["theme.conf.user/General/background"] = mBackgroundPath; args["theme.conf.user/General/type"] = QStringLiteral("image"); } else { args["theme.conf.user/General/type"] = QStringLiteral("color"); } } return args; } QString ThemeConfig::themeConfigPath() const { return mThemeConfigPath; } void ThemeConfig::prepareInitialTheme() { const QString initialTheme = mConfig->group("Theme").readEntry("Current"); QModelIndex index = findThemeIndex(initialTheme); if (!index.isValid() && configUi->themesListView->model()->rowCount() > 0) { //if we can't find the currently configured theme from the config, just select the first theme in the UI index = configUi->themesListView->model()->index(0,0); } configUi->themesListView->setCurrentIndex(index); themeSelected(index); } QModelIndex ThemeConfig::findThemeIndex(const QString &id) const { QAbstractItemModel* model = configUi->themesListView->model(); for (int i=0; i < model->rowCount(); i++) { QModelIndex index = model->index(i, 0); if (index.data(ThemesModel::IdRole).toString() == id) { return index; } } return QModelIndex(); } void ThemeConfig::themeSelected(const QModelIndex &index) { if (!configUi->quickWidget->source().isValid()) { const QString mainQmlPath = QStandardPaths::locate(QStandardPaths::GenericDataLocation, "sddm-kcm/main.qml"); configUi->quickWidget->setSource(QUrl::fromLocalFile(mainQmlPath)); } QString themePath = index.data(ThemesModel::PathRole).toString(); QString previewFilename = themePath + index.data(ThemesModel::PreviewRole).toString(); configUi->quickWidget->rootObject()->setProperty("themeName", index.data().toString()); configUi->quickWidget->rootObject()->setProperty("previewPath", previewFilename); configUi->quickWidget->rootObject()->setProperty("authorName", index.data(ThemesModel::AuthorRole).toString()); configUi->quickWidget->rootObject()->setProperty("description", index.data(ThemesModel::DescriptionRole).toString()); configUi->quickWidget->rootObject()->setProperty("license", index.data(ThemesModel::LicenseRole).toString()); configUi->quickWidget->rootObject()->setProperty("email", index.data(ThemesModel::EmailRole).toString()); configUi->quickWidget->rootObject()->setProperty("website", index.data(ThemesModel::WebsiteRole).toString()); configUi->quickWidget->rootObject()->setProperty("copyright", index.data(ThemesModel::CopyrightRole).toString()); configUi->quickWidget->rootObject()->setProperty("version", index.data(ThemesModel::VersionRole).toString()); //Check if we need to display configuration group QString configPath = themePath + index.data(ThemesModel::ConfigFileRole).toString(); prepareConfigurationUi(configPath); emit changed(true); } void ThemeConfig::backgroundChanged(const QString &imagePath) { mBackgroundPath = imagePath; emit changed(true); } void ThemeConfig::prepareConfigurationUi(const QString &configPath) { mThemeConfigPath = configPath; QFile configFile(configPath); if (configFile.exists()) { - KSharedConfigPtr themeConfig = KSharedConfig::openConfig(configFile.fileName() + ".user", KConfig::SimpleConfig); + KSharedConfigPtr themeConfig = KSharedConfig::openConfig(configFile.fileName() + ".user", KConfig::CascadeConfig); + themeConfig->addConfigSources({configFile.fileName()}); + configUi->customizeBox->setVisible(true); configUi->selectBackgroundButton->setImagePath(themeConfig->group("General").readEntry("background")); } else { configUi->customizeBox->setVisible(false); } } void ThemeConfig::dump() { //dump sddm conf KConfigGroup config = mConfig->group("General"); qDebug() << "Current theme:" << config.readEntry("CurrentTheme"); } void ThemeConfig::getNewStuffClicked() { QPointer dialog(new KNS3::DownloadDialog(QStringLiteral("sddmtheme.knsrc"), this)); dialog->setWindowTitle(i18n("Download New SDDM Themes")); if (dialog->exec()) { emit themesChanged(); } delete dialog.data(); } void ThemeConfig::installFromFileClicked() { QPointer dialog(new QFileDialog(this)); dialog->exec(); QStringList files = dialog->selectedFiles(); if (files.count() == 1) { QString file = files.first(); KAuth::Action saveAction(QStringLiteral("org.kde.kcontrol.kcmsddm.installtheme")); saveAction.setHelperId("org.kde.kcontrol.kcmsddm"); saveAction.addArgument(QStringLiteral("filePath"), file); auto job = saveAction.execute(); if (!job->exec()) { configUi->messageWidget->setMessageType(KMessageWidget::Warning); configUi->messageWidget->setText(job->errorString()); configUi->messageWidget->animatedShow(); } else { emit themesChanged(); } } delete dialog.data(); } void ThemeConfig::removeThemeClicked() { if (!configUi->themesListView->currentIndex().isValid()) { return; } const QString path = configUi->themesListView->currentIndex().data(ThemesModel::PathRole).toString(); KAuth::Action saveAction(QStringLiteral("org.kde.kcontrol.kcmsddm.uninstalltheme")); saveAction.setHelperId("org.kde.kcontrol.kcmsddm"); saveAction.addArgument(QStringLiteral("filePath"), path); auto job = saveAction.execute(); if (!job->exec()) { configUi->messageWidget->setMessageType(KMessageWidget::Warning); configUi->messageWidget->setText(job->errorString()); configUi->messageWidget->animatedShow(); } else { emit themesChanged(); } }