Commit 6eaff207 authored by Mikhail Zolotukhin's avatar Mikhail Zolotukhin

[App Style KCM] Use QtQuick NewStuff dialogs

Summary:
Make the dialogs consistent with others KCMs by using QtQuick versions.

Test Plan: Test dialogs for GTK themes installation.

Reviewers: broulik, ngraham

Reviewed By: ngraham

Subscribers: jferrer, #localization, yurchor, ngraham, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D26717
parent 05569e53
......@@ -41,7 +41,7 @@ target_link_libraries(kcm_style
kcoreaddons_desktop_to_json(kcm_style "kcm_style.desktop")
install(FILES stylesettings.kcfg DESTINATION ${KDE_INSTALL_KCFGDIR})
install(FILES cgctheme.knsrc cgcgtk3.knsrc DESTINATION ${KDE_INSTALL_KNSRCDIR})
install(FILES gtk2_themes.knsrc gtk3_themes.knsrc DESTINATION ${KDE_INSTALL_KNSRCDIR})
install(FILES kcm_style.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR})
install(TARGETS kcm_style DESTINATION ${KDE_INSTALL_PLUGINDIR}/kcms)
......
[KNewStuff3]
Name=GTK 2.x Themes
Name[ar]=سمات جتك الثّانية
Name[ast]=Estilos pa GTK 2.x
Name[ca]=Temes GTK 2.x
Name[ca@valencia]=Temes GTK 2.x
Name[cs]=Motivy GTK 2.x
Name[da]=GTK 2.x-temaer
Name[de]=GTK 2.x-Designs
Name[el]=Θέματα GTK 2.x
Name[en_GB]=GTK 2.x Themes
Name[es]=Temas de GTK 2.x
Name[et]=GTK 2.x teemad
Name[eu]=GTK 2.x gaiak
Name[fi]=GTK 2.x -teemat
Name[fr]=Thèmes GTK 2.x
Name[gl]=Temas de GTK 2.x
Name[he]=ערכות נושא של GTK 2.x
Name[hu]=GTK 2.x témák
Name[id]=Tema GTK 2.x
Name[it]=Temi GTK 2.x
Name[ko]=GTK 2.x 테마
Name[lt]=GTK 2.x apipavidalinimai
Name[nl]=GTK 2.x thema's
Name[nn]=GTK 2.x-tema
Name[pl]=Wygląd GTK 2.x
Name[pt]=Temas do GTK 2.x
Name[pt_BR]=Temas GTK 2.x
Name[ru]=Темы GTK 2.x
Name[sk]=Témy GTK 2.x
Name[sl]=Teme GTK 2.x
Name[sr]=ГТК 2.x теме
Name[sr@ijekavian]=ГТК 2.x теме
Name[sr@ijekavianlatin]=GTK 2.x teme
Name[sr@latin]=GTK 2.x teme
Name[sv]=GTK 2.x-teman
Name[tg]=Мавзӯъҳои GTK 2.x
Name[tr]=GTK 2.x Temaları
Name[uk]=Теми GTK 2.x
Name[x-test]=xxGTK 2.x Themesxx
Name[zh_CN]=GTK 2.x 主题
Name[zh_TW]=GTK 2.x 主題
Categories=GTK 2.x Theme/Style
......
[KNewStuff3]
Name=GTK 3.x Themes
Name[ar]=سمات جتك الثّالثة
Name[ast]=Estilos pa GTK 3.x
Name[ca]=Temes GTK 3.x
Name[ca@valencia]=Temes GTK 3.x
Name[cs]=Motivy GTK 3.x
Name[da]=GTK 3.x-temaer
Name[de]=GTK 3.x-Designs
Name[el]=Θέματα GTK 3.x
Name[en_GB]=GTK 3.x Themes
Name[es]=Temas de GTK 3.x
Name[et]=GTK 3.x teemad
Name[eu]=GTK 3.x gaiak
Name[fi]=GTK 3.x -teemat
Name[fr]=Thèmes GTK 3.x
Name[gl]=Temas de GTK 3.x
Name[he]=ערכות נושא של GTK 3.x
Name[hu]=GTK 3.x témák
Name[id]=Tema GTK 3.x
Name[it]=Temi GTK 3.x
Name[ko]=GTK 3.x 테마
Name[lt]=GTK 3.x apipavidalinimai
Name[nl]=GTK 3.x thema's
Name[nn]=GTK 3.x-tema
Name[pl]=Wygląd GTK 3.x
Name[pt]=Temas do GTK 3.x
Name[pt_BR]=Temas GTK 3.x
Name[ru]=Темы GTK 3.x
Name[sk]=Témy GTK 3.x
Name[sl]=Teme GTK 3.x
Name[sr]=ГТК 3.x теме
Name[sr@ijekavian]=ГТК 3.x теме
Name[sr@ijekavianlatin]=GTK 3.x teme
Name[sr@latin]=GTK 3.x teme
Name[sv]=GTK 3.x-teman
Name[tg]=Мавзӯъҳои GTK 3.x
Name[tr]=GTK 3.x Temaları
Name[uk]=Теми GTK 3.x
Name[x-test]=xxGTK 3.x Themesxx
Name[zh_CN]=GTK 3.x 主题
Name[zh_TW]=GTK 3.x 主題
Categories=GTK 3.x Theme/Style
......
......@@ -79,32 +79,20 @@ void GtkPage::showGtk3Preview()
gtkConfigInterface.call(QStringLiteral("showGtk3ThemePreview"), m_gtk3ThemesModel->selectedTheme());
}
void GtkPage::installGtk2ThemeFromGHNS()
void GtkPage::onThemeRemoved()
{
KNS3::DownloadDialog downloadDialog(QStringLiteral("cgctheme.knsrc"));
downloadDialog.setWindowTitle(i18n("Download New GNOME/GTK2 Application Styles"));
downloadDialog.setWindowModality(Qt::WindowModal);
if (downloadDialog.exec()) {
load();
}
load();
defaults();
save();
}
void GtkPage::installGtk3ThemeFromGHNS()
void GtkPage::onGhnsEntriesChanged(const QQmlListReference &changedEnties)
{
KNS3::DownloadDialog downloadDialog(QStringLiteral("cgcgtk3.knsrc"));
downloadDialog.setWindowTitle(i18n("Download New GNOME/GTK3 Application Styles"));
downloadDialog.setWindowModality(Qt::WindowModal);
if (downloadDialog.exec()) {
load();
if (changedEnties.count() == 0) {
return;
}
}
void GtkPage::onThemeRemoved()
{
load();
defaults();
save();
}
void GtkPage::installGtkThemeFromFile(const QUrl &fileUrl)
......
......@@ -22,6 +22,7 @@
#include <QObject>
#include <QDBusInterface>
#include <QQmlListReference>
#include "gtkthemesmodel.h"
......@@ -48,10 +49,9 @@ public Q_SLOTS:
void showGtk3Preview();
void installGtkThemeFromFile(const QUrl &fileUrl);
void installGtk2ThemeFromGHNS();
void installGtk3ThemeFromGHNS();
void onThemeRemoved();
void onGhnsEntriesChanged(const QQmlListReference &changedEnties);
Q_SIGNALS:
void gtk2ThemesModelChanged(GtkThemesModel *model);
......
......@@ -33,7 +33,6 @@ class GtkThemesModel : public QAbstractListModel {
public:
GtkThemesModel(QObject *parent = nullptr);
~GtkThemesModel() override = default;
enum Roles {
ThemeNameRole = Qt::UserRole + 1,
......
......@@ -24,6 +24,7 @@ import QtQuick.Dialogs 1.0 as QtDialogs
import QtQuick.Controls 2.10 as QtControls
import org.kde.kirigami 2.10 as Kirigami
import org.kde.private.kcms.style 1.0 as Private
import org.kde.newstuff 1.62 as NewStuff
import org.kde.kcm 1.2 as KCM
Kirigami.Page {
......@@ -151,7 +152,7 @@ Kirigami.Page {
QtControls.Button {
icon.name: "get-hot-new-stuff"
text: i18n("Get New GNOME/GTK Application Styles...")
text: i18n("Download New GNOME/GTK Application Styles...")
onClicked: ghnsMenu.open()
QtControls.Menu {
......@@ -159,21 +160,40 @@ Kirigami.Page {
QtControls.MenuItem {
icon.name: "get-hot-new-stuff"
text: i18n("Get New GNOME/GTK2 Application Styles...")
text: i18n("Download New GNOME/GTK2 Application Styles...")
onClicked: function() {
ghnsMenu.close()
kcm.gtkPage.installGtk2ThemeFromGHNS()
gtk2NewStuffButton.showDialog()
}
NewStuff.Button {
id: gtk2NewStuffButton
downloadNewWhat: i18n("GNOME/GTK2 Application Styles")
configFile: "gtk2_themes.knsrc"
viewMode: NewStuff.Page.ViewMode.Preview
onChangedEntriesChanged: kcm.gtkPage.onGhnsEntriesChanged(gtk2NewStuffButton.changedEntries);
visible: false
}
}
QtControls.MenuItem {
icon.name: "get-hot-new-stuff"
text: i18n("Get New GNOME/GTK3 Application Styles...")
text: i18n("Download New GNOME/GTK3 Application Styles...")
onClicked: function() {
ghnsMenu.close()
kcm.gtkPage.installGtk3ThemeFromGHNS()
gtk3NewStuffButton.showDialog()
}
NewStuff.Button {
id: gtk3NewStuffButton
downloadNewWhat: i18n("GNOME/GTK3 Application Styles")
configFile: "gtk3_themes.knsrc"
viewMode: NewStuff.Page.ViewMode.Preview
onChangedEntriesChanged: kcm.gtkPage.onGhnsEntriesChanged(gtk3NewStuffButton.changedEntries);
visible: false
}
}
}
}
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment