summaryrefslogtreecommitdiff
authoreilers <eilers>2002-11-30 18:13:34 (UTC)
committer eilers <eilers>2002-11-30 18:13:34 (UTC)
commit6afb59b5950c8fdd24dc93ac4ee370a3c8437f9a (patch) (unidiff)
treea873946a9b52edaab8f374918c7e0b468c2353b3
parentfe672fd88ead7a987d66f03439eb860e67aeaca6 (diff)
downloadopie-6afb59b5950c8fdd24dc93ac4ee370a3c8437f9a.zip
opie-6afb59b5950c8fdd24dc93ac4ee370a3c8437f9a.tar.gz
opie-6afb59b5950c8fdd24dc93ac4ee370a3c8437f9a.tar.bz2
Fixed a lot of usability stuff .. Some minor bugs were fixed, too ..
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/TODO35
-rw-r--r--core/pim/addressbook/ablabel.cpp7
-rw-r--r--core/pim/addressbook/abview.cpp55
-rw-r--r--core/pim/addressbook/abview.h2
-rw-r--r--core/pim/addressbook/addressbook.cpp2
-rw-r--r--core/pim/addressbook/configdlg_base.ui10
-rw-r--r--core/pim/addressbook/ocontactfields.cpp4
7 files changed, 68 insertions, 47 deletions
diff --git a/core/pim/addressbook/TODO b/core/pim/addressbook/TODO
index 1cbee26..93ece13 100644
--- a/core/pim/addressbook/TODO
+++ b/core/pim/addressbook/TODO
@@ -1,106 +1,109 @@
1Stuff todo until OPIE 1.0 : 1Stuff todo until OPIE 1.0 :
2=========================== 2===========================
3 3
4Feature requests: 4Feature requests:
5----------------- 5-----------------
6- Dial by mobile phone by tapping the number.. 6- Dial by mobile phone by tapping the number..
7 (Maybe using gsmtool. And we may 7 (Maybe using gsmtool. And we may
8 add a library class for this) 8 add a library class for this)
9- dial with dtmfdial incase it's installed and there's no mobile 9- dial with dtmfdial incase it's installed and there's no mobile
10- 3rd column for 2. Contact 10- 3rd column for 2. Contact
11- Implementing additional Views (Phonebook, ...) 11- Implementing additional Views (Phonebook, ...)
12- Birthday & Anniversary Reminder 12- Birthday & Anniversary Reminder
13- Plugin for Today for Birthdays and Anniversaries 13- Plugin for Today for Birthdays and Anniversaries
14 14
15Known Bugs: 15Known Bugs:
16----------- 16-----------
17- OK-Key does not switch from Detailview (ablable) to Listview 17- OK-Key does not switch from Detailview (ablable) to Listview
18- After finising search and after Edit: Clear Picker
19- After Edit: Table position back to edited entry.
20- Combo in Contacteditor: Field "Default-Email" is not correctly implemented and
21 should be removed by a picker/combo.
22- Name order selected in "contacteditor" not used in list view. 18- Name order selected in "contacteditor" not used in list view.
19
23- Language not English (tested with german opie-translation): 20- Language not English (tested with german opie-translation):
24 1. Configure nicht übersetzt (alles leer). 21 1. Configure nicht übersetzt (alles leer).
25 2. Contacteditor nur teilweise übersetzt. 22 2. Contacteditor nur teilweise übersetzt.
26 3. Kategorie-Picker geht nicht (nur bei Openzaurus). 23 3. Kategorie-Picker geht nicht.
27 24
28 25
29Bugs but not in addressbook: 26Bugs but not in addressbook:
30----------------------------- 27-----------------------------
31- VCARD: Import of Anniversary does not work correctly (currently disabled) 28- VCARD: Import of Anniversary does not work correctly (currently disabled)
32- VCARD: If umlaut (äöüß) in address, the parser gets confused.. 29- VCARD: If umlaut (äöüß) in address, the parser gets confused..
33- Exporting and reimporting of Jobtitle fails. 30
31- Exporting and reimporting of Jobtitle fails (Could not reproduce this ! (se))
34 32
35 33
36Urgent: 34Urgent:
37-------- 35--------
38- Contact-Editor is temporarely reanabled. Wait for replacement. 36- Implement Button Pics
37- Fix start of opie-mail
38
39ContactEditor:
40- Contact-Editor is temporarely reenabled. Wait for replacement.
39- Redesign of Contacteditor 41- Redesign of Contacteditor
40- Store last settings of combo-boxes 42- Store last settings of combo-boxes
41- Category is on the wrong position after changing to personal and back to normal 43- Category is on the wrong position after changing to personal and back to normal
42 ( Temporarily workaround: Category is never deactivated.. :S ) 44 ( Temporarily workaround: Category is never deactivated.. :S )
43- Optimize Table Update... 45- Personal and Business Web-page is not editable
44- Change MyDialog to Config
45- Implement Button Pics
46- Fix start of opie-mail
47 46
48Important: 47Important:
49---------- 48----------
50 49
50- Implement a picker/combo for the default email.
51- After search (Started with Return): KeyFocus should be on Tabelle 51- After search (Started with Return): KeyFocus should be on Tabelle
52- Searchwidget closed: Selected user is jumping
53- Wenn suchen beendet, dann dauert das Tabellenupdate (was überhaupt überflüssig ist)
54 zu lange..
55
56- Store position and state of toolbar
57 52
58- IRDA Receive: Contact is added, but start of editor with new entry expected.. 53- IRDA Receive: Contact is added, but start of editor with new entry expected..
59- "What's this" should be added (Deleyed after Feature Freeze) 54- "What's this" should be added (Deleyed after Feature Freeze)
60 55
61Less important: 56Less important:
62--------------- 57---------------
63- Reload if contacts were changed externally 58- Reload if contacts were changed externally
64- Overview window cleanup needed.. 59- Overview window cleanup needed..
65- The picker (alphabetical sort widget) should be 60- The picker (alphabetical sort widget) should be
66 placed verticaly or horizontally (configurable) 61 placed verticaly or horizontally (configurable)
67- Find a smart solution for activating/deactivating the "send email" event 62- Find a smart solution for activating/deactivating the "send email" event
68 63
69Should be Fixed (not absolute sure, need further validation): 64Should be Fixed (not absolute sure, need further validation):
70------------------------------------------------------------- 65-------------------------------------------------------------
66- Searchwidget closed: Selected user is jumping
67- Wenn suchen beendet, dann dauert das Tabellenupdate (was überhaupt überflüssig ist)
68 zu lange..
71 69
72 70
73Fixed: 71Fixed:
74------- 72-------
75- Syncing: abtable not reloaded after sync. 73- Syncing: abtable not reloaded after sync.
76- Find widget should be replaced by something like 74- Find widget should be replaced by something like
77 qpdf has. 75 qpdf has.
78- Adding a configuration dialog 76- Adding a configuration dialog
79- Picker: Activated letter schould be more visible 77- Picker: Activated letter schould be more visible
80- Advanced handling of cursor keys (search..) 78- Advanced handling of cursor keys (search..)
81- Mail-Icon is missing 79- Mail-Icon is missing
82- Use opie-mail insted of qt-mail if possible. 80- Use opie-mail insted of qt-mail if possible.
83- Font menu is invisible using german translation 81- Font menu is invisible using german translation
84- Personal contact editor: Disable categories 82- Personal contact editor: Disable categories
85- "Nonenglish" translation bug has to be fixed. 83- "Nonenglish" translation bug has to be fixed.
86- contacteditor: Birthday, annyversary, ... : Use Dateselector 84- contacteditor: Birthday, annyversary, ... : Use Dateselector
87- The names of the countries are sorted by there english names, only.. 85- The names of the countries are sorted by there english names, only..
88 Even if they are translated.. :S 86 Even if they are translated.. :S
89- Cursor keys should work in detail-view (ablabel) 87- Cursor keys should work in detail-view (ablabel)
90 -> Ablabel should be removed and Abtable should be increased with 88 -> Ablabel should be removed and Abtable should be increased with
91 different views (as started by darwin zins).. 89 different views (as started by darwin zins)..
92- Use advanced database functions in abtable to decrease 90- Use advanced database functions in abtable to decrease
93 memory footprint and to make everything more easy ! 91 memory footprint and to make everything more easy !
94 (abtable should store Iterator for selected Category) 92 (abtable should store Iterator for selected Category)
95- Abtable: Configure Contact column (internally already available, 93- Abtable: Configure Contact column (internally already available,
96 need configuration) 94 need configuration)
97- Select of primary contact (see #274 on mantis) 95- Select of primary contact (see #274 on mantis)
98- Category-select does not work completely: "Unfiled" is always in listview .. 96- Category-select does not work completely: "Unfiled" is always in listview ..
99- Return from Contacteditor: Category resettet to all 97- Return from Contacteditor: Category resettet to all
100- Personal Details not working 98- Personal Details not working
101- If category changed, the letterpicker should be resetted 99- If category changed, the letterpicker should be resetted
102- There should be some icons for List and Cardview 100- There should be some icons for List and Cardview
103- If in Cardview and a category change removes all entries: 101- If in Cardview and a category change removes all entries:
104 There are already entries in Cardview after up/down 102 There are already entries in Cardview after up/down
105- Personal Details: Anniversary zeigt Fantasie-Werte 103- Personal Details: Anniversary zeigt Fantasie-Werte
106- Unfiled shown just in Category "All" and "Unfiled". 104- Unfiled shown just in Category "All" and "Unfiled".
105- After finising search and after Edit: Clear Picker
106- After Edit: Table position back to edited entry.
107- Optimize Table Update...
108- Change MyDialog to Config
109- Store position and state of toolbar
diff --git a/core/pim/addressbook/ablabel.cpp b/core/pim/addressbook/ablabel.cpp
index 5b40dc1..937aaae 100644
--- a/core/pim/addressbook/ablabel.cpp
+++ b/core/pim/addressbook/ablabel.cpp
@@ -1,116 +1,121 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qt Palmtop Environment. 4** This file is part of Qt Palmtop Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include "ablabel.h" 21#include "ablabel.h"
22 22
23#include <qpe/stringutil.h> 23#include <qpe/stringutil.h>
24 24
25#include <qregexp.h> 25#include <qregexp.h>
26#include <qstylesheet.h> 26#include <qstylesheet.h>
27 27
28AbLabel::AbLabel( QWidget *parent, const char *name ): 28AbLabel::AbLabel( QWidget *parent, const char *name ):
29 QTextView( parent, name ), 29 QTextView( parent, name ),
30 m_empty( false ) 30 m_empty( false )
31{ 31{
32} 32}
33 33
34AbLabel::~AbLabel() 34AbLabel::~AbLabel()
35{ 35{
36} 36}
37 37
38void AbLabel::setContacts( const OContactAccess::List& viewList ) 38void AbLabel::setContacts( const OContactAccess::List& viewList )
39{ 39{
40 m_viewList = viewList; 40 m_viewList = viewList;
41 if (m_viewList.count() != 0){ 41 if (m_viewList.count() != 0){
42 m_empty = false; 42 m_empty = false;
43 m_itCurContact = m_viewList.begin(); 43 m_itCurContact = m_viewList.begin();
44 sync(); 44 sync();
45 }else{ 45 }else{
46 // m_itCurContact.clear(); 46 // m_itCurContact.clear();
47 m_empty = true; 47 m_empty = true;
48 setText( "" ); 48 setText( "" );
49 } 49 }
50} 50}
51 51
52int AbLabel::currentEntry_UID() 52int AbLabel::currentEntry_UID()
53{ 53{
54 return ( (*m_itCurContact).uid() ); 54 OContact contact = *m_itCurContact;
55
56 if ( contact.isEmpty() )
57 return 0;
58 else
59 return ( contact.uid() );
55} 60}
56 61
57OContact AbLabel::currentEntry() 62OContact AbLabel::currentEntry()
58{ 63{
59 return ( *m_itCurContact ); 64 return ( *m_itCurContact );
60} 65}
61 66
62 67
63bool AbLabel::selectContact( int UID ) 68bool AbLabel::selectContact( int UID )
64{ 69{
65 70
66 for ( m_itCurContact = m_viewList.begin(); m_itCurContact != m_viewList.end(); ++m_itCurContact){ 71 for ( m_itCurContact = m_viewList.begin(); m_itCurContact != m_viewList.end(); ++m_itCurContact){
67 if ( (*m_itCurContact).uid() == UID ) 72 if ( (*m_itCurContact).uid() == UID )
68 break; 73 break;
69 } 74 }
70 sync(); 75 sync();
71 76
72 return true; 77 return true;
73} 78}
74 79
75 80
76 81
77void AbLabel::sync() 82void AbLabel::sync()
78{ 83{
79 QString text = (*m_itCurContact).toRichText(); 84 QString text = (*m_itCurContact).toRichText();
80 setText( text ); 85 setText( text );
81} 86}
82 87
83void AbLabel::keyPressEvent( QKeyEvent *e ) 88void AbLabel::keyPressEvent( QKeyEvent *e )
84{ 89{
85 // Commonly handled keys 90 // Commonly handled keys
86 if ( !m_empty ){ 91 if ( !m_empty ){
87 switch( e->key() ) { 92 switch( e->key() ) {
88 case Qt::Key_Left: 93 case Qt::Key_Left:
89 qWarning( "Left.."); 94 qWarning( "Left..");
90 case Qt::Key_Right: 95 case Qt::Key_Right:
91 qWarning( "Right.."); 96 qWarning( "Right..");
92 case Qt::Key_F33: 97 case Qt::Key_F33:
93 qWarning( "OK.."); 98 qWarning( "OK..");
94 emit signalOkPressed(); 99 emit signalOkPressed();
95 break; 100 break;
96 case Qt::Key_Up: 101 case Qt::Key_Up:
97 qWarning( "UP.."); 102 qWarning( "UP..");
98 --m_itCurContact; 103 --m_itCurContact;
99 if ( *m_itCurContact != OContact() ) 104 if ( *m_itCurContact != OContact() )
100 sync(); 105 sync();
101 else 106 else
102 m_itCurContact = m_viewList.end(); 107 m_itCurContact = m_viewList.end();
103 108
104 break; 109 break;
105 case Qt::Key_Down: 110 case Qt::Key_Down:
106 qWarning( "DOWN.."); 111 qWarning( "DOWN..");
107 ++m_itCurContact; 112 ++m_itCurContact;
108 if ( *m_itCurContact != OContact() ) 113 if ( *m_itCurContact != OContact() )
109 sync(); 114 sync();
110 else 115 else
111 m_itCurContact = m_viewList.begin(); 116 m_itCurContact = m_viewList.begin();
112 break; 117 break;
113 } 118 }
114 } 119 }
115 120
116} 121}
diff --git a/core/pim/addressbook/abview.cpp b/core/pim/addressbook/abview.cpp
index 0f4bd5f..7226e82 100644
--- a/core/pim/addressbook/abview.cpp
+++ b/core/pim/addressbook/abview.cpp
@@ -1,459 +1,468 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (c) 2002 Stefan Eilers (eilers.stefan@epost.de) 2** Copyright (c) 2002 Stefan Eilers (eilers.stefan@epost.de)
3** 3**
4** This file is part of Qt Palmtop Environment. 4** This file is part of Qt Palmtop Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** 14**
15**********************************************************************/ 15**********************************************************************/
16 16
17#include "abview.h" 17#include "abview.h"
18 18
19#include <qlayout.h> 19#include <qlayout.h>
20 20
21#include <qpe/global.h> 21#include <qpe/global.h>
22 22
23#include <opie/ocontactaccessbackend_vcard.h> 23#include <opie/ocontactaccessbackend_vcard.h>
24 24
25 25
26// Is defined in LibQPE 26// Is defined in LibQPE
27extern QString categoryFileName(); 27extern QString categoryFileName();
28 28
29QString addressbookPersonalVCardName() 29QString addressbookPersonalVCardName()
30{ 30{
31 QString filename = Global::applicationFileName("addressbook", 31 QString filename = Global::applicationFileName("addressbook",
32 "businesscard.vcf"); 32 "businesscard.vcf");
33 return filename; 33 return filename;
34} 34}
35 35
36 36
37AbView::AbView ( QWidget* parent, const QValueList<int>& ordered ): 37AbView::AbView ( QWidget* parent, const QValueList<int>& ordered ):
38 QWidget(parent), 38 QWidget(parent),
39 mCat(0), 39 mCat(0),
40 m_inSearch( false ), 40 m_inSearch( false ),
41 m_inPersonal( false ), 41 m_inPersonal( false ),
42 m_curr_category( -1 ), 42 m_curr_category( -1 ),
43 m_curr_View( TableView ), 43 m_curr_View( TableView ),
44 m_prev_View( TableView ), 44 m_prev_View( TableView ),
45 m_curr_Contact ( 0 ), 45 m_curr_Contact ( 0 ),
46 m_contactdb ( 0l ), 46 m_contactdb ( 0l ),
47 m_storedDB ( 0l ), 47 m_storedDB ( 0l ),
48 m_viewStack( 0l ), 48 m_viewStack( 0l ),
49 m_abTable( 0l ), 49 m_abTable( 0l ),
50 m_orderedFields( ordered ) 50 m_orderedFields( ordered )
51{ 51{
52 // Load default database and handle syncing myself.. ! 52 // Load default database and handle syncing myself.. !
53 m_contactdb = new OContactAccess ( "addressbook", 0l, 0l, false ), 53 m_contactdb = new OContactAccess ( "addressbook", 0l, 0l, false ),
54 mCat.load( categoryFileName() ); 54 mCat.load( categoryFileName() );
55 55
56 // Create Layout and put WidgetStack into it. 56 // Create Layout and put WidgetStack into it.
57 QVBoxLayout *vb = new QVBoxLayout( this ); 57 QVBoxLayout *vb = new QVBoxLayout( this );
58 m_viewStack = new QWidgetStack( this ); 58 m_viewStack = new QWidgetStack( this );
59 vb->addWidget( m_viewStack ); 59 vb->addWidget( m_viewStack );
60 60
61 // Creat TableView 61 // Creat TableView
62 QVBox* tableBox = new QVBox( m_viewStack ); 62 QVBox* tableBox = new QVBox( m_viewStack );
63 m_abTable = new AbTable( m_orderedFields, tableBox, "table" ); 63 m_abTable = new AbTable( m_orderedFields, tableBox, "table" );
64 m_abTable->setCurrentCell( 0, 0 ); 64 m_abTable->setCurrentCell( 0, 0 );
65 m_abTable->setFocus(); 65 m_abTable->setFocus();
66 66
67 // Add TableView to WidgetStack and raise it 67 // Add TableView to WidgetStack and raise it
68 m_viewStack -> addWidget( tableBox , TableView ); 68 m_viewStack -> addWidget( tableBox , TableView );
69 69
70 // Create CardView and add it to WidgetStack 70 // Create CardView and add it to WidgetStack
71 QVBox* cardBox = new QVBox( m_viewStack ); 71 QVBox* cardBox = new QVBox( m_viewStack );
72 m_ablabel = new AbLabel( cardBox, "CardView"); 72 m_ablabel = new AbLabel( cardBox, "CardView");
73 m_viewStack -> addWidget( cardBox , CardView ); 73 m_viewStack -> addWidget( cardBox , CardView );
74 74
75 // Connect views to me 75 // Connect views to me
76 connect ( m_abTable, SIGNAL( signalSwitch( void ) ), 76 connect ( m_abTable, SIGNAL( signalSwitch( void ) ),
77 this, SLOT( slotSwitch( void ) ) ); 77 this, SLOT( slotSwitch( void ) ) );
78 connect ( m_ablabel, SIGNAL( signalOkPressed( void ) ), 78 connect ( m_ablabel, SIGNAL( signalOkPressed( void ) ),
79 this, SLOT( slotSwitch( void ) ) ); 79 this, SLOT( slotSwitch( void ) ) );
80 80
81 load(); 81 load();
82} 82}
83 83
84AbView::~AbView() 84AbView::~AbView()
85{ 85{
86 m_contactdb -> save(); 86 m_contactdb -> save();
87 delete m_contactdb; 87 delete m_contactdb;
88 88
89 if ( m_storedDB ){ 89 if ( m_storedDB ){
90 m_storedDB -> save(); 90 m_storedDB -> save();
91 delete m_storedDB; 91 delete m_storedDB;
92 } 92 }
93} 93}
94 94
95 95
96void AbView::setView( Views view ) 96void AbView::setView( Views view )
97{ 97{
98 qWarning("AbView::setView( Views view )"); 98 qWarning("AbView::setView( Views view )");
99 m_curr_View = view; 99 m_curr_View = view;
100 load(); 100 load();
101} 101}
102 102
103void AbView::addEntry( const OContact &newContact ) 103void AbView::addEntry( const OContact &newContact )
104{ 104{
105 qWarning("abview:AddContact"); 105 qWarning("abview:AddContact");
106 m_contactdb->add ( newContact ); 106 m_contactdb->add ( newContact );
107 load(); 107 load();
108 108
109} 109}
110void AbView::removeEntry( const int UID ) 110void AbView::removeEntry( const int UID )
111{ 111{
112 qWarning("abview:RemoveContact"); 112 qWarning("abview:RemoveContact");
113 m_contactdb->remove( UID ); 113 m_contactdb->remove( UID );
114 load(); 114 load();
115} 115}
116 116
117void AbView::replaceEntry( const OContact &contact ) 117void AbView::replaceEntry( const OContact &contact )
118{ 118{
119 qWarning("abview:ReplaceContact"); 119 qWarning("abview:ReplaceContact");
120 m_contactdb->replace( contact ); 120 m_contactdb->replace( contact );
121 load(); 121 load();
122 122
123} 123}
124 124
125OContact AbView::currentEntry() 125OContact AbView::currentEntry()
126{ 126{
127 OContact currentContact;
128
127 switch ( (int) m_curr_View ) { 129 switch ( (int) m_curr_View ) {
128 case TableView: 130 case TableView:
129 return ( m_abTable -> currentEntry() ); 131 currentContact = m_abTable -> currentEntry();
130 break; 132 break;
131 case CardView: 133 case CardView:
132 return ( m_ablabel -> currentEntry() ); 134 currentContact = m_ablabel -> currentEntry();
133 break; 135 break;
134 } 136 }
135 return OContact(); 137 m_curr_Contact = currentContact.uid();
138 return currentContact;
136} 139}
137 140
138bool AbView::save() 141bool AbView::save()
139{ 142{
140 qWarning("abView:Save data"); 143 qWarning("abView:Save data");
141 144
142 return m_contactdb->save(); 145 return m_contactdb->save();
143} 146}
144 147
145void AbView::load() 148void AbView::load()
146{ 149{
147 qWarning("abView:Load data"); 150 qWarning("abView:Load data");
151
152 // Letter Search is stopped at this place
153 emit signalClearLetterPicker();
148 154
149 if ( m_inPersonal ) 155 if ( m_inPersonal )
150 m_list = m_contactdb->allRecords(); 156 m_list = m_contactdb->allRecords();
151 else 157 else{
152 m_list = m_contactdb->sorted( true, 0, 0, 0 ); 158 m_list = m_contactdb->sorted( true, 0, 0, 0 );
153 159 clearForCategory();
154 clearForCategory(); 160 }
155 161
156 qWarning ("Number of contacts: %d", m_list.count()); 162 qWarning ("Number of contacts: %d", m_list.count());
157 163
158 updateView(); 164 updateView( true );
159 165
160} 166}
161 167
162void AbView::reload() 168void AbView::reload()
163{ 169{
164 qWarning( "void AbView::reload()" ); 170 qWarning( "void AbView::reload()" );
165 171
166 m_contactdb->reload(); 172 m_contactdb->reload();
167 load(); 173 load();
168} 174}
169 175
170void AbView::clear() 176void AbView::clear()
171{ 177{
172 // :SX 178 // :SX
173} 179}
174 180
175void AbView::setShowByCategory( const QString& cat ) 181void AbView::setShowByCategory( const QString& cat )
176{ 182{
177 qWarning("AbView::setShowCategory( const QString& cat )"); 183 qWarning("AbView::setShowCategory( const QString& cat )");
178 184
179 int intCat = 0; 185 int intCat = 0;
180 186
181 // All (cat == NULL) will be stored as -1 187 // All (cat == NULL) will be stored as -1
182 if ( cat.isNull() ) 188 if ( cat.isNull() )
183 intCat = -1; 189 intCat = -1;
184 else 190 else
185 intCat = mCat.id("Contacts", cat ); 191 intCat = mCat.id("Contacts", cat );
186 192
187 // Just do anything if we really change the category 193 // Just do anything if we really change the category
188 if ( intCat != m_curr_category ){ 194 if ( intCat != m_curr_category ){
189 qWarning ("Categories: Selected %s.. Number: %d", cat.latin1(), m_curr_category); 195 qWarning ("Categories: Selected %s.. Number: %d", cat.latin1(), m_curr_category);
190 196
191 m_curr_category = intCat; 197 m_curr_category = intCat;
192 emit signalClearLetterPicker(); 198 emit signalClearLetterPicker();
193 199
194 load(); 200 load();
195 } 201 }
196 202
197} 203}
198 204
199void AbView::setShowToView( Views view ) 205void AbView::setShowToView( Views view )
200{ 206{
201 qWarning("void AbView::setShowToView( View %d )", view); 207 qWarning("void AbView::setShowToView( View %d )", view);
202 208
203 qWarning ("Change the View (Category is: %d)", m_curr_category); 209 qWarning ("Change the View (Category is: %d)", m_curr_category);
204 210
205 if ( m_curr_View != view ){ 211 if ( m_curr_View != view ){
206 m_prev_View = m_curr_View; 212 m_prev_View = m_curr_View;
207 m_curr_View = view; 213 m_curr_View = view;
208 214
209 updateView(); 215 updateView();
210 } 216 }
211 217
212} 218}
213 219
214void AbView::setShowByLetter( char c ) 220void AbView::setShowByLetter( char c )
215{ 221{
216 qWarning("void AbView::setShowByLetter( %c )", c ); 222 qWarning("void AbView::setShowByLetter( %c )", c );
217 OContact query; 223 OContact query;
218 if ( c == 0 ){ 224 if ( c == 0 ){
219 load(); 225 load();
220 return; 226 return;
221 }else{ 227 }else{
222 query.setLastName( QString("%1*").arg(c) ); 228 query.setLastName( QString("%1*").arg(c) );
223 m_list = m_contactdb->queryByExample( query, OContactAccess::WildCards ); 229 m_list = m_contactdb->queryByExample( query, OContactAccess::WildCards );
224 clearForCategory(); 230 clearForCategory();
225 m_curr_Contact = 0; 231 m_curr_Contact = 0;
226 } 232 }
227 updateView(); 233 updateView( true );
228} 234}
229 235
230void AbView::setListOrder( const QValueList<int>& ordered ) 236void AbView::setListOrder( const QValueList<int>& ordered )
231{ 237{
232 m_orderedFields = ordered; 238 m_orderedFields = ordered;
233 updateView(); 239 updateView();
234} 240}
235 241
236 242
237QString AbView::showCategory() const 243QString AbView::showCategory() const
238{ 244{
239 return mCat.label( "Contacts", m_curr_category ); 245 return mCat.label( "Contacts", m_curr_category );
240} 246}
241 247
242void AbView::showPersonal( bool personal ) 248void AbView::showPersonal( bool personal )
243{ 249{
244 qWarning ("void AbView::showPersonal( %d )", personal); 250 qWarning ("void AbView::showPersonal( %d )", personal);
245 251
246 if ( personal ){ 252 if ( personal ){
247 253
248 if ( m_inPersonal ) 254 if ( m_inPersonal )
249 return; 255 return;
250 256
251 // Now switch to vCard Backend and load data. 257 // Now switch to vCard Backend and load data.
252 // The current default backend will be stored 258 // The current default backend will be stored
253 // to avoid unneeded load/stores. 259 // to avoid unneeded load/stores.
254 m_storedDB = m_contactdb; 260 m_storedDB = m_contactdb;
255 261
256 OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, 262 OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null,
257 addressbookPersonalVCardName() ); 263 addressbookPersonalVCardName() );
258 m_contactdb = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); 264 m_contactdb = new OContactAccess ( "addressbook", QString::null , vcard_backend, true );
259 265
260 m_inPersonal = true; 266 m_inPersonal = true;
261 m_curr_View = CardView; 267 m_curr_View = CardView;
262 268
263 }else{ 269 }else{
264 270
265 if ( !m_inPersonal ) 271 if ( !m_inPersonal )
266 return; 272 return;
267 273
268 // Remove vCard Backend and restore default 274 // Remove vCard Backend and restore default
269 m_contactdb->save(); 275 m_contactdb->save();
270 delete m_contactdb; 276 delete m_contactdb;
271 277
272 m_contactdb = m_storedDB; 278 m_contactdb = m_storedDB;
273 m_storedDB = 0l; 279 m_storedDB = 0l;
274 280
275 m_curr_View = TableView; 281 m_curr_View = TableView;
276 m_inPersonal = false; 282 m_inPersonal = false;
277 283
278 } 284 }
279 load(); 285 load();
280} 286}
281 287
282QStringList AbView::categories() 288QStringList AbView::categories()
283{ 289{
284 mCat.load( categoryFileName() ); 290 mCat.load( categoryFileName() );
285 QStringList categoryList = mCat.labels( "Contacts" ); 291 QStringList categoryList = mCat.labels( "Contacts" );
286 return categoryList; 292 return categoryList;
287} 293}
288 294
289// BEGIN: Slots 295// BEGIN: Slots
290void AbView::slotDoFind( const QString &str, bool caseSensitive, bool useRegExp, 296void AbView::slotDoFind( const QString &str, bool caseSensitive, bool useRegExp,
291 bool , QString cat = QString::null ) 297 bool , QString cat = QString::null )
292{ 298{
293 qWarning( "void AbView::slotDoFind" ); 299 qWarning( "void AbView::slotDoFind" );
294 300
295 // We reloading the data: Deselect Letterpicker 301 // We reloading the data: Deselect Letterpicker
296 emit signalClearLetterPicker(); 302 emit signalClearLetterPicker();
297 303
298 // Use the current Category if nothing else selected 304 // Use the current Category if nothing else selected
299 int category = 0; 305 int category = 0;
300 306
301 if ( cat.isEmpty() ) 307 if ( cat.isEmpty() )
302 category = m_curr_category; 308 category = m_curr_category;
303 else{ 309 else{
304 category = mCat.id("Contacts", cat ); 310 category = mCat.id("Contacts", cat );
305 } 311 }
306 312
307 qWarning ("Find in Category %d", category); 313 qWarning ("Find in Category %d", category);
308 314
309 QRegExp r( str ); 315 QRegExp r( str );
310 r.setCaseSensitive( caseSensitive ); 316 r.setCaseSensitive( caseSensitive );
311 r.setWildcard( !useRegExp ); 317 r.setWildcard( !useRegExp );
312 318
313 // Get all matching entries out of the database 319 // Get all matching entries out of the database
314 m_list = m_contactdb->matchRegexp( r ); 320 m_list = m_contactdb->matchRegexp( r );
315 321
316 qWarning( "found: %d", m_list.count() ); 322 qWarning( "found: %d", m_list.count() );
317 if ( m_list.count() == 0 ){ 323 if ( m_list.count() == 0 ){
318 emit signalNotFound(); 324 emit signalNotFound();
319 return; 325 return;
320 } 326 }
321 327
322 // Now remove all contacts with wrong category (if any selected) 328 // Now remove all contacts with wrong category (if any selected)
323 // This algorithm is a litte bit ineffective, but 329 // This algorithm is a litte bit ineffective, but
324 // we will not have a lot of matching entries.. 330 // we will not have a lot of matching entries..
325 clearForCategory(); 331 clearForCategory();
326 332
327 // Now show all found entries 333 // Now show all found entries
328 updateView(); 334 updateView( true );
329} 335}
330 336
331void AbView::offSearch() 337void AbView::offSearch()
332{ 338{
333 m_inSearch = false; 339 m_inSearch = false;
334 340
335 load(); 341 load();
336} 342}
337 343
338void AbView::slotSwitch(){ 344void AbView::slotSwitch(){
339 qWarning("AbView::slotSwitch()"); 345 qWarning("AbView::slotSwitch()");
340 346
341 m_prev_View = m_curr_View; 347 m_prev_View = m_curr_View;
342 switch ( (int) m_curr_View ){ 348 switch ( (int) m_curr_View ){
343 case TableView: 349 case TableView:
344 qWarning("Switching to CardView"); 350 qWarning("Switching to CardView");
345 m_curr_View = CardView; 351 m_curr_View = CardView;
346 break; 352 break;
347 case CardView: 353 case CardView:
348 qWarning("Switching to TableView"); 354 qWarning("Switching to TableView");
349 m_curr_View = TableView; 355 m_curr_View = TableView;
350 break; 356 break;
351 } 357 }
352 updateView(); 358 updateView();
353 359
354} 360}
355 361
356// END: Slots 362// END: Slots
357 363
358void AbView::clearForCategory() 364void AbView::clearForCategory()
359{ 365{
360 OContactAccess::List::Iterator it; 366 OContactAccess::List::Iterator it;
361 // Now remove all contacts with wrong category if any category selected 367 // Now remove all contacts with wrong category if any category selected
362 368
363 OContactAccess::List allList = m_list; 369 OContactAccess::List allList = m_list;
364 if ( m_curr_category != -1 ){ 370 if ( m_curr_category != -1 ){
365 for ( it = allList.begin(); it != allList.end(); ++it ){ 371 for ( it = allList.begin(); it != allList.end(); ++it ){
366 if ( !contactCompare( *it, m_curr_category ) ){ 372 if ( !contactCompare( *it, m_curr_category ) ){
367 qWarning("Removing %d", (*it).uid()); 373 qWarning("Removing %d", (*it).uid());
368 m_list.remove( (*it).uid() ); 374 m_list.remove( (*it).uid() );
369 } 375 }
370 } 376 }
371 } 377 }
372 378
373} 379}
374 380
375bool AbView::contactCompare( const OContact &cnt, int category ) 381bool AbView::contactCompare( const OContact &cnt, int category )
376{ 382{
377 qWarning ("bool AbView::contactCompare( const OContact &cnt, %d )", category); 383 qWarning ("bool AbView::contactCompare( const OContact &cnt, %d )", category);
378 384
379 bool returnMe; 385 bool returnMe;
380 QArray<int> cats; 386 QArray<int> cats;
381 cats = cnt.categories(); 387 cats = cnt.categories();
382 388
383 qWarning ("Number of categories: %d", cats.count() ); 389 qWarning ("Number of categories: %d", cats.count() );
384 390
385 returnMe = false; 391 returnMe = false;
386 if ( cats.count() == 0 && category == 0 ) 392 if ( cats.count() == 0 && category == 0 )
387 // Contacts with no category will just shown on "All" and "Unfiled" 393 // Contacts with no category will just shown on "All" and "Unfiled"
388 returnMe = true; 394 returnMe = true;
389 else { 395 else {
390 int i; 396 int i;
391 for ( i = 0; i < int(cats.count()); i++ ) { 397 for ( i = 0; i < int(cats.count()); i++ ) {
392 qWarning("Comparing %d with %d",cats[i],category ); 398 qWarning("Comparing %d with %d",cats[i],category );
393 if ( cats[i] == category ) { 399 if ( cats[i] == category ) {
394 returnMe = true; 400 returnMe = true;
395 break; 401 break;
396 } 402 }
397 } 403 }
398 } 404 }
399 qWarning ("Return: %d", returnMe); 405 qWarning ("Return: %d", returnMe);
400 return returnMe; 406 return returnMe;
401} 407}
402 408
403// In Some rare cases we have to update all lists.. 409// In Some rare cases we have to update all lists..
404void AbView::updateListinViews() 410void AbView::updateListinViews()
405{ 411{
406 m_abTable -> setContacts( m_list ); 412 m_abTable -> setContacts( m_list );
407 m_ablabel -> setContacts( m_list ); 413 m_ablabel -> setContacts( m_list );
408} 414}
409 415
410void AbView::updateView() 416void AbView::updateView( bool newdata )
411{ 417{
412 qWarning("AbView::updateView()"); 418 qWarning("AbView::updateView()");
413 419
414 if ( m_viewStack -> visibleWidget() ){ 420 if ( m_viewStack -> visibleWidget() ){
415 m_viewStack -> visibleWidget() -> clearFocus(); 421 m_viewStack -> visibleWidget() -> clearFocus();
416 } 422 }
417 423
418 // If we switching the view, we have to store some information 424 // If we switching the view, we have to store some information
419 if ( m_list.count() ){ 425 if ( !newdata ){
420 switch ( (int) m_prev_View ) { 426 if ( m_list.count() ){
421 case TableView: 427 switch ( (int) m_prev_View ) {
422 m_curr_Contact = m_abTable -> currentEntry_UID(); 428 case TableView:
423 break; 429 m_curr_Contact = m_abTable -> currentEntry_UID();
424 case CardView: 430 break;
425 m_curr_Contact = m_ablabel -> currentEntry_UID(); 431 case CardView:
426 break; 432 m_curr_Contact = m_ablabel -> currentEntry_UID();
427 } 433 break;
428 }else 434 }
429 m_curr_Contact = 0; 435 }else
436 m_curr_Contact = 0;
437 }
430 438
431 // Feed all views with new lists 439 // Feed all views with new lists
432 updateListinViews(); 440 if ( newdata )
441 updateListinViews();
433 442
434 // Inform the world that the view is changed 443 // Tell the world that the view is changed
435 if ( m_curr_View != m_prev_View ) 444 if ( m_curr_View != m_prev_View )
436 emit signalViewSwitched ( (int) m_curr_View ); 445 emit signalViewSwitched ( (int) m_curr_View );
437 446
438 m_prev_View = m_curr_View; 447 m_prev_View = m_curr_View;
439 448
440 // Switch to new View 449 // Switch to new View
441 switch ( (int) m_curr_View ) { 450 switch ( (int) m_curr_View ) {
442 case TableView: 451 case TableView:
443 m_abTable -> setChoiceSelection( m_orderedFields ); 452 m_abTable -> setChoiceSelection( m_orderedFields );
444 if ( m_curr_Contact != 0 ) 453 if ( m_curr_Contact != 0 )
445 m_abTable -> selectContact ( m_curr_Contact ); 454 m_abTable -> selectContact ( m_curr_Contact );
446 m_abTable -> setFocus(); 455 m_abTable -> setFocus();
447 break; 456 break;
448 case CardView: 457 case CardView:
449 if ( m_curr_Contact != 0 ) 458 if ( m_curr_Contact != 0 )
450 m_ablabel -> selectContact( m_curr_Contact ); 459 m_ablabel -> selectContact( m_curr_Contact );
451 m_ablabel -> setFocus(); 460 m_ablabel -> setFocus();
452 break; 461 break;
453 } 462 }
454 463
455 // Raise the current View 464 // Raise the current View
456 m_viewStack -> raiseWidget( m_curr_View ); 465 m_viewStack -> raiseWidget( m_curr_View );
457} 466}
458 467
459 468
diff --git a/core/pim/addressbook/abview.h b/core/pim/addressbook/abview.h
index 2c10cfa..8570fe7 100644
--- a/core/pim/addressbook/abview.h
+++ b/core/pim/addressbook/abview.h
@@ -1,87 +1,87 @@
1#ifndef _ABVIEW_H_ 1#ifndef _ABVIEW_H_
2#define _ABVIEW_H_ 2#define _ABVIEW_H_
3 3
4#include <qwidget.h> 4#include <qwidget.h>
5#include <qwidgetstack.h> 5#include <qwidgetstack.h>
6 6
7#include <qpe/categories.h> 7#include <qpe/categories.h>
8#include <opie/ocontact.h> 8#include <opie/ocontact.h>
9#include <opie/ocontactaccess.h> 9#include <opie/ocontactaccess.h>
10 10
11#include "contacteditor.h" 11#include "contacteditor.h"
12#include "abtable.h" 12#include "abtable.h"
13#include "ablabel.h" 13#include "ablabel.h"
14 14
15class AbView: public QWidget 15class AbView: public QWidget
16{ 16{
17 Q_OBJECT 17 Q_OBJECT
18 18
19public: 19public:
20 enum Views{ TableView=0, CardView, PersonalView }; 20 enum Views{ TableView=0, CardView, PersonalView };
21 21
22 AbView( QWidget* parent, const QValueList<int>& ordered ); 22 AbView( QWidget* parent, const QValueList<int>& ordered );
23 ~AbView(); 23 ~AbView();
24 24
25 bool save(); 25 bool save();
26 void load(); 26 void load();
27 void reload(); 27 void reload();
28 void clear(); 28 void clear();
29 29
30 void setView( Views view ); 30 void setView( Views view );
31 void showPersonal( bool personal ); 31 void showPersonal( bool personal );
32 void setShowByCategory( const QString& cat ); 32 void setShowByCategory( const QString& cat );
33 void setShowToView( Views view ); 33 void setShowToView( Views view );
34 void setShowByLetter( char c ); 34 void setShowByLetter( char c );
35 void setListOrder( const QValueList<int>& ordered ); 35 void setListOrder( const QValueList<int>& ordered );
36 36
37 // Add Entry and put to current 37 // Add Entry and put to current
38 void addEntry( const OContact &newContact ); 38 void addEntry( const OContact &newContact );
39 void removeEntry( const int UID ); 39 void removeEntry( const int UID );
40 void replaceEntry( const OContact &contact ); 40 void replaceEntry( const OContact &contact );
41 OContact currentEntry(); 41 OContact currentEntry();
42 42
43 void inSearch() { m_inSearch = true; } 43 void inSearch() { m_inSearch = true; }
44 void offSearch(); 44 void offSearch();
45 45
46 QString showCategory() const; 46 QString showCategory() const;
47 QStringList categories(); 47 QStringList categories();
48 48
49signals: 49signals:
50 void signalNotFound(); 50 void signalNotFound();
51 void signalClearLetterPicker(); 51 void signalClearLetterPicker();
52 void signalViewSwitched ( int ); 52 void signalViewSwitched ( int );
53 53
54public slots: 54public slots:
55 void slotDoFind( const QString &str, bool caseSensitive, bool useRegExp, 55 void slotDoFind( const QString &str, bool caseSensitive, bool useRegExp,
56 bool backwards, QString category = QString::null ); 56 bool backwards, QString category = QString::null );
57 void slotSwitch(); 57 void slotSwitch();
58 58
59private: 59private:
60 void updateListinViews(); 60 void updateListinViews();
61 void updateView(); 61 void updateView( bool newdata = false );
62 void clearForCategory(); 62 void clearForCategory();
63 bool contactCompare( const OContact &cnt, int category ); 63 bool contactCompare( const OContact &cnt, int category );
64 void parseName( const QString& name, QString *first, QString *middle, 64 void parseName( const QString& name, QString *first, QString *middle,
65 QString * last ); 65 QString * last );
66 66
67 Categories mCat; 67 Categories mCat;
68 bool m_inSearch; 68 bool m_inSearch;
69 bool m_inPersonal; 69 bool m_inPersonal;
70 int m_curr_category; 70 int m_curr_category;
71 Views m_curr_View; 71 Views m_curr_View;
72 Views m_prev_View; 72 Views m_prev_View;
73 int m_curr_Contact; 73 int m_curr_Contact;
74 74
75 OContactAccess* m_contactdb; 75 OContactAccess* m_contactdb;
76 OContactAccess* m_storedDB; 76 OContactAccess* m_storedDB;
77 OContactAccess::List m_list; 77 OContactAccess::List m_list;
78 78
79 QWidgetStack* m_viewStack; 79 QWidgetStack* m_viewStack;
80 AbTable* m_abTable; 80 AbTable* m_abTable;
81 AbLabel* m_ablabel; 81 AbLabel* m_ablabel;
82 82
83 QValueList<int> m_orderedFields; 83 QValueList<int> m_orderedFields;
84}; 84};
85 85
86 86
87#endif 87#endif
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp
index 5d588da..055124c 100644
--- a/core/pim/addressbook/addressbook.cpp
+++ b/core/pim/addressbook/addressbook.cpp
@@ -1,950 +1,950 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qt Palmtop Environment. 4** This file is part of Qt Palmtop Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** OContact info@trolltech.com if any conditions of this licensing are 16** OContact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#define QTOPIA_INTERNAL_FD 21#define QTOPIA_INTERNAL_FD
22 22
23#include "contacteditor.h" 23#include "contacteditor.h"
24#include "ablabel.h" 24#include "ablabel.h"
25#include "abview.h" 25#include "abview.h"
26#include "abtable.h" 26#include "abtable.h"
27// #include "addresssettings.h" 27// #include "addresssettings.h"
28#include "addressbook.h" 28#include "addressbook.h"
29 29
30 30
31#include <opie/ofileselector.h> 31#include <opie/ofileselector.h>
32#include <opie/ofiledialog.h> 32#include <opie/ofiledialog.h>
33#include <opie/ocontact.h> 33#include <opie/ocontact.h>
34#include <opie/ocontactaccessbackend_vcard.h> 34#include <opie/ocontactaccessbackend_vcard.h>
35 35
36#include <qpe/resource.h> 36#include <qpe/resource.h>
37#include <qpe/ir.h> 37#include <qpe/ir.h>
38#include <qpe/qpemessagebox.h> 38#include <qpe/qpemessagebox.h>
39#include <qpe/qcopenvelope_qws.h> 39#include <qpe/qcopenvelope_qws.h>
40#include <qpe/qpetoolbar.h> 40#include <qpe/qpetoolbar.h>
41#include <qpe/qpemenubar.h> 41#include <qpe/qpemenubar.h>
42// #include <qtoolbar.h> 42// #include <qtoolbar.h>
43// #include <qmenubar.h> 43// #include <qmenubar.h>
44#include <qpe/qpeapplication.h> 44#include <qpe/qpeapplication.h>
45#include <qpe/config.h> 45#include <qpe/config.h>
46 46
47#include <qaction.h> 47#include <qaction.h>
48#include <qdialog.h> 48#include <qdialog.h>
49#include <qdir.h> 49#include <qdir.h>
50#include <qfile.h> 50#include <qfile.h>
51#include <qimage.h> 51#include <qimage.h>
52#include <qlayout.h> 52#include <qlayout.h>
53#include <qmessagebox.h> 53#include <qmessagebox.h>
54#include <qpixmap.h> 54#include <qpixmap.h>
55#include <qpopupmenu.h> 55#include <qpopupmenu.h>
56#include <qstringlist.h> 56#include <qstringlist.h>
57#include <qtoolbutton.h> 57#include <qtoolbutton.h>
58#include <qwhatsthis.h> 58#include <qwhatsthis.h>
59#include <qdatetime.h> 59#include <qdatetime.h>
60 60
61#include <stdlib.h> 61#include <stdlib.h>
62#include <sys/stat.h> 62#include <sys/stat.h>
63#include <sys/types.h> 63#include <sys/types.h>
64#include <fcntl.h> 64#include <fcntl.h>
65#include <unistd.h> 65#include <unistd.h>
66 66
67 67
68#include "picker.h" 68#include "picker.h"
69#include "configdlg.h" 69#include "configdlg.h"
70 70
71extern QString addressbookPersonalVCardName(); 71extern QString addressbookPersonalVCardName();
72 72
73AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, 73AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
74 WFlags f ) 74 WFlags f )
75 : QMainWindow( parent, name, f ), 75 : QMainWindow( parent, name, f ),
76 catMenu (0l), 76 catMenu (0l),
77 abEditor(0l), 77 abEditor(0l),
78 syncing(FALSE), 78 syncing(FALSE),
79 m_tableViewButton(0l), 79 m_tableViewButton(0l),
80 m_cardViewButton(0l) 80 m_cardViewButton(0l)
81{ 81{
82 isLoading = true; 82 isLoading = true;
83 83
84 m_config.load(); 84 m_config.load();
85 85
86 setCaption( tr("Contacts") ); 86 setCaption( tr("Contacts") );
87 setIcon( Resource::loadPixmap( "AddressBook" ) ); 87 setIcon( Resource::loadPixmap( "AddressBook" ) );
88 88
89 // Settings for Main Menu 89 // Settings for Main Menu
90 setToolBarsMovable( true ); 90 setToolBarsMovable( true );
91 setRightJustification( true ); 91 setRightJustification( true );
92 92
93 // Create Toolbar 93 // Create Toolbar
94 listTools = new QPEToolBar( this, "list operations" ); 94 listTools = new QPEToolBar( this, "list operations" );
95 listTools->setHorizontalStretchable( true ); 95 listTools->setHorizontalStretchable( true );
96 addToolBar( listTools ); 96 addToolBar( listTools );
97 moveToolBar( listTools, m_config.getToolBarPos() ); 97 moveToolBar( listTools, m_config.getToolBarPos() );
98 98
99 QPEMenuBar *mbList = new QPEMenuBar( this ); 99 QPEMenuBar *mbList = new QPEMenuBar( this );
100 mbList->setMargin( 0 ); 100 mbList->setMargin( 0 );
101 101
102 QPopupMenu *edit = new QPopupMenu( mbList ); 102 QPopupMenu *edit = new QPopupMenu( mbList );
103 mbList->insertItem( tr( "Contact" ), edit ); 103 mbList->insertItem( tr( "Contact" ), edit );
104 104
105 105
106 // View Icons 106 // View Icons
107 m_tableViewButton = new QAction( tr( "List" ), Resource::loadPixmap( "datebook/weeklst" ), 107 m_tableViewButton = new QAction( tr( "List" ), Resource::loadPixmap( "datebook/weeklst" ),
108 QString::null, 0, this, 0 ); 108 QString::null, 0, this, 0 );
109 connect( m_tableViewButton, SIGNAL( activated() ), this, SLOT( slotListView() ) ); 109 connect( m_tableViewButton, SIGNAL( activated() ), this, SLOT( slotListView() ) );
110 m_tableViewButton->setToggleAction( true ); 110 m_tableViewButton->setToggleAction( true );
111 m_tableViewButton->addTo( listTools ); 111 m_tableViewButton->addTo( listTools );
112 m_cardViewButton = new QAction( tr( "Card" ), Resource::loadPixmap( "day" ), QString::null, 0, this, 0 ); 112 m_cardViewButton = new QAction( tr( "Card" ), Resource::loadPixmap( "day" ), QString::null, 0, this, 0 );
113 connect( m_cardViewButton, SIGNAL( activated() ), this, SLOT( slotCardView() ) ); 113 connect( m_cardViewButton, SIGNAL( activated() ), this, SLOT( slotCardView() ) );
114 m_cardViewButton->setToggleAction( true ); 114 m_cardViewButton->setToggleAction( true );
115 m_cardViewButton->addTo( listTools ); 115 m_cardViewButton->addTo( listTools );
116 116
117 listTools->addSeparator(); 117 listTools->addSeparator();
118 118
119 // Other Buttons 119 // Other Buttons
120 QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 120 QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null,
121 0, this, 0 ); 121 0, this, 0 );
122 actionNew = a; 122 actionNew = a;
123 connect( a, SIGNAL( activated() ), this, SLOT( slotListNew() ) ); 123 connect( a, SIGNAL( activated() ), this, SLOT( slotListNew() ) );
124 a->addTo( edit ); 124 a->addTo( edit );
125 a->addTo( listTools ); 125 a->addTo( listTools );
126 126
127 a = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ), QString::null, 127 a = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ), QString::null,
128 0, this, 0 ); 128 0, this, 0 );
129 actionEdit = a; 129 actionEdit = a;
130 connect( a, SIGNAL( activated() ), this, SLOT( slotViewEdit() ) ); 130 connect( a, SIGNAL( activated() ), this, SLOT( slotViewEdit() ) );
131 a->addTo( edit ); 131 a->addTo( edit );
132 a->addTo( listTools ); 132 a->addTo( listTools );
133 133
134 a = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, 134 a = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null,
135 0, this, 0 ); 135 0, this, 0 );
136 actionTrash = a; 136 actionTrash = a;
137 connect( a, SIGNAL( activated() ), this, SLOT( slotListDelete() ) ); 137 connect( a, SIGNAL( activated() ), this, SLOT( slotListDelete() ) );
138 a->addTo( edit ); 138 a->addTo( edit );
139 a->addTo( listTools ); 139 a->addTo( listTools );
140 140
141 141
142 // make it possible to go directly to businesscard via qcop call 142 // make it possible to go directly to businesscard via qcop call
143#if defined(Q_WS_QWS) 143#if defined(Q_WS_QWS)
144#if !defined(QT_NO_COP) 144#if !defined(QT_NO_COP)
145 QCopChannel *addressChannel = new QCopChannel("QPE/Addressbook" , this ); 145 QCopChannel *addressChannel = new QCopChannel("QPE/Addressbook" , this );
146 connect (addressChannel, SIGNAL( received(const QCString &, const QByteArray &)), 146 connect (addressChannel, SIGNAL( received(const QCString &, const QByteArray &)),
147 this, SLOT ( appMessage(const QCString &, const QByteArray &) ) ); 147 this, SLOT ( appMessage(const QCString &, const QByteArray &) ) );
148#endif 148#endif
149#endif 149#endif
150 a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ), 150 a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ),
151 QString::null, 0, this, 0 ); 151 QString::null, 0, this, 0 );
152 actionFind = a; 152 actionFind = a;
153 connect( a, SIGNAL(activated()), this, SLOT( slotFindOpen()) ); 153 connect( a, SIGNAL(activated()), this, SLOT( slotFindOpen()) );
154 a->addTo( edit ); 154 a->addTo( edit );
155 a->addTo( listTools ); 155 a->addTo( listTools );
156 156
157 // Much better search widget, taken from QTReader.. (se) 157 // Much better search widget, taken from QTReader.. (se)
158 searchBar = new OFloatBar( "Search", this, QMainWindow::Top, TRUE ); 158 searchBar = new OFloatBar( "Search", this, QMainWindow::Top, TRUE );
159 searchBar->setHorizontalStretchable( TRUE ); 159 searchBar->setHorizontalStretchable( TRUE );
160 searchBar->hide(); 160 searchBar->hide();
161 searchEdit = new QLineEdit( searchBar, "searchEdit" ); 161 searchEdit = new QLineEdit( searchBar, "searchEdit" );
162 162
163 // QFont f("unifont", 16 /*, QFont::Bold*/); 163 // QFont f("unifont", 16 /*, QFont::Bold*/);
164 // searchEdit->setFont( f ); 164 // searchEdit->setFont( f );
165 165
166 searchBar->setStretchableWidget( searchEdit ); 166 searchBar->setStretchableWidget( searchEdit );
167 connect( searchEdit, SIGNAL( returnPressed( ) ), 167 connect( searchEdit, SIGNAL( returnPressed( ) ),
168 this, SLOT( slotFind( ) ) ); 168 this, SLOT( slotFind( ) ) );
169 169
170 a = new QAction( tr( "Start Search" ), Resource::loadPixmap( "enter" ), QString::null, 0, this, 0 ); 170 a = new QAction( tr( "Start Search" ), Resource::loadPixmap( "enter" ), QString::null, 0, this, 0 );
171 connect( a, SIGNAL( activated() ), this, SLOT( slotFind() ) ); 171 connect( a, SIGNAL( activated() ), this, SLOT( slotFind() ) );
172 a->addTo( searchBar ); 172 a->addTo( searchBar );
173 173
174 a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); 174 a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
175 connect( a, SIGNAL( activated() ), this, SLOT( slotFindClose() ) ); 175 connect( a, SIGNAL( activated() ), this, SLOT( slotFindClose() ) );
176 a->addTo( searchBar ); 176 a->addTo( searchBar );
177 177
178 a = new QAction( tr( "Write Mail To" ), Resource::loadPixmap( "mail/sendmail" ), 178 a = new QAction( tr( "Write Mail To" ), Resource::loadPixmap( "mail/sendmail" ),
179 QString::null, 0, this, 0 ); 179 QString::null, 0, this, 0 );
180 //a->setEnabled( FALSE ); we got support for it now :) zecke 180 //a->setEnabled( FALSE ); we got support for it now :) zecke
181 actionMail = a; 181 actionMail = a;
182 connect( a, SIGNAL( activated() ), this, SLOT( writeMail() ) ); 182 connect( a, SIGNAL( activated() ), this, SLOT( writeMail() ) );
183 a->addTo( edit ); 183 a->addTo( edit );
184 a->addTo( listTools ); 184 a->addTo( listTools );
185 185
186 if ( Ir::supported() ) { 186 if ( Ir::supported() ) {
187 a = new QAction( tr ("Beam Entry" ), Resource::loadPixmap( "beam" ), QString::null, 187 a = new QAction( tr ("Beam Entry" ), Resource::loadPixmap( "beam" ), QString::null,
188 0, this, 0 ); 188 0, this, 0 );
189 actionBeam = a; 189 actionBeam = a;
190 connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) ); 190 connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) );
191 a->addTo( edit ); 191 a->addTo( edit );
192 a->addTo( listTools ); 192 a->addTo( listTools );
193 } 193 }
194 194
195 edit->insertSeparator(); 195 edit->insertSeparator();
196 196
197 a = new QAction( tr("Import vCard"), QString::null, 0, 0); 197 a = new QAction( tr("Import vCard"), QString::null, 0, 0);
198 actionPersonal = a; 198 actionPersonal = a;
199 connect( a, SIGNAL( activated() ), this, SLOT( importvCard() ) ); 199 connect( a, SIGNAL( activated() ), this, SLOT( importvCard() ) );
200 a->addTo( edit ); 200 a->addTo( edit );
201 201
202 edit->insertSeparator(); 202 edit->insertSeparator();
203 203
204 a = new QAction( tr("My Personal Details"), QString::null, 0, 0, 0, TRUE ); 204 a = new QAction( tr("My Personal Details"), QString::null, 0, 0, 0, TRUE );
205 actionPersonal = a; 205 actionPersonal = a;
206 connect( a, SIGNAL( activated() ), this, SLOT( slotPersonalView() ) ); 206 connect( a, SIGNAL( activated() ), this, SLOT( slotPersonalView() ) );
207 a->addTo( edit ); 207 a->addTo( edit );
208 208
209 209
210#ifdef __DEBUG_RELEASE 210#ifdef __DEBUG_RELEASE
211 // Remove this function for public Release ! This is only 211 // Remove this function for public Release ! This is only
212 // for debug purposes .. 212 // for debug purposes ..
213 a = new QAction( tr( "Save all Data"), QString::null, 0, 0 ); 213 a = new QAction( tr( "Save all Data"), QString::null, 0, 0 );
214 connect( a, SIGNAL( activated() ), this , SLOT( slotSave() ) ); 214 connect( a, SIGNAL( activated() ), this , SLOT( slotSave() ) );
215 a->addTo( edit ); 215 a->addTo( edit );
216#endif 216#endif
217 a = new QAction( tr( "Config" ), Resource::loadPixmap( "today/config" ), QString::null, 217 a = new QAction( tr( "Config" ), Resource::loadPixmap( "today/config" ), QString::null,
218 0, this, 0 ); 218 0, this, 0 );
219 connect( a, SIGNAL( activated() ), this, SLOT( slotConfig() ) ); 219 connect( a, SIGNAL( activated() ), this, SLOT( slotConfig() ) );
220 a->addTo( edit ); 220 a->addTo( edit );
221 221
222 // Create Views 222 // Create Views
223 listContainer = new QWidget( this ); 223 listContainer = new QWidget( this );
224 QVBoxLayout *vb = new QVBoxLayout( listContainer ); 224 QVBoxLayout *vb = new QVBoxLayout( listContainer );
225 225
226 m_abView = new AbView( listContainer, m_config.orderList() ); 226 m_abView = new AbView( listContainer, m_config.orderList() );
227 vb->addWidget( m_abView ); 227 vb->addWidget( m_abView );
228 // abList->setHScrollBarMode( QScrollView::AlwaysOff ); 228 // abList->setHScrollBarMode( QScrollView::AlwaysOff );
229 connect( m_abView, SIGNAL( signalViewSwitched ( int ) ), 229 connect( m_abView, SIGNAL( signalViewSwitched ( int ) ),
230 this, SLOT( slotViewSwitched( int ) ) ); 230 this, SLOT( slotViewSwitched( int ) ) );
231 231
232 232
233 QObject::connect( m_abView, SIGNAL(signalNotFound()), this, SLOT(slotNotFound()) ); 233 QObject::connect( m_abView, SIGNAL(signalNotFound()), this, SLOT(slotNotFound()) );
234 234
235 m_abView->load(); 235 m_abView->load();
236 236
237 // Letter Picker 237 // Letter Picker
238 pLabel = new LetterPicker( listContainer ); 238 pLabel = new LetterPicker( listContainer );
239 connect(pLabel, SIGNAL(letterClicked(char)), this, SLOT(slotSetLetter(char))); 239 connect(pLabel, SIGNAL(letterClicked(char)), this, SLOT(slotSetLetter(char)));
240 connect(m_abView, SIGNAL( signalClearLetterPicker() ), pLabel, SLOT( clear() ) ); 240 connect(m_abView, SIGNAL( signalClearLetterPicker() ), pLabel, SLOT( clear() ) );
241 241
242 vb->addWidget( pLabel ); 242 vb->addWidget( pLabel );
243 243
244 // Category Menu 244 // Category Menu
245 catMenu = new QPopupMenu( this ); 245 catMenu = new QPopupMenu( this );
246 catMenu->setCheckable( TRUE ); 246 catMenu->setCheckable( TRUE );
247 connect( catMenu, SIGNAL(activated(int)), this, SLOT(slotSetCategory(int)) ); 247 connect( catMenu, SIGNAL(activated(int)), this, SLOT(slotSetCategory(int)) );
248 populateCategories(); 248 populateCategories();
249 mbList->insertItem( tr("View"), catMenu ); 249 mbList->insertItem( tr("View"), catMenu );
250 250
251 defaultFont = new QFont( m_abView->font() ); 251 defaultFont = new QFont( m_abView->font() );
252 slotSetFont(m_config.fontSize()); 252 slotSetFont(m_config.fontSize());
253 m_curFontSize = m_config.fontSize(); 253 m_curFontSize = m_config.fontSize();
254 254
255 setCentralWidget(listContainer); 255 setCentralWidget(listContainer);
256 256
257 // qDebug("adressbook contrsuction: t=%d", t.elapsed() ); 257 // qDebug("adressbook contrsuction: t=%d", t.elapsed() );
258 258
259 259
260 isLoading = false; 260 isLoading = false;
261} 261}
262 262
263 263
264void AddressbookWindow::slotConfig() 264void AddressbookWindow::slotConfig()
265{ 265{
266 ConfigDlg* dlg = new ConfigDlg( this, "Config" ); 266 ConfigDlg* dlg = new ConfigDlg( this, "Config" );
267 dlg -> setConfig( m_config ); 267 dlg -> setConfig( m_config );
268 dlg -> showMaximized(); 268 dlg -> showMaximized();
269 if ( dlg -> exec() ) { 269 if ( dlg -> exec() ) {
270 qWarning ("Config Dialog accepted !"); 270 qWarning ("Config Dialog accepted !");
271 m_config = dlg -> getConfig(); 271 m_config = dlg -> getConfig();
272 if ( m_curFontSize != m_config.fontSize() ){ 272 if ( m_curFontSize != m_config.fontSize() ){
273 qWarning("Font was changed!"); 273 qWarning("Font was changed!");
274 m_curFontSize = m_config.fontSize(); 274 m_curFontSize = m_config.fontSize();
275 emit slotSetFont( m_curFontSize ); 275 emit slotSetFont( m_curFontSize );
276 } 276 }
277 m_abView -> setListOrder( m_config.orderList() ); 277 m_abView -> setListOrder( m_config.orderList() );
278 } 278 }
279 279
280 delete dlg; 280 delete dlg;
281} 281}
282 282
283 283
284void AddressbookWindow::slotSetFont( int size ) 284void AddressbookWindow::slotSetFont( int size )
285{ 285{
286 qWarning("void AddressbookWindow::slotSetFont( %d )", size); 286 qWarning("void AddressbookWindow::slotSetFont( %d )", size);
287 287
288 if (size > 2 || size < 0) 288 if (size > 2 || size < 0)
289 size = 1; 289 size = 1;
290 290
291 m_config.setFontSize( size ); 291 m_config.setFontSize( size );
292 292
293 QFont *currentFont; 293 QFont *currentFont;
294 294
295 switch (size) { 295 switch (size) {
296 case 0: 296 case 0:
297 m_abView->setFont( QFont( defaultFont->family(), defaultFont->pointSize() - 2 ) ); 297 m_abView->setFont( QFont( defaultFont->family(), defaultFont->pointSize() - 2 ) );
298 currentFont = new QFont (m_abView->font()); 298 currentFont = new QFont (m_abView->font());
299 // abList->resizeRows(currentFont->pixelSize() + 7); :SX 299 // abList->resizeRows(currentFont->pixelSize() + 7); :SX
300 // abList->resizeRows(); 300 // abList->resizeRows();
301 break; 301 break;
302 case 1: 302 case 1:
303 m_abView->setFont( *defaultFont ); 303 m_abView->setFont( *defaultFont );
304 currentFont = new QFont (m_abView->font()); 304 currentFont = new QFont (m_abView->font());
305 // // abList->resizeRows(currentFont->pixelSize() + 7); 305 // // abList->resizeRows(currentFont->pixelSize() + 7);
306 // abList->resizeRows(); 306 // abList->resizeRows();
307 break; 307 break;
308 case 2: 308 case 2:
309 m_abView->setFont( QFont( defaultFont->family(), defaultFont->pointSize() + 2 ) ); 309 m_abView->setFont( QFont( defaultFont->family(), defaultFont->pointSize() + 2 ) );
310 currentFont = new QFont (m_abView->font()); 310 currentFont = new QFont (m_abView->font());
311 // //abList->resizeRows(currentFont->pixelSize() + 7); 311 // //abList->resizeRows(currentFont->pixelSize() + 7);
312 // abList->resizeRows(); 312 // abList->resizeRows();
313 break; 313 break;
314 } 314 }
315} 315}
316 316
317 317
318 318
319void AddressbookWindow::importvCard() { 319void AddressbookWindow::importvCard() {
320 QString str = OFileDialog::getOpenFileName( 1,"/");//,"", "*", this ); 320 QString str = OFileDialog::getOpenFileName( 1,"/");//,"", "*", this );
321 if(!str.isEmpty() ){ 321 if(!str.isEmpty() ){
322 setDocument((const QString&) str ); 322 setDocument((const QString&) str );
323 } 323 }
324 324
325} 325}
326 326
327void AddressbookWindow::setDocument( const QString &filename ) 327void AddressbookWindow::setDocument( const QString &filename )
328{ 328{
329 qWarning( "void AddressbookWindow::setDocument( %s )", filename.latin1() ); 329 qWarning( "void AddressbookWindow::setDocument( %s )", filename.latin1() );
330 330
331 if ( filename.find(".vcf") != int(filename.length()) - 4 ){ 331 if ( filename.find(".vcf") != int(filename.length()) - 4 ){
332 332
333 333
334 334
335 switch( QMessageBox::information( this, tr ( "Right file type ?" ), 335 switch( QMessageBox::information( this, tr ( "Right file type ?" ),
336 tr( "The selected file \n does not end with \".vcf\".\n Do you really want to open it?" ), 336 tr( "The selected file \n does not end with \".vcf\".\n Do you really want to open it?" ),
337 tr( "&Yes" ), tr( "&No" ), QString::null, 337 tr( "&Yes" ), tr( "&No" ), QString::null,
338 0, // Enter == button 0 338 0, // Enter == button 0
339 2 ) ) { // Escape == button 2 339 2 ) ) { // Escape == button 2
340 case 0: 340 case 0:
341 qWarning("YES clicked"); 341 qWarning("YES clicked");
342 break; 342 break;
343 case 1: 343 case 1:
344 qWarning("NO clicked"); 344 qWarning("NO clicked");
345 return; 345 return;
346 break; 346 break;
347 } 347 }
348 } 348 }
349 349
350 OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, 350 OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null,
351 filename ); 351 filename );
352 OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); 352 OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true );
353 OContactAccess::List allList = access->allRecords(); 353 OContactAccess::List allList = access->allRecords();
354 354
355 OContactAccess::List::Iterator it; 355 OContactAccess::List::Iterator it;
356 for ( it = allList.begin(); it != allList.end(); ++it ){ 356 for ( it = allList.begin(); it != allList.end(); ++it ){
357 m_abView->addEntry( *it ); 357 m_abView->addEntry( *it );
358 } 358 }
359 359
360 delete access; 360 delete access;
361} 361}
362 362
363void AddressbookWindow::resizeEvent( QResizeEvent *e ) 363void AddressbookWindow::resizeEvent( QResizeEvent *e )
364{ 364{
365 QMainWindow::resizeEvent( e ); 365 QMainWindow::resizeEvent( e );
366 366
367 367
368} 368}
369 369
370AddressbookWindow::~AddressbookWindow() 370AddressbookWindow::~AddressbookWindow()
371{ 371{
372 ToolBarDock dock; 372 ToolBarDock dock;
373 int dummy; 373 int dummy;
374 bool bDummy; 374 bool bDummy;
375 getLocation ( listTools, dock, dummy, bDummy, dummy ); 375 getLocation ( listTools, dock, dummy, bDummy, dummy );
376 m_config.setToolBarDock( dock ); 376 m_config.setToolBarDock( dock );
377 m_config.save(); 377 m_config.save();
378} 378}
379 379
380void AddressbookWindow::slotUpdateToolbar() 380void AddressbookWindow::slotUpdateToolbar()
381{ 381{
382 OContact ce = m_abView->currentEntry(); 382 OContact ce = m_abView->currentEntry();
383 actionMail->setEnabled( !ce.defaultEmail().isEmpty() ); 383 actionMail->setEnabled( !ce.defaultEmail().isEmpty() );
384} 384}
385 385
386void AddressbookWindow::slotListNew() 386void AddressbookWindow::slotListNew()
387{ 387{
388 OContact cnt; 388 OContact cnt;
389 if( !syncing ) { 389 if( !syncing ) {
390 editEntry( NewEntry ); 390 editEntry( NewEntry );
391 } else { 391 } else {
392 QMessageBox::warning(this, tr("OContacts"), 392 QMessageBox::warning(this, tr("OContacts"),
393 tr("Can not edit data, currently syncing")); 393 tr("Can not edit data, currently syncing"));
394 } 394 }
395} 395}
396 396
397// void AddressbookWindow::slotListView() 397// void AddressbookWindow::slotListView()
398// { 398// {
399 // m_abView -> init( abList->currentEntry() ); 399 // m_abView -> init( abList->currentEntry() );
400 // // :SX mView->sync(); 400 // // :SX mView->sync();
401 // //:SXshowView(); 401 // //:SXshowView();
402// } 402// }
403 403
404void AddressbookWindow::slotListDelete() 404void AddressbookWindow::slotListDelete()
405{ 405{
406 if(!syncing) { 406 if(!syncing) {
407 OContact tmpEntry = m_abView ->currentEntry(); 407 OContact tmpEntry = m_abView ->currentEntry();
408 408
409 // get a name, do the best we can... 409 // get a name, do the best we can...
410 QString strName = tmpEntry.fullName(); 410 QString strName = tmpEntry.fullName();
411 if ( strName.isEmpty() ) { 411 if ( strName.isEmpty() ) {
412 strName = tmpEntry.company(); 412 strName = tmpEntry.company();
413 if ( strName.isEmpty() ) 413 if ( strName.isEmpty() )
414 strName = "No Name"; 414 strName = "No Name";
415 } 415 }
416 416
417 417
418 if ( QPEMessageBox::confirmDelete( this, tr( "Contacts" ), 418 if ( QPEMessageBox::confirmDelete( this, tr( "Contacts" ),
419 strName ) ) { 419 strName ) ) {
420 m_abView->removeEntry( tmpEntry.uid() ); 420 m_abView->removeEntry( tmpEntry.uid() );
421 } 421 }
422 } else { 422 } else {
423 QMessageBox::warning( this, tr("Contacts"), 423 QMessageBox::warning( this, tr("Contacts"),
424 tr("Can not edit data, currently syncing") ); 424 tr("Can not edit data, currently syncing") );
425 } 425 }
426} 426}
427 427
428void AddressbookWindow::slotFindOpen() 428void AddressbookWindow::slotFindOpen()
429{ 429{
430 searchBar->show(); 430 searchBar->show();
431 m_abView -> inSearch(); 431 m_abView -> inSearch();
432 searchEdit->setFocus(); 432 searchEdit->setFocus();
433} 433}
434void AddressbookWindow::slotFindClose() 434void AddressbookWindow::slotFindClose()
435{ 435{
436 searchBar->hide(); 436 searchBar->hide();
437 m_abView -> offSearch(); 437 m_abView -> offSearch();
438 // m_abView->setFocus(); 438 // m_abView->setFocus();
439} 439}
440 440
441 441
442void AddressbookWindow::slotFind() 442void AddressbookWindow::slotFind()
443{ 443{
444 m_abView->slotDoFind( searchEdit->text(), m_config.beCaseSensitive(), m_config.useRegExp(), false); 444 m_abView->slotDoFind( searchEdit->text(), m_config.beCaseSensitive(), m_config.useRegExp(), false);
445 445
446 searchEdit->clearFocus(); 446 searchEdit->clearFocus();
447 // m_abView->setFocus(); 447 // m_abView->setFocus();
448 448
449} 449}
450 450
451void AddressbookWindow::slotViewBack() 451void AddressbookWindow::slotViewBack()
452{ 452{
453 // :SX showList(); 453 // :SX showList();
454} 454}
455 455
456void AddressbookWindow::slotViewEdit() 456void AddressbookWindow::slotViewEdit()
457{ 457{
458 if(!syncing) { 458 if(!syncing) {
459 if (actionPersonal->isOn()) { 459 if (actionPersonal->isOn()) {
460 editPersonal(); 460 editPersonal();
461 } else { 461 } else {
462 editEntry( EditEntry ); 462 editEntry( EditEntry );
463 } 463 }
464 } else { 464 } else {
465 QMessageBox::warning( this, tr("Contacts"), 465 QMessageBox::warning( this, tr("Contacts"),
466 tr("Can not edit data, currently syncing") ); 466 tr("Can not edit data, currently syncing") );
467 } 467 }
468} 468}
469 469
470 470
471 471
472void AddressbookWindow::writeMail() 472void AddressbookWindow::writeMail()
473{ 473{
474 OContact c = m_abView -> currentEntry(); 474 OContact c = m_abView -> currentEntry();
475 QString name = c.fileAs(); 475 QString name = c.fileAs();
476 QString email = c.defaultEmail(); 476 QString email = c.defaultEmail();
477 477
478 // I prefer the OPIE-Environment variable before the 478 // I prefer the OPIE-Environment variable before the
479 // QPE-one.. 479 // QPE-one..
480 QString basepath = QString::fromLatin1( getenv("OPIEDIR") ); 480 QString basepath = QString::fromLatin1( getenv("OPIEDIR") );
481 if ( basepath.isEmpty() ) 481 if ( basepath.isEmpty() )
482 basepath = QString::fromLatin1( getenv("QPEDIR") ); 482 basepath = QString::fromLatin1( getenv("QPEDIR") );
483 483
484 // Try to access the preferred. If not possible, try to 484 // Try to access the preferred. If not possible, try to
485 // switch to the other one.. 485 // switch to the other one..
486 if ( m_config.useQtMail() ){ 486 if ( m_config.useQtMail() ){
487 qWarning ("Accessing: %s", (basepath + "/bin/qtmail").latin1()); 487 qWarning ("Accessing: %s", (basepath + "/bin/qtmail").latin1());
488 if ( QFile::exists( basepath + "/bin/qtmail" ) ){ 488 if ( QFile::exists( basepath + "/bin/qtmail" ) ){
489 qWarning ("QCop"); 489 qWarning ("QCop");
490 QCopEnvelope e("QPE/Application/qtmail", "writeMail(QString,QString)"); 490 QCopEnvelope e("QPE/Application/qtmail", "writeMail(QString,QString)");
491 e << name << email; 491 e << name << email;
492 return; 492 return;
493 } else 493 } else
494 m_config.setUseOpieMail( true ); 494 m_config.setUseOpieMail( true );
495 } 495 }
496 if ( m_config.useOpieMail() ){ 496 if ( m_config.useOpieMail() ){
497 qWarning ("Accessing: %s", (basepath + "/bin/mail").latin1()); 497 qWarning ("Accessing: %s", (basepath + "/bin/mail").latin1());
498 if ( QFile::exists( basepath + "/bin/mail" ) ){ 498 if ( QFile::exists( basepath + "/bin/mail" ) ){
499 qWarning ("QCop"); 499 qWarning ("QCop");
500 QCopEnvelope e("QPE/Application/mail", "writeMail(QString,QString)"); 500 QCopEnvelope e("QPE/Application/mail", "writeMail(QString,QString)");
501 e << name << email; 501 e << name << email;
502 return; 502 return;
503 } else 503 } else
504 m_config.setUseQtMail( true ); 504 m_config.setUseQtMail( true );
505 } 505 }
506 506
507} 507}
508 508
509static const char * beamfile = "/tmp/obex/contact.vcf"; 509static const char * beamfile = "/tmp/obex/contact.vcf";
510 510
511void AddressbookWindow::slotBeam() 511void AddressbookWindow::slotBeam()
512{ 512{
513 QString filename; 513 QString filename;
514 OContact c; 514 OContact c;
515 if ( actionPersonal->isOn() ) { 515 if ( actionPersonal->isOn() ) {
516 filename = addressbookPersonalVCardName(); 516 filename = addressbookPersonalVCardName();
517 if (!QFile::exists(filename)) 517 if (!QFile::exists(filename))
518 return; // can't beam a non-existent file 518 return; // can't beam a non-existent file
519 OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, 519 OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null,
520 filename ); 520 filename );
521 OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); 521 OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true );
522 OContactAccess::List allList = access->allRecords(); 522 OContactAccess::List allList = access->allRecords();
523 OContactAccess::List::Iterator it = allList.begin(); // Just take first 523 OContactAccess::List::Iterator it = allList.begin(); // Just take first
524 c = *it; 524 c = *it;
525 525
526 delete access; 526 delete access;
527 } else { 527 } else {
528 unlink( beamfile ); // delete if exists 528 unlink( beamfile ); // delete if exists
529 mkdir("/tmp/obex/", 0755); 529 mkdir("/tmp/obex/", 0755);
530 c = m_abView -> currentEntry(); 530 c = m_abView -> currentEntry();
531 OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, 531 OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null,
532 beamfile ); 532 beamfile );
533 OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); 533 OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true );
534 access->add( c ); 534 access->add( c );
535 access->save(); 535 access->save();
536 delete access; 536 delete access;
537 537
538 filename = beamfile; 538 filename = beamfile;
539 } 539 }
540 540
541 541
542 Ir *ir = new Ir( this ); 542 Ir *ir = new Ir( this );
543 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); 543 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) );
544 QString description = c.fullName(); 544 QString description = c.fullName();
545 ir->send( filename, description, "text/x-vCard" ); 545 ir->send( filename, description, "text/x-vCard" );
546} 546}
547 547
548void AddressbookWindow::beamDone( Ir *ir ) 548void AddressbookWindow::beamDone( Ir *ir )
549{ 549{
550 delete ir; 550 delete ir;
551 unlink( beamfile ); 551 unlink( beamfile );
552} 552}
553 553
554 554
555static void parseName( const QString& name, QString *first, QString *middle, 555static void parseName( const QString& name, QString *first, QString *middle,
556 QString * last ) 556 QString * last )
557{ 557{
558 558
559 int comma = name.find ( "," ); 559 int comma = name.find ( "," );
560 QString rest; 560 QString rest;
561 if ( comma > 0 ) { 561 if ( comma > 0 ) {
562 *last = name.left( comma ); 562 *last = name.left( comma );
563 comma++; 563 comma++;
564 while ( comma < int(name.length()) && name[comma] == ' ' ) 564 while ( comma < int(name.length()) && name[comma] == ' ' )
565 comma++; 565 comma++;
566 rest = name.mid( comma ); 566 rest = name.mid( comma );
567 } else { 567 } else {
568 int space = name.findRev( ' ' ); 568 int space = name.findRev( ' ' );
569 *last = name.mid( space+1 ); 569 *last = name.mid( space+1 );
570 rest = name.left( space ); 570 rest = name.left( space );
571 } 571 }
572 int space = rest.find( ' ' ); 572 int space = rest.find( ' ' );
573 if ( space <= 0 ) { 573 if ( space <= 0 ) {
574 *first = rest; 574 *first = rest;
575 } else { 575 } else {
576 *first = rest.left( space ); 576 *first = rest.left( space );
577 *middle = rest.mid( space+1 ); 577 *middle = rest.mid( space+1 );
578 } 578 }
579 579
580} 580}
581 581
582 582
583void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data) 583void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data)
584{ 584{
585 if (msg == "editPersonal()") { 585 if (msg == "editPersonal()") {
586 editPersonal(); 586 editPersonal();
587 } else if (msg == "editPersonalAndClose()") { 587 } else if (msg == "editPersonalAndClose()") {
588 editPersonal(); 588 editPersonal();
589 close(); 589 close();
590 } else if ( msg == "addContact(QString,QString)" ) { 590 } else if ( msg == "addContact(QString,QString)" ) {
591 QDataStream stream(data,IO_ReadOnly); 591 QDataStream stream(data,IO_ReadOnly);
592 QString name, email; 592 QString name, email;
593 stream >> name >> email; 593 stream >> name >> email;
594 594
595 OContact cnt; 595 OContact cnt;
596 QString fn, mn, ln; 596 QString fn, mn, ln;
597 parseName( name, &fn, &mn, &ln ); 597 parseName( name, &fn, &mn, &ln );
598 // qDebug( " %s - %s - %s", fn.latin1(), mn.latin1(), ln.latin1() ); 598 // qDebug( " %s - %s - %s", fn.latin1(), mn.latin1(), ln.latin1() );
599 cnt.setFirstName( fn ); 599 cnt.setFirstName( fn );
600 cnt.setMiddleName( mn ); 600 cnt.setMiddleName( mn );
601 cnt.setLastName( ln ); 601 cnt.setLastName( ln );
602 cnt.insertEmails( email ); 602 cnt.insertEmails( email );
603 cnt.setDefaultEmail( email ); 603 cnt.setDefaultEmail( email );
604 cnt.setFileAs(); 604 cnt.setFileAs();
605 605
606 m_abView -> addEntry( cnt ); 606 m_abView -> addEntry( cnt );
607 607
608 // :SXm_abView()->init( cnt ); 608 // :SXm_abView()->init( cnt );
609 editEntry( EditEntry ); 609 editEntry( EditEntry );
610 610
611 611
612 612
613 } 613 }
614#if 0 614#if 0
615 else if (msg == "pickAddresses(QCString,QCString,QStringList,...)" ) { 615 else if (msg == "pickAddresses(QCString,QCString,QStringList,...)" ) {
616 QDataStream stream(data,IO_ReadOnly); 616 QDataStream stream(data,IO_ReadOnly);
617 QCString ch,m; 617 QCString ch,m;
618 QStringList types; 618 QStringList types;
619 stream >> ch >> m >> types; 619 stream >> ch >> m >> types;
620 AddressPicker picker(abList,this,0,TRUE); 620 AddressPicker picker(abList,this,0,TRUE);
621 picker.showMaximized(); 621 picker.showMaximized();
622 picker.setChoiceNames(types); 622 picker.setChoiceNames(types);
623 int i=0; 623 int i=0;
624 for (QStringList::ConstIterator it = types.begin(); it!=types.end(); ++it) { 624 for (QStringList::ConstIterator it = types.begin(); it!=types.end(); ++it) {
625 QStringList sel; 625 QStringList sel;
626 stream >> sel; 626 stream >> sel;
627 picker.setSelection(i++,sel); 627 picker.setSelection(i++,sel);
628 } 628 }
629 picker.showMaximized(); 629 picker.showMaximized();
630 picker.exec(); 630 picker.exec();
631 631
632 // ###### note: contacts may have been added - save here! 632 // ###### note: contacts may have been added - save here!
633 633
634 setCentralWidget(abList); 634 setCentralWidget(abList);
635 QCopEnvelope e(ch,m); 635 QCopEnvelope e(ch,m);
636 i=0; 636 i=0;
637 for (QStringList::ConstIterator it = types.begin(); it!=types.end(); ++it) { 637 for (QStringList::ConstIterator it = types.begin(); it!=types.end(); ++it) {
638 QStringList sel = picker.selection(i++); 638 QStringList sel = picker.selection(i++);
639 e << sel; 639 e << sel;
640 } 640 }
641 } 641 }
642#endif 642#endif
643 643
644} 644}
645 645
646void AddressbookWindow::editEntry( EntryMode entryMode ) 646void AddressbookWindow::editEntry( EntryMode entryMode )
647{ 647{
648 OContact entry; 648 OContact entry;
649 if ( !abEditor ) { 649 if ( !abEditor ) {
650 abEditor = new ContactEditor( entry, this, "editor" ); 650 abEditor = new ContactEditor( entry, this, "editor" );
651 } 651 }
652 if ( entryMode == EditEntry ) 652 if ( entryMode == EditEntry )
653 abEditor->setEntry( m_abView -> currentEntry() ); 653 abEditor->setEntry( m_abView -> currentEntry() );
654 else if ( entryMode == NewEntry ) 654 else if ( entryMode == NewEntry )
655 abEditor->setEntry( entry ); 655 abEditor->setEntry( entry );
656 // other things may chane the caption. 656 // other things may change the caption.
657 abEditor->setCaption( tr("Edit Address") ); 657 abEditor->setCaption( tr("Edit Address") );
658 658
659#if defined(Q_WS_QWS) || defined(_WS_QWS_) 659#if defined(Q_WS_QWS) || defined(_WS_QWS_)
660 abEditor->showMaximized(); 660 abEditor->showMaximized();
661#endif 661#endif
662 // fix the foxus... 662 // fix the foxus...
663 abEditor->setNameFocus(); 663 abEditor->setNameFocus();
664 if ( abEditor->exec() ) { 664 if ( abEditor->exec() ) {
665 setFocus(); 665 setFocus();
666 if ( entryMode == NewEntry ) { 666 if ( entryMode == NewEntry ) {
667 OContact insertEntry = abEditor->entry(); 667 OContact insertEntry = abEditor->entry();
668 insertEntry.assignUid(); 668 insertEntry.assignUid();
669 m_abView -> addEntry( insertEntry ); 669 m_abView -> addEntry( insertEntry );
670 } else { 670 } else {
671 OContact replEntry = abEditor->entry(); 671 OContact replEntry = abEditor->entry();
672 672
673 if ( !replEntry.isValidUid() ) 673 if ( !replEntry.isValidUid() )
674 replEntry.assignUid(); 674 replEntry.assignUid();
675 675
676 m_abView -> replaceEntry( replEntry ); 676 m_abView -> replaceEntry( replEntry );
677 } 677 }
678 } 678 }
679 // populateCategories(); 679 // populateCategories();
680 680
681} 681}
682 682
683void AddressbookWindow::editPersonal() 683void AddressbookWindow::editPersonal()
684{ 684{
685 OContact entry; 685 OContact entry;
686 if ( !abEditor ) { 686 if ( !abEditor ) {
687 abEditor = new ContactEditor( entry, this, "editor" ); 687 abEditor = new ContactEditor( entry, this, "editor" );
688 } 688 }
689 689
690 abEditor->setCaption(tr("Edit My Personal Details")); 690 abEditor->setCaption(tr("Edit My Personal Details"));
691 abEditor->setPersonalView( true ); 691 abEditor->setPersonalView( true );
692 editEntry( EditEntry ); 692 editEntry( EditEntry );
693 abEditor->setPersonalView( false ); 693 abEditor->setPersonalView( false );
694 694
695} 695}
696 696
697 697
698void AddressbookWindow::slotPersonalView() 698void AddressbookWindow::slotPersonalView()
699{ 699{
700 if (!actionPersonal->isOn()) { 700 if (!actionPersonal->isOn()) {
701 // we just turned it off 701 // we just turned it off
702 setCaption( tr("Contacts") ); 702 setCaption( tr("Contacts") );
703 actionNew->setEnabled(TRUE); 703 actionNew->setEnabled(TRUE);
704 actionTrash->setEnabled(TRUE); 704 actionTrash->setEnabled(TRUE);
705 actionFind->setEnabled(TRUE); 705 actionFind->setEnabled(TRUE);
706 actionMail->setEnabled(TRUE); 706 actionMail->setEnabled(TRUE);
707 // slotUpdateToolbar(); 707 // slotUpdateToolbar();
708 708
709 m_abView->showPersonal( false ); 709 m_abView->showPersonal( false );
710 710
711 return; 711 return;
712 } 712 }
713 713
714 // XXX need to disable some QActions. 714 // XXX need to disable some QActions.
715 actionNew->setEnabled(FALSE); 715 actionNew->setEnabled(FALSE);
716 actionTrash->setEnabled(FALSE); 716 actionTrash->setEnabled(FALSE);
717 actionFind->setEnabled(FALSE); 717 actionFind->setEnabled(FALSE);
718 actionMail->setEnabled(FALSE); 718 actionMail->setEnabled(FALSE);
719 719
720 setCaption( tr("Contacts - My Personal Details") ); 720 setCaption( tr("Contacts - My Personal Details") );
721 721
722 m_abView->showPersonal( true ); 722 m_abView->showPersonal( true );
723 723
724} 724}
725 725
726 726
727void AddressbookWindow::listIsEmpty( bool empty ) 727void AddressbookWindow::listIsEmpty( bool empty )
728{ 728{
729 if ( !empty ) { 729 if ( !empty ) {
730 deleteButton->setEnabled( TRUE ); 730 deleteButton->setEnabled( TRUE );
731 } 731 }
732} 732}
733 733
734void AddressbookWindow::reload() 734void AddressbookWindow::reload()
735{ 735{
736 syncing = FALSE; 736 syncing = FALSE;
737 m_abView->clear(); 737 m_abView->clear();
738 m_abView->reload(); 738 m_abView->reload();
739} 739}
740 740
741void AddressbookWindow::flush() 741void AddressbookWindow::flush()
742{ 742{
743 syncing = TRUE; 743 syncing = TRUE;
744 m_abView->save(); 744 m_abView->save();
745} 745}
746 746
747 747
748void AddressbookWindow::closeEvent( QCloseEvent *e ) 748void AddressbookWindow::closeEvent( QCloseEvent *e )
749{ 749{
750 750
751 if(syncing) { 751 if(syncing) {
752 /* shouldn't we save, I hear you say? well its already been set 752 /* shouldn't we save, I hear you say? well its already been set
753 so that an edit can not occur during a sync, and we flushed 753 so that an edit can not occur during a sync, and we flushed
754 at the start of the sync, so there is no need to save 754 at the start of the sync, so there is no need to save
755 Saving however itself would cause problems. */ 755 Saving however itself would cause problems. */
756 e->accept(); 756 e->accept();
757 return; 757 return;
758 } 758 }
759 //################## shouldn't always save 759 //################## shouldn't always save
760 // True, but the database handles this automatically ! (se) 760 // True, but the database handles this automatically ! (se)
761 if ( save() ) 761 if ( save() )
762 e->accept(); 762 e->accept();
763 else 763 else
764 e->ignore(); 764 e->ignore();
765} 765}
766 766
767/* 767/*
768 Returns TRUE if it is OK to exit 768 Returns TRUE if it is OK to exit
769*/ 769*/
770 770
771bool AddressbookWindow::save() 771bool AddressbookWindow::save()
772{ 772{
773 if ( !m_abView->save() ) { 773 if ( !m_abView->save() ) {
774 if ( QMessageBox::critical( 0, tr( "Out of space" ), 774 if ( QMessageBox::critical( 0, tr( "Out of space" ),
775 tr("Unable to save information.\n" 775 tr("Unable to save information.\n"
776 "Free up some space\n" 776 "Free up some space\n"
777 "and try again.\n" 777 "and try again.\n"
778 "\nQuit anyway?"), 778 "\nQuit anyway?"),
779 QMessageBox::Yes|QMessageBox::Escape, 779 QMessageBox::Yes|QMessageBox::Escape,
780 QMessageBox::No|QMessageBox::Default ) 780 QMessageBox::No|QMessageBox::Default )
781 != QMessageBox::No ) 781 != QMessageBox::No )
782 return TRUE; 782 return TRUE;
783 else 783 else
784 return FALSE; 784 return FALSE;
785 } 785 }
786 return TRUE; 786 return TRUE;
787} 787}
788 788
789#ifdef __DEBUG_RELEASE 789#ifdef __DEBUG_RELEASE
790void AddressbookWindow::slotSave() 790void AddressbookWindow::slotSave()
791{ 791{
792 save(); 792 save();
793} 793}
794#endif 794#endif
795 795
796 796
797void AddressbookWindow::slotNotFound() 797void AddressbookWindow::slotNotFound()
798{ 798{
799 qWarning("Got notfound signal !"); 799 qWarning("Got notfound signal !");
800 QMessageBox::information( this, tr( "Not Found" ), 800 QMessageBox::information( this, tr( "Not Found" ),
801 tr( "Unable to find a contact for this \n search pattern!" ) ); 801 tr( "Unable to find a contact for this \n search pattern!" ) );
802 802
803 803
804} 804}
805void AddressbookWindow::slotWrapAround() 805void AddressbookWindow::slotWrapAround()
806{ 806{
807 qWarning("Got wrap signal !"); 807 qWarning("Got wrap signal !");
808 // if ( doNotifyWrapAround ) 808 // if ( doNotifyWrapAround )
809 // QMessageBox::information( this, tr( "End of list" ), 809 // QMessageBox::information( this, tr( "End of list" ),
810 // tr( "End of list. Wrap around now...!" ) + "\n" ); 810 // tr( "End of list. Wrap around now...!" ) + "\n" );
811 811
812} 812}
813 813
814void AddressbookWindow::slotSetCategory( int c ) 814void AddressbookWindow::slotSetCategory( int c )
815{ 815{
816 qWarning( "void AddressbookWindow::slotSetCategory( %d ) from %d", c, catMenu->count() ); 816 qWarning( "void AddressbookWindow::slotSetCategory( %d ) from %d", c, catMenu->count() );
817 817
818 QString cat, book; 818 QString cat, book;
819 AbView::Views view = AbView::TableView; 819 AbView::Views view = AbView::TableView;
820 820
821 if ( c <= 0 ) 821 if ( c <= 0 )
822 return; 822 return;
823 823
824 // Switch view 824 // Switch view
825 if ( c < 3 ) 825 if ( c < 3 )
826 for ( unsigned int i = 1; i < 3; i++ ){ 826 for ( unsigned int i = 1; i < 3; i++ ){
827 if ( catMenu ) 827 if ( catMenu )
828 catMenu->setItemChecked( i, c == (int)i ); 828 catMenu->setItemChecked( i, c == (int)i );
829 } 829 }
830 else 830 else
831 // Checkmark Category Menu Item Selected 831 // Checkmark Category Menu Item Selected
832 for ( unsigned int i = 3; i < catMenu->count(); i++ ) 832 for ( unsigned int i = 3; i < catMenu->count(); i++ )
833 catMenu->setItemChecked( i, c == (int)i ); 833 catMenu->setItemChecked( i, c == (int)i );
834 834
835 // Now switch to the selected category 835 // Now switch to the selected category
836 for ( unsigned int i = 1; i < catMenu->count(); i++ ) { 836 for ( unsigned int i = 1; i < catMenu->count(); i++ ) {
837 if (catMenu->isItemChecked( i )) { 837 if (catMenu->isItemChecked( i )) {
838 if ( i == 1 ){ // default List view 838 if ( i == 1 ){ // default List view
839 book = QString::null; 839 book = QString::null;
840 view = AbView::TableView; 840 view = AbView::TableView;
841 }else if ( i == 2 ){ 841 }else if ( i == 2 ){
842 book = tr( "Cards" ); 842 book = tr( "Cards" );
843 view = AbView::CardView; 843 view = AbView::CardView;
844 // }else if ( i == 3 ){ 844 // }else if ( i == 3 ){
845 // book = tr( "Personal" ); 845 // book = tr( "Personal" );
846 // view = AbView:: PersonalView; 846 // view = AbView:: PersonalView;
847 }else if ( i == 3 ){ // default All Categories 847 }else if ( i == 3 ){ // default All Categories
848 cat = QString::null; 848 cat = QString::null;
849 }else if ( i == (unsigned int)catMenu->count() - 1 ){ // last menu option (seperator is counted, too) will be Unfiled 849 }else if ( i == (unsigned int)catMenu->count() - 1 ){ // last menu option (seperator is counted, too) will be Unfiled
850 cat = "Unfiled"; 850 cat = "Unfiled";
851 qWarning ("Unfiled selected!!!"); 851 qWarning ("Unfiled selected!!!");
852 }else{ 852 }else{
853 cat = m_abView->categories()[i - 4]; 853 cat = m_abView->categories()[i - 4];
854 } 854 }
855 } 855 }
856 } 856 }
857 857
858 // Switch to the selected View 858 // Switch to the selected View
859 slotViewSwitched( view ); 859 slotViewSwitched( view );
860 860
861 // Tell the view about the selected category 861 // Tell the view about the selected category
862 m_abView -> setShowByCategory( cat ); 862 m_abView -> setShowByCategory( cat );
863 863
864 if ( book.isEmpty() ) 864 if ( book.isEmpty() )
865 book = "List"; 865 book = "List";
866 if ( cat.isEmpty() ) 866 if ( cat.isEmpty() )
867 cat = "All"; 867 cat = "All";
868 868
869 setCaption( tr( "Contacts" ) + " - " + book + " - " + tr( cat ) ); 869 setCaption( tr( "Contacts" ) + " - " + book + " - " + tr( cat ) );
870} 870}
871 871
872void AddressbookWindow::slotViewSwitched( int view ) 872void AddressbookWindow::slotViewSwitched( int view )
873{ 873{
874 qWarning( "void AddressbookWindow::slotViewSwitched( %d )", view ); 874 qWarning( "void AddressbookWindow::slotViewSwitched( %d )", view );
875 int menu = 0; 875 int menu = 0;
876 876
877 // Switch to selected view 877 // Switch to selected view
878 switch ( view ){ 878 switch ( view ){
879 case AbView::TableView: 879 case AbView::TableView:
880 menu = 1; 880 menu = 1;
881 m_tableViewButton->setOn(true); 881 m_tableViewButton->setOn(true);
882 m_cardViewButton->setOn(false); 882 m_cardViewButton->setOn(false);
883 break; 883 break;
884 case AbView::CardView: 884 case AbView::CardView:
885 menu = 2; 885 menu = 2;
886 m_tableViewButton->setOn(false); 886 m_tableViewButton->setOn(false);
887 m_cardViewButton->setOn(true); 887 m_cardViewButton->setOn(true);
888 break; 888 break;
889 } 889 }
890 for ( unsigned int i = 1; i < 3; i++ ){ 890 for ( unsigned int i = 1; i < 3; i++ ){
891 if ( catMenu ) 891 if ( catMenu )
892 catMenu->setItemChecked( i, menu == (int)i ); 892 catMenu->setItemChecked( i, menu == (int)i );
893 } 893 }
894 894
895 // Tell the view about the selected view 895 // Tell the view about the selected view
896 m_abView -> setShowToView ( (AbView::Views) view ); 896 m_abView -> setShowToView ( (AbView::Views) view );
897 897
898} 898}
899 899
900 900
901void AddressbookWindow::slotListView() 901void AddressbookWindow::slotListView()
902{ 902{
903 slotViewSwitched( AbView::TableView ); 903 slotViewSwitched( AbView::TableView );
904} 904}
905 905
906void AddressbookWindow::slotCardView() 906void AddressbookWindow::slotCardView()
907{ 907{
908 slotViewSwitched( AbView::CardView ); 908 slotViewSwitched( AbView::CardView );
909} 909}
910 910
911void AddressbookWindow::slotSetLetter( char c ) { 911void AddressbookWindow::slotSetLetter( char c ) {
912 912
913 m_abView->setShowByLetter( c ); 913 m_abView->setShowByLetter( c );
914 914
915} 915}
916 916
917 917
918void AddressbookWindow::populateCategories() 918void AddressbookWindow::populateCategories()
919{ 919{
920 catMenu->clear(); 920 catMenu->clear();
921 921
922 int id, rememberId; 922 int id, rememberId;
923 id = 1; 923 id = 1;
924 rememberId = 0; 924 rememberId = 0;
925 925
926 catMenu->insertItem( Resource::loadPixmap( "datebook/weeklst" ), tr( "List" ), id++ ); 926 catMenu->insertItem( Resource::loadPixmap( "datebook/weeklst" ), tr( "List" ), id++ );
927 catMenu->insertItem( Resource::loadPixmap( "day" ), tr( "Cards" ), id++ ); 927 catMenu->insertItem( Resource::loadPixmap( "day" ), tr( "Cards" ), id++ );
928 // catMenu->insertItem( tr( "Personal" ), id++ ); 928 // catMenu->insertItem( tr( "Personal" ), id++ );
929 catMenu->insertSeparator(); 929 catMenu->insertSeparator();
930 930
931 catMenu->insertItem( tr( "All" ), id++ ); 931 catMenu->insertItem( tr( "All" ), id++ );
932 QStringList categories = m_abView->categories(); 932 QStringList categories = m_abView->categories();
933 categories.append( tr( "Unfiled" ) ); 933 categories.append( tr( "Unfiled" ) );
934 for ( QStringList::Iterator it = categories.begin(); 934 for ( QStringList::Iterator it = categories.begin();
935 it != categories.end(); ++it ) { 935 it != categories.end(); ++it ) {
936 catMenu->insertItem( *it, id ); 936 catMenu->insertItem( *it, id );
937 if ( *it == m_abView -> showCategory() ) 937 if ( *it == m_abView -> showCategory() )
938 rememberId = id; 938 rememberId = id;
939 ++id; 939 ++id;
940 } 940 }
941 941
942 942
943 if ( m_abView -> showCategory().isEmpty() ) { 943 if ( m_abView -> showCategory().isEmpty() ) {
944 slotSetCategory( 3 ); 944 slotSetCategory( 3 );
945 } 945 }
946 else { 946 else {
947 slotSetCategory( rememberId ); 947 slotSetCategory( rememberId );
948 } 948 }
949} 949}
950 950
diff --git a/core/pim/addressbook/configdlg_base.ui b/core/pim/addressbook/configdlg_base.ui
index 408bfa6..8ae2578 100644
--- a/core/pim/addressbook/configdlg_base.ui
+++ b/core/pim/addressbook/configdlg_base.ui
@@ -1,543 +1,547 @@
1<!DOCTYPE UI><UI> 1<!DOCTYPE UI><UI>
2<class>ConfigDlg_Base</class> 2<class>ConfigDlg_Base</class>
3<author>Stefan Eilers</author> 3<author>Stefan Eilers</author>
4<widget> 4<widget>
5 <class>QDialog</class> 5 <class>QDialog</class>
6 <property stdset="1"> 6 <property stdset="1">
7 <name>name</name> 7 <name>name</name>
8 <cstring>Configuration</cstring> 8 <cstring>Configuration</cstring>
9 </property> 9 </property>
10 <property stdset="1"> 10 <property stdset="1">
11 <name>geometry</name> 11 <name>geometry</name>
12 <rect> 12 <rect>
13 <x>0</x> 13 <x>0</x>
14 <y>0</y> 14 <y>0</y>
15 <width>276</width> 15 <width>282</width>
16 <height>327</height> 16 <height>327</height>
17 </rect> 17 </rect>
18 </property> 18 </property>
19 <property stdset="1"> 19 <property stdset="1">
20 <name>sizePolicy</name> 20 <name>sizePolicy</name>
21 <sizepolicy> 21 <sizepolicy>
22 <hsizetype>5</hsizetype> 22 <hsizetype>5</hsizetype>
23 <vsizetype>5</vsizetype> 23 <vsizetype>5</vsizetype>
24 </sizepolicy> 24 </sizepolicy>
25 </property> 25 </property>
26 <property stdset="1"> 26 <property stdset="1">
27 <name>caption</name>
28 <string>Configuration</string>
29 </property>
30 <property stdset="1">
27 <name>sizeGripEnabled</name> 31 <name>sizeGripEnabled</name>
28 <bool>true</bool> 32 <bool>true</bool>
29 </property> 33 </property>
30 <property> 34 <property>
31 <name>layoutMargin</name> 35 <name>layoutMargin</name>
32 </property> 36 </property>
33 <vbox> 37 <vbox>
34 <property stdset="1"> 38 <property stdset="1">
35 <name>margin</name> 39 <name>margin</name>
36 <number>1</number> 40 <number>1</number>
37 </property> 41 </property>
38 <property stdset="1"> 42 <property stdset="1">
39 <name>spacing</name> 43 <name>spacing</name>
40 <number>6</number> 44 <number>6</number>
41 </property> 45 </property>
42 <widget> 46 <widget>
43 <class>QTabWidget</class> 47 <class>QTabWidget</class>
44 <property stdset="1"> 48 <property stdset="1">
45 <name>name</name> 49 <name>name</name>
46 <cstring>configDlg_base</cstring> 50 <cstring>configDlg_base</cstring>
47 </property> 51 </property>
48 <property stdset="1"> 52 <property stdset="1">
49 <name>sizePolicy</name> 53 <name>sizePolicy</name>
50 <sizepolicy> 54 <sizepolicy>
51 <hsizetype>7</hsizetype> 55 <hsizetype>7</hsizetype>
52 <vsizetype>7</vsizetype> 56 <vsizetype>7</vsizetype>
53 </sizepolicy> 57 </sizepolicy>
54 </property> 58 </property>
55 <property> 59 <property>
56 <name>layoutMargin</name> 60 <name>layoutMargin</name>
57 </property> 61 </property>
58 <property> 62 <property>
59 <name>layoutSpacing</name> 63 <name>layoutSpacing</name>
60 </property> 64 </property>
61 <widget> 65 <widget>
62 <class>QWidget</class> 66 <class>QWidget</class>
63 <property stdset="1"> 67 <property stdset="1">
64 <name>name</name> 68 <name>name</name>
65 <cstring>Widget5</cstring> 69 <cstring>Widget5</cstring>
66 </property> 70 </property>
67 <attribute> 71 <attribute>
68 <name>title</name> 72 <name>title</name>
69 <string>Misc</string> 73 <string>Misc</string>
70 </attribute> 74 </attribute>
71 <vbox> 75 <vbox>
72 <property stdset="1"> 76 <property stdset="1">
73 <name>margin</name> 77 <name>margin</name>
74 <number>5</number> 78 <number>5</number>
75 </property> 79 </property>
76 <property stdset="1"> 80 <property stdset="1">
77 <name>spacing</name> 81 <name>spacing</name>
78 <number>6</number> 82 <number>6</number>
79 </property> 83 </property>
80 <widget> 84 <widget>
81 <class>QGroupBox</class> 85 <class>QGroupBox</class>
82 <property stdset="1"> 86 <property stdset="1">
83 <name>name</name> 87 <name>name</name>
84 <cstring>GroupBox2</cstring> 88 <cstring>GroupBox2</cstring>
85 </property> 89 </property>
86 <property stdset="1"> 90 <property stdset="1">
87 <name>title</name> 91 <name>title</name>
88 <string>Search Settings</string> 92 <string>Search Settings</string>
89 </property> 93 </property>
90 <vbox> 94 <vbox>
91 <property stdset="1"> 95 <property stdset="1">
92 <name>margin</name> 96 <name>margin</name>
93 <number>11</number> 97 <number>11</number>
94 </property> 98 </property>
95 <property stdset="1"> 99 <property stdset="1">
96 <name>spacing</name> 100 <name>spacing</name>
97 <number>6</number> 101 <number>6</number>
98 </property> 102 </property>
99 <widget> 103 <widget>
100 <class>QButtonGroup</class> 104 <class>QButtonGroup</class>
101 <property stdset="1"> 105 <property stdset="1">
102 <name>name</name> 106 <name>name</name>
103 <cstring>ButtonGroup1</cstring> 107 <cstring>ButtonGroup1</cstring>
104 </property> 108 </property>
105 <property stdset="1"> 109 <property stdset="1">
106 <name>title</name> 110 <name>title</name>
107 <string>Query Style</string> 111 <string>Query Style</string>
108 </property> 112 </property>
109 <vbox> 113 <vbox>
110 <property stdset="1"> 114 <property stdset="1">
111 <name>margin</name> 115 <name>margin</name>
112 <number>11</number> 116 <number>11</number>
113 </property> 117 </property>
114 <property stdset="1"> 118 <property stdset="1">
115 <name>spacing</name> 119 <name>spacing</name>
116 <number>6</number> 120 <number>6</number>
117 </property> 121 </property>
118 <widget> 122 <widget>
119 <class>QRadioButton</class> 123 <class>QRadioButton</class>
120 <property stdset="1"> 124 <property stdset="1">
121 <name>name</name> 125 <name>name</name>
122 <cstring>m_useRegExp</cstring> 126 <cstring>m_useRegExp</cstring>
123 </property> 127 </property>
124 <property stdset="1"> 128 <property stdset="1">
125 <name>text</name> 129 <name>text</name>
126 <string>Use Regular Expressions</string> 130 <string>Use Regular Expressions</string>
127 </property> 131 </property>
128 </widget> 132 </widget>
129 <widget> 133 <widget>
130 <class>QRadioButton</class> 134 <class>QRadioButton</class>
131 <property stdset="1"> 135 <property stdset="1">
132 <name>name</name> 136 <name>name</name>
133 <cstring>m_useWildCard</cstring> 137 <cstring>m_useWildCard</cstring>
134 </property> 138 </property>
135 <property stdset="1"> 139 <property stdset="1">
136 <name>text</name> 140 <name>text</name>
137 <string>Use Wildcards (*,?)</string> 141 <string>Use Wildcards (*,?)</string>
138 </property> 142 </property>
139 <property stdset="1"> 143 <property stdset="1">
140 <name>checked</name> 144 <name>checked</name>
141 <bool>true</bool> 145 <bool>true</bool>
142 </property> 146 </property>
143 </widget> 147 </widget>
144 </vbox> 148 </vbox>
145 </widget> 149 </widget>
146 <widget> 150 <widget>
147 <class>QCheckBox</class> 151 <class>QCheckBox</class>
148 <property stdset="1"> 152 <property stdset="1">
149 <name>name</name> 153 <name>name</name>
150 <cstring>m_useCaseSensitive</cstring> 154 <cstring>m_useCaseSensitive</cstring>
151 </property> 155 </property>
152 <property stdset="1"> 156 <property stdset="1">
153 <name>text</name> 157 <name>text</name>
154 <string>Case Sensitive</string> 158 <string>Case Sensitive</string>
155 </property> 159 </property>
156 </widget> 160 </widget>
157 </vbox> 161 </vbox>
158 </widget> 162 </widget>
159 <widget> 163 <widget>
160 <class>QButtonGroup</class> 164 <class>QButtonGroup</class>
161 <property stdset="1"> 165 <property stdset="1">
162 <name>name</name> 166 <name>name</name>
163 <cstring>ButtonGroup3</cstring> 167 <cstring>ButtonGroup3</cstring>
164 </property> 168 </property>
165 <property stdset="1"> 169 <property stdset="1">
166 <name>title</name> 170 <name>title</name>
167 <string>Font</string> 171 <string>Font</string>
168 </property> 172 </property>
169 <hbox> 173 <hbox>
170 <property stdset="1"> 174 <property stdset="1">
171 <name>margin</name> 175 <name>margin</name>
172 <number>11</number> 176 <number>11</number>
173 </property> 177 </property>
174 <property stdset="1"> 178 <property stdset="1">
175 <name>spacing</name> 179 <name>spacing</name>
176 <number>6</number> 180 <number>6</number>
177 </property> 181 </property>
178 <widget> 182 <widget>
179 <class>QRadioButton</class> 183 <class>QRadioButton</class>
180 <property stdset="1"> 184 <property stdset="1">
181 <name>name</name> 185 <name>name</name>
182 <cstring>m_smallFont</cstring> 186 <cstring>m_smallFont</cstring>
183 </property> 187 </property>
184 <property stdset="1"> 188 <property stdset="1">
185 <name>text</name> 189 <name>text</name>
186 <string>Small</string> 190 <string>Small</string>
187 </property> 191 </property>
188 </widget> 192 </widget>
189 <widget> 193 <widget>
190 <class>QRadioButton</class> 194 <class>QRadioButton</class>
191 <property stdset="1"> 195 <property stdset="1">
192 <name>name</name> 196 <name>name</name>
193 <cstring>m_normalFont</cstring> 197 <cstring>m_normalFont</cstring>
194 </property> 198 </property>
195 <property stdset="1"> 199 <property stdset="1">
196 <name>text</name> 200 <name>text</name>
197 <string>Normal</string> 201 <string>Normal</string>
198 </property> 202 </property>
199 <property stdset="1"> 203 <property stdset="1">
200 <name>checked</name> 204 <name>checked</name>
201 <bool>true</bool> 205 <bool>true</bool>
202 </property> 206 </property>
203 </widget> 207 </widget>
204 <widget> 208 <widget>
205 <class>QRadioButton</class> 209 <class>QRadioButton</class>
206 <property stdset="1"> 210 <property stdset="1">
207 <name>name</name> 211 <name>name</name>
208 <cstring>m_largeFont</cstring> 212 <cstring>m_largeFont</cstring>
209 </property> 213 </property>
210 <property stdset="1"> 214 <property stdset="1">
211 <name>text</name> 215 <name>text</name>
212 <string>Large</string> 216 <string>Large</string>
213 </property> 217 </property>
214 </widget> 218 </widget>
215 </hbox> 219 </hbox>
216 </widget> 220 </widget>
217 <spacer> 221 <spacer>
218 <property> 222 <property>
219 <name>name</name> 223 <name>name</name>
220 <cstring>Spacer3</cstring> 224 <cstring>Spacer3</cstring>
221 </property> 225 </property>
222 <property stdset="1"> 226 <property stdset="1">
223 <name>orientation</name> 227 <name>orientation</name>
224 <enum>Vertical</enum> 228 <enum>Vertical</enum>
225 </property> 229 </property>
226 <property stdset="1"> 230 <property stdset="1">
227 <name>sizeType</name> 231 <name>sizeType</name>
228 <enum>Expanding</enum> 232 <enum>Expanding</enum>
229 </property> 233 </property>
230 <property> 234 <property>
231 <name>sizeHint</name> 235 <name>sizeHint</name>
232 <size> 236 <size>
233 <width>20</width> 237 <width>20</width>
234 <height>20</height> 238 <height>20</height>
235 </size> 239 </size>
236 </property> 240 </property>
237 </spacer> 241 </spacer>
238 </vbox> 242 </vbox>
239 </widget> 243 </widget>
240 <widget> 244 <widget>
241 <class>QWidget</class> 245 <class>QWidget</class>
242 <property stdset="1"> 246 <property stdset="1">
243 <name>name</name> 247 <name>name</name>
244 <cstring>tab</cstring> 248 <cstring>tab</cstring>
245 </property> 249 </property>
246 <attribute> 250 <attribute>
247 <name>title</name> 251 <name>title</name>
248 <string>Mail</string> 252 <string>Mail</string>
249 </attribute> 253 </attribute>
250 <vbox> 254 <vbox>
251 <property stdset="1"> 255 <property stdset="1">
252 <name>margin</name> 256 <name>margin</name>
253 <number>5</number> 257 <number>5</number>
254 </property> 258 </property>
255 <property stdset="1"> 259 <property stdset="1">
256 <name>spacing</name> 260 <name>spacing</name>
257 <number>6</number> 261 <number>6</number>
258 </property> 262 </property>
259 <widget> 263 <widget>
260 <class>QButtonGroup</class> 264 <class>QButtonGroup</class>
261 <property stdset="1"> 265 <property stdset="1">
262 <name>name</name> 266 <name>name</name>
263 <cstring>ButtonGroup2</cstring> 267 <cstring>ButtonGroup2</cstring>
264 </property> 268 </property>
265 <property stdset="1"> 269 <property stdset="1">
266 <name>title</name> 270 <name>title</name>
267 <string>Mail</string> 271 <string>Mail</string>
268 </property> 272 </property>
269 <vbox> 273 <vbox>
270 <property stdset="1"> 274 <property stdset="1">
271 <name>margin</name> 275 <name>margin</name>
272 <number>11</number> 276 <number>11</number>
273 </property> 277 </property>
274 <property stdset="1"> 278 <property stdset="1">
275 <name>spacing</name> 279 <name>spacing</name>
276 <number>6</number> 280 <number>6</number>
277 </property> 281 </property>
278 <widget> 282 <widget>
279 <class>QRadioButton</class> 283 <class>QRadioButton</class>
280 <property stdset="1"> 284 <property stdset="1">
281 <name>name</name> 285 <name>name</name>
282 <cstring>m_useQtMail</cstring> 286 <cstring>m_useQtMail</cstring>
283 </property> 287 </property>
284 <property stdset="1"> 288 <property stdset="1">
285 <name>text</name> 289 <name>text</name>
286 <string>Prefer QT-Mail </string> 290 <string>Prefer QT-Mail </string>
287 </property> 291 </property>
288 <property stdset="1"> 292 <property stdset="1">
289 <name>checked</name> 293 <name>checked</name>
290 <bool>true</bool> 294 <bool>true</bool>
291 </property> 295 </property>
292 </widget> 296 </widget>
293 <widget> 297 <widget>
294 <class>QRadioButton</class> 298 <class>QRadioButton</class>
295 <property stdset="1"> 299 <property stdset="1">
296 <name>name</name> 300 <name>name</name>
297 <cstring>m_useOpieMail</cstring> 301 <cstring>m_useOpieMail</cstring>
298 </property> 302 </property>
299 <property stdset="1"> 303 <property stdset="1">
300 <name>text</name> 304 <name>text</name>
301 <string>Prefer Opie-Mail</string> 305 <string>Prefer Opie-Mail</string>
302 </property> 306 </property>
303 </widget> 307 </widget>
304 <widget> 308 <widget>
305 <class>QLabel</class> 309 <class>QLabel</class>
306 <property stdset="1"> 310 <property stdset="1">
307 <name>name</name> 311 <name>name</name>
308 <cstring>TextLabel1</cstring> 312 <cstring>TextLabel1</cstring>
309 </property> 313 </property>
310 <property stdset="1"> 314 <property stdset="1">
311 <name>text</name> 315 <name>text</name>
312 <string>Notice: QT-Mail is just 316 <string>Notice: QT-Mail is just
313provided in the SHARP 317provided in the SHARP
314default ROM. Opie-Mail 318default ROM. Opie-Mail
315is provided free !</string> 319is provided free !</string>
316 </property> 320 </property>
317 </widget> 321 </widget>
318 </vbox> 322 </vbox>
319 </widget> 323 </widget>
320 <spacer> 324 <spacer>
321 <property> 325 <property>
322 <name>name</name> 326 <name>name</name>
323 <cstring>Spacer2</cstring> 327 <cstring>Spacer2</cstring>
324 </property> 328 </property>
325 <property stdset="1"> 329 <property stdset="1">
326 <name>orientation</name> 330 <name>orientation</name>
327 <enum>Vertical</enum> 331 <enum>Vertical</enum>
328 </property> 332 </property>
329 <property stdset="1"> 333 <property stdset="1">
330 <name>sizeType</name> 334 <name>sizeType</name>
331 <enum>Expanding</enum> 335 <enum>Expanding</enum>
332 </property> 336 </property>
333 <property> 337 <property>
334 <name>sizeHint</name> 338 <name>sizeHint</name>
335 <size> 339 <size>
336 <width>20</width> 340 <width>20</width>
337 <height>20</height> 341 <height>20</height>
338 </size> 342 </size>
339 </property> 343 </property>
340 </spacer> 344 </spacer>
341 </vbox> 345 </vbox>
342 </widget> 346 </widget>
343 <widget> 347 <widget>
344 <class>QWidget</class> 348 <class>QWidget</class>
345 <property stdset="1"> 349 <property stdset="1">
346 <name>name</name> 350 <name>name</name>
347 <cstring>tab</cstring> 351 <cstring>tab</cstring>
348 </property> 352 </property>
349 <attribute> 353 <attribute>
350 <name>title</name> 354 <name>title</name>
351 <string>Order</string> 355 <string>Order</string>
352 </attribute> 356 </attribute>
353 <vbox> 357 <vbox>
354 <property stdset="1"> 358 <property stdset="1">
355 <name>margin</name> 359 <name>margin</name>
356 <number>-1</number> 360 <number>2</number>
357 </property> 361 </property>
358 <property stdset="1"> 362 <property stdset="1">
359 <name>spacing</name> 363 <name>spacing</name>
360 <number>-1</number> 364 <number>2</number>
361 </property> 365 </property>
362 <widget> 366 <widget>
363 <class>QGroupBox</class> 367 <class>QGroupBox</class>
364 <property stdset="1"> 368 <property stdset="1">
365 <name>name</name> 369 <name>name</name>
366 <cstring>GroupBox9</cstring> 370 <cstring>GroupBox9</cstring>
367 </property> 371 </property>
368 <property stdset="1"> 372 <property stdset="1">
369 <name>title</name> 373 <name>title</name>
370 <string>Select Contact Order:</string> 374 <string>Select Contact Order:</string>
371 </property> 375 </property>
372 <grid> 376 <grid>
373 <property stdset="1"> 377 <property stdset="1">
374 <name>margin</name> 378 <name>margin</name>
375 <number>11</number> 379 <number>11</number>
376 </property> 380 </property>
377 <property stdset="1"> 381 <property stdset="1">
378 <name>spacing</name> 382 <name>spacing</name>
379 <number>6</number> 383 <number>6</number>
380 </property> 384 </property>
381 <widget row="0" column="2" > 385 <widget row="0" column="2" >
382 <class>QPushButton</class> 386 <class>QPushButton</class>
383 <property stdset="1"> 387 <property stdset="1">
384 <name>name</name> 388 <name>name</name>
385 <cstring>m_upButton</cstring> 389 <cstring>m_upButton</cstring>
386 </property> 390 </property>
387 <property stdset="1"> 391 <property stdset="1">
388 <name>sizePolicy</name> 392 <name>sizePolicy</name>
389 <sizepolicy> 393 <sizepolicy>
390 <hsizetype>1</hsizetype> 394 <hsizetype>1</hsizetype>
391 <vsizetype>0</vsizetype> 395 <vsizetype>0</vsizetype>
392 </sizepolicy> 396 </sizepolicy>
393 </property> 397 </property>
394 <property stdset="1"> 398 <property stdset="1">
395 <name>text</name> 399 <name>text</name>
396 <string>Up</string> 400 <string>Up</string>
397 </property> 401 </property>
398 <property stdset="1"> 402 <property stdset="1">
399 <name>autoRepeat</name> 403 <name>autoRepeat</name>
400 <bool>true</bool> 404 <bool>true</bool>
401 </property> 405 </property>
402 </widget> 406 </widget>
403 <widget row="1" column="2" > 407 <widget row="1" column="2" >
404 <class>QPushButton</class> 408 <class>QPushButton</class>
405 <property stdset="1"> 409 <property stdset="1">
406 <name>name</name> 410 <name>name</name>
407 <cstring>m_downButton</cstring> 411 <cstring>m_downButton</cstring>
408 </property> 412 </property>
409 <property stdset="1"> 413 <property stdset="1">
410 <name>sizePolicy</name> 414 <name>sizePolicy</name>
411 <sizepolicy> 415 <sizepolicy>
412 <hsizetype>1</hsizetype> 416 <hsizetype>1</hsizetype>
413 <vsizetype>0</vsizetype> 417 <vsizetype>0</vsizetype>
414 </sizepolicy> 418 </sizepolicy>
415 </property> 419 </property>
416 <property stdset="1"> 420 <property stdset="1">
417 <name>text</name> 421 <name>text</name>
418 <string>Down</string> 422 <string>Down</string>
419 </property> 423 </property>
420 <property stdset="1"> 424 <property stdset="1">
421 <name>autoRepeat</name> 425 <name>autoRepeat</name>
422 <bool>true</bool> 426 <bool>true</bool>
423 </property> 427 </property>
424 </widget> 428 </widget>
425 <widget row="4" column="0" rowspan="1" colspan="2" > 429 <widget row="4" column="0" rowspan="1" colspan="2" >
426 <class>QListBox</class> 430 <class>QListBox</class>
427 <property stdset="1"> 431 <property stdset="1">
428 <name>name</name> 432 <name>name</name>
429 <cstring>allFieldListBox</cstring> 433 <cstring>allFieldListBox</cstring>
430 </property> 434 </property>
431 <property stdset="1"> 435 <property stdset="1">
432 <name>sizePolicy</name> 436 <name>sizePolicy</name>
433 <sizepolicy> 437 <sizepolicy>
434 <hsizetype>7</hsizetype> 438 <hsizetype>7</hsizetype>
435 <vsizetype>7</vsizetype> 439 <vsizetype>7</vsizetype>
436 </sizepolicy> 440 </sizepolicy>
437 </property> 441 </property>
438 </widget> 442 </widget>
439 <widget row="3" column="0" > 443 <widget row="3" column="0" >
440 <class>QPushButton</class> 444 <class>QPushButton</class>
441 <property stdset="1"> 445 <property stdset="1">
442 <name>name</name> 446 <name>name</name>
443 <cstring>m_addButton</cstring> 447 <cstring>m_addButton</cstring>
444 </property> 448 </property>
445 <property stdset="1"> 449 <property stdset="1">
446 <name>sizePolicy</name> 450 <name>sizePolicy</name>
447 <sizepolicy> 451 <sizepolicy>
448 <hsizetype>1</hsizetype> 452 <hsizetype>1</hsizetype>
449 <vsizetype>0</vsizetype> 453 <vsizetype>0</vsizetype>
450 </sizepolicy> 454 </sizepolicy>
451 </property> 455 </property>
452 <property stdset="1"> 456 <property stdset="1">
453 <name>text</name> 457 <name>text</name>
454 <string>Add</string> 458 <string>Add</string>
455 </property> 459 </property>
456 </widget> 460 </widget>
457 <widget row="3" column="1" > 461 <widget row="3" column="1" >
458 <class>QPushButton</class> 462 <class>QPushButton</class>
459 <property stdset="1"> 463 <property stdset="1">
460 <name>name</name> 464 <name>name</name>
461 <cstring>m_removeButton</cstring> 465 <cstring>m_removeButton</cstring>
462 </property> 466 </property>
463 <property stdset="1"> 467 <property stdset="1">
464 <name>sizePolicy</name> 468 <name>sizePolicy</name>
465 <sizepolicy> 469 <sizepolicy>
466 <hsizetype>1</hsizetype> 470 <hsizetype>1</hsizetype>
467 <vsizetype>0</vsizetype> 471 <vsizetype>0</vsizetype>
468 </sizepolicy> 472 </sizepolicy>
469 </property> 473 </property>
470 <property stdset="1"> 474 <property stdset="1">
471 <name>text</name> 475 <name>text</name>
472 <string>Remove</string> 476 <string>Remove</string>
473 </property> 477 </property>
474 </widget> 478 </widget>
475 <spacer row="2" column="2" > 479 <spacer row="2" column="2" >
476 <property> 480 <property>
477 <name>name</name> 481 <name>name</name>
478 <cstring>Spacer23</cstring> 482 <cstring>Spacer23</cstring>
479 </property> 483 </property>
480 <property stdset="1"> 484 <property stdset="1">
481 <name>orientation</name> 485 <name>orientation</name>
482 <enum>Vertical</enum> 486 <enum>Vertical</enum>
483 </property> 487 </property>
484 <property stdset="1"> 488 <property stdset="1">
485 <name>sizeType</name> 489 <name>sizeType</name>
486 <enum>Expanding</enum> 490 <enum>Expanding</enum>
487 </property> 491 </property>
488 <property> 492 <property>
489 <name>sizeHint</name> 493 <name>sizeHint</name>
490 <size> 494 <size>
491 <width>20</width> 495 <width>20</width>
492 <height>20</height> 496 <height>20</height>
493 </size> 497 </size>
494 </property> 498 </property>
495 </spacer> 499 </spacer>
496 <spacer row="3" column="2" rowspan="2" colspan="1" > 500 <spacer row="3" column="2" rowspan="2" colspan="1" >
497 <property> 501 <property>
498 <name>name</name> 502 <name>name</name>
499 <cstring>Spacer2_2</cstring> 503 <cstring>Spacer2_2</cstring>
500 </property> 504 </property>
501 <property stdset="1"> 505 <property stdset="1">
502 <name>orientation</name> 506 <name>orientation</name>
503 <enum>Vertical</enum> 507 <enum>Vertical</enum>
504 </property> 508 </property>
505 <property stdset="1"> 509 <property stdset="1">
506 <name>sizeType</name> 510 <name>sizeType</name>
507 <enum>Expanding</enum> 511 <enum>Expanding</enum>
508 </property> 512 </property>
509 <property> 513 <property>
510 <name>sizeHint</name> 514 <name>sizeHint</name>
511 <size> 515 <size>
512 <width>20</width> 516 <width>20</width>
513 <height>20</height> 517 <height>20</height>
514 </size> 518 </size>
515 </property> 519 </property>
516 </spacer> 520 </spacer>
517 <widget row="0" column="0" rowspan="3" colspan="2" > 521 <widget row="0" column="0" rowspan="3" colspan="2" >
518 <class>QListBox</class> 522 <class>QListBox</class>
519 <property stdset="1"> 523 <property stdset="1">
520 <name>name</name> 524 <name>name</name>
521 <cstring>fieldListBox</cstring> 525 <cstring>fieldListBox</cstring>
522 </property> 526 </property>
523 <property stdset="1"> 527 <property stdset="1">
524 <name>sizePolicy</name> 528 <name>sizePolicy</name>
525 <sizepolicy> 529 <sizepolicy>
526 <hsizetype>7</hsizetype> 530 <hsizetype>7</hsizetype>
527 <vsizetype>7</vsizetype> 531 <vsizetype>7</vsizetype>
528 </sizepolicy> 532 </sizepolicy>
529 </property> 533 </property>
530 </widget> 534 </widget>
531 </grid> 535 </grid>
532 </widget> 536 </widget>
533 </vbox> 537 </vbox>
534 </widget> 538 </widget>
535 </widget> 539 </widget>
536 </vbox> 540 </vbox>
537</widget> 541</widget>
538<tabstops> 542<tabstops>
539 <tabstop>configDlg_base</tabstop> 543 <tabstop>configDlg_base</tabstop>
540 <tabstop>m_useQtMail</tabstop> 544 <tabstop>m_useQtMail</tabstop>
541 <tabstop>m_useOpieMail</tabstop> 545 <tabstop>m_useOpieMail</tabstop>
542</tabstops> 546</tabstops>
543</UI> 547</UI>
diff --git a/core/pim/addressbook/ocontactfields.cpp b/core/pim/addressbook/ocontactfields.cpp
index 7823a9c..df57efa 100644
--- a/core/pim/addressbook/ocontactfields.cpp
+++ b/core/pim/addressbook/ocontactfields.cpp
@@ -1,283 +1,283 @@
1 1
2#include "ocontactfields.h" 2#include "ocontactfields.h"
3 3
4#include <qstringlist.h> 4#include <qstringlist.h>
5#include <qobject.h> 5#include <qobject.h>
6 6
7// We should use our own enum in the future .. 7// We should use our own enum in the future ..
8#include <qpe/recordfields.h> 8#include <qpe/recordfields.h>
9 9
10/*! 10/*!
11 \internal 11 \internal
12 Returns a list of details field names for a contact. 12 Returns a list of details field names for a contact.
13*/ 13*/
14QStringList OContactFields::untrdetailsfields( bool sorted ) 14QStringList OContactFields::untrdetailsfields( bool sorted )
15{ 15{
16 QStringList list; 16 QStringList list;
17 17
18 list.append( "Office" ); 18 list.append( "Office" );
19 list.append( "Profession" ); 19 list.append( "Profession" );
20 list.append( "Assistant" ); 20 list.append( "Assistant" );
21 list.append( "Manager" ); 21 list.append( "Manager" );
22 list.append( "Spouse" ); 22 list.append( "Spouse" );
23 list.append( "Gender" ); 23 list.append( "Gender" );
24 list.append( "Birthday" ); 24 list.append( "Birthday" );
25 list.append( "Anniversary" ); 25 list.append( "Anniversary" );
26 list.append( "Nickname" ); 26 list.append( "Nickname" );
27 list.append( "Children" ); 27 list.append( "Children" );
28 28
29 if (sorted) list.sort(); 29 if (sorted) list.sort();
30 30
31 return list; 31 return list;
32} 32}
33 33
34/*! 34/*!
35 \internal 35 \internal
36 Returns a translated list of phone field names for a contact. 36 Returns a translated list of phone field names for a contact.
37*/ 37*/
38QStringList OContactFields::trphonefields( bool sorted ) 38QStringList OContactFields::trphonefields( bool sorted )
39{ 39{
40 QStringList list; 40 QStringList list;
41 list.append( QObject::tr( "Business Phone" ) ); 41 list.append( QObject::tr( "Business Phone" ) );
42 list.append( QObject::tr( "Business Fax" ) ); 42 list.append( QObject::tr( "Business Fax" ) );
43 list.append( QObject::tr( "Business Mobile" ) ); 43 list.append( QObject::tr( "Business Mobile" ) );
44 44
45 list.append( QObject::tr( "Default Email" ) ); 45 // list.append( QObject::tr( "Default Email" ) );
46 list.append( QObject::tr( "Emails" ) ); 46 list.append( QObject::tr( "Emails" ) );
47 47
48 list.append( QObject::tr( "Home Phone" ) ); 48 list.append( QObject::tr( "Home Phone" ) );
49 list.append( QObject::tr( "Home Fax" ) ); 49 list.append( QObject::tr( "Home Fax" ) );
50 list.append( QObject::tr( "Home Mobile" ) ); 50 list.append( QObject::tr( "Home Mobile" ) );
51 51
52 if (sorted) list.sort(); 52 if (sorted) list.sort();
53 53
54 return list; 54 return list;
55} 55}
56 56
57 57
58/*! 58/*!
59 \internal 59 \internal
60 Returns a translated list of details field names for a contact. 60 Returns a translated list of details field names for a contact.
61*/ 61*/
62QStringList OContactFields::trdetailsfields( bool sorted ) 62QStringList OContactFields::trdetailsfields( bool sorted )
63{ 63{
64 QStringList list; 64 QStringList list;
65 65
66 list.append( QObject::tr( "Office" ) ); 66 list.append( QObject::tr( "Office" ) );
67 list.append( QObject::tr( "Profession" ) ); 67 list.append( QObject::tr( "Profession" ) );
68 list.append( QObject::tr( "Assistant" ) ); 68 list.append( QObject::tr( "Assistant" ) );
69 list.append( QObject::tr( "Manager" ) ); 69 list.append( QObject::tr( "Manager" ) );
70 70
71 list.append( QObject::tr( "Spouse" ) ); 71 list.append( QObject::tr( "Spouse" ) );
72 list.append( QObject::tr( "Gender" ) ); 72 list.append( QObject::tr( "Gender" ) );
73 list.append( QObject::tr( "Birthday" ) ); 73 list.append( QObject::tr( "Birthday" ) );
74 list.append( QObject::tr( "Anniversary" ) ); 74 list.append( QObject::tr( "Anniversary" ) );
75 list.append( QObject::tr( "Nickname" ) ); 75 list.append( QObject::tr( "Nickname" ) );
76 list.append( QObject::tr( "Children" ) ); 76 list.append( QObject::tr( "Children" ) );
77 77
78 if (sorted) list.sort(); 78 if (sorted) list.sort();
79 return list; 79 return list;
80} 80}
81 81
82 82
83/*! 83/*!
84 \internal 84 \internal
85 Returns a translated list of field names for a contact. 85 Returns a translated list of field names for a contact.
86*/ 86*/
87QStringList OContactFields::trfields( bool sorted ) 87QStringList OContactFields::trfields( bool sorted )
88{ 88{
89 QStringList list; 89 QStringList list;
90 90
91 list.append( QObject::tr( "Name Title") ); 91 list.append( QObject::tr( "Name Title") );
92 list.append( QObject::tr( "First Name" ) ); 92 list.append( QObject::tr( "First Name" ) );
93 list.append( QObject::tr( "Middle Name" ) ); 93 list.append( QObject::tr( "Middle Name" ) );
94 list.append( QObject::tr( "Last Name" ) ); 94 list.append( QObject::tr( "Last Name" ) );
95 list.append( QObject::tr( "Suffix" ) ); 95 list.append( QObject::tr( "Suffix" ) );
96 list.append( QObject::tr( "File As" ) ); 96 list.append( QObject::tr( "File As" ) );
97 97
98 list.append( QObject::tr( "Job Title" ) ); 98 list.append( QObject::tr( "Job Title" ) );
99 list.append( QObject::tr( "Department" ) ); 99 list.append( QObject::tr( "Department" ) );
100 list.append( QObject::tr( "Company" ) ); 100 list.append( QObject::tr( "Company" ) );
101 101
102 list += trphonefields( sorted ); 102 list += trphonefields( sorted );
103 103
104 list.append( QObject::tr( "Business Street" ) ); 104 list.append( QObject::tr( "Business Street" ) );
105 list.append( QObject::tr( "Business City" ) ); 105 list.append( QObject::tr( "Business City" ) );
106 list.append( QObject::tr( "Business State" ) ); 106 list.append( QObject::tr( "Business State" ) );
107 list.append( QObject::tr( "Business Zip" ) ); 107 list.append( QObject::tr( "Business Zip" ) );
108 list.append( QObject::tr( "Business Country" ) ); 108 list.append( QObject::tr( "Business Country" ) );
109 list.append( QObject::tr( "Business Pager" ) ); 109 list.append( QObject::tr( "Business Pager" ) );
110 list.append( QObject::tr( "Business WebPage" ) ); 110 list.append( QObject::tr( "Business WebPage" ) );
111 111
112 list.append( QObject::tr( "Home Street" ) ); 112 list.append( QObject::tr( "Home Street" ) );
113 list.append( QObject::tr( "Home City" ) ); 113 list.append( QObject::tr( "Home City" ) );
114 list.append( QObject::tr( "Home State" ) ); 114 list.append( QObject::tr( "Home State" ) );
115 list.append( QObject::tr( "Home Zip" ) ); 115 list.append( QObject::tr( "Home Zip" ) );
116 list.append( QObject::tr( "Home Country" ) ); 116 list.append( QObject::tr( "Home Country" ) );
117 list.append( QObject::tr( "Home Web Page" ) ); 117 list.append( QObject::tr( "Home Web Page" ) );
118 118
119 list += trdetailsfields( sorted ); 119 list += trdetailsfields( sorted );
120 120
121 list.append( QObject::tr( "Notes" ) ); 121 list.append( QObject::tr( "Notes" ) );
122 list.append( QObject::tr( "Groups" ) ); 122 list.append( QObject::tr( "Groups" ) );
123 123
124 if (sorted) list.sort(); 124 if (sorted) list.sort();
125 125
126 return list; 126 return list;
127} 127}
128 128
129/*! 129/*!
130 \internal 130 \internal
131 Returns a list of phone field names for a contact. 131 Returns a list of phone field names for a contact.
132*/ 132*/
133QStringList OContactFields::untrphonefields( bool sorted ) 133QStringList OContactFields::untrphonefields( bool sorted )
134{ 134{
135 QStringList list; 135 QStringList list;
136 136
137 list.append( "Business Phone" ); 137 list.append( "Business Phone" );
138 list.append( "Business Fax" ); 138 list.append( "Business Fax" );
139 list.append( "Business Mobile" ); 139 list.append( "Business Mobile" );
140 140
141 list.append( "Default Email" ); 141 // list.append( "Default Email" );
142 list.append( "Emails" ); 142 list.append( "Emails" );
143 143
144 list.append( "Home Phone" ); 144 list.append( "Home Phone" );
145 list.append( "Home Fax" ); 145 list.append( "Home Fax" );
146 list.append( "Home Mobile" ); 146 list.append( "Home Mobile" );
147 147
148 if (sorted) list.sort(); 148 if (sorted) list.sort();
149 149
150 return list; 150 return list;
151} 151}
152 152
153/*! 153/*!
154 \internal 154 \internal
155 Returns an untranslated list of field names for a contact. 155 Returns an untranslated list of field names for a contact.
156*/ 156*/
157QStringList OContactFields::untrfields( bool sorted ) 157QStringList OContactFields::untrfields( bool sorted )
158{ 158{
159 QStringList list; 159 QStringList list;
160 160
161 list.append( "Name Title" ); 161 list.append( "Name Title" );
162 list.append( "First Name" ); 162 list.append( "First Name" );
163 list.append( "Middle Name" ); 163 list.append( "Middle Name" );
164 list.append( "Last Name" ); 164 list.append( "Last Name" );
165 list.append( "Suffix" ); 165 list.append( "Suffix" );
166 list.append( "File As" ); 166 list.append( "File As" );
167 167
168 list.append( "Job Title" ); 168 list.append( "Job Title" );
169 list.append( "Department" ); 169 list.append( "Department" );
170 list.append( "Company" ); 170 list.append( "Company" );
171 171
172 list += untrphonefields( sorted ); 172 list += untrphonefields( sorted );
173 173
174 list.append( "Business Street" ); 174 list.append( "Business Street" );
175 list.append( "Business City" ); 175 list.append( "Business City" );
176 list.append( "Business State" ); 176 list.append( "Business State" );
177 list.append( "Business Zip" ); 177 list.append( "Business Zip" );
178 list.append( "Business Country" ); 178 list.append( "Business Country" );
179 list.append( "Business Pager" ); 179 list.append( "Business Pager" );
180 list.append( "Business WebPage" ); 180 list.append( "Business WebPage" );
181 181
182 list.append( "Office" ); 182 list.append( "Office" );
183 list.append( "Profession" ); 183 list.append( "Profession" );
184 list.append( "Assistant" ); 184 list.append( "Assistant" );
185 list.append( "Manager" ); 185 list.append( "Manager" );
186 186
187 list.append( "Home Street" ); 187 list.append( "Home Street" );
188 list.append( "Home City" ); 188 list.append( "Home City" );
189 list.append( "Home State" ); 189 list.append( "Home State" );
190 list.append( "Home Zip" ); 190 list.append( "Home Zip" );
191 list.append( "Home Country" ); 191 list.append( "Home Country" );
192 list.append( "Home Web Page" ); 192 list.append( "Home Web Page" );
193 193
194 list.append( "Spouse" ); 194 list.append( "Spouse" );
195 list.append( "Gender" ); 195 list.append( "Gender" );
196 list.append( "Birthday" ); 196 list.append( "Birthday" );
197 list.append( "Anniversary" ); 197 list.append( "Anniversary" );
198 list.append( "Nickname" ); 198 list.append( "Nickname" );
199 list.append( "Children" ); 199 list.append( "Children" );
200 200
201 list.append( "Notes" ); 201 list.append( "Notes" );
202 list.append( "Groups" ); 202 list.append( "Groups" );
203 203
204 if (sorted) list.sort(); 204 if (sorted) list.sort();
205 205
206 return list; 206 return list;
207} 207}
208QMap<int, QString> OContactFields::idToTrFields() 208QMap<int, QString> OContactFields::idToTrFields()
209{ 209{
210 QMap<int, QString> ret_map; 210 QMap<int, QString> ret_map;
211 211
212 ret_map.insert( Qtopia::Title, QObject::tr( "Name Title") ); 212 ret_map.insert( Qtopia::Title, QObject::tr( "Name Title") );
213 ret_map.insert( Qtopia::FirstName, QObject::tr( "First Name" ) ); 213 ret_map.insert( Qtopia::FirstName, QObject::tr( "First Name" ) );
214 ret_map.insert( Qtopia::MiddleName, QObject::tr( "Middle Name" ) ); 214 ret_map.insert( Qtopia::MiddleName, QObject::tr( "Middle Name" ) );
215 ret_map.insert( Qtopia::LastName, QObject::tr( "Last Name" ) ); 215 ret_map.insert( Qtopia::LastName, QObject::tr( "Last Name" ) );
216 ret_map.insert( Qtopia::Suffix, QObject::tr( "Suffix" )); 216 ret_map.insert( Qtopia::Suffix, QObject::tr( "Suffix" ));
217 ret_map.insert( Qtopia::FileAs, QObject::tr( "File As" ) ); 217 ret_map.insert( Qtopia::FileAs, QObject::tr( "File As" ) );
218 218
219 ret_map.insert( Qtopia::JobTitle, QObject::tr( "Job Title" ) ); 219 ret_map.insert( Qtopia::JobTitle, QObject::tr( "Job Title" ) );
220 ret_map.insert( Qtopia::Department, QObject::tr( "Department" ) ); 220 ret_map.insert( Qtopia::Department, QObject::tr( "Department" ) );
221 ret_map.insert( Qtopia::Company, QObject::tr( "Company" ) ); 221 ret_map.insert( Qtopia::Company, QObject::tr( "Company" ) );
222 ret_map.insert( Qtopia::BusinessPhone, QObject::tr( "Business Phone" ) ); 222 ret_map.insert( Qtopia::BusinessPhone, QObject::tr( "Business Phone" ) );
223 ret_map.insert( Qtopia::BusinessFax, QObject::tr( "Business Fax" ) ); 223 ret_map.insert( Qtopia::BusinessFax, QObject::tr( "Business Fax" ) );
224 ret_map.insert( Qtopia::BusinessMobile, QObject::tr( "Business Mobile" )); 224 ret_map.insert( Qtopia::BusinessMobile, QObject::tr( "Business Mobile" ));
225 225
226 // email 226 // email
227 ret_map.insert( Qtopia::DefaultEmail, QObject::tr( "Default Email" ) ); 227 ret_map.insert( Qtopia::DefaultEmail, QObject::tr( "Default Email" ) );
228 ret_map.insert( Qtopia::Emails, QObject::tr( "Emails" ) ); 228 ret_map.insert( Qtopia::Emails, QObject::tr( "Emails" ) );
229 229
230 ret_map.insert( Qtopia::HomePhone, QObject::tr( "Home Phone" ) ); 230 ret_map.insert( Qtopia::HomePhone, QObject::tr( "Home Phone" ) );
231 ret_map.insert( Qtopia::HomeFax, QObject::tr( "Home Fax" ) ); 231 ret_map.insert( Qtopia::HomeFax, QObject::tr( "Home Fax" ) );
232 ret_map.insert( Qtopia::HomeMobile, QObject::tr( "Home Mobile" ) ); 232 ret_map.insert( Qtopia::HomeMobile, QObject::tr( "Home Mobile" ) );
233 233
234 // business 234 // business
235 ret_map.insert( Qtopia::BusinessStreet, QObject::tr( "Business Street" ) ); 235 ret_map.insert( Qtopia::BusinessStreet, QObject::tr( "Business Street" ) );
236 ret_map.insert( Qtopia::BusinessCity, QObject::tr( "Business City" ) ); 236 ret_map.insert( Qtopia::BusinessCity, QObject::tr( "Business City" ) );
237 ret_map.insert( Qtopia::BusinessState, QObject::tr( "Business State" ) ); 237 ret_map.insert( Qtopia::BusinessState, QObject::tr( "Business State" ) );
238 ret_map.insert( Qtopia::BusinessZip, QObject::tr( "Business Zip" ) ); 238 ret_map.insert( Qtopia::BusinessZip, QObject::tr( "Business Zip" ) );
239 ret_map.insert( Qtopia::BusinessCountry, QObject::tr( "Business Country" ) ); 239 ret_map.insert( Qtopia::BusinessCountry, QObject::tr( "Business Country" ) );
240 ret_map.insert( Qtopia::BusinessPager, QObject::tr( "Business Pager" ) ); 240 ret_map.insert( Qtopia::BusinessPager, QObject::tr( "Business Pager" ) );
241 ret_map.insert( Qtopia::BusinessWebPage, QObject::tr( "Business WebPage" ) ); 241 ret_map.insert( Qtopia::BusinessWebPage, QObject::tr( "Business WebPage" ) );
242 242
243 ret_map.insert( Qtopia::Office, QObject::tr( "Office" ) ); 243 ret_map.insert( Qtopia::Office, QObject::tr( "Office" ) );
244 ret_map.insert( Qtopia::Profession, QObject::tr( "Profession" ) ); 244 ret_map.insert( Qtopia::Profession, QObject::tr( "Profession" ) );
245 ret_map.insert( Qtopia::Assistant, QObject::tr( "Assistant" ) ); 245 ret_map.insert( Qtopia::Assistant, QObject::tr( "Assistant" ) );
246 ret_map.insert( Qtopia::Manager, QObject::tr( "Manager" ) ); 246 ret_map.insert( Qtopia::Manager, QObject::tr( "Manager" ) );
247 247
248 // home 248 // home
249 ret_map.insert( Qtopia::HomeStreet, QObject::tr( "Home Street" ) ); 249 ret_map.insert( Qtopia::HomeStreet, QObject::tr( "Home Street" ) );
250 ret_map.insert( Qtopia::HomeCity, QObject::tr( "Home City" ) ); 250 ret_map.insert( Qtopia::HomeCity, QObject::tr( "Home City" ) );
251 ret_map.insert( Qtopia::HomeState, QObject::tr( "Home State" ) ); 251 ret_map.insert( Qtopia::HomeState, QObject::tr( "Home State" ) );
252 ret_map.insert( Qtopia::HomeZip, QObject::tr( "Home Zip" ) ); 252 ret_map.insert( Qtopia::HomeZip, QObject::tr( "Home Zip" ) );
253 ret_map.insert( Qtopia::HomeCountry, QObject::tr( "Home Country" ) ); 253 ret_map.insert( Qtopia::HomeCountry, QObject::tr( "Home Country" ) );
254 ret_map.insert( Qtopia::HomeWebPage, QObject::tr( "Home Web Page" ) ); 254 ret_map.insert( Qtopia::HomeWebPage, QObject::tr( "Home Web Page" ) );
255 255
256 //personal 256 //personal
257 ret_map.insert( Qtopia::Spouse, QObject::tr( "Spouse" ) ); 257 ret_map.insert( Qtopia::Spouse, QObject::tr( "Spouse" ) );
258 ret_map.insert( Qtopia::Gender, QObject::tr( "Gender" ) ); 258 ret_map.insert( Qtopia::Gender, QObject::tr( "Gender" ) );
259 ret_map.insert( Qtopia::Birthday, QObject::tr( "Birthday" ) ); 259 ret_map.insert( Qtopia::Birthday, QObject::tr( "Birthday" ) );
260 ret_map.insert( Qtopia::Anniversary, QObject::tr( "Anniversary" ) ); 260 ret_map.insert( Qtopia::Anniversary, QObject::tr( "Anniversary" ) );
261 ret_map.insert( Qtopia::Nickname, QObject::tr( "Nickname" ) ); 261 ret_map.insert( Qtopia::Nickname, QObject::tr( "Nickname" ) );
262 ret_map.insert( Qtopia::Children, QObject::tr( "Children" ) ); 262 ret_map.insert( Qtopia::Children, QObject::tr( "Children" ) );
263 263
264 // other 264 // other
265 ret_map.insert( Qtopia::Notes, QObject::tr( "Notes" ) ); 265 ret_map.insert( Qtopia::Notes, QObject::tr( "Notes" ) );
266 266
267 267
268 return ret_map; 268 return ret_map;
269} 269}
270 270
271QMap<QString, int> OContactFields::trFieldsToId() 271QMap<QString, int> OContactFields::trFieldsToId()
272{ 272{
273 QMap<int, QString> idtostr = idToTrFields(); 273 QMap<int, QString> idtostr = idToTrFields();
274 QMap<QString, int> ret_map; 274 QMap<QString, int> ret_map;
275 275
276 276
277 QMap<int, QString>::Iterator it; 277 QMap<int, QString>::Iterator it;
278 for( it = idtostr.begin(); it != idtostr.end(); ++it ) 278 for( it = idtostr.begin(); it != idtostr.end(); ++it )
279 ret_map.insert( *it, it.key() ); 279 ret_map.insert( *it, it.key() );
280 280
281 281
282 return ret_map; 282 return ret_map;
283} 283}