#include "knewstuff_export.h"
#include "entry.h"
namespace KNSCore
{
class Engine;
}
namespace KNS3
{
class DownloadWidgetPrivate;
/**
* KNewStuff download widget.
*
* The download widget will present items to the user
* for installation, updates and removal.
* Preview images as well as other meta information can be seen.
*
* \section knsrc knsrc Files
* The Dialog is configured by a .knsrc file containing the KHotNewStuff configuration.
* Your application should install a file called: $KDEDIR/share/config/appname.knsrc
*
* The file could look like this for wallpapers:
*
[KNewStuff3]
- ProvidersUrl=http://download.kde.org/ocs/providers.xml
+ ProvidersUrl=https://download.kde.org/ocs/providers.xml
Categories=KDE Wallpaper 1920x1200,KDE Wallpaper 1600x1200
StandardResource=wallpaper
Uncompress=archive
*
*
* Uncompress can be one of: always, never or archive:
*
* - always: assume all downloaded files are archives and need to be extracted
* - never: never try to extract the file
* - archive: if the file is an archive, uncompress it, otherwise just pass it on
* - subdir: logic as archive, but decompress into a subdirectory named after the payload filename
*
*
* You have different options to set the target install directory:
* - StandardResource: not available in KF5, use XdgTargetDir instead.
* - TargetDir: since KF5, this is equivalent to XdgTargetDir.
*
- XdgTargetDir: a directory in the $XDG_DATA_HOME directory such as .local/share/wallpapers.
* This is what QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1Char('/') + name will return.
*
*
* @since 4.5
*/
class KNEWSTUFF_EXPORT DownloadWidget : public QWidget
{
Q_OBJECT
public:
/**
* Create a download widget that lets the user install, update and uninstall
* contents. It will try to find a appname.knsrc file with the configuration.
* Appname is the name of your application as provided in the about data->
*
* @param parent the parent of the dialog
*/
explicit DownloadWidget(QWidget *parent = nullptr);
/**
* Create a download widget that lets the user install, update and uninstall
* contents. Manually specify the name of a .knsrc file where the
* KHotNewStuff configuration can be found.
*
* @param configFile the name of the configuration file
* @param parent the parent of the dialog
*/
explicit DownloadWidget(const QString &configFile, QWidget *parent = nullptr);
/**
* destructor
*/
~DownloadWidget();
/**
* The list of entries with changed status (installed/uninstalled)
* @return the list of entries
*/
KNS3::Entry::List changedEntries();
/**
* The list of entries that have been newly installed
* @return the list of entries
*/
KNS3::Entry::List installedEntries();
/**
* Set the title for display purposes in the widget's title.
* @param title the title of the application (or category or whatever)
*/
void setTitle(const QString &title);
/**
* Get the current title
* @return the current title
*/
QString title() const;
/**
* @return the engine used by this download widget
* @since 5.30
*/
KNSCore::Engine *engine();
private:
void init(const QString &configFile);
DownloadWidgetPrivate *const d;
Q_DISABLE_COPY(DownloadWidget)
Q_PRIVATE_SLOT(d, void slotListViewListMode())
Q_PRIVATE_SLOT(d, void slotListViewIconMode())
Q_PRIVATE_SLOT(d, void slotProvidersLoaded())
Q_PRIVATE_SLOT(d, void slotEntriesLoaded(const KNSCore::EntryInternal::List &entries))
Q_PRIVATE_SLOT(d, void slotEntryChanged(const KNSCore::EntryInternal &entry))
Q_PRIVATE_SLOT(d, void slotShowDetails(const KNSCore::EntryInternal &entry))
Q_PRIVATE_SLOT(d, void slotShowOverview())
Q_PRIVATE_SLOT(d, void slotPayloadFailed(const KNSCore::EntryInternal &entry))
Q_PRIVATE_SLOT(d, void slotPayloadLoaded(QUrl url))
Q_PRIVATE_SLOT(d, void slotResetMessage())
Q_PRIVATE_SLOT(d, void slotNetworkTimeout())
Q_PRIVATE_SLOT(d, void sortingChanged())
Q_PRIVATE_SLOT(d, void slotSearchTextChanged())
Q_PRIVATE_SLOT(d, void slotUpdateSearch())
Q_PRIVATE_SLOT(d, void slotCategoryChanged(int))
Q_PRIVATE_SLOT(d, void slotInfo(QString provider, QString server, QString version))
Q_PRIVATE_SLOT(d, void slotError(const QString &message))
Q_PRIVATE_SLOT(d, void scrollbarValueChanged(int value))
friend class DownloadDialog;
};
}
#endif
diff --git a/src/downloadwidget.ui b/src/downloadwidget.ui
index 181ff6e6..02341fed 100644
--- a/src/downloadwidget.ui
+++ b/src/downloadwidget.ui
@@ -1,643 +1,643 @@
DownloadWidget
0
0
724
490
-
-
0
-
true
2
0
true
QAbstractItemView::NoSelection
QAbstractItemView::ScrollPerPixel
-
10
-
Provider:
m_providerCombo
-
QComboBox::AdjustToMinimumContentsLength
-
Category:
m_categoryCombo
-
-
0
0
Most downloads
true
-
true
Newest
-
Rating
-
Installed
-
Qt::Vertical
QSizePolicy::Fixed
20
10
-
Qt::Vertical
QSizePolicy::Fixed
20
10
-
Qt::Vertical
20
40
-
0
0
Order by:
Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
-
Search:
m_searchEdit
-
Qt::Vertical
QSizePolicy::Fixed
20
10
-
Enter search phrase here
true
-
Qt::Horizontal
QSizePolicy::Fixed
9
20
-
true
-
true
true
false
m_listView
-
true
0
0
684
392
0
-
0
0
100
0
100
100
-
0
0
100
0
100
100
-
0
0
100
0
100
100
-
0
0
-
-
0
0
Author:
-
0
0
true
-
- <a href="http://opendesktop.org">Homepage</a>
+ <a href="https://opendesktop.org">Homepage</a>
true
-
-
0
10
false
-
Qt::Horizontal
40
20
-
0
0
Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop
true
-
Qt::Vertical
QSizePolicy::Fixed
20
12
-
Qt::Vertical
QSizePolicy::Fixed
20
12
-
0
0
300
100
300
300
-
Qt::Vertical
20
0
-
-
-
0
20
0
20
16777215
20
QFrame::NoFrame
QFrame::Raised
1
-
true
Update
-
true
Uninstall
-
Become a Fan
-
Install
-
KTitleWidget
QWidget
KLineEdit
QLineEdit
KComboBox
QComboBox
KNS3::ProgressIndicator
QFrame
1
KNS3::ItemsView
QListView
KRatingWidget
QFrame
1
KNS3::ImagePreviewWidget
QWidget
ui/imagepreviewwidget_p.h
1
diff --git a/src/kmoretools/kmoretoolspresets.cpp b/src/kmoretools/kmoretoolspresets.cpp
index 4c2f3c5e..6c6ccf50 100644
--- a/src/kmoretools/kmoretoolspresets.cpp
+++ b/src/kmoretools/kmoretoolspresets.cpp
@@ -1,202 +1,201 @@
/*
Copyright 2015 by Gregor Mi
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library. If not, see .
*/
#include "kmoretoolspresets.h"
#include "kmoretoolspresets_p.h"
#include "knewstuff_debug.h"
#include
#include
#include
#define _ QStringLiteral
class KmtServiceInfo
{
public:
KmtServiceInfo(const QString &desktopEntryName, const QString &homepageUrl, int maxUrlArgCount, const QString &appstreamId)
: desktopEntryName(desktopEntryName), homepageUrl(homepageUrl), maxUrlArgCount(maxUrlArgCount), appstreamId(appstreamId)
{
}
public:
QString desktopEntryName;
QString homepageUrl;
int maxUrlArgCount;
QString appstreamId;
};
//
// todo later: add a property "maturity" with values "stable" > "new" > "incubating" or similar
//
KMoreToolsService* KMoreToolsPresets::registerServiceByDesktopEntryName(KMoreTools* kmt, const QString& desktopEntryName)
{
static QHash dict;
#define ADD_ENTRY(desktopEntryName, maxUrlArgCount, homepageUrl, appstreamUrl) dict.insert(desktopEntryName, KmtServiceInfo(desktopEntryName, QLatin1String(homepageUrl), maxUrlArgCount, appstreamUrl));
//
// definitions begin (sorted alphabetically):
// .------ If one gives more URL arguments as
// | specified here the program will not work.
// | Note, that there are some desktop files where _too few_
// | arguments also lead to errors. Watch the console
// v output for messages from the program.
//
ADD_ENTRY(QStringLiteral("angrysearch"), 0, "https://github.com/DoTheEvo/ANGRYsearch", QString());
ADD_ENTRY(QStringLiteral("com.uploadedlobster.peek"), 0, "https://github.com/phw/peek", QStringLiteral("com.uploadedlobster.peek.desktop")); // easy to use screen recorder, creates gif
ADD_ENTRY(QStringLiteral("catfish"), 1, "http://www.twotoasts.de/index.php/catfish/", QStringLiteral("catfish"));
- ADD_ENTRY(QStringLiteral("ding"), 0, "https://www-user.tu-chemnitz.de/~fri/ding/", QString()); // Offline dict, Online: http://dict.tu-chemnitz.de/dings.cgi
+ ADD_ENTRY(QStringLiteral("ding"), 0, "https://www-user.tu-chemnitz.de/~fri/ding/", QString()); // Offline dict, Online: https://dict.tu-chemnitz.de/dings.cgi
ADD_ENTRY(QStringLiteral("disk"), 0, "https://en.opensuse.org/YaST_Disk_Controller", QString());
ADD_ENTRY(QStringLiteral("fontinst"), 0, "https://docs.kde.org/trunk5/en/kde-workspace/kcontrol/fontinst/", QString()); // good for previewing many fonts at once
ADD_ENTRY(QStringLiteral("fontmatrix"), 0, "https://github.com/fontmatrix/fontmatrix", QString());
ADD_ENTRY(QStringLiteral("fsearch"), 0, "https://github.com/cboxdoerfer/fsearch", QString());
ADD_ENTRY(QStringLiteral("giggle"), 1, "https://wiki.gnome.org/Apps/giggle/", QStringLiteral("giggle.desktop")); // good for searching in history
ADD_ENTRY(QStringLiteral("git-cola-folder-handler"), 1, "https://git-cola.github.io", QStringLiteral("git-cola.desktop"));
ADD_ENTRY(QStringLiteral("git-cola-view-history.kmt-edition"), 1, "https://git-cola.github.io", QStringLiteral("git-cola.desktop"));
- ADD_ENTRY(QStringLiteral("gitk.kmt-edition"), 1, "http://git-scm.com/docs/gitk", QString());
- ADD_ENTRY(QStringLiteral("qgit.kmt-edition"), 1, "http://libre.tibirna.org/projects/qgit", QString());
+ ADD_ENTRY(QStringLiteral("gitk.kmt-edition"), 1, "https://git-scm.com/docs/gitk", QString());
+ ADD_ENTRY(QStringLiteral("qgit.kmt-edition"), 1, "https://github.com/tibirna/qgit", QString());
ADD_ENTRY(QStringLiteral("gitg"), 1, "https://wiki.gnome.org/action/show/Apps/Gitg?action=show&redirect=Gitg", QStringLiteral("gitg.desktop"));
ADD_ENTRY(QStringLiteral("gnome-search-tool"), 0, "https://help.gnome.org/users/gnome-search-tool/", QStringLiteral("gnome-search-tool.desktop")); // has good filtering options
ADD_ENTRY(QStringLiteral("gucharmap"), 0, "https://wiki.gnome.org/action/show/Apps/Gucharmap", QStringLiteral("gucharmap.desktop"));
- ADD_ENTRY(QStringLiteral("gparted"), 0, "http://gparted.org", QStringLiteral("gparted.desktop"));
- ADD_ENTRY(QStringLiteral("htop"), 0, "http://hisham.hm/htop/", QStringLiteral("htop.desktop"));
- ADD_ENTRY(QStringLiteral("hotshots"), 1, "http://sourceforge.net/projects/hotshots/", QString());
- ADD_ENTRY(QStringLiteral("kaption"), 0, "http://kde-apps.org/content/show.php/?content=139302", QString());
+ ADD_ENTRY(QStringLiteral("gparted"), 0, "https://gparted.org", QStringLiteral("gparted.desktop"));
+ ADD_ENTRY(QStringLiteral("htop"), 0, "https://hisham.hm/htop/", QStringLiteral("htop.desktop"));
+ ADD_ENTRY(QStringLiteral("hotshots"), 1, "https://sourceforge.net/projects/hotshots/", QString());
+ ADD_ENTRY(QStringLiteral("kaption"), 0, "https://www.linux-apps.com/content/show.php/?content=139302", QString());
ADD_ENTRY(QStringLiteral("kding"), 0, "", QString()); // Offline dict; unmaintained?
ADD_ENTRY(QStringLiteral("org.kde.kmousetool"), 0, "https://www.kde.org/applications/utilities/kmousetool/", QStringLiteral("org.kde.kmousetool"));
ADD_ENTRY(QStringLiteral("org.gnome.clocks"), 0, "https://wiki.gnome.org/Apps/Clocks", QStringLiteral("org.gnome.clocks.desktop"));
ADD_ENTRY(QStringLiteral("org.kde.filelight"), 1, "https://utils.kde.org/projects/filelight", QStringLiteral("org.kde.filelight.desktop"));
ADD_ENTRY(QStringLiteral("org.kde.kcharselect"), 0, "https://utils.kde.org/projects/kcharselect/", QStringLiteral("org.kde.kcharselect"));
ADD_ENTRY(QStringLiteral("org.kde.kdf"), 0, "https://www.kde.org/applications/system/kdiskfree", QStringLiteral("org.kde.kdf"));
ADD_ENTRY(QStringLiteral("org.kde.kfind"), 1, "https://www.kde.org/applications/utilities/kfind/", QStringLiteral("org.kde.kfind.desktop")); // has good filtering options
ADD_ENTRY(QStringLiteral("org.kde.partitionmanager"), 0, "https://www.kde.org/applications/system/kdepartitionmanager/", QStringLiteral("org.kde.partitionmanager.desktop"));
- ADD_ENTRY(QStringLiteral("org.kde.plasma.cuttlefish.kmt-edition"), 0, "http://vizzzion.org/blog/2015/02/say-hi-to-cuttlefish/", QStringLiteral("org.kde.plasma.cuttlefish"));
+ ADD_ENTRY(QStringLiteral("org.kde.plasma.cuttlefish.kmt-edition"), 0, "https://vizzzion.org/blog/2015/02/say-hi-to-cuttlefish/", QStringLiteral("org.kde.plasma.cuttlefish"));
ADD_ENTRY(QStringLiteral("org.kde.ksysguard"), 0, "https://userbase.kde.org/KSysGuard", QStringLiteral("org.kde.ksysguard"));
ADD_ENTRY(QStringLiteral("org.kde.ksystemlog"), 0, "https://www.kde.org/applications/system/ksystemlog/", QStringLiteral("org.kde.ksystemlog"));
ADD_ENTRY(QStringLiteral("org.kde.ktimer"), 0, "https://www.kde.org/applications/utilities/ktimer/", QStringLiteral("org.kde.ktimer"));
ADD_ENTRY(QStringLiteral("org.kde.spectacle"), 0, "https://www.kde.org/applications/graphics/spectacle", QStringLiteral("org.kde.spectacle.desktop"));
- ADD_ENTRY(QStringLiteral("simplescreenrecorder"), 0, "http://www.maartenbaert.be/simplescreenrecorder/", QStringLiteral("simplescreenrecorder.desktop"));
- ADD_ENTRY(QStringLiteral("shutter"), 0, "http://shutter-project.org", QStringLiteral("org.shutterproject.shutter")); // good for edit screenshot after capture
+ ADD_ENTRY(QStringLiteral("simplescreenrecorder"), 0, "https://www.maartenbaert.be/simplescreenrecorder/", QStringLiteral("simplescreenrecorder.desktop"));
ADD_ENTRY(QStringLiteral("vokoscreen"), 0, "https://github.com/vkohaupt/vokoscreen", QString()); // feature-rich screen recorder
- ADD_ENTRY(QStringLiteral("xfce4-taskmanager"), 0, "http://goodies.xfce.org/projects/applications/xfce4-taskmanager", QStringLiteral("xfce4-taskmanager.desktop"));
+ ADD_ENTRY(QStringLiteral("xfce4-taskmanager"), 0, "https://goodies.xfce.org/projects/applications/xfce4-taskmanager", QStringLiteral("xfce4-taskmanager.desktop"));
//
// ...definitions end
//
#undef ADD_ENTRY
auto iter = dict.constFind(desktopEntryName);
if (iter != dict.constEnd()) {
auto kmtServiceInfo = *iter;
const QString subdir = QStringLiteral("presets-kmoretools");
auto serviceLocatingMode = desktopEntryName.endsWith(QLatin1String(".kmt-edition")) ?
KMoreTools::ServiceLocatingMode_ByProvidedExecLine : KMoreTools::ServiceLocatingMode_Default;
auto service = kmt->registerServiceByDesktopEntryName(desktopEntryName, subdir, serviceLocatingMode);
if (service) { // We might get nullptr in case of missing or broken .desktop files
service->setHomepageUrl(QUrl(kmtServiceInfo.homepageUrl));
service->setMaxUrlArgCount(kmtServiceInfo.maxUrlArgCount);
service->setAppstreamId(kmtServiceInfo.appstreamId);
}
return service;
} else {
qCDebug(KNEWSTUFF) << "KMoreToolsPresets::registerServiceByDesktopEntryName: " << desktopEntryName << "was not found. Return nullptr.";
return nullptr;
}
}
QList KMoreToolsPresets::registerServicesByGroupingNames(KMoreTools* kmt, const QStringList& groupingNames)
{
QString firstMoreSectionDesktopEntryName;
return KMoreToolsPresetsPrivate::registerServicesByGroupingNames(&firstMoreSectionDesktopEntryName, kmt, groupingNames);
}
QList KMoreToolsPresetsPrivate::registerServicesByGroupingNames(QString* firstMoreSectionDesktopEntryName, KMoreTools* kmt, const QStringList& groupingNames)
{
static QHash> dict;
// The corresponding desktop files are located here:
// 'knewstuff/data/kmoretools-desktopfiles/'
// Use KMoreToolsTest2::testDialogForGroupingNames to see if the settings
// here are correct.
// NOTE that the desktopentry names must be registered in
// registerServiceByDesktopEntryName above.
// For special handlings about naming in the menu etc. see kmoretoolsmenufactory.cpp/addItemsForGroupingNameWithSpecialHandling
//
// grouping definitions begin (sorted alphabetically):
//
dict.insert(_("disk-usage"), { _("org.kde.kdf"), _("org.kde.filelight") });
dict.insert(_("disk-partitions"), { _("gparted"), _("org.kde.partitionmanager"), _("disk") });
dict.insert(_("files-find"), { _("org.kde.kfind"), _("fsearch"), _("more:"), _("gnome-search-tool"), _("catfish"), _("angrysearch") });
dict.insert(_("font-tools"), { _("fontinst"), _("gucharmap"), _("more:"), _("org.kde.kcharselect"), _("fontmatrix") });
dict.insert(_("git-clients-for-folder"), { _("git-cola-folder-handler"), _("gitk.kmt-edition"),
_("giggle"), _("qgit.kmt-edition"), _("gitg") });
dict.insert(_("git-clients-and-actions"), { _("git-cola-folder-handler"), _("git-cola-view-history.kmt-edition"),
_("giggle"), _("gitk.kmt-edition"), _("qgit.kmt-edition"), _("gitg") });
dict.insert(_("icon-browser"), { _("org.kde.plasma.cuttlefish.kmt-edition") });
dict.insert(_("language-dictionary"), { _("ding"), _("kding") });
dict.insert(_("mouse-tools"), { _("org.kde.kmousetool") }); // todo: add program "xbanish" to remove mouse cursor while typing
dict.insert(_("screenrecorder"), { _("com.uploadedlobster.peek"), _("simplescreenrecorder"), _("vokoscreen") });
dict.insert(_("screenshot-take"), { _("org.kde.spectacle"), _("shutter"), _("kaption"), _("hotshots") });
dict.insert(_("system-monitor-processes"), { _("org.kde.ksysguard"), _("more:"), _("htop"), _("xfce4-taskmanager") });
dict.insert(_("system-monitor-logs"), { _("org.kde.ksystemlog") });
dict.insert(_("time-countdown"), { _("org.gnome.clocks"), _("org.kde.ktimer") });
//
// ...grouping definitions end
//
QList resultList;
QSet alreadyUsedDesktopEntryNames; // including the "more:" keyword
bool nextIsMore = false;
for (const QString &groupingName : groupingNames) {
auto iter = dict.constFind(groupingName);
if (iter != dict.constEnd()) {
for (const QString &desktopEntryName : qAsConst(*iter)) {
if (!alreadyUsedDesktopEntryNames.contains(desktopEntryName)) {
if (desktopEntryName == _("more:")) {
nextIsMore = true;
} else {
if (nextIsMore) { // this will be only set once
*firstMoreSectionDesktopEntryName = desktopEntryName;
nextIsMore = false;
}
KMoreToolsService *kmtService = KMoreToolsPresets::registerServiceByDesktopEntryName(kmt, desktopEntryName);
if (kmtService) { // Do not add null pointers caused by missing or broken .desktop files
resultList << kmtService;
}
}
} else {
alreadyUsedDesktopEntryNames.insert(desktopEntryName);
}
}
} else {
qCWarning(KNEWSTUFF) << "KMoreToolsPresets::registerServicesByGroupingName: groupingName not found: " << groupingName;
}
}
if (resultList.isEmpty()) {
qCWarning(KNEWSTUFF) << "KMoreToolsPresets::registerServicesByGroupingName: " << groupingNames << ". Nothing found in this groupings. HINT: check for invalid grouping names.";
}
return resultList;
}