author | eilers <eilers> | 2003-01-31 13:51:13 (UTC) |
---|---|---|
committer | eilers <eilers> | 2003-01-31 13:51:13 (UTC) |
commit | 6f5a127080c50eb901ac6a332ac76d9948f91bd5 (patch) (unidiff) | |
tree | 8021e7597b9bc8e527b2fddac1e03dc0959434c9 | |
parent | 84bd32181af3922ccba35fcaed9b404d1e4deed8 (diff) | |
download | opie-6f5a127080c50eb901ac6a332ac76d9948f91bd5.zip opie-6f5a127080c50eb901ac6a332ac76d9948f91bd5.tar.gz opie-6f5a127080c50eb901ac6a332ac76d9948f91bd5.tar.bz2 |
Removed a lot of debug output.. Therefore it should speed up..
The settings of the combo-boxes in the contacteditor are now stored globally
and individual for a contact ( I fear this will not survive any synchronizing! ).
Thanks to tille for his assistance !
I hope there isn't any new bug in the contacteditor.. It is very ugly and hard
to debug..
-rw-r--r-- | core/pim/addressbook/TODO | 16 | ||||
-rw-r--r-- | core/pim/addressbook/abtable.cpp | 40 | ||||
-rw-r--r-- | core/pim/addressbook/abview.cpp | 48 | ||||
-rw-r--r-- | core/pim/addressbook/contacteditor.cpp | 75 | ||||
-rw-r--r-- | core/pim/addressbook/contacteditor.h | 5 | ||||
-rw-r--r-- | core/pim/addressbook/ocontactfields.cpp | 101 | ||||
-rw-r--r-- | core/pim/addressbook/ocontactfields.h | 34 | ||||
-rw-r--r-- | core/pim/addressbook/version.h | 4 |
8 files changed, 251 insertions, 72 deletions
diff --git a/core/pim/addressbook/TODO b/core/pim/addressbook/TODO index 76247c1..c600d20 100644 --- a/core/pim/addressbook/TODO +++ b/core/pim/addressbook/TODO | |||
@@ -1,84 +1,82 @@ | |||
1 | Stuff todo until OPIE 1.0 : | 1 | Stuff todo until OPIE 1.0 : |
2 | =========================== | 2 | =========================== |
3 | 3 | ||
4 | Feature requests: | 4 | Feature requests: |
5 | ----------------- | 5 | ----------------- |
6 | - Dial by mobile phone by tapping the number.. | 6 | - Dial by mobile phone by tapping the number.. |
7 | (Maybe using gsmtool. And we may | 7 | (Maybe using gsmtool. And we may |
8 | add a library class for this) | 8 | add a library class for this) |
9 | - dial with dtmfdial incase it's installed and there's no mobile | 9 | - dial with dtmfdial in case it's installed and there's no mobile |
10 | - 3rd column for 2. Contact | 10 | - 3rd column for 2. Contact |
11 | - Implementing additional Views (Phonebook, ...) | 11 | - Implementing additional Views (Phonebook, ...) |
12 | - Birthday & Anniversary Reminder | 12 | - Birthday & Anniversary Reminder |
13 | - Plugin for Today for Birthdays and Anniversaries | ||
14 | - Beaming of multiple contacts (current list/ by search or by category) | 13 | - Beaming of multiple contacts (current list/ by search or by category) |
14 | - Configure the letter-picker: lastname/fullname search | ||
15 | 15 | ||
16 | Known Bugs: | 16 | Known Bugs: |
17 | ----------- | 17 | ----------- |
18 | 18 | - Email-button: A lot of problems.. :( | |
19 | - Default Email-Button: Sometimes not hiding the textfields completely | ||
19 | 20 | ||
20 | Bugs but not in addressbook: | 21 | Bugs but not in addressbook: |
21 | ----------------------------- | 22 | ----------------------------- |
22 | - VCARD: If umlaut (äöüß) in address, the parser gets confused.. | 23 | - VCARD: If umlaut (äöüß) in address, the parser gets confused.. |
23 | 24 | ||
24 | - Exporting and reimporting of Jobtitle was reported to fail (Could not reproduce this ! (se)) | 25 | - Exporting and reimporting of Jobtitle was reported to fail (Could not reproduce this ! (se)) |
25 | 26 | ||
26 | 27 | ||
27 | Urgent: | 28 | Urgent: |
28 | -------- | 29 | -------- |
29 | ContactEditor: | 30 | ContactEditor: |
30 | - Contact-Editor is temporarely reenabled. Wait for replacement. | 31 | - Contact-Editor is temporarely reenabled. Wait for replacement. |
31 | - Redesign of Contacteditor | 32 | - Redesign of Contacteditor |
32 | - Store last settings of combo-boxes | ||
33 | - Category is on the wrong position after changing to personal and back to normal | 33 | - Category is on the wrong position after changing to personal and back to normal |
34 | ( Temporarily workaround: Category is never deactivated.. :S ) | 34 | ( Temporarily workaround: Category is never deactivated.. :S ) |
35 | 35 | ||
36 | - Personal and Business Web-page is not editable | 36 | - Personal and Business Web-page is not editable |
37 | 37 | ||
38 | Important: | 38 | Important: |
39 | ---------- | 39 | ---------- |
40 | 40 | ||
41 | - If new contact is added (contacteditor closed): focus (table, card) to | 41 | - If new contact is added (contacteditor closed): focus (table, card) to |
42 | this entry ! | 42 | this entry ! |
43 | - Implement a picker/combo for the default email. | ||
44 | - After search (Started with Return): KeyFocus should be on Tabelle | 43 | - After search (Started with Return): KeyFocus should be on Tabelle |
45 | 44 | ||
46 | - "What's this" should be added (Deleyed after Feature Freeze) | 45 | - "What's this" should be added (Deleyed after Feature Freeze) |
47 | 46 | ||
48 | Less important: | 47 | Less important: |
49 | --------------- | 48 | --------------- |
50 | - Reload if contacts were changed externally | 49 | - Reload if contacts were changed externally |
51 | - Overview window cleanup needed.. | ||
52 | - The picker (alphabetical sort widget) should be | 50 | - The picker (alphabetical sort widget) should be |
53 | placed verticaly or horizontally (configurable) | 51 | placed verticaly or horizontally (configurable) |
54 | - Find a smart solution for activating/deactivating the "send email" event | 52 | - Find a smart solution for activating/deactivating the "send email" event |
55 | 53 | ||
56 | Should be Fixed (not absolute sure, need further validation): | 54 | Should be Fixed (not absolute sure, need further validation): |
57 | ------------------------------------------------------------- | 55 | ------------------------------------------------------------- |
58 | 56 | ||
59 | 57 | ||
60 | Fixed: | 58 | Fixed/Ready: |
61 | ------- | 59 | ------- |
62 | - Syncing: abtable not reloaded after sync. | 60 | - Syncing: abtable not reloaded after sync. |
63 | - Find widget should be replaced by something like | 61 | - Find widget should be replaced by something like |
64 | qpdf has. | 62 | qpdf has. |
65 | - Adding a configuration dialog | 63 | - Adding a configuration dialog |
66 | - Picker: Activated letter schould be more visible | 64 | - Picker: Activated letter schould be more visible |
67 | - Advanced handling of cursor keys (search..) | 65 | - Advanced handling of cursor keys (search..) |
68 | - Mail-Icon is missing | 66 | - Mail-Icon is missing |
69 | - Use opie-mail insted of qt-mail if possible. | 67 | - Use opie-mail insted of qt-mail if possible. |
70 | - Font menu is invisible using german translation | 68 | - Font menu is invisible using german translation |
71 | - Personal contact editor: Disable categories | 69 | - Personal contact editor: Disable categories |
72 | - "Nonenglish" translation bug has to be fixed. | 70 | - "Nonenglish" translation bug has to be fixed. |
73 | - contacteditor: Birthday, annyversary, ... : Use Dateselector | 71 | - contacteditor: Birthday, annyversary, ... : Use Dateselector |
74 | - The names of the countries are sorted by there english names, only.. | 72 | - The names of the countries are sorted by there english names, only.. |
75 | Even if they are translated.. :S | 73 | Even if they are translated.. :S |
76 | - Cursor keys should work in detail-view (ablabel) | 74 | - Cursor keys should work in detail-view (ablabel) |
77 | -> Ablabel should be removed and Abtable should be increased with | 75 | -> Ablabel should be removed and Abtable should be increased with |
78 | different views (as started by darwin zins).. | 76 | different views (as started by darwin zins).. |
79 | - Use advanced database functions in abtable to decrease | 77 | - Use advanced database functions in abtable to decrease |
80 | memory footprint and to make everything more easy ! | 78 | memory footprint and to make everything more easy ! |
81 | (abtable should store Iterator for selected Category) | 79 | (abtable should store Iterator for selected Category) |
82 | - Abtable: Configure Contact column (internally already available, | 80 | - Abtable: Configure Contact column (internally already available, |
83 | need configuration) | 81 | need configuration) |
84 | - Select of primary contact (see #274 on mantis) | 82 | - Select of primary contact (see #274 on mantis) |
@@ -89,24 +87,28 @@ Fixed: | |||
89 | - There should be some icons for List and Cardview | 87 | - There should be some icons for List and Cardview |
90 | - If in Cardview and a category change removes all entries: | 88 | - If in Cardview and a category change removes all entries: |
91 | There are already entries in Cardview after up/down | 89 | There are already entries in Cardview after up/down |
92 | - Personal Details: Anniversary zeigt Fantasie-Werte | 90 | - Personal Details: Anniversary zeigt Fantasie-Werte |
93 | - Unfiled shown just in Category "All" and "Unfiled". | 91 | - Unfiled shown just in Category "All" and "Unfiled". |
94 | - After finising search and after Edit: Clear Picker | 92 | - After finising search and after Edit: Clear Picker |
95 | - After Edit: Table position back to edited entry. | 93 | - After Edit: Table position back to edited entry. |
96 | - Optimize Table Update... | 94 | - Optimize Table Update... |
97 | - Change MyDialog to Config | 95 | - Change MyDialog to Config |
98 | - Store position and state of toolbar | 96 | - Store position and state of toolbar |
99 | - Searchwidget closed: Selected user is jumping | 97 | - Searchwidget closed: Selected user is jumping |
100 | - Wenn suchen beendet, dann dauert das Tabellenupdate (was überhaupt überflüssig ist) | 98 | - Wenn suchen beendet, dann dauert das Tabellenupdate (was überhaupt überflüssig ist) |
101 | zu lange.. | 99 | zu lange.. |
102 | - VCARD: Import of Anniversary does not work correctly (currently disabled) | 100 | - VCARD: Import of Anniversary does not work correctly (currently disabled) |
103 | - Name order selected in "contacteditor" not used in list view. | 101 | - Name order selected in "contacteditor" not used in list view. |
104 | - OK-Key does not switch from Detailview (ablable) to Listview | 102 | - OK-Key does not switch from Detailview (ablable) to Listview |
105 | - Receiving of beams should open a dialog | 103 | - Receiving of beams should open a dialog |
106 | - Fix start of opie-mail | 104 | - Fix start of opie-mail |
107 | - Implement Button Pics | 105 | - Implement Button Pics |
108 | - Add a dialog to accept and optionally edit received contacts by IRDA. | 106 | - Add a dialog to accept and optionally edit received contacts by IRDA. |
109 | - Language not English (tested with german opie-translation): | 107 | - Language not English (tested with german opie-translation): |
110 | 1. Configure nicht übersetzt (alles leer). | 108 | 1. Configure nicht übersetzt (alles leer). |
111 | 2. Contacteditor nur teilweise übersetzt. | 109 | 2. Contacteditor nur teilweise übersetzt. |
112 | 3. Kategorie-Picker geht nicht. | 110 | 3. Kategorie-Picker geht nicht. |
111 | - Plugin for Today for Birthdays and Anniversaries | ||
112 | - Implement a picker/combo for the default email. | ||
113 | - Overview window cleanup needed.. | ||
114 | - Store last settings of combo-boxes | ||
diff --git a/core/pim/addressbook/abtable.cpp b/core/pim/addressbook/abtable.cpp index 00335ae..aec390d 100644 --- a/core/pim/addressbook/abtable.cpp +++ b/core/pim/addressbook/abtable.cpp | |||
@@ -105,249 +105,249 @@ QWidget *AbPickItem::createEditor() const | |||
105 | 105 | ||
106 | void AbPickItem::setContentFromEditor( QWidget *w ) | 106 | void AbPickItem::setContentFromEditor( QWidget *w ) |
107 | { | 107 | { |
108 | if ( w->inherits("QComboBox") ) | 108 | if ( w->inherits("QComboBox") ) |
109 | setText( ( (QComboBox*)w )->currentText() ); | 109 | setText( ( (QComboBox*)w )->currentText() ); |
110 | else | 110 | else |
111 | QTableItem::setContentFromEditor( w ); | 111 | QTableItem::setContentFromEditor( w ); |
112 | } | 112 | } |
113 | 113 | ||
114 | /*! | 114 | /*! |
115 | \class AbTable abtable.h | 115 | \class AbTable abtable.h |
116 | 116 | ||
117 | \brief QTable based class for showing a list of entries | 117 | \brief QTable based class for showing a list of entries |
118 | */ | 118 | */ |
119 | 119 | ||
120 | AbTable::AbTable( const QValueList<int> order, QWidget *parent, const char *name ) | 120 | AbTable::AbTable( const QValueList<int> order, QWidget *parent, const char *name ) |
121 | : QTable( parent, name ), | 121 | : QTable( parent, name ), |
122 | lastSortCol( -1 ), | 122 | lastSortCol( -1 ), |
123 | asc( TRUE ), | 123 | asc( TRUE ), |
124 | intFields( order ), | 124 | intFields( order ), |
125 | enablePainting( true ), | 125 | enablePainting( true ), |
126 | columnVisible( true ), | 126 | columnVisible( true ), |
127 | countNested( 0 ) | 127 | countNested( 0 ) |
128 | { | 128 | { |
129 | qWarning("C'tor start"); | 129 | //qWarning("C'tor start"); |
130 | 130 | ||
131 | setSelectionMode( NoSelection ); | 131 | setSelectionMode( NoSelection ); |
132 | init(); | 132 | init(); |
133 | setSorting( TRUE ); | 133 | setSorting( TRUE ); |
134 | connect( this, SIGNAL(clicked(int,int,int,const QPoint &)), | 134 | connect( this, SIGNAL(clicked(int,int,int,const QPoint &)), |
135 | this, SLOT(itemClicked(int,int)) ); | 135 | this, SLOT(itemClicked(int,int)) ); |
136 | 136 | ||
137 | contactList.clear(); | 137 | contactList.clear(); |
138 | qWarning("C'tor end"); | 138 | //qWarning("C'tor end"); |
139 | } | 139 | } |
140 | 140 | ||
141 | AbTable::~AbTable() | 141 | AbTable::~AbTable() |
142 | { | 142 | { |
143 | } | 143 | } |
144 | 144 | ||
145 | void AbTable::init() | 145 | void AbTable::init() |
146 | { | 146 | { |
147 | // :SX showChar = '\0'; | 147 | // :SX showChar = '\0'; |
148 | setNumRows( 0 ); | 148 | setNumRows( 0 ); |
149 | setNumCols( 2 ); | 149 | setNumCols( 2 ); |
150 | 150 | ||
151 | horizontalHeader()->setLabel( 0, tr( "Full Name" )); | 151 | horizontalHeader()->setLabel( 0, tr( "Full Name" )); |
152 | horizontalHeader()->setLabel( 1, tr( "Contact" )); | 152 | horizontalHeader()->setLabel( 1, tr( "Contact" )); |
153 | setLeftMargin( 0 ); | 153 | setLeftMargin( 0 ); |
154 | verticalHeader()->hide(); | 154 | verticalHeader()->hide(); |
155 | columnVisible = true; | 155 | columnVisible = true; |
156 | } | 156 | } |
157 | 157 | ||
158 | void AbTable::setContacts( const OContactAccess::List& viewList ) | 158 | void AbTable::setContacts( const OContactAccess::List& viewList ) |
159 | { | 159 | { |
160 | qWarning("AbTable::setContacts()"); | 160 | //qWarning("AbTable::setContacts()"); |
161 | 161 | ||
162 | clear(); | 162 | clear(); |
163 | m_viewList = viewList; | 163 | m_viewList = viewList; |
164 | 164 | ||
165 | setSorting( false ); | 165 | setSorting( false ); |
166 | setPaintingEnabled( FALSE ); | 166 | setPaintingEnabled( FALSE ); |
167 | 167 | ||
168 | OContactAccess::List::Iterator it; | 168 | OContactAccess::List::Iterator it; |
169 | setNumRows( m_viewList.count() ); | 169 | setNumRows( m_viewList.count() ); |
170 | int row = 0; | 170 | int row = 0; |
171 | for ( it = m_viewList.begin(); it != m_viewList.end(); ++it ) | 171 | for ( it = m_viewList.begin(); it != m_viewList.end(); ++it ) |
172 | insertIntoTable( *it, row++ ); | 172 | insertIntoTable( *it, row++ ); |
173 | 173 | ||
174 | setSorting( true ); | 174 | setSorting( true ); |
175 | 175 | ||
176 | resort(); | 176 | resort(); |
177 | 177 | ||
178 | updateVisible(); | 178 | updateVisible(); |
179 | 179 | ||
180 | setPaintingEnabled( TRUE ); | 180 | setPaintingEnabled( TRUE ); |
181 | 181 | ||
182 | } | 182 | } |
183 | 183 | ||
184 | bool AbTable::selectContact( int UID ) | 184 | bool AbTable::selectContact( int UID ) |
185 | { | 185 | { |
186 | qWarning( "AbTable::selectContact( %d )", UID ); | 186 | //qWarning( "AbTable::selectContact( %d )", UID ); |
187 | int rows = numRows(); | 187 | int rows = numRows(); |
188 | AbTableItem *abi; | 188 | AbTableItem *abi; |
189 | OContact* foundContact = 0l; | 189 | OContact* foundContact = 0l; |
190 | bool found = false; | 190 | bool found = false; |
191 | 191 | ||
192 | setPaintingEnabled( FALSE ); | 192 | setPaintingEnabled( FALSE ); |
193 | for ( int r = 0; r < rows; ++r ) { | 193 | for ( int r = 0; r < rows; ++r ) { |
194 | abi = static_cast<AbTableItem*>( item(r, 0) ); | 194 | abi = static_cast<AbTableItem*>( item(r, 0) ); |
195 | foundContact = &contactList[abi]; | 195 | foundContact = &contactList[abi]; |
196 | if ( foundContact -> uid() == UID ){ | 196 | if ( foundContact -> uid() == UID ){ |
197 | ensureCellVisible( r, 0 ); | 197 | ensureCellVisible( r, 0 ); |
198 | setCurrentCell( r, 0 ); | 198 | setCurrentCell( r, 0 ); |
199 | found = true; | 199 | found = true; |
200 | break; | 200 | break; |
201 | } | 201 | } |
202 | } | 202 | } |
203 | 203 | ||
204 | if ( !found ){ | 204 | if ( !found ){ |
205 | ensureCellVisible( 0,0 ); | 205 | ensureCellVisible( 0,0 ); |
206 | setCurrentCell( 0, 0 ); | 206 | setCurrentCell( 0, 0 ); |
207 | } | 207 | } |
208 | 208 | ||
209 | setPaintingEnabled( TRUE ); | 209 | setPaintingEnabled( TRUE ); |
210 | 210 | ||
211 | return true; | 211 | return true; |
212 | } | 212 | } |
213 | 213 | ||
214 | void AbTable::insertIntoTable( const OContact& cnt, int row ) | 214 | void AbTable::insertIntoTable( const OContact& cnt, int row ) |
215 | { | 215 | { |
216 | qWarning( "void AbTable::insertIntoTable( const OContact& cnt, %d )", row ); | 216 | //qWarning( "void AbTable::insertIntoTable( const OContact& cnt, %d )", row ); |
217 | QString strName, | 217 | QString strName, |
218 | strContact; | 218 | strContact; |
219 | 219 | ||
220 | strName = findContactName( cnt ); | 220 | strName = findContactName( cnt ); |
221 | strContact = findContactContact( cnt, row ); | 221 | strContact = findContactContact( cnt, row ); |
222 | 222 | ||
223 | AbTableItem *ati; | 223 | AbTableItem *ati; |
224 | ati = new AbTableItem( this, QTableItem::Never, strName, strContact); | 224 | ati = new AbTableItem( this, QTableItem::Never, strName, strContact); |
225 | contactList.insert( ati, cnt ); | 225 | contactList.insert( ati, cnt ); |
226 | setItem( row, 0, ati ); | 226 | setItem( row, 0, ati ); |
227 | ati = new AbTableItem( this, QTableItem::Never, strContact, strName); | 227 | ati = new AbTableItem( this, QTableItem::Never, strContact, strName); |
228 | setItem( row, 1, ati ); | 228 | setItem( row, 1, ati ); |
229 | 229 | ||
230 | //### cannot do this; table only has two columns at this point | 230 | //### cannot do this; table only has two columns at this point |
231 | // setItem( row, 2, new AbPickItem( this ) ); | 231 | // setItem( row, 2, new AbPickItem( this ) ); |
232 | 232 | ||
233 | } | 233 | } |
234 | 234 | ||
235 | 235 | ||
236 | 236 | ||
237 | void AbTable::columnClicked( int col ) | 237 | void AbTable::columnClicked( int col ) |
238 | { | 238 | { |
239 | if ( !sorting() ) | 239 | if ( !sorting() ) |
240 | return; | 240 | return; |
241 | 241 | ||
242 | if ( lastSortCol == -1 ) | 242 | if ( lastSortCol == -1 ) |
243 | lastSortCol = col; | 243 | lastSortCol = col; |
244 | 244 | ||
245 | if ( col == lastSortCol ) { | 245 | if ( col == lastSortCol ) { |
246 | asc = !asc; | 246 | asc = !asc; |
247 | } else { | 247 | } else { |
248 | lastSortCol = col; | 248 | lastSortCol = col; |
249 | asc = TRUE; | 249 | asc = TRUE; |
250 | } | 250 | } |
251 | //QMessageBox::information( this, "resort", "columnClicked" ); | 251 | //QMessageBox::information( this, "resort", "columnClicked" ); |
252 | resort(); | 252 | resort(); |
253 | } | 253 | } |
254 | 254 | ||
255 | void AbTable::resort() | 255 | void AbTable::resort() |
256 | { | 256 | { |
257 | qWarning( "void AbTable::resort()" ); | 257 | //qWarning( "void AbTable::resort()" ); |
258 | setPaintingEnabled( FALSE ); | 258 | setPaintingEnabled( FALSE ); |
259 | if ( sorting() ) { | 259 | if ( sorting() ) { |
260 | if ( lastSortCol == -1 ) | 260 | if ( lastSortCol == -1 ) |
261 | lastSortCol = 0; | 261 | lastSortCol = 0; |
262 | sortColumn( lastSortCol, asc, TRUE ); | 262 | sortColumn( lastSortCol, asc, TRUE ); |
263 | //QMessageBox::information( this, "resort", "resort" ); | 263 | //QMessageBox::information( this, "resort", "resort" ); |
264 | updateVisible(); | 264 | updateVisible(); |
265 | } | 265 | } |
266 | setPaintingEnabled( TRUE ); | 266 | setPaintingEnabled( TRUE ); |
267 | } | 267 | } |
268 | 268 | ||
269 | OContact AbTable::currentEntry() | 269 | OContact AbTable::currentEntry() |
270 | { | 270 | { |
271 | qWarning( "OContact AbTable::currentEntry()" ); | 271 | //qWarning( "OContact AbTable::currentEntry()" ); |
272 | OContact cnt; | 272 | OContact cnt; |
273 | AbTableItem *abItem; | 273 | AbTableItem *abItem; |
274 | abItem = static_cast<AbTableItem*>(item( currentRow(), 0 )); | 274 | abItem = static_cast<AbTableItem*>(item( currentRow(), 0 )); |
275 | if ( abItem ) { | 275 | if ( abItem ) { |
276 | cnt = contactList[abItem]; | 276 | cnt = contactList[abItem]; |
277 | //cnt = contactList[currentRow()]; | 277 | //cnt = contactList[currentRow()]; |
278 | } | 278 | } |
279 | return cnt; | 279 | return cnt; |
280 | } | 280 | } |
281 | 281 | ||
282 | int AbTable::currentEntry_UID() | 282 | int AbTable::currentEntry_UID() |
283 | { | 283 | { |
284 | return ( currentEntry().uid() ); | 284 | return ( currentEntry().uid() ); |
285 | } | 285 | } |
286 | 286 | ||
287 | void AbTable::clear() | 287 | void AbTable::clear() |
288 | { | 288 | { |
289 | qWarning( "void AbTable::clear()" ); | 289 | //qWarning( "void AbTable::clear()" ); |
290 | contactList.clear(); | 290 | contactList.clear(); |
291 | 291 | ||
292 | setPaintingEnabled( FALSE ); | 292 | setPaintingEnabled( FALSE ); |
293 | for ( int r = 0; r < numRows(); ++r ) { | 293 | for ( int r = 0; r < numRows(); ++r ) { |
294 | for ( int c = 0; c < numCols(); ++c ) { | 294 | for ( int c = 0; c < numCols(); ++c ) { |
295 | if ( cellWidget( r, c ) ) | 295 | if ( cellWidget( r, c ) ) |
296 | clearCellWidget( r, c ); | 296 | clearCellWidget( r, c ); |
297 | clearCell( r, c ); | 297 | clearCell( r, c ); |
298 | } | 298 | } |
299 | } | 299 | } |
300 | setNumRows( 0 ); | 300 | setNumRows( 0 ); |
301 | setPaintingEnabled( TRUE ); | 301 | setPaintingEnabled( TRUE ); |
302 | } | 302 | } |
303 | 303 | ||
304 | // Refresh updates column 2 if the contactsettings changed | 304 | // Refresh updates column 2 if the contactsettings changed |
305 | void AbTable::refresh() | 305 | void AbTable::refresh() |
306 | { | 306 | { |
307 | qWarning( "void AbTable::refresh()" ); | 307 | //qWarning( "void AbTable::refresh()" ); |
308 | int rows = numRows(); | 308 | int rows = numRows(); |
309 | QString value; | 309 | QString value; |
310 | AbTableItem *abi; | 310 | AbTableItem *abi; |
311 | 311 | ||
312 | setPaintingEnabled( FALSE ); | 312 | setPaintingEnabled( FALSE ); |
313 | for ( int r = 0; r < rows; ++r ) { | 313 | for ( int r = 0; r < rows; ++r ) { |
314 | abi = static_cast<AbTableItem*>( item(r, 0) ); | 314 | abi = static_cast<AbTableItem*>( item(r, 0) ); |
315 | value = findContactContact( contactList[abi], r ); | 315 | value = findContactContact( contactList[abi], r ); |
316 | static_cast<AbTableItem*>( item(r, 1) )->setItem( value, abi->text() ); | 316 | static_cast<AbTableItem*>( item(r, 1) )->setItem( value, abi->text() ); |
317 | } | 317 | } |
318 | resort(); | 318 | resort(); |
319 | setPaintingEnabled( TRUE ); | 319 | setPaintingEnabled( TRUE ); |
320 | } | 320 | } |
321 | 321 | ||
322 | void AbTable::keyPressEvent( QKeyEvent *e ) | 322 | void AbTable::keyPressEvent( QKeyEvent *e ) |
323 | { | 323 | { |
324 | char key = toupper( e->ascii() ); | 324 | char key = toupper( e->ascii() ); |
325 | 325 | ||
326 | if ( key >= 'A' && key <= 'Z' ) | 326 | if ( key >= 'A' && key <= 'Z' ) |
327 | moveTo( key ); | 327 | moveTo( key ); |
328 | 328 | ||
329 | qWarning("Received key .."); | 329 | //qWarning("Received key .."); |
330 | switch( e->key() ) { | 330 | switch( e->key() ) { |
331 | case Qt::Key_Space: | 331 | case Qt::Key_Space: |
332 | case Qt::Key_Return: | 332 | case Qt::Key_Return: |
333 | case Qt::Key_Enter: | 333 | case Qt::Key_Enter: |
334 | emit signalSwitch(); | 334 | emit signalSwitch(); |
335 | break; | 335 | break; |
336 | // case Qt::Key_Up: | 336 | // case Qt::Key_Up: |
337 | // qWarning("a"); | 337 | // qWarning("a"); |
338 | // emit signalKeyUp(); | 338 | // emit signalKeyUp(); |
339 | // break; | 339 | // break; |
340 | // case Qt::Key_Down: | 340 | // case Qt::Key_Down: |
341 | // qWarning("b"); | 341 | // qWarning("b"); |
342 | // emit signalKeyDown(); | 342 | // emit signalKeyDown(); |
343 | // break; | 343 | // break; |
344 | default: | 344 | default: |
345 | QTable::keyPressEvent( e ); | 345 | QTable::keyPressEvent( e ); |
346 | } | 346 | } |
347 | 347 | ||
348 | } | 348 | } |
349 | 349 | ||
350 | void AbTable::moveTo( char c ) | 350 | void AbTable::moveTo( char c ) |
351 | { | 351 | { |
352 | qWarning( "void AbTable::moveTo( char c )" ); | 352 | qWarning( "void AbTable::moveTo( char c )" ); |
353 | 353 | ||
@@ -390,49 +390,49 @@ QString AbTable::findContactName( const OContact &entry ) | |||
390 | str = entry.company(); | 390 | str = entry.company(); |
391 | if ( str.isEmpty() ) { | 391 | if ( str.isEmpty() ) { |
392 | str = entry.defaultEmail(); | 392 | str = entry.defaultEmail(); |
393 | } | 393 | } |
394 | } | 394 | } |
395 | return str; | 395 | return str; |
396 | } | 396 | } |
397 | 397 | ||
398 | 398 | ||
399 | 399 | ||
400 | void AbTable::resizeRows() { | 400 | void AbTable::resizeRows() { |
401 | /* | 401 | /* |
402 | if (numRows()) { | 402 | if (numRows()) { |
403 | for (int i = 0; i < numRows(); i++) { | 403 | for (int i = 0; i < numRows(); i++) { |
404 | setRowHeight( i, size ); | 404 | setRowHeight( i, size ); |
405 | } | 405 | } |
406 | } | 406 | } |
407 | updateVisible(); | 407 | updateVisible(); |
408 | */ | 408 | */ |
409 | } | 409 | } |
410 | 410 | ||
411 | 411 | ||
412 | void AbTable::realignTable() | 412 | void AbTable::realignTable() |
413 | { | 413 | { |
414 | qWarning( "void AbTable::realignTable()" ); | 414 | //qWarning( "void AbTable::realignTable()" ); |
415 | 415 | ||
416 | setPaintingEnabled( FALSE ); | 416 | setPaintingEnabled( FALSE ); |
417 | 417 | ||
418 | resizeRows(); | 418 | resizeRows(); |
419 | fitColumns(); | 419 | fitColumns(); |
420 | 420 | ||
421 | setPaintingEnabled( TRUE ); | 421 | setPaintingEnabled( TRUE ); |
422 | 422 | ||
423 | } | 423 | } |
424 | 424 | ||
425 | 425 | ||
426 | 426 | ||
427 | 427 | ||
428 | #if QT_VERSION <= 230 | 428 | #if QT_VERSION <= 230 |
429 | #ifndef SINGLE_APP | 429 | #ifndef SINGLE_APP |
430 | void QTable::paintEmptyArea( QPainter *p, int cx, int cy, int cw, int ch ) | 430 | void QTable::paintEmptyArea( QPainter *p, int cx, int cy, int cw, int ch ) |
431 | { | 431 | { |
432 | // Region of the rect we should draw | 432 | // Region of the rect we should draw |
433 | QRegion reg( QRect( cx, cy, cw, ch ) ); | 433 | QRegion reg( QRect( cx, cy, cw, ch ) ); |
434 | // Subtract the table from it | 434 | // Subtract the table from it |
435 | reg = reg.subtract( QRect( QPoint( 0, 0 ), tableSize() ) ); | 435 | reg = reg.subtract( QRect( QPoint( 0, 0 ), tableSize() ) ); |
436 | // And draw the rectangles (transformed as needed) | 436 | // And draw the rectangles (transformed as needed) |
437 | QArray<QRect> r = reg.rects(); | 437 | QArray<QRect> r = reg.rects(); |
438 | for (unsigned int i=0; i<r.count(); i++) | 438 | for (unsigned int i=0; i<r.count(); i++) |
@@ -440,194 +440,194 @@ void QTable::paintEmptyArea( QPainter *p, int cx, int cy, int cw, int ch ) | |||
440 | } | 440 | } |
441 | #endif | 441 | #endif |
442 | #endif | 442 | #endif |
443 | 443 | ||
444 | 444 | ||
445 | // int AbTable::rowHeight( int ) const | 445 | // int AbTable::rowHeight( int ) const |
446 | // { | 446 | // { |
447 | // return 18; | 447 | // return 18; |
448 | // } | 448 | // } |
449 | 449 | ||
450 | // int AbTable::rowPos( int row ) const | 450 | // int AbTable::rowPos( int row ) const |
451 | // { | 451 | // { |
452 | // return 18*row; | 452 | // return 18*row; |
453 | // } | 453 | // } |
454 | 454 | ||
455 | // int AbTable::rowAt( int pos ) const | 455 | // int AbTable::rowAt( int pos ) const |
456 | // { | 456 | // { |
457 | // return QMIN( pos/18, numRows()-1 ); | 457 | // return QMIN( pos/18, numRows()-1 ); |
458 | // } | 458 | // } |
459 | 459 | ||
460 | 460 | ||
461 | 461 | ||
462 | void AbTable::fitColumns() | 462 | void AbTable::fitColumns() |
463 | { | 463 | { |
464 | qWarning( "void AbTable::fitColumns()" ); | 464 | //qWarning( "void AbTable::fitColumns()" ); |
465 | int contentsWidth = visibleWidth() / 2; // :SX Why too low | 465 | int contentsWidth = visibleWidth() / 2; // :SX Why too low |
466 | // Fix to better value | 466 | // Fix to better value |
467 | // contentsWidth = 130; | 467 | // contentsWidth = 130; |
468 | 468 | ||
469 | setPaintingEnabled( FALSE ); | 469 | setPaintingEnabled( FALSE ); |
470 | 470 | ||
471 | if ( columnVisible == false ){ | 471 | if ( columnVisible == false ){ |
472 | showColumn(0); | 472 | showColumn(0); |
473 | columnVisible = true; | 473 | columnVisible = true; |
474 | } | 474 | } |
475 | 475 | ||
476 | qWarning("Width: %d", contentsWidth); | 476 | //qWarning("Width: %d", contentsWidth); |
477 | 477 | ||
478 | setColumnWidth( 0, contentsWidth ); | 478 | setColumnWidth( 0, contentsWidth ); |
479 | adjustColumn(1); | 479 | adjustColumn(1); |
480 | if ( columnWidth(1) < contentsWidth ) | 480 | if ( columnWidth(1) < contentsWidth ) |
481 | setColumnWidth( 1, contentsWidth ); | 481 | setColumnWidth( 1, contentsWidth ); |
482 | 482 | ||
483 | setPaintingEnabled( TRUE ); | 483 | setPaintingEnabled( TRUE ); |
484 | } | 484 | } |
485 | 485 | ||
486 | void AbTable::show() | 486 | void AbTable::show() |
487 | { | 487 | { |
488 | qWarning( "void AbTable::show()" ); | 488 | //qWarning( "void AbTable::show()" ); |
489 | realignTable(); | 489 | realignTable(); |
490 | QTable::show(); | 490 | QTable::show(); |
491 | } | 491 | } |
492 | 492 | ||
493 | void AbTable::setChoiceNames( const QStringList& list) | 493 | void AbTable::setChoiceNames( const QStringList& list) |
494 | { | 494 | { |
495 | choicenames = list; | 495 | choicenames = list; |
496 | if ( choicenames.isEmpty() ) { | 496 | if ( choicenames.isEmpty() ) { |
497 | // hide pick column | 497 | // hide pick column |
498 | setNumCols( 2 ); | 498 | setNumCols( 2 ); |
499 | } else { | 499 | } else { |
500 | // show pick column | 500 | // show pick column |
501 | setNumCols( 3 ); | 501 | setNumCols( 3 ); |
502 | setColumnWidth( 2, fontMetrics().width(tr( "Pick" ))+8 ); | 502 | setColumnWidth( 2, fontMetrics().width(tr( "Pick" ))+8 ); |
503 | horizontalHeader()->setLabel( 2, tr( "Pick" )); | 503 | horizontalHeader()->setLabel( 2, tr( "Pick" )); |
504 | } | 504 | } |
505 | fitColumns(); | 505 | fitColumns(); |
506 | } | 506 | } |
507 | 507 | ||
508 | void AbTable::itemClicked(int,int col) | 508 | void AbTable::itemClicked(int,int col) |
509 | { | 509 | { |
510 | qWarning( "AbTable::itemClicked(int, col:%d)", col); | 510 | //qWarning( "AbTable::itemClicked(int, col:%d)", col); |
511 | if ( col == 2 ) { | 511 | if ( col == 2 ) { |
512 | return; | 512 | return; |
513 | } else { | 513 | } else { |
514 | qWarning ("Emitting signalSwitch()"); | 514 | // qWarning ("Emitting signalSwitch()"); |
515 | emit signalSwitch(); | 515 | emit signalSwitch(); |
516 | } | 516 | } |
517 | } | 517 | } |
518 | 518 | ||
519 | QStringList AbTable::choiceNames() const | 519 | QStringList AbTable::choiceNames() const |
520 | { | 520 | { |
521 | return choicenames; | 521 | return choicenames; |
522 | } | 522 | } |
523 | 523 | ||
524 | void AbTable::setChoiceSelection( const QValueList<int>& list ) | 524 | void AbTable::setChoiceSelection( const QValueList<int>& list ) |
525 | { | 525 | { |
526 | intFields = list; | 526 | intFields = list; |
527 | } | 527 | } |
528 | 528 | ||
529 | QStringList AbTable::choiceSelection(int /*index*/) const | 529 | QStringList AbTable::choiceSelection(int /*index*/) const |
530 | { | 530 | { |
531 | QStringList r; | 531 | QStringList r; |
532 | /* ###### | 532 | /* ###### |
533 | 533 | ||
534 | QString selname = choicenames.at(index); | 534 | QString selname = choicenames.at(index); |
535 | for (each row) { | 535 | for (each row) { |
536 | OContact *c = contactForRow(row); | 536 | OContact *c = contactForRow(row); |
537 | if ( text(row,2) == selname ) { | 537 | if ( text(row,2) == selname ) { |
538 | r.append(c->email); | 538 | r.append(c->email); |
539 | } | 539 | } |
540 | } | 540 | } |
541 | 541 | ||
542 | */ | 542 | */ |
543 | return r; | 543 | return r; |
544 | } | 544 | } |
545 | 545 | ||
546 | 546 | ||
547 | 547 | ||
548 | 548 | ||
549 | void AbTable::updateVisible() | 549 | void AbTable::updateVisible() |
550 | { | 550 | { |
551 | qWarning("void AbTable::updateVisible()"); | 551 | //qWarning("void AbTable::updateVisible()"); |
552 | 552 | ||
553 | int visible, | 553 | int visible, |
554 | totalRows, | 554 | totalRows, |
555 | row, | 555 | row, |
556 | selectedRow = 0; | 556 | selectedRow = 0; |
557 | 557 | ||
558 | visible = 0; | 558 | visible = 0; |
559 | 559 | ||
560 | setPaintingEnabled( FALSE ); | 560 | setPaintingEnabled( FALSE ); |
561 | 561 | ||
562 | realignTable(); | 562 | realignTable(); |
563 | 563 | ||
564 | totalRows = numRows(); | 564 | totalRows = numRows(); |
565 | for ( row = 0; row < totalRows; row++ ) { | 565 | for ( row = 0; row < totalRows; row++ ) { |
566 | if ( rowHeight(row) == 0 ) { | 566 | if ( rowHeight(row) == 0 ) { |
567 | showRow( row ); | 567 | showRow( row ); |
568 | adjustRow( row ); | 568 | adjustRow( row ); |
569 | if ( isSelected( row,0 ) || isSelected( row,1 ) ) | 569 | if ( isSelected( row,0 ) || isSelected( row,1 ) ) |
570 | selectedRow = row; | 570 | selectedRow = row; |
571 | } | 571 | } |
572 | visible++; | 572 | visible++; |
573 | } | 573 | } |
574 | 574 | ||
575 | if ( selectedRow ) | 575 | if ( selectedRow ) |
576 | setCurrentCell( selectedRow, 0 ); | 576 | setCurrentCell( selectedRow, 0 ); |
577 | 577 | ||
578 | if ( !visible ) | 578 | if ( !visible ) |
579 | setCurrentCell( -1, 0 ); | 579 | setCurrentCell( -1, 0 ); |
580 | 580 | ||
581 | setPaintingEnabled( TRUE ); | 581 | setPaintingEnabled( TRUE ); |
582 | 582 | ||
583 | 583 | ||
584 | } | 584 | } |
585 | 585 | ||
586 | 586 | ||
587 | void AbTable::setPaintingEnabled( bool e ) | 587 | void AbTable::setPaintingEnabled( bool e ) |
588 | { | 588 | { |
589 | qWarning("IN void AbTable::setPaintingEnabled( %d )->Nested: %d", e, countNested ); | 589 | //qWarning("IN void AbTable::setPaintingEnabled( %d )->Nested: %d", e, countNested ); |
590 | 590 | ||
591 | if ( e ) { | 591 | if ( e ) { |
592 | if ( countNested > 0 ) | 592 | if ( countNested > 0 ) |
593 | --countNested; | 593 | --countNested; |
594 | if ( ! countNested ){ | 594 | if ( ! countNested ){ |
595 | setUpdatesEnabled( true ); | 595 | setUpdatesEnabled( true ); |
596 | enablePainting = true; | 596 | enablePainting = true; |
597 | rowHeightChanged( 0 ); | 597 | rowHeightChanged( 0 ); |
598 | viewport()->update(); | 598 | viewport()->update(); |
599 | } | 599 | } |
600 | } else { | 600 | } else { |
601 | ++countNested; | 601 | ++countNested; |
602 | enablePainting = false; | 602 | enablePainting = false; |
603 | setUpdatesEnabled( false ); | 603 | setUpdatesEnabled( false ); |
604 | } | 604 | } |
605 | qWarning("OUT void AbTable::setPaintingEnabled( %d )->Nested: %d", e, countNested ); | 605 | //qWarning("OUT void AbTable::setPaintingEnabled( %d )->Nested: %d", e, countNested ); |
606 | } | 606 | } |
607 | 607 | ||
608 | void AbTable::viewportPaintEvent( QPaintEvent* e ) { | 608 | void AbTable::viewportPaintEvent( QPaintEvent* e ) { |
609 | qWarning(" void AbTable::viewportPaintEvent( QPaintEvent* e ) -> %d", enablePainting); | 609 | //qWarning(" void AbTable::viewportPaintEvent( QPaintEvent* e ) -> %d", enablePainting); |
610 | if ( enablePainting ) | 610 | if ( enablePainting ) |
611 | QTable::viewportPaintEvent( e ); | 611 | QTable::viewportPaintEvent( e ); |
612 | } | 612 | } |
613 | 613 | ||
614 | 614 | ||
615 | 615 | ||
616 | void AbTable::rowHeightChanged( int row ) | 616 | void AbTable::rowHeightChanged( int row ) |
617 | { | 617 | { |
618 | if ( enablePainting ) | 618 | if ( enablePainting ) |
619 | QTable::rowHeightChanged( row ); | 619 | QTable::rowHeightChanged( row ); |
620 | } | 620 | } |
621 | QString AbTable::findContactContact( const OContact &entry, int /* row */ ) | 621 | QString AbTable::findContactContact( const OContact &entry, int /* row */ ) |
622 | { | 622 | { |
623 | QString value; | 623 | QString value; |
624 | value = ""; | 624 | value = ""; |
625 | for ( QValueList<int>::ConstIterator it = intFields.begin(); | 625 | for ( QValueList<int>::ConstIterator it = intFields.begin(); |
626 | it != intFields.end(); ++it ) { | 626 | it != intFields.end(); ++it ) { |
627 | switch ( *it ) { | 627 | switch ( *it ) { |
628 | default: | 628 | default: |
629 | break; | 629 | break; |
630 | case Qtopia::Title: | 630 | case Qtopia::Title: |
631 | value = entry.title(); | 631 | value = entry.title(); |
632 | break; | 632 | break; |
633 | case Qtopia::Suffix: | 633 | case Qtopia::Suffix: |
diff --git a/core/pim/addressbook/abview.cpp b/core/pim/addressbook/abview.cpp index 93e57ca..7da0992 100644 --- a/core/pim/addressbook/abview.cpp +++ b/core/pim/addressbook/abview.cpp | |||
@@ -74,376 +74,376 @@ AbView::AbView ( QWidget* parent, const QValueList<int>& ordered ): | |||
74 | 74 | ||
75 | // Connect views to me | 75 | // Connect views to me |
76 | connect ( m_abTable, SIGNAL( signalSwitch( void ) ), | 76 | connect ( m_abTable, SIGNAL( signalSwitch( void ) ), |
77 | this, SLOT( slotSwitch( void ) ) ); | 77 | this, SLOT( slotSwitch( void ) ) ); |
78 | connect ( m_ablabel, SIGNAL( signalOkPressed( void ) ), | 78 | connect ( m_ablabel, SIGNAL( signalOkPressed( void ) ), |
79 | this, SLOT( slotSwitch( void ) ) ); | 79 | this, SLOT( slotSwitch( void ) ) ); |
80 | 80 | ||
81 | load(); | 81 | load(); |
82 | } | 82 | } |
83 | 83 | ||
84 | AbView::~AbView() | 84 | AbView::~AbView() |
85 | { | 85 | { |
86 | m_contactdb -> save(); | 86 | m_contactdb -> save(); |
87 | delete m_contactdb; | 87 | delete m_contactdb; |
88 | 88 | ||
89 | if ( m_storedDB ){ | 89 | if ( m_storedDB ){ |
90 | m_storedDB -> save(); | 90 | m_storedDB -> save(); |
91 | delete m_storedDB; | 91 | delete m_storedDB; |
92 | } | 92 | } |
93 | } | 93 | } |
94 | 94 | ||
95 | 95 | ||
96 | void AbView::setView( Views view ) | 96 | void AbView::setView( Views view ) |
97 | { | 97 | { |
98 | qWarning("AbView::setView( Views view )"); | 98 | //qWarning("AbView::setView( Views view )"); |
99 | m_curr_View = view; | 99 | m_curr_View = view; |
100 | load(); | 100 | load(); |
101 | } | 101 | } |
102 | 102 | ||
103 | void AbView::addEntry( const OContact &newContact ) | 103 | void AbView::addEntry( const OContact &newContact ) |
104 | { | 104 | { |
105 | qWarning("abview:AddContact"); | 105 | //qWarning("abview:AddContact"); |
106 | m_contactdb->add ( newContact ); | 106 | m_contactdb->add ( newContact ); |
107 | load(); | 107 | load(); |
108 | 108 | ||
109 | } | 109 | } |
110 | void AbView::removeEntry( const int UID ) | 110 | void AbView::removeEntry( const int UID ) |
111 | { | 111 | { |
112 | qWarning("abview:RemoveContact"); | 112 | //qWarning("abview:RemoveContact"); |
113 | m_contactdb->remove( UID ); | 113 | m_contactdb->remove( UID ); |
114 | load(); | 114 | load(); |
115 | } | 115 | } |
116 | 116 | ||
117 | void AbView::replaceEntry( const OContact &contact ) | 117 | void AbView::replaceEntry( const OContact &contact ) |
118 | { | 118 | { |
119 | qWarning("abview:ReplaceContact"); | 119 | //qWarning("abview:ReplaceContact"); |
120 | m_contactdb->replace( contact ); | 120 | m_contactdb->replace( contact ); |
121 | load(); | 121 | load(); |
122 | 122 | ||
123 | } | 123 | } |
124 | 124 | ||
125 | OContact AbView::currentEntry() | 125 | OContact AbView::currentEntry() |
126 | { | 126 | { |
127 | OContact currentContact; | 127 | OContact currentContact; |
128 | 128 | ||
129 | switch ( (int) m_curr_View ) { | 129 | switch ( (int) m_curr_View ) { |
130 | case TableView: | 130 | case TableView: |
131 | currentContact = m_abTable -> currentEntry(); | 131 | currentContact = m_abTable -> currentEntry(); |
132 | break; | 132 | break; |
133 | case CardView: | 133 | case CardView: |
134 | currentContact = m_ablabel -> currentEntry(); | 134 | currentContact = m_ablabel -> currentEntry(); |
135 | break; | 135 | break; |
136 | } | 136 | } |
137 | m_curr_Contact = currentContact.uid(); | 137 | m_curr_Contact = currentContact.uid(); |
138 | return currentContact; | 138 | return currentContact; |
139 | } | 139 | } |
140 | 140 | ||
141 | bool AbView::save() | 141 | bool AbView::save() |
142 | { | 142 | { |
143 | qWarning("abView:Save data"); | 143 | //qWarning("abView:Save data"); |
144 | 144 | ||
145 | return m_contactdb->save(); | 145 | return m_contactdb->save(); |
146 | } | 146 | } |
147 | 147 | ||
148 | void AbView::load() | 148 | void AbView::load() |
149 | { | 149 | { |
150 | qWarning("abView:Load data"); | 150 | //qWarning("abView:Load data"); |
151 | 151 | ||
152 | // Letter Search is stopped at this place | 152 | // Letter Search is stopped at this place |
153 | emit signalClearLetterPicker(); | 153 | emit signalClearLetterPicker(); |
154 | 154 | ||
155 | if ( m_inPersonal ) | 155 | if ( m_inPersonal ) |
156 | // VCard Backend does not sort.. | 156 | // VCard Backend does not sort.. |
157 | m_list = m_contactdb->allRecords(); | 157 | m_list = m_contactdb->allRecords(); |
158 | else{ | 158 | else{ |
159 | m_list = m_contactdb->sorted( true, 0, 0, 0 ); | 159 | m_list = m_contactdb->sorted( true, 0, 0, 0 ); |
160 | clearForCategory(); | 160 | clearForCategory(); |
161 | } | 161 | } |
162 | 162 | ||
163 | qWarning ("Number of contacts: %d", m_list.count()); | 163 | //qWarning ("Number of contacts: %d", m_list.count()); |
164 | 164 | ||
165 | updateView( true ); | 165 | updateView( true ); |
166 | 166 | ||
167 | } | 167 | } |
168 | 168 | ||
169 | void AbView::reload() | 169 | void AbView::reload() |
170 | { | 170 | { |
171 | qWarning( "void AbView::reload()" ); | 171 | //qWarning( "void AbView::reload()" ); |
172 | 172 | ||
173 | m_contactdb->reload(); | 173 | m_contactdb->reload(); |
174 | load(); | 174 | load(); |
175 | } | 175 | } |
176 | 176 | ||
177 | void AbView::clear() | 177 | void AbView::clear() |
178 | { | 178 | { |
179 | // :SX | 179 | // :SX |
180 | } | 180 | } |
181 | 181 | ||
182 | void AbView::setShowByCategory( const QString& cat ) | 182 | void AbView::setShowByCategory( const QString& cat ) |
183 | { | 183 | { |
184 | qWarning("AbView::setShowCategory( const QString& cat )"); | 184 | //qWarning("AbView::setShowCategory( const QString& cat )"); |
185 | 185 | ||
186 | int intCat = 0; | 186 | int intCat = 0; |
187 | 187 | ||
188 | // All (cat == NULL) will be stored as -1 | 188 | // All (cat == NULL) will be stored as -1 |
189 | if ( cat.isNull() ) | 189 | if ( cat.isNull() ) |
190 | intCat = -1; | 190 | intCat = -1; |
191 | else | 191 | else |
192 | intCat = mCat.id("Contacts", cat ); | 192 | intCat = mCat.id("Contacts", cat ); |
193 | 193 | ||
194 | // Just do anything if we really change the category | 194 | // Just do anything if we really change the category |
195 | if ( intCat != m_curr_category ){ | 195 | if ( intCat != m_curr_category ){ |
196 | qWarning ("Categories: Selected %s.. Number: %d", cat.latin1(), m_curr_category); | 196 | // qWarning ("Categories: Selected %s.. Number: %d", cat.latin1(), m_curr_category); |
197 | 197 | ||
198 | m_curr_category = intCat; | 198 | m_curr_category = intCat; |
199 | emit signalClearLetterPicker(); | 199 | emit signalClearLetterPicker(); |
200 | 200 | ||
201 | load(); | 201 | load(); |
202 | } | 202 | } |
203 | 203 | ||
204 | } | 204 | } |
205 | 205 | ||
206 | void AbView::setShowToView( Views view ) | 206 | void AbView::setShowToView( Views view ) |
207 | { | 207 | { |
208 | qWarning("void AbView::setShowToView( View %d )", view); | 208 | //qWarning("void AbView::setShowToView( View %d )", view); |
209 | 209 | ||
210 | qWarning ("Change the View (Category is: %d)", m_curr_category); | 210 | //qWarning ("Change the View (Category is: %d)", m_curr_category); |
211 | 211 | ||
212 | if ( m_curr_View != view ){ | 212 | if ( m_curr_View != view ){ |
213 | m_prev_View = m_curr_View; | 213 | m_prev_View = m_curr_View; |
214 | m_curr_View = view; | 214 | m_curr_View = view; |
215 | 215 | ||
216 | updateView(); | 216 | updateView(); |
217 | } | 217 | } |
218 | 218 | ||
219 | } | 219 | } |
220 | 220 | ||
221 | void AbView::setShowByLetter( char c ) | 221 | void AbView::setShowByLetter( char c ) |
222 | { | 222 | { |
223 | qWarning("void AbView::setShowByLetter( %c )", c ); | 223 | //qWarning("void AbView::setShowByLetter( %c )", c ); |
224 | OContact query; | 224 | OContact query; |
225 | if ( c == 0 ){ | 225 | if ( c == 0 ){ |
226 | load(); | 226 | load(); |
227 | return; | 227 | return; |
228 | }else{ | 228 | }else{ |
229 | // If the current Backend is unable to solve the query, we will | 229 | // If the current Backend is unable to solve the query, we will |
230 | // ignore the request .. | 230 | // ignore the request .. |
231 | if ( ! m_contactdb->hasQuerySettings( OContactAccess::WildCards | OContactAccess::IgnoreCase ) ){ | 231 | if ( ! m_contactdb->hasQuerySettings( OContactAccess::WildCards | OContactAccess::IgnoreCase ) ){ |
232 | return; | 232 | return; |
233 | } | 233 | } |
234 | 234 | ||
235 | query.setLastName( QString("%1*").arg(c) ); | 235 | query.setLastName( QString("%1*").arg(c) ); |
236 | m_list = m_contactdb->queryByExample( query, OContactAccess::WildCards | OContactAccess::IgnoreCase ); | 236 | m_list = m_contactdb->queryByExample( query, OContactAccess::WildCards | OContactAccess::IgnoreCase ); |
237 | clearForCategory(); | 237 | clearForCategory(); |
238 | m_curr_Contact = 0; | 238 | m_curr_Contact = 0; |
239 | } | 239 | } |
240 | updateView( true ); | 240 | updateView( true ); |
241 | } | 241 | } |
242 | 242 | ||
243 | void AbView::setListOrder( const QValueList<int>& ordered ) | 243 | void AbView::setListOrder( const QValueList<int>& ordered ) |
244 | { | 244 | { |
245 | m_orderedFields = ordered; | 245 | m_orderedFields = ordered; |
246 | updateView(); | 246 | updateView(); |
247 | } | 247 | } |
248 | 248 | ||
249 | 249 | ||
250 | QString AbView::showCategory() const | 250 | QString AbView::showCategory() const |
251 | { | 251 | { |
252 | return mCat.label( "Contacts", m_curr_category ); | 252 | return mCat.label( "Contacts", m_curr_category ); |
253 | } | 253 | } |
254 | 254 | ||
255 | void AbView::showPersonal( bool personal ) | 255 | void AbView::showPersonal( bool personal ) |
256 | { | 256 | { |
257 | qWarning ("void AbView::showPersonal( %d )", personal); | 257 | //qWarning ("void AbView::showPersonal( %d )", personal); |
258 | 258 | ||
259 | if ( personal ){ | 259 | if ( personal ){ |
260 | 260 | ||
261 | if ( m_inPersonal ) | 261 | if ( m_inPersonal ) |
262 | return; | 262 | return; |
263 | 263 | ||
264 | // Now switch to vCard Backend and load data. | 264 | // Now switch to vCard Backend and load data. |
265 | // The current default backend will be stored | 265 | // The current default backend will be stored |
266 | // to avoid unneeded load/stores. | 266 | // to avoid unneeded load/stores. |
267 | m_storedDB = m_contactdb; | 267 | m_storedDB = m_contactdb; |
268 | 268 | ||
269 | OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, | 269 | OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, |
270 | addressbookPersonalVCardName() ); | 270 | addressbookPersonalVCardName() ); |
271 | m_contactdb = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); | 271 | m_contactdb = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); |
272 | 272 | ||
273 | m_inPersonal = true; | 273 | m_inPersonal = true; |
274 | m_curr_View = CardView; | 274 | m_curr_View = CardView; |
275 | 275 | ||
276 | }else{ | 276 | }else{ |
277 | 277 | ||
278 | if ( !m_inPersonal ) | 278 | if ( !m_inPersonal ) |
279 | return; | 279 | return; |
280 | 280 | ||
281 | // Remove vCard Backend and restore default | 281 | // Remove vCard Backend and restore default |
282 | m_contactdb->save(); | 282 | m_contactdb->save(); |
283 | delete m_contactdb; | 283 | delete m_contactdb; |
284 | 284 | ||
285 | m_contactdb = m_storedDB; | 285 | m_contactdb = m_storedDB; |
286 | m_storedDB = 0l; | 286 | m_storedDB = 0l; |
287 | 287 | ||
288 | m_curr_View = TableView; | 288 | m_curr_View = TableView; |
289 | m_inPersonal = false; | 289 | m_inPersonal = false; |
290 | 290 | ||
291 | } | 291 | } |
292 | load(); | 292 | load(); |
293 | } | 293 | } |
294 | 294 | ||
295 | QStringList AbView::categories() | 295 | QStringList AbView::categories() |
296 | { | 296 | { |
297 | mCat.load( categoryFileName() ); | 297 | mCat.load( categoryFileName() ); |
298 | QStringList categoryList = mCat.labels( "Contacts" ); | 298 | QStringList categoryList = mCat.labels( "Contacts" ); |
299 | return categoryList; | 299 | return categoryList; |
300 | } | 300 | } |
301 | 301 | ||
302 | // BEGIN: Slots | 302 | // BEGIN: Slots |
303 | void AbView::slotDoFind( const QString &str, bool caseSensitive, bool useRegExp, | 303 | void AbView::slotDoFind( const QString &str, bool caseSensitive, bool useRegExp, |
304 | bool , QString cat ) | 304 | bool , QString cat ) |
305 | { | 305 | { |
306 | qWarning( "void AbView::slotDoFind" ); | 306 | //qWarning( "void AbView::slotDoFind" ); |
307 | 307 | ||
308 | // We reloading the data: Deselect Letterpicker | 308 | // We reloading the data: Deselect Letterpicker |
309 | emit signalClearLetterPicker(); | 309 | emit signalClearLetterPicker(); |
310 | 310 | ||
311 | // Use the current Category if nothing else selected | 311 | // Use the current Category if nothing else selected |
312 | int category = 0; | 312 | int category = 0; |
313 | 313 | ||
314 | if ( cat.isEmpty() ) | 314 | if ( cat.isEmpty() ) |
315 | category = m_curr_category; | 315 | category = m_curr_category; |
316 | else{ | 316 | else{ |
317 | category = mCat.id("Contacts", cat ); | 317 | category = mCat.id("Contacts", cat ); |
318 | } | 318 | } |
319 | 319 | ||
320 | qWarning ("Find in Category %d", category); | 320 | //qWarning ("Find in Category %d", category); |
321 | 321 | ||
322 | QRegExp r( str ); | 322 | QRegExp r( str ); |
323 | r.setCaseSensitive( caseSensitive ); | 323 | r.setCaseSensitive( caseSensitive ); |
324 | r.setWildcard( !useRegExp ); | 324 | r.setWildcard( !useRegExp ); |
325 | 325 | ||
326 | // Get all matching entries out of the database | 326 | // Get all matching entries out of the database |
327 | m_list = m_contactdb->matchRegexp( r ); | 327 | m_list = m_contactdb->matchRegexp( r ); |
328 | 328 | ||
329 | qWarning( "found: %d", m_list.count() ); | 329 | //qWarning( "found: %d", m_list.count() ); |
330 | if ( m_list.count() == 0 ){ | 330 | if ( m_list.count() == 0 ){ |
331 | emit signalNotFound(); | 331 | emit signalNotFound(); |
332 | return; | 332 | return; |
333 | } | 333 | } |
334 | 334 | ||
335 | // Now remove all contacts with wrong category (if any selected) | 335 | // Now remove all contacts with wrong category (if any selected) |
336 | // This algorithm is a litte bit ineffective, but | 336 | // This algorithm is a litte bit ineffective, but |
337 | // we will not have a lot of matching entries.. | 337 | // we will not have a lot of matching entries.. |
338 | clearForCategory(); | 338 | clearForCategory(); |
339 | 339 | ||
340 | // Now show all found entries | 340 | // Now show all found entries |
341 | updateView( true ); | 341 | updateView( true ); |
342 | } | 342 | } |
343 | 343 | ||
344 | void AbView::offSearch() | 344 | void AbView::offSearch() |
345 | { | 345 | { |
346 | m_inSearch = false; | 346 | m_inSearch = false; |
347 | 347 | ||
348 | load(); | 348 | load(); |
349 | } | 349 | } |
350 | 350 | ||
351 | void AbView::slotSwitch(){ | 351 | void AbView::slotSwitch(){ |
352 | qWarning("AbView::slotSwitch()"); | 352 | //qWarning("AbView::slotSwitch()"); |
353 | 353 | ||
354 | m_prev_View = m_curr_View; | 354 | m_prev_View = m_curr_View; |
355 | switch ( (int) m_curr_View ){ | 355 | switch ( (int) m_curr_View ){ |
356 | case TableView: | 356 | case TableView: |
357 | qWarning("Switching to CardView"); | 357 | qWarning("Switching to CardView"); |
358 | m_curr_View = CardView; | 358 | m_curr_View = CardView; |
359 | break; | 359 | break; |
360 | case CardView: | 360 | case CardView: |
361 | qWarning("Switching to TableView"); | 361 | qWarning("Switching to TableView"); |
362 | m_curr_View = TableView; | 362 | m_curr_View = TableView; |
363 | break; | 363 | break; |
364 | } | 364 | } |
365 | updateView(); | 365 | updateView(); |
366 | 366 | ||
367 | } | 367 | } |
368 | 368 | ||
369 | // END: Slots | 369 | // END: Slots |
370 | 370 | ||
371 | void AbView::clearForCategory() | 371 | void AbView::clearForCategory() |
372 | { | 372 | { |
373 | OContactAccess::List::Iterator it; | 373 | OContactAccess::List::Iterator it; |
374 | // Now remove all contacts with wrong category if any category selected | 374 | // Now remove all contacts with wrong category if any category selected |
375 | 375 | ||
376 | OContactAccess::List allList = m_list; | 376 | OContactAccess::List allList = m_list; |
377 | if ( m_curr_category != -1 ){ | 377 | if ( m_curr_category != -1 ){ |
378 | for ( it = allList.begin(); it != allList.end(); ++it ){ | 378 | for ( it = allList.begin(); it != allList.end(); ++it ){ |
379 | if ( !contactCompare( *it, m_curr_category ) ){ | 379 | if ( !contactCompare( *it, m_curr_category ) ){ |
380 | qWarning("Removing %d", (*it).uid()); | 380 | // qWarning("Removing %d", (*it).uid()); |
381 | m_list.remove( (*it).uid() ); | 381 | m_list.remove( (*it).uid() ); |
382 | } | 382 | } |
383 | } | 383 | } |
384 | } | 384 | } |
385 | 385 | ||
386 | } | 386 | } |
387 | 387 | ||
388 | bool AbView::contactCompare( const OContact &cnt, int category ) | 388 | bool AbView::contactCompare( const OContact &cnt, int category ) |
389 | { | 389 | { |
390 | qWarning ("bool AbView::contactCompare( const OContact &cnt, %d )", category); | 390 | //qWarning ("bool AbView::contactCompare( const OContact &cnt, %d )", category); |
391 | 391 | ||
392 | bool returnMe; | 392 | bool returnMe; |
393 | QArray<int> cats; | 393 | QArray<int> cats; |
394 | cats = cnt.categories(); | 394 | cats = cnt.categories(); |
395 | 395 | ||
396 | qWarning ("Number of categories: %d", cats.count() ); | 396 | //qWarning ("Number of categories: %d", cats.count() ); |
397 | 397 | ||
398 | returnMe = false; | 398 | returnMe = false; |
399 | if ( cats.count() == 0 && category == 0 ) | 399 | if ( cats.count() == 0 && category == 0 ) |
400 | // Contacts with no category will just shown on "All" and "Unfiled" | 400 | // Contacts with no category will just shown on "All" and "Unfiled" |
401 | returnMe = true; | 401 | returnMe = true; |
402 | else { | 402 | else { |
403 | int i; | 403 | int i; |
404 | for ( i = 0; i < int(cats.count()); i++ ) { | 404 | for ( i = 0; i < int(cats.count()); i++ ) { |
405 | qWarning("Comparing %d with %d",cats[i],category ); | 405 | // qWarning("Comparing %d with %d",cats[i],category ); |
406 | if ( cats[i] == category ) { | 406 | if ( cats[i] == category ) { |
407 | returnMe = true; | 407 | returnMe = true; |
408 | break; | 408 | break; |
409 | } | 409 | } |
410 | } | 410 | } |
411 | } | 411 | } |
412 | qWarning ("Return: %d", returnMe); | 412 | //qWarning ("Return: %d", returnMe); |
413 | return returnMe; | 413 | return returnMe; |
414 | } | 414 | } |
415 | 415 | ||
416 | // In Some rare cases we have to update all lists.. | 416 | // In Some rare cases we have to update all lists.. |
417 | void AbView::updateListinViews() | 417 | void AbView::updateListinViews() |
418 | { | 418 | { |
419 | m_abTable -> setContacts( m_list ); | 419 | m_abTable -> setContacts( m_list ); |
420 | m_ablabel -> setContacts( m_list ); | 420 | m_ablabel -> setContacts( m_list ); |
421 | } | 421 | } |
422 | 422 | ||
423 | void AbView::updateView( bool newdata ) | 423 | void AbView::updateView( bool newdata ) |
424 | { | 424 | { |
425 | qWarning("AbView::updateView()"); | 425 | //qWarning("AbView::updateView()"); |
426 | 426 | ||
427 | if ( m_viewStack -> visibleWidget() ){ | 427 | if ( m_viewStack -> visibleWidget() ){ |
428 | m_viewStack -> visibleWidget() -> clearFocus(); | 428 | m_viewStack -> visibleWidget() -> clearFocus(); |
429 | } | 429 | } |
430 | 430 | ||
431 | // If we switching the view, we have to store some information | 431 | // If we switching the view, we have to store some information |
432 | if ( !newdata ){ | 432 | if ( !newdata ){ |
433 | if ( m_list.count() ){ | 433 | if ( m_list.count() ){ |
434 | switch ( (int) m_prev_View ) { | 434 | switch ( (int) m_prev_View ) { |
435 | case TableView: | 435 | case TableView: |
436 | m_curr_Contact = m_abTable -> currentEntry_UID(); | 436 | m_curr_Contact = m_abTable -> currentEntry_UID(); |
437 | break; | 437 | break; |
438 | case CardView: | 438 | case CardView: |
439 | m_curr_Contact = m_ablabel -> currentEntry_UID(); | 439 | m_curr_Contact = m_ablabel -> currentEntry_UID(); |
440 | break; | 440 | break; |
441 | } | 441 | } |
442 | }else | 442 | }else |
443 | m_curr_Contact = 0; | 443 | m_curr_Contact = 0; |
444 | } | 444 | } |
445 | 445 | ||
446 | // Feed all views with new lists | 446 | // Feed all views with new lists |
447 | if ( newdata ) | 447 | if ( newdata ) |
448 | updateListinViews(); | 448 | updateListinViews(); |
449 | 449 | ||
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp index d14ac51..d830ad3 100644 --- a/core/pim/addressbook/contacteditor.cpp +++ b/core/pim/addressbook/contacteditor.cpp | |||
@@ -46,62 +46,69 @@ | |||
46 | #include <qhbox.h> | 46 | #include <qhbox.h> |
47 | #include <qaction.h> | 47 | #include <qaction.h> |
48 | #include <qiconset.h> | 48 | #include <qiconset.h> |
49 | #include <qmessagebox.h> | 49 | #include <qmessagebox.h> |
50 | 50 | ||
51 | #include <assert.h> | 51 | #include <assert.h> |
52 | 52 | ||
53 | static inline bool containsAlphaNum( const QString &str ); | 53 | static inline bool containsAlphaNum( const QString &str ); |
54 | static inline bool constainsWhiteSpace( const QString &str ); | 54 | static inline bool constainsWhiteSpace( const QString &str ); |
55 | 55 | ||
56 | // helper functions, convert our comma delimited list to proper | 56 | // helper functions, convert our comma delimited list to proper |
57 | // file format... | 57 | // file format... |
58 | void parseEmailFrom( const QString &txt, QString &strDefaultEmail, | 58 | void parseEmailFrom( const QString &txt, QString &strDefaultEmail, |
59 | QString &strAll ); | 59 | QString &strAll ); |
60 | 60 | ||
61 | // helper convert from file format to comma delimited... | 61 | // helper convert from file format to comma delimited... |
62 | void parseEmailTo( const QString &strDefaultEmail, | 62 | void parseEmailTo( const QString &strDefaultEmail, |
63 | const QString &strOtherEmail, QString &strBack ); | 63 | const QString &strOtherEmail, QString &strBack ); |
64 | 64 | ||
65 | ContactEditor::ContactEditor(const OContact &entry, | 65 | ContactEditor::ContactEditor(const OContact &entry, |
66 | QWidget *parent, | 66 | QWidget *parent, |
67 | const char *name, | 67 | const char *name, |
68 | WFlags fl ) | 68 | WFlags fl ) |
69 | : QDialog( parent, name, TRUE, fl ), | 69 | : QDialog( parent, name, TRUE, fl ), |
70 | m_personalView ( false ) | 70 | defaultEmailChooserPosition( -1 ), |
71 | 71 | m_personalView ( false ), | |
72 | cmbDefaultEmail( 0 ), | ||
73 | initializing ( false ) | ||
72 | { | 74 | { |
73 | 75 | ||
76 | initializing = true; | ||
77 | |||
74 | init(); | 78 | init(); |
75 | setEntry( entry ); | 79 | setEntry( entry ); |
76 | cmbDefaultEmail = 0; | 80 | // cmbDefaultEmail = 0; |
77 | defaultEmailChooserPosition = -1; | 81 | // defaultEmailChooserPosition = -1; |
82 | |||
83 | initializing = false; | ||
78 | } | 84 | } |
79 | 85 | ||
80 | ContactEditor::~ContactEditor() { | 86 | ContactEditor::~ContactEditor() { |
81 | } | 87 | } |
82 | 88 | ||
83 | void ContactEditor::init() { | 89 | void ContactEditor::init() { |
90 | qWarning("init() START"); | ||
84 | 91 | ||
85 | useFullName = true; | 92 | useFullName = true; |
86 | 93 | ||
87 | uint i = 0; | 94 | uint i = 0; |
88 | 95 | ||
89 | QStringList trlChooserNames; | 96 | QStringList trlChooserNames; |
90 | 97 | ||
91 | for (i = 0; i <= 6; i++) { | 98 | for (i = 0; i <= 6; i++) { |
92 | slHomeAddress.append( "" ); | 99 | slHomeAddress.append( "" ); |
93 | slBusinessAddress.append( "" ); | 100 | slBusinessAddress.append( "" ); |
94 | } | 101 | } |
95 | 102 | ||
96 | trlChooserNames = OContactFields::trphonefields( false ); | 103 | trlChooserNames = OContactFields::trphonefields( false ); |
97 | slChooserNames = OContactFields::untrphonefields( false ); | 104 | slChooserNames = OContactFields::untrphonefields( false ); |
98 | slDynamicEntries = OContactFields::untrdetailsfields( false ); | 105 | slDynamicEntries = OContactFields::untrdetailsfields( false ); |
99 | trlDynamicEntries = OContactFields::trdetailsfields( false ); | 106 | trlDynamicEntries = OContactFields::trdetailsfields( false ); |
100 | 107 | ||
101 | // Ok, we have to remove elements from the list of dynamic entries | 108 | // Ok, we have to remove elements from the list of dynamic entries |
102 | // which are now stored in special (not dynamic) widgets.. | 109 | // which are now stored in special (not dynamic) widgets.. |
103 | // Otherwise we will get problems with field assignments! (se) | 110 | // Otherwise we will get problems with field assignments! (se) |
104 | slDynamicEntries.remove("Anniversary"); | 111 | slDynamicEntries.remove("Anniversary"); |
105 | slDynamicEntries.remove("Birthday"); | 112 | slDynamicEntries.remove("Birthday"); |
106 | slDynamicEntries.remove("Gender"); | 113 | slDynamicEntries.remove("Gender"); |
107 | 114 | ||
@@ -579,90 +586,92 @@ void ContactEditor::init() { | |||
579 | l = new QLabel( tr("Middle Name"), dlgName ); | 586 | l = new QLabel( tr("Middle Name"), dlgName ); |
580 | gl->addWidget( l, 1, 0 ); | 587 | gl->addWidget( l, 1, 0 ); |
581 | txtMiddleName = new QLineEdit( dlgName ); | 588 | txtMiddleName = new QLineEdit( dlgName ); |
582 | gl->addWidget( txtMiddleName, 1, 1 ); | 589 | gl->addWidget( txtMiddleName, 1, 1 ); |
583 | 590 | ||
584 | l = new QLabel( tr("Last Name"), dlgName ); | 591 | l = new QLabel( tr("Last Name"), dlgName ); |
585 | gl->addWidget( l, 2, 0 ); | 592 | gl->addWidget( l, 2, 0 ); |
586 | txtLastName = new QLineEdit( dlgName ); | 593 | txtLastName = new QLineEdit( dlgName ); |
587 | gl->addWidget( txtLastName, 2, 1 ); | 594 | gl->addWidget( txtLastName, 2, 1 ); |
588 | 595 | ||
589 | l = new QLabel( tr("Suffix"), dlgName ); | 596 | l = new QLabel( tr("Suffix"), dlgName ); |
590 | gl->addWidget( l, 3, 0 ); | 597 | gl->addWidget( l, 3, 0 ); |
591 | txtSuffix = new QLineEdit( dlgName ); | 598 | txtSuffix = new QLineEdit( dlgName ); |
592 | gl->addWidget( txtSuffix, 3, 1 ); | 599 | gl->addWidget( txtSuffix, 3, 1 ); |
593 | space = new QSpacerItem(1,1, | 600 | space = new QSpacerItem(1,1, |
594 | QSizePolicy::Maximum, | 601 | QSizePolicy::Maximum, |
595 | QSizePolicy::MinimumExpanding ); | 602 | QSizePolicy::MinimumExpanding ); |
596 | gl->addItem( space, 4, 0 ); | 603 | gl->addItem( space, 4, 0 ); |
597 | 604 | ||
598 | cmbChooserField1->insertStringList( trlChooserNames ); | 605 | cmbChooserField1->insertStringList( trlChooserNames ); |
599 | cmbChooserField2->insertStringList( trlChooserNames ); | 606 | cmbChooserField2->insertStringList( trlChooserNames ); |
600 | cmbChooserField3->insertStringList( trlChooserNames ); | 607 | cmbChooserField3->insertStringList( trlChooserNames ); |
601 | cmbChooserField4->insertStringList( trlChooserNames ); | 608 | cmbChooserField4->insertStringList( trlChooserNames ); |
602 | 609 | ||
603 | cmbChooserField1->setCurrentItem( 0 ); | 610 | cmbChooserField1->setCurrentItem( 0 ); |
604 | cmbChooserField2->setCurrentItem( 1 ); | 611 | cmbChooserField2->setCurrentItem( 1 ); |
605 | cmbChooserField3->setCurrentItem( 2 ); | 612 | cmbChooserField3->setCurrentItem( 2 ); |
606 | 613 | ||
607 | connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) ); | 614 | connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) ); |
608 | 615 | ||
609 | connect( txtFullName, SIGNAL(textChanged(const QString &)), this, SLOT(slotFullNameChange(const QString &)) ); | 616 | connect( txtFullName, SIGNAL(textChanged(const QString &)), this, SLOT(slotFullNameChange(const QString &)) ); |
610 | 617 | ||
611 | connect( txtChooserField1, SIGNAL(textChanged(const QString &)), | 618 | connect( txtChooserField1, SIGNAL(textChanged(const QString &)), |
612 | this, SLOT(slotChooser1Change(const QString &)) ); | 619 | this, SLOT(slotChooser1Change(const QString &)) ); |
613 | connect( txtChooserField2, SIGNAL(textChanged(const QString &)), | 620 | connect( txtChooserField2, SIGNAL(textChanged(const QString &)), |
614 | this, SLOT(slotChooser2Change(const QString &)) ); | 621 | this, SLOT(slotChooser2Change(const QString &)) ); |
615 | connect( txtChooserField3, SIGNAL(textChanged(const QString &)), | 622 | connect( txtChooserField3, SIGNAL(textChanged(const QString &)), |
616 | this, SLOT(slotChooser3Change(const QString &)) ); | 623 | this, SLOT(slotChooser3Change(const QString &)) ); |
617 | connect( txtChooserField4, SIGNAL(textChanged(const QString &)), | 624 | connect( txtChooserField4, SIGNAL(textChanged(const QString &)), |
618 | this, SLOT(slotChooser4Change(const QString &)) ); | 625 | this, SLOT(slotChooser4Change(const QString &)) ); |
619 | connect( txtAddress, SIGNAL(textChanged(const QString &)), | 626 | connect( txtAddress, SIGNAL(textChanged(const QString &)), |
620 | this, SLOT(slotAddressChange(const QString &)) ); | 627 | this, SLOT(slotAddressChange(const QString &)) ); |
621 | connect( txtCity, SIGNAL(textChanged(const QString &)), | 628 | connect( txtCity, SIGNAL(textChanged(const QString &)), |
622 | this, SLOT(slotCityChange(const QString &)) ); | 629 | this, SLOT(slotCityChange(const QString &)) ); |
623 | connect( txtState, SIGNAL(textChanged(const QString &)), | 630 | connect( txtState, SIGNAL(textChanged(const QString &)), |
624 | this, SLOT(slotStateChange(const QString &)) ); | 631 | this, SLOT(slotStateChange(const QString &)) ); |
625 | connect( txtZip, SIGNAL(textChanged(const QString &)), | 632 | connect( txtZip, SIGNAL(textChanged(const QString &)), |
626 | this, SLOT(slotZipChange(const QString &)) ); | 633 | this, SLOT(slotZipChange(const QString &)) ); |
627 | connect( cmbCountry, SIGNAL(textChanged(const QString &)), | 634 | connect( cmbCountry, SIGNAL(textChanged(const QString &)), |
628 | this, SLOT(slotCountryChange(const QString &)) ); | 635 | this, SLOT(slotCountryChange(const QString &)) ); |
629 | connect( cmbCountry, SIGNAL(activated(const QString &)), | 636 | connect( cmbCountry, SIGNAL(activated(const QString &)), |
630 | this, SLOT(slotCountryChange(const QString &)) ); | 637 | this, SLOT(slotCountryChange(const QString &)) ); |
631 | connect( cmbChooserField1, SIGNAL(activated(int)), | 638 | connect( cmbChooserField1, SIGNAL(activated(int)), |
632 | this, SLOT(slotCmbChooser1Change(int)) ); | 639 | this, SLOT(slotCmbChooser1Change(int)) ); |
633 | connect( cmbChooserField2, SIGNAL(activated(int)), | 640 | connect( cmbChooserField2, SIGNAL(activated(int)), |
634 | this, SLOT(slotCmbChooser2Change(int)) ); | 641 | this, SLOT(slotCmbChooser2Change(int)) ); |
635 | connect( cmbChooserField3, SIGNAL(activated(int)), | 642 | connect( cmbChooserField3, SIGNAL(activated(int)), |
636 | this, SLOT(slotCmbChooser3Change(int)) ); | 643 | this, SLOT(slotCmbChooser3Change(int)) ); |
637 | connect( cmbChooserField4, SIGNAL(activated(int)), | 644 | connect( cmbChooserField4, SIGNAL(activated(int)), |
638 | this, SLOT(slotCmbChooser4Change(int)) ); | 645 | this, SLOT(slotCmbChooser4Change(int)) ); |
639 | connect( cmbAddress, SIGNAL(activated(int)), | 646 | connect( cmbAddress, SIGNAL(activated(int)), |
640 | this, SLOT(slotAddressTypeChange(int)) ); | 647 | this, SLOT(slotAddressTypeChange(int)) ); |
641 | 648 | ||
642 | new QPEDialogListener(this); | 649 | new QPEDialogListener(this); |
643 | 650 | ||
644 | setPersonalView ( m_personalView ); | 651 | setPersonalView ( m_personalView ); |
652 | |||
653 | qWarning("init() END"); | ||
645 | } | 654 | } |
646 | 655 | ||
647 | void ContactEditor::defaultEmailChanged(int i){ | 656 | void ContactEditor::defaultEmailChanged(int i){ |
648 | qDebug("defaultEmailChanged"); | 657 | qDebug("defaultEmailChanged"); |
649 | 658 | ||
650 | // was sollte das ? (se) | 659 | // was sollte das ? (se) |
651 | // int index = cmbChooserField1->currentItem(); | 660 | // int index = cmbChooserField1->currentItem(); |
652 | // slChooserValues[index] = cmbDefaultEmail->text(i); | 661 | // slChooserValues[index] = cmbDefaultEmail->text(i); |
653 | 662 | ||
654 | defaultEmail = cmbDefaultEmail->text(i); | 663 | defaultEmail = cmbDefaultEmail->text(i); |
655 | qDebug ("Changed to: %s", defaultEmail.latin1()); | 664 | qDebug ("Changed to: %s", defaultEmail.latin1()); |
656 | 665 | ||
657 | } | 666 | } |
658 | 667 | ||
659 | void ContactEditor::populateDefaultEmailCmb(){ | 668 | void ContactEditor::populateDefaultEmailCmb(){ |
660 | 669 | ||
661 | // if the default-email combo was not selected and therfore not created | 670 | // if the default-email combo was not selected and therfore not created |
662 | // we get a lot of trouble.. Therfore create an invisible one.. | 671 | // we get a lot of trouble.. Therfore create an invisible one.. |
663 | if ( !cmbDefaultEmail ){ | 672 | if ( !cmbDefaultEmail ){ |
664 | cmbDefaultEmail = new QComboBox(this); | 673 | cmbDefaultEmail = new QComboBox(this); |
665 | cmbDefaultEmail -> hide(); | 674 | cmbDefaultEmail -> hide(); |
666 | } | 675 | } |
667 | cmbDefaultEmail->clear(); | 676 | cmbDefaultEmail->clear(); |
668 | cmbDefaultEmail->insertStringList( emails ); | 677 | cmbDefaultEmail->insertStringList( emails ); |
@@ -671,67 +680,76 @@ void ContactEditor::populateDefaultEmailCmb(){ | |||
671 | // Select default email in combo.. | 680 | // Select default email in combo.. |
672 | bool found = false; | 681 | bool found = false; |
673 | for ( int i = 0; i < cmbDefaultEmail->count(); i++){ | 682 | for ( int i = 0; i < cmbDefaultEmail->count(); i++){ |
674 | qDebug(" populateDefaultEmailCmb text >%s< defaultEmail >%s<", | 683 | qDebug(" populateDefaultEmailCmb text >%s< defaultEmail >%s<", |
675 | cmbDefaultEmail->text( i ).latin1(), defaultEmail.latin1()); | 684 | cmbDefaultEmail->text( i ).latin1(), defaultEmail.latin1()); |
676 | 685 | ||
677 | if ( cmbDefaultEmail->text( i ).stripWhiteSpace() == defaultEmail.stripWhiteSpace() ){ | 686 | if ( cmbDefaultEmail->text( i ).stripWhiteSpace() == defaultEmail.stripWhiteSpace() ){ |
678 | cmbDefaultEmail->setCurrentItem( i ); | 687 | cmbDefaultEmail->setCurrentItem( i ); |
679 | qDebug("set"); | 688 | qDebug("set"); |
680 | found = true; | 689 | found = true; |
681 | } | 690 | } |
682 | } | 691 | } |
683 | 692 | ||
684 | // If the current default email is not found in the list, we choose the | 693 | // If the current default email is not found in the list, we choose the |
685 | // first one.. | 694 | // first one.. |
686 | if ( !found ) | 695 | if ( !found ) |
687 | defaultEmail = cmbDefaultEmail->text(0); | 696 | defaultEmail = cmbDefaultEmail->text(0); |
688 | } | 697 | } |
689 | 698 | ||
690 | // Called when any combobox was changed. | 699 | // Called when any combobox was changed. |
691 | // "true" returned if the change was chandled by this function, else it should | 700 | // "true" returned if the change was chandled by this function, else it should |
692 | // be handled by something else.. | 701 | // be handled by something else.. |
693 | bool ContactEditor::cmbChooserChange( int index, QLineEdit *inputWid, int widgetPos ) { | 702 | bool ContactEditor::cmbChooserChange( int index, QLineEdit *inputWid, int widgetPos ) { |
694 | QString type = slChooserNames[index]; | 703 | QString type = slChooserNames[index]; |
695 | qWarning("ContactEditor::cmbChooserChange -> Type: %s", type.latin1() ); | 704 | qWarning("ContactEditor::cmbChooserChange -> Type: %s, WidgetPos: %d", type.latin1(), widgetPos ); |
705 | |||
706 | if ( !initializing ) | ||
707 | contactfields.setFieldOrder( widgetPos-1, index ); | ||
696 | 708 | ||
697 | // Create and connect combobox for selecting the default email | 709 | // Create and connect combobox for selecting the default email |
698 | if ( type == "Default Email"){ | 710 | if ( type == "Default Email"){ |
699 | qWarning("Choosing default-email "); | 711 | qWarning("Choosing default-email (defaultEmailChooserPosition= %d) ", defaultEmailChooserPosition); |
700 | 712 | ||
701 | // More than one defaul-email chooser is not allowed ! | 713 | // More than one defaul-email chooser is not allowed ! |
702 | if ( ( defaultEmailChooserPosition != -1 ) && | 714 | if ( ( defaultEmailChooserPosition != -1 ) && |
703 | defaultEmailChooserPosition != widgetPos ){ | 715 | defaultEmailChooserPosition != widgetPos && !initializing){ |
704 | chooserError( widgetPos ); | 716 | chooserError( widgetPos ); |
705 | return true; | 717 | return true; |
706 | } | 718 | } |
707 | 719 | ||
708 | if ( cmbDefaultEmail ){ | 720 | if ( cmbDefaultEmail ){ |
709 | delete cmbDefaultEmail; | 721 | delete cmbDefaultEmail; |
710 | cmbDefaultEmail = 0l; | 722 | cmbDefaultEmail = 0l; |
711 | } | 723 | } |
712 | cmbDefaultEmail = new QComboBox(inputWid->parentWidget()); | 724 | cmbDefaultEmail = new QComboBox(inputWid->parentWidget()); |
713 | cmbDefaultEmail->setGeometry(inputWid->frameGeometry()); | 725 | cmbDefaultEmail->setGeometry(inputWid->frameGeometry()); /* :SX */ |
726 | |||
727 | QRect rect = inputWid->frameGeometry(); | ||
728 | qWarning("Geometrie: X=%d, Y=%d, Left=%d, Top=%d, Right=%d, Bottom=%d", | ||
729 | rect.x(), rect.y(), rect.left(), rect.top(), rect.right(), rect.bottom()); | ||
730 | QPoint pnt = inputWid->pos(); | ||
731 | qWarning("Position : X=%d, Y=%d", pnt.x(), pnt.y() ); | ||
714 | 732 | ||
715 | connect( cmbDefaultEmail,SIGNAL( activated(int) ), | 733 | connect( cmbDefaultEmail,SIGNAL( activated(int) ), |
716 | SLOT( defaultEmailChanged(int) ) ); | 734 | SLOT( defaultEmailChanged(int) ) ); |
717 | 735 | ||
718 | cmbDefaultEmail->clear(); | 736 | cmbDefaultEmail->clear(); |
719 | cmbDefaultEmail->insertStringList( emails ); | 737 | cmbDefaultEmail->insertStringList( emails ); |
720 | cmbDefaultEmail->show(); | 738 | cmbDefaultEmail->show(); |
721 | 739 | ||
722 | defaultEmailChooserPosition = widgetPos; | 740 | defaultEmailChooserPosition = widgetPos; |
723 | 741 | ||
724 | // Set current default email | 742 | // Set current default email |
725 | populateDefaultEmailCmb(); | 743 | populateDefaultEmailCmb(); |
726 | 744 | ||
727 | 745 | ||
728 | } else { | 746 | } else { |
729 | // Something else was selected: Hide combo.. | 747 | // Something else was selected: Hide combo.. |
730 | qWarning(" Hiding default-email combo" ); | 748 | qWarning(" Hiding default-email combo" ); |
731 | if ( defaultEmailChooserPosition == widgetPos ){ | 749 | if ( defaultEmailChooserPosition == widgetPos ){ |
732 | defaultEmailChooserPosition = -1; | 750 | defaultEmailChooserPosition = -1; |
733 | if ( cmbDefaultEmail ) | 751 | if ( cmbDefaultEmail ) |
734 | cmbDefaultEmail->hide(); | 752 | cmbDefaultEmail->hide(); |
735 | 753 | ||
736 | } | 754 | } |
737 | 755 | ||
@@ -923,48 +941,53 @@ void ContactEditor::slotCmbChooser2Change( int index ) { | |||
923 | void ContactEditor::slotCmbChooser3Change( int index ) { | 941 | void ContactEditor::slotCmbChooser3Change( int index ) { |
924 | qWarning("ContactEditor::slotCmbChooser3Change( %d )", index); | 942 | qWarning("ContactEditor::slotCmbChooser3Change( %d )", index); |
925 | 943 | ||
926 | if ( !cmbChooserChange( cmbChooserField3->currentItem(), txtChooserField3, 3) ){ | 944 | if ( !cmbChooserChange( cmbChooserField3->currentItem(), txtChooserField3, 3) ){ |
927 | 945 | ||
928 | txtChooserField3->setText( slChooserValues[index] ); | 946 | txtChooserField3->setText( slChooserValues[index] ); |
929 | txtChooserField3->setFocus(); | 947 | txtChooserField3->setFocus(); |
930 | 948 | ||
931 | } | 949 | } |
932 | } | 950 | } |
933 | 951 | ||
934 | void ContactEditor::slotCmbChooser4Change( int index ) { | 952 | void ContactEditor::slotCmbChooser4Change( int index ) { |
935 | qWarning("ContactEditor::slotCmbChooser4Change( %d )", index); | 953 | qWarning("ContactEditor::slotCmbChooser4Change( %d )", index); |
936 | 954 | ||
937 | if ( !cmbChooserChange( cmbChooserField4->currentItem(), txtChooserField4, 4) ){ | 955 | if ( !cmbChooserChange( cmbChooserField4->currentItem(), txtChooserField4, 4) ){ |
938 | 956 | ||
939 | txtChooserField4->setText( slChooserValues[index] ); | 957 | txtChooserField4->setText( slChooserValues[index] ); |
940 | txtChooserField4->setFocus(); | 958 | txtChooserField4->setFocus(); |
941 | 959 | ||
942 | } | 960 | } |
943 | } | 961 | } |
944 | 962 | ||
945 | void ContactEditor::slotAddressTypeChange( int index ) { | 963 | void ContactEditor::slotAddressTypeChange( int index ) { |
946 | 964 | ||
965 | |||
966 | if ( !initializing ) | ||
967 | contactfields.setFieldOrder( 4, index ); | ||
968 | |||
969 | |||
947 | if ( index == 0 ) { | 970 | if ( index == 0 ) { |
948 | 971 | ||
949 | txtAddress->setText( slBusinessAddress[0] ); | 972 | txtAddress->setText( slBusinessAddress[0] ); |
950 | //txtAddress2->setText( (*slBusinessAddress)[1] ); | 973 | //txtAddress2->setText( (*slBusinessAddress)[1] ); |
951 | //txtPOBox->setText( (*slBusinessAddress)[2] ); | 974 | //txtPOBox->setText( (*slBusinessAddress)[2] ); |
952 | txtCity->setText( slBusinessAddress[3] ); | 975 | txtCity->setText( slBusinessAddress[3] ); |
953 | txtState->setText( slBusinessAddress[4] ); | 976 | txtState->setText( slBusinessAddress[4] ); |
954 | txtZip->setText( slBusinessAddress[5] ); | 977 | txtZip->setText( slBusinessAddress[5] ); |
955 | QLineEdit *txtTmp = cmbCountry->lineEdit(); | 978 | QLineEdit *txtTmp = cmbCountry->lineEdit(); |
956 | txtTmp->setText( slBusinessAddress[6] ); | 979 | txtTmp->setText( slBusinessAddress[6] ); |
957 | 980 | ||
958 | } else { | 981 | } else { |
959 | 982 | ||
960 | txtAddress->setText( slHomeAddress[0] ); | 983 | txtAddress->setText( slHomeAddress[0] ); |
961 | //txtAddress2->setText( (*slHomeAddress)[1] ); | 984 | //txtAddress2->setText( (*slHomeAddress)[1] ); |
962 | //txtPOBox->setText( (*slHomeAddress)[2] ); | 985 | //txtPOBox->setText( (*slHomeAddress)[2] ); |
963 | txtCity->setText( slHomeAddress[3] ); | 986 | txtCity->setText( slHomeAddress[3] ); |
964 | txtState->setText( slHomeAddress[4] ); | 987 | txtState->setText( slHomeAddress[4] ); |
965 | txtZip->setText( slHomeAddress[5] ); | 988 | txtZip->setText( slHomeAddress[5] ); |
966 | QLineEdit *txtTmp = cmbCountry->lineEdit(); | 989 | QLineEdit *txtTmp = cmbCountry->lineEdit(); |
967 | txtTmp->setText( slHomeAddress[6] ); | 990 | txtTmp->setText( slHomeAddress[6] ); |
968 | 991 | ||
969 | } | 992 | } |
970 | 993 | ||
@@ -1255,54 +1278,54 @@ void ContactEditor::cleanupFields() { | |||
1255 | txtFirstName->setText(""); | 1278 | txtFirstName->setText(""); |
1256 | txtMiddleName->setText(""); | 1279 | txtMiddleName->setText(""); |
1257 | txtLastName->setText(""); | 1280 | txtLastName->setText(""); |
1258 | txtSuffix->setText(""); | 1281 | txtSuffix->setText(""); |
1259 | txtNote->setText(""); | 1282 | txtNote->setText(""); |
1260 | txtFullName->setText(""); | 1283 | txtFullName->setText(""); |
1261 | txtJobTitle->setText(""); | 1284 | txtJobTitle->setText(""); |
1262 | txtOrganization->setText(""); | 1285 | txtOrganization->setText(""); |
1263 | txtChooserField1->setText(""); | 1286 | txtChooserField1->setText(""); |
1264 | txtChooserField2->setText(""); | 1287 | txtChooserField2->setText(""); |
1265 | txtChooserField3->setText(""); | 1288 | txtChooserField3->setText(""); |
1266 | txtAddress->setText(""); | 1289 | txtAddress->setText(""); |
1267 | txtCity->setText(""); | 1290 | txtCity->setText(""); |
1268 | txtState->setText(""); | 1291 | txtState->setText(""); |
1269 | txtZip->setText(""); | 1292 | txtZip->setText(""); |
1270 | QLineEdit *txtTmp = cmbCountry->lineEdit(); | 1293 | QLineEdit *txtTmp = cmbCountry->lineEdit(); |
1271 | txtTmp->setText(""); | 1294 | txtTmp->setText(""); |
1272 | txtTmp = cmbFileAs->lineEdit(); | 1295 | txtTmp = cmbFileAs->lineEdit(); |
1273 | txtTmp->setText(""); | 1296 | txtTmp->setText(""); |
1274 | 1297 | ||
1275 | } | 1298 | } |
1276 | 1299 | ||
1277 | void ContactEditor::setEntry( const OContact &entry ) { | 1300 | void ContactEditor::setEntry( const OContact &entry ) { |
1278 | 1301 | ||
1302 | initializing = true; | ||
1303 | |||
1279 | cleanupFields(); | 1304 | cleanupFields(); |
1280 | 1305 | ||
1281 | ent = entry; | 1306 | ent = entry; |
1282 | 1307 | ||
1283 | |||
1284 | |||
1285 | emails = QStringList(ent.emailList()); | 1308 | emails = QStringList(ent.emailList()); |
1286 | defaultEmail = ent.defaultEmail(); | 1309 | defaultEmail = ent.defaultEmail(); |
1287 | if (defaultEmail.isEmpty()) defaultEmail = emails[0]; | 1310 | if (defaultEmail.isEmpty()) defaultEmail = emails[0]; |
1288 | qDebug("default email=%s",defaultEmail.latin1()); | 1311 | qDebug("default email=%s",defaultEmail.latin1()); |
1289 | 1312 | ||
1290 | useFullName = false; | 1313 | useFullName = false; |
1291 | txtFirstName->setText( ent.firstName() ); | 1314 | txtFirstName->setText( ent.firstName() ); |
1292 | txtMiddleName->setText( ent.middleName() ); | 1315 | txtMiddleName->setText( ent.middleName() ); |
1293 | txtLastName->setText( ent.lastName() ); | 1316 | txtLastName->setText( ent.lastName() ); |
1294 | txtSuffix->setText( ent.suffix() ); | 1317 | txtSuffix->setText( ent.suffix() ); |
1295 | 1318 | ||
1296 | QString *tmpString = new QString; | 1319 | QString *tmpString = new QString; |
1297 | *tmpString = ent.firstName() + " " + ent.middleName() + | 1320 | *tmpString = ent.firstName() + " " + ent.middleName() + |
1298 | + " " + ent.lastName() + " " + ent.suffix(); | 1321 | + " " + ent.lastName() + " " + ent.suffix(); |
1299 | 1322 | ||
1300 | txtFullName->setText( tmpString->simplifyWhiteSpace() ); | 1323 | txtFullName->setText( tmpString->simplifyWhiteSpace() ); |
1301 | 1324 | ||
1302 | cmbFileAs->setEditText( ent.fileAs() ); | 1325 | cmbFileAs->setEditText( ent.fileAs() ); |
1303 | 1326 | ||
1304 | //if (hasTitle) | 1327 | //if (hasTitle) |
1305 | txtJobTitle->setText( ent.jobTitle() ); | 1328 | txtJobTitle->setText( ent.jobTitle() ); |
1306 | 1329 | ||
1307 | //if (hasCompany) | 1330 | //if (hasCompany) |
1308 | txtOrganization->setText( ent.company() ); | 1331 | txtOrganization->setText( ent.company() ); |
@@ -1434,77 +1457,97 @@ void ContactEditor::setEntry( const OContact &entry ) { | |||
1434 | 1457 | ||
1435 | if ( *it == "MSN IM" ) | 1458 | if ( *it == "MSN IM" ) |
1436 | *itV = ent.MSNIM(); | 1459 | *itV = ent.MSNIM(); |
1437 | 1460 | ||
1438 | if ( *it == "Yahoo IM" ) | 1461 | if ( *it == "Yahoo IM" ) |
1439 | *itV = ent.yahooIM(); | 1462 | *itV = ent.yahooIM(); |
1440 | */ | 1463 | */ |
1441 | if ( *it == "Home Web Page" ) | 1464 | if ( *it == "Home Web Page" ) |
1442 | *itV = ent.homeWebpage(); | 1465 | *itV = ent.homeWebpage(); |
1443 | 1466 | ||
1444 | if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) | 1467 | if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) |
1445 | *itV = ent.businessWebpage(); | 1468 | *itV = ent.businessWebpage(); |
1446 | 1469 | ||
1447 | 1470 | ||
1448 | } | 1471 | } |
1449 | 1472 | ||
1450 | 1473 | ||
1451 | cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") ); | 1474 | cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") ); |
1452 | 1475 | ||
1453 | QString gender = ent.gender(); | 1476 | QString gender = ent.gender(); |
1454 | cmbGender->setCurrentItem( gender.toInt() ); | 1477 | cmbGender->setCurrentItem( gender.toInt() ); |
1455 | 1478 | ||
1456 | txtNote->setText( ent.notes() ); | 1479 | txtNote->setText( ent.notes() ); |
1457 | 1480 | ||
1481 | slotAddressTypeChange( cmbAddress->currentItem() ); | ||
1482 | |||
1483 | // Calling "show()" to arrange all widgets. Otherwise we will get | ||
1484 | // a wrong position of the textfields and are unable to put our | ||
1485 | // default-email combo over it.. This is very ugly ! | ||
1486 | // Does anybody has a better solution ? | ||
1487 | // Basically we should rethink the strategy to hide | ||
1488 | // a textfield with overwriting.. (se) | ||
1489 | show(); | ||
1490 | |||
1491 | // Get combo-settings from contact and set preset.. | ||
1492 | contactfields.loadFromRecord( ent ); | ||
1493 | cmbChooserField1->setCurrentItem( contactfields.getFieldOrder(0, 0) ); | ||
1494 | cmbChooserField2->setCurrentItem( contactfields.getFieldOrder(1, 1) ); | ||
1495 | cmbChooserField3->setCurrentItem( contactfields.getFieldOrder(2, 2) ); | ||
1496 | cmbChooserField4->setCurrentItem( contactfields.getFieldOrder(3, 5) ); | ||
1497 | cmbAddress->setCurrentItem( contactfields.getFieldOrder(4, 1) ); | ||
1458 | slotCmbChooser1Change( cmbChooserField1->currentItem() ); | 1498 | slotCmbChooser1Change( cmbChooserField1->currentItem() ); |
1459 | slotCmbChooser2Change( cmbChooserField2->currentItem() ); | 1499 | slotCmbChooser2Change( cmbChooserField2->currentItem() ); |
1460 | slotCmbChooser3Change( cmbChooserField3->currentItem() ); | 1500 | slotCmbChooser3Change( cmbChooserField3->currentItem() ); |
1461 | 1501 | slotCmbChooser4Change( cmbChooserField4->currentItem() ); | |
1462 | slotAddressTypeChange( cmbAddress->currentItem() ); | 1502 | slotAddressTypeChange( cmbAddress->currentItem() ); |
1463 | 1503 | ||
1464 | // loadFields(); :SX | ||
1465 | updateDatePicker(); | 1504 | updateDatePicker(); |
1505 | |||
1506 | initializing = false; | ||
1466 | } | 1507 | } |
1467 | void ContactEditor::updateDatePicker() | 1508 | void ContactEditor::updateDatePicker() |
1468 | { | 1509 | { |
1469 | // Set DatePicker | 1510 | // Set DatePicker |
1470 | if ( !ent.birthday().isNull() ){ | 1511 | if ( !ent.birthday().isNull() ){ |
1471 | birthdayButton->setText( TimeString::numberDateString( ent.birthday() ) ); | 1512 | birthdayButton->setText( TimeString::numberDateString( ent.birthday() ) ); |
1472 | birthdayPicker->setDate( ent.birthday() ); | 1513 | birthdayPicker->setDate( ent.birthday() ); |
1473 | } else | 1514 | } else |
1474 | birthdayButton->setText( tr ("Unknown") ); | 1515 | birthdayButton->setText( tr ("Unknown") ); |
1475 | 1516 | ||
1476 | if ( !ent.anniversary().isNull() ){ | 1517 | if ( !ent.anniversary().isNull() ){ |
1477 | anniversaryButton->setText( TimeString::numberDateString( ent.anniversary() ) ); | 1518 | anniversaryButton->setText( TimeString::numberDateString( ent.anniversary() ) ); |
1478 | anniversaryPicker->setDate( ent.anniversary() ); | 1519 | anniversaryPicker->setDate( ent.anniversary() ); |
1479 | } else | 1520 | } else |
1480 | anniversaryButton->setText( tr ("Unknown") ); | 1521 | anniversaryButton->setText( tr ("Unknown") ); |
1481 | 1522 | ||
1482 | } | 1523 | } |
1483 | 1524 | ||
1484 | void ContactEditor::saveEntry() { | 1525 | void ContactEditor::saveEntry() { |
1485 | 1526 | ||
1486 | 1527 | // Store current combo into contact | |
1528 | contactfields.saveToRecord( ent ); | ||
1529 | |||
1487 | if ( useFullName ) { | 1530 | if ( useFullName ) { |
1488 | txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) ); | 1531 | txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) ); |
1489 | txtMiddleName->setText( parseName( txtFullName->text(), NAME_M ) ); | 1532 | txtMiddleName->setText( parseName( txtFullName->text(), NAME_M ) ); |
1490 | txtLastName->setText( parseName( txtFullName->text(), NAME_L ) ); | 1533 | txtLastName->setText( parseName( txtFullName->text(), NAME_L ) ); |
1491 | txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) ); | 1534 | txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) ); |
1492 | 1535 | ||
1493 | useFullName = false; | 1536 | useFullName = false; |
1494 | } | 1537 | } |
1495 | 1538 | ||
1496 | ent.setFirstName( txtFirstName->text() ); | 1539 | ent.setFirstName( txtFirstName->text() ); |
1497 | ent.setLastName( txtLastName->text() ); | 1540 | ent.setLastName( txtLastName->text() ); |
1498 | ent.setMiddleName( txtMiddleName->text() ); | 1541 | ent.setMiddleName( txtMiddleName->text() ); |
1499 | ent.setSuffix( txtSuffix->text() ); | 1542 | ent.setSuffix( txtSuffix->text() ); |
1500 | 1543 | ||
1501 | ent.setFileAs( cmbFileAs->currentText() ); | 1544 | ent.setFileAs( cmbFileAs->currentText() ); |
1502 | 1545 | ||
1503 | ent.setCategories( cmbCat->currentCategories() ); | 1546 | ent.setCategories( cmbCat->currentCategories() ); |
1504 | 1547 | ||
1505 | 1548 | ||
1506 | //if (hasTitle) | 1549 | //if (hasTitle) |
1507 | ent.setJobTitle( txtJobTitle->text() ); | 1550 | ent.setJobTitle( txtJobTitle->text() ); |
1508 | 1551 | ||
1509 | //if (hasCompany) | 1552 | //if (hasCompany) |
1510 | ent.setCompany( txtOrganization->text() ); | 1553 | ent.setCompany( txtOrganization->text() ); |
diff --git a/core/pim/addressbook/contacteditor.h b/core/pim/addressbook/contacteditor.h index 4fa48d1..95f9f2d 100644 --- a/core/pim/addressbook/contacteditor.h +++ b/core/pim/addressbook/contacteditor.h | |||
@@ -9,48 +9,50 @@ | |||
9 | * of this file. | 9 | * 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 | * | 14 | * |
15 | * This is a rewrite of the abeditor.h file, modified to provide a more | 15 | * This is a rewrite of the abeditor.h file, modified to provide a more |
16 | * intuitive interface to TrollTech's original Address Book editor. This | 16 | * intuitive interface to TrollTech's original Address Book editor. This |
17 | * is made to operate exactly in interface with the exception of name. | 17 | * is made to operate exactly in interface with the exception of name. |
18 | * | 18 | * |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #ifndef CONTACTEDITOR_H | 21 | #ifndef CONTACTEDITOR_H |
22 | #define CONTACTEDITOR_H | 22 | #define CONTACTEDITOR_H |
23 | 23 | ||
24 | #include <opie/ocontact.h> | 24 | #include <opie/ocontact.h> |
25 | 25 | ||
26 | #include <qpe/datebookmonth.h> | 26 | #include <qpe/datebookmonth.h> |
27 | 27 | ||
28 | #include <qdialog.h> | 28 | #include <qdialog.h> |
29 | #include <qlist.h> | 29 | #include <qlist.h> |
30 | #include <qmap.h> | 30 | #include <qmap.h> |
31 | #include <qstringlist.h> | 31 | #include <qstringlist.h> |
32 | 32 | ||
33 | #include "ocontactfields.h" | ||
34 | |||
33 | const int NAME_LF = 0; | 35 | const int NAME_LF = 0; |
34 | const int NAME_LFM = 1; | 36 | const int NAME_LFM = 1; |
35 | const int NAME_FL = 2; | 37 | const int NAME_FL = 2; |
36 | const int NAME_FMLS = 3; | 38 | const int NAME_FMLS = 3; |
37 | 39 | ||
38 | const int NAME_F = 4; | 40 | const int NAME_F = 4; |
39 | const int NAME_M = 5; | 41 | const int NAME_M = 5; |
40 | const int NAME_L = 6; | 42 | const int NAME_L = 6; |
41 | const int NAME_S = 7; | 43 | const int NAME_S = 7; |
42 | 44 | ||
43 | 45 | ||
44 | class QScrollView; | 46 | class QScrollView; |
45 | class QTabWidget; | 47 | class QTabWidget; |
46 | class QMultiLineEdit; | 48 | class QMultiLineEdit; |
47 | class QLineEdit; | 49 | class QLineEdit; |
48 | class QComboBox; | 50 | class QComboBox; |
49 | class QPushButton; | 51 | class QPushButton; |
50 | class CategorySelect; | 52 | class CategorySelect; |
51 | class QLabel; | 53 | class QLabel; |
52 | 54 | ||
53 | class ContactEditor : public QDialog { | 55 | class ContactEditor : public QDialog { |
54 | Q_OBJECT | 56 | Q_OBJECT |
55 | 57 | ||
56 | public: | 58 | public: |
@@ -87,48 +89,49 @@ class ContactEditor : public QDialog { | |||
87 | void slotCmbChooser1Change( int index ); | 89 | void slotCmbChooser1Change( int index ); |
88 | void slotCmbChooser2Change( int index ); | 90 | void slotCmbChooser2Change( int index ); |
89 | void slotCmbChooser3Change( int index ); | 91 | void slotCmbChooser3Change( int index ); |
90 | void slotCmbChooser4Change( int index ); | 92 | void slotCmbChooser4Change( int index ); |
91 | void slotAddressTypeChange( int index ); | 93 | void slotAddressTypeChange( int index ); |
92 | void slotAddressChange( const QString &textChanged ); | 94 | void slotAddressChange( const QString &textChanged ); |
93 | void slotAddress2Change( const QString &textChanged ); | 95 | void slotAddress2Change( const QString &textChanged ); |
94 | void slotPOBoxChange( const QString &textChanged ); | 96 | void slotPOBoxChange( const QString &textChanged ); |
95 | void slotCityChange( const QString &textChanged ); | 97 | void slotCityChange( const QString &textChanged ); |
96 | void slotStateChange( const QString &textChanged ); | 98 | void slotStateChange( const QString &textChanged ); |
97 | void slotZipChange( const QString &textChanged ); | 99 | void slotZipChange( const QString &textChanged ); |
98 | void slotCountryChange( const QString &textChanged ); | 100 | void slotCountryChange( const QString &textChanged ); |
99 | void slotFullNameChange( const QString &textChanged ); | 101 | void slotFullNameChange( const QString &textChanged ); |
100 | void slotAnniversaryDateChanged( int year, int month, int day); | 102 | void slotAnniversaryDateChanged( int year, int month, int day); |
101 | void slotBirthdayDateChanged( int year, int month, int day); | 103 | void slotBirthdayDateChanged( int year, int month, int day); |
102 | void slotRemoveBirthday(); | 104 | void slotRemoveBirthday(); |
103 | void slotRemoveAnniversary(); | 105 | void slotRemoveAnniversary(); |
104 | void defaultEmailChanged(int); | 106 | void defaultEmailChanged(int); |
105 | 107 | ||
106 | private: | 108 | private: |
107 | int defaultEmailChooserPosition; | 109 | int defaultEmailChooserPosition; |
108 | void populateDefaultEmailCmb(); | 110 | void populateDefaultEmailCmb(); |
109 | void chooserChange( const QString&, int , QLineEdit*, int ); | 111 | void chooserChange( const QString&, int , QLineEdit*, int ); |
110 | bool cmbChooserChange( int , QLineEdit*, int ); | 112 | bool cmbChooserChange( int , QLineEdit*, int ); |
113 | OContactFields contactfields; | ||
111 | 114 | ||
112 | bool useFullName; | 115 | bool useFullName; |
113 | 116 | ||
114 | OContact ent; | 117 | OContact ent; |
115 | 118 | ||
116 | QDialog *dlgNote; | 119 | QDialog *dlgNote; |
117 | QDialog *dlgName; | 120 | QDialog *dlgName; |
118 | 121 | ||
119 | QList<QLineEdit> listValue; | 122 | QList<QLineEdit> listValue; |
120 | QList<QLabel> listName; | 123 | QList<QLabel> listName; |
121 | 124 | ||
122 | QStringList slDynamicEntries; | 125 | QStringList slDynamicEntries; |
123 | QStringList trlDynamicEntries; | 126 | QStringList trlDynamicEntries; |
124 | 127 | ||
125 | bool m_personalView; | 128 | bool m_personalView; |
126 | 129 | ||
127 | QStringList slHomeAddress; | 130 | QStringList slHomeAddress; |
128 | QStringList slBusinessAddress; | 131 | QStringList slBusinessAddress; |
129 | QStringList slChooserNames; | 132 | QStringList slChooserNames; |
130 | QStringList slChooserValues; | 133 | QStringList slChooserValues; |
131 | QStringList emails; | 134 | QStringList emails; |
132 | QString defaultEmail; | 135 | QString defaultEmail; |
133 | 136 | ||
134 | QMultiLineEdit *txtNote; | 137 | QMultiLineEdit *txtNote; |
@@ -155,27 +158,29 @@ class ContactEditor : public QDialog { | |||
155 | QComboBox *cmbChooserField2; | 158 | QComboBox *cmbChooserField2; |
156 | QComboBox *cmbChooserField3; | 159 | QComboBox *cmbChooserField3; |
157 | QComboBox *cmbChooserField4; | 160 | QComboBox *cmbChooserField4; |
158 | QComboBox *cmbDefaultEmail; | 161 | QComboBox *cmbDefaultEmail; |
159 | QComboBox *cmbFileAs; | 162 | QComboBox *cmbFileAs; |
160 | CategorySelect *cmbCat; | 163 | CategorySelect *cmbCat; |
161 | QLabel *labCat; | 164 | QLabel *labCat; |
162 | 165 | ||
163 | QScrollView *svAddress; | 166 | QScrollView *svAddress; |
164 | QLineEdit *txtAddress; | 167 | QLineEdit *txtAddress; |
165 | //QLineEdit *txtAddress2; | 168 | //QLineEdit *txtAddress2; |
166 | //QLineEdit *txtPOBox; | 169 | //QLineEdit *txtPOBox; |
167 | QLineEdit *txtCity; | 170 | QLineEdit *txtCity; |
168 | QLineEdit *txtState; | 171 | QLineEdit *txtState; |
169 | QLineEdit *txtZip; | 172 | QLineEdit *txtZip; |
170 | QComboBox *cmbAddress; | 173 | QComboBox *cmbAddress; |
171 | QComboBox *cmbCountry; | 174 | QComboBox *cmbCountry; |
172 | 175 | ||
173 | QScrollView *svDetails; | 176 | QScrollView *svDetails; |
174 | QComboBox *cmbGender; | 177 | QComboBox *cmbGender; |
175 | DateBookMonth* birthdayPicker; | 178 | DateBookMonth* birthdayPicker; |
176 | QToolButton* birthdayButton; | 179 | QToolButton* birthdayButton; |
177 | DateBookMonth* anniversaryPicker; | 180 | DateBookMonth* anniversaryPicker; |
178 | QToolButton* anniversaryButton; | 181 | QToolButton* anniversaryButton; |
182 | |||
183 | bool initializing; | ||
179 | }; | 184 | }; |
180 | 185 | ||
181 | #endif | 186 | #endif |
diff --git a/core/pim/addressbook/ocontactfields.cpp b/core/pim/addressbook/ocontactfields.cpp index 0da6a4f..75a7641 100644 --- a/core/pim/addressbook/ocontactfields.cpp +++ b/core/pim/addressbook/ocontactfields.cpp | |||
@@ -1,32 +1,34 @@ | |||
1 | 1 | ||
2 | #include "ocontactfields.h" | 2 | #include "ocontactfields.h" |
3 | 3 | ||
4 | #include <qstringlist.h> | 4 | #include <qstringlist.h> |
5 | #include <qobject.h> | 5 | #include <qobject.h> |
6 | 6 | ||
7 | // We should use our own enum in the future .. | 7 | // We should use our own enum in the future .. |
8 | #include <qpe/recordfields.h> | 8 | #include <qpe/recordfields.h> |
9 | #include <qpe/config.h> | ||
10 | #include <opie/ocontact.h> | ||
9 | 11 | ||
10 | /*! | 12 | /*! |
11 | \internal | 13 | \internal |
12 | Returns a list of details field names for a contact. | 14 | Returns a list of details field names for a contact. |
13 | */ | 15 | */ |
14 | QStringList OContactFields::untrdetailsfields( bool sorted ) | 16 | QStringList OContactFields::untrdetailsfields( bool sorted ) |
15 | { | 17 | { |
16 | QStringList list; | 18 | QStringList list; |
17 | 19 | ||
18 | list.append( "Office" ); | 20 | list.append( "Office" ); |
19 | list.append( "Profession" ); | 21 | list.append( "Profession" ); |
20 | list.append( "Assistant" ); | 22 | list.append( "Assistant" ); |
21 | list.append( "Manager" ); | 23 | list.append( "Manager" ); |
22 | 24 | ||
23 | list.append( "Spouse" ); | 25 | list.append( "Spouse" ); |
24 | list.append( "Gender" ); | 26 | list.append( "Gender" ); |
25 | list.append( "Birthday" ); | 27 | list.append( "Birthday" ); |
26 | list.append( "Anniversary" ); | 28 | list.append( "Anniversary" ); |
27 | list.append( "Nickname" ); | 29 | list.append( "Nickname" ); |
28 | list.append( "Children" ); | 30 | list.append( "Children" ); |
29 | 31 | ||
30 | if (sorted) list.sort(); | 32 | if (sorted) list.sort(); |
31 | return list; | 33 | return list; |
32 | } | 34 | } |
@@ -178,49 +180,49 @@ QStringList OContactFields::untrfields( bool sorted ) | |||
178 | list.append( "Business Zip" ); | 180 | list.append( "Business Zip" ); |
179 | list.append( "Business Country" ); | 181 | list.append( "Business Country" ); |
180 | list.append( "Business Pager" ); | 182 | list.append( "Business Pager" ); |
181 | list.append( "Business WebPage" ); | 183 | list.append( "Business WebPage" ); |
182 | 184 | ||
183 | list.append( "Home Street" ); | 185 | list.append( "Home Street" ); |
184 | list.append( "Home City" ); | 186 | list.append( "Home City" ); |
185 | list.append( "Home State" ); | 187 | list.append( "Home State" ); |
186 | list.append( "Home Zip" ); | 188 | list.append( "Home Zip" ); |
187 | list.append( "Home Country" ); | 189 | list.append( "Home Country" ); |
188 | list.append( "Home Web Page" ); | 190 | list.append( "Home Web Page" ); |
189 | 191 | ||
190 | list += untrdetailsfields( sorted ); | 192 | list += untrdetailsfields( sorted ); |
191 | 193 | ||
192 | list.append( "Notes" ); | 194 | list.append( "Notes" ); |
193 | list.append( "Groups" ); | 195 | list.append( "Groups" ); |
194 | 196 | ||
195 | if (sorted) list.sort(); | 197 | if (sorted) list.sort(); |
196 | 198 | ||
197 | return list; | 199 | return list; |
198 | } | 200 | } |
199 | QMap<int, QString> OContactFields::idToTrFields() | 201 | QMap<int, QString> OContactFields::idToTrFields() |
200 | { | 202 | { |
201 | QMap<int, QString> ret_map; | 203 | QMap<int, QString> ret_map; |
202 | 204 | ||
203 | ret_map.insert( Qtopia::Title, QObject::tr( "Name Title") ); | 205 | ret_map.insert( Qtopia::Title, QObject::tr( "Name Title") ); |
204 | ret_map.insert( Qtopia::FirstName, QObject::tr( "First Name" ) ); | 206 | ret_map.insert( Qtopia::FirstName, QObject::tr( "First Name" ) ); |
205 | ret_map.insert( Qtopia::MiddleName, QObject::tr( "Middle Name" ) ); | 207 | ret_map.insert( Qtopia::MiddleName, QObject::tr( "Middle Name" ) ); |
206 | ret_map.insert( Qtopia::LastName, QObject::tr( "Last Name" ) ); | 208 | ret_map.insert( Qtopia::LastName, QObject::tr( "Last Name" ) ); |
207 | ret_map.insert( Qtopia::Suffix, QObject::tr( "Suffix" )); | 209 | ret_map.insert( Qtopia::Suffix, QObject::tr( "Suffix" )); |
208 | ret_map.insert( Qtopia::FileAs, QObject::tr( "File As" ) ); | 210 | ret_map.insert( Qtopia::FileAs, QObject::tr( "File As" ) ); |
209 | 211 | ||
210 | ret_map.insert( Qtopia::JobTitle, QObject::tr( "Job Title" ) ); | 212 | ret_map.insert( Qtopia::JobTitle, QObject::tr( "Job Title" ) ); |
211 | ret_map.insert( Qtopia::Department, QObject::tr( "Department" ) ); | 213 | ret_map.insert( Qtopia::Department, QObject::tr( "Department" ) ); |
212 | ret_map.insert( Qtopia::Company, QObject::tr( "Company" ) ); | 214 | ret_map.insert( Qtopia::Company, QObject::tr( "Company" ) ); |
213 | ret_map.insert( Qtopia::BusinessPhone, QObject::tr( "Business Phone" ) ); | 215 | ret_map.insert( Qtopia::BusinessPhone, QObject::tr( "Business Phone" ) ); |
214 | ret_map.insert( Qtopia::BusinessFax, QObject::tr( "Business Fax" ) ); | 216 | ret_map.insert( Qtopia::BusinessFax, QObject::tr( "Business Fax" ) ); |
215 | ret_map.insert( Qtopia::BusinessMobile, QObject::tr( "Business Mobile" )); | 217 | ret_map.insert( Qtopia::BusinessMobile, QObject::tr( "Business Mobile" )); |
216 | 218 | ||
217 | 219 | ||
218 | ret_map.insert( Qtopia::DefaultEmail, QObject::tr( "Default Email" ) ); | 220 | ret_map.insert( Qtopia::DefaultEmail, QObject::tr( "Default Email" ) ); |
219 | ret_map.insert( Qtopia::Emails, QObject::tr( "Emails" ) ); | 221 | ret_map.insert( Qtopia::Emails, QObject::tr( "Emails" ) ); |
220 | 222 | ||
221 | ret_map.insert( Qtopia::HomePhone, QObject::tr( "Home Phone" ) ); | 223 | ret_map.insert( Qtopia::HomePhone, QObject::tr( "Home Phone" ) ); |
222 | ret_map.insert( Qtopia::HomeFax, QObject::tr( "Home Fax" ) ); | 224 | ret_map.insert( Qtopia::HomeFax, QObject::tr( "Home Fax" ) ); |
223 | ret_map.insert( Qtopia::HomeMobile, QObject::tr( "Home Mobile" ) ); | 225 | ret_map.insert( Qtopia::HomeMobile, QObject::tr( "Home Mobile" ) ); |
224 | 226 | ||
225 | // business | 227 | // business |
226 | ret_map.insert( Qtopia::BusinessStreet, QObject::tr( "Business Street" ) ); | 228 | ret_map.insert( Qtopia::BusinessStreet, QObject::tr( "Business Street" ) ); |
@@ -233,42 +235,135 @@ QMap<int, QString> OContactFields::idToTrFields() | |||
233 | 235 | ||
234 | ret_map.insert( Qtopia::Office, QObject::tr( "Office" ) ); | 236 | ret_map.insert( Qtopia::Office, QObject::tr( "Office" ) ); |
235 | ret_map.insert( Qtopia::Profession, QObject::tr( "Profession" ) ); | 237 | ret_map.insert( Qtopia::Profession, QObject::tr( "Profession" ) ); |
236 | ret_map.insert( Qtopia::Assistant, QObject::tr( "Assistant" ) ); | 238 | ret_map.insert( Qtopia::Assistant, QObject::tr( "Assistant" ) ); |
237 | ret_map.insert( Qtopia::Manager, QObject::tr( "Manager" ) ); | 239 | ret_map.insert( Qtopia::Manager, QObject::tr( "Manager" ) ); |
238 | 240 | ||
239 | // home | 241 | // home |
240 | ret_map.insert( Qtopia::HomeStreet, QObject::tr( "Home Street" ) ); | 242 | ret_map.insert( Qtopia::HomeStreet, QObject::tr( "Home Street" ) ); |
241 | ret_map.insert( Qtopia::HomeCity, QObject::tr( "Home City" ) ); | 243 | ret_map.insert( Qtopia::HomeCity, QObject::tr( "Home City" ) ); |
242 | ret_map.insert( Qtopia::HomeState, QObject::tr( "Home State" ) ); | 244 | ret_map.insert( Qtopia::HomeState, QObject::tr( "Home State" ) ); |
243 | ret_map.insert( Qtopia::HomeZip, QObject::tr( "Home Zip" ) ); | 245 | ret_map.insert( Qtopia::HomeZip, QObject::tr( "Home Zip" ) ); |
244 | ret_map.insert( Qtopia::HomeCountry, QObject::tr( "Home Country" ) ); | 246 | ret_map.insert( Qtopia::HomeCountry, QObject::tr( "Home Country" ) ); |
245 | ret_map.insert( Qtopia::HomeWebPage, QObject::tr( "Home Web Page" ) ); | 247 | ret_map.insert( Qtopia::HomeWebPage, QObject::tr( "Home Web Page" ) ); |
246 | 248 | ||
247 | //personal | 249 | //personal |
248 | ret_map.insert( Qtopia::Spouse, QObject::tr( "Spouse" ) ); | 250 | ret_map.insert( Qtopia::Spouse, QObject::tr( "Spouse" ) ); |
249 | ret_map.insert( Qtopia::Gender, QObject::tr( "Gender" ) ); | 251 | ret_map.insert( Qtopia::Gender, QObject::tr( "Gender" ) ); |
250 | ret_map.insert( Qtopia::Birthday, QObject::tr( "Birthday" ) ); | 252 | ret_map.insert( Qtopia::Birthday, QObject::tr( "Birthday" ) ); |
251 | ret_map.insert( Qtopia::Anniversary, QObject::tr( "Anniversary" ) ); | 253 | ret_map.insert( Qtopia::Anniversary, QObject::tr( "Anniversary" ) ); |
252 | ret_map.insert( Qtopia::Nickname, QObject::tr( "Nickname" ) ); | 254 | ret_map.insert( Qtopia::Nickname, QObject::tr( "Nickname" ) ); |
253 | ret_map.insert( Qtopia::Children, QObject::tr( "Children" ) ); | 255 | ret_map.insert( Qtopia::Children, QObject::tr( "Children" ) ); |
254 | 256 | ||
255 | // other | 257 | // other |
256 | ret_map.insert( Qtopia::Notes, QObject::tr( "Notes" ) ); | 258 | ret_map.insert( Qtopia::Notes, QObject::tr( "Notes" ) ); |
257 | 259 | ||
258 | 260 | ||
259 | return ret_map; | 261 | return ret_map; |
260 | } | 262 | } |
261 | 263 | ||
262 | QMap<QString, int> OContactFields::trFieldsToId() | 264 | QMap<QString, int> OContactFields::trFieldsToId() |
263 | { | 265 | { |
264 | QMap<int, QString> idtostr = idToTrFields(); | 266 | QMap<int, QString> idtostr = idToTrFields(); |
265 | QMap<QString, int> ret_map; | 267 | QMap<QString, int> ret_map; |
266 | 268 | ||
267 | 269 | ||
268 | QMap<int, QString>::Iterator it; | 270 | QMap<int, QString>::Iterator it; |
269 | for( it = idtostr.begin(); it != idtostr.end(); ++it ) | 271 | for( it = idtostr.begin(); it != idtostr.end(); ++it ) |
270 | ret_map.insert( *it, it.key() ); | 272 | ret_map.insert( *it, it.key() ); |
271 | 273 | ||
272 | 274 | ||
273 | return ret_map; | 275 | return ret_map; |
274 | } | 276 | } |
277 | |||
278 | OContactFields::OContactFields(): | ||
279 | fieldOrder( DEFAULT_FIELD_ORDER ), | ||
280 | changedFieldOrder( false ) | ||
281 | { | ||
282 | // Get the global field order from the config file and | ||
283 | // use it as a start pattern | ||
284 | Config cfg ( "AddressBook" ); | ||
285 | cfg.setGroup( "ContactFieldOrder" ); | ||
286 | globalFieldOrder = cfg.readEntry( "General", DEFAULT_FIELD_ORDER ); | ||
287 | } | ||
288 | |||
289 | OContactFields::~OContactFields(){ | ||
290 | |||
291 | // We will store the fieldorder into the config file | ||
292 | // to reuse it for the future.. | ||
293 | if ( changedFieldOrder ){ | ||
294 | Config cfg ( "AddressBook" ); | ||
295 | cfg.setGroup( "ContactFieldOrder" ); | ||
296 | cfg.writeEntry( "General", globalFieldOrder ); | ||
297 | } | ||
298 | } | ||
299 | |||
300 | |||
301 | |||
302 | void OContactFields::saveToRecord( OContact &cnt ){ | ||
303 | |||
304 | qDebug("ocontactfields saveToRecord: >%s<",fieldOrder.latin1()); | ||
305 | |||
306 | // Store fieldorder into this contact. | ||
307 | cnt.setCustomField( CONTACT_FIELD_ORDER_NAME, fieldOrder ); | ||
308 | |||
309 | globalFieldOrder = fieldOrder; | ||
310 | changedFieldOrder = true; | ||
311 | |||
312 | } | ||
313 | |||
314 | void OContactFields::loadFromRecord( const OContact &cnt ){ | ||
315 | qDebug("ocontactfields loadFromRecord"); | ||
316 | qDebug("loading >%s<",cnt.fullName().latin1()); | ||
317 | |||
318 | // Get fieldorder for this contact. If none is defined, | ||
319 | // we will use the global one from the config file.. | ||
320 | |||
321 | fieldOrder = cnt.customField( CONTACT_FIELD_ORDER_NAME ); | ||
322 | |||
323 | qDebug("fieldOrder from contact>%s<",fieldOrder.latin1()); | ||
324 | |||
325 | if (fieldOrder.isEmpty()){ | ||
326 | fieldOrder = globalFieldOrder; | ||
327 | } | ||
328 | |||
329 | |||
330 | qDebug("effective fieldOrder in loadFromRecord >%s<",fieldOrder.latin1()); | ||
331 | } | ||
332 | |||
333 | void OContactFields::setFieldOrder( int num, int index ){ | ||
334 | qDebug("qcontactfields setfieldorder pos %i -> %i",num,index); | ||
335 | |||
336 | fieldOrder[num] = QString::number( index )[0]; | ||
337 | |||
338 | // We will store this new fieldorder globally to | ||
339 | // remember it for contacts which have none | ||
340 | globalFieldOrder = fieldOrder; | ||
341 | changedFieldOrder = true; | ||
342 | |||
343 | qDebug("fieldOrder >%s<",fieldOrder.latin1()); | ||
344 | } | ||
345 | |||
346 | int OContactFields::getFieldOrder( int num, int defIndex ){ | ||
347 | qDebug("ocontactfields getFieldOrder"); | ||
348 | qDebug("fieldOrder >%s<",fieldOrder.latin1()); | ||
349 | |||
350 | // Get index of combo as char.. | ||
351 | QChar poschar = fieldOrder[num]; | ||
352 | |||
353 | bool ok; | ||
354 | int ret = 0; | ||
355 | // Convert char to number.. | ||
356 | if ( !( poschar == QChar::null ) ) | ||
357 | ret = QString( poschar ).toInt(&ok, 10); | ||
358 | else | ||
359 | ok = false; | ||
360 | |||
361 | // Return default value if index for | ||
362 | // num was not set or if anything else happened.. | ||
363 | if ( !ok ) ret = defIndex; | ||
364 | |||
365 | qDebug("returning >%i<",ret); | ||
366 | |||
367 | return ret; | ||
368 | |||
369 | } | ||
diff --git a/core/pim/addressbook/ocontactfields.h b/core/pim/addressbook/ocontactfields.h index 796bc0a..bf3a7f5 100644 --- a/core/pim/addressbook/ocontactfields.h +++ b/core/pim/addressbook/ocontactfields.h | |||
@@ -1,24 +1,58 @@ | |||
1 | #ifndef OPIE_CONTACTS_FIELDS | 1 | #ifndef OPIE_CONTACTS_FIELDS |
2 | #define OPIE_CONTACTS_FIELDS | 2 | #define OPIE_CONTACTS_FIELDS |
3 | 3 | ||
4 | class QStringList; | 4 | class QStringList; |
5 | 5 | ||
6 | #include <qmap.h> | 6 | #include <qmap.h> |
7 | #include <qstring.h> | 7 | #include <qstring.h> |
8 | #include <opie/ocontact.h> | ||
8 | 9 | ||
10 | #define CONTACT_FIELD_ORDER_NAME "opie-contactfield-order" | ||
11 | #define DEFAULT_FIELD_ORDER "__________" | ||
12 | |||
9 | class OContactFields{ | 13 | class OContactFields{ |
10 | 14 | ||
11 | public: | 15 | public: |
16 | OContactFields(); | ||
17 | ~OContactFields(); | ||
18 | /** Set the index for combo boxes. | ||
19 | * Sets the <b>index</b> of combo <b>num</b>. | ||
20 | * @param num selects the number of the combo | ||
21 | * @param index sets the index in the combo | ||
22 | */ | ||
23 | void setFieldOrder( int num, int index ); | ||
24 | |||
25 | /** Get the index for combo boxes. | ||
26 | * Returns the index of combo <b>num</b> or defindex | ||
27 | * if none was defined.. | ||
28 | * @param num Selects the number of the combo | ||
29 | * @param defIndex will be returned if none was defined (either | ||
30 | * globally in the config file, nor by the contact which was used | ||
31 | * by loadFromRecord() ) | ||
32 | */ | ||
33 | int getFieldOrder( int num, int defIndex); | ||
34 | |||
35 | /** Store fieldorder to contact. */ | ||
36 | void saveToRecord( OContact& ); | ||
37 | /** Get Fieldorder from contact. */ | ||
38 | void loadFromRecord( const OContact& ); | ||
39 | |||
40 | private: | ||
41 | QString fieldOrder; | ||
42 | QString globalFieldOrder; | ||
43 | bool changedFieldOrder; | ||
44 | |||
45 | public: | ||
12 | static QStringList trphonefields( bool sorted = true ); | 46 | static QStringList trphonefields( bool sorted = true ); |
13 | static QStringList untrphonefields( bool sorted = true ); | 47 | static QStringList untrphonefields( bool sorted = true ); |
14 | static QStringList trdetailsfields( bool sorted = true ); | 48 | static QStringList trdetailsfields( bool sorted = true ); |
15 | static QStringList untrdetailsfields( bool sorted = true ); | 49 | static QStringList untrdetailsfields( bool sorted = true ); |
16 | static QStringList trfields( bool sorted = true ); | 50 | static QStringList trfields( bool sorted = true ); |
17 | static QStringList untrfields( bool sorted = true ); | 51 | static QStringList untrfields( bool sorted = true ); |
18 | 52 | ||
19 | static QMap<int, QString> idToTrFields(); | 53 | static QMap<int, QString> idToTrFields(); |
20 | static QMap<QString, int> trFieldsToId(); | 54 | static QMap<QString, int> trFieldsToId(); |
21 | 55 | ||
22 | }; | 56 | }; |
23 | 57 | ||
24 | #endif | 58 | #endif |
diff --git a/core/pim/addressbook/version.h b/core/pim/addressbook/version.h index b740326..e716fe4 100644 --- a/core/pim/addressbook/version.h +++ b/core/pim/addressbook/version.h | |||
@@ -1,10 +1,10 @@ | |||
1 | #ifndef _VERSION_H_ | 1 | #ifndef _VERSION_H_ |
2 | #define _VERSION_H_ | 2 | #define _VERSION_H_ |
3 | 3 | ||
4 | #define MAINVERSION "0" | 4 | #define MAINVERSION "0" |
5 | #define SUBVERSION "1" | 5 | #define SUBVERSION "2" |
6 | #define PATCHVERSION "1" | 6 | #define PATCHVERSION "0" |
7 | 7 | ||
8 | #define APPNAME "OPIE_ADDRESSBOOK" | 8 | #define APPNAME "OPIE_ADDRESSBOOK" |
9 | 9 | ||
10 | #endif | 10 | #endif |