Scratchpad/KMoreToolsFramework: Difference between revisions

From KDE Community Wiki
(→‎Technical details: add Components)
Line 35: Line 35:


== Technical details ==
== Technical details ==
=== Components ===
* Library to be used by application developer (see API draft)
* Some configuration GUI to enable or disabled suggestions (e.g. for not-installed tools)


=== Early API draft ===
=== Early API draft ===

Revision as of 14:22, 10 January 2015

The "More Tools Suggestion" (MTS) Framework -- Draft

Abstract

This scratchpad page is the starting point for the draft specification of a framework or module called "More Tools Suggestion" (MTS).

MTS should the support the following purpose:

1) PRIMARY GOAL: Quick access to related tools in a given context.

2) PRIMARY GOAL: Give novice users hints about tools that are useful in a particular context even if the are not installed.

3) CONDITION: The tool suggestions - especially for not-installed tools - should be non-obstrusive. The advanced user should have a global option to turn off the suggestions.

4) SIDE-EFFECT: Simplify discussions about to add or not to add some menu entries because users might complain about cluttered menus.

5) NICE-TO-HAVE: When the user chooses a not-installed tool, the distro specific package manager should be used to start the installation process for the chosen software.

Use cases / References

ksnapshot's SendTo menu

... TODO ...

Dolphin's status bar disk space menu

RR: dolphin: add menu to SpaceInfo widget for detailled disk usage information

Screenshots of current implementation (without MTS):

KDiskFree and Filelight both installed:

File:Http://wstaw.org/m/2014/12/18/plasma-desktopkr2051.png

Filelight not installed:

File:Http://wstaw.org/m/2014/12/18/plasma-desktopRc2051.png

Technical details

Components

  • Library to be used by application developer (see API draft)
  • Some configuration GUI to enable or disabled suggestions (e.g. for not-installed tools)

Early API draft

void MTS::registerApplication(QString globally_unique_context_id, QUrl service_desktop_file);

// register KDiskFree
// "dolphin_resources/kdf.desktop" is a dolphin-local copy of /usr/share/applications/kde4/kdf.desktop
// TODO: where to actually place it? It must not be found by the standard KService. 
MTS::registerApplication("dolphin-statusbar-diskspace-menu", "dolphin_resources/kdf.desktop");
// register Filelight
// "dolphin_resources/org.kde.filelight.desktop" is a dolphin-local copy of Filelight's desktop file
MTS::registerApplication("dolphin-statusbar-diskspace-menu", "dolphin_resources/org.kde.filelight.desktop");

bool MTS::notInstalledAppsSuggestionsEnabled(QString globally_unique_context_id);

Example:

if (MTS::notInstalledAppsSuggestionsEnabled("dolphin-statusbar-diskspace-menu")) {
    // Fill the "not installed suggestions" menu with the registered apps. Use information retrieved by the desktop files.
} else {
    // User had previously turned off the suggestions for not-installed apps.
    // Do not add suggestions.
    // User must go to global settings if he/she wants to turn suggestions on again.
}

How to extract information out of not-installed desktop files?

TODO: would this be the correct method?

KService::serviceByDesktopPath("/path/to/applocal/desktopfile.desktop");

Why .desktop files for not-installed applications/services?

... [draft] / comments? ...

Q: Why add the .desktop file of each tool that should be in the suggestion list to the application that makes the suggestion?

A: The .desktop file contains the translated application name and generic name (short tool description) that can be displayed to the user even if the package is not installed yet.

Q: Maintaining the copy of the .desktop file?

A: In regular intervals the upstream .desktop file of the referenced package should be updated. But in general there is no tight coupling, so the application that uses MTS is not forced to do it on every minor change.

Later: package mgmt integration

Use case:

  • "KDiskFree not installed. If you would like to install it, click here to install it."
  • Similar to /usr/bin/cnf but for .desktop files of programs that are not yet installed: start the distro GUI package mgmt for the specific package.

TODO: is there already related work in this direction?

  • ...
  • ...