Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

CategoryMenu Class Reference

The CategoryMenu widget aids in filtering records or files by Category. More...

#include </home/clem/local/src/opie/library/categorymenu.h>

Collaboration diagram for CategoryMenu:

Collaboration graph
[legend]
List of all members.

Public Slots

void reload ()

Signals

void categoryChange ()

Public Member Functions

 CategoryMenu (const QString &appName, bool, QWidget *parent=0, const char *name=0)
 ~CategoryMenu ()
bool isSelected (const QArray< int > &cUids) const
void setCurrentCategory (int newCatUid)
void setCurrentCategoryAll ()
void setCurrentCategoryUnfiled ()

Private Slots

void mapMenuId (int)

Private Attributes

QString appName
bool includeGlobal
QMap< int, int > menuToId
QMap< int, int > idToMenu
int currentMid
CategoryMenuPrivate * d

Detailed Description

The CategoryMenu widget aids in filtering records or files by Category.

The CategoryMenu widget provides a popup menu that will make filtering records or files by category much easier. The widget will lookup the available categories for an application, populate the menu, and keep a track of which categories are being filtered against. A set of categories can be tested by the isSelected() function to see if a record or file containing those categories would be allowed through by the filter.

Warning:
Currently this class is not suitable for extending.

Definition at line 30 of file categorymenu.h.


Constructor & Destructor Documentation

CategoryMenu::CategoryMenu const QString n,
bool  ig = TRUE,
QWidget *  parent = 0,
const char *  name = 0
 

Creates a new CategoryMenu with parent and name. The menu will be populated with the available categories for application.

If globals is TRUE then it will also poplulate the menu with the global categories.

Definition at line 54 of file categorymenu.cpp.

References currentMid, mapMenuId(), and reload().

CategoryMenu::~CategoryMenu  ) 
 

Destroys a CategoryMenu.

Definition at line 68 of file categorymenu.cpp.


Member Function Documentation

void CategoryMenu::categoryChange  )  [signal]
 

This signal is emitted when the user selects a different category in the menu, hence changing what records or files should be selected.

Referenced by mapMenuId().

bool CategoryMenu::isSelected const QArray< int > &  cUids  )  const
 

Returns TRUE if a record or file with the set of category ids cUids is allowed by the current selection in the CategoryMenu. Otherwise returns FALSE.

Definition at line 121 of file categorymenu.cpp.

References currentMid, FALSE, menuToId, and TRUE.

void CategoryMenu::mapMenuId int  id  )  [private, slot]
 

For internal use only.

Definition at line 105 of file categorymenu.cpp.

References categoryChange(), currentMid, FALSE, and TRUE.

Referenced by CategoryMenu(), setCurrentCategory(), setCurrentCategoryAll(), and setCurrentCategoryUnfiled().

void CategoryMenu::reload  )  [slot]
 

Repopulates the widget's list of available categories.

Definition at line 75 of file categorymenu.cpp.

References appName, QValueList< T >::begin(), categoryFileName(), currentMid, QValueList< T >::end(), Categories::id(), idToMenu, includeGlobal, QMap< Key, T >::insert(), Categories::labels(), Categories::load(), menuToId, tr, and TRUE.

Referenced by CategoryMenu().

void CategoryMenu::setCurrentCategory int  newCatUid  ) 
 

Sets the menu to have newCatUid as the currently selected Category.

Definition at line 138 of file categorymenu.cpp.

References QMap< Key, T >::contains(), idToMenu, and mapMenuId().

void CategoryMenu::setCurrentCategoryAll  ) 
 

Sets the menu to allow all category sets.

Definition at line 149 of file categorymenu.cpp.

References mapMenuId().

void CategoryMenu::setCurrentCategoryUnfiled  ) 
 

Sets the menu to allow only empty category sets.

Definition at line 157 of file categorymenu.cpp.

References mapMenuId().


Member Data Documentation

QString CategoryMenu::appName [private]
 

Definition at line 54 of file categorymenu.h.

Referenced by reload().

int CategoryMenu::currentMid [private]
 

Definition at line 59 of file categorymenu.h.

Referenced by CategoryMenu(), isSelected(), mapMenuId(), and reload().

CategoryMenuPrivate* CategoryMenu::d [private]
 

Definition at line 61 of file categorymenu.h.

QMap<int, int> CategoryMenu::idToMenu [private]
 

Definition at line 58 of file categorymenu.h.

Referenced by reload(), and setCurrentCategory().

bool CategoryMenu::includeGlobal [private]
 

Definition at line 55 of file categorymenu.h.

Referenced by reload().

QMap<int, int> CategoryMenu::menuToId [private]
 

Definition at line 57 of file categorymenu.h.

Referenced by isSelected(), and reload().


The documentation for this class was generated from the following files:
Generated on Sat Nov 5 17:28:12 2005 for OPIE by  doxygen 1.4.2