author | tux_mike <tux_mike> | 2002-03-26 17:39:54 (UTC) |
---|---|---|
committer | tux_mike <tux_mike> | 2002-03-26 17:39:54 (UTC) |
commit | e91f77a9ebf359c0fbf4f8d1a0de50bf0dcf81d8 (patch) (unidiff) | |
tree | f3214c3c9dac147f43e127371e3f547f30c97dbf | |
parent | 7c55845eb070ce39eb0673be191130be64e96cfb (diff) | |
download | opie-e91f77a9ebf359c0fbf4f8d1a0de50bf0dcf81d8.zip opie-e91f77a9ebf359c0fbf4f8d1a0de50bf0dcf81d8.tar.gz opie-e91f77a9ebf359c0fbf4f8d1a0de50bf0dcf81d8.tar.bz2 |
Mike Crawford <mike@tuxnami.org>
Changed addressbook input screen to be a little more user friendly,
divided all the options into 3 tabs.
-rw-r--r-- | core/pim/addressbook/abeditor.cpp | 2 | ||||
-rw-r--r-- | core/pim/addressbook/addressbook.cpp | 8 | ||||
-rw-r--r-- | core/pim/addressbook/addressbook.h | 4 | ||||
-rw-r--r-- | core/pim/addressbook/addressbook.pro | 4 |
4 files changed, 9 insertions, 9 deletions
diff --git a/core/pim/addressbook/abeditor.cpp b/core/pim/addressbook/abeditor.cpp index 94baa71..6354db9 100644 --- a/core/pim/addressbook/abeditor.cpp +++ b/core/pim/addressbook/abeditor.cpp | |||
@@ -1,619 +1,619 @@ | |||
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 "abeditor.h" | 21 | #include "abeditor.h" |
22 | #include "addresspicker.h" | 22 | #include "addresspicker.h" |
23 | 23 | ||
24 | #include <qpe/categoryselect.h> | 24 | #include <qpe/categoryselect.h> |
25 | #include <qpe/qpeapplication.h> | 25 | #include <qpe/qpeapplication.h> |
26 | #include <qpe/qpedialog.h> | 26 | #include <qpe/qpedialog.h> |
27 | 27 | ||
28 | #include <qcombobox.h> | 28 | #include <qcombobox.h> |
29 | #include <qlabel.h> | 29 | #include <qlabel.h> |
30 | #include <qlayout.h> | 30 | #include <qlayout.h> |
31 | #include <qlineedit.h> | 31 | #include <qlineedit.h> |
32 | #include <qmultilineedit.h> | 32 | #include <qmultilineedit.h> |
33 | #include <qscrollview.h> | 33 | #include <qscrollview.h> |
34 | #include <qtoolbutton.h> | 34 | #include <qtoolbutton.h> |
35 | #include <qpushbutton.h> | 35 | #include <qpushbutton.h> |
36 | #include <qmainwindow.h> | 36 | #include <qmainwindow.h> |
37 | 37 | ||
38 | 38 | ||
39 | static inline bool containsAlphaNum( const QString &str ); | 39 | static inline bool containsAlphaNum( const QString &str ); |
40 | static inline bool constainsWhiteSpace( const QString &str ); | 40 | static inline bool constainsWhiteSpace( const QString &str ); |
41 | 41 | ||
42 | 42 | ||
43 | // helper functions, convert our comma delimited list to proper | 43 | // helper functions, convert our comma delimited list to proper |
44 | // file format... | 44 | // file format... |
45 | void parseEmailFrom( const QString &txt, QString &strDefaultEmail, | 45 | void parseEmailFrom( const QString &txt, QString &strDefaultEmail, |
46 | QString &strAll ); | 46 | QString &strAll ); |
47 | 47 | ||
48 | // helper convert from file format to comma delimited... | 48 | // helper convert from file format to comma delimited... |
49 | void parseEmailTo( const QString &strDefaultEmail, | 49 | void parseEmailTo( const QString &strDefaultEmail, |
50 | const QString &strOtherEmail, QString &strBack ); | 50 | const QString &strOtherEmail, QString &strBack ); |
51 | 51 | ||
52 | 52 | ||
53 | 53 | ||
54 | AbEditor::AbEditor( const Contact &entry, const QValueList<int> *newOrdered, | 54 | AbEditor::AbEditor( const Contact &entry, const QValueList<int> *newOrdered, |
55 | QStringList *slNewOrdered, | 55 | QStringList *slNewOrdered, |
56 | QWidget *parent, const char *name, WFlags fl ) | 56 | QWidget *parent = 0, const char *name = 0, WFlags fl = 0 ) |
57 | : QDialog( parent, name, TRUE, fl ), | 57 | : QDialog( parent, name, TRUE, fl ), |
58 | orderedValues( newOrdered ), | 58 | orderedValues( newOrdered ), |
59 | slOrdered( slNewOrdered ) | 59 | slOrdered( slNewOrdered ) |
60 | { | 60 | { |
61 | init(); | 61 | init(); |
62 | initMap(); | 62 | initMap(); |
63 | setEntry( entry ); | 63 | setEntry( entry ); |
64 | } | 64 | } |
65 | 65 | ||
66 | AbEditor::~AbEditor() | 66 | AbEditor::~AbEditor() |
67 | { | 67 | { |
68 | } | 68 | } |
69 | 69 | ||
70 | void AbEditor::init() | 70 | void AbEditor::init() |
71 | { | 71 | { |
72 | middleEdit = 0; | 72 | middleEdit = 0; |
73 | QVBoxLayout *vb = new QVBoxLayout( this ); | 73 | QVBoxLayout *vb = new QVBoxLayout( this ); |
74 | svPage = new QScrollView( this ); | 74 | svPage = new QScrollView( this ); |
75 | svPage->setHScrollBarMode( QScrollView::AlwaysOff ); | 75 | svPage->setHScrollBarMode( QScrollView::AlwaysOff ); |
76 | vb->addWidget( svPage ); | 76 | vb->addWidget( svPage ); |
77 | svPage->setResizePolicy( QScrollView::AutoOneFit ); | 77 | svPage->setResizePolicy( QScrollView::AutoOneFit ); |
78 | svPage->setFrameStyle( QFrame::NoFrame ); | 78 | svPage->setFrameStyle( QFrame::NoFrame ); |
79 | 79 | ||
80 | QWidget *container = new QWidget( svPage->viewport() ); | 80 | QWidget *container = new QWidget( svPage->viewport() ); |
81 | svPage->addChild( container ); | 81 | svPage->addChild( container ); |
82 | 82 | ||
83 | QGridLayout *gl = new QGridLayout( container, 20, 2, 4, 2 ); | 83 | QGridLayout *gl = new QGridLayout( container, 20, 2, 4, 2 ); |
84 | 84 | ||
85 | QLabel *l = new QLabel( tr("First Name"), container ); | 85 | QLabel *l = new QLabel( tr("First Name"), container ); |
86 | gl->addWidget( l, 0, 0 ); | 86 | gl->addWidget( l, 0, 0 ); |
87 | firstEdit = new QLineEdit( container ); | 87 | firstEdit = new QLineEdit( container ); |
88 | gl->addWidget( firstEdit, 0, 1 ); | 88 | gl->addWidget( firstEdit, 0, 1 ); |
89 | 89 | ||
90 | l = new QLabel( tr("Last Name"), container ); | 90 | l = new QLabel( tr("Last Name"), container ); |
91 | gl->addWidget( l, 1, 0 ); | 91 | gl->addWidget( l, 1, 0 ); |
92 | lastEdit = new QLineEdit( container ); | 92 | lastEdit = new QLineEdit( container ); |
93 | gl->addWidget( lastEdit, 1, 1 ); | 93 | gl->addWidget( lastEdit, 1, 1 ); |
94 | 94 | ||
95 | l = new QLabel( tr("Categories"), container ); | 95 | l = new QLabel( tr("Categories"), container ); |
96 | gl->addWidget( l, 2, 0 ); | 96 | gl->addWidget( l, 2, 0 ); |
97 | 97 | ||
98 | cmbCat = new CategorySelect( container ); | 98 | cmbCat = new CategorySelect( container ); |
99 | gl->addWidget( cmbCat, 2, 1 ); | 99 | gl->addWidget( cmbCat, 2, 1 ); |
100 | 100 | ||
101 | int i; | 101 | int i; |
102 | bool foundGender, | 102 | bool foundGender, |
103 | foundNotes; | 103 | foundNotes; |
104 | foundGender = foundNotes = false; | 104 | foundGender = foundNotes = false; |
105 | QStringList::ConstIterator it = slOrdered->begin(); | 105 | QStringList::ConstIterator it = slOrdered->begin(); |
106 | for ( i = 0; it != slOrdered->end(); i++, ++it ) { | 106 | for ( i = 0; it != slOrdered->end(); i++, ++it ) { |
107 | if ( !foundGender && *it == tr("Gender") ) { | 107 | if ( !foundGender && *it == tr("Gender") ) { |
108 | foundGender = true; | 108 | foundGender = true; |
109 | } else if ( !foundNotes && *it == tr("Notes") ) { | 109 | } else if ( !foundNotes && *it == tr("Notes") ) { |
110 | foundNotes = true; | 110 | foundNotes = true; |
111 | } else { | 111 | } else { |
112 | l = new QLabel( *it, container ); | 112 | l = new QLabel( *it, container ); |
113 | listName.append( l ); | 113 | listName.append( l ); |
114 | gl->addWidget( l, i + 3, 0 ); | 114 | gl->addWidget( l, i + 3, 0 ); |
115 | QLineEdit *e = new QLineEdit( container ); | 115 | QLineEdit *e = new QLineEdit( container ); |
116 | listValue.append( e ); | 116 | listValue.append( e ); |
117 | gl->addWidget( e, i + 3, 1 ); | 117 | gl->addWidget( e, i + 3, 1 ); |
118 | if ( *it == tr( "Middle Name" ) ) | 118 | if ( *it == tr( "Middle Name" ) ) |
119 | middleEdit = e; | 119 | middleEdit = e; |
120 | } | 120 | } |
121 | } | 121 | } |
122 | l = new QLabel( tr("Gender"), container ); | 122 | l = new QLabel( tr("Gender"), container ); |
123 | gl->addWidget( l, slOrdered->count() + 3, 0 ); | 123 | gl->addWidget( l, slOrdered->count() + 3, 0 ); |
124 | genderCombo = new QComboBox( container ); | 124 | genderCombo = new QComboBox( container ); |
125 | genderCombo->insertItem( "", 0 ); | 125 | genderCombo->insertItem( "", 0 ); |
126 | genderCombo->insertItem( tr( "Male" ), 1 ); | 126 | genderCombo->insertItem( tr( "Male" ), 1 ); |
127 | genderCombo->insertItem( tr( "Female" ), 2 ); | 127 | genderCombo->insertItem( tr( "Female" ), 2 ); |
128 | gl->addWidget( genderCombo, slOrdered->count() + 3, 1 ); | 128 | gl->addWidget( genderCombo, slOrdered->count() + 3, 1 ); |
129 | 129 | ||
130 | dlgNote = new QDialog( this, "Note Dialog", TRUE ); | 130 | dlgNote = new QDialog( this, "Note Dialog", TRUE ); |
131 | dlgNote->setCaption( tr("Enter Note") ); | 131 | dlgNote->setCaption( tr("Enter Note") ); |
132 | QVBoxLayout *vbNote = new QVBoxLayout( dlgNote ); | 132 | QVBoxLayout *vbNote = new QVBoxLayout( dlgNote ); |
133 | // lblNote = new QLabel( dlgNote ); | 133 | // lblNote = new QLabel( dlgNote ); |
134 | // lblNote->setMinimumSize( lblNote->sizeHint() + QSize( 0, 4 ) ); | 134 | // lblNote->setMinimumSize( lblNote->sizeHint() + QSize( 0, 4 ) ); |
135 | // vbNote->addWidget( lblNote ); | 135 | // vbNote->addWidget( lblNote ); |
136 | txtNote = new QMultiLineEdit( dlgNote ); | 136 | txtNote = new QMultiLineEdit( dlgNote ); |
137 | vbNote->addWidget( txtNote ); | 137 | vbNote->addWidget( txtNote ); |
138 | 138 | ||
139 | QHBoxLayout *hb = new QHBoxLayout( vb ); | 139 | QHBoxLayout *hb = new QHBoxLayout( vb ); |
140 | hb->addStretch( 2 ); | 140 | hb->addStretch( 2 ); |
141 | QPushButton *pb = new QPushButton( tr("Notes..."), this ); | 141 | QPushButton *pb = new QPushButton( tr("Notes..."), this ); |
142 | hb->addWidget( pb ); | 142 | hb->addWidget( pb ); |
143 | connect( pb, SIGNAL(clicked()), this, SLOT(slotNote()) ); | 143 | connect( pb, SIGNAL(clicked()), this, SLOT(slotNote()) ); |
144 | 144 | ||
145 | new QPEDialogListener(this); | 145 | new QPEDialogListener(this); |
146 | } | 146 | } |
147 | 147 | ||
148 | void AbEditor::initMap() | 148 | void AbEditor::initMap() |
149 | { | 149 | { |
150 | /* | 150 | /* |
151 | // since the fields and the XML fields exist, create a map | 151 | // since the fields and the XML fields exist, create a map |
152 | // between them... | 152 | // between them... |
153 | Config cfg1( "AddressBook" ); | 153 | Config cfg1( "AddressBook" ); |
154 | Config cfg2( "AddressBook" ); | 154 | Config cfg2( "AddressBook" ); |
155 | QString strCfg1, | 155 | QString strCfg1, |
156 | strCfg2; | 156 | strCfg2; |
157 | int i; | 157 | int i; |
158 | 158 | ||
159 | // This stuff better exist... | 159 | // This stuff better exist... |
160 | cfg1.setGroup( "AddressFields" ); | 160 | cfg1.setGroup( "AddressFields" ); |
161 | cfg2.setGroup( "XMLFields" ); | 161 | cfg2.setGroup( "XMLFields" ); |
162 | i = 0; | 162 | i = 0; |
163 | strCfg1 = cfg1.readEntry( "Field" + QString::number(i), QString::null ); | 163 | strCfg1 = cfg1.readEntry( "Field" + QString::number(i), QString::null ); |
164 | strCfg2 = cfg2.readEntry( "XMLField" + QString::number(i++), | 164 | strCfg2 = cfg2.readEntry( "XMLField" + QString::number(i++), |
165 | QString::null ); | 165 | QString::null ); |
166 | while ( !strCfg1.isNull() && !strCfg2.isNull() ) { | 166 | while ( !strCfg1.isNull() && !strCfg2.isNull() ) { |
167 | mapField.insert( strCfg1, strCfg2 ); | 167 | mapField.insert( strCfg1, strCfg2 ); |
168 | strCfg1 = cfg1.readEntry( "Field" + QString::number(i), | 168 | strCfg1 = cfg1.readEntry( "Field" + QString::number(i), |
169 | QString::null ); | 169 | QString::null ); |
170 | strCfg2 = cfg2.readEntry( "XMLField" + QString::number(i++), | 170 | strCfg2 = cfg2.readEntry( "XMLField" + QString::number(i++), |
171 | QString::null ); | 171 | QString::null ); |
172 | } | 172 | } |
173 | */ | 173 | */ |
174 | } | 174 | } |
175 | 175 | ||
176 | void AbEditor::loadFields() | 176 | void AbEditor::loadFields() |
177 | { | 177 | { |
178 | QStringList::ConstIterator it; | 178 | QStringList::ConstIterator it; |
179 | QListIterator<QLabel> lit( listName ); | 179 | QListIterator<QLabel> lit( listName ); |
180 | for ( it = slOrdered->begin(); *lit; ++lit, ++it ) { | 180 | for ( it = slOrdered->begin(); *lit; ++lit, ++it ) { |
181 | (*lit)->setText( *it ); | 181 | (*lit)->setText( *it ); |
182 | } | 182 | } |
183 | } | 183 | } |
184 | 184 | ||
185 | void AbEditor::setEntry( const Contact &entry ) | 185 | void AbEditor::setEntry( const Contact &entry ) |
186 | { | 186 | { |
187 | ent = entry; | 187 | ent = entry; |
188 | QListIterator<QLineEdit> it( listValue ); | 188 | QListIterator<QLineEdit> it( listValue ); |
189 | firstEdit->setText( ent.firstName() ); | 189 | firstEdit->setText( ent.firstName() ); |
190 | lastEdit->setText( ent.lastName() ); | 190 | lastEdit->setText( ent.lastName() ); |
191 | cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") ); | 191 | cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") ); |
192 | 192 | ||
193 | // ### Fix... | 193 | // ### Fix... |
194 | QValueList<int>::ConstIterator itVl; | 194 | QValueList<int>::ConstIterator itVl; |
195 | for ( itVl = orderedValues->begin(); *it && itVl != orderedValues->end(); | 195 | for ( itVl = orderedValues->begin(); *it && itVl != orderedValues->end(); |
196 | ++itVl, ++it ) { | 196 | ++itVl, ++it ) { |
197 | switch( *itVl ) { | 197 | switch( *itVl ) { |
198 | case Qtopia::Title: | 198 | case Qtopia::Title: |
199 | (*it)->setText(ent.title()); | 199 | (*it)->setText(ent.title()); |
200 | break; | 200 | break; |
201 | case Qtopia::MiddleName: | 201 | case Qtopia::MiddleName: |
202 | (*it)->setText( ent.middleName() ); | 202 | (*it)->setText( ent.middleName() ); |
203 | break; | 203 | break; |
204 | case Qtopia::Suffix: | 204 | case Qtopia::Suffix: |
205 | (*it)->setText( ent.suffix() ); | 205 | (*it)->setText( ent.suffix() ); |
206 | break; | 206 | break; |
207 | 207 | ||
208 | 208 | ||
209 | case Qtopia::DefaultEmail: | 209 | case Qtopia::DefaultEmail: |
210 | case Qtopia::Emails: | 210 | case Qtopia::Emails: |
211 | { | 211 | { |
212 | QString strDefEmail = ent.defaultEmail(); | 212 | QString strDefEmail = ent.defaultEmail(); |
213 | QString strAllEmail = ent.emails(); | 213 | QString strAllEmail = ent.emails(); |
214 | QString strFinal; | 214 | QString strFinal; |
215 | parseEmailTo( strDefEmail, strAllEmail, strFinal ); | 215 | parseEmailTo( strDefEmail, strAllEmail, strFinal ); |
216 | (*it)->setText( strFinal ); | 216 | (*it)->setText( strFinal ); |
217 | // make sure we see the "default" | 217 | // make sure we see the "default" |
218 | (*it)->home( false ); | 218 | (*it)->home( false ); |
219 | break; | 219 | break; |
220 | } | 220 | } |
221 | 221 | ||
222 | // home | 222 | // home |
223 | case Qtopia::HomeStreet: | 223 | case Qtopia::HomeStreet: |
224 | (*it)->setText(ent.homeStreet() ); | 224 | (*it)->setText(ent.homeStreet() ); |
225 | break; | 225 | break; |
226 | case Qtopia::HomeCity: | 226 | case Qtopia::HomeCity: |
227 | (*it)->setText( ent.homeCity() ); | 227 | (*it)->setText( ent.homeCity() ); |
228 | break; | 228 | break; |
229 | case Qtopia::HomeState: | 229 | case Qtopia::HomeState: |
230 | (*it)->setText( ent.homeState() ); | 230 | (*it)->setText( ent.homeState() ); |
231 | break; | 231 | break; |
232 | case Qtopia::HomeZip: | 232 | case Qtopia::HomeZip: |
233 | (*it)->setText( ent.homeZip() ); | 233 | (*it)->setText( ent.homeZip() ); |
234 | break; | 234 | break; |
235 | case Qtopia::HomeCountry: | 235 | case Qtopia::HomeCountry: |
236 | (*it)->setText( ent.homeCountry() ); | 236 | (*it)->setText( ent.homeCountry() ); |
237 | break; | 237 | break; |
238 | case Qtopia::HomePhone: | 238 | case Qtopia::HomePhone: |
239 | (*it)->setText( ent.homePhone() ); | 239 | (*it)->setText( ent.homePhone() ); |
240 | break; | 240 | break; |
241 | case Qtopia::HomeFax: | 241 | case Qtopia::HomeFax: |
242 | (*it)->setText( ent.homeFax() ); | 242 | (*it)->setText( ent.homeFax() ); |
243 | break; | 243 | break; |
244 | case Qtopia::HomeMobile: | 244 | case Qtopia::HomeMobile: |
245 | (*it)->setText( ent.homeMobile() ); | 245 | (*it)->setText( ent.homeMobile() ); |
246 | break; | 246 | break; |
247 | case Qtopia::HomeWebPage: | 247 | case Qtopia::HomeWebPage: |
248 | (*it)->setText( ent.homeWebpage() ); | 248 | (*it)->setText( ent.homeWebpage() ); |
249 | break; | 249 | break; |
250 | 250 | ||
251 | // business | 251 | // business |
252 | case Qtopia::Company: | 252 | case Qtopia::Company: |
253 | (*it)->setText( ent.company() ); | 253 | (*it)->setText( ent.company() ); |
254 | break; | 254 | break; |
255 | case Qtopia::BusinessStreet: | 255 | case Qtopia::BusinessStreet: |
256 | (*it)->setText( ent.businessStreet() ); | 256 | (*it)->setText( ent.businessStreet() ); |
257 | break; | 257 | break; |
258 | case Qtopia::BusinessCity: | 258 | case Qtopia::BusinessCity: |
259 | (*it)->setText( ent.businessCity() ); | 259 | (*it)->setText( ent.businessCity() ); |
260 | break; | 260 | break; |
261 | case Qtopia::BusinessState: | 261 | case Qtopia::BusinessState: |
262 | (*it)->setText( ent.businessState() ); | 262 | (*it)->setText( ent.businessState() ); |
263 | break; | 263 | break; |
264 | case Qtopia::BusinessZip: | 264 | case Qtopia::BusinessZip: |
265 | (*it)->setText( ent.businessZip() ); | 265 | (*it)->setText( ent.businessZip() ); |
266 | break; | 266 | break; |
267 | case Qtopia::BusinessCountry: | 267 | case Qtopia::BusinessCountry: |
268 | (*it)->setText( ent.businessCountry() ); | 268 | (*it)->setText( ent.businessCountry() ); |
269 | break; | 269 | break; |
270 | case Qtopia::BusinessWebPage: | 270 | case Qtopia::BusinessWebPage: |
271 | (*it)->setText( ent.businessWebpage() ); | 271 | (*it)->setText( ent.businessWebpage() ); |
272 | break; | 272 | break; |
273 | case Qtopia::JobTitle: | 273 | case Qtopia::JobTitle: |
274 | (*it)->setText( ent.jobTitle() ); | 274 | (*it)->setText( ent.jobTitle() ); |
275 | break; | 275 | break; |
276 | case Qtopia::Department: | 276 | case Qtopia::Department: |
277 | (*it)->setText( ent.department() ); | 277 | (*it)->setText( ent.department() ); |
278 | break; | 278 | break; |
279 | case Qtopia::Office: | 279 | case Qtopia::Office: |
280 | (*it)->setText( ent.office() ); | 280 | (*it)->setText( ent.office() ); |
281 | break; | 281 | break; |
282 | case Qtopia::BusinessPhone: | 282 | case Qtopia::BusinessPhone: |
283 | (*it)->setText( ent.businessPhone() ); | 283 | (*it)->setText( ent.businessPhone() ); |
284 | break; | 284 | break; |
285 | case Qtopia::BusinessFax: | 285 | case Qtopia::BusinessFax: |
286 | (*it)->setText( ent.businessFax() ); | 286 | (*it)->setText( ent.businessFax() ); |
287 | break; | 287 | break; |
288 | case Qtopia::BusinessMobile: | 288 | case Qtopia::BusinessMobile: |
289 | (*it)->setText( ent.businessMobile() ); | 289 | (*it)->setText( ent.businessMobile() ); |
290 | break; | 290 | break; |
291 | case Qtopia::BusinessPager: | 291 | case Qtopia::BusinessPager: |
292 | (*it)->setText( ent.businessPager() ); | 292 | (*it)->setText( ent.businessPager() ); |
293 | break; | 293 | break; |
294 | case Qtopia::Profession: | 294 | case Qtopia::Profession: |
295 | (*it)->setText( ent.profession() ); | 295 | (*it)->setText( ent.profession() ); |
296 | break; | 296 | break; |
297 | case Qtopia::Assistant: | 297 | case Qtopia::Assistant: |
298 | (*it)->setText( ent.assistant() ); | 298 | (*it)->setText( ent.assistant() ); |
299 | break; | 299 | break; |
300 | case Qtopia::Manager: | 300 | case Qtopia::Manager: |
301 | (*it)->setText( ent.manager() ); | 301 | (*it)->setText( ent.manager() ); |
302 | break; | 302 | break; |
303 | 303 | ||
304 | // personal | 304 | // personal |
305 | case Qtopia::Spouse: | 305 | case Qtopia::Spouse: |
306 | (*it)->setText( ent.spouse() ); | 306 | (*it)->setText( ent.spouse() ); |
307 | break; | 307 | break; |
308 | case Qtopia::Children: | 308 | case Qtopia::Children: |
309 | (*it)->setText( ent.children() ); | 309 | (*it)->setText( ent.children() ); |
310 | break; | 310 | break; |
311 | case Qtopia::Birthday: | 311 | case Qtopia::Birthday: |
312 | (*it)->setText( ent.birthday() ); | 312 | (*it)->setText( ent.birthday() ); |
313 | break; | 313 | break; |
314 | case Qtopia::Anniversary: | 314 | case Qtopia::Anniversary: |
315 | (*it)->setText( ent.anniversary() ); | 315 | (*it)->setText( ent.anniversary() ); |
316 | break; | 316 | break; |
317 | case Qtopia::Nickname: | 317 | case Qtopia::Nickname: |
318 | (*it)->setText( ent.nickname() ); | 318 | (*it)->setText( ent.nickname() ); |
319 | break; | 319 | break; |
320 | 320 | ||
321 | } | 321 | } |
322 | } | 322 | } |
323 | 323 | ||
324 | QString gender = ent.gender(); | 324 | QString gender = ent.gender(); |
325 | genderCombo->setCurrentItem( gender.toInt() ); | 325 | genderCombo->setCurrentItem( gender.toInt() ); |
326 | 326 | ||
327 | txtNote->setText( ent.notes() ); | 327 | txtNote->setText( ent.notes() ); |
328 | } | 328 | } |
329 | 329 | ||
330 | void AbEditor::accept() | 330 | void AbEditor::accept() |
331 | { | 331 | { |
332 | if ( isEmpty() ) | 332 | if ( isEmpty() ) |
333 | reject(); | 333 | reject(); |
334 | else { | 334 | else { |
335 | saveEntry(); | 335 | saveEntry(); |
336 | QDialog::accept(); | 336 | QDialog::accept(); |
337 | } | 337 | } |
338 | } | 338 | } |
339 | 339 | ||
340 | bool AbEditor::isEmpty() | 340 | bool AbEditor::isEmpty() |
341 | { | 341 | { |
342 | // analyze all the fields and make sure there is _something_ there | 342 | // analyze all the fields and make sure there is _something_ there |
343 | // that warrants saving... | 343 | // that warrants saving... |
344 | QString t = firstEdit->text(); | 344 | QString t = firstEdit->text(); |
345 | if ( !t.isEmpty() && containsAlphaNum( t ) ) | 345 | if ( !t.isEmpty() && containsAlphaNum( t ) ) |
346 | return false; | 346 | return false; |
347 | 347 | ||
348 | t = lastEdit->text(); | 348 | t = lastEdit->text(); |
349 | if ( !t.isEmpty() && containsAlphaNum( t ) ) | 349 | if ( !t.isEmpty() && containsAlphaNum( t ) ) |
350 | return false; | 350 | return false; |
351 | 351 | ||
352 | QListIterator<QLineEdit> it( listValue ); | 352 | QListIterator<QLineEdit> it( listValue ); |
353 | for ( ; it.current(); ++it ) { | 353 | for ( ; it.current(); ++it ) { |
354 | t = it.current()->text(); | 354 | t = it.current()->text(); |
355 | if ( !t.isEmpty() && containsAlphaNum( t ) ) | 355 | if ( !t.isEmpty() && containsAlphaNum( t ) ) |
356 | return false; | 356 | return false; |
357 | } | 357 | } |
358 | 358 | ||
359 | t = txtNote->text(); | 359 | t = txtNote->text(); |
360 | if ( !t.isEmpty() && containsAlphaNum( t ) ) | 360 | if ( !t.isEmpty() && containsAlphaNum( t ) ) |
361 | return false; | 361 | return false; |
362 | 362 | ||
363 | return true; | 363 | return true; |
364 | } | 364 | } |
365 | 365 | ||
366 | void AbEditor::saveEntry() | 366 | void AbEditor::saveEntry() |
367 | { | 367 | { |
368 | QString strDefaultEmail, strOtherEmail; | 368 | QString strDefaultEmail, strOtherEmail; |
369 | 369 | ||
370 | // determine if there has been a change in names | 370 | // determine if there has been a change in names |
371 | if ( ent.firstName() != firstEdit->text() || | 371 | if ( ent.firstName() != firstEdit->text() || |
372 | ent.lastName() != lastEdit->text() | 372 | ent.lastName() != lastEdit->text() |
373 | || (middleEdit && ent.middleName() != middleEdit->text()) ) { | 373 | || (middleEdit && ent.middleName() != middleEdit->text()) ) { |
374 | // set the names | 374 | // set the names |
375 | ent.setFirstName( firstEdit->text() ); | 375 | ent.setFirstName( firstEdit->text() ); |
376 | ent.setLastName( lastEdit->text() ); | 376 | ent.setLastName( lastEdit->text() ); |
377 | if ( middleEdit ) | 377 | if ( middleEdit ) |
378 | ent.setMiddleName( middleEdit->text() ); | 378 | ent.setMiddleName( middleEdit->text() ); |
379 | ent.setFileAs(); | 379 | ent.setFileAs(); |
380 | } | 380 | } |
381 | 381 | ||
382 | ent.setCategories( cmbCat->currentCategories() ); | 382 | ent.setCategories( cmbCat->currentCategories() ); |
383 | 383 | ||
384 | QListIterator<QLineEdit> it( listValue ); | 384 | QListIterator<QLineEdit> it( listValue ); |
385 | int i; | 385 | int i; |
386 | QValueList<int>::ConstIterator<int> vlIt; | 386 | QValueList<int>::ConstIterator<int> vlIt; |
387 | for ( i = 0, vlIt = orderedValues->begin(); | 387 | for ( i = 0, vlIt = orderedValues->begin(); |
388 | it.current(); ++it, ++vlIt, i++ ) { | 388 | it.current(); ++it, ++vlIt, i++ ) { |
389 | switch( *vlIt ) { | 389 | switch( *vlIt ) { |
390 | case Qtopia::Title: | 390 | case Qtopia::Title: |
391 | ent.setTitle( it.current()->text() ); | 391 | ent.setTitle( it.current()->text() ); |
392 | break; | 392 | break; |
393 | case Qtopia::MiddleName: | 393 | case Qtopia::MiddleName: |
394 | ent.setMiddleName( it.current()->text() ); | 394 | ent.setMiddleName( it.current()->text() ); |
395 | break; | 395 | break; |
396 | case Qtopia::Suffix: | 396 | case Qtopia::Suffix: |
397 | ent.setSuffix( it.current()->text() ); | 397 | ent.setSuffix( it.current()->text() ); |
398 | break; | 398 | break; |
399 | // case Qtopia::Category: | 399 | // case Qtopia::Category: |
400 | // { | 400 | // { |
401 | // // QStringList slCat = QStringList::split( ";", value ); | 401 | // // QStringList slCat = QStringList::split( ";", value ); |
402 | // // QValueList<int> cat; | 402 | // // QValueList<int> cat; |
403 | // // for ( QStringList::ConstIterator it = slCat.begin(); | 403 | // // for ( QStringList::ConstIterator it = slCat.begin(); |
404 | // // it != slCat.end(); ++it ) | 404 | // // it != slCat.end(); ++it ) |
405 | // // cat.append( (*it).toInt() ); | 405 | // // cat.append( (*it).toInt() ); |
406 | // // ent.setCategories( cat ); | 406 | // // ent.setCategories( cat ); |
407 | // } | 407 | // } |
408 | // break; | 408 | // break; |
409 | 409 | ||
410 | 410 | ||
411 | case Qtopia::DefaultEmail: | 411 | case Qtopia::DefaultEmail: |
412 | case Qtopia::Emails: | 412 | case Qtopia::Emails: |
413 | parseEmailFrom( it.current()->text(), strDefaultEmail, | 413 | parseEmailFrom( it.current()->text(), strDefaultEmail, |
414 | strOtherEmail ); | 414 | strOtherEmail ); |
415 | ent.setDefaultEmail( strDefaultEmail ); | 415 | ent.setDefaultEmail( strDefaultEmail ); |
416 | ent.setEmails( strOtherEmail ); | 416 | ent.setEmails( strOtherEmail ); |
417 | break; | 417 | break; |
418 | 418 | ||
419 | // home | 419 | // home |
420 | case Qtopia::HomeStreet: | 420 | case Qtopia::HomeStreet: |
421 | ent.setHomeStreet( it.current()->text() ); | 421 | ent.setHomeStreet( it.current()->text() ); |
422 | break; | 422 | break; |
423 | case Qtopia::HomeCity: | 423 | case Qtopia::HomeCity: |
424 | ent.setHomeCity( it.current()->text() ); | 424 | ent.setHomeCity( it.current()->text() ); |
425 | break; | 425 | break; |
426 | case Qtopia::HomeState: | 426 | case Qtopia::HomeState: |
427 | ent.setHomeState( it.current()->text() ); | 427 | ent.setHomeState( it.current()->text() ); |
428 | break; | 428 | break; |
429 | case Qtopia::HomeZip: | 429 | case Qtopia::HomeZip: |
430 | ent.setHomeZip( it.current()->text() ); | 430 | ent.setHomeZip( it.current()->text() ); |
431 | break; | 431 | break; |
432 | case Qtopia::HomeCountry: | 432 | case Qtopia::HomeCountry: |
433 | ent.setHomeCountry( it.current()->text() ); | 433 | ent.setHomeCountry( it.current()->text() ); |
434 | break; | 434 | break; |
435 | case Qtopia::HomePhone: | 435 | case Qtopia::HomePhone: |
436 | ent.setHomePhone( it.current()->text() ); | 436 | ent.setHomePhone( it.current()->text() ); |
437 | break; | 437 | break; |
438 | case Qtopia::HomeFax: | 438 | case Qtopia::HomeFax: |
439 | ent.setHomeFax( it.current()->text() ); | 439 | ent.setHomeFax( it.current()->text() ); |
440 | break; | 440 | break; |
441 | case Qtopia::HomeMobile: | 441 | case Qtopia::HomeMobile: |
442 | ent.setHomeMobile( it.current()->text() ); | 442 | ent.setHomeMobile( it.current()->text() ); |
443 | break; | 443 | break; |
444 | case Qtopia::HomeWebPage: | 444 | case Qtopia::HomeWebPage: |
445 | ent.setHomeWebpage( it.current()->text() ); | 445 | ent.setHomeWebpage( it.current()->text() ); |
446 | break; | 446 | break; |
447 | 447 | ||
448 | // business | 448 | // business |
449 | case Qtopia::Company: | 449 | case Qtopia::Company: |
450 | ent.setCompany( it.current()->text() ); | 450 | ent.setCompany( it.current()->text() ); |
451 | break; | 451 | break; |
452 | case Qtopia::BusinessStreet: | 452 | case Qtopia::BusinessStreet: |
453 | ent.setBusinessStreet( it.current()->text() ); | 453 | ent.setBusinessStreet( it.current()->text() ); |
454 | break; | 454 | break; |
455 | case Qtopia::BusinessCity: | 455 | case Qtopia::BusinessCity: |
456 | ent.setBusinessCity( it.current()->text() ); | 456 | ent.setBusinessCity( it.current()->text() ); |
457 | break; | 457 | break; |
458 | case Qtopia::BusinessState: | 458 | case Qtopia::BusinessState: |
459 | ent.setBusinessState( it.current()->text() ); | 459 | ent.setBusinessState( it.current()->text() ); |
460 | break; | 460 | break; |
461 | case Qtopia::BusinessZip: | 461 | case Qtopia::BusinessZip: |
462 | ent.setBusinessZip( it.current()->text() ); | 462 | ent.setBusinessZip( it.current()->text() ); |
463 | break; | 463 | break; |
464 | case Qtopia::BusinessCountry: | 464 | case Qtopia::BusinessCountry: |
465 | ent.setBusinessCountry( it.current()->text() ); | 465 | ent.setBusinessCountry( it.current()->text() ); |
466 | break; | 466 | break; |
467 | case Qtopia::BusinessWebPage: | 467 | case Qtopia::BusinessWebPage: |
468 | ent.setBusinessWebpage( it.current()->text() ); | 468 | ent.setBusinessWebpage( it.current()->text() ); |
469 | break; | 469 | break; |
470 | case Qtopia::JobTitle: | 470 | case Qtopia::JobTitle: |
471 | ent.setJobTitle( it.current()->text() ); | 471 | ent.setJobTitle( it.current()->text() ); |
472 | break; | 472 | break; |
473 | case Qtopia::Department: | 473 | case Qtopia::Department: |
474 | ent.setDepartment( it.current()->text() ); | 474 | ent.setDepartment( it.current()->text() ); |
475 | break; | 475 | break; |
476 | case Qtopia::Office: | 476 | case Qtopia::Office: |
477 | ent.setOffice( it.current()->text() ); | 477 | ent.setOffice( it.current()->text() ); |
478 | break; | 478 | break; |
479 | case Qtopia::BusinessPhone: | 479 | case Qtopia::BusinessPhone: |
480 | ent.setBusinessPhone( it.current()->text() ); | 480 | ent.setBusinessPhone( it.current()->text() ); |
481 | break; | 481 | break; |
482 | case Qtopia::BusinessFax: | 482 | case Qtopia::BusinessFax: |
483 | ent.setBusinessFax( it.current()->text() ); | 483 | ent.setBusinessFax( it.current()->text() ); |
484 | break; | 484 | break; |
485 | case Qtopia::BusinessMobile: | 485 | case Qtopia::BusinessMobile: |
486 | ent.setBusinessMobile( it.current()->text() ); | 486 | ent.setBusinessMobile( it.current()->text() ); |
487 | break; | 487 | break; |
488 | case Qtopia::BusinessPager: | 488 | case Qtopia::BusinessPager: |
489 | ent.setBusinessPager( it.current()->text() ); | 489 | ent.setBusinessPager( it.current()->text() ); |
490 | break; | 490 | break; |
491 | case Qtopia::Profession: | 491 | case Qtopia::Profession: |
492 | ent.setProfession( it.current()->text() ); | 492 | ent.setProfession( it.current()->text() ); |
493 | break; | 493 | break; |
494 | case Qtopia::Assistant: | 494 | case Qtopia::Assistant: |
495 | ent.setAssistant( it.current()->text() ); | 495 | ent.setAssistant( it.current()->text() ); |
496 | break; | 496 | break; |
497 | case Qtopia::Manager: | 497 | case Qtopia::Manager: |
498 | ent.setManager( it.current()->text() ); | 498 | ent.setManager( it.current()->text() ); |
499 | break; | 499 | break; |
500 | 500 | ||
501 | // personal | 501 | // personal |
502 | case Qtopia::Spouse: | 502 | case Qtopia::Spouse: |
503 | ent.setSpouse( it.current()->text() ); | 503 | ent.setSpouse( it.current()->text() ); |
504 | break; | 504 | break; |
505 | case Qtopia::Children: | 505 | case Qtopia::Children: |
506 | ent.setChildren( it.current()->text() ); | 506 | ent.setChildren( it.current()->text() ); |
507 | break; | 507 | break; |
508 | case Qtopia::Birthday: | 508 | case Qtopia::Birthday: |
509 | ent.setBirthday( it.current()->text() ); | 509 | ent.setBirthday( it.current()->text() ); |
510 | break; | 510 | break; |
511 | case Qtopia::Anniversary: | 511 | case Qtopia::Anniversary: |
512 | ent.setAnniversary( it.current()->text() ); | 512 | ent.setAnniversary( it.current()->text() ); |
513 | break; | 513 | break; |
514 | case Qtopia::Nickname: | 514 | case Qtopia::Nickname: |
515 | ent.setNickname( it.current()->text() ); | 515 | ent.setNickname( it.current()->text() ); |
516 | break; | 516 | break; |
517 | default: | 517 | default: |
518 | break; | 518 | break; |
519 | 519 | ||
520 | } | 520 | } |
521 | } | 521 | } |
522 | 522 | ||
523 | int gender = genderCombo->currentItem(); | 523 | int gender = genderCombo->currentItem(); |
524 | ent.setGender( QString::number( gender ) ); | 524 | ent.setGender( QString::number( gender ) ); |
525 | 525 | ||
526 | QString str = txtNote->text(); | 526 | QString str = txtNote->text(); |
527 | if ( !str.isNull() ) | 527 | if ( !str.isNull() ) |
528 | ent.setNotes( str ); | 528 | ent.setNotes( str ); |
529 | } | 529 | } |
530 | 530 | ||
531 | void AbEditor::slotNote() | 531 | void AbEditor::slotNote() |
532 | { | 532 | { |
533 | dlgNote->showMaximized(); | 533 | dlgNote->showMaximized(); |
534 | if ( !dlgNote->exec() ) { | 534 | if ( !dlgNote->exec() ) { |
535 | // reset the note... | 535 | // reset the note... |
536 | txtNote->setText( ent.notes() ); | 536 | txtNote->setText( ent.notes() ); |
537 | } | 537 | } |
538 | } | 538 | } |
539 | 539 | ||
540 | void AbEditor::setNameFocus() | 540 | void AbEditor::setNameFocus() |
541 | { | 541 | { |
542 | firstEdit->setFocus(); | 542 | firstEdit->setFocus(); |
543 | } | 543 | } |
544 | 544 | ||
545 | void parseEmailFrom( const QString &txt, QString &strDefaultEmail, | 545 | void parseEmailFrom( const QString &txt, QString &strDefaultEmail, |
546 | QString &strAll ) | 546 | QString &strAll ) |
547 | { | 547 | { |
548 | int where, | 548 | int where, |
549 | start; | 549 | start; |
550 | if ( txt.isEmpty() ) | 550 | if ( txt.isEmpty() ) |
551 | return; | 551 | return; |
552 | // find the first | 552 | // find the first |
553 | where = txt.find( ',' ); | 553 | where = txt.find( ',' ); |
554 | if ( where < 0 ) { | 554 | if ( where < 0 ) { |
555 | strDefaultEmail = txt; | 555 | strDefaultEmail = txt; |
556 | strAll = txt; | 556 | strAll = txt; |
557 | } else { | 557 | } else { |
558 | strDefaultEmail = txt.left( where ).stripWhiteSpace(); | 558 | strDefaultEmail = txt.left( where ).stripWhiteSpace(); |
559 | strAll = strDefaultEmail; | 559 | strAll = strDefaultEmail; |
560 | while ( where > -1 ) { | 560 | while ( where > -1 ) { |
561 | strAll.append(" "); | 561 | strAll.append(" "); |
562 | start = where; | 562 | start = where; |
563 | where = txt.find( ',', where + 1 ); | 563 | where = txt.find( ',', where + 1 ); |
564 | if ( where > - 1 ) | 564 | if ( where > - 1 ) |
565 | strAll.append( txt.mid(start + 1, where - start - 1).stripWhiteSpace() ); | 565 | strAll.append( txt.mid(start + 1, where - start - 1).stripWhiteSpace() ); |
566 | else // grab until the end... | 566 | else // grab until the end... |
567 | strAll.append( txt.right(txt.length() - start - 1).stripWhiteSpace() ); | 567 | strAll.append( txt.right(txt.length() - start - 1).stripWhiteSpace() ); |
568 | } | 568 | } |
569 | } | 569 | } |
570 | } | 570 | } |
571 | 571 | ||
572 | void parseEmailTo( const QString &strDefaultEmail, | 572 | void parseEmailTo( const QString &strDefaultEmail, |
573 | const QString &strOtherEmail, QString &strBack ) | 573 | const QString &strOtherEmail, QString &strBack ) |
574 | { | 574 | { |
575 | // create a comma dilimeted set of emails... | 575 | // create a comma dilimeted set of emails... |
576 | // use the power of short circuiting... | 576 | // use the power of short circuiting... |
577 | bool foundDefault = false; | 577 | bool foundDefault = false; |
578 | QString strTmp; | 578 | QString strTmp; |
579 | int start = 0; | 579 | int start = 0; |
580 | int where; | 580 | int where; |
581 | // start at the beginng. | 581 | // start at the beginng. |
582 | strBack = strDefaultEmail; | 582 | strBack = strDefaultEmail; |
583 | where = 0; | 583 | where = 0; |
584 | while ( where > -1 ) { | 584 | while ( where > -1 ) { |
585 | start = where; | 585 | start = where; |
586 | where = strOtherEmail.find( ' ', where + 1 ); | 586 | where = strOtherEmail.find( ' ', where + 1 ); |
587 | if ( where > 0 ) { | 587 | if ( where > 0 ) { |
588 | strTmp = strOtherEmail.mid( start, where - start ).stripWhiteSpace(); | 588 | strTmp = strOtherEmail.mid( start, where - start ).stripWhiteSpace(); |
589 | } else | 589 | } else |
590 | strTmp = strOtherEmail.right( strOtherEmail.length() - start ).stripWhiteSpace(); | 590 | strTmp = strOtherEmail.right( strOtherEmail.length() - start ).stripWhiteSpace(); |
591 | if ( foundDefault || strTmp != strDefaultEmail ) { | 591 | if ( foundDefault || strTmp != strDefaultEmail ) { |
592 | strBack.append( ", " ); | 592 | strBack.append( ", " ); |
593 | strBack.append( strTmp ); | 593 | strBack.append( strTmp ); |
594 | } else | 594 | } else |
595 | foundDefault = true; | 595 | foundDefault = true; |
596 | } | 596 | } |
597 | } | 597 | } |
598 | 598 | ||
599 | 599 | ||
600 | static inline bool containsAlphaNum( const QString &str ) | 600 | static inline bool containsAlphaNum( const QString &str ) |
601 | { | 601 | { |
602 | int i, | 602 | int i, |
603 | count = str.length(); | 603 | count = str.length(); |
604 | for ( i = 0; i < count; i++ ) | 604 | for ( i = 0; i < count; i++ ) |
605 | if ( !str[i].isSpace() ) | 605 | if ( !str[i].isSpace() ) |
606 | return TRUE; | 606 | return TRUE; |
607 | return FALSE; | 607 | return FALSE; |
608 | } | 608 | } |
609 | 609 | ||
610 | static inline bool constainsWhiteSpace( const QString &str ) | 610 | static inline bool constainsWhiteSpace( const QString &str ) |
611 | { | 611 | { |
612 | int i, | 612 | int i, |
613 | count = str.length(); | 613 | count = str.length(); |
614 | for (i = 0; i < count; i++ ) | 614 | for (i = 0; i < count; i++ ) |
615 | if ( str[i].isSpace() ) | 615 | if ( str[i].isSpace() ) |
616 | return TRUE; | 616 | return TRUE; |
617 | return FALSE; | 617 | return FALSE; |
618 | } | 618 | } |
619 | 619 | ||
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp index a2b8276..e8fa37c 100644 --- a/core/pim/addressbook/addressbook.cpp +++ b/core/pim/addressbook/addressbook.cpp | |||
@@ -1,831 +1,831 @@ | |||
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 | #define QTOPIA_INTERNAL_FD | 21 | #define QTOPIA_INTERNAL_FD |
22 | 22 | ||
23 | #include "abeditor.h" | 23 | #include "contacteditor.h" |
24 | #include "ablabel.h" | 24 | #include "ablabel.h" |
25 | #include "abtable.h" | 25 | #include "abtable.h" |
26 | #include "addresssettings.h" | 26 | #include "addresssettings.h" |
27 | #include "addressbook.h" | 27 | #include "addressbook.h" |
28 | 28 | ||
29 | #include <qpe/qpeapplication.h> | 29 | #include <qpe/qpeapplication.h> |
30 | #include <qpe/config.h> | 30 | #include <qpe/config.h> |
31 | #include <qpe/contact.h> | 31 | #include <qpe/contact.h> |
32 | #include <qpe/finddialog.h> | 32 | #include <qpe/finddialog.h> |
33 | #include <qpe/global.h> | 33 | #include <qpe/global.h> |
34 | #include <qpe/resource.h> | 34 | #include <qpe/resource.h> |
35 | #include <qpe/ir.h> | 35 | #include <qpe/ir.h> |
36 | #include <qpe/qpemessagebox.h> | 36 | #include <qpe/qpemessagebox.h> |
37 | #include <qpe/qcopenvelope_qws.h> | 37 | #include <qpe/qcopenvelope_qws.h> |
38 | 38 | ||
39 | #include <qaction.h> | 39 | #include <qaction.h> |
40 | #include <qdialog.h> | 40 | #include <qdialog.h> |
41 | #include <qdir.h> | 41 | #include <qdir.h> |
42 | #include <qfile.h> | 42 | #include <qfile.h> |
43 | #include <qimage.h> | 43 | #include <qimage.h> |
44 | #include <qlayout.h> | 44 | #include <qlayout.h> |
45 | #include <qpe/qpemenubar.h> | 45 | #include <qpe/qpemenubar.h> |
46 | #include <qmessagebox.h> | 46 | #include <qmessagebox.h> |
47 | #include <qpixmap.h> | 47 | #include <qpixmap.h> |
48 | #include <qpopupmenu.h> | 48 | #include <qpopupmenu.h> |
49 | #include <qpe/qpetoolbar.h> | 49 | #include <qpe/qpetoolbar.h> |
50 | #include <qstringlist.h> | 50 | #include <qstringlist.h> |
51 | #include <qtoolbutton.h> | 51 | #include <qtoolbutton.h> |
52 | #include <qwhatsthis.h> | 52 | #include <qwhatsthis.h> |
53 | 53 | ||
54 | #include <stdlib.h> | 54 | #include <stdlib.h> |
55 | #include <sys/stat.h> | 55 | #include <sys/stat.h> |
56 | #include <sys/types.h> | 56 | #include <sys/types.h> |
57 | #include <fcntl.h> | 57 | #include <fcntl.h> |
58 | #include <unistd.h> | 58 | #include <unistd.h> |
59 | 59 | ||
60 | #include <qdatetime.h> | 60 | #include <qdatetime.h> |
61 | 61 | ||
62 | static QString addressbookOldXMLFilename() | 62 | static QString addressbookOldXMLFilename() |
63 | { | 63 | { |
64 | QString filename = QPEApplication::documentDir() + "addressbook.xml"; | 64 | QString filename = QPEApplication::documentDir() + "addressbook.xml"; |
65 | return filename; | 65 | return filename; |
66 | } | 66 | } |
67 | 67 | ||
68 | static QString addressbookXMLFilename() | 68 | static QString addressbookXMLFilename() |
69 | { | 69 | { |
70 | QString filename = Global::applicationFileName("addressbook", | 70 | QString filename = Global::applicationFileName("addressbook", |
71 | "addressbook.xml"); | 71 | "addressbook.xml"); |
72 | return filename; | 72 | return filename; |
73 | } | 73 | } |
74 | 74 | ||
75 | static QString addressbookPersonalVCardName() | 75 | static QString addressbookPersonalVCardName() |
76 | { | 76 | { |
77 | QString filename = Global::applicationFileName("addressbook", | 77 | QString filename = Global::applicationFileName("addressbook", |
78 | "businesscard.vcf"); | 78 | "businesscard.vcf"); |
79 | return filename; | 79 | return filename; |
80 | } | 80 | } |
81 | 81 | ||
82 | 82 | ||
83 | AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, | 83 | AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, |
84 | WFlags f ) | 84 | WFlags f ) |
85 | : QMainWindow( parent, name, f ), | 85 | : QMainWindow( parent, name, f ), |
86 | abEditor(0), | 86 | abEditor(0), |
87 | bAbEditFirstTime(TRUE), | 87 | bAbEditFirstTime(TRUE), |
88 | syncing(FALSE) | 88 | syncing(FALSE) |
89 | { | 89 | { |
90 | initFields(); | 90 | initFields(); |
91 | 91 | ||
92 | setCaption( tr("Contacts") ); | 92 | setCaption( tr("Contacts") ); |
93 | setIcon( Resource::loadPixmap( "AddressBook" ) ); | 93 | setIcon( Resource::loadPixmap( "AddressBook" ) ); |
94 | 94 | ||
95 | setToolBarsMovable( FALSE ); | 95 | setToolBarsMovable( FALSE ); |
96 | 96 | ||
97 | // Create Toolbars | 97 | // Create Toolbars |
98 | 98 | ||
99 | QPEToolBar *bar = new QPEToolBar( this ); | 99 | QPEToolBar *bar = new QPEToolBar( this ); |
100 | bar->setHorizontalStretchable( TRUE ); | 100 | bar->setHorizontalStretchable( TRUE ); |
101 | 101 | ||
102 | QPEMenuBar *mbList = new QPEMenuBar( bar ); | 102 | QPEMenuBar *mbList = new QPEMenuBar( bar ); |
103 | mbList->setMargin( 0 ); | 103 | mbList->setMargin( 0 ); |
104 | 104 | ||
105 | QPopupMenu *edit = new QPopupMenu( this ); | 105 | QPopupMenu *edit = new QPopupMenu( this ); |
106 | mbList->insertItem( tr( "Contact" ), edit ); | 106 | mbList->insertItem( tr( "Contact" ), edit ); |
107 | 107 | ||
108 | listTools = new QPEToolBar( this, "list operations" ); | 108 | listTools = new QPEToolBar( this, "list operations" ); |
109 | 109 | ||
110 | 110 | ||
111 | QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, | 111 | QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, |
112 | 0, this, 0 ); | 112 | 0, this, 0 ); |
113 | actionNew = a; | 113 | actionNew = a; |
114 | connect( a, SIGNAL( activated() ), this, SLOT( slotListNew() ) ); | 114 | connect( a, SIGNAL( activated() ), this, SLOT( slotListNew() ) ); |
115 | a->addTo( edit ); | 115 | a->addTo( edit ); |
116 | a->addTo( listTools ); | 116 | a->addTo( listTools ); |
117 | 117 | ||
118 | a = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ), QString::null, | 118 | a = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ), QString::null, |
119 | 0, this, 0 ); | 119 | 0, this, 0 ); |
120 | actionEdit = a; | 120 | actionEdit = a; |
121 | connect( a, SIGNAL( activated() ), this, SLOT( slotViewEdit() ) ); | 121 | connect( a, SIGNAL( activated() ), this, SLOT( slotViewEdit() ) ); |
122 | a->addTo( edit ); | 122 | a->addTo( edit ); |
123 | a->addTo( listTools ); | 123 | a->addTo( listTools ); |
124 | 124 | ||
125 | a = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, | 125 | a = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, |
126 | 0, this, 0 ); | 126 | 0, this, 0 ); |
127 | actionTrash = a; | 127 | actionTrash = a; |
128 | connect( a, SIGNAL( activated() ), this, SLOT( slotListDelete() ) ); | 128 | connect( a, SIGNAL( activated() ), this, SLOT( slotListDelete() ) ); |
129 | a->addTo( edit ); | 129 | a->addTo( edit ); |
130 | a->addTo( listTools ); | 130 | a->addTo( listTools ); |
131 | 131 | ||
132 | a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ), | 132 | a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ), |
133 | QString::null, 0, this, 0 ); | 133 | QString::null, 0, this, 0 ); |
134 | actionFind = a; | 134 | actionFind = a; |
135 | connect( a, SIGNAL(activated()), this, SLOT(slotFind()) ); | 135 | connect( a, SIGNAL(activated()), this, SLOT(slotFind()) ); |
136 | a->addTo( edit ); | 136 | a->addTo( edit ); |
137 | a->addTo( listTools ); | 137 | a->addTo( listTools ); |
138 | 138 | ||
139 | 139 | ||
140 | a = new QAction( tr( "Write Mail To" ), Resource::loadPixmap( "qtmail/reply" ), | 140 | a = new QAction( tr( "Write Mail To" ), Resource::loadPixmap( "qtmail/reply" ), |
141 | QString::null, 0, this, 0 ); | 141 | QString::null, 0, this, 0 ); |
142 | //a->setEnabled( FALSE ); we got support for it now :) zecke | 142 | //a->setEnabled( FALSE ); we got support for it now :) zecke |
143 | actionMail = a; | 143 | actionMail = a; |
144 | connect( a, SIGNAL( activated() ), this, SLOT( writeMail() ) ); | 144 | connect( a, SIGNAL( activated() ), this, SLOT( writeMail() ) ); |
145 | a->addTo( edit ); | 145 | a->addTo( edit ); |
146 | a->addTo( listTools ); | 146 | a->addTo( listTools ); |
147 | 147 | ||
148 | 148 | ||
149 | 149 | ||
150 | if ( Ir::supported() ) { | 150 | if ( Ir::supported() ) { |
151 | a = new QAction( tr ("Beam Entry" ), Resource::loadPixmap( "beam" ), QString::null, | 151 | a = new QAction( tr ("Beam Entry" ), Resource::loadPixmap( "beam" ), QString::null, |
152 | 0, this, 0 ); | 152 | 0, this, 0 ); |
153 | actionBeam = a; | 153 | actionBeam = a; |
154 | connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) ); | 154 | connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) ); |
155 | a->addTo( edit ); | 155 | a->addTo( edit ); |
156 | a->addTo( listTools ); | 156 | a->addTo( listTools ); |
157 | } | 157 | } |
158 | 158 | ||
159 | edit->insertSeparator(); | 159 | edit->insertSeparator(); |
160 | 160 | ||
161 | a = new QAction( tr("My Personal Details"), QString::null, 0, 0, 0, TRUE ); | 161 | a = new QAction( tr("My Personal Details"), QString::null, 0, 0, 0, TRUE ); |
162 | actionPersonal = a; | 162 | actionPersonal = a; |
163 | connect( a, SIGNAL( activated() ), this, SLOT( slotPersonalView() ) ); | 163 | connect( a, SIGNAL( activated() ), this, SLOT( slotPersonalView() ) ); |
164 | a->addTo( edit ); | 164 | a->addTo( edit ); |
165 | 165 | ||
166 | 166 | ||
167 | a = new QAction( tr( "Arrange Edit Fields"), QString::null, 0, 0 ); | 167 | a = new QAction( tr( "Arrange Edit Fields"), QString::null, 0, 0 ); |
168 | connect( a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); | 168 | connect( a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); |
169 | a->addTo( edit ); | 169 | a->addTo( edit ); |
170 | 170 | ||
171 | // Create Views | 171 | // Create Views |
172 | 172 | ||
173 | // This is safe to call without checking to see if it exists... | 173 | // This is safe to call without checking to see if it exists... |
174 | // not to mention it also does the necessary stuff for the | 174 | // not to mention it also does the necessary stuff for the |
175 | // journaling... | 175 | // journaling... |
176 | QString str = addressbookXMLFilename(); | 176 | QString str = addressbookXMLFilename(); |
177 | if ( str.isNull() ) { | 177 | if ( str.isNull() ) { |
178 | QMessageBox::warning( this, tr("Out of Space"), | 178 | QMessageBox::warning( this, tr("Out of Space"), |
179 | tr("There is not enough space to create\n" | 179 | tr("There is not enough space to create\n" |
180 | "neccessary startup files.\n" | 180 | "neccessary startup files.\n" |
181 | "\nFree up some space before\nentering data!") | 181 | "\nFree up some space before\nentering data!") |
182 | ); | 182 | ); |
183 | } | 183 | } |
184 | 184 | ||
185 | abList = new AbTable( &orderedFields, this, "table" ); | 185 | abList = new AbTable( &orderedFields, this, "table" ); |
186 | abList->setHScrollBarMode( QScrollView::AlwaysOff ); | 186 | abList->setHScrollBarMode( QScrollView::AlwaysOff ); |
187 | connect( abList, SIGNAL( empty( bool ) ), | 187 | connect( abList, SIGNAL( empty( bool ) ), |
188 | this, SLOT( listIsEmpty( bool ) ) ); | 188 | this, SLOT( listIsEmpty( bool ) ) ); |
189 | connect( abList, SIGNAL( details() ), | 189 | connect( abList, SIGNAL( details() ), |
190 | this, SLOT( slotListView() ) ); | 190 | this, SLOT( slotListView() ) ); |
191 | connect( abList, SIGNAL(currentChanged(int,int)), | 191 | connect( abList, SIGNAL(currentChanged(int,int)), |
192 | this, SLOT(slotUpdateToolbar()) ); | 192 | this, SLOT(slotUpdateToolbar()) ); |
193 | 193 | ||
194 | mView = 0; | 194 | mView = 0; |
195 | 195 | ||
196 | abList->load( addressbookXMLFilename() ); | 196 | abList->load( addressbookXMLFilename() ); |
197 | if ( QFile::exists(addressbookOldXMLFilename()) ) { | 197 | if ( QFile::exists(addressbookOldXMLFilename()) ) { |
198 | abList->load( addressbookOldXMLFilename() ); | 198 | abList->load( addressbookOldXMLFilename() ); |
199 | QFile::remove(addressbookOldXMLFilename()); | 199 | QFile::remove(addressbookOldXMLFilename()); |
200 | } | 200 | } |
201 | 201 | ||
202 | catMenu = new QPopupMenu( this ); | 202 | catMenu = new QPopupMenu( this ); |
203 | catMenu->setCheckable( TRUE ); | 203 | catMenu->setCheckable( TRUE ); |
204 | connect( catMenu, SIGNAL(activated(int)), this, SLOT(slotSetCategory(int)) ); | 204 | connect( catMenu, SIGNAL(activated(int)), this, SLOT(slotSetCategory(int)) ); |
205 | populateCategories(); | 205 | populateCategories(); |
206 | 206 | ||
207 | mbList->insertItem( tr("View"), catMenu ); | 207 | mbList->insertItem( tr("View"), catMenu ); |
208 | setCentralWidget( abList ); | 208 | setCentralWidget( abList ); |
209 | 209 | ||
210 | // qDebug("adressbook contrsuction: t=%d", t.elapsed() ); | 210 | // qDebug("adressbook contrsuction: t=%d", t.elapsed() ); |
211 | } | 211 | } |
212 | 212 | ||
213 | void AddressbookWindow::setDocument( const QString &filename ) | 213 | void AddressbookWindow::setDocument( const QString &filename ) |
214 | { | 214 | { |
215 | if ( filename.find(".vcf") != int(filename.length()) - 4 ) return; | 215 | if ( filename.find(".vcf") != int(filename.length()) - 4 ) return; |
216 | 216 | ||
217 | QValueList<Contact> cl = Contact::readVCard( filename ); | 217 | QValueList<Contact> cl = Contact::readVCard( filename ); |
218 | for( QValueList<Contact>::Iterator it = cl.begin(); it != cl.end(); ++it ) { | 218 | for( QValueList<Contact>::Iterator it = cl.begin(); it != cl.end(); ++it ) { |
219 | // QString msg = tr("You received a vCard for\n%1.\nDo You want to add it to your\naddressbook?") | 219 | // QString msg = tr("You received a vCard for\n%1.\nDo You want to add it to your\naddressbook?") |
220 | // .arg( (*it).fullName() ); | 220 | // .arg( (*it).fullName() ); |
221 | // if ( QMessageBox::information( this, tr("received contact"), msg, QMessageBox::Ok, QMessageBox::Cancel ) == | 221 | // if ( QMessageBox::information( this, tr("received contact"), msg, QMessageBox::Ok, QMessageBox::Cancel ) == |
222 | // QMessageBox::Ok ) { | 222 | // QMessageBox::Ok ) { |
223 | abList->addEntry( *it ); | 223 | abList->addEntry( *it ); |
224 | // } | 224 | // } |
225 | } | 225 | } |
226 | 226 | ||
227 | } | 227 | } |
228 | 228 | ||
229 | void AddressbookWindow::resizeEvent( QResizeEvent *e ) | 229 | void AddressbookWindow::resizeEvent( QResizeEvent *e ) |
230 | { | 230 | { |
231 | QMainWindow::resizeEvent( e ); | 231 | QMainWindow::resizeEvent( e ); |
232 | 232 | ||
233 | if ( centralWidget() == abList ) | 233 | if ( centralWidget() == abList ) |
234 | showList(); | 234 | showList(); |
235 | else if ( centralWidget() == mView ) | 235 | else if ( centralWidget() == mView ) |
236 | showView(); | 236 | showView(); |
237 | } | 237 | } |
238 | 238 | ||
239 | AddressbookWindow::~AddressbookWindow() | 239 | AddressbookWindow::~AddressbookWindow() |
240 | { | 240 | { |
241 | } | 241 | } |
242 | 242 | ||
243 | void AddressbookWindow::slotUpdateToolbar() | 243 | void AddressbookWindow::slotUpdateToolbar() |
244 | { | 244 | { |
245 | Contact ce = abList->currentEntry(); | 245 | Contact ce = abList->currentEntry(); |
246 | actionMail->setEnabled( !ce.defaultEmail().isEmpty() ); | 246 | actionMail->setEnabled( !ce.defaultEmail().isEmpty() ); |
247 | } | 247 | } |
248 | 248 | ||
249 | void AddressbookWindow::showList() | 249 | void AddressbookWindow::showList() |
250 | { | 250 | { |
251 | if ( mView ) mView->hide(); | 251 | if ( mView ) mView->hide(); |
252 | setCentralWidget( abList ); | 252 | setCentralWidget( abList ); |
253 | abList->show(); | 253 | abList->show(); |
254 | // update our focues... (or use a stack widget!); | 254 | // update our focues... (or use a stack widget!); |
255 | abList->setFocus(); | 255 | abList->setFocus(); |
256 | } | 256 | } |
257 | 257 | ||
258 | void AddressbookWindow::showView() | 258 | void AddressbookWindow::showView() |
259 | { | 259 | { |
260 | if ( abList->numRows() > 0 ) { | 260 | if ( abList->numRows() > 0 ) { |
261 | abList->hide(); | 261 | abList->hide(); |
262 | setCentralWidget( abView() ); | 262 | setCentralWidget( abView() ); |
263 | mView->show(); | 263 | mView->show(); |
264 | mView->setFocus(); | 264 | mView->setFocus(); |
265 | } | 265 | } |
266 | } | 266 | } |
267 | 267 | ||
268 | void AddressbookWindow::slotListNew() | 268 | void AddressbookWindow::slotListNew() |
269 | { | 269 | { |
270 | Contact cnt; | 270 | Contact cnt; |
271 | if( !syncing ) { | 271 | if( !syncing ) { |
272 | if ( abEditor ) | 272 | if ( abEditor ) |
273 | abEditor->setEntry( cnt ); | 273 | abEditor->setEntry( cnt ); |
274 | abView()->init( cnt ); | 274 | abView()->init( cnt ); |
275 | editEntry( NewEntry ); | 275 | editEntry( NewEntry ); |
276 | } else { | 276 | } else { |
277 | QMessageBox::warning(this, tr("Contacts"), | 277 | QMessageBox::warning(this, tr("Contacts"), |
278 | tr("Can not edit data, currently syncing")); | 278 | tr("Can not edit data, currently syncing")); |
279 | } | 279 | } |
280 | } | 280 | } |
281 | 281 | ||
282 | void AddressbookWindow::slotListView() | 282 | void AddressbookWindow::slotListView() |
283 | { | 283 | { |
284 | abView()->init( abList->currentEntry() ); | 284 | abView()->init( abList->currentEntry() ); |
285 | mView->sync(); | 285 | mView->sync(); |
286 | showView(); | 286 | showView(); |
287 | } | 287 | } |
288 | 288 | ||
289 | void AddressbookWindow::slotListDelete() | 289 | void AddressbookWindow::slotListDelete() |
290 | { | 290 | { |
291 | if(!syncing) { | 291 | if(!syncing) { |
292 | Contact tmpEntry = abList->currentEntry(); | 292 | Contact tmpEntry = abList->currentEntry(); |
293 | 293 | ||
294 | // get a name, do the best we can... | 294 | // get a name, do the best we can... |
295 | QString strName = tmpEntry.fullName(); | 295 | QString strName = tmpEntry.fullName(); |
296 | if ( strName.isEmpty() ) { | 296 | if ( strName.isEmpty() ) { |
297 | strName = tmpEntry.company(); | 297 | strName = tmpEntry.company(); |
298 | if ( strName.isEmpty() ) | 298 | if ( strName.isEmpty() ) |
299 | strName = "No Name"; | 299 | strName = "No Name"; |
300 | } | 300 | } |
301 | 301 | ||
302 | 302 | ||
303 | if ( QPEMessageBox::confirmDelete( this, tr( "Contacts" ), | 303 | if ( QPEMessageBox::confirmDelete( this, tr( "Contacts" ), |
304 | strName ) ) { | 304 | strName ) ) { |
305 | abList->deleteCurrentEntry(); | 305 | abList->deleteCurrentEntry(); |
306 | showList(); | 306 | showList(); |
307 | } | 307 | } |
308 | } else { | 308 | } else { |
309 | QMessageBox::warning( this, tr("Contacts"), | 309 | QMessageBox::warning( this, tr("Contacts"), |
310 | tr("Can not edit data, currently syncing") ); | 310 | tr("Can not edit data, currently syncing") ); |
311 | } | 311 | } |
312 | } | 312 | } |
313 | 313 | ||
314 | void AddressbookWindow::slotViewBack() | 314 | void AddressbookWindow::slotViewBack() |
315 | { | 315 | { |
316 | showList(); | 316 | showList(); |
317 | } | 317 | } |
318 | 318 | ||
319 | void AddressbookWindow::slotViewEdit() | 319 | void AddressbookWindow::slotViewEdit() |
320 | { | 320 | { |
321 | if(!syncing) { | 321 | if(!syncing) { |
322 | if (actionPersonal->isOn()) { | 322 | if (actionPersonal->isOn()) { |
323 | editPersonal(); | 323 | editPersonal(); |
324 | } else { | 324 | } else { |
325 | if ( !bAbEditFirstTime ) | 325 | if ( !bAbEditFirstTime ) |
326 | abEditor->setEntry( abList->currentEntry() ); | 326 | abEditor->setEntry( abList->currentEntry() ); |
327 | editEntry( EditEntry ); | 327 | editEntry( EditEntry ); |
328 | } | 328 | } |
329 | } else { | 329 | } else { |
330 | QMessageBox::warning( this, tr("Contacts"), | 330 | QMessageBox::warning( this, tr("Contacts"), |
331 | tr("Can not edit data, currently syncing") ); | 331 | tr("Can not edit data, currently syncing") ); |
332 | } | 332 | } |
333 | } | 333 | } |
334 | 334 | ||
335 | 335 | ||
336 | 336 | ||
337 | void AddressbookWindow::writeMail() | 337 | void AddressbookWindow::writeMail() |
338 | { | 338 | { |
339 | Contact c = abList->currentEntry(); | 339 | Contact c = abList->currentEntry(); |
340 | QString name = c.fileAs(); | 340 | QString name = c.fileAs(); |
341 | QString email = c.defaultEmail(); | 341 | QString email = c.defaultEmail(); |
342 | QCopEnvelope e("QPE/Application/qtmail", "writeMail(QString,QString)"); | 342 | QCopEnvelope e("QPE/Application/qtmail", "writeMail(QString,QString)"); |
343 | e << name << email; | 343 | e << name << email; |
344 | } | 344 | } |
345 | 345 | ||
346 | 346 | ||
347 | 347 | ||
348 | 348 | ||
349 | static const char * beamfile = "/tmp/obex/contact.vcf"; | 349 | static const char * beamfile = "/tmp/obex/contact.vcf"; |
350 | 350 | ||
351 | void AddressbookWindow::slotBeam() | 351 | void AddressbookWindow::slotBeam() |
352 | { | 352 | { |
353 | QString filename; | 353 | QString filename; |
354 | Contact c; | 354 | Contact c; |
355 | if ( actionPersonal->isOn() ) { | 355 | if ( actionPersonal->isOn() ) { |
356 | filename = addressbookPersonalVCardName(); | 356 | filename = addressbookPersonalVCardName(); |
357 | if (!QFile::exists(filename)) | 357 | if (!QFile::exists(filename)) |
358 | return; // can't beam a non-existent file | 358 | return; // can't beam a non-existent file |
359 | c = Contact::readVCard( filename )[0]; | 359 | c = Contact::readVCard( filename )[0]; |
360 | } else { | 360 | } else { |
361 | unlink( beamfile ); // delete if exists | 361 | unlink( beamfile ); // delete if exists |
362 | c = abList->currentEntry(); | 362 | c = abList->currentEntry(); |
363 | mkdir("/tmp/obex/", 0755); | 363 | mkdir("/tmp/obex/", 0755); |
364 | Contact::writeVCard( beamfile, c ); | 364 | Contact::writeVCard( beamfile, c ); |
365 | filename = beamfile; | 365 | filename = beamfile; |
366 | } | 366 | } |
367 | Ir *ir = new Ir( this ); | 367 | Ir *ir = new Ir( this ); |
368 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); | 368 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); |
369 | QString description = c.fullName(); | 369 | QString description = c.fullName(); |
370 | ir->send( filename, description, "text/x-vCard" ); | 370 | ir->send( filename, description, "text/x-vCard" ); |
371 | } | 371 | } |
372 | 372 | ||
373 | void AddressbookWindow::beamDone( Ir *ir ) | 373 | void AddressbookWindow::beamDone( Ir *ir ) |
374 | { | 374 | { |
375 | delete ir; | 375 | delete ir; |
376 | unlink( beamfile ); | 376 | unlink( beamfile ); |
377 | } | 377 | } |
378 | 378 | ||
379 | 379 | ||
380 | static void parseName( const QString& name, QString *first, QString *middle, | 380 | static void parseName( const QString& name, QString *first, QString *middle, |
381 | QString * last ) | 381 | QString * last ) |
382 | { | 382 | { |
383 | 383 | ||
384 | int comma = name.find ( "," ); | 384 | int comma = name.find ( "," ); |
385 | QString rest; | 385 | QString rest; |
386 | if ( comma > 0 ) { | 386 | if ( comma > 0 ) { |
387 | *last = name.left( comma ); | 387 | *last = name.left( comma ); |
388 | comma++; | 388 | comma++; |
389 | while ( comma < int(name.length()) && name[comma] == ' ' ) | 389 | while ( comma < int(name.length()) && name[comma] == ' ' ) |
390 | comma++; | 390 | comma++; |
391 | rest = name.mid( comma ); | 391 | rest = name.mid( comma ); |
392 | } else { | 392 | } else { |
393 | int space = name.findRev( ' ' ); | 393 | int space = name.findRev( ' ' ); |
394 | *last = name.mid( space+1 ); | 394 | *last = name.mid( space+1 ); |
395 | rest = name.left( space ); | 395 | rest = name.left( space ); |
396 | } | 396 | } |
397 | int space = rest.find( ' ' ); | 397 | int space = rest.find( ' ' ); |
398 | if ( space <= 0 ) { | 398 | if ( space <= 0 ) { |
399 | *first = rest; | 399 | *first = rest; |
400 | } else { | 400 | } else { |
401 | *first = rest.left( space ); | 401 | *first = rest.left( space ); |
402 | *middle = rest.mid( space+1 ); | 402 | *middle = rest.mid( space+1 ); |
403 | } | 403 | } |
404 | 404 | ||
405 | } | 405 | } |
406 | 406 | ||
407 | 407 | ||
408 | void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data) | 408 | void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data) |
409 | { | 409 | { |
410 | if (msg == "editPersonal()") { | 410 | if (msg == "editPersonal()") { |
411 | editPersonal(); | 411 | editPersonal(); |
412 | } else if (msg == "editPersonalAndClose()") { | 412 | } else if (msg == "editPersonalAndClose()") { |
413 | editPersonal(); | 413 | editPersonal(); |
414 | close(); | 414 | close(); |
415 | } else if ( msg == "addContact(QString,QString)" ) { | 415 | } else if ( msg == "addContact(QString,QString)" ) { |
416 | QDataStream stream(data,IO_ReadOnly); | 416 | QDataStream stream(data,IO_ReadOnly); |
417 | QString name, email; | 417 | QString name, email; |
418 | stream >> name >> email; | 418 | stream >> name >> email; |
419 | 419 | ||
420 | Contact cnt; | 420 | Contact cnt; |
421 | QString fn, mn, ln; | 421 | QString fn, mn, ln; |
422 | parseName( name, &fn, &mn, &ln ); | 422 | parseName( name, &fn, &mn, &ln ); |
423 | //qDebug( " %s - %s - %s", fn.latin1(), mn.latin1(), ln.latin1() ); | 423 | //qDebug( " %s - %s - %s", fn.latin1(), mn.latin1(), ln.latin1() ); |
424 | cnt.setFirstName( fn ); | 424 | cnt.setFirstName( fn ); |
425 | cnt.setMiddleName( mn ); | 425 | cnt.setMiddleName( mn ); |
426 | cnt.setLastName( ln ); | 426 | cnt.setLastName( ln ); |
427 | cnt.setEmails( email ); | 427 | cnt.setEmails( email ); |
428 | cnt.setDefaultEmail( email ); | 428 | cnt.setDefaultEmail( email ); |
429 | cnt.setFileAs(); | 429 | cnt.setFileAs(); |
430 | 430 | ||
431 | if ( bAbEditFirstTime ) { | 431 | if ( bAbEditFirstTime ) { |
432 | abEditor = new AbEditor( cnt, &orderedFields, &slOrderedFields, | 432 | abEditor = new ContactEditor( cnt, &orderedFields, &slOrderedFields, |
433 | this, "editor" ); | 433 | this, "editor" ); |
434 | bAbEditFirstTime = FALSE; | 434 | bAbEditFirstTime = FALSE; |
435 | } else { | 435 | } else { |
436 | abEditor->setEntry( cnt ); | 436 | abEditor->setEntry( cnt ); |
437 | } | 437 | } |
438 | abView()->init( cnt ); | 438 | abView()->init( cnt ); |
439 | editEntry( NewEntry ); | 439 | editEntry( NewEntry ); |
440 | 440 | ||
441 | 441 | ||
442 | 442 | ||
443 | } | 443 | } |
444 | #if 0 | 444 | #if 0 |
445 | else if (msg == "pickAddresses(QCString,QCString,QStringList,...)" ) { | 445 | else if (msg == "pickAddresses(QCString,QCString,QStringList,...)" ) { |
446 | QDataStream stream(data,IO_ReadOnly); | 446 | QDataStream stream(data,IO_ReadOnly); |
447 | QCString ch,m; | 447 | QCString ch,m; |
448 | QStringList types; | 448 | QStringList types; |
449 | stream >> ch >> m >> types; | 449 | stream >> ch >> m >> types; |
450 | AddressPicker picker(abList,this,0,TRUE); | 450 | AddressPicker picker(abList,this,0,TRUE); |
451 | picker.showMaximized(); | 451 | picker.showMaximized(); |
452 | picker.setChoiceNames(types); | 452 | picker.setChoiceNames(types); |
453 | int i=0; | 453 | int i=0; |
454 | for (QStringList::ConstIterator it = types.begin(); it!=types.end(); ++it) { | 454 | for (QStringList::ConstIterator it = types.begin(); it!=types.end(); ++it) { |
455 | QStringList sel; | 455 | QStringList sel; |
456 | stream >> sel; | 456 | stream >> sel; |
457 | picker.setSelection(i++,sel); | 457 | picker.setSelection(i++,sel); |
458 | } | 458 | } |
459 | picker.showMaximized(); | 459 | picker.showMaximized(); |
460 | picker.exec(); | 460 | picker.exec(); |
461 | 461 | ||
462 | // ###### note: contacts may have been added - save here! | 462 | // ###### note: contacts may have been added - save here! |
463 | 463 | ||
464 | setCentralWidget(abList); | 464 | setCentralWidget(abList); |
465 | QCopEnvelope e(ch,m); | 465 | QCopEnvelope e(ch,m); |
466 | i=0; | 466 | i=0; |
467 | for (QStringList::ConstIterator it = types.begin(); it!=types.end(); ++it) { | 467 | for (QStringList::ConstIterator it = types.begin(); it!=types.end(); ++it) { |
468 | QStringList sel = picker.selection(i++); | 468 | QStringList sel = picker.selection(i++); |
469 | e << sel; | 469 | e << sel; |
470 | } | 470 | } |
471 | } | 471 | } |
472 | #endif | 472 | #endif |
473 | 473 | ||
474 | } | 474 | } |
475 | 475 | ||
476 | void AddressbookWindow::editPersonal() | 476 | void AddressbookWindow::editPersonal() |
477 | { | 477 | { |
478 | QString filename = addressbookPersonalVCardName(); | 478 | QString filename = addressbookPersonalVCardName(); |
479 | Contact me; | 479 | Contact me; |
480 | if (QFile::exists(filename)) | 480 | if (QFile::exists(filename)) |
481 | me = Contact::readVCard( filename )[0]; | 481 | me = Contact::readVCard( filename )[0]; |
482 | if (bAbEditFirstTime) { | 482 | if (bAbEditFirstTime) { |
483 | abEditor = new AbEditor( me, &orderedFields, &slOrderedFields, | 483 | abEditor = new ContactEditor( me, &orderedFields, &slOrderedFields, |
484 | this, "editor" ); | 484 | this, "editor" ); |
485 | // don't create a new editor every time | 485 | // don't create a new editor every time |
486 | bAbEditFirstTime = FALSE; | 486 | bAbEditFirstTime = FALSE; |
487 | } else | 487 | } else |
488 | abEditor->setEntry( me ); | 488 | abEditor->setEntry( me ); |
489 | 489 | ||
490 | abEditor->setCaption(tr("Edit My Personal Details")); | 490 | abEditor->setCaption(tr("Edit My Personal Details")); |
491 | abEditor->showMaximized(); | 491 | abEditor->showMaximized(); |
492 | 492 | ||
493 | // fix the foxus... | 493 | // fix the foxus... |
494 | abEditor->setNameFocus(); | 494 | abEditor->setNameFocus(); |
495 | if ( abEditor->exec() ) { | 495 | if ( abEditor->exec() ) { |
496 | setFocus(); | 496 | setFocus(); |
497 | Contact new_personal = abEditor->entry(); | 497 | Contact new_personal = abEditor->entry(); |
498 | QString fname = addressbookPersonalVCardName(); | 498 | QString fname = addressbookPersonalVCardName(); |
499 | Contact::writeVCard( fname, new_personal ); | 499 | Contact::writeVCard( fname, new_personal ); |
500 | abView()->init(new_personal); | 500 | abView()->init(new_personal); |
501 | abView()->sync(); | 501 | abView()->sync(); |
502 | } | 502 | } |
503 | abEditor->setCaption( tr("Edit Address") ); | 503 | abEditor->setCaption( tr("Edit Address") ); |
504 | } | 504 | } |
505 | 505 | ||
506 | void AddressbookWindow::slotPersonalView() | 506 | void AddressbookWindow::slotPersonalView() |
507 | { | 507 | { |
508 | if (!actionPersonal->isOn()) { | 508 | if (!actionPersonal->isOn()) { |
509 | // we just turned it off | 509 | // we just turned it off |
510 | setCaption( tr("Contacts") ); | 510 | setCaption( tr("Contacts") ); |
511 | actionNew->setEnabled(TRUE); | 511 | actionNew->setEnabled(TRUE); |
512 | actionTrash->setEnabled(TRUE); | 512 | actionTrash->setEnabled(TRUE); |
513 | actionFind->setEnabled(TRUE); | 513 | actionFind->setEnabled(TRUE); |
514 | slotUpdateToolbar(); // maybe some of the above could be moved there | 514 | slotUpdateToolbar(); // maybe some of the above could be moved there |
515 | showList(); | 515 | showList(); |
516 | return; | 516 | return; |
517 | } | 517 | } |
518 | 518 | ||
519 | // XXX need to disable some QActions. | 519 | // XXX need to disable some QActions. |
520 | actionNew->setEnabled(FALSE); | 520 | actionNew->setEnabled(FALSE); |
521 | actionTrash->setEnabled(FALSE); | 521 | actionTrash->setEnabled(FALSE); |
522 | actionFind->setEnabled(FALSE); | 522 | actionFind->setEnabled(FALSE); |
523 | actionMail->setEnabled(FALSE); | 523 | actionMail->setEnabled(FALSE); |
524 | 524 | ||
525 | setCaption( tr("Contacts - My Personal Details") ); | 525 | setCaption( tr("Contacts - My Personal Details") ); |
526 | QString filename = addressbookPersonalVCardName(); | 526 | QString filename = addressbookPersonalVCardName(); |
527 | Contact me; | 527 | Contact me; |
528 | if (QFile::exists(filename)) | 528 | if (QFile::exists(filename)) |
529 | me = Contact::readVCard( filename )[0]; | 529 | me = Contact::readVCard( filename )[0]; |
530 | 530 | ||
531 | abView()->init( me ); | 531 | abView()->init( me ); |
532 | abView()->sync(); | 532 | abView()->sync(); |
533 | abList->hide(); | 533 | abList->hide(); |
534 | setCentralWidget( abView() ); | 534 | setCentralWidget( abView() ); |
535 | mView->show(); | 535 | mView->show(); |
536 | mView->setFocus(); | 536 | mView->setFocus(); |
537 | } | 537 | } |
538 | 538 | ||
539 | void AddressbookWindow::editEntry( EntryMode entryMode ) | 539 | void AddressbookWindow::editEntry( EntryMode entryMode ) |
540 | { | 540 | { |
541 | Contact entry; | 541 | Contact entry; |
542 | if ( bAbEditFirstTime ) { | 542 | if ( bAbEditFirstTime ) { |
543 | abEditor = new AbEditor( entry, &orderedFields, &slOrderedFields, | 543 | abEditor = new ContactEditor( entry, &orderedFields, &slOrderedFields, |
544 | this, "editor" ); | 544 | this, "editor" ); |
545 | bAbEditFirstTime = FALSE; | 545 | bAbEditFirstTime = FALSE; |
546 | if ( entryMode == EditEntry ) | 546 | if ( entryMode == EditEntry ) |
547 | abEditor->setEntry( abList->currentEntry() ); | 547 | abEditor->setEntry( abList->currentEntry() ); |
548 | } | 548 | } |
549 | // other things may chane the caption. | 549 | // other things may chane the caption. |
550 | abEditor->setCaption( tr("Edit Address") ); | 550 | abEditor->setCaption( tr("Edit Address") ); |
551 | 551 | ||
552 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) | 552 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) |
553 | abEditor->showMaximized(); | 553 | abEditor->showMaximized(); |
554 | #endif | 554 | #endif |
555 | // fix the foxus... | 555 | // fix the foxus... |
556 | abEditor->setNameFocus(); | 556 | abEditor->setNameFocus(); |
557 | if ( abEditor->exec() ) { | 557 | if ( abEditor->exec() ) { |
558 | setFocus(); | 558 | setFocus(); |
559 | if ( entryMode == NewEntry ) { | 559 | if ( entryMode == NewEntry ) { |
560 | Contact insertEntry = abEditor->entry(); | 560 | Contact insertEntry = abEditor->entry(); |
561 | insertEntry.assignUid(); | 561 | insertEntry.assignUid(); |
562 | abList->addEntry( insertEntry ); | 562 | abList->addEntry( insertEntry ); |
563 | } else { | 563 | } else { |
564 | Contact replaceEntry = abEditor->entry(); | 564 | Contact replaceEntry = abEditor->entry(); |
565 | if ( !replaceEntry.isValidUid() ) | 565 | if ( !replaceEntry.isValidUid() ) |
566 | replaceEntry.assignUid(); | 566 | replaceEntry.assignUid(); |
567 | abList->replaceCurrentEntry( replaceEntry ); | 567 | abList->replaceCurrentEntry( replaceEntry ); |
568 | } | 568 | } |
569 | } | 569 | } |
570 | populateCategories(); | 570 | populateCategories(); |
571 | showList(); | 571 | showList(); |
572 | } | 572 | } |
573 | 573 | ||
574 | void AddressbookWindow::listIsEmpty( bool empty ) | 574 | void AddressbookWindow::listIsEmpty( bool empty ) |
575 | { | 575 | { |
576 | if ( !empty ) { | 576 | if ( !empty ) { |
577 | deleteButton->setEnabled( TRUE ); | 577 | deleteButton->setEnabled( TRUE ); |
578 | } | 578 | } |
579 | } | 579 | } |
580 | 580 | ||
581 | void AddressbookWindow::reload() | 581 | void AddressbookWindow::reload() |
582 | { | 582 | { |
583 | syncing = FALSE; | 583 | syncing = FALSE; |
584 | abList->clear(); | 584 | abList->clear(); |
585 | abList->load( addressbookXMLFilename() ); | 585 | abList->load( addressbookXMLFilename() ); |
586 | } | 586 | } |
587 | 587 | ||
588 | void AddressbookWindow::flush() | 588 | void AddressbookWindow::flush() |
589 | { | 589 | { |
590 | syncing = TRUE; | 590 | syncing = TRUE; |
591 | abList->save( addressbookXMLFilename() ); | 591 | abList->save( addressbookXMLFilename() ); |
592 | } | 592 | } |
593 | 593 | ||
594 | 594 | ||
595 | void AddressbookWindow::closeEvent( QCloseEvent *e ) | 595 | void AddressbookWindow::closeEvent( QCloseEvent *e ) |
596 | { | 596 | { |
597 | if ( centralWidget() == mView ) { | 597 | if ( centralWidget() == mView ) { |
598 | if (actionPersonal->isOn()) { | 598 | if (actionPersonal->isOn()) { |
599 | // pretend we clicked it off | 599 | // pretend we clicked it off |
600 | actionPersonal->setOn(FALSE); | 600 | actionPersonal->setOn(FALSE); |
601 | slotPersonalView(); | 601 | slotPersonalView(); |
602 | } else { | 602 | } else { |
603 | showList(); | 603 | showList(); |
604 | } | 604 | } |
605 | e->ignore(); | 605 | e->ignore(); |
606 | return; | 606 | return; |
607 | } | 607 | } |
608 | 608 | ||
609 | if(syncing) { | 609 | if(syncing) { |
610 | /* shouldn't we save, I hear you say? well its already been set | 610 | /* shouldn't we save, I hear you say? well its already been set |
611 | so that an edit can not occur during a sync, and we flushed | 611 | so that an edit can not occur during a sync, and we flushed |
612 | at the start of the sync, so there is no need to save | 612 | at the start of the sync, so there is no need to save |
613 | Saving however itself would cause problems. */ | 613 | Saving however itself would cause problems. */ |
614 | e->accept(); | 614 | e->accept(); |
615 | return; | 615 | return; |
616 | } | 616 | } |
617 | //################## shouldn't always save | 617 | //################## shouldn't always save |
618 | if ( save() ) | 618 | if ( save() ) |
619 | e->accept(); | 619 | e->accept(); |
620 | else | 620 | else |
621 | e->ignore(); | 621 | e->ignore(); |
622 | } | 622 | } |
623 | 623 | ||
624 | /* | 624 | /* |
625 | Returns TRUE if it is OK to exit | 625 | Returns TRUE if it is OK to exit |
626 | */ | 626 | */ |
627 | 627 | ||
628 | bool AddressbookWindow::save() | 628 | bool AddressbookWindow::save() |
629 | { | 629 | { |
630 | QString str = addressbookXMLFilename(); | 630 | QString str = addressbookXMLFilename(); |
631 | if ( str.isNull() ) { | 631 | if ( str.isNull() ) { |
632 | if ( QMessageBox::critical( 0, tr("Out of space"), | 632 | if ( QMessageBox::critical( 0, tr("Out of space"), |
633 | tr("Unable to save information.\n" | 633 | tr("Unable to save information.\n" |
634 | "Free up some space\n" | 634 | "Free up some space\n" |
635 | "and try again.\n" | 635 | "and try again.\n" |
636 | "\nQuit anyway?"), | 636 | "\nQuit anyway?"), |
637 | QMessageBox::Yes|QMessageBox::Escape, | 637 | QMessageBox::Yes|QMessageBox::Escape, |
638 | QMessageBox::No|QMessageBox::Default ) | 638 | QMessageBox::No|QMessageBox::Default ) |
639 | != QMessageBox::No ) | 639 | != QMessageBox::No ) |
640 | return TRUE; | 640 | return TRUE; |
641 | else | 641 | else |
642 | return FALSE; | 642 | return FALSE; |
643 | } else { | 643 | } else { |
644 | if ( !abList->save( str ) ) { | 644 | if ( !abList->save( str ) ) { |
645 | if ( QMessageBox::critical( 0, tr( "Out of space" ), | 645 | if ( QMessageBox::critical( 0, tr( "Out of space" ), |
646 | tr("Unable to save information.\n" | 646 | tr("Unable to save information.\n" |
647 | "Free up some space\n" | 647 | "Free up some space\n" |
648 | "and try again.\n" | 648 | "and try again.\n" |
649 | "\nQuit anyway?"), | 649 | "\nQuit anyway?"), |
650 | QMessageBox::Yes|QMessageBox::Escape, | 650 | QMessageBox::Yes|QMessageBox::Escape, |
651 | QMessageBox::No|QMessageBox::Default ) | 651 | QMessageBox::No|QMessageBox::Default ) |
652 | != QMessageBox::No ) | 652 | != QMessageBox::No ) |
653 | return TRUE; | 653 | return TRUE; |
654 | else | 654 | else |
655 | return FALSE; | 655 | return FALSE; |
656 | } | 656 | } |
657 | } | 657 | } |
658 | return TRUE; | 658 | return TRUE; |
659 | } | 659 | } |
660 | 660 | ||
661 | void AddressbookWindow::slotSettings() | 661 | void AddressbookWindow::slotSettings() |
662 | { | 662 | { |
663 | AddressSettings frmSettings( this ); | 663 | AddressSettings frmSettings( this ); |
664 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) | 664 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) |
665 | frmSettings.showMaximized(); | 665 | frmSettings.showMaximized(); |
666 | #endif | 666 | #endif |
667 | 667 | ||
668 | if ( frmSettings.exec() ) { | 668 | if ( frmSettings.exec() ) { |
669 | allFields.clear(); | 669 | allFields.clear(); |
670 | orderedFields.clear(); | 670 | orderedFields.clear(); |
671 | slOrderedFields.clear(); | 671 | slOrderedFields.clear(); |
672 | initFields(); | 672 | initFields(); |
673 | if ( abEditor ) | 673 | if ( abEditor ) |
674 | abEditor->loadFields(); | 674 | abEditor->loadFields(); |
675 | abList->refresh(); | 675 | abList->refresh(); |
676 | } | 676 | } |
677 | } | 677 | } |
678 | 678 | ||
679 | 679 | ||
680 | void AddressbookWindow::initFields() | 680 | void AddressbookWindow::initFields() |
681 | { | 681 | { |
682 | // we really don't need the things from the configuration, anymore | 682 | // we really don't need the things from the configuration, anymore |
683 | // only thing that is important are the important categories. So, | 683 | // only thing that is important are the important categories. So, |
684 | // Call the contact functions that correspond to these old functions... | 684 | // Call the contact functions that correspond to these old functions... |
685 | 685 | ||
686 | QStringList xmlFields = Contact::fields(); | 686 | QStringList xmlFields = Contact::fields(); |
687 | QStringList visibleFields = Contact::trfields(); | 687 | QStringList visibleFields = Contact::trfields(); |
688 | xmlFields.remove( "Title" ); | 688 | xmlFields.remove( "Title" ); |
689 | visibleFields.remove( tr("Name Title") ); | 689 | visibleFields.remove( tr("Name Title") ); |
690 | visibleFields.remove( tr("Notes") ); | 690 | visibleFields.remove( tr("Notes") ); |
691 | 691 | ||
692 | int i, | 692 | int i, |
693 | version; | 693 | version; |
694 | Config cfg( "AddressBook" ); | 694 | Config cfg( "AddressBook" ); |
695 | QString zn; | 695 | QString zn; |
696 | 696 | ||
697 | // ### Write a function to keep this from happening again... | 697 | // ### Write a function to keep this from happening again... |
698 | QStringList::ConstIterator it; | 698 | QStringList::ConstIterator it; |
699 | for ( i = 0, it = xmlFields.begin(); it != xmlFields.end(); ++it, i++ ) { | 699 | for ( i = 0, it = xmlFields.begin(); it != xmlFields.end(); ++it, i++ ) { |
700 | allFields.append( i + 3 ); | 700 | allFields.append( i + 3 ); |
701 | } | 701 | } |
702 | 702 | ||
703 | cfg.setGroup( "Version" ); | 703 | cfg.setGroup( "Version" ); |
704 | version = cfg.readNumEntry( "version" ); | 704 | version = cfg.readNumEntry( "version" ); |
705 | i = 0; | 705 | i = 0; |
706 | if ( version >= ADDRESSVERSION ) { | 706 | if ( version >= ADDRESSVERSION ) { |
707 | 707 | ||
708 | cfg.setGroup( "ImportantCategory" ); | 708 | cfg.setGroup( "ImportantCategory" ); |
709 | 709 | ||
710 | zn = cfg.readEntry( "Category" + QString::number(i), QString::null ); | 710 | zn = cfg.readEntry( "Category" + QString::number(i), QString::null ); |
711 | while ( !zn.isNull() ) { | 711 | while ( !zn.isNull() ) { |
712 | if ( zn.contains( tr("Work") ) || zn.contains( tr("Mb") ) ) { | 712 | if ( zn.contains( tr("Work") ) || zn.contains( tr("Mb") ) ) { |
713 | slOrderedFields.clear(); | 713 | slOrderedFields.clear(); |
714 | break; | 714 | break; |
715 | } | 715 | } |
716 | slOrderedFields.append( zn ); | 716 | slOrderedFields.append( zn ); |
717 | zn = cfg.readEntry( "Category" + QString::number(++i), QString::null ); | 717 | zn = cfg.readEntry( "Category" + QString::number(++i), QString::null ); |
718 | } | 718 | } |
719 | } else { | 719 | } else { |
720 | QString str; | 720 | QString str; |
721 | str = getenv("HOME"); | 721 | str = getenv("HOME"); |
722 | str += "/Settings/AddressBook.conf"; | 722 | str += "/Settings/AddressBook.conf"; |
723 | QFile::remove( str ); | 723 | QFile::remove( str ); |
724 | } | 724 | } |
725 | if ( slOrderedFields.count() > 0 ) { | 725 | if ( slOrderedFields.count() > 0 ) { |
726 | for( QStringList::ConstIterator it = slOrderedFields.begin(); | 726 | for( QStringList::ConstIterator it = slOrderedFields.begin(); |
727 | it != slOrderedFields.end(); ++it ) { | 727 | it != slOrderedFields.end(); ++it ) { |
728 | QValueList<int>::ConstIterator itVl; | 728 | QValueList<int>::ConstIterator itVl; |
729 | QStringList::ConstIterator itVis; | 729 | QStringList::ConstIterator itVis; |
730 | itVl = allFields.begin(); | 730 | itVl = allFields.begin(); |
731 | for ( itVis = visibleFields.begin(); | 731 | for ( itVis = visibleFields.begin(); |
732 | itVis != visibleFields.end() && itVl != allFields.end(); | 732 | itVis != visibleFields.end() && itVl != allFields.end(); |
733 | ++itVis, ++itVl ) { | 733 | ++itVis, ++itVl ) { |
734 | if ( *it == *itVis && itVl != allFields.end() ) { | 734 | if ( *it == *itVis && itVl != allFields.end() ) { |
735 | orderedFields.append( *itVl ); | 735 | orderedFields.append( *itVl ); |
736 | } | 736 | } |
737 | } | 737 | } |
738 | } | 738 | } |
739 | } else { | 739 | } else { |
740 | QValueList<int>::ConstIterator it; | 740 | QValueList<int>::ConstIterator it; |
741 | for ( it = allFields.begin(); it != allFields.end(); ++it ) | 741 | for ( it = allFields.begin(); it != allFields.end(); ++it ) |
742 | orderedFields.append( *it ); | 742 | orderedFields.append( *it ); |
743 | 743 | ||
744 | slOrderedFields = visibleFields; | 744 | slOrderedFields = visibleFields; |
745 | orderedFields.remove( Qtopia::AddressUid ); | 745 | orderedFields.remove( Qtopia::AddressUid ); |
746 | orderedFields.remove( Qtopia::Title ); | 746 | orderedFields.remove( Qtopia::Title ); |
747 | orderedFields.remove( Qtopia::Groups ); | 747 | orderedFields.remove( Qtopia::Groups ); |
748 | orderedFields.remove( Qtopia::AddressCategory ); | 748 | orderedFields.remove( Qtopia::AddressCategory ); |
749 | orderedFields.remove( Qtopia::FirstName ); | 749 | orderedFields.remove( Qtopia::FirstName ); |
750 | orderedFields.remove( Qtopia::LastName ); | 750 | orderedFields.remove( Qtopia::LastName ); |
751 | orderedFields.remove( Qtopia::DefaultEmail ); | 751 | orderedFields.remove( Qtopia::DefaultEmail ); |
752 | orderedFields.remove( Qtopia::FileAs ); | 752 | orderedFields.remove( Qtopia::FileAs ); |
753 | orderedFields.remove( Qtopia::Notes ); | 753 | orderedFields.remove( Qtopia::Notes ); |
754 | orderedFields.remove( Qtopia::Gender ); | 754 | orderedFields.remove( Qtopia::Gender ); |
755 | slOrderedFields.remove( tr("Name Title") ); | 755 | slOrderedFields.remove( tr("Name Title") ); |
756 | slOrderedFields.remove( tr("First Name") ); | 756 | slOrderedFields.remove( tr("First Name") ); |
757 | slOrderedFields.remove( tr("Last Name") ); | 757 | slOrderedFields.remove( tr("Last Name") ); |
758 | slOrderedFields.remove( tr("File As") ); | 758 | slOrderedFields.remove( tr("File As") ); |
759 | slOrderedFields.remove( tr("Default Email") ); | 759 | slOrderedFields.remove( tr("Default Email") ); |
760 | slOrderedFields.remove( tr("Notes") ); | 760 | slOrderedFields.remove( tr("Notes") ); |
761 | slOrderedFields.remove( tr("Gender") ); | 761 | slOrderedFields.remove( tr("Gender") ); |
762 | 762 | ||
763 | } | 763 | } |
764 | } | 764 | } |
765 | 765 | ||
766 | 766 | ||
767 | AbLabel *AddressbookWindow::abView() | 767 | AbLabel *AddressbookWindow::abView() |
768 | { | 768 | { |
769 | if ( !mView ) { | 769 | if ( !mView ) { |
770 | mView = new AbLabel( this, "viewer" ); | 770 | mView = new AbLabel( this, "viewer" ); |
771 | mView->init( Contact() ); | 771 | mView->init( Contact() ); |
772 | connect( mView, SIGNAL( okPressed() ), this, SLOT( slotListView() ) ); | 772 | connect( mView, SIGNAL( okPressed() ), this, SLOT( slotListView() ) ); |
773 | } | 773 | } |
774 | return mView; | 774 | return mView; |
775 | } | 775 | } |
776 | 776 | ||
777 | void AddressbookWindow::slotFind() | 777 | void AddressbookWindow::slotFind() |
778 | { | 778 | { |
779 | if ( centralWidget() == abView() ) | 779 | if ( centralWidget() == abView() ) |
780 | showList(); | 780 | showList(); |
781 | FindDialog frmFind( "Contacts", this ); | 781 | FindDialog frmFind( "Contacts", this ); |
782 | QObject::connect( &frmFind, SIGNAL(signalFindClicked(const QString &, bool, bool, int)), abList, SLOT(slotDoFind( const QString&,bool,bool,int))); | 782 | QObject::connect( &frmFind, SIGNAL(signalFindClicked(const QString &, bool, bool, int)), abList, SLOT(slotDoFind( const QString&,bool,bool,int))); |
783 | QObject::connect( abList, SIGNAL(signalNotFound()), &frmFind, SLOT(slotNotFound()) ); | 783 | QObject::connect( abList, SIGNAL(signalNotFound()), &frmFind, SLOT(slotNotFound()) ); |
784 | QObject::connect( abList, SIGNAL(signalWrapAround()), &frmFind, SLOT(slotWrapAround()) ); | 784 | QObject::connect( abList, SIGNAL(signalWrapAround()), &frmFind, SLOT(slotWrapAround()) ); |
785 | frmFind.exec(); | 785 | frmFind.exec(); |
786 | if ( abList->numSelections() ) | 786 | if ( abList->numSelections() ) |
787 | abList->clearSelection(); | 787 | abList->clearSelection(); |
788 | abList->clearFindRow(); | 788 | abList->clearFindRow(); |
789 | } | 789 | } |
790 | 790 | ||
791 | void AddressbookWindow::slotSetCategory( int c ) | 791 | void AddressbookWindow::slotSetCategory( int c ) |
792 | { | 792 | { |
793 | if ( c <= 0 ) | 793 | if ( c <= 0 ) |
794 | return; | 794 | return; |
795 | for ( unsigned int i = 1; i < catMenu->count(); i++ ) | 795 | for ( unsigned int i = 1; i < catMenu->count(); i++ ) |
796 | catMenu->setItemChecked( i, c == (int)i ); | 796 | catMenu->setItemChecked( i, c == (int)i ); |
797 | if ( c == 1 ) { | 797 | if ( c == 1 ) { |
798 | abList->setShowCategory( QString::null ); | 798 | abList->setShowCategory( QString::null ); |
799 | setCaption( tr("Contacts") + " - " + tr ( "All" ) ); | 799 | setCaption( tr("Contacts") + " - " + tr ( "All" ) ); |
800 | } else if ( c == (int)catMenu->count() ) { | 800 | } else if ( c == (int)catMenu->count() ) { |
801 | abList->setShowCategory( tr( "Unfiled" ) ); | 801 | abList->setShowCategory( tr( "Unfiled" ) ); |
802 | setCaption( tr("Contacts") + " - " + tr( "Unfiled" ) ); | 802 | setCaption( tr("Contacts") + " - " + tr( "Unfiled" ) ); |
803 | } else { | 803 | } else { |
804 | QString cat = abList->categories()[c - 2]; | 804 | QString cat = abList->categories()[c - 2]; |
805 | abList->setShowCategory( cat ); | 805 | abList->setShowCategory( cat ); |
806 | setCaption( tr("Contacts") + " - " + cat ); | 806 | setCaption( tr("Contacts") + " - " + cat ); |
807 | } | 807 | } |
808 | } | 808 | } |
809 | 809 | ||
810 | void AddressbookWindow::populateCategories() | 810 | void AddressbookWindow::populateCategories() |
811 | { | 811 | { |
812 | catMenu->clear(); | 812 | catMenu->clear(); |
813 | 813 | ||
814 | int id, | 814 | int id, |
815 | rememberId; | 815 | rememberId; |
816 | id = 1; | 816 | id = 1; |
817 | catMenu->insertItem( tr( "All" ), id++ ); | 817 | catMenu->insertItem( tr( "All" ), id++ ); |
818 | QStringList categories = abList->categories(); | 818 | QStringList categories = abList->categories(); |
819 | categories.append( tr( "Unfiled" ) ); | 819 | categories.append( tr( "Unfiled" ) ); |
820 | for ( QStringList::Iterator it = categories.begin(); | 820 | for ( QStringList::Iterator it = categories.begin(); |
821 | it != categories.end(); ++it ) { | 821 | it != categories.end(); ++it ) { |
822 | catMenu->insertItem( *it, id ); | 822 | catMenu->insertItem( *it, id ); |
823 | if ( *it == abList->showCategory() ) | 823 | if ( *it == abList->showCategory() ) |
824 | rememberId = id; | 824 | rememberId = id; |
825 | ++id; | 825 | ++id; |
826 | } | 826 | } |
827 | if ( abList->showCategory().isEmpty() ) | 827 | if ( abList->showCategory().isEmpty() ) |
828 | slotSetCategory( 1 ); | 828 | slotSetCategory( 1 ); |
829 | else | 829 | else |
830 | slotSetCategory( rememberId ); | 830 | slotSetCategory( rememberId ); |
831 | } | 831 | } |
diff --git a/core/pim/addressbook/addressbook.h b/core/pim/addressbook/addressbook.h index 9694465..342077f 100644 --- a/core/pim/addressbook/addressbook.h +++ b/core/pim/addressbook/addressbook.h | |||
@@ -1,99 +1,99 @@ | |||
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 Addressbook_H | 20 | #ifndef Addressbook_H |
21 | #define Addressbook_H | 21 | #define Addressbook_H |
22 | 22 | ||
23 | #include <qmainwindow.h> | 23 | #include <qmainwindow.h> |
24 | 24 | ||
25 | class AbEditor; | 25 | class ContactEditor; |
26 | class AbLabel; | 26 | class AbLabel; |
27 | class AbTable; | 27 | class AbTable; |
28 | class QPEToolBar; | 28 | class QPEToolBar; |
29 | class QPopupMenu; | 29 | class QPopupMenu; |
30 | class QToolButton; | 30 | class QToolButton; |
31 | class QDialog; | 31 | class QDialog; |
32 | class Ir; | 32 | class Ir; |
33 | class QAction; | 33 | class QAction; |
34 | 34 | ||
35 | class AddressbookWindow: public QMainWindow | 35 | class AddressbookWindow: public QMainWindow |
36 | { | 36 | { |
37 | Q_OBJECT | 37 | Q_OBJECT |
38 | public: | 38 | public: |
39 | AddressbookWindow( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); | 39 | AddressbookWindow( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); |
40 | ~AddressbookWindow(); | 40 | ~AddressbookWindow(); |
41 | 41 | ||
42 | protected: | 42 | protected: |
43 | void resizeEvent( QResizeEvent * e ); | 43 | void resizeEvent( QResizeEvent * e ); |
44 | void showList(); | 44 | void showList(); |
45 | void showView(); | 45 | void showView(); |
46 | enum EntryMode { NewEntry=0, EditEntry }; | 46 | enum EntryMode { NewEntry=0, EditEntry }; |
47 | void editPersonal(); | 47 | void editPersonal(); |
48 | void editEntry( EntryMode ); | 48 | void editEntry( EntryMode ); |
49 | void closeEvent( QCloseEvent *e ); | 49 | void closeEvent( QCloseEvent *e ); |
50 | bool save(); | 50 | bool save(); |
51 | 51 | ||
52 | public slots: | 52 | public slots: |
53 | void flush(); | 53 | void flush(); |
54 | void reload(); | 54 | void reload(); |
55 | void appMessage(const QCString &, const QByteArray &); | 55 | void appMessage(const QCString &, const QByteArray &); |
56 | void setDocument( const QString & ); | 56 | void setDocument( const QString & ); |
57 | 57 | ||
58 | private slots: | 58 | private slots: |
59 | void slotListNew(); | 59 | void slotListNew(); |
60 | void slotListView(); | 60 | void slotListView(); |
61 | void slotListDelete(); | 61 | void slotListDelete(); |
62 | void slotViewBack(); | 62 | void slotViewBack(); |
63 | void slotViewEdit(); | 63 | void slotViewEdit(); |
64 | void slotPersonalView(); | 64 | void slotPersonalView(); |
65 | void listIsEmpty( bool ); | 65 | void listIsEmpty( bool ); |
66 | void slotSettings(); | 66 | void slotSettings(); |
67 | void writeMail(); | 67 | void writeMail(); |
68 | void slotBeam(); | 68 | void slotBeam(); |
69 | void beamDone( Ir * ); | 69 | void beamDone( Ir * ); |
70 | void slotFind(); | 70 | void slotFind(); |
71 | void slotSetCategory( int ); | 71 | void slotSetCategory( int ); |
72 | void slotUpdateToolbar(); | 72 | void slotUpdateToolbar(); |
73 | 73 | ||
74 | private: | 74 | private: |
75 | void initFields();// inititialize our fields... | 75 | void initFields();// inititialize our fields... |
76 | AbLabel *abView(); | 76 | AbLabel *abView(); |
77 | void populateCategories(); | 77 | void populateCategories(); |
78 | 78 | ||
79 | QPopupMenu *catMenu; | 79 | QPopupMenu *catMenu; |
80 | QPEToolBar *listTools; | 80 | QPEToolBar *listTools; |
81 | QToolButton *deleteButton; | 81 | QToolButton *deleteButton; |
82 | QValueList<int> allFields, | 82 | QValueList<int> allFields, |
83 | orderedFields; | 83 | orderedFields; |
84 | QStringList slOrderedFields; | 84 | QStringList slOrderedFields; |
85 | enum Panes { paneList=0, paneView, paneEdit }; | 85 | enum Panes { paneList=0, paneView, paneEdit }; |
86 | AbEditor *abEditor; | 86 | ContactEditor *abEditor; |
87 | AbLabel *mView; | 87 | AbLabel *mView; |
88 | AbTable *abList; | 88 | AbTable *abList; |
89 | 89 | ||
90 | QAction *actionNew, *actionEdit, *actionTrash, *actionFind, *actionBeam, | 90 | QAction *actionNew, *actionEdit, *actionTrash, *actionFind, *actionBeam, |
91 | *actionPersonal, *actionMail; | 91 | *actionPersonal, *actionMail; |
92 | 92 | ||
93 | bool bAbEditFirstTime; | 93 | bool bAbEditFirstTime; |
94 | int viewMargin; | 94 | int viewMargin; |
95 | 95 | ||
96 | bool syncing; | 96 | bool syncing; |
97 | }; | 97 | }; |
98 | 98 | ||
99 | #endif | 99 | #endif |
diff --git a/core/pim/addressbook/addressbook.pro b/core/pim/addressbook/addressbook.pro index 31de2a3..180b401 100644 --- a/core/pim/addressbook/addressbook.pro +++ b/core/pim/addressbook/addressbook.pro | |||
@@ -1,23 +1,23 @@ | |||
1 | TEMPLATE= app | 1 | TEMPLATE= app |
2 | CONFIG = qt warn_on release | 2 | CONFIG = qt warn_on release |
3 | DESTDIR = $(OPIEDIR)/bin | 3 | DESTDIR = $(OPIEDIR)/bin |
4 | HEADERS= addressbook.h \ | 4 | HEADERS= addressbook.h \ |
5 | abeditor.h \ | 5 | contacteditor.h \ |
6 | ablabel.h \ | 6 | ablabel.h \ |
7 | abtable.h \ | 7 | abtable.h \ |
8 | addresssettings.h | 8 | addresssettings.h |
9 | SOURCES= main.cpp \ | 9 | SOURCES= main.cpp \ |
10 | addressbook.cpp \ | 10 | addressbook.cpp \ |
11 | abeditor.cpp \ | 11 | contacteditor.cpp \ |
12 | ablabel.cpp \ | 12 | ablabel.cpp \ |
13 | abtable.cpp \ | 13 | abtable.cpp \ |
14 | addresssettings.cpp | 14 | addresssettings.cpp |
15 | INTERFACES= addresssettingsbase.ui | 15 | INTERFACES= addresssettingsbase.ui |
16 | 16 | ||
17 | TARGET = addressbook | 17 | TARGET = addressbook |
18 | INCLUDEPATH += $(OPIEDIR)/include | 18 | INCLUDEPATH += $(OPIEDIR)/include |
19 | DEPENDPATH+= $(OPIEDIR)/include | 19 | DEPENDPATH+= $(OPIEDIR)/include |
20 | LIBS += -lqpe | 20 | LIBS += -lqpe |
21 | 21 | ||
22 | TRANSLATIONS = ../i18n/de/addressbook.ts | 22 | TRANSLATIONS = ../i18n/de/addressbook.ts |
23 | TRANSLATIONS += ../i18n/pt_BR/addressbook.ts | 23 | TRANSLATIONS += ../i18n/pt_BR/addressbook.ts |