author | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
commit | a08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (unidiff) | |
tree | 8ee90d686081c52e7c69b5ce946e9b1a7d690001 /kabc/plugins/qtopia | |
parent | 11edc920afe4f274c0964436633aa632c8288a40 (diff) | |
download | kdepimpi-p1.zip kdepimpi-p1.tar.gz kdepimpi-p1.tar.bz2 |
initial public commit of qt4 portp1
-rw-r--r-- | kabc/plugins/qtopia/qtopia.pro | 16 | ||||
-rw-r--r-- | kabc/plugins/qtopia/qtopiaE.pro | 6 | ||||
-rw-r--r-- | kabc/plugins/qtopia/qtopiaconverter.cpp | 24 | ||||
-rw-r--r-- | kabc/plugins/qtopia/qtopiaconverter.h | 9 | ||||
-rw-r--r-- | kabc/plugins/qtopia/resourceqtopia.cpp | 14 | ||||
-rw-r--r-- | kabc/plugins/qtopia/resourceqtopiaconfig.cpp | 4 |
6 files changed, 42 insertions, 31 deletions
diff --git a/kabc/plugins/qtopia/qtopia.pro b/kabc/plugins/qtopia/qtopia.pro index 64d1abc..d91a2e3 100644 --- a/kabc/plugins/qtopia/qtopia.pro +++ b/kabc/plugins/qtopia/qtopia.pro | |||
@@ -1,20 +1,20 @@ | |||
1 | TEMPLATE= lib | 1 | TEMPLATE= lib |
2 | CONFIG += qt warn_on release | 2 | CONFIG += qt warn_on release |
3 | 3 | ||
4 | include( ../../../variables.pri ) | 4 | include( ../../../variables.pri ) |
5 | 5 | ||
6 | TARGET = microkabc_qtopia | 6 | TARGET = xmicrokabc_qtopia |
7 | 7 | ||
8 | INCLUDEPATH += ../.. ../../.. ../../../kabc ../../../microkde ../../../microkde/kdecore ../../../microkde/kio/kfile ../../../microkde/kio/kio ../../../microkde/kresources | 8 | INCLUDEPATH += ../.. ../../.. ../../../kabc ../../../microkde ../../../microkde/kdecore ../../../microkde/kio/kfile ../../../microkde/kio/kio ../../../microkde/kresources |
9 | 9 | ||
10 | DESTDIR = ../../../bin | 10 | DESTDIR = ../../../bin |
11 | #LIBS += -lmicrokde | 11 | #LIBS += -lxmicrokde |
12 | #LIBS += -lkamicrokabc | 12 | #LIBS += -lxkamicrokabc |
13 | 13 | ||
14 | DEFINES += KAB_EMBEDDED DESKTOP_VERSION | 14 | DEFINES += KAB_EMBEDDED DESKTOP_VERSION |
15 | 15 | ||
16 | INTERFACES = \ | 16 | INTERFACES = \ |
17 | 17 | ||
18 | HEADERS = \ | 18 | HEADERS = \ |
19 | resourceqtopia.h \ | 19 | resourceqtopia.h \ |
20 | resourceqtopiaconfig.h \ | 20 | resourceqtopiaconfig.h \ |
@@ -31,13 +31,17 @@ unix : { | |||
31 | OBJECTS_DIR = obj/unix | 31 | OBJECTS_DIR = obj/unix |
32 | MOC_DIR = moc/unix | 32 | MOC_DIR = moc/unix |
33 | } | 33 | } |
34 | win32: { | 34 | win32: { |
35 | CONFIG += dll | 35 | CONFIG += dll |
36 | DEFINES += _WIN32_ | 36 | DEFINES += _WIN32_ |
37 | OBJECTS_DIR = obj/win | 37 | OBJECTS_DIR = obj/win |
38 | MOC_DIR = moc/win | 38 | MOC_DIR = moc/win |
39 | LIBS += ../../../bin/microkdepim.lib | 39 | LIBS += ../../../bin/xmicrokdepim.lib |
40 | LIBS += ../../../bin/microkcal.lib | 40 | LIBS += ../../../bin/xmicrokcal.lib |
41 | LIBS += ../../../bin/microkde.lib | 41 | LIBS += ../../../bin/xmicrokde.lib |
42 | LIBS += ../../../bin/microkabc.lib | 42 | LIBS += ../../../bin/microkabc.lib |
43 | } | 43 | } |
44 | #The following line was inserted by qt3to4 | ||
45 | QT += xml qt3support | ||
46 | #The following line was inserted by qt3to4 | ||
47 | QT += | ||
diff --git a/kabc/plugins/qtopia/qtopiaE.pro b/kabc/plugins/qtopia/qtopiaE.pro index 700057b..4b174b2 100644 --- a/kabc/plugins/qtopia/qtopiaE.pro +++ b/kabc/plugins/qtopia/qtopiaE.pro | |||
@@ -1,20 +1,20 @@ | |||
1 | TEMPLATE= lib | 1 | TEMPLATE= lib |
2 | CONFIG += qt warn_on | 2 | CONFIG += qt warn_on |
3 | 3 | ||
4 | TARGET = microkabc_qtopia | 4 | TARGET = xmicrokabc_qtopia |
5 | 5 | ||
6 | INCLUDEPATH += $(KDEPIMDIR) $(KDEPIMDIR)/kabc $(KDEPIMDIR)/microkde $(KDEPIMDIR)/microkde/kdecore $(KDEPIMDIR)/microkde/kio/kfile $(KDEPIMDIR)/microkde/kio/kio $(KDEPIMDIR)/microkde/kresources $(KDEPIMDIR)/qtcompat $(QPEDIR)/include | 6 | INCLUDEPATH += $(KDEPIMDIR) $(KDEPIMDIR)/kabc $(KDEPIMDIR)/microkde $(KDEPIMDIR)/microkde/kdecore $(KDEPIMDIR)/microkde/kio/kfile $(KDEPIMDIR)/microkde/kio/kio $(KDEPIMDIR)/microkde/kresources $(KDEPIMDIR)/qtcompat $(QPEDIR)/include |
7 | 7 | ||
8 | OBJECTS_DIR = obj/$(PLATFORM) | 8 | OBJECTS_DIR = obj/$(PLATFORM) |
9 | MOC_DIR = moc/$(PLATFORM) | 9 | MOC_DIR = moc/$(PLATFORM) |
10 | DESTDIR = $(QPEDIR)/lib | 10 | DESTDIR = $(QPEDIR)/lib |
11 | LIBS += -lmicrokde | 11 | LIBS += -lxmicrokde |
12 | LIBS += -lmicrokabc | 12 | LIBS += -lxmicrokabc |
13 | LIBS += -L$(QPEDIR)/lib | 13 | LIBS += -L$(QPEDIR)/lib |
14 | LIBS += -lqpe | 14 | LIBS += -lqpe |
15 | 15 | ||
16 | INTERFACES = \ | 16 | INTERFACES = \ |
17 | 17 | ||
18 | HEADERS = \ | 18 | HEADERS = \ |
19 | resourceqtopia.h \ | 19 | resourceqtopia.h \ |
20 | resourceqtopiaconfig.h \ | 20 | resourceqtopiaconfig.h \ |
diff --git a/kabc/plugins/qtopia/qtopiaconverter.cpp b/kabc/plugins/qtopia/qtopiaconverter.cpp index 9693a68..9b3903b 100644 --- a/kabc/plugins/qtopia/qtopiaconverter.cpp +++ b/kabc/plugins/qtopia/qtopiaconverter.cpp | |||
@@ -29,17 +29,19 @@ $Id$ | |||
29 | #include "kglobal.h" | 29 | #include "kglobal.h" |
30 | #include "klocale.h" | 30 | #include "klocale.h" |
31 | 31 | ||
32 | 32 | ||
33 | #include "qtopiaconverter.h" | 33 | #include "qtopiaconverter.h" |
34 | 34 | ||
35 | #include <qfile.h> | 35 | #include <qfile.h> |
36 | #include <qdir.h> | 36 | #include <qdir.h> |
37 | #include <qtextstream.h> | 37 | #include <q3textstream.h> |
38 | //Added by qt3to4: | ||
39 | #include <Q3ValueList> | ||
38 | //#include <.h> | 40 | //#include <.h> |
39 | 41 | ||
40 | #include <libkdepim/ksyncprofile.h> | 42 | #include <libkdepim/ksyncprofile.h> |
41 | 43 | ||
42 | 44 | ||
43 | using namespace KABC; | 45 | using namespace KABC; |
44 | 46 | ||
45 | QtopiaConverter::QtopiaConverter() | 47 | QtopiaConverter::QtopiaConverter() |
@@ -66,18 +68,18 @@ void QtopiaConverter::deinit() | |||
66 | delete m_edit; | 68 | delete m_edit; |
67 | m_edit = 0; | 69 | m_edit = 0; |
68 | } | 70 | } |
69 | } | 71 | } |
70 | QString QtopiaConverter::categoriesToNumber( const QStringList &list, const QString &app ) | 72 | QString QtopiaConverter::categoriesToNumber( const QStringList &list, const QString &app ) |
71 | { | 73 | { |
72 | startover: | 74 | startover: |
73 | QStringList dummy; | 75 | QStringList dummy; |
74 | QValueList<OpieCategories>::ConstIterator catIt; | 76 | Q3ValueList<OpieCategories>::ConstIterator catIt; |
75 | QValueList<OpieCategories> categories = m_edit->categories(); | 77 | Q3ValueList<OpieCategories> categories = m_edit->categories(); |
76 | bool found = false; | 78 | bool found = false; |
77 | for ( QStringList::ConstIterator listIt = list.begin(); listIt != list.end(); ++listIt ) { | 79 | for ( QStringList::ConstIterator listIt = list.begin(); listIt != list.end(); ++listIt ) { |
78 | /* skip empty category name */ | 80 | /* skip empty category name */ |
79 | if ( (*listIt).isEmpty() ) continue; | 81 | if ( (*listIt).isEmpty() ) continue; |
80 | 82 | ||
81 | found = false; | 83 | found = false; |
82 | for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) { | 84 | for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) { |
83 | /* | 85 | /* |
@@ -187,17 +189,17 @@ bool QtopiaConverter::qtopiaToAddressee( const QDomElement& el, Addressee &adr ) | |||
187 | adr.setFamilyName( el.attribute( "LastName" ) ); | 189 | adr.setFamilyName( el.attribute( "LastName" ) ); |
188 | adr.setGivenName( el.attribute( "FirstName" ) ); | 190 | adr.setGivenName( el.attribute( "FirstName" ) ); |
189 | adr.setAdditionalName( el.attribute( "MiddleName" ) ); | 191 | adr.setAdditionalName( el.attribute( "MiddleName" ) ); |
190 | adr.setSuffix( el.attribute( "Suffix" ) ); | 192 | adr.setSuffix( el.attribute( "Suffix" ) ); |
191 | adr.setNickName( el.attribute( "Nickname" ) ); | 193 | adr.setNickName( el.attribute( "Nickname" ) ); |
192 | 194 | ||
193 | QDate date = dateFromString( el.attribute( "Birthday" ) ); | 195 | QDate date = dateFromString( el.attribute( "Birthday" ) ); |
194 | if ( date.isValid() ) | 196 | if ( date.isValid() ) |
195 | adr.setBirthday( date ); | 197 | adr.setBirthday( (QDateTime)date ); |
196 | 198 | ||
197 | adr.setRole( el.attribute( "JobTitle" ) ); | 199 | adr.setRole( el.attribute( "JobTitle" ) ); |
198 | if ( !el.attribute( "FileAs" ).isEmpty() ) | 200 | if ( !el.attribute( "FileAs" ).isEmpty() ) |
199 | adr.setFormattedName( el.attribute( "FileAs" ) ); | 201 | adr.setFormattedName( el.attribute( "FileAs" ) ); |
200 | 202 | ||
201 | adr.setOrganization( el.attribute( "Company" ) ); | 203 | adr.setOrganization( el.attribute( "Company" ) ); |
202 | 204 | ||
203 | KABC::PhoneNumber businessPhoneNum( el.attribute( "BusinessPhone" ), | 205 | KABC::PhoneNumber businessPhoneNum( el.attribute( "BusinessPhone" ), |
@@ -312,17 +314,17 @@ bool QtopiaConverter::qtopiaToAddressee( const QDomElement& el, Addressee &adr ) | |||
312 | if ( !el.attribute( "Manager" ).isEmpty() ) | 314 | if ( !el.attribute( "Manager" ).isEmpty() ) |
313 | adr.insertCustom("KADDRESSBOOK", "X-ManagersName", el.attribute("Manager") ); | 315 | adr.insertCustom("KADDRESSBOOK", "X-ManagersName", el.attribute("Manager") ); |
314 | 316 | ||
315 | 317 | ||
316 | } | 318 | } |
317 | return true; | 319 | return true; |
318 | } | 320 | } |
319 | 321 | ||
320 | bool QtopiaConverter::addresseeToQtopia( const Addressee &ab, QTextStream *stream ) | 322 | bool QtopiaConverter::addresseeToQtopia( const Addressee &ab, Q3TextStream *stream ) |
321 | { | 323 | { |
322 | *stream << "<Contact "; | 324 | *stream << "<Contact "; |
323 | *stream << "FirstName=\"" << escape(ab.givenName()) << "\" "; | 325 | *stream << "FirstName=\"" << escape(ab.givenName()) << "\" "; |
324 | *stream << "MiddleName=\"" << escape(ab.additionalName()) << "\" "; | 326 | *stream << "MiddleName=\"" << escape(ab.additionalName()) << "\" "; |
325 | *stream << "LastName=\"" << escape(ab.familyName()) << "\" "; | 327 | *stream << "LastName=\"" << escape(ab.familyName()) << "\" "; |
326 | *stream << "Suffix=\"" << escape(ab.suffix()) << "\" "; | 328 | *stream << "Suffix=\"" << escape(ab.suffix()) << "\" "; |
327 | 329 | ||
328 | QString sortStr; | 330 | QString sortStr; |
@@ -479,23 +481,23 @@ CategoryEdit::CategoryEdit(){ | |||
479 | CategoryEdit::CategoryEdit(const QString &fileName){ | 481 | CategoryEdit::CategoryEdit(const QString &fileName){ |
480 | parse( fileName ); | 482 | parse( fileName ); |
481 | } | 483 | } |
482 | CategoryEdit::~CategoryEdit(){ | 484 | CategoryEdit::~CategoryEdit(){ |
483 | } | 485 | } |
484 | void CategoryEdit::save(const QString& fileName)const{ | 486 | void CategoryEdit::save(const QString& fileName)const{ |
485 | QFile file( fileName ); | 487 | QFile file( fileName ); |
486 | QString endl = "\n"; | 488 | QString endl = "\n"; |
487 | if ( file.open( IO_WriteOnly ) ) { | 489 | if ( file.open( QIODevice::WriteOnly ) ) { |
488 | QTextStream stream( &file ); | 490 | Q3TextStream stream( &file ); |
489 | stream.setEncoding( QTextStream::UnicodeUTF8 ); | 491 | stream.setEncoding( Q3TextStream::UnicodeUTF8 ); |
490 | stream << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << endl; | 492 | stream << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << endl; |
491 | stream << "<!DOCTYPE CategoryList>" << endl; | 493 | stream << "<!DOCTYPE CategoryList>" << endl; |
492 | stream << "<Categories>" << endl; | 494 | stream << "<Categories>" << endl; |
493 | for ( QValueList<OpieCategories>::ConstIterator it = m_categories.begin(); | 495 | for ( Q3ValueList<OpieCategories>::ConstIterator it = m_categories.begin(); |
494 | it != m_categories.end(); ++it ) | 496 | it != m_categories.end(); ++it ) |
495 | { | 497 | { |
496 | stream << "<Category id=\""<< ( (*it).id() ) << "\" "; | 498 | stream << "<Category id=\""<< ( (*it).id() ) << "\" "; |
497 | 499 | ||
498 | if ( !(*it).app().isEmpty() ) | 500 | if ( !(*it).app().isEmpty() ) |
499 | stream << " app=\""<< ( (*it).app() ) << "\" "; | 501 | stream << " app=\""<< ( (*it).app() ) << "\" "; |
500 | 502 | ||
501 | stream << "name=\"" << ( (*it).name() ) << "\" "; | 503 | stream << "name=\"" << ( (*it).name() ) << "\" "; |
@@ -532,17 +534,17 @@ int CategoryEdit::addCategory( const QString &appName, const QString &name, in | |||
532 | * and Of Organizer and Contact cats and then | 534 | * and Of Organizer and Contact cats and then |
533 | * we will add them to the kde side... | 535 | * we will add them to the kde side... |
534 | */ | 536 | */ |
535 | void CategoryEdit::parse( const QString &tempFile ){ | 537 | void CategoryEdit::parse( const QString &tempFile ){ |
536 | clear(); | 538 | clear(); |
537 | 539 | ||
538 | QDomDocument doc( "mydocument" ); | 540 | QDomDocument doc( "mydocument" ); |
539 | QFile f( tempFile ); | 541 | QFile f( tempFile ); |
540 | if ( !f.open( IO_ReadOnly ) ) | 542 | if ( !f.open( QIODevice::ReadOnly ) ) |
541 | return; | 543 | return; |
542 | 544 | ||
543 | if ( !doc.setContent( &f ) ) { | 545 | if ( !doc.setContent( &f ) ) { |
544 | f.close(); | 546 | f.close(); |
545 | return; | 547 | return; |
546 | } | 548 | } |
547 | f.close(); | 549 | f.close(); |
548 | 550 | ||
@@ -582,17 +584,17 @@ void CategoryEdit::parse( const QString &tempFile ){ | |||
582 | } | 584 | } |
583 | void CategoryEdit::clear() | 585 | void CategoryEdit::clear() |
584 | { | 586 | { |
585 | ids.clear(); | 587 | ids.clear(); |
586 | m_categories.clear(); | 588 | m_categories.clear(); |
587 | } | 589 | } |
588 | QString CategoryEdit::categoryById( const QString &id, const QString &app )const | 590 | QString CategoryEdit::categoryById( const QString &id, const QString &app )const |
589 | { | 591 | { |
590 | QValueList<OpieCategories>::ConstIterator it; | 592 | Q3ValueList<OpieCategories>::ConstIterator it; |
591 | QString category; | 593 | QString category; |
592 | QString fallback; | 594 | QString fallback; |
593 | for( it = m_categories.begin(); it != m_categories.end(); ++it ){ | 595 | for( it = m_categories.begin(); it != m_categories.end(); ++it ){ |
594 | if( id.stripWhiteSpace() == (*it).id().stripWhiteSpace() ){ | 596 | if( id.stripWhiteSpace() == (*it).id().stripWhiteSpace() ){ |
595 | if( app == (*it).app() ){ | 597 | if( app == (*it).app() ){ |
596 | category = (*it).name(); | 598 | category = (*it).name(); |
597 | break; | 599 | break; |
598 | }else{ | 600 | }else{ |
diff --git a/kabc/plugins/qtopia/qtopiaconverter.h b/kabc/plugins/qtopia/qtopiaconverter.h index 744dd41..389926c 100644 --- a/kabc/plugins/qtopia/qtopiaconverter.h +++ b/kabc/plugins/qtopia/qtopiaconverter.h | |||
@@ -23,16 +23,19 @@ Enhanced Version of the file for platform independent KDE tools. | |||
23 | Copyright (c) 2004 Ulf Schenk | 23 | Copyright (c) 2004 Ulf Schenk |
24 | $Id$ | 24 | $Id$ |
25 | */ | 25 | */ |
26 | 26 | ||
27 | #ifndef KABC_QTOPIACONVERTER_H | 27 | #ifndef KABC_QTOPIACONVERTER_H |
28 | #define KABC_QTOPIACONVERTER_H | 28 | #define KABC_QTOPIACONVERTER_H |
29 | 29 | ||
30 | #include <qstring.h> | 30 | #include <qstring.h> |
31 | //Added by qt3to4: | ||
32 | #include <Q3ValueList> | ||
33 | #include <Q3TextStream> | ||
31 | 34 | ||
32 | #include "addressee.h" | 35 | #include "addressee.h" |
33 | #ifdef DESKTOP_VERSION | 36 | #ifdef DESKTOP_VERSION |
34 | #include <qdom.h> | 37 | #include <qdom.h> |
35 | #else | 38 | #else |
36 | #include <xml/qdom.h> | 39 | #include <xml/qdom.h> |
37 | #endif | 40 | #endif |
38 | class Categories; | 41 | class Categories; |
@@ -71,24 +74,24 @@ class OpieCategories { | |||
71 | int addCategory( const QString &name, int id = 0 ); | 74 | int addCategory( const QString &name, int id = 0 ); |
72 | int addCategory(const QString &appName, const QString &name, int id = 0); | 75 | int addCategory(const QString &appName, const QString &name, int id = 0); |
73 | void parse( const QString &fileName ); | 76 | void parse( const QString &fileName ); |
74 | 77 | ||
75 | QString categoryById(const QString &id, const QString &app )const; | 78 | QString categoryById(const QString &id, const QString &app )const; |
76 | QStringList categoriesByIds( const QStringList& ids, const QString& app ); | 79 | QStringList categoriesByIds( const QStringList& ids, const QString& app ); |
77 | 80 | ||
78 | void clear(); | 81 | void clear(); |
79 | QValueList<OpieCategories> categories()const { return m_categories; }; | 82 | Q3ValueList<OpieCategories> categories()const { return m_categories; }; |
80 | private: | 83 | private: |
81 | /** | 84 | /** |
82 | * this function will be used internally to update the kde categories... | 85 | * this function will be used internally to update the kde categories... |
83 | */ | 86 | */ |
84 | void updateKDE( const QString& app, const QStringList& categories ); | 87 | void updateKDE( const QString& app, const QStringList& categories ); |
85 | QMap<int, bool> ids; // from tt Qtopia::UidGen | 88 | QMap<int, bool> ids; // from tt Qtopia::UidGen |
86 | QValueList<OpieCategories> m_categories; | 89 | Q3ValueList<OpieCategories> m_categories; |
87 | }; | 90 | }; |
88 | 91 | ||
89 | 92 | ||
90 | class QtopiaConverter | 93 | class QtopiaConverter |
91 | { | 94 | { |
92 | public: | 95 | public: |
93 | 96 | ||
94 | /** | 97 | /** |
@@ -112,17 +115,17 @@ public: | |||
112 | */ | 115 | */ |
113 | bool qtopiaToAddressee( const QDomElement& el, Addressee &adr ); | 116 | bool qtopiaToAddressee( const QDomElement& el, Addressee &adr ); |
114 | /** | 117 | /** |
115 | * Converts an addressee to a vcard string. | 118 | * Converts an addressee to a vcard string. |
116 | * | 119 | * |
117 | * @param addr The addressee. | 120 | * @param addr The addressee. |
118 | * @param contact The qtopia contact. | 121 | * @param contact The qtopia contact. |
119 | */ | 122 | */ |
120 | bool addresseeToQtopia( const Addressee &ab, QTextStream *stream ); | 123 | bool addresseeToQtopia( const Addressee &ab, Q3TextStream *stream ); |
121 | 124 | ||
122 | private: | 125 | private: |
123 | QString categoriesToNumber( const QStringList &list, const QString &app ); | 126 | QString categoriesToNumber( const QStringList &list, const QString &app ); |
124 | QString escape( const QString& s){ return s;}; | 127 | QString escape( const QString& s){ return s;}; |
125 | CategoryEdit *m_edit; | 128 | CategoryEdit *m_edit; |
126 | QDate fromString( const QString& ); | 129 | QDate fromString( const QString& ); |
127 | QDate dateFromString( const QString& ); | 130 | QDate dateFromString( const QString& ); |
128 | QString dateToString( const QDate& ); | 131 | QString dateToString( const QDate& ); |
diff --git a/kabc/plugins/qtopia/resourceqtopia.cpp b/kabc/plugins/qtopia/resourceqtopia.cpp index 79ddaea..a36eb8f 100644 --- a/kabc/plugins/qtopia/resourceqtopia.cpp +++ b/kabc/plugins/qtopia/resourceqtopia.cpp | |||
@@ -26,17 +26,17 @@ $Id$ | |||
26 | */ | 26 | */ |
27 | #include <sys/types.h> | 27 | #include <sys/types.h> |
28 | #include <sys/stat.h> | 28 | #include <sys/stat.h> |
29 | #ifndef _WIN32_ | 29 | #ifndef _WIN32_ |
30 | #include <unistd.h> | 30 | #include <unistd.h> |
31 | #endif | 31 | #endif |
32 | #include <qdir.h> | 32 | #include <qdir.h> |
33 | #include <qfile.h> | 33 | #include <qfile.h> |
34 | #include <qtextstream.h> | 34 | #include <q3textstream.h> |
35 | #include <qfileinfo.h> | 35 | #include <qfileinfo.h> |
36 | #include <qregexp.h> | 36 | #include <qregexp.h> |
37 | //US #include <qtimer.h> | 37 | //US #include <qtimer.h> |
38 | 38 | ||
39 | #include <kapplication.h> | 39 | #include <kapplication.h> |
40 | #include <kconfig.h> | 40 | #include <kconfig.h> |
41 | #include <kdebug.h> | 41 | #include <kdebug.h> |
42 | #include <klocale.h> | 42 | #include <klocale.h> |
@@ -151,17 +151,17 @@ void ResourceQtopia::doClose() | |||
151 | 151 | ||
152 | return; | 152 | return; |
153 | } | 153 | } |
154 | 154 | ||
155 | bool ResourceQtopia::load() | 155 | bool ResourceQtopia::load() |
156 | { | 156 | { |
157 | 157 | ||
158 | QFile file( fileName() ); | 158 | QFile file( fileName() ); |
159 | if ( !file.open(IO_ReadOnly ) ) { | 159 | if ( !file.open(QIODevice::ReadOnly ) ) { |
160 | return false; | 160 | return false; |
161 | } | 161 | } |
162 | 162 | ||
163 | QDomDocument doc("mydocument" ); | 163 | QDomDocument doc("mydocument" ); |
164 | if ( !doc.setContent( &file ) ) { | 164 | if ( !doc.setContent( &file ) ) { |
165 | file.close(); | 165 | file.close(); |
166 | return false; | 166 | return false; |
167 | } | 167 | } |
@@ -198,22 +198,22 @@ bool ResourceQtopia::load() | |||
198 | bool ResourceQtopia::save( Ticket *ticket ) | 198 | bool ResourceQtopia::save( Ticket *ticket ) |
199 | { | 199 | { |
200 | #ifdef _USE_DIRWATCH_ | 200 | #ifdef _USE_DIRWATCH_ |
201 | mDirWatch.stopScan(); | 201 | mDirWatch.stopScan(); |
202 | #endif | 202 | #endif |
203 | KABC::AddressBook::Iterator it; | 203 | KABC::AddressBook::Iterator it; |
204 | bool res; | 204 | bool res; |
205 | QFile file( fileName() ); | 205 | QFile file( fileName() ); |
206 | if (!file.open( IO_WriteOnly ) ) { | 206 | if (!file.open( QIODevice::WriteOnly ) ) { |
207 | return false; | 207 | return false; |
208 | } | 208 | } |
209 | QTextStream ts( &file ); | 209 | Q3TextStream ts( &file ); |
210 | QTextStream *stream = &ts; | 210 | Q3TextStream *stream = &ts; |
211 | stream->setEncoding( QTextStream::UnicodeUTF8 ); | 211 | stream->setEncoding( Q3TextStream::UnicodeUTF8 ); |
212 | *stream << "<?xml version=\"1.0\" encoding=\"UTF-8\"?><!DOCTYPE Addressbook ><AddressBook>" << endl; | 212 | *stream << "<?xml version=\"1.0\" encoding=\"UTF-8\"?><!DOCTYPE Addressbook ><AddressBook>" << endl; |
213 | *stream << " <Groups>" << endl; | 213 | *stream << " <Groups>" << endl; |
214 | *stream << " </Groups>" << endl; | 214 | *stream << " </Groups>" << endl; |
215 | *stream << " <Contacts> " << endl; | 215 | *stream << " <Contacts> " << endl; |
216 | // for all entries | 216 | // for all entries |
217 | KABC::Addressee ab; | 217 | KABC::Addressee ab; |
218 | for ( it = addressBook()->begin(); it != addressBook()->end(); ++it ) { | 218 | for ( it = addressBook()->begin(); it != addressBook()->end(); ++it ) { |
219 | KABC::Addressee addressee = (*it); | 219 | KABC::Addressee addressee = (*it); |
@@ -255,17 +255,17 @@ bool ResourceQtopia::lock( const QString &lockfileName ) | |||
255 | 255 | ||
256 | url = lockUniqueName; | 256 | url = lockUniqueName; |
257 | //US mLockUniqueName = locateLocal( "data", "kabc/lock/" + lockUniqueName ); | 257 | //US mLockUniqueName = locateLocal( "data", "kabc/lock/" + lockUniqueName ); |
258 | mLockUniqueName = locateLocal( "data", "kabc/lock/" + url.fileName() ); | 258 | mLockUniqueName = locateLocal( "data", "kabc/lock/" + url.fileName() ); |
259 | kdDebug(5700) << "-- lock unique name: " << mLockUniqueName << endl; | 259 | kdDebug(5700) << "-- lock unique name: " << mLockUniqueName << endl; |
260 | 260 | ||
261 | // Create unique file | 261 | // Create unique file |
262 | QFile file( mLockUniqueName ); | 262 | QFile file( mLockUniqueName ); |
263 | file.open( IO_WriteOnly ); | 263 | file.open( QIODevice::WriteOnly ); |
264 | file.close(); | 264 | file.close(); |
265 | 265 | ||
266 | // Create lock file | 266 | // Create lock file |
267 | int result = 0; | 267 | int result = 0; |
268 | #ifndef _WIN32_ | 268 | #ifndef _WIN32_ |
269 | result = ::link( QFile::encodeName( mLockUniqueName ), | 269 | result = ::link( QFile::encodeName( mLockUniqueName ), |
270 | QFile::encodeName( lockName ) ); | 270 | QFile::encodeName( lockName ) ); |
271 | #endif | 271 | #endif |
diff --git a/kabc/plugins/qtopia/resourceqtopiaconfig.cpp b/kabc/plugins/qtopia/resourceqtopiaconfig.cpp index d5d6141..42fd428 100644 --- a/kabc/plugins/qtopia/resourceqtopiaconfig.cpp +++ b/kabc/plugins/qtopia/resourceqtopiaconfig.cpp | |||
@@ -22,16 +22,18 @@ | |||
22 | Enhanced Version of the file for platform independent KDE tools. | 22 | Enhanced Version of the file for platform independent KDE tools. |
23 | Copyright (c) 2004 Ulf Schenk | 23 | Copyright (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 | //Added by qt3to4: | ||
31 | #include <Q3GridLayout> | ||
30 | 32 | ||
31 | #include <kdebug.h> | 33 | #include <kdebug.h> |
32 | #include <klocale.h> | 34 | #include <klocale.h> |
33 | #include <kstandarddirs.h> | 35 | #include <kstandarddirs.h> |
34 | #include <kdialog.h> | 36 | #include <kdialog.h> |
35 | 37 | ||
36 | //#include <unistd.h> | 38 | //#include <unistd.h> |
37 | 39 | ||
@@ -41,17 +43,17 @@ $Id$ | |||
41 | 43 | ||
42 | #include "resourceqtopiaconfig.h" | 44 | #include "resourceqtopiaconfig.h" |
43 | 45 | ||
44 | using namespace KABC; | 46 | using namespace KABC; |
45 | 47 | ||
46 | ResourceQtopiaConfig::ResourceQtopiaConfig( QWidget* parent, const char* name ) | 48 | ResourceQtopiaConfig::ResourceQtopiaConfig( QWidget* parent, const char* name ) |
47 | : ConfigWidget( parent, name ) | 49 | : ConfigWidget( parent, name ) |
48 | { | 50 | { |
49 | QGridLayout *mainLayout = new QGridLayout( this, 1, 2, 0, | 51 | Q3GridLayout *mainLayout = new Q3GridLayout( this, 1, 2, 0, |
50 | KDialog::spacingHint() ); | 52 | KDialog::spacingHint() ); |
51 | 53 | ||
52 | QLabel *label = new QLabel( i18n( "Location:" ), this ); | 54 | QLabel *label = new QLabel( i18n( "Location:" ), this ); |
53 | mFileNameEdit = new KURLRequester( this ); | 55 | mFileNameEdit = new KURLRequester( this ); |
54 | 56 | ||
55 | connect( mFileNameEdit, SIGNAL( textChanged( const QString & ) ), | 57 | connect( mFileNameEdit, SIGNAL( textChanged( const QString & ) ), |
56 | SLOT( checkFilePermissions( const QString & ) ) ); | 58 | SLOT( checkFilePermissions( const QString & ) ) ); |
57 | 59 | ||