-rw-r--r-- | library/backend/categories.cpp | 9 | ||||
-rw-r--r-- | library/backend/categories.h | 2 | ||||
-rw-r--r-- | library/backend/event.cpp | 4 | ||||
-rw-r--r-- | library/backend/palmtoprecord.h | 12 |
4 files changed, 17 insertions, 10 deletions
diff --git a/library/backend/categories.cpp b/library/backend/categories.cpp index 2e84089..cce9f38 100644 --- a/library/backend/categories.cpp +++ b/library/backend/categories.cpp | |||
@@ -442,97 +442,97 @@ QStringList Categories::labels( const QString &app, | |||
442 | 442 | ||
443 | /*! | 443 | /*! |
444 | Returns the label associated with the id | 444 | Returns the label associated with the id |
445 | */ | 445 | */ |
446 | QString Categories::label( const QString &app, int id ) const | 446 | QString Categories::label( const QString &app, int id ) const |
447 | { | 447 | { |
448 | if ( mGlobalCats.contains( id ) ) | 448 | if ( mGlobalCats.contains( id ) ) |
449 | return mGlobalCats.label( id ); | 449 | return mGlobalCats.label( id ); |
450 | QMap< QString, CategoryGroup >::ConstIterator | 450 | QMap< QString, CategoryGroup >::ConstIterator |
451 | appIt = mAppCats.find( app ); | 451 | appIt = mAppCats.find( app ); |
452 | if ( appIt == mAppCats.end() ) | 452 | if ( appIt == mAppCats.end() ) |
453 | return QString::null; | 453 | return QString::null; |
454 | return (*appIt).label( id ); | 454 | return (*appIt).label( id ); |
455 | } | 455 | } |
456 | 456 | ||
457 | /*! | 457 | /*! |
458 | Returns a single string associated with \a catids for display in a | 458 | Returns a single string associated with \a catids for display in a |
459 | combobox or any area that requires one string. If \a catids are empty | 459 | combobox or any area that requires one string. If \a catids are empty |
460 | then "Unfiled" will be returned. If multiple categories are | 460 | then "Unfiled" will be returned. If multiple categories are |
461 | assigned then the behavior depends on the DisplaySingle type. | 461 | assigned then the behavior depends on the DisplaySingle type. |
462 | 462 | ||
463 | If \a display is set to ShowMulti then " (multi)" appended to the | 463 | If \a display is set to ShowMulti then " (multi)" appended to the |
464 | first string. If \a display is set to ShowAll, then a space | 464 | first string. If \a display is set to ShowAll, then a space |
465 | seperated string is returned with all categories. If ShowFirst is | 465 | seperated string is returned with all categories. If ShowFirst is |
466 | set, the just the first string is returned. | 466 | set, the just the first string is returned. |
467 | */ | 467 | */ |
468 | QString Categories::displaySingle( const QString &app, | 468 | QString Categories::displaySingle( const QString &app, |
469 | const QArray<int> &catids, | 469 | const QArray<int> &catids, |
470 | DisplaySingle display ) const | 470 | DisplaySingle display ) const |
471 | { | 471 | { |
472 | QStringList strs = labels( app, catids ); | 472 | QStringList strs = labels( app, catids ); |
473 | if ( !strs.count() ) | 473 | if ( !strs.count() ) |
474 | return tr("Unfiled"); | 474 | return tr("Unfiled"); |
475 | strs.sort(); | 475 | strs.sort(); |
476 | QString r; | 476 | QString r; |
477 | if ( strs.count() > 1 ) { | 477 | if ( strs.count() > 1 ) { |
478 | switch ( display ) { | 478 | switch ( display ) { |
479 | case ShowFirst: | 479 | case ShowFirst: |
480 | r = strs.first(); | 480 | r = strs.first(); |
481 | break; | 481 | break; |
482 | case ShowMulti: | 482 | case ShowMulti: |
483 | r = strs.first() + tr(" (multi.)"); | 483 | r = strs.first() + tr(" (multi.)"); |
484 | break; | 484 | break; |
485 | case ShowAll: | 485 | case ShowAll: |
486 | r = strs.join(" "); | 486 | r = strs.join(" "); |
487 | break; | 487 | break; |
488 | } | 488 | } |
489 | } | 489 | } |
490 | else r = strs.first(); | 490 | else r = strs.first(); |
491 | return r; | 491 | return r; |
492 | } | 492 | } |
493 | 493 | ||
494 | /*! | 494 | /*! |
495 | 495 | ||
496 | Returns all ids associated with the application CategoryGroup \a app | 496 | Returns all ids associated with the application CategoryGroup \a app |
497 | and the passed in \a labels in that group. | 497 | and the passed in \a labels in that group. |
498 | */ | 498 | */ |
499 | QArray<int> Categories::ids( const QString &app, const QStringList &labels) const | 499 | QArray<int> Categories::ids( const QString &app, const QStringList &labels) const |
500 | { | 500 | { |
501 | QArray<int> results; | 501 | QArray<int> results; |
502 | QStringList::ConstIterator it; | 502 | QStringList::ConstIterator it; |
503 | int i; | 503 | int i; |
504 | 504 | ||
505 | for ( i=0, it=labels.begin(); it!=labels.end(); i++, ++it ) { | 505 | for ( i=0, it=labels.begin(); it!=labels.end(); i++, ++it ) { |
506 | int value = id( app, *it ); | 506 | int value = id( app, *it ); |
507 | if ( value != 0 ) { | 507 | if ( value != 0 ) { |
508 | int tmp = results.size(); | 508 | int tmp = results.size(); |
509 | results.resize( tmp + 1 ); | 509 | results.resize( tmp + 1 ); |
510 | results[ tmp ] = value; | 510 | results[ tmp ] = value; |
511 | } | 511 | } |
512 | } | 512 | } |
513 | return results; | 513 | return results; |
514 | } | 514 | } |
515 | 515 | ||
516 | /*! | 516 | /*! |
517 | Returns the id associated with the app. If the id is not found in the | 517 | Returns the id associated with the app. If the id is not found in the |
518 | application CategoryGroup, then it searches the global CategoryGroup. | 518 | application CategoryGroup, then it searches the global CategoryGroup. |
519 | If it is not found it either, 0 is returned. | 519 | If it is not found it either, 0 is returned. |
520 | */ | 520 | */ |
521 | int Categories::id( const QString &app, const QString &cat ) const | 521 | int Categories::id( const QString &app, const QString &cat ) const |
522 | { | 522 | { |
523 | if ( cat == tr("Unfiled") || cat.contains( tr(" (multi.)") ) ) | 523 | if ( cat == tr("Unfiled") || cat.contains( tr(" (multi.)") ) ) |
524 | return 0; | 524 | return 0; |
525 | int uid = mGlobalCats.id( cat ); | 525 | int uid = mGlobalCats.id( cat ); |
526 | if ( uid != 0 ) | 526 | if ( uid != 0 ) |
527 | return uid; | 527 | return uid; |
528 | return mAppCats[app].id( cat ); | 528 | return mAppCats[app].id( cat ); |
529 | } | 529 | } |
530 | 530 | ||
531 | 531 | ||
532 | /*! | 532 | /*! |
533 | Return TRUE if renaming succeeded; FALSE if \a appname or \a oldName | 533 | Return TRUE if renaming succeeded; FALSE if \a appname or \a oldName |
534 | is not found, or if \a newName conflicts with an existing category | 534 | is not found, or if \a newName conflicts with an existing category |
535 | in the CategoryGroup. | 535 | in the CategoryGroup. |
536 | 536 | ||
537 | It will first search the CategoryGroup associated with \a appname | 537 | It will first search the CategoryGroup associated with \a appname |
538 | and if not found it will try to replace in global CategoryGroup. | 538 | and if not found it will try to replace in global CategoryGroup. |
@@ -803,126 +803,121 @@ void Categories::dump() const | |||
803 | } | 803 | } |
804 | } | 804 | } |
805 | 805 | ||
806 | QStringList CheckedListView::checked() const | 806 | QStringList CheckedListView::checked() const |
807 | { | 807 | { |
808 | QStringList strs; | 808 | QStringList strs; |
809 | for ( QCheckListItem *i = (QCheckListItem *) firstChild(); | 809 | for ( QCheckListItem *i = (QCheckListItem *) firstChild(); |
810 | i; i = (QCheckListItem *)i->nextSibling() ) | 810 | i; i = (QCheckListItem *)i->nextSibling() ) |
811 | if ( i->isOn() ) | 811 | if ( i->isOn() ) |
812 | strs += i->text( 0 ); | 812 | strs += i->text( 0 ); |
813 | return strs; | 813 | return strs; |
814 | } | 814 | } |
815 | 815 | ||
816 | void CheckedListView::addCheckableList( const QStringList &options ) | 816 | void CheckedListView::addCheckableList( const QStringList &options ) |
817 | { | 817 | { |
818 | for ( QStringList::ConstIterator it = options.begin(); | 818 | for ( QStringList::ConstIterator it = options.begin(); |
819 | it != options.end(); ++it ) { | 819 | it != options.end(); ++it ) { |
820 | (void) new QCheckListItem( this, *it, | 820 | (void) new QCheckListItem( this, *it, |
821 | QCheckListItem::CheckBox ); | 821 | QCheckListItem::CheckBox ); |
822 | } | 822 | } |
823 | } | 823 | } |
824 | 824 | ||
825 | void CheckedListView::setChecked( const QStringList &checked ) | 825 | void CheckedListView::setChecked( const QStringList &checked ) |
826 | { | 826 | { |
827 | // iterate over all items | 827 | // iterate over all items |
828 | bool showingChecked = FALSE; | 828 | bool showingChecked = FALSE; |
829 | for ( QCheckListItem *i = (QCheckListItem *) firstChild(); | 829 | for ( QCheckListItem *i = (QCheckListItem *) firstChild(); |
830 | i; i = (QCheckListItem *)i->nextSibling() ) | 830 | i; i = (QCheckListItem *)i->nextSibling() ) |
831 | // see if the item should be checked by searching the | 831 | // see if the item should be checked by searching the |
832 | // checked list | 832 | // checked list |
833 | if ( checked.find( i->text( 0 ) ) != checked.end() ) { | 833 | if ( checked.find( i->text( 0 ) ) != checked.end() ) { |
834 | i->setOn( TRUE ); | 834 | i->setOn( TRUE ); |
835 | // make sure it is showing at least one checked item | 835 | // make sure it is showing at least one checked item |
836 | if ( !showingChecked ) { | 836 | if ( !showingChecked ) { |
837 | ensureItemVisible( i ); | 837 | ensureItemVisible( i ); |
838 | showingChecked = TRUE; | 838 | showingChecked = TRUE; |
839 | } | 839 | } |
840 | } | 840 | } |
841 | else | 841 | else |
842 | i->setOn( FALSE ); | 842 | i->setOn( FALSE ); |
843 | } | 843 | } |
844 | 844 | ||
845 | /*! \fn Categories &Categories::operator= ( const Categories &c ) | 845 | /*! \fn Categories &Categories::operator= ( const Categories &c ) |
846 | 846 | ||
847 | Performs deep copy. | 847 | Performs deep copy. |
848 | */ | 848 | */ |
849 | 849 | ||
850 | 850 | ||
851 | /*! \fn QStringList Categories::labels( const QString & app, const QArray<int> &catids ) const | ||
852 | |||
853 | Returns list of labels associated with the application and catids | ||
854 | */ | ||
855 | |||
856 | /*! \fn QStringList Categories::globalCategories() const | 851 | /*! \fn QStringList Categories::globalCategories() const |
857 | 852 | ||
858 | Returns list of all global category labels | 853 | Returns list of all global category labels |
859 | */ | 854 | */ |
860 | 855 | ||
861 | /*! \fn const QMap<QString, CategoryGroup> &Categories::appGroupMap() const | 856 | /*! \fn const QMap<QString, CategoryGroup> &Categories::appGroupMap() const |
862 | 857 | ||
863 | Returns a map of application names to CategoryGroup. The CategoryGroup | 858 | Returns a map of application names to CategoryGroup. The CategoryGroup |
864 | class defines a map of ids to category labels and category labels to ids. | 859 | class defines a map of ids to category labels and category labels to ids. |
865 | */ | 860 | */ |
866 | 861 | ||
867 | /*! \fn const CategoryGroup &Categories::globalGroup() const | 862 | /*! \fn const CategoryGroup &Categories::globalGroup() const |
868 | 863 | ||
869 | Returns the global CategoryGroup. The CategoryGroup | 864 | Returns the global CategoryGroup. The CategoryGroup |
870 | class defines a map of ids to category labels and category labels to ids. | 865 | class defines a map of ids to category labels and category labels to ids. |
871 | */ | 866 | */ |
872 | 867 | ||
873 | /*! \fn void Categories::categoryAdded( const Categories &cats, const QString &appname, int uid) | 868 | /*! \fn void Categories::categoryAdded( const Categories &cats, const QString &appname, int uid) |
874 | 869 | ||
875 | Emitted if a category is added. | 870 | Emitted if a category is added. |
876 | 871 | ||
877 | \a cats is a const reference to this object | 872 | \a cats is a const reference to this object |
878 | \a appname is the CategoryGroup application name that the category was added to or QString::null if it was global | 873 | \a appname is the CategoryGroup application name that the category was added to or QString::null if it was global |
879 | \a uid is the unique identifier associated with the added category | 874 | \a uid is the unique identifier associated with the added category |
880 | */ | 875 | */ |
881 | 876 | ||
882 | /*! \fn void Categories::categoryRemoved( const Categories &cats, const QString &appname, | 877 | /*! \fn void Categories::categoryRemoved( const Categories &cats, const QString &appname, |
883 | int uid) | 878 | int uid) |
884 | 879 | ||
885 | Emitted if removed category is removed. | 880 | Emitted if removed category is removed. |
886 | 881 | ||
887 | \a cats is a const reference to this object | 882 | \a cats is a const reference to this object |
888 | \a appname is the CategoryGroup application name that the category was removed from or QString::null if it was the global CategoryGroup | 883 | \a appname is the CategoryGroup application name that the category was removed from or QString::null if it was the global CategoryGroup |
889 | \a uid is the unique identifier associated with the removed category | 884 | \a uid is the unique identifier associated with the removed category |
890 | */ | 885 | */ |
891 | 886 | ||
892 | 887 | ||
893 | /*! \fn void Categories::categoryRenamed( const Categories &cats, const QString &appname, | 888 | /*! \fn void Categories::categoryRenamed( const Categories &cats, const QString &appname, |
894 | int uid) | 889 | int uid) |
895 | 890 | ||
896 | Emitted if \a uid in the \a appname CategoryGroup is renamed in \a cats | 891 | Emitted if \a uid in the \a appname CategoryGroup is renamed in \a cats |
897 | object. | 892 | object. |
898 | 893 | ||
899 | \a cats is a const reference to this object | 894 | \a cats is a const reference to this object |
900 | \a appname is the CategoryGroup application name that the category was renamed in or QString::null if it was the global CategoryGroup | 895 | \a appname is the CategoryGroup application name that the category was renamed in or QString::null if it was the global CategoryGroup |
901 | \a uid is the unique identifier associated with the renamed category | 896 | \a uid is the unique identifier associated with the renamed category |
902 | */ | 897 | */ |
903 | 898 | ||
904 | /*! \fn Categories::Categories( QObject *parent=0, const char *name = 0 ) | 899 | /*! \fn Categories::Categories( QObject *parent=0, const char *name = 0 ) |
905 | 900 | ||
906 | Constructor for an empty Categories object. | 901 | Constructor for an empty Categories object. |
907 | */ | 902 | */ |
908 | 903 | ||
909 | /*! \fn Categories::Categories( const Categories ©From ) | 904 | /*! \fn Categories::Categories( const Categories ©From ) |
910 | 905 | ||
911 | Deep copy constructor | 906 | Deep copy constructor |
912 | */ | 907 | */ |
913 | 908 | ||
914 | /*! \fn Categories::~Categories() | 909 | /*! \fn Categories::~Categories() |
915 | 910 | ||
916 | Empty destructor. Call save() before destruction if there are changes | 911 | Empty destructor. Call save() before destruction if there are changes |
917 | that need to be saved. | 912 | that need to be saved. |
918 | */ | 913 | */ |
919 | 914 | ||
920 | /*! \fn CategoryGroup::clear() | 915 | /*! \fn CategoryGroup::clear() |
921 | \internal | 916 | \internal |
922 | */ | 917 | */ |
923 | 918 | ||
924 | /*! \fn const QMap<int, QString> &CategoryGroup::idMap() const | 919 | /*! \fn const QMap<int, QString> &CategoryGroup::idMap() const |
925 | 920 | ||
926 | Returns a const reference to the id to label QMap | 921 | Returns a const reference to the id to label QMap |
927 | */ | 922 | */ |
928 | 923 | ||
diff --git a/library/backend/categories.h b/library/backend/categories.h index ba65ee3..d5b3669 100644 --- a/library/backend/categories.h +++ b/library/backend/categories.h | |||
@@ -40,97 +40,97 @@ template class QPC_EXPORT QMap< QString, CategoryGroup >; | |||
40 | // MOC_SKIP_END | 40 | // MOC_SKIP_END |
41 | #endif | 41 | #endif |
42 | 42 | ||
43 | class QPC_EXPORT CategoryGroup | 43 | class QPC_EXPORT CategoryGroup |
44 | { | 44 | { |
45 | friend class Categories; | 45 | friend class Categories; |
46 | public: | 46 | public: |
47 | CategoryGroup(): mIdLabelMap(), mLabelIdMap() { } | 47 | CategoryGroup(): mIdLabelMap(), mLabelIdMap() { } |
48 | CategoryGroup( const CategoryGroup &c ) : | 48 | CategoryGroup( const CategoryGroup &c ) : |
49 | mIdLabelMap( c.mIdLabelMap), mLabelIdMap( c.mLabelIdMap ) { } | 49 | mIdLabelMap( c.mIdLabelMap), mLabelIdMap( c.mLabelIdMap ) { } |
50 | 50 | ||
51 | void clear() { mIdLabelMap.clear(); mLabelIdMap.clear(); } | 51 | void clear() { mIdLabelMap.clear(); mLabelIdMap.clear(); } |
52 | 52 | ||
53 | int add( const QString &label ); | 53 | int add( const QString &label ); |
54 | bool add( int uid, const QString &label ); | 54 | bool add( int uid, const QString &label ); |
55 | 55 | ||
56 | bool remove( const QString &label ); | 56 | bool remove( const QString &label ); |
57 | bool remove( int uid ); | 57 | bool remove( int uid ); |
58 | 58 | ||
59 | bool rename( int uid, const QString &newLabel ); | 59 | bool rename( int uid, const QString &newLabel ); |
60 | bool rename( const QString &oldLabel, const QString &newLabel ); | 60 | bool rename( const QString &oldLabel, const QString &newLabel ); |
61 | 61 | ||
62 | bool contains(int id) const; | 62 | bool contains(int id) const; |
63 | bool contains(const QString &label) const; | 63 | bool contains(const QString &label) const; |
64 | 64 | ||
65 | /** Returns label associated with the uid or QString::null if | 65 | /** Returns label associated with the uid or QString::null if |
66 | * not found | 66 | * not found |
67 | */ | 67 | */ |
68 | const QString &label(int id) const; | 68 | const QString &label(int id) const; |
69 | /** Returns the uid associated with label or 0 if not found */ | 69 | /** Returns the uid associated with label or 0 if not found */ |
70 | int id(const QString &label) const; | 70 | int id(const QString &label) const; |
71 | 71 | ||
72 | /** Returns a sorted list of labels */ | 72 | /** Returns a sorted list of labels */ |
73 | QStringList labels() const; | 73 | QStringList labels() const; |
74 | 74 | ||
75 | QStringList labels( const QArray<int> &catids ) const; | 75 | QStringList labels( const QArray<int> &catids ) const; |
76 | 76 | ||
77 | const QMap<int, QString> &idMap() const { return mIdLabelMap; } | 77 | const QMap<int, QString> &idMap() const { return mIdLabelMap; } |
78 | 78 | ||
79 | private: | 79 | private: |
80 | void insert( int uid, const QString &label ); | 80 | void insert( int uid, const QString &label ); |
81 | QMap<int, QString> mIdLabelMap; | 81 | QMap<int, QString> mIdLabelMap; |
82 | QMap<QString, int> mLabelIdMap; | 82 | QMap<QString, int> mLabelIdMap; |
83 | 83 | ||
84 | static Qtopia::UidGen &uidGen() { return sUidGen; } | 84 | static Qtopia::UidGen &uidGen() { return sUidGen; } |
85 | static Qtopia::UidGen sUidGen; | 85 | static Qtopia::UidGen sUidGen; |
86 | }; | 86 | }; |
87 | 87 | ||
88 | /** Map from application name to categories */ | 88 | /* Map from application name to categories */ |
89 | class QPC_EXPORT Categories : public QObject | 89 | class QPC_EXPORT Categories : public QObject |
90 | { | 90 | { |
91 | Q_OBJECT | 91 | Q_OBJECT |
92 | public: | 92 | public: |
93 | Categories( QObject *parent=0, const char *name = 0 ) | 93 | Categories( QObject *parent=0, const char *name = 0 ) |
94 | : QObject( parent, name ), mGlobalCats(), mAppCats() { } | 94 | : QObject( parent, name ), mGlobalCats(), mAppCats() { } |
95 | Categories( const Categories ©From ) : QObject( copyFrom.parent() ), | 95 | Categories( const Categories ©From ) : QObject( copyFrom.parent() ), |
96 | mGlobalCats( copyFrom.mGlobalCats ), | 96 | mGlobalCats( copyFrom.mGlobalCats ), |
97 | mAppCats( copyFrom.mAppCats ) { } | 97 | mAppCats( copyFrom.mAppCats ) { } |
98 | virtual ~Categories() { } | 98 | virtual ~Categories() { } |
99 | 99 | ||
100 | Categories &operator= ( const Categories &c ) | 100 | Categories &operator= ( const Categories &c ) |
101 | { mAppCats = c.mAppCats; mGlobalCats = c.mGlobalCats; return *this; } | 101 | { mAppCats = c.mAppCats; mGlobalCats = c.mGlobalCats; return *this; } |
102 | 102 | ||
103 | void clear(); | 103 | void clear(); |
104 | 104 | ||
105 | /** Add the category name as long as it doesn't already exist | 105 | /** Add the category name as long as it doesn't already exist |
106 | * locally or globally. Return UID if added, 0 if conflicts | 106 | * locally or globally. Return UID if added, 0 if conflicts |
107 | * (error). | 107 | * (error). |
108 | */ | 108 | */ |
109 | int addCategory( const QString &appname, const QString &catname); | 109 | int addCategory( const QString &appname, const QString &catname); |
110 | /** Add the category name as long as it doesn't already exist | 110 | /** Add the category name as long as it doesn't already exist |
111 | * locally or globally. Return UID if added, 0 if conflicts | 111 | * locally or globally. Return UID if added, 0 if conflicts |
112 | * (error). | 112 | * (error). |
113 | */ | 113 | */ |
114 | int addCategory( const QString &appname, const QString &catname, int uid); | 114 | int addCategory( const QString &appname, const QString &catname, int uid); |
115 | /** Add the global category just checking that it doesn't | 115 | /** Add the global category just checking that it doesn't |
116 | * already exist globally. Return UID if added, 0 if conflicts. | 116 | * already exist globally. Return UID if added, 0 if conflicts. |
117 | */ | 117 | */ |
118 | int addGlobalCategory( const QString &catname ); | 118 | int addGlobalCategory( const QString &catname ); |
119 | /** Add the global category just checking that it doesn't | 119 | /** Add the global category just checking that it doesn't |
120 | * already exist globally. Return UID if added, 0 if conflicts. | 120 | * already exist globally. Return UID if added, 0 if conflicts. |
121 | */ | 121 | */ |
122 | int addGlobalCategory( const QString &catname, int uid ); | 122 | int addGlobalCategory( const QString &catname, int uid ); |
123 | /** Removes the category from the application; if it is not found | 123 | /** Removes the category from the application; if it is not found |
124 | * in the application, then it removes it from the global list | 124 | * in the application, then it removes it from the global list |
125 | */ | 125 | */ |
126 | bool removeCategory( const QString &appName, const QString &catName, | 126 | bool removeCategory( const QString &appName, const QString &catName, |
127 | bool checkGlobal = TRUE); | 127 | bool checkGlobal = TRUE); |
128 | bool removeCategory( const QString &appName, int uid ); | 128 | bool removeCategory( const QString &appName, int uid ); |
129 | bool removeGlobalCategory( const QString &catName ); | 129 | bool removeGlobalCategory( const QString &catName ); |
130 | bool removeGlobalCategory( int uid ); | 130 | bool removeGlobalCategory( int uid ); |
131 | 131 | ||
132 | QArray<int> ids( const QString &app, const QStringList &labels) const; | 132 | QArray<int> ids( const QString &app, const QStringList &labels) const; |
133 | 133 | ||
134 | /** Returns the id associated with the app */ | 134 | /** Returns the id associated with the app */ |
135 | int id( const QString &app, const QString &cat ) const; | 135 | int id( const QString &app, const QString &cat ) const; |
136 | /** Returns the label associated with the id */ | 136 | /** Returns the label associated with the id */ |
diff --git a/library/backend/event.cpp b/library/backend/event.cpp index d906f19..4c24ab3 100644 --- a/library/backend/event.cpp +++ b/library/backend/event.cpp | |||
@@ -122,103 +122,103 @@ Qtopia::UidGen Event::sUidGen( Qtopia::UidGen::Qtopia ); | |||
122 | /*! | 122 | /*! |
123 | \fn bool Event::operator!=( const Event & ) const | 123 | \fn bool Event::operator!=( const Event & ) const |
124 | \internal | 124 | \internal |
125 | */ | 125 | */ |
126 | 126 | ||
127 | /*! | 127 | /*! |
128 | \fn bool Event::operator>( const Event & ) const | 128 | \fn bool Event::operator>( const Event & ) const |
129 | \internal | 129 | \internal |
130 | */ | 130 | */ |
131 | 131 | ||
132 | /*! | 132 | /*! |
133 | \fn bool Event::operator>=( const Event & ) const | 133 | \fn bool Event::operator>=( const Event & ) const |
134 | \internal | 134 | \internal |
135 | */ | 135 | */ |
136 | 136 | ||
137 | /*! | 137 | /*! |
138 | \enum Event::RepeatType | 138 | \enum Event::RepeatType |
139 | 139 | ||
140 | This enum defines how a event will repeat, if at all. | 140 | This enum defines how a event will repeat, if at all. |
141 | 141 | ||
142 | <ul> | 142 | <ul> |
143 | <li>\c NoRepeat - Event does not repeat. | 143 | <li>\c NoRepeat - Event does not repeat. |
144 | <li>\c Daily - Event occurs every n days. | 144 | <li>\c Daily - Event occurs every n days. |
145 | <li>\c Weekly - Event occurs every n weeks. | 145 | <li>\c Weekly - Event occurs every n weeks. |
146 | <li>\c MonthlyDay - Event occurs every n months. Event will always occur in | 146 | <li>\c MonthlyDay - Event occurs every n months. Event will always occur in |
147 | the same week and same day of week as the first event. | 147 | the same week and same day of week as the first event. |
148 | <li>\c MonthlyDate - Event occurs every n months. Event will always occur | 148 | <li>\c MonthlyDate - Event occurs every n months. Event will always occur |
149 | on the same day of the month as the first event. | 149 | on the same day of the month as the first event. |
150 | <li>\c Yearly - Event occurs every n years. | 150 | <li>\c Yearly - Event occurs every n years. |
151 | </ul> | 151 | </ul> |
152 | */ | 152 | */ |
153 | 153 | ||
154 | /*! | 154 | /*! |
155 | \fn bool Event::isAllDay() const | 155 | \fn bool Event::isAllDay() const |
156 | 156 | ||
157 | Returns TRUE if the event is an all day event. Otherwise returns FALSE. | 157 | Returns TRUE if the event is an all day event. Otherwise returns FALSE. |
158 | */ | 158 | */ |
159 | 159 | ||
160 | /*! | 160 | /*! |
161 | \fn void Event::setAllDay(bool allday) | 161 | \fn void Event::setAllDay(bool allday) |
162 | 162 | ||
163 | If \a allday is TRUE, will set the event to be an all day event. | 163 | If \a allday is TRUE, will set the event to be an all day event. |
164 | Otherwise sets the event to not be an all day event. | 164 | Otherwise sets the event to not be an all day event. |
165 | 165 | ||
166 | \warning This function may affect the start and end times of the event. | 166 | \warning This function may affect the start and end times of the event. |
167 | */ | 167 | */ |
168 | 168 | ||
169 | /*! | 169 | /*! |
170 | \fn QDateTime Event::start() const | 170 | \fn QDateTime Event::start(bool) const |
171 | 171 | ||
172 | Returns the start date and time of the first occurance of the event. | 172 | Returns the start date and time of the first occurance of the event. |
173 | */ | 173 | */ |
174 | 174 | ||
175 | /*! | 175 | /*! |
176 | \fn QDateTime Event::end() const | 176 | \fn QDateTime Event::end(bool) const |
177 | 177 | ||
178 | Returns the end date and time of the first occurance of the event. | 178 | Returns the end date and time of the first occurance of the event. |
179 | */ | 179 | */ |
180 | 180 | ||
181 | /*! | 181 | /*! |
182 | \fn time_t Event::startTime() const | 182 | \fn time_t Event::startTime() const |
183 | \internal | 183 | \internal |
184 | */ | 184 | */ |
185 | 185 | ||
186 | /*! | 186 | /*! |
187 | \fn time_t Event::endTime() const | 187 | \fn time_t Event::endTime() const |
188 | \internal | 188 | \internal |
189 | */ | 189 | */ |
190 | 190 | ||
191 | /*! | 191 | /*! |
192 | \fn void Event::setAlarm(int delay, SoundTypeChoice s) | 192 | \fn void Event::setAlarm(int delay, SoundTypeChoice s) |
193 | 193 | ||
194 | Sets the alarm delay of the event to \a delay and the sound type of the | 194 | Sets the alarm delay of the event to \a delay and the sound type of the |
195 | alarm to \a s. | 195 | alarm to \a s. |
196 | */ | 196 | */ |
197 | 197 | ||
198 | /*! | 198 | /*! |
199 | \fn void Event::clearAlarm() | 199 | \fn void Event::clearAlarm() |
200 | 200 | ||
201 | Clears the alarm for the event. | 201 | Clears the alarm for the event. |
202 | */ | 202 | */ |
203 | 203 | ||
204 | /*! | 204 | /*! |
205 | \fn int Event::alarmDelay() const | 205 | \fn int Event::alarmDelay() const |
206 | 206 | ||
207 | Returns the delay in minutes between the alarm for an event and the | 207 | Returns the delay in minutes between the alarm for an event and the |
208 | start of the event. | 208 | start of the event. |
209 | */ | 209 | */ |
210 | 210 | ||
211 | /*! | 211 | /*! |
212 | \fn Event::RepeatType Event::repeatType() const | 212 | \fn Event::RepeatType Event::repeatType() const |
213 | 213 | ||
214 | Returns the repeat pattern type for the event. | 214 | Returns the repeat pattern type for the event. |
215 | 215 | ||
216 | \sa frequency() | 216 | \sa frequency() |
217 | */ | 217 | */ |
218 | 218 | ||
219 | /*! | 219 | /*! |
220 | \fn int Event::weekOffset() const | 220 | \fn int Event::weekOffset() const |
221 | 221 | ||
222 | Returns the number of weeks from the start of the month that this event | 222 | Returns the number of weeks from the start of the month that this event |
223 | occurs. | 223 | occurs. |
224 | */ | 224 | */ |
diff --git a/library/backend/palmtoprecord.h b/library/backend/palmtoprecord.h index 72f7d1c..15cdd6a 100644 --- a/library/backend/palmtoprecord.h +++ b/library/backend/palmtoprecord.h | |||
@@ -1,85 +1,97 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #ifndef QTPALMTOP_RECORD_H | 20 | #ifndef QTPALMTOP_RECORD_H |
21 | #define QTPALMTOP_RECORD_H | 21 | #define QTPALMTOP_RECORD_H |
22 | #include <qglobal.h> | 22 | #include <qglobal.h> |
23 | #include "qpcglobal.h" | 23 | #include "qpcglobal.h" |
24 | #include "palmtopuidgen.h" | 24 | #include "palmtopuidgen.h" |
25 | #include <qarray.h> | 25 | #include <qarray.h> |
26 | #include <qmap.h> | 26 | #include <qmap.h> |
27 | 27 | ||
28 | #if defined(QPC_TEMPLATEDLL) | 28 | #if defined(QPC_TEMPLATEDLL) |
29 | // MOC_SKIP_BEGIN | 29 | // MOC_SKIP_BEGIN |
30 | QPC_TEMPLATEEXTERN template class QPC_EXPORT QMap<QString, QString>; | 30 | QPC_TEMPLATEEXTERN template class QPC_EXPORT QMap<QString, QString>; |
31 | // MOC_SKIP_END | 31 | // MOC_SKIP_END |
32 | #endif | 32 | #endif |
33 | 33 | ||
34 | class QRegExp; | 34 | class QRegExp; |
35 | /** | ||
36 | * @short Qtopia namespace | ||
37 | * The namespace of Qtopia | ||
38 | */ | ||
35 | namespace Qtopia { | 39 | namespace Qtopia { |
36 | 40 | ||
37 | class RecordPrivate; | 41 | class RecordPrivate; |
42 | /** | ||
43 | * @short The base class of all Records | ||
44 | * | ||
45 | * The base class for Records in Qtopia | ||
46 | * @see Task | ||
47 | * @see Event | ||
48 | * @see Contact | ||
49 | */ | ||
38 | class QPC_EXPORT Record | 50 | class QPC_EXPORT Record |
39 | { | 51 | { |
40 | public: | 52 | public: |
41 | Record() : mUid(0), mCats() { } | 53 | Record() : mUid(0), mCats() { } |
42 | Record( const Record &c ) :mUid( c.mUid ), mCats ( c.mCats ), customMap(c.customMap) { } | 54 | Record( const Record &c ) :mUid( c.mUid ), mCats ( c.mCats ), customMap(c.customMap) { } |
43 | virtual ~Record() { } | 55 | virtual ~Record() { } |
44 | 56 | ||
45 | Record &operator=( const Record &c ); | 57 | Record &operator=( const Record &c ); |
46 | 58 | ||
47 | virtual bool match( const QRegExp & ) const { return FALSE; } | 59 | virtual bool match( const QRegExp & ) const { return FALSE; } |
48 | 60 | ||
49 | void setCategories( const QArray<int> &v ) { mCats = v; mCats.sort(); } | 61 | void setCategories( const QArray<int> &v ) { mCats = v; mCats.sort(); } |
50 | void setCategories( int single ); | 62 | void setCategories( int single ); |
51 | const QArray<int> &categories() const { return mCats; } | 63 | const QArray<int> &categories() const { return mCats; } |
52 | 64 | ||
53 | void reassignCategoryId( int oldId, int newId ) | 65 | void reassignCategoryId( int oldId, int newId ) |
54 | { | 66 | { |
55 | int index = mCats.find( oldId ); | 67 | int index = mCats.find( oldId ); |
56 | if ( index >= 0 ) | 68 | if ( index >= 0 ) |
57 | mCats[index] = newId; | 69 | mCats[index] = newId; |
58 | } | 70 | } |
59 | 71 | ||
60 | int uid() const { return mUid; }; | 72 | int uid() const { return mUid; }; |
61 | virtual void setUid( int i ) { mUid = i; uidGen().store( mUid ); } | 73 | virtual void setUid( int i ) { mUid = i; uidGen().store( mUid ); } |
62 | bool isValidUid() const { return mUid != 0; } | 74 | bool isValidUid() const { return mUid != 0; } |
63 | void assignUid() { setUid( uidGen().generate() ); } | 75 | void assignUid() { setUid( uidGen().generate() ); } |
64 | 76 | ||
65 | virtual QString customField(const QString &) const; | 77 | virtual QString customField(const QString &) const; |
66 | virtual void setCustomField(const QString &, const QString &); | 78 | virtual void setCustomField(const QString &, const QString &); |
67 | virtual void removeCustomField(const QString &); | 79 | virtual void removeCustomField(const QString &); |
68 | 80 | ||
69 | virtual bool operator == ( const Record &r ) const | 81 | virtual bool operator == ( const Record &r ) const |
70 | { return mUid == r.mUid; } | 82 | { return mUid == r.mUid; } |
71 | virtual bool operator != ( const Record &r ) const | 83 | virtual bool operator != ( const Record &r ) const |
72 | { return mUid != r.mUid; } | 84 | { return mUid != r.mUid; } |
73 | 85 | ||
74 | // convenience methods provided for loading and saving to xml | 86 | // convenience methods provided for loading and saving to xml |
75 | static QString idsToString( const QArray<int> &ids ); | 87 | static QString idsToString( const QArray<int> &ids ); |
76 | // convenience methods provided for loading and saving to xml | 88 | // convenience methods provided for loading and saving to xml |
77 | static QArray<int> idsFromString( const QString &str ); | 89 | static QArray<int> idsFromString( const QString &str ); |
78 | 90 | ||
79 | // for debugging | 91 | // for debugging |
80 | static void dump( const QMap<int, QString> &map ); | 92 | static void dump( const QMap<int, QString> &map ); |
81 | 93 | ||
82 | protected: | 94 | protected: |
83 | virtual UidGen &uidGen() = 0; | 95 | virtual UidGen &uidGen() = 0; |
84 | virtual QString customToXml() const; | 96 | virtual QString customToXml() const; |
85 | private: | 97 | private: |