-rw-r--r-- | library/categorymenu.cpp | 62 |
1 files changed, 57 insertions, 5 deletions
diff --git a/library/categorymenu.cpp b/library/categorymenu.cpp index e733107..5d7adf7 100644 --- a/library/categorymenu.cpp +++ b/library/categorymenu.cpp | |||
@@ -25,6 +25,35 @@ | |||
25 | #include <qmap.h> | 25 | #include <qmap.h> |
26 | 26 | ||
27 | /*! | ||
28 | \class CategoryMenu | ||
29 | \brief The CategoryMenu widget aids in filtering records or files by Category. | ||
30 | |||
31 | The CategoryMenu widget provides a popup menu that will make filtering records | ||
32 | or files by category much easier. The widget will lookup the available | ||
33 | categories for an application, populate the menu, and keep a track of which | ||
34 | categories are being filtered against. A set of categories can be tested | ||
35 | by the isSelected() function to see if a record or file containing those | ||
36 | categories would be allowed through by the filter. | ||
37 | |||
38 | \warning Currently this class is not suitable for extending. | ||
39 | |||
40 | \ingroup qtopiaemb | ||
41 | */ | ||
42 | |||
43 | /*! | ||
44 | \fn void CategoryMenu::categoryChange() | ||
45 | This signal is emitted when the user selects a different category in the | ||
46 | menu, hence changing what records or files should be selected. | ||
47 | */ | ||
48 | |||
49 | /*! | ||
50 | Creates a new CategoryMenu with \a parent and \a name. The menu will be | ||
51 | populated with the available categories for \a application. | ||
52 | |||
53 | If \a globals is TRUE then it will also poplulate the menu with the | ||
54 | global categories. | ||
55 | */ | ||
27 | CategoryMenu::CategoryMenu( const QString &n, bool ig = TRUE, | 56 | CategoryMenu::CategoryMenu( const QString &n, bool ig = TRUE, |
28 | QWidget *parent, const char *name ) : | 57 | QWidget *parent, const char *name ) : |
29 | QPopupMenu(parent, name), | 58 | QPopupMenu(parent, name), |
30 | appName(n), | 59 | appName(n), |
@@ -36,8 +65,14 @@ CategoryMenu::CategoryMenu( const QString &n, bool ig = TRUE, | |||
36 | } | 65 | } |
37 | 66 | ||
38 | CategoryMenu::~CategoryMenu( ) | 67 | /*! |
68 | Destroys a CategoryMenu. | ||
69 | */ | ||
70 | CategoryMenu::~CategoryMenu( ) | ||
39 | { | 71 | { |
40 | } | 72 | } |
41 | 73 | ||
74 | /*! | ||
75 | Repopulates the widget's list of available categories. | ||
76 | */ | ||
42 | void CategoryMenu::reload() | 77 | void CategoryMenu::reload() |
43 | { | 78 | { |
@@ -67,5 +102,8 @@ void CategoryMenu::reload() | |||
67 | } | 102 | } |
68 | 103 | ||
69 | void CategoryMenu::mapMenuId(int id) | 104 | /*! |
105 | \internal | ||
106 | */ | ||
107 | void CategoryMenu::mapMenuId(int id) | ||
70 | { | 108 | { |
71 | if (id == currentMid) | 109 | if (id == currentMid) |
@@ -78,4 +116,9 @@ void CategoryMenu::mapMenuId(int id) | |||
78 | } | 116 | } |
79 | 117 | ||
118 | /*! | ||
119 | Returns TRUE if a record or file with the set of category ids \a cUids | ||
120 | is allowed by the current selection in the CategoryMenu. | ||
121 | Otherwise returns FALSE. | ||
122 | */ | ||
80 | bool CategoryMenu::isSelected(const QArray<int> &cUids) const | 123 | bool CategoryMenu::isSelected(const QArray<int> &cUids) const |
81 | { | 124 | { |
@@ -83,5 +126,5 @@ bool CategoryMenu::isSelected(const QArray<int> &cUids) const | |||
83 | return TRUE; | 126 | return TRUE; |
84 | 127 | ||
85 | if (currentMid == 2 && cUids.count() == 0) | 128 | if (currentMid == 2 && cUids.count() == 0) |
86 | return TRUE; | 129 | return TRUE; |
87 | 130 | ||
@@ -92,7 +135,10 @@ bool CategoryMenu::isSelected(const QArray<int> &cUids) const | |||
92 | } | 135 | } |
93 | 136 | ||
137 | /*! | ||
138 | Sets the menu to have \a newCatUid as the currently selected Category. | ||
139 | */ | ||
94 | void CategoryMenu::setCurrentCategory( int newCatUid ) | 140 | void CategoryMenu::setCurrentCategory( int newCatUid ) |
95 | { | 141 | { |
96 | if (!idToMenu.contains(newCatUid)) | 142 | if (!idToMenu.contains(newCatUid)) |
97 | return; | 143 | return; |
98 | 144 | ||
@@ -100,4 +146,7 @@ void CategoryMenu::setCurrentCategory( int newCatUid ) | |||
100 | } | 146 | } |
101 | 147 | ||
148 | /*! | ||
149 | Sets the menu to allow all category sets. | ||
150 | */ | ||
102 | void CategoryMenu::setCurrentCategoryAll( ) | 151 | void CategoryMenu::setCurrentCategoryAll( ) |
103 | { | 152 | { |
@@ -105,4 +154,7 @@ void CategoryMenu::setCurrentCategoryAll( ) | |||
105 | } | 154 | } |
106 | 155 | ||
156 | /*! | ||
157 | Sets the menu to allow only empty category sets. | ||
158 | */ | ||
107 | void CategoryMenu::setCurrentCategoryUnfiled( ) | 159 | void CategoryMenu::setCurrentCategoryUnfiled( ) |
108 | { | 160 | { |