summaryrefslogtreecommitdiffabout
authorulf69 <ulf69>2004-08-06 18:24:25 (UTC)
committer ulf69 <ulf69>2004-08-06 18:24:25 (UTC)
commit79bb2950bd27b5e138d2fd7afe2ab37b6b036cae (patch) (unidiff)
treeabd40f9f1f6cb2a73e2410e67c7889efb855c85f
parentaeb62a1841266e1bec8250a1af9ec3231eb25655 (diff)
downloadkdepimpi-79bb2950bd27b5e138d2fd7afe2ab37b6b036cae.zip
kdepimpi-79bb2950bd27b5e138d2fd7afe2ab37b6b036cae.tar.gz
kdepimpi-79bb2950bd27b5e138d2fd7afe2ab37b6b036cae.tar.bz2
functionality now handled by kabc resourceadapter
Diffstat (more/less context) (ignore whitespace changes)
-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
-rw-r--r--pluginopiekabc/opieaddressbook.cpp33
-rw-r--r--pluginopiekabc/opieaddressbook.h63
-rw-r--r--pluginopiekabc/opieaddressbookplugin.cpp71
-rw-r--r--pluginopiekabc/opieaddressbookplugin.h19
-rw-r--r--pluginopiekabc/opieaddressee.cpp21
-rw-r--r--pluginopiekabc/opieaddressee.h16
-rw-r--r--pluginopiekabc/pluginopiekabcE.pro27
12 files changed, 0 insertions, 507 deletions
diff --git a/plugindtmkabc/plugindtmkabcE.pro b/plugindtmkabc/plugindtmkabcE.pro
deleted file mode 100644
index 56c08fa..0000000
--- a/plugindtmkabc/plugindtmkabcE.pro
+++ b/dev/null
@@ -1,20 +0,0 @@
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
deleted file mode 100644
index 37dd4e2..0000000
--- a/plugindtmkabc/qtopiaaddressbookplugin.cpp
+++ b/dev/null
@@ -1,167 +0,0 @@
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
deleted file mode 100644
index abedf73..0000000
--- a/plugindtmkabc/qtopiaaddressbookplugin.h
+++ b/dev/null
@@ -1,24 +0,0 @@
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
deleted file mode 100644
index e8e49f5..0000000
--- a/plugindtmkabc/qtopiaaddressee.cpp
+++ b/dev/null
@@ -1,26 +0,0 @@
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
deleted file mode 100644
index f7d18a3..0000000
--- a/plugindtmkabc/qtopiaaddressee.h
+++ b/dev/null
@@ -1,20 +0,0 @@
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
diff --git a/pluginopiekabc/opieaddressbook.cpp b/pluginopiekabc/opieaddressbook.cpp
deleted file mode 100644
index ff0ef63..0000000
--- a/pluginopiekabc/opieaddressbook.cpp
+++ b/dev/null
@@ -1,33 +0,0 @@
1#include "opieaddressbook.h"
2#include <qstringlist.h>
3#include <opie/ocontact.h>
4#include <opie/orecordlist.h>
5#include <stdio.h>
6
7using namespace KABC;
8
9OpieAddressBook *StdOpieAddressBook::mSelf = 0;
10
11OpieAddressBook::OpieAddressBook() {
12 access = new OContactAccess("Addressbook");
13}
14
15OpieAddressBook::~OpieAddressBook() {
16}
17
18
19StdOpieAddressBook::StdOpieAddressBook() {
20 access = new OContactAccess("Addressbook");
21}
22
23StdOpieAddressBook::~StdOpieAddressBook() {
24}
25
26OpieAddressBook *StdOpieAddressBook::self() {
27 if ( !mSelf ) {
28 mSelf = new StdOpieAddressBook();
29 }
30 return mSelf;
31}
32
33 \ No newline at end of file
diff --git a/pluginopiekabc/opieaddressbook.h b/pluginopiekabc/opieaddressbook.h
deleted file mode 100644
index d2a3b38..0000000
--- a/pluginopiekabc/opieaddressbook.h
+++ b/dev/null
@@ -1,63 +0,0 @@
1/*
2 This file is part of libkabc.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
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
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19*/
20
21#ifndef KABC_STDADDRESSBOOK_H
22#define KABC_STDADDRESSBOOK_H
23
24#include <opie/ocontactaccess.h>
25#include "opieaddressee.h"
26#include "opieaddress.h"
27
28namespace KABC {
29
30class AddressBook {
31
32 public:
33 AddressBook();
34 ~AddressBook();
35 Addressee::List findByEmail( const QString & );
36
37 protected:
38 OContactAccess *access;
39};
40
41
42class StdAddressBook : public AddressBook
43{
44 public:
45 /**
46 Return the standard addressbook object.
47 */
48 static AddressBook *self();
49
50
51 protected:
52 StdAddressBook();
53 ~StdAddressBook();
54
55 void init( bool onlyFastResources );
56
57 private:
58 static AddressBook *mSelf;
59 static bool mAutomaticSave;
60};
61
62}
63#endif
diff --git a/pluginopiekabc/opieaddressbookplugin.cpp b/pluginopiekabc/opieaddressbookplugin.cpp
deleted file mode 100644
index 0b22289..0000000
--- a/pluginopiekabc/opieaddressbookplugin.cpp
+++ b/dev/null
@@ -1,71 +0,0 @@
1#include <stdio.h>
2#include <qwidget.h>
3#include <qlayout.h>
4#include <qlistbox.h>
5#include <opie/ocontact.h>
6#include <opie/orecordlist.h>
7#include "opieaddressbookplugin.h"
8#include "opieaddressee.h"
9
10OpieAddressBookPlugin::OpieAddressBookPlugin() : ref(0) {
11
12 access = new OContactAccess("OpieAddressBookPlugin");
13
14}
15
16KABC::Addressee::List OpieAddressBookPlugin::getAddressees() {
17 KABC::Addressee::List results;
18 OContactAccess access("OpieAddressBookPlugin");
19 OContactAccess::List::Iterator it;
20 ORecordList<OContact> accessList = access.sorted(true,0,0,0);
21 for(it = accessList.begin(); it != accessList.end(); ++it ) {
22 OpieAddressee addressee( *it );
23 results.append(addressee);
24 }
25 return results;
26}
27
28QString OpieAddressBookPlugin::name() {
29 return QString::QString("OpieAddressBookPlugin");
30}
31
32
33KABC::Addressee::List OpieAddressBookPlugin::findByEmail(const QString &email) {
34printf("OpieAddressBookPlugin::findByEmail: email=%s\n", email.ascii());
35 KABC::Addressee::List results;
36
37 ORecordList<OContact> accessList = access->sorted(true,0,0,0);
38 OContactAccess::List::Iterator it;
39 for(it = accessList.begin(); it != accessList.end(); ++it ) {
40 OContact contact = *it;
41 QStringList emailList = contact.emailList();
42 QStringList foundEmails = emailList.grep(email,false);
43 if (foundEmails.count() >= 1) {
44 OpieAddressee a(contact);
45 printf("Found Contact %s\n", a.formattedName().ascii());
46 results.append(a);
47 }
48 }
49 return results;
50
51}
52
53QRESULT OpieAddressBookPlugin::queryInterface( const QUuid &uuid, QUnknownInterface **iface )
54{
55printf("Start: OpieAddressBookPlugin::queryInterface\n");
56 *iface = 0;
57 if ( uuid == IID_QUnknown )
58 *iface = this;
59 else if ( uuid == IID_KOAddressBookInterface )
60 *iface = this;
61 if ( *iface )
62 (*iface)->addRef();
63 return QS_OK;
64printf("End: OpieAddressBookPlugin::queryInterface\n");
65}
66
67Q_EXPORT_INTERFACE()
68{
69 Q_CREATE_INSTANCE( OpieAddressBookPlugin )
70}
71
diff --git a/pluginopiekabc/opieaddressbookplugin.h b/pluginopiekabc/opieaddressbookplugin.h
deleted file mode 100644
index 1ad1c15..0000000
--- a/pluginopiekabc/opieaddressbookplugin.h
+++ b/dev/null
@@ -1,19 +0,0 @@
1#include <qwidget.h>
2#include <kabc/koaddressbookinterface.h>
3#include <kabc/addressee.h>
4#include <opie/ocontactaccess.h>
5
6struct OpieAddressBookPlugin : public KOAddressBookInterface {
7
8 public:
9
10 OpieAddressBookPlugin::OpieAddressBookPlugin();
11 QString name();
12 KABC::Addressee::List getAddressees();
13 KABC::Addressee::List findByEmail(const QString &email);
14 QRESULT queryInterface( const QUuid&, QUnknownInterface** );
15 Q_REFCOUNT
16 protected:
17 OContactAccess *access;
18 ulong ref;
19};
diff --git a/pluginopiekabc/opieaddressee.cpp b/pluginopiekabc/opieaddressee.cpp
deleted file mode 100644
index 3325152..0000000
--- a/pluginopiekabc/opieaddressee.cpp
+++ b/dev/null
@@ -1,21 +0,0 @@
1#include <stdio.h>
2#include "opieaddressee.h"
3
4OpieAddressee::OpieAddressee(const OContact & ocontact) {
5 setOContact(ocontact);
6}
7
8OpieAddressee::OpieAddressee() {
9 empty = true;
10}
11
12void OpieAddressee::setOContact(const OContact & ocontact) {
13 contact = ocontact;
14 QString id;
15 id.setNum(contact.uid());
16 fName = contact.lastName() + ", " + contact.firstName();
17 rName = contact.fullName();
18 pEmail = contact.defaultEmail();
19 empty = false;
20}
21
diff --git a/pluginopiekabc/opieaddressee.h b/pluginopiekabc/opieaddressee.h
deleted file mode 100644
index b0e8b0d..0000000
--- a/pluginopiekabc/opieaddressee.h
+++ b/dev/null
@@ -1,16 +0,0 @@
1#include <opie/ocontact.h>
2#include <kabc/addressee.h>
3
4class OpieAddressee : public KABC::Addressee {
5
6 public:
7
8 OpieAddressee::OpieAddressee(const OContact & contact);
9 OpieAddressee::OpieAddressee();
10 void setOContact(const OContact & contact);
11
12 private:
13 OContact contact;
14 QString id;
15 bool empty;
16};
diff --git a/pluginopiekabc/pluginopiekabcE.pro b/pluginopiekabc/pluginopiekabcE.pro
deleted file mode 100644
index 8411fc5..0000000
--- a/pluginopiekabc/pluginopiekabcE.pro
+++ b/dev/null
@@ -1,27 +0,0 @@
1 TEMPLATE= lib
2 CONFIG += qt warn_on release
3
4 TARGET = opiekabc
5OBJECTS_DIR = obj/$(PLATFORM)
6MOC_DIR = moc/$(PLATFORM)
7DESTDIR=$(QPEDIR)/plugins/korganizer
8INCLUDEPATH += $(QPEDIR)/include ../libkabcwrap $(OPIEDIR)/include
9DEFINES +=
10LIBS += -L$(QPEDIR)/lib
11LIBS += -lmicrokabc
12LIBS += -lopie
13LIBS += -lqpe
14LIBS += -lqte
15
16INTERFACES = \
17
18#select_attendee_base.ui
19
20HEADERS = \
21 opieaddressbookplugin.h \
22 opieaddressee.h
23
24SOURCES = \
25 opieaddressbookplugin.cpp \
26 opieaddressee.cpp
27