summaryrefslogtreecommitdiffabout
authorulf69 <ulf69>2004-08-02 18:28:27 (UTC)
committer ulf69 <ulf69>2004-08-02 18:28:27 (UTC)
commit983127ce46c9ff6663d08dedd450da3fe7dd549b (patch) (unidiff)
treeb6c5bf6bffbddb80ef405a6fc322bfa8bfe13d98
parent09fe5a5325105b5051d22feb8dae6bb1f9875ff3 (diff)
downloadkdepimpi-983127ce46c9ff6663d08dedd450da3fe7dd549b.zip
kdepimpi-983127ce46c9ff6663d08dedd450da3fe7dd549b.tar.gz
kdepimpi-983127ce46c9ff6663d08dedd450da3fe7dd549b.tar.bz2
implemented the exportclasses for opie, qtopia and sharp as part of kaddressbook and not as additional libraries.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kaddressbook.pro8
-rw-r--r--kaddressbook/kaddressbookE.pro8
-rw-r--r--kaddressbook/xxportmanager.cpp15
-rw-r--r--kaddressbook/xxportobject.cpp21
-rw-r--r--kaddressbook/xxportobject.h35
5 files changed, 78 insertions, 9 deletions
diff --git a/kaddressbook/kaddressbook.pro b/kaddressbook/kaddressbook.pro
index 77fce1b..0da5842 100644
--- a/kaddressbook/kaddressbook.pro
+++ b/kaddressbook/kaddressbook.pro
@@ -3,13 +3,13 @@ CONFIG = qt warn_on
3 TARGET = kapi 3 TARGET = kapi
4DESTDIR= ../bin 4DESTDIR= ../bin
5 5
6include( ../variables.pri ) 6include( ../variables.pri )
7 7
8 8
9INCLUDEPATH += . ./details ./features ./kcmconfigs ./xxport ../microkde ../microkde/kdecore ../microkde/kutils ../microkde/kio/kfile ../microkde/kio/kio ../microkde/kdeui ../kabc ../ interfaces 9INCLUDEPATH += . ./details ./features ./kcmconfigs ./xxport ../microkde ../microkde/kdecore ../microkde/kutils ../microkde/kio/kfile ../microkde/kio/kio ../microkde/kdeui ../microkde/kresources ../kabc ../ interfaces
10DEFINES += KAB_EMBEDDED KAB_NOSPLITTER DESKTOP_VERSION 10DEFINES += KAB_EMBEDDED KAB_NOSPLITTER DESKTOP_VERSION
11 11
12unix : { 12unix : {
13LIBS += ../bin/libmicrokdepim.so 13LIBS += ../bin/libmicrokdepim.so
14LIBS += ../bin/libmicrokde.so 14LIBS += ../bin/libmicrokde.so
15LIBS += ../bin/libmicrokabc.so 15LIBS += ../bin/libmicrokabc.so
@@ -94,12 +94,15 @@ views/cardview.h \
94views/colorlistbox.h \ 94views/colorlistbox.h \
95views/contactlistview.h \ 95views/contactlistview.h \
96xxport/vcard_xxport.h \ 96xxport/vcard_xxport.h \
97xxport/kde2_xxport.h \ 97xxport/kde2_xxport.h \
98xxport/csv_xxport.h \ 98xxport/csv_xxport.h \
99xxport/csvimportdialog.h \ 99xxport/csvimportdialog.h \
100xxport/opie_xxport.h \
101xxport/qtopia_xxport.h \
102xxport/sharpdtm_xxport.h \
100#details/look_details.h \ 103#details/look_details.h \
101#mainwindoiw.h \ 104#mainwindoiw.h \
102# alarmclient.h \ 105# alarmclient.h \
103# calendarview.h \ 106# calendarview.h \
104# customlistviewitem.h \ 107# customlistviewitem.h \
105# datenavigator.h 108# datenavigator.h
@@ -157,12 +160,15 @@ views/cardview.cpp \
157views/contactlistview.cpp \ 160views/contactlistview.cpp \
158views/colorlistbox.cpp \ 161views/colorlistbox.cpp \
159xxport/vcard_xxport.cpp \ 162xxport/vcard_xxport.cpp \
160xxport/kde2_xxport.cpp \ 163xxport/kde2_xxport.cpp \
161xxport/csv_xxport.cpp \ 164xxport/csv_xxport.cpp \
162xxport/csvimportdialog.cpp \ 165xxport/csvimportdialog.cpp \
166xxport/opie_xxport.cpp \
167xxport/qtopia_xxport.cpp \
168xxport/sharpdtm_xxport.cpp \
163#details/look_details.cpp \ 169#details/look_details.cpp \
164#mainwindow.cpp \ 170#mainwindow.cpp \
165# calendarview.cpp \ 171# calendarview.cpp \
166# timespanview.cpp 172# timespanview.cpp
167 173
168 174
diff --git a/kaddressbook/kaddressbookE.pro b/kaddressbook/kaddressbookE.pro
index dc4a2f2..95e6641 100644
--- a/kaddressbook/kaddressbookE.pro
+++ b/kaddressbook/kaddressbookE.pro
@@ -7,13 +7,13 @@ OBJECTS_DIR = obj/$(PLATFORM)
7MOC_DIR = moc/$(PLATFORM) 7MOC_DIR = moc/$(PLATFORM)
8DESTDIR=$(QPEDIR)/bin 8DESTDIR=$(QPEDIR)/bin
9 9
10#LFLAGS += -Wl,-export-dynamic 10#LFLAGS += -Wl,-export-dynamic
11 11
12 12
13INCLUDEPATH += . ./details ./features ./kcmconfigs ./xxport ../microkde ../microkde/kdecore ../microkde/kutils ../microkde/kio/kfile ../microkde/kio/kio ../microkde/kdeui ../kabc ../qtcompat ../ interfaces $(QPEDIR)/include 13INCLUDEPATH += . ./details ./features ./kcmconfigs ./xxport ../microkde ../microkde/kdecore ../microkde/kutils ../microkde/kio/kfile ../microkde/kio/kio ../microkde/kdeui ../microkde/kresources ../kabc ../qtcompat ../ interfaces $(QPEDIR)/include
14DEFINES += KAB_EMBEDDED KAB_NOSPLITTER 14DEFINES += KAB_EMBEDDED KAB_NOSPLITTER
15#DEFINES += KORG_NODND KORG_NOPLUGINS KORG_NOKABC KORG_NOARCHIVE KORG_NOMAIL 15#DEFINES += KORG_NODND KORG_NOPLUGINS KORG_NOKABC KORG_NOARCHIVE KORG_NOMAIL
16#DEFINES += KORG_NOPRINTER KORG_NODCOP KORG_NOKALARMD KORG_NORESOURCEVIEW KORG_NOSPLITTER 16#DEFINES += KORG_NOPRINTER KORG_NODCOP KORG_NOKALARMD KORG_NORESOURCEVIEW KORG_NOSPLITTER
17#DEFINES += KORG_NOLVALTERNATION 17#DEFINES += KORG_NOLVALTERNATION
18LIBS += -lmicrokdepim 18LIBS += -lmicrokdepim
19#LIBS += -lmicrokcal 19#LIBS += -lmicrokcal
@@ -84,12 +84,15 @@ views/cardview.h \
84views/colorlistbox.h \ 84views/colorlistbox.h \
85views/contactlistview.h \ 85views/contactlistview.h \
86xxport/vcard_xxport.h \ 86xxport/vcard_xxport.h \
87xxport/kde2_xxport.h \ 87xxport/kde2_xxport.h \
88xxport/csv_xxport.h \ 88xxport/csv_xxport.h \
89xxport/csvimportdialog.h \ 89xxport/csvimportdialog.h \
90xxport/opie_xxport.h \
91xxport/qtopia_xxport.h \
92xxport/sharpdtm_xxport.h \
90#details/look_details.h \ 93#details/look_details.h \
91#mainwindoiw.h \ 94#mainwindoiw.h \
92# alarmclient.h \ 95# alarmclient.h \
93# calendarview.h \ 96# calendarview.h \
94# customlistviewitem.h \ 97# customlistviewitem.h \
95# datenavigator.h 98# datenavigator.h
@@ -147,11 +150,14 @@ views/cardview.cpp \
147views/contactlistview.cpp \ 150views/contactlistview.cpp \
148views/colorlistbox.cpp \ 151views/colorlistbox.cpp \
149xxport/vcard_xxport.cpp \ 152xxport/vcard_xxport.cpp \
150xxport/kde2_xxport.cpp \ 153xxport/kde2_xxport.cpp \
151xxport/csv_xxport.cpp \ 154xxport/csv_xxport.cpp \
152xxport/csvimportdialog.cpp \ 155xxport/csvimportdialog.cpp \
156xxport/opie_xxport.cpp \
157xxport/qtopia_xxport.cpp \
158xxport/sharpdtm_xxport.cpp \
153#details/look_details.cpp \ 159#details/look_details.cpp \
154#mainwindow.cpp \ 160#mainwindow.cpp \
155# calendarview.cpp \ 161# calendarview.cpp \
156# timespanview.cpp 162# timespanview.cpp
157 163
diff --git a/kaddressbook/xxportmanager.cpp b/kaddressbook/xxportmanager.cpp
index 2962951..a6797c9 100644
--- a/kaddressbook/xxportmanager.cpp
+++ b/kaddressbook/xxportmanager.cpp
@@ -40,15 +40,18 @@ $Id$
40 40
41#ifndef KAB_EMBEDDED 41#ifndef KAB_EMBEDDED
42#include <ktrader.h> 42#include <ktrader.h>
43#else //KAB_EMBEDDED 43#else //KAB_EMBEDDED
44extern "C" 44extern "C"
45{ 45{
46 void* init_kaddrbk_csv_xxport(); 46 void* init_microkaddrbk_csv_xxport();
47 void* init_kaddrbk_kde2_xxport(); 47 void* init_microkaddrbk_kde2_xxport();
48 void* init_kaddrbk_vcard_xxport(); 48 void* init_microkaddrbk_vcard_xxport();
49 void* init_microkaddrbk_opie_xxport();
50 void* init_microkaddrbk_qtopia_xxport();
51 void* init_microkaddrbk_sharpdtm_xxport();
49} 52}
50#endif //KAB_EMBEDDED 53#endif //KAB_EMBEDDED
51 54
52#include <libkdepim/addresseeview.h> 55#include <libkdepim/addresseeview.h>
53 56
54#include "kabcore.h" 57#include "kabcore.h"
@@ -189,15 +192,15 @@ void XXPortManager::loadPlugins()
189 kdDebug(5720) << "XXPortManager::loadExtensions(): Cast failed" << endl; 192 kdDebug(5720) << "XXPortManager::loadExtensions(): Cast failed" << endl;
190 continue; 193 continue;
191 } 194 }
192 195
193#else //KAB_EMBEDDED 196#else //KAB_EMBEDDED
194 QList<XXPortFactory> factorylist; 197 QList<XXPortFactory> factorylist;
195 factorylist.append(static_cast<XXPortFactory*>(init_kaddrbk_csv_xxport())); 198 factorylist.append(static_cast<XXPortFactory*>(init_microkaddrbk_csv_xxport()));
196 factorylist.append(static_cast<XXPortFactory*>(init_kaddrbk_kde2_xxport())); 199 factorylist.append(static_cast<XXPortFactory*>(init_microkaddrbk_kde2_xxport()));
197 factorylist.append(static_cast<XXPortFactory*>(init_kaddrbk_vcard_xxport())); 200 factorylist.append(static_cast<XXPortFactory*>(init_microkaddrbk_vcard_xxport()));
198 201
199 //add the opie import library dynamically 202 //add the opie import library dynamically
200 KLibFactory *factory = KLibLoader::self()->factory( "microkaddrbk_opie_xxport" ); 203 KLibFactory *factory = KLibLoader::self()->factory( "microkaddrbk_opie_xxport" );
201 if ( factory ) { 204 if ( factory ) {
202 XXPortFactory *xxportFactory = static_cast<XXPortFactory*>( factory ); 205 XXPortFactory *xxportFactory = static_cast<XXPortFactory*>( factory );
203 factorylist.append(xxportFactory); 206 factorylist.append(xxportFactory);
diff --git a/kaddressbook/xxportobject.cpp b/kaddressbook/xxportobject.cpp
index 42ab0fb..bb985a6 100644
--- a/kaddressbook/xxportobject.cpp
+++ b/kaddressbook/xxportobject.cpp
@@ -144,9 +144,30 @@ void XXPortObject::slotExportActivated( const QString &data )
144 144
145void XXPortObject::slotImportActivated( const QString &data ) 145void XXPortObject::slotImportActivated( const QString &data )
146{ 146{
147 emit importActivated( identifier(), ( data == "<empty>" ? QString::null : data ) ); 147 emit importActivated( identifier(), ( data == "<empty>" ? QString::null : data ) );
148} 148}
149 149
150/********************************************************************
151 *
152 *******************************************************************/
153
154
155XXPortResourceObject::XXPortResourceObject( KABC::AddressBook *ab, QWidget *parent,
156 const char *name )
157 : XXPortObject( ab, parent, name ), mResource(0)
158{
159}
160
161XXPortResourceObject::~XXPortResourceObject()
162{
163}
164
165bool XXPortResourceObject::isAvailable()
166{
167 return (mResource != 0);
168}
169
170
150#ifndef KAB_EMBEDDED 171#ifndef KAB_EMBEDDED
151#include "xxportobject.moc" 172#include "xxportobject.moc"
152#endif //KAB_EMBEDDED 173#endif //KAB_EMBEDDED
diff --git a/kaddressbook/xxportobject.h b/kaddressbook/xxportobject.h
index fddc219..d547855 100644
--- a/kaddressbook/xxportobject.h
+++ b/kaddressbook/xxportobject.h
@@ -32,16 +32,20 @@ $Id$
32#define XXPORTOBJECT_H 32#define XXPORTOBJECT_H
33 33
34#include <qobject.h> 34#include <qobject.h>
35 35
36#include <kabc/addressbook.h> 36#include <kabc/addressbook.h>
37#include <kabc/addresseelist.h> 37#include <kabc/addresseelist.h>
38#include <kabc/resource.h>
38#include <kxmlguiclient.h> 39#include <kxmlguiclient.h>
39#include <klibloader.h> 40#include <klibloader.h>
40 41
41 42
43
44
45
42class XXPortObject : public QObject, virtual public KXMLGUIClient 46class XXPortObject : public QObject, virtual public KXMLGUIClient
43{ 47{
44 Q_OBJECT 48 Q_OBJECT
45 49
46 public: 50 public:
47 XXPortObject( KABC::AddressBook *ab, QWidget *parent, const char *name = 0 ); 51 XXPortObject( KABC::AddressBook *ab, QWidget *parent, const char *name = 0 );
@@ -56,12 +60,19 @@ class XXPortObject : public QObject, virtual public KXMLGUIClient
56 /** 60 /**
57 Reimplement this method if the XXPortManager shall 61 Reimplement this method if the XXPortManager shall
58 pass a sorted list to @ref exportContacts(). 62 pass a sorted list to @ref exportContacts().
59 */ 63 */
60 virtual bool requiresSorting() const { return false; } 64 virtual bool requiresSorting() const { return false; }
61 65
66 /**
67 Returns true if the XXPortObject can be used.
68 One case it can not be used is for example if a needed lib could not be loaded.
69 */
70 virtual bool isAvailable() const { return true; };
71
72
62 public slots: 73 public slots:
63 /** 74 /**
64 Reimplement this method for exporting the contacts. 75 Reimplement this method for exporting the contacts.
65 */ 76 */
66 virtual bool exportContacts( const KABC::AddresseeList &list, const QString& identifier ); 77 virtual bool exportContacts( const KABC::AddresseeList &list, const QString& identifier );
67 78
@@ -104,25 +115,47 @@ class XXPortObject : public QObject, virtual public KXMLGUIClient
104 /** 115 /**
105 Returns a pointer to the parent widget. It can be used as parent for 116 Returns a pointer to the parent widget. It can be used as parent for
106 message boxes. 117 message boxes.
107 */ 118 */
108 QWidget *parentWidget() const; 119 QWidget *parentWidget() const;
109 120
110 121
111 private slots: 122 private slots:
112 void slotImportActivated( const QString& ); 123 void slotImportActivated( const QString& );
113 void slotExportActivated( const QString& ); 124 void slotExportActivated( const QString& );
114 125
115 private: 126 private:
116 KABC::AddressBook *mAddressBook; 127 KABC::AddressBook *mAddressBook;
117 QWidget *mParentWidget; 128 QWidget *mParentWidget;
118 129
119 class XXPortObjectPrivate; 130 class XXPortObjectPrivate;
120 XXPortObjectPrivate *d; 131 XXPortObjectPrivate *d;
121}; 132};
122 133
134
135
136class XXPortResourceObject : public XXPortObject
137{
138 Q_OBJECT
139
140 public:
141 XXPortResourceObject( KABC::AddressBook *ab, QWidget *parent, const char *name = 0 );
142 ~XXPortResourceObject();
143
144 /**
145 Returns true if the XXPortObject can be used.
146 One case it can not be used is for example if a needed lib could not be loaded.
147 */
148 virtual bool isAvailable();
149 protected:
150 KABC::Resource* mResource;
151};
152
153
154
155
123class XXPortFactory : public KLibFactory 156class XXPortFactory : public KLibFactory
124{ 157{
125 public: 158 public:
126 virtual XXPortObject *xxportObject( KABC::AddressBook *ab, QWidget *parent, 159 virtual XXPortObject *xxportObject( KABC::AddressBook *ab, QWidget *parent,
127 const char *name = 0 ) = 0; 160 const char *name = 0 ) = 0;
128 161