Scratchpad/KMoreToolsFramework: Difference between revisions

From KDE Community Wiki
mNo edit summary
No edit summary
Line 1: Line 1:
= The "More Tools Suggestion" (MTS) Framework -- Draft =
= The "K More Tools" (KMT) Framework -- Draft =
{{Note|Open for discussion and ideas to make this a nice concept with minimal implementation effort}}
{{Note|Open for discussion and ideas to make this a nice concept with minimal implementation effort}}
== Abstract ==
== Abstract ==
This scratchpad page is the starting point for the draft specification of a framework or module called "More Tools Suggestion" ('''MTS''').
This scratchpad page is the starting point for the draft specification of a framework or module called "K Tools Suggestion" (''KMT''').


MTS should provide an API to provide a consistent UI for the following purpose:
KMT should provide an API to provide a consistent UI for the following purpose:


1) PRIMARY GOAL: '''Quick access to related tools in a given context.'''
1) 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'''.
2) 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.
3) GOAL: Make it easier for application developers to add alternative application/tool suggestions without worrying about cluttered menus.


4) SIDE-EFFECT: Simplify discussions about to add or not to add some menu entries because users might complain about cluttered menus.
4) CONDITION: The tool suggestions - especially for not-installed tools - should be '''non-obstrusive'''.


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.
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.
Line 24: Line 24:
[https://git.reviewboard.kde.org/r/121478/ RR: dolphin: add menu to SpaceInfo widget for detailled disk usage information]
[https://git.reviewboard.kde.org/r/121478/ RR: dolphin: add menu to SpaceInfo widget for detailled disk usage information]


Screenshots of '''current implementation (without MTS)''':
Screenshots of '''current implementation (without KMT)''':


KDiskFree and Filelight both installed:
KDiskFree and Filelight both installed:
Line 34: Line 34:
[[File:Diskusage-utils-2.png]]
[[File:Diskusage-utils-2.png]]


This could be improved doing it '''with MTS''':
This could be improved doing it '''with KMT''':


'''CURRENT:''' (without MTS)
'''CURRENT:''' (without KMT)
  Menu
  Menu
   `- Filelight [not installed]
   `- Filelight [not installed]
   `- View Disk Usage
   `- View Disk Usage


'''NEW:''' (with MTS support)
'''NEW:''' (with KMT support)
  Menu
  Menu
   `- View Disk Usage
   `- View Disk Usage
Line 52: Line 52:
* All applications which are not installed are placed in a submenu called '''Not installed''' which is placed in the '''More''' submenu.
* All applications which are not installed are placed in a submenu called '''Not installed''' which is placed in the '''More''' submenu.
* [LATER] If such a menu item is clicked the systems package manager opens and '''asks the user to install''' the package. As an intermediate step one could launch a simple Internet search.
* [LATER] If such a menu item is clicked the systems package manager opens and '''asks the user to install''' the package. As an intermediate step one could launch a simple Internet search.
* The '''More''' submenu can also contain less often used items (user-configurable in a later version of MTS)
* The '''More''' submenu can also contain less often used items (user-configurable in a later version of KMT)
* '''Configure this menu...''': Opens a dialog that gives the option not to show not installed applications.
* '''Configure this menu...''': Opens a dialog that gives the option not to show not installed applications.
  .----------------------------------------------------------------.
  .----------------------------------------------------------------.
Line 65: Line 65:
  |                                        [Ok] [Apply] [Cancel]  |
  |                                        [Ok] [Apply] [Cancel]  |
  `----------------------------------------------------------------`
  `----------------------------------------------------------------`
* '''Configure this menu...''' [LATER}: In a later version of MTS it could be made user-configurable which menu items should be shown in the ''More'' menu instead of in the first level.
* '''Configure this menu...''' [LATER}: In a later version of KMT it could be made user-configurable which menu items should be shown in the ''More'' menu instead of in the first level.


== Technical details ==
== Technical details ==
Line 73: Line 73:
* Library to be used by application developer (see API draft)
* Library to be used by application developer (see API draft)
* Some configuration GUI to enable or disabled suggestions (e.g. for not-installed tools)
* Some configuration GUI to enable or disabled suggestions (e.g. for not-installed tools)
=== User settings ===
* User settings are saved _per id_ (todo: clarify what that means) in the application settings (KConfig). Similar to the "Recent files" entries.


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


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


  // register KDiskFree
  // register KDiskFree
  // "dolphin_resources/kdf.desktop" is a dolphin-local copy of /usr/share/applications/kde4/kdf.desktop
  // "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.  
  // 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");
  KMT::registerApplication("dolphin-statusbar-diskspace-menu", "dolphin_resources/kdf.desktop");


  // register Filelight
  // register Filelight
  // "dolphin_resources/org.kde.filelight.desktop" is a dolphin-local copy of Filelight's desktop file
  // "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");
  KMT::registerApplication("dolphin-statusbar-diskspace-menu", "dolphin_resources/org.kde.filelight.desktop");


'''bool MTS::notInstalledAppsSuggestionsEnabled(QString globally_unique_context_id);'''
'''bool KMT::notInstalledAppsSuggestionsEnabled(QString globally_unique_context_id);'''


Example:
Example:


  if (MTS::notInstalledAppsSuggestionsEnabled("dolphin-statusbar-diskspace-menu")) {
  if (KMT::notInstalledAppsSuggestionsEnabled("dolphin-statusbar-diskspace-menu")) {
     // Fill the "not installed suggestions" menu with the registered apps. Use information retrieved by the desktop files.
     // Fill the "not installed suggestions" menu with the registered apps. Use information retrieved by the desktop files.
  } else {
  } else {
Line 110: Line 113:


=== Why .desktop files for not-installed applications/services? ===
=== Why .desktop files for not-installed applications/services? ===
* From a given application name it is often hard to guess what purpose it has. The .desktop file contains a more understandable description of an application.


... [draft] / comments? ...
... [draft] / comments? ...
Line 119: Line 124:
'''Q:''' Maintaining the copy of the .desktop file?
'''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.
'''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 KMT is ''not'' forced to do it on every minor change.


== Later: package mgmt integration ==
== Later: package mgmt integration ==

Revision as of 21:58, 26 January 2015

The "K More Tools" (KMT) Framework -- Draft

Note

Open for discussion and ideas to make this a nice concept with minimal implementation effort

Abstract

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

KMT should provide an API to provide a consistent UI for the following purpose:

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

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

3) GOAL: Make it easier for application developers to add alternative application/tool suggestions without worrying about cluttered menus.

4) CONDITION: The tool suggestions - especially for not-installed tools - should be non-obstrusive.

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 KMT):

KDiskFree and Filelight both installed:

Filelight not installed:

This could be improved doing it with KMT:

CURRENT: (without KMT)

Menu
 `- Filelight [not installed]
 `- View Disk Usage

NEW: (with KMT support)

Menu
 `- View Disk Usage
 `- More >
        `- Not installed >
             `- Disk Usage Statstics with Filelight
             `- <GenericName> with <Name>
             `- Configure this menu...
  • All applications which are not installed are placed in a submenu called Not installed which is placed in the More submenu.
  • [LATER] If such a menu item is clicked the systems package manager opens and asks the user to install the package. As an intermediate step one could launch a simple Internet search.
  • The More submenu can also contain less often used items (user-configurable in a later version of KMT)
  • Configure this menu...: Opens a dialog that gives the option not to show not installed applications.
.----------------------------------------------------------------.
| Configure More Tools Suggestions                               |
-----------------------------------------------------------------|
| Global settings                                                |
|                                                                |
| [x] Show menu entries of tools that are not installed          |
| If you do like to see suggestions of applications that are not |
| installed enable this option                                   |
|                                                                |
|                                        [Ok] [Apply] [Cancel]   |
`----------------------------------------------------------------`
  • Configure this menu... [LATER}: In a later version of KMT it could be made user-configurable which menu items should be shown in the More menu instead of in the first level.

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)

User settings

  • User settings are saved _per id_ (todo: clarify what that means) in the application settings (KConfig). Similar to the "Recent files" entries.

Early API draft

void KMT::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. 
KMT::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
KMT::registerApplication("dolphin-statusbar-diskspace-menu", "dolphin_resources/org.kde.filelight.desktop");

bool KMT::notInstalledAppsSuggestionsEnabled(QString globally_unique_context_id);

Example:

if (KMT::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.
}

TODO:

  • construct menu by globally_unique_context_id and automatically handle the user's preference if not-installed apps entries should be shown or not
  • later distinguish between applications and services

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?

  • From a given application name it is often hard to guess what purpose it has. The .desktop file contains a more understandable description of an application.

... [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 KMT 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?

  • ...
  • ...