-rwxr-xr-x | libkdepim/ol_access.h | 174 |
1 files changed, 174 insertions, 0 deletions
diff --git a/libkdepim/ol_access.h b/libkdepim/ol_access.h new file mode 100755 index 0000000..85dbc6c --- a/dev/null +++ b/libkdepim/ol_access.h | |||
@@ -0,0 +1,174 @@ | |||
1 | /* | ||
2 | This file is part of KDE/Pim-Pi | ||
3 | Copyright (c) 2006 Lutz Rogowski | ||
4 | |||
5 | This program is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published by | ||
7 | the Free Software Foundation; either version 2 of the License, or | ||
8 | (at your option) any later version. | ||
9 | |||
10 | This program 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 | ||
13 | GNU General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with this program; if not, write to the Free Software | ||
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
18 | |||
19 | As a special exception, permission is given to link this program | ||
20 | with any edition of Qt, and distribute the resulting executable, | ||
21 | without including the source code for Qt in the source distribution. | ||
22 | */ | ||
23 | #ifndef OL_ACCESS_H | ||
24 | #define OL_ACCESS_H | ||
25 | |||
26 | #include <qstring.h> | ||
27 | |||
28 | #include <kdialogbase.h> | ||
29 | #include <kabc/addressee.h> | ||
30 | #include <kabc/addressbook.h> | ||
31 | |||
32 | #include <afxdisp.h> | ||
33 | |||
34 | #include "../outport/msoutl9.h" | ||
35 | |||
36 | #define OL_CONTACT_DATA 2 | ||
37 | #define OL_CALENDAR_DATA 1 //pending is this the right number | ||
38 | |||
39 | class QDateTime; | ||
40 | class QListView; | ||
41 | class OLEListViewItem; | ||
42 | class _ContactItem; | ||
43 | class OL_access : public QObject | ||
44 | { | ||
45 | Q_OBJECT | ||
46 | public: | ||
47 | static OL_access *instance(); | ||
48 | ~OL_access(); | ||
49 | //static converter methods | ||
50 | static QDateTime mDdate2Qdtr( DATE dt); | ||
51 | static DATE Qdt2date( QDateTime dt ); | ||
52 | static KABC::Addressee ol2kapiContact( _ContactItem * aItem , bool syncMode); | ||
53 | static void writeData2OLitem( KABC::Addressee addressee, _ContactItem * aItem ); | ||
54 | |||
55 | KABC::Addressee::List importOLcontacts(); | ||
56 | QStringList getFolderSelection( int type, QString caption ); | ||
57 | void readContactData( LPDISPATCH folder, KABC::Addressee::List* list, bool syncMode ); | ||
58 | |||
59 | LPDISPATCH getFolderFromID( LPDISPATCH parentFolder, QString selectedFolderID ); | ||
60 | bool setSelectedFolder( QString folderID ); | ||
61 | //call setSelectedFolder() before using the next methods: | ||
62 | void deleteAddressee( KABC::Addressee a ); | ||
63 | KABC::Addressee changeAddressee( KABC::Addressee a ); | ||
64 | KABC::Addressee addAddressee( KABC::Addressee a ); | ||
65 | |||
66 | |||
67 | |||
68 | |||
69 | public slots: | ||
70 | |||
71 | |||
72 | signals: | ||
73 | |||
74 | protected slots: | ||
75 | |||
76 | |||
77 | protected: | ||
78 | |||
79 | private: | ||
80 | _Application gOlAppAB; | ||
81 | bool mErrorInit; | ||
82 | void addFolder(OLEListViewItem* iParent, LPDISPATCH dispParent, long fType); | ||
83 | LPDISPATCH getOLcontactItemFromUid( QString uid ); | ||
84 | |||
85 | QString mSelectedFolderID; | ||
86 | LPDISPATCH mSelectedFolder; | ||
87 | _Items mFolderItems; | ||
88 | |||
89 | OL_access(); | ||
90 | static OL_access *sInstance; | ||
91 | }; | ||
92 | |||
93 | |||
94 | #if 0 | ||
95 | //using namespace KABC; | ||
96 | //class KABC::AddressBook; | ||
97 | |||
98 | /** | ||
99 | This is the base class for the calendar component editors. | ||
100 | */ | ||
101 | class KAImportOLdialog : public KDialogBase | ||
102 | { | ||
103 | Q__OBJECT | ||
104 | public: | ||
105 | /** | ||
106 | Construct new IncidenceEditor. | ||
107 | */ | ||
108 | KAImportOLdialog( const QString &caption, KABC::AddressBook * aBook, | ||
109 | QWidget *parent ); | ||
110 | ~KAImportOLdialog(); | ||
111 | |||
112 | /** Initialize editor. This function creates the tab widgets. */ | ||
113 | void init(); | ||
114 | void setSyncMode(); | ||
115 | KABC::Addressee::List getAddressList(); | ||
116 | QString selectedFolderID() {return mSelectedFolderID;} | ||
117 | static KABC::Addressee ol2kapiContact( _ContactItem * , bool syncMode ); | ||
118 | static bool sOLDispatch; | ||
119 | pub_lic sl_ots: | ||
120 | |||
121 | |||
122 | sign_als: | ||
123 | |||
124 | prote_cted slo_ts: | ||
125 | void slotApply(); | ||
126 | void slotOk(); | ||
127 | void slotCancel(); | ||
128 | |||
129 | protected: | ||
130 | void setupFolderView(); | ||
131 | void addFolder(OLEListViewItem* iParent, LPDISPATCH dispParent); | ||
132 | void readContactData( DWORD folder ); | ||
133 | |||
134 | KABC::AddressBook * mABook; | ||
135 | QListView * mListView; | ||
136 | KABC::Addressee::List mAList; | ||
137 | bool addAddressee( KABC::Addressee a ); | ||
138 | private: | ||
139 | int importedItems; | ||
140 | bool mSyncMode; | ||
141 | QString mSelectedFolderID; | ||
142 | }; | ||
143 | class KAwritebackOL : public QObject | ||
144 | { | ||
145 | Q__OBJECT | ||
146 | public: | ||
147 | KAwritebackOL( const QString &olFolderID ); | ||
148 | ~KAwritebackOL(); | ||
149 | bool init(); | ||
150 | void deleteAddressee( KABC::Addressee a ); | ||
151 | KABC::Addressee changeAddressee( KABC::Addressee a ); | ||
152 | KABC::Addressee addAddressee( KABC::Addressee a ); | ||
153 | public sl_ots: | ||
154 | |||
155 | |||
156 | signals: | ||
157 | |||
158 | protected sl_ots: | ||
159 | |||
160 | |||
161 | protected: | ||
162 | LPDISPATCH getFolderFromID( LPDISPATCH parentFolder ); | ||
163 | LPDISPATCH getOLitemFromUid( QString uid ); | ||
164 | void writeData2OLitem( KABC::Addressee a, _ContactItem * olitem ); | ||
165 | private: | ||
166 | QString mSelectedFolderID; | ||
167 | LPDISPATCH mSelectedFolder; | ||
168 | _Items mFolderItems; | ||
169 | }; | ||
170 | |||
171 | #endif | ||
172 | #endif | ||
173 | |||
174 | |||