-rw-r--r-- | library/categoryselect.cpp | 114 |
1 files changed, 111 insertions, 3 deletions
diff --git a/library/categoryselect.cpp b/library/categoryselect.cpp index 21b3f91..8473aeb 100644 --- a/library/categoryselect.cpp +++ b/library/categoryselect.cpp | |||
@@ -1,4 +1,5 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2001 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2001 Trolltech AS. All rights reserved. |
3 | ** Copyright (C) 2003 zecke introduce a needed symbol | ||
3 | ** | 4 | ** |
4 | ** This file is part of Qtopia Environment. | 5 | ** This file is part of Qtopia Environment. |
@@ -32,4 +33,39 @@ | |||
32 | #include <stdlib.h> | 33 | #include <stdlib.h> |
33 | 34 | ||
35 | |||
36 | /*! \enum CategorySelect::SelectorWidget | ||
37 | Chooses a type of widget to use as the selection widget. | ||
38 | |||
39 | \value ComboBox | ||
40 | \value ListView | ||
41 | */ | ||
42 | |||
43 | /*! | ||
44 | \class CategorySelect | ||
45 | \brief The CategorySelect widget allows users to select Categories with a | ||
46 | combobox interface. | ||
47 | |||
48 | CategorySelect is useful to provide a QComboBox of Categories for | ||
49 | filtering (such as in the Contacts table view) or to allow the user | ||
50 | to select multiple Categories. The allCategories variable sets | ||
51 | whether the CategorySelect is in filtering or selecting mode. | ||
52 | |||
53 | In filtering mode, the All and Unfiled categories are added. The | ||
54 | |||
55 | In selecting mode, the CategorySelect may either be a QComboBox and | ||
56 | a QToolButton or a QListView with checkable items depending on the | ||
57 | screen size. | ||
58 | |||
59 | CategorySelect automatically updates itself if Categories has been | ||
60 | changed elsewhere in the environment. | ||
61 | |||
62 | Signals and slots are provided to notify the application of the users | ||
63 | selections. A QToolButton is also provided so that users can edit the | ||
64 | Categories manually. | ||
65 | |||
66 | \ingroup qtopiaemb | ||
67 | */ | ||
68 | |||
69 | |||
34 | static QString categoryEdittingFileName() | 70 | static QString categoryEdittingFileName() |
35 | { | 71 | { |
@@ -250,5 +286,5 @@ int CategoryCombo::currentCategory() const | |||
250 | int returnMe; | 286 | int returnMe; |
251 | returnMe = currentItem(); | 287 | returnMe = currentItem(); |
252 | 288 | ||
253 | if ( returnMe == (int)d->mAppCats.count() ) | 289 | if ( returnMe == (int)d->mAppCats.count() ) |
254 | returnMe = -1; | 290 | returnMe = -1; |
@@ -287,4 +323,24 @@ void CategoryCombo::slotValueChanged( int ) | |||
287 | } | 323 | } |
288 | 324 | ||
325 | /*! | ||
326 | Constructs a category selector with parent \a parent, name \a name. | ||
327 | |||
328 | This constructor is provided to make Opie compatible with Sharp ROM. | ||
329 | */ | ||
330 | CategorySelect::CategorySelect( QWidget* parent, const char* name ) | ||
331 | : QHBox( parent, name ), | ||
332 | cmbCat( 0 ), | ||
333 | cmdCat( 0 ), | ||
334 | d( 0 ) | ||
335 | { | ||
336 | d = new CategorySelectPrivate(); | ||
337 | init(0); // default argument | ||
338 | } | ||
339 | /*! | ||
340 | Constructs a category selector with parent \a parent, name \a name and | ||
341 | fixed width \a width. | ||
342 | |||
343 | This constructor is provided to make integration with Qt Designer easier. | ||
344 | */ | ||
289 | CategorySelect::CategorySelect( QWidget *parent, const char *name,int width) | 345 | CategorySelect::CategorySelect( QWidget *parent, const char *name,int width) |
290 | : QHBox( parent, name ), | 346 | : QHBox( parent, name ), |
@@ -297,4 +353,9 @@ CategorySelect::CategorySelect( QWidget *parent, const char *name,int width) | |||
297 | } | 353 | } |
298 | 354 | ||
355 | /*! | ||
356 | \overload | ||
357 | This constructor accepts an array \a vl of integers representing Categories. | ||
358 | \a appName is used as the visible name string. | ||
359 | */ | ||
299 | CategorySelect::CategorySelect( const QArray<int> &vl, | 360 | CategorySelect::CategorySelect( const QArray<int> &vl, |
300 | const QString &appName, QWidget *parent, | 361 | const QString &appName, QWidget *parent, |
@@ -309,4 +370,11 @@ CategorySelect::CategorySelect( const QArray<int> &vl, | |||
309 | } | 370 | } |
310 | 371 | ||
372 | /*! | ||
373 | \overload | ||
374 | |||
375 | This constructor accepts an array \a vl of integers representing Categories. | ||
376 | \a visibleName is the string used when the name of this widget is required | ||
377 | to be displayed. \a width is an integer used as the fixed width of the widget. | ||
378 | */ | ||
311 | CategorySelect::CategorySelect( const QArray<int> &vl, | 379 | CategorySelect::CategorySelect( const QArray<int> &vl, |
312 | const QString &appName, | 380 | const QString &appName, |
@@ -320,4 +388,7 @@ CategorySelect::CategorySelect( const QArray<int> &vl, | |||
320 | } | 388 | } |
321 | 389 | ||
390 | /*! | ||
391 | Destructs a CategorySelect widget. | ||
392 | */ | ||
322 | CategorySelect::~CategorySelect() | 393 | CategorySelect::~CategorySelect() |
323 | { | 394 | { |
@@ -325,4 +396,7 @@ CategorySelect::~CategorySelect() | |||
325 | } | 396 | } |
326 | 397 | ||
398 | /*! | ||
399 | This slot is called when the user pushes the button to edit Categories. | ||
400 | */ | ||
327 | void CategorySelect::slotDialog() | 401 | void CategorySelect::slotDialog() |
328 | { | 402 | { |
@@ -358,4 +432,8 @@ void CategorySelect::slotDialog() | |||
358 | } | 432 | } |
359 | 433 | ||
434 | |||
435 | /*! | ||
436 | This slot is called when a new Category is available. | ||
437 | */ | ||
360 | void CategorySelect::slotNewCat( int newUid ) | 438 | void CategorySelect::slotNewCat( int newUid ) |
361 | { | 439 | { |
@@ -377,4 +455,14 @@ void CategorySelect::slotNewCat( int newUid ) | |||
377 | } | 455 | } |
378 | 456 | ||
457 | /*! | ||
458 | \overload | ||
459 | |||
460 | Resets the CategorySelect to select the \a vlCats for | ||
461 | the Categories assoicated with \a appName. | ||
462 | |||
463 | This function should only be called if <i>filtering</i> | ||
464 | on Categories and not selecting and therefore possibly | ||
465 | allowing the user to edit Categories. | ||
466 | */ | ||
379 | QString CategorySelect::setCategories( const QArray<int> &rec, | 467 | QString CategorySelect::setCategories( const QArray<int> &rec, |
380 | const QString &appName ) | 468 | const QString &appName ) |
@@ -383,4 +471,10 @@ QString CategorySelect::setCategories( const QArray<int> &rec, | |||
383 | } | 471 | } |
384 | 472 | ||
473 | /*! | ||
474 | Resets the CategorySelect to select the \a vlCats for | ||
475 | the Categories assoicated with \a appName and displays | ||
476 | the \a visibleName if the user is selecting and therefore editing | ||
477 | new Categories. | ||
478 | */ | ||
385 | QString CategorySelect::setCategories( const QArray<int> &rec, | 479 | QString CategorySelect::setCategories( const QArray<int> &rec, |
386 | const QString &appName, | 480 | const QString &appName, |
@@ -407,5 +501,7 @@ void CategorySelect::init(int width) | |||
407 | } | 501 | } |
408 | 502 | ||
409 | 503 | /*! | |
504 | Return the value of the currently selected category. | ||
505 | */ | ||
410 | int CategorySelect::currentCategory() const | 506 | int CategorySelect::currentCategory() const |
411 | { | 507 | { |
@@ -413,4 +509,5 @@ int CategorySelect::currentCategory() const | |||
413 | } | 509 | } |
414 | 510 | ||
511 | |||
415 | void CategorySelect::setCurrentCategory( int newCatUid ) | 512 | void CategorySelect::setCurrentCategory( int newCatUid ) |
416 | { | 513 | { |
@@ -418,5 +515,7 @@ void CategorySelect::setCurrentCategory( int newCatUid ) | |||
418 | } | 515 | } |
419 | 516 | ||
420 | 517 | /*! | |
518 | Returns a shallow copy of the categories in this CategorySelect. | ||
519 | */ | ||
421 | const QArray<int> &CategorySelect::currentCategories() const | 520 | const QArray<int> &CategorySelect::currentCategories() const |
422 | { | 521 | { |
@@ -424,4 +523,7 @@ const QArray<int> &CategorySelect::currentCategories() const | |||
424 | } | 523 | } |
425 | 524 | ||
525 | /*! | ||
526 | Hides the edit section of the CategorySelect widget if \a remove is TRUE. | ||
527 | */ | ||
426 | void CategorySelect::setRemoveCategoryEdit( bool remove ) | 528 | void CategorySelect::setRemoveCategoryEdit( bool remove ) |
427 | { | 529 | { |
@@ -435,4 +537,7 @@ void CategorySelect::setRemoveCategoryEdit( bool remove ) | |||
435 | } | 537 | } |
436 | 538 | ||
539 | /*! | ||
540 | Changes this CategorySelect to the All category if \a all is TRUE. | ||
541 | */ | ||
437 | void CategorySelect::setAllCategories( bool add ) | 542 | void CategorySelect::setAllCategories( bool add ) |
438 | { | 543 | { |
@@ -446,4 +551,7 @@ void CategorySelect::setAllCategories( bool add ) | |||
446 | 551 | ||
447 | // 01.12.21 added | 552 | // 01.12.21 added |
553 | /*! | ||
554 | Sets the fixed width of the widget to \a width. | ||
555 | */ | ||
448 | void CategorySelect::setFixedWidth(int width) | 556 | void CategorySelect::setFixedWidth(int width) |
449 | { | 557 | { |