author | drw <drw> | 2005-04-06 22:41:05 (UTC) |
---|---|---|
committer | drw <drw> | 2005-04-06 22:41:05 (UTC) |
commit | 6ea302df768201e4ab8dd2ec797a5cc9ea6589bf (patch) (unidiff) | |
tree | 9cffcfa9fecd49d0d6a0498de0cccd9aef52bf75 | |
parent | cd1b15147d372d8786c855764d397553651c358d (diff) | |
download | opie-6ea302df768201e4ab8dd2ec797a5cc9ea6589bf.zip opie-6ea302df768201e4ab8dd2ec797a5cc9ea6589bf.tar.gz opie-6ea302df768201e4ab8dd2ec797a5cc9ea6589bf.tar.bz2 |
Use OResource for loading images
-rw-r--r-- | core/pim/addressbook/abtable.cpp | 22 | ||||
-rw-r--r-- | core/pim/addressbook/addressbook.cpp | 26 | ||||
-rw-r--r-- | core/pim/addressbook/configdlg.cpp | 13 | ||||
-rw-r--r-- | core/pim/addressbook/contacteditor.cpp | 9 |
4 files changed, 37 insertions, 33 deletions
diff --git a/core/pim/addressbook/abtable.cpp b/core/pim/addressbook/abtable.cpp index 60f3177..539d6ba 100644 --- a/core/pim/addressbook/abtable.cpp +++ b/core/pim/addressbook/abtable.cpp | |||
@@ -1,760 +1,760 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** Copyright (c) 2002 Stefan Eilers (eilers.stefan@epost.de) | 3 | ** Copyright (c) 2002 Stefan Eilers (eilers.stefan@epost.de) |
4 | ** | 4 | ** |
5 | ** This file is part of Qt Palmtop Environment. | 5 | ** This file is part of Qt Palmtop Environment. |
6 | ** | 6 | ** |
7 | ** This file may be distributed and/or modified under the terms of the | 7 | ** This file may be distributed and/or modified under the terms of the |
8 | ** GNU General Public License version 2 as published by the Free Software | 8 | ** GNU General Public License version 2 as published by the Free Software |
9 | ** Foundation and appearing in the file LICENSE.GPL included in the | 9 | ** Foundation and appearing in the file LICENSE.GPL included in the |
10 | ** packaging of this file. | 10 | ** packaging of this file. |
11 | ** | 11 | ** |
12 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 12 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
13 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 13 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
14 | ** | 14 | ** |
15 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 15 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
16 | ** | 16 | ** |
17 | ** Contact info@trolltech.com if any conditions of this licensing are | 17 | ** Contact info@trolltech.com if any conditions of this licensing are |
18 | ** not clear to you. | 18 | ** not clear to you. |
19 | ** | 19 | ** |
20 | **********************************************************************/ | 20 | **********************************************************************/ |
21 | 21 | ||
22 | #include <opie2/odebug.h> | 22 | #include <opie2/odebug.h> |
23 | #include <opie2/opimrecordlist.h> | 23 | #include <opie2/opimrecordlist.h> |
24 | #include <opie2/oresource.h> | ||
24 | 25 | ||
25 | #include <qpe/timestring.h> | 26 | #include <qpe/timestring.h> |
26 | #include <qpe/resource.h> | ||
27 | 27 | ||
28 | #include "abtable.h" | 28 | #include "abtable.h" |
29 | 29 | ||
30 | #include <errno.h> | 30 | #include <errno.h> |
31 | #include <fcntl.h> | 31 | #include <fcntl.h> |
32 | #include <unistd.h> | 32 | #include <unistd.h> |
33 | #include <stdlib.h> | 33 | #include <stdlib.h> |
34 | 34 | ||
35 | #include <ctype.h> //toupper() for key hack | 35 | #include <ctype.h> //toupper() for key hack |
36 | 36 | ||
37 | #if 0 | 37 | #if 0 |
38 | 38 | ||
39 | /*! | 39 | /*! |
40 | \class AbTableItem abtable.h | 40 | \class AbTableItem abtable.h |
41 | 41 | ||
42 | \brief QTableItem based class for showing a field of an entry | 42 | \brief QTableItem based class for showing a field of an entry |
43 | */ | 43 | */ |
44 | 44 | ||
45 | AbTableItem::AbTableItem( QTable *t, EditType et, const QString &s, | 45 | AbTableItem::AbTableItem( QTable *t, EditType et, const QString &s, |
46 | const QString &secondSortKey) | 46 | const QString &secondSortKey) |
47 | : QTableItem( t, et, s ) | 47 | : QTableItem( t, et, s ) |
48 | { | 48 | { |
49 | // sortKey = s.lower() + QChar( '\0' ) + secondSortKey.lower(); | 49 | // sortKey = s.lower() + QChar( '\0' ) + secondSortKey.lower(); |
50 | sortKey = Qtopia::buildSortKey( s, secondSortKey ); | 50 | sortKey = Qtopia::buildSortKey( s, secondSortKey ); |
51 | } | 51 | } |
52 | 52 | ||
53 | int AbTableItem::alignment() const | 53 | int AbTableItem::alignment() const |
54 | { | 54 | { |
55 | return AlignLeft|AlignVCenter; | 55 | return AlignLeft|AlignVCenter; |
56 | } | 56 | } |
57 | 57 | ||
58 | QString AbTableItem::key() const | 58 | QString AbTableItem::key() const |
59 | { | 59 | { |
60 | return sortKey; | 60 | return sortKey; |
61 | } | 61 | } |
62 | 62 | ||
63 | // A way to reset the item, without out doing a delete or a new... | 63 | // A way to reset the item, without out doing a delete or a new... |
64 | void AbTableItem::setItem( const QString &txt, const QString &secondKey ) | 64 | void AbTableItem::setItem( const QString &txt, const QString &secondKey ) |
65 | { | 65 | { |
66 | setText( txt ); | 66 | setText( txt ); |
67 | sortKey = Qtopia::buildSortKey( txt, secondKey ); | 67 | sortKey = Qtopia::buildSortKey( txt, secondKey ); |
68 | 68 | ||
69 | // sortKey = txt.lower() + QChar( '\0' ) + secondKey.lower(); | 69 | // sortKey = txt.lower() + QChar( '\0' ) + secondKey.lower(); |
70 | } | 70 | } |
71 | 71 | ||
72 | /*! | 72 | /*! |
73 | \class AbPickItem abtable.h | 73 | \class AbPickItem abtable.h |
74 | 74 | ||
75 | \brief QTableItem based class for showing slection of an entry | 75 | \brief QTableItem based class for showing slection of an entry |
76 | */ | 76 | */ |
77 | 77 | ||
78 | AbPickItem::AbPickItem( QTable *t ) : | 78 | AbPickItem::AbPickItem( QTable *t ) : |
79 | QTableItem(t, WhenCurrent, "?") | 79 | QTableItem(t, WhenCurrent, "?") |
80 | { | 80 | { |
81 | } | 81 | } |
82 | 82 | ||
83 | QWidget *AbPickItem::createEditor() const | 83 | QWidget *AbPickItem::createEditor() const |
84 | { | 84 | { |
85 | QComboBox* combo = new QComboBox( table()->viewport() ); | 85 | QComboBox* combo = new QComboBox( table()->viewport() ); |
86 | ( (AbPickItem*)this )->cb = combo; | 86 | ( (AbPickItem*)this )->cb = combo; |
87 | AbTable* t = static_cast<AbTable*>(table()); | 87 | AbTable* t = static_cast<AbTable*>(table()); |
88 | QStringList c = t->choiceNames(); | 88 | QStringList c = t->choiceNames(); |
89 | int cur = 0; | 89 | int cur = 0; |
90 | for (QStringList::ConstIterator it = c.begin(); it!=c.end(); ++it) { | 90 | for (QStringList::ConstIterator it = c.begin(); it!=c.end(); ++it) { |
91 | if ( *it == text() ) | 91 | if ( *it == text() ) |
92 | cur = combo->count(); | 92 | cur = combo->count(); |
93 | combo->insertItem(*it); | 93 | combo->insertItem(*it); |
94 | } | 94 | } |
95 | combo->setCurrentItem(cur); | 95 | combo->setCurrentItem(cur); |
96 | return combo; | 96 | return combo; |
97 | } | 97 | } |
98 | 98 | ||
99 | void AbPickItem::setContentFromEditor( QWidget *w ) | 99 | void AbPickItem::setContentFromEditor( QWidget *w ) |
100 | { | 100 | { |
101 | if ( w->inherits("QComboBox") ) | 101 | if ( w->inherits("QComboBox") ) |
102 | setText( ( (QComboBox*)w )->currentText() ); | 102 | setText( ( (QComboBox*)w )->currentText() ); |
103 | else | 103 | else |
104 | QTableItem::setContentFromEditor( w ); | 104 | QTableItem::setContentFromEditor( w ); |
105 | } | 105 | } |
106 | 106 | ||
107 | #endif | 107 | #endif |
108 | 108 | ||
109 | /*! | 109 | /*! |
110 | \class AbTable abtable.h | 110 | \class AbTable abtable.h |
111 | 111 | ||
112 | \brief QTable based class for showing a list of entries | 112 | \brief QTable based class for showing a list of entries |
113 | */ | 113 | */ |
114 | 114 | ||
115 | AbTable::AbTable( const QValueList<int> order, QWidget *parent, const char *name ) | 115 | AbTable::AbTable( const QValueList<int> order, QWidget *parent, const char *name ) |
116 | : QTable( parent, name ), | 116 | : QTable( parent, name ), |
117 | lastSortCol( -1 ), | 117 | lastSortCol( -1 ), |
118 | asc( TRUE ), | 118 | asc( TRUE ), |
119 | intFields( order ), | 119 | intFields( order ), |
120 | enablePainting( true ), | 120 | enablePainting( true ), |
121 | columnVisible( true ), | 121 | columnVisible( true ), |
122 | countNested( 0 ) | 122 | countNested( 0 ) |
123 | { | 123 | { |
124 | //odebug << "C'tor start" << oendl; | 124 | //odebug << "C'tor start" << oendl; |
125 | setSelectionMode( NoSelection ); | 125 | setSelectionMode( NoSelection ); |
126 | init(); | 126 | init(); |
127 | setSorting( false ); // The table should not sort by itself! | 127 | setSorting( false ); // The table should not sort by itself! |
128 | 128 | ||
129 | connect( this, SIGNAL(clicked(int,int,int,const QPoint&)), | 129 | connect( this, SIGNAL(clicked(int,int,int,const QPoint&)), |
130 | this, SLOT(itemClicked(int,int)) ); | 130 | this, SLOT(itemClicked(int,int)) ); |
131 | 131 | ||
132 | // contactList.clear(); | 132 | // contactList.clear(); |
133 | //odebug << "C'tor end" << oendl; | 133 | //odebug << "C'tor end" << oendl; |
134 | } | 134 | } |
135 | 135 | ||
136 | AbTable::~AbTable() | 136 | AbTable::~AbTable() |
137 | { | 137 | { |
138 | } | 138 | } |
139 | 139 | ||
140 | void AbTable::init() | 140 | void AbTable::init() |
141 | { | 141 | { |
142 | // :SX showChar = '\0'; | 142 | // :SX showChar = '\0'; |
143 | setNumRows( 0 ); | 143 | setNumRows( 0 ); |
144 | setNumCols( 2 ); | 144 | setNumCols( 2 ); |
145 | 145 | ||
146 | horizontalHeader()->setLabel( 0, tr( "Full Name" )); | 146 | horizontalHeader()->setLabel( 0, tr( "Full Name" )); |
147 | horizontalHeader()->setLabel( 1, tr( "Contact" )); | 147 | horizontalHeader()->setLabel( 1, tr( "Contact" )); |
148 | setLeftMargin( 0 ); | 148 | setLeftMargin( 0 ); |
149 | verticalHeader()->hide(); | 149 | verticalHeader()->hide(); |
150 | columnVisible = true; | 150 | columnVisible = true; |
151 | } | 151 | } |
152 | 152 | ||
153 | void AbTable::setContacts( const Opie::OPimContactAccess::List& viewList ) | 153 | void AbTable::setContacts( const Opie::OPimContactAccess::List& viewList ) |
154 | { | 154 | { |
155 | odebug << "AbTable::setContacts()" << oendl; | 155 | odebug << "AbTable::setContacts()" << oendl; |
156 | 156 | ||
157 | clear(); | 157 | clear(); |
158 | m_viewList = viewList; | 158 | m_viewList = viewList; |
159 | 159 | ||
160 | setPaintingEnabled( FALSE ); | 160 | setPaintingEnabled( FALSE ); |
161 | 161 | ||
162 | setNumRows( m_viewList.count() ); | 162 | setNumRows( m_viewList.count() ); |
163 | 163 | ||
164 | 164 | ||
165 | updateVisible(); | 165 | updateVisible(); |
166 | 166 | ||
167 | setPaintingEnabled( TRUE ); | 167 | setPaintingEnabled( TRUE ); |
168 | 168 | ||
169 | } | 169 | } |
170 | 170 | ||
171 | void AbTable::setOrderedList( const QValueList<int> ordered ) | 171 | void AbTable::setOrderedList( const QValueList<int> ordered ) |
172 | { | 172 | { |
173 | intFields = ordered; | 173 | intFields = ordered; |
174 | } | 174 | } |
175 | 175 | ||
176 | 176 | ||
177 | bool AbTable::selectContact( int UID ) | 177 | bool AbTable::selectContact( int UID ) |
178 | { | 178 | { |
179 | odebug << "AbTable::selectContact( " << UID << " )" << oendl; | 179 | odebug << "AbTable::selectContact( " << UID << " )" << oendl; |
180 | int rows = numRows(); | 180 | int rows = numRows(); |
181 | bool found = false; | 181 | bool found = false; |
182 | 182 | ||
183 | setPaintingEnabled( FALSE ); | 183 | setPaintingEnabled( FALSE ); |
184 | odebug << "Search start" << oendl; | 184 | odebug << "Search start" << oendl; |
185 | for ( int r = 0; r < rows; ++r ) { | 185 | for ( int r = 0; r < rows; ++r ) { |
186 | if ( m_viewList.uidAt( r ) == UID ){ | 186 | if ( m_viewList.uidAt( r ) == UID ){ |
187 | ensureCellVisible( r, 0 ); | 187 | ensureCellVisible( r, 0 ); |
188 | setCurrentCell( r, 0 ); | 188 | setCurrentCell( r, 0 ); |
189 | found = true; | 189 | found = true; |
190 | break; | 190 | break; |
191 | } | 191 | } |
192 | } | 192 | } |
193 | odebug << "Search end" << oendl; | 193 | odebug << "Search end" << oendl; |
194 | 194 | ||
195 | if ( !found ){ | 195 | if ( !found ){ |
196 | ensureCellVisible( 0,0 ); | 196 | ensureCellVisible( 0,0 ); |
197 | setCurrentCell( 0, 0 ); | 197 | setCurrentCell( 0, 0 ); |
198 | } | 198 | } |
199 | 199 | ||
200 | setPaintingEnabled( TRUE ); | 200 | setPaintingEnabled( TRUE ); |
201 | 201 | ||
202 | return true; | 202 | return true; |
203 | } | 203 | } |
204 | 204 | ||
205 | 205 | ||
206 | void AbTable::columnClicked( int col ) | 206 | void AbTable::columnClicked( int col ) |
207 | { | 207 | { |
208 | odebug << "columClicked(" << col << ")" << oendl; | 208 | odebug << "columClicked(" << col << ")" << oendl; |
209 | 209 | ||
210 | if ( col == 0 ){ | 210 | if ( col == 0 ){ |
211 | odebug << "Change sort order: " << asc << oendl; | 211 | odebug << "Change sort order: " << asc << oendl; |
212 | asc = !asc; | 212 | asc = !asc; |
213 | emit signalSortOrderChanged( asc ); | 213 | emit signalSortOrderChanged( asc ); |
214 | } | 214 | } |
215 | } | 215 | } |
216 | 216 | ||
217 | void AbTable::resort() | 217 | void AbTable::resort() |
218 | { | 218 | { |
219 | owarn << "void AbTable::resort() NOT POSSIBLE !!" << oendl; | 219 | owarn << "void AbTable::resort() NOT POSSIBLE !!" << oendl; |
220 | 220 | ||
221 | } | 221 | } |
222 | 222 | ||
223 | Opie::OPimContact AbTable::currentEntry() | 223 | Opie::OPimContact AbTable::currentEntry() |
224 | { | 224 | { |
225 | return m_viewList[currentRow()]; | 225 | return m_viewList[currentRow()]; |
226 | } | 226 | } |
227 | 227 | ||
228 | int AbTable::currentEntry_UID() | 228 | int AbTable::currentEntry_UID() |
229 | { | 229 | { |
230 | return ( currentEntry().uid() ); | 230 | return ( currentEntry().uid() ); |
231 | } | 231 | } |
232 | 232 | ||
233 | void AbTable::clear() | 233 | void AbTable::clear() |
234 | { | 234 | { |
235 | odebug << "void AbTable::clear()" << oendl; | 235 | odebug << "void AbTable::clear()" << oendl; |
236 | // contactList.clear(); | 236 | // contactList.clear(); |
237 | 237 | ||
238 | setPaintingEnabled( FALSE ); | 238 | setPaintingEnabled( FALSE ); |
239 | for ( int r = 0; r < numRows(); ++r ) { | 239 | for ( int r = 0; r < numRows(); ++r ) { |
240 | for ( int c = 0; c < numCols(); ++c ) { | 240 | for ( int c = 0; c < numCols(); ++c ) { |
241 | if ( cellWidget( r, c ) ) | 241 | if ( cellWidget( r, c ) ) |
242 | clearCellWidget( r, c ); | 242 | clearCellWidget( r, c ); |
243 | clearCell( r, c ); | 243 | clearCell( r, c ); |
244 | } | 244 | } |
245 | } | 245 | } |
246 | setNumRows( 0 ); | 246 | setNumRows( 0 ); |
247 | setPaintingEnabled( TRUE ); | 247 | setPaintingEnabled( TRUE ); |
248 | } | 248 | } |
249 | 249 | ||
250 | // Refresh updates column 2 if the contactsettings changed | 250 | // Refresh updates column 2 if the contactsettings changed |
251 | void AbTable::refresh() | 251 | void AbTable::refresh() |
252 | { | 252 | { |
253 | owarn << "void AbTable::refresh() NOT IMPLEMENTED !!" << oendl; | 253 | owarn << "void AbTable::refresh() NOT IMPLEMENTED !!" << oendl; |
254 | 254 | ||
255 | #if 0 | 255 | #if 0 |
256 | int rows = numRows(); | 256 | int rows = numRows(); |
257 | AbTableItem *abi; | 257 | AbTableItem *abi; |
258 | ContactItem contactItem; | 258 | ContactItem contactItem; |
259 | 259 | ||
260 | setPaintingEnabled( FALSE ); | 260 | setPaintingEnabled( FALSE ); |
261 | for ( int r = 0; r < rows; ++r ) { | 261 | for ( int r = 0; r < rows; ++r ) { |
262 | abi = static_cast<AbTableItem*>( item(r, 0) ); | 262 | abi = static_cast<AbTableItem*>( item(r, 0) ); |
263 | contactItem = findContactContact( contactList[abi], r ); | 263 | contactItem = findContactContact( contactList[abi], r ); |
264 | static_cast<AbTableItem*>( item(r, 1) )->setItem( contactItem.value, abi->text() ); | 264 | static_cast<AbTableItem*>( item(r, 1) )->setItem( contactItem.value, abi->text() ); |
265 | if ( !contactItem.icon.isNull() ){ | 265 | if ( !contactItem.icon.isNull() ){ |
266 | static_cast<AbTableItem*>( item(r, 1) )-> | 266 | static_cast<AbTableItem*>( item(r, 1) )-> |
267 | setPixmap( contactItem.icon ); | 267 | setPixmap( contactItem.icon ); |
268 | }else{ | 268 | }else{ |
269 | static_cast<AbTableItem*>( item(r, 1) )-> | 269 | static_cast<AbTableItem*>( item(r, 1) )-> |
270 | setPixmap( QPixmap() ); | 270 | setPixmap( QPixmap() ); |
271 | } | 271 | } |
272 | } | 272 | } |
273 | resort(); | 273 | resort(); |
274 | setPaintingEnabled( TRUE ); | 274 | setPaintingEnabled( TRUE ); |
275 | 275 | ||
276 | #endif | 276 | #endif |
277 | } | 277 | } |
278 | 278 | ||
279 | void AbTable::keyPressEvent( QKeyEvent *e ) | 279 | void AbTable::keyPressEvent( QKeyEvent *e ) |
280 | { | 280 | { |
281 | char key = toupper( e->ascii() ); | 281 | char key = toupper( e->ascii() ); |
282 | 282 | ||
283 | if ( key >= 'A' && key <= 'Z' ) | 283 | if ( key >= 'A' && key <= 'Z' ) |
284 | moveTo( key ); | 284 | moveTo( key ); |
285 | 285 | ||
286 | // odebug << "Received key .." << oendl; | 286 | // odebug << "Received key .." << oendl; |
287 | switch( e->key() ) { | 287 | switch( e->key() ) { |
288 | case Qt::Key_Space: | 288 | case Qt::Key_Space: |
289 | case Qt::Key_Return: | 289 | case Qt::Key_Return: |
290 | case Qt::Key_Enter: | 290 | case Qt::Key_Enter: |
291 | emit signalSwitch(); | 291 | emit signalSwitch(); |
292 | break; | 292 | break; |
293 | // case Qt::Key_Up: | 293 | // case Qt::Key_Up: |
294 | // odebug << "a" << oendl; | 294 | // odebug << "a" << oendl; |
295 | // emit signalKeyUp(); | 295 | // emit signalKeyUp(); |
296 | // break; | 296 | // break; |
297 | // case Qt::Key_Down: | 297 | // case Qt::Key_Down: |
298 | // odebug << "b" << oendl; | 298 | // odebug << "b" << oendl; |
299 | // emit signalKeyDown(); | 299 | // emit signalKeyDown(); |
300 | // break; | 300 | // break; |
301 | default: | 301 | default: |
302 | QTable::keyPressEvent( e ); | 302 | QTable::keyPressEvent( e ); |
303 | } | 303 | } |
304 | 304 | ||
305 | } | 305 | } |
306 | 306 | ||
307 | void AbTable::moveTo( char /*c*/ ) | 307 | void AbTable::moveTo( char /*c*/ ) |
308 | { | 308 | { |
309 | odebug << "void AbTable::moveTo( char c ) NOT IMPLEMENTED !!" << oendl; | 309 | odebug << "void AbTable::moveTo( char c ) NOT IMPLEMENTED !!" << oendl; |
310 | 310 | ||
311 | } | 311 | } |
312 | 312 | ||
313 | #if 0 | 313 | #if 0 |
314 | // Useless.. Nobody uses it .. (se) | 314 | // Useless.. Nobody uses it .. (se) |
315 | QString AbTable::findContactName( const Opie::OPimContact &entry ) | 315 | QString AbTable::findContactName( const Opie::OPimContact &entry ) |
316 | { | 316 | { |
317 | // We use the fileAs, then company, defaultEmail | 317 | // We use the fileAs, then company, defaultEmail |
318 | QString str; | 318 | QString str; |
319 | str = entry.fileAs(); | 319 | str = entry.fileAs(); |
320 | if ( str.isEmpty() ) { | 320 | if ( str.isEmpty() ) { |
321 | str = entry.company(); | 321 | str = entry.company(); |
322 | if ( str.isEmpty() ) { | 322 | if ( str.isEmpty() ) { |
323 | str = entry.defaultEmail(); | 323 | str = entry.defaultEmail(); |
324 | } | 324 | } |
325 | } | 325 | } |
326 | return str; | 326 | return str; |
327 | } | 327 | } |
328 | #endif | 328 | #endif |
329 | 329 | ||
330 | 330 | ||
331 | void AbTable::resizeRows() { | 331 | void AbTable::resizeRows() { |
332 | /* | 332 | /* |
333 | if (numRows()) { | 333 | if (numRows()) { |
334 | for (int i = 0; i < numRows(); i++) { | 334 | for (int i = 0; i < numRows(); i++) { |
335 | setRowHeight( i, size ); | 335 | setRowHeight( i, size ); |
336 | } | 336 | } |
337 | } | 337 | } |
338 | updateVisible(); | 338 | updateVisible(); |
339 | */ | 339 | */ |
340 | } | 340 | } |
341 | 341 | ||
342 | 342 | ||
343 | void AbTable::realignTable() | 343 | void AbTable::realignTable() |
344 | { | 344 | { |
345 | //odebug << "void AbTable::realignTable()" << oendl; | 345 | //odebug << "void AbTable::realignTable()" << oendl; |
346 | 346 | ||
347 | setPaintingEnabled( FALSE ); | 347 | setPaintingEnabled( FALSE ); |
348 | 348 | ||
349 | resizeRows(); | 349 | resizeRows(); |
350 | fitColumns(); | 350 | fitColumns(); |
351 | 351 | ||
352 | setPaintingEnabled( TRUE ); | 352 | setPaintingEnabled( TRUE ); |
353 | 353 | ||
354 | } | 354 | } |
355 | 355 | ||
356 | 356 | ||
357 | 357 | ||
358 | 358 | ||
359 | #if QT_VERSION <= 230 | 359 | #if QT_VERSION <= 230 |
360 | #ifndef SINGLE_APP | 360 | #ifndef SINGLE_APP |
361 | void QTable::paintEmptyArea( QPainter *p, int cx, int cy, int cw, int ch ) | 361 | void QTable::paintEmptyArea( QPainter *p, int cx, int cy, int cw, int ch ) |
362 | { | 362 | { |
363 | // Region of the rect we should draw | 363 | // Region of the rect we should draw |
364 | QRegion reg( QRect( cx, cy, cw, ch ) ); | 364 | QRegion reg( QRect( cx, cy, cw, ch ) ); |
365 | // Subtract the table from it | 365 | // Subtract the table from it |
366 | reg = reg.subtract( QRect( QPoint( 0, 0 ), tableSize() ) ); | 366 | reg = reg.subtract( QRect( QPoint( 0, 0 ), tableSize() ) ); |
367 | // And draw the rectangles (transformed as needed) | 367 | // And draw the rectangles (transformed as needed) |
368 | QArray<QRect> r = reg.rects(); | 368 | QArray<QRect> r = reg.rects(); |
369 | for (unsigned int i=0; i<r.count(); i++) | 369 | for (unsigned int i=0; i<r.count(); i++) |
370 | p->fillRect( r[i], colorGroup().brush( QColorGroup::Base ) ); | 370 | p->fillRect( r[i], colorGroup().brush( QColorGroup::Base ) ); |
371 | } | 371 | } |
372 | #endif | 372 | #endif |
373 | #endif | 373 | #endif |
374 | 374 | ||
375 | 375 | ||
376 | // int AbTable::rowHeight( int ) const | 376 | // int AbTable::rowHeight( int ) const |
377 | // { | 377 | // { |
378 | // return 18; | 378 | // return 18; |
379 | // } | 379 | // } |
380 | 380 | ||
381 | // int AbTable::rowPos( int row ) const | 381 | // int AbTable::rowPos( int row ) const |
382 | // { | 382 | // { |
383 | // return 18*row; | 383 | // return 18*row; |
384 | // } | 384 | // } |
385 | 385 | ||
386 | // int AbTable::rowAt( int pos ) const | 386 | // int AbTable::rowAt( int pos ) const |
387 | // { | 387 | // { |
388 | // return QMIN( pos/18, numRows()-1 ); | 388 | // return QMIN( pos/18, numRows()-1 ); |
389 | // } | 389 | // } |
390 | 390 | ||
391 | 391 | ||
392 | 392 | ||
393 | void AbTable::fitColumns() | 393 | void AbTable::fitColumns() |
394 | { | 394 | { |
395 | odebug << "void AbTable::fitColumns()" << oendl; | 395 | odebug << "void AbTable::fitColumns()" << oendl; |
396 | int contentsWidth = visibleWidth() / 2; | 396 | int contentsWidth = visibleWidth() / 2; |
397 | // Fix to better value | 397 | // Fix to better value |
398 | // contentsWidth = 130; | 398 | // contentsWidth = 130; |
399 | 399 | ||
400 | setPaintingEnabled( FALSE ); | 400 | setPaintingEnabled( FALSE ); |
401 | 401 | ||
402 | if ( columnVisible == false ){ | 402 | if ( columnVisible == false ){ |
403 | showColumn(0); | 403 | showColumn(0); |
404 | columnVisible = true; | 404 | columnVisible = true; |
405 | } | 405 | } |
406 | 406 | ||
407 | //odebug << "Width: " << contentsWidth << oendl; | 407 | //odebug << "Width: " << contentsWidth << oendl; |
408 | 408 | ||
409 | setColumnWidth( 0, contentsWidth ); | 409 | setColumnWidth( 0, contentsWidth ); |
410 | adjustColumn(1); | 410 | adjustColumn(1); |
411 | if ( columnWidth(1) < contentsWidth ) | 411 | if ( columnWidth(1) < contentsWidth ) |
412 | setColumnWidth( 1, contentsWidth ); | 412 | setColumnWidth( 1, contentsWidth ); |
413 | 413 | ||
414 | setPaintingEnabled( TRUE ); | 414 | setPaintingEnabled( TRUE ); |
415 | } | 415 | } |
416 | 416 | ||
417 | void AbTable::show() | 417 | void AbTable::show() |
418 | { | 418 | { |
419 | //odebug << "void AbTable::show()" << oendl; | 419 | //odebug << "void AbTable::show()" << oendl; |
420 | realignTable(); | 420 | realignTable(); |
421 | QTable::show(); | 421 | QTable::show(); |
422 | } | 422 | } |
423 | 423 | ||
424 | #if 0 | 424 | #if 0 |
425 | void AbTable::setChoiceNames( const QStringList& list) | 425 | void AbTable::setChoiceNames( const QStringList& list) |
426 | { | 426 | { |
427 | choicenames = list; | 427 | choicenames = list; |
428 | if ( choicenames.isEmpty() ) { | 428 | if ( choicenames.isEmpty() ) { |
429 | // hide pick column | 429 | // hide pick column |
430 | setNumCols( 2 ); | 430 | setNumCols( 2 ); |
431 | } else { | 431 | } else { |
432 | // show pick column | 432 | // show pick column |
433 | setNumCols( 3 ); | 433 | setNumCols( 3 ); |
434 | setColumnWidth( 2, fontMetrics().width(tr( "Pick" ))+8 ); | 434 | setColumnWidth( 2, fontMetrics().width(tr( "Pick" ))+8 ); |
435 | horizontalHeader()->setLabel( 2, tr( "Pick" )); | 435 | horizontalHeader()->setLabel( 2, tr( "Pick" )); |
436 | } | 436 | } |
437 | fitColumns(); | 437 | fitColumns(); |
438 | } | 438 | } |
439 | #endif | 439 | #endif |
440 | 440 | ||
441 | void AbTable::itemClicked(int,int col) | 441 | void AbTable::itemClicked(int,int col) |
442 | { | 442 | { |
443 | //odebug << "AbTable::itemClicked(int, col: " << col << ")" << oendl; | 443 | //odebug << "AbTable::itemClicked(int, col: " << col << ")" << oendl; |
444 | if ( col == 2 ) { | 444 | if ( col == 2 ) { |
445 | return; | 445 | return; |
446 | } else { | 446 | } else { |
447 | //odebug << "Emitting signalSwitch()" << oendl; | 447 | //odebug << "Emitting signalSwitch()" << oendl; |
448 | emit signalSwitch(); | 448 | emit signalSwitch(); |
449 | } | 449 | } |
450 | } | 450 | } |
451 | 451 | ||
452 | #if 0 | 452 | #if 0 |
453 | QStringList AbTable::choiceNames() const | 453 | QStringList AbTable::choiceNames() const |
454 | { | 454 | { |
455 | return choicenames; | 455 | return choicenames; |
456 | } | 456 | } |
457 | 457 | ||
458 | #endif | 458 | #endif |
459 | void AbTable::setChoiceSelection( const QValueList<int>& list ) | 459 | void AbTable::setChoiceSelection( const QValueList<int>& list ) |
460 | { | 460 | { |
461 | intFields = list; | 461 | intFields = list; |
462 | } | 462 | } |
463 | 463 | ||
464 | QStringList AbTable::choiceSelection(int /*index*/) const | 464 | QStringList AbTable::choiceSelection(int /*index*/) const |
465 | { | 465 | { |
466 | QStringList r; | 466 | QStringList r; |
467 | /* ###### | 467 | /* ###### |
468 | 468 | ||
469 | QString selname = choicenames.at(index); | 469 | QString selname = choicenames.at(index); |
470 | for (each row) { | 470 | for (each row) { |
471 | Opie::OPimContact *c = contactForRow(row); | 471 | Opie::OPimContact *c = contactForRow(row); |
472 | if ( text(row,2) == selname ) { | 472 | if ( text(row,2) == selname ) { |
473 | r.append(c->email); | 473 | r.append(c->email); |
474 | } | 474 | } |
475 | } | 475 | } |
476 | 476 | ||
477 | */ | 477 | */ |
478 | return r; | 478 | return r; |
479 | } | 479 | } |
480 | 480 | ||
481 | 481 | ||
482 | void AbTable::updateVisible() | 482 | void AbTable::updateVisible() |
483 | { | 483 | { |
484 | //odebug << "void AbTable::updateVisible()" << oendl; | 484 | //odebug << "void AbTable::updateVisible()" << oendl; |
485 | 485 | ||
486 | int visible, | 486 | int visible, |
487 | totalRows, | 487 | totalRows, |
488 | row, | 488 | row, |
489 | selectedRow = 0; | 489 | selectedRow = 0; |
490 | 490 | ||
491 | visible = 0; | 491 | visible = 0; |
492 | 492 | ||
493 | setPaintingEnabled( FALSE ); | 493 | setPaintingEnabled( FALSE ); |
494 | 494 | ||
495 | realignTable(); | 495 | realignTable(); |
496 | 496 | ||
497 | totalRows = numRows(); | 497 | totalRows = numRows(); |
498 | for ( row = 0; row < totalRows; row++ ) { | 498 | for ( row = 0; row < totalRows; row++ ) { |
499 | if ( rowHeight(row) == 0 ) { | 499 | if ( rowHeight(row) == 0 ) { |
500 | showRow( row ); | 500 | showRow( row ); |
501 | adjustRow( row ); | 501 | adjustRow( row ); |
502 | if ( isSelected( row,0 ) || isSelected( row,1 ) ) | 502 | if ( isSelected( row,0 ) || isSelected( row,1 ) ) |
503 | selectedRow = row; | 503 | selectedRow = row; |
504 | } | 504 | } |
505 | visible++; | 505 | visible++; |
506 | } | 506 | } |
507 | 507 | ||
508 | if ( selectedRow ) | 508 | if ( selectedRow ) |
509 | setCurrentCell( selectedRow, 0 ); | 509 | setCurrentCell( selectedRow, 0 ); |
510 | 510 | ||
511 | if ( !visible ) | 511 | if ( !visible ) |
512 | setCurrentCell( -1, 0 ); | 512 | setCurrentCell( -1, 0 ); |
513 | 513 | ||
514 | setPaintingEnabled( TRUE ); | 514 | setPaintingEnabled( TRUE ); |
515 | } | 515 | } |
516 | 516 | ||
517 | 517 | ||
518 | void AbTable::setPaintingEnabled( bool e ) | 518 | void AbTable::setPaintingEnabled( bool e ) |
519 | { | 519 | { |
520 | //odebug << "IN void AbTable::setPaintingEnabled( " << e << " )->Nested: " | 520 | //odebug << "IN void AbTable::setPaintingEnabled( " << e << " )->Nested: " |
521 | // << countNested << oendl; | 521 | // << countNested << oendl; |
522 | 522 | ||
523 | if ( e ) { | 523 | if ( e ) { |
524 | if ( countNested > 0 ) | 524 | if ( countNested > 0 ) |
525 | --countNested; | 525 | --countNested; |
526 | if ( ! countNested ){ | 526 | if ( ! countNested ){ |
527 | setUpdatesEnabled( true ); | 527 | setUpdatesEnabled( true ); |
528 | enablePainting = true; | 528 | enablePainting = true; |
529 | rowHeightChanged( 0 ); | 529 | rowHeightChanged( 0 ); |
530 | viewport()->update(); | 530 | viewport()->update(); |
531 | } | 531 | } |
532 | } else { | 532 | } else { |
533 | ++countNested; | 533 | ++countNested; |
534 | enablePainting = false; | 534 | enablePainting = false; |
535 | setUpdatesEnabled( false ); | 535 | setUpdatesEnabled( false ); |
536 | } | 536 | } |
537 | //odebug << "OUT void AbTable::setPaintingEnabled( " << e << " )->Nested: " | 537 | //odebug << "OUT void AbTable::setPaintingEnabled( " << e << " )->Nested: " |
538 | // << countNested << oendl; | 538 | // << countNested << oendl; |
539 | } | 539 | } |
540 | 540 | ||
541 | void AbTable::viewportPaintEvent( QPaintEvent* e ) { | 541 | void AbTable::viewportPaintEvent( QPaintEvent* e ) { |
542 | //odebug << "void AbTable::viewportPaintEvent( QPaintEvent* e ) -> " | 542 | //odebug << "void AbTable::viewportPaintEvent( QPaintEvent* e ) -> " |
543 | // << enablePainting << oendl; | 543 | // << enablePainting << oendl; |
544 | if ( enablePainting ) | 544 | if ( enablePainting ) |
545 | QTable::viewportPaintEvent( e ); | 545 | QTable::viewportPaintEvent( e ); |
546 | } | 546 | } |
547 | 547 | ||
548 | void AbTable::paintCell(QPainter* p, int row, int col, const QRect& cr, bool ) { | 548 | void AbTable::paintCell(QPainter* p, int row, int col, const QRect& cr, bool ) { |
549 | const QColorGroup &cg = colorGroup(); | 549 | const QColorGroup &cg = colorGroup(); |
550 | 550 | ||
551 | p->save(); | 551 | p->save(); |
552 | 552 | ||
553 | //odebug << "Paint row: " << row << oendl; | 553 | //odebug << "Paint row: " << row << oendl; |
554 | 554 | ||
555 | Opie::OPimContact act_contact = m_viewList[row]; | 555 | Opie::OPimContact act_contact = m_viewList[row]; |
556 | 556 | ||
557 | // Paint alternating background bars | 557 | // Paint alternating background bars |
558 | if ( (row % 2 ) == 0 ) { | 558 | if ( (row % 2 ) == 0 ) { |
559 | p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Base ) ); | 559 | p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Base ) ); |
560 | p->setPen( QPen( cg.text() ) ); | 560 | p->setPen( QPen( cg.text() ) ); |
561 | } | 561 | } |
562 | else { | 562 | else { |
563 | p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Background ) ); | 563 | p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Background ) ); |
564 | p->setPen( QPen( cg.buttonText() ) ); | 564 | p->setPen( QPen( cg.buttonText() ) ); |
565 | } | 565 | } |
566 | 566 | ||
567 | QFont f = p->font(); | 567 | QFont f = p->font(); |
568 | QFontMetrics fm(f); | 568 | QFontMetrics fm(f); |
569 | 569 | ||
570 | int marg = 2; | 570 | int marg = 2; |
571 | int x = 0; | 571 | int x = 0; |
572 | int y = ( cr.height() - 14 ) / 2; | 572 | int y = ( cr.height() - 14 ) / 2; |
573 | 573 | ||
574 | QString nameText = act_contact.fileAs(); | 574 | QString nameText = act_contact.fileAs(); |
575 | 575 | ||
576 | switch( col ){ | 576 | switch( col ){ |
577 | case 0: | 577 | case 0: |
578 | p->drawText( x + marg,2 + fm.ascent(), nameText ); | 578 | p->drawText( x + marg,2 + fm.ascent(), nameText ); |
579 | break; | 579 | break; |
580 | case 1:{ | 580 | case 1:{ |
581 | 581 | ||
582 | ContactItem contactItem = findContactContact( act_contact, 0 ); | 582 | ContactItem contactItem = findContactContact( act_contact, 0 ); |
583 | QPixmap contactPic = contactItem.icon; /* pixmap( row, col ); */ | 583 | QPixmap contactPic = contactItem.icon; /* pixmap( row, col ); */ |
584 | QString contactText = contactItem.value; | 584 | QString contactText = contactItem.value; |
585 | 585 | ||
586 | if ( !contactPic.isNull() ) | 586 | if ( !contactPic.isNull() ) |
587 | { | 587 | { |
588 | p->drawPixmap( x + marg, y, contactPic ); | 588 | p->drawPixmap( x + marg, y, contactPic ); |
589 | p->drawText( x + marg + contactPic.width() | 589 | p->drawText( x + marg + contactPic.width() |
590 | + 4,2 + fm.ascent(), contactText ); | 590 | + 4,2 + fm.ascent(), contactText ); |
591 | } | 591 | } |
592 | else | 592 | else |
593 | { | 593 | { |
594 | p->drawText( x + marg,2 + fm.ascent(), contactText ); | 594 | p->drawText( x + marg,2 + fm.ascent(), contactText ); |
595 | } | 595 | } |
596 | } | 596 | } |
597 | break; | 597 | break; |
598 | 598 | ||
599 | } | 599 | } |
600 | p->restore(); | 600 | p->restore(); |
601 | } | 601 | } |
602 | 602 | ||
603 | void AbTable::rowHeightChanged( int row ) | 603 | void AbTable::rowHeightChanged( int row ) |
604 | { | 604 | { |
605 | if ( enablePainting ) | 605 | if ( enablePainting ) |
606 | QTable::rowHeightChanged( row ); | 606 | QTable::rowHeightChanged( row ); |
607 | } | 607 | } |
608 | ContactItem AbTable::findContactContact( const Opie::OPimContact &entry, int /* row */ ) | 608 | ContactItem AbTable::findContactContact( const Opie::OPimContact &entry, int /* row */ ) |
609 | { | 609 | { |
610 | 610 | ||
611 | ContactItem item; | 611 | ContactItem item; |
612 | 612 | ||
613 | item.value = ""; | 613 | item.value = ""; |
614 | 614 | ||
615 | for ( QValueList<int>::ConstIterator it = intFields.begin(); | 615 | for ( QValueList<int>::ConstIterator it = intFields.begin(); |
616 | it != intFields.end(); ++it ) { | 616 | it != intFields.end(); ++it ) { |
617 | switch ( *it ) { | 617 | switch ( *it ) { |
618 | default: | 618 | default: |
619 | break; | 619 | break; |
620 | case Qtopia::Title: | 620 | case Qtopia::Title: |
621 | item.value = entry.title(); | 621 | item.value = entry.title(); |
622 | break; | 622 | break; |
623 | case Qtopia::Suffix: | 623 | case Qtopia::Suffix: |
624 | item.value = entry.suffix(); | 624 | item.value = entry.suffix(); |
625 | break; | 625 | break; |
626 | case Qtopia::FileAs: | 626 | case Qtopia::FileAs: |
627 | item.value = entry.fileAs(); | 627 | item.value = entry.fileAs(); |
628 | break; | 628 | break; |
629 | case Qtopia::DefaultEmail: | 629 | case Qtopia::DefaultEmail: |
630 | item.value = entry.defaultEmail(); | 630 | item.value = entry.defaultEmail(); |
631 | if ( !item.value.isEmpty() ) | 631 | if ( !item.value.isEmpty() ) |
632 | item.icon = Resource::loadPixmap( "addressbook/email" ); | 632 | item.icon = Opie::Core::OResource::loadPixmap( "addressbook/email" ); |
633 | break; | 633 | break; |
634 | case Qtopia::Emails: | 634 | case Qtopia::Emails: |
635 | item.value = entry.emails(); | 635 | item.value = entry.emails(); |
636 | if ( !item.value.isEmpty() ) | 636 | if ( !item.value.isEmpty() ) |
637 | item.icon = Resource::loadPixmap( "addressbook/email" ); | 637 | item.icon = Opie::Core::OResource::loadPixmap( "addressbook/email" ); |
638 | break; | 638 | break; |
639 | case Qtopia::HomeStreet: | 639 | case Qtopia::HomeStreet: |
640 | item.value = entry.homeStreet(); | 640 | item.value = entry.homeStreet(); |
641 | break; | 641 | break; |
642 | case Qtopia::HomeCity: | 642 | case Qtopia::HomeCity: |
643 | item.value = entry.homeCity(); | 643 | item.value = entry.homeCity(); |
644 | break; | 644 | break; |
645 | case Qtopia::HomeState: | 645 | case Qtopia::HomeState: |
646 | item.value = entry.homeState(); | 646 | item.value = entry.homeState(); |
647 | break; | 647 | break; |
648 | case Qtopia::HomeZip: | 648 | case Qtopia::HomeZip: |
649 | item.value = entry.homeZip(); | 649 | item.value = entry.homeZip(); |
650 | break; | 650 | break; |
651 | case Qtopia::HomeCountry: | 651 | case Qtopia::HomeCountry: |
652 | item.value = entry.homeCountry(); | 652 | item.value = entry.homeCountry(); |
653 | break; | 653 | break; |
654 | case Qtopia::HomePhone: | 654 | case Qtopia::HomePhone: |
655 | item.value = entry.homePhone(); | 655 | item.value = entry.homePhone(); |
656 | if ( !item.value.isEmpty() ) | 656 | if ( !item.value.isEmpty() ) |
657 | item.icon = Resource::loadPixmap( "addressbook/phonehome" ); | 657 | item.icon = Opie::Core::OResource::loadPixmap( "addressbook/phonehome" ); |
658 | break; | 658 | break; |
659 | case Qtopia::HomeFax: | 659 | case Qtopia::HomeFax: |
660 | item.value = entry.homeFax(); | 660 | item.value = entry.homeFax(); |
661 | if ( !item.value.isEmpty() ) | 661 | if ( !item.value.isEmpty() ) |
662 | item.icon = Resource::loadPixmap( "addressbook/faxhome" ); | 662 | item.icon = Opie::Core::OResource::loadPixmap( "addressbook/faxhome" ); |
663 | break; | 663 | break; |
664 | case Qtopia::HomeMobile: | 664 | case Qtopia::HomeMobile: |
665 | item.value = entry.homeMobile(); | 665 | item.value = entry.homeMobile(); |
666 | if ( !item.value.isEmpty() ) | 666 | if ( !item.value.isEmpty() ) |
667 | item.icon = Resource::loadPixmap( "addressbook/mobilehome" ); | 667 | item.icon = Opie::Core::OResource::loadPixmap( "addressbook/mobilehome" ); |
668 | break; | 668 | break; |
669 | case Qtopia::HomeWebPage: | 669 | case Qtopia::HomeWebPage: |
670 | item.value = entry.homeWebpage(); | 670 | item.value = entry.homeWebpage(); |
671 | if ( !item.value.isEmpty() ) | 671 | if ( !item.value.isEmpty() ) |
672 | item.icon = Resource::loadPixmap( "addressbook/webpagehome" ); | 672 | item.icon = Opie::Core::OResource::loadPixmap( "addressbook/webpagehome" ); |
673 | break; | 673 | break; |
674 | case Qtopia::Company: | 674 | case Qtopia::Company: |
675 | item.value = entry.company(); | 675 | item.value = entry.company(); |
676 | break; | 676 | break; |
677 | case Qtopia::BusinessCity: | 677 | case Qtopia::BusinessCity: |
678 | item.value = entry.businessCity(); | 678 | item.value = entry.businessCity(); |
679 | break; | 679 | break; |
680 | case Qtopia::BusinessStreet: | 680 | case Qtopia::BusinessStreet: |
681 | item.value = entry.businessStreet(); | 681 | item.value = entry.businessStreet(); |
682 | break; | 682 | break; |
683 | case Qtopia::BusinessZip: | 683 | case Qtopia::BusinessZip: |
684 | item.value = entry.businessZip(); | 684 | item.value = entry.businessZip(); |
685 | break; | 685 | break; |
686 | case Qtopia::BusinessCountry: | 686 | case Qtopia::BusinessCountry: |
687 | item.value = entry.businessCountry(); | 687 | item.value = entry.businessCountry(); |
688 | break; | 688 | break; |
689 | case Qtopia::BusinessWebPage: | 689 | case Qtopia::BusinessWebPage: |
690 | item.value = entry.businessWebpage(); | 690 | item.value = entry.businessWebpage(); |
691 | if ( !item.value.isEmpty() ) | 691 | if ( !item.value.isEmpty() ) |
692 | item.icon = Resource::loadPixmap( "addressbook/webpagework" ); | 692 | item.icon = Opie::Core::OResource::loadPixmap( "addressbook/webpagework" ); |
693 | break; | 693 | break; |
694 | case Qtopia::JobTitle: | 694 | case Qtopia::JobTitle: |
695 | item.value = entry.jobTitle(); | 695 | item.value = entry.jobTitle(); |
696 | break; | 696 | break; |
697 | case Qtopia::Department: | 697 | case Qtopia::Department: |
698 | item.value = entry.department(); | 698 | item.value = entry.department(); |
699 | break; | 699 | break; |
700 | case Qtopia::Office: | 700 | case Qtopia::Office: |
701 | item.value = entry.office(); | 701 | item.value = entry.office(); |
702 | break; | 702 | break; |
703 | case Qtopia::BusinessPhone: | 703 | case Qtopia::BusinessPhone: |
704 | item.value = entry.businessPhone(); | 704 | item.value = entry.businessPhone(); |
705 | if ( !item.value.isEmpty() ) | 705 | if ( !item.value.isEmpty() ) |
706 | item.icon = Resource::loadPixmap( "addressbook/phonework" ); | 706 | item.icon = Opie::Core::OResource::loadPixmap( "addressbook/phonework" ); |
707 | break; | 707 | break; |
708 | case Qtopia::BusinessFax: | 708 | case Qtopia::BusinessFax: |
709 | item.value = entry.businessFax(); | 709 | item.value = entry.businessFax(); |
710 | if ( !item.value.isEmpty() ) | 710 | if ( !item.value.isEmpty() ) |
711 | item.icon = Resource::loadPixmap( "addressbook/faxwork" ); | 711 | item.icon = Opie::Core::OResource::loadPixmap( "addressbook/faxwork" ); |
712 | break; | 712 | break; |
713 | case Qtopia::BusinessMobile: | 713 | case Qtopia::BusinessMobile: |
714 | item.value = entry.businessMobile(); | 714 | item.value = entry.businessMobile(); |
715 | if ( !item.value.isEmpty() ) | 715 | if ( !item.value.isEmpty() ) |
716 | item.icon = Resource::loadPixmap( "addressbook/mobilework" ); | 716 | item.icon = Opie::Core::OResource::loadPixmap( "addressbook/mobilework" ); |
717 | break; | 717 | break; |
718 | case Qtopia::BusinessPager: | 718 | case Qtopia::BusinessPager: |
719 | item.value = entry.businessPager(); | 719 | item.value = entry.businessPager(); |
720 | break; | 720 | break; |
721 | case Qtopia::Profession: | 721 | case Qtopia::Profession: |
722 | item.value = entry.profession(); | 722 | item.value = entry.profession(); |
723 | break; | 723 | break; |
724 | case Qtopia::Assistant: | 724 | case Qtopia::Assistant: |
725 | item.value = entry.assistant(); | 725 | item.value = entry.assistant(); |
726 | break; | 726 | break; |
727 | case Qtopia::Manager: | 727 | case Qtopia::Manager: |
728 | item.value = entry.manager(); | 728 | item.value = entry.manager(); |
729 | break; | 729 | break; |
730 | case Qtopia::Spouse: | 730 | case Qtopia::Spouse: |
731 | item.value = entry.spouse(); | 731 | item.value = entry.spouse(); |
732 | break; | 732 | break; |
733 | case Qtopia::Gender: | 733 | case Qtopia::Gender: |
734 | item.value = entry.gender(); | 734 | item.value = entry.gender(); |
735 | break; | 735 | break; |
736 | case Qtopia::Birthday: | 736 | case Qtopia::Birthday: |
737 | if ( ! entry.birthday().isNull() ){ | 737 | if ( ! entry.birthday().isNull() ){ |
738 | item.value = TimeString::numberDateString( entry.birthday() ); | 738 | item.value = TimeString::numberDateString( entry.birthday() ); |
739 | } | 739 | } |
740 | break; | 740 | break; |
741 | case Qtopia::Anniversary: | 741 | case Qtopia::Anniversary: |
742 | if ( ! entry.anniversary().isNull() ){ | 742 | if ( ! entry.anniversary().isNull() ){ |
743 | item.value = TimeString::numberDateString( entry.anniversary() ); | 743 | item.value = TimeString::numberDateString( entry.anniversary() ); |
744 | } | 744 | } |
745 | break; | 745 | break; |
746 | case Qtopia::Nickname: | 746 | case Qtopia::Nickname: |
747 | item.value = entry.nickname(); | 747 | item.value = entry.nickname(); |
748 | break; | 748 | break; |
749 | case Qtopia::Children: | 749 | case Qtopia::Children: |
750 | item.value = entry.children(); | 750 | item.value = entry.children(); |
751 | break; | 751 | break; |
752 | case Qtopia::Notes: | 752 | case Qtopia::Notes: |
753 | item.value = entry.notes(); | 753 | item.value = entry.notes(); |
754 | break; | 754 | break; |
755 | } | 755 | } |
756 | if ( !item.value.isEmpty() ) | 756 | if ( !item.value.isEmpty() ) |
757 | break; | 757 | break; |
758 | } | 758 | } |
759 | return item; | 759 | return item; |
760 | } | 760 | } |
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp index faae0a9..4fa9253 100644 --- a/core/pim/addressbook/addressbook.cpp +++ b/core/pim/addressbook/addressbook.cpp | |||
@@ -1,889 +1,893 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** Copyright (C) 2003 Stefan Eilers (eilers.stefan@epost.de) | 3 | ** Copyright (C) 2003 Stefan Eilers (eilers.stefan@epost.de) |
4 | ** | 4 | ** |
5 | ** This file is part of the Open Palmtop Environment (see www.opie.info). | 5 | ** This file is part of the Open Palmtop Environment (see www.opie.info). |
6 | ** | 6 | ** |
7 | ** This file may be distributed and/or modified under the terms of the | 7 | ** This file may be distributed and/or modified under the terms of the |
8 | ** GNU General Public License version 2 as published by the Free Software | 8 | ** GNU General Public License version 2 as published by the Free Software |
9 | ** Foundation and appearing in the file LICENSE.GPL included in the | 9 | ** Foundation and appearing in the file LICENSE.GPL included in the |
10 | ** packaging of this file. | 10 | ** packaging of this file. |
11 | ** | 11 | ** |
12 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 12 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
13 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 13 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
14 | ** | 14 | ** |
15 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 15 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
16 | ** | 16 | ** |
17 | ** | 17 | ** |
18 | **********************************************************************/ | 18 | **********************************************************************/ |
19 | 19 | ||
20 | #define QTOPIA_INTERNAL_FD | 20 | #define QTOPIA_INTERNAL_FD |
21 | 21 | ||
22 | // #include "addresssettings.h" | 22 | // #include "addresssettings.h" |
23 | #include "addressbook.h" | 23 | #include "addressbook.h" |
24 | 24 | ||
25 | #include <opie2/odebug.h> | 25 | #include <opie2/odebug.h> |
26 | #include <opie2/ofileselector.h> | 26 | #include <opie2/ofileselector.h> |
27 | #include <opie2/ofiledialog.h> | 27 | #include <opie2/ofiledialog.h> |
28 | #include <opie2/opimcontact.h> | 28 | #include <opie2/opimcontact.h> |
29 | #include <opie2/ocontactaccessbackend_vcard.h> | 29 | #include <opie2/ocontactaccessbackend_vcard.h> |
30 | #include <opie2/oresource.h> | ||
30 | 31 | ||
31 | #include <qpe/resource.h> | ||
32 | #include <qpe/ir.h> | 32 | #include <qpe/ir.h> |
33 | #include <qpe/qpemessagebox.h> | 33 | #include <qpe/qpemessagebox.h> |
34 | #include <qmenubar.h> | 34 | #include <qmenubar.h> |
35 | // #include <qtoolbar.h> | ||
36 | // #include <qmenubar.h> | ||
37 | #include <qpe/qpeapplication.h> | 35 | #include <qpe/qpeapplication.h> |
38 | 36 | ||
39 | #include <qaction.h> | 37 | #include <qaction.h> |
40 | #include <qlayout.h> | 38 | #include <qlayout.h> |
41 | #include <qmessagebox.h> | 39 | #include <qmessagebox.h> |
42 | #include <qtoolbutton.h> | 40 | #include <qtoolbutton.h> |
43 | 41 | ||
44 | #include <stdlib.h> | 42 | #include <stdlib.h> |
45 | #include <sys/stat.h> | 43 | #include <sys/stat.h> |
46 | #include <sys/types.h> | 44 | #include <sys/types.h> |
47 | #include <fcntl.h> | 45 | #include <fcntl.h> |
48 | #include <unistd.h> | 46 | #include <unistd.h> |
49 | 47 | ||
50 | 48 | ||
51 | #include "picker.h" | 49 | #include "picker.h" |
52 | #include "configdlg.h" | 50 | #include "configdlg.h" |
53 | 51 | ||
54 | extern QString addressbookPersonalVCardName(); | 52 | extern QString addressbookPersonalVCardName(); |
55 | 53 | ||
56 | AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, | 54 | AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, |
57 | WFlags /*f*/ ) | 55 | WFlags /*f*/ ) |
58 | : Opie::OPimMainWindow( "Addressbook", "Contacts", tr( "Contact" ), "AddressBook", | 56 | : Opie::OPimMainWindow( "Addressbook", "Contacts", tr( "Contact" ), "AddressBook", |
59 | parent, name, WType_TopLevel | WStyle_ContextHelp ), | 57 | parent, name, WType_TopLevel | WStyle_ContextHelp ), |
60 | abEditor(0l), | 58 | abEditor(0l), |
61 | syncing(false) | 59 | syncing(false) |
62 | { | 60 | { |
63 | setCaption( tr( "Contacts" ) ); | 61 | setCaption( tr( "Contacts" ) ); |
64 | 62 | ||
65 | isLoading = true; | 63 | isLoading = true; |
66 | 64 | ||
67 | m_config.load(); | 65 | m_config.load(); |
68 | 66 | ||
69 | // Create Views | 67 | // Create Views |
70 | m_listContainer = new QWidget( this ); | 68 | m_listContainer = new QWidget( this ); |
71 | QVBoxLayout *vb = new QVBoxLayout( m_listContainer ); | 69 | QVBoxLayout *vb = new QVBoxLayout( m_listContainer ); |
72 | 70 | ||
73 | m_abView = new AbView( m_listContainer, m_config.orderList() ); | 71 | m_abView = new AbView( m_listContainer, m_config.orderList() ); |
74 | vb->addWidget( m_abView ); | 72 | vb->addWidget( m_abView ); |
75 | connect( m_abView, SIGNAL(signalViewSwitched(int)), | 73 | connect( m_abView, SIGNAL(signalViewSwitched(int)), |
76 | this, SLOT(slotViewSwitched(int)) ); | 74 | this, SLOT(slotViewSwitched(int)) ); |
77 | 75 | ||
78 | QObject::connect( m_abView, SIGNAL(signalNotFound()), this, SLOT(slotNotFound()) ); | 76 | QObject::connect( m_abView, SIGNAL(signalNotFound()), this, SLOT(slotNotFound()) ); |
79 | 77 | ||
80 | // Letter Picker | 78 | // Letter Picker |
81 | pLabel = new LetterPicker( m_listContainer ); | 79 | pLabel = new LetterPicker( m_listContainer ); |
82 | connect(pLabel, SIGNAL(letterClicked(char)), this, SLOT(slotSetLetter(char))); | 80 | connect(pLabel, SIGNAL(letterClicked(char)), this, SLOT(slotSetLetter(char))); |
83 | connect(m_abView, SIGNAL(signalClearLetterPicker()), pLabel, SLOT(clear()) ); | 81 | connect(m_abView, SIGNAL(signalClearLetterPicker()), pLabel, SLOT(clear()) ); |
84 | 82 | ||
85 | vb->addWidget( pLabel ); | 83 | vb->addWidget( pLabel ); |
86 | 84 | ||
87 | // Quick search bar | 85 | // Quick search bar |
88 | m_searchBar = new OFloatBar( "Search", this, QMainWindow::Top, true ); | 86 | m_searchBar = new OFloatBar( "Search", this, QMainWindow::Top, true ); |
89 | m_searchBar->setHorizontalStretchable( true ); | 87 | m_searchBar->setHorizontalStretchable( true ); |
90 | m_searchBar->hide(); | 88 | m_searchBar->hide(); |
91 | m_searchEdit = new QLineEdit( m_searchBar, "m_searchEdit" ); | 89 | m_searchEdit = new QLineEdit( m_searchBar, "m_searchEdit" ); |
92 | 90 | ||
93 | m_searchBar->setStretchableWidget( m_searchEdit ); | 91 | m_searchBar->setStretchableWidget( m_searchEdit ); |
94 | connect( m_searchEdit, SIGNAL(returnPressed()), this, SLOT(slotFind()) ); | 92 | connect( m_searchEdit, SIGNAL(returnPressed()), this, SLOT(slotFind()) ); |
95 | 93 | ||
96 | QAction *a = new QAction( tr( "Start Search" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); | 94 | QAction *a = new QAction( tr( "Start Search" ), |
95 | Opie::Core::OResource::loadPixmap( "find", Opie::Core::OResource::SmallIcon ), | ||
96 | QString::null, 0, this, 0 ); | ||
97 | connect( a, SIGNAL(activated()), this, SLOT(slotFind()) ); | 97 | connect( a, SIGNAL(activated()), this, SLOT(slotFind()) ); |
98 | a->addTo( m_searchBar ); | 98 | a->addTo( m_searchBar ); |
99 | 99 | ||
100 | // Insert Contact menu items | 100 | // Insert Contact menu items |
101 | QActionGroup *items = new QActionGroup( this, QString::null, false ); | 101 | QActionGroup *items = new QActionGroup( this, QString::null, false ); |
102 | 102 | ||
103 | m_actionMail = new QAction( tr( "Write Mail To" ), Resource::loadPixmap( "addressbook/sendmail" ), | 103 | m_actionMail = new QAction( tr( "Write Mail To" ), |
104 | QString::null, 0, items, 0 ); | 104 | Opie::Core::OResource::loadPixmap( "addressbook/sendmail" ), |
105 | QString::null, 0, items, 0 ); | ||
105 | connect( m_actionMail, SIGNAL(activated()), this, SLOT(writeMail()) ); | 106 | connect( m_actionMail, SIGNAL(activated()), this, SLOT(writeMail()) ); |
106 | 107 | ||
107 | a = new QAction( tr("Import vCard"), Resource::loadPixmap( "addressbook/fileimport"), | 108 | a = new QAction( tr("Import vCard"), |
108 | QString::null, 0, items, 0 ); | 109 | Opie::Core::OResource::loadPixmap( "addressbook/fileimport" ), |
110 | QString::null, 0, items, 0 ); | ||
109 | connect( a, SIGNAL(activated()), this, SLOT(importvCard()) ); | 111 | connect( a, SIGNAL(activated()), this, SLOT(importvCard()) ); |
110 | 112 | ||
111 | a = new QAction( tr("Export vCard"), Resource::loadPixmap( "addressbook/fileexport"), | 113 | a = new QAction( tr("Export vCard"), |
114 | Opie::Core::OResource::loadPixmap( "addressbook/fileexport" ), | ||
112 | QString::null, 0, items, 0 ); | 115 | QString::null, 0, items, 0 ); |
113 | connect( a, SIGNAL(activated()), this, SLOT(exportvCard()) ); | 116 | connect( a, SIGNAL(activated()), this, SLOT(exportvCard()) ); |
114 | 117 | ||
115 | m_actionPersonal = new QAction( tr("My Personal Details"), Resource::loadPixmap( "addressbook/identity" ), | 118 | m_actionPersonal = new QAction( tr("My Personal Details"), |
116 | QString::null, 0, items, 0 , true ); | 119 | Opie::Core::OResource::loadPixmap( "addressbook/identity" ), |
120 | QString::null, 0, items, 0 , true ); | ||
117 | connect( m_actionPersonal, SIGNAL(activated()), this, SLOT(slotPersonalView()) ); | 121 | connect( m_actionPersonal, SIGNAL(activated()), this, SLOT(slotPersonalView()) ); |
118 | 122 | ||
119 | insertItemMenuItems( items ); | 123 | insertItemMenuItems( items ); |
120 | 124 | ||
121 | // Insert View menu items | 125 | // Insert View menu items |
122 | items = new QActionGroup( this, QString::null, false ); | 126 | items = new QActionGroup( this, QString::null, false ); |
123 | 127 | ||
124 | a = new QAction( tr("Show quick search bar"),QString::null, 0, items, 0, true ); | 128 | a = new QAction( tr("Show quick search bar"),QString::null, 0, items, 0, true ); |
125 | connect( a, SIGNAL(toggled(bool)), this, SLOT(slotShowFind(bool)) ); | 129 | connect( a, SIGNAL(toggled(bool)), this, SLOT(slotShowFind(bool)) ); |
126 | 130 | ||
127 | insertViewMenuItems( items ); | 131 | insertViewMenuItems( items ); |
128 | 132 | ||
129 | // Fontsize | 133 | // Fontsize |
130 | defaultFont = new QFont( m_abView->font() ); | 134 | defaultFont = new QFont( m_abView->font() ); |
131 | slotSetFont(m_config.fontSize()); | 135 | slotSetFont(m_config.fontSize()); |
132 | m_curFontSize = m_config.fontSize(); | 136 | m_curFontSize = m_config.fontSize(); |
133 | 137 | ||
134 | setCentralWidget(m_listContainer); | 138 | setCentralWidget(m_listContainer); |
135 | 139 | ||
136 | //odebug << "adressbook contrsuction: t=" << t.elapsed() << oendl; | 140 | //odebug << "adressbook contrsuction: t=" << t.elapsed() << oendl; |
137 | connect( qApp, SIGNAL(flush()), this, SLOT(flush()) ); | 141 | connect( qApp, SIGNAL(flush()), this, SLOT(flush()) ); |
138 | connect( qApp, SIGNAL(reload()), this, SLOT(reload()) ); | 142 | connect( qApp, SIGNAL(reload()), this, SLOT(reload()) ); |
139 | connect( qApp, SIGNAL(appMessage(const QCString&,const QByteArray&)), | 143 | connect( qApp, SIGNAL(appMessage(const QCString&,const QByteArray&)), |
140 | this, SLOT(appMessage(const QCString&,const QByteArray&)) ); | 144 | this, SLOT(appMessage(const QCString&,const QByteArray&)) ); |
141 | 145 | ||
142 | isLoading = false; | 146 | isLoading = false; |
143 | 147 | ||
144 | // Handle category selection | 148 | // Handle category selection |
145 | setViewCategory( m_config.category() ); | 149 | setViewCategory( m_config.category() ); |
146 | m_abView->setShowByCategory( m_config.category() ); | 150 | m_abView->setShowByCategory( m_config.category() ); |
147 | connect( this, SIGNAL(categorySelected(const QString&)), | 151 | connect( this, SIGNAL(categorySelected(const QString&)), |
148 | this, SLOT(slotSetCategory(const QString&)) ); | 152 | this, SLOT(slotSetCategory(const QString&)) ); |
149 | } | 153 | } |
150 | 154 | ||
151 | void AddressbookWindow::slotSetFont( int size ) | 155 | void AddressbookWindow::slotSetFont( int size ) |
152 | { | 156 | { |
153 | odebug << "void AddressbookWindow::slotSetFont( " << size << " )" << oendl; | 157 | odebug << "void AddressbookWindow::slotSetFont( " << size << " )" << oendl; |
154 | 158 | ||
155 | if (size > 2 || size < 0) | 159 | if (size > 2 || size < 0) |
156 | size = 1; | 160 | size = 1; |
157 | 161 | ||
158 | m_config.setFontSize( size ); | 162 | m_config.setFontSize( size ); |
159 | 163 | ||
160 | QFont *currentFont; | 164 | QFont *currentFont; |
161 | 165 | ||
162 | switch (size) { | 166 | switch (size) { |
163 | case 0: | 167 | case 0: |
164 | m_abView->setFont( QFont( defaultFont->family(), defaultFont->pointSize() - 2 ) ); | 168 | m_abView->setFont( QFont( defaultFont->family(), defaultFont->pointSize() - 2 ) ); |
165 | currentFont = new QFont (m_abView->font()); | 169 | currentFont = new QFont (m_abView->font()); |
166 | // abList->resizeRows(currentFont->pixelSize() + 7); :SX | 170 | // abList->resizeRows(currentFont->pixelSize() + 7); :SX |
167 | // abList->resizeRows(); | 171 | // abList->resizeRows(); |
168 | break; | 172 | break; |
169 | case 1: | 173 | case 1: |
170 | m_abView->setFont( *defaultFont ); | 174 | m_abView->setFont( *defaultFont ); |
171 | currentFont = new QFont (m_abView->font()); | 175 | currentFont = new QFont (m_abView->font()); |
172 | // // abList->resizeRows(currentFont->pixelSize() + 7); | 176 | // // abList->resizeRows(currentFont->pixelSize() + 7); |
173 | // abList->resizeRows(); | 177 | // abList->resizeRows(); |
174 | break; | 178 | break; |
175 | case 2: | 179 | case 2: |
176 | m_abView->setFont( QFont( defaultFont->family(), defaultFont->pointSize() + 2 ) ); | 180 | m_abView->setFont( QFont( defaultFont->family(), defaultFont->pointSize() + 2 ) ); |
177 | currentFont = new QFont (m_abView->font()); | 181 | currentFont = new QFont (m_abView->font()); |
178 | // //abList->resizeRows(currentFont->pixelSize() + 7); | 182 | // //abList->resizeRows(currentFont->pixelSize() + 7); |
179 | // abList->resizeRows(); | 183 | // abList->resizeRows(); |
180 | break; | 184 | break; |
181 | } | 185 | } |
182 | } | 186 | } |
183 | 187 | ||
184 | 188 | ||
185 | 189 | ||
186 | void AddressbookWindow::importvCard() { | 190 | void AddressbookWindow::importvCard() { |
187 | QString str = Opie::Ui::OFileDialog::getOpenFileName( 1,"/");//,"", "*", this ); | 191 | QString str = Opie::Ui::OFileDialog::getOpenFileName( 1,"/");//,"", "*", this ); |
188 | if(!str.isEmpty() ){ | 192 | if(!str.isEmpty() ){ |
189 | setDocument((const QString&) str ); | 193 | setDocument((const QString&) str ); |
190 | } | 194 | } |
191 | 195 | ||
192 | } | 196 | } |
193 | void AddressbookWindow::exportvCard() | 197 | void AddressbookWindow::exportvCard() |
194 | { | 198 | { |
195 | odebug << "void AddressbookWindow::exportvCard()" << oendl; | 199 | odebug << "void AddressbookWindow::exportvCard()" << oendl; |
196 | QString filename = Opie::Ui::OFileDialog::getSaveFileName( 1,"/home/"); //,"", "*", this ); | 200 | QString filename = Opie::Ui::OFileDialog::getSaveFileName( 1,"/home/"); //,"", "*", this ); |
197 | if( !filename.isEmpty() && ( filename[filename.length()-1] != '/' ) ){ | 201 | if( !filename.isEmpty() && ( filename[filename.length()-1] != '/' ) ){ |
198 | odebug << " Save to file " << filename << ", (" << filename.length()-1 << ")" << oendl; | 202 | odebug << " Save to file " << filename << ", (" << filename.length()-1 << ")" << oendl; |
199 | Opie::OPimContact curCont = m_abView->currentEntry(); | 203 | Opie::OPimContact curCont = m_abView->currentEntry(); |
200 | if ( !curCont.isEmpty() ){ | 204 | if ( !curCont.isEmpty() ){ |
201 | Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, | 205 | Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, |
202 | filename ); | 206 | filename ); |
203 | Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook_exp", QString::null , vcard_backend, true ); | 207 | Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook_exp", QString::null , vcard_backend, true ); |
204 | if ( access ){ | 208 | if ( access ){ |
205 | access->add( curCont ); | 209 | access->add( curCont ); |
206 | access->save(); | 210 | access->save(); |
207 | } | 211 | } |
208 | delete access; | 212 | delete access; |
209 | }else | 213 | }else |
210 | QMessageBox::critical( 0, "Export VCard", | 214 | QMessageBox::critical( 0, "Export VCard", |
211 | QString( tr( "You have to select a contact !") ) ); | 215 | QString( tr( "You have to select a contact !") ) ); |
212 | 216 | ||
213 | }else | 217 | }else |
214 | QMessageBox::critical( 0, "Export VCard", | 218 | QMessageBox::critical( 0, "Export VCard", |
215 | QString( tr( "You have to set a filename !") ) ); | 219 | QString( tr( "You have to set a filename !") ) ); |
216 | } | 220 | } |
217 | 221 | ||
218 | void AddressbookWindow::setDocument( const QString &filename ) | 222 | void AddressbookWindow::setDocument( const QString &filename ) |
219 | { | 223 | { |
220 | odebug << "void AddressbookWindow::setDocument( " << filename << " )" << oendl; | 224 | odebug << "void AddressbookWindow::setDocument( " << filename << " )" << oendl; |
221 | 225 | ||
222 | // Switch to default backend. This should avoid to import into | 226 | // Switch to default backend. This should avoid to import into |
223 | // the personal database accidently. | 227 | // the personal database accidently. |
224 | if ( m_actionPersonal->isOn() ){ | 228 | if ( m_actionPersonal->isOn() ){ |
225 | m_actionPersonal->setOn( false ); | 229 | m_actionPersonal->setOn( false ); |
226 | slotPersonalView(); | 230 | slotPersonalView(); |
227 | } | 231 | } |
228 | 232 | ||
229 | if ( filename.find(".vcf") != int(filename.length()) - 4 ){ | 233 | if ( filename.find(".vcf") != int(filename.length()) - 4 ){ |
230 | 234 | ||
231 | 235 | ||
232 | 236 | ||
233 | switch( QMessageBox::information( this, tr ( "Right file type ?" ), | 237 | switch( QMessageBox::information( this, tr ( "Right file type ?" ), |
234 | tr( "The selected file \n does not end with \".vcf\".\n Do you really want to open it?" ), | 238 | tr( "The selected file \n does not end with \".vcf\".\n Do you really want to open it?" ), |
235 | tr( "&Yes" ), tr( "&No" ), QString::null, | 239 | tr( "&Yes" ), tr( "&No" ), QString::null, |
236 | 0, // Enter == button 0 | 240 | 0, // Enter == button 0 |
237 | 2 ) ) { // Escape == button 2 | 241 | 2 ) ) { // Escape == button 2 |
238 | case 0: | 242 | case 0: |
239 | odebug << "YES clicked" << oendl; | 243 | odebug << "YES clicked" << oendl; |
240 | break; | 244 | break; |
241 | case 1: | 245 | case 1: |
242 | odebug << "NO clicked" << oendl; | 246 | odebug << "NO clicked" << oendl; |
243 | return; | 247 | return; |
244 | break; | 248 | break; |
245 | } | 249 | } |
246 | } | 250 | } |
247 | 251 | ||
248 | Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, | 252 | Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, |
249 | filename ); | 253 | filename ); |
250 | Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); | 254 | Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); |
251 | Opie::OPimContactAccess::List allList = access->allRecords(); | 255 | Opie::OPimContactAccess::List allList = access->allRecords(); |
252 | odebug << "Found number of contacts in File: " << allList.count() << oendl; | 256 | odebug << "Found number of contacts in File: " << allList.count() << oendl; |
253 | 257 | ||
254 | if ( !allList.count() ) { | 258 | if ( !allList.count() ) { |
255 | QMessageBox::information( this, "Import VCard", | 259 | QMessageBox::information( this, "Import VCard", |
256 | "It was impossible to import\nthe VCard.\n" | 260 | "It was impossible to import\nthe VCard.\n" |
257 | "The VCard may be corrupted!" ); | 261 | "The VCard may be corrupted!" ); |
258 | } | 262 | } |
259 | 263 | ||
260 | bool doAsk = true; | 264 | bool doAsk = true; |
261 | Opie::OPimContactAccess::List::Iterator it; | 265 | Opie::OPimContactAccess::List::Iterator it; |
262 | for ( it = allList.begin(); it != allList.end(); ++it ){ | 266 | for ( it = allList.begin(); it != allList.end(); ++it ){ |
263 | odebug << "Adding Contact from: " << (*it).fullName() << oendl; | 267 | odebug << "Adding Contact from: " << (*it).fullName() << oendl; |
264 | if ( doAsk ){ | 268 | if ( doAsk ){ |
265 | switch( QMessageBox::information( this, tr ( "Add Contact?" ), | 269 | switch( QMessageBox::information( this, tr ( "Add Contact?" ), |
266 | tr( "Do you really want add contact for \n%1?" ) | 270 | tr( "Do you really want add contact for \n%1?" ) |
267 | .arg( (*it).fullName().latin1() ), | 271 | .arg( (*it).fullName().latin1() ), |
268 | tr( "&Yes" ), tr( "&No" ), tr( "&All Yes"), | 272 | tr( "&Yes" ), tr( "&No" ), tr( "&All Yes"), |
269 | 0, // Enter == button 0 | 273 | 0, // Enter == button 0 |
270 | 2 ) ) { // Escape == button 2 | 274 | 2 ) ) { // Escape == button 2 |
271 | case 0: | 275 | case 0: |
272 | odebug << "YES clicked" << oendl; | 276 | odebug << "YES clicked" << oendl; |
273 | m_abView->addEntry( *it ); | 277 | m_abView->addEntry( *it ); |
274 | break; | 278 | break; |
275 | case 1: | 279 | case 1: |
276 | odebug << "NO clicked" << oendl; | 280 | odebug << "NO clicked" << oendl; |
277 | break; | 281 | break; |
278 | case 2: | 282 | case 2: |
279 | odebug << "YesAll clicked" << oendl; | 283 | odebug << "YesAll clicked" << oendl; |
280 | doAsk = false; | 284 | doAsk = false; |
281 | break; | 285 | break; |
282 | } | 286 | } |
283 | }else | 287 | }else |
284 | m_abView->addEntry( *it ); | 288 | m_abView->addEntry( *it ); |
285 | 289 | ||
286 | } | 290 | } |
287 | 291 | ||
288 | delete access; | 292 | delete access; |
289 | } | 293 | } |
290 | 294 | ||
291 | void AddressbookWindow::resizeEvent( QResizeEvent *e ) | 295 | void AddressbookWindow::resizeEvent( QResizeEvent *e ) |
292 | { | 296 | { |
293 | QMainWindow::resizeEvent( e ); | 297 | QMainWindow::resizeEvent( e ); |
294 | 298 | ||
295 | 299 | ||
296 | } | 300 | } |
297 | 301 | ||
298 | AddressbookWindow::~AddressbookWindow() | 302 | AddressbookWindow::~AddressbookWindow() |
299 | { | 303 | { |
300 | ToolBarDock dock; | 304 | ToolBarDock dock; |
301 | int dummy; | 305 | int dummy; |
302 | bool bDummy; | 306 | bool bDummy; |
303 | getLocation ( listTools, dock, dummy, bDummy, dummy ); | 307 | getLocation ( listTools, dock, dummy, bDummy, dummy ); |
304 | m_config.setToolBarDock( dock ); | 308 | m_config.setToolBarDock( dock ); |
305 | m_config.save(); | 309 | m_config.save(); |
306 | } | 310 | } |
307 | 311 | ||
308 | int AddressbookWindow::create() | 312 | int AddressbookWindow::create() |
309 | { | 313 | { |
310 | return 0; | 314 | return 0; |
311 | } | 315 | } |
312 | 316 | ||
313 | bool AddressbookWindow::remove( int /*uid*/ ) | 317 | bool AddressbookWindow::remove( int /*uid*/ ) |
314 | { | 318 | { |
315 | return false; | 319 | return false; |
316 | } | 320 | } |
317 | 321 | ||
318 | void AddressbookWindow::beam( int /*uid*/ ) | 322 | void AddressbookWindow::beam( int /*uid*/ ) |
319 | { | 323 | { |
320 | } | 324 | } |
321 | 325 | ||
322 | void AddressbookWindow::show( int /*uid*/ ) | 326 | void AddressbookWindow::show( int /*uid*/ ) |
323 | { | 327 | { |
324 | } | 328 | } |
325 | 329 | ||
326 | void AddressbookWindow::edit( int /*uid*/ ) | 330 | void AddressbookWindow::edit( int /*uid*/ ) |
327 | { | 331 | { |
328 | } | 332 | } |
329 | 333 | ||
330 | void AddressbookWindow::add( const Opie::OPimRecord& ) | 334 | void AddressbookWindow::add( const Opie::OPimRecord& ) |
331 | { | 335 | { |
332 | } | 336 | } |
333 | 337 | ||
334 | void AddressbookWindow::slotItemNew() | 338 | void AddressbookWindow::slotItemNew() |
335 | { | 339 | { |
336 | Opie::OPimContact cnt; | 340 | Opie::OPimContact cnt; |
337 | if( !syncing ) { | 341 | if( !syncing ) { |
338 | editEntry( NewEntry ); | 342 | editEntry( NewEntry ); |
339 | } else { | 343 | } else { |
340 | QMessageBox::warning(this, tr("Contacts"), | 344 | QMessageBox::warning(this, tr("Contacts"), |
341 | tr("Can not edit data, currently syncing")); | 345 | tr("Can not edit data, currently syncing")); |
342 | } | 346 | } |
343 | } | 347 | } |
344 | 348 | ||
345 | void AddressbookWindow::slotItemEdit() | 349 | void AddressbookWindow::slotItemEdit() |
346 | { | 350 | { |
347 | if(!syncing) { | 351 | if(!syncing) { |
348 | if (m_actionPersonal->isOn()) { | 352 | if (m_actionPersonal->isOn()) { |
349 | editPersonal(); | 353 | editPersonal(); |
350 | } else { | 354 | } else { |
351 | editEntry( EditEntry ); | 355 | editEntry( EditEntry ); |
352 | } | 356 | } |
353 | } else { | 357 | } else { |
354 | QMessageBox::warning( this, tr("Contacts"), | 358 | QMessageBox::warning( this, tr("Contacts"), |
355 | tr("Can not edit data, currently syncing") ); | 359 | tr("Can not edit data, currently syncing") ); |
356 | } | 360 | } |
357 | } | 361 | } |
358 | 362 | ||
359 | void AddressbookWindow::slotItemDuplicate() | 363 | void AddressbookWindow::slotItemDuplicate() |
360 | { | 364 | { |
361 | if(!syncing) | 365 | if(!syncing) |
362 | { | 366 | { |
363 | Opie::OPimContact entry = m_abView->currentEntry(); | 367 | Opie::OPimContact entry = m_abView->currentEntry(); |
364 | entry.assignUid(); | 368 | entry.assignUid(); |
365 | m_abView->addEntry( entry ); | 369 | m_abView->addEntry( entry ); |
366 | m_abView->setCurrentUid( entry.uid() ); | 370 | m_abView->setCurrentUid( entry.uid() ); |
367 | } | 371 | } |
368 | else | 372 | else |
369 | { | 373 | { |
370 | QMessageBox::warning( this, tr("Contacts"), | 374 | QMessageBox::warning( this, tr("Contacts"), |
371 | tr("Can not edit data, currently syncing") ); | 375 | tr("Can not edit data, currently syncing") ); |
372 | } | 376 | } |
373 | } | 377 | } |
374 | 378 | ||
375 | void AddressbookWindow::slotItemDelete() | 379 | void AddressbookWindow::slotItemDelete() |
376 | { | 380 | { |
377 | if(!syncing) { | 381 | if(!syncing) { |
378 | Opie::OPimContact tmpEntry = m_abView ->currentEntry(); | 382 | Opie::OPimContact tmpEntry = m_abView ->currentEntry(); |
379 | 383 | ||
380 | // get a name, do the best we can... | 384 | // get a name, do the best we can... |
381 | QString strName = tmpEntry.fullName(); | 385 | QString strName = tmpEntry.fullName(); |
382 | if ( strName.isEmpty() ) { | 386 | if ( strName.isEmpty() ) { |
383 | strName = tmpEntry.company(); | 387 | strName = tmpEntry.company(); |
384 | if ( strName.isEmpty() ) | 388 | if ( strName.isEmpty() ) |
385 | strName = "No Name"; | 389 | strName = "No Name"; |
386 | } | 390 | } |
387 | 391 | ||
388 | 392 | ||
389 | if ( QPEMessageBox::confirmDelete( this, tr( "Contacts" ), | 393 | if ( QPEMessageBox::confirmDelete( this, tr( "Contacts" ), |
390 | strName ) ) { | 394 | strName ) ) { |
391 | m_abView->removeEntry( tmpEntry.uid() ); | 395 | m_abView->removeEntry( tmpEntry.uid() ); |
392 | } | 396 | } |
393 | } else { | 397 | } else { |
394 | QMessageBox::warning( this, tr("Contacts"), | 398 | QMessageBox::warning( this, tr("Contacts"), |
395 | tr("Can not edit data, currently syncing") ); | 399 | tr("Can not edit data, currently syncing") ); |
396 | } | 400 | } |
397 | } | 401 | } |
398 | 402 | ||
399 | static const char * beamfile = "/tmp/obex/contact.vcf"; | 403 | static const char * beamfile = "/tmp/obex/contact.vcf"; |
400 | 404 | ||
401 | void AddressbookWindow::slotItemBeam() | 405 | void AddressbookWindow::slotItemBeam() |
402 | { | 406 | { |
403 | QString beamFilename; | 407 | QString beamFilename; |
404 | Opie::OPimContact c; | 408 | Opie::OPimContact c; |
405 | if ( m_actionPersonal->isOn() ) { | 409 | if ( m_actionPersonal->isOn() ) { |
406 | beamFilename = addressbookPersonalVCardName(); | 410 | beamFilename = addressbookPersonalVCardName(); |
407 | if ( !QFile::exists( beamFilename ) ) | 411 | if ( !QFile::exists( beamFilename ) ) |
408 | return; // can't beam a non-existent file | 412 | return; // can't beam a non-existent file |
409 | Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, | 413 | Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, |
410 | beamFilename ); | 414 | beamFilename ); |
411 | Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); | 415 | Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); |
412 | Opie::OPimContactAccess::List allList = access->allRecords(); | 416 | Opie::OPimContactAccess::List allList = access->allRecords(); |
413 | Opie::OPimContactAccess::List::Iterator it = allList.begin(); // Just take first | 417 | Opie::OPimContactAccess::List::Iterator it = allList.begin(); // Just take first |
414 | c = *it; | 418 | c = *it; |
415 | 419 | ||
416 | delete access; | 420 | delete access; |
417 | } else { | 421 | } else { |
418 | unlink( beamfile ); // delete if exists | 422 | unlink( beamfile ); // delete if exists |
419 | mkdir("/tmp/obex/", 0755); | 423 | mkdir("/tmp/obex/", 0755); |
420 | c = m_abView -> currentEntry(); | 424 | c = m_abView -> currentEntry(); |
421 | Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, | 425 | Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, |
422 | beamfile ); | 426 | beamfile ); |
423 | Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); | 427 | Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); |
424 | access->add( c ); | 428 | access->add( c ); |
425 | access->save(); | 429 | access->save(); |
426 | delete access; | 430 | delete access; |
427 | 431 | ||
428 | beamFilename = beamfile; | 432 | beamFilename = beamfile; |
429 | } | 433 | } |
430 | 434 | ||
431 | odebug << "Beaming: " << beamFilename << oendl; | 435 | odebug << "Beaming: " << beamFilename << oendl; |
432 | 436 | ||
433 | Ir *ir = new Ir( this ); | 437 | Ir *ir = new Ir( this ); |
434 | connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); | 438 | connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); |
435 | QString description = c.fullName(); | 439 | QString description = c.fullName(); |
436 | ir->send( beamFilename, description, "text/x-vCard" ); | 440 | ir->send( beamFilename, description, "text/x-vCard" ); |
437 | } | 441 | } |
438 | 442 | ||
439 | void AddressbookWindow::slotItemFind() | 443 | void AddressbookWindow::slotItemFind() |
440 | { | 444 | { |
441 | } | 445 | } |
442 | 446 | ||
443 | void AddressbookWindow::slotConfigure() | 447 | void AddressbookWindow::slotConfigure() |
444 | { | 448 | { |
445 | ConfigDlg* dlg = new ConfigDlg( this, "Config" ); | 449 | ConfigDlg* dlg = new ConfigDlg( this, "Config" ); |
446 | dlg -> setConfig( m_config ); | 450 | dlg -> setConfig( m_config ); |
447 | if ( QPEApplication::execDialog( dlg ) ) { | 451 | if ( QPEApplication::execDialog( dlg ) ) { |
448 | odebug << "Config Dialog accepted!" << oendl; | 452 | odebug << "Config Dialog accepted!" << oendl; |
449 | m_config = dlg -> getConfig(); | 453 | m_config = dlg -> getConfig(); |
450 | if ( m_curFontSize != m_config.fontSize() ){ | 454 | if ( m_curFontSize != m_config.fontSize() ){ |
451 | odebug << "Font was changed!" << oendl; | 455 | odebug << "Font was changed!" << oendl; |
452 | m_curFontSize = m_config.fontSize(); | 456 | m_curFontSize = m_config.fontSize(); |
453 | emit slotSetFont( m_curFontSize ); | 457 | emit slotSetFont( m_curFontSize ); |
454 | } | 458 | } |
455 | m_abView -> setListOrder( m_config.orderList() ); | 459 | m_abView -> setListOrder( m_config.orderList() ); |
456 | } | 460 | } |
457 | 461 | ||
458 | delete dlg; | 462 | delete dlg; |
459 | } | 463 | } |
460 | 464 | ||
461 | void AddressbookWindow::slotShowFind( bool show ) | 465 | void AddressbookWindow::slotShowFind( bool show ) |
462 | { | 466 | { |
463 | if ( show ) | 467 | if ( show ) |
464 | { | 468 | { |
465 | // Display search bar | 469 | // Display search bar |
466 | m_searchBar->show(); | 470 | m_searchBar->show(); |
467 | m_abView -> inSearch(); | 471 | m_abView -> inSearch(); |
468 | m_searchEdit->setFocus(); | 472 | m_searchEdit->setFocus(); |
469 | } | 473 | } |
470 | else | 474 | else |
471 | { | 475 | { |
472 | // Hide search bar | 476 | // Hide search bar |
473 | m_searchBar->hide(); | 477 | m_searchBar->hide(); |
474 | m_abView -> offSearch(); | 478 | m_abView -> offSearch(); |
475 | } | 479 | } |
476 | } | 480 | } |
477 | 481 | ||
478 | void AddressbookWindow::slotFind() | 482 | void AddressbookWindow::slotFind() |
479 | { | 483 | { |
480 | m_abView->slotDoFind( m_searchEdit->text(), m_config.beCaseSensitive(), m_config.useRegExp(), false); | 484 | m_abView->slotDoFind( m_searchEdit->text(), m_config.beCaseSensitive(), m_config.useRegExp(), false); |
481 | 485 | ||
482 | m_searchEdit->clearFocus(); | 486 | m_searchEdit->clearFocus(); |
483 | // m_abView->setFocus(); | 487 | // m_abView->setFocus(); |
484 | 488 | ||
485 | } | 489 | } |
486 | 490 | ||
487 | void AddressbookWindow::slotViewBack() | 491 | void AddressbookWindow::slotViewBack() |
488 | { | 492 | { |
489 | // :SX showList(); | 493 | // :SX showList(); |
490 | } | 494 | } |
491 | 495 | ||
492 | void AddressbookWindow::writeMail() | 496 | void AddressbookWindow::writeMail() |
493 | { | 497 | { |
494 | Opie::OPimContact c = m_abView -> currentEntry(); | 498 | Opie::OPimContact c = m_abView -> currentEntry(); |
495 | QString name = c.fileAs(); | 499 | QString name = c.fileAs(); |
496 | QString email = c.defaultEmail(); | 500 | QString email = c.defaultEmail(); |
497 | 501 | ||
498 | // I prefer the OPIE-Environment variable before the | 502 | // I prefer the OPIE-Environment variable before the |
499 | // QPE-one.. | 503 | // QPE-one.. |
500 | QString basepath = QString::fromLatin1( getenv("OPIEDIR") ); | 504 | QString basepath = QString::fromLatin1( getenv("OPIEDIR") ); |
501 | if ( basepath.isEmpty() ) | 505 | if ( basepath.isEmpty() ) |
502 | basepath = QString::fromLatin1( getenv("QPEDIR") ); | 506 | basepath = QString::fromLatin1( getenv("QPEDIR") ); |
503 | 507 | ||
504 | // Try to access the preferred. If not possible, try to | 508 | // Try to access the preferred. If not possible, try to |
505 | // switch to the other one.. | 509 | // switch to the other one.. |
506 | if ( m_config.useQtMail() ){ | 510 | if ( m_config.useQtMail() ){ |
507 | odebug << "Accessing: " << (basepath + "/bin/qtmail") << oendl; | 511 | odebug << "Accessing: " << (basepath + "/bin/qtmail") << oendl; |
508 | if ( QFile::exists( basepath + "/bin/qtmail" ) ){ | 512 | if ( QFile::exists( basepath + "/bin/qtmail" ) ){ |
509 | odebug << "QCop" << oendl; | 513 | odebug << "QCop" << oendl; |
510 | QCopEnvelope e("QPE/Application/qtmail", "writeMail(QString,QString)"); | 514 | QCopEnvelope e("QPE/Application/qtmail", "writeMail(QString,QString)"); |
511 | e << name << email; | 515 | e << name << email; |
512 | return; | 516 | return; |
513 | } else | 517 | } else |
514 | m_config.setUseOpieMail( true ); | 518 | m_config.setUseOpieMail( true ); |
515 | } | 519 | } |
516 | if ( m_config.useOpieMail() ){ | 520 | if ( m_config.useOpieMail() ){ |
517 | odebug << "Accessing: " << (basepath + "/bin/opiemail") << oendl; | 521 | odebug << "Accessing: " << (basepath + "/bin/opiemail") << oendl; |
518 | if ( QFile::exists( basepath + "/bin/opiemail" ) ){ | 522 | if ( QFile::exists( basepath + "/bin/opiemail" ) ){ |
519 | odebug << "QCop" << oendl; | 523 | odebug << "QCop" << oendl; |
520 | QCopEnvelope e("QPE/Application/opiemail", "writeMail(QString,QString)"); | 524 | QCopEnvelope e("QPE/Application/opiemail", "writeMail(QString,QString)"); |
521 | e << name << email; | 525 | e << name << email; |
522 | return; | 526 | return; |
523 | } else | 527 | } else |
524 | m_config.setUseQtMail( true ); | 528 | m_config.setUseQtMail( true ); |
525 | } | 529 | } |
526 | 530 | ||
527 | } | 531 | } |
528 | 532 | ||
529 | void AddressbookWindow::beamDone( Ir *ir ) | 533 | void AddressbookWindow::beamDone( Ir *ir ) |
530 | { | 534 | { |
531 | 535 | ||
532 | delete ir; | 536 | delete ir; |
533 | unlink( beamfile ); | 537 | unlink( beamfile ); |
534 | } | 538 | } |
535 | 539 | ||
536 | 540 | ||
537 | static void parseName( const QString& name, QString *first, QString *middle, | 541 | static void parseName( const QString& name, QString *first, QString *middle, |
538 | QString * last ) | 542 | QString * last ) |
539 | { | 543 | { |
540 | 544 | ||
541 | int comma = name.find ( "," ); | 545 | int comma = name.find ( "," ); |
542 | QString rest; | 546 | QString rest; |
543 | if ( comma > 0 ) { | 547 | if ( comma > 0 ) { |
544 | *last = name.left( comma ); | 548 | *last = name.left( comma ); |
545 | comma++; | 549 | comma++; |
546 | while ( comma < int(name.length()) && name[comma] == ' ' ) | 550 | while ( comma < int(name.length()) && name[comma] == ' ' ) |
547 | comma++; | 551 | comma++; |
548 | rest = name.mid( comma ); | 552 | rest = name.mid( comma ); |
549 | } else { | 553 | } else { |
550 | int space = name.findRev( ' ' ); | 554 | int space = name.findRev( ' ' ); |
551 | *last = name.mid( space+1 ); | 555 | *last = name.mid( space+1 ); |
552 | rest = name.left( space ); | 556 | rest = name.left( space ); |
553 | } | 557 | } |
554 | int space = rest.find( ' ' ); | 558 | int space = rest.find( ' ' ); |
555 | if ( space <= 0 ) { | 559 | if ( space <= 0 ) { |
556 | *first = rest; | 560 | *first = rest; |
557 | } else { | 561 | } else { |
558 | *first = rest.left( space ); | 562 | *first = rest.left( space ); |
559 | *middle = rest.mid( space+1 ); | 563 | *middle = rest.mid( space+1 ); |
560 | } | 564 | } |
561 | 565 | ||
562 | } | 566 | } |
563 | 567 | ||
564 | 568 | ||
565 | void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data) | 569 | void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data) |
566 | { | 570 | { |
567 | bool needShow = false; | 571 | bool needShow = false; |
568 | odebug << "Receiving QCop-Call with message " << msg << oendl; | 572 | odebug << "Receiving QCop-Call with message " << msg << oendl; |
569 | 573 | ||
570 | 574 | ||
571 | if (msg == "editPersonal()") { | 575 | if (msg == "editPersonal()") { |
572 | editPersonal(); | 576 | editPersonal(); |
573 | 577 | ||
574 | // Categories might have changed, so reload | 578 | // Categories might have changed, so reload |
575 | reloadCategories(); | 579 | reloadCategories(); |
576 | } else if (msg == "editPersonalAndClose()") { | 580 | } else if (msg == "editPersonalAndClose()") { |
577 | editPersonal(); | 581 | editPersonal(); |
578 | close(); | 582 | close(); |
579 | } else if ( msg == "addContact(QString,QString)" ) { | 583 | } else if ( msg == "addContact(QString,QString)" ) { |
580 | QDataStream stream(data,IO_ReadOnly); | 584 | QDataStream stream(data,IO_ReadOnly); |
581 | QString name, email; | 585 | QString name, email; |
582 | stream >> name >> email; | 586 | stream >> name >> email; |
583 | 587 | ||
584 | Opie::OPimContact cnt; | 588 | Opie::OPimContact cnt; |
585 | QString fn, mn, ln; | 589 | QString fn, mn, ln; |
586 | parseName( name, &fn, &mn, &ln ); | 590 | parseName( name, &fn, &mn, &ln ); |
587 | //odebug << " " << fn << " - " << mn " - " << ln << oendl; | 591 | //odebug << " " << fn << " - " << mn " - " << ln << oendl; |
588 | cnt.setFirstName( fn ); | 592 | cnt.setFirstName( fn ); |
589 | cnt.setMiddleName( mn ); | 593 | cnt.setMiddleName( mn ); |
590 | cnt.setLastName( ln ); | 594 | cnt.setLastName( ln ); |
591 | cnt.insertEmails( email ); | 595 | cnt.insertEmails( email ); |
592 | cnt.setDefaultEmail( email ); | 596 | cnt.setDefaultEmail( email ); |
593 | cnt.setFileAs(); | 597 | cnt.setFileAs(); |
594 | 598 | ||
595 | m_abView -> addEntry( cnt ); | 599 | m_abView -> addEntry( cnt ); |
596 | 600 | ||
597 | // :SXm_abView()->init( cnt ); | 601 | // :SXm_abView()->init( cnt ); |
598 | editEntry( EditEntry ); | 602 | editEntry( EditEntry ); |
599 | 603 | ||
600 | // Categories might have changed, so reload | 604 | // Categories might have changed, so reload |
601 | reloadCategories(); | 605 | reloadCategories(); |
602 | } else if ( msg == "beamBusinessCard()" ) { | 606 | } else if ( msg == "beamBusinessCard()" ) { |
603 | QString beamFilename = addressbookPersonalVCardName(); | 607 | QString beamFilename = addressbookPersonalVCardName(); |
604 | if ( !QFile::exists( beamFilename ) ) | 608 | if ( !QFile::exists( beamFilename ) ) |
605 | return; // can't beam a non-existent file | 609 | return; // can't beam a non-existent file |
606 | 610 | ||
607 | Ir *ir = new Ir( this ); | 611 | Ir *ir = new Ir( this ); |
608 | connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); | 612 | connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); |
609 | QString description = "mycard.vcf"; | 613 | QString description = "mycard.vcf"; |
610 | ir->send( beamFilename, description, "text/x-vCard" ); | 614 | ir->send( beamFilename, description, "text/x-vCard" ); |
611 | } else if ( msg == "show(int)" ) { | 615 | } else if ( msg == "show(int)" ) { |
612 | raise(); | 616 | raise(); |
613 | QDataStream stream(data,IO_ReadOnly); | 617 | QDataStream stream(data,IO_ReadOnly); |
614 | int uid; | 618 | int uid; |
615 | stream >> uid; | 619 | stream >> uid; |
616 | 620 | ||
617 | odebug << "Showing uid: " << uid << oendl; | 621 | odebug << "Showing uid: " << uid << oendl; |
618 | 622 | ||
619 | // Deactivate Personal View.. | 623 | // Deactivate Personal View.. |
620 | if ( m_actionPersonal->isOn() ){ | 624 | if ( m_actionPersonal->isOn() ){ |
621 | m_actionPersonal->setOn( false ); | 625 | m_actionPersonal->setOn( false ); |
622 | slotPersonalView(); | 626 | slotPersonalView(); |
623 | } | 627 | } |
624 | 628 | ||
625 | // Reset category and show as card.. | 629 | // Reset category and show as card.. |
626 | m_abView -> setShowByCategory( QString::null ); | 630 | m_abView -> setShowByCategory( QString::null ); |
627 | m_abView -> setCurrentUid( uid ); | 631 | m_abView -> setCurrentUid( uid ); |
628 | slotViewSwitched ( AbView::CardView ); | 632 | slotViewSwitched ( AbView::CardView ); |
629 | 633 | ||
630 | needShow = true; | 634 | needShow = true; |
631 | 635 | ||
632 | 636 | ||
633 | } else if ( msg == "edit(int)" ) { | 637 | } else if ( msg == "edit(int)" ) { |
634 | QDataStream stream(data,IO_ReadOnly); | 638 | QDataStream stream(data,IO_ReadOnly); |
635 | int uid; | 639 | int uid; |
636 | stream >> uid; | 640 | stream >> uid; |
637 | 641 | ||
638 | // Deactivate Personal View.. | 642 | // Deactivate Personal View.. |
639 | if ( m_actionPersonal->isOn() ){ | 643 | if ( m_actionPersonal->isOn() ){ |
640 | m_actionPersonal->setOn( false ); | 644 | m_actionPersonal->setOn( false ); |
641 | slotPersonalView(); | 645 | slotPersonalView(); |
642 | } | 646 | } |
643 | 647 | ||
644 | // Reset category and edit.. | 648 | // Reset category and edit.. |
645 | m_abView -> setShowByCategory( QString::null ); | 649 | m_abView -> setShowByCategory( QString::null ); |
646 | m_abView -> setCurrentUid( uid ); | 650 | m_abView -> setCurrentUid( uid ); |
647 | slotItemEdit(); | 651 | slotItemEdit(); |
648 | 652 | ||
649 | // Categories might have changed, so reload | 653 | // Categories might have changed, so reload |
650 | reloadCategories(); | 654 | reloadCategories(); |
651 | } | 655 | } |
652 | 656 | ||
653 | if (needShow) | 657 | if (needShow) |
654 | QPEApplication::setKeepRunning(); | 658 | QPEApplication::setKeepRunning(); |
655 | } | 659 | } |
656 | 660 | ||
657 | void AddressbookWindow::editEntry( EntryMode entryMode ) | 661 | void AddressbookWindow::editEntry( EntryMode entryMode ) |
658 | { | 662 | { |
659 | Opie::OPimContact entry; | 663 | Opie::OPimContact entry; |
660 | if ( !abEditor ) { | 664 | if ( !abEditor ) { |
661 | abEditor = new ContactEditor( entry, this, "editor" ); | 665 | abEditor = new ContactEditor( entry, this, "editor" ); |
662 | } | 666 | } |
663 | if ( entryMode == EditEntry ) | 667 | if ( entryMode == EditEntry ) |
664 | abEditor->setEntry( m_abView -> currentEntry() ); | 668 | abEditor->setEntry( m_abView -> currentEntry() ); |
665 | else if ( entryMode == NewEntry ) | 669 | else if ( entryMode == NewEntry ) |
666 | abEditor->setEntry( entry ); | 670 | abEditor->setEntry( entry ); |
667 | 671 | ||
668 | // Set the dialog caption | 672 | // Set the dialog caption |
669 | if ( m_actionPersonal->isOn() ) | 673 | if ( m_actionPersonal->isOn() ) |
670 | abEditor->setCaption( tr( "Edit My Personal Details" ) ); | 674 | abEditor->setCaption( tr( "Edit My Personal Details" ) ); |
671 | else | 675 | else |
672 | abEditor->setCaption( tr( "Edit Contact" ) ); | 676 | abEditor->setCaption( tr( "Edit Contact" ) ); |
673 | 677 | ||
674 | // fix the focus... | 678 | // fix the focus... |
675 | abEditor->setNameFocus(); | 679 | abEditor->setNameFocus(); |
676 | if ( QPEApplication::execDialog( abEditor ) == QDialog::Accepted ) { | 680 | if ( QPEApplication::execDialog( abEditor ) == QDialog::Accepted ) { |
677 | setFocus(); | 681 | setFocus(); |
678 | if ( entryMode == NewEntry ) { | 682 | if ( entryMode == NewEntry ) { |
679 | Opie::OPimContact insertEntry = abEditor->entry(); | 683 | Opie::OPimContact insertEntry = abEditor->entry(); |
680 | insertEntry.assignUid(); | 684 | insertEntry.assignUid(); |
681 | m_abView -> addEntry( insertEntry ); | 685 | m_abView -> addEntry( insertEntry ); |
682 | m_abView -> setCurrentUid( insertEntry.uid() ); | 686 | m_abView -> setCurrentUid( insertEntry.uid() ); |
683 | } else { | 687 | } else { |
684 | Opie::OPimContact replEntry = abEditor->entry(); | 688 | Opie::OPimContact replEntry = abEditor->entry(); |
685 | 689 | ||
686 | if ( !replEntry.isValidUid() ) | 690 | if ( !replEntry.isValidUid() ) |
687 | replEntry.assignUid(); | 691 | replEntry.assignUid(); |
688 | 692 | ||
689 | m_abView -> replaceEntry( replEntry ); | 693 | m_abView -> replaceEntry( replEntry ); |
690 | } | 694 | } |
691 | 695 | ||
692 | // Categories might have changed, so reload | 696 | // Categories might have changed, so reload |
693 | reloadCategories(); | 697 | reloadCategories(); |
694 | } | 698 | } |
695 | } | 699 | } |
696 | 700 | ||
697 | void AddressbookWindow::editPersonal() | 701 | void AddressbookWindow::editPersonal() |
698 | { | 702 | { |
699 | Opie::OPimContact entry; | 703 | Opie::OPimContact entry; |
700 | 704 | ||
701 | // Switch to personal view if not selected | 705 | // Switch to personal view if not selected |
702 | // but take care of the menu, too | 706 | // but take care of the menu, too |
703 | if ( ! m_actionPersonal->isOn() ){ | 707 | if ( ! m_actionPersonal->isOn() ){ |
704 | odebug << "*** ++++" << oendl; | 708 | odebug << "*** ++++" << oendl; |
705 | m_actionPersonal->setOn( true ); | 709 | m_actionPersonal->setOn( true ); |
706 | slotPersonalView(); | 710 | slotPersonalView(); |
707 | } | 711 | } |
708 | 712 | ||
709 | if ( !abEditor ) { | 713 | if ( !abEditor ) { |
710 | abEditor = new ContactEditor( entry, this, "editor" ); | 714 | abEditor = new ContactEditor( entry, this, "editor" ); |
711 | } | 715 | } |
712 | 716 | ||
713 | abEditor->setPersonalView( true ); | 717 | abEditor->setPersonalView( true ); |
714 | editEntry( EditEntry ); | 718 | editEntry( EditEntry ); |
715 | abEditor->setPersonalView( false ); | 719 | abEditor->setPersonalView( false ); |
716 | 720 | ||
717 | } | 721 | } |
718 | 722 | ||
719 | 723 | ||
720 | void AddressbookWindow::slotPersonalView() | 724 | void AddressbookWindow::slotPersonalView() |
721 | { | 725 | { |
722 | odebug << "slotPersonalView()" << oendl; | 726 | odebug << "slotPersonalView()" << oendl; |
723 | 727 | ||
724 | bool personal = m_actionPersonal->isOn(); | 728 | bool personal = m_actionPersonal->isOn(); |
725 | 729 | ||
726 | // Disable actions when showing personal details | 730 | // Disable actions when showing personal details |
727 | setItemNewEnabled( !personal ); | 731 | setItemNewEnabled( !personal ); |
728 | setItemDuplicateEnabled( !personal ); | 732 | setItemDuplicateEnabled( !personal ); |
729 | setItemDeleteEnabled( !personal ); | 733 | setItemDeleteEnabled( !personal ); |
730 | m_actionMail->setEnabled( !personal ); | 734 | m_actionMail->setEnabled( !personal ); |
731 | setShowCategories( !personal ); | 735 | setShowCategories( !personal ); |
732 | 736 | ||
733 | // Display appropriate view | 737 | // Display appropriate view |
734 | m_abView->showPersonal( personal ); | 738 | m_abView->showPersonal( personal ); |
735 | 739 | ||
736 | if ( personal ) | 740 | if ( personal ) |
737 | { | 741 | { |
738 | setCaption( tr( "Contacts - My Personal Details") ); | 742 | setCaption( tr( "Contacts - My Personal Details") ); |
739 | 743 | ||
740 | // Set category to 'All' to make sure personal details is visible | 744 | // Set category to 'All' to make sure personal details is visible |
741 | setViewCategory( "All" ); | 745 | setViewCategory( "All" ); |
742 | m_abView->setShowByCategory( "All" ); | 746 | m_abView->setShowByCategory( "All" ); |
743 | 747 | ||
744 | // Temporarily disable letter picker | 748 | // Temporarily disable letter picker |
745 | pLabel->hide(); | 749 | pLabel->hide(); |
746 | } | 750 | } |
747 | else | 751 | else |
748 | { | 752 | { |
749 | setCaption( tr( "Contacts") ); | 753 | setCaption( tr( "Contacts") ); |
750 | 754 | ||
751 | // Re-enable letter picker | 755 | // Re-enable letter picker |
752 | pLabel->show(); | 756 | pLabel->show(); |
753 | } | 757 | } |
754 | } | 758 | } |
755 | 759 | ||
756 | void AddressbookWindow::reload() | 760 | void AddressbookWindow::reload() |
757 | { | 761 | { |
758 | syncing = false; | 762 | syncing = false; |
759 | m_abView->clear(); | 763 | m_abView->clear(); |
760 | m_abView->reload(); | 764 | m_abView->reload(); |
761 | } | 765 | } |
762 | 766 | ||
763 | void AddressbookWindow::flush() | 767 | void AddressbookWindow::flush() |
764 | { | 768 | { |
765 | syncing = true; | 769 | syncing = true; |
766 | m_abView->save(); | 770 | m_abView->save(); |
767 | } | 771 | } |
768 | 772 | ||
769 | 773 | ||
770 | void AddressbookWindow::closeEvent( QCloseEvent *e ) | 774 | void AddressbookWindow::closeEvent( QCloseEvent *e ) |
771 | { | 775 | { |
772 | if ( active_view == AbView::CardView ) | 776 | if ( active_view == AbView::CardView ) |
773 | { | 777 | { |
774 | if ( !m_actionPersonal->isOn() ) | 778 | if ( !m_actionPersonal->isOn() ) |
775 | { | 779 | { |
776 | // Switch to table view only if not editing personal details | 780 | // Switch to table view only if not editing personal details |
777 | slotViewSwitched( AbView::TableView ); | 781 | slotViewSwitched( AbView::TableView ); |
778 | } | 782 | } |
779 | else | 783 | else |
780 | { | 784 | { |
781 | // If currently editing personal details, switch off personal view | 785 | // If currently editing personal details, switch off personal view |
782 | m_actionPersonal->setOn( false ); | 786 | m_actionPersonal->setOn( false ); |
783 | slotPersonalView(); | 787 | slotPersonalView(); |
784 | } | 788 | } |
785 | 789 | ||
786 | e->ignore(); | 790 | e->ignore(); |
787 | return; | 791 | return; |
788 | } | 792 | } |
789 | if(syncing) { | 793 | if(syncing) { |
790 | /* shouldn't we save, I hear you say? well its already been set | 794 | /* shouldn't we save, I hear you say? well its already been set |
791 | so that an edit can not occur during a sync, and we flushed | 795 | so that an edit can not occur during a sync, and we flushed |
792 | at the start of the sync, so there is no need to save | 796 | at the start of the sync, so there is no need to save |
793 | Saving however itself would cause problems. */ | 797 | Saving however itself would cause problems. */ |
794 | e->accept(); | 798 | e->accept(); |
795 | return; | 799 | return; |
796 | } | 800 | } |
797 | //################## shouldn't always save | 801 | //################## shouldn't always save |
798 | // True, but the database handles this automatically ! (se) | 802 | // True, but the database handles this automatically ! (se) |
799 | if ( save() ) | 803 | if ( save() ) |
800 | e->accept(); | 804 | e->accept(); |
801 | else | 805 | else |
802 | e->ignore(); | 806 | e->ignore(); |
803 | } | 807 | } |
804 | 808 | ||
805 | /* | 809 | /* |
806 | Returns true if it is OK to exit | 810 | Returns true if it is OK to exit |
807 | */ | 811 | */ |
808 | 812 | ||
809 | bool AddressbookWindow::save() | 813 | bool AddressbookWindow::save() |
810 | { | 814 | { |
811 | if ( !m_abView->save() ) { | 815 | if ( !m_abView->save() ) { |
812 | if ( QMessageBox::critical( 0, tr( "Out of space" ), | 816 | if ( QMessageBox::critical( 0, tr( "Out of space" ), |
813 | tr("Unable to save information.\n" | 817 | tr("Unable to save information.\n" |
814 | "Free up some space\n" | 818 | "Free up some space\n" |
815 | "and try again.\n" | 819 | "and try again.\n" |
816 | "\nQuit anyway?"), | 820 | "\nQuit anyway?"), |
817 | QMessageBox::Yes|QMessageBox::Escape, | 821 | QMessageBox::Yes|QMessageBox::Escape, |
818 | QMessageBox::No|QMessageBox::Default ) | 822 | QMessageBox::No|QMessageBox::Default ) |
819 | != QMessageBox::No ) | 823 | != QMessageBox::No ) |
820 | return true; | 824 | return true; |
821 | else | 825 | else |
822 | return false; | 826 | return false; |
823 | } | 827 | } |
824 | return true; | 828 | return true; |
825 | } | 829 | } |
826 | 830 | ||
827 | #ifdef __DEBUG_RELEASE | 831 | #ifdef __DEBUG_RELEASE |
828 | void AddressbookWindow::slotSave() | 832 | void AddressbookWindow::slotSave() |
829 | { | 833 | { |
830 | save(); | 834 | save(); |
831 | } | 835 | } |
832 | #endif | 836 | #endif |
833 | 837 | ||
834 | 838 | ||
835 | void AddressbookWindow::slotNotFound() | 839 | void AddressbookWindow::slotNotFound() |
836 | { | 840 | { |
837 | odebug << "Got not found signal!" << oendl; | 841 | odebug << "Got not found signal!" << oendl; |
838 | QMessageBox::information( this, tr( "Not Found" ), | 842 | QMessageBox::information( this, tr( "Not Found" ), |
839 | "<qt>" + tr( "Unable to find a contact for this search pattern!" ) + "</qt>" ); | 843 | "<qt>" + tr( "Unable to find a contact for this search pattern!" ) + "</qt>" ); |
840 | 844 | ||
841 | 845 | ||
842 | } | 846 | } |
843 | void AddressbookWindow::slotWrapAround() | 847 | void AddressbookWindow::slotWrapAround() |
844 | { | 848 | { |
845 | odebug << "Got wrap signal!" << oendl; | 849 | odebug << "Got wrap signal!" << oendl; |
846 | // if ( doNotifyWrapAround ) | 850 | // if ( doNotifyWrapAround ) |
847 | // QMessageBox::information( this, tr( "End of list" ), | 851 | // QMessageBox::information( this, tr( "End of list" ), |
848 | // tr( "End of list. Wrap around now...!" ) + "\n" ); | 852 | // tr( "End of list. Wrap around now...!" ) + "\n" ); |
849 | 853 | ||
850 | } | 854 | } |
851 | 855 | ||
852 | void AddressbookWindow::slotSetCategory( const QString &category ) | 856 | void AddressbookWindow::slotSetCategory( const QString &category ) |
853 | { | 857 | { |
854 | odebug << "void AddressbookWindow::slotSetCategory( " << category << " )" << oendl; | 858 | odebug << "void AddressbookWindow::slotSetCategory( " << category << " )" << oendl; |
855 | 859 | ||
856 | // Tell the view about the selected category | 860 | // Tell the view about the selected category |
857 | QString cat = category; | 861 | QString cat = category; |
858 | if ( cat == tr( "All" ) ) | 862 | if ( cat == tr( "All" ) ) |
859 | cat = QString::null; | 863 | cat = QString::null; |
860 | m_config.setCategory( cat ); | 864 | m_config.setCategory( cat ); |
861 | m_abView -> setShowByCategory( cat ); | 865 | m_abView -> setShowByCategory( cat ); |
862 | } | 866 | } |
863 | 867 | ||
864 | void AddressbookWindow::slotViewSwitched( int view ) | 868 | void AddressbookWindow::slotViewSwitched( int view ) |
865 | { | 869 | { |
866 | odebug << "void AddressbookWindow::slotViewSwitched( " << view << " )" << oendl; | 870 | odebug << "void AddressbookWindow::slotViewSwitched( " << view << " )" << oendl; |
867 | 871 | ||
868 | // Tell the view about the selected view | 872 | // Tell the view about the selected view |
869 | m_abView -> setShowToView ( (AbView::Views) view ); | 873 | m_abView -> setShowToView ( (AbView::Views) view ); |
870 | active_view = view; | 874 | active_view = view; |
871 | } | 875 | } |
872 | 876 | ||
873 | 877 | ||
874 | void AddressbookWindow::slotListView() | 878 | void AddressbookWindow::slotListView() |
875 | { | 879 | { |
876 | slotViewSwitched( AbView::TableView ); | 880 | slotViewSwitched( AbView::TableView ); |
877 | } | 881 | } |
878 | 882 | ||
879 | void AddressbookWindow::slotCardView() | 883 | void AddressbookWindow::slotCardView() |
880 | { | 884 | { |
881 | slotViewSwitched( AbView::CardView ); | 885 | slotViewSwitched( AbView::CardView ); |
882 | } | 886 | } |
883 | 887 | ||
884 | void AddressbookWindow::slotSetLetter( char c ) { | 888 | void AddressbookWindow::slotSetLetter( char c ) { |
885 | 889 | ||
886 | m_abView->setShowByLetter( c, m_config.letterPickerSearch() ); | 890 | m_abView->setShowByLetter( c, m_config.letterPickerSearch() ); |
887 | 891 | ||
888 | } | 892 | } |
889 | 893 | ||
diff --git a/core/pim/addressbook/configdlg.cpp b/core/pim/addressbook/configdlg.cpp index 61e6c7e..a491fc7 100644 --- a/core/pim/addressbook/configdlg.cpp +++ b/core/pim/addressbook/configdlg.cpp | |||
@@ -1,154 +1,153 @@ | |||
1 | #include "configdlg.h" | 1 | #include "configdlg.h" |
2 | 2 | ||
3 | #include <opie2/odebug.h> | 3 | #include <opie2/odebug.h> |
4 | #include <opie2/opimcontact.h> | 4 | #include <opie2/opimcontact.h> |
5 | #include "opie2/opimcontactfields.h" | 5 | #include <opie2/opimcontactfields.h> |
6 | 6 | #include <opie2/oresource.h> | |
7 | #include <qpe/resource.h> | ||
8 | 7 | ||
9 | #include <qcheckbox.h> | 8 | #include <qcheckbox.h> |
10 | #include <qradiobutton.h> | 9 | #include <qradiobutton.h> |
11 | #include <qlistbox.h> | 10 | #include <qlistbox.h> |
12 | #include <qpushbutton.h> | 11 | #include <qpushbutton.h> |
13 | 12 | ||
14 | ConfigDlg::ConfigDlg( QWidget *parent, const char *name): | 13 | ConfigDlg::ConfigDlg( QWidget *parent, const char *name): |
15 | ConfigDlg_Base(parent, name, true ) | 14 | ConfigDlg_Base(parent, name, true ) |
16 | { | 15 | { |
17 | contFields = Opie::OPimContactFields::trfields(); | 16 | contFields = Opie::OPimContactFields::trfields(); |
18 | 17 | ||
19 | // We add all Fields into the Listbox | 18 | // We add all Fields into the Listbox |
20 | for (uint i=0; i < contFields.count(); i++) { | 19 | for (uint i=0; i < contFields.count(); i++) { |
21 | allFieldListBox->insertItem( contFields[i] ); | 20 | allFieldListBox->insertItem( contFields[i] ); |
22 | } | 21 | } |
23 | 22 | ||
24 | // Reset Widget Flags: This was not changeable by designer :( | 23 | // Reset Widget Flags: This was not changeable by designer :( |
25 | setWFlags ( WStyle_ContextHelp ); | 24 | setWFlags ( WStyle_ContextHelp ); |
26 | 25 | ||
27 | // Set Pics to Buttons and Tabs | 26 | // Set Pics to Buttons and Tabs |
28 | m_upButton->setIconSet( QIconSet( Resource::loadPixmap( "addressbook/up" ) ) ); | 27 | m_upButton->setIconSet( QIconSet( Opie::Core::OResource::loadPixmap( "addressbook/up" ) ) ); |
29 | m_downButton->setIconSet( QIconSet( Resource::loadPixmap( "addressbook/down" ) ) ); | 28 | m_downButton->setIconSet( QIconSet( Opie::Core::OResource::loadPixmap( "addressbook/down" ) ) ); |
30 | m_addButton->setIconSet( QIconSet( Resource::loadPixmap( "addressbook/add" ) ) ); | 29 | m_addButton->setIconSet( QIconSet( Opie::Core::OResource::loadPixmap( "addressbook/add" ) ) ); |
31 | m_removeButton->setIconSet( QIconSet( Resource::loadPixmap( "addressbook/sub" ) ) ); | 30 | m_removeButton->setIconSet( QIconSet( Opie::Core::OResource::loadPixmap( "addressbook/sub" ) ) ); |
32 | 31 | ||
33 | 32 | ||
34 | // Get the translation maps between Field ID and translated strings | 33 | // Get the translation maps between Field ID and translated strings |
35 | m_mapStrToID = Opie::OPimContactFields::trFieldsToId(); | 34 | m_mapStrToID = Opie::OPimContactFields::trFieldsToId(); |
36 | m_mapIDToStr = Opie::OPimContactFields::idToTrFields(); | 35 | m_mapIDToStr = Opie::OPimContactFields::idToTrFields(); |
37 | 36 | ||
38 | connect ( m_addButton, SIGNAL( clicked() ), this, SLOT( slotItemAdd() ) ); | 37 | connect ( m_addButton, SIGNAL( clicked() ), this, SLOT( slotItemAdd() ) ); |
39 | connect ( m_removeButton, SIGNAL( clicked() ), this, SLOT( slotItemRemove() ) ); | 38 | connect ( m_removeButton, SIGNAL( clicked() ), this, SLOT( slotItemRemove() ) ); |
40 | connect ( m_upButton, SIGNAL( clicked() ), this, SLOT( slotItemUp() ) ); | 39 | connect ( m_upButton, SIGNAL( clicked() ), this, SLOT( slotItemUp() ) ); |
41 | connect ( m_downButton, SIGNAL( clicked() ), this, SLOT( slotItemDown() ) ); | 40 | connect ( m_downButton, SIGNAL( clicked() ), this, SLOT( slotItemDown() ) ); |
42 | } | 41 | } |
43 | 42 | ||
44 | void ConfigDlg::slotItemUp() | 43 | void ConfigDlg::slotItemUp() |
45 | { | 44 | { |
46 | odebug << "void ConfigDlg::slotItemUp()" << oendl; | 45 | odebug << "void ConfigDlg::slotItemUp()" << oendl; |
47 | 46 | ||
48 | int i = fieldListBox->currentItem(); | 47 | int i = fieldListBox->currentItem(); |
49 | if ( i > 0 ) { | 48 | if ( i > 0 ) { |
50 | QString item = fieldListBox->currentText(); | 49 | QString item = fieldListBox->currentText(); |
51 | fieldListBox->removeItem( i ); | 50 | fieldListBox->removeItem( i ); |
52 | fieldListBox->insertItem( item, i-1 ); | 51 | fieldListBox->insertItem( item, i-1 ); |
53 | fieldListBox->setCurrentItem( i-1 ); | 52 | fieldListBox->setCurrentItem( i-1 ); |
54 | } | 53 | } |
55 | 54 | ||
56 | } | 55 | } |
57 | 56 | ||
58 | void ConfigDlg::slotItemDown() | 57 | void ConfigDlg::slotItemDown() |
59 | { | 58 | { |
60 | odebug << "void ConfigDlg::slotItemDown()" << oendl; | 59 | odebug << "void ConfigDlg::slotItemDown()" << oendl; |
61 | 60 | ||
62 | int i = fieldListBox->currentItem(); | 61 | int i = fieldListBox->currentItem(); |
63 | if ( i < (int)fieldListBox->count() - 1 ) { | 62 | if ( i < (int)fieldListBox->count() - 1 ) { |
64 | QString item = fieldListBox->currentText(); | 63 | QString item = fieldListBox->currentText(); |
65 | fieldListBox->removeItem( i ); | 64 | fieldListBox->removeItem( i ); |
66 | fieldListBox->insertItem( item, i+1 ); | 65 | fieldListBox->insertItem( item, i+1 ); |
67 | fieldListBox->setCurrentItem( i+1 ); | 66 | fieldListBox->setCurrentItem( i+1 ); |
68 | } | 67 | } |
69 | } | 68 | } |
70 | 69 | ||
71 | void ConfigDlg::slotItemAdd() | 70 | void ConfigDlg::slotItemAdd() |
72 | { | 71 | { |
73 | odebug << "void ConfigDlg::slotItemAdd()" << oendl; | 72 | odebug << "void ConfigDlg::slotItemAdd()" << oendl; |
74 | 73 | ||
75 | int i = allFieldListBox->currentItem(); | 74 | int i = allFieldListBox->currentItem(); |
76 | if ( i > 0 ) { | 75 | if ( i > 0 ) { |
77 | QString item = allFieldListBox->currentText(); | 76 | QString item = allFieldListBox->currentText(); |
78 | odebug << "Adding " << item << oendl; | 77 | odebug << "Adding " << item << oendl; |
79 | fieldListBox->insertItem( item ); | 78 | fieldListBox->insertItem( item ); |
80 | } | 79 | } |
81 | } | 80 | } |
82 | 81 | ||
83 | void ConfigDlg::slotItemRemove() | 82 | void ConfigDlg::slotItemRemove() |
84 | { | 83 | { |
85 | odebug << "void ConfigDlg::slotItemRemove()" << oendl; | 84 | odebug << "void ConfigDlg::slotItemRemove()" << oendl; |
86 | 85 | ||
87 | int i = fieldListBox->currentItem(); | 86 | int i = fieldListBox->currentItem(); |
88 | if ( i > 0 ) { | 87 | if ( i > 0 ) { |
89 | fieldListBox->removeItem( i ); | 88 | fieldListBox->removeItem( i ); |
90 | } | 89 | } |
91 | } | 90 | } |
92 | 91 | ||
93 | void ConfigDlg::setConfig( const AbConfig& cnf ) | 92 | void ConfigDlg::setConfig( const AbConfig& cnf ) |
94 | { | 93 | { |
95 | m_config = cnf; | 94 | m_config = cnf; |
96 | 95 | ||
97 | m_useRegExp->setChecked( m_config.useRegExp() ); | 96 | m_useRegExp->setChecked( m_config.useRegExp() ); |
98 | m_useWildCard->setChecked( m_config.useWildCards() ); | 97 | m_useWildCard->setChecked( m_config.useWildCards() ); |
99 | m_useQtMail->setChecked( m_config.useQtMail() ); | 98 | m_useQtMail->setChecked( m_config.useQtMail() ); |
100 | m_useOpieMail->setChecked( m_config.useOpieMail() ); | 99 | m_useOpieMail->setChecked( m_config.useOpieMail() ); |
101 | m_useCaseSensitive->setChecked( m_config.beCaseSensitive() ); | 100 | m_useCaseSensitive->setChecked( m_config.beCaseSensitive() ); |
102 | 101 | ||
103 | switch( m_config.fontSize() ){ | 102 | switch( m_config.fontSize() ){ |
104 | case 0: | 103 | case 0: |
105 | m_smallFont->setChecked( true ); | 104 | m_smallFont->setChecked( true ); |
106 | m_normalFont->setChecked( false ); | 105 | m_normalFont->setChecked( false ); |
107 | m_largeFont->setChecked( false ); | 106 | m_largeFont->setChecked( false ); |
108 | break; | 107 | break; |
109 | case 1: | 108 | case 1: |
110 | m_smallFont->setChecked( false ); | 109 | m_smallFont->setChecked( false ); |
111 | m_normalFont->setChecked( true ); | 110 | m_normalFont->setChecked( true ); |
112 | m_largeFont->setChecked( false ); | 111 | m_largeFont->setChecked( false ); |
113 | break; | 112 | break; |
114 | case 2: | 113 | case 2: |
115 | m_smallFont->setChecked( false ); | 114 | m_smallFont->setChecked( false ); |
116 | m_normalFont->setChecked( false ); | 115 | m_normalFont->setChecked( false ); |
117 | m_largeFont->setChecked( true ); | 116 | m_largeFont->setChecked( true ); |
118 | break; | 117 | break; |
119 | } | 118 | } |
120 | 119 | ||
121 | for( uint i = 0; i < m_config.orderList().count(); i++ ) { | 120 | for( uint i = 0; i < m_config.orderList().count(); i++ ) { |
122 | fieldListBox -> insertItem ( m_mapIDToStr[ m_config.orderList()[i] ] ); | 121 | fieldListBox -> insertItem ( m_mapIDToStr[ m_config.orderList()[i] ] ); |
123 | } | 122 | } |
124 | 123 | ||
125 | m_fixedBars->setChecked( m_config.fixedBars() ); | 124 | m_fixedBars->setChecked( m_config.fixedBars() ); |
126 | m_moveBars->setChecked( !m_config.fixedBars() ); | 125 | m_moveBars->setChecked( !m_config.fixedBars() ); |
127 | } | 126 | } |
128 | 127 | ||
129 | AbConfig ConfigDlg::getConfig() | 128 | AbConfig ConfigDlg::getConfig() |
130 | { | 129 | { |
131 | m_config.setUseRegExp( m_useRegExp->isOn() ); | 130 | m_config.setUseRegExp( m_useRegExp->isOn() ); |
132 | m_config.setUseWildCards( m_useWildCard->isOn() ); | 131 | m_config.setUseWildCards( m_useWildCard->isOn() ); |
133 | m_config.setUseQtMail( m_useQtMail->isOn() ); | 132 | m_config.setUseQtMail( m_useQtMail->isOn() ); |
134 | m_config.setUseOpieMail( m_useOpieMail->isOn() ); | 133 | m_config.setUseOpieMail( m_useOpieMail->isOn() ); |
135 | m_config.setBeCaseSensitive( m_useCaseSensitive->isChecked() ); | 134 | m_config.setBeCaseSensitive( m_useCaseSensitive->isChecked() ); |
136 | 135 | ||
137 | if ( m_smallFont->isChecked() ) | 136 | if ( m_smallFont->isChecked() ) |
138 | m_config.setFontSize( 0 ); | 137 | m_config.setFontSize( 0 ); |
139 | if ( m_normalFont->isChecked() ) | 138 | if ( m_normalFont->isChecked() ) |
140 | m_config.setFontSize( 1 ); | 139 | m_config.setFontSize( 1 ); |
141 | if ( m_largeFont->isChecked() ) | 140 | if ( m_largeFont->isChecked() ) |
142 | m_config.setFontSize( 2 ); | 141 | m_config.setFontSize( 2 ); |
143 | 142 | ||
144 | QValueList<int> orderlist; | 143 | QValueList<int> orderlist; |
145 | for( int i = 0; i < (int)fieldListBox->count(); i++ ) { | 144 | for( int i = 0; i < (int)fieldListBox->count(); i++ ) { |
146 | orderlist.append( m_mapStrToID[ fieldListBox->text(i) ] ); | 145 | orderlist.append( m_mapStrToID[ fieldListBox->text(i) ] ); |
147 | } | 146 | } |
148 | m_config.setOrderList( orderlist ); | 147 | m_config.setOrderList( orderlist ); |
149 | 148 | ||
150 | m_config.setFixedBars( m_fixedBars->isChecked() ); | 149 | m_config.setFixedBars( m_fixedBars->isChecked() ); |
151 | 150 | ||
152 | return m_config; | 151 | return m_config; |
153 | } | 152 | } |
154 | 153 | ||
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp index dec4c7c..4a0059a 100644 --- a/core/pim/addressbook/contacteditor.cpp +++ b/core/pim/addressbook/contacteditor.cpp | |||
@@ -1,1750 +1,1751 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2002 Michael R. Crawford <mike@tuxnami.org> | 2 | * Copyright (c) 2002 Michael R. Crawford <mike@tuxnami.org> |
3 | * Copyright (C) 2002 by Stefan Eilers (eilers.stefan@epost.de) | 3 | * Copyright (C) 2002 by Stefan Eilers (eilers.stefan@epost.de) |
4 | * | 4 | * |
5 | * This file is an add-on for the OPIE Palmtop Environment | 5 | * This file is an add-on for the OPIE Palmtop Environment |
6 | * | 6 | * |
7 | * This file may be distributed and/or modified under the terms of the | 7 | * This file may be distributed and/or modified under the terms of the |
8 | * GNU General Public License version 2 as published by the Free Software | 8 | * GNU General Public License version 2 as published by the Free Software |
9 | * Foundation and appearing in the file LICENSE.GPL included in the pacakaging | 9 | * Foundation and appearing in the file LICENSE.GPL included in the pacakaging |
10 | * of this file. | 10 | * of this file. |
11 | * | 11 | * |
12 | * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 12 | * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
13 | * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 13 | * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
14 | * | 14 | * |
15 | * | 15 | * |
16 | * This is a rewrite of the abeditor.h file, modified to provide a more | 16 | * This is a rewrite of the abeditor.h file, modified to provide a more |
17 | * intuitive interface to TrollTech's original Address Book editor. This | 17 | * intuitive interface to TrollTech's original Address Book editor. This |
18 | * is made to operate exactly in interface with the exception of name. | 18 | * is made to operate exactly in interface with the exception of name. |
19 | * | 19 | * |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include "contacteditor.h" | 22 | #include "contacteditor.h" |
23 | #include "namelineedit.h" | 23 | #include "namelineedit.h" |
24 | 24 | ||
25 | #include <opie2/odebug.h> | 25 | #include <opie2/odebug.h> |
26 | #include <opie2/opimcontact.h> | 26 | #include <opie2/opimcontact.h> |
27 | #include <opie2/oresource.h> | ||
27 | 28 | ||
28 | #include <qpe/categoryselect.h> | 29 | #include <qpe/categoryselect.h> |
29 | #include <qpe/qpeapplication.h> | 30 | #include <qpe/qpeapplication.h> |
30 | #include <qpe/qpedialog.h> | 31 | #include <qpe/qpedialog.h> |
31 | #include <qpe/resource.h> | ||
32 | 32 | ||
33 | #include <qlabel.h> | 33 | #include <qlabel.h> |
34 | #include <qlayout.h> | 34 | #include <qlayout.h> |
35 | #include <qlineedit.h> | 35 | #include <qlineedit.h> |
36 | #include <qmultilineedit.h> | 36 | #include <qmultilineedit.h> |
37 | #include <qtoolbutton.h> | 37 | #include <qtoolbutton.h> |
38 | #include <qlistbox.h> | 38 | #include <qlistbox.h> |
39 | #include <qmessagebox.h> | 39 | #include <qmessagebox.h> |
40 | #include <qwhatsthis.h> | 40 | #include <qwhatsthis.h> |
41 | 41 | ||
42 | #include <assert.h> | 42 | #include <assert.h> |
43 | 43 | ||
44 | static inline bool containsAlphaNum( const QString &str ); | 44 | static inline bool containsAlphaNum( const QString &str ); |
45 | static inline bool constainsWhiteSpace( const QString &str ); | 45 | static inline bool constainsWhiteSpace( const QString &str ); |
46 | 46 | ||
47 | // helper functions, convert our comma delimited list to proper | 47 | // helper functions, convert our comma delimited list to proper |
48 | // file format... | 48 | // file format... |
49 | void parseEmailFrom( const QString &txt, QString &strDefaultEmail, | 49 | void parseEmailFrom( const QString &txt, QString &strDefaultEmail, |
50 | QString &strAll ); | 50 | QString &strAll ); |
51 | 51 | ||
52 | // helper convert from file format to comma delimited... | 52 | // helper convert from file format to comma delimited... |
53 | void parseEmailTo( const QString &strDefaultEmail, | 53 | void parseEmailTo( const QString &strDefaultEmail, |
54 | const QString &strOtherEmail, QString &strBack ); | 54 | const QString &strOtherEmail, QString &strBack ); |
55 | 55 | ||
56 | ContactEditor::ContactEditor(const Opie::OPimContact &entry, | 56 | ContactEditor::ContactEditor(const Opie::OPimContact &entry, |
57 | QWidget *parent, | 57 | QWidget *parent, |
58 | const char *name, | 58 | const char *name, |
59 | WFlags ) | 59 | WFlags ) |
60 | : QDialog( parent, name, true, WStyle_ContextHelp ), | 60 | : QDialog( parent, name, true, WStyle_ContextHelp ), |
61 | defaultEmailChooserPosition( -1 ), | 61 | defaultEmailChooserPosition( -1 ), |
62 | m_personalView ( false ), | 62 | m_personalView ( false ), |
63 | cmbDefaultEmail( 0 ), | 63 | cmbDefaultEmail( 0 ), |
64 | initializing ( false ) | 64 | initializing ( false ) |
65 | { | 65 | { |
66 | 66 | ||
67 | initializing = true; | 67 | initializing = true; |
68 | 68 | ||
69 | init(); | 69 | init(); |
70 | setEntry( entry ); | 70 | setEntry( entry ); |
71 | // cmbDefaultEmail = 0; | 71 | // cmbDefaultEmail = 0; |
72 | // defaultEmailChooserPosition = -1; | 72 | // defaultEmailChooserPosition = -1; |
73 | 73 | ||
74 | initializing = false; | 74 | initializing = false; |
75 | } | 75 | } |
76 | 76 | ||
77 | ContactEditor::~ContactEditor() { | 77 | ContactEditor::~ContactEditor() { |
78 | } | 78 | } |
79 | 79 | ||
80 | void ContactEditor::init() { | 80 | void ContactEditor::init() { |
81 | odebug << "init() START" << oendl; | 81 | odebug << "init() START" << oendl; |
82 | 82 | ||
83 | uint i = 0; | 83 | uint i = 0; |
84 | 84 | ||
85 | QStringList trlChooserNames; | 85 | QStringList trlChooserNames; |
86 | 86 | ||
87 | for (i = 0; i <= 6; i++) { | 87 | for (i = 0; i <= 6; i++) { |
88 | slHomeAddress.append( "" ); | 88 | slHomeAddress.append( "" ); |
89 | slBusinessAddress.append( "" ); | 89 | slBusinessAddress.append( "" ); |
90 | } | 90 | } |
91 | 91 | ||
92 | trlChooserNames = Opie::OPimContactFields::trphonefields( false ); | 92 | trlChooserNames = Opie::OPimContactFields::trphonefields( false ); |
93 | slChooserNames = Opie::OPimContactFields::untrphonefields( false ); | 93 | slChooserNames = Opie::OPimContactFields::untrphonefields( false ); |
94 | slDynamicEntries = Opie::OPimContactFields::untrdetailsfields( false ); | 94 | slDynamicEntries = Opie::OPimContactFields::untrdetailsfields( false ); |
95 | trlDynamicEntries = Opie::OPimContactFields::trdetailsfields( false ); | 95 | trlDynamicEntries = Opie::OPimContactFields::trdetailsfields( false ); |
96 | 96 | ||
97 | // Ok, we have to remove elements from the list of dynamic entries | 97 | // Ok, we have to remove elements from the list of dynamic entries |
98 | // which are now stored in special (not dynamic) widgets.. | 98 | // which are now stored in special (not dynamic) widgets.. |
99 | // Otherwise we will get problems with field assignments! (se) | 99 | // Otherwise we will get problems with field assignments! (se) |
100 | slDynamicEntries.remove("Anniversary"); | 100 | slDynamicEntries.remove("Anniversary"); |
101 | slDynamicEntries.remove("Birthday"); | 101 | slDynamicEntries.remove("Birthday"); |
102 | slDynamicEntries.remove("Gender"); | 102 | slDynamicEntries.remove("Gender"); |
103 | 103 | ||
104 | // The same with translated fields.. But I will | 104 | // The same with translated fields.. But I will |
105 | // use the translation map to avoid mismatches.. | 105 | // use the translation map to avoid mismatches.. |
106 | QMap<int, QString> translMap = Opie::OPimContactFields::idToTrFields(); | 106 | QMap<int, QString> translMap = Opie::OPimContactFields::idToTrFields(); |
107 | trlDynamicEntries.remove( translMap[Qtopia::Anniversary] ); | 107 | trlDynamicEntries.remove( translMap[Qtopia::Anniversary] ); |
108 | trlDynamicEntries.remove( translMap[Qtopia::Birthday] ); | 108 | trlDynamicEntries.remove( translMap[Qtopia::Birthday] ); |
109 | trlDynamicEntries.remove( translMap[Qtopia::Gender] ); | 109 | trlDynamicEntries.remove( translMap[Qtopia::Gender] ); |
110 | 110 | ||
111 | // Last Check to be sure.. | 111 | // Last Check to be sure.. |
112 | assert( slDynamicEntries.count() == trlDynamicEntries.count() ); | 112 | assert( slDynamicEntries.count() == trlDynamicEntries.count() ); |
113 | assert( slChooserNames.count() == trlChooserNames.count() ); | 113 | assert( slChooserNames.count() == trlChooserNames.count() ); |
114 | 114 | ||
115 | for (i = 0; i < slChooserNames.count(); i++) | 115 | for (i = 0; i < slChooserNames.count(); i++) |
116 | slChooserValues.append(""); | 116 | slChooserValues.append(""); |
117 | 117 | ||
118 | 118 | ||
119 | QVBoxLayout *vb = new QVBoxLayout( this ); | 119 | QVBoxLayout *vb = new QVBoxLayout( this ); |
120 | 120 | ||
121 | tabMain = new Opie::Ui::OTabWidget( this ); | 121 | tabMain = new Opie::Ui::OTabWidget( this ); |
122 | vb->addWidget( tabMain ); | 122 | vb->addWidget( tabMain ); |
123 | 123 | ||
124 | m_generalWidget = new QWidget ( tabMain ); | 124 | m_generalWidget = new QWidget ( tabMain ); |
125 | 125 | ||
126 | vb = new QVBoxLayout( m_generalWidget ); | 126 | vb = new QVBoxLayout( m_generalWidget ); |
127 | 127 | ||
128 | svGeneral = new QScrollView( m_generalWidget ); | 128 | svGeneral = new QScrollView( m_generalWidget ); |
129 | vb->addWidget( svGeneral, 0, 0 ); | 129 | vb->addWidget( svGeneral, 0, 0 ); |
130 | svGeneral->setResizePolicy( QScrollView::AutoOneFit ); | 130 | svGeneral->setResizePolicy( QScrollView::AutoOneFit ); |
131 | // svGeneral->setHScrollBarMode( QScrollView::AlwaysOff ); | 131 | // svGeneral->setHScrollBarMode( QScrollView::AlwaysOff ); |
132 | // svGeneral->setVScrollBarMode( QScrollView::AlwaysOff ); | 132 | // svGeneral->setVScrollBarMode( QScrollView::AlwaysOff ); |
133 | svGeneral->setFrameStyle( QFrame::NoFrame ); | 133 | svGeneral->setFrameStyle( QFrame::NoFrame ); |
134 | 134 | ||
135 | QWidget *container = new QWidget( svGeneral->viewport() ); | 135 | QWidget *container = new QWidget( svGeneral->viewport() ); |
136 | svGeneral->addChild( container ); | 136 | svGeneral->addChild( container ); |
137 | 137 | ||
138 | QGridLayout *gl = new QGridLayout( container, 10, 2, 2, 4 ); | 138 | QGridLayout *gl = new QGridLayout( container, 10, 2, 2, 4 ); |
139 | 139 | ||
140 | btnFullName = new QPushButton( tr( "Full Name..." ), container ); | 140 | btnFullName = new QPushButton( tr( "Full Name..." ), container ); |
141 | QWhatsThis::add( btnFullName, tr( "Press to enter last- middle and firstname" ) ); | 141 | QWhatsThis::add( btnFullName, tr( "Press to enter last- middle and firstname" ) ); |
142 | gl->addWidget( btnFullName, 0, 0 ); | 142 | gl->addWidget( btnFullName, 0, 0 ); |
143 | txtFullName = new ABOOK::NameLineEdit( container ); | 143 | txtFullName = new ABOOK::NameLineEdit( container ); |
144 | QWhatsThis::add( txtFullName, tr( "Enter fullname directly ! If you have a lastname with multiple words ( for instance \"de la Guerra\"), please write <lastname>,<firstnames> like this: \"de la Guerra, Carlos Pedro\"" ) ); | 144 | QWhatsThis::add( txtFullName, tr( "Enter fullname directly ! If you have a lastname with multiple words ( for instance \"de la Guerra\"), please write <lastname>,<firstnames> like this: \"de la Guerra, Carlos Pedro\"" ) ); |
145 | gl->addWidget( txtFullName, 0, 1 ); | 145 | gl->addWidget( txtFullName, 0, 1 ); |
146 | 146 | ||
147 | QLabel *l = new QLabel( tr( "Job Title" ), container ); | 147 | QLabel *l = new QLabel( tr( "Job Title" ), container ); |
148 | QWhatsThis::add( l, tr( "The jobtitle.." ) ); | 148 | QWhatsThis::add( l, tr( "The jobtitle.." ) ); |
149 | gl->addWidget( l, 1, 0 ); | 149 | gl->addWidget( l, 1, 0 ); |
150 | txtJobTitle = new QLineEdit( container ); | 150 | txtJobTitle = new QLineEdit( container ); |
151 | QWhatsThis::add( txtJobTitle, tr( "The jobtitle.." ) ); | 151 | QWhatsThis::add( txtJobTitle, tr( "The jobtitle.." ) ); |
152 | gl->addWidget( txtJobTitle, 1, 1 ); | 152 | gl->addWidget( txtJobTitle, 1, 1 ); |
153 | 153 | ||
154 | l = new QLabel( tr("Suffix"), container ); | 154 | l = new QLabel( tr("Suffix"), container ); |
155 | QWhatsThis::add( l, tr( "Something like \"jr.\".." ) ); | 155 | QWhatsThis::add( l, tr( "Something like \"jr.\".." ) ); |
156 | gl->addWidget( l, 2, 0 ); | 156 | gl->addWidget( l, 2, 0 ); |
157 | txtSuffix = new QLineEdit( container ); | 157 | txtSuffix = new QLineEdit( container ); |
158 | QWhatsThis::add( txtSuffix, tr( "Something like \"jr.\".." ) ); | 158 | QWhatsThis::add( txtSuffix, tr( "Something like \"jr.\".." ) ); |
159 | gl->addWidget( txtSuffix, 2, 1 ); | 159 | gl->addWidget( txtSuffix, 2, 1 ); |
160 | 160 | ||
161 | l = new QLabel( tr( "Organization" ), container ); | 161 | l = new QLabel( tr( "Organization" ), container ); |
162 | QWhatsThis::add( l, tr( "The working place of the contact" ) ); | 162 | QWhatsThis::add( l, tr( "The working place of the contact" ) ); |
163 | gl->addWidget( l, 3, 0 ); | 163 | gl->addWidget( l, 3, 0 ); |
164 | txtOrganization = new QLineEdit( container ); | 164 | txtOrganization = new QLineEdit( container ); |
165 | QWhatsThis::add( txtOrganization, tr( "The working place of the contact" ) ); | 165 | QWhatsThis::add( txtOrganization, tr( "The working place of the contact" ) ); |
166 | gl->addWidget( txtOrganization, 3, 1 ); | 166 | gl->addWidget( txtOrganization, 3, 1 ); |
167 | 167 | ||
168 | // Chooser 1 | 168 | // Chooser 1 |
169 | cmbChooserField1 = new QComboBox( false, container ); | 169 | cmbChooserField1 = new QComboBox( false, container ); |
170 | QWhatsThis::add( cmbChooserField1, tr( "Press to select attribute to change" ) ); | 170 | QWhatsThis::add( cmbChooserField1, tr( "Press to select attribute to change" ) ); |
171 | cmbChooserField1->setMaximumWidth( 90 ); | 171 | cmbChooserField1->setMaximumWidth( 90 ); |
172 | gl->addWidget( cmbChooserField1, 4, 0 ); | 172 | gl->addWidget( cmbChooserField1, 4, 0 ); |
173 | // Textfield for chooser 1. | 173 | // Textfield for chooser 1. |
174 | // Now use Widgetstack to contain the textfield and the default-email combo ! | 174 | // Now use Widgetstack to contain the textfield and the default-email combo ! |
175 | m_widgetStack1 = new QWidgetStack( container ); | 175 | m_widgetStack1 = new QWidgetStack( container ); |
176 | txtChooserField1 = new QLineEdit( m_widgetStack1 ); | 176 | txtChooserField1 = new QLineEdit( m_widgetStack1 ); |
177 | m_widgetStack1 -> addWidget( txtChooserField1, TextField ); | 177 | m_widgetStack1 -> addWidget( txtChooserField1, TextField ); |
178 | gl->addWidget( m_widgetStack1, 4, 1 ); | 178 | gl->addWidget( m_widgetStack1, 4, 1 ); |
179 | m_widgetStack1 -> raiseWidget( TextField ); | 179 | m_widgetStack1 -> raiseWidget( TextField ); |
180 | 180 | ||
181 | // Chooser 2 | 181 | // Chooser 2 |
182 | cmbChooserField2 = new QComboBox( false, container ); | 182 | cmbChooserField2 = new QComboBox( false, container ); |
183 | QWhatsThis::add( cmbChooserField2, tr( "Press to select attribute to change" ) ); | 183 | QWhatsThis::add( cmbChooserField2, tr( "Press to select attribute to change" ) ); |
184 | cmbChooserField2->setMaximumWidth( 90 ); | 184 | cmbChooserField2->setMaximumWidth( 90 ); |
185 | gl->addWidget( cmbChooserField2, 5, 0 ); | 185 | gl->addWidget( cmbChooserField2, 5, 0 ); |
186 | // Textfield for chooser 2 | 186 | // Textfield for chooser 2 |
187 | // Now use WidgetStack to contain the textfield and the default-email combo! | 187 | // Now use WidgetStack to contain the textfield and the default-email combo! |
188 | m_widgetStack2 = new QWidgetStack( container ); | 188 | m_widgetStack2 = new QWidgetStack( container ); |
189 | txtChooserField2 = new QLineEdit( m_widgetStack2 ); | 189 | txtChooserField2 = new QLineEdit( m_widgetStack2 ); |
190 | m_widgetStack2 -> addWidget( txtChooserField2, TextField ); | 190 | m_widgetStack2 -> addWidget( txtChooserField2, TextField ); |
191 | gl->addWidget( m_widgetStack2, 5, 1 ); | 191 | gl->addWidget( m_widgetStack2, 5, 1 ); |
192 | m_widgetStack2 -> raiseWidget( TextField ); | 192 | m_widgetStack2 -> raiseWidget( TextField ); |
193 | 193 | ||
194 | // Chooser 3 | 194 | // Chooser 3 |
195 | cmbChooserField3 = new QComboBox( false, container ); | 195 | cmbChooserField3 = new QComboBox( false, container ); |
196 | QWhatsThis::add( cmbChooserField3, tr( "Press to select attribute to change" ) ); | 196 | QWhatsThis::add( cmbChooserField3, tr( "Press to select attribute to change" ) ); |
197 | cmbChooserField3->setMaximumWidth( 90 ); | 197 | cmbChooserField3->setMaximumWidth( 90 ); |
198 | gl->addWidget( cmbChooserField3, 6, 0 ); | 198 | gl->addWidget( cmbChooserField3, 6, 0 ); |
199 | // Textfield for chooser 2 | 199 | // Textfield for chooser 2 |
200 | // Now use WidgetStack to contain the textfield and the default-email combo! | 200 | // Now use WidgetStack to contain the textfield and the default-email combo! |
201 | m_widgetStack3 = new QWidgetStack( container ); | 201 | m_widgetStack3 = new QWidgetStack( container ); |
202 | txtChooserField3 = new QLineEdit( m_widgetStack3 ); | 202 | txtChooserField3 = new QLineEdit( m_widgetStack3 ); |
203 | m_widgetStack3 -> addWidget( txtChooserField3, TextField ); | 203 | m_widgetStack3 -> addWidget( txtChooserField3, TextField ); |
204 | gl->addWidget( m_widgetStack3, 6, 1 ); | 204 | gl->addWidget( m_widgetStack3, 6, 1 ); |
205 | m_widgetStack3 -> raiseWidget( TextField ); | 205 | m_widgetStack3 -> raiseWidget( TextField ); |
206 | 206 | ||
207 | l = new QLabel( tr( "File As" ), container ); | 207 | l = new QLabel( tr( "File As" ), container ); |
208 | QWhatsThis::add( l, tr( "Press to select how to store the name (and howto show it in the listview)" ) ); | 208 | QWhatsThis::add( l, tr( "Press to select how to store the name (and howto show it in the listview)" ) ); |
209 | gl->addWidget( l, 7, 0 ); | 209 | gl->addWidget( l, 7, 0 ); |
210 | cmbFileAs = new QComboBox( true, container ); | 210 | cmbFileAs = new QComboBox( true, container ); |
211 | gl->addWidget( cmbFileAs, 7, 1 ); | 211 | gl->addWidget( cmbFileAs, 7, 1 ); |
212 | 212 | ||
213 | labCat = new QLabel( tr( "Category" ), container ); | 213 | labCat = new QLabel( tr( "Category" ), container ); |
214 | gl->addWidget( labCat, 8, 0 ); | 214 | gl->addWidget( labCat, 8, 0 ); |
215 | cmbCat = new CategorySelect( container ); | 215 | cmbCat = new CategorySelect( container ); |
216 | gl->addWidget( cmbCat, 8, 1 ); | 216 | gl->addWidget( cmbCat, 8, 1 ); |
217 | labCat->show(); | 217 | labCat->show(); |
218 | cmbCat->show(); | 218 | cmbCat->show(); |
219 | 219 | ||
220 | btnNote = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Notes..." ), container ); | 220 | btnNote = new QPushButton( Opie::Core::OResource::loadPixmap( "edit", Opie::Core::OResource::SmallIcon ), |
221 | tr( "Notes..." ), container ); | ||
221 | gl->addWidget( btnNote, 9, 1 ); | 222 | gl->addWidget( btnNote, 9, 1 ); |
222 | 223 | ||
223 | tabMain->addTab( m_generalWidget, "addressbook/AddressBookSmall", tr( "General" ) ); | 224 | tabMain->addTab( m_generalWidget, "addressbook/AddressBookSmall", tr( "General" ) ); |
224 | 225 | ||
225 | QWidget *tabViewport = new QWidget ( tabMain ); | 226 | QWidget *tabViewport = new QWidget ( tabMain ); |
226 | 227 | ||
227 | vb = new QVBoxLayout( tabViewport ); | 228 | vb = new QVBoxLayout( tabViewport ); |
228 | 229 | ||
229 | svAddress = new QScrollView( tabViewport ); | 230 | svAddress = new QScrollView( tabViewport ); |
230 | vb->addWidget( svAddress, 0, 0 ); | 231 | vb->addWidget( svAddress, 0, 0 ); |
231 | svAddress->setResizePolicy( QScrollView::AutoOneFit ); | 232 | svAddress->setResizePolicy( QScrollView::AutoOneFit ); |
232 | svAddress->setFrameStyle( QFrame::NoFrame ); | 233 | svAddress->setFrameStyle( QFrame::NoFrame ); |
233 | 234 | ||
234 | container = new QWidget( svAddress->viewport() ); | 235 | container = new QWidget( svAddress->viewport() ); |
235 | svAddress->addChild( container ); | 236 | svAddress->addChild( container ); |
236 | 237 | ||
237 | gl = new QGridLayout( container, 8, 3, 2, 4 ); // row 7 QSpacerItem | 238 | gl = new QGridLayout( container, 8, 3, 2, 4 ); // row 7 QSpacerItem |
238 | 239 | ||
239 | cmbAddress = new QComboBox( false, container ); | 240 | cmbAddress = new QComboBox( false, container ); |
240 | cmbAddress->insertItem( tr( "Business" ) ); | 241 | cmbAddress->insertItem( tr( "Business" ) ); |
241 | cmbAddress->insertItem( tr( "Home" ) ); | 242 | cmbAddress->insertItem( tr( "Home" ) ); |
242 | gl->addMultiCellWidget( cmbAddress, 0, 0, 0, 1 ); | 243 | gl->addMultiCellWidget( cmbAddress, 0, 0, 0, 1 ); |
243 | 244 | ||
244 | l = new QLabel( tr( "Address" ), container ); | 245 | l = new QLabel( tr( "Address" ), container ); |
245 | gl->addWidget( l, 1, 0 ); | 246 | gl->addWidget( l, 1, 0 ); |
246 | txtAddress = new QLineEdit( container ); | 247 | txtAddress = new QLineEdit( container ); |
247 | gl->addMultiCellWidget( txtAddress, 1, 1, 1, 2 ); | 248 | gl->addMultiCellWidget( txtAddress, 1, 1, 1, 2 ); |
248 | 249 | ||
249 | l = new QLabel( tr( "City" ), container ); | 250 | l = new QLabel( tr( "City" ), container ); |
250 | gl->addWidget( l, 2, 0 ); | 251 | gl->addWidget( l, 2, 0 ); |
251 | txtCity = new QLineEdit( container ); | 252 | txtCity = new QLineEdit( container ); |
252 | gl->addMultiCellWidget( txtCity, 2, 2, 1, 2 ); | 253 | gl->addMultiCellWidget( txtCity, 2, 2, 1, 2 ); |
253 | 254 | ||
254 | l = new QLabel( tr( "State" ), container ); | 255 | l = new QLabel( tr( "State" ), container ); |
255 | gl->addWidget( l, 3, 0 ); | 256 | gl->addWidget( l, 3, 0 ); |
256 | txtState = new QLineEdit( container ); | 257 | txtState = new QLineEdit( container ); |
257 | gl->addMultiCellWidget( txtState, 3, 3, 1, 2 ); | 258 | gl->addMultiCellWidget( txtState, 3, 3, 1, 2 ); |
258 | 259 | ||
259 | l = new QLabel( tr( "Zip Code" ), container ); | 260 | l = new QLabel( tr( "Zip Code" ), container ); |
260 | gl->addWidget( l, 4, 0 ); | 261 | gl->addWidget( l, 4, 0 ); |
261 | txtZip = new QLineEdit( container ); | 262 | txtZip = new QLineEdit( container ); |
262 | gl->addMultiCellWidget( txtZip, 4, 4, 1, 2 ); | 263 | gl->addMultiCellWidget( txtZip, 4, 4, 1, 2 ); |
263 | 264 | ||
264 | l = new QLabel( tr( "Country" ), container ); | 265 | l = new QLabel( tr( "Country" ), container ); |
265 | gl->addWidget( l, 5, 0 ); | 266 | gl->addWidget( l, 5, 0 ); |
266 | cmbCountry = new QComboBox( true, container ); | 267 | cmbCountry = new QComboBox( true, container ); |
267 | cmbCountry->insertItem( "" ); | 268 | cmbCountry->insertItem( "" ); |
268 | cmbCountry->insertItem( tr ( "United States" ) ); | 269 | cmbCountry->insertItem( tr ( "United States" ) ); |
269 | cmbCountry->insertItem( tr ( "United Kingdom" ) ); | 270 | cmbCountry->insertItem( tr ( "United Kingdom" ) ); |
270 | cmbCountry->insertItem( tr ( "Afghanistan" ) ); | 271 | cmbCountry->insertItem( tr ( "Afghanistan" ) ); |
271 | cmbCountry->insertItem( tr ( "Albania" ) ); | 272 | cmbCountry->insertItem( tr ( "Albania" ) ); |
272 | cmbCountry->insertItem( tr ( "Algeria" ) ); | 273 | cmbCountry->insertItem( tr ( "Algeria" ) ); |
273 | cmbCountry->insertItem( tr ( "American Samoa" ) ); | 274 | cmbCountry->insertItem( tr ( "American Samoa" ) ); |
274 | cmbCountry->insertItem( tr ( "Andorra" ) ); | 275 | cmbCountry->insertItem( tr ( "Andorra" ) ); |
275 | cmbCountry->insertItem( tr ( "Angola" ) ); | 276 | cmbCountry->insertItem( tr ( "Angola" ) ); |
276 | cmbCountry->insertItem( tr ( "Anguilla" ) ); | 277 | cmbCountry->insertItem( tr ( "Anguilla" ) ); |
277 | cmbCountry->insertItem( tr ( "Antarctica" ) ); | 278 | cmbCountry->insertItem( tr ( "Antarctica" ) ); |
278 | cmbCountry->insertItem( tr ( "Argentina" ) ); | 279 | cmbCountry->insertItem( tr ( "Argentina" ) ); |
279 | cmbCountry->insertItem( tr ( "Armenia" ) ); | 280 | cmbCountry->insertItem( tr ( "Armenia" ) ); |
280 | cmbCountry->insertItem( tr ( "Aruba" ) ); | 281 | cmbCountry->insertItem( tr ( "Aruba" ) ); |
281 | cmbCountry->insertItem( tr ( "Australia" ) ); | 282 | cmbCountry->insertItem( tr ( "Australia" ) ); |
282 | cmbCountry->insertItem( tr ( "Austria" ) ); | 283 | cmbCountry->insertItem( tr ( "Austria" ) ); |
283 | cmbCountry->insertItem( tr ( "Azerbaijan" ) ); | 284 | cmbCountry->insertItem( tr ( "Azerbaijan" ) ); |
284 | cmbCountry->insertItem( tr ( "Bahamas" ) ); | 285 | cmbCountry->insertItem( tr ( "Bahamas" ) ); |
285 | cmbCountry->insertItem( tr ( "Bahrain" ) ); | 286 | cmbCountry->insertItem( tr ( "Bahrain" ) ); |
286 | cmbCountry->insertItem( tr ( "Bangladesh" ) ); | 287 | cmbCountry->insertItem( tr ( "Bangladesh" ) ); |
287 | cmbCountry->insertItem( tr ( "Barbados" ) ); | 288 | cmbCountry->insertItem( tr ( "Barbados" ) ); |
288 | cmbCountry->insertItem( tr ( "Belarus" ) ); | 289 | cmbCountry->insertItem( tr ( "Belarus" ) ); |
289 | cmbCountry->insertItem( tr ( "Belgium" ) ); | 290 | cmbCountry->insertItem( tr ( "Belgium" ) ); |
290 | cmbCountry->insertItem( tr ( "Belize" ) ); | 291 | cmbCountry->insertItem( tr ( "Belize" ) ); |
291 | cmbCountry->insertItem( tr ( "Benin" ) ); | 292 | cmbCountry->insertItem( tr ( "Benin" ) ); |
292 | cmbCountry->insertItem( tr ( "Bermuda" ) ); | 293 | cmbCountry->insertItem( tr ( "Bermuda" ) ); |
293 | cmbCountry->insertItem( tr ( "Bhutan" ) ); | 294 | cmbCountry->insertItem( tr ( "Bhutan" ) ); |
294 | cmbCountry->insertItem( tr ( "Bolivia" ) ); | 295 | cmbCountry->insertItem( tr ( "Bolivia" ) ); |
295 | cmbCountry->insertItem( tr ( "Botswana" ) ); | 296 | cmbCountry->insertItem( tr ( "Botswana" ) ); |
296 | cmbCountry->insertItem( tr ( "Bouvet Island" ) ); | 297 | cmbCountry->insertItem( tr ( "Bouvet Island" ) ); |
297 | cmbCountry->insertItem( tr ( "Brazil" ) ); | 298 | cmbCountry->insertItem( tr ( "Brazil" ) ); |
298 | cmbCountry->insertItem( tr ( "Brunei Darussalam" ) ); | 299 | cmbCountry->insertItem( tr ( "Brunei Darussalam" ) ); |
299 | cmbCountry->insertItem( tr ( "Bulgaria" ) ); | 300 | cmbCountry->insertItem( tr ( "Bulgaria" ) ); |
300 | cmbCountry->insertItem( tr ( "Burkina Faso" ) ); | 301 | cmbCountry->insertItem( tr ( "Burkina Faso" ) ); |
301 | cmbCountry->insertItem( tr ( "Burundi" ) ); | 302 | cmbCountry->insertItem( tr ( "Burundi" ) ); |
302 | cmbCountry->insertItem( tr ( "Cambodia" ) ); | 303 | cmbCountry->insertItem( tr ( "Cambodia" ) ); |
303 | cmbCountry->insertItem( tr ( "Cameroon" ) ); | 304 | cmbCountry->insertItem( tr ( "Cameroon" ) ); |
304 | cmbCountry->insertItem( tr ( "Canada" ) ); | 305 | cmbCountry->insertItem( tr ( "Canada" ) ); |
305 | cmbCountry->insertItem( tr ( "Cape Verde" ) ); | 306 | cmbCountry->insertItem( tr ( "Cape Verde" ) ); |
306 | cmbCountry->insertItem( tr ( "Cayman Islands" ) ); | 307 | cmbCountry->insertItem( tr ( "Cayman Islands" ) ); |
307 | cmbCountry->insertItem( tr ( "Chad" ) ); | 308 | cmbCountry->insertItem( tr ( "Chad" ) ); |
308 | cmbCountry->insertItem( tr ( "Chile" ) ); | 309 | cmbCountry->insertItem( tr ( "Chile" ) ); |
309 | cmbCountry->insertItem( tr ( "China" ) ); | 310 | cmbCountry->insertItem( tr ( "China" ) ); |
310 | cmbCountry->insertItem( tr ( "Christmas Island" ) ); | 311 | cmbCountry->insertItem( tr ( "Christmas Island" ) ); |
311 | cmbCountry->insertItem( tr ( "Colombia" ) ); | 312 | cmbCountry->insertItem( tr ( "Colombia" ) ); |
312 | cmbCountry->insertItem( tr ( "Comoros" ) ); | 313 | cmbCountry->insertItem( tr ( "Comoros" ) ); |
313 | cmbCountry->insertItem( tr ( "Congo" ) ); | 314 | cmbCountry->insertItem( tr ( "Congo" ) ); |
314 | cmbCountry->insertItem( tr ( "Cook Island" ) ); | 315 | cmbCountry->insertItem( tr ( "Cook Island" ) ); |
315 | cmbCountry->insertItem( tr ( "Costa Rica" ) ); | 316 | cmbCountry->insertItem( tr ( "Costa Rica" ) ); |
316 | cmbCountry->insertItem( tr ( "Cote d'Ivoire" ) ); | 317 | cmbCountry->insertItem( tr ( "Cote d'Ivoire" ) ); |
317 | cmbCountry->insertItem( tr ( "Croatia" ) ); | 318 | cmbCountry->insertItem( tr ( "Croatia" ) ); |
318 | cmbCountry->insertItem( tr ( "Cuba" ) ); | 319 | cmbCountry->insertItem( tr ( "Cuba" ) ); |
319 | cmbCountry->insertItem( tr ( "Cyprus" ) ); | 320 | cmbCountry->insertItem( tr ( "Cyprus" ) ); |
320 | cmbCountry->insertItem( tr ( "Czech Republic" ) ); | 321 | cmbCountry->insertItem( tr ( "Czech Republic" ) ); |
321 | cmbCountry->insertItem( tr ( "Denmark" ) ); | 322 | cmbCountry->insertItem( tr ( "Denmark" ) ); |
322 | cmbCountry->insertItem( tr ( "Djibouti" ) ); | 323 | cmbCountry->insertItem( tr ( "Djibouti" ) ); |
323 | cmbCountry->insertItem( tr ( "Dominica" ) ); | 324 | cmbCountry->insertItem( tr ( "Dominica" ) ); |
324 | cmbCountry->insertItem( tr ( "Dominican Republic" ) ); | 325 | cmbCountry->insertItem( tr ( "Dominican Republic" ) ); |
325 | cmbCountry->insertItem( tr ( "East Timor" ) ); | 326 | cmbCountry->insertItem( tr ( "East Timor" ) ); |
326 | cmbCountry->insertItem( tr ( "Ecuador" ) ); | 327 | cmbCountry->insertItem( tr ( "Ecuador" ) ); |
327 | cmbCountry->insertItem( tr ( "Egypt" ) ); | 328 | cmbCountry->insertItem( tr ( "Egypt" ) ); |
328 | cmbCountry->insertItem( tr ( "El Salvador" ) ); | 329 | cmbCountry->insertItem( tr ( "El Salvador" ) ); |
329 | cmbCountry->insertItem( tr ( "Equatorial Guinea" ) ); | 330 | cmbCountry->insertItem( tr ( "Equatorial Guinea" ) ); |
330 | cmbCountry->insertItem( tr ( "Eritrea" ) ); | 331 | cmbCountry->insertItem( tr ( "Eritrea" ) ); |
331 | cmbCountry->insertItem( tr ( "Estonia" ) ); | 332 | cmbCountry->insertItem( tr ( "Estonia" ) ); |
332 | cmbCountry->insertItem( tr ( "Ethiopia" ) ); | 333 | cmbCountry->insertItem( tr ( "Ethiopia" ) ); |
333 | cmbCountry->insertItem( tr ( "Falkland Islands" ) ); | 334 | cmbCountry->insertItem( tr ( "Falkland Islands" ) ); |
334 | cmbCountry->insertItem( tr ( "Faroe Islands" ) ); | 335 | cmbCountry->insertItem( tr ( "Faroe Islands" ) ); |
335 | cmbCountry->insertItem( tr ( "Fiji" ) ); | 336 | cmbCountry->insertItem( tr ( "Fiji" ) ); |
336 | cmbCountry->insertItem( tr ( "Finland" ) ); | 337 | cmbCountry->insertItem( tr ( "Finland" ) ); |
337 | cmbCountry->insertItem( tr ( "France" ) ); | 338 | cmbCountry->insertItem( tr ( "France" ) ); |
338 | cmbCountry->insertItem( tr ( "French Guiana" ) ); | 339 | cmbCountry->insertItem( tr ( "French Guiana" ) ); |
339 | cmbCountry->insertItem( tr ( "French Polynesia" ) ); | 340 | cmbCountry->insertItem( tr ( "French Polynesia" ) ); |
340 | cmbCountry->insertItem( tr ( "Gabon" ) ); | 341 | cmbCountry->insertItem( tr ( "Gabon" ) ); |
341 | cmbCountry->insertItem( tr ( "Gambia" ) ); | 342 | cmbCountry->insertItem( tr ( "Gambia" ) ); |
342 | cmbCountry->insertItem( tr ( "Georgia" ) ); | 343 | cmbCountry->insertItem( tr ( "Georgia" ) ); |
343 | cmbCountry->insertItem( tr ( "Germany" ) ); | 344 | cmbCountry->insertItem( tr ( "Germany" ) ); |
344 | cmbCountry->insertItem( tr ( "Ghana" ) ); | 345 | cmbCountry->insertItem( tr ( "Ghana" ) ); |
345 | cmbCountry->insertItem( tr ( "Gibraltar" ) ); | 346 | cmbCountry->insertItem( tr ( "Gibraltar" ) ); |
346 | cmbCountry->insertItem( tr ( "Greece" ) ); | 347 | cmbCountry->insertItem( tr ( "Greece" ) ); |
347 | cmbCountry->insertItem( tr ( "Greenland" ) ); | 348 | cmbCountry->insertItem( tr ( "Greenland" ) ); |
348 | cmbCountry->insertItem( tr ( "Grenada" ) ); | 349 | cmbCountry->insertItem( tr ( "Grenada" ) ); |
349 | cmbCountry->insertItem( tr ( "Guadeloupe" ) ); | 350 | cmbCountry->insertItem( tr ( "Guadeloupe" ) ); |
350 | cmbCountry->insertItem( tr ( "Guam" ) ); | 351 | cmbCountry->insertItem( tr ( "Guam" ) ); |
351 | cmbCountry->insertItem( tr ( "Guatemala" ) ); | 352 | cmbCountry->insertItem( tr ( "Guatemala" ) ); |
352 | cmbCountry->insertItem( tr ( "Guinea" ) ); | 353 | cmbCountry->insertItem( tr ( "Guinea" ) ); |
353 | cmbCountry->insertItem( tr ( "Guinea-Bissau" ) ); | 354 | cmbCountry->insertItem( tr ( "Guinea-Bissau" ) ); |
354 | cmbCountry->insertItem( tr ( "Guyana" ) ); | 355 | cmbCountry->insertItem( tr ( "Guyana" ) ); |
355 | cmbCountry->insertItem( tr ( "Haiti" ) ); | 356 | cmbCountry->insertItem( tr ( "Haiti" ) ); |
356 | cmbCountry->insertItem( tr ( "Holy See" ) ); | 357 | cmbCountry->insertItem( tr ( "Holy See" ) ); |
357 | cmbCountry->insertItem( tr ( "Honduras" ) ); | 358 | cmbCountry->insertItem( tr ( "Honduras" ) ); |
358 | cmbCountry->insertItem( tr ( "Hong Kong" ) ); | 359 | cmbCountry->insertItem( tr ( "Hong Kong" ) ); |
359 | cmbCountry->insertItem( tr ( "Hungary" ) ); | 360 | cmbCountry->insertItem( tr ( "Hungary" ) ); |
360 | cmbCountry->insertItem( tr ( "Iceland" ) ); | 361 | cmbCountry->insertItem( tr ( "Iceland" ) ); |
361 | cmbCountry->insertItem( tr ( "India" ) ); | 362 | cmbCountry->insertItem( tr ( "India" ) ); |
362 | cmbCountry->insertItem( tr ( "Indonesia" ) ); | 363 | cmbCountry->insertItem( tr ( "Indonesia" ) ); |
363 | cmbCountry->insertItem( tr ( "Ireland" ) ); | 364 | cmbCountry->insertItem( tr ( "Ireland" ) ); |
364 | cmbCountry->insertItem( tr ( "Israel" ) ); | 365 | cmbCountry->insertItem( tr ( "Israel" ) ); |
365 | cmbCountry->insertItem( tr ( "Italy" ) ); | 366 | cmbCountry->insertItem( tr ( "Italy" ) ); |
366 | cmbCountry->insertItem( tr ( "Jamaica" ) ); | 367 | cmbCountry->insertItem( tr ( "Jamaica" ) ); |
367 | cmbCountry->insertItem( tr ( "Japan" ) ); | 368 | cmbCountry->insertItem( tr ( "Japan" ) ); |
368 | cmbCountry->insertItem( tr ( "Jordan" ) ); | 369 | cmbCountry->insertItem( tr ( "Jordan" ) ); |
369 | cmbCountry->insertItem( tr ( "Kazakhstan" ) ); | 370 | cmbCountry->insertItem( tr ( "Kazakhstan" ) ); |
370 | cmbCountry->insertItem( tr ( "Kenya" ) ); | 371 | cmbCountry->insertItem( tr ( "Kenya" ) ); |
371 | cmbCountry->insertItem( tr ( "Kiribati" ) ); | 372 | cmbCountry->insertItem( tr ( "Kiribati" ) ); |
372 | cmbCountry->insertItem( tr ( "Korea" ) ); | 373 | cmbCountry->insertItem( tr ( "Korea" ) ); |
373 | cmbCountry->insertItem( tr ( "Kuwait" ) ); | 374 | cmbCountry->insertItem( tr ( "Kuwait" ) ); |
374 | cmbCountry->insertItem( tr ( "Kyrgyzstan" ) ); | 375 | cmbCountry->insertItem( tr ( "Kyrgyzstan" ) ); |
375 | cmbCountry->insertItem( tr ( "Laos" ) ); | 376 | cmbCountry->insertItem( tr ( "Laos" ) ); |
376 | cmbCountry->insertItem( tr ( "Latvia" ) ); | 377 | cmbCountry->insertItem( tr ( "Latvia" ) ); |
377 | cmbCountry->insertItem( tr ( "Lebanon" ) ); | 378 | cmbCountry->insertItem( tr ( "Lebanon" ) ); |
378 | cmbCountry->insertItem( tr ( "Lesotho" ) ); | 379 | cmbCountry->insertItem( tr ( "Lesotho" ) ); |
379 | cmbCountry->insertItem( tr ( "Liberia" ) ); | 380 | cmbCountry->insertItem( tr ( "Liberia" ) ); |
380 | cmbCountry->insertItem( tr ( "Liechtenstein" ) ); | 381 | cmbCountry->insertItem( tr ( "Liechtenstein" ) ); |
381 | cmbCountry->insertItem( tr ( "Lithuania" ) ); | 382 | cmbCountry->insertItem( tr ( "Lithuania" ) ); |
382 | cmbCountry->insertItem( tr ( "Luxembourg" ) ); | 383 | cmbCountry->insertItem( tr ( "Luxembourg" ) ); |
383 | cmbCountry->insertItem( tr ( "Macau" ) ); | 384 | cmbCountry->insertItem( tr ( "Macau" ) ); |
384 | cmbCountry->insertItem( tr ( "Macedonia" ) ); | 385 | cmbCountry->insertItem( tr ( "Macedonia" ) ); |
385 | cmbCountry->insertItem( tr ( "Madagascar" ) ); | 386 | cmbCountry->insertItem( tr ( "Madagascar" ) ); |
386 | cmbCountry->insertItem( tr ( "Malawi" ) ); | 387 | cmbCountry->insertItem( tr ( "Malawi" ) ); |
387 | cmbCountry->insertItem( tr ( "Malaysia" ) ); | 388 | cmbCountry->insertItem( tr ( "Malaysia" ) ); |
388 | cmbCountry->insertItem( tr ( "Maldives" ) ); | 389 | cmbCountry->insertItem( tr ( "Maldives" ) ); |
389 | cmbCountry->insertItem( tr ( "Mali" ) ); | 390 | cmbCountry->insertItem( tr ( "Mali" ) ); |
390 | cmbCountry->insertItem( tr ( "Malta" ) ); | 391 | cmbCountry->insertItem( tr ( "Malta" ) ); |
391 | cmbCountry->insertItem( tr ( "Martinique" ) ); | 392 | cmbCountry->insertItem( tr ( "Martinique" ) ); |
392 | cmbCountry->insertItem( tr ( "Mauritania" ) ); | 393 | cmbCountry->insertItem( tr ( "Mauritania" ) ); |
393 | cmbCountry->insertItem( tr ( "Mauritius" ) ); | 394 | cmbCountry->insertItem( tr ( "Mauritius" ) ); |
394 | cmbCountry->insertItem( tr ( "Mayotte" ) ); | 395 | cmbCountry->insertItem( tr ( "Mayotte" ) ); |
395 | cmbCountry->insertItem( tr ( "Mexico" ) ); | 396 | cmbCountry->insertItem( tr ( "Mexico" ) ); |
396 | cmbCountry->insertItem( tr ( "Micronesia" ) ); | 397 | cmbCountry->insertItem( tr ( "Micronesia" ) ); |
397 | cmbCountry->insertItem( tr ( "Moldova" ) ); | 398 | cmbCountry->insertItem( tr ( "Moldova" ) ); |
398 | cmbCountry->insertItem( tr ( "Monaco" ) ); | 399 | cmbCountry->insertItem( tr ( "Monaco" ) ); |
399 | cmbCountry->insertItem( tr ( "Mongolia" ) ); | 400 | cmbCountry->insertItem( tr ( "Mongolia" ) ); |
400 | cmbCountry->insertItem( tr ( "Montserrat" ) ); | 401 | cmbCountry->insertItem( tr ( "Montserrat" ) ); |
401 | cmbCountry->insertItem( tr ( "Morocco" ) ); | 402 | cmbCountry->insertItem( tr ( "Morocco" ) ); |
402 | cmbCountry->insertItem( tr ( "Mozambique" ) ); | 403 | cmbCountry->insertItem( tr ( "Mozambique" ) ); |
403 | cmbCountry->insertItem( tr ( "Myanmar" ) ); | 404 | cmbCountry->insertItem( tr ( "Myanmar" ) ); |
404 | cmbCountry->insertItem( tr ( "Namibia" ) ); | 405 | cmbCountry->insertItem( tr ( "Namibia" ) ); |
405 | cmbCountry->insertItem( tr ( "Nauru" ) ); | 406 | cmbCountry->insertItem( tr ( "Nauru" ) ); |
406 | cmbCountry->insertItem( tr ( "Nepal" ) ); | 407 | cmbCountry->insertItem( tr ( "Nepal" ) ); |
407 | cmbCountry->insertItem( tr ( "Netherlands" ) ); | 408 | cmbCountry->insertItem( tr ( "Netherlands" ) ); |
408 | cmbCountry->insertItem( tr ( "New Caledonia" ) ); | 409 | cmbCountry->insertItem( tr ( "New Caledonia" ) ); |
409 | cmbCountry->insertItem( tr ( "New Zealand" ) ); | 410 | cmbCountry->insertItem( tr ( "New Zealand" ) ); |
410 | cmbCountry->insertItem( tr ( "Nicaragua" ) ); | 411 | cmbCountry->insertItem( tr ( "Nicaragua" ) ); |
411 | cmbCountry->insertItem( tr ( "Niger" ) ); | 412 | cmbCountry->insertItem( tr ( "Niger" ) ); |
412 | cmbCountry->insertItem( tr ( "Nigeria" ) ); | 413 | cmbCountry->insertItem( tr ( "Nigeria" ) ); |
413 | cmbCountry->insertItem( tr ( "Niue" ) ); | 414 | cmbCountry->insertItem( tr ( "Niue" ) ); |
414 | cmbCountry->insertItem( tr ( "Norway" ) ); | 415 | cmbCountry->insertItem( tr ( "Norway" ) ); |
415 | cmbCountry->insertItem( tr ( "Oman" ) ); | 416 | cmbCountry->insertItem( tr ( "Oman" ) ); |
416 | cmbCountry->insertItem( tr ( "Pakistan" ) ); | 417 | cmbCountry->insertItem( tr ( "Pakistan" ) ); |
417 | cmbCountry->insertItem( tr ( "Palau" ) ); | 418 | cmbCountry->insertItem( tr ( "Palau" ) ); |
418 | cmbCountry->insertItem( tr ( "Palestinian Sovereign Areas" ) ); | 419 | cmbCountry->insertItem( tr ( "Palestinian Sovereign Areas" ) ); |
419 | cmbCountry->insertItem( tr ( "Panama" ) ); | 420 | cmbCountry->insertItem( tr ( "Panama" ) ); |
420 | cmbCountry->insertItem( tr ( "Papua New Guinea" ) ); | 421 | cmbCountry->insertItem( tr ( "Papua New Guinea" ) ); |
421 | cmbCountry->insertItem( tr ( "Paraguay" ) ); | 422 | cmbCountry->insertItem( tr ( "Paraguay" ) ); |
422 | cmbCountry->insertItem( tr ( "Peru" ) ); | 423 | cmbCountry->insertItem( tr ( "Peru" ) ); |
423 | cmbCountry->insertItem( tr ( "Philippines" ) ); | 424 | cmbCountry->insertItem( tr ( "Philippines" ) ); |
424 | cmbCountry->insertItem( tr ( "Pitcairn Islands" ) ); | 425 | cmbCountry->insertItem( tr ( "Pitcairn Islands" ) ); |
425 | cmbCountry->insertItem( tr ( "Poland" ) ); | 426 | cmbCountry->insertItem( tr ( "Poland" ) ); |
426 | cmbCountry->insertItem( tr ( "Portugal" ) ); | 427 | cmbCountry->insertItem( tr ( "Portugal" ) ); |
427 | cmbCountry->insertItem( tr ( "Puerto Rico" ) ); | 428 | cmbCountry->insertItem( tr ( "Puerto Rico" ) ); |
428 | cmbCountry->insertItem( tr ( "Qatar" ) ); | 429 | cmbCountry->insertItem( tr ( "Qatar" ) ); |
429 | cmbCountry->insertItem( tr ( "Reunion" ) ); | 430 | cmbCountry->insertItem( tr ( "Reunion" ) ); |
430 | cmbCountry->insertItem( tr ( "Romania" ) ); | 431 | cmbCountry->insertItem( tr ( "Romania" ) ); |
431 | cmbCountry->insertItem( tr ( "Russia" ) ); | 432 | cmbCountry->insertItem( tr ( "Russia" ) ); |
432 | cmbCountry->insertItem( tr ( "Rwanda" ) ); | 433 | cmbCountry->insertItem( tr ( "Rwanda" ) ); |
433 | cmbCountry->insertItem( tr ( "Saint Lucia" ) ); | 434 | cmbCountry->insertItem( tr ( "Saint Lucia" ) ); |
434 | cmbCountry->insertItem( tr ( "Samoa" ) ); | 435 | cmbCountry->insertItem( tr ( "Samoa" ) ); |
435 | cmbCountry->insertItem( tr ( "San Marino" ) ); | 436 | cmbCountry->insertItem( tr ( "San Marino" ) ); |
436 | cmbCountry->insertItem( tr ( "Saudi Arabia" ) ); | 437 | cmbCountry->insertItem( tr ( "Saudi Arabia" ) ); |
437 | cmbCountry->insertItem( tr ( "Senegal" ) ); | 438 | cmbCountry->insertItem( tr ( "Senegal" ) ); |
438 | cmbCountry->insertItem( tr ( "Seychelles" ) ); | 439 | cmbCountry->insertItem( tr ( "Seychelles" ) ); |
439 | cmbCountry->insertItem( tr ( "Sierra Leone" ) ); | 440 | cmbCountry->insertItem( tr ( "Sierra Leone" ) ); |
440 | cmbCountry->insertItem( tr ( "Singapore" ) ); | 441 | cmbCountry->insertItem( tr ( "Singapore" ) ); |
441 | cmbCountry->insertItem( tr ( "Slovakia" ) ); | 442 | cmbCountry->insertItem( tr ( "Slovakia" ) ); |
442 | cmbCountry->insertItem( tr ( "Slovenia" ) ); | 443 | cmbCountry->insertItem( tr ( "Slovenia" ) ); |
443 | cmbCountry->insertItem( tr ( "Solomon Islands" ) ); | 444 | cmbCountry->insertItem( tr ( "Solomon Islands" ) ); |
444 | cmbCountry->insertItem( tr ( "Somalia" ) ); | 445 | cmbCountry->insertItem( tr ( "Somalia" ) ); |
445 | cmbCountry->insertItem( tr ( "South Africa" ) ); | 446 | cmbCountry->insertItem( tr ( "South Africa" ) ); |
446 | cmbCountry->insertItem( tr ( "Spain" ) ); | 447 | cmbCountry->insertItem( tr ( "Spain" ) ); |
447 | cmbCountry->insertItem( tr ( "Sri Lanka" ) ); | 448 | cmbCountry->insertItem( tr ( "Sri Lanka" ) ); |
448 | cmbCountry->insertItem( tr ( "St. Helena" ) ); | 449 | cmbCountry->insertItem( tr ( "St. Helena" ) ); |
449 | cmbCountry->insertItem( tr ( "Sudan" ) ); | 450 | cmbCountry->insertItem( tr ( "Sudan" ) ); |
450 | cmbCountry->insertItem( tr ( "Suriname" ) ); | 451 | cmbCountry->insertItem( tr ( "Suriname" ) ); |
451 | cmbCountry->insertItem( tr ( "Swaziland" ) ); | 452 | cmbCountry->insertItem( tr ( "Swaziland" ) ); |
452 | cmbCountry->insertItem( tr ( "Sweden" ) ); | 453 | cmbCountry->insertItem( tr ( "Sweden" ) ); |
453 | cmbCountry->insertItem( tr ( "Switzerland" ) ); | 454 | cmbCountry->insertItem( tr ( "Switzerland" ) ); |
454 | cmbCountry->insertItem( tr ( "Taiwan" ) ); | 455 | cmbCountry->insertItem( tr ( "Taiwan" ) ); |
455 | cmbCountry->insertItem( tr ( "Tajikistan" ) ); | 456 | cmbCountry->insertItem( tr ( "Tajikistan" ) ); |
456 | cmbCountry->insertItem( tr ( "Tanzania" ) ); | 457 | cmbCountry->insertItem( tr ( "Tanzania" ) ); |
457 | cmbCountry->insertItem( tr ( "Thailand" ) ); | 458 | cmbCountry->insertItem( tr ( "Thailand" ) ); |
458 | cmbCountry->insertItem( tr ( "Togo" ) ); | 459 | cmbCountry->insertItem( tr ( "Togo" ) ); |
459 | cmbCountry->insertItem( tr ( "Tokelau" ) ); | 460 | cmbCountry->insertItem( tr ( "Tokelau" ) ); |
460 | cmbCountry->insertItem( tr ( "Tonga" ) ); | 461 | cmbCountry->insertItem( tr ( "Tonga" ) ); |
461 | cmbCountry->insertItem( tr ( "Tunisia" ) ); | 462 | cmbCountry->insertItem( tr ( "Tunisia" ) ); |
462 | cmbCountry->insertItem( tr ( "Turkey" ) ); | 463 | cmbCountry->insertItem( tr ( "Turkey" ) ); |
463 | cmbCountry->insertItem( tr ( "Turkmenistan" ) ); | 464 | cmbCountry->insertItem( tr ( "Turkmenistan" ) ); |
464 | cmbCountry->insertItem( tr ( "Tuvalu" ) ); | 465 | cmbCountry->insertItem( tr ( "Tuvalu" ) ); |
465 | cmbCountry->insertItem( tr ( "Uganda" ) ); | 466 | cmbCountry->insertItem( tr ( "Uganda" ) ); |
466 | cmbCountry->insertItem( tr ( "Ukraine" ) ); | 467 | cmbCountry->insertItem( tr ( "Ukraine" ) ); |
467 | cmbCountry->insertItem( tr ( "Uruguay" ) ); | 468 | cmbCountry->insertItem( tr ( "Uruguay" ) ); |
468 | cmbCountry->insertItem( tr ( "Uzbekistan" ) ); | 469 | cmbCountry->insertItem( tr ( "Uzbekistan" ) ); |
469 | cmbCountry->insertItem( tr ( "Vanuatu" ) ); | 470 | cmbCountry->insertItem( tr ( "Vanuatu" ) ); |
470 | cmbCountry->insertItem( tr ( "Venezuela" ) ); | 471 | cmbCountry->insertItem( tr ( "Venezuela" ) ); |
471 | cmbCountry->insertItem( tr ( "Vietnam" ) ); | 472 | cmbCountry->insertItem( tr ( "Vietnam" ) ); |
472 | cmbCountry->insertItem( tr ( "Virgin Islands" ) ); | 473 | cmbCountry->insertItem( tr ( "Virgin Islands" ) ); |
473 | cmbCountry->insertItem( tr ( "Western Sahara" ) ); | 474 | cmbCountry->insertItem( tr ( "Western Sahara" ) ); |
474 | cmbCountry->insertItem( tr ( "Yemen" ) ); | 475 | cmbCountry->insertItem( tr ( "Yemen" ) ); |
475 | cmbCountry->insertItem( tr ( "Yugoslavia" ) ); | 476 | cmbCountry->insertItem( tr ( "Yugoslavia" ) ); |
476 | cmbCountry->insertItem( tr ( "Zambia" ) ); | 477 | cmbCountry->insertItem( tr ( "Zambia" ) ); |
477 | cmbCountry->insertItem( tr ( "Zimbabwe" ) ); | 478 | cmbCountry->insertItem( tr ( "Zimbabwe" ) ); |
478 | if (cmbCountry->listBox()!=0) | 479 | if (cmbCountry->listBox()!=0) |
479 | cmbCountry->listBox()->sort(); | 480 | cmbCountry->listBox()->sort(); |
480 | 481 | ||
481 | cmbCountry->setMaximumWidth( 135 ); | 482 | cmbCountry->setMaximumWidth( 135 ); |
482 | 483 | ||
483 | gl->addMultiCellWidget( cmbCountry, 5, 5, 1, 2 ); | 484 | gl->addMultiCellWidget( cmbCountry, 5, 5, 1, 2 ); |
484 | 485 | ||
485 | // Chooser 4 | 486 | // Chooser 4 |
486 | cmbChooserField4 = new QComboBox( false, container ); | 487 | cmbChooserField4 = new QComboBox( false, container ); |
487 | cmbChooserField4->setMaximumWidth( 90 ); | 488 | cmbChooserField4->setMaximumWidth( 90 ); |
488 | gl->addWidget( cmbChooserField4, 6, 0 ); | 489 | gl->addWidget( cmbChooserField4, 6, 0 ); |
489 | // Textfield for chooser 2 | 490 | // Textfield for chooser 2 |
490 | // Now use WidgetStack to contain the textfield and the default-email combo! | 491 | // Now use WidgetStack to contain the textfield and the default-email combo! |
491 | m_widgetStack4 = new QWidgetStack( container ); | 492 | m_widgetStack4 = new QWidgetStack( container ); |
492 | txtChooserField4 = new QLineEdit( m_widgetStack4 ); | 493 | txtChooserField4 = new QLineEdit( m_widgetStack4 ); |
493 | m_widgetStack4 -> addWidget( txtChooserField4, TextField ); | 494 | m_widgetStack4 -> addWidget( txtChooserField4, TextField ); |
494 | gl->addMultiCellWidget( m_widgetStack4, 6, 6, 1, 2 ); | 495 | gl->addMultiCellWidget( m_widgetStack4, 6, 6, 1, 2 ); |
495 | m_widgetStack4 -> raiseWidget( TextField ); | 496 | m_widgetStack4 -> raiseWidget( TextField ); |
496 | 497 | ||
497 | QSpacerItem *space = new QSpacerItem(1,1, | 498 | QSpacerItem *space = new QSpacerItem(1,1, |
498 | QSizePolicy::Maximum, | 499 | QSizePolicy::Maximum, |
499 | QSizePolicy::MinimumExpanding ); | 500 | QSizePolicy::MinimumExpanding ); |
500 | gl->addItem( space, 7, 0 ); | 501 | gl->addItem( space, 7, 0 ); |
501 | 502 | ||
502 | tabMain->addTab( tabViewport, "home", tr( "Address" ) ); | 503 | tabMain->addTab( tabViewport, "home", tr( "Address" ) ); |
503 | 504 | ||
504 | tabViewport = new QWidget ( tabMain ); | 505 | tabViewport = new QWidget ( tabMain ); |
505 | 506 | ||
506 | vb = new QVBoxLayout( tabViewport ); | 507 | vb = new QVBoxLayout( tabViewport ); |
507 | 508 | ||
508 | svDetails = new QScrollView( tabViewport ); | 509 | svDetails = new QScrollView( tabViewport ); |
509 | vb->addWidget( svDetails, 0, 0 ); | 510 | vb->addWidget( svDetails, 0, 0 ); |
510 | svDetails->setResizePolicy( QScrollView::AutoOneFit ); | 511 | svDetails->setResizePolicy( QScrollView::AutoOneFit ); |
511 | svDetails->setFrameStyle( QFrame::NoFrame ); | 512 | svDetails->setFrameStyle( QFrame::NoFrame ); |
512 | 513 | ||
513 | container = new QWidget( svDetails->viewport() ); | 514 | container = new QWidget( svDetails->viewport() ); |
514 | svDetails->addChild( container ); | 515 | svDetails->addChild( container ); |
515 | 516 | ||
516 | gl = new QGridLayout( container, 1, 2, 2, 4 ); | 517 | gl = new QGridLayout( container, 1, 2, 2, 4 ); |
517 | 518 | ||
518 | int counter = 0; | 519 | int counter = 0; |
519 | 520 | ||
520 | // Birthday | 521 | // Birthday |
521 | QHBox* hBox = new QHBox( container ); | 522 | QHBox* hBox = new QHBox( container ); |
522 | l = new QLabel( tr("Birthday"), container ); | 523 | l = new QLabel( tr("Birthday"), container ); |
523 | gl->addWidget( l, counter, 0 ); | 524 | gl->addWidget( l, counter, 0 ); |
524 | 525 | ||
525 | QPopupMenu* m1 = new QPopupMenu( container ); | 526 | QPopupMenu* m1 = new QPopupMenu( container ); |
526 | birthdayPicker = new DateBookMonth( m1, 0, true ); | 527 | birthdayPicker = new DateBookMonth( m1, 0, true ); |
527 | m1->insertItem( birthdayPicker ); | 528 | m1->insertItem( birthdayPicker ); |
528 | 529 | ||
529 | birthdayButton= new QToolButton( hBox, "buttonStart" ); | 530 | birthdayButton= new QToolButton( hBox, "buttonStart" ); |
530 | birthdayButton->setPopup( m1 ); | 531 | birthdayButton->setPopup( m1 ); |
531 | birthdayButton->setPopupDelay(0); | 532 | birthdayButton->setPopupDelay(0); |
532 | 533 | ||
533 | QPushButton* deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), | 534 | QPushButton* deleteButton = new QPushButton( Opie::Core::OResource::loadPixmap( "trash", Opie::Core::OResource::SmallIcon ), |
534 | tr( "Delete" ), | 535 | tr( "Delete" ), |
535 | hBox, 0 ); | 536 | hBox, 0 ); |
536 | 537 | ||
537 | gl->addWidget( hBox, counter , 1 ); | 538 | gl->addWidget( hBox, counter , 1 ); |
538 | 539 | ||
539 | connect( birthdayPicker, SIGNAL( dateClicked(int,int,int) ), | 540 | connect( birthdayPicker, SIGNAL( dateClicked(int,int,int) ), |
540 | this, SLOT( slotBirthdayDateChanged(int,int,int) ) ); | 541 | this, SLOT( slotBirthdayDateChanged(int,int,int) ) ); |
541 | connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveBirthday() ) ); | 542 | connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveBirthday() ) ); |
542 | 543 | ||
543 | ++counter; | 544 | ++counter; |
544 | 545 | ||
545 | // Anniversary | 546 | // Anniversary |
546 | hBox = new QHBox( container ); | 547 | hBox = new QHBox( container ); |
547 | l = new QLabel( tr("Anniversary"), container ); | 548 | l = new QLabel( tr("Anniversary"), container ); |
548 | gl->addWidget( l, counter, 0 ); | 549 | gl->addWidget( l, counter, 0 ); |
549 | 550 | ||
550 | m1 = new QPopupMenu( container ); | 551 | m1 = new QPopupMenu( container ); |
551 | anniversaryPicker = new DateBookMonth( m1, 0, true ); | 552 | anniversaryPicker = new DateBookMonth( m1, 0, true ); |
552 | m1->insertItem( anniversaryPicker ); | 553 | m1->insertItem( anniversaryPicker ); |
553 | 554 | ||
554 | anniversaryButton= new QToolButton( hBox, "buttonStart" ); | 555 | anniversaryButton= new QToolButton( hBox, "buttonStart" ); |
555 | anniversaryButton->setPopup( m1 ); | 556 | anniversaryButton->setPopup( m1 ); |
556 | anniversaryButton->setPopupDelay(0); | 557 | anniversaryButton->setPopupDelay(0); |
557 | 558 | ||
558 | deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), | 559 | deleteButton = new QPushButton( Opie::Core::OResource::loadPixmap( "trash", Opie::Core::OResource::SmallIcon ), |
559 | tr( "Delete" ), | 560 | tr( "Delete" ), |
560 | hBox, 0 ); | 561 | hBox, 0 ); |
561 | gl->addWidget( hBox, counter , 1 ); | 562 | gl->addWidget( hBox, counter , 1 ); |
562 | 563 | ||
563 | connect( anniversaryPicker, SIGNAL( dateClicked(int,int,int) ), | 564 | connect( anniversaryPicker, SIGNAL( dateClicked(int,int,int) ), |
564 | this, SLOT( slotAnniversaryDateChanged(int,int,int) ) ); | 565 | this, SLOT( slotAnniversaryDateChanged(int,int,int) ) ); |
565 | connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveAnniversary() ) ); | 566 | connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveAnniversary() ) ); |
566 | 567 | ||
567 | ++counter; | 568 | ++counter; |
568 | 569 | ||
569 | // Gender | 570 | // Gender |
570 | l = new QLabel( tr("Gender"), container ); | 571 | l = new QLabel( tr("Gender"), container ); |
571 | gl->addWidget( l, counter, 0 ); | 572 | gl->addWidget( l, counter, 0 ); |
572 | cmbGender = new QComboBox( container ); | 573 | cmbGender = new QComboBox( container ); |
573 | cmbGender->insertItem( "", 0 ); | 574 | cmbGender->insertItem( "", 0 ); |
574 | cmbGender->insertItem( tr("Male"), 1); | 575 | cmbGender->insertItem( tr("Male"), 1); |
575 | cmbGender->insertItem( tr("Female"), 2); | 576 | cmbGender->insertItem( tr("Female"), 2); |
576 | gl->addWidget( cmbGender, counter, 1 ); | 577 | gl->addWidget( cmbGender, counter, 1 ); |
577 | 578 | ||
578 | ++counter; | 579 | ++counter; |
579 | 580 | ||
580 | // Create Labels and lineedit fields for every dynamic entry | 581 | // Create Labels and lineedit fields for every dynamic entry |
581 | QStringList::ConstIterator it = slDynamicEntries.begin(); | 582 | QStringList::ConstIterator it = slDynamicEntries.begin(); |
582 | QMap<QString, int> mapStrToID = Opie::OPimContactFields::untrFieldsToId(); | 583 | QMap<QString, int> mapStrToID = Opie::OPimContactFields::untrFieldsToId(); |
583 | QMap<int, QString> mapIdToStr = Opie::OPimContactFields::idToTrFields(); | 584 | QMap<int, QString> mapIdToStr = Opie::OPimContactFields::idToTrFields(); |
584 | for (i = counter; it != slDynamicEntries.end(); i++, ++it ) { | 585 | for (i = counter; it != slDynamicEntries.end(); i++, ++it ) { |
585 | 586 | ||
586 | if (((*it) == "Anniversary") || | 587 | if (((*it) == "Anniversary") || |
587 | ((*it) == "Birthday")|| ((*it) == "Gender")) continue; | 588 | ((*it) == "Birthday")|| ((*it) == "Gender")) continue; |
588 | 589 | ||
589 | l = new QLabel( mapIdToStr[mapStrToID[*it]], container ); | 590 | l = new QLabel( mapIdToStr[mapStrToID[*it]], container ); |
590 | listName.append( l ); | 591 | listName.append( l ); |
591 | gl->addWidget( l, i, 0 ); | 592 | gl->addWidget( l, i, 0 ); |
592 | QLineEdit *e = new QLineEdit( container ); | 593 | QLineEdit *e = new QLineEdit( container ); |
593 | listValue.append( e ); | 594 | listValue.append( e ); |
594 | gl->addWidget( e, i, 1); | 595 | gl->addWidget( e, i, 1); |
595 | } | 596 | } |
596 | // Fill labels with names.. | 597 | // Fill labels with names.. |
597 | //loadFields(); | 598 | //loadFields(); |
598 | 599 | ||
599 | 600 | ||
600 | tabMain->addTab( tabViewport, "UtilsIcon", tr( "Details" ) ); | 601 | tabMain->addTab( tabViewport, "UtilsIcon", tr( "Details" ) ); |
601 | 602 | ||
602 | dlgNote = new QDialog( this, "Note Dialog", true ); | 603 | dlgNote = new QDialog( this, "Note Dialog", true ); |
603 | dlgNote->setCaption( tr("Enter Note") ); | 604 | dlgNote->setCaption( tr("Enter Note") ); |
604 | QVBoxLayout *vbNote = new QVBoxLayout( dlgNote ); | 605 | QVBoxLayout *vbNote = new QVBoxLayout( dlgNote ); |
605 | txtNote = new QMultiLineEdit( dlgNote ); | 606 | txtNote = new QMultiLineEdit( dlgNote ); |
606 | vbNote->addWidget( txtNote ); | 607 | vbNote->addWidget( txtNote ); |
607 | connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) ); | 608 | connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) ); |
608 | 609 | ||
609 | dlgName = new QDialog( this, "Name Dialog", true ); | 610 | dlgName = new QDialog( this, "Name Dialog", true ); |
610 | dlgName->setCaption( tr("Edit Name") ); | 611 | dlgName->setCaption( tr("Edit Name") ); |
611 | gl = new QGridLayout( dlgName, 5, 2, 2, 3 ); | 612 | gl = new QGridLayout( dlgName, 5, 2, 2, 3 ); |
612 | 613 | ||
613 | l = new QLabel( tr("First Name"), dlgName ); | 614 | l = new QLabel( tr("First Name"), dlgName ); |
614 | gl->addWidget( l, 0, 0 ); | 615 | gl->addWidget( l, 0, 0 ); |
615 | txtFirstName = new ABOOK::NameLineEdit( dlgName ); | 616 | txtFirstName = new ABOOK::NameLineEdit( dlgName ); |
616 | gl->addWidget( txtFirstName, 0, 1 ); | 617 | gl->addWidget( txtFirstName, 0, 1 ); |
617 | 618 | ||
618 | l = new QLabel( tr("Middle Name"), dlgName ); | 619 | l = new QLabel( tr("Middle Name"), dlgName ); |
619 | gl->addWidget( l, 1, 0 ); | 620 | gl->addWidget( l, 1, 0 ); |
620 | txtMiddleName = new ABOOK::NameLineEdit( dlgName ); | 621 | txtMiddleName = new ABOOK::NameLineEdit( dlgName ); |
621 | gl->addWidget( txtMiddleName, 1, 1 ); | 622 | gl->addWidget( txtMiddleName, 1, 1 ); |
622 | 623 | ||
623 | l = new QLabel( tr("Last Name"), dlgName ); | 624 | l = new QLabel( tr("Last Name"), dlgName ); |
624 | gl->addWidget( l, 2, 0 ); | 625 | gl->addWidget( l, 2, 0 ); |
625 | txtLastName = new ABOOK::NameLineEdit( dlgName ); | 626 | txtLastName = new ABOOK::NameLineEdit( dlgName ); |
626 | gl->addWidget( txtLastName, 2, 1 ); | 627 | gl->addWidget( txtLastName, 2, 1 ); |
627 | 628 | ||
628 | // l = new QLabel( tr("Suffix"), dlgName ); | 629 | // l = new QLabel( tr("Suffix"), dlgName ); |
629 | // gl->addWidget( l, 3, 0 ); | 630 | // gl->addWidget( l, 3, 0 ); |
630 | // txtSuffix = new QLineEdit( dlgName ); | 631 | // txtSuffix = new QLineEdit( dlgName ); |
631 | // gl->addWidget( txtSuffix, 3, 1 ); | 632 | // gl->addWidget( txtSuffix, 3, 1 ); |
632 | space = new QSpacerItem(1,1, | 633 | space = new QSpacerItem(1,1, |
633 | QSizePolicy::Maximum, | 634 | QSizePolicy::Maximum, |
634 | QSizePolicy::MinimumExpanding ); | 635 | QSizePolicy::MinimumExpanding ); |
635 | gl->addItem( space, 4, 0 ); | 636 | gl->addItem( space, 4, 0 ); |
636 | 637 | ||
637 | cmbChooserField1->insertStringList( trlChooserNames ); | 638 | cmbChooserField1->insertStringList( trlChooserNames ); |
638 | cmbChooserField2->insertStringList( trlChooserNames ); | 639 | cmbChooserField2->insertStringList( trlChooserNames ); |
639 | cmbChooserField3->insertStringList( trlChooserNames ); | 640 | cmbChooserField3->insertStringList( trlChooserNames ); |
640 | cmbChooserField4->insertStringList( trlChooserNames ); | 641 | cmbChooserField4->insertStringList( trlChooserNames ); |
641 | 642 | ||
642 | cmbChooserField1->setCurrentItem( 0 ); | 643 | cmbChooserField1->setCurrentItem( 0 ); |
643 | cmbChooserField2->setCurrentItem( 1 ); | 644 | cmbChooserField2->setCurrentItem( 1 ); |
644 | cmbChooserField3->setCurrentItem( 2 ); | 645 | cmbChooserField3->setCurrentItem( 2 ); |
645 | 646 | ||
646 | connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) ); | 647 | connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) ); |
647 | 648 | ||
648 | connect( txtFullName, SIGNAL(textChanged(const QString&)), | 649 | connect( txtFullName, SIGNAL(textChanged(const QString&)), |
649 | this, SLOT(slotFullNameChange(const QString&)) ); | 650 | this, SLOT(slotFullNameChange(const QString&)) ); |
650 | connect( txtSuffix, SIGNAL(textChanged(const QString&)), | 651 | connect( txtSuffix, SIGNAL(textChanged(const QString&)), |
651 | this, SLOT(slotSuffixChange(const QString&)) ); | 652 | this, SLOT(slotSuffixChange(const QString&)) ); |
652 | connect( txtOrganization, SIGNAL(textChanged(const QString&)), | 653 | connect( txtOrganization, SIGNAL(textChanged(const QString&)), |
653 | this, SLOT(slotOrganizationChange(const QString&)) ); | 654 | this, SLOT(slotOrganizationChange(const QString&)) ); |
654 | connect( txtChooserField1, SIGNAL(textChanged(const QString&)), | 655 | connect( txtChooserField1, SIGNAL(textChanged(const QString&)), |
655 | this, SLOT(slotChooser1Change(const QString&)) ); | 656 | this, SLOT(slotChooser1Change(const QString&)) ); |
656 | connect( txtChooserField2, SIGNAL(textChanged(const QString&)), | 657 | connect( txtChooserField2, SIGNAL(textChanged(const QString&)), |
657 | this, SLOT(slotChooser2Change(const QString&)) ); | 658 | this, SLOT(slotChooser2Change(const QString&)) ); |
658 | connect( txtChooserField3, SIGNAL(textChanged(const QString&)), | 659 | connect( txtChooserField3, SIGNAL(textChanged(const QString&)), |
659 | this, SLOT(slotChooser3Change(const QString&)) ); | 660 | this, SLOT(slotChooser3Change(const QString&)) ); |
660 | connect( txtChooserField4, SIGNAL(textChanged(const QString&)), | 661 | connect( txtChooserField4, SIGNAL(textChanged(const QString&)), |
661 | this, SLOT(slotChooser4Change(const QString&)) ); | 662 | this, SLOT(slotChooser4Change(const QString&)) ); |
662 | connect( txtAddress, SIGNAL(textChanged(const QString&)), | 663 | connect( txtAddress, SIGNAL(textChanged(const QString&)), |
663 | this, SLOT(slotAddressChange(const QString&)) ); | 664 | this, SLOT(slotAddressChange(const QString&)) ); |
664 | connect( txtCity, SIGNAL(textChanged(const QString&)), | 665 | connect( txtCity, SIGNAL(textChanged(const QString&)), |
665 | this, SLOT(slotCityChange(const QString&)) ); | 666 | this, SLOT(slotCityChange(const QString&)) ); |
666 | connect( txtState, SIGNAL(textChanged(const QString&)), | 667 | connect( txtState, SIGNAL(textChanged(const QString&)), |
667 | this, SLOT(slotStateChange(const QString&)) ); | 668 | this, SLOT(slotStateChange(const QString&)) ); |
668 | connect( txtZip, SIGNAL(textChanged(const QString&)), | 669 | connect( txtZip, SIGNAL(textChanged(const QString&)), |
669 | this, SLOT(slotZipChange(const QString&)) ); | 670 | this, SLOT(slotZipChange(const QString&)) ); |
670 | connect( cmbCountry, SIGNAL(textChanged(const QString&)), | 671 | connect( cmbCountry, SIGNAL(textChanged(const QString&)), |
671 | this, SLOT(slotCountryChange(const QString&)) ); | 672 | this, SLOT(slotCountryChange(const QString&)) ); |
672 | connect( cmbCountry, SIGNAL(activated(const QString&)), | 673 | connect( cmbCountry, SIGNAL(activated(const QString&)), |
673 | this, SLOT(slotCountryChange(const QString&)) ); | 674 | this, SLOT(slotCountryChange(const QString&)) ); |
674 | connect( cmbChooserField1, SIGNAL(activated(int)), | 675 | connect( cmbChooserField1, SIGNAL(activated(int)), |
675 | this, SLOT(slotCmbChooser1Change(int)) ); | 676 | this, SLOT(slotCmbChooser1Change(int)) ); |
676 | connect( cmbChooserField2, SIGNAL(activated(int)), | 677 | connect( cmbChooserField2, SIGNAL(activated(int)), |
677 | this, SLOT(slotCmbChooser2Change(int)) ); | 678 | this, SLOT(slotCmbChooser2Change(int)) ); |
678 | connect( cmbChooserField3, SIGNAL(activated(int)), | 679 | connect( cmbChooserField3, SIGNAL(activated(int)), |
679 | this, SLOT(slotCmbChooser3Change(int)) ); | 680 | this, SLOT(slotCmbChooser3Change(int)) ); |
680 | connect( cmbChooserField4, SIGNAL(activated(int)), | 681 | connect( cmbChooserField4, SIGNAL(activated(int)), |
681 | this, SLOT(slotCmbChooser4Change(int)) ); | 682 | this, SLOT(slotCmbChooser4Change(int)) ); |
682 | connect( cmbAddress, SIGNAL(activated(int)), | 683 | connect( cmbAddress, SIGNAL(activated(int)), |
683 | this, SLOT(slotAddressTypeChange(int)) ); | 684 | this, SLOT(slotAddressTypeChange(int)) ); |
684 | 685 | ||
685 | new QPEDialogListener(this); | 686 | new QPEDialogListener(this); |
686 | 687 | ||
687 | setPersonalView ( m_personalView ); | 688 | setPersonalView ( m_personalView ); |
688 | 689 | ||
689 | odebug << "init() END" << oendl; | 690 | odebug << "init() END" << oendl; |
690 | } | 691 | } |
691 | 692 | ||
692 | void ContactEditor::defaultEmailChanged(int i){ | 693 | void ContactEditor::defaultEmailChanged(int i){ |
693 | odebug << "defaultEmailChanged" << oendl; | 694 | odebug << "defaultEmailChanged" << oendl; |
694 | 695 | ||
695 | // was sollte das ? (se) | 696 | // was sollte das ? (se) |
696 | // int index = cmbChooserField1->currentItem(); | 697 | // int index = cmbChooserField1->currentItem(); |
697 | // slChooserValues[index] = cmbDefaultEmail->text(i); | 698 | // slChooserValues[index] = cmbDefaultEmail->text(i); |
698 | 699 | ||
699 | defaultEmail = cmbDefaultEmail->text(i); | 700 | defaultEmail = cmbDefaultEmail->text(i); |
700 | odebug << "Changed to: " << defaultEmail << oendl; | 701 | odebug << "Changed to: " << defaultEmail << oendl; |
701 | 702 | ||
702 | } | 703 | } |
703 | 704 | ||
704 | void ContactEditor::populateDefaultEmailCmb(){ | 705 | void ContactEditor::populateDefaultEmailCmb(){ |
705 | 706 | ||
706 | // if the default-email combo was not selected and therfore not created | 707 | // if the default-email combo was not selected and therfore not created |
707 | // we get a lot of trouble.. Therfore create an invisible one.. | 708 | // we get a lot of trouble.. Therfore create an invisible one.. |
708 | if ( !cmbDefaultEmail ){ | 709 | if ( !cmbDefaultEmail ){ |
709 | cmbDefaultEmail = new QComboBox(this); | 710 | cmbDefaultEmail = new QComboBox(this); |
710 | cmbDefaultEmail -> hide(); | 711 | cmbDefaultEmail -> hide(); |
711 | } | 712 | } |
712 | cmbDefaultEmail->clear(); | 713 | cmbDefaultEmail->clear(); |
713 | cmbDefaultEmail->insertStringList( emails ); | 714 | cmbDefaultEmail->insertStringList( emails ); |
714 | // cmbDefaultEmail->show(); | 715 | // cmbDefaultEmail->show(); |
715 | 716 | ||
716 | // Select default email in combo.. | 717 | // Select default email in combo.. |
717 | bool found = false; | 718 | bool found = false; |
718 | for ( int i = 0; i < cmbDefaultEmail->count(); i++){ | 719 | for ( int i = 0; i < cmbDefaultEmail->count(); i++){ |
719 | odebug << " populateDefaultEmailCmb text >" << cmbDefaultEmail->text( i ) | 720 | odebug << " populateDefaultEmailCmb text >" << cmbDefaultEmail->text( i ) |
720 | << "< defaultEmail >" << defaultEmail << "<" << oendl; | 721 | << "< defaultEmail >" << defaultEmail << "<" << oendl; |
721 | 722 | ||
722 | if ( cmbDefaultEmail->text( i ).stripWhiteSpace() == defaultEmail.stripWhiteSpace() ){ | 723 | if ( cmbDefaultEmail->text( i ).stripWhiteSpace() == defaultEmail.stripWhiteSpace() ){ |
723 | cmbDefaultEmail->setCurrentItem( i ); | 724 | cmbDefaultEmail->setCurrentItem( i ); |
724 | odebug << "set" << oendl; | 725 | odebug << "set" << oendl; |
725 | found = true; | 726 | found = true; |
726 | } | 727 | } |
727 | } | 728 | } |
728 | 729 | ||
729 | // If the current default email is not found in the list, we choose the | 730 | // If the current default email is not found in the list, we choose the |
730 | // first one.. | 731 | // first one.. |
731 | if ( !found ) | 732 | if ( !found ) |
732 | defaultEmail = cmbDefaultEmail->text(0); | 733 | defaultEmail = cmbDefaultEmail->text(0); |
733 | } | 734 | } |
734 | 735 | ||
735 | // Called when any combobox was changed. | 736 | // Called when any combobox was changed. |
736 | // "true" returned if the change was chandled by this function, else it should | 737 | // "true" returned if the change was chandled by this function, else it should |
737 | // be handled by something else.. | 738 | // be handled by something else.. |
738 | bool ContactEditor::cmbChooserChange( int index, QWidgetStack* inputStack, int widgetPos ) { | 739 | bool ContactEditor::cmbChooserChange( int index, QWidgetStack* inputStack, int widgetPos ) { |
739 | QString type = slChooserNames[index]; | 740 | QString type = slChooserNames[index]; |
740 | odebug << "ContactEditor::cmbChooserChange -> Type: " << type | 741 | odebug << "ContactEditor::cmbChooserChange -> Type: " << type |
741 | << ", WidgetPos: " << widgetPos << oendl; | 742 | << ", WidgetPos: " << widgetPos << oendl; |
742 | 743 | ||
743 | if ( !initializing ) | 744 | if ( !initializing ) |
744 | contactfields.setFieldOrder( widgetPos-1, index ); | 745 | contactfields.setFieldOrder( widgetPos-1, index ); |
745 | 746 | ||
746 | // Create and connect combobox for selecting the default email | 747 | // Create and connect combobox for selecting the default email |
747 | if ( type == "Default Email"){ | 748 | if ( type == "Default Email"){ |
748 | odebug << "Choosing default-email (defaultEmailChooserPosition= " | 749 | odebug << "Choosing default-email (defaultEmailChooserPosition= " |
749 | << defaultEmailChooserPosition << ") " << oendl; | 750 | << defaultEmailChooserPosition << ") " << oendl; |
750 | 751 | ||
751 | // More than one default-email chooser is not allowed ! | 752 | // More than one default-email chooser is not allowed ! |
752 | if ( ( defaultEmailChooserPosition != -1 ) && | 753 | if ( ( defaultEmailChooserPosition != -1 ) && |
753 | defaultEmailChooserPosition != widgetPos && !initializing){ | 754 | defaultEmailChooserPosition != widgetPos && !initializing){ |
754 | chooserError( widgetPos ); | 755 | chooserError( widgetPos ); |
755 | return true; | 756 | return true; |
756 | } | 757 | } |
757 | 758 | ||
758 | QComboBox* cmbo = ( QComboBox* ) inputStack -> widget( Combo ); | 759 | QComboBox* cmbo = ( QComboBox* ) inputStack -> widget( Combo ); |
759 | if ( cmbo ){ | 760 | if ( cmbo ){ |
760 | inputStack->raiseWidget( TextField ); | 761 | inputStack->raiseWidget( TextField ); |
761 | inputStack -> removeWidget( cmbo ); | 762 | inputStack -> removeWidget( cmbo ); |
762 | delete cmbo; | 763 | delete cmbo; |
763 | } | 764 | } |
764 | cmbo = new QComboBox( inputStack ); | 765 | cmbo = new QComboBox( inputStack ); |
765 | cmbo -> insertStringList( emails ); | 766 | cmbo -> insertStringList( emails ); |
766 | 767 | ||
767 | inputStack -> addWidget( cmbo, Combo ); | 768 | inputStack -> addWidget( cmbo, Combo ); |
768 | inputStack -> raiseWidget( Combo ); | 769 | inputStack -> raiseWidget( Combo ); |
769 | 770 | ||
770 | defaultEmailChooserPosition = widgetPos; | 771 | defaultEmailChooserPosition = widgetPos; |
771 | cmbDefaultEmail = cmbo; | 772 | cmbDefaultEmail = cmbo; |
772 | 773 | ||
773 | connect( cmbo,SIGNAL( activated(int) ), | 774 | connect( cmbo,SIGNAL( activated(int) ), |
774 | SLOT( defaultEmailChanged(int) ) ); | 775 | SLOT( defaultEmailChanged(int) ) ); |
775 | 776 | ||
776 | // Set current default email | 777 | // Set current default email |
777 | populateDefaultEmailCmb(); | 778 | populateDefaultEmailCmb(); |
778 | 779 | ||
779 | 780 | ||
780 | } else { | 781 | } else { |
781 | // Something else was selected: Hide combo.. | 782 | // Something else was selected: Hide combo.. |
782 | odebug << " Hiding default-email combo" << oendl; | 783 | odebug << " Hiding default-email combo" << oendl; |
783 | if ( defaultEmailChooserPosition == widgetPos ){ | 784 | if ( defaultEmailChooserPosition == widgetPos ){ |
784 | defaultEmailChooserPosition = -1; | 785 | defaultEmailChooserPosition = -1; |
785 | } | 786 | } |
786 | QComboBox* cmbo = ( QComboBox* ) inputStack -> widget( Combo ); | 787 | QComboBox* cmbo = ( QComboBox* ) inputStack -> widget( Combo ); |
787 | if ( cmbo ){ | 788 | if ( cmbo ){ |
788 | inputStack->raiseWidget( TextField ); | 789 | inputStack->raiseWidget( TextField ); |
789 | inputStack -> removeWidget( cmbo ); | 790 | inputStack -> removeWidget( cmbo ); |
790 | cmbDefaultEmail = 0l; | 791 | cmbDefaultEmail = 0l; |
791 | delete cmbo; | 792 | delete cmbo; |
792 | } | 793 | } |
793 | 794 | ||
794 | // Caller should initialize the responsible textfield, therefore | 795 | // Caller should initialize the responsible textfield, therefore |
795 | // "false" is returned | 796 | // "false" is returned |
796 | return false; | 797 | return false; |
797 | } | 798 | } |
798 | 799 | ||
799 | // Everything is worked off .. | 800 | // Everything is worked off .. |
800 | return true; | 801 | return true; |
801 | 802 | ||
802 | } | 803 | } |
803 | 804 | ||
804 | // Currently accessed when we select default-email more than once ! | 805 | // Currently accessed when we select default-email more than once ! |
805 | void ContactEditor::chooserError( int index ) | 806 | void ContactEditor::chooserError( int index ) |
806 | { | 807 | { |
807 | owarn << "ContactEditor::chooserError( " << index << " )" << oendl; | 808 | owarn << "ContactEditor::chooserError( " << index << " )" << oendl; |
808 | QMessageBox::warning( this, "Chooser Error", | 809 | QMessageBox::warning( this, "Chooser Error", |
809 | "Multiple selection of this\n" | 810 | "Multiple selection of this\n" |
810 | "Item is not allowed !\n\n" | 811 | "Item is not allowed !\n\n" |
811 | "First deselect the previous one !", | 812 | "First deselect the previous one !", |
812 | "&OK", 0, 0, | 813 | "&OK", 0, 0, |
813 | 0, 0 ); | 814 | 0, 0 ); |
814 | 815 | ||
815 | // Reset the selected Chooser. Unfortunately the chooser | 816 | // Reset the selected Chooser. Unfortunately the chooser |
816 | // generates no signal, therfore we have to | 817 | // generates no signal, therfore we have to |
817 | // call the cmbChooserChange function manually.. | 818 | // call the cmbChooserChange function manually.. |
818 | switch( index ){ | 819 | switch( index ){ |
819 | case 1: | 820 | case 1: |
820 | cmbChooserField1 -> setCurrentItem( 0 ); | 821 | cmbChooserField1 -> setCurrentItem( 0 ); |
821 | slotCmbChooser1Change( 0 ); | 822 | slotCmbChooser1Change( 0 ); |
822 | break; | 823 | break; |
823 | case 2: | 824 | case 2: |
824 | cmbChooserField2 -> setCurrentItem( 0 ); | 825 | cmbChooserField2 -> setCurrentItem( 0 ); |
825 | slotCmbChooser2Change( 0 ); | 826 | slotCmbChooser2Change( 0 ); |
826 | break; | 827 | break; |
827 | case 3: | 828 | case 3: |
828 | cmbChooserField3 -> setCurrentItem( 0 ); | 829 | cmbChooserField3 -> setCurrentItem( 0 ); |
829 | slotCmbChooser3Change( 0 ); | 830 | slotCmbChooser3Change( 0 ); |
830 | break; | 831 | break; |
831 | case 4: | 832 | case 4: |
832 | cmbChooserField4 -> setCurrentItem( 0 ); | 833 | cmbChooserField4 -> setCurrentItem( 0 ); |
833 | slotCmbChooser4Change( 0 ); | 834 | slotCmbChooser4Change( 0 ); |
834 | break; | 835 | break; |
835 | } | 836 | } |
836 | } | 837 | } |
837 | 838 | ||
838 | // Called when something was changed in a textfield (shouldn't it called textchanged? (se)) | 839 | // Called when something was changed in a textfield (shouldn't it called textchanged? (se)) |
839 | void ContactEditor::chooserChange( const QString &textChanged, int index, | 840 | void ContactEditor::chooserChange( const QString &textChanged, int index, |
840 | QLineEdit* , int widgetPos ) { | 841 | QLineEdit* , int widgetPos ) { |
841 | 842 | ||
842 | QString type = slChooserNames[index]; // :SX | 843 | QString type = slChooserNames[index]; // :SX |
843 | odebug << "ContactEditor::chooserChange( type=>" << type << "<, textChanged=>" | 844 | odebug << "ContactEditor::chooserChange( type=>" << type << "<, textChanged=>" |
844 | << textChanged << "< index=" << index << ", widgetPos=" << widgetPos | 845 | << textChanged << "< index=" << index << ", widgetPos=" << widgetPos |
845 | << " )" << oendl; | 846 | << " )" << oendl; |
846 | 847 | ||
847 | if ( type == "Default Email"){ | 848 | if ( type == "Default Email"){ |
848 | odebug << "??? Wozu??: " << textChanged << oendl; | 849 | odebug << "??? Wozu??: " << textChanged << oendl; |
849 | defaultEmail = textChanged; | 850 | defaultEmail = textChanged; |
850 | 851 | ||
851 | populateDefaultEmailCmb(); | 852 | populateDefaultEmailCmb(); |
852 | 853 | ||
853 | }else if (type == "Emails"){ | 854 | }else if (type == "Emails"){ |
854 | odebug << "emails" << oendl; | 855 | odebug << "emails" << oendl; |
855 | 856 | ||
856 | QString de; | 857 | QString de; |
857 | emails = QStringList::split (",", textChanged ); | 858 | emails = QStringList::split (",", textChanged ); |
858 | 859 | ||
859 | populateDefaultEmailCmb(); | 860 | populateDefaultEmailCmb(); |
860 | } | 861 | } |
861 | 862 | ||
862 | slChooserValues[index] = textChanged; | 863 | slChooserValues[index] = textChanged; |
863 | 864 | ||
864 | } | 865 | } |
865 | 866 | ||
866 | void ContactEditor::slotChooser1Change( const QString &textChanged ) { | 867 | void ContactEditor::slotChooser1Change( const QString &textChanged ) { |
867 | odebug << "ContactEditor::slotChooser1Change( " << textChanged << " )" << oendl; | 868 | odebug << "ContactEditor::slotChooser1Change( " << textChanged << " )" << oendl; |
868 | chooserChange( textChanged, cmbChooserField1->currentItem(), txtChooserField1, 1); | 869 | chooserChange( textChanged, cmbChooserField1->currentItem(), txtChooserField1, 1); |
869 | } | 870 | } |
870 | 871 | ||
871 | void ContactEditor::slotChooser2Change( const QString &textChanged ) { | 872 | void ContactEditor::slotChooser2Change( const QString &textChanged ) { |
872 | odebug << "ContactEditor::slotChooser2Change( " << textChanged << " )" << oendl; | 873 | odebug << "ContactEditor::slotChooser2Change( " << textChanged << " )" << oendl; |
873 | chooserChange( textChanged, cmbChooserField2->currentItem(), txtChooserField2, 2); | 874 | chooserChange( textChanged, cmbChooserField2->currentItem(), txtChooserField2, 2); |
874 | 875 | ||
875 | } | 876 | } |
876 | 877 | ||
877 | void ContactEditor::slotChooser3Change( const QString &textChanged ) { | 878 | void ContactEditor::slotChooser3Change( const QString &textChanged ) { |
878 | odebug << "ContactEditor::slotChooser3Change( " << textChanged << " )" << oendl; | 879 | odebug << "ContactEditor::slotChooser3Change( " << textChanged << " )" << oendl; |
879 | chooserChange( textChanged, cmbChooserField3->currentItem(), txtChooserField3, 3); | 880 | chooserChange( textChanged, cmbChooserField3->currentItem(), txtChooserField3, 3); |
880 | } | 881 | } |
881 | 882 | ||
882 | void ContactEditor::slotChooser4Change( const QString &textChanged ) { | 883 | void ContactEditor::slotChooser4Change( const QString &textChanged ) { |
883 | odebug << "ContactEditor::slotChooser4Change( " << textChanged << " )" << oendl; | 884 | odebug << "ContactEditor::slotChooser4Change( " << textChanged << " )" << oendl; |
884 | chooserChange( textChanged, cmbChooserField4->currentItem(), txtChooserField4, 4); | 885 | chooserChange( textChanged, cmbChooserField4->currentItem(), txtChooserField4, 4); |
885 | } | 886 | } |
886 | 887 | ||
887 | void ContactEditor::slotAddressChange( const QString &textChanged ) { | 888 | void ContactEditor::slotAddressChange( const QString &textChanged ) { |
888 | 889 | ||
889 | if ( cmbAddress->currentItem() == 0 ) { | 890 | if ( cmbAddress->currentItem() == 0 ) { |
890 | slBusinessAddress[0] = textChanged; | 891 | slBusinessAddress[0] = textChanged; |
891 | } else { | 892 | } else { |
892 | slHomeAddress[0] = textChanged; | 893 | slHomeAddress[0] = textChanged; |
893 | } | 894 | } |
894 | } | 895 | } |
895 | 896 | ||
896 | void ContactEditor::slotAddress2Change( const QString &textChanged ) { | 897 | void ContactEditor::slotAddress2Change( const QString &textChanged ) { |
897 | 898 | ||
898 | if ( cmbAddress->currentItem() == 0 ) { | 899 | if ( cmbAddress->currentItem() == 0 ) { |
899 | slBusinessAddress[1] = textChanged; | 900 | slBusinessAddress[1] = textChanged; |
900 | } else { | 901 | } else { |
901 | slHomeAddress[1] = textChanged; | 902 | slHomeAddress[1] = textChanged; |
902 | } | 903 | } |
903 | } | 904 | } |
904 | 905 | ||
905 | void ContactEditor::slotPOBoxChange( const QString &textChanged ) { | 906 | void ContactEditor::slotPOBoxChange( const QString &textChanged ) { |
906 | 907 | ||
907 | if ( cmbAddress->currentItem() == 0 ) { | 908 | if ( cmbAddress->currentItem() == 0 ) { |
908 | slBusinessAddress[2] = textChanged; | 909 | slBusinessAddress[2] = textChanged; |
909 | } else { | 910 | } else { |
910 | slHomeAddress[2] = textChanged; | 911 | slHomeAddress[2] = textChanged; |
911 | } | 912 | } |
912 | } | 913 | } |
913 | 914 | ||
914 | void ContactEditor::slotCityChange( const QString &textChanged ) { | 915 | void ContactEditor::slotCityChange( const QString &textChanged ) { |
915 | 916 | ||
916 | if ( cmbAddress->currentItem() == 0 ) { | 917 | if ( cmbAddress->currentItem() == 0 ) { |
917 | slBusinessAddress[3] = textChanged; | 918 | slBusinessAddress[3] = textChanged; |
918 | } else { | 919 | } else { |
919 | slHomeAddress[3] = textChanged; | 920 | slHomeAddress[3] = textChanged; |
920 | } | 921 | } |
921 | } | 922 | } |
922 | 923 | ||
923 | void ContactEditor::slotStateChange( const QString &textChanged ) { | 924 | void ContactEditor::slotStateChange( const QString &textChanged ) { |
924 | 925 | ||
925 | 926 | ||
926 | if ( cmbAddress->currentItem() == 0 ) { | 927 | if ( cmbAddress->currentItem() == 0 ) { |
927 | slBusinessAddress[4] = textChanged; | 928 | slBusinessAddress[4] = textChanged; |
928 | } else { | 929 | } else { |
929 | slHomeAddress[4] = textChanged; | 930 | slHomeAddress[4] = textChanged; |
930 | } | 931 | } |
931 | } | 932 | } |
932 | 933 | ||
933 | void ContactEditor::slotZipChange( const QString &textChanged ) { | 934 | void ContactEditor::slotZipChange( const QString &textChanged ) { |
934 | 935 | ||
935 | if ( cmbAddress->currentItem() == 0 ) { | 936 | if ( cmbAddress->currentItem() == 0 ) { |
936 | slBusinessAddress[5] = textChanged; | 937 | slBusinessAddress[5] = textChanged; |
937 | } else { | 938 | } else { |
938 | slHomeAddress[5] = textChanged; | 939 | slHomeAddress[5] = textChanged; |
939 | } | 940 | } |
940 | } | 941 | } |
941 | 942 | ||
942 | void ContactEditor::slotCountryChange( const QString &textChanged ) { | 943 | void ContactEditor::slotCountryChange( const QString &textChanged ) { |
943 | 944 | ||
944 | if ( cmbAddress->currentItem() == 0 ) { | 945 | if ( cmbAddress->currentItem() == 0 ) { |
945 | slBusinessAddress[6] = textChanged; | 946 | slBusinessAddress[6] = textChanged; |
946 | } else { | 947 | } else { |
947 | slHomeAddress[6] = textChanged; | 948 | slHomeAddress[6] = textChanged; |
948 | } | 949 | } |
949 | } | 950 | } |
950 | 951 | ||
951 | 952 | ||
952 | void ContactEditor::slotCmbChooser1Change( int index ) { | 953 | void ContactEditor::slotCmbChooser1Change( int index ) { |
953 | odebug << "ContactEditor::slotCmbChooser1Change( " << index << " )" << oendl; | 954 | odebug << "ContactEditor::slotCmbChooser1Change( " << index << " )" << oendl; |
954 | if ( !cmbChooserChange( cmbChooserField1->currentItem(), m_widgetStack1, 1) ){ | 955 | if ( !cmbChooserChange( cmbChooserField1->currentItem(), m_widgetStack1, 1) ){ |
955 | 956 | ||
956 | txtChooserField1->setText( slChooserValues[index] ); | 957 | txtChooserField1->setText( slChooserValues[index] ); |
957 | txtChooserField1->setFocus(); | 958 | txtChooserField1->setFocus(); |
958 | 959 | ||
959 | } | 960 | } |
960 | 961 | ||
961 | } | 962 | } |
962 | 963 | ||
963 | void ContactEditor::slotCmbChooser2Change( int index ) { | 964 | void ContactEditor::slotCmbChooser2Change( int index ) { |
964 | odebug << "ContactEditor::slotCmbChooser2Change( " << index << " )" << oendl; | 965 | odebug << "ContactEditor::slotCmbChooser2Change( " << index << " )" << oendl; |
965 | 966 | ||
966 | if ( !cmbChooserChange( cmbChooserField2->currentItem(), m_widgetStack2, 2) ){ | 967 | if ( !cmbChooserChange( cmbChooserField2->currentItem(), m_widgetStack2, 2) ){ |
967 | 968 | ||
968 | txtChooserField2->setText( slChooserValues[index] ); | 969 | txtChooserField2->setText( slChooserValues[index] ); |
969 | txtChooserField2->setFocus(); | 970 | txtChooserField2->setFocus(); |
970 | 971 | ||
971 | } | 972 | } |
972 | } | 973 | } |
973 | 974 | ||
974 | void ContactEditor::slotCmbChooser3Change( int index ) { | 975 | void ContactEditor::slotCmbChooser3Change( int index ) { |
975 | odebug << "ContactEditor::slotCmbChooser3Change( " << index << " )" << oendl; | 976 | odebug << "ContactEditor::slotCmbChooser3Change( " << index << " )" << oendl; |
976 | 977 | ||
977 | if ( !cmbChooserChange( cmbChooserField3->currentItem(), m_widgetStack3, 3) ){ | 978 | if ( !cmbChooserChange( cmbChooserField3->currentItem(), m_widgetStack3, 3) ){ |
978 | 979 | ||
979 | txtChooserField3->setText( slChooserValues[index] ); | 980 | txtChooserField3->setText( slChooserValues[index] ); |
980 | txtChooserField3->setFocus(); | 981 | txtChooserField3->setFocus(); |
981 | 982 | ||
982 | } | 983 | } |
983 | } | 984 | } |
984 | 985 | ||
985 | void ContactEditor::slotCmbChooser4Change( int index ) { | 986 | void ContactEditor::slotCmbChooser4Change( int index ) { |
986 | odebug << "ContactEditor::slotCmbChooser4Change( " << index << " )" << oendl; | 987 | odebug << "ContactEditor::slotCmbChooser4Change( " << index << " )" << oendl; |
987 | 988 | ||
988 | if ( !cmbChooserChange( cmbChooserField4->currentItem(), m_widgetStack4, 4) ){ | 989 | if ( !cmbChooserChange( cmbChooserField4->currentItem(), m_widgetStack4, 4) ){ |
989 | 990 | ||
990 | txtChooserField4->setText( slChooserValues[index] ); | 991 | txtChooserField4->setText( slChooserValues[index] ); |
991 | txtChooserField4->setFocus(); | 992 | txtChooserField4->setFocus(); |
992 | 993 | ||
993 | } | 994 | } |
994 | } | 995 | } |
995 | 996 | ||
996 | void ContactEditor::slotAddressTypeChange( int index ) { | 997 | void ContactEditor::slotAddressTypeChange( int index ) { |
997 | 998 | ||
998 | 999 | ||
999 | if ( !initializing ) | 1000 | if ( !initializing ) |
1000 | contactfields.setFieldOrder( 4, index ); | 1001 | contactfields.setFieldOrder( 4, index ); |
1001 | 1002 | ||
1002 | 1003 | ||
1003 | if ( index == 0 ) { | 1004 | if ( index == 0 ) { |
1004 | 1005 | ||
1005 | txtAddress->setText( slBusinessAddress[0] ); | 1006 | txtAddress->setText( slBusinessAddress[0] ); |
1006 | //txtAddress2->setText( (*slBusinessAddress)[1] ); | 1007 | //txtAddress2->setText( (*slBusinessAddress)[1] ); |
1007 | //txtPOBox->setText( (*slBusinessAddress)[2] ); | 1008 | //txtPOBox->setText( (*slBusinessAddress)[2] ); |
1008 | txtCity->setText( slBusinessAddress[3] ); | 1009 | txtCity->setText( slBusinessAddress[3] ); |
1009 | txtState->setText( slBusinessAddress[4] ); | 1010 | txtState->setText( slBusinessAddress[4] ); |
1010 | txtZip->setText( slBusinessAddress[5] ); | 1011 | txtZip->setText( slBusinessAddress[5] ); |
1011 | QLineEdit *txtTmp = cmbCountry->lineEdit(); | 1012 | QLineEdit *txtTmp = cmbCountry->lineEdit(); |
1012 | txtTmp->setText( slBusinessAddress[6] ); | 1013 | txtTmp->setText( slBusinessAddress[6] ); |
1013 | 1014 | ||
1014 | } else { | 1015 | } else { |
1015 | 1016 | ||
1016 | txtAddress->setText( slHomeAddress[0] ); | 1017 | txtAddress->setText( slHomeAddress[0] ); |
1017 | //txtAddress2->setText( (*slHomeAddress)[1] ); | 1018 | //txtAddress2->setText( (*slHomeAddress)[1] ); |
1018 | //txtPOBox->setText( (*slHomeAddress)[2] ); | 1019 | //txtPOBox->setText( (*slHomeAddress)[2] ); |
1019 | txtCity->setText( slHomeAddress[3] ); | 1020 | txtCity->setText( slHomeAddress[3] ); |
1020 | txtState->setText( slHomeAddress[4] ); | 1021 | txtState->setText( slHomeAddress[4] ); |
1021 | txtZip->setText( slHomeAddress[5] ); | 1022 | txtZip->setText( slHomeAddress[5] ); |
1022 | QLineEdit *txtTmp = cmbCountry->lineEdit(); | 1023 | QLineEdit *txtTmp = cmbCountry->lineEdit(); |
1023 | txtTmp->setText( slHomeAddress[6] ); | 1024 | txtTmp->setText( slHomeAddress[6] ); |
1024 | 1025 | ||
1025 | } | 1026 | } |
1026 | 1027 | ||
1027 | } | 1028 | } |
1028 | 1029 | ||
1029 | void ContactEditor::slotFullNameChange( const QString &textChanged ) { | 1030 | void ContactEditor::slotFullNameChange( const QString &textChanged ) { |
1030 | 1031 | ||
1031 | odebug << "ContactEditor::slotFullNameChange( " << textChanged << " )" << oendl; | 1032 | odebug << "ContactEditor::slotFullNameChange( " << textChanged << " )" << oendl; |
1032 | 1033 | ||
1033 | int index = cmbFileAs->currentItem(); | 1034 | int index = cmbFileAs->currentItem(); |
1034 | 1035 | ||
1035 | cmbFileAs->clear(); | 1036 | cmbFileAs->clear(); |
1036 | 1037 | ||
1037 | cmbFileAs->insertItem( parseName( textChanged, NAME_LF ) ); | 1038 | cmbFileAs->insertItem( parseName( textChanged, NAME_LF ) ); |
1038 | cmbFileAs->insertItem( parseName( textChanged, NAME_LFM ) ); | 1039 | cmbFileAs->insertItem( parseName( textChanged, NAME_LFM ) ); |
1039 | cmbFileAs->insertItem( parseName( textChanged, NAME_FL ) ); | 1040 | cmbFileAs->insertItem( parseName( textChanged, NAME_FL ) ); |
1040 | cmbFileAs->insertItem( parseName( textChanged, NAME_FML ) ); | 1041 | cmbFileAs->insertItem( parseName( textChanged, NAME_FML ) ); |
1041 | if ( ! txtSuffix->text().isEmpty() ) | 1042 | if ( ! txtSuffix->text().isEmpty() ) |
1042 | cmbFileAs->insertItem( parseName( textChanged, NAME_FML ) + " " + txtSuffix->text() ); | 1043 | cmbFileAs->insertItem( parseName( textChanged, NAME_FML ) + " " + txtSuffix->text() ); |
1043 | 1044 | ||
1044 | cmbFileAs->setCurrentItem( index ); | 1045 | cmbFileAs->setCurrentItem( index ); |
1045 | 1046 | ||
1046 | 1047 | ||
1047 | } | 1048 | } |
1048 | 1049 | ||
1049 | void ContactEditor::slotSuffixChange( const QString& ) { | 1050 | void ContactEditor::slotSuffixChange( const QString& ) { |
1050 | // Just want to update the FileAs combo if the suffix was changed.. | 1051 | // Just want to update the FileAs combo if the suffix was changed.. |
1051 | slotFullNameChange( txtFullName->text() ); | 1052 | slotFullNameChange( txtFullName->text() ); |
1052 | } | 1053 | } |
1053 | 1054 | ||
1054 | void ContactEditor::slotOrganizationChange( const QString &textChanged ){ | 1055 | void ContactEditor::slotOrganizationChange( const QString &textChanged ){ |
1055 | odebug << "ContactEditor::slotOrganizationChange( " << textChanged << " )" << oendl; | 1056 | odebug << "ContactEditor::slotOrganizationChange( " << textChanged << " )" << oendl; |
1056 | // Special handling for storing Companies: | 1057 | // Special handling for storing Companies: |
1057 | // If no Fullname is given, we store the Company-Name as lastname | 1058 | // If no Fullname is given, we store the Company-Name as lastname |
1058 | // to handle it like a person.. | 1059 | // to handle it like a person.. |
1059 | if ( txtFullName->text() == txtOrganization->text().left( txtFullName->text().length() ) ) | 1060 | if ( txtFullName->text() == txtOrganization->text().left( txtFullName->text().length() ) ) |
1060 | txtFullName->setText( textChanged ); | 1061 | txtFullName->setText( textChanged ); |
1061 | 1062 | ||
1062 | } | 1063 | } |
1063 | 1064 | ||
1064 | void ContactEditor::accept() { | 1065 | void ContactEditor::accept() { |
1065 | 1066 | ||
1066 | if ( isEmpty() ) { | 1067 | if ( isEmpty() ) { |
1067 | cleanupFields(); | 1068 | cleanupFields(); |
1068 | reject(); | 1069 | reject(); |
1069 | } else { | 1070 | } else { |
1070 | saveEntry(); | 1071 | saveEntry(); |
1071 | cleanupFields(); | 1072 | cleanupFields(); |
1072 | QDialog::accept(); | 1073 | QDialog::accept(); |
1073 | } | 1074 | } |
1074 | 1075 | ||
1075 | } | 1076 | } |
1076 | 1077 | ||
1077 | void ContactEditor::slotNote() { | 1078 | void ContactEditor::slotNote() { |
1078 | 1079 | ||
1079 | if ( ! QPEApplication::execDialog( dlgNote ) ) { | 1080 | if ( ! QPEApplication::execDialog( dlgNote ) ) { |
1080 | txtNote->setText( ent.notes() ); | 1081 | txtNote->setText( ent.notes() ); |
1081 | } | 1082 | } |
1082 | } | 1083 | } |
1083 | 1084 | ||
1084 | void ContactEditor::slotName() { | 1085 | void ContactEditor::slotName() { |
1085 | 1086 | ||
1086 | QString tmpName; | 1087 | QString tmpName; |
1087 | 1088 | ||
1088 | txtFirstName->setText( parseName(txtFullName->text(), NAME_F) ); | 1089 | txtFirstName->setText( parseName(txtFullName->text(), NAME_F) ); |
1089 | txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) ); | 1090 | txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) ); |
1090 | txtLastName->setText( parseName(txtFullName->text(), NAME_L) ); | 1091 | txtLastName->setText( parseName(txtFullName->text(), NAME_L) ); |
1091 | // txtSuffix->setText( parseName(txtFullName->text(), NAME_S) ); | 1092 | // txtSuffix->setText( parseName(txtFullName->text(), NAME_S) ); |
1092 | 1093 | ||
1093 | if ( QPEApplication::execDialog( dlgName ) ) { | 1094 | if ( QPEApplication::execDialog( dlgName ) ) { |
1094 | if ( txtLastName->text().contains( ' ', true ) ) | 1095 | if ( txtLastName->text().contains( ' ', true ) ) |
1095 | tmpName = txtLastName->text() + ", " + txtFirstName->text() + " " + txtMiddleName->text(); | 1096 | tmpName = txtLastName->text() + ", " + txtFirstName->text() + " " + txtMiddleName->text(); |
1096 | else | 1097 | else |
1097 | tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text(); | 1098 | tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text(); |
1098 | 1099 | ||
1099 | txtFullName->setText( tmpName.simplifyWhiteSpace() ); | 1100 | txtFullName->setText( tmpName.simplifyWhiteSpace() ); |
1100 | slotFullNameChange( txtFullName->text() ); | 1101 | slotFullNameChange( txtFullName->text() ); |
1101 | } | 1102 | } |
1102 | 1103 | ||
1103 | } | 1104 | } |
1104 | 1105 | ||
1105 | void ContactEditor::setNameFocus() { | 1106 | void ContactEditor::setNameFocus() { |
1106 | 1107 | ||
1107 | txtFullName->setFocus(); | 1108 | txtFullName->setFocus(); |
1108 | 1109 | ||
1109 | } | 1110 | } |
1110 | 1111 | ||
1111 | bool ContactEditor::isEmpty() { | 1112 | bool ContactEditor::isEmpty() { |
1112 | // Test and see if the record should be saved. | 1113 | // Test and see if the record should be saved. |
1113 | // More strict than the original qtopia, needs name or fileas to save | 1114 | // More strict than the original qtopia, needs name or fileas to save |
1114 | 1115 | ||
1115 | QString t = txtFullName->text(); | 1116 | QString t = txtFullName->text(); |
1116 | if ( !t.isEmpty() && containsAlphaNum( t ) ) | 1117 | if ( !t.isEmpty() && containsAlphaNum( t ) ) |
1117 | return false; | 1118 | return false; |
1118 | 1119 | ||
1119 | t = cmbFileAs->currentText(); | 1120 | t = cmbFileAs->currentText(); |
1120 | if ( !t.isEmpty() && containsAlphaNum( t ) ) | 1121 | if ( !t.isEmpty() && containsAlphaNum( t ) ) |
1121 | return false; | 1122 | return false; |
1122 | 1123 | ||
1123 | return true; | 1124 | return true; |
1124 | 1125 | ||
1125 | } | 1126 | } |
1126 | 1127 | ||
1127 | QString ContactEditor::parseName( const QString fullName, int type ) { | 1128 | QString ContactEditor::parseName( const QString fullName, int type ) { |
1128 | 1129 | ||
1129 | QString simplifiedName( fullName.simplifyWhiteSpace() ); | 1130 | QString simplifiedName( fullName.simplifyWhiteSpace() ); |
1130 | QString strFirstName; | 1131 | QString strFirstName; |
1131 | QString strMiddleName; | 1132 | QString strMiddleName; |
1132 | QString strLastName; | 1133 | QString strLastName; |
1133 | QString strTitle; | 1134 | QString strTitle; |
1134 | int commapos; | 1135 | int commapos; |
1135 | bool haveLastName = false; | 1136 | bool haveLastName = false; |
1136 | 1137 | ||
1137 | odebug << "Fullname: " << simplifiedName << oendl; | 1138 | odebug << "Fullname: " << simplifiedName << oendl; |
1138 | 1139 | ||
1139 | commapos = simplifiedName.find( ',', 0, true); | 1140 | commapos = simplifiedName.find( ',', 0, true); |
1140 | if ( commapos >= 0 ) { | 1141 | if ( commapos >= 0 ) { |
1141 | odebug << " Commapos: " << commapos << oendl; | 1142 | odebug << " Commapos: " << commapos << oendl; |
1142 | 1143 | ||
1143 | // A comma (",") separates the lastname from one or | 1144 | // A comma (",") separates the lastname from one or |
1144 | // many first names. Thus, remove the lastname from the | 1145 | // many first names. Thus, remove the lastname from the |
1145 | // String and parse the firstnames. | 1146 | // String and parse the firstnames. |
1146 | 1147 | ||
1147 | strLastName = simplifiedName.left( commapos ); | 1148 | strLastName = simplifiedName.left( commapos ); |
1148 | simplifiedName= simplifiedName.mid( commapos + 1 ); | 1149 | simplifiedName= simplifiedName.mid( commapos + 1 ); |
1149 | haveLastName = true; | 1150 | haveLastName = true; |
1150 | odebug << "Fullname without ',': " << simplifiedName << oendl; | 1151 | odebug << "Fullname without ',': " << simplifiedName << oendl; |
1151 | 1152 | ||
1152 | // If we have any lastname, we should now split all first names. | 1153 | // If we have any lastname, we should now split all first names. |
1153 | // The first one will be the used as first, the rest as "middle names" | 1154 | // The first one will be the used as first, the rest as "middle names" |
1154 | 1155 | ||
1155 | QStringList allFirstNames = QStringList::split(" ", simplifiedName); | 1156 | QStringList allFirstNames = QStringList::split(" ", simplifiedName); |
1156 | QStringList::Iterator it = allFirstNames.begin(); | 1157 | QStringList::Iterator it = allFirstNames.begin(); |
1157 | strFirstName = *it++; | 1158 | strFirstName = *it++; |
1158 | QStringList allSecondNames; | 1159 | QStringList allSecondNames; |
1159 | for ( ; it != allFirstNames.end(); ++it ) | 1160 | for ( ; it != allFirstNames.end(); ++it ) |
1160 | allSecondNames.append( *it ); | 1161 | allSecondNames.append( *it ); |
1161 | 1162 | ||
1162 | strMiddleName = allSecondNames.join(" "); | 1163 | strMiddleName = allSecondNames.join(" "); |
1163 | 1164 | ||
1164 | } else { | 1165 | } else { |
1165 | 1166 | ||
1166 | // No comma separator used: We use the first word as firstname, the | 1167 | // No comma separator used: We use the first word as firstname, the |
1167 | // last as second/lastname and everything in the middle as middlename | 1168 | // last as second/lastname and everything in the middle as middlename |
1168 | 1169 | ||
1169 | QStringList allNames = QStringList::split(" ", simplifiedName); | 1170 | QStringList allNames = QStringList::split(" ", simplifiedName); |
1170 | QStringList::Iterator it = allNames.begin(); | 1171 | QStringList::Iterator it = allNames.begin(); |
1171 | strFirstName = *it++; | 1172 | strFirstName = *it++; |
1172 | QStringList allSecondNames; | 1173 | QStringList allSecondNames; |
1173 | for ( ; it != --allNames.end(); ++it ) | 1174 | for ( ; it != --allNames.end(); ++it ) |
1174 | allSecondNames.append( *it ); | 1175 | allSecondNames.append( *it ); |
1175 | 1176 | ||
1176 | strMiddleName = allSecondNames.join(" "); | 1177 | strMiddleName = allSecondNames.join(" "); |
1177 | strLastName = *(--allNames.end()); | 1178 | strLastName = *(--allNames.end()); |
1178 | 1179 | ||
1179 | } | 1180 | } |
1180 | 1181 | ||
1181 | if ( strFirstName == strLastName ) | 1182 | if ( strFirstName == strLastName ) |
1182 | strFirstName = ""; | 1183 | strFirstName = ""; |
1183 | 1184 | ||
1184 | odebug << "strFirstName: " << strFirstName << oendl; | 1185 | odebug << "strFirstName: " << strFirstName << oendl; |
1185 | odebug << "strMiddletName: " << strMiddleName << oendl; | 1186 | odebug << "strMiddletName: " << strMiddleName << oendl; |
1186 | odebug << "strLastName: " << strLastName << oendl; | 1187 | odebug << "strLastName: " << strLastName << oendl; |
1187 | odebug << "strTitle: " << strTitle << oendl; | 1188 | odebug << "strTitle: " << strTitle << oendl; |
1188 | 1189 | ||
1189 | switch (type) { | 1190 | switch (type) { |
1190 | case NAME_FL: | 1191 | case NAME_FL: |
1191 | return strFirstName + " " + strLastName; | 1192 | return strFirstName + " " + strLastName; |
1192 | 1193 | ||
1193 | case NAME_LF: | 1194 | case NAME_LF: |
1194 | return strLastName + ", " + strFirstName; | 1195 | return strLastName + ", " + strFirstName; |
1195 | 1196 | ||
1196 | case NAME_LFM: | 1197 | case NAME_LFM: |
1197 | return strLastName + ", " + strFirstName + " " + strMiddleName; | 1198 | return strLastName + ", " + strFirstName + " " + strMiddleName; |
1198 | 1199 | ||
1199 | case NAME_FML: | 1200 | case NAME_FML: |
1200 | return strFirstName + " " + strMiddleName + " " + strLastName ; | 1201 | return strFirstName + " " + strMiddleName + " " + strLastName ; |
1201 | 1202 | ||
1202 | case NAME_F: | 1203 | case NAME_F: |
1203 | return strFirstName; | 1204 | return strFirstName; |
1204 | 1205 | ||
1205 | case NAME_M: | 1206 | case NAME_M: |
1206 | return strMiddleName; | 1207 | return strMiddleName; |
1207 | 1208 | ||
1208 | case NAME_L: | 1209 | case NAME_L: |
1209 | return strLastName; | 1210 | return strLastName; |
1210 | 1211 | ||
1211 | case NAME_S: | 1212 | case NAME_S: |
1212 | return txtSuffix->text(); | 1213 | return txtSuffix->text(); |
1213 | 1214 | ||
1214 | } | 1215 | } |
1215 | return QString::null; | 1216 | return QString::null; |
1216 | } | 1217 | } |
1217 | 1218 | ||
1218 | void ContactEditor::cleanupFields() { | 1219 | void ContactEditor::cleanupFields() { |
1219 | QStringList::Iterator it = slChooserValues.begin(); | 1220 | QStringList::Iterator it = slChooserValues.begin(); |
1220 | 1221 | ||
1221 | for ( int i = 0; it != slChooserValues.end(); i++, ++it ) { | 1222 | for ( int i = 0; it != slChooserValues.end(); i++, ++it ) { |
1222 | (*it) = ""; | 1223 | (*it) = ""; |
1223 | } | 1224 | } |
1224 | 1225 | ||
1225 | for ( int i = 0; i < 7; i++ ) { | 1226 | for ( int i = 0; i < 7; i++ ) { |
1226 | slHomeAddress[i] = ""; | 1227 | slHomeAddress[i] = ""; |
1227 | slBusinessAddress[i] = ""; | 1228 | slBusinessAddress[i] = ""; |
1228 | } | 1229 | } |
1229 | 1230 | ||
1230 | QListIterator<QLineEdit> itLV( listValue ); | 1231 | QListIterator<QLineEdit> itLV( listValue ); |
1231 | for ( ; itLV.current(); ++itLV ) { | 1232 | for ( ; itLV.current(); ++itLV ) { |
1232 | (*itLV)->setText( "" ); | 1233 | (*itLV)->setText( "" ); |
1233 | } | 1234 | } |
1234 | 1235 | ||
1235 | txtFirstName->setText(""); | 1236 | txtFirstName->setText(""); |
1236 | txtMiddleName->setText(""); | 1237 | txtMiddleName->setText(""); |
1237 | txtLastName->setText(""); | 1238 | txtLastName->setText(""); |
1238 | txtSuffix->setText(""); | 1239 | txtSuffix->setText(""); |
1239 | txtNote->setText(""); | 1240 | txtNote->setText(""); |
1240 | txtFullName->setText(""); | 1241 | txtFullName->setText(""); |
1241 | txtJobTitle->setText(""); | 1242 | txtJobTitle->setText(""); |
1242 | txtOrganization->setText(""); | 1243 | txtOrganization->setText(""); |
1243 | txtChooserField1->setText(""); | 1244 | txtChooserField1->setText(""); |
1244 | txtChooserField2->setText(""); | 1245 | txtChooserField2->setText(""); |
1245 | txtChooserField3->setText(""); | 1246 | txtChooserField3->setText(""); |
1246 | txtAddress->setText(""); | 1247 | txtAddress->setText(""); |
1247 | txtCity->setText(""); | 1248 | txtCity->setText(""); |
1248 | txtState->setText(""); | 1249 | txtState->setText(""); |
1249 | txtZip->setText(""); | 1250 | txtZip->setText(""); |
1250 | QLineEdit *txtTmp = cmbCountry->lineEdit(); | 1251 | QLineEdit *txtTmp = cmbCountry->lineEdit(); |
1251 | txtTmp->setText(""); | 1252 | txtTmp->setText(""); |
1252 | txtTmp = cmbFileAs->lineEdit(); | 1253 | txtTmp = cmbFileAs->lineEdit(); |
1253 | txtTmp->setText(""); | 1254 | txtTmp->setText(""); |
1254 | 1255 | ||
1255 | } | 1256 | } |
1256 | 1257 | ||
1257 | void ContactEditor::setEntry( const Opie::OPimContact &entry ) { | 1258 | void ContactEditor::setEntry( const Opie::OPimContact &entry ) { |
1258 | 1259 | ||
1259 | initializing = true; | 1260 | initializing = true; |
1260 | 1261 | ||
1261 | // Cleanup and activate the general Page .. | 1262 | // Cleanup and activate the general Page .. |
1262 | cleanupFields(); | 1263 | cleanupFields(); |
1263 | tabMain->setCurrentTab( m_generalWidget ); | 1264 | tabMain->setCurrentTab( m_generalWidget ); |
1264 | 1265 | ||
1265 | ent = entry; | 1266 | ent = entry; |
1266 | 1267 | ||
1267 | emails = QStringList(ent.emailList()); | 1268 | emails = QStringList(ent.emailList()); |
1268 | defaultEmail = ent.defaultEmail(); | 1269 | defaultEmail = ent.defaultEmail(); |
1269 | if (defaultEmail.isEmpty()) defaultEmail = emails[0]; | 1270 | if (defaultEmail.isEmpty()) defaultEmail = emails[0]; |
1270 | odebug << "default email=" << defaultEmail << oendl; | 1271 | odebug << "default email=" << defaultEmail << oendl; |
1271 | 1272 | ||
1272 | txtFirstName->setText( ent.firstName() ); | 1273 | txtFirstName->setText( ent.firstName() ); |
1273 | txtMiddleName->setText( ent.middleName() ); | 1274 | txtMiddleName->setText( ent.middleName() ); |
1274 | txtLastName->setText( ent.lastName() ); | 1275 | txtLastName->setText( ent.lastName() ); |
1275 | txtSuffix->setText( ent.suffix() ); | 1276 | txtSuffix->setText( ent.suffix() ); |
1276 | 1277 | ||
1277 | // QString *tmpString = new QString; | 1278 | // QString *tmpString = new QString; |
1278 | // *tmpString = ent.firstName() + " " + ent.middleName() + | 1279 | // *tmpString = ent.firstName() + " " + ent.middleName() + |
1279 | // + " " + ent.lastName() + " " + ent.suffix(); | 1280 | // + " " + ent.lastName() + " " + ent.suffix(); |
1280 | //txtFullName->setText( tmpString->simplifyWhiteSpace() ); | 1281 | //txtFullName->setText( tmpString->simplifyWhiteSpace() ); |
1281 | 1282 | ||
1282 | if ( !ent.isEmpty() ){ | 1283 | if ( !ent.isEmpty() ){ |
1283 | // Lastnames with multiple words need to be protected by a comma ! | 1284 | // Lastnames with multiple words need to be protected by a comma ! |
1284 | if ( ent.lastName().contains( ' ', true ) ) | 1285 | if ( ent.lastName().contains( ' ', true ) ) |
1285 | txtFullName->setText( ent.lastName() + ", " + ent.firstName() + " " + ent.middleName() ); | 1286 | txtFullName->setText( ent.lastName() + ", " + ent.firstName() + " " + ent.middleName() ); |
1286 | else | 1287 | else |
1287 | txtFullName->setText( ent.firstName() + " " + ent.middleName() + " " + ent.lastName() ); | 1288 | txtFullName->setText( ent.firstName() + " " + ent.middleName() + " " + ent.lastName() ); |
1288 | } | 1289 | } |
1289 | 1290 | ||
1290 | cmbFileAs->setEditText( ent.fileAs() ); | 1291 | cmbFileAs->setEditText( ent.fileAs() ); |
1291 | 1292 | ||
1292 | //if (hasTitle) | 1293 | //if (hasTitle) |
1293 | txtJobTitle->setText( ent.jobTitle() ); | 1294 | txtJobTitle->setText( ent.jobTitle() ); |
1294 | 1295 | ||
1295 | //if (hasCompany) | 1296 | //if (hasCompany) |
1296 | txtOrganization->setText( ent.company() ); | 1297 | txtOrganization->setText( ent.company() ); |
1297 | 1298 | ||
1298 | //if (hasNotes) | 1299 | //if (hasNotes) |
1299 | txtNote->setText( ent.notes() ); | 1300 | txtNote->setText( ent.notes() ); |
1300 | 1301 | ||
1301 | //if (hasStreet) { | 1302 | //if (hasStreet) { |
1302 | slHomeAddress[0] = ent.homeStreet(); | 1303 | slHomeAddress[0] = ent.homeStreet(); |
1303 | slBusinessAddress[0] = ent.businessStreet(); | 1304 | slBusinessAddress[0] = ent.businessStreet(); |
1304 | //} | 1305 | //} |
1305 | 1306 | ||
1306 | //if (hasCity) { | 1307 | //if (hasCity) { |
1307 | slHomeAddress[3] = ent.homeCity(); | 1308 | slHomeAddress[3] = ent.homeCity(); |
1308 | slBusinessAddress[3] = ent.businessCity(); | 1309 | slBusinessAddress[3] = ent.businessCity(); |
1309 | //} | 1310 | //} |
1310 | 1311 | ||
1311 | //if (hasState) { | 1312 | //if (hasState) { |
1312 | slHomeAddress[4] = ent.homeState(); | 1313 | slHomeAddress[4] = ent.homeState(); |
1313 | slBusinessAddress[4] = ent.businessState(); | 1314 | slBusinessAddress[4] = ent.businessState(); |
1314 | //} | 1315 | //} |
1315 | 1316 | ||
1316 | //if (hasZip) { | 1317 | //if (hasZip) { |
1317 | slHomeAddress[5] = ent.homeZip(); | 1318 | slHomeAddress[5] = ent.homeZip(); |
1318 | slBusinessAddress[5] = ent.businessZip(); | 1319 | slBusinessAddress[5] = ent.businessZip(); |
1319 | //} | 1320 | //} |
1320 | 1321 | ||
1321 | //if (hasCountry) { | 1322 | //if (hasCountry) { |
1322 | slHomeAddress[6] = ent.homeCountry(); | 1323 | slHomeAddress[6] = ent.homeCountry(); |
1323 | slBusinessAddress[6] = ent.businessCountry(); | 1324 | slBusinessAddress[6] = ent.businessCountry(); |
1324 | //} | 1325 | //} |
1325 | 1326 | ||
1326 | QStringList::ConstIterator it; | 1327 | QStringList::ConstIterator it; |
1327 | QListIterator<QLineEdit> itLE( listValue ); | 1328 | QListIterator<QLineEdit> itLE( listValue ); |
1328 | for ( it = slDynamicEntries.begin(); itLE.current()/* != slDynamicEntries.end()*/; ++it, ++itLE) { | 1329 | for ( it = slDynamicEntries.begin(); itLE.current()/* != slDynamicEntries.end()*/; ++it, ++itLE) { |
1329 | 1330 | ||
1330 | odebug << " Filling dynamic Field: " << (*it) << oendl; | 1331 | odebug << " Filling dynamic Field: " << (*it) << oendl; |
1331 | 1332 | ||
1332 | if ( *it == "Department" ) | 1333 | if ( *it == "Department" ) |
1333 | (*itLE)->setText( ent.department() ); | 1334 | (*itLE)->setText( ent.department() ); |
1334 | 1335 | ||
1335 | if ( *it == "Company" ) | 1336 | if ( *it == "Company" ) |
1336 | (*itLE)->setText( ent.company() ); | 1337 | (*itLE)->setText( ent.company() ); |
1337 | 1338 | ||
1338 | if ( *it == "Office" ) | 1339 | if ( *it == "Office" ) |
1339 | (*itLE)->setText( ent.office() ); | 1340 | (*itLE)->setText( ent.office() ); |
1340 | 1341 | ||
1341 | if ( *it == "Profession" ) | 1342 | if ( *it == "Profession" ) |
1342 | (*itLE)->setText( ent.profession() ); | 1343 | (*itLE)->setText( ent.profession() ); |
1343 | 1344 | ||
1344 | if ( *it == "Assistant" ) | 1345 | if ( *it == "Assistant" ) |
1345 | (*itLE)->setText( ent.assistant() ); | 1346 | (*itLE)->setText( ent.assistant() ); |
1346 | 1347 | ||
1347 | if ( *it == "Manager" ) | 1348 | if ( *it == "Manager" ) |
1348 | (*itLE)->setText( ent.manager() ); | 1349 | (*itLE)->setText( ent.manager() ); |
1349 | 1350 | ||
1350 | if ( *it == "Spouse" ) | 1351 | if ( *it == "Spouse" ) |
1351 | (*itLE)->setText( ent.spouse() ); | 1352 | (*itLE)->setText( ent.spouse() ); |
1352 | 1353 | ||
1353 | if ( *it == "Nickname" ){ | 1354 | if ( *it == "Nickname" ){ |
1354 | odebug << "**** Nichname: " << ent.nickname() << oendl; | 1355 | odebug << "**** Nichname: " << ent.nickname() << oendl; |
1355 | (*itLE)->setText( ent.nickname() ); | 1356 | (*itLE)->setText( ent.nickname() ); |
1356 | } | 1357 | } |
1357 | 1358 | ||
1358 | if ( *it == "Children" ) | 1359 | if ( *it == "Children" ) |
1359 | (*itLE)->setText( ent.children() ); | 1360 | (*itLE)->setText( ent.children() ); |
1360 | 1361 | ||
1361 | } | 1362 | } |
1362 | 1363 | ||
1363 | QStringList::Iterator itV; | 1364 | QStringList::Iterator itV; |
1364 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { | 1365 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { |
1365 | 1366 | ||
1366 | if ( ( *it == "Business Phone") || ( *it == "Work Phone" ) ) | 1367 | if ( ( *it == "Business Phone") || ( *it == "Work Phone" ) ) |
1367 | *itV = ent.businessPhone(); | 1368 | *itV = ent.businessPhone(); |
1368 | /* | 1369 | /* |
1369 | if ( *it == "Business 2 Phone" ) | 1370 | if ( *it == "Business 2 Phone" ) |
1370 | *itV = ent.business2Phone(); | 1371 | *itV = ent.business2Phone(); |
1371 | */ | 1372 | */ |
1372 | if ( ( *it == "Business Fax") || ( *it == "Work Fax" ) ) | 1373 | if ( ( *it == "Business Fax") || ( *it == "Work Fax" ) ) |
1373 | *itV = ent.businessFax(); | 1374 | *itV = ent.businessFax(); |
1374 | 1375 | ||
1375 | if ( ( *it == "Business Mobile" ) || ( *it == "work Mobile" ) ) | 1376 | if ( ( *it == "Business Mobile" ) || ( *it == "work Mobile" ) ) |
1376 | *itV = ent.businessMobile(); | 1377 | *itV = ent.businessMobile(); |
1377 | /* | 1378 | /* |
1378 | if ( *it == "Company Phone" ) | 1379 | if ( *it == "Company Phone" ) |
1379 | *itV = ent.companyPhone(); | 1380 | *itV = ent.companyPhone(); |
1380 | */ | 1381 | */ |
1381 | if ( *it == "Default Email" ) | 1382 | if ( *it == "Default Email" ) |
1382 | *itV = ent.defaultEmail(); | 1383 | *itV = ent.defaultEmail(); |
1383 | 1384 | ||
1384 | if ( *it == "Emails" ) | 1385 | if ( *it == "Emails" ) |
1385 | *itV = ent.emailList().join(", "); // :SX | 1386 | *itV = ent.emailList().join(", "); // :SX |
1386 | 1387 | ||
1387 | if ( *it == "Home Phone" ) | 1388 | if ( *it == "Home Phone" ) |
1388 | *itV = ent.homePhone(); | 1389 | *itV = ent.homePhone(); |
1389 | /* | 1390 | /* |
1390 | if ( *it == "Home 2 Phone" ) | 1391 | if ( *it == "Home 2 Phone" ) |
1391 | *itV = ent.home2Phone(); | 1392 | *itV = ent.home2Phone(); |
1392 | */ | 1393 | */ |
1393 | if ( *it == "Home Fax" ) | 1394 | if ( *it == "Home Fax" ) |
1394 | *itV = ent.homeFax(); | 1395 | *itV = ent.homeFax(); |
1395 | 1396 | ||
1396 | if ( *it == "Home Mobile" ) | 1397 | if ( *it == "Home Mobile" ) |
1397 | *itV = ent.homeMobile(); | 1398 | *itV = ent.homeMobile(); |
1398 | /* | 1399 | /* |
1399 | if ( *it == "Car Phone" ) | 1400 | if ( *it == "Car Phone" ) |
1400 | *itV = ent.carPhone(); | 1401 | *itV = ent.carPhone(); |
1401 | 1402 | ||
1402 | if ( *it == "ISDN Phone" ) | 1403 | if ( *it == "ISDN Phone" ) |
1403 | *itV = ent.ISDNPhone(); | 1404 | *itV = ent.ISDNPhone(); |
1404 | 1405 | ||
1405 | if ( *it == "Other Phone" ) | 1406 | if ( *it == "Other Phone" ) |
1406 | *itV = ent.otherPhone(); | 1407 | *itV = ent.otherPhone(); |
1407 | */ | 1408 | */ |
1408 | if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) | 1409 | if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) |
1409 | *itV = ent.businessPager(); | 1410 | *itV = ent.businessPager(); |
1410 | /* | 1411 | /* |
1411 | if ( *it == "Home Pager") | 1412 | if ( *it == "Home Pager") |
1412 | *itV = ent.homePager(); | 1413 | *itV = ent.homePager(); |
1413 | 1414 | ||
1414 | if ( *it == "AIM IM" ) | 1415 | if ( *it == "AIM IM" ) |
1415 | *itV = ent.AIMIM(); | 1416 | *itV = ent.AIMIM(); |
1416 | 1417 | ||
1417 | if ( *it == "ICQ IM" ) | 1418 | if ( *it == "ICQ IM" ) |
1418 | *itV = ent.ICQIM(); | 1419 | *itV = ent.ICQIM(); |
1419 | 1420 | ||
1420 | if ( *it == "Jabber IM" ) | 1421 | if ( *it == "Jabber IM" ) |
1421 | *itV = ent.jabberIM(); | 1422 | *itV = ent.jabberIM(); |
1422 | 1423 | ||
1423 | if ( *it == "MSN IM" ) | 1424 | if ( *it == "MSN IM" ) |
1424 | *itV = ent.MSNIM(); | 1425 | *itV = ent.MSNIM(); |
1425 | 1426 | ||
1426 | if ( *it == "Yahoo IM" ) | 1427 | if ( *it == "Yahoo IM" ) |
1427 | *itV = ent.yahooIM(); | 1428 | *itV = ent.yahooIM(); |
1428 | */ | 1429 | */ |
1429 | if ( *it == "Home Web Page" ) | 1430 | if ( *it == "Home Web Page" ) |
1430 | *itV = ent.homeWebpage(); | 1431 | *itV = ent.homeWebpage(); |
1431 | 1432 | ||
1432 | if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) | 1433 | if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) |
1433 | *itV = ent.businessWebpage(); | 1434 | *itV = ent.businessWebpage(); |
1434 | 1435 | ||
1435 | 1436 | ||
1436 | } | 1437 | } |
1437 | 1438 | ||
1438 | 1439 | ||
1439 | cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") ); | 1440 | cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") ); |
1440 | 1441 | ||
1441 | QString gender = ent.gender(); | 1442 | QString gender = ent.gender(); |
1442 | cmbGender->setCurrentItem( gender.toInt() ); | 1443 | cmbGender->setCurrentItem( gender.toInt() ); |
1443 | 1444 | ||
1444 | txtNote->setText( ent.notes() ); | 1445 | txtNote->setText( ent.notes() ); |
1445 | 1446 | ||
1446 | slotAddressTypeChange( cmbAddress->currentItem() ); | 1447 | slotAddressTypeChange( cmbAddress->currentItem() ); |
1447 | 1448 | ||
1448 | // Get combo-settings from contact and set preset.. | 1449 | // Get combo-settings from contact and set preset.. |
1449 | contactfields.loadFromRecord( ent ); | 1450 | contactfields.loadFromRecord( ent ); |
1450 | cmbChooserField1->setCurrentItem( contactfields.getFieldOrder(0, 7) ); | 1451 | cmbChooserField1->setCurrentItem( contactfields.getFieldOrder(0, 7) ); |
1451 | cmbChooserField2->setCurrentItem( contactfields.getFieldOrder(1, 9) ); | 1452 | cmbChooserField2->setCurrentItem( contactfields.getFieldOrder(1, 9) ); |
1452 | cmbChooserField3->setCurrentItem( contactfields.getFieldOrder(2, 0) ); | 1453 | cmbChooserField3->setCurrentItem( contactfields.getFieldOrder(2, 0) ); |
1453 | cmbChooserField4->setCurrentItem( contactfields.getFieldOrder(3, 6) ); | 1454 | cmbChooserField4->setCurrentItem( contactfields.getFieldOrder(3, 6) ); |
1454 | cmbAddress->setCurrentItem( contactfields.getFieldOrder(4, 1) ); | 1455 | cmbAddress->setCurrentItem( contactfields.getFieldOrder(4, 1) ); |
1455 | slotCmbChooser1Change( cmbChooserField1->currentItem() ); | 1456 | slotCmbChooser1Change( cmbChooserField1->currentItem() ); |
1456 | slotCmbChooser2Change( cmbChooserField2->currentItem() ); | 1457 | slotCmbChooser2Change( cmbChooserField2->currentItem() ); |
1457 | slotCmbChooser3Change( cmbChooserField3->currentItem() ); | 1458 | slotCmbChooser3Change( cmbChooserField3->currentItem() ); |
1458 | slotCmbChooser4Change( cmbChooserField4->currentItem() ); | 1459 | slotCmbChooser4Change( cmbChooserField4->currentItem() ); |
1459 | slotAddressTypeChange( cmbAddress->currentItem() ); | 1460 | slotAddressTypeChange( cmbAddress->currentItem() ); |
1460 | 1461 | ||
1461 | updateDatePicker(); | 1462 | updateDatePicker(); |
1462 | 1463 | ||
1463 | initializing = false; | 1464 | initializing = false; |
1464 | } | 1465 | } |
1465 | void ContactEditor::updateDatePicker() | 1466 | void ContactEditor::updateDatePicker() |
1466 | { | 1467 | { |
1467 | // Set DatePicker | 1468 | // Set DatePicker |
1468 | if ( !ent.birthday().isNull() ){ | 1469 | if ( !ent.birthday().isNull() ){ |
1469 | birthdayButton->setText( TimeString::numberDateString( ent.birthday() ) ); | 1470 | birthdayButton->setText( TimeString::numberDateString( ent.birthday() ) ); |
1470 | birthdayPicker->setDate( ent.birthday() ); | 1471 | birthdayPicker->setDate( ent.birthday() ); |
1471 | } else | 1472 | } else |
1472 | birthdayButton->setText( tr ("Unknown") ); | 1473 | birthdayButton->setText( tr ("Unknown") ); |
1473 | 1474 | ||
1474 | if ( !ent.anniversary().isNull() ){ | 1475 | if ( !ent.anniversary().isNull() ){ |
1475 | anniversaryButton->setText( TimeString::numberDateString( ent.anniversary() ) ); | 1476 | anniversaryButton->setText( TimeString::numberDateString( ent.anniversary() ) ); |
1476 | anniversaryPicker->setDate( ent.anniversary() ); | 1477 | anniversaryPicker->setDate( ent.anniversary() ); |
1477 | } else | 1478 | } else |
1478 | anniversaryButton->setText( tr ("Unknown") ); | 1479 | anniversaryButton->setText( tr ("Unknown") ); |
1479 | 1480 | ||
1480 | } | 1481 | } |
1481 | 1482 | ||
1482 | void ContactEditor::saveEntry() { | 1483 | void ContactEditor::saveEntry() { |
1483 | 1484 | ||
1484 | // Store current combo into contact | 1485 | // Store current combo into contact |
1485 | contactfields.saveToRecord( ent ); | 1486 | contactfields.saveToRecord( ent ); |
1486 | 1487 | ||
1487 | txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) ); | 1488 | txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) ); |
1488 | txtMiddleName->setText( parseName( txtFullName->text(), NAME_M ) ); | 1489 | txtMiddleName->setText( parseName( txtFullName->text(), NAME_M ) ); |
1489 | txtLastName->setText( parseName( txtFullName->text(), NAME_L ) ); | 1490 | txtLastName->setText( parseName( txtFullName->text(), NAME_L ) ); |
1490 | // txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) ); | 1491 | // txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) ); |
1491 | 1492 | ||
1492 | ent.setFirstName( txtFirstName->text() ); | 1493 | ent.setFirstName( txtFirstName->text() ); |
1493 | ent.setLastName( txtLastName->text() ); | 1494 | ent.setLastName( txtLastName->text() ); |
1494 | ent.setMiddleName( txtMiddleName->text() ); | 1495 | ent.setMiddleName( txtMiddleName->text() ); |
1495 | ent.setSuffix( txtSuffix->text() ); | 1496 | ent.setSuffix( txtSuffix->text() ); |
1496 | 1497 | ||
1497 | ent.setFileAs( cmbFileAs->currentText() ); | 1498 | ent.setFileAs( cmbFileAs->currentText() ); |
1498 | 1499 | ||
1499 | ent.setCategories( cmbCat->currentCategories() ); | 1500 | ent.setCategories( cmbCat->currentCategories() ); |
1500 | 1501 | ||
1501 | 1502 | ||
1502 | //if (hasTitle) | 1503 | //if (hasTitle) |
1503 | ent.setJobTitle( txtJobTitle->text() ); | 1504 | ent.setJobTitle( txtJobTitle->text() ); |
1504 | 1505 | ||
1505 | //if (hasCompany) | 1506 | //if (hasCompany) |
1506 | ent.setCompany( txtOrganization->text() ); | 1507 | ent.setCompany( txtOrganization->text() ); |
1507 | 1508 | ||
1508 | //if (hasNotes) | 1509 | //if (hasNotes) |
1509 | ent.setNotes( txtNote->text() ); | 1510 | ent.setNotes( txtNote->text() ); |
1510 | 1511 | ||
1511 | //if (hasStreet) { | 1512 | //if (hasStreet) { |
1512 | ent.setHomeStreet( slHomeAddress[0] ); | 1513 | ent.setHomeStreet( slHomeAddress[0] ); |
1513 | ent.setBusinessStreet( slBusinessAddress[0] ); | 1514 | ent.setBusinessStreet( slBusinessAddress[0] ); |
1514 | //} | 1515 | //} |
1515 | 1516 | ||
1516 | //if (hasCity) { | 1517 | //if (hasCity) { |
1517 | ent.setHomeCity( slHomeAddress[3] ); | 1518 | ent.setHomeCity( slHomeAddress[3] ); |
1518 | ent.setBusinessCity( slBusinessAddress[3] ); | 1519 | ent.setBusinessCity( slBusinessAddress[3] ); |
1519 | //} | 1520 | //} |
1520 | 1521 | ||
1521 | //if (hasState) { | 1522 | //if (hasState) { |
1522 | ent.setHomeState( slHomeAddress[4] ); | 1523 | ent.setHomeState( slHomeAddress[4] ); |
1523 | ent.setBusinessState( slBusinessAddress[4] ); | 1524 | ent.setBusinessState( slBusinessAddress[4] ); |
1524 | //} | 1525 | //} |
1525 | 1526 | ||
1526 | //if (hasZip) { | 1527 | //if (hasZip) { |
1527 | ent.setHomeZip( slHomeAddress[5] ); | 1528 | ent.setHomeZip( slHomeAddress[5] ); |
1528 | ent.setBusinessZip( slBusinessAddress[5] ); | 1529 | ent.setBusinessZip( slBusinessAddress[5] ); |
1529 | //} | 1530 | //} |
1530 | 1531 | ||
1531 | //if (hasCountry) { | 1532 | //if (hasCountry) { |
1532 | ent.setHomeCountry( slHomeAddress[6] ); | 1533 | ent.setHomeCountry( slHomeAddress[6] ); |
1533 | ent.setBusinessCountry( slBusinessAddress[6] ); | 1534 | ent.setBusinessCountry( slBusinessAddress[6] ); |
1534 | //} | 1535 | //} |
1535 | 1536 | ||
1536 | QStringList::ConstIterator it; | 1537 | QStringList::ConstIterator it; |
1537 | QListIterator<QLineEdit> itLE( listValue ); | 1538 | QListIterator<QLineEdit> itLE( listValue ); |
1538 | for ( it = slDynamicEntries.begin(); itLE.current() && it != slDynamicEntries.end(); ++it, ++itLE) { | 1539 | for ( it = slDynamicEntries.begin(); itLE.current() && it != slDynamicEntries.end(); ++it, ++itLE) { |
1539 | 1540 | ||
1540 | if ( *it == "Department" ) | 1541 | if ( *it == "Department" ) |
1541 | ent.setDepartment( (*itLE)->text() ); | 1542 | ent.setDepartment( (*itLE)->text() ); |
1542 | 1543 | ||
1543 | if ( *it == "Company" ) | 1544 | if ( *it == "Company" ) |
1544 | ent.setCompany( (*itLE)->text() ); | 1545 | ent.setCompany( (*itLE)->text() ); |
1545 | 1546 | ||
1546 | if ( *it == "Office" ) | 1547 | if ( *it == "Office" ) |
1547 | ent.setOffice( (*itLE)->text() ); | 1548 | ent.setOffice( (*itLE)->text() ); |
1548 | 1549 | ||
1549 | if ( *it == "Profession" ) | 1550 | if ( *it == "Profession" ) |
1550 | ent.setProfession( (*itLE)->text() ); | 1551 | ent.setProfession( (*itLE)->text() ); |
1551 | 1552 | ||
1552 | if ( *it == "Assistant" ) | 1553 | if ( *it == "Assistant" ) |
1553 | ent.setAssistant( (*itLE)->text() ); | 1554 | ent.setAssistant( (*itLE)->text() ); |
1554 | 1555 | ||
1555 | if ( *it == "Manager" ) | 1556 | if ( *it == "Manager" ) |
1556 | ent.setManager( (*itLE)->text() ); | 1557 | ent.setManager( (*itLE)->text() ); |
1557 | 1558 | ||
1558 | if ( *it == "Spouse" ) | 1559 | if ( *it == "Spouse" ) |
1559 | ent.setSpouse( (*itLE)->text() ); | 1560 | ent.setSpouse( (*itLE)->text() ); |
1560 | 1561 | ||
1561 | if ( *it == "Nickname" ) | 1562 | if ( *it == "Nickname" ) |
1562 | ent.setNickname( (*itLE)->text() ); | 1563 | ent.setNickname( (*itLE)->text() ); |
1563 | 1564 | ||
1564 | if ( *it == "Children" ) | 1565 | if ( *it == "Children" ) |
1565 | ent.setChildren( (*itLE)->text() ); | 1566 | ent.setChildren( (*itLE)->text() ); |
1566 | 1567 | ||
1567 | } | 1568 | } |
1568 | 1569 | ||
1569 | 1570 | ||
1570 | QStringList::ConstIterator itV; | 1571 | QStringList::ConstIterator itV; |
1571 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { | 1572 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { |
1572 | 1573 | ||
1573 | if ( ( *it == "Business Phone" ) || ( *it == "Work Phone" ) ) | 1574 | if ( ( *it == "Business Phone" ) || ( *it == "Work Phone" ) ) |
1574 | ent.setBusinessPhone( *itV ); | 1575 | ent.setBusinessPhone( *itV ); |
1575 | 1576 | ||
1576 | if ( ( *it == "Business Fax" ) || ( *it == "Work Fax" ) ) | 1577 | if ( ( *it == "Business Fax" ) || ( *it == "Work Fax" ) ) |
1577 | ent.setBusinessFax( *itV ); | 1578 | ent.setBusinessFax( *itV ); |
1578 | 1579 | ||
1579 | if ( ( *it == "Business Mobile" ) || ( *it == "Work Mobile" ) ) | 1580 | if ( ( *it == "Business Mobile" ) || ( *it == "Work Mobile" ) ) |
1580 | ent.setBusinessMobile( *itV ); | 1581 | ent.setBusinessMobile( *itV ); |
1581 | 1582 | ||
1582 | if ( *it == "Emails" ){ | 1583 | if ( *it == "Emails" ){ |
1583 | QString allemail; | 1584 | QString allemail; |
1584 | QString defaultmail; | 1585 | QString defaultmail; |
1585 | parseEmailFrom( emails.join(","), defaultmail, allemail ); | 1586 | parseEmailFrom( emails.join(","), defaultmail, allemail ); |
1586 | if ( defaultEmail.isEmpty() ){ | 1587 | if ( defaultEmail.isEmpty() ){ |
1587 | odebug << "Default email was not set by user!" << oendl; | 1588 | odebug << "Default email was not set by user!" << oendl; |
1588 | odebug << "Using first email in list: " << defaultmail << oendl; | 1589 | odebug << "Using first email in list: " << defaultmail << oendl; |
1589 | ent.setDefaultEmail( defaultmail ); | 1590 | ent.setDefaultEmail( defaultmail ); |
1590 | } | 1591 | } |
1591 | ent.setEmails( allemail ); | 1592 | ent.setEmails( allemail ); |
1592 | } | 1593 | } |
1593 | 1594 | ||
1594 | if ( *it == "Default Email") | 1595 | if ( *it == "Default Email") |
1595 | ent.setDefaultEmail( defaultEmail /* *itV */ ); | 1596 | ent.setDefaultEmail( defaultEmail /* *itV */ ); |
1596 | 1597 | ||
1597 | if ( *it == "Home Phone" ) | 1598 | if ( *it == "Home Phone" ) |
1598 | ent.setHomePhone( *itV ); | 1599 | ent.setHomePhone( *itV ); |
1599 | 1600 | ||
1600 | if ( *it == "Home Fax" ) | 1601 | if ( *it == "Home Fax" ) |
1601 | ent.setHomeFax( *itV ); | 1602 | ent.setHomeFax( *itV ); |
1602 | 1603 | ||
1603 | if ( *it == "Home Mobile" ) | 1604 | if ( *it == "Home Mobile" ) |
1604 | ent.setHomeMobile( *itV ); | 1605 | ent.setHomeMobile( *itV ); |
1605 | 1606 | ||
1606 | if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) | 1607 | if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) |
1607 | ent.setBusinessPager( *itV ); | 1608 | ent.setBusinessPager( *itV ); |
1608 | 1609 | ||
1609 | if ( *it == "Home Web Page" ) | 1610 | if ( *it == "Home Web Page" ) |
1610 | ent.setHomeWebpage( *itV ); | 1611 | ent.setHomeWebpage( *itV ); |
1611 | 1612 | ||
1612 | if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) | 1613 | if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) |
1613 | ent.setBusinessWebpage( *itV ); | 1614 | ent.setBusinessWebpage( *itV ); |
1614 | 1615 | ||
1615 | 1616 | ||
1616 | } | 1617 | } |
1617 | 1618 | ||
1618 | int gender = cmbGender->currentItem(); | 1619 | int gender = cmbGender->currentItem(); |
1619 | ent.setGender( QString::number( gender ) ); | 1620 | ent.setGender( QString::number( gender ) ); |
1620 | 1621 | ||
1621 | QString str = txtNote->text(); | 1622 | QString str = txtNote->text(); |
1622 | if ( !str.isNull() ) | 1623 | if ( !str.isNull() ) |
1623 | ent.setNotes( str ); | 1624 | ent.setNotes( str ); |
1624 | 1625 | ||
1625 | } | 1626 | } |
1626 | 1627 | ||
1627 | void parseEmailFrom( const QString &txt, QString &strDefaultEmail, | 1628 | void parseEmailFrom( const QString &txt, QString &strDefaultEmail, |
1628 | QString &strAll ) | 1629 | QString &strAll ) |
1629 | { | 1630 | { |
1630 | int where, | 1631 | int where, |
1631 | start; | 1632 | start; |
1632 | if ( txt.isEmpty() ) | 1633 | if ( txt.isEmpty() ) |
1633 | return; | 1634 | return; |
1634 | // find the first | 1635 | // find the first |
1635 | where = txt.find( ',' ); | 1636 | where = txt.find( ',' ); |
1636 | if ( where < 0 ) { | 1637 | if ( where < 0 ) { |
1637 | strDefaultEmail = txt; | 1638 | strDefaultEmail = txt; |
1638 | strAll = txt; | 1639 | strAll = txt; |
1639 | } else { | 1640 | } else { |
1640 | strDefaultEmail = txt.left( where ).stripWhiteSpace(); | 1641 | strDefaultEmail = txt.left( where ).stripWhiteSpace(); |
1641 | strAll = strDefaultEmail; | 1642 | strAll = strDefaultEmail; |
1642 | while ( where > -1 ) { | 1643 | while ( where > -1 ) { |
1643 | strAll.append(" "); | 1644 | strAll.append(" "); |
1644 | start = where; | 1645 | start = where; |
1645 | where = txt.find( ',', where + 1 ); | 1646 | where = txt.find( ',', where + 1 ); |
1646 | if ( where > - 1 ) | 1647 | if ( where > - 1 ) |
1647 | strAll.append( txt.mid(start + 1, where - start - 1).stripWhiteSpace() ); | 1648 | strAll.append( txt.mid(start + 1, where - start - 1).stripWhiteSpace() ); |
1648 | else // grab until the end... | 1649 | else // grab until the end... |
1649 | strAll.append( txt.right(txt.length() - start - 1).stripWhiteSpace() ); | 1650 | strAll.append( txt.right(txt.length() - start - 1).stripWhiteSpace() ); |
1650 | } | 1651 | } |
1651 | } | 1652 | } |
1652 | } | 1653 | } |
1653 | 1654 | ||
1654 | void parseEmailTo( const QString &strDefaultEmail, | 1655 | void parseEmailTo( const QString &strDefaultEmail, |
1655 | const QString &strOtherEmail, QString &strBack ) | 1656 | const QString &strOtherEmail, QString &strBack ) |
1656 | { | 1657 | { |
1657 | // create a comma dilimeted set of emails... | 1658 | // create a comma dilimeted set of emails... |
1658 | // use the power of short circuiting... | 1659 | // use the power of short circuiting... |
1659 | bool foundDefault = false; | 1660 | bool foundDefault = false; |
1660 | QString strTmp; | 1661 | QString strTmp; |
1661 | int start = 0; | 1662 | int start = 0; |
1662 | int where; | 1663 | int where; |
1663 | // start at the beginng. | 1664 | // start at the beginng. |
1664 | strBack = strDefaultEmail; | 1665 | strBack = strDefaultEmail; |
1665 | where = 0; | 1666 | where = 0; |
1666 | while ( where > -1 ) { | 1667 | while ( where > -1 ) { |
1667 | start = where; | 1668 | start = where; |
1668 | where = strOtherEmail.find( ' ', where + 1 ); | 1669 | where = strOtherEmail.find( ' ', where + 1 ); |
1669 | if ( where > 0 ) { | 1670 | if ( where > 0 ) { |
1670 | strTmp = strOtherEmail.mid( start, where - start ).stripWhiteSpace(); | 1671 | strTmp = strOtherEmail.mid( start, where - start ).stripWhiteSpace(); |
1671 | } else | 1672 | } else |
1672 | strTmp = strOtherEmail.right( strOtherEmail.length() - start ).stripWhiteSpace(); | 1673 | strTmp = strOtherEmail.right( strOtherEmail.length() - start ).stripWhiteSpace(); |
1673 | if ( foundDefault || strTmp != strDefaultEmail ) { | 1674 | if ( foundDefault || strTmp != strDefaultEmail ) { |
1674 | strBack.append( ", " ); | 1675 | strBack.append( ", " ); |
1675 | strBack.append( strTmp ); | 1676 | strBack.append( strTmp ); |
1676 | } else | 1677 | } else |
1677 | foundDefault = true; | 1678 | foundDefault = true; |
1678 | } | 1679 | } |
1679 | } | 1680 | } |
1680 | 1681 | ||
1681 | 1682 | ||
1682 | static inline bool containsAlphaNum( const QString &str ) | 1683 | static inline bool containsAlphaNum( const QString &str ) |
1683 | { | 1684 | { |
1684 | int i, | 1685 | int i, |
1685 | count = str.length(); | 1686 | count = str.length(); |
1686 | for ( i = 0; i < count; i++ ) | 1687 | for ( i = 0; i < count; i++ ) |
1687 | if ( !str[i].isSpace() ) | 1688 | if ( !str[i].isSpace() ) |
1688 | return true; | 1689 | return true; |
1689 | return false; | 1690 | return false; |
1690 | } | 1691 | } |
1691 | 1692 | ||
1692 | static inline bool constainsWhiteSpace( const QString &str ) | 1693 | static inline bool constainsWhiteSpace( const QString &str ) |
1693 | { | 1694 | { |
1694 | int i, | 1695 | int i, |
1695 | count = str.length(); | 1696 | count = str.length(); |
1696 | for (i = 0; i < count; i++ ) | 1697 | for (i = 0; i < count; i++ ) |
1697 | if ( str[i].isSpace() ) | 1698 | if ( str[i].isSpace() ) |
1698 | return true; | 1699 | return true; |
1699 | return false; | 1700 | return false; |
1700 | } | 1701 | } |
1701 | 1702 | ||
1702 | void ContactEditor::setPersonalView( bool personal ) | 1703 | void ContactEditor::setPersonalView( bool personal ) |
1703 | { | 1704 | { |
1704 | m_personalView = personal; | 1705 | m_personalView = personal; |
1705 | 1706 | ||
1706 | // Currently disbled due to the fact that | 1707 | // Currently disbled due to the fact that |
1707 | // show will not work... | 1708 | // show will not work... |
1708 | return; | 1709 | return; |
1709 | 1710 | ||
1710 | if ( personal ){ | 1711 | if ( personal ){ |
1711 | cmbCat->hide(); | 1712 | cmbCat->hide(); |
1712 | labCat->hide(); | 1713 | labCat->hide(); |
1713 | 1714 | ||
1714 | } else{ | 1715 | } else{ |
1715 | cmbCat->show(); | 1716 | cmbCat->show(); |
1716 | labCat->show(); | 1717 | labCat->show(); |
1717 | } | 1718 | } |
1718 | } | 1719 | } |
1719 | 1720 | ||
1720 | void ContactEditor::slotAnniversaryDateChanged( int year, int month, int day) | 1721 | void ContactEditor::slotAnniversaryDateChanged( int year, int month, int day) |
1721 | { | 1722 | { |
1722 | QDate date; | 1723 | QDate date; |
1723 | date.setYMD( year, month, day ); | 1724 | date.setYMD( year, month, day ); |
1724 | QString dateString = TimeString::numberDateString( date ); | 1725 | QString dateString = TimeString::numberDateString( date ); |
1725 | anniversaryButton->setText( dateString ); | 1726 | anniversaryButton->setText( dateString ); |
1726 | ent.setAnniversary ( date ); | 1727 | ent.setAnniversary ( date ); |
1727 | } | 1728 | } |
1728 | 1729 | ||
1729 | void ContactEditor::slotBirthdayDateChanged( int year, int month, int day) | 1730 | void ContactEditor::slotBirthdayDateChanged( int year, int month, int day) |
1730 | { | 1731 | { |
1731 | QDate date; | 1732 | QDate date; |
1732 | date.setYMD( year, month, day ); | 1733 | date.setYMD( year, month, day ); |
1733 | QString dateString = TimeString::numberDateString( date ); | 1734 | QString dateString = TimeString::numberDateString( date ); |
1734 | birthdayButton->setText( dateString ); | 1735 | birthdayButton->setText( dateString ); |
1735 | ent.setBirthday ( date ); | 1736 | ent.setBirthday ( date ); |
1736 | } | 1737 | } |
1737 | 1738 | ||
1738 | void ContactEditor::slotRemoveBirthday() | 1739 | void ContactEditor::slotRemoveBirthday() |
1739 | { | 1740 | { |
1740 | odebug << "void ContactEditor::slotRemoveBirthday()" << oendl; | 1741 | odebug << "void ContactEditor::slotRemoveBirthday()" << oendl; |
1741 | ent.setBirthday( QDate() ); | 1742 | ent.setBirthday( QDate() ); |
1742 | updateDatePicker(); | 1743 | updateDatePicker(); |
1743 | } | 1744 | } |
1744 | 1745 | ||
1745 | void ContactEditor::slotRemoveAnniversary() | 1746 | void ContactEditor::slotRemoveAnniversary() |
1746 | { | 1747 | { |
1747 | odebug << "void ContactEditor::slotRemoveAnniversary()" << oendl; | 1748 | odebug << "void ContactEditor::slotRemoveAnniversary()" << oendl; |
1748 | ent.setAnniversary( QDate() ); | 1749 | ent.setAnniversary( QDate() ); |
1749 | updateDatePicker(); | 1750 | updateDatePicker(); |
1750 | } | 1751 | } |