summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/abtable.cpp31
-rw-r--r--core/pim/addressbook/configdlg.cpp9
2 files changed, 24 insertions, 16 deletions
diff --git a/core/pim/addressbook/abtable.cpp b/core/pim/addressbook/abtable.cpp
index 539d6ba..52aff36 100644
--- a/core/pim/addressbook/abtable.cpp
+++ b/core/pim/addressbook/abtable.cpp
@@ -1,760 +1,769 @@
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#include <opie2/oresource.h>
25 25
26#include <qpe/timestring.h> 26#include <qpe/timestring.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
45AbTableItem::AbTableItem( QTable *t, EditType et, const QString &s, 45AbTableItem::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
53int AbTableItem::alignment() const 53int AbTableItem::alignment() const
54{ 54{
55 return AlignLeft|AlignVCenter; 55 return AlignLeft|AlignVCenter;
56} 56}
57 57
58QString AbTableItem::key() const 58QString 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...
64void AbTableItem::setItem( const QString &txt, const QString &secondKey ) 64void 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
78AbPickItem::AbPickItem( QTable *t ) : 78AbPickItem::AbPickItem( QTable *t ) :
79 QTableItem(t, WhenCurrent, "?") 79 QTableItem(t, WhenCurrent, "?")
80{ 80{
81} 81}
82 82
83QWidget *AbPickItem::createEditor() const 83QWidget *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
99void AbPickItem::setContentFromEditor( QWidget *w ) 99void 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
115AbTable::AbTable( const QValueList<int> order, QWidget *parent, const char *name ) 115AbTable::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
136AbTable::~AbTable() 136AbTable::~AbTable()
137{ 137{
138} 138}
139 139
140void AbTable::init() 140void 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
153void AbTable::setContacts( const Opie::OPimContactAccess::List& viewList ) 153void 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
171void AbTable::setOrderedList( const QValueList<int> ordered ) 171void AbTable::setOrderedList( const QValueList<int> ordered )
172{ 172{
173 intFields = ordered; 173 intFields = ordered;
174} 174}
175 175
176 176
177bool AbTable::selectContact( int UID ) 177bool 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
206void AbTable::columnClicked( int col ) 206void 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
217void AbTable::resort() 217void 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
223Opie::OPimContact AbTable::currentEntry() 223Opie::OPimContact AbTable::currentEntry()
224{ 224{
225 return m_viewList[currentRow()]; 225 return m_viewList[currentRow()];
226} 226}
227 227
228int AbTable::currentEntry_UID() 228int AbTable::currentEntry_UID()
229{ 229{
230 return ( currentEntry().uid() ); 230 return ( currentEntry().uid() );
231} 231}
232 232
233void AbTable::clear() 233void 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
251void AbTable::refresh() 251void 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
279void AbTable::keyPressEvent( QKeyEvent *e ) 279void 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
307void AbTable::moveTo( char /*c*/ ) 307void 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)
315QString AbTable::findContactName( const Opie::OPimContact &entry ) 315QString 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
331void AbTable::resizeRows() { 331void 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
343void AbTable::realignTable() 343void 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
361void QTable::paintEmptyArea( QPainter *p, int cx, int cy, int cw, int ch ) 361void 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
393void AbTable::fitColumns() 393void 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
417void AbTable::show() 417void 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
425void AbTable::setChoiceNames( const QStringList& list) 425void 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
441void AbTable::itemClicked(int,int col) 441void 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
453QStringList AbTable::choiceNames() const 453QStringList AbTable::choiceNames() const
454{ 454{
455 return choicenames; 455 return choicenames;
456} 456}
457 457
458#endif 458#endif
459void AbTable::setChoiceSelection( const QValueList<int>& list ) 459void AbTable::setChoiceSelection( const QValueList<int>& list )
460{ 460{
461 intFields = list; 461 intFields = list;
462} 462}
463 463
464QStringList AbTable::choiceSelection(int /*index*/) const 464QStringList 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
482void AbTable::updateVisible() 482void 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
518void AbTable::setPaintingEnabled( bool e ) 518void 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
541void AbTable::viewportPaintEvent( QPaintEvent* e ) { 541void 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
548void AbTable::paintCell(QPainter* p, int row, int col, const QRect& cr, bool ) { 548void 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
603void AbTable::rowHeightChanged( int row ) 603void AbTable::rowHeightChanged( int row )
604{ 604{
605 if ( enablePainting ) 605 if ( enablePainting )
606 QTable::rowHeightChanged( row ); 606 QTable::rowHeightChanged( row );
607} 607}
608ContactItem AbTable::findContactContact( const Opie::OPimContact &entry, int /* row */ ) 608ContactItem AbTable::findContactContact( const Opie::OPimContact &entry, int /* row */ )
609{ 609{
610 610
611 ContactItem item; 611 int iconsize = fontMetrics().height();
612 QImage icon;
612 613
614 ContactItem item;
613 item.value = ""; 615 item.value = "";
614 616
615 for ( QValueList<int>::ConstIterator it = intFields.begin(); 617 for ( QValueList<int>::ConstIterator it = intFields.begin();
616 it != intFields.end(); ++it ) { 618 it != intFields.end(); ++it ) {
619 icon.reset();
620
617 switch ( *it ) { 621 switch ( *it ) {
618 default: 622 default:
619 break; 623 break;
620 case Qtopia::Title: 624 case Qtopia::Title:
621 item.value = entry.title(); 625 item.value = entry.title();
622 break; 626 break;
623 case Qtopia::Suffix: 627 case Qtopia::Suffix:
624 item.value = entry.suffix(); 628 item.value = entry.suffix();
625 break; 629 break;
626 case Qtopia::FileAs: 630 case Qtopia::FileAs:
627 item.value = entry.fileAs(); 631 item.value = entry.fileAs();
628 break; 632 break;
629 case Qtopia::DefaultEmail: 633 case Qtopia::DefaultEmail:
630 item.value = entry.defaultEmail(); 634 item.value = entry.defaultEmail();
631 if ( !item.value.isEmpty() ) 635 if ( !item.value.isEmpty() )
632 item.icon = Opie::Core::OResource::loadPixmap( "addressbook/email" ); 636 icon = Opie::Core::OResource::loadPixmap( "addressbook/email" );
633 break; 637 break;
634 case Qtopia::Emails: 638 case Qtopia::Emails:
635 item.value = entry.emails(); 639 item.value = entry.emails();
636 if ( !item.value.isEmpty() ) 640 if ( !item.value.isEmpty() )
637 item.icon = Opie::Core::OResource::loadPixmap( "addressbook/email" ); 641 icon = Opie::Core::OResource::loadPixmap( "addressbook/email" );
638 break; 642 break;
639 case Qtopia::HomeStreet: 643 case Qtopia::HomeStreet:
640 item.value = entry.homeStreet(); 644 item.value = entry.homeStreet();
641 break; 645 break;
642 case Qtopia::HomeCity: 646 case Qtopia::HomeCity:
643 item.value = entry.homeCity(); 647 item.value = entry.homeCity();
644 break; 648 break;
645 case Qtopia::HomeState: 649 case Qtopia::HomeState:
646 item.value = entry.homeState(); 650 item.value = entry.homeState();
647 break; 651 break;
648 case Qtopia::HomeZip: 652 case Qtopia::HomeZip:
649 item.value = entry.homeZip(); 653 item.value = entry.homeZip();
650 break; 654 break;
651 case Qtopia::HomeCountry: 655 case Qtopia::HomeCountry:
652 item.value = entry.homeCountry(); 656 item.value = entry.homeCountry();
653 break; 657 break;
654 case Qtopia::HomePhone: 658 case Qtopia::HomePhone:
655 item.value = entry.homePhone(); 659 item.value = entry.homePhone();
656 if ( !item.value.isEmpty() ) 660 if ( !item.value.isEmpty() )
657 item.icon = Opie::Core::OResource::loadPixmap( "addressbook/phonehome" ); 661 icon = Opie::Core::OResource::loadPixmap( "addressbook/phonehome" );
658 break; 662 break;
659 case Qtopia::HomeFax: 663 case Qtopia::HomeFax:
660 item.value = entry.homeFax(); 664 item.value = entry.homeFax();
661 if ( !item.value.isEmpty() ) 665 if ( !item.value.isEmpty() )
662 item.icon = Opie::Core::OResource::loadPixmap( "addressbook/faxhome" ); 666 icon = Opie::Core::OResource::loadPixmap( "addressbook/faxhome" );
663 break; 667 break;
664 case Qtopia::HomeMobile: 668 case Qtopia::HomeMobile:
665 item.value = entry.homeMobile(); 669 item.value = entry.homeMobile();
666 if ( !item.value.isEmpty() ) 670 if ( !item.value.isEmpty() )
667 item.icon = Opie::Core::OResource::loadPixmap( "addressbook/mobilehome" ); 671 icon = Opie::Core::OResource::loadPixmap( "addressbook/mobilehome" );
668 break; 672 break;
669 case Qtopia::HomeWebPage: 673 case Qtopia::HomeWebPage:
670 item.value = entry.homeWebpage(); 674 item.value = entry.homeWebpage();
671 if ( !item.value.isEmpty() ) 675 if ( !item.value.isEmpty() )
672 item.icon = Opie::Core::OResource::loadPixmap( "addressbook/webpagehome" ); 676 icon = Opie::Core::OResource::loadPixmap( "addressbook/webpagehome" );
673 break; 677 break;
674 case Qtopia::Company: 678 case Qtopia::Company:
675 item.value = entry.company(); 679 item.value = entry.company();
676 break; 680 break;
677 case Qtopia::BusinessCity: 681 case Qtopia::BusinessCity:
678 item.value = entry.businessCity(); 682 item.value = entry.businessCity();
679 break; 683 break;
680 case Qtopia::BusinessStreet: 684 case Qtopia::BusinessStreet:
681 item.value = entry.businessStreet(); 685 item.value = entry.businessStreet();
682 break; 686 break;
683 case Qtopia::BusinessZip: 687 case Qtopia::BusinessZip:
684 item.value = entry.businessZip(); 688 item.value = entry.businessZip();
685 break; 689 break;
686 case Qtopia::BusinessCountry: 690 case Qtopia::BusinessCountry:
687 item.value = entry.businessCountry(); 691 item.value = entry.businessCountry();
688 break; 692 break;
689 case Qtopia::BusinessWebPage: 693 case Qtopia::BusinessWebPage:
690 item.value = entry.businessWebpage(); 694 item.value = entry.businessWebpage();
691 if ( !item.value.isEmpty() ) 695 if ( !item.value.isEmpty() )
692 item.icon = Opie::Core::OResource::loadPixmap( "addressbook/webpagework" ); 696 icon = Opie::Core::OResource::loadPixmap( "addressbook/webpagework" );
693 break; 697 break;
694 case Qtopia::JobTitle: 698 case Qtopia::JobTitle:
695 item.value = entry.jobTitle(); 699 item.value = entry.jobTitle();
696 break; 700 break;
697 case Qtopia::Department: 701 case Qtopia::Department:
698 item.value = entry.department(); 702 item.value = entry.department();
699 break; 703 break;
700 case Qtopia::Office: 704 case Qtopia::Office:
701 item.value = entry.office(); 705 item.value = entry.office();
702 break; 706 break;
703 case Qtopia::BusinessPhone: 707 case Qtopia::BusinessPhone:
704 item.value = entry.businessPhone(); 708 item.value = entry.businessPhone();
705 if ( !item.value.isEmpty() ) 709 if ( !item.value.isEmpty() )
706 item.icon = Opie::Core::OResource::loadPixmap( "addressbook/phonework" ); 710 icon = Opie::Core::OResource::loadPixmap( "addressbook/phonework" );
707 break; 711 break;
708 case Qtopia::BusinessFax: 712 case Qtopia::BusinessFax:
709 item.value = entry.businessFax(); 713 item.value = entry.businessFax();
710 if ( !item.value.isEmpty() ) 714 if ( !item.value.isEmpty() )
711 item.icon = Opie::Core::OResource::loadPixmap( "addressbook/faxwork" ); 715 icon = Opie::Core::OResource::loadPixmap( "addressbook/faxwork" );
712 break; 716 break;
713 case Qtopia::BusinessMobile: 717 case Qtopia::BusinessMobile:
714 item.value = entry.businessMobile(); 718 item.value = entry.businessMobile();
715 if ( !item.value.isEmpty() ) 719 if ( !item.value.isEmpty() )
716 item.icon = Opie::Core::OResource::loadPixmap( "addressbook/mobilework" ); 720 icon = Opie::Core::OResource::loadPixmap( "addressbook/mobilework" );
717 break; 721 break;
718 case Qtopia::BusinessPager: 722 case Qtopia::BusinessPager:
719 item.value = entry.businessPager(); 723 item.value = entry.businessPager();
720 break; 724 break;
721 case Qtopia::Profession: 725 case Qtopia::Profession:
722 item.value = entry.profession(); 726 item.value = entry.profession();
723 break; 727 break;
724 case Qtopia::Assistant: 728 case Qtopia::Assistant:
725 item.value = entry.assistant(); 729 item.value = entry.assistant();
726 break; 730 break;
727 case Qtopia::Manager: 731 case Qtopia::Manager:
728 item.value = entry.manager(); 732 item.value = entry.manager();
729 break; 733 break;
730 case Qtopia::Spouse: 734 case Qtopia::Spouse:
731 item.value = entry.spouse(); 735 item.value = entry.spouse();
732 break; 736 break;
733 case Qtopia::Gender: 737 case Qtopia::Gender:
734 item.value = entry.gender(); 738 item.value = entry.gender();
735 break; 739 break;
736 case Qtopia::Birthday: 740 case Qtopia::Birthday:
737 if ( ! entry.birthday().isNull() ){ 741 if ( ! entry.birthday().isNull() ){
738 item.value = TimeString::numberDateString( entry.birthday() ); 742 item.value = TimeString::numberDateString( entry.birthday() );
739 } 743 }
740 break; 744 break;
741 case Qtopia::Anniversary: 745 case Qtopia::Anniversary:
742 if ( ! entry.anniversary().isNull() ){ 746 if ( ! entry.anniversary().isNull() ){
743 item.value = TimeString::numberDateString( entry.anniversary() ); 747 item.value = TimeString::numberDateString( entry.anniversary() );
744 } 748 }
745 break; 749 break;
746 case Qtopia::Nickname: 750 case Qtopia::Nickname:
747 item.value = entry.nickname(); 751 item.value = entry.nickname();
748 break; 752 break;
749 case Qtopia::Children: 753 case Qtopia::Children:
750 item.value = entry.children(); 754 item.value = entry.children();
751 break; 755 break;
752 case Qtopia::Notes: 756 case Qtopia::Notes:
753 item.value = entry.notes(); 757 item.value = entry.notes();
754 break; 758 break;
755 } 759 }
760
761 if ( !icon.isNull() ) {
762 item.icon = icon.smoothScale( iconsize, iconsize );
763 }
764
756 if ( !item.value.isEmpty() ) 765 if ( !item.value.isEmpty() )
757 break; 766 break;
758 } 767 }
759 return item; 768 return item;
760} 769}
diff --git a/core/pim/addressbook/configdlg.cpp b/core/pim/addressbook/configdlg.cpp
index a491fc7..648ad52 100644
--- a/core/pim/addressbook/configdlg.cpp
+++ b/core/pim/addressbook/configdlg.cpp
@@ -1,153 +1,152 @@
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#include <opie2/oresource.h> 6#include <opie2/oresource.h>
7 7
8#include <qcheckbox.h> 8#include <qcheckbox.h>
9#include <qradiobutton.h> 9#include <qradiobutton.h>
10#include <qlistbox.h> 10#include <qlistbox.h>
11#include <qpushbutton.h> 11#include <qpushbutton.h>
12 12
13ConfigDlg::ConfigDlg( QWidget *parent, const char *name): 13ConfigDlg::ConfigDlg( QWidget *parent, const char *name):
14 ConfigDlg_Base(parent, name, true ) 14 ConfigDlg_Base(parent, name, true )
15{ 15{
16 contFields = Opie::OPimContactFields::trfields(); 16 contFields = Opie::OPimContactFields::trfields();
17 17
18 // We add all Fields into the Listbox 18 // We add all Fields into the Listbox
19 for (uint i=0; i < contFields.count(); i++) { 19 for (uint i=0; i < contFields.count(); i++) {
20 allFieldListBox->insertItem( contFields[i] ); 20 allFieldListBox->insertItem( contFields[i] );
21 } 21 }
22 22
23 // Reset Widget Flags: This was not changeable by designer :( 23 // Reset Widget Flags: This was not changeable by designer :(
24 setWFlags ( WStyle_ContextHelp ); 24 setWFlags ( WStyle_ContextHelp );
25 25
26 // Set Pics to Buttons and Tabs 26 // Set Pics to Buttons and Tabs
27 m_upButton->setIconSet( QIconSet( Opie::Core::OResource::loadPixmap( "addressbook/up" ) ) ); 27 m_upButton->setPixmap( Opie::Core::OResource::loadPixmap( "up", Opie::Core::OResource::SmallIcon ) );
28 m_downButton->setIconSet( QIconSet( Opie::Core::OResource::loadPixmap( "addressbook/down" ) ) ); 28 m_downButton->setPixmap( Opie::Core::OResource::loadPixmap( "down", Opie::Core::OResource::SmallIcon ) );
29 m_addButton->setIconSet( QIconSet( Opie::Core::OResource::loadPixmap( "addressbook/add" ) ) ); 29 m_addButton->setPixmap( Opie::Core::OResource::loadPixmap( "addressbook/add", Opie::Core::OResource::SmallIcon ) );
30 m_removeButton->setIconSet( QIconSet( Opie::Core::OResource::loadPixmap( "addressbook/sub" ) ) ); 30 m_removeButton->setPixmap( Opie::Core::OResource::loadPixmap( "addressbook/sub", Opie::Core::OResource::SmallIcon ) );
31
32 31
33 // Get the translation maps between Field ID and translated strings 32 // Get the translation maps between Field ID and translated strings
34 m_mapStrToID = Opie::OPimContactFields::trFieldsToId(); 33 m_mapStrToID = Opie::OPimContactFields::trFieldsToId();
35 m_mapIDToStr = Opie::OPimContactFields::idToTrFields(); 34 m_mapIDToStr = Opie::OPimContactFields::idToTrFields();
36 35
37 connect ( m_addButton, SIGNAL( clicked() ), this, SLOT( slotItemAdd() ) ); 36 connect ( m_addButton, SIGNAL( clicked() ), this, SLOT( slotItemAdd() ) );
38 connect ( m_removeButton, SIGNAL( clicked() ), this, SLOT( slotItemRemove() ) ); 37 connect ( m_removeButton, SIGNAL( clicked() ), this, SLOT( slotItemRemove() ) );
39 connect ( m_upButton, SIGNAL( clicked() ), this, SLOT( slotItemUp() ) ); 38 connect ( m_upButton, SIGNAL( clicked() ), this, SLOT( slotItemUp() ) );
40 connect ( m_downButton, SIGNAL( clicked() ), this, SLOT( slotItemDown() ) ); 39 connect ( m_downButton, SIGNAL( clicked() ), this, SLOT( slotItemDown() ) );
41} 40}
42 41
43void ConfigDlg::slotItemUp() 42void ConfigDlg::slotItemUp()
44{ 43{
45 odebug << "void ConfigDlg::slotItemUp()" << oendl; 44 odebug << "void ConfigDlg::slotItemUp()" << oendl;
46 45
47 int i = fieldListBox->currentItem(); 46 int i = fieldListBox->currentItem();
48 if ( i > 0 ) { 47 if ( i > 0 ) {
49 QString item = fieldListBox->currentText(); 48 QString item = fieldListBox->currentText();
50 fieldListBox->removeItem( i ); 49 fieldListBox->removeItem( i );
51 fieldListBox->insertItem( item, i-1 ); 50 fieldListBox->insertItem( item, i-1 );
52 fieldListBox->setCurrentItem( i-1 ); 51 fieldListBox->setCurrentItem( i-1 );
53 } 52 }
54 53
55} 54}
56 55
57void ConfigDlg::slotItemDown() 56void ConfigDlg::slotItemDown()
58{ 57{
59 odebug << "void ConfigDlg::slotItemDown()" << oendl; 58 odebug << "void ConfigDlg::slotItemDown()" << oendl;
60 59
61 int i = fieldListBox->currentItem(); 60 int i = fieldListBox->currentItem();
62 if ( i < (int)fieldListBox->count() - 1 ) { 61 if ( i < (int)fieldListBox->count() - 1 ) {
63 QString item = fieldListBox->currentText(); 62 QString item = fieldListBox->currentText();
64 fieldListBox->removeItem( i ); 63 fieldListBox->removeItem( i );
65 fieldListBox->insertItem( item, i+1 ); 64 fieldListBox->insertItem( item, i+1 );
66 fieldListBox->setCurrentItem( i+1 ); 65 fieldListBox->setCurrentItem( i+1 );
67 } 66 }
68} 67}
69 68
70void ConfigDlg::slotItemAdd() 69void ConfigDlg::slotItemAdd()
71{ 70{
72 odebug << "void ConfigDlg::slotItemAdd()" << oendl; 71 odebug << "void ConfigDlg::slotItemAdd()" << oendl;
73 72
74 int i = allFieldListBox->currentItem(); 73 int i = allFieldListBox->currentItem();
75 if ( i > 0 ) { 74 if ( i > 0 ) {
76 QString item = allFieldListBox->currentText(); 75 QString item = allFieldListBox->currentText();
77 odebug << "Adding " << item << oendl; 76 odebug << "Adding " << item << oendl;
78 fieldListBox->insertItem( item ); 77 fieldListBox->insertItem( item );
79 } 78 }
80} 79}
81 80
82void ConfigDlg::slotItemRemove() 81void ConfigDlg::slotItemRemove()
83{ 82{
84 odebug << "void ConfigDlg::slotItemRemove()" << oendl; 83 odebug << "void ConfigDlg::slotItemRemove()" << oendl;
85 84
86 int i = fieldListBox->currentItem(); 85 int i = fieldListBox->currentItem();
87 if ( i > 0 ) { 86 if ( i > 0 ) {
88 fieldListBox->removeItem( i ); 87 fieldListBox->removeItem( i );
89 } 88 }
90} 89}
91 90
92void ConfigDlg::setConfig( const AbConfig& cnf ) 91void ConfigDlg::setConfig( const AbConfig& cnf )
93{ 92{
94 m_config = cnf; 93 m_config = cnf;
95 94
96 m_useRegExp->setChecked( m_config.useRegExp() ); 95 m_useRegExp->setChecked( m_config.useRegExp() );
97 m_useWildCard->setChecked( m_config.useWildCards() ); 96 m_useWildCard->setChecked( m_config.useWildCards() );
98 m_useQtMail->setChecked( m_config.useQtMail() ); 97 m_useQtMail->setChecked( m_config.useQtMail() );
99 m_useOpieMail->setChecked( m_config.useOpieMail() ); 98 m_useOpieMail->setChecked( m_config.useOpieMail() );
100 m_useCaseSensitive->setChecked( m_config.beCaseSensitive() ); 99 m_useCaseSensitive->setChecked( m_config.beCaseSensitive() );
101 100
102 switch( m_config.fontSize() ){ 101 switch( m_config.fontSize() ){
103 case 0: 102 case 0:
104 m_smallFont->setChecked( true ); 103 m_smallFont->setChecked( true );
105 m_normalFont->setChecked( false ); 104 m_normalFont->setChecked( false );
106 m_largeFont->setChecked( false ); 105 m_largeFont->setChecked( false );
107 break; 106 break;
108 case 1: 107 case 1:
109 m_smallFont->setChecked( false ); 108 m_smallFont->setChecked( false );
110 m_normalFont->setChecked( true ); 109 m_normalFont->setChecked( true );
111 m_largeFont->setChecked( false ); 110 m_largeFont->setChecked( false );
112 break; 111 break;
113 case 2: 112 case 2:
114 m_smallFont->setChecked( false ); 113 m_smallFont->setChecked( false );
115 m_normalFont->setChecked( false ); 114 m_normalFont->setChecked( false );
116 m_largeFont->setChecked( true ); 115 m_largeFont->setChecked( true );
117 break; 116 break;
118 } 117 }
119 118
120 for( uint i = 0; i < m_config.orderList().count(); i++ ) { 119 for( uint i = 0; i < m_config.orderList().count(); i++ ) {
121 fieldListBox -> insertItem ( m_mapIDToStr[ m_config.orderList()[i] ] ); 120 fieldListBox -> insertItem ( m_mapIDToStr[ m_config.orderList()[i] ] );
122 } 121 }
123 122
124 m_fixedBars->setChecked( m_config.fixedBars() ); 123 m_fixedBars->setChecked( m_config.fixedBars() );
125 m_moveBars->setChecked( !m_config.fixedBars() ); 124 m_moveBars->setChecked( !m_config.fixedBars() );
126} 125}
127 126
128AbConfig ConfigDlg::getConfig() 127AbConfig ConfigDlg::getConfig()
129{ 128{
130 m_config.setUseRegExp( m_useRegExp->isOn() ); 129 m_config.setUseRegExp( m_useRegExp->isOn() );
131 m_config.setUseWildCards( m_useWildCard->isOn() ); 130 m_config.setUseWildCards( m_useWildCard->isOn() );
132 m_config.setUseQtMail( m_useQtMail->isOn() ); 131 m_config.setUseQtMail( m_useQtMail->isOn() );
133 m_config.setUseOpieMail( m_useOpieMail->isOn() ); 132 m_config.setUseOpieMail( m_useOpieMail->isOn() );
134 m_config.setBeCaseSensitive( m_useCaseSensitive->isChecked() ); 133 m_config.setBeCaseSensitive( m_useCaseSensitive->isChecked() );
135 134
136 if ( m_smallFont->isChecked() ) 135 if ( m_smallFont->isChecked() )
137 m_config.setFontSize( 0 ); 136 m_config.setFontSize( 0 );
138 if ( m_normalFont->isChecked() ) 137 if ( m_normalFont->isChecked() )
139 m_config.setFontSize( 1 ); 138 m_config.setFontSize( 1 );
140 if ( m_largeFont->isChecked() ) 139 if ( m_largeFont->isChecked() )
141 m_config.setFontSize( 2 ); 140 m_config.setFontSize( 2 );
142 141
143 QValueList<int> orderlist; 142 QValueList<int> orderlist;
144 for( int i = 0; i < (int)fieldListBox->count(); i++ ) { 143 for( int i = 0; i < (int)fieldListBox->count(); i++ ) {
145 orderlist.append( m_mapStrToID[ fieldListBox->text(i) ] ); 144 orderlist.append( m_mapStrToID[ fieldListBox->text(i) ] );
146 } 145 }
147 m_config.setOrderList( orderlist ); 146 m_config.setOrderList( orderlist );
148 147
149 m_config.setFixedBars( m_fixedBars->isChecked() ); 148 m_config.setFixedBars( m_fixedBars->isChecked() );
150 149
151 return m_config; 150 return m_config;
152} 151}
153 152