summaryrefslogtreecommitdiffabout
authorulf69 <ulf69>2004-07-09 08:12:00 (UTC)
committer ulf69 <ulf69>2004-07-09 08:12:00 (UTC)
commitaae8af24992bf3b7b59fb425955153b86f31bb5d (patch) (unidiff)
tree2ad2e501a14c5a96bf5c7deebd3638bed405350e
parentde99e22a7093e857ee3c08a67ccc389d6374099a (diff)
downloadkdepimpi-aae8af24992bf3b7b59fb425955153b86f31bb5d.zip
kdepimpi-aae8af24992bf3b7b59fb425955153b86f31bb5d.tar.gz
kdepimpi-aae8af24992bf3b7b59fb425955153b86f31bb5d.tar.bz2
IntDateFormat is now an enum instead of an ionteger value
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/field.cpp8
-rw-r--r--kabc/plugins/opie/resourceopie.cpp16
-rw-r--r--kabc/plugins/opie/resourceopieconfig.cpp11
-rw-r--r--kabc/plugins/opie/resourceopieconfig.h3
4 files changed, 20 insertions, 18 deletions
diff --git a/kabc/field.cpp b/kabc/field.cpp
index bc2e176..e27970e 100644
--- a/kabc/field.cpp
+++ b/kabc/field.cpp
@@ -1,566 +1,566 @@
1/*** Warning! This file has been generated by the script makeaddressee ***/ 1/*** Warning! This file has been generated by the script makeaddressee ***/
2/* 2/*
3 This file is part of libkabc. 3 This file is part of libkabc.
4 Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> 4 Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org>
5 5
6 This library is free software; you can redistribute it and/or 6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public 7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either 8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version. 9 version 2 of the License, or (at your option) any later version.
10 10
11 This library is distributed in the hope that it will be useful, 11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details. 14 Library General Public License for more details.
15 15
16 You should have received a copy of the GNU Library General Public License 16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to 17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. 19 Boston, MA 02111-1307, USA.
20*/ 20*/
21 21
22/* 22/*
23Enhanced Version of the file for platform independent KDE tools. 23Enhanced Version of the file for platform independent KDE tools.
24Copyright (c) 2004 Ulf Schenk 24Copyright (c) 2004 Ulf Schenk
25 25
26$Id$ 26$Id$
27*/ 27*/
28 28
29#include <klocale.h> 29#include <klocale.h>
30#include <kconfig.h> 30#include <kconfig.h>
31#include <kconfigbase.h> 31#include <kconfigbase.h>
32#include <kglobal.h> 32#include <kglobal.h>
33 33
34#include "field.h" 34#include "field.h"
35#include "resource.h" 35#include "resource.h"
36 36
37using namespace KABC; 37using namespace KABC;
38 38
39class Field::FieldImpl 39class Field::FieldImpl
40{ 40{
41 public: 41 public:
42 FieldImpl( int fieldId, int category = 0, 42 FieldImpl( int fieldId, int category = 0,
43 const QString &label = QString::null, 43 const QString &label = QString::null,
44 const QString &key = QString::null, 44 const QString &key = QString::null,
45 const QString &app = QString::null ) 45 const QString &app = QString::null )
46 : mFieldId( fieldId ), mCategory( category ), mLabel( label ), 46 : mFieldId( fieldId ), mCategory( category ), mLabel( label ),
47 mKey( key ), mApp( app ) {} 47 mKey( key ), mApp( app ) {}
48 48
49 enum FieldId 49 enum FieldId
50 { 50 {
51 CustomField, 51 CustomField,
52 FormattedName, 52 FormattedName,
53 FamilyName, 53 FamilyName,
54 GivenName, 54 GivenName,
55 AdditionalName, 55 AdditionalName,
56 Prefix, 56 Prefix,
57 Suffix, 57 Suffix,
58 NickName, 58 NickName,
59 Birthday, 59 Birthday,
60 HomeAddressStreet, 60 HomeAddressStreet,
61 HomeAddressLocality, 61 HomeAddressLocality,
62 HomeAddressRegion, 62 HomeAddressRegion,
63 HomeAddressPostalCode, 63 HomeAddressPostalCode,
64 HomeAddressCountry, 64 HomeAddressCountry,
65 HomeAddressLabel, 65 HomeAddressLabel,
66 BusinessAddressStreet, 66 BusinessAddressStreet,
67 BusinessAddressLocality, 67 BusinessAddressLocality,
68 BusinessAddressRegion, 68 BusinessAddressRegion,
69 BusinessAddressPostalCode, 69 BusinessAddressPostalCode,
70 BusinessAddressCountry, 70 BusinessAddressCountry,
71 BusinessAddressLabel, 71 BusinessAddressLabel,
72 HomePhone, 72 HomePhone,
73 BusinessPhone, 73 BusinessPhone,
74 MobilePhone, 74 MobilePhone,
75 HomeFax, 75 HomeFax,
76 BusinessFax, 76 BusinessFax,
77 CarPhone, 77 CarPhone,
78 Isdn, 78 Isdn,
79 Pager, 79 Pager,
80 Email, 80 Email,
81 Mailer, 81 Mailer,
82 Title, 82 Title,
83 Role, 83 Role,
84 Organization, 84 Organization,
85 Note, 85 Note,
86 Url, 86 Url,
87 Resource 87 Resource
88 }; 88 };
89 89
90 int fieldId() { return mFieldId; } 90 int fieldId() { return mFieldId; }
91 int category() { return mCategory; } 91 int category() { return mCategory; }
92 92
93 QString label() { return mLabel; } 93 QString label() { return mLabel; }
94 QString key() { return mKey; } 94 QString key() { return mKey; }
95 QString app() { return mApp; } 95 QString app() { return mApp; }
96 96
97 private: 97 private:
98 int mFieldId; 98 int mFieldId;
99 int mCategory; 99 int mCategory;
100 100
101 QString mLabel; 101 QString mLabel;
102 QString mKey; 102 QString mKey;
103 QString mApp; 103 QString mApp;
104}; 104};
105 105
106 106
107Field::List Field::mAllFields; 107Field::List Field::mAllFields;
108Field::List Field::mDefaultFields; 108Field::List Field::mDefaultFields;
109Field::List Field::mCustomFields; 109Field::List Field::mCustomFields;
110 110
111 111
112Field::Field( FieldImpl *impl ) 112Field::Field( FieldImpl *impl )
113{ 113{
114 mImpl = impl; 114 mImpl = impl;
115} 115}
116 116
117Field::~Field() 117Field::~Field()
118{ 118{
119 delete mImpl; 119 delete mImpl;
120} 120}
121 121
122QString Field::label() 122QString Field::label()
123{ 123{
124 switch ( mImpl->fieldId() ) { 124 switch ( mImpl->fieldId() ) {
125 case FieldImpl::FormattedName: 125 case FieldImpl::FormattedName:
126 return Addressee::formattedNameLabel(); 126 return Addressee::formattedNameLabel();
127 case FieldImpl::FamilyName: 127 case FieldImpl::FamilyName:
128 return Addressee::familyNameLabel(); 128 return Addressee::familyNameLabel();
129 case FieldImpl::GivenName: 129 case FieldImpl::GivenName:
130 return Addressee::givenNameLabel(); 130 return Addressee::givenNameLabel();
131 case FieldImpl::AdditionalName: 131 case FieldImpl::AdditionalName:
132 return Addressee::additionalNameLabel(); 132 return Addressee::additionalNameLabel();
133 case FieldImpl::Prefix: 133 case FieldImpl::Prefix:
134 return Addressee::prefixLabel(); 134 return Addressee::prefixLabel();
135 case FieldImpl::Suffix: 135 case FieldImpl::Suffix:
136 return Addressee::suffixLabel(); 136 return Addressee::suffixLabel();
137 case FieldImpl::NickName: 137 case FieldImpl::NickName:
138 return Addressee::nickNameLabel(); 138 return Addressee::nickNameLabel();
139 case FieldImpl::Birthday: 139 case FieldImpl::Birthday:
140 return Addressee::birthdayLabel(); 140 return Addressee::birthdayLabel();
141 case FieldImpl::HomeAddressStreet: 141 case FieldImpl::HomeAddressStreet:
142 return Addressee::homeAddressStreetLabel(); 142 return Addressee::homeAddressStreetLabel();
143 case FieldImpl::HomeAddressLocality: 143 case FieldImpl::HomeAddressLocality:
144 return Addressee::homeAddressLocalityLabel(); 144 return Addressee::homeAddressLocalityLabel();
145 case FieldImpl::HomeAddressRegion: 145 case FieldImpl::HomeAddressRegion:
146 return Addressee::homeAddressRegionLabel(); 146 return Addressee::homeAddressRegionLabel();
147 case FieldImpl::HomeAddressPostalCode: 147 case FieldImpl::HomeAddressPostalCode:
148 return Addressee::homeAddressPostalCodeLabel(); 148 return Addressee::homeAddressPostalCodeLabel();
149 case FieldImpl::HomeAddressCountry: 149 case FieldImpl::HomeAddressCountry:
150 return Addressee::homeAddressCountryLabel(); 150 return Addressee::homeAddressCountryLabel();
151 case FieldImpl::HomeAddressLabel: 151 case FieldImpl::HomeAddressLabel:
152 return Addressee::homeAddressLabelLabel(); 152 return Addressee::homeAddressLabelLabel();
153 case FieldImpl::BusinessAddressStreet: 153 case FieldImpl::BusinessAddressStreet:
154 return Addressee::businessAddressStreetLabel(); 154 return Addressee::businessAddressStreetLabel();
155 case FieldImpl::BusinessAddressLocality: 155 case FieldImpl::BusinessAddressLocality:
156 return Addressee::businessAddressLocalityLabel(); 156 return Addressee::businessAddressLocalityLabel();
157 case FieldImpl::BusinessAddressRegion: 157 case FieldImpl::BusinessAddressRegion:
158 return Addressee::businessAddressRegionLabel(); 158 return Addressee::businessAddressRegionLabel();
159 case FieldImpl::BusinessAddressPostalCode: 159 case FieldImpl::BusinessAddressPostalCode:
160 return Addressee::businessAddressPostalCodeLabel(); 160 return Addressee::businessAddressPostalCodeLabel();
161 case FieldImpl::BusinessAddressCountry: 161 case FieldImpl::BusinessAddressCountry:
162 return Addressee::businessAddressCountryLabel(); 162 return Addressee::businessAddressCountryLabel();
163 case FieldImpl::BusinessAddressLabel: 163 case FieldImpl::BusinessAddressLabel:
164 return Addressee::businessAddressLabelLabel(); 164 return Addressee::businessAddressLabelLabel();
165 case FieldImpl::HomePhone: 165 case FieldImpl::HomePhone:
166 return Addressee::homePhoneLabel(); 166 return Addressee::homePhoneLabel();
167 case FieldImpl::BusinessPhone: 167 case FieldImpl::BusinessPhone:
168 return Addressee::businessPhoneLabel(); 168 return Addressee::businessPhoneLabel();
169 case FieldImpl::MobilePhone: 169 case FieldImpl::MobilePhone:
170 return Addressee::mobilePhoneLabel(); 170 return Addressee::mobilePhoneLabel();
171 case FieldImpl::HomeFax: 171 case FieldImpl::HomeFax:
172 return Addressee::homeFaxLabel(); 172 return Addressee::homeFaxLabel();
173 case FieldImpl::BusinessFax: 173 case FieldImpl::BusinessFax:
174 return Addressee::businessFaxLabel(); 174 return Addressee::businessFaxLabel();
175 case FieldImpl::CarPhone: 175 case FieldImpl::CarPhone:
176 return Addressee::carPhoneLabel(); 176 return Addressee::carPhoneLabel();
177 case FieldImpl::Isdn: 177 case FieldImpl::Isdn:
178 return Addressee::isdnLabel(); 178 return Addressee::isdnLabel();
179 case FieldImpl::Pager: 179 case FieldImpl::Pager:
180 return Addressee::pagerLabel(); 180 return Addressee::pagerLabel();
181 case FieldImpl::Email: 181 case FieldImpl::Email:
182 return Addressee::emailLabel(); 182 return Addressee::emailLabel();
183 case FieldImpl::Mailer: 183 case FieldImpl::Mailer:
184 return Addressee::mailerLabel(); 184 return Addressee::mailerLabel();
185 case FieldImpl::Title: 185 case FieldImpl::Title:
186 return Addressee::titleLabel(); 186 return Addressee::titleLabel();
187 case FieldImpl::Role: 187 case FieldImpl::Role:
188 return Addressee::roleLabel(); 188 return Addressee::roleLabel();
189 case FieldImpl::Organization: 189 case FieldImpl::Organization:
190 return Addressee::organizationLabel(); 190 return Addressee::organizationLabel();
191 case FieldImpl::Note: 191 case FieldImpl::Note:
192 return Addressee::noteLabel(); 192 return Addressee::noteLabel();
193 case FieldImpl::Url: 193 case FieldImpl::Url:
194 return Addressee::urlLabel(); 194 return Addressee::urlLabel();
195 case FieldImpl::Resource: 195 case FieldImpl::Resource:
196 return Addressee::resourceLabel(); 196 return Addressee::resourceLabel();
197 case FieldImpl::CustomField: 197 case FieldImpl::CustomField:
198 return mImpl->label(); 198 return mImpl->label();
199 default: 199 default:
200 return i18n("Unknown Field"); 200 return i18n("Unknown Field");
201 } 201 }
202} 202}
203 203
204int Field::category() 204int Field::category()
205{ 205{
206 return mImpl->category(); 206 return mImpl->category();
207} 207}
208 208
209QString Field::categoryLabel( int category ) 209QString Field::categoryLabel( int category )
210{ 210{
211 switch ( category ) { 211 switch ( category ) {
212 case All: 212 case All:
213 return i18n("All"); 213 return i18n("All");
214 case Frequent: 214 case Frequent:
215 return i18n("Frequent"); 215 return i18n("Frequent");
216 case Address: 216 case Address:
217 return i18n("Address"); 217 return i18n("Address");
218 case Email: 218 case Email:
219 return i18n("Email"); 219 return i18n("Email");
220 case Personal: 220 case Personal:
221 return i18n("Personal"); 221 return i18n("Personal");
222 case Organization: 222 case Organization:
223 return i18n("Organization"); 223 return i18n("Organization");
224 case CustomCategory: 224 case CustomCategory:
225 return i18n("Custom"); 225 return i18n("Custom");
226 default: 226 default:
227 return i18n("Undefined"); 227 return i18n("Undefined");
228 } 228 }
229} 229}
230 230
231QString Field::value( const KABC::Addressee &a ) 231QString Field::value( const KABC::Addressee &a )
232{ 232{
233 switch ( mImpl->fieldId() ) { 233 switch ( mImpl->fieldId() ) {
234 case FieldImpl::FormattedName: 234 case FieldImpl::FormattedName:
235 return a.formattedName(); 235 return a.formattedName();
236 case FieldImpl::FamilyName: 236 case FieldImpl::FamilyName:
237 return a.familyName(); 237 return a.familyName();
238 case FieldImpl::GivenName: 238 case FieldImpl::GivenName:
239 return a.givenName(); 239 return a.givenName();
240 case FieldImpl::AdditionalName: 240 case FieldImpl::AdditionalName:
241 return a.additionalName(); 241 return a.additionalName();
242 case FieldImpl::Prefix: 242 case FieldImpl::Prefix:
243 return a.prefix(); 243 return a.prefix();
244 case FieldImpl::Suffix: 244 case FieldImpl::Suffix:
245 return a.suffix(); 245 return a.suffix();
246 case FieldImpl::NickName: 246 case FieldImpl::NickName:
247 return a.nickName(); 247 return a.nickName();
248 case FieldImpl::Mailer: 248 case FieldImpl::Mailer:
249 return a.mailer(); 249 return a.mailer();
250 case FieldImpl::Title: 250 case FieldImpl::Title:
251 return a.title(); 251 return a.title();
252 case FieldImpl::Role: 252 case FieldImpl::Role:
253 return a.role(); 253 return a.role();
254 case FieldImpl::Organization: 254 case FieldImpl::Organization:
255 return a.organization(); 255 return a.organization();
256 case FieldImpl::Note: 256 case FieldImpl::Note:
257 return a.note(); 257 return a.note();
258 case FieldImpl::Email: 258 case FieldImpl::Email:
259 return a.preferredEmail(); 259 return a.preferredEmail();
260 case FieldImpl::Birthday: 260 case FieldImpl::Birthday:
261 if ( a.birthday().isValid() ) { 261 if ( a.birthday().isValid() ) {
262//the generated code had the following format: return a.birthday().date().toString( Qt::ISODate ); 262//the generated code had the following format: return a.birthday().date().toString( Qt::ISODate );
263// But Qt::IsoDate was not specified. 263// But Qt::IsoDate was not specified.
264 QString _oldFormat = KGlobal::locale()->dateFormat(); 264// QString _oldFormat = KGlobal::locale()->dateFormat();
265 KGlobal::locale()->setDateFormat("%Y-%m-%d"); // = Qt::ISODate 265// KGlobal::locale()->setDateFormat("%Y-%m-%d"); // = Qt::ISODate
266 QString dt = KGlobal::locale()->formatDate(a.birthday().date(), false); 266 QString dt = KGlobal::locale()->formatDate(a.birthday().date(), false, KLocale::ISODate);
267 KGlobal::locale()->setDateFormat(_oldFormat); 267// KGlobal::locale()->setDateFormat(_oldFormat);
268 return dt; 268 return dt;
269 } 269 }
270 else 270 else
271 return QString::null; 271 return QString::null;
272 case FieldImpl::Url: 272 case FieldImpl::Url:
273 return a.url().prettyURL(); 273 return a.url().prettyURL();
274//US 274//US
275 case FieldImpl::Resource: 275 case FieldImpl::Resource:
276 return a.resource()->resourceName(); 276 return a.resource()->resourceName();
277 case FieldImpl::HomePhone: 277 case FieldImpl::HomePhone:
278 return a.phoneNumber( PhoneNumber::Home ).number(); 278 return a.phoneNumber( PhoneNumber::Home ).number();
279 case FieldImpl::BusinessPhone: 279 case FieldImpl::BusinessPhone:
280 return a.phoneNumber( PhoneNumber::Work ).number(); 280 return a.phoneNumber( PhoneNumber::Work ).number();
281 case FieldImpl::MobilePhone: 281 case FieldImpl::MobilePhone:
282 return a.phoneNumber( PhoneNumber::Cell ).number(); 282 return a.phoneNumber( PhoneNumber::Cell ).number();
283 case FieldImpl::HomeFax: 283 case FieldImpl::HomeFax:
284 return a.phoneNumber( PhoneNumber::Home | PhoneNumber::Fax ).number(); 284 return a.phoneNumber( PhoneNumber::Home | PhoneNumber::Fax ).number();
285 case FieldImpl::BusinessFax: 285 case FieldImpl::BusinessFax:
286 return a.phoneNumber( PhoneNumber::Work | PhoneNumber::Fax ).number(); 286 return a.phoneNumber( PhoneNumber::Work | PhoneNumber::Fax ).number();
287 case FieldImpl::CarPhone: 287 case FieldImpl::CarPhone:
288 return a.phoneNumber( PhoneNumber::Car ).number(); 288 return a.phoneNumber( PhoneNumber::Car ).number();
289 case FieldImpl::Isdn: 289 case FieldImpl::Isdn:
290 return a.phoneNumber( PhoneNumber::Isdn ).number(); 290 return a.phoneNumber( PhoneNumber::Isdn ).number();
291 case FieldImpl::Pager: 291 case FieldImpl::Pager:
292 return a.phoneNumber( PhoneNumber::Pager ).number(); 292 return a.phoneNumber( PhoneNumber::Pager ).number();
293 case FieldImpl::HomeAddressStreet: 293 case FieldImpl::HomeAddressStreet:
294 return a.address( Address::Home ).street(); 294 return a.address( Address::Home ).street();
295 case FieldImpl::HomeAddressLocality: 295 case FieldImpl::HomeAddressLocality:
296 return a.address( Address::Home ).locality(); 296 return a.address( Address::Home ).locality();
297 case FieldImpl::HomeAddressRegion: 297 case FieldImpl::HomeAddressRegion:
298 return a.address( Address::Home ).region(); 298 return a.address( Address::Home ).region();
299 case FieldImpl::HomeAddressPostalCode: 299 case FieldImpl::HomeAddressPostalCode:
300 return a.address( Address::Home ).postalCode(); 300 return a.address( Address::Home ).postalCode();
301 case FieldImpl::HomeAddressCountry: 301 case FieldImpl::HomeAddressCountry:
302 return a.address( Address::Home ).country(); 302 return a.address( Address::Home ).country();
303 case FieldImpl::BusinessAddressStreet: 303 case FieldImpl::BusinessAddressStreet:
304 return a.address( Address::Work ).street(); 304 return a.address( Address::Work ).street();
305 case FieldImpl::BusinessAddressLocality: 305 case FieldImpl::BusinessAddressLocality:
306 return a.address( Address::Work ).locality(); 306 return a.address( Address::Work ).locality();
307 case FieldImpl::BusinessAddressRegion: 307 case FieldImpl::BusinessAddressRegion:
308 return a.address( Address::Work ).region(); 308 return a.address( Address::Work ).region();
309 case FieldImpl::BusinessAddressPostalCode: 309 case FieldImpl::BusinessAddressPostalCode:
310 return a.address( Address::Work ).postalCode(); 310 return a.address( Address::Work ).postalCode();
311 case FieldImpl::BusinessAddressCountry: 311 case FieldImpl::BusinessAddressCountry:
312 return a.address( Address::Work ).country(); 312 return a.address( Address::Work ).country();
313 case FieldImpl::CustomField: 313 case FieldImpl::CustomField:
314 return a.custom( mImpl->app(), mImpl->key() ); 314 return a.custom( mImpl->app(), mImpl->key() );
315 default: 315 default:
316 return QString::null; 316 return QString::null;
317 } 317 }
318} 318}
319 319
320bool Field::setValue( KABC::Addressee &a, const QString &value ) 320bool Field::setValue( KABC::Addressee &a, const QString &value )
321{ 321{
322 switch ( mImpl->fieldId() ) { 322 switch ( mImpl->fieldId() ) {
323 case FieldImpl::FormattedName: 323 case FieldImpl::FormattedName:
324 a.setFormattedName( value ); 324 a.setFormattedName( value );
325 return true; 325 return true;
326 case FieldImpl::FamilyName: 326 case FieldImpl::FamilyName:
327 a.setFamilyName( value ); 327 a.setFamilyName( value );
328 return true; 328 return true;
329 case FieldImpl::GivenName: 329 case FieldImpl::GivenName:
330 a.setGivenName( value ); 330 a.setGivenName( value );
331 return true; 331 return true;
332 case FieldImpl::AdditionalName: 332 case FieldImpl::AdditionalName:
333 a.setAdditionalName( value ); 333 a.setAdditionalName( value );
334 return true; 334 return true;
335 case FieldImpl::Prefix: 335 case FieldImpl::Prefix:
336 a.setPrefix( value ); 336 a.setPrefix( value );
337 return true; 337 return true;
338 case FieldImpl::Suffix: 338 case FieldImpl::Suffix:
339 a.setSuffix( value ); 339 a.setSuffix( value );
340 return true; 340 return true;
341 case FieldImpl::NickName: 341 case FieldImpl::NickName:
342 a.setNickName( value ); 342 a.setNickName( value );
343 return true; 343 return true;
344 case FieldImpl::Mailer: 344 case FieldImpl::Mailer:
345 a.setMailer( value ); 345 a.setMailer( value );
346 return true; 346 return true;
347 case FieldImpl::Title: 347 case FieldImpl::Title:
348 a.setTitle( value ); 348 a.setTitle( value );
349 return true; 349 return true;
350 case FieldImpl::Role: 350 case FieldImpl::Role:
351 a.setRole( value ); 351 a.setRole( value );
352 return true; 352 return true;
353 case FieldImpl::Organization: 353 case FieldImpl::Organization:
354 a.setOrganization( value ); 354 a.setOrganization( value );
355 return true; 355 return true;
356 case FieldImpl::Note: 356 case FieldImpl::Note:
357 a.setNote( value ); 357 a.setNote( value );
358 return true; 358 return true;
359 case FieldImpl::Birthday: 359 case FieldImpl::Birthday:
360//US 360//US
361//the generated code had the following format: return a.setBirthday( QDate::fromString( value, Qt::ISODate ) ); 361//the generated code had the following format: return a.setBirthday( QDate::fromString( value, Qt::ISODate ) );
362// But Qt::IsoDate and QDate::fromString was not specified. Do I have the wrong QT version ? 362// But Qt::IsoDate and QDate::fromString was not specified. Do I have the wrong QT version ?
363 { 363 {
364 QDate dt = KGlobal::locale()->readDate( value, "%Y-%m-%d"); // = Qt::ISODate 364 QDate dt = KGlobal::locale()->readDate( value, "%Y-%m-%d"); // = Qt::ISODate
365 a.setBirthday(dt); 365 a.setBirthday(dt);
366 } 366 }
367 return true; 367 return true;
368 case FieldImpl::CustomField: 368 case FieldImpl::CustomField:
369 a.insertCustom( mImpl->app(), mImpl->key(), value ); 369 a.insertCustom( mImpl->app(), mImpl->key(), value );
370//US never copy the resourcename back to the adressee. 370//US never copy the resourcename back to the adressee.
371 case FieldImpl::Resource: 371 case FieldImpl::Resource:
372 default: 372 default:
373 return false; 373 return false;
374 } 374 }
375} 375}
376 376
377bool Field::isCustom() 377bool Field::isCustom()
378{ 378{
379 return mImpl->fieldId() == FieldImpl::CustomField; 379 return mImpl->fieldId() == FieldImpl::CustomField;
380} 380}
381 381
382Field::List Field::allFields() 382Field::List Field::allFields()
383{ 383{
384 if ( mAllFields.isEmpty() ) { 384 if ( mAllFields.isEmpty() ) {
385 createField( FieldImpl::FormattedName, Frequent ); 385 createField( FieldImpl::FormattedName, Frequent );
386 createField( FieldImpl::FamilyName, Frequent ); 386 createField( FieldImpl::FamilyName, Frequent );
387 createField( FieldImpl::GivenName, Frequent ); 387 createField( FieldImpl::GivenName, Frequent );
388 createField( FieldImpl::AdditionalName ); 388 createField( FieldImpl::AdditionalName );
389 createField( FieldImpl::Prefix ); 389 createField( FieldImpl::Prefix );
390 createField( FieldImpl::Suffix ); 390 createField( FieldImpl::Suffix );
391 createField( FieldImpl::NickName, Personal ); 391 createField( FieldImpl::NickName, Personal );
392 createField( FieldImpl::Birthday, Personal ); 392 createField( FieldImpl::Birthday, Personal );
393 createField( FieldImpl::HomeAddressStreet, Address|Personal ); 393 createField( FieldImpl::HomeAddressStreet, Address|Personal );
394 createField( FieldImpl::HomeAddressLocality, Address|Personal ); 394 createField( FieldImpl::HomeAddressLocality, Address|Personal );
395 createField( FieldImpl::HomeAddressRegion, Address|Personal ); 395 createField( FieldImpl::HomeAddressRegion, Address|Personal );
396 createField( FieldImpl::HomeAddressPostalCode, Address|Personal ); 396 createField( FieldImpl::HomeAddressPostalCode, Address|Personal );
397 createField( FieldImpl::HomeAddressCountry, Address|Personal ); 397 createField( FieldImpl::HomeAddressCountry, Address|Personal );
398 createField( FieldImpl::HomeAddressLabel, Address|Personal ); 398 createField( FieldImpl::HomeAddressLabel, Address|Personal );
399 createField( FieldImpl::BusinessAddressStreet, Address|Organization ); 399 createField( FieldImpl::BusinessAddressStreet, Address|Organization );
400 createField( FieldImpl::BusinessAddressLocality, Address|Organization ); 400 createField( FieldImpl::BusinessAddressLocality, Address|Organization );
401 createField( FieldImpl::BusinessAddressRegion, Address|Organization ); 401 createField( FieldImpl::BusinessAddressRegion, Address|Organization );
402 createField( FieldImpl::BusinessAddressPostalCode, Address|Organization ); 402 createField( FieldImpl::BusinessAddressPostalCode, Address|Organization );
403 createField( FieldImpl::BusinessAddressCountry, Address|Organization ); 403 createField( FieldImpl::BusinessAddressCountry, Address|Organization );
404 createField( FieldImpl::BusinessAddressLabel, Address|Organization ); 404 createField( FieldImpl::BusinessAddressLabel, Address|Organization );
405 createField( FieldImpl::HomePhone, Personal|Frequent ); 405 createField( FieldImpl::HomePhone, Personal|Frequent );
406 createField( FieldImpl::BusinessPhone, Organization|Frequent ); 406 createField( FieldImpl::BusinessPhone, Organization|Frequent );
407 createField( FieldImpl::MobilePhone, Frequent ); 407 createField( FieldImpl::MobilePhone, Frequent );
408 createField( FieldImpl::HomeFax ); 408 createField( FieldImpl::HomeFax );
409 createField( FieldImpl::BusinessFax ); 409 createField( FieldImpl::BusinessFax );
410 createField( FieldImpl::CarPhone ); 410 createField( FieldImpl::CarPhone );
411 createField( FieldImpl::Isdn ); 411 createField( FieldImpl::Isdn );
412 createField( FieldImpl::Pager ); 412 createField( FieldImpl::Pager );
413 createField( FieldImpl::Email, Email|Frequent ); 413 createField( FieldImpl::Email, Email|Frequent );
414 createField( FieldImpl::Mailer, Email ); 414 createField( FieldImpl::Mailer, Email );
415 createField( FieldImpl::Title, Organization ); 415 createField( FieldImpl::Title, Organization );
416 createField( FieldImpl::Role, Organization ); 416 createField( FieldImpl::Role, Organization );
417 createField( FieldImpl::Organization, Organization ); 417 createField( FieldImpl::Organization, Organization );
418 createField( FieldImpl::Note ); 418 createField( FieldImpl::Note );
419 createField( FieldImpl::Url ); 419 createField( FieldImpl::Url );
420 createField( FieldImpl::Resource ); 420 createField( FieldImpl::Resource );
421 } 421 }
422 422
423 return mAllFields; 423 return mAllFields;
424} 424}
425 425
426Field::List Field::defaultFields() 426Field::List Field::defaultFields()
427{ 427{
428 if ( mDefaultFields.isEmpty() ) { 428 if ( mDefaultFields.isEmpty() ) {
429 createDefaultField( FieldImpl::GivenName ); 429 createDefaultField( FieldImpl::GivenName );
430 createDefaultField( FieldImpl::FamilyName ); 430 createDefaultField( FieldImpl::FamilyName );
431 createDefaultField( FieldImpl::Email ); 431 createDefaultField( FieldImpl::Email );
432 } 432 }
433 433
434 return mDefaultFields; 434 return mDefaultFields;
435} 435}
436 436
437void Field::createField( int id, int category ) 437void Field::createField( int id, int category )
438{ 438{
439 mAllFields.append( new Field( new FieldImpl( id, category ) ) ); 439 mAllFields.append( new Field( new FieldImpl( id, category ) ) );
440} 440}
441 441
442void Field::createDefaultField( int id, int category ) 442void Field::createDefaultField( int id, int category )
443{ 443{
444 mDefaultFields.append( new Field( new FieldImpl( id, category ) ) ); 444 mDefaultFields.append( new Field( new FieldImpl( id, category ) ) );
445} 445}
446 446
447void Field::deleteFields() 447void Field::deleteFields()
448{ 448{
449 Field::List::ConstIterator it; 449 Field::List::ConstIterator it;
450 450
451 for( it = mAllFields.begin(); it != mAllFields.end(); ++it ) { 451 for( it = mAllFields.begin(); it != mAllFields.end(); ++it ) {
452 delete (*it); 452 delete (*it);
453 } 453 }
454 mAllFields.clear(); 454 mAllFields.clear();
455 455
456 for( it = mDefaultFields.begin(); it != mDefaultFields.end(); ++it ) { 456 for( it = mDefaultFields.begin(); it != mDefaultFields.end(); ++it ) {
457 delete (*it); 457 delete (*it);
458 } 458 }
459 mDefaultFields.clear(); 459 mDefaultFields.clear();
460 460
461 for( it = mCustomFields.begin(); it != mCustomFields.end(); ++it ) { 461 for( it = mCustomFields.begin(); it != mCustomFields.end(); ++it ) {
462 delete (*it); 462 delete (*it);
463 } 463 }
464 mCustomFields.clear(); 464 mCustomFields.clear();
465} 465}
466 466
467void Field::saveFields( const QString &identifier, 467void Field::saveFields( const QString &identifier,
468 const Field::List &fields ) 468 const Field::List &fields )
469{ 469{
470 KConfig *cfg = KGlobal::config(); 470 KConfig *cfg = KGlobal::config();
471 KConfigGroupSaver( cfg, "KABCFields" ); 471 KConfigGroupSaver( cfg, "KABCFields" );
472 saveFields( cfg, identifier, fields ); 472 saveFields( cfg, identifier, fields );
473} 473}
474 474
475void Field::saveFields( KConfig *cfg, const QString &identifier, 475void Field::saveFields( KConfig *cfg, const QString &identifier,
476 const Field::List &fields ) 476 const Field::List &fields )
477{ 477{
478 QValueList<int> fieldIds; 478 QValueList<int> fieldIds;
479 479
480//US 480//US
481// qDebug("Field::saveFields to %s %s", cfg->getFileName().latin1(), identifier.latin1()); 481// qDebug("Field::saveFields to %s %s", cfg->getFileName().latin1(), identifier.latin1());
482 482
483 int custom = 0; 483 int custom = 0;
484 Field::List::ConstIterator it; 484 Field::List::ConstIterator it;
485 for( it = fields.begin(); it != fields.end(); ++it ) { 485 for( it = fields.begin(); it != fields.end(); ++it ) {
486//US 486//US
487// qDebug("Field::saveFields field:%i", (*it)->mImpl->fieldId()); 487// qDebug("Field::saveFields field:%i", (*it)->mImpl->fieldId());
488 488
489 fieldIds.append( (*it)->mImpl->fieldId() ); 489 fieldIds.append( (*it)->mImpl->fieldId() );
490 if( (*it)->isCustom() ) { 490 if( (*it)->isCustom() ) {
491 QStringList customEntry; 491 QStringList customEntry;
492 customEntry << (*it)->mImpl->label(); 492 customEntry << (*it)->mImpl->label();
493 customEntry << (*it)->mImpl->key(); 493 customEntry << (*it)->mImpl->key();
494 customEntry << (*it)->mImpl->app(); 494 customEntry << (*it)->mImpl->app();
495 cfg->writeEntry( "KABC_CustomEntry_" + identifier + "_" + 495 cfg->writeEntry( "KABC_CustomEntry_" + identifier + "_" +
496 QString::number( custom++ ), customEntry ); 496 QString::number( custom++ ), customEntry );
497 } 497 }
498 } 498 }
499 cfg->writeEntry( identifier, fieldIds ); 499 cfg->writeEntry( identifier, fieldIds );
500} 500}
501 501
502Field::List Field::restoreFields( const QString &identifier ) 502Field::List Field::restoreFields( const QString &identifier )
503{ 503{
504//US 504//US
505// qDebug("Field::restoreFields, identifier: %s", identifier.latin1()); 505// qDebug("Field::restoreFields, identifier: %s", identifier.latin1());
506 506
507 KConfig *cfg = KGlobal::config(); 507 KConfig *cfg = KGlobal::config();
508 KConfigGroupSaver( cfg, "KABCFields" ); 508 KConfigGroupSaver( cfg, "KABCFields" );
509 cfg->setGroup( "KABCFields" ); 509 cfg->setGroup( "KABCFields" );
510 510
511 Field::List l = restoreFields( cfg, identifier ); 511 Field::List l = restoreFields( cfg, identifier );
512 512
513 return l; 513 return l;
514} 514}
515 515
516Field::List Field::restoreFields( KConfig *cfg, const QString &identifier ) 516Field::List Field::restoreFields( KConfig *cfg, const QString &identifier )
517{ 517{
518 QValueList<int> fieldIds = cfg->readIntListEntry( identifier); 518 QValueList<int> fieldIds = cfg->readIntListEntry( identifier);
519//US 519//US
520// qDebug("Field::restoreFields from %s, identifier: %s", cfg->getFileName().latin1(), identifier.latin1()); 520// qDebug("Field::restoreFields from %s, identifier: %s", cfg->getFileName().latin1(), identifier.latin1());
521 521
522 Field::List fields; 522 Field::List fields;
523 523
524 int custom = 0; 524 int custom = 0;
525 QValueList<int>::ConstIterator it; 525 QValueList<int>::ConstIterator it;
526 for( it = fieldIds.begin(); it != fieldIds.end(); ++it ) { 526 for( it = fieldIds.begin(); it != fieldIds.end(); ++it ) {
527 FieldImpl *f = 0; 527 FieldImpl *f = 0;
528 if ( (*it) == FieldImpl::CustomField ) { 528 if ( (*it) == FieldImpl::CustomField ) {
529 QStringList customEntry = cfg->readListEntry( "KABC_CustomEntry_" + 529 QStringList customEntry = cfg->readListEntry( "KABC_CustomEntry_" +
530 identifier + "_" + 530 identifier + "_" +
531 QString::number( custom++ ) ); 531 QString::number( custom++ ) );
532 f = new FieldImpl( *it, CustomCategory, customEntry[ 0 ], 532 f = new FieldImpl( *it, CustomCategory, customEntry[ 0 ],
533 customEntry[ 1 ], customEntry[ 2 ] ); 533 customEntry[ 1 ], customEntry[ 2 ] );
534 } else { 534 } else {
535 f = new FieldImpl( *it ); 535 f = new FieldImpl( *it );
536 } 536 }
537 fields.append( new Field( f ) ); 537 fields.append( new Field( f ) );
538 } 538 }
539 539
540 return fields; 540 return fields;
541} 541}
542 542
543bool Field::equals( Field *field ) 543bool Field::equals( Field *field )
544{ 544{
545 bool sameId = ( mImpl->fieldId() == field->mImpl->fieldId() ); 545 bool sameId = ( mImpl->fieldId() == field->mImpl->fieldId() );
546 546
547 if ( !sameId ) return false; 547 if ( !sameId ) return false;
548 548
549 if ( mImpl->fieldId() != FieldImpl::CustomField ) return true; 549 if ( mImpl->fieldId() != FieldImpl::CustomField ) return true;
550 550
551 return mImpl->key() == field->mImpl->key(); 551 return mImpl->key() == field->mImpl->key();
552} 552}
553 553
554Field *Field::createCustomField( const QString &label, int category, 554Field *Field::createCustomField( const QString &label, int category,
555 const QString &key, const QString &app ) 555 const QString &key, const QString &app )
556{ 556{
557 Field *field = new Field( new FieldImpl( FieldImpl::CustomField, 557 Field *field = new Field( new FieldImpl( FieldImpl::CustomField,
558 category | CustomCategory, 558 category | CustomCategory,
559 label, key, app ) ); 559 label, key, app ) );
560//US 560//US
561// qDebug("Field::createCustomField label %s", label.latin1() ); 561// qDebug("Field::createCustomField label %s", label.latin1() );
562 562
563 mCustomFields.append( field ); 563 mCustomFields.append( field );
564 564
565 return field; 565 return field;
566} 566}
diff --git a/kabc/plugins/opie/resourceopie.cpp b/kabc/plugins/opie/resourceopie.cpp
index 3b2a6b7..a7d271f 100644
--- a/kabc/plugins/opie/resourceopie.cpp
+++ b/kabc/plugins/opie/resourceopie.cpp
@@ -1,400 +1,410 @@
1/* 1/*
2 This file is part of libkabc. 2 This file is part of libkabc.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public 6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either 7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version. 8 version 2 of the License, or (at your option) any later version.
9 9
10 This library is distributed in the hope that it will be useful, 10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details. 13 Library General Public License for more details.
14 14
15 You should have received a copy of the GNU Library General Public License 15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to 16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20 20
21/* 21/*
22Enhanced Version of the file for platform independent KDE tools. 22Enhanced Version of the file for platform independent KDE tools.
23Copyright (c) 2004 Ulf Schenk 23Copyright (c) 2004 Ulf Schenk
24 24
25$Id$ 25$Id$
26*/ 26*/
27 27
28#include <sys/types.h> 28#include <sys/types.h>
29#include <sys/stat.h> 29#include <sys/stat.h>
30#include <unistd.h> 30#include <unistd.h>
31 31
32#include <qdir.h> 32#include <qdir.h>
33#include <qfile.h> 33#include <qfile.h>
34#include <qfileinfo.h> 34#include <qfileinfo.h>
35#include <qregexp.h> 35#include <qregexp.h>
36#include <qtimer.h> 36#include <qtimer.h>
37 37
38#include <kapplication.h> 38#include <kapplication.h>
39#include <kconfig.h> 39#include <kconfig.h>
40#include <kdebug.h> 40#include <kdebug.h>
41#include <klocale.h> 41#include <klocale.h>
42//US #include <ksavefile.h> 42//US #include <ksavefile.h>
43#include <kstandarddirs.h> 43#include <kstandarddirs.h>
44 44
45//US #include "formatfactory.h" 45//US #include "formatfactory.h"
46//US #include <qpe/qpeapplication.h> 46//US #include <qpe/qpeapplication.h>
47 47
48#include <opie/ocontactaccess.h> 48#include <opie/ocontactaccess.h>
49#include <opie/ocontactaccessbackend_xml.h> 49#include <opie/ocontactaccessbackend_xml.h>
50 50
51#include "resource.h" 51#include "resource.h"
52#include "resourceopieconfig.h" 52#include "resourceopieconfig.h"
53#include "stdaddressbook.h" 53#include "stdaddressbook.h"
54 54
55#include "opieconverter.h" 55#include "opieconverter.h"
56 56
57#include "resourceopie.h" 57#include "resourceopie.h"
58 58
59using namespace KABC; 59using namespace KABC;
60extern "C" 60extern "C"
61{ 61{
62 void *init_microkabc_opie() 62 void *init_microkabc_opie()
63 { 63 {
64 return new KRES::PluginFactory<ResourceOpie,ResourceOpieConfig>(); 64 return new KRES::PluginFactory<ResourceOpie,ResourceOpieConfig>();
65 } 65 }
66} 66}
67 67
68ResourceOpie::ResourceOpie( const KConfig *config ) 68ResourceOpie::ResourceOpie( const KConfig *config )
69 : Resource( config ), mConverter (0) 69 : Resource( config ), mConverter (0)
70{ 70{
71 QString fileName = QDir::homeDirPath() + "/Applications/addressbook/addressbook.xml"; 71 QString fileName = QDir::homeDirPath() + "/Applications/addressbook/addressbook.xml";
72 72
73 KConfig *cfg = (KConfig *)config; 73 KConfig *cfg = (KConfig *)config;
74 if ( cfg ) { 74 if ( cfg ) {
75 fileName = cfg->readEntry( "FileName", fileName ); 75 fileName = cfg->readEntry( "FileName", fileName );
76 76
77 } 77 }
78 78
79// qDebug("ResourceOpie::ResourceOpie : %s", fileName.latin1() ); 79// qDebug("ResourceOpie::ResourceOpie : %s", fileName.latin1() );
80 80
81 init( fileName ); 81 init( fileName );
82} 82}
83 83
84ResourceOpie::ResourceOpie( const QString &fileName ) 84ResourceOpie::ResourceOpie( const QString &fileName )
85 : Resource( 0 ) 85 : Resource( 0 )
86{ 86{
87// qDebug("ResourceOpie::ResourceOpie : 3 %s", fileName.latin1()); 87// qDebug("ResourceOpie::ResourceOpie : 3 %s", fileName.latin1());
88 init( fileName ); 88 init( fileName );
89} 89}
90 90
91void ResourceOpie::init( const QString &fileName ) 91void ResourceOpie::init( const QString &fileName )
92{ 92{
93 93
94/*US we have no KDirWatch. SO simulate the signals from inside the apropriate methods 94/*US we have no KDirWatch. SO simulate the signals from inside the apropriate methods
95 connect( &mDirWatch, SIGNAL( dirty(const QString&) ), SLOT( fileChanged() ) ); 95 connect( &mDirWatch, SIGNAL( dirty(const QString&) ), SLOT( fileChanged() ) );
96 connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( fileChanged() ) ); 96 connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( fileChanged() ) );
97 connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( fileChanged() ) ); 97 connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( fileChanged() ) );
98*/ 98*/
99 //US opie addressbook is always readonly 99 //US opie addressbook is always readonly
100 setReadOnly( true ); 100//US setReadOnly( true );
101 101
102 setFileName( fileName ); 102 setFileName( fileName );
103 103
104} 104}
105 105
106ResourceOpie::~ResourceOpie() 106ResourceOpie::~ResourceOpie()
107{ 107{
108 if (mConverter != 0) 108 if (mConverter != 0)
109 delete mConverter; 109 delete mConverter;
110} 110}
111 111
112void ResourceOpie::writeConfig( KConfig *config ) 112void ResourceOpie::writeConfig( KConfig *config )
113{ 113{
114 //US opie addressbook is always readonly 114 //US opie addressbook is always readonly
115 setReadOnly( true ); 115//US setReadOnly( true );
116 116
117 Resource::writeConfig( config ); 117 Resource::writeConfig( config );
118 118
119 config->writeEntry( "FileName", mFileName ); 119 config->writeEntry( "FileName", mFileName );
120 120
121// qDebug("ResourceFile::writeConfig format %s, %s", mFileName.latin1(), mFormatName.latin1()); 121// qDebug("ResourceFile::writeConfig format %s, %s", mFileName.latin1(), mFormatName.latin1());
122 122
123} 123}
124 124
125Ticket *ResourceOpie::requestSaveTicket() 125Ticket *ResourceOpie::requestSaveTicket()
126{ 126{
127 kdDebug(5700) << "ResourceOpie::requestSaveTicket()" << endl; 127 kdDebug(5700) << "ResourceOpie::requestSaveTicket()" << endl;
128 128
129 if ( !addressBook() ) return 0; 129 if ( !addressBook() ) return 0;
130 130
131 if ( !lock( mFileName ) ) { 131 if ( !lock( mFileName ) ) {
132 kdDebug(5700) << "ResourceOpie::requestSaveTicket(): Unable to lock file '" 132 kdDebug(5700) << "ResourceOpie::requestSaveTicket(): Unable to lock file '"
133 << mFileName << "'" << endl; 133 << mFileName << "'" << endl;
134 return 0; 134 return 0;
135 } 135 }
136 return createTicket( this ); 136 return createTicket( this );
137} 137}
138 138
139 139
140bool ResourceOpie::doOpen() 140bool ResourceOpie::doOpen()
141{ 141{
142// qDebug("ResourceOpie::doOpen() %s", mFileName.latin1()); 142// qDebug("ResourceOpie::doOpen() %s", mFileName.latin1());
143/*US 143/*US
144 QFile file( mFileName ); 144 QFile file( mFileName );
145 145
146 if ( !file.exists() ) { 146 if ( !file.exists() ) {
147 // try to create the file 147 // try to create the file
148 bool ok = file.open( IO_WriteOnly ); 148 bool ok = file.open( IO_WriteOnly );
149 if ( ok ) 149 if ( ok )
150 file.close(); 150 file.close();
151 151
152 return ok; 152 return ok;
153 } else { 153 } else {
154 if ( !file.open( IO_ReadWrite ) ) 154 if ( !file.open( IO_ReadWrite ) )
155 return false; 155 return false;
156 156
157 if ( file.size() == 0 ) { 157 if ( file.size() == 0 ) {
158 file.close(); 158 file.close();
159 return true; 159 return true;
160 } 160 }
161 161
162//US bool ok = mFormat->checkFormat( &file ); 162//US bool ok = mFormat->checkFormat( &file );
163 bool ok = true; 163 bool ok = true;
164 164
165 file.close(); 165 file.close();
166 166
167 return ok; 167 return ok;
168 } 168 }
169*/ 169*/
170 qDebug("ResourceOpie::doOpen() has to be fixed - %s", mFileName.latin1()); 170 qDebug("ResourceOpie::doOpen() has to be fixed - %s", mFileName.latin1());
171 return true; 171 return true;
172} 172}
173 173
174void ResourceOpie::doClose() 174void ResourceOpie::doClose()
175{ 175{
176// qDebug("ResourceOpie::doClose() %s", mFileName.latin1()); 176// qDebug("ResourceOpie::doClose() %s", mFileName.latin1());
177} 177}
178 178
179bool ResourceOpie::load() 179bool ResourceOpie::load()
180{ 180{
181// qDebug("ResourceOpie::load() %s", mFileName.latin1()); 181// qDebug("ResourceOpie::load() %s", mFileName.latin1());
182 kdDebug(5700) << "ResourceOpie::load(): '" << mFileName << "'" << endl; 182 kdDebug(5700) << "ResourceOpie::load(): '" << mFileName << "'" << endl;
183 183
184 qDebug("ResourceOpie::load: Try to load file() %s", mFileName.latin1()); 184 qDebug("ResourceOpie::load: Try to load file() %s", mFileName.latin1());
185 185
186 OContactAccessBackend_XML* backend = new OContactAccessBackend_XML( "KDEPim/Pi", mFileName ); 186 OContactAccessBackend_XML* backend = new OContactAccessBackend_XML( "KDEPim/Pi", mFileName );
187 OContactAccess* access = new OContactAccess("KDEPim/Pi", 0l, backend, false); 187 OContactAccess* access = new OContactAccess("KDEPim/Pi", 0l, backend, false);
188 188
189 if ( !access ) { 189 if ( !access ) {
190 qDebug("Unable to load file() %s", mFileName.latin1()); 190 qDebug("Unable to load file() %s", mFileName.latin1());
191 addressBook()->error( i18n( "Unable to load file '%1'." ).arg( mFileName ) ); 191 addressBook()->error( i18n( "Unable to load file '%1'." ).arg( mFileName ) );
192 return false; 192 return false;
193 } 193 }
194 194
195 access -> setReadAhead( 32 ); // Use ReadAhead-Cache if available 195 access -> setReadAhead( 32 ); // Use ReadAhead-Cache if available
196 196
197 bool res = false;
197 if (mConverter == 0) 198 if (mConverter == 0)
199 {
198 mConverter = new OpieConverter(); 200 mConverter = new OpieConverter();
201 res = mConverter->init();
202 if ( !res )
203 {
204 qDebug("Unable to initialize opie converter. Most likely a problem with the category file");
205 addressBook()->error( i18n( "Unable to initialize opie converter. Most likely a problem with the category file" ) );
206 delete access;
207 return false;
208 }
209 }
199 210
200 211
201 OContactAccess::List::Iterator it; 212 OContactAccess::List::Iterator it;
202 OContactAccess::List allList = access->allRecords(); 213 OContactAccess::List allList = access->allRecords();
203 bool res = false;
204 for ( it = allList.begin(); it != allList.end(); ++it ) 214 for ( it = allList.begin(); it != allList.end(); ++it )
205 { 215 {
206 OContact c = (*it); 216 OContact c = (*it);
207 217
208 KABC::Addressee addressee; 218 KABC::Addressee addressee;
209 219
210 res = mConverter->opieToAddressee( c, addressee ); 220 res = mConverter->opieToAddressee( c, addressee );
211 221
212 if ( !addressee.isEmpty() && res ) 222 if ( !addressee.isEmpty() && res )
213 { 223 {
214 addressee.setResource( this ); 224 addressee.setResource( this );
215 addressBook()->insertAddressee( addressee ); 225 addressBook()->insertAddressee( addressee );
216 } 226 }
217 227
218// qDebug("found %s", c.fullName().latin1()); 228// qDebug("found %s", c.fullName().latin1());
219 } 229 }
220 230
221 delete access; 231 delete access;
222 // it seems so, that deletion of access deletes backend as well 232 // it seems so, that deletion of access deletes backend as well
223 //delete backend; 233 //delete backend;
224 234
225 return true; 235 return true;
226} 236}
227 237
228bool ResourceOpie::save( Ticket *ticket ) 238bool ResourceOpie::save( Ticket *ticket )
229{ 239{
230 qDebug("ResourceOpie::save() has to be fixed - %s", mFileName.latin1()); 240 qDebug("ResourceOpie::save() has to be fixed - %s", mFileName.latin1());
231/*US 241/*US
232 242
233 qDebug("ResourceOpie::save %s", mFileName.latin1()); 243 qDebug("ResourceOpie::save %s", mFileName.latin1());
234 kdDebug(5700) << "ResourceOpie::save()" << endl; 244 kdDebug(5700) << "ResourceOpie::save()" << endl;
235 245
236 // create backup file 246 // create backup file
237 QString extension = "_" + QString::number( QDate::currentDate().dayOfWeek() ); 247 QString extension = "_" + QString::number( QDate::currentDate().dayOfWeek() );
238*/ 248*/
239/*US we use a simpler method to create a backupfile 249/*US we use a simpler method to create a backupfile
240 250
241 (void) KSaveFile::backupFile( mFileName, QString::null 251 (void) KSaveFile::backupFile( mFileName, QString::null
242 ,extension ); 252 ,extension );
243 253
244 KSaveFile saveFile( mFileName ); 254 KSaveFile saveFile( mFileName );
245 bool ok = false; 255 bool ok = false;
246 if ( saveFile.status() == 0 && saveFile.file() ) 256 if ( saveFile.status() == 0 && saveFile.file() )
247 { 257 {
248 mFormat->saveAll( addressBook(), this, saveFile.file() ); 258 mFormat->saveAll( addressBook(), this, saveFile.file() );
249 ok = saveFile.close(); 259 ok = saveFile.close();
250 } 260 }
251*/ 261*/
252/*US 262/*US
253//US ToDo: write backupfile 263//US ToDo: write backupfile
254 QFile info; 264 QFile info;
255 info.setName( mFileName ); 265 info.setName( mFileName );
256 bool ok = info.open( IO_WriteOnly ); 266 bool ok = info.open( IO_WriteOnly );
257 if ( ok ) { 267 if ( ok ) {
258//US mFormat->saveAll( addressBook(), this, &info ); 268//US mFormat->saveAll( addressBook(), this, &info );
259 269
260 info.close(); 270 info.close();
261 ok = true; 271 ok = true;
262 } 272 }
263 else { 273 else {
264 274
265 } 275 }
266 276
267 if ( !ok ) 277 if ( !ok )
268 addressBook()->error( i18n( "Unable to save file '%1'." ).arg( mFileName ) ); 278 addressBook()->error( i18n( "Unable to save file '%1'." ).arg( mFileName ) );
269 279
270 delete ticket; 280 delete ticket;
271 unlock( mFileName ); 281 unlock( mFileName );
272 282
273 return ok; 283 return ok;
274 284
275 qDebug("ResourceOpie::save has to be changed"); 285 qDebug("ResourceOpie::save has to be changed");
276*/ 286*/
277 return true; 287 return true;
278 288
279} 289}
280 290
281bool ResourceOpie::lock( const QString &fileName ) 291bool ResourceOpie::lock( const QString &fileName )
282{ 292{
283 qDebug("ResourceOpie::lock() has to be fixed - %s", mFileName.latin1()); 293 qDebug("ResourceOpie::lock() has to be fixed - %s", mFileName.latin1());
284 294
285/*US 295/*US
286// qDebug("ResourceOpie::lock() %s", fileName.latin1()); 296// qDebug("ResourceOpie::lock() %s", fileName.latin1());
287 kdDebug(5700) << "ResourceOpie::lock()" << endl; 297 kdDebug(5700) << "ResourceOpie::lock()" << endl;
288 298
289 QString fn = fileName; 299 QString fn = fileName;
290 300
291//US change the implementation how the lockfilename is getting created 301//US change the implementation how the lockfilename is getting created
292//US fn.replace( QRegExp("/"), "_" ); 302//US fn.replace( QRegExp("/"), "_" );
293//US QString lockName = locateLocal( "data", "kabc/lock/" + fn + ".lock" ); 303//US QString lockName = locateLocal( "data", "kabc/lock/" + fn + ".lock" );
294 304
295 KURL url(fn); 305 KURL url(fn);
296 QString lockName = locateLocal( "data", "kabc/lock/" + url.fileName() + ".lock" ); 306 QString lockName = locateLocal( "data", "kabc/lock/" + url.fileName() + ".lock" );
297 307
298 kdDebug(5700) << "-- lock name: " << lockName << endl; 308 kdDebug(5700) << "-- lock name: " << lockName << endl;
299 309
300 if (QFile::exists( lockName )) return false; 310 if (QFile::exists( lockName )) return false;
301 311
302 QString lockUniqueName; 312 QString lockUniqueName;
303 lockUniqueName = fn + KApplication::randomString( 8 ); 313 lockUniqueName = fn + KApplication::randomString( 8 );
304 314
305 url = lockUniqueName; 315 url = lockUniqueName;
306//US mLockUniqueName = locateLocal( "data", "kabc/lock/" + lockUniqueName ); 316//US mLockUniqueName = locateLocal( "data", "kabc/lock/" + lockUniqueName );
307 mLockUniqueName = locateLocal( "data", "kabc/lock/" + url.fileName() ); 317 mLockUniqueName = locateLocal( "data", "kabc/lock/" + url.fileName() );
308 kdDebug(5700) << "-- lock unique name: " << mLockUniqueName << endl; 318 kdDebug(5700) << "-- lock unique name: " << mLockUniqueName << endl;
309 319
310 // Create unique file 320 // Create unique file
311 QFile file( mLockUniqueName ); 321 QFile file( mLockUniqueName );
312 file.open( IO_WriteOnly ); 322 file.open( IO_WriteOnly );
313 file.close(); 323 file.close();
314 324
315 // Create lock file 325 // Create lock file
316 int result = ::link( QFile::encodeName( mLockUniqueName ), 326 int result = ::link( QFile::encodeName( mLockUniqueName ),
317 QFile::encodeName( lockName ) ); 327 QFile::encodeName( lockName ) );
318 328
319 if ( result == 0 ) { 329 if ( result == 0 ) {
320 addressBook()->emitAddressBookLocked(); 330 addressBook()->emitAddressBookLocked();
321 return true; 331 return true;
322 } 332 }
323 333
324 // TODO: check stat 334 // TODO: check stat
325 335
326 return false; 336 return false;
327*/ 337*/
328 338
329 return true; 339 return true;
330} 340}
331 341
332void ResourceOpie::unlock( const QString &fileName ) 342void ResourceOpie::unlock( const QString &fileName )
333{ 343{
334 qDebug("ResourceOpie::unlock() has to be fixed - %s", mFileName.latin1()); 344 qDebug("ResourceOpie::unlock() has to be fixed - %s", mFileName.latin1());
335/*US 345/*US
336// qDebug("ResourceOpie::unlock() %s", fileName.latin1()); 346// qDebug("ResourceOpie::unlock() %s", fileName.latin1());
337 347
338 QString fn = fileName; 348 QString fn = fileName;
339//US change the implementation how the lockfilename is getting created 349//US change the implementation how the lockfilename is getting created
340//US fn.replace( QRegExp( "/" ), "_" ); 350//US fn.replace( QRegExp( "/" ), "_" );
341//US QString lockName = locateLocal( "data", "kabc/lock/" + fn + ".lock" ); 351//US QString lockName = locateLocal( "data", "kabc/lock/" + fn + ".lock" );
342//US QString lockName = fn + ".lock"; 352//US QString lockName = fn + ".lock";
343 KURL url(fn); 353 KURL url(fn);
344 QString lockName = locateLocal( "data", "kabc/lock/" + url.fileName() + ".lock" ); 354 QString lockName = locateLocal( "data", "kabc/lock/" + url.fileName() + ".lock" );
345 355
346 QFile::remove( lockName ); 356 QFile::remove( lockName );
347 QFile::remove( mLockUniqueName ); 357 QFile::remove( mLockUniqueName );
348 addressBook()->emitAddressBookUnlocked(); 358 addressBook()->emitAddressBookUnlocked();
349*/ 359*/
350} 360}
351 361
352void ResourceOpie::setFileName( const QString &fileName ) 362void ResourceOpie::setFileName( const QString &fileName )
353{ 363{
354/*US ToDo: no synchronization so far. Has to be changed in the future 364/*US ToDo: no synchronization so far. Has to be changed in the future
355 mDirWatch.stopScan(); 365 mDirWatch.stopScan();
356 mDirWatch.removeFile( mFileName ); 366 mDirWatch.removeFile( mFileName );
357*/ 367*/
358 mFileName = fileName; 368 mFileName = fileName;
359 369
360 370
361/*US ToDo: no synchronization so far. Has to be changed in the future 371/*US ToDo: no synchronization so far. Has to be changed in the future
362 mDirWatch.addFile( mFileName ); 372 mDirWatch.addFile( mFileName );
363 mDirWatch.startScan(); 373 mDirWatch.startScan();
364*/ 374*/
365//US simulate KDirWatch event 375//US simulate KDirWatch event
366 fileChanged(); 376 fileChanged();
367} 377}
368 378
369QString ResourceOpie::fileName() const 379QString ResourceOpie::fileName() const
370{ 380{
371 return mFileName; 381 return mFileName;
372} 382}
373 383
374void ResourceOpie::fileChanged() 384void ResourceOpie::fileChanged()
375{ 385{
376 // There is a small theoretical chance that KDirWatch calls us before 386 // There is a small theoretical chance that KDirWatch calls us before
377 // we are fully constructed 387 // we are fully constructed
378 if (!addressBook()) 388 if (!addressBook())
379 return; 389 return;
380 load(); 390 load();
381 addressBook()->emitAddressBookChanged(); 391 addressBook()->emitAddressBookChanged();
382} 392}
383 393
384void ResourceOpie::removeAddressee( const Addressee &addr ) 394void ResourceOpie::removeAddressee( const Addressee &addr )
385{ 395{
386/*US 396/*US
387 QFile::remove( QFile::encodeName( locateLocal( "data", "kabc/photos/" ) + addr.uid() ) ); 397 QFile::remove( QFile::encodeName( locateLocal( "data", "kabc/photos/" ) + addr.uid() ) );
388 QFile::remove( QFile::encodeName( locateLocal( "data", "kabc/logos/" ) + addr.uid() ) ); 398 QFile::remove( QFile::encodeName( locateLocal( "data", "kabc/logos/" ) + addr.uid() ) );
389 QFile::remove( QFile::encodeName( locateLocal( "data", "kabc/sounds/" ) + addr.uid() ) ); 399 QFile::remove( QFile::encodeName( locateLocal( "data", "kabc/sounds/" ) + addr.uid() ) );
390*/ 400*/
391} 401}
392 402
393void ResourceOpie::cleanUp() 403void ResourceOpie::cleanUp()
394{ 404{
395// qDebug("ResourceOpie::cleanup() %s", mFileName.latin1()); 405// qDebug("ResourceOpie::cleanup() %s", mFileName.latin1());
396 406
397 unlock( mFileName ); 407 unlock( mFileName );
398} 408}
399 409
400//US #include "resourceopie.moc" 410//US #include "resourceopie.moc"
diff --git a/kabc/plugins/opie/resourceopieconfig.cpp b/kabc/plugins/opie/resourceopieconfig.cpp
index f4cc4f9..eef9cc9 100644
--- a/kabc/plugins/opie/resourceopieconfig.cpp
+++ b/kabc/plugins/opie/resourceopieconfig.cpp
@@ -1,112 +1,107 @@
1/* 1/*
2 This file is part of libkabc. 2 This file is part of libkabc.
3 Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> 3 Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public 6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either 7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version. 8 version 2 of the License, or (at your option) any later version.
9 9
10 This library is distributed in the hope that it will be useful, 10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details. 13 Library General Public License for more details.
14 14
15 You should have received a copy of the GNU Library General Public License 15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to 16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20 20
21/* 21/*
22Enhanced Version of the file for platform independent KDE tools. 22Enhanced Version of the file for platform independent KDE tools.
23Copyright (c) 2004 Ulf Schenk 23Copyright (c) 2004 Ulf Schenk
24 24
25$Id$ 25$Id$
26*/ 26*/
27 27
28#include <qlabel.h> 28#include <qlabel.h>
29#include <qlayout.h> 29#include <qlayout.h>
30 30
31#include <kdebug.h> 31#include <kdebug.h>
32#include <klocale.h> 32#include <klocale.h>
33#include <kstandarddirs.h> 33#include <kstandarddirs.h>
34#include <kdialog.h> 34#include <kdialog.h>
35 35
36#include <unistd.h> 36#include <unistd.h>
37 37
38#include <qdir.h> 38#include <qdir.h>
39#include <qfile.h> 39#include <qfile.h>
40#include "resourceopie.h" 40#include "resourceopie.h"
41//US #include <qpe/qpeapplication.h> 41//US #include <qpe/qpeapplication.h>
42 42
43//US #include "stdaddressbook.h" 43//US #include "stdaddressbook.h"
44 44
45#include "resourceopieconfig.h" 45#include "resourceopieconfig.h"
46 46
47using namespace KABC; 47using namespace KABC;
48 48
49ResourceOpieConfig::ResourceOpieConfig( QWidget* parent, const char* name ) 49ResourceOpieConfig::ResourceOpieConfig( QWidget* parent, const char* name )
50 : ConfigWidget( parent, name ) 50 : ConfigWidget( parent, name )
51{ 51{
52//qDebug("ResourceFileConfig::ResourceFileConfig"); 52//qDebug("ResourceFileConfig::ResourceFileConfig");
53 53
54 QGridLayout *mainLayout = new QGridLayout( this, 1, 2, 0, 54 QGridLayout *mainLayout = new QGridLayout( this, 1, 2, 0,
55 KDialog::spacingHint() ); 55 KDialog::spacingHint() );
56 56
57 QLabel *label = new QLabel( i18n( "Location:" ), this ); 57 QLabel *label = new QLabel( i18n( "Location:" ), this );
58 mFileNameEdit = new KURLRequester( this ); 58 mFileNameEdit = new KURLRequester( this );
59 59
60 connect( mFileNameEdit, SIGNAL( textChanged( const QString & ) ), 60 connect( mFileNameEdit, SIGNAL( textChanged( const QString & ) ),
61 SLOT( checkFilePermissions( const QString & ) ) ); 61 SLOT( checkFilePermissions( const QString & ) ) );
62 62
63 mainLayout->addWidget( label, 0, 0 ); 63 mainLayout->addWidget( label, 0, 0 );
64 mainLayout->addWidget( mFileNameEdit, 0, 1 ); 64 mainLayout->addWidget( mFileNameEdit, 0, 1 );
65
66//US mInEditMode = false;
67}
68/*US
69void ResourceOpieConfig::setEditMode( bool value )
70{
71 mInEditMode = value;
72} 65}
73*/
74 66
75void ResourceOpieConfig::loadSettings( KRES::Resource *res ) 67void ResourceOpieConfig::loadSettings( KRES::Resource *res )
76{ 68{
77//US ResourceFile *resource = dynamic_cast<ResourceFile*>( res ); 69//US ResourceFile *resource = dynamic_cast<ResourceFile*>( res );
78 ResourceOpie *resource = (ResourceOpie*)( res ); 70 ResourceOpie *resource = (ResourceOpie*)( res );
79 71
80 if ( !resource ) { 72 if ( !resource ) {
81 kdDebug(5700) << "ResourceOpieConfig::loadSettings(): cast failed" << endl; 73 kdDebug(5700) << "ResourceOpieConfig::loadSettings(): cast failed" << endl;
82 return; 74 return;
83 } 75 }
84 76
85 mFileNameEdit->setURL( resource->fileName() ); 77 mFileNameEdit->setURL( resource->fileName() );
86 if ( mFileNameEdit->url().isEmpty() ) 78 if ( mFileNameEdit->url().isEmpty() )
87 mFileNameEdit->setURL( QDir::homeDirPath() + "/Applications/addressbook/addressbook.xml" ); 79 mFileNameEdit->setURL( QDir::homeDirPath() + "/Applications/addressbook/addressbook.xml" );
80
81 //US Opie resources are ReadOnly by definition
82 emit setPersistentReadOnly( true );
88} 83}
89 84
90void ResourceOpieConfig::saveSettings( KRES::Resource *res ) 85void ResourceOpieConfig::saveSettings( KRES::Resource *res )
91{ 86{
92//US ResourceFile *resource = dynamic_cast<ResourceFile*>( res ); 87//US ResourceFile *resource = dynamic_cast<ResourceFile*>( res );
93 ResourceOpie *resource = (ResourceOpie*)( res ); 88 ResourceOpie *resource = (ResourceOpie*)( res );
94 89
95 if ( !resource ) { 90 if ( !resource ) {
96 kdDebug(5700) << "ResourceOpieConfig::saveSettings(): cast failed" << endl; 91 kdDebug(5700) << "ResourceOpieConfig::saveSettings(): cast failed" << endl;
97 return; 92 return;
98 } 93 }
99 94
100 resource->setFileName( mFileNameEdit->url() ); 95 resource->setFileName( mFileNameEdit->url() );
101} 96}
102 97
103void ResourceOpieConfig::checkFilePermissions( const QString& fileName ) 98void ResourceOpieConfig::checkFilePermissions( const QString& fileName )
104{ 99{
105 // If file exist but is not writeable... 100 // If file exist but is not writeable...
106/*US 101/*US
107 if ( access( QFile::encodeName( fileName ), F_OK ) == 0 ) 102 if ( access( QFile::encodeName( fileName ), F_OK ) == 0 )
108 emit setReadOnly( access( QFile::encodeName( fileName ), W_OK ) < 0 ); 103 emit setReadOnly( access( QFile::encodeName( fileName ), W_OK ) < 0 );
109*/ 104*/
110} 105}
111 106
112//US #include "resourceopieconfig.moc" 107//US #include "resourceopieconfig.moc"
diff --git a/kabc/plugins/opie/resourceopieconfig.h b/kabc/plugins/opie/resourceopieconfig.h
index 533b7f4..8cc192c 100644
--- a/kabc/plugins/opie/resourceopieconfig.h
+++ b/kabc/plugins/opie/resourceopieconfig.h
@@ -1,61 +1,58 @@
1/* 1/*
2 This file is part of libkabc. 2 This file is part of libkabc.
3 Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> 3 Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public 6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either 7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version. 8 version 2 of the License, or (at your option) any later version.
9 9
10 This library is distributed in the hope that it will be useful, 10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details. 13 Library General Public License for more details.
14 14
15 You should have received a copy of the GNU Library General Public License 15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to 16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20 20
21 21
22/* 22/*
23Enhanced Version of the file for platform independent KDE tools. 23Enhanced Version of the file for platform independent KDE tools.
24Copyright (c) 2004 Ulf Schenk 24Copyright (c) 2004 Ulf Schenk
25 25
26$Id$ 26$Id$
27*/ 27*/
28 28
29#ifndef RESOURCEOPIECONFIG_H 29#ifndef RESOURCEOPIECONFIG_H
30#define RESOURCEOPIECONFIG_H 30#define RESOURCEOPIECONFIG_H
31 31
32#include <kurlrequester.h> 32#include <kurlrequester.h>
33 33
34#include <kresources/configwidget.h> 34#include <kresources/configwidget.h>
35 35
36namespace KABC { 36namespace KABC {
37 37
38class ResourceOpieConfig : public KRES::ConfigWidget 38class ResourceOpieConfig : public KRES::ConfigWidget
39{ 39{
40 Q_OBJECT 40 Q_OBJECT
41 41
42public: 42public:
43 ResourceOpieConfig( QWidget* parent = 0, const char* name = 0 ); 43 ResourceOpieConfig( QWidget* parent = 0, const char* name = 0 );
44 44
45//US void setEditMode( bool value );
46
47public slots: 45public slots:
48 void loadSettings( KRES::Resource *resource ); 46 void loadSettings( KRES::Resource *resource );
49 void saveSettings( KRES::Resource *resource ); 47 void saveSettings( KRES::Resource *resource );
50 48
51protected slots: 49protected slots:
52 void checkFilePermissions( const QString& fileName ); 50 void checkFilePermissions( const QString& fileName );
53 51
54private: 52private:
55 KURLRequester* mFileNameEdit; 53 KURLRequester* mFileNameEdit;
56//US bool mInEditMode;
57}; 54};
58 55
59} 56}
60 57
61#endif 58#endif