author | eilers <eilers> | 2003-01-31 13:51:13 (UTC) |
---|---|---|
committer | eilers <eilers> | 2003-01-31 13:51:13 (UTC) |
commit | 6f5a127080c50eb901ac6a332ac76d9948f91bd5 (patch) (unidiff) | |
tree | 8021e7597b9bc8e527b2fddac1e03dc0959434c9 /core | |
parent | 84bd32181af3922ccba35fcaed9b404d1e4deed8 (diff) | |
download | opie-6f5a127080c50eb901ac6a332ac76d9948f91bd5.zip opie-6f5a127080c50eb901ac6a332ac76d9948f91bd5.tar.gz opie-6f5a127080c50eb901ac6a332ac76d9948f91bd5.tar.bz2 |
Removed a lot of debug output.. Therefore it should speed up..
The settings of the combo-boxes in the contacteditor are now stored globally
and individual for a contact ( I fear this will not survive any synchronizing! ).
Thanks to tille for his assistance !
I hope there isn't any new bug in the contacteditor.. It is very ugly and hard
to debug..
-rw-r--r-- | core/pim/addressbook/TODO | 14 | ||||
-rw-r--r-- | core/pim/addressbook/abtable.cpp | 40 | ||||
-rw-r--r-- | core/pim/addressbook/abview.cpp | 48 | ||||
-rw-r--r-- | core/pim/addressbook/contacteditor.cpp | 67 | ||||
-rw-r--r-- | core/pim/addressbook/contacteditor.h | 5 | ||||
-rw-r--r-- | core/pim/addressbook/ocontactfields.cpp | 95 | ||||
-rw-r--r-- | core/pim/addressbook/ocontactfields.h | 34 | ||||
-rw-r--r-- | core/pim/addressbook/version.h | 4 |
8 files changed, 243 insertions, 64 deletions
diff --git a/core/pim/addressbook/TODO b/core/pim/addressbook/TODO index 76247c1..c600d20 100644 --- a/core/pim/addressbook/TODO +++ b/core/pim/addressbook/TODO | |||
@@ -12,4 +12,4 @@ Feature requests: | |||
12 | - Birthday & Anniversary Reminder | 12 | - Birthday & Anniversary Reminder |
13 | - Plugin for Today for Birthdays and Anniversaries | ||
14 | - Beaming of multiple contacts (current list/ by search or by category) | 13 | - Beaming of multiple contacts (current list/ by search or by category) |
14 | - Configure the letter-picker: lastname/fullname search | ||
15 | 15 | ||
@@ -17,3 +17,4 @@ Known Bugs: | |||
17 | ----------- | 17 | ----------- |
18 | 18 | - Email-button: A lot of problems.. :( | |
19 | - Default Email-Button: Sometimes not hiding the textfields completely | ||
19 | 20 | ||
@@ -31,3 +32,2 @@ ContactEditor: | |||
31 | - Redesign of Contacteditor | 32 | - Redesign of Contacteditor |
32 | - Store last settings of combo-boxes | ||
33 | - Category is on the wrong position after changing to personal and back to normal | 33 | - Category is on the wrong position after changing to personal and back to normal |
@@ -42,3 +42,2 @@ Important: | |||
42 | this entry ! | 42 | this entry ! |
43 | - Implement a picker/combo for the default email. | ||
44 | - After search (Started with Return): KeyFocus should be on Tabelle | 43 | - After search (Started with Return): KeyFocus should be on Tabelle |
@@ -50,3 +49,2 @@ Less important: | |||
50 | - Reload if contacts were changed externally | 49 | - Reload if contacts were changed externally |
51 | - Overview window cleanup needed.. | ||
52 | - The picker (alphabetical sort widget) should be | 50 | - The picker (alphabetical sort widget) should be |
@@ -59,3 +57,3 @@ Should be Fixed (not absolute sure, need further validation): | |||
59 | 57 | ||
60 | Fixed: | 58 | Fixed/Ready: |
61 | ------- | 59 | ------- |
@@ -112 +110,5 @@ Fixed: | |||
112 | 3. Kategorie-Picker geht nicht. | 110 | 3. Kategorie-Picker geht nicht. |
111 | - Plugin for Today for Birthdays and Anniversaries | ||
112 | - Implement a picker/combo for the default email. | ||
113 | - Overview window cleanup needed.. | ||
114 | - Store last settings of combo-boxes | ||
diff --git a/core/pim/addressbook/abtable.cpp b/core/pim/addressbook/abtable.cpp index 00335ae..aec390d 100644 --- a/core/pim/addressbook/abtable.cpp +++ b/core/pim/addressbook/abtable.cpp | |||
@@ -128,3 +128,3 @@ AbTable::AbTable( const QValueList<int> order, QWidget *parent, const char *name | |||
128 | { | 128 | { |
129 | qWarning("C'tor start"); | 129 | //qWarning("C'tor start"); |
130 | 130 | ||
@@ -137,3 +137,3 @@ AbTable::AbTable( const QValueList<int> order, QWidget *parent, const char *name | |||
137 | contactList.clear(); | 137 | contactList.clear(); |
138 | qWarning("C'tor end"); | 138 | //qWarning("C'tor end"); |
139 | } | 139 | } |
@@ -159,3 +159,3 @@ void AbTable::setContacts( const OContactAccess::List& viewList ) | |||
159 | { | 159 | { |
160 | qWarning("AbTable::setContacts()"); | 160 | //qWarning("AbTable::setContacts()"); |
161 | 161 | ||
@@ -185,3 +185,3 @@ bool AbTable::selectContact( int UID ) | |||
185 | { | 185 | { |
186 | qWarning( "AbTable::selectContact( %d )", UID ); | 186 | //qWarning( "AbTable::selectContact( %d )", UID ); |
187 | int rows = numRows(); | 187 | int rows = numRows(); |
@@ -215,3 +215,3 @@ void AbTable::insertIntoTable( const OContact& cnt, int row ) | |||
215 | { | 215 | { |
216 | qWarning( "void AbTable::insertIntoTable( const OContact& cnt, %d )", row ); | 216 | //qWarning( "void AbTable::insertIntoTable( const OContact& cnt, %d )", row ); |
217 | QString strName, | 217 | QString strName, |
@@ -256,3 +256,3 @@ void AbTable::resort() | |||
256 | { | 256 | { |
257 | qWarning( "void AbTable::resort()" ); | 257 | //qWarning( "void AbTable::resort()" ); |
258 | setPaintingEnabled( FALSE ); | 258 | setPaintingEnabled( FALSE ); |
@@ -270,3 +270,3 @@ OContact AbTable::currentEntry() | |||
270 | { | 270 | { |
271 | qWarning( "OContact AbTable::currentEntry()" ); | 271 | //qWarning( "OContact AbTable::currentEntry()" ); |
272 | OContact cnt; | 272 | OContact cnt; |
@@ -288,3 +288,3 @@ void AbTable::clear() | |||
288 | { | 288 | { |
289 | qWarning( "void AbTable::clear()" ); | 289 | //qWarning( "void AbTable::clear()" ); |
290 | contactList.clear(); | 290 | contactList.clear(); |
@@ -306,3 +306,3 @@ void AbTable::refresh() | |||
306 | { | 306 | { |
307 | qWarning( "void AbTable::refresh()" ); | 307 | //qWarning( "void AbTable::refresh()" ); |
308 | int rows = numRows(); | 308 | int rows = numRows(); |
@@ -328,3 +328,3 @@ void AbTable::keyPressEvent( QKeyEvent *e ) | |||
328 | 328 | ||
329 | qWarning("Received key .."); | 329 | //qWarning("Received key .."); |
330 | switch( e->key() ) { | 330 | switch( e->key() ) { |
@@ -413,3 +413,3 @@ void AbTable::realignTable() | |||
413 | { | 413 | { |
414 | qWarning( "void AbTable::realignTable()" ); | 414 | //qWarning( "void AbTable::realignTable()" ); |
415 | 415 | ||
@@ -463,3 +463,3 @@ void AbTable::fitColumns() | |||
463 | { | 463 | { |
464 | qWarning( "void AbTable::fitColumns()" ); | 464 | //qWarning( "void AbTable::fitColumns()" ); |
465 | int contentsWidth = visibleWidth() / 2; // :SX Why too low | 465 | int contentsWidth = visibleWidth() / 2; // :SX Why too low |
@@ -475,3 +475,3 @@ void AbTable::fitColumns() | |||
475 | 475 | ||
476 | qWarning("Width: %d", contentsWidth); | 476 | //qWarning("Width: %d", contentsWidth); |
477 | 477 | ||
@@ -487,3 +487,3 @@ void AbTable::show() | |||
487 | { | 487 | { |
488 | qWarning( "void AbTable::show()" ); | 488 | //qWarning( "void AbTable::show()" ); |
489 | realignTable(); | 489 | realignTable(); |
@@ -509,3 +509,3 @@ void AbTable::itemClicked(int,int col) | |||
509 | { | 509 | { |
510 | qWarning( "AbTable::itemClicked(int, col:%d)", col); | 510 | //qWarning( "AbTable::itemClicked(int, col:%d)", col); |
511 | if ( col == 2 ) { | 511 | if ( col == 2 ) { |
@@ -513,3 +513,3 @@ void AbTable::itemClicked(int,int col) | |||
513 | } else { | 513 | } else { |
514 | qWarning ("Emitting signalSwitch()"); | 514 | // qWarning ("Emitting signalSwitch()"); |
515 | emit signalSwitch(); | 515 | emit signalSwitch(); |
@@ -550,3 +550,3 @@ void AbTable::updateVisible() | |||
550 | { | 550 | { |
551 | qWarning("void AbTable::updateVisible()"); | 551 | //qWarning("void AbTable::updateVisible()"); |
552 | 552 | ||
@@ -588,3 +588,3 @@ void AbTable::setPaintingEnabled( bool e ) | |||
588 | { | 588 | { |
589 | qWarning("IN void AbTable::setPaintingEnabled( %d )->Nested: %d", e, countNested ); | 589 | //qWarning("IN void AbTable::setPaintingEnabled( %d )->Nested: %d", e, countNested ); |
590 | 590 | ||
@@ -604,3 +604,3 @@ void AbTable::setPaintingEnabled( bool e ) | |||
604 | } | 604 | } |
605 | qWarning("OUT void AbTable::setPaintingEnabled( %d )->Nested: %d", e, countNested ); | 605 | //qWarning("OUT void AbTable::setPaintingEnabled( %d )->Nested: %d", e, countNested ); |
606 | } | 606 | } |
@@ -608,3 +608,3 @@ void AbTable::setPaintingEnabled( bool e ) | |||
608 | void AbTable::viewportPaintEvent( QPaintEvent* e ) { | 608 | void AbTable::viewportPaintEvent( QPaintEvent* e ) { |
609 | qWarning(" void AbTable::viewportPaintEvent( QPaintEvent* e ) -> %d", enablePainting); | 609 | //qWarning(" void AbTable::viewportPaintEvent( QPaintEvent* e ) -> %d", enablePainting); |
610 | if ( enablePainting ) | 610 | if ( enablePainting ) |
diff --git a/core/pim/addressbook/abview.cpp b/core/pim/addressbook/abview.cpp index 93e57ca..7da0992 100644 --- a/core/pim/addressbook/abview.cpp +++ b/core/pim/addressbook/abview.cpp | |||
@@ -97,3 +97,3 @@ void AbView::setView( Views view ) | |||
97 | { | 97 | { |
98 | qWarning("AbView::setView( Views view )"); | 98 | //qWarning("AbView::setView( Views view )"); |
99 | m_curr_View = view; | 99 | m_curr_View = view; |
@@ -104,3 +104,3 @@ void AbView::addEntry( const OContact &newContact ) | |||
104 | { | 104 | { |
105 | qWarning("abview:AddContact"); | 105 | //qWarning("abview:AddContact"); |
106 | m_contactdb->add ( newContact ); | 106 | m_contactdb->add ( newContact ); |
@@ -111,3 +111,3 @@ void AbView::removeEntry( const int UID ) | |||
111 | { | 111 | { |
112 | qWarning("abview:RemoveContact"); | 112 | //qWarning("abview:RemoveContact"); |
113 | m_contactdb->remove( UID ); | 113 | m_contactdb->remove( UID ); |
@@ -118,3 +118,3 @@ void AbView::replaceEntry( const OContact &contact ) | |||
118 | { | 118 | { |
119 | qWarning("abview:ReplaceContact"); | 119 | //qWarning("abview:ReplaceContact"); |
120 | m_contactdb->replace( contact ); | 120 | m_contactdb->replace( contact ); |
@@ -142,3 +142,3 @@ bool AbView::save() | |||
142 | { | 142 | { |
143 | qWarning("abView:Save data"); | 143 | //qWarning("abView:Save data"); |
144 | 144 | ||
@@ -149,3 +149,3 @@ void AbView::load() | |||
149 | { | 149 | { |
150 | qWarning("abView:Load data"); | 150 | //qWarning("abView:Load data"); |
151 | 151 | ||
@@ -162,3 +162,3 @@ void AbView::load() | |||
162 | 162 | ||
163 | qWarning ("Number of contacts: %d", m_list.count()); | 163 | //qWarning ("Number of contacts: %d", m_list.count()); |
164 | 164 | ||
@@ -170,3 +170,3 @@ void AbView::reload() | |||
170 | { | 170 | { |
171 | qWarning( "void AbView::reload()" ); | 171 | //qWarning( "void AbView::reload()" ); |
172 | 172 | ||
@@ -183,3 +183,3 @@ void AbView::setShowByCategory( const QString& cat ) | |||
183 | { | 183 | { |
184 | qWarning("AbView::setShowCategory( const QString& cat )"); | 184 | //qWarning("AbView::setShowCategory( const QString& cat )"); |
185 | 185 | ||
@@ -195,3 +195,3 @@ void AbView::setShowByCategory( const QString& cat ) | |||
195 | if ( intCat != m_curr_category ){ | 195 | if ( intCat != m_curr_category ){ |
196 | qWarning ("Categories: Selected %s.. Number: %d", cat.latin1(), m_curr_category); | 196 | // qWarning ("Categories: Selected %s.. Number: %d", cat.latin1(), m_curr_category); |
197 | 197 | ||
@@ -207,5 +207,5 @@ void AbView::setShowToView( Views view ) | |||
207 | { | 207 | { |
208 | qWarning("void AbView::setShowToView( View %d )", view); | 208 | //qWarning("void AbView::setShowToView( View %d )", view); |
209 | 209 | ||
210 | qWarning ("Change the View (Category is: %d)", m_curr_category); | 210 | //qWarning ("Change the View (Category is: %d)", m_curr_category); |
211 | 211 | ||
@@ -222,3 +222,3 @@ void AbView::setShowByLetter( char c ) | |||
222 | { | 222 | { |
223 | qWarning("void AbView::setShowByLetter( %c )", c ); | 223 | //qWarning("void AbView::setShowByLetter( %c )", c ); |
224 | OContact query; | 224 | OContact query; |
@@ -256,3 +256,3 @@ void AbView::showPersonal( bool personal ) | |||
256 | { | 256 | { |
257 | qWarning ("void AbView::showPersonal( %d )", personal); | 257 | //qWarning ("void AbView::showPersonal( %d )", personal); |
258 | 258 | ||
@@ -305,3 +305,3 @@ void AbView::slotDoFind( const QString &str, bool caseSensitive, bool useRegExp, | |||
305 | { | 305 | { |
306 | qWarning( "void AbView::slotDoFind" ); | 306 | //qWarning( "void AbView::slotDoFind" ); |
307 | 307 | ||
@@ -319,3 +319,3 @@ void AbView::slotDoFind( const QString &str, bool caseSensitive, bool useRegExp, | |||
319 | 319 | ||
320 | qWarning ("Find in Category %d", category); | 320 | //qWarning ("Find in Category %d", category); |
321 | 321 | ||
@@ -328,3 +328,3 @@ void AbView::slotDoFind( const QString &str, bool caseSensitive, bool useRegExp, | |||
328 | 328 | ||
329 | qWarning( "found: %d", m_list.count() ); | 329 | //qWarning( "found: %d", m_list.count() ); |
330 | if ( m_list.count() == 0 ){ | 330 | if ( m_list.count() == 0 ){ |
@@ -351,3 +351,3 @@ void AbView::offSearch() | |||
351 | void AbView::slotSwitch(){ | 351 | void AbView::slotSwitch(){ |
352 | qWarning("AbView::slotSwitch()"); | 352 | //qWarning("AbView::slotSwitch()"); |
353 | 353 | ||
@@ -379,3 +379,3 @@ void AbView::clearForCategory() | |||
379 | if ( !contactCompare( *it, m_curr_category ) ){ | 379 | if ( !contactCompare( *it, m_curr_category ) ){ |
380 | qWarning("Removing %d", (*it).uid()); | 380 | // qWarning("Removing %d", (*it).uid()); |
381 | m_list.remove( (*it).uid() ); | 381 | m_list.remove( (*it).uid() ); |
@@ -389,3 +389,3 @@ bool AbView::contactCompare( const OContact &cnt, int category ) | |||
389 | { | 389 | { |
390 | qWarning ("bool AbView::contactCompare( const OContact &cnt, %d )", category); | 390 | //qWarning ("bool AbView::contactCompare( const OContact &cnt, %d )", category); |
391 | 391 | ||
@@ -395,3 +395,3 @@ bool AbView::contactCompare( const OContact &cnt, int category ) | |||
395 | 395 | ||
396 | qWarning ("Number of categories: %d", cats.count() ); | 396 | //qWarning ("Number of categories: %d", cats.count() ); |
397 | 397 | ||
@@ -404,3 +404,3 @@ bool AbView::contactCompare( const OContact &cnt, int category ) | |||
404 | for ( i = 0; i < int(cats.count()); i++ ) { | 404 | for ( i = 0; i < int(cats.count()); i++ ) { |
405 | qWarning("Comparing %d with %d",cats[i],category ); | 405 | // qWarning("Comparing %d with %d",cats[i],category ); |
406 | if ( cats[i] == category ) { | 406 | if ( cats[i] == category ) { |
@@ -411,3 +411,3 @@ bool AbView::contactCompare( const OContact &cnt, int category ) | |||
411 | } | 411 | } |
412 | qWarning ("Return: %d", returnMe); | 412 | //qWarning ("Return: %d", returnMe); |
413 | return returnMe; | 413 | return returnMe; |
@@ -424,3 +424,3 @@ void AbView::updateView( bool newdata ) | |||
424 | { | 424 | { |
425 | qWarning("AbView::updateView()"); | 425 | //qWarning("AbView::updateView()"); |
426 | 426 | ||
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp index d14ac51..d830ad3 100644 --- a/core/pim/addressbook/contacteditor.cpp +++ b/core/pim/addressbook/contacteditor.cpp | |||
@@ -69,10 +69,16 @@ ContactEditor::ContactEditor( const OContact &entry, | |||
69 | : QDialog( parent, name, TRUE, fl ), | 69 | : QDialog( parent, name, TRUE, fl ), |
70 | m_personalView ( false ) | 70 | defaultEmailChooserPosition( -1 ), |
71 | 71 | m_personalView ( false ), | |
72 | cmbDefaultEmail( 0 ), | ||
73 | initializing ( false ) | ||
72 | { | 74 | { |
73 | 75 | ||
76 | initializing = true; | ||
77 | |||
74 | init(); | 78 | init(); |
75 | setEntry( entry ); | 79 | setEntry( entry ); |
76 | cmbDefaultEmail = 0; | 80 | // cmbDefaultEmail = 0; |
77 | defaultEmailChooserPosition = -1; | 81 | // defaultEmailChooserPosition = -1; |
82 | |||
83 | initializing = false; | ||
78 | } | 84 | } |
@@ -83,2 +89,3 @@ ContactEditor::~ContactEditor() { | |||
83 | void ContactEditor::init() { | 89 | void ContactEditor::init() { |
90 | qWarning("init() START"); | ||
84 | 91 | ||
@@ -644,2 +651,4 @@ void ContactEditor::init() { | |||
644 | setPersonalView ( m_personalView ); | 651 | setPersonalView ( m_personalView ); |
652 | |||
653 | qWarning("init() END"); | ||
645 | } | 654 | } |
@@ -694,3 +703,6 @@ bool ContactEditor::cmbChooserChange( int index, QLineEdit *inputWid, int widget | |||
694 | QString type = slChooserNames[index]; | 703 | QString type = slChooserNames[index]; |
695 | qWarning("ContactEditor::cmbChooserChange -> Type: %s", type.latin1() ); | 704 | qWarning("ContactEditor::cmbChooserChange -> Type: %s, WidgetPos: %d", type.latin1(), widgetPos ); |
705 | |||
706 | if ( !initializing ) | ||
707 | contactfields.setFieldOrder( widgetPos-1, index ); | ||
696 | 708 | ||
@@ -698,3 +710,3 @@ bool ContactEditor::cmbChooserChange( int index, QLineEdit *inputWid, int widget | |||
698 | if ( type == "Default Email"){ | 710 | if ( type == "Default Email"){ |
699 | qWarning("Choosing default-email "); | 711 | qWarning("Choosing default-email (defaultEmailChooserPosition= %d) ", defaultEmailChooserPosition); |
700 | 712 | ||
@@ -702,3 +714,3 @@ bool ContactEditor::cmbChooserChange( int index, QLineEdit *inputWid, int widget | |||
702 | if ( ( defaultEmailChooserPosition != -1 ) && | 714 | if ( ( defaultEmailChooserPosition != -1 ) && |
703 | defaultEmailChooserPosition != widgetPos ){ | 715 | defaultEmailChooserPosition != widgetPos && !initializing){ |
704 | chooserError( widgetPos ); | 716 | chooserError( widgetPos ); |
@@ -712,3 +724,9 @@ bool ContactEditor::cmbChooserChange( int index, QLineEdit *inputWid, int widget | |||
712 | cmbDefaultEmail = new QComboBox(inputWid->parentWidget()); | 724 | cmbDefaultEmail = new QComboBox(inputWid->parentWidget()); |
713 | cmbDefaultEmail->setGeometry(inputWid->frameGeometry()); | 725 | cmbDefaultEmail->setGeometry(inputWid->frameGeometry()); /* :SX */ |
726 | |||
727 | QRect rect = inputWid->frameGeometry(); | ||
728 | qWarning("Geometrie: X=%d, Y=%d, Left=%d, Top=%d, Right=%d, Bottom=%d", | ||
729 | rect.x(), rect.y(), rect.left(), rect.top(), rect.right(), rect.bottom()); | ||
730 | QPoint pnt = inputWid->pos(); | ||
731 | qWarning("Position : X=%d, Y=%d", pnt.x(), pnt.y() ); | ||
714 | 732 | ||
@@ -946,2 +964,7 @@ void ContactEditor::slotAddressTypeChange( int index ) { | |||
946 | 964 | ||
965 | |||
966 | if ( !initializing ) | ||
967 | contactfields.setFieldOrder( 4, index ); | ||
968 | |||
969 | |||
947 | if ( index == 0 ) { | 970 | if ( index == 0 ) { |
@@ -1278,2 +1301,4 @@ void ContactEditor::setEntry( const OContact &entry ) { | |||
1278 | 1301 | ||
1302 | initializing = true; | ||
1303 | |||
1279 | cleanupFields(); | 1304 | cleanupFields(); |
@@ -1282,4 +1307,2 @@ void ContactEditor::setEntry( const OContact &entry ) { | |||
1282 | 1307 | ||
1283 | |||
1284 | |||
1285 | emails = QStringList(ent.emailList()); | 1308 | emails = QStringList(ent.emailList()); |
@@ -1457,2 +1480,19 @@ void ContactEditor::setEntry( const OContact &entry ) { | |||
1457 | 1480 | ||
1481 | slotAddressTypeChange( cmbAddress->currentItem() ); | ||
1482 | |||
1483 | // Calling "show()" to arrange all widgets. Otherwise we will get | ||
1484 | // a wrong position of the textfields and are unable to put our | ||
1485 | // default-email combo over it.. This is very ugly ! | ||
1486 | // Does anybody has a better solution ? | ||
1487 | // Basically we should rethink the strategy to hide | ||
1488 | // a textfield with overwriting.. (se) | ||
1489 | show(); | ||
1490 | |||
1491 | // Get combo-settings from contact and set preset.. | ||
1492 | contactfields.loadFromRecord( ent ); | ||
1493 | cmbChooserField1->setCurrentItem( contactfields.getFieldOrder(0, 0) ); | ||
1494 | cmbChooserField2->setCurrentItem( contactfields.getFieldOrder(1, 1) ); | ||
1495 | cmbChooserField3->setCurrentItem( contactfields.getFieldOrder(2, 2) ); | ||
1496 | cmbChooserField4->setCurrentItem( contactfields.getFieldOrder(3, 5) ); | ||
1497 | cmbAddress->setCurrentItem( contactfields.getFieldOrder(4, 1) ); | ||
1458 | slotCmbChooser1Change( cmbChooserField1->currentItem() ); | 1498 | slotCmbChooser1Change( cmbChooserField1->currentItem() ); |
@@ -1460,7 +1500,8 @@ void ContactEditor::setEntry( const OContact &entry ) { | |||
1460 | slotCmbChooser3Change( cmbChooserField3->currentItem() ); | 1500 | slotCmbChooser3Change( cmbChooserField3->currentItem() ); |
1461 | 1501 | slotCmbChooser4Change( cmbChooserField4->currentItem() ); | |
1462 | slotAddressTypeChange( cmbAddress->currentItem() ); | 1502 | slotAddressTypeChange( cmbAddress->currentItem() ); |
1463 | 1503 | ||
1464 | // loadFields(); :SX | ||
1465 | updateDatePicker(); | 1504 | updateDatePicker(); |
1505 | |||
1506 | initializing = false; | ||
1466 | } | 1507 | } |
@@ -1485,2 +1526,4 @@ void ContactEditor::saveEntry() { | |||
1485 | 1526 | ||
1527 | // Store current combo into contact | ||
1528 | contactfields.saveToRecord( ent ); | ||
1486 | 1529 | ||
diff --git a/core/pim/addressbook/contacteditor.h b/core/pim/addressbook/contacteditor.h index 4fa48d1..95f9f2d 100644 --- a/core/pim/addressbook/contacteditor.h +++ b/core/pim/addressbook/contacteditor.h | |||
@@ -32,2 +32,4 @@ | |||
32 | 32 | ||
33 | #include "ocontactfields.h" | ||
34 | |||
33 | const int NAME_LF = 0; | 35 | const int NAME_LF = 0; |
@@ -110,2 +112,3 @@ class ContactEditor : public QDialog { | |||
110 | bool cmbChooserChange( int , QLineEdit*, int ); | 112 | bool cmbChooserChange( int , QLineEdit*, int ); |
113 | OContactFields contactfields; | ||
111 | 114 | ||
@@ -178,2 +181,4 @@ class ContactEditor : public QDialog { | |||
178 | QToolButton* anniversaryButton; | 181 | QToolButton* anniversaryButton; |
182 | |||
183 | bool initializing; | ||
179 | }; | 184 | }; |
diff --git a/core/pim/addressbook/ocontactfields.cpp b/core/pim/addressbook/ocontactfields.cpp index 0da6a4f..75a7641 100644 --- a/core/pim/addressbook/ocontactfields.cpp +++ b/core/pim/addressbook/ocontactfields.cpp | |||
@@ -8,2 +8,4 @@ | |||
8 | #include <qpe/recordfields.h> | 8 | #include <qpe/recordfields.h> |
9 | #include <qpe/config.h> | ||
10 | #include <opie/ocontact.h> | ||
9 | 11 | ||
@@ -274 +276,94 @@ QMap<QString, int> OContactFields::trFieldsToId() | |||
274 | } | 276 | } |
277 | |||
278 | OContactFields::OContactFields(): | ||
279 | fieldOrder( DEFAULT_FIELD_ORDER ), | ||
280 | changedFieldOrder( false ) | ||
281 | { | ||
282 | // Get the global field order from the config file and | ||
283 | // use it as a start pattern | ||
284 | Config cfg ( "AddressBook" ); | ||
285 | cfg.setGroup( "ContactFieldOrder" ); | ||
286 | globalFieldOrder = cfg.readEntry( "General", DEFAULT_FIELD_ORDER ); | ||
287 | } | ||
288 | |||
289 | OContactFields::~OContactFields(){ | ||
290 | |||
291 | // We will store the fieldorder into the config file | ||
292 | // to reuse it for the future.. | ||
293 | if ( changedFieldOrder ){ | ||
294 | Config cfg ( "AddressBook" ); | ||
295 | cfg.setGroup( "ContactFieldOrder" ); | ||
296 | cfg.writeEntry( "General", globalFieldOrder ); | ||
297 | } | ||
298 | } | ||
299 | |||
300 | |||
301 | |||
302 | void OContactFields::saveToRecord( OContact &cnt ){ | ||
303 | |||
304 | qDebug("ocontactfields saveToRecord: >%s<",fieldOrder.latin1()); | ||
305 | |||
306 | // Store fieldorder into this contact. | ||
307 | cnt.setCustomField( CONTACT_FIELD_ORDER_NAME, fieldOrder ); | ||
308 | |||
309 | globalFieldOrder = fieldOrder; | ||
310 | changedFieldOrder = true; | ||
311 | |||
312 | } | ||
313 | |||
314 | void OContactFields::loadFromRecord( const OContact &cnt ){ | ||
315 | qDebug("ocontactfields loadFromRecord"); | ||
316 | qDebug("loading >%s<",cnt.fullName().latin1()); | ||
317 | |||
318 | // Get fieldorder for this contact. If none is defined, | ||
319 | // we will use the global one from the config file.. | ||
320 | |||
321 | fieldOrder = cnt.customField( CONTACT_FIELD_ORDER_NAME ); | ||
322 | |||
323 | qDebug("fieldOrder from contact>%s<",fieldOrder.latin1()); | ||
324 | |||
325 | if (fieldOrder.isEmpty()){ | ||
326 | fieldOrder = globalFieldOrder; | ||
327 | } | ||
328 | |||
329 | |||
330 | qDebug("effective fieldOrder in loadFromRecord >%s<",fieldOrder.latin1()); | ||
331 | } | ||
332 | |||
333 | void OContactFields::setFieldOrder( int num, int index ){ | ||
334 | qDebug("qcontactfields setfieldorder pos %i -> %i",num,index); | ||
335 | |||
336 | fieldOrder[num] = QString::number( index )[0]; | ||
337 | |||
338 | // We will store this new fieldorder globally to | ||
339 | // remember it for contacts which have none | ||
340 | globalFieldOrder = fieldOrder; | ||
341 | changedFieldOrder = true; | ||
342 | |||
343 | qDebug("fieldOrder >%s<",fieldOrder.latin1()); | ||
344 | } | ||
345 | |||
346 | int OContactFields::getFieldOrder( int num, int defIndex ){ | ||
347 | qDebug("ocontactfields getFieldOrder"); | ||
348 | qDebug("fieldOrder >%s<",fieldOrder.latin1()); | ||
349 | |||
350 | // Get index of combo as char.. | ||
351 | QChar poschar = fieldOrder[num]; | ||
352 | |||
353 | bool ok; | ||
354 | int ret = 0; | ||
355 | // Convert char to number.. | ||
356 | if ( !( poschar == QChar::null ) ) | ||
357 | ret = QString( poschar ).toInt(&ok, 10); | ||
358 | else | ||
359 | ok = false; | ||
360 | |||
361 | // Return default value if index for | ||
362 | // num was not set or if anything else happened.. | ||
363 | if ( !ok ) ret = defIndex; | ||
364 | |||
365 | qDebug("returning >%i<",ret); | ||
366 | |||
367 | return ret; | ||
368 | |||
369 | } | ||
diff --git a/core/pim/addressbook/ocontactfields.h b/core/pim/addressbook/ocontactfields.h index 796bc0a..bf3a7f5 100644 --- a/core/pim/addressbook/ocontactfields.h +++ b/core/pim/addressbook/ocontactfields.h | |||
@@ -7,2 +7,6 @@ class QStringList; | |||
7 | #include <qstring.h> | 7 | #include <qstring.h> |
8 | #include <opie/ocontact.h> | ||
9 | |||
10 | #define CONTACT_FIELD_ORDER_NAME "opie-contactfield-order" | ||
11 | #define DEFAULT_FIELD_ORDER "__________" | ||
8 | 12 | ||
@@ -11,2 +15,32 @@ class OContactFields{ | |||
11 | public: | 15 | public: |
16 | OContactFields(); | ||
17 | ~OContactFields(); | ||
18 | /** Set the index for combo boxes. | ||
19 | * Sets the <b>index</b> of combo <b>num</b>. | ||
20 | * @param num selects the number of the combo | ||
21 | * @param index sets the index in the combo | ||
22 | */ | ||
23 | void setFieldOrder( int num, int index ); | ||
24 | |||
25 | /** Get the index for combo boxes. | ||
26 | * Returns the index of combo <b>num</b> or defindex | ||
27 | * if none was defined.. | ||
28 | * @param num Selects the number of the combo | ||
29 | * @param defIndex will be returned if none was defined (either | ||
30 | * globally in the config file, nor by the contact which was used | ||
31 | * by loadFromRecord() ) | ||
32 | */ | ||
33 | int getFieldOrder( int num, int defIndex); | ||
34 | |||
35 | /** Store fieldorder to contact. */ | ||
36 | void saveToRecord( OContact& ); | ||
37 | /** Get Fieldorder from contact. */ | ||
38 | void loadFromRecord( const OContact& ); | ||
39 | |||
40 | private: | ||
41 | QString fieldOrder; | ||
42 | QString globalFieldOrder; | ||
43 | bool changedFieldOrder; | ||
44 | |||
45 | public: | ||
12 | static QStringList trphonefields( bool sorted = true ); | 46 | static QStringList trphonefields( bool sorted = true ); |
diff --git a/core/pim/addressbook/version.h b/core/pim/addressbook/version.h index b740326..e716fe4 100644 --- a/core/pim/addressbook/version.h +++ b/core/pim/addressbook/version.h | |||
@@ -4,4 +4,4 @@ | |||
4 | #define MAINVERSION "0" | 4 | #define MAINVERSION "0" |
5 | #define SUBVERSION "1" | 5 | #define SUBVERSION "2" |
6 | #define PATCHVERSION "1" | 6 | #define PATCHVERSION "0" |
7 | 7 | ||