author | zautrix <zautrix> | 2004-07-01 19:28:46 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-07-01 19:28:46 (UTC) |
commit | df5b4df6bc00ea8acfee0b11a335a9d2f39d04dc (patch) (unidiff) | |
tree | 34a8459c68c1fdd849006452c45f34a5ad38eaab | |
parent | 574570db1963fd729bb40a778ae3fc6a71ffc221 (diff) | |
download | kdepimpi-df5b4df6bc00ea8acfee0b11a335a9d2f39d04dc.zip kdepimpi-df5b4df6bc00ea8acfee0b11a335a9d2f39d04dc.tar.gz kdepimpi-df5b4df6bc00ea8acfee0b11a335a9d2f39d04dc.tar.bz2 |
Added missing DTM plugin
-rw-r--r-- | Makefile | 24 | ||||
-rw-r--r-- | plugindtmkabc/plugindtmkabcE.pro | 20 | ||||
-rw-r--r-- | plugindtmkabc/qtopiaaddressbookplugin.cpp | 167 | ||||
-rw-r--r-- | plugindtmkabc/qtopiaaddressbookplugin.h | 24 | ||||
-rw-r--r-- | plugindtmkabc/qtopiaaddressee.cpp | 26 | ||||
-rw-r--r-- | plugindtmkabc/qtopiaaddressee.h | 20 |
6 files changed, 280 insertions, 1 deletions
@@ -1,20 +1,22 @@ | |||
1 | DISTPATH = $(shell pwd) | 1 | DISTPATH = $(shell pwd) |
2 | DISTDIR = $(shell basename $(DISTPATH)) | 2 | DISTDIR = $(shell basename $(DISTPATH)) |
3 | 3 | ||
4 | SUBDIRS = libical/src/libical libical/src/libicalss qtcompat microkde \ | 4 | SUBDIRS = libical/src/libical libical/src/libicalss qtcompat microkde \ |
5 | libkcal libkdepim kabc \ | 5 | libkcal libkdepim kabc kabc/formats/binary kabc/plugins/file kabc/plugins/dir \ |
6 | kabc/plugins/ldap kabc/plugins/opie \ | ||
6 | korganizer kalarmd kaddressbook | 7 | korganizer kalarmd kaddressbook |
7 | all: tmake | 8 | all: tmake |
8 | for i in $(SUBDIRS); do pushd $$i; \ | 9 | for i in $(SUBDIRS); do pushd $$i; \ |
9 | make -f Makefile$(PLATFORM) || exit 1; popd; \ | 10 | make -f Makefile$(PLATFORM) || exit 1; popd; \ |
10 | done | 11 | done |
11 | 12 | ||
12 | objects: | 13 | objects: |
13 | for i in $(SUBDIRS); do mkdir -p $$i/obj/$(PLATFORM); done | 14 | for i in $(SUBDIRS); do mkdir -p $$i/obj/$(PLATFORM); done |
14 | for i in $(SUBDIRS); do mkdir -p $$i/moc/$(PLATFORM); done | 15 | for i in $(SUBDIRS); do mkdir -p $$i/moc/$(PLATFORM); done |
16 | mkdir -p libical/lib/$(PLATFORM) | ||
15 | 17 | ||
16 | clean: | 18 | clean: |
17 | rm -f libical/lib/$(PLATFORM)/*; | 19 | rm -f libical/lib/$(PLATFORM)/*; |
18 | for i in $(SUBDIRS); do pushd $$i; make clean; rm -f *~;\ | 20 | for i in $(SUBDIRS); do pushd $$i; make clean; rm -f *~;\ |
19 | rm -f obj/$(PLATFORM)/*; rm -f moc/$(PLATFORM)/*; rm Makefile$(PLATFORM); popd; \ | 21 | rm -f obj/$(PLATFORM)/*; rm -f moc/$(PLATFORM)/*; rm Makefile$(PLATFORM); popd; \ |
20 | done | 22 | done |
@@ -35,12 +37,17 @@ tmake: objects qtcompat/Makefile$(PLATFORM) microkde/Makefile$(PLATFORM) \ | |||
35 | libkcal/Makefile$(PLATFORM) \ | 37 | libkcal/Makefile$(PLATFORM) \ |
36 | libkdepim/Makefile$(PLATFORM) korganizer/Makefile$(PLATFORM) \ | 38 | libkdepim/Makefile$(PLATFORM) korganizer/Makefile$(PLATFORM) \ |
37 | kalarmd/Makefile$(PLATFORM) \ | 39 | kalarmd/Makefile$(PLATFORM) \ |
38 | libical/src/libical/Makefile$(PLATFORM) \ | 40 | libical/src/libical/Makefile$(PLATFORM) \ |
39 | libical/src/libicalss/Makefile$(PLATFORM) \ | 41 | libical/src/libicalss/Makefile$(PLATFORM) \ |
40 | kabc/Makefile$(PLATFORM) \ | 42 | kabc/Makefile$(PLATFORM) \ |
43 | kabc/formats/binary/Makefile$(PLATFORM) \ | ||
44 | kabc/plugins/file/Makefile$(PLATFORM) \ | ||
45 | kabc/plugins/dir/Makefile$(PLATFORM) \ | ||
46 | kabc/plugins/ldap/Makefile$(PLATFORM) \ | ||
47 | kabc/plugins/opie/Makefile$(PLATFORM) \ | ||
41 | kaddressbook/Makefile$(PLATFORM) | 48 | kaddressbook/Makefile$(PLATFORM) |
42 | 49 | ||
43 | 50 | ||
44 | 51 | ||
45 | qtcompat/Makefile$(PLATFORM): qtcompat/qtcompat.pro | 52 | qtcompat/Makefile$(PLATFORM): qtcompat/qtcompat.pro |
46 | cd qtcompat; tmake "CONFIG+=$(RELEASE_DEBUG)" qtcompat.pro -o Makefile$(PLATFORM) | 53 | cd qtcompat; tmake "CONFIG+=$(RELEASE_DEBUG)" qtcompat.pro -o Makefile$(PLATFORM) |
@@ -67,9 +74,24 @@ libical/src/libical/Makefile$(PLATFORM): libical/src/libical/libicalE.pro | |||
67 | libical/src/libicalss/Makefile$(PLATFORM): libical/src/libicalss/libicalssE.pro | 74 | libical/src/libicalss/Makefile$(PLATFORM): libical/src/libicalss/libicalssE.pro |
68 | cd libical/src/libicalss; tmake "CONFIG+=$(RELEASE_DEBUG)" libicalssE.pro -o Makefile$(PLATFORM) | 75 | cd libical/src/libicalss; tmake "CONFIG+=$(RELEASE_DEBUG)" libicalssE.pro -o Makefile$(PLATFORM) |
69 | 76 | ||
70 | kabc/Makefile$(PLATFORM): kabc/kabcE.pro | 77 | kabc/Makefile$(PLATFORM): kabc/kabcE.pro |
71 | cd kabc; tmake "CONFIG+=$(RELEASE_DEBUG)" kabcE.pro -o Makefile$(PLATFORM) | 78 | cd kabc; tmake "CONFIG+=$(RELEASE_DEBUG)" kabcE.pro -o Makefile$(PLATFORM) |
72 | 79 | ||
80 | kabc/formats/binary/Makefile$(PLATFORM): kabc/formats/binary/kabcformat_binaryE.pro | ||
81 | cd kabc/formats/binary; tmake "CONFIG+=$(RELEASE_DEBUG)" kabcformat_binaryE.pro -o Makefile$(PLATFORM) | ||
82 | |||
83 | kabc/plugins/file/Makefile$(PLATFORM): kabc/plugins/file/kabc_fileE.pro | ||
84 | cd kabc/plugins/file; tmake "CONFIG+=$(RELEASE_DEBUG)" kabc_fileE.pro -o Makefile$(PLATFORM) | ||
85 | |||
86 | kabc/plugins/dir/Makefile$(PLATFORM): kabc/plugins/dir/kabc_dirE.pro | ||
87 | cd kabc/plugins/dir; tmake "CONFIG+=$(RELEASE_DEBUG)" kabc_dirE.pro -o Makefile$(PLATFORM) | ||
88 | |||
89 | kabc/plugins/ldap/Makefile$(PLATFORM): kabc/plugins/ldap/kabc_ldapE.pro | ||
90 | cd kabc/plugins/ldap; tmake "CONFIG+=$(RELEASE_DEBUG)" kabc_ldapE.pro -o Makefile$(PLATFORM) | ||
91 | |||
92 | kabc/plugins/opie/Makefile$(PLATFORM): kabc/plugins/opie/kabc_opieE.pro | ||
93 | cd kabc/plugins/opie; tmake "CONFIG+=$(RELEASE_DEBUG)" kabc_opieE.pro -o Makefile$(PLATFORM) | ||
94 | |||
73 | kaddressbook/Makefile$(PLATFORM): kaddressbook/kaddressbookE.pro | 95 | kaddressbook/Makefile$(PLATFORM): kaddressbook/kaddressbookE.pro |
74 | cd kaddressbook; tmake "CONFIG+=$(RELEASE_DEBUG)" kaddressbookE.pro -o Makefile$(PLATFORM) | 96 | cd kaddressbook; tmake "CONFIG+=$(RELEASE_DEBUG)" kaddressbookE.pro -o Makefile$(PLATFORM) |
75 | 97 | ||
diff --git a/plugindtmkabc/plugindtmkabcE.pro b/plugindtmkabc/plugindtmkabcE.pro new file mode 100644 index 0000000..56c08fa --- a/dev/null +++ b/plugindtmkabc/plugindtmkabcE.pro | |||
@@ -0,0 +1,20 @@ | |||
1 | TEMPLATE= lib | ||
2 | #TEMPLATE= app | ||
3 | CONFIG = qt warn_on release | ||
4 | |||
5 | TARGET = dtmkabc | ||
6 | OBJECTS_DIR = obj/$(PLATFORM) | ||
7 | MOC_DIR = moc | ||
8 | DESTDIR=$(QPEDIR)/plugins/korganizer | ||
9 | #DESTDIR=. | ||
10 | INCLUDEPATH += ../libkabcwrap $(QPEDIR)/include | ||
11 | DEFINES += | ||
12 | LIBS += -lmicrokabc | ||
13 | |||
14 | HEADERS = \ | ||
15 | qtopiaaddressbookplugin.h \ | ||
16 | qtopiaaddressee.h | ||
17 | |||
18 | SOURCES = \ | ||
19 | qtopiaaddressbookplugin.cpp \ | ||
20 | qtopiaaddressee.cpp | ||
diff --git a/plugindtmkabc/qtopiaaddressbookplugin.cpp b/plugindtmkabc/qtopiaaddressbookplugin.cpp new file mode 100644 index 0000000..37dd4e2 --- a/dev/null +++ b/plugindtmkabc/qtopiaaddressbookplugin.cpp | |||
@@ -0,0 +1,167 @@ | |||
1 | #include <qwidget.h> | ||
2 | #include <qlayout.h> | ||
3 | #include <qlistbox.h> | ||
4 | #include <qstring.h> | ||
5 | #include <qfile.h> | ||
6 | #include <qtextstream.h> | ||
7 | #include <qtextcodec.h> | ||
8 | #include <stdlib.h> | ||
9 | #include "qtopiaaddressbookplugin.h" | ||
10 | #include "qtopiaaddressee.h" | ||
11 | |||
12 | QtopiaAddressBookPlugin::QtopiaAddressBookPlugin() : ref(0) { | ||
13 | qDebug("DTMAddressBookPlugin::DTMAddressBookPlugin"); | ||
14 | QString command ="db2file address -r -c utf8 > /tmp/addressDTM.txt"; | ||
15 | system ( command.latin1() ); | ||
16 | } | ||
17 | |||
18 | QtopiaAddressBookPlugin::~QtopiaAddressBookPlugin() { | ||
19 | } | ||
20 | |||
21 | KABC::Addressee::List QtopiaAddressBookPlugin::getAddressees() { | ||
22 | |||
23 | qDebug("Start: DTMAddressBookPlugin::getAddressees"); | ||
24 | |||
25 | KABC::Addressee::List result; | ||
26 | QString text; | ||
27 | QString fileName = "/tmp/addressDTM.txt"; | ||
28 | QFile file( fileName ); | ||
29 | if (!file.open( IO_ReadOnly ) ) { | ||
30 | return result; | ||
31 | } | ||
32 | QTextStream ts( &file ); | ||
33 | ts.setCodec( QTextCodec::codecForName("utf8") ); | ||
34 | text = ts.read(); | ||
35 | file.close(); | ||
36 | |||
37 | QStringList templist; | ||
38 | QString tempString; | ||
39 | int start = 0; | ||
40 | int len = text.length(); | ||
41 | int end = text.find ("\n",start)+1; | ||
42 | bool ok = true; | ||
43 | start = end; | ||
44 | int lastStart1 = -1; | ||
45 | int lastStart2 = -1; | ||
46 | while ( start > 0 ) { | ||
47 | //qDebug("while start %d ", start); | ||
48 | if ( lastStart1 == start ) | ||
49 | break; | ||
50 | lastStart1 =start; | ||
51 | templist.clear(); | ||
52 | ok = true; | ||
53 | int iii = 0; | ||
54 | while ( ok ) { | ||
55 | |||
56 | // qDebug("while ok %d ", start); | ||
57 | |||
58 | if ( lastStart2 == start ) | ||
59 | break; | ||
60 | lastStart2 =start; | ||
61 | tempString = getPart( text, ok, start ); | ||
62 | //if ( ! tempString.isEmpty() ) | ||
63 | //qDebug("tempString %s %d",tempString.latin1(), iii); | ||
64 | iii++; | ||
65 | if ( start >= len || start == 0 ) { | ||
66 | start = 0; | ||
67 | ok = false; | ||
68 | } | ||
69 | if ( tempString.right(1) =="\n" ) | ||
70 | tempString = tempString.left( tempString.length()-1); | ||
71 | //if ( ok ) | ||
72 | templist.append( tempString ); | ||
73 | //qDebug("%d ---%s---", templist.count(),tempString.latin1() ); | ||
74 | } | ||
75 | result.append(QtopiaAddressee(templist)); | ||
76 | //qDebug("name %s ",templist[2].latin1() ); | ||
77 | //qDebug("name %s ",templist[4].latin1() ); | ||
78 | //qDebug("name %s ",templist[5].latin1() ); | ||
79 | //qDebug("name %s ",templist[40].latin1() ); | ||
80 | } | ||
81 | |||
82 | |||
83 | qDebug("End: DTMAddressBookPlugin::getAddressees"); | ||
84 | |||
85 | return result; | ||
86 | } | ||
87 | |||
88 | QString QtopiaAddressBookPlugin::getPart( const QString& text , bool &ok, int &start ) | ||
89 | { | ||
90 | //qDebug("start %d ", start); | ||
91 | |||
92 | QString retval =""; | ||
93 | if ( text.at(start) == '"' ) { | ||
94 | if ( text.mid( start,2) == "\"\"" && !( text.mid( start+2,1) == "\"")) { | ||
95 | start = start +2; | ||
96 | if ( text.mid( start,1) == "," ) { | ||
97 | start += 1; | ||
98 | } | ||
99 | retval = ""; | ||
100 | if ( text.mid( start,1) == "\n" ) { | ||
101 | start += 1; | ||
102 | ok = false; | ||
103 | } | ||
104 | return retval; | ||
105 | } | ||
106 | int hk = start+1; | ||
107 | hk = text.find ('"',hk); | ||
108 | while ( text.at(hk+1) == '"' ) | ||
109 | hk = text.find ('"',hk+2); | ||
110 | retval = text.mid( start+1, hk-start-1); | ||
111 | start = hk+1; | ||
112 | retval.replace( QRegExp("\"\""), "\""); | ||
113 | if ( text.mid( start,1) == "," ) { | ||
114 | start += 1; | ||
115 | } | ||
116 | if ( text.mid( start,1) == "\n" ) { | ||
117 | start += 1; | ||
118 | ok = false; | ||
119 | } | ||
120 | //qDebug("retval***%s*** ",retval.latin1() ); | ||
121 | return retval; | ||
122 | |||
123 | } else { | ||
124 | int nl = text.find ("\n",start); | ||
125 | int kom = text.find (',',start); | ||
126 | if ( kom < nl ) { | ||
127 | // qDebug("kom < nl %d ", kom); | ||
128 | retval = text.mid(start, kom-start); | ||
129 | start = kom+1; | ||
130 | return retval; | ||
131 | } else { | ||
132 | if ( nl == kom ) { | ||
133 | // qDebug(" nl == kom "); | ||
134 | start = 0; | ||
135 | ok = false; | ||
136 | return "0"; | ||
137 | } | ||
138 | // qDebug(" nl < kom ", nl); | ||
139 | retval = text.mid( start, nl-start); | ||
140 | ok = false; | ||
141 | start = nl+1; | ||
142 | return retval; | ||
143 | } | ||
144 | } | ||
145 | |||
146 | } | ||
147 | QString QtopiaAddressBookPlugin::name() { | ||
148 | return "DTM addressbook plugin"; | ||
149 | } | ||
150 | |||
151 | QRESULT QtopiaAddressBookPlugin::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) | ||
152 | { | ||
153 | *iface = 0; | ||
154 | if ( uuid == IID_QUnknown ) | ||
155 | *iface = this; | ||
156 | else if ( uuid == IID_KOAddressBookInterface ) | ||
157 | *iface = this; | ||
158 | if ( *iface ) | ||
159 | (*iface)->addRef(); | ||
160 | return QS_OK; | ||
161 | } | ||
162 | |||
163 | Q_EXPORT_INTERFACE() | ||
164 | { | ||
165 | Q_CREATE_INSTANCE( QtopiaAddressBookPlugin ) | ||
166 | } | ||
167 | |||
diff --git a/plugindtmkabc/qtopiaaddressbookplugin.h b/plugindtmkabc/qtopiaaddressbookplugin.h new file mode 100644 index 0000000..abedf73 --- a/dev/null +++ b/plugindtmkabc/qtopiaaddressbookplugin.h | |||
@@ -0,0 +1,24 @@ | |||
1 | #ifndef QTOPIA_ADDRESS_BOOK_PLUGIN_H | ||
2 | #define QTOPIA_ADDRESS_BOOK_PLUGIN_H | ||
3 | #include <kabc/koaddressbookinterface.h> | ||
4 | #include <kabc/addressee.h> | ||
5 | #include <qstring.h> | ||
6 | |||
7 | |||
8 | class QtopiaAddressBookPlugin : public KOAddressBookInterface { | ||
9 | |||
10 | public: | ||
11 | QtopiaAddressBookPlugin(); | ||
12 | virtual ~QtopiaAddressBookPlugin(); | ||
13 | QString name(); | ||
14 | KABC::Addressee::List getAddressees(); | ||
15 | QRESULT queryInterface( const QUuid&, QUnknownInterface** ); | ||
16 | Q_REFCOUNT | ||
17 | |||
18 | protected: | ||
19 | ulong ref; | ||
20 | QString getPart( const QString & , bool& , int &start ); | ||
21 | private: | ||
22 | }; | ||
23 | #endif | ||
24 | |||
diff --git a/plugindtmkabc/qtopiaaddressee.cpp b/plugindtmkabc/qtopiaaddressee.cpp new file mode 100644 index 0000000..e8e49f5 --- a/dev/null +++ b/plugindtmkabc/qtopiaaddressee.cpp | |||
@@ -0,0 +1,26 @@ | |||
1 | #include "qtopiaaddressee.h" | ||
2 | |||
3 | QtopiaAddressee::QtopiaAddressee(const QStringList& contact) { | ||
4 | setPimContact(contact); | ||
5 | } | ||
6 | |||
7 | QtopiaAddressee::QtopiaAddressee() { | ||
8 | empty = true; | ||
9 | } | ||
10 | |||
11 | void QtopiaAddressee::setPimContact(const QStringList& contact) { | ||
12 | if ( contact[40].isEmpty() ) | ||
13 | id = contact[0]; | ||
14 | else | ||
15 | id = contact[40]; | ||
16 | fName = contact[2]; | ||
17 | rName = contact[2]; | ||
18 | pEmail = contact[40]; | ||
19 | empty = false; | ||
20 | mails.clear(); | ||
21 | mobilehomephone = contact[30] ; | ||
22 | workphone = contact[16]; | ||
23 | homephone = contact[31]; | ||
24 | //mails = pimContact.emailList(); | ||
25 | } | ||
26 | |||
diff --git a/plugindtmkabc/qtopiaaddressee.h b/plugindtmkabc/qtopiaaddressee.h new file mode 100644 index 0000000..f7d18a3 --- a/dev/null +++ b/plugindtmkabc/qtopiaaddressee.h | |||
@@ -0,0 +1,20 @@ | |||
1 | #include <qstringlist.h> | ||
2 | #include <kabc/addressee.h> | ||
3 | |||
4 | #ifndef QTOPIA_ADDRESSE_H | ||
5 | #define QTOPIA_ADDRESSE_H | ||
6 | |||
7 | class QtopiaAddressee : public KABC::Addressee { | ||
8 | |||
9 | public: | ||
10 | |||
11 | QtopiaAddressee(const QStringList& contact); | ||
12 | QtopiaAddressee(); | ||
13 | void setPimContact(const QStringList& contact); | ||
14 | |||
15 | private: | ||
16 | |||
17 | }; | ||
18 | |||
19 | #endif | ||
20 | |||