summaryrefslogtreecommitdiff
authordrw <drw>2004-03-25 23:40:52 (UTC)
committer drw <drw>2004-03-25 23:40:52 (UTC)
commit98721c16aa480c4a160d3492462cb8f0de783268 (patch) (unidiff)
tree2be8dcd6cf985d98912cbb18e5d23e4b567396ff
parent03091cd727701bdb2aa6ac623cd606131546d686 (diff)
downloadopie-98721c16aa480c4a160d3492462cb8f0de783268.zip
opie-98721c16aa480c4a160d3492462cb8f0de783268.tar.gz
opie-98721c16aa480c4a160d3492462cb8f0de783268.tar.bz2
libopie -> libopie2
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/ablabel.cpp14
-rw-r--r--core/pim/addressbook/ablabel.h14
-rw-r--r--core/pim/addressbook/abtable.cpp85
-rw-r--r--core/pim/addressbook/abtable.h23
-rw-r--r--core/pim/addressbook/abview.cpp38
-rw-r--r--core/pim/addressbook/abview.h31
-rw-r--r--core/pim/addressbook/addressbook.cpp58
-rw-r--r--core/pim/addressbook/addressbook.pro2
-rw-r--r--core/pim/addressbook/config.in2
-rw-r--r--core/pim/addressbook/configdlg.cpp38
-rw-r--r--core/pim/addressbook/contacteditor.cpp327
-rw-r--r--core/pim/addressbook/contacteditor.h16
-rw-r--r--core/pim/addressbook/main.cpp4
-rw-r--r--core/pim/addressbook/opie-addressbook.control2
14 files changed, 328 insertions, 326 deletions
diff --git a/core/pim/addressbook/ablabel.cpp b/core/pim/addressbook/ablabel.cpp
index 076e2e0..70a66a0 100644
--- a/core/pim/addressbook/ablabel.cpp
+++ b/core/pim/addressbook/ablabel.cpp
@@ -1,144 +1,144 @@
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 23
24 24
25AbLabel::AbLabel( QWidget *parent, const char *name ): 25AbLabel::AbLabel( QWidget *parent, const char *name ):
26 QTextView( parent, name ), 26 QTextView( parent, name ),
27 m_empty( false ) 27 m_empty( false )
28{ 28{
29} 29}
30 30
31AbLabel::~AbLabel() 31AbLabel::~AbLabel()
32{ 32{
33} 33}
34 34
35void AbLabel::setContacts( const OContactAccess::List& viewList ) 35void AbLabel::setContacts( const Opie::OPimContactAccess::List& viewList )
36{ 36{
37 m_viewList = viewList; 37 m_viewList = viewList;
38 if (m_viewList.count() != 0){ 38 if (m_viewList.count() != 0){
39 m_empty = false; 39 m_empty = false;
40 m_itCurContact = m_viewList.begin(); 40 m_itCurContact = m_viewList.begin();
41 sync(); 41 sync();
42 }else{ 42 }else{
43 // m_itCurContact.clear(); 43 // m_itCurContact.clear();
44 m_empty = true; 44 m_empty = true;
45 setText( "" ); 45 setText( "" );
46 } 46 }
47} 47}
48 48
49int AbLabel::currentEntry_UID() 49int AbLabel::currentEntry_UID()
50{ 50{
51 OContact contact = currentEntry(); 51 Opie::OPimContact contact = currentEntry();
52 52
53 if ( contact.isEmpty() ) 53 if ( contact.isEmpty() )
54 return 0; 54 return 0;
55 else 55 else
56 return ( contact.uid() ); 56 return ( contact.uid() );
57} 57}
58 58
59OContact AbLabel::currentEntry() 59Opie::OPimContact AbLabel::currentEntry()
60{ 60{
61 if ( ! m_empty ) 61 if ( ! m_empty )
62 return ( *m_itCurContact ); 62 return ( *m_itCurContact );
63 else 63 else
64 return OContact(); 64 return Opie::OPimContact();
65} 65}
66 66
67 67
68bool AbLabel::selectContact( int UID ) 68bool AbLabel::selectContact( int UID )
69{ 69{
70 70
71 for ( int r = 0; r < m_viewList.count(); ++r ) { 71 for ( int r = 0; r < m_viewList.count(); ++r ) {
72 if ( m_viewList.uidAt( r ) == UID ){ 72 if ( m_viewList.uidAt( r ) == UID ){
73 m_itCurContact.setCurrent( r ); 73 m_itCurContact.setCurrent( r );
74 break; 74 break;
75 } 75 }
76 } 76 }
77 77
78 sync(); 78 sync();
79 79
80 return true; 80 return true;
81} 81}
82 82
83 83
84 84
85void AbLabel::sync() 85void AbLabel::sync()
86{ 86{
87 QString text = (*m_itCurContact).toRichText(); 87 QString text = (*m_itCurContact).toRichText();
88 setText( text ); 88 setText( text );
89} 89}
90 90
91void AbLabel::keyPressEvent( QKeyEvent *e ) 91void AbLabel::keyPressEvent( QKeyEvent *e )
92{ 92{
93 93
94 // Commonly handled keys 94 // Commonly handled keys
95 if ( !m_empty ){ 95 if ( !m_empty ){
96 switch( e->key() ) { 96 switch( e->key() ) {
97 case Qt::Key_Left: 97 case Qt::Key_Left:
98 qWarning( "Left.."); 98 qWarning( "Left..");
99 case Qt::Key_Right: 99 case Qt::Key_Right:
100 qWarning( "Right.."); 100 qWarning( "Right..");
101 case Qt::Key_F33: 101 case Qt::Key_F33:
102 qWarning( "OK.."); 102 qWarning( "OK..");
103 emit signalOkPressed(); 103 emit signalOkPressed();
104 break; 104 break;
105 case Qt::Key_Up: 105 case Qt::Key_Up:
106 qWarning( "UP.."); 106 qWarning( "UP..");
107 if ( ( visibleHeight() < contentsHeight() ) && 107 if ( ( visibleHeight() < contentsHeight() ) &&
108 ( verticalScrollBar()->value() > verticalScrollBar()->minValue() ) ) 108 ( verticalScrollBar()->value() > verticalScrollBar()->minValue() ) )
109 scrollBy( 0, -(visibleHeight()-20) ); 109 scrollBy( 0, -(visibleHeight()-20) );
110 else { 110 else {
111 --m_itCurContact; 111 --m_itCurContact;
112 if ( *m_itCurContact != OContact() ) 112 if ( *m_itCurContact != Opie::OPimContact() )
113 sync(); 113 sync();
114 else 114 else
115 m_itCurContact = m_viewList.end(); 115 m_itCurContact = m_viewList.end();
116 } 116 }
117 117
118 break; 118 break;
119 case Qt::Key_Down: 119 case Qt::Key_Down:
120 qWarning( "DOWN.."); 120 qWarning( "DOWN..");
121 // qWarning( "visible: %d, content: %d",visibleHeight(),contentsHeight()); 121 // qWarning( "visible: %d, content: %d",visibleHeight(),contentsHeight());
122 // qWarning( "value: %d; barMaxValue: %d", verticalScrollBar()->value() 122 // qWarning( "value: %d; barMaxValue: %d", verticalScrollBar()->value()
123 // , verticalScrollBar()->maxValue() ); 123 // , verticalScrollBar()->maxValue() );
124 if ( ( visibleHeight() < contentsHeight() ) && 124 if ( ( visibleHeight() < contentsHeight() ) &&
125 ( verticalScrollBar()->value() < verticalScrollBar()->maxValue() ) ) 125 ( verticalScrollBar()->value() < verticalScrollBar()->maxValue() ) )
126 scrollBy( 0, visibleHeight()-20 ); 126 scrollBy( 0, visibleHeight()-20 );
127 else { 127 else {
128 ++m_itCurContact; 128 ++m_itCurContact;
129 if ( *m_itCurContact != OContact() ) 129 if ( *m_itCurContact != Opie::OPimContact() )
130 sync(); 130 sync();
131 else 131 else
132 m_itCurContact = m_viewList.begin(); 132 m_itCurContact = m_viewList.begin();
133 } 133 }
134 break; 134 break;
135 case Qt::Key_Return: // fall through 135 case Qt::Key_Return: // fall through
136 case Qt::Key_Space: // fall through 136 case Qt::Key_Space: // fall through
137 case Qt::Key_Enter: // we want to switch back 137 case Qt::Key_Enter: // we want to switch back
138 emit signalOkPressed(); 138 emit signalOkPressed();
139 break; 139 break;
140 default: break; 140 default: break;
141 } 141 }
142 } 142 }
143 143
144} 144}
diff --git a/core/pim/addressbook/ablabel.h b/core/pim/addressbook/ablabel.h
index 80336dc..8d7f2ac 100644
--- a/core/pim/addressbook/ablabel.h
+++ b/core/pim/addressbook/ablabel.h
@@ -1,64 +1,64 @@
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#ifndef ABLABEL_H 20#ifndef ABLABEL_H
21#define ABLABEL_H 21#define ABLABEL_H
22 22
23#include <opie/ocontact.h> 23#include <opie2/opimcontact.h>
24#include <qtextview.h> 24#include <opie2/ocontactaccess.h>
25 25
26#include <opie/ocontactaccess.h> 26#include <qtextview.h>
27 27
28class AbLabel : public QTextView 28class AbLabel : public QTextView
29{ 29{
30 Q_OBJECT 30 Q_OBJECT
31 31
32public: 32public:
33 AbLabel( QWidget *parent, const char *name = 0 ); 33 AbLabel( QWidget *parent, const char *name = 0 );
34 ~AbLabel(); 34 ~AbLabel();
35 35
36 // Set the contacts 36 // Set the contacts
37 void setContacts( const OContactAccess::List& viewList ); 37 void setContacts( const Opie::OPimContactAccess::List& viewList );
38 38
39 // Selects a contact 39 // Selects a contact
40 bool selectContact( int UID ); 40 bool selectContact( int UID );
41 41
42 // Get the UID of the current selected Entry 42 // Get the UID of the current selected Entry
43 int currentEntry_UID(); 43 int currentEntry_UID();
44 44
45 // 45 //
46 OContact currentEntry(); 46 Opie::OPimContact currentEntry();
47 47
48signals: 48signals:
49 void signalOkPressed(); 49 void signalOkPressed();
50 50
51protected: 51protected:
52 void sync(); 52 void sync();
53 void keyPressEvent( QKeyEvent * ); 53 void keyPressEvent( QKeyEvent * );
54 54
55private: 55private:
56 OContactAccess::List m_viewList; 56 Opie::OPimContactAccess::List m_viewList;
57 OContactAccess::List::Iterator m_itCurContact; 57 Opie::OPimContactAccess::List::Iterator m_itCurContact;
58 58
59 bool m_empty; 59 bool m_empty;
60 60
61}; 61};
62 62
63#endif // ABLABEL_H 63#endif // ABLABEL_H
64 64
diff --git a/core/pim/addressbook/abtable.cpp b/core/pim/addressbook/abtable.cpp
index 29f4383..cd77b13 100644
--- a/core/pim/addressbook/abtable.cpp
+++ b/core/pim/addressbook/abtable.cpp
@@ -1,735 +1,734 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** Copyright (c) 2002 Stefan Eilers (eilers.stefan@epost.de) 3** Copyright (c) 2002 Stefan Eilers (eilers.stefan@epost.de)
4** 4**
5** This file is part of Qt Palmtop Environment. 5** This file is part of Qt Palmtop Environment.
6** 6**
7** This file may be distributed and/or modified under the terms of the 7** This file may be distributed and/or modified under the terms of the
8** GNU General Public License version 2 as published by the Free Software 8** GNU General Public License version 2 as published by the Free Software
9** Foundation and appearing in the file LICENSE.GPL included in the 9** Foundation and appearing in the file LICENSE.GPL included in the
10** packaging of this file. 10** packaging of this file.
11** 11**
12** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 12** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
13** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 13** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
14** 14**
15** See http://www.trolltech.com/gpl/ for GPL licensing information. 15** See http://www.trolltech.com/gpl/ for GPL licensing information.
16** 16**
17** Contact info@trolltech.com if any conditions of this licensing are 17** Contact info@trolltech.com if any conditions of this licensing are
18** not clear to you. 18** not clear to you.
19** 19**
20**********************************************************************/ 20**********************************************************************/
21 21
22 22
23#include <opie2/opimrecordlist.h>
24
23#include <qpe/timestring.h> 25#include <qpe/timestring.h>
24#include <qpe/resource.h> 26#include <qpe/resource.h>
25 27
26#include <opie/orecordlist.h>
27
28
29#include "abtable.h" 28#include "abtable.h"
30 29
31#include <errno.h> 30#include <errno.h>
32#include <fcntl.h> 31#include <fcntl.h>
33#include <unistd.h> 32#include <unistd.h>
34#include <stdlib.h> 33#include <stdlib.h>
35 34
36#include <ctype.h> //toupper() for key hack 35#include <ctype.h> //toupper() for key hack
37 36
38#if 0 37#if 0
39 38
40/*! 39/*!
41 \class AbTableItem abtable.h 40 \class AbTableItem abtable.h
42 41
43 \brief QTableItem based class for showing a field of an entry 42 \brief QTableItem based class for showing a field of an entry
44*/ 43*/
45 44
46AbTableItem::AbTableItem( QTable *t, EditType et, const QString &s, 45AbTableItem::AbTableItem( QTable *t, EditType et, const QString &s,
47 const QString &secondSortKey) 46 const QString &secondSortKey)
48 : QTableItem( t, et, s ) 47 : QTableItem( t, et, s )
49{ 48{
50 // sortKey = s.lower() + QChar( '\0' ) + secondSortKey.lower(); 49 // sortKey = s.lower() + QChar( '\0' ) + secondSortKey.lower();
51 sortKey = Qtopia::buildSortKey( s, secondSortKey ); 50 sortKey = Qtopia::buildSortKey( s, secondSortKey );
52} 51}
53 52
54int AbTableItem::alignment() const 53int AbTableItem::alignment() const
55{ 54{
56 return AlignLeft|AlignVCenter; 55 return AlignLeft|AlignVCenter;
57} 56}
58 57
59QString AbTableItem::key() const 58QString AbTableItem::key() const
60{ 59{
61 return sortKey; 60 return sortKey;
62} 61}
63 62
64// A way to reset the item, without out doing a delete or a new... 63// A way to reset the item, without out doing a delete or a new...
65void AbTableItem::setItem( const QString &txt, const QString &secondKey ) 64void AbTableItem::setItem( const QString &txt, const QString &secondKey )
66{ 65{
67 setText( txt ); 66 setText( txt );
68 sortKey = Qtopia::buildSortKey( txt, secondKey ); 67 sortKey = Qtopia::buildSortKey( txt, secondKey );
69 68
70 // sortKey = txt.lower() + QChar( '\0' ) + secondKey.lower(); 69 // sortKey = txt.lower() + QChar( '\0' ) + secondKey.lower();
71} 70}
72 71
73/*! 72/*!
74 \class AbPickItem abtable.h 73 \class AbPickItem abtable.h
75 74
76 \brief QTableItem based class for showing slection of an entry 75 \brief QTableItem based class for showing slection of an entry
77*/ 76*/
78 77
79AbPickItem::AbPickItem( QTable *t ) : 78AbPickItem::AbPickItem( QTable *t ) :
80 QTableItem(t, WhenCurrent, "?") 79 QTableItem(t, WhenCurrent, "?")
81{ 80{
82} 81}
83 82
84QWidget *AbPickItem::createEditor() const 83QWidget *AbPickItem::createEditor() const
85{ 84{
86 QComboBox* combo = new QComboBox( table()->viewport() ); 85 QComboBox* combo = new QComboBox( table()->viewport() );
87 ( (AbPickItem*)this )->cb = combo; 86 ( (AbPickItem*)this )->cb = combo;
88 AbTable* t = static_cast<AbTable*>(table()); 87 AbTable* t = static_cast<AbTable*>(table());
89 QStringList c = t->choiceNames(); 88 QStringList c = t->choiceNames();
90 int cur = 0; 89 int cur = 0;
91 for (QStringList::ConstIterator it = c.begin(); it!=c.end(); ++it) { 90 for (QStringList::ConstIterator it = c.begin(); it!=c.end(); ++it) {
92 if ( *it == text() ) 91 if ( *it == text() )
93 cur = combo->count(); 92 cur = combo->count();
94 combo->insertItem(*it); 93 combo->insertItem(*it);
95 } 94 }
96 combo->setCurrentItem(cur); 95 combo->setCurrentItem(cur);
97 return combo; 96 return combo;
98} 97}
99 98
100void AbPickItem::setContentFromEditor( QWidget *w ) 99void AbPickItem::setContentFromEditor( QWidget *w )
101{ 100{
102 if ( w->inherits("QComboBox") ) 101 if ( w->inherits("QComboBox") )
103 setText( ( (QComboBox*)w )->currentText() ); 102 setText( ( (QComboBox*)w )->currentText() );
104 else 103 else
105 QTableItem::setContentFromEditor( w ); 104 QTableItem::setContentFromEditor( w );
106} 105}
107 106
108#endif 107#endif
109 108
110/*! 109/*!
111 \class AbTable abtable.h 110 \class AbTable abtable.h
112 111
113 \brief QTable based class for showing a list of entries 112 \brief QTable based class for showing a list of entries
114*/ 113*/
115 114
116AbTable::AbTable( const QValueList<int> order, QWidget *parent, const char *name ) 115AbTable::AbTable( const QValueList<int> order, QWidget *parent, const char *name )
117 : QTable( parent, name ), 116 : QTable( parent, name ),
118 lastSortCol( -1 ), 117 lastSortCol( -1 ),
119 asc( TRUE ), 118 asc( TRUE ),
120 intFields( order ), 119 intFields( order ),
121 enablePainting( true ), 120 enablePainting( true ),
122 columnVisible( true ), 121 columnVisible( true ),
123 countNested( 0 ) 122 countNested( 0 )
124{ 123{
125 //qWarning("C'tor start"); 124 //qWarning("C'tor start");
126 125
127 setSelectionMode( NoSelection ); 126 setSelectionMode( NoSelection );
128 init(); 127 init();
129 setSorting( TRUE ); 128 setSorting( TRUE );
130 connect( this, SIGNAL(clicked(int,int,int,const QPoint&)), 129 connect( this, SIGNAL(clicked(int,int,int,const QPoint&)),
131 this, SLOT(itemClicked(int,int)) ); 130 this, SLOT(itemClicked(int,int)) );
132 131
133 // contactList.clear(); 132 // contactList.clear();
134 //qWarning("C'tor end"); 133 //qWarning("C'tor end");
135} 134}
136 135
137AbTable::~AbTable() 136AbTable::~AbTable()
138{ 137{
139} 138}
140 139
141void AbTable::init() 140void AbTable::init()
142{ 141{
143 // :SX showChar = '\0'; 142 // :SX showChar = '\0';
144 setNumRows( 0 ); 143 setNumRows( 0 );
145 setNumCols( 2 ); 144 setNumCols( 2 );
146 145
147 horizontalHeader()->setLabel( 0, tr( "Full Name" )); 146 horizontalHeader()->setLabel( 0, tr( "Full Name" ));
148 horizontalHeader()->setLabel( 1, tr( "Contact" )); 147 horizontalHeader()->setLabel( 1, tr( "Contact" ));
149 setLeftMargin( 0 ); 148 setLeftMargin( 0 );
150 verticalHeader()->hide(); 149 verticalHeader()->hide();
151 columnVisible = true; 150 columnVisible = true;
152} 151}
153 152
154void AbTable::setContacts( const OContactAccess::List& viewList ) 153void AbTable::setContacts( const Opie::OPimContactAccess::List& viewList )
155{ 154{
156 qWarning("AbTable::setContacts()"); 155 qWarning("AbTable::setContacts()");
157 156
158 clear(); 157 clear();
159 m_viewList = viewList; 158 m_viewList = viewList;
160 159
161 setSorting( false ); 160 setSorting( false );
162 setPaintingEnabled( FALSE ); 161 setPaintingEnabled( FALSE );
163 162
164 OContactAccess::List::Iterator it; 163 Opie::OPimContactAccess::List::Iterator it;
165 setNumRows( m_viewList.count() ); 164 setNumRows( m_viewList.count() );
166 //int row = 0; 165 //int row = 0;
167 // for ( it = m_viewList.begin(); it != m_viewList.end(); ++it ) 166 // for ( it = m_viewList.begin(); it != m_viewList.end(); ++it )
168 // insertIntoTable( *it, row++ ); 167 // insertIntoTable( *it, row++ );
169 168
170 // setSorting( true ); 169 // setSorting( true );
171 170
172 // resort(); 171 // resort();
173 172
174 updateVisible(); 173 updateVisible();
175 174
176 setPaintingEnabled( TRUE ); 175 setPaintingEnabled( TRUE );
177 176
178} 177}
179 178
180void AbTable::setOrderedList( const QValueList<int> ordered ) 179void AbTable::setOrderedList( const QValueList<int> ordered )
181{ 180{
182 intFields = ordered; 181 intFields = ordered;
183} 182}
184 183
185 184
186bool AbTable::selectContact( int UID ) 185bool AbTable::selectContact( int UID )
187{ 186{
188 qWarning( "AbTable::selectContact( %d )", UID ); 187 qWarning( "AbTable::selectContact( %d )", UID );
189 int rows = numRows(); 188 int rows = numRows();
190 OContact* foundContact = 0l; 189 Opie::OPimContact* foundContact = 0l;
191 bool found = false; 190 bool found = false;
192 191
193 setPaintingEnabled( FALSE ); 192 setPaintingEnabled( FALSE );
194 qWarning( "search start" ); 193 qWarning( "search start" );
195 for ( int r = 0; r < rows; ++r ) { 194 for ( int r = 0; r < rows; ++r ) {
196 if ( m_viewList.uidAt( r ) == UID ){ 195 if ( m_viewList.uidAt( r ) == UID ){
197 ensureCellVisible( r, 0 ); 196 ensureCellVisible( r, 0 );
198 setCurrentCell( r, 0 ); 197 setCurrentCell( r, 0 );
199 found = true; 198 found = true;
200 break; 199 break;
201 } 200 }
202 } 201 }
203 qWarning( "search end" ); 202 qWarning( "search end" );
204 203
205 if ( !found ){ 204 if ( !found ){
206 ensureCellVisible( 0,0 ); 205 ensureCellVisible( 0,0 );
207 setCurrentCell( 0, 0 ); 206 setCurrentCell( 0, 0 );
208 } 207 }
209 208
210 setPaintingEnabled( TRUE ); 209 setPaintingEnabled( TRUE );
211 210
212 return true; 211 return true;
213} 212}
214 213
215#if 0 214#if 0
216void AbTable::insertIntoTable( const OContact& cnt, int row ) 215void AbTable::insertIntoTable( const Opie::OPimContact& cnt, int row )
217{ 216{
218 qWarning( "void AbTable::insertIntoTable( const OContact& cnt, %d )", row ); 217 qWarning( "void AbTable::insertIntoTable( const Opie::OPimContact& cnt, %d )", row );
219 QString strName; 218 QString strName;
220 ContactItem contactItem; 219 ContactItem contactItem;
221 220
222 strName = findContactName( cnt ); 221 strName = findContactName( cnt );
223 contactItem = findContactContact( cnt, row ); 222 contactItem = findContactContact( cnt, row );
224 223
225 AbTableItem *ati; 224 AbTableItem *ati;
226 ati = new AbTableItem( this, QTableItem::Never, strName, contactItem.value ); 225 ati = new AbTableItem( this, QTableItem::Never, strName, contactItem.value );
227 contactList.insert( ati, cnt ); 226 contactList.insert( ati, cnt );
228 setItem( row, 0, ati ); 227 setItem( row, 0, ati );
229 ati = new AbTableItem( this, QTableItem::Never, contactItem.value, strName); 228 ati = new AbTableItem( this, QTableItem::Never, contactItem.value, strName);
230 if ( !contactItem.icon.isNull() ) 229 if ( !contactItem.icon.isNull() )
231 ati->setPixmap( contactItem.icon ); 230 ati->setPixmap( contactItem.icon );
232 setItem( row, 1, ati ); 231 setItem( row, 1, ati );
233 232
234 //### cannot do this; table only has two columns at this point 233 //### cannot do this; table only has two columns at this point
235 // setItem( row, 2, new AbPickItem( this ) ); 234 // setItem( row, 2, new AbPickItem( this ) );
236 235
237} 236}
238#endif 237#endif
239 238
240 239
241void AbTable::columnClicked( int col ) 240void AbTable::columnClicked( int col )
242{ 241{
243 if ( !sorting() ) 242 if ( !sorting() )
244 return; 243 return;
245 244
246 if ( lastSortCol == -1 ) 245 if ( lastSortCol == -1 )
247 lastSortCol = col; 246 lastSortCol = col;
248 247
249 if ( col == lastSortCol ) { 248 if ( col == lastSortCol ) {
250 asc = !asc; 249 asc = !asc;
251 } else { 250 } else {
252 lastSortCol = col; 251 lastSortCol = col;
253 asc = TRUE; 252 asc = TRUE;
254 } 253 }
255 //QMessageBox::information( this, "resort", "columnClicked" ); 254 //QMessageBox::information( this, "resort", "columnClicked" );
256 resort(); 255 resort();
257} 256}
258 257
259void AbTable::resort() 258void AbTable::resort()
260{ 259{
261 qWarning( "void AbTable::resort() NOT POSSIBLE !!" ); 260 qWarning( "void AbTable::resort() NOT POSSIBLE !!" );
262#if 0 261#if 0
263 setPaintingEnabled( FALSE ); 262 setPaintingEnabled( FALSE );
264 if ( sorting() ) { 263 if ( sorting() ) {
265 if ( lastSortCol == -1 ) 264 if ( lastSortCol == -1 )
266 lastSortCol = 0; 265 lastSortCol = 0;
267 sortColumn( lastSortCol, asc, TRUE ); 266 sortColumn( lastSortCol, asc, TRUE );
268 //QMessageBox::information( this, "resort", "resort" ); 267 //QMessageBox::information( this, "resort", "resort" );
269 updateVisible(); 268 updateVisible();
270 } 269 }
271 setPaintingEnabled( TRUE ); 270 setPaintingEnabled( TRUE );
272#endif 271#endif
273} 272}
274 273
275OContact AbTable::currentEntry() 274Opie::OPimContact AbTable::currentEntry()
276 { 275{
277 return m_viewList[currentRow()]; 276 return m_viewList[currentRow()];
278} 277}
279 278
280int AbTable::currentEntry_UID() 279int AbTable::currentEntry_UID()
281{ 280{
282 return ( currentEntry().uid() ); 281 return ( currentEntry().uid() );
283} 282}
284 283
285void AbTable::clear() 284void AbTable::clear()
286{ 285{
287 qWarning( "void AbTable::clear()" ); 286 qWarning( "void AbTable::clear()" );
288 // contactList.clear(); 287 // contactList.clear();
289 288
290 setPaintingEnabled( FALSE ); 289 setPaintingEnabled( FALSE );
291 for ( int r = 0; r < numRows(); ++r ) { 290 for ( int r = 0; r < numRows(); ++r ) {
292 for ( int c = 0; c < numCols(); ++c ) { 291 for ( int c = 0; c < numCols(); ++c ) {
293 if ( cellWidget( r, c ) ) 292 if ( cellWidget( r, c ) )
294 clearCellWidget( r, c ); 293 clearCellWidget( r, c );
295 clearCell( r, c ); 294 clearCell( r, c );
296 } 295 }
297 } 296 }
298 setNumRows( 0 ); 297 setNumRows( 0 );
299 setPaintingEnabled( TRUE ); 298 setPaintingEnabled( TRUE );
300} 299}
301 300
302// Refresh updates column 2 if the contactsettings changed 301// Refresh updates column 2 if the contactsettings changed
303void AbTable::refresh() 302void AbTable::refresh()
304{ 303{
305 qWarning( "void AbTable::refresh() NOT IMPLEMENTED !!" ); 304 qWarning( "void AbTable::refresh() NOT IMPLEMENTED !!" );
306 305
307#if 0 306#if 0
308 int rows = numRows(); 307 int rows = numRows();
309 AbTableItem *abi; 308 AbTableItem *abi;
310 ContactItem contactItem; 309 ContactItem contactItem;
311 310
312 setPaintingEnabled( FALSE ); 311 setPaintingEnabled( FALSE );
313 for ( int r = 0; r < rows; ++r ) { 312 for ( int r = 0; r < rows; ++r ) {
314 abi = static_cast<AbTableItem*>( item(r, 0) ); 313 abi = static_cast<AbTableItem*>( item(r, 0) );
315 contactItem = findContactContact( contactList[abi], r ); 314 contactItem = findContactContact( contactList[abi], r );
316 static_cast<AbTableItem*>( item(r, 1) )->setItem( contactItem.value, abi->text() ); 315 static_cast<AbTableItem*>( item(r, 1) )->setItem( contactItem.value, abi->text() );
317 if ( !contactItem.icon.isNull() ){ 316 if ( !contactItem.icon.isNull() ){
318 static_cast<AbTableItem*>( item(r, 1) )-> 317 static_cast<AbTableItem*>( item(r, 1) )->
319 setPixmap( contactItem.icon ); 318 setPixmap( contactItem.icon );
320 }else{ 319 }else{
321 static_cast<AbTableItem*>( item(r, 1) )-> 320 static_cast<AbTableItem*>( item(r, 1) )->
322 setPixmap( QPixmap() ); 321 setPixmap( QPixmap() );
323 } 322 }
324 } 323 }
325 resort(); 324 resort();
326 setPaintingEnabled( TRUE ); 325 setPaintingEnabled( TRUE );
327 326
328#endif 327#endif
329} 328}
330 329
331void AbTable::keyPressEvent( QKeyEvent *e ) 330void AbTable::keyPressEvent( QKeyEvent *e )
332{ 331{
333 char key = toupper( e->ascii() ); 332 char key = toupper( e->ascii() );
334 333
335 if ( key >= 'A' && key <= 'Z' ) 334 if ( key >= 'A' && key <= 'Z' )
336 moveTo( key ); 335 moveTo( key );
337 336
338 //qWarning("Received key .."); 337 //qWarning("Received key ..");
339 switch( e->key() ) { 338 switch( e->key() ) {
340 case Qt::Key_Space: 339 case Qt::Key_Space:
341 case Qt::Key_Return: 340 case Qt::Key_Return:
342 case Qt::Key_Enter: 341 case Qt::Key_Enter:
343 emit signalSwitch(); 342 emit signalSwitch();
344 break; 343 break;
345 // case Qt::Key_Up: 344 // case Qt::Key_Up:
346 // qWarning("a"); 345 // qWarning("a");
347 // emit signalKeyUp(); 346 // emit signalKeyUp();
348 // break; 347 // break;
349 // case Qt::Key_Down: 348 // case Qt::Key_Down:
350 // qWarning("b"); 349 // qWarning("b");
351 // emit signalKeyDown(); 350 // emit signalKeyDown();
352 // break; 351 // break;
353 default: 352 default:
354 QTable::keyPressEvent( e ); 353 QTable::keyPressEvent( e );
355 } 354 }
356 355
357} 356}
358 357
359void AbTable::moveTo( char c ) 358void AbTable::moveTo( char c )
360{ 359{
361 qWarning( "void AbTable::moveTo( char c ) NOT IMPLEMENTED !!" ); 360 qWarning( "void AbTable::moveTo( char c ) NOT IMPLEMENTED !!" );
362 361
363#if 0 362#if 0
364 int rows = numRows(); 363 int rows = numRows();
365 QString value; 364 QString value;
366 AbTableItem *abi; 365 AbTableItem *abi;
367 int r; 366 int r;
368 if ( asc ) { 367 if ( asc ) {
369 r = 0; 368 r = 0;
370 while ( r < rows-1) { 369 while ( r < rows-1) {
371 abi = static_cast<AbTableItem*>( item(r, 0) ); 370 abi = static_cast<AbTableItem*>( item(r, 0) );
372 QChar first = abi->key()[0]; 371 QChar first = abi->key()[0];
373 //### is there a bug in QChar to char comparison??? 372 //### is there a bug in QChar to char comparison???
374 if ( first.row() || first.cell() >= c ) 373 if ( first.row() || first.cell() >= c )
375 break; 374 break;
376 r++; 375 r++;
377 } 376 }
378 } else { 377 } else {
379 //### should probably disable reverse sorting instead 378 //### should probably disable reverse sorting instead
380 r = rows - 1; 379 r = rows - 1;
381 while ( r > 0 ) { 380 while ( r > 0 ) {
382 abi = static_cast<AbTableItem*>( item(r, 0) ); 381 abi = static_cast<AbTableItem*>( item(r, 0) );
383 QChar first = abi->key()[0]; 382 QChar first = abi->key()[0];
384 //### is there a bug in QChar to char comparison??? 383 //### is there a bug in QChar to char comparison???
385 if ( first.row() || first.cell() >= c ) 384 if ( first.row() || first.cell() >= c )
386 break; 385 break;
387 r--; 386 r--;
388 } 387 }
389 } 388 }
390 setCurrentCell( r, currentColumn() ); 389 setCurrentCell( r, currentColumn() );
391 390
392#endif 391#endif
393} 392}
394 393
395#if 0 394#if 0
396// Useless.. Nobody uses it .. (se) 395// Useless.. Nobody uses it .. (se)
397QString AbTable::findContactName( const OContact &entry ) 396QString AbTable::findContactName( const Opie::OPimContact &entry )
398{ 397{
399 // We use the fileAs, then company, defaultEmail 398 // We use the fileAs, then company, defaultEmail
400 QString str; 399 QString str;
401 str = entry.fileAs(); 400 str = entry.fileAs();
402 if ( str.isEmpty() ) { 401 if ( str.isEmpty() ) {
403 str = entry.company(); 402 str = entry.company();
404 if ( str.isEmpty() ) { 403 if ( str.isEmpty() ) {
405 str = entry.defaultEmail(); 404 str = entry.defaultEmail();
406 } 405 }
407 } 406 }
408 return str; 407 return str;
409} 408}
410#endif 409#endif
411 410
412 411
413void AbTable::resizeRows() { 412void AbTable::resizeRows() {
414 /* 413 /*
415 if (numRows()) { 414 if (numRows()) {
416 for (int i = 0; i < numRows(); i++) { 415 for (int i = 0; i < numRows(); i++) {
417 setRowHeight( i, size ); 416 setRowHeight( i, size );
418 } 417 }
419 } 418 }
420 updateVisible(); 419 updateVisible();
421 */ 420 */
422} 421}
423 422
424 423
425void AbTable::realignTable() 424void AbTable::realignTable()
426{ 425{
427 //qWarning( "void AbTable::realignTable()" ); 426 //qWarning( "void AbTable::realignTable()" );
428 427
429 setPaintingEnabled( FALSE ); 428 setPaintingEnabled( FALSE );
430 429
431 resizeRows(); 430 resizeRows();
432 fitColumns(); 431 fitColumns();
433 432
434 setPaintingEnabled( TRUE ); 433 setPaintingEnabled( TRUE );
435 434
436} 435}
437 436
438 437
439 438
440 439
441#if QT_VERSION <= 230 440#if QT_VERSION <= 230
442#ifndef SINGLE_APP 441#ifndef SINGLE_APP
443void QTable::paintEmptyArea( QPainter *p, int cx, int cy, int cw, int ch ) 442void QTable::paintEmptyArea( QPainter *p, int cx, int cy, int cw, int ch )
444{ 443{
445 // Region of the rect we should draw 444 // Region of the rect we should draw
446 QRegion reg( QRect( cx, cy, cw, ch ) ); 445 QRegion reg( QRect( cx, cy, cw, ch ) );
447 // Subtract the table from it 446 // Subtract the table from it
448 reg = reg.subtract( QRect( QPoint( 0, 0 ), tableSize() ) ); 447 reg = reg.subtract( QRect( QPoint( 0, 0 ), tableSize() ) );
449 // And draw the rectangles (transformed as needed) 448 // And draw the rectangles (transformed as needed)
450 QArray<QRect> r = reg.rects(); 449 QArray<QRect> r = reg.rects();
451 for (unsigned int i=0; i<r.count(); i++) 450 for (unsigned int i=0; i<r.count(); i++)
452 p->fillRect( r[i], colorGroup().brush( QColorGroup::Base ) ); 451 p->fillRect( r[i], colorGroup().brush( QColorGroup::Base ) );
453} 452}
454#endif 453#endif
455#endif 454#endif
456 455
457 456
458// int AbTable::rowHeight( int ) const 457// int AbTable::rowHeight( int ) const
459// { 458// {
460// return 18; 459// return 18;
461// } 460// }
462 461
463// int AbTable::rowPos( int row ) const 462// int AbTable::rowPos( int row ) const
464// { 463// {
465// return 18*row; 464// return 18*row;
466// } 465// }
467 466
468// int AbTable::rowAt( int pos ) const 467// int AbTable::rowAt( int pos ) const
469// { 468// {
470// return QMIN( pos/18, numRows()-1 ); 469// return QMIN( pos/18, numRows()-1 );
471// } 470// }
472 471
473 472
474 473
475void AbTable::fitColumns() 474void AbTable::fitColumns()
476{ 475{
477 qWarning( "void AbTable::fitColumns()" ); 476 qWarning( "void AbTable::fitColumns()" );
478 int contentsWidth = visibleWidth() / 2; 477 int contentsWidth = visibleWidth() / 2;
479 // Fix to better value 478 // Fix to better value
480 // contentsWidth = 130; 479 // contentsWidth = 130;
481 480
482 setPaintingEnabled( FALSE ); 481 setPaintingEnabled( FALSE );
483 482
484 if ( columnVisible == false ){ 483 if ( columnVisible == false ){
485 showColumn(0); 484 showColumn(0);
486 columnVisible = true; 485 columnVisible = true;
487 } 486 }
488 487
489 //qWarning("Width: %d", contentsWidth); 488 //qWarning("Width: %d", contentsWidth);
490 489
491 setColumnWidth( 0, contentsWidth ); 490 setColumnWidth( 0, contentsWidth );
492 adjustColumn(1); 491 adjustColumn(1);
493 if ( columnWidth(1) < contentsWidth ) 492 if ( columnWidth(1) < contentsWidth )
494 setColumnWidth( 1, contentsWidth ); 493 setColumnWidth( 1, contentsWidth );
495 494
496 setPaintingEnabled( TRUE ); 495 setPaintingEnabled( TRUE );
497} 496}
498 497
499void AbTable::show() 498void AbTable::show()
500{ 499{
501 //qWarning( "void AbTable::show()" ); 500 //qWarning( "void AbTable::show()" );
502 realignTable(); 501 realignTable();
503 QTable::show(); 502 QTable::show();
504} 503}
505 504
506#if 0 505#if 0
507void AbTable::setChoiceNames( const QStringList& list) 506void AbTable::setChoiceNames( const QStringList& list)
508{ 507{
509 choicenames = list; 508 choicenames = list;
510 if ( choicenames.isEmpty() ) { 509 if ( choicenames.isEmpty() ) {
511 // hide pick column 510 // hide pick column
512 setNumCols( 2 ); 511 setNumCols( 2 );
513 } else { 512 } else {
514 // show pick column 513 // show pick column
515 setNumCols( 3 ); 514 setNumCols( 3 );
516 setColumnWidth( 2, fontMetrics().width(tr( "Pick" ))+8 ); 515 setColumnWidth( 2, fontMetrics().width(tr( "Pick" ))+8 );
517 horizontalHeader()->setLabel( 2, tr( "Pick" )); 516 horizontalHeader()->setLabel( 2, tr( "Pick" ));
518 } 517 }
519 fitColumns(); 518 fitColumns();
520} 519}
521#endif 520#endif
522 521
523void AbTable::itemClicked(int,int col) 522void AbTable::itemClicked(int,int col)
524{ 523{
525 //qWarning( "AbTable::itemClicked(int, col:%d)", col); 524 //qWarning( "AbTable::itemClicked(int, col:%d)", col);
526 if ( col == 2 ) { 525 if ( col == 2 ) {
527 return; 526 return;
528 } else { 527 } else {
529 // qWarning ("Emitting signalSwitch()"); 528 // qWarning ("Emitting signalSwitch()");
530 emit signalSwitch(); 529 emit signalSwitch();
531 } 530 }
532} 531}
533 532
534#if 0 533#if 0
535QStringList AbTable::choiceNames() const 534QStringList AbTable::choiceNames() const
536{ 535{
537 return choicenames; 536 return choicenames;
538} 537}
539 538
540#endif 539#endif
541void AbTable::setChoiceSelection( const QValueList<int>& list ) 540void AbTable::setChoiceSelection( const QValueList<int>& list )
542{ 541{
543 intFields = list; 542 intFields = list;
544} 543}
545 544
546QStringList AbTable::choiceSelection(int /*index*/) const 545QStringList AbTable::choiceSelection(int /*index*/) const
547{ 546{
548 QStringList r; 547 QStringList r;
549 /* ###### 548 /* ######
550 549
551 QString selname = choicenames.at(index); 550 QString selname = choicenames.at(index);
552 for (each row) { 551 for (each row) {
553 OContact *c = contactForRow(row); 552 Opie::OPimContact *c = contactForRow(row);
554 if ( text(row,2) == selname ) { 553 if ( text(row,2) == selname ) {
555 r.append(c->email); 554 r.append(c->email);
556 } 555 }
557 } 556 }
558 557
559 */ 558 */
560 return r; 559 return r;
561} 560}
562 561
563 562
564void AbTable::updateVisible() 563void AbTable::updateVisible()
565{ 564{
566 //qWarning("void AbTable::updateVisible()"); 565 //qWarning("void AbTable::updateVisible()");
567 566
568 int visible, 567 int visible,
569 totalRows, 568 totalRows,
570 row, 569 row,
571 selectedRow = 0; 570 selectedRow = 0;
572 571
573 visible = 0; 572 visible = 0;
574 573
575 setPaintingEnabled( FALSE ); 574 setPaintingEnabled( FALSE );
576 575
577 realignTable(); 576 realignTable();
578 577
579 totalRows = numRows(); 578 totalRows = numRows();
580 for ( row = 0; row < totalRows; row++ ) { 579 for ( row = 0; row < totalRows; row++ ) {
581 if ( rowHeight(row) == 0 ) { 580 if ( rowHeight(row) == 0 ) {
582 showRow( row ); 581 showRow( row );
583 adjustRow( row ); 582 adjustRow( row );
584 if ( isSelected( row,0 ) || isSelected( row,1 ) ) 583 if ( isSelected( row,0 ) || isSelected( row,1 ) )
585 selectedRow = row; 584 selectedRow = row;
586 } 585 }
587 visible++; 586 visible++;
588 } 587 }
589 588
590 if ( selectedRow ) 589 if ( selectedRow )
591 setCurrentCell( selectedRow, 0 ); 590 setCurrentCell( selectedRow, 0 );
592 591
593 if ( !visible ) 592 if ( !visible )
594 setCurrentCell( -1, 0 ); 593 setCurrentCell( -1, 0 );
595 594
596 setPaintingEnabled( TRUE ); 595 setPaintingEnabled( TRUE );
597} 596}
598 597
599 598
600void AbTable::setPaintingEnabled( bool e ) 599void AbTable::setPaintingEnabled( bool e )
601{ 600{
602 //qWarning("IN void AbTable::setPaintingEnabled( %d )->Nested: %d", e, countNested ); 601 //qWarning("IN void AbTable::setPaintingEnabled( %d )->Nested: %d", e, countNested );
603 602
604 if ( e ) { 603 if ( e ) {
605 if ( countNested > 0 ) 604 if ( countNested > 0 )
606 --countNested; 605 --countNested;
607 if ( ! countNested ){ 606 if ( ! countNested ){
608 setUpdatesEnabled( true ); 607 setUpdatesEnabled( true );
609 enablePainting = true; 608 enablePainting = true;
610 rowHeightChanged( 0 ); 609 rowHeightChanged( 0 );
611 viewport()->update(); 610 viewport()->update();
612 } 611 }
613 } else { 612 } else {
614 ++countNested; 613 ++countNested;
615 enablePainting = false; 614 enablePainting = false;
616 setUpdatesEnabled( false ); 615 setUpdatesEnabled( false );
617 } 616 }
618 //qWarning("OUT void AbTable::setPaintingEnabled( %d )->Nested: %d", e, countNested ); 617 //qWarning("OUT void AbTable::setPaintingEnabled( %d )->Nested: %d", e, countNested );
619} 618}
620 619
621void AbTable::viewportPaintEvent( QPaintEvent* e ) { 620void AbTable::viewportPaintEvent( QPaintEvent* e ) {
622 //qWarning(" void AbTable::viewportPaintEvent( QPaintEvent* e ) -> %d", enablePainting); 621 //qWarning(" void AbTable::viewportPaintEvent( QPaintEvent* e ) -> %d", enablePainting);
623 if ( enablePainting ) 622 if ( enablePainting )
624 QTable::viewportPaintEvent( e ); 623 QTable::viewportPaintEvent( e );
625} 624}
626 625
627void AbTable::paintCell(QPainter* p, int row, int col, const QRect& cr, bool ) { 626void AbTable::paintCell(QPainter* p, int row, int col, const QRect& cr, bool ) {
628 const QColorGroup &cg = colorGroup(); 627 const QColorGroup &cg = colorGroup();
629 628
630 p->save(); 629 p->save();
631 630
632 //qWarning( "Paint row: %d", row ); 631 //qWarning( "Paint row: %d", row );
633 632
634 OContact act_contact = m_viewList[row]; 633 Opie::OPimContact act_contact = m_viewList[row];
635 634
636 // Paint alternating background bars 635 // Paint alternating background bars
637 if ( (row % 2 ) == 0 ) { 636 if ( (row % 2 ) == 0 ) {
638 p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Base ) ); 637 p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Base ) );
639 p->setPen( QPen( cg.text() ) ); 638 p->setPen( QPen( cg.text() ) );
640 } 639 }
641 else { 640 else {
642 p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Background ) ); 641 p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Background ) );
643 p->setPen( QPen( cg.buttonText() ) ); 642 p->setPen( QPen( cg.buttonText() ) );
644 } 643 }
645 644
646 QFont f = p->font(); 645 QFont f = p->font();
647 QFontMetrics fm(f); 646 QFontMetrics fm(f);
648 647
649 int marg = 2; 648 int marg = 2;
650 int x = 0; 649 int x = 0;
651 int y = ( cr.height() - 14 ) / 2; 650 int y = ( cr.height() - 14 ) / 2;
652 651
653 QString nameText = act_contact.fileAs(); 652 QString nameText = act_contact.fileAs();
654 653
655 switch( col ){ 654 switch( col ){
656 case 0: 655 case 0:
657 p->drawText( x + marg,2 + fm.ascent(), nameText ); 656 p->drawText( x + marg,2 + fm.ascent(), nameText );
658 break; 657 break;
659 case 1:{ 658 case 1:{
660 659
661 ContactItem contactItem = findContactContact( act_contact, 0 ); 660 ContactItem contactItem = findContactContact( act_contact, 0 );
662 QPixmap contactPic = contactItem.icon; /* pixmap( row, col ); */ 661 QPixmap contactPic = contactItem.icon; /* pixmap( row, col ); */
663 QString contactText = contactItem.value; 662 QString contactText = contactItem.value;
664 663
665 if ( !contactPic.isNull() ) 664 if ( !contactPic.isNull() )
666 { 665 {
667 p->drawPixmap( x + marg, y, contactPic ); 666 p->drawPixmap( x + marg, y, contactPic );
668 p->drawText( x + marg + contactPic.width() 667 p->drawText( x + marg + contactPic.width()
669 + 4,2 + fm.ascent(), contactText ); 668 + 4,2 + fm.ascent(), contactText );
670 } 669 }
671 else 670 else
672 { 671 {
673 p->drawText( x + marg,2 + fm.ascent(), contactText ); 672 p->drawText( x + marg,2 + fm.ascent(), contactText );
674 } 673 }
675 } 674 }
676 break; 675 break;
677 676
678 } 677 }
679 p->restore(); 678 p->restore();
680} 679}
681 680
682void AbTable::rowHeightChanged( int row ) 681void AbTable::rowHeightChanged( int row )
683{ 682{
684 if ( enablePainting ) 683 if ( enablePainting )
685 QTable::rowHeightChanged( row ); 684 QTable::rowHeightChanged( row );
686} 685}
687ContactItem AbTable::findContactContact( const OContact &entry, int /* row */ ) 686ContactItem AbTable::findContactContact( const Opie::OPimContact &entry, int /* row */ )
688{ 687{
689 688
690 ContactItem item; 689 ContactItem item;
691 690
692 item.value = ""; 691 item.value = "";
693 692
694 for ( QValueList<int>::ConstIterator it = intFields.begin(); 693 for ( QValueList<int>::ConstIterator it = intFields.begin();
695 it != intFields.end(); ++it ) { 694 it != intFields.end(); ++it ) {
696 switch ( *it ) { 695 switch ( *it ) {
697 default: 696 default:
698 break; 697 break;
699 case Qtopia::Title: 698 case Qtopia::Title:
700 item.value = entry.title(); 699 item.value = entry.title();
701 break; 700 break;
702 case Qtopia::Suffix: 701 case Qtopia::Suffix:
703 item.value = entry.suffix(); 702 item.value = entry.suffix();
704 break; 703 break;
705 case Qtopia::FileAs: 704 case Qtopia::FileAs:
706 item.value = entry.fileAs(); 705 item.value = entry.fileAs();
707 break; 706 break;
708 case Qtopia::DefaultEmail: 707 case Qtopia::DefaultEmail:
709 item.value = entry.defaultEmail(); 708 item.value = entry.defaultEmail();
710 if ( !item.value.isEmpty() ) 709 if ( !item.value.isEmpty() )
711 item.icon = Resource::loadPixmap( "addressbook/email" ); 710 item.icon = Resource::loadPixmap( "addressbook/email" );
712 break; 711 break;
713 case Qtopia::Emails: 712 case Qtopia::Emails:
714 item.value = entry.emails(); 713 item.value = entry.emails();
715 if ( !item.value.isEmpty() ) 714 if ( !item.value.isEmpty() )
716 item.icon = Resource::loadPixmap( "addressbook/email" ); 715 item.icon = Resource::loadPixmap( "addressbook/email" );
717 break; 716 break;
718 case Qtopia::HomeStreet: 717 case Qtopia::HomeStreet:
719 item.value = entry.homeStreet(); 718 item.value = entry.homeStreet();
720 break; 719 break;
721 case Qtopia::HomeCity: 720 case Qtopia::HomeCity:
722 item.value = entry.homeCity(); 721 item.value = entry.homeCity();
723 break; 722 break;
724 case Qtopia::HomeState: 723 case Qtopia::HomeState:
725 item.value = entry.homeState(); 724 item.value = entry.homeState();
726 break; 725 break;
727 case Qtopia::HomeZip: 726 case Qtopia::HomeZip:
728 item.value = entry.homeZip(); 727 item.value = entry.homeZip();
729 break; 728 break;
730 case Qtopia::HomeCountry: 729 case Qtopia::HomeCountry:
731 item.value = entry.homeCountry(); 730 item.value = entry.homeCountry();
732 break; 731 break;
733 case Qtopia::HomePhone: 732 case Qtopia::HomePhone:
734 item.value = entry.homePhone(); 733 item.value = entry.homePhone();
735 if ( !item.value.isEmpty() ) 734 if ( !item.value.isEmpty() )
diff --git a/core/pim/addressbook/abtable.h b/core/pim/addressbook/abtable.h
index b9ebe27..927a5a9 100644
--- a/core/pim/addressbook/abtable.h
+++ b/core/pim/addressbook/abtable.h
@@ -1,158 +1,159 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** Copyright (c) 2002 Stefan Eilers (eilers.stefan@epost.de) 3** Copyright (c) 2002 Stefan Eilers (eilers.stefan@epost.de)
4** 4**
5** This file is part of Qt Palmtop Environment. 5** This file is part of Qt Palmtop Environment.
6** 6**
7** This file may be distributed and/or modified under the terms of the 7** This file may be distributed and/or modified under the terms of the
8** GNU General Public License version 2 as published by the Free Software 8** GNU General Public License version 2 as published by the Free Software
9** Foundation and appearing in the file LICENSE.GPL included in the 9** Foundation and appearing in the file LICENSE.GPL included in the
10** packaging of this file. 10** packaging of this file.
11** 11**
12** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 12** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
13** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 13** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
14** 14**
15** See http://www.trolltech.com/gpl/ for GPL licensing information. 15** See http://www.trolltech.com/gpl/ for GPL licensing information.
16** 16**
17** Contact info@trolltech.com if any conditions of this licensing are 17** Contact info@trolltech.com if any conditions of this licensing are
18** not clear to you. 18** not clear to you.
19** 19**
20**********************************************************************/ 20**********************************************************************/
21 21
22#ifndef ABTABLE_H 22#ifndef ABTABLE_H
23#define ABTABLE_H 23#define ABTABLE_H
24 24
25#include <opie2/opimcontact.h>
26#include <opie2/ocontactaccess.h>
27
25#include <qpe/categories.h> 28#include <qpe/categories.h>
26#include <opie/ocontact.h>
27#include <opie/ocontactaccess.h>
28 29
29#include <qmap.h> 30#include <qmap.h>
30#include <qtable.h> 31#include <qtable.h>
31#include <qstringlist.h> 32#include <qstringlist.h>
32#include <qcombobox.h> 33#include <qcombobox.h>
33#include <qpixmap.h> 34#include <qpixmap.h>
34 35
35#if 0 36#if 0
36class AbTableItem : public QTableItem 37class AbTableItem : public QTableItem
37{ 38{
38public: 39public:
39 AbTableItem( QTable *t, EditType et, const QString &s, 40 AbTableItem( QTable *t, EditType et, const QString &s,
40 const QString &secondSortKey); 41 const QString &secondSortKey);
41 QString entryKey() const; 42 QString entryKey() const;
42 void setEntryKey( const QString & k ); 43 void setEntryKey( const QString & k );
43 virtual int alignment() const; 44 virtual int alignment() const;
44 virtual QString key() const; 45 virtual QString key() const;
45 void setItem( const QString &txt, const QString &secondKey ); 46 void setItem( const QString &txt, const QString &secondKey );
46 47
47private: 48private:
48 QString sortKey; 49 QString sortKey;
49}; 50};
50 51
51#endif 52#endif
52 53
53// This is a simple container, storing all contact 54// This is a simple container, storing all contact
54// information 55// information
55class ContactItem 56class ContactItem
56{ 57{
57 public: 58 public:
58 QPixmap icon; 59 QPixmap icon;
59 QString value; 60 QString value;
60}; 61};
61 62
62#if 0 63#if 0
63class AbPickItem : public QTableItem 64class AbPickItem : public QTableItem
64{ 65{
65public: 66public:
66 AbPickItem( QTable *t ); 67 AbPickItem( QTable *t );
67 68
68 QWidget *createEditor() const; 69 QWidget *createEditor() const;
69 void setContentFromEditor( QWidget *w ); 70 void setContentFromEditor( QWidget *w );
70 71
71private: 72private:
72 QGuardedPtr<QComboBox> cb; 73 QGuardedPtr<QComboBox> cb;
73}; 74};
74 75
75#endif 76#endif
76 77
77class AbTable : public QTable 78class AbTable : public QTable
78{ 79{
79 Q_OBJECT 80 Q_OBJECT
80 81
81public: 82public:
82 AbTable( const QValueList<int> ordered, QWidget *parent, const char *name=0 ); 83 AbTable( const QValueList<int> ordered, QWidget *parent, const char *name=0 );
83 ~AbTable(); 84 ~AbTable();
84 85
85 // Set the contacts shown in the table 86 // Set the contacts shown in the table
86 void setContacts( const OContactAccess::List& viewList ); 87 void setContacts( const Opie::OPimContactAccess::List& viewList );
87 88
88 // Set the list for primary contacts 89 // Set the list for primary contacts
89 void setOrderedList( const QValueList<int> ordered ); 90 void setOrderedList( const QValueList<int> ordered );
90 91
91 // Selects a contact of a specific UID 92 // Selects a contact of a specific UID
92 bool selectContact( int UID ); 93 bool selectContact( int UID );
93 94
94 // Get the current selected entry 95 // Get the current selected entry
95 OContact currentEntry(); 96 Opie::OPimContact currentEntry();
96 97
97 // Get the UID of the current selected Entry 98 // Get the UID of the current selected Entry
98 int currentEntry_UID(); 99 int currentEntry_UID();
99 100
100 // QString findContactName( const OContact &entry ); 101 // QString findContactName( const Opie::OPimContact &entry );
101 102
102 void init(); 103 void init();
103 void clear(); 104 void clear();
104 void refresh(); 105 void refresh();
105 106
106 void show(); 107 void show();
107 void setPaintingEnabled( bool e ); 108 void setPaintingEnabled( bool e );
108 void viewportPaintEvent( QPaintEvent* e); 109 void viewportPaintEvent( QPaintEvent* e);
109 void paintCell(QPainter* p, int row, int col, const QRect&, bool ); 110 void paintCell(QPainter* p, int row, int col, const QRect&, bool );
110 111
111 // addresspicker mode (What's that ? se) 112 // addresspicker mode (What's that ? se)
112 // void setChoiceNames( const QStringList& list); 113 // void setChoiceNames( const QStringList& list);
113 // QStringList choiceNames() const; 114 // QStringList choiceNames() const;
114 void setChoiceSelection( const QValueList<int>& list ); 115 void setChoiceSelection( const QValueList<int>& list );
115 QStringList choiceSelection(int index) const; 116 QStringList choiceSelection(int index) const;
116 117
117signals: 118signals:
118 void signalSwitch(); 119 void signalSwitch();
119 void signalEditor(); 120 void signalEditor();
120 void signalKeyDown(); 121 void signalKeyDown();
121 void signalKeyUp(); 122 void signalKeyUp();
122 123
123protected: 124protected:
124 virtual void keyPressEvent( QKeyEvent *e ); 125 virtual void keyPressEvent( QKeyEvent *e );
125 126
126// int rowHeight( int ) const; 127// int rowHeight( int ) const;
127// int rowPos( int row ) const; 128// int rowPos( int row ) const;
128// virtual int rowAt( int pos ) const; 129// virtual int rowAt( int pos ) const;
129 130
130 131
131protected slots: 132protected slots:
132 void moveTo( char ); 133 void moveTo( char );
133 virtual void columnClicked( int col ); 134 virtual void columnClicked( int col );
134 void itemClicked(int,int col); 135 void itemClicked(int,int col);
135 void rowHeightChanged( int row ); 136 void rowHeightChanged( int row );
136 137
137private: 138private:
138 // void insertIntoTable( const OContact &cnt, int row ); 139 // void insertIntoTable( const Opie::OPimContact &cnt, int row );
139 ContactItem findContactContact( const OContact &entry, int row ); 140 ContactItem findContactContact( const Opie::OPimContact &entry, int row );
140 void fitColumns(); 141 void fitColumns();
141 void resizeRows(); 142 void resizeRows();
142 void realignTable(); 143 void realignTable();
143 void resort(); 144 void resort();
144 void updateVisible(); 145 void updateVisible();
145 146
146 int lastSortCol; 147 int lastSortCol;
147 bool asc; 148 bool asc;
148 // QMap<AbTableItem*, OContact> contactList; 149 // QMap<AbTableItem*, Opie::OPimContact> contactList;
149 QValueList<int> intFields; 150 QValueList<int> intFields;
150 QStringList choicenames; 151 QStringList choicenames;
151 bool enablePainting; 152 bool enablePainting;
152 bool columnVisible; 153 bool columnVisible;
153 int countNested; 154 int countNested;
154 155
155 OContactAccess::List m_viewList; 156 Opie::OPimContactAccess::List m_viewList;
156 157
157}; 158};
158#endif // ABTABLE_H 159#endif // ABTABLE_H
diff --git a/core/pim/addressbook/abview.cpp b/core/pim/addressbook/abview.cpp
index 8d61582..aa242b7 100644
--- a/core/pim/addressbook/abview.cpp
+++ b/core/pim/addressbook/abview.cpp
@@ -1,469 +1,469 @@
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 <opie2/ocontactaccessbackend_vcard.h>
20 20
21#include <qpe/global.h> 21#include <qpe/global.h>
22 22
23#include <opie/ocontactaccessbackend_vcard.h> 23#include <qlayout.h>
24 24
25#include <assert.h> 25#include <assert.h>
26 26
27 27
28// Is defined in LibQPE 28// Is defined in LibQPE
29extern QString categoryFileName(); 29extern QString categoryFileName();
30 30
31QString addressbookPersonalVCardName() 31QString addressbookPersonalVCardName()
32{ 32{
33 QString filename = Global::applicationFileName("addressbook", 33 QString filename = Global::applicationFileName("addressbook",
34 "businesscard.vcf"); 34 "businesscard.vcf");
35 return filename; 35 return filename;
36} 36}
37 37
38 38
39AbView::AbView ( QWidget* parent, const QValueList<int>& ordered ): 39AbView::AbView ( QWidget* parent, const QValueList<int>& ordered ):
40 QWidget(parent), 40 QWidget(parent),
41 mCat(0), 41 mCat(0),
42 m_inSearch( false ), 42 m_inSearch( false ),
43 m_inPersonal( false ), 43 m_inPersonal( false ),
44 m_curr_category( -1 ), 44 m_curr_category( -1 ),
45 m_curr_View( TableView ), 45 m_curr_View( TableView ),
46 m_prev_View( TableView ), 46 m_prev_View( TableView ),
47 m_curr_Contact ( 0 ), 47 m_curr_Contact ( 0 ),
48 m_contactdb ( 0l ), 48 m_contactdb ( 0l ),
49 m_storedDB ( 0l ), 49 m_storedDB ( 0l ),
50 m_viewStack( 0l ), 50 m_viewStack( 0l ),
51 m_abTable( 0l ), 51 m_abTable( 0l ),
52 m_orderedFields( ordered ) 52 m_orderedFields( ordered )
53{ 53{
54 qWarning("AbView::c'tor"); 54 qWarning("AbView::c'tor");
55 // Load default database and handle syncing myself.. ! 55 // Load default database and handle syncing myself.. !
56 m_contactdb = new OContactAccess ( "addressbook", 0l, 0l, false ); 56 m_contactdb = new Opie::OPimContactAccess ( "addressbook", 0l, 0l, false );
57 m_contactdb -> setReadAhead( 16 ); // Use ReadAhead-Cache if available 57 m_contactdb -> setReadAhead( 16 ); // Use ReadAhead-Cache if available
58 mCat.load( categoryFileName() ); 58 mCat.load( categoryFileName() );
59 59
60 // Create Layout and put WidgetStack into it. 60 // Create Layout and put WidgetStack into it.
61 QVBoxLayout *vb = new QVBoxLayout( this ); 61 QVBoxLayout *vb = new QVBoxLayout( this );
62 m_viewStack = new QWidgetStack( this ); 62 m_viewStack = new QWidgetStack( this );
63 vb->addWidget( m_viewStack ); 63 vb->addWidget( m_viewStack );
64 64
65 // Creat TableView 65 // Creat TableView
66 QVBox* tableBox = new QVBox( m_viewStack ); 66 QVBox* tableBox = new QVBox( m_viewStack );
67 m_abTable = new AbTable( m_orderedFields, tableBox, "table" ); 67 m_abTable = new AbTable( m_orderedFields, tableBox, "table" );
68 m_abTable->setCurrentCell( 0, 0 ); 68 m_abTable->setCurrentCell( 0, 0 );
69 m_abTable->setFocus(); 69 m_abTable->setFocus();
70 70
71 // Add TableView to WidgetStack and raise it 71 // Add TableView to WidgetStack and raise it
72 m_viewStack -> addWidget( tableBox , TableView ); 72 m_viewStack -> addWidget( tableBox , TableView );
73 73
74 // Create CardView and add it to WidgetStack 74 // Create CardView and add it to WidgetStack
75 QVBox* cardBox = new QVBox( m_viewStack ); 75 QVBox* cardBox = new QVBox( m_viewStack );
76 m_ablabel = new AbLabel( cardBox, "CardView"); 76 m_ablabel = new AbLabel( cardBox, "CardView");
77 m_viewStack -> addWidget( cardBox , CardView ); 77 m_viewStack -> addWidget( cardBox , CardView );
78 78
79 // Connect views to me 79 // Connect views to me
80 connect ( m_abTable, SIGNAL( signalSwitch(void) ), 80 connect ( m_abTable, SIGNAL( signalSwitch(void) ),
81 this, SLOT( slotSwitch(void) ) ); 81 this, SLOT( slotSwitch(void) ) );
82 connect ( m_ablabel, SIGNAL( signalOkPressed(void) ), 82 connect ( m_ablabel, SIGNAL( signalOkPressed(void) ),
83 this, SLOT( slotSwitch(void) ) ); 83 this, SLOT( slotSwitch(void) ) );
84 84
85 load(); 85 load();
86} 86}
87 87
88AbView::~AbView() 88AbView::~AbView()
89{ 89{
90 m_contactdb -> save(); 90 m_contactdb -> save();
91 delete m_contactdb; 91 delete m_contactdb;
92 92
93 if ( m_storedDB ){ 93 if ( m_storedDB ){
94 m_storedDB -> save(); 94 m_storedDB -> save();
95 delete m_storedDB; 95 delete m_storedDB;
96 } 96 }
97} 97}
98 98
99 99
100void AbView::setView( Views view ) 100void AbView::setView( Views view )
101{ 101{
102 qWarning("AbView::setView( Views view )"); 102 qWarning("AbView::setView( Views view )");
103 m_curr_View = view; 103 m_curr_View = view;
104 load(); 104 load();
105} 105}
106 106
107void AbView::addEntry( const OContact &newContact ) 107void AbView::addEntry( const Opie::OPimContact &newContact )
108{ 108{
109 qWarning("abview:AddContact"); 109 qWarning("abview:AddContact");
110 m_contactdb->add ( newContact ); 110 m_contactdb->add ( newContact );
111 load(); 111 load();
112 112
113} 113}
114void AbView::removeEntry( const int UID ) 114void AbView::removeEntry( const int UID )
115{ 115{
116 qWarning("abview:RemoveContact"); 116 qWarning("abview:RemoveContact");
117 m_contactdb->remove( UID ); 117 m_contactdb->remove( UID );
118 load(); 118 load();
119} 119}
120 120
121void AbView::replaceEntry( const OContact &contact ) 121void AbView::replaceEntry( const Opie::OPimContact &contact )
122{ 122{
123 qWarning("abview:ReplaceContact"); 123 qWarning("abview:ReplaceContact");
124 m_contactdb->replace( contact ); 124 m_contactdb->replace( contact );
125 load(); 125 load();
126 126
127} 127}
128 128
129OContact AbView::currentEntry() 129Opie::OPimContact AbView::currentEntry()
130{ 130{
131 OContact currentContact; 131 Opie::OPimContact currentContact;
132 132
133 switch ( (int) m_curr_View ) { 133 switch ( (int) m_curr_View ) {
134 case TableView: 134 case TableView:
135 currentContact = m_abTable -> currentEntry(); 135 currentContact = m_abTable -> currentEntry();
136 break; 136 break;
137 case CardView: 137 case CardView:
138 currentContact = m_ablabel -> currentEntry(); 138 currentContact = m_ablabel -> currentEntry();
139 break; 139 break;
140 } 140 }
141 m_curr_Contact = currentContact.uid(); 141 m_curr_Contact = currentContact.uid();
142 return currentContact; 142 return currentContact;
143} 143}
144 144
145bool AbView::save() 145bool AbView::save()
146{ 146{
147 //qWarning("abView:Save data"); 147 //qWarning("abView:Save data");
148 148
149 return m_contactdb->save(); 149 return m_contactdb->save();
150} 150}
151 151
152void AbView::load() 152void AbView::load()
153{ 153{
154 qWarning("abView:Load data"); 154 qWarning("abView:Load data");
155 155
156 // Letter Search is stopped at this place 156 // Letter Search is stopped at this place
157 emit signalClearLetterPicker(); 157 emit signalClearLetterPicker();
158 158
159 if ( m_inPersonal ) 159 if ( m_inPersonal )
160 // VCard Backend does not sort.. 160 // VCard Backend does not sort..
161 m_list = m_contactdb->allRecords(); 161 m_list = m_contactdb->allRecords();
162 else{ 162 else{
163 m_list = m_contactdb->sorted( true, 0, 0, 0 ); 163 m_list = m_contactdb->sorted( true, 0, 0, 0 );
164 if ( m_curr_category != -1 ) 164 if ( m_curr_category != -1 )
165 clearForCategory(); 165 clearForCategory();
166 } 166 }
167 167
168 qWarning ("Number of contacts: %d", m_list.count()); 168 qWarning ("Number of contacts: %d", m_list.count());
169 169
170 updateView( true ); 170 updateView( true );
171 171
172} 172}
173 173
174void AbView::reload() 174void AbView::reload()
175{ 175{
176 qWarning( "void AbView::reload()" ); 176 qWarning( "void AbView::reload()" );
177 177
178 m_contactdb->reload(); 178 m_contactdb->reload();
179 load(); 179 load();
180} 180}
181 181
182void AbView::clear() 182void AbView::clear()
183{ 183{
184 // :SX 184 // :SX
185} 185}
186 186
187void AbView::setShowByCategory( const QString& cat ) 187void AbView::setShowByCategory( const QString& cat )
188{ 188{
189 qWarning("AbView::setShowCategory( const QString& cat )"); 189 qWarning("AbView::setShowCategory( const QString& cat )");
190 190
191 int intCat = 0; 191 int intCat = 0;
192 192
193 // All (cat == NULL) will be stored as -1 193 // All (cat == NULL) will be stored as -1
194 if ( cat.isNull() ) 194 if ( cat.isNull() )
195 intCat = -1; 195 intCat = -1;
196 else 196 else
197 intCat = mCat.id("Contacts", cat ); 197 intCat = mCat.id("Contacts", cat );
198 198
199 // Just do anything if we really change the category 199 // Just do anything if we really change the category
200 if ( intCat != m_curr_category ){ 200 if ( intCat != m_curr_category ){
201 // qWarning ("Categories: Selected %s.. Number: %d", cat.latin1(), m_curr_category); 201 // qWarning ("Categories: Selected %s.. Number: %d", cat.latin1(), m_curr_category);
202 202
203 m_curr_category = intCat; 203 m_curr_category = intCat;
204 emit signalClearLetterPicker(); 204 emit signalClearLetterPicker();
205 205
206 load(); 206 load();
207 } 207 }
208 208
209} 209}
210 210
211void AbView::setShowToView( Views view ) 211void AbView::setShowToView( Views view )
212{ 212{
213 qWarning("void AbView::setShowToView( View %d )", view); 213 qWarning("void AbView::setShowToView( View %d )", view);
214 214
215 if ( m_curr_View != view ){ 215 if ( m_curr_View != view ){
216 qWarning ("Change the View (Category is: %d)", m_curr_category); 216 qWarning ("Change the View (Category is: %d)", m_curr_category);
217 m_prev_View = m_curr_View; 217 m_prev_View = m_curr_View;
218 m_curr_View = view; 218 m_curr_View = view;
219 219
220 updateView(); 220 updateView();
221 } 221 }
222 222
223} 223}
224 224
225void AbView::setShowByLetter( char c, AbConfig::LPSearchMode mode ) 225void AbView::setShowByLetter( char c, AbConfig::LPSearchMode mode )
226{ 226{
227 qWarning("void AbView::setShowByLetter( %c, %d )", c, mode ); 227 qWarning("void AbView::setShowByLetter( %c, %d )", c, mode );
228 228
229 assert( mode < AbConfig::LASTELEMENT ); 229 assert( mode < AbConfig::LASTELEMENT );
230 230
231 OContact query; 231 Opie::OPimContact query;
232 if ( c == 0 ){ 232 if ( c == 0 ){
233 load(); 233 load();
234 return; 234 return;
235 }else{ 235 }else{
236 // If the current Backend is unable to solve the query, we will 236 // If the current Backend is unable to solve the query, we will
237 // ignore the request .. 237 // ignore the request ..
238 if ( ! m_contactdb->hasQuerySettings( OContactAccess::WildCards | OContactAccess::IgnoreCase ) ){ 238 if ( ! m_contactdb->hasQuerySettings( Opie::OPimContactAccess::WildCards | Opie::OPimContactAccess::IgnoreCase ) ){
239 return; 239 return;
240 } 240 }
241 241
242 switch( mode ){ 242 switch( mode ){
243 case AbConfig::LastName: 243 case AbConfig::LastName:
244 query.setLastName( QString("%1*").arg(c) ); 244 query.setLastName( QString("%1*").arg(c) );
245 break; 245 break;
246 case AbConfig::FileAs: 246 case AbConfig::FileAs:
247 query.setFileAs( QString("%1*").arg(c) ); 247 query.setFileAs( QString("%1*").arg(c) );
248 break; 248 break;
249 default: 249 default:
250 qWarning( "Unknown Searchmode for AbView::setShowByLetter ! -> %d", mode ); 250 qWarning( "Unknown Searchmode for AbView::setShowByLetter ! -> %d", mode );
251 qWarning( "I will ignore it.." ); 251 qWarning( "I will ignore it.." );
252 return; 252 return;
253 } 253 }
254 m_list = m_contactdb->queryByExample( query, OContactAccess::WildCards | OContactAccess::IgnoreCase ); 254 m_list = m_contactdb->queryByExample( query, Opie::OPimContactAccess::WildCards | Opie::OPimContactAccess::IgnoreCase );
255 if ( m_curr_category != -1 ) 255 if ( m_curr_category != -1 )
256 clearForCategory(); 256 clearForCategory();
257 m_curr_Contact = 0; 257 m_curr_Contact = 0;
258 } 258 }
259 updateView( true ); 259 updateView( true );
260} 260}
261 261
262void AbView::setListOrder( const QValueList<int>& ordered ) 262void AbView::setListOrder( const QValueList<int>& ordered )
263{ 263{
264 m_orderedFields = ordered; 264 m_orderedFields = ordered;
265 if ( m_abTable ){ 265 if ( m_abTable ){
266 m_abTable->setOrderedList( ordered ); 266 m_abTable->setOrderedList( ordered );
267 m_abTable->refresh(); 267 m_abTable->refresh();
268 } 268 }
269 updateView(); 269 updateView();
270} 270}
271 271
272 272
273QString AbView::showCategory() const 273QString AbView::showCategory() const
274{ 274{
275 return mCat.label( "Contacts", m_curr_category ); 275 return mCat.label( "Contacts", m_curr_category );
276} 276}
277 277
278void AbView::showPersonal( bool personal ) 278void AbView::showPersonal( bool personal )
279{ 279{
280 qWarning ("void AbView::showPersonal( %d )", personal); 280 qWarning ("void AbView::showPersonal( %d )", personal);
281 281
282 if ( personal ){ 282 if ( personal ){
283 283
284 if ( m_inPersonal ) 284 if ( m_inPersonal )
285 return; 285 return;
286 286
287 // Now switch to vCard Backend and load data. 287 // Now switch to vCard Backend and load data.
288 // The current default backend will be stored 288 // The current default backend will be stored
289 // to avoid unneeded load/stores. 289 // to avoid unneeded load/stores.
290 m_storedDB = m_contactdb; 290 m_storedDB = m_contactdb;
291 291
292 OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, 292 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null,
293 addressbookPersonalVCardName() ); 293 addressbookPersonalVCardName() );
294 m_contactdb = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); 294 m_contactdb = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true );
295 295
296 m_inPersonal = true; 296 m_inPersonal = true;
297 m_curr_View = CardView; 297 m_curr_View = CardView;
298 298
299 }else{ 299 }else{
300 300
301 if ( !m_inPersonal ) 301 if ( !m_inPersonal )
302 return; 302 return;
303 303
304 // Remove vCard Backend and restore default 304 // Remove vCard Backend and restore default
305 m_contactdb->save(); 305 m_contactdb->save();
306 delete m_contactdb; 306 delete m_contactdb;
307 307
308 m_contactdb = m_storedDB; 308 m_contactdb = m_storedDB;
309 m_storedDB = 0l; 309 m_storedDB = 0l;
310 310
311 m_curr_View = TableView; 311 m_curr_View = TableView;
312 m_inPersonal = false; 312 m_inPersonal = false;
313 313
314 } 314 }
315 load(); 315 load();
316} 316}
317 317
318void AbView::setCurrentUid( int uid ){ 318void AbView::setCurrentUid( int uid ){
319 319
320 m_curr_Contact = uid; 320 m_curr_Contact = uid;
321 updateView( true ); //true: Don't modificate the UID ! 321 updateView( true ); //true: Don't modificate the UID !
322} 322}
323 323
324 324
325QStringList AbView::categories() 325QStringList AbView::categories()
326{ 326{
327 mCat.load( categoryFileName() ); 327 mCat.load( categoryFileName() );
328 QStringList categoryList = mCat.labels( "Contacts" ); 328 QStringList categoryList = mCat.labels( "Contacts" );
329 return categoryList; 329 return categoryList;
330} 330}
331 331
332// BEGIN: Slots 332// BEGIN: Slots
333void AbView::slotDoFind( const QString &str, bool caseSensitive, bool useRegExp, 333void AbView::slotDoFind( const QString &str, bool caseSensitive, bool useRegExp,
334 bool , QString cat ) 334 bool , QString cat )
335{ 335{
336 //qWarning( "void AbView::slotDoFind" ); 336 //qWarning( "void AbView::slotDoFind" );
337 337
338 // We reloading the data: Deselect Letterpicker 338 // We reloading the data: Deselect Letterpicker
339 emit signalClearLetterPicker(); 339 emit signalClearLetterPicker();
340 340
341 // Use the current Category if nothing else selected 341 // Use the current Category if nothing else selected
342 int category = 0; 342 int category = 0;
343 343
344 if ( cat.isEmpty() ) 344 if ( cat.isEmpty() )
345 category = m_curr_category; 345 category = m_curr_category;
346 else{ 346 else{
347 category = mCat.id("Contacts", cat ); 347 category = mCat.id("Contacts", cat );
348 } 348 }
349 349
350 //qWarning ("Find in Category %d", category); 350 //qWarning ("Find in Category %d", category);
351 351
352 QRegExp r( str ); 352 QRegExp r( str );
353 r.setCaseSensitive( caseSensitive ); 353 r.setCaseSensitive( caseSensitive );
354 r.setWildcard( !useRegExp ); 354 r.setWildcard( !useRegExp );
355 355
356 // Get all matching entries out of the database 356 // Get all matching entries out of the database
357 m_list = m_contactdb->matchRegexp( r ); 357 m_list = m_contactdb->matchRegexp( r );
358 358
359 //qWarning( "found: %d", m_list.count() ); 359 //qWarning( "found: %d", m_list.count() );
360 if ( m_list.count() == 0 ){ 360 if ( m_list.count() == 0 ){
361 emit signalNotFound(); 361 emit signalNotFound();
362 return; 362 return;
363 } 363 }
364 364
365 // Now remove all contacts with wrong category (if any selected) 365 // Now remove all contacts with wrong category (if any selected)
366 // This algorithm is a litte bit ineffective, but 366 // This algorithm is a litte bit ineffective, but
367 // we will not have a lot of matching entries.. 367 // we will not have a lot of matching entries..
368 if ( m_curr_category != -1 ) 368 if ( m_curr_category != -1 )
369 clearForCategory(); 369 clearForCategory();
370 370
371 // Now show all found entries 371 // Now show all found entries
372 updateView( true ); 372 updateView( true );
373} 373}
374 374
375void AbView::offSearch() 375void AbView::offSearch()
376{ 376{
377 m_inSearch = false; 377 m_inSearch = false;
378 378
379 load(); 379 load();
380} 380}
381 381
382void AbView::slotSwitch(){ 382void AbView::slotSwitch(){
383 //qWarning("AbView::slotSwitch()"); 383 //qWarning("AbView::slotSwitch()");
384 384
385 m_prev_View = m_curr_View; 385 m_prev_View = m_curr_View;
386 switch ( (int) m_curr_View ){ 386 switch ( (int) m_curr_View ){
387 case TableView: 387 case TableView:
388 qWarning("Switching to CardView"); 388 qWarning("Switching to CardView");
389 m_curr_View = CardView; 389 m_curr_View = CardView;
390 break; 390 break;
391 case CardView: 391 case CardView:
392 qWarning("Switching to TableView"); 392 qWarning("Switching to TableView");
393 m_curr_View = TableView; 393 m_curr_View = TableView;
394 break; 394 break;
395 } 395 }
396 updateView(); 396 updateView();
397 397
398} 398}
399 399
400// END: Slots 400// END: Slots
401 401
402void AbView::clearForCategory() 402void AbView::clearForCategory()
403{ 403{
404 OContactAccess::List::Iterator it; 404 Opie::OPimContactAccess::List::Iterator it;
405 // Now remove all contacts with wrong category if any category selected 405 // Now remove all contacts with wrong category if any category selected
406 406
407 OContactAccess::List allList = m_list; 407 Opie::OPimContactAccess::List allList = m_list;
408 if ( m_curr_category != -1 ){ 408 if ( m_curr_category != -1 ){
409 for ( it = allList.begin(); it != allList.end(); ++it ){ 409 for ( it = allList.begin(); it != allList.end(); ++it ){
410 if ( !contactCompare( *it, m_curr_category ) ){ 410 if ( !contactCompare( *it, m_curr_category ) ){
411 // qWarning("Removing %d", (*it).uid()); 411 // qWarning("Removing %d", (*it).uid());
412 m_list.remove( (*it).uid() ); 412 m_list.remove( (*it).uid() );
413 } 413 }
414 } 414 }
415 } 415 }
416 416
417} 417}
418 418
419bool AbView::contactCompare( const OContact &cnt, int category ) 419bool AbView::contactCompare( const Opie::OPimContact &cnt, int category )
420{ 420{
421 //qWarning ("bool AbView::contactCompare( const OContact &cnt, %d )", category); 421 //qWarning ("bool AbView::contactCompare( const Opie::OPimContact &cnt, %d )", category);
422 422
423 bool returnMe; 423 bool returnMe;
424 QArray<int> cats; 424 QArray<int> cats;
425 cats = cnt.categories(); 425 cats = cnt.categories();
426 426
427 //qWarning ("Number of categories: %d", cats.count() ); 427 //qWarning ("Number of categories: %d", cats.count() );
428 428
429 returnMe = false; 429 returnMe = false;
430 if ( cats.count() == 0 && category == 0 ) 430 if ( cats.count() == 0 && category == 0 )
431 // Contacts with no category will just shown on "All" and "Unfiled" 431 // Contacts with no category will just shown on "All" and "Unfiled"
432 returnMe = true; 432 returnMe = true;
433 else { 433 else {
434 int i; 434 int i;
435 for ( i = 0; i < int(cats.count()); i++ ) { 435 for ( i = 0; i < int(cats.count()); i++ ) {
436 // qWarning("Comparing %d with %d",cats[i],category ); 436 // qWarning("Comparing %d with %d",cats[i],category );
437 if ( cats[i] == category ) { 437 if ( cats[i] == category ) {
438 returnMe = true; 438 returnMe = true;
439 break; 439 break;
440 } 440 }
441 } 441 }
442 } 442 }
443 //qWarning ("Return: %d", returnMe); 443 //qWarning ("Return: %d", returnMe);
444 return returnMe; 444 return returnMe;
445} 445}
446 446
447// In Some rare cases we have to update all lists.. 447// In Some rare cases we have to update all lists..
448void AbView::updateListinViews() 448void AbView::updateListinViews()
449{ 449{
450 m_abTable -> setContacts( m_list ); 450 m_abTable -> setContacts( m_list );
451 m_ablabel -> setContacts( m_list ); 451 m_ablabel -> setContacts( m_list );
452} 452}
453 453
454void AbView::updateView( bool newdata ) 454void AbView::updateView( bool newdata )
455{ 455{
456 //qWarning("AbView::updateView()"); 456 //qWarning("AbView::updateView()");
457 457
458 if ( m_viewStack -> visibleWidget() ){ 458 if ( m_viewStack -> visibleWidget() ){
459 m_viewStack -> visibleWidget() -> clearFocus(); 459 m_viewStack -> visibleWidget() -> clearFocus();
460 } 460 }
461 461
462 // If we switching the view, we have to store some information 462 // If we switching the view, we have to store some information
463 if ( !newdata ){ 463 if ( !newdata ){
464 if ( m_list.count() ){ 464 if ( m_list.count() ){
465 switch ( (int) m_prev_View ) { 465 switch ( (int) m_prev_View ) {
466 case TableView: 466 case TableView:
467 m_curr_Contact = m_abTable -> currentEntry_UID(); 467 m_curr_Contact = m_abTable -> currentEntry_UID();
468 break; 468 break;
469 case CardView: 469 case CardView:
diff --git a/core/pim/addressbook/abview.h b/core/pim/addressbook/abview.h
index 49bb4be..b8c8a08 100644
--- a/core/pim/addressbook/abview.h
+++ b/core/pim/addressbook/abview.h
@@ -1,89 +1,90 @@
1#ifndef _ABVIEW_H_ 1#ifndef _ABVIEW_H_
2#define _ABVIEW_H_ 2#define _ABVIEW_H_
3 3
4#include <qwidget.h> 4#include <opie2/opimcontact.h>
5#include <qwidgetstack.h> 5#include <opie2/ocontactaccess.h>
6 6
7#include <qpe/categories.h> 7#include <qpe/categories.h>
8#include <opie/ocontact.h> 8
9#include <opie/ocontactaccess.h> 9#include <qwidget.h>
10#include <qwidgetstack.h>
10 11
11#include "contacteditor.h" 12#include "contacteditor.h"
12#include "abtable.h" 13#include "abtable.h"
13#include "ablabel.h" 14#include "ablabel.h"
14#include "abconfig.h" 15#include "abconfig.h"
15 16
16class AbView: public QWidget 17class AbView: public QWidget
17{ 18{
18 Q_OBJECT 19 Q_OBJECT
19 20
20public: 21public:
21 enum Views{ TableView=0, CardView, PersonalView }; 22 enum Views{ TableView=0, CardView, PersonalView };
22 23
23 AbView( QWidget* parent, const QValueList<int>& ordered ); 24 AbView( QWidget* parent, const QValueList<int>& ordered );
24 ~AbView(); 25 ~AbView();
25 26
26 bool save(); 27 bool save();
27 void load(); 28 void load();
28 void reload(); 29 void reload();
29 void clear(); 30 void clear();
30 31
31 void setView( Views view ); 32 void setView( Views view );
32 void showPersonal( bool personal ); 33 void showPersonal( bool personal );
33 void setCurrentUid( int uid ); 34 void setCurrentUid( int uid );
34 void setShowByCategory( const QString& cat ); 35 void setShowByCategory( const QString& cat );
35 void setShowToView( Views view ); 36 void setShowToView( Views view );
36 void setShowByLetter( char c, AbConfig::LPSearchMode mode = AbConfig::LastName ); 37 void setShowByLetter( char c, AbConfig::LPSearchMode mode = AbConfig::LastName );
37 void setListOrder( const QValueList<int>& ordered ); 38 void setListOrder( const QValueList<int>& ordered );
38 39
39 // Add Entry and put to current 40 // Add Entry and put to current
40 void addEntry( const OContact &newContact ); 41 void addEntry( const Opie::OPimContact &newContact );
41 void removeEntry( const int UID ); 42 void removeEntry( const int UID );
42 void replaceEntry( const OContact &contact ); 43 void replaceEntry( const Opie::OPimContact &contact );
43 OContact currentEntry(); 44 Opie::OPimContact currentEntry();
44 45
45 void inSearch() { m_inSearch = true; } 46 void inSearch() { m_inSearch = true; }
46 void offSearch(); 47 void offSearch();
47 48
48 QString showCategory() const; 49 QString showCategory() const;
49 QStringList categories(); 50 QStringList categories();
50 51
51signals: 52signals:
52 void signalNotFound(); 53 void signalNotFound();
53 void signalClearLetterPicker(); 54 void signalClearLetterPicker();
54 void signalViewSwitched ( int ); 55 void signalViewSwitched ( int );
55 56
56public slots: 57public slots:
57 void slotDoFind( const QString &str, bool caseSensitive, bool useRegExp, 58 void slotDoFind( const QString &str, bool caseSensitive, bool useRegExp,
58 bool backwards, QString category = QString::null ); 59 bool backwards, QString category = QString::null );
59 void slotSwitch(); 60 void slotSwitch();
60 61
61private: 62private:
62 void updateListinViews(); 63 void updateListinViews();
63 void updateView( bool newdata = false ); 64 void updateView( bool newdata = false );
64 void clearForCategory(); 65 void clearForCategory();
65 bool contactCompare( const OContact &cnt, int category ); 66 bool contactCompare( const Opie::OPimContact &cnt, int category );
66 void parseName( const QString& name, QString *first, QString *middle, 67 void parseName( const QString& name, QString *first, QString *middle,
67 QString * last ); 68 QString * last );
68 69
69 Categories mCat; 70 Categories mCat;
70 bool m_inSearch; 71 bool m_inSearch;
71 bool m_inPersonal; 72 bool m_inPersonal;
72 int m_curr_category; 73 int m_curr_category;
73 Views m_curr_View; 74 Views m_curr_View;
74 Views m_prev_View; 75 Views m_prev_View;
75 int m_curr_Contact; 76 int m_curr_Contact;
76 77
77 OContactAccess* m_contactdb; 78 Opie::OPimContactAccess* m_contactdb;
78 OContactAccess* m_storedDB; 79 Opie::OPimContactAccess* m_storedDB;
79 OContactAccess::List m_list; 80 Opie::OPimContactAccess::List m_list;
80 81
81 QWidgetStack* m_viewStack; 82 QWidgetStack* m_viewStack;
82 AbTable* m_abTable; 83 AbTable* m_abTable;
83 AbLabel* m_ablabel; 84 AbLabel* m_ablabel;
84 85
85 QValueList<int> m_orderedFields; 86 QValueList<int> m_orderedFields;
86}; 87};
87 88
88 89
89#endif 90#endif
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp
index 8a5f9d5..9ae66d1 100644
--- a/core/pim/addressbook/addressbook.cpp
+++ b/core/pim/addressbook/addressbook.cpp
@@ -1,77 +1,77 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** Copyright (C) 2003 Stefan Eilers (eilers.stefan@epost.de) 3** Copyright (C) 2003 Stefan Eilers (eilers.stefan@epost.de)
4** 4**
5** This file is part of the Open Palmtop Environment (see www.opie.info). 5** This file is part of the Open Palmtop Environment (see www.opie.info).
6** 6**
7** This file may be distributed and/or modified under the terms of the 7** This file may be distributed and/or modified under the terms of the
8** GNU General Public License version 2 as published by the Free Software 8** GNU General Public License version 2 as published by the Free Software
9** Foundation and appearing in the file LICENSE.GPL included in the 9** Foundation and appearing in the file LICENSE.GPL included in the
10** packaging of this file. 10** packaging of this file.
11** 11**
12** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 12** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
13** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 13** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
14** 14**
15** See http://www.trolltech.com/gpl/ for GPL licensing information. 15** See http://www.trolltech.com/gpl/ for GPL licensing information.
16** 16**
17** 17**
18**********************************************************************/ 18**********************************************************************/
19 19
20#define QTOPIA_INTERNAL_FD 20#define QTOPIA_INTERNAL_FD
21 21
22// #include "addresssettings.h" 22// #include "addresssettings.h"
23#include "addressbook.h" 23#include "addressbook.h"
24 24
25 25
26#include <opie/ofileselector.h> 26#include <opie2/ofileselector.h>
27#include <opie/ofiledialog.h> 27#include <opie2/ofiledialog.h>
28#include <opie/ocontact.h> 28#include <opie2/opimcontact.h>
29#include <opie/ocontactaccessbackend_vcard.h> 29#include <opie2/ocontactaccessbackend_vcard.h>
30 30
31#include <qpe/resource.h> 31#include <qpe/resource.h>
32#include <qpe/ir.h> 32#include <qpe/ir.h>
33#include <qpe/qpemessagebox.h> 33#include <qpe/qpemessagebox.h>
34#include <qmenubar.h> 34#include <qmenubar.h>
35// #include <qtoolbar.h> 35// #include <qtoolbar.h>
36// #include <qmenubar.h> 36// #include <qmenubar.h>
37#include <qpe/qpeapplication.h> 37#include <qpe/qpeapplication.h>
38 38
39#include <qaction.h> 39#include <qaction.h>
40#include <qlayout.h> 40#include <qlayout.h>
41#include <qmessagebox.h> 41#include <qmessagebox.h>
42#include <qtoolbutton.h> 42#include <qtoolbutton.h>
43 43
44#include <stdlib.h> 44#include <stdlib.h>
45#include <sys/stat.h> 45#include <sys/stat.h>
46#include <sys/types.h> 46#include <sys/types.h>
47#include <fcntl.h> 47#include <fcntl.h>
48#include <unistd.h> 48#include <unistd.h>
49 49
50 50
51#include "picker.h" 51#include "picker.h"
52#include "configdlg.h" 52#include "configdlg.h"
53 53
54extern QString addressbookPersonalVCardName(); 54extern QString addressbookPersonalVCardName();
55 55
56AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, 56AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
57 WFlags f ) 57 WFlags f )
58 : QMainWindow( parent, name, f ), 58 : QMainWindow( parent, name, f ),
59 catMenu (0l), 59 catMenu (0l),
60 abEditor(0l), 60 abEditor(0l),
61 syncing(FALSE), 61 syncing(FALSE),
62 m_tableViewButton(0l), 62 m_tableViewButton(0l),
63 m_cardViewButton(0l) 63 m_cardViewButton(0l)
64{ 64{
65 isLoading = true; 65 isLoading = true;
66 66
67 m_config.load(); 67 m_config.load();
68 68
69 setCaption( tr("Contacts") ); 69 setCaption( tr("Contacts") );
70 setIcon( Resource::loadPixmap( "AddressBook" ) ); 70 setIcon( Resource::loadPixmap( "AddressBook" ) );
71 71
72 // Settings for Main Menu 72 // Settings for Main Menu
73 // setToolBarsMovable( false ); 73 // setToolBarsMovable( false );
74 setToolBarsMovable( !m_config.fixedBars() ); 74 setToolBarsMovable( !m_config.fixedBars() );
75 setRightJustification( true ); 75 setRightJustification( true );
76 76
77 QToolBar *bar = new QToolBar( this ); 77 QToolBar *bar = new QToolBar( this );
@@ -272,537 +272,537 @@ void AddressbookWindow::slotConfig()
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 = Opie::Ui::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}
326void AddressbookWindow::exportvCard() 326void AddressbookWindow::exportvCard()
327{ 327{
328 qWarning(" void AddressbookWindow::exportvCard()"); 328 qWarning(" void AddressbookWindow::exportvCard()");
329 QString filename = OFileDialog::getSaveFileName( 1,"/home/"); //,"", "*", this ); 329 QString filename = Opie::Ui::OFileDialog::getSaveFileName( 1,"/home/"); //,"", "*", this );
330 if( !filename.isEmpty() && ( filename[filename.length()-1] != '/' ) ){ 330 if( !filename.isEmpty() && ( filename[filename.length()-1] != '/' ) ){
331 qWarning(" Save to file %s, (%d)", filename.latin1(), filename.length()-1 ); 331 qWarning(" Save to file %s, (%d)", filename.latin1(), filename.length()-1 );
332 OContact curCont = m_abView->currentEntry(); 332 Opie::OPimContact curCont = m_abView->currentEntry();
333 if ( !curCont.isEmpty() ){ 333 if ( !curCont.isEmpty() ){
334 OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, 334 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null,
335 filename ); 335 filename );
336 OContactAccess* access = new OContactAccess ( "addressbook_exp", QString::null , vcard_backend, true ); 336 Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook_exp", QString::null , vcard_backend, true );
337 if ( access ){ 337 if ( access ){
338 access->add( curCont ); 338 access->add( curCont );
339 access->save(); 339 access->save();
340 } 340 }
341 delete access; 341 delete access;
342 }else 342 }else
343 QMessageBox::critical( 0, "Export VCard", 343 QMessageBox::critical( 0, "Export VCard",
344 QString( tr( "You have to select a contact !") ) ); 344 QString( tr( "You have to select a contact !") ) );
345 345
346 }else 346 }else
347 QMessageBox::critical( 0, "Export VCard", 347 QMessageBox::critical( 0, "Export VCard",
348 QString( tr( "You have to set a filename !") ) ); 348 QString( tr( "You have to set a filename !") ) );
349} 349}
350 350
351void AddressbookWindow::setDocument( const QString &filename ) 351void AddressbookWindow::setDocument( const QString &filename )
352{ 352{
353 qWarning( "void AddressbookWindow::setDocument( %s )", filename.latin1() ); 353 qWarning( "void AddressbookWindow::setDocument( %s )", filename.latin1() );
354 354
355 if ( filename.find(".vcf") != int(filename.length()) - 4 ){ 355 if ( filename.find(".vcf") != int(filename.length()) - 4 ){
356 356
357 357
358 358
359 switch( QMessageBox::information( this, tr ( "Right file type ?" ), 359 switch( QMessageBox::information( this, tr ( "Right file type ?" ),
360 tr( "The selected file \n does not end with \".vcf\".\n Do you really want to open it?" ), 360 tr( "The selected file \n does not end with \".vcf\".\n Do you really want to open it?" ),
361 tr( "&Yes" ), tr( "&No" ), QString::null, 361 tr( "&Yes" ), tr( "&No" ), QString::null,
362 0, // Enter == button 0 362 0, // Enter == button 0
363 2 ) ) { // Escape == button 2 363 2 ) ) { // Escape == button 2
364 case 0: 364 case 0:
365 qWarning("YES clicked"); 365 qWarning("YES clicked");
366 break; 366 break;
367 case 1: 367 case 1:
368 qWarning("NO clicked"); 368 qWarning("NO clicked");
369 return; 369 return;
370 break; 370 break;
371 } 371 }
372 } 372 }
373 373
374 OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, 374 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null,
375 filename ); 375 filename );
376 OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); 376 Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true );
377 OContactAccess::List allList = access->allRecords(); 377 Opie::OPimContactAccess::List allList = access->allRecords();
378 qWarning( "Found number of contacts in File: %d", allList.count() ); 378 qWarning( "Found number of contacts in File: %d", allList.count() );
379 379
380 if ( !allList.count() ) { 380 if ( !allList.count() ) {
381 QMessageBox::information( this, "Import VCard", 381 QMessageBox::information( this, "Import VCard",
382 "It was impossible to import\nthe VCard.\n" 382 "It was impossible to import\nthe VCard.\n"
383 "The VCard may be corrupted!" ); 383 "The VCard may be corrupted!" );
384 } 384 }
385 385
386 bool doAsk = true; 386 bool doAsk = true;
387 OContactAccess::List::Iterator it; 387 Opie::OPimContactAccess::List::Iterator it;
388 for ( it = allList.begin(); it != allList.end(); ++it ){ 388 for ( it = allList.begin(); it != allList.end(); ++it ){
389 qWarning("Adding Contact from: %s", (*it).fullName().latin1() ); 389 qWarning("Adding Contact from: %s", (*it).fullName().latin1() );
390 if ( doAsk ){ 390 if ( doAsk ){
391 switch( QMessageBox::information( this, tr ( "Add Contact?" ), 391 switch( QMessageBox::information( this, tr ( "Add Contact?" ),
392 tr( "Do you really want add contact for \n%1?" ) 392 tr( "Do you really want add contact for \n%1?" )
393 .arg( (*it).fullName().latin1() ), 393 .arg( (*it).fullName().latin1() ),
394 tr( "&Yes" ), tr( "&No" ), tr( "&All Yes"), 394 tr( "&Yes" ), tr( "&No" ), tr( "&All Yes"),
395 0, // Enter == button 0 395 0, // Enter == button 0
396 2 ) ) { // Escape == button 2 396 2 ) ) { // Escape == button 2
397 case 0: 397 case 0:
398 qWarning("YES clicked"); 398 qWarning("YES clicked");
399 m_abView->addEntry( *it ); 399 m_abView->addEntry( *it );
400 break; 400 break;
401 case 1: 401 case 1:
402 qWarning("NO clicked"); 402 qWarning("NO clicked");
403 break; 403 break;
404 case 2: 404 case 2:
405 qWarning("YesAll clicked"); 405 qWarning("YesAll clicked");
406 doAsk = false; 406 doAsk = false;
407 break; 407 break;
408 } 408 }
409 }else 409 }else
410 m_abView->addEntry( *it ); 410 m_abView->addEntry( *it );
411 411
412 } 412 }
413 413
414 delete access; 414 delete access;
415} 415}
416 416
417void AddressbookWindow::resizeEvent( QResizeEvent *e ) 417void AddressbookWindow::resizeEvent( QResizeEvent *e )
418{ 418{
419 QMainWindow::resizeEvent( e ); 419 QMainWindow::resizeEvent( e );
420 420
421 421
422} 422}
423 423
424AddressbookWindow::~AddressbookWindow() 424AddressbookWindow::~AddressbookWindow()
425{ 425{
426 ToolBarDock dock; 426 ToolBarDock dock;
427 int dummy; 427 int dummy;
428 bool bDummy; 428 bool bDummy;
429 getLocation ( listTools, dock, dummy, bDummy, dummy ); 429 getLocation ( listTools, dock, dummy, bDummy, dummy );
430 m_config.setToolBarDock( dock ); 430 m_config.setToolBarDock( dock );
431 m_config.save(); 431 m_config.save();
432} 432}
433 433
434void AddressbookWindow::slotUpdateToolbar() 434void AddressbookWindow::slotUpdateToolbar()
435{ 435{
436 OContact ce = m_abView->currentEntry(); 436 Opie::OPimContact ce = m_abView->currentEntry();
437 actionMail->setEnabled( !ce.defaultEmail().isEmpty() ); 437 actionMail->setEnabled( !ce.defaultEmail().isEmpty() );
438} 438}
439 439
440void AddressbookWindow::slotListNew() 440void AddressbookWindow::slotListNew()
441{ 441{
442 OContact cnt; 442 Opie::OPimContact cnt;
443 if( !syncing ) { 443 if( !syncing ) {
444 editEntry( NewEntry ); 444 editEntry( NewEntry );
445 } else { 445 } else {
446 QMessageBox::warning(this, tr("Contacts"), 446 QMessageBox::warning(this, tr("Contacts"),
447 tr("Can not edit data, currently syncing")); 447 tr("Can not edit data, currently syncing"));
448 } 448 }
449} 449}
450 450
451// void AddressbookWindow::slotListView() 451// void AddressbookWindow::slotListView()
452// { 452// {
453 // m_abView -> init( abList->currentEntry() ); 453 // m_abView -> init( abList->currentEntry() );
454 // // :SX mView->sync(); 454 // // :SX mView->sync();
455 // //:SXshowView(); 455 // //:SXshowView();
456// } 456// }
457 457
458void AddressbookWindow::slotListDelete() 458void AddressbookWindow::slotListDelete()
459{ 459{
460 if(!syncing) { 460 if(!syncing) {
461 OContact tmpEntry = m_abView ->currentEntry(); 461 Opie::OPimContact tmpEntry = m_abView ->currentEntry();
462 462
463 // get a name, do the best we can... 463 // get a name, do the best we can...
464 QString strName = tmpEntry.fullName(); 464 QString strName = tmpEntry.fullName();
465 if ( strName.isEmpty() ) { 465 if ( strName.isEmpty() ) {
466 strName = tmpEntry.company(); 466 strName = tmpEntry.company();
467 if ( strName.isEmpty() ) 467 if ( strName.isEmpty() )
468 strName = "No Name"; 468 strName = "No Name";
469 } 469 }
470 470
471 471
472 if ( QPEMessageBox::confirmDelete( this, tr( "Contacts" ), 472 if ( QPEMessageBox::confirmDelete( this, tr( "Contacts" ),
473 strName ) ) { 473 strName ) ) {
474 m_abView->removeEntry( tmpEntry.uid() ); 474 m_abView->removeEntry( tmpEntry.uid() );
475 } 475 }
476 } else { 476 } else {
477 QMessageBox::warning( this, tr("Contacts"), 477 QMessageBox::warning( this, tr("Contacts"),
478 tr("Can not edit data, currently syncing") ); 478 tr("Can not edit data, currently syncing") );
479 } 479 }
480} 480}
481 481
482void AddressbookWindow::slotFindOpen() 482void AddressbookWindow::slotFindOpen()
483{ 483{
484 searchBar->show(); 484 searchBar->show();
485 m_abView -> inSearch(); 485 m_abView -> inSearch();
486 searchEdit->setFocus(); 486 searchEdit->setFocus();
487} 487}
488void AddressbookWindow::slotFindClose() 488void AddressbookWindow::slotFindClose()
489{ 489{
490 searchBar->hide(); 490 searchBar->hide();
491 m_abView -> offSearch(); 491 m_abView -> offSearch();
492 // m_abView->setFocus(); 492 // m_abView->setFocus();
493} 493}
494 494
495 495
496void AddressbookWindow::slotFind() 496void AddressbookWindow::slotFind()
497{ 497{
498 m_abView->slotDoFind( searchEdit->text(), m_config.beCaseSensitive(), m_config.useRegExp(), false); 498 m_abView->slotDoFind( searchEdit->text(), m_config.beCaseSensitive(), m_config.useRegExp(), false);
499 499
500 searchEdit->clearFocus(); 500 searchEdit->clearFocus();
501 // m_abView->setFocus(); 501 // m_abView->setFocus();
502 502
503} 503}
504 504
505void AddressbookWindow::slotViewBack() 505void AddressbookWindow::slotViewBack()
506{ 506{
507 // :SX showList(); 507 // :SX showList();
508} 508}
509 509
510void AddressbookWindow::slotViewEdit() 510void AddressbookWindow::slotViewEdit()
511{ 511{
512 if(!syncing) { 512 if(!syncing) {
513 if (actionPersonal->isOn()) { 513 if (actionPersonal->isOn()) {
514 editPersonal(); 514 editPersonal();
515 } else { 515 } else {
516 editEntry( EditEntry ); 516 editEntry( EditEntry );
517 } 517 }
518 } else { 518 } else {
519 QMessageBox::warning( this, tr("Contacts"), 519 QMessageBox::warning( this, tr("Contacts"),
520 tr("Can not edit data, currently syncing") ); 520 tr("Can not edit data, currently syncing") );
521 } 521 }
522} 522}
523 523
524 524
525 525
526void AddressbookWindow::writeMail() 526void AddressbookWindow::writeMail()
527{ 527{
528 OContact c = m_abView -> currentEntry(); 528 Opie::OPimContact c = m_abView -> currentEntry();
529 QString name = c.fileAs(); 529 QString name = c.fileAs();
530 QString email = c.defaultEmail(); 530 QString email = c.defaultEmail();
531 531
532 // I prefer the OPIE-Environment variable before the 532 // I prefer the OPIE-Environment variable before the
533 // QPE-one.. 533 // QPE-one..
534 QString basepath = QString::fromLatin1( getenv("OPIEDIR") ); 534 QString basepath = QString::fromLatin1( getenv("OPIEDIR") );
535 if ( basepath.isEmpty() ) 535 if ( basepath.isEmpty() )
536 basepath = QString::fromLatin1( getenv("QPEDIR") ); 536 basepath = QString::fromLatin1( getenv("QPEDIR") );
537 537
538 // Try to access the preferred. If not possible, try to 538 // Try to access the preferred. If not possible, try to
539 // switch to the other one.. 539 // switch to the other one..
540 if ( m_config.useQtMail() ){ 540 if ( m_config.useQtMail() ){
541 qWarning ("Accessing: %s", (basepath + "/bin/qtmail").latin1()); 541 qWarning ("Accessing: %s", (basepath + "/bin/qtmail").latin1());
542 if ( QFile::exists( basepath + "/bin/qtmail" ) ){ 542 if ( QFile::exists( basepath + "/bin/qtmail" ) ){
543 qWarning ("QCop"); 543 qWarning ("QCop");
544 QCopEnvelope e("QPE/Application/qtmail", "writeMail(QString,QString)"); 544 QCopEnvelope e("QPE/Application/qtmail", "writeMail(QString,QString)");
545 e << name << email; 545 e << name << email;
546 return; 546 return;
547 } else 547 } else
548 m_config.setUseOpieMail( true ); 548 m_config.setUseOpieMail( true );
549 } 549 }
550 if ( m_config.useOpieMail() ){ 550 if ( m_config.useOpieMail() ){
551 qWarning ("Accessing: %s", (basepath + "/bin/opiemail").latin1()); 551 qWarning ("Accessing: %s", (basepath + "/bin/opiemail").latin1());
552 if ( QFile::exists( basepath + "/bin/opiemail" ) ){ 552 if ( QFile::exists( basepath + "/bin/opiemail" ) ){
553 qWarning ("QCop"); 553 qWarning ("QCop");
554 QCopEnvelope e("QPE/Application/opiemail", "writeMail(QString,QString)"); 554 QCopEnvelope e("QPE/Application/opiemail", "writeMail(QString,QString)");
555 e << name << email; 555 e << name << email;
556 return; 556 return;
557 } else 557 } else
558 m_config.setUseQtMail( true ); 558 m_config.setUseQtMail( true );
559 } 559 }
560 560
561} 561}
562 562
563static const char * beamfile = "/tmp/obex/contact.vcf"; 563static const char * beamfile = "/tmp/obex/contact.vcf";
564 564
565void AddressbookWindow::slotBeam() 565void AddressbookWindow::slotBeam()
566{ 566{
567 QString beamFilename; 567 QString beamFilename;
568 OContact c; 568 Opie::OPimContact c;
569 if ( actionPersonal->isOn() ) { 569 if ( actionPersonal->isOn() ) {
570 beamFilename = addressbookPersonalVCardName(); 570 beamFilename = addressbookPersonalVCardName();
571 if ( !QFile::exists( beamFilename ) ) 571 if ( !QFile::exists( beamFilename ) )
572 return; // can't beam a non-existent file 572 return; // can't beam a non-existent file
573 OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, 573 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null,
574 beamFilename ); 574 beamFilename );
575 OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); 575 Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true );
576 OContactAccess::List allList = access->allRecords(); 576 Opie::OPimContactAccess::List allList = access->allRecords();
577 OContactAccess::List::Iterator it = allList.begin(); // Just take first 577 Opie::OPimContactAccess::List::Iterator it = allList.begin(); // Just take first
578 c = *it; 578 c = *it;
579 579
580 delete access; 580 delete access;
581 } else { 581 } else {
582 unlink( beamfile ); // delete if exists 582 unlink( beamfile ); // delete if exists
583 mkdir("/tmp/obex/", 0755); 583 mkdir("/tmp/obex/", 0755);
584 c = m_abView -> currentEntry(); 584 c = m_abView -> currentEntry();
585 OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, 585 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null,
586 beamfile ); 586 beamfile );
587 OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); 587 Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true );
588 access->add( c ); 588 access->add( c );
589 access->save(); 589 access->save();
590 delete access; 590 delete access;
591 591
592 beamFilename = beamfile; 592 beamFilename = beamfile;
593 } 593 }
594 594
595 qWarning("Beaming: %s", beamFilename.latin1() ); 595 qWarning("Beaming: %s", beamFilename.latin1() );
596 596
597 Ir *ir = new Ir( this ); 597 Ir *ir = new Ir( this );
598 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); 598 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) );
599 QString description = c.fullName(); 599 QString description = c.fullName();
600 ir->send( beamFilename, description, "text/x-vCard" ); 600 ir->send( beamFilename, description, "text/x-vCard" );
601} 601}
602 602
603void AddressbookWindow::beamDone( Ir *ir ) 603void AddressbookWindow::beamDone( Ir *ir )
604{ 604{
605 605
606 delete ir; 606 delete ir;
607 unlink( beamfile ); 607 unlink( beamfile );
608} 608}
609 609
610 610
611static void parseName( const QString& name, QString *first, QString *middle, 611static void parseName( const QString& name, QString *first, QString *middle,
612 QString * last ) 612 QString * last )
613{ 613{
614 614
615 int comma = name.find ( "," ); 615 int comma = name.find ( "," );
616 QString rest; 616 QString rest;
617 if ( comma > 0 ) { 617 if ( comma > 0 ) {
618 *last = name.left( comma ); 618 *last = name.left( comma );
619 comma++; 619 comma++;
620 while ( comma < int(name.length()) && name[comma] == ' ' ) 620 while ( comma < int(name.length()) && name[comma] == ' ' )
621 comma++; 621 comma++;
622 rest = name.mid( comma ); 622 rest = name.mid( comma );
623 } else { 623 } else {
624 int space = name.findRev( ' ' ); 624 int space = name.findRev( ' ' );
625 *last = name.mid( space+1 ); 625 *last = name.mid( space+1 );
626 rest = name.left( space ); 626 rest = name.left( space );
627 } 627 }
628 int space = rest.find( ' ' ); 628 int space = rest.find( ' ' );
629 if ( space <= 0 ) { 629 if ( space <= 0 ) {
630 *first = rest; 630 *first = rest;
631 } else { 631 } else {
632 *first = rest.left( space ); 632 *first = rest.left( space );
633 *middle = rest.mid( space+1 ); 633 *middle = rest.mid( space+1 );
634 } 634 }
635 635
636} 636}
637 637
638 638
639void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data) 639void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data)
640{ 640{
641 bool needShow = FALSE; 641 bool needShow = FALSE;
642 qWarning("Receiving QCop-Call with message %s", QString( msg ).latin1() ); 642 qWarning("Receiving QCop-Call with message %s", QString( msg ).latin1() );
643 643
644 644
645 if (msg == "editPersonal()") { 645 if (msg == "editPersonal()") {
646 editPersonal(); 646 editPersonal();
647 } else if (msg == "editPersonalAndClose()") { 647 } else if (msg == "editPersonalAndClose()") {
648 editPersonal(); 648 editPersonal();
649 close(); 649 close();
650 } else if ( msg == "addContact(QString,QString)" ) { 650 } else if ( msg == "addContact(QString,QString)" ) {
651 QDataStream stream(data,IO_ReadOnly); 651 QDataStream stream(data,IO_ReadOnly);
652 QString name, email; 652 QString name, email;
653 stream >> name >> email; 653 stream >> name >> email;
654 654
655 OContact cnt; 655 Opie::OPimContact cnt;
656 QString fn, mn, ln; 656 QString fn, mn, ln;
657 parseName( name, &fn, &mn, &ln ); 657 parseName( name, &fn, &mn, &ln );
658 // qDebug( " %s - %s - %s", fn.latin1(), mn.latin1(), ln.latin1() ); 658 // qDebug( " %s - %s - %s", fn.latin1(), mn.latin1(), ln.latin1() );
659 cnt.setFirstName( fn ); 659 cnt.setFirstName( fn );
660 cnt.setMiddleName( mn ); 660 cnt.setMiddleName( mn );
661 cnt.setLastName( ln ); 661 cnt.setLastName( ln );
662 cnt.insertEmails( email ); 662 cnt.insertEmails( email );
663 cnt.setDefaultEmail( email ); 663 cnt.setDefaultEmail( email );
664 cnt.setFileAs(); 664 cnt.setFileAs();
665 665
666 m_abView -> addEntry( cnt ); 666 m_abView -> addEntry( cnt );
667 667
668 // :SXm_abView()->init( cnt ); 668 // :SXm_abView()->init( cnt );
669 editEntry( EditEntry ); 669 editEntry( EditEntry );
670 } else if ( msg == "beamBusinessCard()" ) { 670 } else if ( msg == "beamBusinessCard()" ) {
671 QString beamFilename = addressbookPersonalVCardName(); 671 QString beamFilename = addressbookPersonalVCardName();
672 if ( !QFile::exists( beamFilename ) ) 672 if ( !QFile::exists( beamFilename ) )
673 return; // can't beam a non-existent file 673 return; // can't beam a non-existent file
674 674
675 Ir *ir = new Ir( this ); 675 Ir *ir = new Ir( this );
676 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); 676 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) );
677 QString description = "mycard.vcf"; 677 QString description = "mycard.vcf";
678 ir->send( beamFilename, description, "text/x-vCard" ); 678 ir->send( beamFilename, description, "text/x-vCard" );
679 } else if ( msg == "show(int)" ) { 679 } else if ( msg == "show(int)" ) {
680 raise(); 680 raise();
681 QDataStream stream(data,IO_ReadOnly); 681 QDataStream stream(data,IO_ReadOnly);
682 int uid; 682 int uid;
683 stream >> uid; 683 stream >> uid;
684 684
685 qWarning( "Showing uid: %d" , uid ); 685 qWarning( "Showing uid: %d" , uid );
686 686
687 // Deactivate Personal View.. 687 // Deactivate Personal View..
688 if ( actionPersonal->isOn() ){ 688 if ( actionPersonal->isOn() ){
689 actionPersonal->setOn( false ); 689 actionPersonal->setOn( false );
690 slotPersonalView(); 690 slotPersonalView();
691 } 691 }
692 692
693 // Reset category and show as card.. 693 // Reset category and show as card..
694 m_abView -> setShowByCategory( QString::null ); 694 m_abView -> setShowByCategory( QString::null );
695 m_abView -> setCurrentUid( uid ); 695 m_abView -> setCurrentUid( uid );
696 slotViewSwitched ( AbView::CardView ); 696 slotViewSwitched ( AbView::CardView );
697 697
698 needShow = true; 698 needShow = true;
699 699
700 700
701 } else if ( msg == "edit(int)" ) { 701 } else if ( msg == "edit(int)" ) {
702 QDataStream stream(data,IO_ReadOnly); 702 QDataStream stream(data,IO_ReadOnly);
703 int uid; 703 int uid;
704 stream >> uid; 704 stream >> uid;
705 705
706 // Deactivate Personal View.. 706 // Deactivate Personal View..
707 if ( actionPersonal->isOn() ){ 707 if ( actionPersonal->isOn() ){
708 actionPersonal->setOn( false ); 708 actionPersonal->setOn( false );
709 slotPersonalView(); 709 slotPersonalView();
710 } 710 }
711 711
712 // Reset category and edit.. 712 // Reset category and edit..
713 m_abView -> setShowByCategory( QString::null ); 713 m_abView -> setShowByCategory( QString::null );
714 m_abView -> setCurrentUid( uid ); 714 m_abView -> setCurrentUid( uid );
715 slotViewEdit(); 715 slotViewEdit();
716 } 716 }
717 717
718 if (needShow) 718 if (needShow)
719 QPEApplication::setKeepRunning(); 719 QPEApplication::setKeepRunning();
720 720
721} 721}
722 722
723void AddressbookWindow::editEntry( EntryMode entryMode ) 723void AddressbookWindow::editEntry( EntryMode entryMode )
724{ 724{
725 OContact entry; 725 Opie::OPimContact entry;
726 if ( !abEditor ) { 726 if ( !abEditor ) {
727 abEditor = new ContactEditor( entry, this, "editor" ); 727 abEditor = new ContactEditor( entry, this, "editor" );
728 } 728 }
729 if ( entryMode == EditEntry ) 729 if ( entryMode == EditEntry )
730 abEditor->setEntry( m_abView -> currentEntry() ); 730 abEditor->setEntry( m_abView -> currentEntry() );
731 else if ( entryMode == NewEntry ) 731 else if ( entryMode == NewEntry )
732 abEditor->setEntry( entry ); 732 abEditor->setEntry( entry );
733 // other things may change the caption. 733 // other things may change the caption.
734 abEditor->setCaption( tr("Edit Address") ); 734 abEditor->setCaption( tr("Edit Address") );
735 735
736 // fix the foxus... 736 // fix the foxus...
737 abEditor->setNameFocus(); 737 abEditor->setNameFocus();
738 if ( QPEApplication::execDialog( abEditor ) ) { 738 if ( QPEApplication::execDialog( abEditor ) ) {
739 setFocus(); 739 setFocus();
740 if ( entryMode == NewEntry ) { 740 if ( entryMode == NewEntry ) {
741 OContact insertEntry = abEditor->entry(); 741 Opie::OPimContact insertEntry = abEditor->entry();
742 insertEntry.assignUid(); 742 insertEntry.assignUid();
743 m_abView -> addEntry( insertEntry ); 743 m_abView -> addEntry( insertEntry );
744 m_abView -> setCurrentUid( insertEntry.uid() ); 744 m_abView -> setCurrentUid( insertEntry.uid() );
745 } else { 745 } else {
746 OContact replEntry = abEditor->entry(); 746 Opie::OPimContact replEntry = abEditor->entry();
747 747
748 if ( !replEntry.isValidUid() ) 748 if ( !replEntry.isValidUid() )
749 replEntry.assignUid(); 749 replEntry.assignUid();
750 750
751 m_abView -> replaceEntry( replEntry ); 751 m_abView -> replaceEntry( replEntry );
752 } 752 }
753 } 753 }
754 // populateCategories(); 754 // populateCategories();
755 755
756} 756}
757 757
758void AddressbookWindow::editPersonal() 758void AddressbookWindow::editPersonal()
759{ 759{
760 OContact entry; 760 Opie::OPimContact entry;
761 761
762 // Switch to personal view if not selected 762 // Switch to personal view if not selected
763 // but take care of the menu, too 763 // but take care of the menu, too
764 if ( ! actionPersonal->isOn() ){ 764 if ( ! actionPersonal->isOn() ){
765 qWarning("*** ++++"); 765 qWarning("*** ++++");
766 actionPersonal->setOn( true ); 766 actionPersonal->setOn( true );
767 slotPersonalView(); 767 slotPersonalView();
768 } 768 }
769 769
770 if ( !abEditor ) { 770 if ( !abEditor ) {
771 abEditor = new ContactEditor( entry, this, "editor" ); 771 abEditor = new ContactEditor( entry, this, "editor" );
772 } 772 }
773 773
774 abEditor->setCaption(tr("Edit My Personal Details")); 774 abEditor->setCaption(tr("Edit My Personal Details"));
775 abEditor->setPersonalView( true ); 775 abEditor->setPersonalView( true );
776 editEntry( EditEntry ); 776 editEntry( EditEntry );
777 abEditor->setPersonalView( false ); 777 abEditor->setPersonalView( false );
778 778
779} 779}
780 780
781 781
782void AddressbookWindow::slotPersonalView() 782void AddressbookWindow::slotPersonalView()
783{ 783{
784 qWarning("slotPersonalView()"); 784 qWarning("slotPersonalView()");
785 if (!actionPersonal->isOn()) { 785 if (!actionPersonal->isOn()) {
786 // we just turned it off 786 // we just turned it off
787 qWarning("slotPersonalView()-> OFF"); 787 qWarning("slotPersonalView()-> OFF");
788 setCaption( tr("Contacts") ); 788 setCaption( tr("Contacts") );
789 actionNew->setEnabled(TRUE); 789 actionNew->setEnabled(TRUE);
790 actionTrash->setEnabled(TRUE); 790 actionTrash->setEnabled(TRUE);
791 actionFind->setEnabled(TRUE); 791 actionFind->setEnabled(TRUE);
792 actionMail->setEnabled(TRUE); 792 actionMail->setEnabled(TRUE);
793 // slotUpdateToolbar(); 793 // slotUpdateToolbar();
794 794
795 m_abView->showPersonal( false ); 795 m_abView->showPersonal( false );
796 796
797 return; 797 return;
798 } 798 }
799 799
800 qWarning("slotPersonalView()-> ON"); 800 qWarning("slotPersonalView()-> ON");
801 // XXX need to disable some QActions. 801 // XXX need to disable some QActions.
802 actionNew->setEnabled(FALSE); 802 actionNew->setEnabled(FALSE);
803 actionTrash->setEnabled(FALSE); 803 actionTrash->setEnabled(FALSE);
804 actionFind->setEnabled(FALSE); 804 actionFind->setEnabled(FALSE);
805 actionMail->setEnabled(FALSE); 805 actionMail->setEnabled(FALSE);
806 806
807 setCaption( tr("Contacts - My Personal Details") ); 807 setCaption( tr("Contacts - My Personal Details") );
808 808
diff --git a/core/pim/addressbook/addressbook.pro b/core/pim/addressbook/addressbook.pro
index afd3b92..05f02c3 100644
--- a/core/pim/addressbook/addressbook.pro
+++ b/core/pim/addressbook/addressbook.pro
@@ -1,28 +1,28 @@
1 #CONFIG = qt warn_on release quick-app 1 #CONFIG = qt warn_on release quick-app
2 CONFIG = qt warn_on debug quick-app 2 CONFIG = qt warn_on debug quick-app
3 HEADERS= addressbook.h \ 3 HEADERS= addressbook.h \
4 contacteditor.h \ 4 contacteditor.h \
5 ablabel.h \ 5 ablabel.h \
6 abtable.h \ 6 abtable.h \
7 picker.h \ 7 picker.h \
8 ofloatbar.h \ 8 ofloatbar.h \
9 configdlg.h \ 9 configdlg.h \
10 abconfig.h \ 10 abconfig.h \
11 abview.h 11 abview.h
12 SOURCES= main.cpp \ 12 SOURCES= main.cpp \
13 addressbook.cpp \ 13 addressbook.cpp \
14 contacteditor.cpp \ 14 contacteditor.cpp \
15 ablabel.cpp \ 15 ablabel.cpp \
16 abtable.cpp \ 16 abtable.cpp \
17 picker.cpp \ 17 picker.cpp \
18 configdlg.cpp \ 18 configdlg.cpp \
19 abconfig.cpp \ 19 abconfig.cpp \
20 abview.cpp 20 abview.cpp
21 21
22 INTERFACES= configdlg_base.ui 22 INTERFACES= configdlg_base.ui
23 TARGET = addressbook 23 TARGET = addressbook
24INCLUDEPATH += $(OPIEDIR)/include 24INCLUDEPATH += $(OPIEDIR)/include
25 DEPENDPATH+= $(OPIEDIR)/include 25 DEPENDPATH+= $(OPIEDIR)/include
26LIBS += -lqpe -lopie 26LIBS += -lqpe -lopiecore2 -lopieui2 -lopiepim2 -lopiedb2
27 27
28include ( $(OPIEDIR)/include.pro ) 28include ( $(OPIEDIR)/include.pro )
diff --git a/core/pim/addressbook/config.in b/core/pim/addressbook/config.in
index 3377763..7ecf14c 100644
--- a/core/pim/addressbook/config.in
+++ b/core/pim/addressbook/config.in
@@ -1,4 +1,4 @@
1 config ADDRESSBOOK 1 config ADDRESSBOOK
2 boolean "opie-addressbook (a simple addressbook)" 2 boolean "opie-addressbook (a simple addressbook)"
3 default "y" 3 default "y"
4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE 4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBOPIE2UI && LIBOPIE2PIM && LIBOPIE2DB
diff --git a/core/pim/addressbook/configdlg.cpp b/core/pim/addressbook/configdlg.cpp
index dee0f11..6c98b5d 100644
--- a/core/pim/addressbook/configdlg.cpp
+++ b/core/pim/addressbook/configdlg.cpp
@@ -1,153 +1,153 @@
1#include "configdlg.h" 1#include "configdlg.h"
2 2
3#include <opie2/opimcontact.h>
4#include "opie2/opimcontactfields.h"
5
6#include <qpe/resource.h>
7
3#include <qcheckbox.h> 8#include <qcheckbox.h>
4#include <qradiobutton.h> 9#include <qradiobutton.h>
5#include <qlistbox.h> 10#include <qlistbox.h>
6#include <qpushbutton.h> 11#include <qpushbutton.h>
7 12
8#include <qpe/resource.h>
9
10#include <opie/ocontact.h>
11#include "opie/ocontactfields.h"
12
13ConfigDlg::ConfigDlg( QWidget *parent, const char *name): 13ConfigDlg::ConfigDlg( QWidget *parent, const char *name):
14 ConfigDlg_Base(parent, name, true ) 14 ConfigDlg_Base(parent, name, true )
15{ 15{
16 contFields = OContactFields::trfields(); 16 contFields = Opie::OPimContactFields::trfields();
17 17
18 // We add all Fields into the Listbox 18 // We add all Fields into the Listbox
19 for (uint i=0; i < contFields.count(); i++) { 19 for (uint i=0; i < contFields.count(); i++) {
20 allFieldListBox->insertItem( contFields[i] ); 20 allFieldListBox->insertItem( contFields[i] );
21 } 21 }
22 22
23 // Reset Widget Flags: This was not changeable by designer :( 23 // Reset Widget Flags: This was not changeable by designer :(
24 setWFlags ( WStyle_ContextHelp ); 24 setWFlags ( WStyle_ContextHelp );
25 25
26 // Set Pics to Buttons and Tabs 26 // Set Pics to Buttons and Tabs
27 m_upButton->setIconSet( QIconSet( Resource::loadPixmap( "addressbook/up" ) ) ); 27 m_upButton->setIconSet( QIconSet( Resource::loadPixmap( "addressbook/up" ) ) );
28 m_downButton->setIconSet( QIconSet( Resource::loadPixmap( "addressbook/down" ) ) ); 28 m_downButton->setIconSet( QIconSet( Resource::loadPixmap( "addressbook/down" ) ) );
29 m_addButton->setIconSet( QIconSet( Resource::loadPixmap( "addressbook/add" ) ) ); 29 m_addButton->setIconSet( QIconSet( Resource::loadPixmap( "addressbook/add" ) ) );
30 m_removeButton->setIconSet( QIconSet( Resource::loadPixmap( "addressbook/sub" ) ) ); 30 m_removeButton->setIconSet( QIconSet( Resource::loadPixmap( "addressbook/sub" ) ) );
31 31
32 32
33 // Get the translation maps between Field ID and translated strings 33 // Get the translation maps between Field ID and translated strings
34 m_mapStrToID = OContactFields::trFieldsToId(); 34 m_mapStrToID = Opie::OPimContactFields::trFieldsToId();
35 m_mapIDToStr = OContactFields::idToTrFields(); 35 m_mapIDToStr = Opie::OPimContactFields::idToTrFields();
36 36
37 connect ( m_addButton, SIGNAL( clicked() ), this, SLOT( slotItemAdd() ) ); 37 connect ( m_addButton, SIGNAL( clicked() ), this, SLOT( slotItemAdd() ) );
38 connect ( m_removeButton, SIGNAL( clicked() ), this, SLOT( slotItemRemove() ) ); 38 connect ( m_removeButton, SIGNAL( clicked() ), this, SLOT( slotItemRemove() ) );
39 connect ( m_upButton, SIGNAL( clicked() ), this, SLOT( slotItemUp() ) ); 39 connect ( m_upButton, SIGNAL( clicked() ), this, SLOT( slotItemUp() ) );
40 connect ( m_downButton, SIGNAL( clicked() ), this, SLOT( slotItemDown() ) ); 40 connect ( m_downButton, SIGNAL( clicked() ), this, SLOT( slotItemDown() ) );
41} 41}
42 42
43void ConfigDlg::slotItemUp() 43void ConfigDlg::slotItemUp()
44{ 44{
45 qWarning( "void ConfigDlg::slotItemUp()" ); 45 qWarning( "void ConfigDlg::slotItemUp()" );
46 46
47 int i = fieldListBox->currentItem(); 47 int i = fieldListBox->currentItem();
48 if ( i > 0 ) { 48 if ( i > 0 ) {
49 QString item = fieldListBox->currentText(); 49 QString item = fieldListBox->currentText();
50 fieldListBox->removeItem( i ); 50 fieldListBox->removeItem( i );
51 fieldListBox->insertItem( item, i-1 ); 51 fieldListBox->insertItem( item, i-1 );
52 fieldListBox->setCurrentItem( i-1 ); 52 fieldListBox->setCurrentItem( i-1 );
53 } 53 }
54 54
55} 55}
56 56
57void ConfigDlg::slotItemDown() 57void ConfigDlg::slotItemDown()
58{ 58{
59 qWarning( "void ConfigDlg::slotItemDown()" ); 59 qWarning( "void ConfigDlg::slotItemDown()" );
60 60
61 int i = fieldListBox->currentItem(); 61 int i = fieldListBox->currentItem();
62 if ( i < (int)fieldListBox->count() - 1 ) { 62 if ( i < (int)fieldListBox->count() - 1 ) {
63 QString item = fieldListBox->currentText(); 63 QString item = fieldListBox->currentText();
64 fieldListBox->removeItem( i ); 64 fieldListBox->removeItem( i );
65 fieldListBox->insertItem( item, i+1 ); 65 fieldListBox->insertItem( item, i+1 );
66 fieldListBox->setCurrentItem( i+1 ); 66 fieldListBox->setCurrentItem( i+1 );
67 } 67 }
68} 68}
69 69
70void ConfigDlg::slotItemAdd() 70void ConfigDlg::slotItemAdd()
71{ 71{
72 qWarning( "void ConfigDlg::slotItemAdd()" ); 72 qWarning( "void ConfigDlg::slotItemAdd()" );
73 73
74 int i = allFieldListBox->currentItem(); 74 int i = allFieldListBox->currentItem();
75 if ( i > 0 ) { 75 if ( i > 0 ) {
76 QString item = allFieldListBox->currentText(); 76 QString item = allFieldListBox->currentText();
77 qWarning("ADding %s", item.latin1()); 77 qWarning("ADding %s", item.latin1());
78 fieldListBox->insertItem( item ); 78 fieldListBox->insertItem( item );
79 } 79 }
80} 80}
81 81
82void ConfigDlg::slotItemRemove() 82void ConfigDlg::slotItemRemove()
83{ 83{
84 qWarning( "void ConfigDlg::slotItemRemove()" ); 84 qWarning( "void ConfigDlg::slotItemRemove()" );
85 85
86 int i = fieldListBox->currentItem(); 86 int i = fieldListBox->currentItem();
87 if ( i > 0 ) { 87 if ( i > 0 ) {
88 fieldListBox->removeItem( i ); 88 fieldListBox->removeItem( i );
89 } 89 }
90} 90}
91 91
92void ConfigDlg::setConfig( const AbConfig& cnf ) 92void ConfigDlg::setConfig( const AbConfig& cnf )
93{ 93{
94 m_config = cnf; 94 m_config = cnf;
95 95
96 m_useRegExp->setChecked( m_config.useRegExp() ); 96 m_useRegExp->setChecked( m_config.useRegExp() );
97 m_useWildCard->setChecked( m_config.useWildCards() ); 97 m_useWildCard->setChecked( m_config.useWildCards() );
98 m_useQtMail->setChecked( m_config.useQtMail() ); 98 m_useQtMail->setChecked( m_config.useQtMail() );
99 m_useOpieMail->setChecked( m_config.useOpieMail() ); 99 m_useOpieMail->setChecked( m_config.useOpieMail() );
100 m_useCaseSensitive->setChecked( m_config.beCaseSensitive() ); 100 m_useCaseSensitive->setChecked( m_config.beCaseSensitive() );
101 101
102 switch( m_config.fontSize() ){ 102 switch( m_config.fontSize() ){
103 case 0: 103 case 0:
104 m_smallFont->setChecked( true ); 104 m_smallFont->setChecked( true );
105 m_normalFont->setChecked( false ); 105 m_normalFont->setChecked( false );
106 m_largeFont->setChecked( false ); 106 m_largeFont->setChecked( false );
107 break; 107 break;
108 case 1: 108 case 1:
109 m_smallFont->setChecked( false ); 109 m_smallFont->setChecked( false );
110 m_normalFont->setChecked( true ); 110 m_normalFont->setChecked( true );
111 m_largeFont->setChecked( false ); 111 m_largeFont->setChecked( false );
112 break; 112 break;
113 case 2: 113 case 2:
114 m_smallFont->setChecked( false ); 114 m_smallFont->setChecked( false );
115 m_normalFont->setChecked( false ); 115 m_normalFont->setChecked( false );
116 m_largeFont->setChecked( true ); 116 m_largeFont->setChecked( true );
117 break; 117 break;
118 } 118 }
119 119
120 for( uint i = 0; i < m_config.orderList().count(); i++ ) { 120 for( uint i = 0; i < m_config.orderList().count(); i++ ) {
121 fieldListBox -> insertItem ( m_mapIDToStr[ m_config.orderList()[i] ] ); 121 fieldListBox -> insertItem ( m_mapIDToStr[ m_config.orderList()[i] ] );
122 } 122 }
123 123
124 m_fixedBars->setChecked( m_config.fixedBars() ); 124 m_fixedBars->setChecked( m_config.fixedBars() );
125 m_moveBars->setChecked( !m_config.fixedBars() ); 125 m_moveBars->setChecked( !m_config.fixedBars() );
126} 126}
127 127
128AbConfig ConfigDlg::getConfig() 128AbConfig ConfigDlg::getConfig()
129{ 129{
130 m_config.setUseRegExp( m_useRegExp->isOn() ); 130 m_config.setUseRegExp( m_useRegExp->isOn() );
131 m_config.setUseWildCards( m_useWildCard->isOn() ); 131 m_config.setUseWildCards( m_useWildCard->isOn() );
132 m_config.setUseQtMail( m_useQtMail->isOn() ); 132 m_config.setUseQtMail( m_useQtMail->isOn() );
133 m_config.setUseOpieMail( m_useOpieMail->isOn() ); 133 m_config.setUseOpieMail( m_useOpieMail->isOn() );
134 m_config.setBeCaseSensitive( m_useCaseSensitive->isChecked() ); 134 m_config.setBeCaseSensitive( m_useCaseSensitive->isChecked() );
135 135
136 if ( m_smallFont->isChecked() ) 136 if ( m_smallFont->isChecked() )
137 m_config.setFontSize( 0 ); 137 m_config.setFontSize( 0 );
138 if ( m_normalFont->isChecked() ) 138 if ( m_normalFont->isChecked() )
139 m_config.setFontSize( 1 ); 139 m_config.setFontSize( 1 );
140 if ( m_largeFont->isChecked() ) 140 if ( m_largeFont->isChecked() )
141 m_config.setFontSize( 2 ); 141 m_config.setFontSize( 2 );
142 142
143 QValueList<int> orderlist; 143 QValueList<int> orderlist;
144 for( int i = 0; i < (int)fieldListBox->count(); i++ ) { 144 for( int i = 0; i < (int)fieldListBox->count(); i++ ) {
145 orderlist.append( m_mapStrToID[ fieldListBox->text(i) ] ); 145 orderlist.append( m_mapStrToID[ fieldListBox->text(i) ] );
146 } 146 }
147 m_config.setOrderList( orderlist ); 147 m_config.setOrderList( orderlist );
148 148
149 m_config.setFixedBars( m_fixedBars->isChecked() ); 149 m_config.setFixedBars( m_fixedBars->isChecked() );
150 150
151 return m_config; 151 return m_config;
152} 152}
153 153
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp
index 8acf570..534666d 100644
--- a/core/pim/addressbook/contacteditor.cpp
+++ b/core/pim/addressbook/contacteditor.cpp
@@ -1,215 +1,216 @@
1/* 1/*
2 * Copyright (c) 2002 Michael R. Crawford <mike@tuxnami.org> 2 * Copyright (c) 2002 Michael R. Crawford <mike@tuxnami.org>
3 * Copyright (C) 2002 by Stefan Eilers (eilers.stefan@epost.de) 3 * Copyright (C) 2002 by Stefan Eilers (eilers.stefan@epost.de)
4 * 4 *
5 * This file is an add-on for the OPIE Palmtop Environment 5 * This file is an add-on for the OPIE Palmtop Environment
6 * 6 *
7 * This file may be distributed and/or modified under the terms of the 7 * This file may be distributed and/or modified under the terms of the
8 * GNU General Public License version 2 as published by the Free Software 8 * GNU General Public License version 2 as published by the Free Software
9 * Foundation and appearing in the file LICENSE.GPL included in the pacakaging 9 * Foundation and appearing in the file LICENSE.GPL included in the pacakaging
10 * of this file. 10 * of this file.
11 * 11 *
12 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 12 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
13 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 13 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
14 * 14 *
15 * 15 *
16 * This is a rewrite of the abeditor.h file, modified to provide a more 16 * This is a rewrite of the abeditor.h file, modified to provide a more
17 * intuitive interface to TrollTech's original Address Book editor. This 17 * intuitive interface to TrollTech's original Address Book editor. This
18 * is made to operate exactly in interface with the exception of name. 18 * is made to operate exactly in interface with the exception of name.
19 * 19 *
20 */ 20 */
21 21
22#include "contacteditor.h" 22#include "contacteditor.h"
23 23
24#include <opie2/opimcontact.h>
25
24#include <qpe/categoryselect.h> 26#include <qpe/categoryselect.h>
25#include <qpe/qpeapplication.h> 27#include <qpe/qpeapplication.h>
26#include <qpe/qpedialog.h> 28#include <qpe/qpedialog.h>
27#include <opie/ocontact.h>
28#include <qpe/resource.h> 29#include <qpe/resource.h>
29 30
30#include <qlabel.h> 31#include <qlabel.h>
31#include <qtabwidget.h> 32#include <qtabwidget.h>
32#include <qlayout.h> 33#include <qlayout.h>
33#include <qlineedit.h> 34#include <qlineedit.h>
34#include <qmultilineedit.h> 35#include <qmultilineedit.h>
35#include <qtoolbutton.h> 36#include <qtoolbutton.h>
36#include <qlistbox.h> 37#include <qlistbox.h>
37#include <qmessagebox.h> 38#include <qmessagebox.h>
38#include <qwhatsthis.h> 39#include <qwhatsthis.h>
39 40
40#include <assert.h> 41#include <assert.h>
41 42
42static inline bool containsAlphaNum( const QString &str ); 43static inline bool containsAlphaNum( const QString &str );
43static inline bool constainsWhiteSpace( const QString &str ); 44static inline bool constainsWhiteSpace( const QString &str );
44 45
45// helper functions, convert our comma delimited list to proper 46// helper functions, convert our comma delimited list to proper
46// file format... 47// file format...
47void parseEmailFrom( const QString &txt, QString &strDefaultEmail, 48void parseEmailFrom( const QString &txt, QString &strDefaultEmail,
48 QString &strAll ); 49 QString &strAll );
49 50
50// helper convert from file format to comma delimited... 51// helper convert from file format to comma delimited...
51void parseEmailTo( const QString &strDefaultEmail, 52void parseEmailTo( const QString &strDefaultEmail,
52 const QString &strOtherEmail, QString &strBack ); 53 const QString &strOtherEmail, QString &strBack );
53 54
54 ContactEditor::ContactEditor(const OContact &entry, 55 ContactEditor::ContactEditor(const Opie::OPimContact &entry,
55 QWidget *parent, 56 QWidget *parent,
56 const char *name, 57 const char *name,
57 WFlags ) 58 WFlags )
58 : QDialog( parent, name, TRUE, WStyle_ContextHelp ), 59 : QDialog( parent, name, TRUE, WStyle_ContextHelp ),
59 defaultEmailChooserPosition( -1 ), 60 defaultEmailChooserPosition( -1 ),
60 m_personalView ( false ), 61 m_personalView ( false ),
61 cmbDefaultEmail( 0 ), 62 cmbDefaultEmail( 0 ),
62 initializing ( false ) 63 initializing ( false )
63{ 64{
64 65
65 initializing = true; 66 initializing = true;
66 67
67 init(); 68 init();
68 setEntry( entry ); 69 setEntry( entry );
69 // cmbDefaultEmail = 0; 70 // cmbDefaultEmail = 0;
70 // defaultEmailChooserPosition = -1; 71 // defaultEmailChooserPosition = -1;
71 72
72 initializing = false; 73 initializing = false;
73} 74}
74 75
75ContactEditor::~ContactEditor() { 76ContactEditor::~ContactEditor() {
76} 77}
77 78
78void ContactEditor::init() { 79void ContactEditor::init() {
79 qWarning("init() START"); 80 qWarning("init() START");
80 81
81 uint i = 0; 82 uint i = 0;
82 83
83 QStringList trlChooserNames; 84 QStringList trlChooserNames;
84 85
85 for (i = 0; i <= 6; i++) { 86 for (i = 0; i <= 6; i++) {
86 slHomeAddress.append( "" ); 87 slHomeAddress.append( "" );
87 slBusinessAddress.append( "" ); 88 slBusinessAddress.append( "" );
88 } 89 }
89 90
90 trlChooserNames = OContactFields::trphonefields( false ); 91 trlChooserNames = Opie::OPimContactFields::trphonefields( false );
91 slChooserNames = OContactFields::untrphonefields( false ); 92 slChooserNames = Opie::OPimContactFields::untrphonefields( false );
92 slDynamicEntries = OContactFields::untrdetailsfields( false ); 93 slDynamicEntries = Opie::OPimContactFields::untrdetailsfields( false );
93 trlDynamicEntries = OContactFields::trdetailsfields( false ); 94 trlDynamicEntries = Opie::OPimContactFields::trdetailsfields( false );
94 95
95 // Ok, we have to remove elements from the list of dynamic entries 96 // Ok, we have to remove elements from the list of dynamic entries
96 // which are now stored in special (not dynamic) widgets.. 97 // which are now stored in special (not dynamic) widgets..
97 // Otherwise we will get problems with field assignments! (se) 98 // Otherwise we will get problems with field assignments! (se)
98 slDynamicEntries.remove("Anniversary"); 99 slDynamicEntries.remove("Anniversary");
99 slDynamicEntries.remove("Birthday"); 100 slDynamicEntries.remove("Birthday");
100 slDynamicEntries.remove("Gender"); 101 slDynamicEntries.remove("Gender");
101 102
102 // The same with translated fields.. But I will 103 // The same with translated fields.. But I will
103 // use the translation map to avoid mismatches.. 104 // use the translation map to avoid mismatches..
104 QMap<int, QString> translMap = OContactFields::idToTrFields(); 105 QMap<int, QString> translMap = Opie::OPimContactFields::idToTrFields();
105 trlDynamicEntries.remove( translMap[Qtopia::Anniversary] ); 106 trlDynamicEntries.remove( translMap[Qtopia::Anniversary] );
106 trlDynamicEntries.remove( translMap[Qtopia::Birthday] ); 107 trlDynamicEntries.remove( translMap[Qtopia::Birthday] );
107 trlDynamicEntries.remove( translMap[Qtopia::Gender] ); 108 trlDynamicEntries.remove( translMap[Qtopia::Gender] );
108 109
109 // Last Check to be sure.. 110 // Last Check to be sure..
110 assert( slDynamicEntries.count() == trlDynamicEntries.count() ); 111 assert( slDynamicEntries.count() == trlDynamicEntries.count() );
111 assert( slChooserNames.count() == trlChooserNames.count() ); 112 assert( slChooserNames.count() == trlChooserNames.count() );
112 113
113 for (i = 0; i < slChooserNames.count(); i++) 114 for (i = 0; i < slChooserNames.count(); i++)
114 slChooserValues.append(""); 115 slChooserValues.append("");
115 116
116 117
117 QVBoxLayout *vb = new QVBoxLayout( this ); 118 QVBoxLayout *vb = new QVBoxLayout( this );
118 119
119 tabMain = new QTabWidget( this ); 120 tabMain = new QTabWidget( this );
120 vb->addWidget( tabMain ); 121 vb->addWidget( tabMain );
121 122
122 QWidget *tabViewport = new QWidget ( tabMain ); 123 QWidget *tabViewport = new QWidget ( tabMain );
123 124
124 vb = new QVBoxLayout( tabViewport ); 125 vb = new QVBoxLayout( tabViewport );
125 126
126 svGeneral = new QScrollView( tabViewport ); 127 svGeneral = new QScrollView( tabViewport );
127 vb->addWidget( svGeneral, 0, 0 ); 128 vb->addWidget( svGeneral, 0, 0 );
128 svGeneral->setResizePolicy( QScrollView::AutoOneFit ); 129 svGeneral->setResizePolicy( QScrollView::AutoOneFit );
129 // svGeneral->setHScrollBarMode( QScrollView::AlwaysOff ); 130 // svGeneral->setHScrollBarMode( QScrollView::AlwaysOff );
130 // svGeneral->setVScrollBarMode( QScrollView::AlwaysOff ); 131 // svGeneral->setVScrollBarMode( QScrollView::AlwaysOff );
131 svGeneral->setFrameStyle( QFrame::NoFrame ); 132 svGeneral->setFrameStyle( QFrame::NoFrame );
132 133
133 QWidget *container = new QWidget( svGeneral->viewport() ); 134 QWidget *container = new QWidget( svGeneral->viewport() );
134 svGeneral->addChild( container ); 135 svGeneral->addChild( container );
135 136
136 QGridLayout *gl = new QGridLayout( container, 1, 1, 2, 4 ); 137 QGridLayout *gl = new QGridLayout( container, 1, 1, 2, 4 );
137 gl->setResizeMode( QLayout::FreeResize ); 138 gl->setResizeMode( QLayout::FreeResize );
138 139
139 btnFullName = new QPushButton( tr( "Full Name..." ), container ); 140 btnFullName = new QPushButton( tr( "Full Name..." ), container );
140 QWhatsThis::add( btnFullName, tr( "Press to enter last- middle and firstname" ) ); 141 QWhatsThis::add( btnFullName, tr( "Press to enter last- middle and firstname" ) );
141 gl->addWidget( btnFullName, 0, 0 ); 142 gl->addWidget( btnFullName, 0, 0 );
142 txtFullName = new QLineEdit( container ); 143 txtFullName = new QLineEdit( container );
143 QWhatsThis::add( txtFullName, tr( "Enter fullname directly ! If you have a lastname with multiple words ( for instance \"de la Guerra\"), please write <lastname>,<firstnames> like this: \"de la Guerra, Carlos Pedro\"" ) ); 144 QWhatsThis::add( txtFullName, tr( "Enter fullname directly ! If you have a lastname with multiple words ( for instance \"de la Guerra\"), please write <lastname>,<firstnames> like this: \"de la Guerra, Carlos Pedro\"" ) );
144 gl->addWidget( txtFullName, 0, 1 ); 145 gl->addWidget( txtFullName, 0, 1 );
145 146
146 QLabel *l = new QLabel( tr( "Job Title" ), container ); 147 QLabel *l = new QLabel( tr( "Job Title" ), container );
147 QWhatsThis::add( l, tr( "The jobtitle.." ) ); 148 QWhatsThis::add( l, tr( "The jobtitle.." ) );
148 gl->addWidget( l, 1, 0 ); 149 gl->addWidget( l, 1, 0 );
149 txtJobTitle = new QLineEdit( container ); 150 txtJobTitle = new QLineEdit( container );
150 QWhatsThis::add( txtJobTitle, tr( "The jobtitle.." ) ); 151 QWhatsThis::add( txtJobTitle, tr( "The jobtitle.." ) );
151 gl->addWidget( txtJobTitle, 1, 1 ); 152 gl->addWidget( txtJobTitle, 1, 1 );
152 153
153 l = new QLabel( tr("Suffix"), container ); 154 l = new QLabel( tr("Suffix"), container );
154 QWhatsThis::add( l, tr( "Something like \"jr.\".." ) ); 155 QWhatsThis::add( l, tr( "Something like \"jr.\".." ) );
155 gl->addWidget( l, 2, 0 ); 156 gl->addWidget( l, 2, 0 );
156 txtSuffix = new QLineEdit( container ); 157 txtSuffix = new QLineEdit( container );
157 QWhatsThis::add( txtSuffix, tr( "Something like \"jr.\".." ) ); 158 QWhatsThis::add( txtSuffix, tr( "Something like \"jr.\".." ) );
158 gl->addWidget( txtSuffix, 2, 1 ); 159 gl->addWidget( txtSuffix, 2, 1 );
159 160
160 l = new QLabel( tr( "Organization" ), container ); 161 l = new QLabel( tr( "Organization" ), container );
161 QWhatsThis::add( l, tr( "The working place of the contact" ) ); 162 QWhatsThis::add( l, tr( "The working place of the contact" ) );
162 gl->addWidget( l, 3, 0 ); 163 gl->addWidget( l, 3, 0 );
163 txtOrganization = new QLineEdit( container ); 164 txtOrganization = new QLineEdit( container );
164 QWhatsThis::add( txtOrganization, tr( "The working place of the contact" ) ); 165 QWhatsThis::add( txtOrganization, tr( "The working place of the contact" ) );
165 gl->addWidget( txtOrganization, 3, 1 ); 166 gl->addWidget( txtOrganization, 3, 1 );
166 167
167 // Chooser 1 168 // Chooser 1
168 cmbChooserField1 = new QComboBox( FALSE, container ); 169 cmbChooserField1 = new QComboBox( FALSE, container );
169 QWhatsThis::add( cmbChooserField1, tr( "Press to select attribute to change" ) ); 170 QWhatsThis::add( cmbChooserField1, tr( "Press to select attribute to change" ) );
170 cmbChooserField1->setMaximumWidth( 90 ); 171 cmbChooserField1->setMaximumWidth( 90 );
171 gl->addWidget( cmbChooserField1, 4, 0 ); 172 gl->addWidget( cmbChooserField1, 4, 0 );
172 // Textfield for chooser 1. 173 // Textfield for chooser 1.
173 // Now use Widgetstack to contain the textfield and the default-email combo ! 174 // Now use Widgetstack to contain the textfield and the default-email combo !
174 m_widgetStack1 = new QWidgetStack( container ); 175 m_widgetStack1 = new QWidgetStack( container );
175 txtChooserField1 = new QLineEdit( m_widgetStack1 ); 176 txtChooserField1 = new QLineEdit( m_widgetStack1 );
176 m_widgetStack1 -> addWidget( txtChooserField1, TextField ); 177 m_widgetStack1 -> addWidget( txtChooserField1, TextField );
177 gl->addWidget( m_widgetStack1, 4, 1 ); 178 gl->addWidget( m_widgetStack1, 4, 1 );
178 m_widgetStack1 -> raiseWidget( TextField ); 179 m_widgetStack1 -> raiseWidget( TextField );
179 180
180 // Chooser 2 181 // Chooser 2
181 cmbChooserField2 = new QComboBox( FALSE, container ); 182 cmbChooserField2 = new QComboBox( FALSE, container );
182 QWhatsThis::add( cmbChooserField2, tr( "Press to select attribute to change" ) ); 183 QWhatsThis::add( cmbChooserField2, tr( "Press to select attribute to change" ) );
183 cmbChooserField2->setMaximumWidth( 90 ); 184 cmbChooserField2->setMaximumWidth( 90 );
184 gl->addWidget( cmbChooserField2, 5, 0 ); 185 gl->addWidget( cmbChooserField2, 5, 0 );
185 // Textfield for chooser 2 186 // Textfield for chooser 2
186 // Now use WidgetStack to contain the textfield and the default-email combo! 187 // Now use WidgetStack to contain the textfield and the default-email combo!
187 m_widgetStack2 = new QWidgetStack( container ); 188 m_widgetStack2 = new QWidgetStack( container );
188 txtChooserField2 = new QLineEdit( m_widgetStack2 ); 189 txtChooserField2 = new QLineEdit( m_widgetStack2 );
189 m_widgetStack2 -> addWidget( txtChooserField2, TextField ); 190 m_widgetStack2 -> addWidget( txtChooserField2, TextField );
190 gl->addWidget( m_widgetStack2, 5, 1 ); 191 gl->addWidget( m_widgetStack2, 5, 1 );
191 m_widgetStack2 -> raiseWidget( TextField ); 192 m_widgetStack2 -> raiseWidget( TextField );
192 193
193 // Chooser 3 194 // Chooser 3
194 cmbChooserField3 = new QComboBox( FALSE, container ); 195 cmbChooserField3 = new QComboBox( FALSE, container );
195 QWhatsThis::add( cmbChooserField3, tr( "Press to select attribute to change" ) ); 196 QWhatsThis::add( cmbChooserField3, tr( "Press to select attribute to change" ) );
196 cmbChooserField3->setMaximumWidth( 90 ); 197 cmbChooserField3->setMaximumWidth( 90 );
197 gl->addWidget( cmbChooserField3, 6, 0 ); 198 gl->addWidget( cmbChooserField3, 6, 0 );
198 // Textfield for chooser 2 199 // Textfield for chooser 2
199 // Now use WidgetStack to contain the textfield and the default-email combo! 200 // Now use WidgetStack to contain the textfield and the default-email combo!
200 m_widgetStack3 = new QWidgetStack( container ); 201 m_widgetStack3 = new QWidgetStack( container );
201 txtChooserField3 = new QLineEdit( m_widgetStack3 ); 202 txtChooserField3 = new QLineEdit( m_widgetStack3 );
202 m_widgetStack3 -> addWidget( txtChooserField3, TextField ); 203 m_widgetStack3 -> addWidget( txtChooserField3, TextField );
203 gl->addWidget( m_widgetStack3, 6, 1 ); 204 gl->addWidget( m_widgetStack3, 6, 1 );
204 m_widgetStack3 -> raiseWidget( TextField ); 205 m_widgetStack3 -> raiseWidget( TextField );
205 206
206 l = new QLabel( tr( "File As" ), container ); 207 l = new QLabel( tr( "File As" ), container );
207 QWhatsThis::add( l, tr( "Press to select how to store the name (and howto show it in the listview)" ) ); 208 QWhatsThis::add( l, tr( "Press to select how to store the name (and howto show it in the listview)" ) );
208 gl->addWidget( l, 7, 0 ); 209 gl->addWidget( l, 7, 0 );
209 cmbFileAs = new QComboBox( TRUE, container ); 210 cmbFileAs = new QComboBox( TRUE, container );
210 gl->addWidget( cmbFileAs, 7, 1 ); 211 gl->addWidget( cmbFileAs, 7, 1 );
211 212
212 labCat = new QLabel( tr( "Category" ), container ); 213 labCat = new QLabel( tr( "Category" ), container );
213 gl->addWidget( labCat, 8, 0 ); 214 gl->addWidget( labCat, 8, 0 );
214 cmbCat = new CategorySelect( container ); 215 cmbCat = new CategorySelect( container );
215 gl->addWidget( cmbCat, 8, 1 ); 216 gl->addWidget( cmbCat, 8, 1 );
@@ -484,516 +485,516 @@ void ContactEditor::init() {
484 // Chooser 4 485 // Chooser 4
485 cmbChooserField4 = new QComboBox( FALSE, container ); 486 cmbChooserField4 = new QComboBox( FALSE, container );
486 cmbChooserField4->setMaximumWidth( 90 ); 487 cmbChooserField4->setMaximumWidth( 90 );
487 gl->addWidget( cmbChooserField4, 6, 0 ); 488 gl->addWidget( cmbChooserField4, 6, 0 );
488 // Textfield for chooser 2 489 // Textfield for chooser 2
489 // Now use WidgetStack to contain the textfield and the default-email combo! 490 // Now use WidgetStack to contain the textfield and the default-email combo!
490 m_widgetStack4 = new QWidgetStack( container ); 491 m_widgetStack4 = new QWidgetStack( container );
491 txtChooserField4 = new QLineEdit( m_widgetStack4 ); 492 txtChooserField4 = new QLineEdit( m_widgetStack4 );
492 m_widgetStack4 -> addWidget( txtChooserField4, TextField ); 493 m_widgetStack4 -> addWidget( txtChooserField4, TextField );
493 gl->addMultiCellWidget( m_widgetStack4, 6, 6, 1, 2 ); 494 gl->addMultiCellWidget( m_widgetStack4, 6, 6, 1, 2 );
494 m_widgetStack4 -> raiseWidget( TextField ); 495 m_widgetStack4 -> raiseWidget( TextField );
495 496
496 QSpacerItem *space = new QSpacerItem(1,1, 497 QSpacerItem *space = new QSpacerItem(1,1,
497 QSizePolicy::Maximum, 498 QSizePolicy::Maximum,
498 QSizePolicy::MinimumExpanding ); 499 QSizePolicy::MinimumExpanding );
499 gl->addItem( space, 7, 0 ); 500 gl->addItem( space, 7, 0 );
500 501
501 tabMain->insertTab( tabViewport, tr( "Address" ) ); 502 tabMain->insertTab( tabViewport, tr( "Address" ) );
502 503
503 tabViewport = new QWidget ( tabMain ); 504 tabViewport = new QWidget ( tabMain );
504 505
505 vb = new QVBoxLayout( tabViewport ); 506 vb = new QVBoxLayout( tabViewport );
506 507
507 svDetails = new QScrollView( tabViewport ); 508 svDetails = new QScrollView( tabViewport );
508 vb->addWidget( svDetails, 0, 0 ); 509 vb->addWidget( svDetails, 0, 0 );
509 svDetails->setResizePolicy( QScrollView::AutoOneFit ); 510 svDetails->setResizePolicy( QScrollView::AutoOneFit );
510 svDetails->setFrameStyle( QFrame::NoFrame ); 511 svDetails->setFrameStyle( QFrame::NoFrame );
511 512
512 container = new QWidget( svDetails->viewport() ); 513 container = new QWidget( svDetails->viewport() );
513 svDetails->addChild( container ); 514 svDetails->addChild( container );
514 515
515 gl = new QGridLayout( container, 1, 2, 2, 4 ); 516 gl = new QGridLayout( container, 1, 2, 2, 4 );
516 517
517 int counter = 0; 518 int counter = 0;
518 519
519 // Birthday 520 // Birthday
520 QHBox* hBox = new QHBox( container ); 521 QHBox* hBox = new QHBox( container );
521 l = new QLabel( tr("Birthday"), container ); 522 l = new QLabel( tr("Birthday"), container );
522 gl->addWidget( l, counter, 0 ); 523 gl->addWidget( l, counter, 0 );
523 524
524 QPopupMenu* m1 = new QPopupMenu( container ); 525 QPopupMenu* m1 = new QPopupMenu( container );
525 birthdayPicker = new DateBookMonth( m1, 0, TRUE ); 526 birthdayPicker = new DateBookMonth( m1, 0, TRUE );
526 m1->insertItem( birthdayPicker ); 527 m1->insertItem( birthdayPicker );
527 528
528 birthdayButton= new QToolButton( hBox, "buttonStart" ); 529 birthdayButton= new QToolButton( hBox, "buttonStart" );
529 birthdayButton->setPopup( m1 ); 530 birthdayButton->setPopup( m1 );
530 birthdayButton->setPopupDelay(0); 531 birthdayButton->setPopupDelay(0);
531 532
532 QPushButton* deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), 533 QPushButton* deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ),
533 tr( "Delete" ), 534 tr( "Delete" ),
534 hBox, 0 ); 535 hBox, 0 );
535 536
536 gl->addWidget( hBox, counter , 1 ); 537 gl->addWidget( hBox, counter , 1 );
537 538
538 connect( birthdayPicker, SIGNAL( dateClicked(int,int,int) ), 539 connect( birthdayPicker, SIGNAL( dateClicked(int,int,int) ),
539 this, SLOT( slotBirthdayDateChanged(int,int,int) ) ); 540 this, SLOT( slotBirthdayDateChanged(int,int,int) ) );
540 connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveBirthday() ) ); 541 connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveBirthday() ) );
541 542
542 ++counter; 543 ++counter;
543 544
544 // Anniversary 545 // Anniversary
545 hBox = new QHBox( container ); 546 hBox = new QHBox( container );
546 l = new QLabel( tr("Anniversary"), container ); 547 l = new QLabel( tr("Anniversary"), container );
547 gl->addWidget( l, counter, 0 ); 548 gl->addWidget( l, counter, 0 );
548 549
549 m1 = new QPopupMenu( container ); 550 m1 = new QPopupMenu( container );
550 anniversaryPicker = new DateBookMonth( m1, 0, TRUE ); 551 anniversaryPicker = new DateBookMonth( m1, 0, TRUE );
551 m1->insertItem( anniversaryPicker ); 552 m1->insertItem( anniversaryPicker );
552 553
553 anniversaryButton= new QToolButton( hBox, "buttonStart" ); 554 anniversaryButton= new QToolButton( hBox, "buttonStart" );
554 anniversaryButton->setPopup( m1 ); 555 anniversaryButton->setPopup( m1 );
555 anniversaryButton->setPopupDelay(0); 556 anniversaryButton->setPopupDelay(0);
556 557
557 deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), 558 deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ),
558 tr( "Delete" ), 559 tr( "Delete" ),
559 hBox, 0 ); 560 hBox, 0 );
560 gl->addWidget( hBox, counter , 1 ); 561 gl->addWidget( hBox, counter , 1 );
561 562
562 connect( anniversaryPicker, SIGNAL( dateClicked(int,int,int) ), 563 connect( anniversaryPicker, SIGNAL( dateClicked(int,int,int) ),
563 this, SLOT( slotAnniversaryDateChanged(int,int,int) ) ); 564 this, SLOT( slotAnniversaryDateChanged(int,int,int) ) );
564 connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveAnniversary() ) ); 565 connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveAnniversary() ) );
565 566
566 ++counter; 567 ++counter;
567 568
568 // Gender 569 // Gender
569 l = new QLabel( tr("Gender"), container ); 570 l = new QLabel( tr("Gender"), container );
570 gl->addWidget( l, counter, 0 ); 571 gl->addWidget( l, counter, 0 );
571 cmbGender = new QComboBox( container ); 572 cmbGender = new QComboBox( container );
572 cmbGender->insertItem( "", 0 ); 573 cmbGender->insertItem( "", 0 );
573 cmbGender->insertItem( tr("Male"), 1); 574 cmbGender->insertItem( tr("Male"), 1);
574 cmbGender->insertItem( tr("Female"), 2); 575 cmbGender->insertItem( tr("Female"), 2);
575 gl->addWidget( cmbGender, counter, 1 ); 576 gl->addWidget( cmbGender, counter, 1 );
576 577
577 ++counter; 578 ++counter;
578 579
579 // Create Labels and lineedit fields for every dynamic entry 580 // Create Labels and lineedit fields for every dynamic entry
580 QStringList::ConstIterator it = slDynamicEntries.begin(); 581 QStringList::ConstIterator it = slDynamicEntries.begin();
581 QMap<QString, int> mapStrToID = OContactFields::untrFieldsToId(); 582 QMap<QString, int> mapStrToID = Opie::OPimContactFields::untrFieldsToId();
582 QMap<int, QString> mapIdToStr = OContactFields::idToTrFields(); 583 QMap<int, QString> mapIdToStr = Opie::OPimContactFields::idToTrFields();
583 for (i = counter; it != slDynamicEntries.end(); i++, ++it ) { 584 for (i = counter; it != slDynamicEntries.end(); i++, ++it ) {
584 585
585 if (((*it) == "Anniversary") || 586 if (((*it) == "Anniversary") ||
586 ((*it) == "Birthday")|| ((*it) == "Gender")) continue; 587 ((*it) == "Birthday")|| ((*it) == "Gender")) continue;
587 588
588 l = new QLabel( mapIdToStr[mapStrToID[*it]], container ); 589 l = new QLabel( mapIdToStr[mapStrToID[*it]], container );
589 listName.append( l ); 590 listName.append( l );
590 gl->addWidget( l, i, 0 ); 591 gl->addWidget( l, i, 0 );
591 QLineEdit *e = new QLineEdit( container ); 592 QLineEdit *e = new QLineEdit( container );
592 listValue.append( e ); 593 listValue.append( e );
593 gl->addWidget( e, i, 1); 594 gl->addWidget( e, i, 1);
594 } 595 }
595 // Fill labels with names.. 596 // Fill labels with names..
596 //loadFields(); 597 //loadFields();
597 598
598 599
599 tabMain->insertTab( tabViewport, tr( "Details" ) ); 600 tabMain->insertTab( tabViewport, tr( "Details" ) );
600 601
601 dlgNote = new QDialog( this, "Note Dialog", TRUE ); 602 dlgNote = new QDialog( this, "Note Dialog", TRUE );
602 dlgNote->setCaption( tr("Enter Note") ); 603 dlgNote->setCaption( tr("Enter Note") );
603 QVBoxLayout *vbNote = new QVBoxLayout( dlgNote ); 604 QVBoxLayout *vbNote = new QVBoxLayout( dlgNote );
604 txtNote = new QMultiLineEdit( dlgNote ); 605 txtNote = new QMultiLineEdit( dlgNote );
605 vbNote->addWidget( txtNote ); 606 vbNote->addWidget( txtNote );
606 connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) ); 607 connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) );
607 608
608 dlgName = new QDialog( this, "Name Dialog", TRUE ); 609 dlgName = new QDialog( this, "Name Dialog", TRUE );
609 dlgName->setCaption( tr("Edit Name") ); 610 dlgName->setCaption( tr("Edit Name") );
610 gl = new QGridLayout( dlgName, 5, 2, 2, 3 ); 611 gl = new QGridLayout( dlgName, 5, 2, 2, 3 );
611 612
612 l = new QLabel( tr("First Name"), dlgName ); 613 l = new QLabel( tr("First Name"), dlgName );
613 gl->addWidget( l, 0, 0 ); 614 gl->addWidget( l, 0, 0 );
614 txtFirstName = new QLineEdit( dlgName ); 615 txtFirstName = new QLineEdit( dlgName );
615 gl->addWidget( txtFirstName, 0, 1 ); 616 gl->addWidget( txtFirstName, 0, 1 );
616 617
617 l = new QLabel( tr("Middle Name"), dlgName ); 618 l = new QLabel( tr("Middle Name"), dlgName );
618 gl->addWidget( l, 1, 0 ); 619 gl->addWidget( l, 1, 0 );
619 txtMiddleName = new QLineEdit( dlgName ); 620 txtMiddleName = new QLineEdit( dlgName );
620 gl->addWidget( txtMiddleName, 1, 1 ); 621 gl->addWidget( txtMiddleName, 1, 1 );
621 622
622 l = new QLabel( tr("Last Name"), dlgName ); 623 l = new QLabel( tr("Last Name"), dlgName );
623 gl->addWidget( l, 2, 0 ); 624 gl->addWidget( l, 2, 0 );
624 txtLastName = new QLineEdit( dlgName ); 625 txtLastName = new QLineEdit( dlgName );
625 gl->addWidget( txtLastName, 2, 1 ); 626 gl->addWidget( txtLastName, 2, 1 );
626 627
627 // l = new QLabel( tr("Suffix"), dlgName ); 628 // l = new QLabel( tr("Suffix"), dlgName );
628 // gl->addWidget( l, 3, 0 ); 629 // gl->addWidget( l, 3, 0 );
629 // txtSuffix = new QLineEdit( dlgName ); 630 // txtSuffix = new QLineEdit( dlgName );
630 // gl->addWidget( txtSuffix, 3, 1 ); 631 // gl->addWidget( txtSuffix, 3, 1 );
631 space = new QSpacerItem(1,1, 632 space = new QSpacerItem(1,1,
632 QSizePolicy::Maximum, 633 QSizePolicy::Maximum,
633 QSizePolicy::MinimumExpanding ); 634 QSizePolicy::MinimumExpanding );
634 gl->addItem( space, 4, 0 ); 635 gl->addItem( space, 4, 0 );
635 636
636 cmbChooserField1->insertStringList( trlChooserNames ); 637 cmbChooserField1->insertStringList( trlChooserNames );
637 cmbChooserField2->insertStringList( trlChooserNames ); 638 cmbChooserField2->insertStringList( trlChooserNames );
638 cmbChooserField3->insertStringList( trlChooserNames ); 639 cmbChooserField3->insertStringList( trlChooserNames );
639 cmbChooserField4->insertStringList( trlChooserNames ); 640 cmbChooserField4->insertStringList( trlChooserNames );
640 641
641 cmbChooserField1->setCurrentItem( 0 ); 642 cmbChooserField1->setCurrentItem( 0 );
642 cmbChooserField2->setCurrentItem( 1 ); 643 cmbChooserField2->setCurrentItem( 1 );
643 cmbChooserField3->setCurrentItem( 2 ); 644 cmbChooserField3->setCurrentItem( 2 );
644 645
645 connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) ); 646 connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) );
646 647
647 connect( txtFullName, SIGNAL(textChanged(const QString&)), 648 connect( txtFullName, SIGNAL(textChanged(const QString&)),
648 this, SLOT(slotFullNameChange(const QString&)) ); 649 this, SLOT(slotFullNameChange(const QString&)) );
649 connect( txtSuffix, SIGNAL(textChanged(const QString&)), 650 connect( txtSuffix, SIGNAL(textChanged(const QString&)),
650 this, SLOT(slotSuffixChange(const QString&)) ); 651 this, SLOT(slotSuffixChange(const QString&)) );
651 connect( txtOrganization, SIGNAL(textChanged(const QString&)), 652 connect( txtOrganization, SIGNAL(textChanged(const QString&)),
652 this, SLOT(slotOrganizationChange(const QString&)) ); 653 this, SLOT(slotOrganizationChange(const QString&)) );
653 connect( txtChooserField1, SIGNAL(textChanged(const QString&)), 654 connect( txtChooserField1, SIGNAL(textChanged(const QString&)),
654 this, SLOT(slotChooser1Change(const QString&)) ); 655 this, SLOT(slotChooser1Change(const QString&)) );
655 connect( txtChooserField2, SIGNAL(textChanged(const QString&)), 656 connect( txtChooserField2, SIGNAL(textChanged(const QString&)),
656 this, SLOT(slotChooser2Change(const QString&)) ); 657 this, SLOT(slotChooser2Change(const QString&)) );
657 connect( txtChooserField3, SIGNAL(textChanged(const QString&)), 658 connect( txtChooserField3, SIGNAL(textChanged(const QString&)),
658 this, SLOT(slotChooser3Change(const QString&)) ); 659 this, SLOT(slotChooser3Change(const QString&)) );
659 connect( txtChooserField4, SIGNAL(textChanged(const QString&)), 660 connect( txtChooserField4, SIGNAL(textChanged(const QString&)),
660 this, SLOT(slotChooser4Change(const QString&)) ); 661 this, SLOT(slotChooser4Change(const QString&)) );
661 connect( txtAddress, SIGNAL(textChanged(const QString&)), 662 connect( txtAddress, SIGNAL(textChanged(const QString&)),
662 this, SLOT(slotAddressChange(const QString&)) ); 663 this, SLOT(slotAddressChange(const QString&)) );
663 connect( txtCity, SIGNAL(textChanged(const QString&)), 664 connect( txtCity, SIGNAL(textChanged(const QString&)),
664 this, SLOT(slotCityChange(const QString&)) ); 665 this, SLOT(slotCityChange(const QString&)) );
665 connect( txtState, SIGNAL(textChanged(const QString&)), 666 connect( txtState, SIGNAL(textChanged(const QString&)),
666 this, SLOT(slotStateChange(const QString&)) ); 667 this, SLOT(slotStateChange(const QString&)) );
667 connect( txtZip, SIGNAL(textChanged(const QString&)), 668 connect( txtZip, SIGNAL(textChanged(const QString&)),
668 this, SLOT(slotZipChange(const QString&)) ); 669 this, SLOT(slotZipChange(const QString&)) );
669 connect( cmbCountry, SIGNAL(textChanged(const QString&)), 670 connect( cmbCountry, SIGNAL(textChanged(const QString&)),
670 this, SLOT(slotCountryChange(const QString&)) ); 671 this, SLOT(slotCountryChange(const QString&)) );
671 connect( cmbCountry, SIGNAL(activated(const QString&)), 672 connect( cmbCountry, SIGNAL(activated(const QString&)),
672 this, SLOT(slotCountryChange(const QString&)) ); 673 this, SLOT(slotCountryChange(const QString&)) );
673 connect( cmbChooserField1, SIGNAL(activated(int)), 674 connect( cmbChooserField1, SIGNAL(activated(int)),
674 this, SLOT(slotCmbChooser1Change(int)) ); 675 this, SLOT(slotCmbChooser1Change(int)) );
675 connect( cmbChooserField2, SIGNAL(activated(int)), 676 connect( cmbChooserField2, SIGNAL(activated(int)),
676 this, SLOT(slotCmbChooser2Change(int)) ); 677 this, SLOT(slotCmbChooser2Change(int)) );
677 connect( cmbChooserField3, SIGNAL(activated(int)), 678 connect( cmbChooserField3, SIGNAL(activated(int)),
678 this, SLOT(slotCmbChooser3Change(int)) ); 679 this, SLOT(slotCmbChooser3Change(int)) );
679 connect( cmbChooserField4, SIGNAL(activated(int)), 680 connect( cmbChooserField4, SIGNAL(activated(int)),
680 this, SLOT(slotCmbChooser4Change(int)) ); 681 this, SLOT(slotCmbChooser4Change(int)) );
681 connect( cmbAddress, SIGNAL(activated(int)), 682 connect( cmbAddress, SIGNAL(activated(int)),
682 this, SLOT(slotAddressTypeChange(int)) ); 683 this, SLOT(slotAddressTypeChange(int)) );
683 684
684 new QPEDialogListener(this); 685 new QPEDialogListener(this);
685 686
686 setPersonalView ( m_personalView ); 687 setPersonalView ( m_personalView );
687 688
688 qWarning("init() END"); 689 qWarning("init() END");
689} 690}
690 691
691void ContactEditor::defaultEmailChanged(int i){ 692void ContactEditor::defaultEmailChanged(int i){
692 qDebug("defaultEmailChanged"); 693 qDebug("defaultEmailChanged");
693 694
694 // was sollte das ? (se) 695 // was sollte das ? (se)
695 // int index = cmbChooserField1->currentItem(); 696 // int index = cmbChooserField1->currentItem();
696 // slChooserValues[index] = cmbDefaultEmail->text(i); 697 // slChooserValues[index] = cmbDefaultEmail->text(i);
697 698
698 defaultEmail = cmbDefaultEmail->text(i); 699 defaultEmail = cmbDefaultEmail->text(i);
699 qDebug ("Changed to: %s", defaultEmail.latin1()); 700 qDebug ("Changed to: %s", defaultEmail.latin1());
700 701
701} 702}
702 703
703void ContactEditor::populateDefaultEmailCmb(){ 704void ContactEditor::populateDefaultEmailCmb(){
704 705
705 // if the default-email combo was not selected and therfore not created 706 // if the default-email combo was not selected and therfore not created
706 // we get a lot of trouble.. Therfore create an invisible one.. 707 // we get a lot of trouble.. Therfore create an invisible one..
707 if ( !cmbDefaultEmail ){ 708 if ( !cmbDefaultEmail ){
708 cmbDefaultEmail = new QComboBox(this); 709 cmbDefaultEmail = new QComboBox(this);
709 cmbDefaultEmail -> hide(); 710 cmbDefaultEmail -> hide();
710 } 711 }
711 cmbDefaultEmail->clear(); 712 cmbDefaultEmail->clear();
712 cmbDefaultEmail->insertStringList( emails ); 713 cmbDefaultEmail->insertStringList( emails );
713 // cmbDefaultEmail->show(); 714 // cmbDefaultEmail->show();
714 715
715 // Select default email in combo.. 716 // Select default email in combo..
716 bool found = false; 717 bool found = false;
717 for ( int i = 0; i < cmbDefaultEmail->count(); i++){ 718 for ( int i = 0; i < cmbDefaultEmail->count(); i++){
718 qDebug(" populateDefaultEmailCmb text >%s< defaultEmail >%s<", 719 qDebug(" populateDefaultEmailCmb text >%s< defaultEmail >%s<",
719 cmbDefaultEmail->text( i ).latin1(), defaultEmail.latin1()); 720 cmbDefaultEmail->text( i ).latin1(), defaultEmail.latin1());
720 721
721 if ( cmbDefaultEmail->text( i ).stripWhiteSpace() == defaultEmail.stripWhiteSpace() ){ 722 if ( cmbDefaultEmail->text( i ).stripWhiteSpace() == defaultEmail.stripWhiteSpace() ){
722 cmbDefaultEmail->setCurrentItem( i ); 723 cmbDefaultEmail->setCurrentItem( i );
723 qDebug("set"); 724 qDebug("set");
724 found = true; 725 found = true;
725 } 726 }
726 } 727 }
727 728
728 // If the current default email is not found in the list, we choose the 729 // If the current default email is not found in the list, we choose the
729 // first one.. 730 // first one..
730 if ( !found ) 731 if ( !found )
731 defaultEmail = cmbDefaultEmail->text(0); 732 defaultEmail = cmbDefaultEmail->text(0);
732} 733}
733 734
734// Called when any combobox was changed. 735// Called when any combobox was changed.
735// "true" returned if the change was chandled by this function, else it should 736// "true" returned if the change was chandled by this function, else it should
736// be handled by something else.. 737// be handled by something else..
737bool ContactEditor::cmbChooserChange( int index, QWidgetStack* inputStack, int widgetPos ) { 738bool ContactEditor::cmbChooserChange( int index, QWidgetStack* inputStack, int widgetPos ) {
738 QString type = slChooserNames[index]; 739 QString type = slChooserNames[index];
739 qWarning("ContactEditor::cmbChooserChange -> Type: %s, WidgetPos: %d", type.latin1(), widgetPos ); 740 qWarning("ContactEditor::cmbChooserChange -> Type: %s, WidgetPos: %d", type.latin1(), widgetPos );
740 741
741 if ( !initializing ) 742 if ( !initializing )
742 contactfields.setFieldOrder( widgetPos-1, index ); 743 contactfields.setFieldOrder( widgetPos-1, index );
743 744
744 // Create and connect combobox for selecting the default email 745 // Create and connect combobox for selecting the default email
745 if ( type == "Default Email"){ 746 if ( type == "Default Email"){
746 qWarning("Choosing default-email (defaultEmailChooserPosition= %d) ", defaultEmailChooserPosition); 747 qWarning("Choosing default-email (defaultEmailChooserPosition= %d) ", defaultEmailChooserPosition);
747 748
748 // More than one default-email chooser is not allowed ! 749 // More than one default-email chooser is not allowed !
749 if ( ( defaultEmailChooserPosition != -1 ) && 750 if ( ( defaultEmailChooserPosition != -1 ) &&
750 defaultEmailChooserPosition != widgetPos && !initializing){ 751 defaultEmailChooserPosition != widgetPos && !initializing){
751 chooserError( widgetPos ); 752 chooserError( widgetPos );
752 return true; 753 return true;
753 } 754 }
754 755
755 QComboBox* cmbo = ( QComboBox* ) inputStack -> widget( Combo ); 756 QComboBox* cmbo = ( QComboBox* ) inputStack -> widget( Combo );
756 if ( cmbo ){ 757 if ( cmbo ){
757 inputStack->raiseWidget( TextField ); 758 inputStack->raiseWidget( TextField );
758 inputStack -> removeWidget( cmbo ); 759 inputStack -> removeWidget( cmbo );
759 delete cmbo; 760 delete cmbo;
760 } 761 }
761 cmbo = new QComboBox( inputStack ); 762 cmbo = new QComboBox( inputStack );
762 cmbo -> insertStringList( emails ); 763 cmbo -> insertStringList( emails );
763 764
764 inputStack -> addWidget( cmbo, Combo ); 765 inputStack -> addWidget( cmbo, Combo );
765 inputStack -> raiseWidget( Combo ); 766 inputStack -> raiseWidget( Combo );
766 767
767 defaultEmailChooserPosition = widgetPos; 768 defaultEmailChooserPosition = widgetPos;
768 cmbDefaultEmail = cmbo; 769 cmbDefaultEmail = cmbo;
769 770
770 connect( cmbo,SIGNAL( activated(int) ), 771 connect( cmbo,SIGNAL( activated(int) ),
771 SLOT( defaultEmailChanged(int) ) ); 772 SLOT( defaultEmailChanged(int) ) );
772 773
773 // Set current default email 774 // Set current default email
774 populateDefaultEmailCmb(); 775 populateDefaultEmailCmb();
775 776
776 777
777 } else { 778 } else {
778 // Something else was selected: Hide combo.. 779 // Something else was selected: Hide combo..
779 qWarning(" Hiding default-email combo" ); 780 qWarning(" Hiding default-email combo" );
780 if ( defaultEmailChooserPosition == widgetPos ){ 781 if ( defaultEmailChooserPosition == widgetPos ){
781 defaultEmailChooserPosition = -1; 782 defaultEmailChooserPosition = -1;
782 } 783 }
783 QComboBox* cmbo = ( QComboBox* ) inputStack -> widget( Combo ); 784 QComboBox* cmbo = ( QComboBox* ) inputStack -> widget( Combo );
784 if ( cmbo ){ 785 if ( cmbo ){
785 inputStack->raiseWidget( TextField ); 786 inputStack->raiseWidget( TextField );
786 inputStack -> removeWidget( cmbo ); 787 inputStack -> removeWidget( cmbo );
787 cmbDefaultEmail = 0l; 788 cmbDefaultEmail = 0l;
788 delete cmbo; 789 delete cmbo;
789 } 790 }
790 791
791 // Caller should initialize the responsible textfield, therefore 792 // Caller should initialize the responsible textfield, therefore
792 // "false" is returned 793 // "false" is returned
793 return false; 794 return false;
794 } 795 }
795 796
796 // Everything is worked off .. 797 // Everything is worked off ..
797 return true; 798 return true;
798 799
799} 800}
800 801
801// Currently accessed when we select default-email more than once ! 802// Currently accessed when we select default-email more than once !
802void ContactEditor::chooserError( int index ) 803void ContactEditor::chooserError( int index )
803{ 804{
804 qWarning("ContactEditor::chooserError( %d )", index); 805 qWarning("ContactEditor::chooserError( %d )", index);
805 QMessageBox::warning( this, "Chooser Error", 806 QMessageBox::warning( this, "Chooser Error",
806 "Multiple selection of this\n" 807 "Multiple selection of this\n"
807 "Item is not allowed !\n\n" 808 "Item is not allowed !\n\n"
808 "First deselect the previous one !", 809 "First deselect the previous one !",
809 "&OK", 0, 0, 810 "&OK", 0, 0,
810 0, 0 ); 811 0, 0 );
811 812
812 // Reset the selected Chooser. Unfortunately the chooser 813 // Reset the selected Chooser. Unfortunately the chooser
813 // generates no signal, therfore we have to 814 // generates no signal, therfore we have to
814 // call the cmbChooserChange function manually.. 815 // call the cmbChooserChange function manually..
815 switch( index ){ 816 switch( index ){
816 case 1: 817 case 1:
817 cmbChooserField1 -> setCurrentItem( 0 ); 818 cmbChooserField1 -> setCurrentItem( 0 );
818 slotCmbChooser1Change( 0 ); 819 slotCmbChooser1Change( 0 );
819 break; 820 break;
820 case 2: 821 case 2:
821 cmbChooserField2 -> setCurrentItem( 0 ); 822 cmbChooserField2 -> setCurrentItem( 0 );
822 slotCmbChooser2Change( 0 ); 823 slotCmbChooser2Change( 0 );
823 break; 824 break;
824 case 3: 825 case 3:
825 cmbChooserField3 -> setCurrentItem( 0 ); 826 cmbChooserField3 -> setCurrentItem( 0 );
826 slotCmbChooser3Change( 0 ); 827 slotCmbChooser3Change( 0 );
827 break; 828 break;
828 case 4: 829 case 4:
829 cmbChooserField4 -> setCurrentItem( 0 ); 830 cmbChooserField4 -> setCurrentItem( 0 );
830 slotCmbChooser4Change( 0 ); 831 slotCmbChooser4Change( 0 );
831 break; 832 break;
832 } 833 }
833} 834}
834 835
835// Called when something was changed in a textfield (shouldn't it called textchanged? (se)) 836// Called when something was changed in a textfield (shouldn't it called textchanged? (se))
836void ContactEditor::chooserChange( const QString &textChanged, int index, 837void ContactEditor::chooserChange( const QString &textChanged, int index,
837 QLineEdit* , int widgetPos ) { 838 QLineEdit* , int widgetPos ) {
838 839
839 QString type = slChooserNames[index]; // :SX 840 QString type = slChooserNames[index]; // :SX
840 qDebug("ContactEditor::chooserChange( type=>%s<, textChanged=>%s< index=%i, widgetPos=%i", 841 qDebug("ContactEditor::chooserChange( type=>%s<, textChanged=>%s< index=%i, widgetPos=%i",
841 type.latin1(),textChanged.latin1(), index, widgetPos ); 842 type.latin1(),textChanged.latin1(), index, widgetPos );
842 843
843 if ( type == "Default Email"){ 844 if ( type == "Default Email"){
844 qWarning ("??? Wozu??: %s", textChanged.latin1()); 845 qWarning ("??? Wozu??: %s", textChanged.latin1());
845 defaultEmail = textChanged; 846 defaultEmail = textChanged;
846 847
847 populateDefaultEmailCmb(); 848 populateDefaultEmailCmb();
848 849
849 }else if (type == "Emails"){ 850 }else if (type == "Emails"){
850 qDebug("emails"); 851 qDebug("emails");
851 852
852 QString de; 853 QString de;
853 emails = QStringList::split (",", textChanged ); 854 emails = QStringList::split (",", textChanged );
854 855
855 populateDefaultEmailCmb(); 856 populateDefaultEmailCmb();
856 } 857 }
857 858
858 slChooserValues[index] = textChanged; 859 slChooserValues[index] = textChanged;
859 860
860} 861}
861 862
862void ContactEditor::slotChooser1Change( const QString &textChanged ) { 863void ContactEditor::slotChooser1Change( const QString &textChanged ) {
863 qWarning("ContactEditor::slotChooser1Change( %s )", textChanged.latin1()); 864 qWarning("ContactEditor::slotChooser1Change( %s )", textChanged.latin1());
864 chooserChange( textChanged, cmbChooserField1->currentItem(), txtChooserField1, 1); 865 chooserChange( textChanged, cmbChooserField1->currentItem(), txtChooserField1, 1);
865} 866}
866 867
867void ContactEditor::slotChooser2Change( const QString &textChanged ) { 868void ContactEditor::slotChooser2Change( const QString &textChanged ) {
868 qWarning("ContactEditor::slotChooser2Change( %s )", textChanged.latin1()); 869 qWarning("ContactEditor::slotChooser2Change( %s )", textChanged.latin1());
869 chooserChange( textChanged, cmbChooserField2->currentItem(), txtChooserField2, 2); 870 chooserChange( textChanged, cmbChooserField2->currentItem(), txtChooserField2, 2);
870 871
871} 872}
872 873
873void ContactEditor::slotChooser3Change( const QString &textChanged ) { 874void ContactEditor::slotChooser3Change( const QString &textChanged ) {
874 qWarning("ContactEditor::slotChooser3Change( %s )", textChanged.latin1()); 875 qWarning("ContactEditor::slotChooser3Change( %s )", textChanged.latin1());
875 chooserChange( textChanged, cmbChooserField3->currentItem(), txtChooserField3, 3); 876 chooserChange( textChanged, cmbChooserField3->currentItem(), txtChooserField3, 3);
876} 877}
877 878
878void ContactEditor::slotChooser4Change( const QString &textChanged ) { 879void ContactEditor::slotChooser4Change( const QString &textChanged ) {
879 qWarning("ContactEditor::slotChooser4Change( %s )", textChanged.latin1()); 880 qWarning("ContactEditor::slotChooser4Change( %s )", textChanged.latin1());
880 chooserChange( textChanged, cmbChooserField4->currentItem(), txtChooserField4, 4); 881 chooserChange( textChanged, cmbChooserField4->currentItem(), txtChooserField4, 4);
881} 882}
882 883
883void ContactEditor::slotAddressChange( const QString &textChanged ) { 884void ContactEditor::slotAddressChange( const QString &textChanged ) {
884 885
885 if ( cmbAddress->currentItem() == 0 ) { 886 if ( cmbAddress->currentItem() == 0 ) {
886 slBusinessAddress[0] = textChanged; 887 slBusinessAddress[0] = textChanged;
887 } else { 888 } else {
888 slHomeAddress[0] = textChanged; 889 slHomeAddress[0] = textChanged;
889 } 890 }
890} 891}
891 892
892void ContactEditor::slotAddress2Change( const QString &textChanged ) { 893void ContactEditor::slotAddress2Change( const QString &textChanged ) {
893 894
894 if ( cmbAddress->currentItem() == 0 ) { 895 if ( cmbAddress->currentItem() == 0 ) {
895 slBusinessAddress[1] = textChanged; 896 slBusinessAddress[1] = textChanged;
896 } else { 897 } else {
897 slHomeAddress[1] = textChanged; 898 slHomeAddress[1] = textChanged;
898 } 899 }
899} 900}
900 901
901void ContactEditor::slotPOBoxChange( const QString &textChanged ) { 902void ContactEditor::slotPOBoxChange( const QString &textChanged ) {
902 903
903 if ( cmbAddress->currentItem() == 0 ) { 904 if ( cmbAddress->currentItem() == 0 ) {
904 slBusinessAddress[2] = textChanged; 905 slBusinessAddress[2] = textChanged;
905 } else { 906 } else {
906 slHomeAddress[2] = textChanged; 907 slHomeAddress[2] = textChanged;
907 } 908 }
908} 909}
909 910
910void ContactEditor::slotCityChange( const QString &textChanged ) { 911void ContactEditor::slotCityChange( const QString &textChanged ) {
911 912
912 if ( cmbAddress->currentItem() == 0 ) { 913 if ( cmbAddress->currentItem() == 0 ) {
913 slBusinessAddress[3] = textChanged; 914 slBusinessAddress[3] = textChanged;
914 } else { 915 } else {
915 slHomeAddress[3] = textChanged; 916 slHomeAddress[3] = textChanged;
916 } 917 }
917} 918}
918 919
919void ContactEditor::slotStateChange( const QString &textChanged ) { 920void ContactEditor::slotStateChange( const QString &textChanged ) {
920 921
921 922
922 if ( cmbAddress->currentItem() == 0 ) { 923 if ( cmbAddress->currentItem() == 0 ) {
923 slBusinessAddress[4] = textChanged; 924 slBusinessAddress[4] = textChanged;
924 } else { 925 } else {
925 slHomeAddress[4] = textChanged; 926 slHomeAddress[4] = textChanged;
926 } 927 }
927} 928}
928 929
929void ContactEditor::slotZipChange( const QString &textChanged ) { 930void ContactEditor::slotZipChange( const QString &textChanged ) {
930 931
931 if ( cmbAddress->currentItem() == 0 ) { 932 if ( cmbAddress->currentItem() == 0 ) {
932 slBusinessAddress[5] = textChanged; 933 slBusinessAddress[5] = textChanged;
933 } else { 934 } else {
934 slHomeAddress[5] = textChanged; 935 slHomeAddress[5] = textChanged;
935 } 936 }
936} 937}
937 938
938void ContactEditor::slotCountryChange( const QString &textChanged ) { 939void ContactEditor::slotCountryChange( const QString &textChanged ) {
939 940
940 if ( cmbAddress->currentItem() == 0 ) { 941 if ( cmbAddress->currentItem() == 0 ) {
941 slBusinessAddress[6] = textChanged; 942 slBusinessAddress[6] = textChanged;
942 } else { 943 } else {
943 slHomeAddress[6] = textChanged; 944 slHomeAddress[6] = textChanged;
944 } 945 }
945} 946}
946 947
947 948
948void ContactEditor::slotCmbChooser1Change( int index ) { 949void ContactEditor::slotCmbChooser1Change( int index ) {
949 qWarning("ContactEditor::slotCmbChooser1Change( %d )", index); 950 qWarning("ContactEditor::slotCmbChooser1Change( %d )", index);
950 if ( !cmbChooserChange( cmbChooserField1->currentItem(), m_widgetStack1, 1) ){ 951 if ( !cmbChooserChange( cmbChooserField1->currentItem(), m_widgetStack1, 1) ){
951 952
952 txtChooserField1->setText( slChooserValues[index] ); 953 txtChooserField1->setText( slChooserValues[index] );
953 txtChooserField1->setFocus(); 954 txtChooserField1->setFocus();
954 955
955 } 956 }
956 957
957} 958}
958 959
959void ContactEditor::slotCmbChooser2Change( int index ) { 960void ContactEditor::slotCmbChooser2Change( int index ) {
960 qWarning("ContactEditor::slotCmbChooser2Change( %d )", index); 961 qWarning("ContactEditor::slotCmbChooser2Change( %d )", index);
961 962
962 if ( !cmbChooserChange( cmbChooserField2->currentItem(), m_widgetStack2, 2) ){ 963 if ( !cmbChooserChange( cmbChooserField2->currentItem(), m_widgetStack2, 2) ){
963 964
964 txtChooserField2->setText( slChooserValues[index] ); 965 txtChooserField2->setText( slChooserValues[index] );
965 txtChooserField2->setFocus(); 966 txtChooserField2->setFocus();
966 967
967 } 968 }
968} 969}
969 970
970void ContactEditor::slotCmbChooser3Change( int index ) { 971void ContactEditor::slotCmbChooser3Change( int index ) {
971 qWarning("ContactEditor::slotCmbChooser3Change( %d )", index); 972 qWarning("ContactEditor::slotCmbChooser3Change( %d )", index);
972 973
973 if ( !cmbChooserChange( cmbChooserField3->currentItem(), m_widgetStack3, 3) ){ 974 if ( !cmbChooserChange( cmbChooserField3->currentItem(), m_widgetStack3, 3) ){
974 975
975 txtChooserField3->setText( slChooserValues[index] ); 976 txtChooserField3->setText( slChooserValues[index] );
976 txtChooserField3->setFocus(); 977 txtChooserField3->setFocus();
977 978
978 } 979 }
979} 980}
980 981
981void ContactEditor::slotCmbChooser4Change( int index ) { 982void ContactEditor::slotCmbChooser4Change( int index ) {
982 qWarning("ContactEditor::slotCmbChooser4Change( %d )", index); 983 qWarning("ContactEditor::slotCmbChooser4Change( %d )", index);
983 984
984 if ( !cmbChooserChange( cmbChooserField4->currentItem(), m_widgetStack4, 4) ){ 985 if ( !cmbChooserChange( cmbChooserField4->currentItem(), m_widgetStack4, 4) ){
985 986
986 txtChooserField4->setText( slChooserValues[index] ); 987 txtChooserField4->setText( slChooserValues[index] );
987 txtChooserField4->setFocus(); 988 txtChooserField4->setFocus();
988 989
989 } 990 }
990} 991}
991 992
992void ContactEditor::slotAddressTypeChange( int index ) { 993void ContactEditor::slotAddressTypeChange( int index ) {
993 994
994 995
995 if ( !initializing ) 996 if ( !initializing )
996 contactfields.setFieldOrder( 4, index ); 997 contactfields.setFieldOrder( 4, index );
997 998
998 999
999 if ( index == 0 ) { 1000 if ( index == 0 ) {
@@ -1004,743 +1005,743 @@ void ContactEditor::slotAddressTypeChange( int index ) {
1004 txtCity->setText( slBusinessAddress[3] ); 1005 txtCity->setText( slBusinessAddress[3] );
1005 txtState->setText( slBusinessAddress[4] ); 1006 txtState->setText( slBusinessAddress[4] );
1006 txtZip->setText( slBusinessAddress[5] ); 1007 txtZip->setText( slBusinessAddress[5] );
1007 QLineEdit *txtTmp = cmbCountry->lineEdit(); 1008 QLineEdit *txtTmp = cmbCountry->lineEdit();
1008 txtTmp->setText( slBusinessAddress[6] ); 1009 txtTmp->setText( slBusinessAddress[6] );
1009 1010
1010 } else { 1011 } else {
1011 1012
1012 txtAddress->setText( slHomeAddress[0] ); 1013 txtAddress->setText( slHomeAddress[0] );
1013 //txtAddress2->setText( (*slHomeAddress)[1] ); 1014 //txtAddress2->setText( (*slHomeAddress)[1] );
1014 //txtPOBox->setText( (*slHomeAddress)[2] ); 1015 //txtPOBox->setText( (*slHomeAddress)[2] );
1015 txtCity->setText( slHomeAddress[3] ); 1016 txtCity->setText( slHomeAddress[3] );
1016 txtState->setText( slHomeAddress[4] ); 1017 txtState->setText( slHomeAddress[4] );
1017 txtZip->setText( slHomeAddress[5] ); 1018 txtZip->setText( slHomeAddress[5] );
1018 QLineEdit *txtTmp = cmbCountry->lineEdit(); 1019 QLineEdit *txtTmp = cmbCountry->lineEdit();
1019 txtTmp->setText( slHomeAddress[6] ); 1020 txtTmp->setText( slHomeAddress[6] );
1020 1021
1021 } 1022 }
1022 1023
1023} 1024}
1024 1025
1025void ContactEditor::slotFullNameChange( const QString &textChanged ) { 1026void ContactEditor::slotFullNameChange( const QString &textChanged ) {
1026 1027
1027 qWarning( "ContactEditor::slotFullNameChange( %s )", textChanged.latin1() ); 1028 qWarning( "ContactEditor::slotFullNameChange( %s )", textChanged.latin1() );
1028 1029
1029 int index = cmbFileAs->currentItem(); 1030 int index = cmbFileAs->currentItem();
1030 1031
1031 cmbFileAs->clear(); 1032 cmbFileAs->clear();
1032 1033
1033 cmbFileAs->insertItem( parseName( textChanged, NAME_LF ) ); 1034 cmbFileAs->insertItem( parseName( textChanged, NAME_LF ) );
1034 cmbFileAs->insertItem( parseName( textChanged, NAME_LFM ) ); 1035 cmbFileAs->insertItem( parseName( textChanged, NAME_LFM ) );
1035 cmbFileAs->insertItem( parseName( textChanged, NAME_FL ) ); 1036 cmbFileAs->insertItem( parseName( textChanged, NAME_FL ) );
1036 cmbFileAs->insertItem( parseName( textChanged, NAME_FML ) ); 1037 cmbFileAs->insertItem( parseName( textChanged, NAME_FML ) );
1037 if ( ! txtSuffix->text().isEmpty() ) 1038 if ( ! txtSuffix->text().isEmpty() )
1038 cmbFileAs->insertItem( parseName( textChanged, NAME_FML ) + " " + txtSuffix->text() ); 1039 cmbFileAs->insertItem( parseName( textChanged, NAME_FML ) + " " + txtSuffix->text() );
1039 1040
1040 cmbFileAs->setCurrentItem( index ); 1041 cmbFileAs->setCurrentItem( index );
1041 1042
1042 1043
1043} 1044}
1044 1045
1045void ContactEditor::slotSuffixChange( const QString& ) { 1046void ContactEditor::slotSuffixChange( const QString& ) {
1046 // Just want to update the FileAs combo if the suffix was changed.. 1047 // Just want to update the FileAs combo if the suffix was changed..
1047 slotFullNameChange( txtFullName->text() ); 1048 slotFullNameChange( txtFullName->text() );
1048} 1049}
1049 1050
1050void ContactEditor::slotOrganizationChange( const QString &textChanged ){ 1051void ContactEditor::slotOrganizationChange( const QString &textChanged ){
1051 qWarning( "ContactEditor::slotOrganizationChange( %s )", textChanged.latin1() ); 1052 qWarning( "ContactEditor::slotOrganizationChange( %s )", textChanged.latin1() );
1052 // Special handling for storing Companies: 1053 // Special handling for storing Companies:
1053 // If no Fullname is given, we store the Company-Name as lastname 1054 // If no Fullname is given, we store the Company-Name as lastname
1054 // to handle it like a person.. 1055 // to handle it like a person..
1055 if ( txtFullName->text() == txtOrganization->text().left( txtFullName->text().length() ) ) 1056 if ( txtFullName->text() == txtOrganization->text().left( txtFullName->text().length() ) )
1056 txtFullName->setText( textChanged ); 1057 txtFullName->setText( textChanged );
1057 1058
1058} 1059}
1059 1060
1060void ContactEditor::accept() { 1061void ContactEditor::accept() {
1061 1062
1062 if ( isEmpty() ) { 1063 if ( isEmpty() ) {
1063 cleanupFields(); 1064 cleanupFields();
1064 reject(); 1065 reject();
1065 } else { 1066 } else {
1066 saveEntry(); 1067 saveEntry();
1067 cleanupFields(); 1068 cleanupFields();
1068 QDialog::accept(); 1069 QDialog::accept();
1069 } 1070 }
1070 1071
1071} 1072}
1072 1073
1073void ContactEditor::slotNote() { 1074void ContactEditor::slotNote() {
1074 1075
1075 if ( ! QPEApplication::execDialog( dlgNote ) ) { 1076 if ( ! QPEApplication::execDialog( dlgNote ) ) {
1076 txtNote->setText( ent.notes() ); 1077 txtNote->setText( ent.notes() );
1077 } 1078 }
1078} 1079}
1079 1080
1080void ContactEditor::slotName() { 1081void ContactEditor::slotName() {
1081 1082
1082 QString tmpName; 1083 QString tmpName;
1083 1084
1084 txtFirstName->setText( parseName(txtFullName->text(), NAME_F) ); 1085 txtFirstName->setText( parseName(txtFullName->text(), NAME_F) );
1085 txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) ); 1086 txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) );
1086 txtLastName->setText( parseName(txtFullName->text(), NAME_L) ); 1087 txtLastName->setText( parseName(txtFullName->text(), NAME_L) );
1087 // txtSuffix->setText( parseName(txtFullName->text(), NAME_S) ); 1088 // txtSuffix->setText( parseName(txtFullName->text(), NAME_S) );
1088 1089
1089 if ( QPEApplication::execDialog( dlgName ) ) { 1090 if ( QPEApplication::execDialog( dlgName ) ) {
1090 if ( txtLastName->text().contains( ' ', TRUE ) ) 1091 if ( txtLastName->text().contains( ' ', TRUE ) )
1091 tmpName = txtLastName->text() + ", " + txtFirstName->text() + " " + txtMiddleName->text(); 1092 tmpName = txtLastName->text() + ", " + txtFirstName->text() + " " + txtMiddleName->text();
1092 else 1093 else
1093 tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text(); 1094 tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text();
1094 1095
1095 txtFullName->setText( tmpName.simplifyWhiteSpace() ); 1096 txtFullName->setText( tmpName.simplifyWhiteSpace() );
1096 slotFullNameChange( txtFullName->text() ); 1097 slotFullNameChange( txtFullName->text() );
1097 } 1098 }
1098 1099
1099} 1100}
1100 1101
1101void ContactEditor::setNameFocus() { 1102void ContactEditor::setNameFocus() {
1102 1103
1103 txtFullName->setFocus(); 1104 txtFullName->setFocus();
1104 1105
1105} 1106}
1106 1107
1107bool ContactEditor::isEmpty() { 1108bool ContactEditor::isEmpty() {
1108 // Test and see if the record should be saved. 1109 // Test and see if the record should be saved.
1109 // More strict than the original qtopia, needs name or fileas to save 1110 // More strict than the original qtopia, needs name or fileas to save
1110 1111
1111 QString t = txtFullName->text(); 1112 QString t = txtFullName->text();
1112 if ( !t.isEmpty() && containsAlphaNum( t ) ) 1113 if ( !t.isEmpty() && containsAlphaNum( t ) )
1113 return false; 1114 return false;
1114 1115
1115 t = cmbFileAs->currentText(); 1116 t = cmbFileAs->currentText();
1116 if ( !t.isEmpty() && containsAlphaNum( t ) ) 1117 if ( !t.isEmpty() && containsAlphaNum( t ) )
1117 return false; 1118 return false;
1118 1119
1119 return true; 1120 return true;
1120 1121
1121} 1122}
1122 1123
1123QString ContactEditor::parseName( const QString fullName, int type ) { 1124QString ContactEditor::parseName( const QString fullName, int type ) {
1124 1125
1125 QString simplifiedName( fullName.simplifyWhiteSpace() ); 1126 QString simplifiedName( fullName.simplifyWhiteSpace() );
1126 QString strFirstName; 1127 QString strFirstName;
1127 QString strMiddleName; 1128 QString strMiddleName;
1128 QString strLastName; 1129 QString strLastName;
1129 QString strTitle; 1130 QString strTitle;
1130 int commapos; 1131 int commapos;
1131 bool haveLastName = false; 1132 bool haveLastName = false;
1132 1133
1133 qWarning("Fullname: %s", simplifiedName.latin1()); 1134 qWarning("Fullname: %s", simplifiedName.latin1());
1134 1135
1135 commapos = simplifiedName.find( ',', 0, TRUE); 1136 commapos = simplifiedName.find( ',', 0, TRUE);
1136 if ( commapos >= 0 ) { 1137 if ( commapos >= 0 ) {
1137 qWarning(" Commapos: %d", commapos ); 1138 qWarning(" Commapos: %d", commapos );
1138 1139
1139 // A comma (",") separates the lastname from one or 1140 // A comma (",") separates the lastname from one or
1140 // many first names. Thus, remove the lastname from the 1141 // many first names. Thus, remove the lastname from the
1141 // String and parse the firstnames. 1142 // String and parse the firstnames.
1142 1143
1143 strLastName = simplifiedName.left( commapos ); 1144 strLastName = simplifiedName.left( commapos );
1144 simplifiedName= simplifiedName.mid( commapos + 1 ); 1145 simplifiedName= simplifiedName.mid( commapos + 1 );
1145 haveLastName = true; 1146 haveLastName = true;
1146 qWarning("Fullname without ',': %s", simplifiedName.latin1()); 1147 qWarning("Fullname without ',': %s", simplifiedName.latin1());
1147 1148
1148 // If we have any lastname, we should now split all first names. 1149 // If we have any lastname, we should now split all first names.
1149 // The first one will be the used as first, the rest as "middle names" 1150 // The first one will be the used as first, the rest as "middle names"
1150 1151
1151 QStringList allFirstNames = QStringList::split(" ", simplifiedName); 1152 QStringList allFirstNames = QStringList::split(" ", simplifiedName);
1152 QStringList::Iterator it = allFirstNames.begin(); 1153 QStringList::Iterator it = allFirstNames.begin();
1153 strFirstName = *it++; 1154 strFirstName = *it++;
1154 QStringList allSecondNames; 1155 QStringList allSecondNames;
1155 for ( ; it != allFirstNames.end(); ++it ) 1156 for ( ; it != allFirstNames.end(); ++it )
1156 allSecondNames.append( *it ); 1157 allSecondNames.append( *it );
1157 1158
1158 strMiddleName = allSecondNames.join(" "); 1159 strMiddleName = allSecondNames.join(" ");
1159 1160
1160 } else { 1161 } else {
1161 1162
1162 // No comma separator used: We use the first word as firstname, the 1163 // No comma separator used: We use the first word as firstname, the
1163 // last as second/lastname and everything in the middle as middlename 1164 // last as second/lastname and everything in the middle as middlename
1164 1165
1165 QStringList allNames = QStringList::split(" ", simplifiedName); 1166 QStringList allNames = QStringList::split(" ", simplifiedName);
1166 QStringList::Iterator it = allNames.begin(); 1167 QStringList::Iterator it = allNames.begin();
1167 strFirstName = *it++; 1168 strFirstName = *it++;
1168 QStringList allSecondNames; 1169 QStringList allSecondNames;
1169 for ( ; it != --allNames.end(); ++it ) 1170 for ( ; it != --allNames.end(); ++it )
1170 allSecondNames.append( *it ); 1171 allSecondNames.append( *it );
1171 1172
1172 strMiddleName = allSecondNames.join(" "); 1173 strMiddleName = allSecondNames.join(" ");
1173 strLastName = *(--allNames.end()); 1174 strLastName = *(--allNames.end());
1174 1175
1175 } 1176 }
1176 1177
1177 if ( strFirstName == strLastName ) 1178 if ( strFirstName == strLastName )
1178 strFirstName = ""; 1179 strFirstName = "";
1179 1180
1180 qWarning(" strFirstName: %s", strFirstName.latin1()); 1181 qWarning(" strFirstName: %s", strFirstName.latin1());
1181 qWarning(" strMiddleName: %s", strMiddleName.latin1()); 1182 qWarning(" strMiddleName: %s", strMiddleName.latin1());
1182 qWarning(" strLastName: %s", strLastName.latin1()); 1183 qWarning(" strLastName: %s", strLastName.latin1());
1183 qWarning(" strTitle: %s", strTitle.latin1()); 1184 qWarning(" strTitle: %s", strTitle.latin1());
1184 1185
1185 switch (type) { 1186 switch (type) {
1186 case NAME_FL: 1187 case NAME_FL:
1187 return strFirstName + " " + strLastName; 1188 return strFirstName + " " + strLastName;
1188 1189
1189 case NAME_LF: 1190 case NAME_LF:
1190 return strLastName + ", " + strFirstName; 1191 return strLastName + ", " + strFirstName;
1191 1192
1192 case NAME_LFM: 1193 case NAME_LFM:
1193 return strLastName + ", " + strFirstName + " " + strMiddleName; 1194 return strLastName + ", " + strFirstName + " " + strMiddleName;
1194 1195
1195 case NAME_FML: 1196 case NAME_FML:
1196 return strFirstName + " " + strMiddleName + " " + strLastName ; 1197 return strFirstName + " " + strMiddleName + " " + strLastName ;
1197 1198
1198 case NAME_F: 1199 case NAME_F:
1199 return strFirstName; 1200 return strFirstName;
1200 1201
1201 case NAME_M: 1202 case NAME_M:
1202 return strMiddleName; 1203 return strMiddleName;
1203 1204
1204 case NAME_L: 1205 case NAME_L:
1205 return strLastName; 1206 return strLastName;
1206 1207
1207 case NAME_S: 1208 case NAME_S:
1208 return txtSuffix->text(); 1209 return txtSuffix->text();
1209 1210
1210 } 1211 }
1211 return QString::null; 1212 return QString::null;
1212} 1213}
1213 1214
1214void ContactEditor::cleanupFields() { 1215void ContactEditor::cleanupFields() {
1215 QStringList::Iterator it = slChooserValues.begin(); 1216 QStringList::Iterator it = slChooserValues.begin();
1216 1217
1217 for ( int i = 0; it != slChooserValues.end(); i++, ++it ) { 1218 for ( int i = 0; it != slChooserValues.end(); i++, ++it ) {
1218 (*it) = ""; 1219 (*it) = "";
1219 } 1220 }
1220 1221
1221 for ( int i = 0; i < 7; i++ ) { 1222 for ( int i = 0; i < 7; i++ ) {
1222 slHomeAddress[i] = ""; 1223 slHomeAddress[i] = "";
1223 slBusinessAddress[i] = ""; 1224 slBusinessAddress[i] = "";
1224 } 1225 }
1225 1226
1226 QListIterator<QLineEdit> itLV( listValue ); 1227 QListIterator<QLineEdit> itLV( listValue );
1227 for ( ; itLV.current(); ++itLV ) { 1228 for ( ; itLV.current(); ++itLV ) {
1228 (*itLV)->setText( "" ); 1229 (*itLV)->setText( "" );
1229 } 1230 }
1230 1231
1231 txtFirstName->setText(""); 1232 txtFirstName->setText("");
1232 txtMiddleName->setText(""); 1233 txtMiddleName->setText("");
1233 txtLastName->setText(""); 1234 txtLastName->setText("");
1234 txtSuffix->setText(""); 1235 txtSuffix->setText("");
1235 txtNote->setText(""); 1236 txtNote->setText("");
1236 txtFullName->setText(""); 1237 txtFullName->setText("");
1237 txtJobTitle->setText(""); 1238 txtJobTitle->setText("");
1238 txtOrganization->setText(""); 1239 txtOrganization->setText("");
1239 txtChooserField1->setText(""); 1240 txtChooserField1->setText("");
1240 txtChooserField2->setText(""); 1241 txtChooserField2->setText("");
1241 txtChooserField3->setText(""); 1242 txtChooserField3->setText("");
1242 txtAddress->setText(""); 1243 txtAddress->setText("");
1243 txtCity->setText(""); 1244 txtCity->setText("");
1244 txtState->setText(""); 1245 txtState->setText("");
1245 txtZip->setText(""); 1246 txtZip->setText("");
1246 QLineEdit *txtTmp = cmbCountry->lineEdit(); 1247 QLineEdit *txtTmp = cmbCountry->lineEdit();
1247 txtTmp->setText(""); 1248 txtTmp->setText("");
1248 txtTmp = cmbFileAs->lineEdit(); 1249 txtTmp = cmbFileAs->lineEdit();
1249 txtTmp->setText(""); 1250 txtTmp->setText("");
1250 1251
1251} 1252}
1252 1253
1253void ContactEditor::setEntry( const OContact &entry ) { 1254void ContactEditor::setEntry( const Opie::OPimContact &entry ) {
1254 1255
1255 initializing = true; 1256 initializing = true;
1256 1257
1257 // Cleanup and activate the general Page .. 1258 // Cleanup and activate the general Page ..
1258 cleanupFields(); 1259 cleanupFields();
1259 tabMain->setCurrentPage( 0 ); 1260 tabMain->setCurrentPage( 0 );
1260 1261
1261 ent = entry; 1262 ent = entry;
1262 1263
1263 emails = QStringList(ent.emailList()); 1264 emails = QStringList(ent.emailList());
1264 defaultEmail = ent.defaultEmail(); 1265 defaultEmail = ent.defaultEmail();
1265 if (defaultEmail.isEmpty()) defaultEmail = emails[0]; 1266 if (defaultEmail.isEmpty()) defaultEmail = emails[0];
1266 qDebug("default email=%s",defaultEmail.latin1()); 1267 qDebug("default email=%s",defaultEmail.latin1());
1267 1268
1268 txtFirstName->setText( ent.firstName() ); 1269 txtFirstName->setText( ent.firstName() );
1269 txtMiddleName->setText( ent.middleName() ); 1270 txtMiddleName->setText( ent.middleName() );
1270 txtLastName->setText( ent.lastName() ); 1271 txtLastName->setText( ent.lastName() );
1271 txtSuffix->setText( ent.suffix() ); 1272 txtSuffix->setText( ent.suffix() );
1272 1273
1273 // QString *tmpString = new QString; 1274 // QString *tmpString = new QString;
1274 // *tmpString = ent.firstName() + " " + ent.middleName() + 1275 // *tmpString = ent.firstName() + " " + ent.middleName() +
1275 // + " " + ent.lastName() + " " + ent.suffix(); 1276 // + " " + ent.lastName() + " " + ent.suffix();
1276 //txtFullName->setText( tmpString->simplifyWhiteSpace() ); 1277 //txtFullName->setText( tmpString->simplifyWhiteSpace() );
1277 1278
1278 if ( !ent.isEmpty() ){ 1279 if ( !ent.isEmpty() ){
1279 // Lastnames with multiple words need to be protected by a comma ! 1280 // Lastnames with multiple words need to be protected by a comma !
1280 if ( ent.lastName().contains( ' ', TRUE ) ) 1281 if ( ent.lastName().contains( ' ', TRUE ) )
1281 txtFullName->setText( ent.lastName() + ", " + ent.firstName() + " " + ent.middleName() ); 1282 txtFullName->setText( ent.lastName() + ", " + ent.firstName() + " " + ent.middleName() );
1282 else 1283 else
1283 txtFullName->setText( ent.firstName() + " " + ent.middleName() + " " + ent.lastName() ); 1284 txtFullName->setText( ent.firstName() + " " + ent.middleName() + " " + ent.lastName() );
1284 } 1285 }
1285 1286
1286 cmbFileAs->setEditText( ent.fileAs() ); 1287 cmbFileAs->setEditText( ent.fileAs() );
1287 1288
1288 //if (hasTitle) 1289 //if (hasTitle)
1289 txtJobTitle->setText( ent.jobTitle() ); 1290 txtJobTitle->setText( ent.jobTitle() );
1290 1291
1291 //if (hasCompany) 1292 //if (hasCompany)
1292 txtOrganization->setText( ent.company() ); 1293 txtOrganization->setText( ent.company() );
1293 1294
1294 //if (hasNotes) 1295 //if (hasNotes)
1295 txtNote->setText( ent.notes() ); 1296 txtNote->setText( ent.notes() );
1296 1297
1297 //if (hasStreet) { 1298 //if (hasStreet) {
1298 slHomeAddress[0] = ent.homeStreet(); 1299 slHomeAddress[0] = ent.homeStreet();
1299 slBusinessAddress[0] = ent.businessStreet(); 1300 slBusinessAddress[0] = ent.businessStreet();
1300 //} 1301 //}
1301 1302
1302 //if (hasCity) { 1303 //if (hasCity) {
1303 slHomeAddress[3] = ent.homeCity(); 1304 slHomeAddress[3] = ent.homeCity();
1304 slBusinessAddress[3] = ent.businessCity(); 1305 slBusinessAddress[3] = ent.businessCity();
1305 //} 1306 //}
1306 1307
1307 //if (hasState) { 1308 //if (hasState) {
1308 slHomeAddress[4] = ent.homeState(); 1309 slHomeAddress[4] = ent.homeState();
1309 slBusinessAddress[4] = ent.businessState(); 1310 slBusinessAddress[4] = ent.businessState();
1310 //} 1311 //}
1311 1312
1312 //if (hasZip) { 1313 //if (hasZip) {
1313 slHomeAddress[5] = ent.homeZip(); 1314 slHomeAddress[5] = ent.homeZip();
1314 slBusinessAddress[5] = ent.businessZip(); 1315 slBusinessAddress[5] = ent.businessZip();
1315 //} 1316 //}
1316 1317
1317 //if (hasCountry) { 1318 //if (hasCountry) {
1318 slHomeAddress[6] = ent.homeCountry(); 1319 slHomeAddress[6] = ent.homeCountry();
1319 slBusinessAddress[6] = ent.businessCountry(); 1320 slBusinessAddress[6] = ent.businessCountry();
1320 //} 1321 //}
1321 1322
1322 QStringList::ConstIterator it; 1323 QStringList::ConstIterator it;
1323 QListIterator<QLineEdit> itLE( listValue ); 1324 QListIterator<QLineEdit> itLE( listValue );
1324 for ( it = slDynamicEntries.begin(); itLE.current()/* != slDynamicEntries.end()*/; ++it, ++itLE) { 1325 for ( it = slDynamicEntries.begin(); itLE.current()/* != slDynamicEntries.end()*/; ++it, ++itLE) {
1325 1326
1326 qWarning(" Filling dynamic Field: %s", (*it).latin1() ); 1327 qWarning(" Filling dynamic Field: %s", (*it).latin1() );
1327 1328
1328 if ( *it == "Department" ) 1329 if ( *it == "Department" )
1329 (*itLE)->setText( ent.department() ); 1330 (*itLE)->setText( ent.department() );
1330 1331
1331 if ( *it == "Company" ) 1332 if ( *it == "Company" )
1332 (*itLE)->setText( ent.company() ); 1333 (*itLE)->setText( ent.company() );
1333 1334
1334 if ( *it == "Office" ) 1335 if ( *it == "Office" )
1335 (*itLE)->setText( ent.office() ); 1336 (*itLE)->setText( ent.office() );
1336 1337
1337 if ( *it == "Profession" ) 1338 if ( *it == "Profession" )
1338 (*itLE)->setText( ent.profession() ); 1339 (*itLE)->setText( ent.profession() );
1339 1340
1340 if ( *it == "Assistant" ) 1341 if ( *it == "Assistant" )
1341 (*itLE)->setText( ent.assistant() ); 1342 (*itLE)->setText( ent.assistant() );
1342 1343
1343 if ( *it == "Manager" ) 1344 if ( *it == "Manager" )
1344 (*itLE)->setText( ent.manager() ); 1345 (*itLE)->setText( ent.manager() );
1345 1346
1346 if ( *it == "Spouse" ) 1347 if ( *it == "Spouse" )
1347 (*itLE)->setText( ent.spouse() ); 1348 (*itLE)->setText( ent.spouse() );
1348 1349
1349 if ( *it == "Nickname" ){ 1350 if ( *it == "Nickname" ){
1350 qWarning("**** Nichname: %s", ent.nickname().latin1() ); 1351 qWarning("**** Nichname: %s", ent.nickname().latin1() );
1351 (*itLE)->setText( ent.nickname() ); 1352 (*itLE)->setText( ent.nickname() );
1352 } 1353 }
1353 1354
1354 if ( *it == "Children" ) 1355 if ( *it == "Children" )
1355 (*itLE)->setText( ent.children() ); 1356 (*itLE)->setText( ent.children() );
1356 1357
1357 } 1358 }
1358 1359
1359 QStringList::Iterator itV; 1360 QStringList::Iterator itV;
1360 for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { 1361 for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) {
1361 1362
1362 if ( ( *it == "Business Phone") || ( *it == "Work Phone" ) ) 1363 if ( ( *it == "Business Phone") || ( *it == "Work Phone" ) )
1363 *itV = ent.businessPhone(); 1364 *itV = ent.businessPhone();
1364 /* 1365 /*
1365 if ( *it == "Business 2 Phone" ) 1366 if ( *it == "Business 2 Phone" )
1366 *itV = ent.business2Phone(); 1367 *itV = ent.business2Phone();
1367 */ 1368 */
1368 if ( ( *it == "Business Fax") || ( *it == "Work Fax" ) ) 1369 if ( ( *it == "Business Fax") || ( *it == "Work Fax" ) )
1369 *itV = ent.businessFax(); 1370 *itV = ent.businessFax();
1370 1371
1371 if ( ( *it == "Business Mobile" ) || ( *it == "work Mobile" ) ) 1372 if ( ( *it == "Business Mobile" ) || ( *it == "work Mobile" ) )
1372 *itV = ent.businessMobile(); 1373 *itV = ent.businessMobile();
1373 /* 1374 /*
1374 if ( *it == "Company Phone" ) 1375 if ( *it == "Company Phone" )
1375 *itV = ent.companyPhone(); 1376 *itV = ent.companyPhone();
1376 */ 1377 */
1377 if ( *it == "Default Email" ) 1378 if ( *it == "Default Email" )
1378 *itV = ent.defaultEmail(); 1379 *itV = ent.defaultEmail();
1379 1380
1380 if ( *it == "Emails" ) 1381 if ( *it == "Emails" )
1381 *itV = ent.emailList().join(", "); // :SX 1382 *itV = ent.emailList().join(", "); // :SX
1382 1383
1383 if ( *it == "Home Phone" ) 1384 if ( *it == "Home Phone" )
1384 *itV = ent.homePhone(); 1385 *itV = ent.homePhone();
1385 /* 1386 /*
1386 if ( *it == "Home 2 Phone" ) 1387 if ( *it == "Home 2 Phone" )
1387 *itV = ent.home2Phone(); 1388 *itV = ent.home2Phone();
1388 */ 1389 */
1389 if ( *it == "Home Fax" ) 1390 if ( *it == "Home Fax" )
1390 *itV = ent.homeFax(); 1391 *itV = ent.homeFax();
1391 1392
1392 if ( *it == "Home Mobile" ) 1393 if ( *it == "Home Mobile" )
1393 *itV = ent.homeMobile(); 1394 *itV = ent.homeMobile();
1394 /* 1395 /*
1395 if ( *it == "Car Phone" ) 1396 if ( *it == "Car Phone" )
1396 *itV = ent.carPhone(); 1397 *itV = ent.carPhone();
1397 1398
1398 if ( *it == "ISDN Phone" ) 1399 if ( *it == "ISDN Phone" )
1399 *itV = ent.ISDNPhone(); 1400 *itV = ent.ISDNPhone();
1400 1401
1401 if ( *it == "Other Phone" ) 1402 if ( *it == "Other Phone" )
1402 *itV = ent.otherPhone(); 1403 *itV = ent.otherPhone();
1403 */ 1404 */
1404 if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) 1405 if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) )
1405 *itV = ent.businessPager(); 1406 *itV = ent.businessPager();
1406 /* 1407 /*
1407 if ( *it == "Home Pager") 1408 if ( *it == "Home Pager")
1408 *itV = ent.homePager(); 1409 *itV = ent.homePager();
1409 1410
1410 if ( *it == "AIM IM" ) 1411 if ( *it == "AIM IM" )
1411 *itV = ent.AIMIM(); 1412 *itV = ent.AIMIM();
1412 1413
1413 if ( *it == "ICQ IM" ) 1414 if ( *it == "ICQ IM" )
1414 *itV = ent.ICQIM(); 1415 *itV = ent.ICQIM();
1415 1416
1416 if ( *it == "Jabber IM" ) 1417 if ( *it == "Jabber IM" )
1417 *itV = ent.jabberIM(); 1418 *itV = ent.jabberIM();
1418 1419
1419 if ( *it == "MSN IM" ) 1420 if ( *it == "MSN IM" )
1420 *itV = ent.MSNIM(); 1421 *itV = ent.MSNIM();
1421 1422
1422 if ( *it == "Yahoo IM" ) 1423 if ( *it == "Yahoo IM" )
1423 *itV = ent.yahooIM(); 1424 *itV = ent.yahooIM();
1424 */ 1425 */
1425 if ( *it == "Home Web Page" ) 1426 if ( *it == "Home Web Page" )
1426 *itV = ent.homeWebpage(); 1427 *itV = ent.homeWebpage();
1427 1428
1428 if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) 1429 if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) )
1429 *itV = ent.businessWebpage(); 1430 *itV = ent.businessWebpage();
1430 1431
1431 1432
1432 } 1433 }
1433 1434
1434 1435
1435 cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") ); 1436 cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") );
1436 1437
1437 QString gender = ent.gender(); 1438 QString gender = ent.gender();
1438 cmbGender->setCurrentItem( gender.toInt() ); 1439 cmbGender->setCurrentItem( gender.toInt() );
1439 1440
1440 txtNote->setText( ent.notes() ); 1441 txtNote->setText( ent.notes() );
1441 1442
1442 slotAddressTypeChange( cmbAddress->currentItem() ); 1443 slotAddressTypeChange( cmbAddress->currentItem() );
1443 1444
1444 // Get combo-settings from contact and set preset.. 1445 // Get combo-settings from contact and set preset..
1445 contactfields.loadFromRecord( ent ); 1446 contactfields.loadFromRecord( ent );
1446 cmbChooserField1->setCurrentItem( contactfields.getFieldOrder(0, 7) ); 1447 cmbChooserField1->setCurrentItem( contactfields.getFieldOrder(0, 7) );
1447 cmbChooserField2->setCurrentItem( contactfields.getFieldOrder(1, 9) ); 1448 cmbChooserField2->setCurrentItem( contactfields.getFieldOrder(1, 9) );
1448 cmbChooserField3->setCurrentItem( contactfields.getFieldOrder(2, 0) ); 1449 cmbChooserField3->setCurrentItem( contactfields.getFieldOrder(2, 0) );
1449 cmbChooserField4->setCurrentItem( contactfields.getFieldOrder(3, 6) ); 1450 cmbChooserField4->setCurrentItem( contactfields.getFieldOrder(3, 6) );
1450 cmbAddress->setCurrentItem( contactfields.getFieldOrder(4, 1) ); 1451 cmbAddress->setCurrentItem( contactfields.getFieldOrder(4, 1) );
1451 slotCmbChooser1Change( cmbChooserField1->currentItem() ); 1452 slotCmbChooser1Change( cmbChooserField1->currentItem() );
1452 slotCmbChooser2Change( cmbChooserField2->currentItem() ); 1453 slotCmbChooser2Change( cmbChooserField2->currentItem() );
1453 slotCmbChooser3Change( cmbChooserField3->currentItem() ); 1454 slotCmbChooser3Change( cmbChooserField3->currentItem() );
1454 slotCmbChooser4Change( cmbChooserField4->currentItem() ); 1455 slotCmbChooser4Change( cmbChooserField4->currentItem() );
1455 slotAddressTypeChange( cmbAddress->currentItem() ); 1456 slotAddressTypeChange( cmbAddress->currentItem() );
1456 1457
1457 updateDatePicker(); 1458 updateDatePicker();
1458 1459
1459 initializing = false; 1460 initializing = false;
1460} 1461}
1461void ContactEditor::updateDatePicker() 1462void ContactEditor::updateDatePicker()
1462{ 1463{
1463 // Set DatePicker 1464 // Set DatePicker
1464 if ( !ent.birthday().isNull() ){ 1465 if ( !ent.birthday().isNull() ){
1465 birthdayButton->setText( TimeString::numberDateString( ent.birthday() ) ); 1466 birthdayButton->setText( TimeString::numberDateString( ent.birthday() ) );
1466 birthdayPicker->setDate( ent.birthday() ); 1467 birthdayPicker->setDate( ent.birthday() );
1467 } else 1468 } else
1468 birthdayButton->setText( tr ("Unknown") ); 1469 birthdayButton->setText( tr ("Unknown") );
1469 1470
1470 if ( !ent.anniversary().isNull() ){ 1471 if ( !ent.anniversary().isNull() ){
1471 anniversaryButton->setText( TimeString::numberDateString( ent.anniversary() ) ); 1472 anniversaryButton->setText( TimeString::numberDateString( ent.anniversary() ) );
1472 anniversaryPicker->setDate( ent.anniversary() ); 1473 anniversaryPicker->setDate( ent.anniversary() );
1473 } else 1474 } else
1474 anniversaryButton->setText( tr ("Unknown") ); 1475 anniversaryButton->setText( tr ("Unknown") );
1475 1476
1476} 1477}
1477 1478
1478void ContactEditor::saveEntry() { 1479void ContactEditor::saveEntry() {
1479 1480
1480 // Store current combo into contact 1481 // Store current combo into contact
1481 contactfields.saveToRecord( ent ); 1482 contactfields.saveToRecord( ent );
1482 1483
1483 txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) ); 1484 txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) );
1484 txtMiddleName->setText( parseName( txtFullName->text(), NAME_M ) ); 1485 txtMiddleName->setText( parseName( txtFullName->text(), NAME_M ) );
1485 txtLastName->setText( parseName( txtFullName->text(), NAME_L ) ); 1486 txtLastName->setText( parseName( txtFullName->text(), NAME_L ) );
1486 // txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) ); 1487 // txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) );
1487 1488
1488 ent.setFirstName( txtFirstName->text() ); 1489 ent.setFirstName( txtFirstName->text() );
1489 ent.setLastName( txtLastName->text() ); 1490 ent.setLastName( txtLastName->text() );
1490 ent.setMiddleName( txtMiddleName->text() ); 1491 ent.setMiddleName( txtMiddleName->text() );
1491 ent.setSuffix( txtSuffix->text() ); 1492 ent.setSuffix( txtSuffix->text() );
1492 1493
1493 ent.setFileAs( cmbFileAs->currentText() ); 1494 ent.setFileAs( cmbFileAs->currentText() );
1494 1495
1495 ent.setCategories( cmbCat->currentCategories() ); 1496 ent.setCategories( cmbCat->currentCategories() );
1496 1497
1497 1498
1498 //if (hasTitle) 1499 //if (hasTitle)
1499 ent.setJobTitle( txtJobTitle->text() ); 1500 ent.setJobTitle( txtJobTitle->text() );
1500 1501
1501 //if (hasCompany) 1502 //if (hasCompany)
1502 ent.setCompany( txtOrganization->text() ); 1503 ent.setCompany( txtOrganization->text() );
1503 1504
1504 //if (hasNotes) 1505 //if (hasNotes)
1505 ent.setNotes( txtNote->text() ); 1506 ent.setNotes( txtNote->text() );
1506 1507
1507 //if (hasStreet) { 1508 //if (hasStreet) {
1508 ent.setHomeStreet( slHomeAddress[0] ); 1509 ent.setHomeStreet( slHomeAddress[0] );
1509 ent.setBusinessStreet( slBusinessAddress[0] ); 1510 ent.setBusinessStreet( slBusinessAddress[0] );
1510 //} 1511 //}
1511 1512
1512 //if (hasCity) { 1513 //if (hasCity) {
1513 ent.setHomeCity( slHomeAddress[3] ); 1514 ent.setHomeCity( slHomeAddress[3] );
1514 ent.setBusinessCity( slBusinessAddress[3] ); 1515 ent.setBusinessCity( slBusinessAddress[3] );
1515 //} 1516 //}
1516 1517
1517 //if (hasState) { 1518 //if (hasState) {
1518 ent.setHomeState( slHomeAddress[4] ); 1519 ent.setHomeState( slHomeAddress[4] );
1519 ent.setBusinessState( slBusinessAddress[4] ); 1520 ent.setBusinessState( slBusinessAddress[4] );
1520 //} 1521 //}
1521 1522
1522 //if (hasZip) { 1523 //if (hasZip) {
1523 ent.setHomeZip( slHomeAddress[5] ); 1524 ent.setHomeZip( slHomeAddress[5] );
1524 ent.setBusinessZip( slBusinessAddress[5] ); 1525 ent.setBusinessZip( slBusinessAddress[5] );
1525 //} 1526 //}
1526 1527
1527 //if (hasCountry) { 1528 //if (hasCountry) {
1528 ent.setHomeCountry( slHomeAddress[6] ); 1529 ent.setHomeCountry( slHomeAddress[6] );
1529 ent.setBusinessCountry( slBusinessAddress[6] ); 1530 ent.setBusinessCountry( slBusinessAddress[6] );
1530 //} 1531 //}
1531 1532
1532 QStringList::ConstIterator it; 1533 QStringList::ConstIterator it;
1533 QListIterator<QLineEdit> itLE( listValue ); 1534 QListIterator<QLineEdit> itLE( listValue );
1534 for ( it = slDynamicEntries.begin(); itLE.current() && it != slDynamicEntries.end(); ++it, ++itLE) { 1535 for ( it = slDynamicEntries.begin(); itLE.current() && it != slDynamicEntries.end(); ++it, ++itLE) {
1535 1536
1536 if ( *it == "Department" ) 1537 if ( *it == "Department" )
1537 ent.setDepartment( (*itLE)->text() ); 1538 ent.setDepartment( (*itLE)->text() );
1538 1539
1539 if ( *it == "Company" ) 1540 if ( *it == "Company" )
1540 ent.setCompany( (*itLE)->text() ); 1541 ent.setCompany( (*itLE)->text() );
1541 1542
1542 if ( *it == "Office" ) 1543 if ( *it == "Office" )
1543 ent.setOffice( (*itLE)->text() ); 1544 ent.setOffice( (*itLE)->text() );
1544 1545
1545 if ( *it == "Profession" ) 1546 if ( *it == "Profession" )
1546 ent.setProfession( (*itLE)->text() ); 1547 ent.setProfession( (*itLE)->text() );
1547 1548
1548 if ( *it == "Assistant" ) 1549 if ( *it == "Assistant" )
1549 ent.setAssistant( (*itLE)->text() ); 1550 ent.setAssistant( (*itLE)->text() );
1550 1551
1551 if ( *it == "Manager" ) 1552 if ( *it == "Manager" )
1552 ent.setManager( (*itLE)->text() ); 1553 ent.setManager( (*itLE)->text() );
1553 1554
1554 if ( *it == "Spouse" ) 1555 if ( *it == "Spouse" )
1555 ent.setSpouse( (*itLE)->text() ); 1556 ent.setSpouse( (*itLE)->text() );
1556 1557
1557 if ( *it == "Nickname" ) 1558 if ( *it == "Nickname" )
1558 ent.setNickname( (*itLE)->text() ); 1559 ent.setNickname( (*itLE)->text() );
1559 1560
1560 if ( *it == "Children" ) 1561 if ( *it == "Children" )
1561 ent.setChildren( (*itLE)->text() ); 1562 ent.setChildren( (*itLE)->text() );
1562 1563
1563 } 1564 }
1564 1565
1565 1566
1566 QStringList::ConstIterator itV; 1567 QStringList::ConstIterator itV;
1567 for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { 1568 for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) {
1568 1569
1569 if ( ( *it == "Business Phone" ) || ( *it == "Work Phone" ) ) 1570 if ( ( *it == "Business Phone" ) || ( *it == "Work Phone" ) )
1570 ent.setBusinessPhone( *itV ); 1571 ent.setBusinessPhone( *itV );
1571 1572
1572 if ( ( *it == "Business Fax" ) || ( *it == "Work Fax" ) ) 1573 if ( ( *it == "Business Fax" ) || ( *it == "Work Fax" ) )
1573 ent.setBusinessFax( *itV ); 1574 ent.setBusinessFax( *itV );
1574 1575
1575 if ( ( *it == "Business Mobile" ) || ( *it == "Work Mobile" ) ) 1576 if ( ( *it == "Business Mobile" ) || ( *it == "Work Mobile" ) )
1576 ent.setBusinessMobile( *itV ); 1577 ent.setBusinessMobile( *itV );
1577 1578
1578 if ( *it == "Emails" ){ 1579 if ( *it == "Emails" ){
1579 QString allemail; 1580 QString allemail;
1580 QString defaultmail; 1581 QString defaultmail;
1581 parseEmailFrom( emails.join(","), defaultmail, allemail ); 1582 parseEmailFrom( emails.join(","), defaultmail, allemail );
1582 if ( defaultEmail.isEmpty() ){ 1583 if ( defaultEmail.isEmpty() ){
1583 qWarning("Default email was not set by user!"); 1584 qWarning("Default email was not set by user!");
1584 qWarning("Using first email in list: %s", defaultmail.latin1()); 1585 qWarning("Using first email in list: %s", defaultmail.latin1());
1585 ent.setDefaultEmail( defaultmail ); 1586 ent.setDefaultEmail( defaultmail );
1586 } 1587 }
1587 ent.setEmails( allemail ); 1588 ent.setEmails( allemail );
1588 } 1589 }
1589 1590
1590 if ( *it == "Default Email") 1591 if ( *it == "Default Email")
1591 ent.setDefaultEmail( defaultEmail /* *itV */ ); 1592 ent.setDefaultEmail( defaultEmail /* *itV */ );
1592 1593
1593 if ( *it == "Home Phone" ) 1594 if ( *it == "Home Phone" )
1594 ent.setHomePhone( *itV ); 1595 ent.setHomePhone( *itV );
1595 1596
1596 if ( *it == "Home Fax" ) 1597 if ( *it == "Home Fax" )
1597 ent.setHomeFax( *itV ); 1598 ent.setHomeFax( *itV );
1598 1599
1599 if ( *it == "Home Mobile" ) 1600 if ( *it == "Home Mobile" )
1600 ent.setHomeMobile( *itV ); 1601 ent.setHomeMobile( *itV );
1601 1602
1602 if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) 1603 if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) )
1603 ent.setBusinessPager( *itV ); 1604 ent.setBusinessPager( *itV );
1604 1605
1605 if ( *it == "Home Web Page" ) 1606 if ( *it == "Home Web Page" )
1606 ent.setHomeWebpage( *itV ); 1607 ent.setHomeWebpage( *itV );
1607 1608
1608 if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) 1609 if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) )
1609 ent.setBusinessWebpage( *itV ); 1610 ent.setBusinessWebpage( *itV );
1610 1611
1611 1612
1612 } 1613 }
1613 1614
1614 int gender = cmbGender->currentItem(); 1615 int gender = cmbGender->currentItem();
1615 ent.setGender( QString::number( gender ) ); 1616 ent.setGender( QString::number( gender ) );
1616 1617
1617 QString str = txtNote->text(); 1618 QString str = txtNote->text();
1618 if ( !str.isNull() ) 1619 if ( !str.isNull() )
1619 ent.setNotes( str ); 1620 ent.setNotes( str );
1620 1621
1621} 1622}
1622 1623
1623void parseEmailFrom( const QString &txt, QString &strDefaultEmail, 1624void parseEmailFrom( const QString &txt, QString &strDefaultEmail,
1624 QString &strAll ) 1625 QString &strAll )
1625{ 1626{
1626 int where, 1627 int where,
1627 start; 1628 start;
1628 if ( txt.isEmpty() ) 1629 if ( txt.isEmpty() )
1629 return; 1630 return;
1630 // find the first 1631 // find the first
1631 where = txt.find( ',' ); 1632 where = txt.find( ',' );
1632 if ( where < 0 ) { 1633 if ( where < 0 ) {
1633 strDefaultEmail = txt; 1634 strDefaultEmail = txt;
1634 strAll = txt; 1635 strAll = txt;
1635 } else { 1636 } else {
1636 strDefaultEmail = txt.left( where ).stripWhiteSpace(); 1637 strDefaultEmail = txt.left( where ).stripWhiteSpace();
1637 strAll = strDefaultEmail; 1638 strAll = strDefaultEmail;
1638 while ( where > -1 ) { 1639 while ( where > -1 ) {
1639 strAll.append(" "); 1640 strAll.append(" ");
1640 start = where; 1641 start = where;
1641 where = txt.find( ',', where + 1 ); 1642 where = txt.find( ',', where + 1 );
1642 if ( where > - 1 ) 1643 if ( where > - 1 )
1643 strAll.append( txt.mid(start + 1, where - start - 1).stripWhiteSpace() ); 1644 strAll.append( txt.mid(start + 1, where - start - 1).stripWhiteSpace() );
1644 else // grab until the end... 1645 else // grab until the end...
1645 strAll.append( txt.right(txt.length() - start - 1).stripWhiteSpace() ); 1646 strAll.append( txt.right(txt.length() - start - 1).stripWhiteSpace() );
1646 } 1647 }
1647 } 1648 }
1648} 1649}
1649 1650
1650void parseEmailTo( const QString &strDefaultEmail, 1651void parseEmailTo( const QString &strDefaultEmail,
1651 const QString &strOtherEmail, QString &strBack ) 1652 const QString &strOtherEmail, QString &strBack )
1652{ 1653{
1653 // create a comma dilimeted set of emails... 1654 // create a comma dilimeted set of emails...
1654 // use the power of short circuiting... 1655 // use the power of short circuiting...
1655 bool foundDefault = false; 1656 bool foundDefault = false;
1656 QString strTmp; 1657 QString strTmp;
1657 int start = 0; 1658 int start = 0;
1658 int where; 1659 int where;
1659 // start at the beginng. 1660 // start at the beginng.
1660 strBack = strDefaultEmail; 1661 strBack = strDefaultEmail;
1661 where = 0; 1662 where = 0;
1662 while ( where > -1 ) { 1663 while ( where > -1 ) {
1663 start = where; 1664 start = where;
1664 where = strOtherEmail.find( ' ', where + 1 ); 1665 where = strOtherEmail.find( ' ', where + 1 );
1665 if ( where > 0 ) { 1666 if ( where > 0 ) {
1666 strTmp = strOtherEmail.mid( start, where - start ).stripWhiteSpace(); 1667 strTmp = strOtherEmail.mid( start, where - start ).stripWhiteSpace();
1667 } else 1668 } else
1668 strTmp = strOtherEmail.right( strOtherEmail.length() - start ).stripWhiteSpace(); 1669 strTmp = strOtherEmail.right( strOtherEmail.length() - start ).stripWhiteSpace();
1669 if ( foundDefault || strTmp != strDefaultEmail ) { 1670 if ( foundDefault || strTmp != strDefaultEmail ) {
1670 strBack.append( ", " ); 1671 strBack.append( ", " );
1671 strBack.append( strTmp ); 1672 strBack.append( strTmp );
1672 } else 1673 } else
1673 foundDefault = true; 1674 foundDefault = true;
1674 } 1675 }
1675} 1676}
1676 1677
1677 1678
1678static inline bool containsAlphaNum( const QString &str ) 1679static inline bool containsAlphaNum( const QString &str )
1679{ 1680{
1680 int i, 1681 int i,
1681 count = str.length(); 1682 count = str.length();
1682 for ( i = 0; i < count; i++ ) 1683 for ( i = 0; i < count; i++ )
1683 if ( !str[i].isSpace() ) 1684 if ( !str[i].isSpace() )
1684 return TRUE; 1685 return TRUE;
1685 return FALSE; 1686 return FALSE;
1686} 1687}
1687 1688
1688static inline bool constainsWhiteSpace( const QString &str ) 1689static inline bool constainsWhiteSpace( const QString &str )
1689{ 1690{
1690 int i, 1691 int i,
1691 count = str.length(); 1692 count = str.length();
1692 for (i = 0; i < count; i++ ) 1693 for (i = 0; i < count; i++ )
1693 if ( str[i].isSpace() ) 1694 if ( str[i].isSpace() )
1694 return TRUE; 1695 return TRUE;
1695 return FALSE; 1696 return FALSE;
1696} 1697}
1697 1698
1698void ContactEditor::setPersonalView( bool personal ) 1699void ContactEditor::setPersonalView( bool personal )
1699{ 1700{
1700 m_personalView = personal; 1701 m_personalView = personal;
1701 1702
1702 // Currently disbled due to the fact that 1703 // Currently disbled due to the fact that
1703 // show will not work... 1704 // show will not work...
1704 return; 1705 return;
1705 1706
1706 if ( personal ){ 1707 if ( personal ){
1707 cmbCat->hide(); 1708 cmbCat->hide();
1708 labCat->hide(); 1709 labCat->hide();
1709 1710
1710 } else{ 1711 } else{
1711 cmbCat->show(); 1712 cmbCat->show();
1712 labCat->show(); 1713 labCat->show();
1713 } 1714 }
1714} 1715}
1715 1716
1716void ContactEditor::slotAnniversaryDateChanged( int year, int month, int day) 1717void ContactEditor::slotAnniversaryDateChanged( int year, int month, int day)
1717{ 1718{
1718 QDate date; 1719 QDate date;
1719 date.setYMD( year, month, day ); 1720 date.setYMD( year, month, day );
1720 QString dateString = TimeString::numberDateString( date ); 1721 QString dateString = TimeString::numberDateString( date );
1721 anniversaryButton->setText( dateString ); 1722 anniversaryButton->setText( dateString );
1722 ent.setAnniversary ( date ); 1723 ent.setAnniversary ( date );
1723} 1724}
1724 1725
1725void ContactEditor::slotBirthdayDateChanged( int year, int month, int day) 1726void ContactEditor::slotBirthdayDateChanged( int year, int month, int day)
1726{ 1727{
1727 QDate date; 1728 QDate date;
1728 date.setYMD( year, month, day ); 1729 date.setYMD( year, month, day );
1729 QString dateString = TimeString::numberDateString( date ); 1730 QString dateString = TimeString::numberDateString( date );
1730 birthdayButton->setText( dateString ); 1731 birthdayButton->setText( dateString );
1731 ent.setBirthday ( date ); 1732 ent.setBirthday ( date );
1732} 1733}
1733 1734
1734void ContactEditor::slotRemoveBirthday() 1735void ContactEditor::slotRemoveBirthday()
1735{ 1736{
1736 qWarning("void ContactEditor::slotRemoveBirthday()"); 1737 qWarning("void ContactEditor::slotRemoveBirthday()");
1737 ent.setBirthday( QDate() ); 1738 ent.setBirthday( QDate() );
1738 updateDatePicker(); 1739 updateDatePicker();
1739} 1740}
1740 1741
1741void ContactEditor::slotRemoveAnniversary() 1742void ContactEditor::slotRemoveAnniversary()
1742{ 1743{
1743 qWarning("void ContactEditor::slotRemoveAnniversary()"); 1744 qWarning("void ContactEditor::slotRemoveAnniversary()");
1744 ent.setAnniversary( QDate() ); 1745 ent.setAnniversary( QDate() );
1745 updateDatePicker(); 1746 updateDatePicker();
1746} 1747}
diff --git a/core/pim/addressbook/contacteditor.h b/core/pim/addressbook/contacteditor.h
index 72d14a9..1b86e6f 100644
--- a/core/pim/addressbook/contacteditor.h
+++ b/core/pim/addressbook/contacteditor.h
@@ -1,166 +1,166 @@
1/* 1/*
2 * Copyright (c) 2002 Michael R. Crawford <mike@tuxnami.org> 2 * Copyright (c) 2002 Michael R. Crawford <mike@tuxnami.org>
3 * 3 *
4 * This file is an add-on for the OPIE Palmtop Environment 4 * This file is an add-on for the OPIE 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 pacakaging 8 * Foundation and appearing in the file LICENSE.GPL included in the pacakaging
9 * of this file. 9 * of this file.
10 * 10 *
11 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13 * 13 *
14 * 14 *
15 * This is a rewrite of the abeditor.h file, modified to provide a more 15 * This is a rewrite of the abeditor.h file, modified to provide a more
16 * intuitive interface to TrollTech's original Address Book editor. This 16 * intuitive interface to TrollTech's original Address Book editor. This
17 * is made to operate exactly in interface with the exception of name. 17 * is made to operate exactly in interface with the exception of name.
18 * 18 *
19 */ 19 */
20 20
21#ifndef CONTACTEDITOR_H 21#ifndef CONTACTEDITOR_H
22#define CONTACTEDITOR_H 22#define CONTACTEDITOR_H
23 23
24#include <opie/ocontact.h> 24#include <opie2/opimcontact.h>
25#include <opie/ocontactfields.h> 25#include <opie2/opimcontactfields.h>
26 26
27#include <qpe/datebookmonth.h> 27#include <qpe/datebookmonth.h>
28 28
29#include <qdialog.h> 29#include <qdialog.h>
30#include <qlist.h> 30#include <qlist.h>
31#include <qmap.h> 31#include <qmap.h>
32#include <qstringlist.h> 32#include <qstringlist.h>
33#include <qwidgetstack.h> 33#include <qwidgetstack.h>
34 34
35const int NAME_LF = 0; 35const int NAME_LF = 0;
36const int NAME_LFM = 1; 36const int NAME_LFM = 1;
37const int NAME_FL = 2; 37const int NAME_FL = 2;
38const int NAME_FML = 3; 38const int NAME_FML = 3;
39 39
40const int NAME_F = 4; 40const int NAME_F = 4;
41const int NAME_M = 5; 41const int NAME_M = 5;
42const int NAME_L = 6; 42const int NAME_L = 6;
43const int NAME_S = 7; 43const int NAME_S = 7;
44 44
45 45
46class QScrollView; 46class QScrollView;
47class QTabWidget; 47class QTabWidget;
48class QMultiLineEdit; 48class QMultiLineEdit;
49class QLineEdit; 49class QLineEdit;
50class QComboBox; 50class QComboBox;
51class QPushButton; 51class QPushButton;
52class CategorySelect; 52class CategorySelect;
53class QLabel; 53class QLabel;
54 54
55class ContactEditor : public QDialog { 55class ContactEditor : public QDialog {
56 Q_OBJECT 56 Q_OBJECT
57 57
58 public: 58 public:
59 ContactEditor(const OContact &entry, 59 ContactEditor(const Opie::OPimContact &entry,
60 QWidget *parent = 0, 60 QWidget *parent = 0,
61 const char *name = 0, 61 const char *name = 0,
62 WFlags fl = 0 ); 62 WFlags fl = 0 );
63 ~ContactEditor(); 63 ~ContactEditor();
64 void setNameFocus(); 64 void setNameFocus();
65 void setPersonalView( bool personal = true ); 65 void setPersonalView( bool personal = true );
66 OContact entry() const { return ent; } 66 Opie::OPimContact entry() const { return ent; }
67 67
68 public slots: 68 public slots:
69 void slotNote(); 69 void slotNote();
70 void slotName(); 70 void slotName();
71 void setEntry(const OContact &entry); 71 void setEntry(const Opie::OPimContact &entry);
72 72
73 protected slots: 73 protected slots:
74 void accept(); 74 void accept();
75 75
76 private: 76 private:
77 void init(); 77 void init();
78 void saveEntry(); 78 void saveEntry();
79 bool isEmpty(); 79 bool isEmpty();
80 void cleanupFields(); 80 void cleanupFields();
81 void updateDatePicker(); 81 void updateDatePicker();
82 QString parseName( QString fullName, int type ); 82 QString parseName( QString fullName, int type );
83 void chooserError( int index ); 83 void chooserError( int index );
84 private slots: 84 private slots:
85 void slotChooser1Change( const QString &textChanged ); 85 void slotChooser1Change( const QString &textChanged );
86 void slotChooser2Change( const QString &textChanged ); 86 void slotChooser2Change( const QString &textChanged );
87 void slotChooser3Change( const QString &textChanged ); 87 void slotChooser3Change( const QString &textChanged );
88 void slotChooser4Change( const QString &textChanged ); 88 void slotChooser4Change( const QString &textChanged );
89 void slotCmbChooser1Change( int index ); 89 void slotCmbChooser1Change( int index );
90 void slotCmbChooser2Change( int index ); 90 void slotCmbChooser2Change( int index );
91 void slotCmbChooser3Change( int index ); 91 void slotCmbChooser3Change( int index );
92 void slotCmbChooser4Change( int index ); 92 void slotCmbChooser4Change( int index );
93 void slotAddressTypeChange( int index ); 93 void slotAddressTypeChange( int index );
94 void slotAddressChange( const QString &textChanged ); 94 void slotAddressChange( const QString &textChanged );
95 void slotAddress2Change( const QString &textChanged ); 95 void slotAddress2Change( const QString &textChanged );
96 void slotPOBoxChange( const QString &textChanged ); 96 void slotPOBoxChange( const QString &textChanged );
97 void slotCityChange( const QString &textChanged ); 97 void slotCityChange( const QString &textChanged );
98 void slotStateChange( const QString &textChanged ); 98 void slotStateChange( const QString &textChanged );
99 void slotZipChange( const QString &textChanged ); 99 void slotZipChange( const QString &textChanged );
100 void slotCountryChange( const QString &textChanged ); 100 void slotCountryChange( const QString &textChanged );
101 void slotFullNameChange( const QString &textChanged ); 101 void slotFullNameChange( const QString &textChanged );
102 void slotSuffixChange( const QString &textChanged ); 102 void slotSuffixChange( const QString &textChanged );
103 void slotOrganizationChange( const QString &textChanged ); 103 void slotOrganizationChange( const QString &textChanged );
104 void slotAnniversaryDateChanged( int year, int month, int day); 104 void slotAnniversaryDateChanged( int year, int month, int day);
105 void slotBirthdayDateChanged( int year, int month, int day); 105 void slotBirthdayDateChanged( int year, int month, int day);
106 void slotRemoveBirthday(); 106 void slotRemoveBirthday();
107 void slotRemoveAnniversary(); 107 void slotRemoveAnniversary();
108 void defaultEmailChanged(int); 108 void defaultEmailChanged(int);
109 109
110 private: 110 private:
111 enum StackWidgets { TextField = 1, Combo }; 111 enum StackWidgets { TextField = 1, Combo };
112 int defaultEmailChooserPosition; 112 int defaultEmailChooserPosition;
113 void populateDefaultEmailCmb(); 113 void populateDefaultEmailCmb();
114 void chooserChange( const QString&, int , QLineEdit*, int ); 114 void chooserChange( const QString&, int , QLineEdit*, int );
115 bool cmbChooserChange( int , QWidgetStack*, int ); 115 bool cmbChooserChange( int , QWidgetStack*, int );
116 OContactFields contactfields; 116 Opie::OPimContactFields contactfields;
117 117
118 OContact ent; 118 Opie::OPimContact ent;
119 119
120 QDialog *dlgNote; 120 QDialog *dlgNote;
121 QDialog *dlgName; 121 QDialog *dlgName;
122 122
123 QList<QLineEdit> listValue; 123 QList<QLineEdit> listValue;
124 QList<QLabel> listName; 124 QList<QLabel> listName;
125 125
126 QStringList slDynamicEntries; 126 QStringList slDynamicEntries;
127 QStringList trlDynamicEntries; 127 QStringList trlDynamicEntries;
128 128
129 bool m_personalView; 129 bool m_personalView;
130 130
131 QStringList slHomeAddress; 131 QStringList slHomeAddress;
132 QStringList slBusinessAddress; 132 QStringList slBusinessAddress;
133 QStringList slChooserNames; 133 QStringList slChooserNames;
134 QStringList slChooserValues; 134 QStringList slChooserValues;
135 QStringList emails; 135 QStringList emails;
136 QString defaultEmail; 136 QString defaultEmail;
137 137
138 QMultiLineEdit *txtNote; 138 QMultiLineEdit *txtNote;
139 QLabel *lblNote; 139 QLabel *lblNote;
140 140
141 //QLineEdit *txtTitle; 141 //QLineEdit *txtTitle;
142 QLineEdit *txtFirstName; 142 QLineEdit *txtFirstName;
143 QLineEdit *txtMiddleName; 143 QLineEdit *txtMiddleName;
144 QLineEdit *txtLastName; 144 QLineEdit *txtLastName;
145 QLineEdit *txtSuffix; 145 QLineEdit *txtSuffix;
146 146
147 QTabWidget *tabMain; 147 QTabWidget *tabMain;
148 QScrollView *svGeneral; 148 QScrollView *svGeneral;
149 QPushButton *btnFullName; 149 QPushButton *btnFullName;
150 QPushButton *btnNote; 150 QPushButton *btnNote;
151 QLineEdit *txtFullName; 151 QLineEdit *txtFullName;
152 QLineEdit *txtJobTitle; 152 QLineEdit *txtJobTitle;
153 QLineEdit *txtOrganization; 153 QLineEdit *txtOrganization;
154 QLineEdit *txtChooserField1; 154 QLineEdit *txtChooserField1;
155 QLineEdit *txtChooserField2; 155 QLineEdit *txtChooserField2;
156 QLineEdit *txtChooserField3; 156 QLineEdit *txtChooserField3;
157 QLineEdit *txtChooserField4; 157 QLineEdit *txtChooserField4;
158 QWidgetStack* m_widgetStack1; 158 QWidgetStack* m_widgetStack1;
159 QWidgetStack* m_widgetStack2; 159 QWidgetStack* m_widgetStack2;
160 QWidgetStack* m_widgetStack3; 160 QWidgetStack* m_widgetStack3;
161 QWidgetStack* m_widgetStack4; 161 QWidgetStack* m_widgetStack4;
162 QComboBox *cmbChooserField1; 162 QComboBox *cmbChooserField1;
163 QComboBox *cmbChooserField2; 163 QComboBox *cmbChooserField2;
164 QComboBox *cmbChooserField3; 164 QComboBox *cmbChooserField3;
165 QComboBox *cmbChooserField4; 165 QComboBox *cmbChooserField4;
166 QComboBox *cmbDefaultEmail; 166 QComboBox *cmbDefaultEmail;
diff --git a/core/pim/addressbook/main.cpp b/core/pim/addressbook/main.cpp
index 47d370a..660fae6 100644
--- a/core/pim/addressbook/main.cpp
+++ b/core/pim/addressbook/main.cpp
@@ -1,27 +1,27 @@
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 "addressbook.h" 21#include "addressbook.h"
22 22
23 23
24#include <opie/oapplicationfactory.h> 24#include <opie2/oapplicationfactory.h>
25 25
26OPIE_EXPORT_APP( OApplicationFactory<AddressbookWindow> ) 26OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<AddressbookWindow> )
27 27
diff --git a/core/pim/addressbook/opie-addressbook.control b/core/pim/addressbook/opie-addressbook.control
index 2d30dc5..18a3791 100644
--- a/core/pim/addressbook/opie-addressbook.control
+++ b/core/pim/addressbook/opie-addressbook.control
@@ -1,11 +1,11 @@
1Package: opie-addressbook 1Package: opie-addressbook
2Files: plugins/application/libaddressbook.so* bin/addressbook apps/1Pim/addressbook.desktop 2Files: plugins/application/libaddressbook.so* bin/addressbook apps/1Pim/addressbook.desktop
3Priority: optional 3Priority: optional
4Section: opie/pim 4Section: opie/pim
5Conflicts: qpe-tkcaddressbook 5Conflicts: qpe-tkcaddressbook
6Maintainer: Stefan Eilers <eilers.stefan@epost.de> 6Maintainer: Stefan Eilers <eilers.stefan@epost.de>
7Architecture: arm 7Architecture: arm
8Depends: task-opie-minimal, libopie1, opie-pics 8Depends: task-opie-minimal, opie-pics, libopiecore2, libopieui2, libopiepim2, libopiedb2
9Description: Contacts 9Description: Contacts
10 A simple addressbook for the Opie environment. 10 A simple addressbook for the Opie environment.
11Version: $QPE_VERSION$EXTRAVERSION 11Version: $QPE_VERSION$EXTRAVERSION