File indexing completed on 2024-04-28 15:29:00

0001 /*
0002     SPDX-FileCopyrightText: 2015 Gregor Mi <codestruct@posteo.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-or-later
0005 */
0006 
0007 #ifndef KMORETOOLSPRESETS_H
0008 #define KMORETOOLSPRESETS_H
0009 
0010 #include <QString>
0011 #include <QUrl>
0012 
0013 #include <KNS3/knewstuff_export.h>
0014 
0015 class KMoreTools;
0016 class KMoreToolsService;
0017 
0018 /**
0019  * Provides static methods to make use of desktop files provided by
0020  * KMoreTools.
0021  *
0022  * registerServiceByDesktopEntryName creates a KMoreToolsService instance
0023  * from a given desktopEntryName.
0024  *
0025  * registerServicesByGroupingNames takes a list of a set of predefined
0026  * grouping names and returns a list KMoreToolsService instances. Remember,
0027  * a KMoreToolsService represents a service which might or might not be
0028  * installed on the current machine.
0029  *
0030  * The groupings defined here are used for the KMoreToolsMenuFactory.
0031  *
0032  * (todo later: Probably it would make sense to move the methods of
0033  * this class to KMoreToolsMenuFactory because grouping names and special
0034  * handling are too much coupled anyway.)
0035  *
0036  * @since 5.10
0037  */
0038 class KNEWSTUFF_EXPORT KMoreToolsPresets
0039 {
0040 public:
0041     /**
0042      * @returns an _ordered_ list of KMoreToolsService instances.
0043      * The most popular or recommended tools will be listed first.
0044      *
0045      * Available grouping names (listed in alphabetical order):
0046      *
0047      * - "disk-usage"
0048      *      Disk usage tools as currently used in dolphin.
0049      *      Some take 1 URL argument pointing to a directory.
0050      *
0051      * - "disk-partitions"
0052      *      Disk partition tools as currently used in dolphin.
0053      *
0054      * - "files-find"
0055      *      Tools to find files on disk.
0056      *      You can specify 1 URL argument that points to the directory
0057      *      where the search should be started.
0058      *
0059      * - "font-tools" (since 5.37.0)
0060      *      Tools to manage and analyze fonts.
0061      *
0062      * - "git-clients-for-folder"
0063      *      Collection of git clients which all take 1 URL argument pointing
0064      *      to a directory within a git repository. It may not be the
0065      *      git repo's root dir.
0066      *      e.g. "file:///home/user1/dev/kf5/src/frameworks/knewstuff/data/"
0067      *
0068      * - "git-clients-and-actions"
0069      *      Git clients and actions (e.g. View History for a specific file)
0070      *      to be used in a file tree context menu (e.g. in kate's project
0071      *      plugin).
0072      *      1 URL argument can be provided that points to a directory or a
0073      *      file within a git repository.
0074      *      e.g. "file:///home/user1/dev/knewstuff/data/"
0075      *      e.g. "file:///home/user1/dev/knewstuff/data/CMakeLists.txt"
0076      *
0077      * - "icon-browser"
0078      *      Browse for icons on your system
0079      *      (e.g. those under /usr/share/icons).
0080      *
0081      * - "language-dictionary" (since 5.37.0)
0082      *      Language dictionaries for translation
0083      *
0084      * - "mouse-tools" (since 5.37.0)
0085      *      Tools related to the mouse pointer device.
0086      *
0087      * - "screenrecorder" (since 5.37.0)
0088      *      Record screen contents to a video file (including animated gif).
0089      *
0090      * - "screenshot-take"
0091      *      Tools for taking and maybe also editing screenshots.
0092      *
0093      * - "system-monitor-processes"
0094      *      Tools to monitor the running processes on the system.
0095 
0096      * - "system-monitor-logs"
0097      *      Tools to view system logs.
0098      *
0099      * - "time-countdown"
0100      *      Tools for counting down the time and maybe trigger custom a action.
0101      *
0102      * For URL arguments see also QUrl::fromLocalFile.
0103      *
0104      * Services which are present in more than one grouping are only added once
0105      * to the resulting list.
0106      */
0107     static QList<KMoreToolsService *> registerServicesByGroupingNames(KMoreTools *kmt, const QStringList &groupingNames);
0108 
0109     /**
0110      * Registers a service who's kmt-desktopfile is provided by the
0111      * KMoreTools library itself (see directory kmoretools-desktopfiles).
0112      * If the kmt-desktopfile is missing the service is still created
0113      * but with no translations and icon if the service is not installed.
0114      *
0115      * Associates a homepage URL because a regular .desktop file has got
0116      * no field for this information.
0117      *
0118      * Adds some corrections to faulty upstream .desktop files. Corrected
0119      * desktop filenames end with .kmt-edition.desktop.
0120      *
0121      * todo: how to avoid the "Do you trust this program?" question when a
0122      * non-installed kmt-edition desktopfile is used but the program is installed?
0123      * Possible solution: install all .kmt-edition files to proper desktop
0124      * file location.
0125      *
0126      * @returns the added KMoreToolsService
0127      */
0128     static KMoreToolsService *registerServiceByDesktopEntryName(KMoreTools *kmt, const QString &desktopEntryName);
0129 
0130     // todo later: add another method registerServiceByDesktopEntryNames (plural) that handles
0131     // a list of desktopEntryNames.
0132 };
0133 
0134 #endif