• Skip to content
  • Skip to link menu
KDE 4.4 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

SystemSettingsView

MenuItem Class Reference

Provides a specific item in the list of modules or categories. More...

#include <MenuItem.h>

List of all members.

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

Author:
Ben Cooksley <ben@eclipse.endoftheinternet.org>
Will Stephenson <wstephenson@kde.org>

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.

Warning:
Destroys the KService and KCModuleInfo objects provided by service() and item().

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.

QList< MenuItem * > & MenuItem::children (  )  const

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:
  • MenuItem.h
  • MenuItem.cpp

SystemSettingsView

Skip menu "SystemSettingsView"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members

API Reference

Skip menu "API Reference"
  • KWin
  •   KWin Libraries
  • Libraries
  •   libkworkspace
  •   libsolidcontrol
  •   libtaskmanager
  • Plasma
  •     Animators
  •     Applets
  •     Engines
  • Solid Modules
  • System Settings
  •   SystemSettingsView
Generated for API Reference by doxygen 1.5.9-20090814
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal