diff --git a/debian/changelog b/debian/changelog index 89b47fd..dd13851 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +lxqt-config (1.1.0-0ubuntu2) kinetic; urgency=medium + + * Enhancements to the theme list. + + -- Simon Quigley Sat, 11 Jun 2022 14:22:35 -0400 + lxqt-config (1.1.0-0ubuntu1) kinetic; urgency=medium * New upstream release. diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 0000000..abd6d2a --- /dev/null +++ b/debian/patches/series @@ -0,0 +1 @@ +theme-list-enhancements.patch diff --git a/debian/patches/theme-list-enhancements.patch b/debian/patches/theme-list-enhancements.patch new file mode 100644 index 0000000..361c130 --- /dev/null +++ b/debian/patches/theme-list-enhancements.patch @@ -0,0 +1,109 @@ +From ccc2ede1557523ed396e488f705132f187ab750f Mon Sep 17 00:00:00 2001 +From: tsujan +Date: Mon, 16 May 2022 19:05:49 +0430 +Subject: [PATCH] Small enhancement to theme list in appearance config dialog + (#854) + +* Small enhancement to theme list in appearance config dialog + +Themes are always sorted alphabetically, user themes are distinguished, and theme folders can be opened by double clicking or by using context menus. + +Closes https://github.com/lxqt/lxqt-config/issues/852 + +* Don't use `WhatsThisRole` for theme path + +`WhatsThisRole` might be needed later for another purpose, and finding the theme path directly has no real cost. +--- + lxqt-config-appearance/lxqtthemeconfig.cpp | 40 ++++++++++++++++++++++ + lxqt-config-appearance/lxqtthemeconfig.h | 4 +++ + 2 files changed, 44 insertions(+) + +diff --git a/lxqt-config-appearance/lxqtthemeconfig.cpp b/lxqt-config-appearance/lxqtthemeconfig.cpp +index 49b65e8b..8bc903f8 100644 +--- a/lxqt-config-appearance/lxqtthemeconfig.cpp ++++ b/lxqt-config-appearance/lxqtthemeconfig.cpp +@@ -32,6 +32,11 @@ + #include + #include + #include ++#include ++#include ++#include ++ ++#include + + /*! + * \brief Simple delegate to draw system background color below decoration/icon +@@ -84,6 +89,10 @@ LXQtThemeConfig::LXQtThemeConfig(LXQt::Settings *settings, QWidget *parent) : + { + QString themeName = theme.name(); + themeName[0] = themeName[0].toTitleCase(); ++ if (theme.path().contains(XdgDirs::dataHome(false) + QStringLiteral("/"))) ++ { ++ themeName += QStringLiteral(" ") + tr("(User Theme)"); ++ } + QTreeWidgetItem *item = new QTreeWidgetItem(QStringList(themeName)); + if (!theme.previewImage().isEmpty()) + { +@@ -93,11 +102,16 @@ LXQtThemeConfig::LXQtThemeConfig(LXQt::Settings *settings, QWidget *parent) : + item->setData(0, Qt::UserRole, theme.name()); + ui->lxqtThemeList->addTopLevelItem(item); + } ++ ui->lxqtThemeList->sortItems(0, Qt::AscendingOrder); ++ ui->lxqtThemeList->setContextMenuPolicy(Qt::CustomContextMenu); + + initControls(); + + connect(ui->lxqtThemeList, &QTreeWidget::currentItemChanged, this, &LXQtThemeConfig::settingsChanged); + connect(ui->wallpaperOverride, &QAbstractButton::clicked, this, &LXQtThemeConfig::settingsChanged); ++ ++ connect(ui->lxqtThemeList, &QTreeWidget::itemDoubleClicked, this, &LXQtThemeConfig::doubleClicked); ++ connect(ui->lxqtThemeList, &QWidget::customContextMenuRequested, this, &LXQtThemeConfig::contextMenu); + } + + +@@ -145,3 +159,29 @@ void LXQtThemeConfig::applyLxqtTheme() + } + } + } ++ ++void LXQtThemeConfig::doubleClicked(QTreeWidgetItem *item, int /*column*/) ++{ ++ if (!item) ++ return; ++ ++ LXQt::LXQtTheme theme{item->data(0, Qt::UserRole).toString()}; ++ if (!theme.isValid()) ++ return; ++ ++ // first try "qtxdg-mat"; fall back to QDesktopServices if we are not inside an LXQt session ++ if (!QProcess::startDetached(QStringLiteral("qtxdg-mat"), QStringList() << QStringLiteral("open") << theme.path())) ++ { ++ QDesktopServices::openUrl(QUrl(theme.path())); ++ } ++} ++ ++void LXQtThemeConfig::contextMenu(const QPoint& p) ++{ ++ QMenu menu; ++ QAction *a = menu.addAction(tr("Open theme folder")); ++ connect(a, &QAction::triggered, [this, p] { ++ doubleClicked(ui->lxqtThemeList->itemAt(p), 0); ++ }); ++ menu.exec(ui->lxqtThemeList->viewport()->mapToGlobal(p)); ++} +diff --git a/lxqt-config-appearance/lxqtthemeconfig.h b/lxqt-config-appearance/lxqtthemeconfig.h +index 8846dbbe..1886738c 100644 +--- a/lxqt-config-appearance/lxqtthemeconfig.h ++++ b/lxqt-config-appearance/lxqtthemeconfig.h +@@ -53,6 +53,10 @@ public slots: + signals: + void settingsChanged(); + ++private slots: ++ void doubleClicked(QTreeWidgetItem *item, int column); ++ void contextMenu(const QPoint& p); ++ + private: + Ui::LXQtThemeConfig *ui; + LXQt::Settings *mSettings;