summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--Makefile24
-rw-r--r--plugindtmkabc/plugindtmkabcE.pro20
-rw-r--r--plugindtmkabc/qtopiaaddressbookplugin.cpp167
-rw-r--r--plugindtmkabc/qtopiaaddressbookplugin.h24
-rw-r--r--plugindtmkabc/qtopiaaddressee.cpp26
-rw-r--r--plugindtmkabc/qtopiaaddressee.h20
6 files changed, 280 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index d6d78bc..95bd2ae 100644
--- a/Makefile
+++ b/Makefile
@@ -1,26 +1,28 @@
1DISTPATH = $(shell pwd) 1DISTPATH = $(shell pwd)
2DISTDIR = $(shell basename $(DISTPATH)) 2DISTDIR = $(shell basename $(DISTPATH))
3 3
4SUBDIRS = libical/src/libical libical/src/libicalss qtcompat microkde \ 4SUBDIRS = 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
7all: tmake 8all: 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
12objects: 13objects:
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
16clean: 18clean:
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
21install: 23install:
22 cd bin/kdepim; make install 24 cd bin/kdepim; make install
23 cp korganizer/korganizer.desktop $(QPEDIR)/apps/Pim/korganizer.desktop 25 cp korganizer/korganizer.desktop $(QPEDIR)/apps/Pim/korganizer.desktop
24 cp kaddressbook/kaddressbook.desktop $(QPEDIR)/apps/Pim/kaddressbook.desktop 26 cp kaddressbook/kaddressbook.desktop $(QPEDIR)/apps/Pim/kaddressbook.desktop
25 27
26dist: 28dist:
@@ -29,24 +31,29 @@ dist:
29 rm -f *~ 31 rm -f *~
30 cd ..; tar czf kdepim.src.tar.gz --exclude=obj --exclude=moc kdepim 32 cd ..; tar czf kdepim.src.tar.gz --exclude=obj --exclude=moc kdepim
31 mkipks kdepim.control 33 mkipks kdepim.control
32 mkipks korganizer-alarm.control 34 mkipks korganizer-alarm.control
33 35
34tmake: objects qtcompat/Makefile$(PLATFORM) microkde/Makefile$(PLATFORM) \ 36tmake: 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
45qtcompat/Makefile$(PLATFORM): qtcompat/qtcompat.pro 52qtcompat/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)
47 54
48microkde/Makefile$(PLATFORM): microkde/microkdeE.pro 55microkde/Makefile$(PLATFORM): microkde/microkdeE.pro
49 cd microkde; tmake "CONFIG+=$(RELEASE_DEBUG)" microkdeE.pro -o Makefile$(PLATFORM) 56 cd microkde; tmake "CONFIG+=$(RELEASE_DEBUG)" microkdeE.pro -o Makefile$(PLATFORM)
50 57
51libkcal/Makefile$(PLATFORM): libkcal/libkcalE.pro 58libkcal/Makefile$(PLATFORM): libkcal/libkcalE.pro
52 cd libkcal; tmake "CONFIG+=$(RELEASE_DEBUG)" libkcalE.pro -o Makefile$(PLATFORM) 59 cd libkcal; tmake "CONFIG+=$(RELEASE_DEBUG)" libkcalE.pro -o Makefile$(PLATFORM)
@@ -61,15 +68,30 @@ kalarmd/Makefile$(PLATFORM): kalarmd/kalarmdE.pro
61korganizer/Makefile$(PLATFORM): korganizer/korganizerE.pro 68korganizer/Makefile$(PLATFORM): korganizer/korganizerE.pro
62 cd korganizer; tmake "CONFIG+=$(RELEASE_DEBUG)" korganizerE.pro -o Makefile$(PLATFORM) 69 cd korganizer; tmake "CONFIG+=$(RELEASE_DEBUG)" korganizerE.pro -o Makefile$(PLATFORM)
63 70
64libical/src/libical/Makefile$(PLATFORM): libical/src/libical/libicalE.pro 71libical/src/libical/Makefile$(PLATFORM): libical/src/libical/libicalE.pro
65 cd libical/src/libical; tmake "CONFIG+=$(RELEASE_DEBUG)" libicalE.pro -o Makefile$(PLATFORM) 72 cd libical/src/libical; tmake "CONFIG+=$(RELEASE_DEBUG)" libicalE.pro -o Makefile$(PLATFORM)
66 73
67libical/src/libicalss/Makefile$(PLATFORM): libical/src/libicalss/libicalssE.pro 74libical/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
70kabc/Makefile$(PLATFORM): kabc/kabcE.pro 77kabc/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
80kabc/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
83kabc/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
86kabc/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
89kabc/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
92kabc/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
73kaddressbook/Makefile$(PLATFORM): kaddressbook/kaddressbookE.pro 95kaddressbook/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
6OBJECTS_DIR = obj/$(PLATFORM)
7MOC_DIR = moc
8DESTDIR=$(QPEDIR)/plugins/korganizer
9#DESTDIR=.
10INCLUDEPATH += ../libkabcwrap $(QPEDIR)/include
11DEFINES +=
12LIBS += -lmicrokabc
13
14HEADERS = \
15 qtopiaaddressbookplugin.h \
16 qtopiaaddressee.h
17
18SOURCES = \
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
12QtopiaAddressBookPlugin::QtopiaAddressBookPlugin() : ref(0) {
13 qDebug("DTMAddressBookPlugin::DTMAddressBookPlugin");
14 QString command ="db2file address -r -c utf8 > /tmp/addressDTM.txt";
15 system ( command.latin1() );
16}
17
18QtopiaAddressBookPlugin::~QtopiaAddressBookPlugin() {
19}
20
21KABC::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
88QString 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}
147QString QtopiaAddressBookPlugin::name() {
148 return "DTM addressbook plugin";
149}
150
151QRESULT 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
163Q_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
8class 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
3QtopiaAddressee::QtopiaAddressee(const QStringList& contact) {
4 setPimContact(contact);
5}
6
7QtopiaAddressee::QtopiaAddressee() {
8 empty = true;
9}
10
11void 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
7class 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