SystemSettingsView
MenuItem Class Reference
Provides a specific item in the list of modules or categories. More...
#include <MenuItem.h>
Public Member Functions | |
| MenuItem (bool isMenu, MenuItem *parent) | |
| ~MenuItem () | |
| QString & | category () const |
| MenuItem * | child (int index) |
| QList< MenuItem * > & | children () const |
| KCModuleInfo & | item () const |
| QStringList | keywords () |
| bool | menu () const |
| QString & | name () const |
| MenuItem * | parent () const |
| KService::Ptr & | service () const |
| void | setService (const KService::Ptr &service) |
| void | sortChildrenByWeight () |
| int | weight () |
Detailed Description
Provides a specific item in the list of modules or categories.
This provides convienent access to the list of modules, providing information about them such as name, module information and its service object.
This is created automatically by System Settings, and is shared among all plugins and so should not be modified under any circumstances.
System Settings creates it in a tree like manner, with categories containing subcategories and modules, and subcategories repeating this.
The service object must be set, unless it is the top level item, otherwise using applications will crash when attempting to sort the children by weight
Definition at line 50 of file MenuItem.h.
Constructor & Destructor Documentation
| MenuItem::MenuItem | ( | bool | isMenu, | |
| MenuItem * | parent | |||
| ) |
Creates a MenuItem.
- Note:
- Will not provide keywords, name, or a module item until a service has been set.
- Parameters:
-
isMenu Specifies if it is a category or not. parent The item it is parented to. Provide 0 for a top level item.
Definition at line 48 of file MenuItem.cpp.
| MenuItem::~MenuItem | ( | ) |
Destroys a MenuItem, including all children, the service object and the module information.
Definition at line 59 of file MenuItem.cpp.
Member Function Documentation
| QString & MenuItem::category | ( | ) | const |
Convienence function which provides the System Settings category of the current item.
- Returns:
- The category of the item, if the service object has been set.
Definition at line 111 of file MenuItem.cpp.
| MenuItem * MenuItem::child | ( | int | index | ) |
Provides the MenuItem for the child at the specified index.
- Parameters:
-
index The index of the child.
- Returns:
- The MenuItem object of the specified child.
Definition at line 70 of file MenuItem.cpp.
Provides a list of all the children of this item.
- Returns:
- The list of children this has.
Definition at line 91 of file MenuItem.cpp.
| KCModuleInfo & MenuItem::item | ( | ) | const |
Provides the KDE control module information item, which can be used to load control modules by the ModuleView.
- Returns:
- The control module information object of the item, if the service object has been set.
Definition at line 101 of file MenuItem.cpp.
| QStringList MenuItem::keywords | ( | ) |
Returns the list of keywords, which is used for searching the list of categories and modules.
- Note:
- The parent items share all the keywords of their children.
- Returns:
- The list of keywords the item has.
Definition at line 75 of file MenuItem.cpp.
| bool MenuItem::menu | ( | ) | const |
Provides information on which type the current item is.
- Returns:
- true if it is a category.
- false if it is not a category.
Definition at line 121 of file MenuItem.cpp.
| QString & MenuItem::name | ( | ) | const |
Convienence function which provides the name of the current item.
- Returns:
- The name of the item, if the service object has been set.
Definition at line 106 of file MenuItem.cpp.
| MenuItem * MenuItem::parent | ( | ) | const |
Returns the parent of this item.
- Returns:
- The MenuItem object of this items parent.
Definition at line 86 of file MenuItem.cpp.
| KService::Ptr & MenuItem::service | ( | ) | const |
Returns the service object of this item, which contains useful information about it.
- Returns:
- The service object of this item if it has been set.
Definition at line 96 of file MenuItem.cpp.
| void MenuItem::setService | ( | const KService::Ptr & | service | ) |
Sets the service object, which is used to provide the module information, name and keywords Applications will crash if it is not set, unless it is the top level item.
- Parameters:
-
service The service object to store.
Definition at line 126 of file MenuItem.cpp.
| void MenuItem::sortChildrenByWeight | ( | ) |
Sorts the children depending on the value of "X-KDE-Weight" in the desktop files of the category or module.
Definition at line 65 of file MenuItem.cpp.
| int MenuItem::weight | ( | ) |
Provides the weight of the current item, as determined by its service.
If the service does not specify a weight, it is 100
- Returns:
- The weight of the service
Definition at line 116 of file MenuItem.cpp.
The documentation for this class was generated from the following files:
KDE 4.4 API Reference