author | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
commit | a08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (unidiff) | |
tree | 8ee90d686081c52e7c69b5ce946e9b1a7d690001 /kabc/field.h | |
parent | 11edc920afe4f274c0964436633aa632c8288a40 (diff) | |
download | kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.zip kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.gz kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.bz2 |
initial public commit of qt4 portp1
-rw-r--r-- | kabc/field.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/kabc/field.h b/kabc/field.h index 9e06597..55cc705 100644 --- a/kabc/field.h +++ b/kabc/field.h | |||
@@ -1,174 +1,174 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkabc. | 2 | This file is part of libkabc. |
3 | Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | /* | 21 | /* |
22 | Enhanced Version of the file for platform independent KDE tools. | 22 | Enhanced Version of the file for platform independent KDE tools. |
23 | Copyright (c) 2004 Ulf Schenk | 23 | Copyright (c) 2004 Ulf Schenk |
24 | 24 | ||
25 | $Id$ | 25 | $Id$ |
26 | */ | 26 | */ |
27 | 27 | ||
28 | #ifndef KABC_FIELD_H | 28 | #ifndef KABC_FIELD_H |
29 | #define KABC_FIELD_H | 29 | #define KABC_FIELD_H |
30 | 30 | ||
31 | #include <qstring.h> | 31 | #include <qstring.h> |
32 | #include <qvaluelist.h> | 32 | #include <q3valuelist.h> |
33 | 33 | ||
34 | #include "addressee.h" | 34 | #include "addressee.h" |
35 | 35 | ||
36 | class KConfig; | 36 | class KConfig; |
37 | 37 | ||
38 | namespace KABC { | 38 | namespace KABC { |
39 | 39 | ||
40 | class Field | 40 | class Field |
41 | { | 41 | { |
42 | class FieldImpl; | 42 | class FieldImpl; |
43 | friend class FieldImpl; | 43 | friend class FieldImpl; |
44 | 44 | ||
45 | public: | 45 | public: |
46 | typedef QValueList<Field *> List; | 46 | typedef Q3ValueList<Field *> List; |
47 | 47 | ||
48 | /** | 48 | /** |
49 | * @li @p All - | 49 | * @li @p All - |
50 | * @li @p Frequent - | 50 | * @li @p Frequent - |
51 | * @li @p Address - | 51 | * @li @p Address - |
52 | * @li @p Email - | 52 | * @li @p Email - |
53 | * @li @p Personal - | 53 | * @li @p Personal - |
54 | * @li @p Organization - | 54 | * @li @p Organization - |
55 | * @li @p CustomCategory - | 55 | * @li @p CustomCategory - |
56 | */ | 56 | */ |
57 | enum FieldCategory | 57 | enum FieldCategory |
58 | { | 58 | { |
59 | All = 0x0, | 59 | All = 0x0, |
60 | Frequent = 0x01, | 60 | Frequent = 0x01, |
61 | Address = 0x02, | 61 | Address = 0x02, |
62 | Email = 0x04, | 62 | Email = 0x04, |
63 | Personal = 0x08, | 63 | Personal = 0x08, |
64 | Organization = 0x10, | 64 | Organization = 0x10, |
65 | CustomCategory = 0x20 | 65 | CustomCategory = 0x20 |
66 | }; | 66 | }; |
67 | 67 | ||
68 | /** | 68 | /** |
69 | * Returns the translated label for this field. | 69 | * Returns the translated label for this field. |
70 | */ | 70 | */ |
71 | virtual QString label(); | 71 | virtual QString label(); |
72 | 72 | ||
73 | /** | 73 | /** |
74 | * Returns the ored categories the field belongs to. | 74 | * Returns the ored categories the field belongs to. |
75 | */ | 75 | */ |
76 | virtual int category(); | 76 | virtual int category(); |
77 | 77 | ||
78 | /** | 78 | /** |
79 | * Returns the translated label for field category. | 79 | * Returns the translated label for field category. |
80 | */ | 80 | */ |
81 | static QString categoryLabel( int category ); | 81 | static QString categoryLabel( int category ); |
82 | 82 | ||
83 | /** | 83 | /** |
84 | * Returns a string representation of the value the field has in the given | 84 | * Returns a string representation of the value the field has in the given |
85 | * Addressee. Returns QString::null, if it is not possible to convert the | 85 | * Addressee. Returns QString::null, if it is not possible to convert the |
86 | * value to a string. | 86 | * value to a string. |
87 | */ | 87 | */ |
88 | virtual QString value( const KABC::Addressee & ); | 88 | virtual QString value( const KABC::Addressee & ); |
89 | 89 | ||
90 | /** | 90 | /** |
91 | * Sets the value of the field in the given Addressee. Returns true on success | 91 | * Sets the value of the field in the given Addressee. Returns true on success |
92 | * or false, if the given string couldn't be converted to a valid value. | 92 | * or false, if the given string couldn't be converted to a valid value. |
93 | */ | 93 | */ |
94 | virtual bool setValue( KABC::Addressee &, const QString & ); | 94 | virtual bool setValue( KABC::Addressee &, const QString & ); |
95 | 95 | ||
96 | /** | 96 | /** |
97 | * Returns, if the field is a user-defined field. | 97 | * Returns, if the field is a user-defined field. |
98 | */ | 98 | */ |
99 | virtual bool isCustom(); | 99 | virtual bool isCustom(); |
100 | 100 | ||
101 | /** | 101 | /** |
102 | * Returns, if the field is equal with @param field. | 102 | * Returns, if the field is equal with @param field. |
103 | */ | 103 | */ |
104 | virtual bool equals( Field *field ); | 104 | virtual bool equals( Field *field ); |
105 | 105 | ||
106 | /** | 106 | /** |
107 | * Returns a list of all fields. | 107 | * Returns a list of all fields. |
108 | */ | 108 | */ |
109 | static Field::List allFields(); | 109 | static Field::List allFields(); |
110 | 110 | ||
111 | /** | 111 | /** |
112 | * Returns a list of the default fields. | 112 | * Returns a list of the default fields. |
113 | */ | 113 | */ |
114 | static Field::List defaultFields(); | 114 | static Field::List defaultFields(); |
115 | 115 | ||
116 | /** | 116 | /** |
117 | * Creates a custom field. | 117 | * Creates a custom field. |
118 | * | 118 | * |
119 | * @param label The label for this field | 119 | * @param label The label for this field |
120 | * @param category The category of this field | 120 | * @param category The category of this field |
121 | * @param key Unique key for this field | 121 | * @param key Unique key for this field |
122 | * @param app Unique app name for this field | 122 | * @param app Unique app name for this field |
123 | */ | 123 | */ |
124 | static Field *createCustomField( const QString &label, int category, | 124 | static Field *createCustomField( const QString &label, int category, |
125 | const QString &key, const QString &app ); | 125 | const QString &key, const QString &app ); |
126 | 126 | ||
127 | /** | 127 | /** |
128 | * Delete all fields from list. | 128 | * Delete all fields from list. |
129 | */ | 129 | */ |
130 | static void deleteFields(); | 130 | static void deleteFields(); |
131 | 131 | ||
132 | /** | 132 | /** |
133 | * Save the field settings to a config file. | 133 | * Save the field settings to a config file. |
134 | * | 134 | * |
135 | * @param cfg The config file object | 135 | * @param cfg The config file object |
136 | * @param identifier The unique identifier | 136 | * @param identifier The unique identifier |
137 | * @param fields The list of the fields | 137 | * @param fields The list of the fields |
138 | */ | 138 | */ |
139 | static void saveFields( KConfig *cfg, const QString &identifier, | 139 | static void saveFields( KConfig *cfg, const QString &identifier, |
140 | const Field::List &fields ); | 140 | const Field::List &fields ); |
141 | /** | 141 | /** |
142 | * This is the same as above, with the difference, that | 142 | * This is the same as above, with the difference, that |
143 | * the list is stored in KGlobal::config() in group "KABCFields". | 143 | * the list is stored in KGlobal::config() in group "KABCFields". |
144 | */ | 144 | */ |
145 | static void saveFields( const QString &identifier, | 145 | static void saveFields( const QString &identifier, |
146 | const Field::List &fields ); | 146 | const Field::List &fields ); |
147 | 147 | ||
148 | /** | 148 | /** |
149 | * Load the field settings from a config file. | 149 | * Load the field settings from a config file. |
150 | * | 150 | * |
151 | * @param cfg The config file object | 151 | * @param cfg The config file object |
152 | * @param identifier The unique identifier | 152 | * @param identifier The unique identifier |
153 | */ | 153 | */ |
154 | static Field::List restoreFields( KConfig *cfg, const QString &identifier ); | 154 | static Field::List restoreFields( KConfig *cfg, const QString &identifier ); |
155 | 155 | ||
156 | /** | 156 | /** |
157 | * This is the same as above, with the difference, that | 157 | * This is the same as above, with the difference, that |
158 | * the list is loaded from KGlobal::config() from group "KABCFields". | 158 | * the list is loaded from KGlobal::config() from group "KABCFields". |
159 | */ | 159 | */ |
160 | static Field::List restoreFields( const QString &identifier ); | 160 | static Field::List restoreFields( const QString &identifier ); |
161 | 161 | ||
162 | protected: | 162 | protected: |
163 | static void createField( int id, int category = 0 ); | 163 | static void createField( int id, int category = 0 ); |
164 | static void createDefaultField( int id, int category = 0 ); | 164 | static void createDefaultField( int id, int category = 0 ); |
165 | 165 | ||
166 | private: | 166 | private: |
167 | Field( FieldImpl * ); | 167 | Field( FieldImpl * ); |
168 | virtual ~Field(); | 168 | virtual ~Field(); |
169 | 169 | ||
170 | FieldImpl *mImpl; | 170 | FieldImpl *mImpl; |
171 | 171 | ||
172 | static Field::List mAllFields; | 172 | static Field::List mAllFields; |
173 | static Field::List mDefaultFields; | 173 | static Field::List mDefaultFields; |
174 | static Field::List mCustomFields; | 174 | static Field::List mCustomFields; |