-rw-r--r-- | kaddressbook/kabcore.cpp | 9 | ||||
-rw-r--r-- | kaddressbook/kabcore.h | 1 | ||||
-rw-r--r-- | kaddressbook/xxportselectdialog.cpp | 11 | ||||
-rw-r--r-- | libkdepim/externalapphandler.cpp | 4 |
4 files changed, 15 insertions, 10 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index e34951a..ce5c755 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -1,3396 +1,3399 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KAddressbook. | 2 | This file is part of KAddressbook. |
3 | Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> | 3 | Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 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 | 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 | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 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 | 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. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | Async a special exception, permission is given to link this program | 19 | Async a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | /*s | 24 | /*s |
25 | Enhanced Version of the file for platform independent KDE tools. | 25 | Enhanced Version of the file for platform independent KDE tools. |
26 | Copyright (c) 2004 Ulf Schenk | 26 | Copyright (c) 2004 Ulf Schenk |
27 | 27 | ||
28 | $Id$ | 28 | $Id$ |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #include "kabcore.h" | 31 | #include "kabcore.h" |
32 | 32 | ||
33 | #include <stdaddressbook.h> | 33 | #include <stdaddressbook.h> |
34 | #include <klocale.h> | 34 | #include <klocale.h> |
35 | #include <kfiledialog.h> | 35 | #include <kfiledialog.h> |
36 | #include <qtimer.h> | 36 | #include <qtimer.h> |
37 | #include <qlabel.h> | 37 | #include <qlabel.h> |
38 | #include <qregexp.h> | 38 | #include <qregexp.h> |
39 | #include <qlineedit.h> | 39 | #include <qlineedit.h> |
40 | #include <qcheckbox.h> | 40 | #include <qcheckbox.h> |
41 | #include <qpushbutton.h> | 41 | #include <qpushbutton.h> |
42 | #include <qprogressbar.h> | 42 | #include <qprogressbar.h> |
43 | #include <libkdepim/phoneaccess.h> | 43 | #include <libkdepim/phoneaccess.h> |
44 | 44 | ||
45 | #ifndef KAB_EMBEDDED | 45 | #ifndef KAB_EMBEDDED |
46 | #include <qclipboard.h> | 46 | #include <qclipboard.h> |
47 | #include <qdir.h> | 47 | #include <qdir.h> |
48 | #include <qfile.h> | 48 | #include <qfile.h> |
49 | #include <qapplicaton.h> | 49 | #include <qapplicaton.h> |
50 | #include <qprogressbar.h> | 50 | #include <qprogressbar.h> |
51 | #include <qlayout.h> | 51 | #include <qlayout.h> |
52 | #include <qregexp.h> | 52 | #include <qregexp.h> |
53 | #include <qvbox.h> | 53 | #include <qvbox.h> |
54 | #include <kabc/addresseelist.h> | 54 | #include <kabc/addresseelist.h> |
55 | #include <kabc/errorhandler.h> | 55 | #include <kabc/errorhandler.h> |
56 | #include <kabc/resource.h> | 56 | #include <kabc/resource.h> |
57 | #include <kabc/vcardconverter.h> | 57 | #include <kabc/vcardconverter.h> |
58 | #include <kapplication.h> | 58 | #include <kapplication.h> |
59 | #include <kactionclasses.h> | 59 | #include <kactionclasses.h> |
60 | #include <kcmultidialog.h> | 60 | #include <kcmultidialog.h> |
61 | #include <kdebug.h> | 61 | #include <kdebug.h> |
62 | #include <kdeversion.h> | 62 | #include <kdeversion.h> |
63 | #include <kkeydialog.h> | 63 | #include <kkeydialog.h> |
64 | #include <kmessagebox.h> | 64 | #include <kmessagebox.h> |
65 | #include <kprinter.h> | 65 | #include <kprinter.h> |
66 | #include <kprotocolinfo.h> | 66 | #include <kprotocolinfo.h> |
67 | #include <kresources/selectdialog.h> | 67 | #include <kresources/selectdialog.h> |
68 | #include <kstandarddirs.h> | 68 | #include <kstandarddirs.h> |
69 | #include <ktempfile.h> | 69 | #include <ktempfile.h> |
70 | #include <kxmlguiclient.h> | 70 | #include <kxmlguiclient.h> |
71 | #include <kaboutdata.h> | 71 | #include <kaboutdata.h> |
72 | #include <libkdepim/categoryselectdialog.h> | 72 | #include <libkdepim/categoryselectdialog.h> |
73 | 73 | ||
74 | #include "addresseeutil.h" | 74 | #include "addresseeutil.h" |
75 | #include "addresseeeditordialog.h" | 75 | #include "addresseeeditordialog.h" |
76 | #include "extensionmanager.h" | 76 | #include "extensionmanager.h" |
77 | #include "kstdaction.h" | 77 | #include "kstdaction.h" |
78 | #include "kaddressbookservice.h" | 78 | #include "kaddressbookservice.h" |
79 | #include "ldapsearchdialog.h" | 79 | #include "ldapsearchdialog.h" |
80 | #include "printing/printingwizard.h" | 80 | #include "printing/printingwizard.h" |
81 | #else // KAB_EMBEDDED | 81 | #else // KAB_EMBEDDED |
82 | 82 | ||
83 | #include <kapplication.h> | 83 | #include <kapplication.h> |
84 | #include "KDGanttMinimizeSplitter.h" | 84 | #include "KDGanttMinimizeSplitter.h" |
85 | #include "kaddressbookmain.h" | 85 | #include "kaddressbookmain.h" |
86 | #include "kactioncollection.h" | 86 | #include "kactioncollection.h" |
87 | #include "addresseedialog.h" | 87 | #include "addresseedialog.h" |
88 | //US | 88 | //US |
89 | #include <addresseeview.h> | 89 | #include <addresseeview.h> |
90 | 90 | ||
91 | #include <qapp.h> | 91 | #include <qapp.h> |
92 | #include <qmenubar.h> | 92 | #include <qmenubar.h> |
93 | //#include <qtoolbar.h> | 93 | //#include <qtoolbar.h> |
94 | #include <qmessagebox.h> | 94 | #include <qmessagebox.h> |
95 | #include <kdebug.h> | 95 | #include <kdebug.h> |
96 | #include <kiconloader.h> // needed for SmallIcon | 96 | #include <kiconloader.h> // needed for SmallIcon |
97 | #include <kresources/kcmkresources.h> | 97 | #include <kresources/kcmkresources.h> |
98 | #include <ktoolbar.h> | 98 | #include <ktoolbar.h> |
99 | 99 | ||
100 | 100 | ||
101 | //#include <qlabel.h> | 101 | //#include <qlabel.h> |
102 | 102 | ||
103 | 103 | ||
104 | #ifndef DESKTOP_VERSION | 104 | #ifndef DESKTOP_VERSION |
105 | #include <qpe/ir.h> | 105 | #include <qpe/ir.h> |
106 | #include <qpe/qpemenubar.h> | 106 | #include <qpe/qpemenubar.h> |
107 | #include <qtopia/qcopenvelope_qws.h> | 107 | #include <qtopia/qcopenvelope_qws.h> |
108 | #else | 108 | #else |
109 | 109 | ||
110 | #include <qmenubar.h> | 110 | #include <qmenubar.h> |
111 | #endif | 111 | #endif |
112 | 112 | ||
113 | #endif // KAB_EMBEDDED | 113 | #endif // KAB_EMBEDDED |
114 | #include "kcmconfigs/kcmkabconfig.h" | 114 | #include "kcmconfigs/kcmkabconfig.h" |
115 | #include "kcmconfigs/kcmkdepimconfig.h" | 115 | #include "kcmconfigs/kcmkdepimconfig.h" |
116 | #include "kpimglobalprefs.h" | 116 | #include "kpimglobalprefs.h" |
117 | #include "externalapphandler.h" | 117 | #include "externalapphandler.h" |
118 | #include "xxportselectdialog.h" | 118 | #include "xxportselectdialog.h" |
119 | 119 | ||
120 | 120 | ||
121 | #include <kresources/selectdialog.h> | 121 | #include <kresources/selectdialog.h> |
122 | #include <kmessagebox.h> | 122 | #include <kmessagebox.h> |
123 | 123 | ||
124 | #include <picture.h> | 124 | #include <picture.h> |
125 | #include <resource.h> | 125 | #include <resource.h> |
126 | 126 | ||
127 | //US#include <qsplitter.h> | 127 | //US#include <qsplitter.h> |
128 | #include <qmap.h> | 128 | #include <qmap.h> |
129 | #include <qdir.h> | 129 | #include <qdir.h> |
130 | #include <qfile.h> | 130 | #include <qfile.h> |
131 | #include <qvbox.h> | 131 | #include <qvbox.h> |
132 | #include <qlayout.h> | 132 | #include <qlayout.h> |
133 | #include <qclipboard.h> | 133 | #include <qclipboard.h> |
134 | #include <qtextstream.h> | 134 | #include <qtextstream.h> |
135 | #include <qradiobutton.h> | 135 | #include <qradiobutton.h> |
136 | #include <qbuttongroup.h> | 136 | #include <qbuttongroup.h> |
137 | 137 | ||
138 | #include <libkdepim/categoryselectdialog.h> | 138 | #include <libkdepim/categoryselectdialog.h> |
139 | #include <libkdepim/categoryeditdialog.h> | 139 | #include <libkdepim/categoryeditdialog.h> |
140 | #include <kabc/vcardconverter.h> | 140 | #include <kabc/vcardconverter.h> |
141 | 141 | ||
142 | 142 | ||
143 | #include "addresseeutil.h" | 143 | #include "addresseeutil.h" |
144 | #include "undocmds.h" | 144 | #include "undocmds.h" |
145 | #include "addresseeeditordialog.h" | 145 | #include "addresseeeditordialog.h" |
146 | #include "viewmanager.h" | 146 | #include "viewmanager.h" |
147 | #include "details/detailsviewcontainer.h" | 147 | #include "details/detailsviewcontainer.h" |
148 | #include "kabprefs.h" | 148 | #include "kabprefs.h" |
149 | #include "xxportmanager.h" | 149 | #include "xxportmanager.h" |
150 | #include "incsearchwidget.h" | 150 | #include "incsearchwidget.h" |
151 | #include "jumpbuttonbar.h" | 151 | #include "jumpbuttonbar.h" |
152 | #include "extensionmanager.h" | 152 | #include "extensionmanager.h" |
153 | #include "addresseeconfig.h" | 153 | #include "addresseeconfig.h" |
154 | #include "nameeditdialog.h" | 154 | #include "nameeditdialog.h" |
155 | #include <kcmultidialog.h> | 155 | #include <kcmultidialog.h> |
156 | 156 | ||
157 | #ifdef _WIN32_ | 157 | #ifdef _WIN32_ |
158 | #ifdef _OL_IMPORT_ | 158 | #ifdef _OL_IMPORT_ |
159 | #include "kaimportoldialog.h" | 159 | #include "kaimportoldialog.h" |
160 | #endif | 160 | #endif |
161 | #else | 161 | #else |
162 | #include <unistd.h> | 162 | #include <unistd.h> |
163 | #endif | 163 | #endif |
164 | // sync includes | 164 | // sync includes |
165 | #include <libkdepim/ksyncprofile.h> | 165 | #include <libkdepim/ksyncprofile.h> |
166 | #include <libkdepim/ksyncprefsdialog.h> | 166 | #include <libkdepim/ksyncprefsdialog.h> |
167 | 167 | ||
168 | 168 | ||
169 | class KABCatPrefs : public QDialog | 169 | class KABCatPrefs : public QDialog |
170 | { | 170 | { |
171 | public: | 171 | public: |
172 | KABCatPrefs( QWidget *parent=0, const char *name=0 ) : | 172 | KABCatPrefs( QWidget *parent=0, const char *name=0 ) : |
173 | QDialog( parent, name, true ) | 173 | QDialog( parent, name, true ) |
174 | { | 174 | { |
175 | setCaption( i18n("Manage new Categories") ); | 175 | setCaption( i18n("Manage new Categories") ); |
176 | QVBoxLayout* lay = new QVBoxLayout( this ); | 176 | QVBoxLayout* lay = new QVBoxLayout( this ); |
177 | lay->setSpacing( 3 ); | 177 | lay->setSpacing( 3 ); |
178 | lay->setMargin( 3 ); | 178 | lay->setMargin( 3 ); |
179 | QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\naddressees\nwhich are not in the category list.\nPlease choose what to do:\n "), this ); | 179 | QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\naddressees\nwhich are not in the category list.\nPlease choose what to do:\n "), this ); |
180 | lay->addWidget( lab ); | 180 | lay->addWidget( lab ); |
181 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); | 181 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); |
182 | lay->addWidget( format ); | 182 | lay->addWidget( format ); |
183 | format->setExclusive ( true ) ; | 183 | format->setExclusive ( true ) ; |
184 | addCatBut = new QRadioButton(i18n("Add to category list"), format ); | 184 | addCatBut = new QRadioButton(i18n("Add to category list"), format ); |
185 | new QRadioButton(i18n("Remove from addressees"), format ); | 185 | new QRadioButton(i18n("Remove from addressees"), format ); |
186 | addCatBut->setChecked( true ); | 186 | addCatBut->setChecked( true ); |
187 | QPushButton * ok = new QPushButton( i18n("OK"), this ); | 187 | QPushButton * ok = new QPushButton( i18n("OK"), this ); |
188 | lay->addWidget( ok ); | 188 | lay->addWidget( ok ); |
189 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 189 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
190 | lay->addWidget( cancel ); | 190 | lay->addWidget( cancel ); |
191 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 191 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
192 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 192 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
193 | resize( 200, 200 ); | 193 | resize( 200, 200 ); |
194 | } | 194 | } |
195 | 195 | ||
196 | bool addCat() { return addCatBut->isChecked(); } | 196 | bool addCat() { return addCatBut->isChecked(); } |
197 | private: | 197 | private: |
198 | QRadioButton* addCatBut; | 198 | QRadioButton* addCatBut; |
199 | }; | 199 | }; |
200 | 200 | ||
201 | class KABFormatPrefs : public QDialog | 201 | class KABFormatPrefs : public QDialog |
202 | { | 202 | { |
203 | public: | 203 | public: |
204 | KABFormatPrefs( QWidget *parent=0, const char *name=0 ) : | 204 | KABFormatPrefs( QWidget *parent=0, const char *name=0 ) : |
205 | QDialog( parent, name, true ) | 205 | QDialog( parent, name, true ) |
206 | { | 206 | { |
207 | setCaption( i18n("Set formatted name") ); | 207 | setCaption( i18n("Set formatted name") ); |
208 | QVBoxLayout* lay = new QVBoxLayout( this ); | 208 | QVBoxLayout* lay = new QVBoxLayout( this ); |
209 | lay->setSpacing( 3 ); | 209 | lay->setSpacing( 3 ); |
210 | lay->setMargin( 3 ); | 210 | lay->setMargin( 3 ); |
211 | QLabel * lab = new QLabel( i18n("You can set the formatted name\nfor a list of contacts in one go."), this ); | 211 | QLabel * lab = new QLabel( i18n("You can set the formatted name\nfor a list of contacts in one go."), this ); |
212 | lay->addWidget( lab ); | 212 | lay->addWidget( lab ); |
213 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("Set formatted name to:"), this ); | 213 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("Set formatted name to:"), this ); |
214 | lay->addWidget( format ); | 214 | lay->addWidget( format ); |
215 | format->setExclusive ( true ) ; | 215 | format->setExclusive ( true ) ; |
216 | simple = new QRadioButton(i18n("Simple: James Bond"), format ); | 216 | simple = new QRadioButton(i18n("Simple: James Bond"), format ); |
217 | full = new QRadioButton(i18n("Full: Mr. James 007 Bond I"), format ); | 217 | full = new QRadioButton(i18n("Full: Mr. James 007 Bond I"), format ); |
218 | reverse = new QRadioButton(i18n("Reverse: Bond, James"), format ); | 218 | reverse = new QRadioButton(i18n("Reverse: Bond, James"), format ); |
219 | company = new QRadioButton(i18n("Organization: MI6"), format ); | 219 | company = new QRadioButton(i18n("Organization: MI6"), format ); |
220 | simple->setChecked( true ); | 220 | simple->setChecked( true ); |
221 | setCompany = new QCheckBox(i18n("Set formatted name to\norganization, if name empty"), this); | 221 | setCompany = new QCheckBox(i18n("Set formatted name to\norganization, if name empty"), this); |
222 | lay->addWidget( setCompany ); | 222 | lay->addWidget( setCompany ); |
223 | QPushButton * ok = new QPushButton( i18n("Select contact list"), this ); | 223 | QPushButton * ok = new QPushButton( i18n("Select contact list"), this ); |
224 | lay->addWidget( ok ); | 224 | lay->addWidget( ok ); |
225 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 225 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
226 | lay->addWidget( cancel ); | 226 | lay->addWidget( cancel ); |
227 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 227 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
228 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 228 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
229 | //resize( 200, 200 ); | 229 | //resize( 200, 200 ); |
230 | 230 | ||
231 | } | 231 | } |
232 | public: | 232 | public: |
233 | QRadioButton* simple, *full, *reverse, *company; | 233 | QRadioButton* simple, *full, *reverse, *company; |
234 | QCheckBox* setCompany; | 234 | QCheckBox* setCompany; |
235 | }; | 235 | }; |
236 | 236 | ||
237 | 237 | ||
238 | 238 | ||
239 | class KAex2phonePrefs : public QDialog | 239 | class KAex2phonePrefs : public QDialog |
240 | { | 240 | { |
241 | public: | 241 | public: |
242 | KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) : | 242 | KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) : |
243 | QDialog( parent, name, true ) | 243 | QDialog( parent, name, true ) |
244 | { | 244 | { |
245 | setCaption( i18n("Export to phone options") ); | 245 | setCaption( i18n("Export to phone options") ); |
246 | QVBoxLayout* lay = new QVBoxLayout( this ); | 246 | QVBoxLayout* lay = new QVBoxLayout( this ); |
247 | lay->setSpacing( 3 ); | 247 | lay->setSpacing( 3 ); |
248 | lay->setMargin( 3 ); | 248 | lay->setMargin( 3 ); |
249 | QLabel *lab; | 249 | QLabel *lab; |
250 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); | 250 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); |
251 | lab->setAlignment (AlignHCenter ); | 251 | lab->setAlignment (AlignHCenter ); |
252 | QHBox* temphb; | 252 | QHBox* temphb; |
253 | temphb = new QHBox( this ); | 253 | temphb = new QHBox( this ); |
254 | new QLabel( i18n("I/O device: "), temphb ); | 254 | new QLabel( i18n("I/O device: "), temphb ); |
255 | mPhoneDevice = new QLineEdit( temphb); | 255 | mPhoneDevice = new QLineEdit( temphb); |
256 | lay->addWidget( temphb ); | 256 | lay->addWidget( temphb ); |
257 | temphb = new QHBox( this ); | 257 | temphb = new QHBox( this ); |
258 | new QLabel( i18n("Connection: "), temphb ); | 258 | new QLabel( i18n("Connection: "), temphb ); |
259 | mPhoneConnection = new QLineEdit( temphb); | 259 | mPhoneConnection = new QLineEdit( temphb); |
260 | lay->addWidget( temphb ); | 260 | lay->addWidget( temphb ); |
261 | temphb = new QHBox( this ); | 261 | temphb = new QHBox( this ); |
262 | new QLabel( i18n("Model(opt.): "), temphb ); | 262 | new QLabel( i18n("Model(opt.): "), temphb ); |
263 | mPhoneModel = new QLineEdit( temphb); | 263 | mPhoneModel = new QLineEdit( temphb); |
264 | lay->addWidget( temphb ); | 264 | lay->addWidget( temphb ); |
265 | // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this ); | 265 | // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this ); |
266 | // lay->addWidget( mWriteToSim ); | 266 | // lay->addWidget( mWriteToSim ); |
267 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) ); | 267 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) ); |
268 | lab->setAlignment (AlignHCenter); | 268 | lab->setAlignment (AlignHCenter); |
269 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); | 269 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); |
270 | lay->addWidget( ok ); | 270 | lay->addWidget( ok ); |
271 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 271 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
272 | lay->addWidget( cancel ); | 272 | lay->addWidget( cancel ); |
273 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 273 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
274 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 274 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
275 | resize( 220, 240 ); | 275 | resize( 220, 240 ); |
276 | 276 | ||
277 | } | 277 | } |
278 | 278 | ||
279 | public: | 279 | public: |
280 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; | 280 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; |
281 | QCheckBox* mWriteToSim; | 281 | QCheckBox* mWriteToSim; |
282 | }; | 282 | }; |
283 | 283 | ||
284 | 284 | ||
285 | bool pasteWithNewUid = true; | 285 | bool pasteWithNewUid = true; |
286 | 286 | ||
287 | #ifdef KAB_EMBEDDED | 287 | #ifdef KAB_EMBEDDED |
288 | KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) | 288 | KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) |
289 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), | 289 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), |
290 | mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ | 290 | mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ |
291 | mReadWrite( readWrite ), mModified( false ), mMainWindow(client) | 291 | mReadWrite( readWrite ), mModified( false ), mMainWindow(client) |
292 | #else //KAB_EMBEDDED | 292 | #else //KAB_EMBEDDED |
293 | KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) | 293 | KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) |
294 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), | 294 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), |
295 | mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), | 295 | mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), |
296 | mReadWrite( readWrite ), mModified( false ) | 296 | mReadWrite( readWrite ), mModified( false ) |
297 | #endif //KAB_EMBEDDED | 297 | #endif //KAB_EMBEDDED |
298 | { | 298 | { |
299 | // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); | 299 | // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); |
300 | // syncManager->setBlockSave(false); | 300 | // syncManager->setBlockSave(false); |
301 | mIncSearchWidget = 0; | 301 | mIncSearchWidget = 0; |
302 | mMiniSplitter = 0; | 302 | mMiniSplitter = 0; |
303 | mExtensionBarSplitter = 0; | 303 | mExtensionBarSplitter = 0; |
304 | mIsPart = !parent->inherits( "KAddressBookMain" ); | 304 | mIsPart = !parent->inherits( "KAddressBookMain" ); |
305 | mAddressBook = KABC::StdAddressBook::self(); | 305 | mAddressBook = KABC::StdAddressBook::self(); |
306 | KABC::StdAddressBook::setAutomaticSave( false ); | 306 | KABC::StdAddressBook::setAutomaticSave( false ); |
307 | 307 | ||
308 | #ifndef KAB_EMBEDDED | 308 | #ifndef KAB_EMBEDDED |
309 | mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); | 309 | mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); |
310 | #endif //KAB_EMBEDDED | 310 | #endif //KAB_EMBEDDED |
311 | 311 | ||
312 | connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), | 312 | connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), |
313 | SLOT( addressBookChanged() ) ); | 313 | SLOT( addressBookChanged() ) ); |
314 | 314 | ||
315 | #if 0 | 315 | #if 0 |
316 | // LR moved to addressbook init method | 316 | // LR moved to addressbook init method |
317 | mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, | 317 | mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, |
318 | "X-Department", "KADDRESSBOOK" ); | 318 | "X-Department", "KADDRESSBOOK" ); |
319 | mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, | 319 | mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, |
320 | "X-Profession", "KADDRESSBOOK" ); | 320 | "X-Profession", "KADDRESSBOOK" ); |
321 | mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, | 321 | mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, |
322 | "X-AssistantsName", "KADDRESSBOOK" ); | 322 | "X-AssistantsName", "KADDRESSBOOK" ); |
323 | mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, | 323 | mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, |
324 | "X-ManagersName", "KADDRESSBOOK" ); | 324 | "X-ManagersName", "KADDRESSBOOK" ); |
325 | mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, | 325 | mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, |
326 | "X-SpousesName", "KADDRESSBOOK" ); | 326 | "X-SpousesName", "KADDRESSBOOK" ); |
327 | mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, | 327 | mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, |
328 | "X-Office", "KADDRESSBOOK" ); | 328 | "X-Office", "KADDRESSBOOK" ); |
329 | mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, | 329 | mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, |
330 | "X-IMAddress", "KADDRESSBOOK" ); | 330 | "X-IMAddress", "KADDRESSBOOK" ); |
331 | mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, | 331 | mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, |
332 | "X-Anniversary", "KADDRESSBOOK" ); | 332 | "X-Anniversary", "KADDRESSBOOK" ); |
333 | 333 | ||
334 | //US added this field to become compatible with Opie/qtopia addressbook | 334 | //US added this field to become compatible with Opie/qtopia addressbook |
335 | // values can be "female" or "male" or "". An empty field represents undefined. | 335 | // values can be "female" or "male" or "". An empty field represents undefined. |
336 | mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, | 336 | mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, |
337 | "X-Gender", "KADDRESSBOOK" ); | 337 | "X-Gender", "KADDRESSBOOK" ); |
338 | mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, | 338 | mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, |
339 | "X-Children", "KADDRESSBOOK" ); | 339 | "X-Children", "KADDRESSBOOK" ); |
340 | mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, | 340 | mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, |
341 | "X-FreeBusyUrl", "KADDRESSBOOK" ); | 341 | "X-FreeBusyUrl", "KADDRESSBOOK" ); |
342 | #endif | 342 | #endif |
343 | initGUI(); | 343 | initGUI(); |
344 | 344 | ||
345 | mIncSearchWidget->setFocus(); | 345 | mIncSearchWidget->setFocus(); |
346 | 346 | ||
347 | 347 | ||
348 | connect( mViewManager, SIGNAL( selected( const QString& ) ), | 348 | connect( mViewManager, SIGNAL( selected( const QString& ) ), |
349 | SLOT( setContactSelected( const QString& ) ) ); | 349 | SLOT( setContactSelected( const QString& ) ) ); |
350 | connect( mViewManager, SIGNAL( executed( const QString& ) ), | 350 | connect( mViewManager, SIGNAL( executed( const QString& ) ), |
351 | SLOT( executeContact( const QString& ) ) ); | 351 | SLOT( executeContact( const QString& ) ) ); |
352 | 352 | ||
353 | connect( mViewManager, SIGNAL( deleteRequest( ) ), | 353 | connect( mViewManager, SIGNAL( deleteRequest( ) ), |
354 | SLOT( deleteContacts( ) ) ); | 354 | SLOT( deleteContacts( ) ) ); |
355 | connect( mViewManager, SIGNAL( modified() ), | 355 | connect( mViewManager, SIGNAL( modified() ), |
356 | SLOT( setModified() ) ); | 356 | SLOT( setModified() ) ); |
357 | 357 | ||
358 | connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); | 358 | connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); |
359 | connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); | 359 | connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); |
360 | 360 | ||
361 | connect( mXXPortManager, SIGNAL( modified() ), | 361 | connect( mXXPortManager, SIGNAL( modified() ), |
362 | SLOT( setModified() ) ); | 362 | SLOT( setModified() ) ); |
363 | 363 | ||
364 | connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), | 364 | connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), |
365 | SLOT( incrementalSearchJump( const QString& ) ) ); | 365 | SLOT( incrementalSearchJump( const QString& ) ) ); |
366 | connect( mIncSearchWidget, SIGNAL( fieldChanged() ), | 366 | connect( mIncSearchWidget, SIGNAL( fieldChanged() ), |
367 | mJumpButtonBar, SLOT( recreateButtons() ) ); | 367 | mJumpButtonBar, SLOT( recreateButtons() ) ); |
368 | 368 | ||
369 | connect( mDetails, SIGNAL( sendEmail( const QString& ) ), | 369 | connect( mDetails, SIGNAL( sendEmail( const QString& ) ), |
370 | SLOT( sendMail( const QString& ) ) ); | 370 | SLOT( sendMail( const QString& ) ) ); |
371 | 371 | ||
372 | 372 | ||
373 | connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); | 373 | connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); |
374 | connect( ExternalAppHandler::instance(), SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)),this, SLOT(requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&))); | 374 | connect( ExternalAppHandler::instance(), SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)),this, SLOT(requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&))); |
375 | connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&))); | 375 | connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&))); |
376 | connect( ExternalAppHandler::instance(), SIGNAL (nextView()),this, SLOT(setDetailsToggle())); | 376 | connect( ExternalAppHandler::instance(), SIGNAL (nextView()),this, SLOT(setDetailsToggle())); |
377 | connect( ExternalAppHandler::instance(), SIGNAL (callContactdialog()),this, SLOT(callContactdialog())); | 377 | connect( ExternalAppHandler::instance(), SIGNAL (callContactdialog()),this, SLOT(callContactdialog())); |
378 | 378 | ||
379 | 379 | ||
380 | #ifndef KAB_EMBEDDED | 380 | #ifndef KAB_EMBEDDED |
381 | connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), | 381 | connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), |
382 | mXXPortManager, SLOT( importVCard( const KURL& ) ) ); | 382 | mXXPortManager, SLOT( importVCard( const KURL& ) ) ); |
383 | 383 | ||
384 | connect( mDetails, SIGNAL( browse( const QString& ) ), | 384 | connect( mDetails, SIGNAL( browse( const QString& ) ), |
385 | SLOT( browse( const QString& ) ) ); | 385 | SLOT( browse( const QString& ) ) ); |
386 | 386 | ||
387 | 387 | ||
388 | mAddressBookService = new KAddressBookService( this ); | 388 | mAddressBookService = new KAddressBookService( this ); |
389 | 389 | ||
390 | #endif //KAB_EMBEDDED | 390 | #endif //KAB_EMBEDDED |
391 | 391 | ||
392 | mMessageTimer = new QTimer( this ); | 392 | mMessageTimer = new QTimer( this ); |
393 | connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) ); | 393 | connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) ); |
394 | mEditorDialog = 0; | 394 | mEditorDialog = 0; |
395 | createAddresseeEditorDialog( this ); | 395 | createAddresseeEditorDialog( this ); |
396 | setModified( false ); | 396 | setModified( false ); |
397 | mBRdisabled = false; | 397 | mBRdisabled = false; |
398 | #ifndef DESKTOP_VERSION | 398 | #ifndef DESKTOP_VERSION |
399 | infrared = 0; | 399 | infrared = 0; |
400 | #endif | 400 | #endif |
401 | //toggleBeamReceive( ); | 401 | //toggleBeamReceive( ); |
402 | mMainWindow->toolBar()->show(); | 402 | mMainWindow->toolBar()->show(); |
403 | // we have a toolbar repainting error on the Zaurus when starting KA/Pi | 403 | // we have a toolbar repainting error on the Zaurus when starting KA/Pi |
404 | QTimer::singleShot( 10, this , SLOT ( updateToolBar())); | 404 | QTimer::singleShot( 10, this , SLOT ( updateToolBar())); |
405 | } | 405 | } |
406 | 406 | ||
407 | void KABCore::updateToolBar() | 407 | void KABCore::updateToolBar() |
408 | { | 408 | { |
409 | static int iii = 0; | 409 | static int iii = 0; |
410 | ++iii; | 410 | ++iii; |
411 | mMainWindow->toolBar()->repaintMe(); | 411 | mMainWindow->toolBar()->repaintMe(); |
412 | if ( iii < 4 ) | 412 | if ( iii < 4 ) |
413 | QTimer::singleShot( 100*iii, this , SLOT ( updateToolBar())); | 413 | QTimer::singleShot( 100*iii, this , SLOT ( updateToolBar())); |
414 | } | 414 | } |
415 | KABCore::~KABCore() | 415 | KABCore::~KABCore() |
416 | { | 416 | { |
417 | // save(); | 417 | // save(); |
418 | //saveSettings(); | 418 | //saveSettings(); |
419 | //KABPrefs::instance()->writeConfig(); | 419 | //KABPrefs::instance()->writeConfig(); |
420 | delete AddresseeConfig::instance(); | 420 | delete AddresseeConfig::instance(); |
421 | mAddressBook = 0; | 421 | mAddressBook = 0; |
422 | KABC::StdAddressBook::close(); | 422 | KABC::StdAddressBook::close(); |
423 | 423 | ||
424 | delete syncManager; | 424 | delete syncManager; |
425 | #ifndef DESKTOP_VERSION | 425 | #ifndef DESKTOP_VERSION |
426 | if ( infrared ) | 426 | if ( infrared ) |
427 | delete infrared; | 427 | delete infrared; |
428 | #endif | 428 | #endif |
429 | } | 429 | } |
430 | void KABCore::receive( const QCString& cmsg, const QByteArray& data ) | 430 | void KABCore::receive( const QCString& cmsg, const QByteArray& data ) |
431 | { | 431 | { |
432 | //qDebug("KA: QCOP message received: %s ", cmsg.data() ); | 432 | //qDebug("KA: QCOP message received: %s ", cmsg.data() ); |
433 | if ( cmsg == "setDocument(QString)" ) { | 433 | if ( cmsg == "setDocument(QString)" ) { |
434 | QDataStream stream( data, IO_ReadOnly ); | 434 | QDataStream stream( data, IO_ReadOnly ); |
435 | QString fileName; | 435 | QString fileName; |
436 | stream >> fileName; | 436 | stream >> fileName; |
437 | recieve( fileName ); | 437 | recieve( fileName ); |
438 | return; | 438 | return; |
439 | } | 439 | } |
440 | } | 440 | } |
441 | void KABCore::toggleBeamReceive( ) | 441 | void KABCore::toggleBeamReceive( ) |
442 | { | 442 | { |
443 | if ( mBRdisabled ) | 443 | if ( mBRdisabled ) |
444 | return; | 444 | return; |
445 | #ifndef DESKTOP_VERSION | 445 | #ifndef DESKTOP_VERSION |
446 | if ( infrared ) { | 446 | if ( infrared ) { |
447 | qDebug("KA: AB disable BeamReceive "); | 447 | qDebug("KA: AB disable BeamReceive "); |
448 | delete infrared; | 448 | delete infrared; |
449 | infrared = 0; | 449 | infrared = 0; |
450 | mActionBR->setChecked(false); | 450 | mActionBR->setChecked(false); |
451 | return; | 451 | return; |
452 | } | 452 | } |
453 | qDebug("KA: AB enable BeamReceive "); | 453 | qDebug("KA: AB enable BeamReceive "); |
454 | mActionBR->setChecked(true); | 454 | mActionBR->setChecked(true); |
455 | 455 | ||
456 | infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ; | 456 | infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ; |
457 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& ))); | 457 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& ))); |
458 | #endif | 458 | #endif |
459 | } | 459 | } |
460 | 460 | ||
461 | 461 | ||
462 | void KABCore::disableBR(bool b) | 462 | void KABCore::disableBR(bool b) |
463 | { | 463 | { |
464 | #ifndef DESKTOP_VERSION | 464 | #ifndef DESKTOP_VERSION |
465 | if ( b ) { | 465 | if ( b ) { |
466 | if ( infrared ) { | 466 | if ( infrared ) { |
467 | toggleBeamReceive( ); | 467 | toggleBeamReceive( ); |
468 | } | 468 | } |
469 | mBRdisabled = true; | 469 | mBRdisabled = true; |
470 | } else { | 470 | } else { |
471 | if ( mBRdisabled ) { | 471 | if ( mBRdisabled ) { |
472 | mBRdisabled = false; | 472 | mBRdisabled = false; |
473 | //toggleBeamReceive( ); | 473 | //toggleBeamReceive( ); |
474 | } | 474 | } |
475 | } | 475 | } |
476 | #endif | 476 | #endif |
477 | 477 | ||
478 | } | 478 | } |
479 | void KABCore::recieve( QString fn ) | 479 | void KABCore::recieve( QString fn ) |
480 | { | 480 | { |
481 | //qDebug("KABCore::recieve "); | 481 | //qDebug("KABCore::recieve "); |
482 | int count = mAddressBook->importFromFile( fn, true ); | 482 | int count = mAddressBook->importFromFile( fn, true ); |
483 | if ( count ) | 483 | if ( count ) |
484 | setModified( true ); | 484 | setModified( true ); |
485 | mViewManager->refreshView(); | 485 | mViewManager->refreshView(); |
486 | message(i18n("%1 contact(s) received!").arg( count )); | 486 | message(i18n("%1 contact(s) received!").arg( count )); |
487 | topLevelWidget()->showMaximized(); | 487 | topLevelWidget()->showMaximized(); |
488 | topLevelWidget()->raise(); | 488 | topLevelWidget()->raise(); |
489 | } | 489 | } |
490 | void KABCore::restoreSettings() | 490 | void KABCore::restoreSettings() |
491 | { | 491 | { |
492 | mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; | 492 | mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; |
493 | 493 | ||
494 | bool state; | 494 | bool state; |
495 | 495 | ||
496 | if (mMultipleViewsAtOnce) | 496 | if (mMultipleViewsAtOnce) |
497 | state = KABPrefs::instance()->mDetailsPageVisible; | 497 | state = KABPrefs::instance()->mDetailsPageVisible; |
498 | else | 498 | else |
499 | state = false; | 499 | state = false; |
500 | 500 | ||
501 | mActionDetails->setChecked( state ); | 501 | mActionDetails->setChecked( state ); |
502 | setDetailsVisible( state ); | 502 | setDetailsVisible( state ); |
503 | 503 | ||
504 | state = KABPrefs::instance()->mJumpButtonBarVisible; | 504 | state = KABPrefs::instance()->mJumpButtonBarVisible; |
505 | 505 | ||
506 | mActionJumpBar->setChecked( state ); | 506 | mActionJumpBar->setChecked( state ); |
507 | setJumpButtonBarVisible( state ); | 507 | setJumpButtonBarVisible( state ); |
508 | /*US | 508 | /*US |
509 | QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; | 509 | QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; |
510 | if ( splitterSize.count() == 0 ) { | 510 | if ( splitterSize.count() == 0 ) { |
511 | splitterSize.append( width() / 2 ); | 511 | splitterSize.append( width() / 2 ); |
512 | splitterSize.append( width() / 2 ); | 512 | splitterSize.append( width() / 2 ); |
513 | } | 513 | } |
514 | mMiniSplitter->setSizes( splitterSize ); | 514 | mMiniSplitter->setSizes( splitterSize ); |
515 | if ( mExtensionBarSplitter ) { | 515 | if ( mExtensionBarSplitter ) { |
516 | splitterSize = KABPrefs::instance()->mExtensionsSplitter; | 516 | splitterSize = KABPrefs::instance()->mExtensionsSplitter; |
517 | if ( splitterSize.count() == 0 ) { | 517 | if ( splitterSize.count() == 0 ) { |
518 | splitterSize.append( width() / 2 ); | 518 | splitterSize.append( width() / 2 ); |
519 | splitterSize.append( width() / 2 ); | 519 | splitterSize.append( width() / 2 ); |
520 | } | 520 | } |
521 | mExtensionBarSplitter->setSizes( splitterSize ); | 521 | mExtensionBarSplitter->setSizes( splitterSize ); |
522 | 522 | ||
523 | } | 523 | } |
524 | */ | 524 | */ |
525 | mViewManager->restoreSettings(); | 525 | mViewManager->restoreSettings(); |
526 | mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); | 526 | mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); |
527 | mExtensionManager->restoreSettings(); | 527 | mExtensionManager->restoreSettings(); |
528 | #ifdef DESKTOP_VERSION | 528 | #ifdef DESKTOP_VERSION |
529 | int wid = width(); | 529 | int wid = width(); |
530 | if ( wid < 10 ) | 530 | if ( wid < 10 ) |
531 | wid = 400; | 531 | wid = 400; |
532 | #else | 532 | #else |
533 | int wid = QApplication::desktop()->width(); | 533 | int wid = QApplication::desktop()->width(); |
534 | if ( wid < 640 ) | 534 | if ( wid < 640 ) |
535 | wid = QApplication::desktop()->height(); | 535 | wid = QApplication::desktop()->height(); |
536 | #endif | 536 | #endif |
537 | QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; | 537 | QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; |
538 | if ( true /*splitterSize.count() == 0*/ ) { | 538 | if ( true /*splitterSize.count() == 0*/ ) { |
539 | splitterSize.append( wid / 2 ); | 539 | splitterSize.append( wid / 2 ); |
540 | splitterSize.append( wid / 2 ); | 540 | splitterSize.append( wid / 2 ); |
541 | } | 541 | } |
542 | mMiniSplitter->setSizes( splitterSize ); | 542 | mMiniSplitter->setSizes( splitterSize ); |
543 | if ( mExtensionBarSplitter ) { | 543 | if ( mExtensionBarSplitter ) { |
544 | //splitterSize = KABPrefs::instance()->mExtensionsSplitter; | 544 | //splitterSize = KABPrefs::instance()->mExtensionsSplitter; |
545 | if ( true /*splitterSize.count() == 0*/ ) { | 545 | if ( true /*splitterSize.count() == 0*/ ) { |
546 | splitterSize.append( wid / 2 ); | 546 | splitterSize.append( wid / 2 ); |
547 | splitterSize.append( wid / 2 ); | 547 | splitterSize.append( wid / 2 ); |
548 | } | 548 | } |
549 | mExtensionBarSplitter->setSizes( splitterSize ); | 549 | mExtensionBarSplitter->setSizes( splitterSize ); |
550 | 550 | ||
551 | } | 551 | } |
552 | 552 | ||
553 | 553 | ||
554 | } | 554 | } |
555 | 555 | ||
556 | void KABCore::saveSettings() | 556 | void KABCore::saveSettings() |
557 | { | 557 | { |
558 | KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); | 558 | KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); |
559 | if ( mExtensionBarSplitter ) | 559 | if ( mExtensionBarSplitter ) |
560 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); | 560 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); |
561 | KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); | 561 | KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); |
562 | KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); | 562 | KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); |
563 | #ifndef KAB_EMBEDDED | 563 | #ifndef KAB_EMBEDDED |
564 | 564 | ||
565 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); | 565 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); |
566 | KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); | 566 | KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); |
567 | #endif //KAB_EMBEDDED | 567 | #endif //KAB_EMBEDDED |
568 | mExtensionManager->saveSettings(); | 568 | mExtensionManager->saveSettings(); |
569 | mViewManager->saveSettings(); | 569 | mViewManager->saveSettings(); |
570 | 570 | ||
571 | KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); | 571 | KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); |
572 | KABPrefs::instance()->writeConfig(); | 572 | KABPrefs::instance()->writeConfig(); |
573 | qDebug("KA: KABCore::saveSettings() "); | 573 | qDebug("KA: KABCore::saveSettings() "); |
574 | } | 574 | } |
575 | 575 | ||
576 | KABC::AddressBook *KABCore::addressBook() const | 576 | KABC::AddressBook *KABCore::addressBook() const |
577 | { | 577 | { |
578 | return mAddressBook; | 578 | return mAddressBook; |
579 | } | 579 | } |
580 | 580 | ||
581 | KConfig *KABCore::config() | 581 | KConfig *KABCore::config() |
582 | { | 582 | { |
583 | #ifndef KAB_EMBEDDED | 583 | #ifndef KAB_EMBEDDED |
584 | return KABPrefs::instance()->config(); | 584 | return KABPrefs::instance()->config(); |
585 | #else //KAB_EMBEDDED | 585 | #else //KAB_EMBEDDED |
586 | return KABPrefs::instance()->getConfig(); | 586 | return KABPrefs::instance()->getConfig(); |
587 | #endif //KAB_EMBEDDED | 587 | #endif //KAB_EMBEDDED |
588 | } | 588 | } |
589 | 589 | ||
590 | KActionCollection *KABCore::actionCollection() const | 590 | KActionCollection *KABCore::actionCollection() const |
591 | { | 591 | { |
592 | return mGUIClient->actionCollection(); | 592 | return mGUIClient->actionCollection(); |
593 | } | 593 | } |
594 | 594 | ||
595 | KABC::Field *KABCore::currentSearchField() const | 595 | KABC::Field *KABCore::currentSearchField() const |
596 | { | 596 | { |
597 | if (mIncSearchWidget) | 597 | if (mIncSearchWidget) |
598 | return mIncSearchWidget->currentField(); | 598 | return mIncSearchWidget->currentField(); |
599 | else | 599 | else |
600 | return 0; | 600 | return 0; |
601 | } | 601 | } |
602 | 602 | ||
603 | QStringList KABCore::selectedUIDs() const | 603 | QStringList KABCore::selectedUIDs() const |
604 | { | 604 | { |
605 | return mViewManager->selectedUids(); | 605 | return mViewManager->selectedUids(); |
606 | } | 606 | } |
607 | 607 | ||
608 | KABC::Resource *KABCore::requestResource( QWidget *parent ) | 608 | KABC::Resource *KABCore::requestResource( QWidget *parent ) |
609 | { | 609 | { |
610 | QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); | 610 | QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); |
611 | 611 | ||
612 | QPtrList<KRES::Resource> kresResources; | 612 | QPtrList<KRES::Resource> kresResources; |
613 | QPtrListIterator<KABC::Resource> resIt( kabcResources ); | 613 | QPtrListIterator<KABC::Resource> resIt( kabcResources ); |
614 | KABC::Resource *resource; | 614 | KABC::Resource *resource; |
615 | while ( ( resource = resIt.current() ) != 0 ) { | 615 | while ( ( resource = resIt.current() ) != 0 ) { |
616 | ++resIt; | 616 | ++resIt; |
617 | if ( !resource->readOnly() ) { | 617 | if ( !resource->readOnly() ) { |
618 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); | 618 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); |
619 | if ( res ) | 619 | if ( res ) |
620 | kresResources.append( res ); | 620 | kresResources.append( res ); |
621 | } | 621 | } |
622 | } | 622 | } |
623 | 623 | ||
624 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); | 624 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); |
625 | return static_cast<KABC::Resource*>( res ); | 625 | return static_cast<KABC::Resource*>( res ); |
626 | } | 626 | } |
627 | 627 | ||
628 | #ifndef KAB_EMBEDDED | 628 | #ifndef KAB_EMBEDDED |
629 | KAboutData *KABCore::createAboutData() | 629 | KAboutData *KABCore::createAboutData() |
630 | #else //KAB_EMBEDDED | 630 | #else //KAB_EMBEDDED |
631 | void KABCore::createAboutData() | 631 | void KABCore::createAboutData() |
632 | #endif //KAB_EMBEDDED | 632 | #endif //KAB_EMBEDDED |
633 | { | 633 | { |
634 | #ifndef KAB_EMBEDDED | 634 | #ifndef KAB_EMBEDDED |
635 | KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ), | 635 | KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ), |
636 | "3.1", I18N_NOOP( "The KDE Address Book" ), | 636 | "3.1", I18N_NOOP( "The KDE Address Book" ), |
637 | KAboutData::License_GPL_V2, | 637 | KAboutData::License_GPL_V2, |
638 | I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) ); | 638 | I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) ); |
639 | about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" ); | 639 | about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" ); |
640 | about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) ); | 640 | about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) ); |
641 | about->addAuthor( "Cornelius Schumacher", | 641 | about->addAuthor( "Cornelius Schumacher", |
642 | I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ), | 642 | I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ), |
643 | "schumacher@kde.org" ); | 643 | "schumacher@kde.org" ); |
644 | about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ), | 644 | about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ), |
645 | "mpilone@slac.com" ); | 645 | "mpilone@slac.com" ); |
646 | about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) ); | 646 | about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) ); |
647 | about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) ); | 647 | about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) ); |
648 | about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ), | 648 | about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ), |
649 | "michel@klaralvdalens-datakonsult.se" ); | 649 | "michel@klaralvdalens-datakonsult.se" ); |
650 | about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ), | 650 | about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ), |
651 | "hansen@kde.org" ); | 651 | "hansen@kde.org" ); |
652 | 652 | ||
653 | return about; | 653 | return about; |
654 | #endif //KAB_EMBEDDED | 654 | #endif //KAB_EMBEDDED |
655 | 655 | ||
656 | QString version; | 656 | QString version; |
657 | #include <../version> | 657 | #include <../version> |
658 | QMessageBox::about( this, "About KAddressbook/Pi", | 658 | QMessageBox::about( this, "About KAddressbook/Pi", |
659 | "KAddressbook/Platform-independent\n" | 659 | "KAddressbook/Platform-independent\n" |
660 | "(KA/Pi) " +version + " - " + | 660 | "(KA/Pi) " +version + " - " + |
661 | #ifdef DESKTOP_VERSION | 661 | #ifdef DESKTOP_VERSION |
662 | "Desktop Edition\n" | 662 | "Desktop Edition\n" |
663 | #else | 663 | #else |
664 | "PDA-Edition\n" | 664 | "PDA-Edition\n" |
665 | "for: Zaurus 5500 / 7x0 / 8x0\n" | 665 | "for: Zaurus 5500 / 7x0 / 8x0\n" |
666 | #endif | 666 | #endif |
667 | 667 | ||
668 | "(c) 2004 Ulf Schenk\n" | 668 | "(c) 2004 Ulf Schenk\n" |
669 | "(c) 2004 Lutz Rogowski\n" | 669 | "(c) 2004 Lutz Rogowski\n" |
670 | "(c) 1997-2003, The KDE PIM Team\n" | 670 | "(c) 1997-2003, The KDE PIM Team\n" |
671 | "Tobias Koenig Current maintainer\ntokoe@kde.org\n" | 671 | "Tobias Koenig Current maintainer\ntokoe@kde.org\n" |
672 | "Don Sanders Original author\n" | 672 | "Don Sanders Original author\n" |
673 | "Cornelius Schumacher Co-maintainer\nschumacher@kde.org\n" | 673 | "Cornelius Schumacher Co-maintainer\nschumacher@kde.org\n" |
674 | "Mike Pilone GUI and framework redesign\nmpilone@slac.com\n" | 674 | "Mike Pilone GUI and framework redesign\nmpilone@slac.com\n" |
675 | "Greg Stern DCOP interface\n" | 675 | "Greg Stern DCOP interface\n" |
676 | "Mark Westcot Contact pinning\n" | 676 | "Mark Westcot Contact pinning\n" |
677 | "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n" | 677 | "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n" |
678 | "Steffen Hansen LDAP Lookup\nhansen@kde.org\n" | 678 | "Steffen Hansen LDAP Lookup\nhansen@kde.org\n" |
679 | #ifdef _WIN32_ | 679 | #ifdef _WIN32_ |
680 | "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n" | 680 | "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n" |
681 | #endif | 681 | #endif |
682 | ); | 682 | ); |
683 | } | 683 | } |
684 | 684 | ||
685 | void KABCore::setContactSelected( const QString &uid ) | 685 | void KABCore::setContactSelected( const QString &uid ) |
686 | { | 686 | { |
687 | KABC::Addressee addr = mAddressBook->findByUid( uid ); | 687 | KABC::Addressee addr = mAddressBook->findByUid( uid ); |
688 | if ( !mDetails->isHidden() ) | 688 | if ( !mDetails->isHidden() ) |
689 | mDetails->setAddressee( addr ); | 689 | mDetails->setAddressee( addr ); |
690 | 690 | ||
691 | if ( !addr.isEmpty() ) { | 691 | if ( !addr.isEmpty() ) { |
692 | emit contactSelected( addr.formattedName() ); | 692 | emit contactSelected( addr.formattedName() ); |
693 | KABC::Picture pic = addr.photo(); | 693 | KABC::Picture pic = addr.photo(); |
694 | if ( pic.isIntern() ) { | 694 | if ( pic.isIntern() ) { |
695 | //US emit contactSelected( pic.data() ); | 695 | //US emit contactSelected( pic.data() ); |
696 | //US instead use: | 696 | //US instead use: |
697 | QPixmap px; | 697 | QPixmap px; |
698 | if (pic.data().isNull() != true) | 698 | if (pic.data().isNull() != true) |
699 | { | 699 | { |
700 | px.convertFromImage(pic.data()); | 700 | px.convertFromImage(pic.data()); |
701 | } | 701 | } |
702 | 702 | ||
703 | emit contactSelected( px ); | 703 | emit contactSelected( px ); |
704 | } | 704 | } |
705 | } | 705 | } |
706 | 706 | ||
707 | 707 | ||
708 | mExtensionManager->setSelectionChanged(); | 708 | mExtensionManager->setSelectionChanged(); |
709 | 709 | ||
710 | // update the actions | 710 | // update the actions |
711 | bool selected = !uid.isEmpty(); | 711 | bool selected = !uid.isEmpty(); |
712 | 712 | ||
713 | if ( mReadWrite ) { | 713 | if ( mReadWrite ) { |
714 | mActionCut->setEnabled( selected ); | 714 | mActionCut->setEnabled( selected ); |
715 | mActionPaste->setEnabled( selected ); | 715 | mActionPaste->setEnabled( selected ); |
716 | } | 716 | } |
717 | 717 | ||
718 | mActionCopy->setEnabled( selected ); | 718 | mActionCopy->setEnabled( selected ); |
719 | mActionDelete->setEnabled( selected ); | 719 | mActionDelete->setEnabled( selected ); |
720 | mActionEditAddressee->setEnabled( selected ); | 720 | mActionEditAddressee->setEnabled( selected ); |
721 | mActionMail->setEnabled( selected ); | 721 | mActionMail->setEnabled( selected ); |
722 | mActionMailVCard->setEnabled( selected ); | 722 | mActionMailVCard->setEnabled( selected ); |
723 | //if (mActionBeam) | 723 | //if (mActionBeam) |
724 | //mActionBeam->setEnabled( selected ); | 724 | //mActionBeam->setEnabled( selected ); |
725 | mActionWhoAmI->setEnabled( selected ); | 725 | mActionWhoAmI->setEnabled( selected ); |
726 | } | 726 | } |
727 | 727 | ||
728 | void KABCore::sendMail() | 728 | void KABCore::sendMail() |
729 | { | 729 | { |
730 | sendMail( mViewManager->selectedEmails().join( ", " ) ); | 730 | sendMail( mViewManager->selectedEmails().join( ", " ) ); |
731 | } | 731 | } |
732 | 732 | ||
733 | void KABCore::sendMail( const QString& emaillist ) | 733 | void KABCore::sendMail( const QString& emaillist ) |
734 | { | 734 | { |
735 | // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... " | 735 | // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... " |
736 | if (emaillist.contains(",") > 0) | 736 | if (emaillist.contains(",") > 0) |
737 | ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null ); | 737 | ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null ); |
738 | else | 738 | else |
739 | ExternalAppHandler::instance()->mailToOneContact( emaillist ); | 739 | ExternalAppHandler::instance()->mailToOneContact( emaillist ); |
740 | } | 740 | } |
741 | 741 | ||
742 | 742 | ||
743 | 743 | ||
744 | void KABCore::mailVCard() | 744 | void KABCore::mailVCard() |
745 | { | 745 | { |
746 | QStringList uids = mViewManager->selectedUids(); | 746 | QStringList uids = mViewManager->selectedUids(); |
747 | if ( !uids.isEmpty() ) | 747 | if ( !uids.isEmpty() ) |
748 | mailVCard( uids ); | 748 | mailVCard( uids ); |
749 | } | 749 | } |
750 | 750 | ||
751 | void KABCore::mailVCard( const QStringList& uids ) | 751 | void KABCore::mailVCard( const QStringList& uids ) |
752 | { | 752 | { |
753 | QStringList urls; | 753 | QStringList urls; |
754 | 754 | ||
755 | // QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); | 755 | // QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); |
756 | 756 | ||
757 | QString dirName = "/tmp/" + KApplication::randomString( 8 ); | 757 | QString dirName = "/tmp/" + KApplication::randomString( 8 ); |
758 | 758 | ||
759 | 759 | ||
760 | 760 | ||
761 | QDir().mkdir( dirName, true ); | 761 | QDir().mkdir( dirName, true ); |
762 | 762 | ||
763 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { | 763 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { |
764 | KABC::Addressee a = mAddressBook->findByUid( *it ); | 764 | KABC::Addressee a = mAddressBook->findByUid( *it ); |
765 | 765 | ||
766 | if ( a.isEmpty() ) | 766 | if ( a.isEmpty() ) |
767 | continue; | 767 | continue; |
768 | 768 | ||
769 | QString name = a.givenName() + "_" + a.familyName() + ".vcf"; | 769 | QString name = a.givenName() + "_" + a.familyName() + ".vcf"; |
770 | 770 | ||
771 | QString fileName = dirName + "/" + name; | 771 | QString fileName = dirName + "/" + name; |
772 | 772 | ||
773 | QFile outFile(fileName); | 773 | QFile outFile(fileName); |
774 | 774 | ||
775 | if ( outFile.open(IO_WriteOnly) ) { // file opened successfully | 775 | if ( outFile.open(IO_WriteOnly) ) { // file opened successfully |
776 | KABC::VCardConverter converter; | 776 | KABC::VCardConverter converter; |
777 | QString vcard; | 777 | QString vcard; |
778 | 778 | ||
779 | converter.addresseeToVCard( a, vcard ); | 779 | converter.addresseeToVCard( a, vcard ); |
780 | 780 | ||
781 | QTextStream t( &outFile ); // use a text stream | 781 | QTextStream t( &outFile ); // use a text stream |
782 | t.setEncoding( QTextStream::UnicodeUTF8 ); | 782 | t.setEncoding( QTextStream::UnicodeUTF8 ); |
783 | t << vcard; | 783 | t << vcard; |
784 | 784 | ||
785 | outFile.close(); | 785 | outFile.close(); |
786 | 786 | ||
787 | urls.append( fileName ); | 787 | urls.append( fileName ); |
788 | } | 788 | } |
789 | } | 789 | } |
790 | 790 | ||
791 | bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") ); | 791 | bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") ); |
792 | 792 | ||
793 | 793 | ||
794 | /*US | 794 | /*US |
795 | kapp->invokeMailer( QString::null, QString::null, QString::null, | 795 | kapp->invokeMailer( QString::null, QString::null, QString::null, |
796 | QString::null, // subject | 796 | QString::null, // subject |
797 | QString::null, // body | 797 | QString::null, // body |
798 | QString::null, | 798 | QString::null, |
799 | urls ); // attachments | 799 | urls ); // attachments |
800 | */ | 800 | */ |
801 | 801 | ||
802 | } | 802 | } |
803 | 803 | ||
804 | /** | 804 | /** |
805 | Beams the "WhoAmI contact. | 805 | Beams the "WhoAmI contact. |
806 | */ | 806 | */ |
807 | void KABCore::beamMySelf() | 807 | void KABCore::beamMySelf() |
808 | { | 808 | { |
809 | KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); | 809 | KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); |
810 | if (!a.isEmpty()) | 810 | if (!a.isEmpty()) |
811 | { | 811 | { |
812 | QStringList uids; | 812 | QStringList uids; |
813 | uids << a.uid(); | 813 | uids << a.uid(); |
814 | 814 | ||
815 | beamVCard(uids); | 815 | beamVCard(uids); |
816 | } else { | 816 | } else { |
817 | KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); | 817 | KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); |
818 | 818 | ||
819 | 819 | ||
820 | } | 820 | } |
821 | } | 821 | } |
822 | void KABCore::updateMainWindow() | 822 | void KABCore::updateMainWindow() |
823 | { | 823 | { |
824 | mMainWindow->showMaximized(); | 824 | mMainWindow->showMaximized(); |
825 | mMainWindow->update(); | 825 | mMainWindow->update(); |
826 | } | 826 | } |
827 | void KABCore::resizeEvent(QResizeEvent* e ) | 827 | void KABCore::resizeEvent(QResizeEvent* e ) |
828 | { | 828 | { |
829 | if ( !mMiniSplitter ) | 829 | if ( !mMiniSplitter ) |
830 | return; | 830 | return; |
831 | //qDebug("KABCore::resizeEvent(QResizeEvent* e ) "); | 831 | //qDebug("KABCore::resizeEvent(QResizeEvent* e ) "); |
832 | if ( QApplication::desktop()->width() >= 480 ) { | 832 | if ( QApplication::desktop()->width() >= 480 ) { |
833 | if (QApplication::desktop()->width() == 640 ) { // e.g. 640x480 | 833 | if (QApplication::desktop()->width() == 640 ) { // e.g. 640x480 |
834 | if ( mMiniSplitter->orientation() == Qt::Vertical ) { | 834 | if ( mMiniSplitter->orientation() == Qt::Vertical ) { |
835 | mMiniSplitter->setOrientation( Qt::Horizontal); | 835 | mMiniSplitter->setOrientation( Qt::Horizontal); |
836 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 836 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
837 | } | 837 | } |
838 | if ( QApplication::desktop()->width() <= 640 ) { | 838 | if ( QApplication::desktop()->width() <= 640 ) { |
839 | mMainWindow->showMinimized(); | 839 | mMainWindow->showMinimized(); |
840 | //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); | 840 | //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); |
841 | mViewManager->getFilterAction()->setComboWidth( 150 ); | 841 | mViewManager->getFilterAction()->setComboWidth( 150 ); |
842 | if ( mIncSearchWidget ) | 842 | if ( mIncSearchWidget ) |
843 | mIncSearchWidget->setSize(); | 843 | mIncSearchWidget->setSize(); |
844 | QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); | 844 | QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); |
845 | } | 845 | } |
846 | 846 | ||
847 | } else if (QApplication::desktop()->width() == 480 ){// e.g. 480x640 | 847 | } else if (QApplication::desktop()->width() == 480 ){// e.g. 480x640 |
848 | if ( mMiniSplitter->orientation() == Qt::Horizontal ) { | 848 | if ( mMiniSplitter->orientation() == Qt::Horizontal ) { |
849 | mMiniSplitter->setOrientation( Qt::Vertical ); | 849 | mMiniSplitter->setOrientation( Qt::Vertical ); |
850 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); | 850 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); |
851 | } | 851 | } |
852 | if ( QApplication::desktop()->width() <= 640 ) { | 852 | if ( QApplication::desktop()->width() <= 640 ) { |
853 | //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); | 853 | //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); |
854 | mMainWindow->showMinimized(); | 854 | mMainWindow->showMinimized(); |
855 | if ( KABPrefs::instance()->mHideSearchOnSwitch ) { | 855 | if ( KABPrefs::instance()->mHideSearchOnSwitch ) { |
856 | if ( mIncSearchWidget ) { | 856 | if ( mIncSearchWidget ) { |
857 | mIncSearchWidget->setSize(); | 857 | mIncSearchWidget->setSize(); |
858 | } | 858 | } |
859 | } else { | 859 | } else { |
860 | mViewManager->getFilterAction()->setComboWidth( 0 ); | 860 | mViewManager->getFilterAction()->setComboWidth( 0 ); |
861 | } | 861 | } |
862 | QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); | 862 | QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); |
863 | } | 863 | } |
864 | } | 864 | } |
865 | } | 865 | } |
866 | QWidget::resizeEvent( e ); | 866 | QWidget::resizeEvent( e ); |
867 | 867 | ||
868 | } | 868 | } |
869 | void KABCore::export2phone() | 869 | void KABCore::export2phone() |
870 | { | 870 | { |
871 | 871 | ||
872 | QStringList uids; | 872 | QStringList uids; |
873 | XXPortSelectDialog dlg( this, false, this ); | 873 | XXPortSelectDialog dlg( this, false, this ); |
874 | if ( dlg.exec() ) | 874 | if ( dlg.exec() ) |
875 | uids = dlg.uids(); | 875 | uids = dlg.uids(); |
876 | else | 876 | else |
877 | return; | 877 | return; |
878 | if ( uids.isEmpty() ) | 878 | if ( uids.isEmpty() ) |
879 | return; | 879 | return; |
880 | // qDebug("count %d ", uids.count()); | 880 | // qDebug("count %d ", uids.count()); |
881 | 881 | ||
882 | KAex2phonePrefs ex2phone; | 882 | KAex2phonePrefs ex2phone; |
883 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); | 883 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); |
884 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); | 884 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); |
885 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 885 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
886 | 886 | ||
887 | if ( !ex2phone.exec() ) { | 887 | if ( !ex2phone.exec() ) { |
888 | return; | 888 | return; |
889 | } | 889 | } |
890 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); | 890 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); |
891 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); | 891 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); |
892 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); | 892 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); |
893 | 893 | ||
894 | 894 | ||
895 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, | 895 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, |
896 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, | 896 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, |
897 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 897 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
898 | 898 | ||
899 | QString fileName = getPhoneFile(); | 899 | QString fileName = getPhoneFile(); |
900 | if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) ) | 900 | if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) ) |
901 | return; | 901 | return; |
902 | 902 | ||
903 | message(i18n("Exporting to phone...")); | 903 | message(i18n("Exporting to phone...")); |
904 | QTimer::singleShot( 1, this , SLOT ( writeToPhone())); | 904 | QTimer::singleShot( 1, this , SLOT ( writeToPhone())); |
905 | 905 | ||
906 | } | 906 | } |
907 | QString KABCore::getPhoneFile() | 907 | QString KABCore::getPhoneFile() |
908 | { | 908 | { |
909 | #ifdef DESKTOP_VERSION | 909 | #ifdef DESKTOP_VERSION |
910 | return locateLocal("tmp", "phonefile.vcf"); | 910 | return locateLocal("tmp", "phonefile.vcf"); |
911 | #else | 911 | #else |
912 | return "/tmp/phonefile.vcf"; | 912 | return "/tmp/phonefile.vcf"; |
913 | #endif | 913 | #endif |
914 | 914 | ||
915 | } | 915 | } |
916 | void KABCore::writeToPhone( ) | 916 | void KABCore::writeToPhone( ) |
917 | { | 917 | { |
918 | if ( PhoneAccess::writeToPhone( getPhoneFile() ) ) | 918 | if ( PhoneAccess::writeToPhone( getPhoneFile() ) ) |
919 | message(i18n("Export to phone finished!")); | 919 | message(i18n("Export to phone finished!")); |
920 | else | 920 | else |
921 | qDebug(i18n("KA: Error exporting to phone")); | 921 | qDebug(i18n("KA: Error exporting to phone")); |
922 | } | 922 | } |
923 | void KABCore::beamVCard() | 923 | void KABCore::beamVCard() |
924 | { | 924 | { |
925 | QStringList uids; | 925 | QStringList uids; |
926 | XXPortSelectDialog dlg( this, false, this ); | 926 | XXPortSelectDialog dlg( this, false, this ); |
927 | if ( dlg.exec() ) | 927 | if ( dlg.exec() ) |
928 | uids = dlg.uids(); | 928 | uids = dlg.uids(); |
929 | else | 929 | else |
930 | return; | 930 | return; |
931 | if ( uids.isEmpty() ) | 931 | if ( uids.isEmpty() ) |
932 | return; | 932 | return; |
933 | beamVCard( uids ); | 933 | beamVCard( uids ); |
934 | } | 934 | } |
935 | 935 | ||
936 | 936 | ||
937 | void KABCore::beamVCard(const QStringList& uids) | 937 | void KABCore::beamVCard(const QStringList& uids) |
938 | { | 938 | { |
939 | 939 | ||
940 | // LR: we should use the /tmp dir on the Zaurus, | 940 | // LR: we should use the /tmp dir on the Zaurus, |
941 | // because: /tmp = RAM, (HOME)/kdepim = flash memory | 941 | // because: /tmp = RAM, (HOME)/kdepim = flash memory |
942 | 942 | ||
943 | #ifdef DESKTOP_VERSION | 943 | #ifdef DESKTOP_VERSION |
944 | QString fileName = locateLocal("tmp", "kapibeamfile.vcf"); | 944 | QString fileName = locateLocal("tmp", "kapibeamfile.vcf"); |
945 | #else | 945 | #else |
946 | QString fileName = "/tmp/kapibeamfile.vcf"; | 946 | QString fileName = "/tmp/kapibeamfile.vcf"; |
947 | #endif | 947 | #endif |
948 | 948 | ||
949 | KABC::VCardConverter converter; | 949 | KABC::VCardConverter converter; |
950 | QString description; | 950 | QString description; |
951 | QString datastream; | 951 | QString datastream; |
952 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { | 952 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { |
953 | KABC::Addressee a = mAddressBook->findByUid( *it ); | 953 | KABC::Addressee a = mAddressBook->findByUid( *it ); |
954 | 954 | ||
955 | if ( a.isEmpty() ) | 955 | if ( a.isEmpty() ) |
956 | continue; | 956 | continue; |
957 | 957 | ||
958 | if (description.isEmpty()) | 958 | if (description.isEmpty()) |
959 | description = a.formattedName(); | 959 | description = a.formattedName(); |
960 | 960 | ||
961 | QString vcard; | 961 | QString vcard; |
962 | converter.addresseeToVCard( a, vcard ); | 962 | converter.addresseeToVCard( a, vcard ); |
963 | int start = 0; | 963 | int start = 0; |
964 | int next; | 964 | int next; |
965 | while ( (next = vcard.find("TYPE=", start) )>= 0 ) { | 965 | while ( (next = vcard.find("TYPE=", start) )>= 0 ) { |
966 | int semi = vcard.find(";", next); | 966 | int semi = vcard.find(";", next); |
967 | int dopp = vcard.find(":", next); | 967 | int dopp = vcard.find(":", next); |
968 | int sep; | 968 | int sep; |
969 | if ( semi < dopp && semi >= 0 ) | 969 | if ( semi < dopp && semi >= 0 ) |
970 | sep = semi ; | 970 | sep = semi ; |
971 | else | 971 | else |
972 | sep = dopp; | 972 | sep = dopp; |
973 | datastream +=vcard.mid( start, next - start); | 973 | datastream +=vcard.mid( start, next - start); |
974 | datastream +=vcard.mid( next+5,sep -next -5 ).upper(); | 974 | datastream +=vcard.mid( next+5,sep -next -5 ).upper(); |
975 | start = sep; | 975 | start = sep; |
976 | } | 976 | } |
977 | datastream += vcard.mid( start,vcard.length() ); | 977 | datastream += vcard.mid( start,vcard.length() ); |
978 | } | 978 | } |
979 | #ifndef DESKTOP_VERSION | 979 | #ifndef DESKTOP_VERSION |
980 | QFile outFile(fileName); | 980 | QFile outFile(fileName); |
981 | if ( outFile.open(IO_WriteOnly) ) { | 981 | if ( outFile.open(IO_WriteOnly) ) { |
982 | datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); | 982 | datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); |
983 | QTextStream t( &outFile ); // use a text stream | 983 | QTextStream t( &outFile ); // use a text stream |
984 | //t.setEncoding( QTextStream::UnicodeUTF8 ); | 984 | //t.setEncoding( QTextStream::UnicodeUTF8 ); |
985 | t.setEncoding( QTextStream::Latin1 ); | 985 | t.setEncoding( QTextStream::Latin1 ); |
986 | t <<datastream.latin1(); | 986 | t <<datastream.latin1(); |
987 | outFile.close(); | 987 | outFile.close(); |
988 | Ir *ir = new Ir( this ); | 988 | Ir *ir = new Ir( this ); |
989 | connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); | 989 | connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); |
990 | ir->send( fileName, description, "text/x-vCard" ); | 990 | ir->send( fileName, description, "text/x-vCard" ); |
991 | } else { | 991 | } else { |
992 | qDebug("KA: Error open temp beam file "); | 992 | qDebug("KA: Error open temp beam file "); |
993 | return; | 993 | return; |
994 | } | 994 | } |
995 | #endif | 995 | #endif |
996 | 996 | ||
997 | } | 997 | } |
998 | 998 | ||
999 | void KABCore::beamDone( Ir *ir ) | 999 | void KABCore::beamDone( Ir *ir ) |
1000 | { | 1000 | { |
1001 | #ifndef DESKTOP_VERSION | 1001 | #ifndef DESKTOP_VERSION |
1002 | delete ir; | 1002 | delete ir; |
1003 | #endif | 1003 | #endif |
1004 | topLevelWidget()->raise(); | 1004 | topLevelWidget()->raise(); |
1005 | message( i18n("Beaming finished!") ); | 1005 | message( i18n("Beaming finished!") ); |
1006 | } | 1006 | } |
1007 | 1007 | ||
1008 | 1008 | ||
1009 | void KABCore::browse( const QString& url ) | 1009 | void KABCore::browse( const QString& url ) |
1010 | { | 1010 | { |
1011 | #ifndef KAB_EMBEDDED | 1011 | #ifndef KAB_EMBEDDED |
1012 | kapp->invokeBrowser( url ); | 1012 | kapp->invokeBrowser( url ); |
1013 | #else //KAB_EMBEDDED | 1013 | #else //KAB_EMBEDDED |
1014 | qDebug("KABCore::browse must be fixed"); | 1014 | qDebug("KABCore::browse must be fixed"); |
1015 | #endif //KAB_EMBEDDED | 1015 | #endif //KAB_EMBEDDED |
1016 | } | 1016 | } |
1017 | 1017 | ||
1018 | void KABCore::selectAllContacts() | 1018 | void KABCore::selectAllContacts() |
1019 | { | 1019 | { |
1020 | mViewManager->setSelected( QString::null, true ); | 1020 | mViewManager->setSelected( QString::null, true ); |
1021 | } | 1021 | } |
1022 | 1022 | ||
1023 | void KABCore::deleteContacts() | 1023 | void KABCore::deleteContacts() |
1024 | { | 1024 | { |
1025 | QStringList uidList = mViewManager->selectedUids(); | 1025 | QStringList uidList = mViewManager->selectedUids(); |
1026 | deleteContacts( uidList ); | 1026 | deleteContacts( uidList ); |
1027 | } | 1027 | } |
1028 | 1028 | ||
1029 | void KABCore::deleteContacts( const QStringList &uids ) | 1029 | void KABCore::deleteContacts( const QStringList &uids ) |
1030 | { | 1030 | { |
1031 | if ( uids.count() > 0 ) { | 1031 | if ( uids.count() > 0 ) { |
1032 | PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids ); | 1032 | PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids ); |
1033 | UndoStack::instance()->push( command ); | 1033 | UndoStack::instance()->push( command ); |
1034 | RedoStack::instance()->clear(); | 1034 | RedoStack::instance()->clear(); |
1035 | 1035 | ||
1036 | // now if we deleted anything, refresh | 1036 | // now if we deleted anything, refresh |
1037 | setContactSelected( QString::null ); | 1037 | setContactSelected( QString::null ); |
1038 | setModified( true ); | 1038 | setModified( true ); |
1039 | } | 1039 | } |
1040 | } | 1040 | } |
1041 | 1041 | ||
1042 | void KABCore::copyContacts() | 1042 | void KABCore::copyContacts() |
1043 | { | 1043 | { |
1044 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); | 1044 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); |
1045 | 1045 | ||
1046 | QString clipText = AddresseeUtil::addresseesToClipboard( addrList ); | 1046 | QString clipText = AddresseeUtil::addresseesToClipboard( addrList ); |
1047 | 1047 | ||
1048 | kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl; | 1048 | kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl; |
1049 | 1049 | ||
1050 | QClipboard *cb = QApplication::clipboard(); | 1050 | QClipboard *cb = QApplication::clipboard(); |
1051 | cb->setText( clipText ); | 1051 | cb->setText( clipText ); |
1052 | } | 1052 | } |
1053 | 1053 | ||
1054 | void KABCore::cutContacts() | 1054 | void KABCore::cutContacts() |
1055 | { | 1055 | { |
1056 | QStringList uidList = mViewManager->selectedUids(); | 1056 | QStringList uidList = mViewManager->selectedUids(); |
1057 | 1057 | ||
1058 | //US if ( uidList.size() > 0 ) { | 1058 | //US if ( uidList.size() > 0 ) { |
1059 | if ( uidList.count() > 0 ) { | 1059 | if ( uidList.count() > 0 ) { |
1060 | PwCutCommand *command = new PwCutCommand( mAddressBook, uidList ); | 1060 | PwCutCommand *command = new PwCutCommand( mAddressBook, uidList ); |
1061 | UndoStack::instance()->push( command ); | 1061 | UndoStack::instance()->push( command ); |
1062 | RedoStack::instance()->clear(); | 1062 | RedoStack::instance()->clear(); |
1063 | 1063 | ||
1064 | setModified( true ); | 1064 | setModified( true ); |
1065 | } | 1065 | } |
1066 | } | 1066 | } |
1067 | 1067 | ||
1068 | void KABCore::pasteContacts() | 1068 | void KABCore::pasteContacts() |
1069 | { | 1069 | { |
1070 | QClipboard *cb = QApplication::clipboard(); | 1070 | QClipboard *cb = QApplication::clipboard(); |
1071 | 1071 | ||
1072 | KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() ); | 1072 | KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() ); |
1073 | 1073 | ||
1074 | pasteContacts( list ); | 1074 | pasteContacts( list ); |
1075 | } | 1075 | } |
1076 | 1076 | ||
1077 | void KABCore::pasteContacts( KABC::Addressee::List &list ) | 1077 | void KABCore::pasteContacts( KABC::Addressee::List &list ) |
1078 | { | 1078 | { |
1079 | KABC::Resource *resource = requestResource( this ); | 1079 | KABC::Resource *resource = requestResource( this ); |
1080 | KABC::Addressee::List::Iterator it; | 1080 | KABC::Addressee::List::Iterator it; |
1081 | for ( it = list.begin(); it != list.end(); ++it ) | 1081 | for ( it = list.begin(); it != list.end(); ++it ) |
1082 | (*it).setResource( resource ); | 1082 | (*it).setResource( resource ); |
1083 | 1083 | ||
1084 | PwPasteCommand *command = new PwPasteCommand( this, list ); | 1084 | PwPasteCommand *command = new PwPasteCommand( this, list ); |
1085 | UndoStack::instance()->push( command ); | 1085 | UndoStack::instance()->push( command ); |
1086 | RedoStack::instance()->clear(); | 1086 | RedoStack::instance()->clear(); |
1087 | 1087 | ||
1088 | setModified( true ); | 1088 | setModified( true ); |
1089 | } | 1089 | } |
1090 | 1090 | ||
1091 | void KABCore::setWhoAmI() | 1091 | void KABCore::setWhoAmI() |
1092 | { | 1092 | { |
1093 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); | 1093 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); |
1094 | 1094 | ||
1095 | if ( addrList.count() > 1 ) { | 1095 | if ( addrList.count() > 1 ) { |
1096 | KMessageBox::sorry( this, i18n( "Please select only one contact." ) ); | 1096 | KMessageBox::sorry( this, i18n( "Please select only one contact." ) ); |
1097 | return; | 1097 | return; |
1098 | } | 1098 | } |
1099 | 1099 | ||
1100 | QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) ); | 1100 | QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) ); |
1101 | if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes ) | 1101 | if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes ) |
1102 | static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] ); | 1102 | static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] ); |
1103 | } | 1103 | } |
1104 | void KABCore::editCategories() | 1104 | void KABCore::editCategories() |
1105 | { | 1105 | { |
1106 | KPIM::CategoryEditDialog dlg ( KABPrefs::instance(), this, "", true ); | 1106 | KPIM::CategoryEditDialog dlg ( KABPrefs::instance(), this, "", true ); |
1107 | dlg.exec(); | 1107 | dlg.exec(); |
1108 | } | 1108 | } |
1109 | void KABCore::setCategories() | 1109 | void KABCore::setCategories() |
1110 | { | 1110 | { |
1111 | 1111 | ||
1112 | QStringList uids; | 1112 | QStringList uids; |
1113 | XXPortSelectDialog dlgx( this, false, this ); | 1113 | XXPortSelectDialog dlgx( this, false, this ); |
1114 | if ( dlgx.exec() ) | 1114 | if ( dlgx.exec() ) |
1115 | uids = dlgx.uids(); | 1115 | uids = dlgx.uids(); |
1116 | else | 1116 | else |
1117 | return; | 1117 | return; |
1118 | if ( uids.isEmpty() ) | 1118 | if ( uids.isEmpty() ) |
1119 | return; | 1119 | return; |
1120 | // qDebug("count %d ", uids.count()); | 1120 | // qDebug("count %d ", uids.count()); |
1121 | 1121 | ||
1122 | 1122 | ||
1123 | KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true ); | 1123 | KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true ); |
1124 | if ( !dlg.exec() ) { | 1124 | if ( !dlg.exec() ) { |
1125 | message( i18n("Setting categories cancelled") ); | 1125 | message( i18n("Setting categories cancelled") ); |
1126 | return; | 1126 | return; |
1127 | } | 1127 | } |
1128 | bool merge = false; | 1128 | bool merge = false; |
1129 | QString msg = i18n( "Merge with existing categories?" ); | 1129 | QString msg = i18n( "Merge with existing categories?" ); |
1130 | if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes ) | 1130 | if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes ) |
1131 | merge = true; | 1131 | merge = true; |
1132 | 1132 | ||
1133 | message( i18n("Setting categories ... please wait!") ); | 1133 | message( i18n("Setting categories ... please wait!") ); |
1134 | QStringList categories = dlg.selectedCategories(); | 1134 | QStringList categories = dlg.selectedCategories(); |
1135 | 1135 | ||
1136 | //QStringList uids = mViewManager->selectedUids(); | 1136 | //QStringList uids = mViewManager->selectedUids(); |
1137 | QStringList::Iterator it; | 1137 | QStringList::Iterator it; |
1138 | for ( it = uids.begin(); it != uids.end(); ++it ) { | 1138 | for ( it = uids.begin(); it != uids.end(); ++it ) { |
1139 | KABC::Addressee addr = mAddressBook->findByUid( *it ); | 1139 | KABC::Addressee addr = mAddressBook->findByUid( *it ); |
1140 | if ( !addr.isEmpty() ) { | 1140 | if ( !addr.isEmpty() ) { |
1141 | if ( !merge ) | 1141 | if ( !merge ) |
1142 | addr.setCategories( categories ); | 1142 | addr.setCategories( categories ); |
1143 | else { | 1143 | else { |
1144 | QStringList addrCategories = addr.categories(); | 1144 | QStringList addrCategories = addr.categories(); |
1145 | QStringList::Iterator catIt; | 1145 | QStringList::Iterator catIt; |
1146 | for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) { | 1146 | for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) { |
1147 | if ( !addrCategories.contains( *catIt ) ) | 1147 | if ( !addrCategories.contains( *catIt ) ) |
1148 | addrCategories.append( *catIt ); | 1148 | addrCategories.append( *catIt ); |
1149 | } | 1149 | } |
1150 | addr.setCategories( addrCategories ); | 1150 | addr.setCategories( addrCategories ); |
1151 | } | 1151 | } |
1152 | mAddressBook->insertAddressee( addr ); | 1152 | mAddressBook->insertAddressee( addr ); |
1153 | } | 1153 | } |
1154 | } | 1154 | } |
1155 | 1155 | ||
1156 | if ( uids.count() > 0 ) | 1156 | if ( uids.count() > 0 ) |
1157 | setModified( true ); | 1157 | setModified( true ); |
1158 | message( i18n("Setting categories completed!") ); | 1158 | message( i18n("Setting categories completed!") ); |
1159 | } | 1159 | } |
1160 | 1160 | ||
1161 | void KABCore::setSearchFields( const KABC::Field::List &fields ) | 1161 | void KABCore::setSearchFields( const KABC::Field::List &fields ) |
1162 | { | 1162 | { |
1163 | mIncSearchWidget->setFields( fields ); | 1163 | mIncSearchWidget->setFields( fields ); |
1164 | } | 1164 | } |
1165 | 1165 | ||
1166 | void KABCore::incrementalSearch( const QString& text ) | 1166 | void KABCore::incrementalSearch( const QString& text ) |
1167 | { | 1167 | { |
1168 | QString stext; | 1168 | QString stext; |
1169 | if ( KABPrefs::instance()->mAutoSearchWithWildcard ) { | 1169 | if ( KABPrefs::instance()->mAutoSearchWithWildcard ) { |
1170 | stext = "*" + text; | 1170 | stext = "*" + text; |
1171 | } else { | 1171 | } else { |
1172 | stext = text; | 1172 | stext = text; |
1173 | } | 1173 | } |
1174 | mViewManager->doSearch( stext, mIncSearchWidget->currentField() ); | 1174 | mViewManager->doSearch( stext, mIncSearchWidget->currentField() ); |
1175 | } | 1175 | } |
1176 | void KABCore::incrementalSearchJump( const QString& text ) | 1176 | void KABCore::incrementalSearchJump( const QString& text ) |
1177 | { | 1177 | { |
1178 | mViewManager->doSearch( text, mIncSearchWidget->currentField() ); | 1178 | mViewManager->doSearch( text, mIncSearchWidget->currentField() ); |
1179 | } | 1179 | } |
1180 | 1180 | ||
1181 | void KABCore::setModified() | 1181 | void KABCore::setModified() |
1182 | { | 1182 | { |
1183 | setModified( true ); | 1183 | setModified( true ); |
1184 | } | 1184 | } |
1185 | 1185 | ||
1186 | void KABCore::setModifiedWOrefresh() | 1186 | void KABCore::setModifiedWOrefresh() |
1187 | { | 1187 | { |
1188 | // qDebug("KABCore::setModifiedWOrefresh() "); | 1188 | // qDebug("KABCore::setModifiedWOrefresh() "); |
1189 | mModified = true; | 1189 | mModified = true; |
1190 | mActionSave->setEnabled( mModified ); | 1190 | mActionSave->setEnabled( mModified ); |
1191 | 1191 | ||
1192 | 1192 | ||
1193 | } | 1193 | } |
1194 | void KABCore::setModified( bool modified ) | 1194 | void KABCore::setModified( bool modified ) |
1195 | { | 1195 | { |
1196 | mModified = modified; | 1196 | mModified = modified; |
1197 | mActionSave->setEnabled( mModified ); | 1197 | mActionSave->setEnabled( mModified ); |
1198 | 1198 | ||
1199 | if ( modified ) | 1199 | if ( modified ) |
1200 | mJumpButtonBar->recreateButtons(); | 1200 | mJumpButtonBar->recreateButtons(); |
1201 | 1201 | ||
1202 | mViewManager->refreshView(); | 1202 | mViewManager->refreshView(); |
1203 | 1203 | ||
1204 | } | 1204 | } |
1205 | 1205 | ||
1206 | bool KABCore::modified() const | 1206 | bool KABCore::modified() const |
1207 | { | 1207 | { |
1208 | return mModified; | 1208 | return mModified; |
1209 | } | 1209 | } |
1210 | 1210 | ||
1211 | void KABCore::contactModified( const KABC::Addressee &addr ) | 1211 | void KABCore::contactModified( const KABC::Addressee &addr ) |
1212 | { | 1212 | { |
1213 | addrModified( addr ); | 1213 | addrModified( addr ); |
1214 | #if 0 // debug only | 1214 | #if 0 // debug only |
1215 | KABC::Addressee ad = addr; | 1215 | KABC::Addressee ad = addr; |
1216 | ad.computeCsum( "123"); | 1216 | ad.computeCsum( "123"); |
1217 | #endif | 1217 | #endif |
1218 | } | 1218 | } |
1219 | 1219 | ||
1220 | void KABCore::addrModified( const KABC::Addressee &addr ,bool updateDetails ) | 1220 | void KABCore::addrModified( const KABC::Addressee &addr ,bool updateDetails ) |
1221 | { | 1221 | { |
1222 | 1222 | ||
1223 | Command *command = 0; | 1223 | Command *command = 0; |
1224 | QString uid; | 1224 | QString uid; |
1225 | 1225 | ||
1226 | // check if it exists already | 1226 | // check if it exists already |
1227 | KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() ); | 1227 | KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() ); |
1228 | if ( origAddr.isEmpty() ) | 1228 | if ( origAddr.isEmpty() ) |
1229 | command = new PwNewCommand( mAddressBook, addr ); | 1229 | command = new PwNewCommand( mAddressBook, addr ); |
1230 | else { | 1230 | else { |
1231 | command = new PwEditCommand( mAddressBook, origAddr, addr ); | 1231 | command = new PwEditCommand( mAddressBook, origAddr, addr ); |
1232 | uid = addr.uid(); | 1232 | uid = addr.uid(); |
1233 | } | 1233 | } |
1234 | 1234 | ||
1235 | UndoStack::instance()->push( command ); | 1235 | UndoStack::instance()->push( command ); |
1236 | RedoStack::instance()->clear(); | 1236 | RedoStack::instance()->clear(); |
1237 | if ( updateDetails ) | 1237 | if ( updateDetails ) |
1238 | mDetails->setAddressee( addr ); | 1238 | mDetails->setAddressee( addr ); |
1239 | setModified( true ); | 1239 | setModified( true ); |
1240 | } | 1240 | } |
1241 | 1241 | ||
1242 | void KABCore::newContact() | 1242 | void KABCore::newContact() |
1243 | { | 1243 | { |
1244 | 1244 | ||
1245 | 1245 | ||
1246 | QPtrList<KABC::Resource> kabcResources = mAddressBook->resources(); | 1246 | QPtrList<KABC::Resource> kabcResources = mAddressBook->resources(); |
1247 | 1247 | ||
1248 | QPtrList<KRES::Resource> kresResources; | 1248 | QPtrList<KRES::Resource> kresResources; |
1249 | QPtrListIterator<KABC::Resource> it( kabcResources ); | 1249 | QPtrListIterator<KABC::Resource> it( kabcResources ); |
1250 | KABC::Resource *resource; | 1250 | KABC::Resource *resource; |
1251 | while ( ( resource = it.current() ) != 0 ) { | 1251 | while ( ( resource = it.current() ) != 0 ) { |
1252 | ++it; | 1252 | ++it; |
1253 | if ( !resource->readOnly() ) { | 1253 | if ( !resource->readOnly() ) { |
1254 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); | 1254 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); |
1255 | if ( res ) | 1255 | if ( res ) |
1256 | kresResources.append( res ); | 1256 | kresResources.append( res ); |
1257 | } | 1257 | } |
1258 | } | 1258 | } |
1259 | 1259 | ||
1260 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); | 1260 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); |
1261 | resource = static_cast<KABC::Resource*>( res ); | 1261 | resource = static_cast<KABC::Resource*>( res ); |
1262 | 1262 | ||
1263 | if ( resource ) { | 1263 | if ( resource ) { |
1264 | KABC::Addressee addr; | 1264 | KABC::Addressee addr; |
1265 | addr.setResource( resource ); | 1265 | addr.setResource( resource ); |
1266 | mEditorDialog->setAddressee( addr ); | 1266 | mEditorDialog->setAddressee( addr ); |
1267 | mEditorDialog->setCaption( i18n("Edit new contact")); | 1267 | mEditorDialog->setCaption( i18n("Edit new contact")); |
1268 | KApplication::execDialog ( mEditorDialog ); | 1268 | KApplication::execDialog ( mEditorDialog ); |
1269 | 1269 | ||
1270 | } else | 1270 | } else |
1271 | return; | 1271 | return; |
1272 | 1272 | ||
1273 | // mEditorDict.insert( dialog->addressee().uid(), dialog ); | 1273 | // mEditorDict.insert( dialog->addressee().uid(), dialog ); |
1274 | 1274 | ||
1275 | 1275 | ||
1276 | } | 1276 | } |
1277 | 1277 | ||
1278 | void KABCore::addEmail( QString aStr ) | 1278 | void KABCore::addEmail( QString aStr ) |
1279 | { | 1279 | { |
1280 | #ifndef KAB_EMBEDDED | 1280 | #ifndef KAB_EMBEDDED |
1281 | QString fullName, email; | 1281 | QString fullName, email; |
1282 | 1282 | ||
1283 | KABC::Addressee::parseEmailAddress( aStr, fullName, email ); | 1283 | KABC::Addressee::parseEmailAddress( aStr, fullName, email ); |
1284 | 1284 | ||
1285 | // Try to lookup the addressee matching the email address | 1285 | // Try to lookup the addressee matching the email address |
1286 | bool found = false; | 1286 | bool found = false; |
1287 | QStringList emailList; | 1287 | QStringList emailList; |
1288 | KABC::AddressBook::Iterator it; | 1288 | KABC::AddressBook::Iterator it; |
1289 | for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) { | 1289 | for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) { |
1290 | emailList = (*it).emails(); | 1290 | emailList = (*it).emails(); |
1291 | if ( emailList.contains( email ) > 0 ) { | 1291 | if ( emailList.contains( email ) > 0 ) { |
1292 | found = true; | 1292 | found = true; |
1293 | (*it).setNameFromString( fullName ); | 1293 | (*it).setNameFromString( fullName ); |
1294 | editContact( (*it).uid() ); | 1294 | editContact( (*it).uid() ); |
1295 | } | 1295 | } |
1296 | } | 1296 | } |
1297 | 1297 | ||
1298 | if ( !found ) { | 1298 | if ( !found ) { |
1299 | KABC::Addressee addr; | 1299 | KABC::Addressee addr; |
1300 | addr.setNameFromString( fullName ); | 1300 | addr.setNameFromString( fullName ); |
1301 | addr.insertEmail( email, true ); | 1301 | addr.insertEmail( email, true ); |
1302 | 1302 | ||
1303 | mAddressBook->insertAddressee( addr ); | 1303 | mAddressBook->insertAddressee( addr ); |
1304 | mViewManager->refreshView( addr.uid() ); | 1304 | mViewManager->refreshView( addr.uid() ); |
1305 | editContact( addr.uid() ); | 1305 | editContact( addr.uid() ); |
1306 | } | 1306 | } |
1307 | #else //KAB_EMBEDDED | 1307 | #else //KAB_EMBEDDED |
1308 | qDebug("KABCore::addEmail finsih method"); | 1308 | qDebug("KABCore::addEmail finsih method"); |
1309 | #endif //KAB_EMBEDDED | 1309 | #endif //KAB_EMBEDDED |
1310 | } | 1310 | } |
1311 | 1311 | ||
1312 | void KABCore::importVCard( const KURL &url, bool showPreview ) | 1312 | void KABCore::importVCard( const KURL &url, bool showPreview ) |
1313 | { | 1313 | { |
1314 | mXXPortManager->importVCard( url, showPreview ); | 1314 | mXXPortManager->importVCard( url, showPreview ); |
1315 | } | 1315 | } |
1316 | void KABCore::importFromOL() | 1316 | void KABCore::importFromOL() |
1317 | { | 1317 | { |
1318 | #ifdef _OL_IMPORT_ | 1318 | #ifdef _OL_IMPORT_ |
1319 | KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this ); | 1319 | KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this ); |
1320 | idgl->exec(); | 1320 | idgl->exec(); |
1321 | KABC::Addressee::List list = idgl->getAddressList(); | 1321 | KABC::Addressee::List list = idgl->getAddressList(); |
1322 | if ( list.count() > 0 ) { | 1322 | if ( list.count() > 0 ) { |
1323 | KABC::Addressee::List listNew; | 1323 | KABC::Addressee::List listNew; |
1324 | KABC::Addressee::List listExisting; | 1324 | KABC::Addressee::List listExisting; |
1325 | KABC::Addressee::List::Iterator it; | 1325 | KABC::Addressee::List::Iterator it; |
1326 | KABC::AddressBook::Iterator iter; | 1326 | KABC::AddressBook::Iterator iter; |
1327 | for ( it = list.begin(); it != list.end(); ++it ) { | 1327 | for ( it = list.begin(); it != list.end(); ++it ) { |
1328 | if ( mAddressBook->findByUid((*it).uid() ).isEmpty()) | 1328 | if ( mAddressBook->findByUid((*it).uid() ).isEmpty()) |
1329 | listNew.append( (*it) ); | 1329 | listNew.append( (*it) ); |
1330 | else | 1330 | else |
1331 | listExisting.append( (*it) ); | 1331 | listExisting.append( (*it) ); |
1332 | } | 1332 | } |
1333 | if ( listExisting.count() > 0 ) | 1333 | if ( listExisting.count() > 0 ) |
1334 | KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() )); | 1334 | KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() )); |
1335 | if ( listNew.count() > 0 ) { | 1335 | if ( listNew.count() > 0 ) { |
1336 | pasteWithNewUid = false; | 1336 | pasteWithNewUid = false; |
1337 | pasteContacts( listNew ); | 1337 | pasteContacts( listNew ); |
1338 | pasteWithNewUid = true; | 1338 | pasteWithNewUid = true; |
1339 | } | 1339 | } |
1340 | } | 1340 | } |
1341 | delete idgl; | 1341 | delete idgl; |
1342 | #endif | 1342 | #endif |
1343 | } | 1343 | } |
1344 | 1344 | ||
1345 | void KABCore::importVCard( const QString &vCard, bool showPreview ) | 1345 | void KABCore::importVCard( const QString &vCard, bool showPreview ) |
1346 | { | 1346 | { |
1347 | mXXPortManager->importVCard( vCard, showPreview ); | 1347 | mXXPortManager->importVCard( vCard, showPreview ); |
1348 | } | 1348 | } |
1349 | 1349 | ||
1350 | //US added a second method without defaultparameter | 1350 | //US added a second method without defaultparameter |
1351 | void KABCore::editContact2() { | 1351 | void KABCore::editContact2() { |
1352 | editContact( QString::null ); | 1352 | editContact( QString::null ); |
1353 | } | 1353 | } |
1354 | 1354 | ||
1355 | void KABCore::editContact( const QString &uid ) | 1355 | void KABCore::editContact( const QString &uid ) |
1356 | { | 1356 | { |
1357 | 1357 | ||
1358 | if ( mExtensionManager->isQuickEditVisible() ) | 1358 | if ( mExtensionManager->isQuickEditVisible() ) |
1359 | return; | 1359 | return; |
1360 | 1360 | ||
1361 | // First, locate the contact entry | 1361 | // First, locate the contact entry |
1362 | QString localUID = uid; | 1362 | QString localUID = uid; |
1363 | if ( localUID.isNull() ) { | 1363 | if ( localUID.isNull() ) { |
1364 | QStringList uidList = mViewManager->selectedUids(); | 1364 | QStringList uidList = mViewManager->selectedUids(); |
1365 | if ( uidList.count() > 0 ) | 1365 | if ( uidList.count() > 0 ) |
1366 | localUID = *( uidList.at( 0 ) ); | 1366 | localUID = *( uidList.at( 0 ) ); |
1367 | } | 1367 | } |
1368 | 1368 | ||
1369 | KABC::Addressee addr = mAddressBook->findByUid( localUID ); | 1369 | KABC::Addressee addr = mAddressBook->findByUid( localUID ); |
1370 | if ( !addr.isEmpty() ) { | 1370 | if ( !addr.isEmpty() ) { |
1371 | mEditorDialog->setAddressee( addr ); | 1371 | mEditorDialog->setAddressee( addr ); |
1372 | KApplication::execDialog ( mEditorDialog ); | 1372 | KApplication::execDialog ( mEditorDialog ); |
1373 | } | 1373 | } |
1374 | } | 1374 | } |
1375 | 1375 | ||
1376 | /** | 1376 | /** |
1377 | Shows or edits the detail view for the given uid. If the uid is QString::null, | 1377 | Shows or edits the detail view for the given uid. If the uid is QString::null, |
1378 | the method will try to find a selected addressee in the view. | 1378 | the method will try to find a selected addressee in the view. |
1379 | */ | 1379 | */ |
1380 | void KABCore::executeContact( const QString &uid /*US = QString::null*/ ) | 1380 | void KABCore::executeContact( const QString &uid /*US = QString::null*/ ) |
1381 | { | 1381 | { |
1382 | if ( mMultipleViewsAtOnce ) | 1382 | if ( mMultipleViewsAtOnce ) |
1383 | { | 1383 | { |
1384 | editContact( uid ); | 1384 | editContact( uid ); |
1385 | } | 1385 | } |
1386 | else | 1386 | else |
1387 | { | 1387 | { |
1388 | setDetailsVisible( true ); | 1388 | setDetailsVisible( true ); |
1389 | mActionDetails->setChecked(true); | 1389 | mActionDetails->setChecked(true); |
1390 | } | 1390 | } |
1391 | 1391 | ||
1392 | } | 1392 | } |
1393 | 1393 | ||
1394 | void KABCore::save() | 1394 | void KABCore::save() |
1395 | { | 1395 | { |
1396 | if (syncManager->blockSave()) | 1396 | if (syncManager->blockSave()) |
1397 | return; | 1397 | return; |
1398 | if ( !mModified ) | 1398 | if ( !mModified ) |
1399 | return; | 1399 | return; |
1400 | 1400 | ||
1401 | syncManager->setBlockSave(true); | 1401 | syncManager->setBlockSave(true); |
1402 | QString text = i18n( "There was an error while attempting to save\n the " | 1402 | QString text = i18n( "There was an error while attempting to save\n the " |
1403 | "address book. Please check that some \nother application is " | 1403 | "address book. Please check that some \nother application is " |
1404 | "not using it. " ); | 1404 | "not using it. " ); |
1405 | message(i18n("Saving ... please wait! "), false); | 1405 | message(i18n("Saving ... please wait! "), false); |
1406 | //qApp->processEvents(); | 1406 | //qApp->processEvents(); |
1407 | #ifndef KAB_EMBEDDED | 1407 | #ifndef KAB_EMBEDDED |
1408 | KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); | 1408 | KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); |
1409 | if ( !b || !b->save() ) { | 1409 | if ( !b || !b->save() ) { |
1410 | KMessageBox::error( this, text, i18n( "Unable to Save" ) ); | 1410 | KMessageBox::error( this, text, i18n( "Unable to Save" ) ); |
1411 | } | 1411 | } |
1412 | #else //KAB_EMBEDDED | 1412 | #else //KAB_EMBEDDED |
1413 | KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); | 1413 | KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); |
1414 | if ( !b || !b->save() ) { | 1414 | if ( !b || !b->save() ) { |
1415 | QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok")); | 1415 | QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok")); |
1416 | } | 1416 | } |
1417 | #endif //KAB_EMBEDDED | 1417 | #endif //KAB_EMBEDDED |
1418 | 1418 | ||
1419 | message(i18n("Addressbook saved!")); | 1419 | message(i18n("Addressbook saved!")); |
1420 | setModified( false ); | 1420 | setModified( false ); |
1421 | syncManager->setBlockSave(false); | 1421 | syncManager->setBlockSave(false); |
1422 | } | 1422 | } |
1423 | 1423 | ||
1424 | 1424 | ||
1425 | void KABCore::undo() | 1425 | void KABCore::undo() |
1426 | { | 1426 | { |
1427 | UndoStack::instance()->undo(); | 1427 | UndoStack::instance()->undo(); |
1428 | 1428 | ||
1429 | // Refresh the view | 1429 | // Refresh the view |
1430 | mViewManager->refreshView(); | 1430 | mViewManager->refreshView(); |
1431 | } | 1431 | } |
1432 | 1432 | ||
1433 | void KABCore::redo() | 1433 | void KABCore::redo() |
1434 | { | 1434 | { |
1435 | RedoStack::instance()->redo(); | 1435 | RedoStack::instance()->redo(); |
1436 | 1436 | ||
1437 | // Refresh the view | 1437 | // Refresh the view |
1438 | mViewManager->refreshView(); | 1438 | mViewManager->refreshView(); |
1439 | } | 1439 | } |
1440 | void KABCore::setJumpButtonBar( bool visible ) | 1440 | void KABCore::setJumpButtonBar( bool visible ) |
1441 | { | 1441 | { |
1442 | setJumpButtonBarVisible(visible ); | 1442 | setJumpButtonBarVisible(visible ); |
1443 | saveSettings(); | 1443 | saveSettings(); |
1444 | } | 1444 | } |
1445 | void KABCore::setJumpButtonBarVisible( bool visible ) | 1445 | void KABCore::setJumpButtonBarVisible( bool visible ) |
1446 | { | 1446 | { |
1447 | if (mMultipleViewsAtOnce) | 1447 | if (mMultipleViewsAtOnce) |
1448 | { | 1448 | { |
1449 | if ( visible ) | 1449 | if ( visible ) |
1450 | mJumpButtonBar->show(); | 1450 | mJumpButtonBar->show(); |
1451 | else | 1451 | else |
1452 | mJumpButtonBar->hide(); | 1452 | mJumpButtonBar->hide(); |
1453 | } | 1453 | } |
1454 | else | 1454 | else |
1455 | { | 1455 | { |
1456 | // show the jumpbar only if "the details are hidden" == "viewmanager are shown" | 1456 | // show the jumpbar only if "the details are hidden" == "viewmanager are shown" |
1457 | if (mViewManager->isVisible()) | 1457 | if (mViewManager->isVisible()) |
1458 | { | 1458 | { |
1459 | if ( visible ) | 1459 | if ( visible ) |
1460 | mJumpButtonBar->show(); | 1460 | mJumpButtonBar->show(); |
1461 | else | 1461 | else |
1462 | mJumpButtonBar->hide(); | 1462 | mJumpButtonBar->hide(); |
1463 | } | 1463 | } |
1464 | else | 1464 | else |
1465 | { | 1465 | { |
1466 | mJumpButtonBar->hide(); | 1466 | mJumpButtonBar->hide(); |
1467 | } | 1467 | } |
1468 | } | 1468 | } |
1469 | if ( visible ) { | 1469 | if ( visible ) { |
1470 | if ( mIncSearchWidget->currentItem() == 0 ) { | 1470 | if ( mIncSearchWidget->currentItem() == 0 ) { |
1471 | message( i18n("Change search field enable jump bar") ); | 1471 | message( i18n("Change search field enable jump bar") ); |
1472 | } | 1472 | } |
1473 | } | 1473 | } |
1474 | } | 1474 | } |
1475 | 1475 | ||
1476 | 1476 | ||
1477 | void KABCore::setDetailsToState() | 1477 | void KABCore::setDetailsToState() |
1478 | { | 1478 | { |
1479 | setDetailsVisible( mActionDetails->isChecked() ); | 1479 | setDetailsVisible( mActionDetails->isChecked() ); |
1480 | } | 1480 | } |
1481 | void KABCore::setDetailsToggle() | 1481 | void KABCore::setDetailsToggle() |
1482 | { | 1482 | { |
1483 | mActionDetails->setChecked( !mActionDetails->isChecked() ); | 1483 | mActionDetails->setChecked( !mActionDetails->isChecked() ); |
1484 | setDetailsToState(); | 1484 | setDetailsToState(); |
1485 | } | 1485 | } |
1486 | 1486 | ||
1487 | 1487 | ||
1488 | 1488 | ||
1489 | void KABCore::setDetailsVisible( bool visible ) | 1489 | void KABCore::setDetailsVisible( bool visible ) |
1490 | { | 1490 | { |
1491 | if (visible && mDetails->isHidden()) | 1491 | if (visible && mDetails->isHidden()) |
1492 | { | 1492 | { |
1493 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); | 1493 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); |
1494 | if ( addrList.count() > 0 ) | 1494 | if ( addrList.count() > 0 ) |
1495 | mDetails->setAddressee( addrList[ 0 ] ); | 1495 | mDetails->setAddressee( addrList[ 0 ] ); |
1496 | } | 1496 | } |
1497 | 1497 | ||
1498 | // mMultipleViewsAtOnce=false: mDetails is always visible. But we switch between | 1498 | // mMultipleViewsAtOnce=false: mDetails is always visible. But we switch between |
1499 | // the listview and the detailview. We do that by changing the splitbar size. | 1499 | // the listview and the detailview. We do that by changing the splitbar size. |
1500 | if (mMultipleViewsAtOnce) | 1500 | if (mMultipleViewsAtOnce) |
1501 | { | 1501 | { |
1502 | if ( visible ) | 1502 | if ( visible ) |
1503 | mDetails->show(); | 1503 | mDetails->show(); |
1504 | else | 1504 | else |
1505 | mDetails->hide(); | 1505 | mDetails->hide(); |
1506 | } | 1506 | } |
1507 | else | 1507 | else |
1508 | { | 1508 | { |
1509 | if ( visible ) { | 1509 | if ( visible ) { |
1510 | mViewManager->hide(); | 1510 | mViewManager->hide(); |
1511 | mDetails->show(); | 1511 | mDetails->show(); |
1512 | mIncSearchWidget->setFocus(); | 1512 | mIncSearchWidget->setFocus(); |
1513 | } | 1513 | } |
1514 | else { | 1514 | else { |
1515 | mViewManager->show(); | 1515 | mViewManager->show(); |
1516 | mDetails->hide(); | 1516 | mDetails->hide(); |
1517 | mViewManager->setFocusAV(); | 1517 | mViewManager->setFocusAV(); |
1518 | } | 1518 | } |
1519 | setJumpButtonBarVisible( !visible ); | 1519 | setJumpButtonBarVisible( !visible ); |
1520 | } | 1520 | } |
1521 | 1521 | ||
1522 | } | 1522 | } |
1523 | 1523 | ||
1524 | void KABCore::extensionChanged( int id ) | 1524 | void KABCore::extensionChanged( int id ) |
1525 | { | 1525 | { |
1526 | //change the details view only for non desktop systems | 1526 | //change the details view only for non desktop systems |
1527 | #ifndef DESKTOP_VERSION | 1527 | #ifndef DESKTOP_VERSION |
1528 | 1528 | ||
1529 | if (id == 0) | 1529 | if (id == 0) |
1530 | { | 1530 | { |
1531 | //the user disabled the extension. | 1531 | //the user disabled the extension. |
1532 | 1532 | ||
1533 | if (mMultipleViewsAtOnce) | 1533 | if (mMultipleViewsAtOnce) |
1534 | { // enable detailsview again | 1534 | { // enable detailsview again |
1535 | setDetailsVisible( true ); | 1535 | setDetailsVisible( true ); |
1536 | mActionDetails->setChecked( true ); | 1536 | mActionDetails->setChecked( true ); |
1537 | } | 1537 | } |
1538 | else | 1538 | else |
1539 | { //go back to the listview | 1539 | { //go back to the listview |
1540 | setDetailsVisible( false ); | 1540 | setDetailsVisible( false ); |
1541 | mActionDetails->setChecked( false ); | 1541 | mActionDetails->setChecked( false ); |
1542 | mActionDetails->setEnabled(true); | 1542 | mActionDetails->setEnabled(true); |
1543 | } | 1543 | } |
1544 | 1544 | ||
1545 | } | 1545 | } |
1546 | else | 1546 | else |
1547 | { | 1547 | { |
1548 | //the user enabled the extension. | 1548 | //the user enabled the extension. |
1549 | setDetailsVisible( false ); | 1549 | setDetailsVisible( false ); |
1550 | mActionDetails->setChecked( false ); | 1550 | mActionDetails->setChecked( false ); |
1551 | 1551 | ||
1552 | if (!mMultipleViewsAtOnce) | 1552 | if (!mMultipleViewsAtOnce) |
1553 | { | 1553 | { |
1554 | mActionDetails->setEnabled(false); | 1554 | mActionDetails->setEnabled(false); |
1555 | } | 1555 | } |
1556 | 1556 | ||
1557 | mExtensionManager->setSelectionChanged(); | 1557 | mExtensionManager->setSelectionChanged(); |
1558 | 1558 | ||
1559 | } | 1559 | } |
1560 | 1560 | ||
1561 | #endif// DESKTOP_VERSION | 1561 | #endif// DESKTOP_VERSION |
1562 | 1562 | ||
1563 | } | 1563 | } |
1564 | 1564 | ||
1565 | 1565 | ||
1566 | void KABCore::extensionModified( const KABC::Addressee::List &list ) | 1566 | void KABCore::extensionModified( const KABC::Addressee::List &list ) |
1567 | { | 1567 | { |
1568 | 1568 | ||
1569 | if ( list.count() != 0 ) { | 1569 | if ( list.count() != 0 ) { |
1570 | KABC::Addressee::List::ConstIterator it; | 1570 | KABC::Addressee::List::ConstIterator it; |
1571 | for ( it = list.begin(); it != list.end(); ++it ) | 1571 | for ( it = list.begin(); it != list.end(); ++it ) |
1572 | mAddressBook->insertAddressee( *it ); | 1572 | mAddressBook->insertAddressee( *it ); |
1573 | if ( list.count() > 1 ) | 1573 | if ( list.count() > 1 ) |
1574 | setModified(); | 1574 | setModified(); |
1575 | else | 1575 | else |
1576 | setModifiedWOrefresh(); | 1576 | setModifiedWOrefresh(); |
1577 | } | 1577 | } |
1578 | if ( list.count() == 0 ) | 1578 | if ( list.count() == 0 ) |
1579 | mViewManager->refreshView(); | 1579 | mViewManager->refreshView(); |
1580 | else | 1580 | else |
1581 | mViewManager->refreshView( list[ 0 ].uid() ); | 1581 | mViewManager->refreshView( list[ 0 ].uid() ); |
1582 | 1582 | ||
1583 | 1583 | ||
1584 | 1584 | ||
1585 | } | 1585 | } |
1586 | 1586 | ||
1587 | QString KABCore::getNameByPhone( const QString &phone ) | 1587 | QString KABCore::getNameByPhone( const QString &phone ) |
1588 | { | 1588 | { |
1589 | #ifndef KAB_EMBEDDED | 1589 | #ifndef KAB_EMBEDDED |
1590 | QRegExp r( "[/*/-/ ]" ); | 1590 | QRegExp r( "[/*/-/ ]" ); |
1591 | QString localPhone( phone ); | 1591 | QString localPhone( phone ); |
1592 | 1592 | ||
1593 | bool found = false; | 1593 | bool found = false; |
1594 | QString ownerName = ""; | 1594 | QString ownerName = ""; |
1595 | KABC::AddressBook::Iterator iter; | 1595 | KABC::AddressBook::Iterator iter; |
1596 | KABC::PhoneNumber::List::Iterator phoneIter; | 1596 | KABC::PhoneNumber::List::Iterator phoneIter; |
1597 | KABC::PhoneNumber::List phoneList; | 1597 | KABC::PhoneNumber::List phoneList; |
1598 | for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) { | 1598 | for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) { |
1599 | phoneList = (*iter).phoneNumbers(); | 1599 | phoneList = (*iter).phoneNumbers(); |
1600 | for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() ); | 1600 | for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() ); |
1601 | ++phoneIter) { | 1601 | ++phoneIter) { |
1602 | // Get rid of separator chars so just the numbers are compared. | 1602 | // Get rid of separator chars so just the numbers are compared. |
1603 | if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) { | 1603 | if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) { |
1604 | ownerName = (*iter).formattedName(); | 1604 | ownerName = (*iter).formattedName(); |
1605 | found = true; | 1605 | found = true; |
1606 | } | 1606 | } |
1607 | } | 1607 | } |
1608 | } | 1608 | } |
1609 | 1609 | ||
1610 | return ownerName; | 1610 | return ownerName; |
1611 | #else //KAB_EMBEDDED | 1611 | #else //KAB_EMBEDDED |
1612 | qDebug("KABCore::getNameByPhone finsih method"); | 1612 | qDebug("KABCore::getNameByPhone finsih method"); |
1613 | return ""; | 1613 | return ""; |
1614 | #endif //KAB_EMBEDDED | 1614 | #endif //KAB_EMBEDDED |
1615 | 1615 | ||
1616 | } | 1616 | } |
1617 | 1617 | ||
1618 | void KABCore::openConfigDialog() | 1618 | void KABCore::openConfigDialog() |
1619 | { | 1619 | { |
1620 | KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true ); | 1620 | KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true ); |
1621 | KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" ); | 1621 | KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" ); |
1622 | ConfigureDialog->addModule(kabcfg ); | 1622 | ConfigureDialog->addModule(kabcfg ); |
1623 | KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" ); | 1623 | KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" ); |
1624 | ConfigureDialog->addModule(kdelibcfg ); | 1624 | ConfigureDialog->addModule(kdelibcfg ); |
1625 | 1625 | ||
1626 | connect( ConfigureDialog, SIGNAL( applyClicked() ), | 1626 | connect( ConfigureDialog, SIGNAL( applyClicked() ), |
1627 | this, SLOT( configurationChanged() ) ); | 1627 | this, SLOT( configurationChanged() ) ); |
1628 | connect( ConfigureDialog, SIGNAL( okClicked() ), | 1628 | connect( ConfigureDialog, SIGNAL( okClicked() ), |
1629 | this, SLOT( configurationChanged() ) ); | 1629 | this, SLOT( configurationChanged() ) ); |
1630 | saveSettings(); | 1630 | saveSettings(); |
1631 | #ifndef DESKTOP_VERSION | 1631 | #ifndef DESKTOP_VERSION |
1632 | ConfigureDialog->showMaximized(); | 1632 | ConfigureDialog->showMaximized(); |
1633 | #endif | 1633 | #endif |
1634 | if ( ConfigureDialog->exec() ) | 1634 | if ( ConfigureDialog->exec() ) |
1635 | KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") ); | 1635 | KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") ); |
1636 | delete ConfigureDialog; | 1636 | delete ConfigureDialog; |
1637 | } | 1637 | } |
1638 | 1638 | ||
1639 | void KABCore::openLDAPDialog() | 1639 | void KABCore::openLDAPDialog() |
1640 | { | 1640 | { |
1641 | #ifndef KAB_EMBEDDED | 1641 | #ifndef KAB_EMBEDDED |
1642 | if ( !mLdapSearchDialog ) { | 1642 | if ( !mLdapSearchDialog ) { |
1643 | mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this ); | 1643 | mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this ); |
1644 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager, | 1644 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager, |
1645 | SLOT( refreshView() ) ); | 1645 | SLOT( refreshView() ) ); |
1646 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this, | 1646 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this, |
1647 | SLOT( setModified() ) ); | 1647 | SLOT( setModified() ) ); |
1648 | } else | 1648 | } else |
1649 | mLdapSearchDialog->restoreSettings(); | 1649 | mLdapSearchDialog->restoreSettings(); |
1650 | 1650 | ||
1651 | if ( mLdapSearchDialog->isOK() ) | 1651 | if ( mLdapSearchDialog->isOK() ) |
1652 | mLdapSearchDialog->exec(); | 1652 | mLdapSearchDialog->exec(); |
1653 | #else //KAB_EMBEDDED | 1653 | #else //KAB_EMBEDDED |
1654 | qDebug("KABCore::openLDAPDialog() finsih method"); | 1654 | qDebug("KABCore::openLDAPDialog() finsih method"); |
1655 | #endif //KAB_EMBEDDED | 1655 | #endif //KAB_EMBEDDED |
1656 | } | 1656 | } |
1657 | 1657 | ||
1658 | void KABCore::print() | 1658 | void KABCore::print() |
1659 | { | 1659 | { |
1660 | #ifndef KAB_EMBEDDED | 1660 | #ifndef KAB_EMBEDDED |
1661 | KPrinter printer; | 1661 | KPrinter printer; |
1662 | if ( !printer.setup( this ) ) | 1662 | if ( !printer.setup( this ) ) |
1663 | return; | 1663 | return; |
1664 | 1664 | ||
1665 | KABPrinting::PrintingWizard wizard( &printer, mAddressBook, | 1665 | KABPrinting::PrintingWizard wizard( &printer, mAddressBook, |
1666 | mViewManager->selectedUids(), this ); | 1666 | mViewManager->selectedUids(), this ); |
1667 | 1667 | ||
1668 | wizard.exec(); | 1668 | wizard.exec(); |
1669 | #else //KAB_EMBEDDED | 1669 | #else //KAB_EMBEDDED |
1670 | qDebug("KABCore::print() finsih method"); | 1670 | qDebug("KABCore::print() finsih method"); |
1671 | #endif //KAB_EMBEDDED | 1671 | #endif //KAB_EMBEDDED |
1672 | 1672 | ||
1673 | } | 1673 | } |
1674 | 1674 | ||
1675 | 1675 | ||
1676 | void KABCore::addGUIClient( KXMLGUIClient *client ) | 1676 | void KABCore::addGUIClient( KXMLGUIClient *client ) |
1677 | { | 1677 | { |
1678 | if ( mGUIClient ) | 1678 | if ( mGUIClient ) |
1679 | mGUIClient->insertChildClient( client ); | 1679 | mGUIClient->insertChildClient( client ); |
1680 | else | 1680 | else |
1681 | KMessageBox::error( this, "no KXMLGUICLient"); | 1681 | KMessageBox::error( this, "no KXMLGUICLient"); |
1682 | } | 1682 | } |
1683 | 1683 | ||
1684 | 1684 | ||
1685 | void KABCore::configurationChanged() | 1685 | void KABCore::configurationChanged() |
1686 | { | 1686 | { |
1687 | mExtensionManager->reconfigure(); | 1687 | mExtensionManager->reconfigure(); |
1688 | } | 1688 | } |
1689 | 1689 | ||
1690 | void KABCore::addressBookChanged() | 1690 | void KABCore::addressBookChanged() |
1691 | { | 1691 | { |
1692 | /*US | 1692 | /*US |
1693 | QDictIterator<AddresseeEditorDialog> it( mEditorDict ); | 1693 | QDictIterator<AddresseeEditorDialog> it( mEditorDict ); |
1694 | while ( it.current() ) { | 1694 | while ( it.current() ) { |
1695 | if ( it.current()->dirty() ) { | 1695 | if ( it.current()->dirty() ) { |
1696 | QString text = i18n( "Data has been changed externally. Unsaved " | 1696 | QString text = i18n( "Data has been changed externally. Unsaved " |
1697 | "changes will be lost." ); | 1697 | "changes will be lost." ); |
1698 | KMessageBox::information( this, text ); | 1698 | KMessageBox::information( this, text ); |
1699 | } | 1699 | } |
1700 | it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) ); | 1700 | it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) ); |
1701 | ++it; | 1701 | ++it; |
1702 | } | 1702 | } |
1703 | */ | 1703 | */ |
1704 | if (mEditorDialog) | 1704 | if (mEditorDialog) |
1705 | { | 1705 | { |
1706 | if (mEditorDialog->dirty()) | 1706 | if (mEditorDialog->dirty()) |
1707 | { | 1707 | { |
1708 | QString text = i18n( "Data has been changed externally. Unsaved " | 1708 | QString text = i18n( "Data has been changed externally. Unsaved " |
1709 | "changes will be lost." ); | 1709 | "changes will be lost." ); |
1710 | KMessageBox::information( this, text ); | 1710 | KMessageBox::information( this, text ); |
1711 | } | 1711 | } |
1712 | QString currentuid = mEditorDialog->addressee().uid(); | 1712 | QString currentuid = mEditorDialog->addressee().uid(); |
1713 | mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) ); | 1713 | mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) ); |
1714 | } | 1714 | } |
1715 | mViewManager->refreshView(); | 1715 | mViewManager->refreshView(); |
1716 | 1716 | ||
1717 | 1717 | ||
1718 | } | 1718 | } |
1719 | 1719 | ||
1720 | AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, | 1720 | AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, |
1721 | const char *name ) | 1721 | const char *name ) |
1722 | { | 1722 | { |
1723 | 1723 | ||
1724 | if ( mEditorDialog == 0 ) { | 1724 | if ( mEditorDialog == 0 ) { |
1725 | mEditorDialog = new AddresseeEditorDialog( this, parent, | 1725 | mEditorDialog = new AddresseeEditorDialog( this, parent, |
1726 | name ? name : "editorDialog" ); | 1726 | name ? name : "editorDialog" ); |
1727 | 1727 | ||
1728 | 1728 | ||
1729 | connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ), | 1729 | connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ), |
1730 | SLOT( contactModified( const KABC::Addressee& ) ) ); | 1730 | SLOT( contactModified( const KABC::Addressee& ) ) ); |
1731 | //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ), | 1731 | //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ), |
1732 | // SLOT( slotEditorDestroyed( const QString& ) ) ; | 1732 | // SLOT( slotEditorDestroyed( const QString& ) ) ; |
1733 | } | 1733 | } |
1734 | 1734 | ||
1735 | return mEditorDialog; | 1735 | return mEditorDialog; |
1736 | } | 1736 | } |
1737 | 1737 | ||
1738 | void KABCore::slotEditorDestroyed( const QString &uid ) | 1738 | void KABCore::slotEditorDestroyed( const QString &uid ) |
1739 | { | 1739 | { |
1740 | //mEditorDict.remove( uid ); | 1740 | //mEditorDict.remove( uid ); |
1741 | } | 1741 | } |
1742 | 1742 | ||
1743 | void KABCore::initGUI() | 1743 | void KABCore::initGUI() |
1744 | { | 1744 | { |
1745 | #ifndef KAB_EMBEDDED | 1745 | #ifndef KAB_EMBEDDED |
1746 | QHBoxLayout *topLayout = new QHBoxLayout( this ); | 1746 | QHBoxLayout *topLayout = new QHBoxLayout( this ); |
1747 | topLayout->setSpacing( KDialogBase::spacingHint() ); | 1747 | topLayout->setSpacing( KDialogBase::spacingHint() ); |
1748 | 1748 | ||
1749 | mExtensionBarSplitter = new QSplitter( this ); | 1749 | mExtensionBarSplitter = new QSplitter( this ); |
1750 | mExtensionBarSplitter->setOrientation( Qt::Vertical ); | 1750 | mExtensionBarSplitter->setOrientation( Qt::Vertical ); |
1751 | 1751 | ||
1752 | mDetailsSplitter = new QSplitter( mExtensionBarSplitter ); | 1752 | mDetailsSplitter = new QSplitter( mExtensionBarSplitter ); |
1753 | 1753 | ||
1754 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); | 1754 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); |
1755 | mIncSearchWidget = new IncSearchWidget( viewSpace ); | 1755 | mIncSearchWidget = new IncSearchWidget( viewSpace ); |
1756 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 1756 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
1757 | SLOT( incrementalSearch( const QString& ) ) ); | 1757 | SLOT( incrementalSearch( const QString& ) ) ); |
1758 | 1758 | ||
1759 | mViewManager = new ViewManager( this, viewSpace ); | 1759 | mViewManager = new ViewManager( this, viewSpace ); |
1760 | viewSpace->setStretchFactor( mViewManager, 1 ); | 1760 | viewSpace->setStretchFactor( mViewManager, 1 ); |
1761 | 1761 | ||
1762 | mDetails = new ViewContainer( mDetailsSplitter ); | 1762 | mDetails = new ViewContainer( mDetailsSplitter ); |
1763 | 1763 | ||
1764 | mJumpButtonBar = new JumpButtonBar( this, this ); | 1764 | mJumpButtonBar = new JumpButtonBar( this, this ); |
1765 | 1765 | ||
1766 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); | 1766 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); |
1767 | 1767 | ||
1768 | topLayout->addWidget( mExtensionBarSplitter ); | 1768 | topLayout->addWidget( mExtensionBarSplitter ); |
1769 | topLayout->setStretchFactor( mExtensionBarSplitter, 100 ); | 1769 | topLayout->setStretchFactor( mExtensionBarSplitter, 100 ); |
1770 | topLayout->addWidget( mJumpButtonBar ); | 1770 | topLayout->addWidget( mJumpButtonBar ); |
1771 | //topLayout->setStretchFactor( mJumpButtonBar, 1 ); | 1771 | //topLayout->setStretchFactor( mJumpButtonBar, 1 ); |
1772 | 1772 | ||
1773 | mXXPortManager = new XXPortManager( this, this ); | 1773 | mXXPortManager = new XXPortManager( this, this ); |
1774 | 1774 | ||
1775 | #else //KAB_EMBEDDED | 1775 | #else //KAB_EMBEDDED |
1776 | //US initialize viewMenu before settingup viewmanager. | 1776 | //US initialize viewMenu before settingup viewmanager. |
1777 | // Viewmanager needs this menu to plugin submenues. | 1777 | // Viewmanager needs this menu to plugin submenues. |
1778 | viewMenu = new QPopupMenu( this ); | 1778 | viewMenu = new QPopupMenu( this ); |
1779 | settingsMenu = new QPopupMenu( this ); | 1779 | settingsMenu = new QPopupMenu( this ); |
1780 | //filterMenu = new QPopupMenu( this ); | 1780 | //filterMenu = new QPopupMenu( this ); |
1781 | ImportMenu = new QPopupMenu( this ); | 1781 | ImportMenu = new QPopupMenu( this ); |
1782 | ExportMenu = new QPopupMenu( this ); | 1782 | ExportMenu = new QPopupMenu( this ); |
1783 | syncMenu = new QPopupMenu( this ); | 1783 | syncMenu = new QPopupMenu( this ); |
1784 | changeMenu= new QPopupMenu( this ); | 1784 | changeMenu= new QPopupMenu( this ); |
1785 | beamMenu= new QPopupMenu( this ); | 1785 | beamMenu= new QPopupMenu( this ); |
1786 | 1786 | ||
1787 | //US since we have no splitter for the embedded system, setup | 1787 | //US since we have no splitter for the embedded system, setup |
1788 | // a layout with two frames. One left and one right. | 1788 | // a layout with two frames. One left and one right. |
1789 | 1789 | ||
1790 | QBoxLayout *topLayout; | 1790 | QBoxLayout *topLayout; |
1791 | 1791 | ||
1792 | // = new QHBoxLayout( this ); | 1792 | // = new QHBoxLayout( this ); |
1793 | // QBoxLayout *topLayout = (QBoxLayout*)layout(); | 1793 | // QBoxLayout *topLayout = (QBoxLayout*)layout(); |
1794 | 1794 | ||
1795 | // QWidget *mainBox = new QWidget( this ); | 1795 | // QWidget *mainBox = new QWidget( this ); |
1796 | // QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); | 1796 | // QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); |
1797 | 1797 | ||
1798 | #ifdef DESKTOP_VERSION | 1798 | #ifdef DESKTOP_VERSION |
1799 | topLayout = new QHBoxLayout( this ); | 1799 | topLayout = new QHBoxLayout( this ); |
1800 | 1800 | ||
1801 | 1801 | ||
1802 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); | 1802 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); |
1803 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 1803 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
1804 | 1804 | ||
1805 | topLayout->addWidget(mMiniSplitter ); | 1805 | topLayout->addWidget(mMiniSplitter ); |
1806 | 1806 | ||
1807 | mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); | 1807 | mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); |
1808 | mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); | 1808 | mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); |
1809 | mViewManager = new ViewManager( this, mExtensionBarSplitter ); | 1809 | mViewManager = new ViewManager( this, mExtensionBarSplitter ); |
1810 | mDetails = new ViewContainer( mMiniSplitter ); | 1810 | mDetails = new ViewContainer( mMiniSplitter ); |
1811 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); | 1811 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); |
1812 | #else | 1812 | #else |
1813 | if ( QApplication::desktop()->width() > 480 ) { | 1813 | if ( QApplication::desktop()->width() > 480 ) { |
1814 | topLayout = new QHBoxLayout( this ); | 1814 | topLayout = new QHBoxLayout( this ); |
1815 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); | 1815 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); |
1816 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 1816 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
1817 | } else { | 1817 | } else { |
1818 | 1818 | ||
1819 | topLayout = new QHBoxLayout( this ); | 1819 | topLayout = new QHBoxLayout( this ); |
1820 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); | 1820 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); |
1821 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); | 1821 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); |
1822 | } | 1822 | } |
1823 | 1823 | ||
1824 | topLayout->addWidget(mMiniSplitter ); | 1824 | topLayout->addWidget(mMiniSplitter ); |
1825 | mViewManager = new ViewManager( this, mMiniSplitter ); | 1825 | mViewManager = new ViewManager( this, mMiniSplitter ); |
1826 | mDetails = new ViewContainer( mMiniSplitter ); | 1826 | mDetails = new ViewContainer( mMiniSplitter ); |
1827 | 1827 | ||
1828 | 1828 | ||
1829 | mExtensionManager = new ExtensionManager( this, mMiniSplitter ); | 1829 | mExtensionManager = new ExtensionManager( this, mMiniSplitter ); |
1830 | #endif | 1830 | #endif |
1831 | //eh->hide(); | 1831 | //eh->hide(); |
1832 | // topLayout->addWidget(mExtensionManager ); | 1832 | // topLayout->addWidget(mExtensionManager ); |
1833 | 1833 | ||
1834 | 1834 | ||
1835 | /*US | 1835 | /*US |
1836 | #ifndef KAB_NOSPLITTER | 1836 | #ifndef KAB_NOSPLITTER |
1837 | QHBoxLayout *topLayout = new QHBoxLayout( this ); | 1837 | QHBoxLayout *topLayout = new QHBoxLayout( this ); |
1838 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); | 1838 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); |
1839 | topLayout->setSpacing( 10 ); | 1839 | topLayout->setSpacing( 10 ); |
1840 | 1840 | ||
1841 | mDetailsSplitter = new QSplitter( this ); | 1841 | mDetailsSplitter = new QSplitter( this ); |
1842 | 1842 | ||
1843 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); | 1843 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); |
1844 | 1844 | ||
1845 | mViewManager = new ViewManager( this, viewSpace ); | 1845 | mViewManager = new ViewManager( this, viewSpace ); |
1846 | viewSpace->setStretchFactor( mViewManager, 1 ); | 1846 | viewSpace->setStretchFactor( mViewManager, 1 ); |
1847 | 1847 | ||
1848 | mDetails = new ViewContainer( mDetailsSplitter ); | 1848 | mDetails = new ViewContainer( mDetailsSplitter ); |
1849 | 1849 | ||
1850 | topLayout->addWidget( mDetailsSplitter ); | 1850 | topLayout->addWidget( mDetailsSplitter ); |
1851 | topLayout->setStretchFactor( mDetailsSplitter, 100 ); | 1851 | topLayout->setStretchFactor( mDetailsSplitter, 100 ); |
1852 | #else //KAB_NOSPLITTER | 1852 | #else //KAB_NOSPLITTER |
1853 | QHBoxLayout *topLayout = new QHBoxLayout( this ); | 1853 | QHBoxLayout *topLayout = new QHBoxLayout( this ); |
1854 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); | 1854 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); |
1855 | topLayout->setSpacing( 10 ); | 1855 | topLayout->setSpacing( 10 ); |
1856 | 1856 | ||
1857 | // mDetailsSplitter = new QSplitter( this ); | 1857 | // mDetailsSplitter = new QSplitter( this ); |
1858 | 1858 | ||
1859 | QVBox *viewSpace = new QVBox( this ); | 1859 | QVBox *viewSpace = new QVBox( this ); |
1860 | 1860 | ||
1861 | mViewManager = new ViewManager( this, viewSpace ); | 1861 | mViewManager = new ViewManager( this, viewSpace ); |
1862 | viewSpace->setStretchFactor( mViewManager, 1 ); | 1862 | viewSpace->setStretchFactor( mViewManager, 1 ); |
1863 | 1863 | ||
1864 | mDetails = new ViewContainer( this ); | 1864 | mDetails = new ViewContainer( this ); |
1865 | 1865 | ||
1866 | topLayout->addWidget( viewSpace ); | 1866 | topLayout->addWidget( viewSpace ); |
1867 | // topLayout->setStretchFactor( mDetailsSplitter, 100 ); | 1867 | // topLayout->setStretchFactor( mDetailsSplitter, 100 ); |
1868 | topLayout->addWidget( mDetails ); | 1868 | topLayout->addWidget( mDetails ); |
1869 | #endif //KAB_NOSPLITTER | 1869 | #endif //KAB_NOSPLITTER |
1870 | */ | 1870 | */ |
1871 | 1871 | ||
1872 | syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); | 1872 | syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); |
1873 | syncManager->setBlockSave(false); | 1873 | syncManager->setBlockSave(false); |
1874 | 1874 | ||
1875 | connect(syncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); | 1875 | connect(syncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); |
1876 | connect(syncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); | 1876 | connect(syncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); |
1877 | QString sync_file = sentSyncFile(); | 1877 | QString sync_file = sentSyncFile(); |
1878 | //qDebug("KABCore::initGUI()::setting tmp sync file to:%s ",sync_file.latin1()); | 1878 | //qDebug("KABCore::initGUI()::setting tmp sync file to:%s ",sync_file.latin1()); |
1879 | syncManager->setDefaultFileName( sync_file ); | 1879 | syncManager->setDefaultFileName( sync_file ); |
1880 | //connect(syncManager , SIGNAL( ), this, SLOT( ) ); | 1880 | //connect(syncManager , SIGNAL( ), this, SLOT( ) ); |
1881 | 1881 | ||
1882 | #endif //KAB_EMBEDDED | 1882 | #endif //KAB_EMBEDDED |
1883 | initActions(); | 1883 | initActions(); |
1884 | 1884 | ||
1885 | #ifdef KAB_EMBEDDED | 1885 | #ifdef KAB_EMBEDDED |
1886 | addActionsManually(); | 1886 | addActionsManually(); |
1887 | //US make sure the export and import menues are initialized before creating the xxPortManager. | 1887 | //US make sure the export and import menues are initialized before creating the xxPortManager. |
1888 | mXXPortManager = new XXPortManager( this, this ); | 1888 | mXXPortManager = new XXPortManager( this, this ); |
1889 | 1889 | ||
1890 | // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); | 1890 | // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); |
1891 | //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); | 1891 | //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); |
1892 | // mActionQuit->plug ( mMainWindow->toolBar()); | 1892 | // mActionQuit->plug ( mMainWindow->toolBar()); |
1893 | //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); | 1893 | //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); |
1894 | //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); | 1894 | //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); |
1895 | // mIncSearchWidget->hide(); | 1895 | // mIncSearchWidget->hide(); |
1896 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 1896 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
1897 | SLOT( incrementalSearch( const QString& ) ) ); | 1897 | SLOT( incrementalSearch( const QString& ) ) ); |
1898 | connect( mIncSearchWidget, SIGNAL( scrollUP() ),mViewManager, SLOT( scrollUP() ) ); | 1898 | connect( mIncSearchWidget, SIGNAL( scrollUP() ),mViewManager, SLOT( scrollUP() ) ); |
1899 | connect( mIncSearchWidget, SIGNAL( scrollDOWN() ),mViewManager, SLOT( scrollDOWN() ) ); | 1899 | connect( mIncSearchWidget, SIGNAL( scrollDOWN() ),mViewManager, SLOT( scrollDOWN() ) ); |
1900 | 1900 | ||
1901 | mJumpButtonBar = new JumpButtonBar( this, this ); | 1901 | mJumpButtonBar = new JumpButtonBar( this, this ); |
1902 | 1902 | ||
1903 | topLayout->addWidget( mJumpButtonBar ); | 1903 | topLayout->addWidget( mJumpButtonBar ); |
1904 | //US topLayout->setStretchFactor( mJumpButtonBar, 10 ); | 1904 | //US topLayout->setStretchFactor( mJumpButtonBar, 10 ); |
1905 | 1905 | ||
1906 | // mMainWindow->getIconToolBar()->raise(); | 1906 | // mMainWindow->getIconToolBar()->raise(); |
1907 | 1907 | ||
1908 | #endif //KAB_EMBEDDED | 1908 | #endif //KAB_EMBEDDED |
1909 | 1909 | ||
1910 | } | 1910 | } |
1911 | void KABCore::initActions() | 1911 | void KABCore::initActions() |
1912 | { | 1912 | { |
1913 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); | 1913 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); |
1914 | 1914 | ||
1915 | #ifndef KAB_EMBEDDED | 1915 | #ifndef KAB_EMBEDDED |
1916 | connect( QApplication::clipboard(), SIGNAL( dataChanged() ), | 1916 | connect( QApplication::clipboard(), SIGNAL( dataChanged() ), |
1917 | SLOT( clipboardDataChanged() ) ); | 1917 | SLOT( clipboardDataChanged() ) ); |
1918 | #endif //KAB_EMBEDDED | 1918 | #endif //KAB_EMBEDDED |
1919 | 1919 | ||
1920 | // file menu | 1920 | // file menu |
1921 | 1921 | ||
1922 | mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); | 1922 | mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); |
1923 | //mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); | 1923 | //mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); |
1924 | mActionPrint = new KAction( i18n( "&Print View" ), "fileprint", CTRL + Key_P, mViewManager, | 1924 | mActionPrint = new KAction( i18n( "&Print View" ), "fileprint", CTRL + Key_P, mViewManager, |
1925 | SLOT( printView() ), actionCollection(), "kaddressbook_print" ); | 1925 | SLOT( printView() ), actionCollection(), "kaddressbook_print" ); |
1926 | 1926 | ||
1927 | 1927 | ||
1928 | mActionPrintDetails = new KAction( i18n( "&Print Details" ), "fileprint", 0, mDetails, | 1928 | mActionPrintDetails = new KAction( i18n( "&Print Details" ), "fileprint", 0, mDetails, |
1929 | SLOT( printView() ), actionCollection(), "kaddressbook_print2" ); | 1929 | SLOT( printView() ), actionCollection(), "kaddressbook_print2" ); |
1930 | 1930 | ||
1931 | mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, | 1931 | mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, |
1932 | SLOT( save() ), actionCollection(), "file_sync" ); | 1932 | SLOT( save() ), actionCollection(), "file_sync" ); |
1933 | 1933 | ||
1934 | mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, | 1934 | mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, |
1935 | SLOT( newContact() ), actionCollection(), "file_new_contact" ); | 1935 | SLOT( newContact() ), actionCollection(), "file_new_contact" ); |
1936 | 1936 | ||
1937 | mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, | 1937 | mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, |
1938 | this, SLOT( mailVCard() ), | 1938 | this, SLOT( mailVCard() ), |
1939 | actionCollection(), "file_mail_vcard"); | 1939 | actionCollection(), "file_mail_vcard"); |
1940 | 1940 | ||
1941 | mActionExport2phone = new KAction( i18n( "Export to phone" ), "ex2phone", 0, this, | 1941 | mActionExport2phone = new KAction( i18n( "Export to phone" ), "ex2phone", 0, this, |
1942 | SLOT( export2phone() ), actionCollection(), | 1942 | SLOT( export2phone() ), actionCollection(), |
1943 | "kaddressbook_ex2phone" ); | 1943 | "kaddressbook_ex2phone" ); |
1944 | 1944 | ||
1945 | mActionBeamVCard = 0; | 1945 | mActionBeamVCard = 0; |
1946 | mActionBeam = 0; | 1946 | mActionBeam = 0; |
1947 | 1947 | ||
1948 | #ifndef DESKTOP_VERSION | 1948 | #ifndef DESKTOP_VERSION |
1949 | if ( Ir::supported() ) { | 1949 | if ( Ir::supported() ) { |
1950 | mActionBeamVCard = new KAction( i18n( "Beam v&Card(s)..." ), "beam", 0, this, | 1950 | mActionBeamVCard = new KAction( i18n( "Beam v&Card(s)..." ), "beam", 0, this, |
1951 | SLOT( beamVCard() ), actionCollection(), | 1951 | SLOT( beamVCard() ), actionCollection(), |
1952 | "kaddressbook_beam_vcard" ); | 1952 | "kaddressbook_beam_vcard" ); |
1953 | 1953 | ||
1954 | mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, | 1954 | mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, |
1955 | SLOT( beamMySelf() ), actionCollection(), | 1955 | SLOT( beamMySelf() ), actionCollection(), |
1956 | "kaddressbook_beam_myself" ); | 1956 | "kaddressbook_beam_myself" ); |
1957 | } | 1957 | } |
1958 | #endif | 1958 | #endif |
1959 | 1959 | ||
1960 | mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, | 1960 | mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, |
1961 | this, SLOT( editContact2() ), | 1961 | this, SLOT( editContact2() ), |
1962 | actionCollection(), "file_properties" ); | 1962 | actionCollection(), "file_properties" ); |
1963 | 1963 | ||
1964 | #ifdef KAB_EMBEDDED | 1964 | #ifdef KAB_EMBEDDED |
1965 | // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); | 1965 | // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); |
1966 | mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, | 1966 | mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, |
1967 | mMainWindow, SLOT( exit() ), | 1967 | mMainWindow, SLOT( exit() ), |
1968 | actionCollection(), "quit" ); | 1968 | actionCollection(), "quit" ); |
1969 | #endif //KAB_EMBEDDED | 1969 | #endif //KAB_EMBEDDED |
1970 | 1970 | ||
1971 | // edit menu | 1971 | // edit menu |
1972 | if ( mIsPart ) { | 1972 | if ( mIsPart ) { |
1973 | mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, | 1973 | mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, |
1974 | SLOT( copyContacts() ), actionCollection(), | 1974 | SLOT( copyContacts() ), actionCollection(), |
1975 | "kaddressbook_copy" ); | 1975 | "kaddressbook_copy" ); |
1976 | mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, | 1976 | mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, |
1977 | SLOT( cutContacts() ), actionCollection(), | 1977 | SLOT( cutContacts() ), actionCollection(), |
1978 | "kaddressbook_cut" ); | 1978 | "kaddressbook_cut" ); |
1979 | mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, | 1979 | mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, |
1980 | SLOT( pasteContacts() ), actionCollection(), | 1980 | SLOT( pasteContacts() ), actionCollection(), |
1981 | "kaddressbook_paste" ); | 1981 | "kaddressbook_paste" ); |
1982 | mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, | 1982 | mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, |
1983 | SLOT( selectAllContacts() ), actionCollection(), | 1983 | SLOT( selectAllContacts() ), actionCollection(), |
1984 | "kaddressbook_select_all" ); | 1984 | "kaddressbook_select_all" ); |
1985 | mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, | 1985 | mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, |
1986 | SLOT( undo() ), actionCollection(), | 1986 | SLOT( undo() ), actionCollection(), |
1987 | "kaddressbook_undo" ); | 1987 | "kaddressbook_undo" ); |
1988 | mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, | 1988 | mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, |
1989 | this, SLOT( redo() ), actionCollection(), | 1989 | this, SLOT( redo() ), actionCollection(), |
1990 | "kaddressbook_redo" ); | 1990 | "kaddressbook_redo" ); |
1991 | } else { | 1991 | } else { |
1992 | mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); | 1992 | mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); |
1993 | mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); | 1993 | mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); |
1994 | mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); | 1994 | mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); |
1995 | mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); | 1995 | mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); |
1996 | mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); | 1996 | mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); |
1997 | mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); | 1997 | mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); |
1998 | } | 1998 | } |
1999 | 1999 | ||
2000 | mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", | 2000 | mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", |
2001 | Key_Delete, this, SLOT( deleteContacts() ), | 2001 | Key_Delete, this, SLOT( deleteContacts() ), |
2002 | actionCollection(), "edit_delete" ); | 2002 | actionCollection(), "edit_delete" ); |
2003 | 2003 | ||
2004 | mActionUndo->setEnabled( false ); | 2004 | mActionUndo->setEnabled( false ); |
2005 | mActionRedo->setEnabled( false ); | 2005 | mActionRedo->setEnabled( false ); |
2006 | 2006 | ||
2007 | // settings menu | 2007 | // settings menu |
2008 | #ifdef KAB_EMBEDDED | 2008 | #ifdef KAB_EMBEDDED |
2009 | //US special menuentry to configure the addressbook resources. On KDE | 2009 | //US special menuentry to configure the addressbook resources. On KDE |
2010 | // you do that through the control center !!! | 2010 | // you do that through the control center !!! |
2011 | mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, | 2011 | mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, |
2012 | SLOT( configureResources() ), actionCollection(), | 2012 | SLOT( configureResources() ), actionCollection(), |
2013 | "kaddressbook_configure_resources" ); | 2013 | "kaddressbook_configure_resources" ); |
2014 | #endif //KAB_EMBEDDED | 2014 | #endif //KAB_EMBEDDED |
2015 | 2015 | ||
2016 | if ( mIsPart ) { | 2016 | if ( mIsPart ) { |
2017 | mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, | 2017 | mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, |
2018 | SLOT( openConfigDialog() ), actionCollection(), | 2018 | SLOT( openConfigDialog() ), actionCollection(), |
2019 | "kaddressbook_configure" ); | 2019 | "kaddressbook_configure" ); |
2020 | 2020 | ||
2021 | //US not implemented yet | 2021 | //US not implemented yet |
2022 | //mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, | 2022 | //mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, |
2023 | // this, SLOT( configureKeyBindings() ), actionCollection(), | 2023 | // this, SLOT( configureKeyBindings() ), actionCollection(), |
2024 | // "kaddressbook_configure_shortcuts" ); | 2024 | // "kaddressbook_configure_shortcuts" ); |
2025 | #ifdef KAB_EMBEDDED | 2025 | #ifdef KAB_EMBEDDED |
2026 | mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); | 2026 | mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); |
2027 | mActionConfigureToolbars->setEnabled( false ); | 2027 | mActionConfigureToolbars->setEnabled( false ); |
2028 | #endif //KAB_EMBEDDED | 2028 | #endif //KAB_EMBEDDED |
2029 | 2029 | ||
2030 | } else { | 2030 | } else { |
2031 | mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); | 2031 | mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); |
2032 | 2032 | ||
2033 | //US not implemented yet | 2033 | //US not implemented yet |
2034 | //mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); | 2034 | //mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); |
2035 | } | 2035 | } |
2036 | 2036 | ||
2037 | mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, | 2037 | mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, |
2038 | actionCollection(), "options_show_jump_bar" ); | 2038 | actionCollection(), "options_show_jump_bar" ); |
2039 | connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBar( bool ) ) ); | 2039 | connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBar( bool ) ) ); |
2040 | 2040 | ||
2041 | mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0, | 2041 | mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0, |
2042 | actionCollection(), "options_show_details" ); | 2042 | actionCollection(), "options_show_details" ); |
2043 | connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); | 2043 | connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); |
2044 | 2044 | ||
2045 | 2045 | ||
2046 | mActionBR = new KToggleAction( i18n( "Beam receive enabled" ), "beam", 0, this, | 2046 | mActionBR = new KToggleAction( i18n( "Beam receive enabled" ), "beam", 0, this, |
2047 | SLOT( toggleBeamReceive() ), actionCollection(), | 2047 | SLOT( toggleBeamReceive() ), actionCollection(), |
2048 | "kaddressbook_beam_rec" ); | 2048 | "kaddressbook_beam_rec" ); |
2049 | 2049 | ||
2050 | 2050 | ||
2051 | // misc | 2051 | // misc |
2052 | // only enable LDAP lookup if we can handle the protocol | 2052 | // only enable LDAP lookup if we can handle the protocol |
2053 | #ifndef KAB_EMBEDDED | 2053 | #ifndef KAB_EMBEDDED |
2054 | if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { | 2054 | if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { |
2055 | new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, | 2055 | new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, |
2056 | this, SLOT( openLDAPDialog() ), actionCollection(), | 2056 | this, SLOT( openLDAPDialog() ), actionCollection(), |
2057 | "ldap_lookup" ); | 2057 | "ldap_lookup" ); |
2058 | } | 2058 | } |
2059 | #else //KAB_EMBEDDED | 2059 | #else //KAB_EMBEDDED |
2060 | //qDebug("KABCore::initActions() LDAP has to be implemented"); | 2060 | //qDebug("KABCore::initActions() LDAP has to be implemented"); |
2061 | #endif //KAB_EMBEDDED | 2061 | #endif //KAB_EMBEDDED |
2062 | 2062 | ||
2063 | 2063 | ||
2064 | mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, | 2064 | mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, |
2065 | SLOT( setWhoAmI() ), actionCollection(), | 2065 | SLOT( setWhoAmI() ), actionCollection(), |
2066 | "set_personal" ); | 2066 | "set_personal" ); |
2067 | 2067 | ||
2068 | 2068 | ||
2069 | mActionCategories = new KAction( i18n( "Set Categories for Contacts..." ), 0, this, | 2069 | mActionCategories = new KAction( i18n( "Set Categories for Contacts..." ), 0, this, |
2070 | SLOT( setCategories() ), actionCollection(), | 2070 | SLOT( setCategories() ), actionCollection(), |
2071 | "edit_set_categories" ); | 2071 | "edit_set_categories" ); |
2072 | mActionEditCategories = new KAction( i18n( "Edit Category List..." ), 0, this, | 2072 | mActionEditCategories = new KAction( i18n( "Edit Category List..." ), 0, this, |
2073 | SLOT( editCategories() ), actionCollection(), | 2073 | SLOT( editCategories() ), actionCollection(), |
2074 | "edit__categories" ); | 2074 | "edit__categories" ); |
2075 | 2075 | ||
2076 | mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, | 2076 | mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, |
2077 | SLOT( removeVoice() ), actionCollection(), | 2077 | SLOT( removeVoice() ), actionCollection(), |
2078 | "remove_voice" ); | 2078 | "remove_voice" ); |
2079 | mActionSetFormattedName = new KAction( i18n( "Set formatted name..." ), 0, this, | 2079 | mActionSetFormattedName = new KAction( i18n( "Set formatted name..." ), 0, this, |
2080 | SLOT( setFormattedName() ), actionCollection(), | 2080 | SLOT( setFormattedName() ), actionCollection(), |
2081 | "set_formatted" ); | 2081 | "set_formatted" ); |
2082 | 2082 | ||
2083 | mActionManageCategories= new KAction( i18n( "Manage new categories..." ), 0, this, | 2083 | mActionManageCategories= new KAction( i18n( "Manage new categories..." ), 0, this, |
2084 | SLOT( manageCategories() ), actionCollection(), | 2084 | SLOT( manageCategories() ), actionCollection(), |
2085 | "remove_voice" ); | 2085 | "remove_voice" ); |
2086 | 2086 | ||
2087 | 2087 | ||
2088 | mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this, | 2088 | mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this, |
2089 | SLOT( importFromOL() ), actionCollection(), | 2089 | SLOT( importFromOL() ), actionCollection(), |
2090 | "import_OL" ); | 2090 | "import_OL" ); |
2091 | #ifdef KAB_EMBEDDED | 2091 | #ifdef KAB_EMBEDDED |
2092 | mActionLicence = new KAction( i18n( "Licence" ), 0, | 2092 | mActionLicence = new KAction( i18n( "Licence" ), 0, |
2093 | this, SLOT( showLicence() ), actionCollection(), | 2093 | this, SLOT( showLicence() ), actionCollection(), |
2094 | "licence_about_data" ); | 2094 | "licence_about_data" ); |
2095 | mActionFaq = new KAction( i18n( "Faq" ), 0, | 2095 | mActionFaq = new KAction( i18n( "Faq" ), 0, |
2096 | this, SLOT( faq() ), actionCollection(), | 2096 | this, SLOT( faq() ), actionCollection(), |
2097 | "faq_about_data" ); | 2097 | "faq_about_data" ); |
2098 | mActionWN = new KAction( i18n( "What's New?" ), 0, | 2098 | mActionWN = new KAction( i18n( "What's New?" ), 0, |
2099 | this, SLOT( whatsnew() ), actionCollection(), | 2099 | this, SLOT( whatsnew() ), actionCollection(), |
2100 | "wn" ); | 2100 | "wn" ); |
2101 | mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0, | 2101 | mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0, |
2102 | this, SLOT( synchowto() ), actionCollection(), | 2102 | this, SLOT( synchowto() ), actionCollection(), |
2103 | "sync" ); | 2103 | "sync" ); |
2104 | mActionKdeSyncHowto = new KAction( i18n( "Kde Sync HowTo" ), 0, | 2104 | mActionKdeSyncHowto = new KAction( i18n( "Kde Sync HowTo" ), 0, |
2105 | this, SLOT( kdesynchowto() ), actionCollection(), | 2105 | this, SLOT( kdesynchowto() ), actionCollection(), |
2106 | "kdesync" ); | 2106 | "kdesync" ); |
2107 | mActionMultiSyncHowto = new KAction( i18n( "Multi Sync HowTo" ), 0, | 2107 | mActionMultiSyncHowto = new KAction( i18n( "Multi Sync HowTo" ), 0, |
2108 | this, SLOT( multisynchowto() ), actionCollection(), | 2108 | this, SLOT( multisynchowto() ), actionCollection(), |
2109 | "multisync" ); | 2109 | "multisync" ); |
2110 | 2110 | ||
2111 | mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, | 2111 | mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, |
2112 | this, SLOT( createAboutData() ), actionCollection(), | 2112 | this, SLOT( createAboutData() ), actionCollection(), |
2113 | "kaddressbook_about_data" ); | 2113 | "kaddressbook_about_data" ); |
2114 | #endif //KAB_EMBEDDED | 2114 | #endif //KAB_EMBEDDED |
2115 | 2115 | ||
2116 | clipboardDataChanged(); | 2116 | clipboardDataChanged(); |
2117 | connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); | 2117 | connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); |
2118 | connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); | 2118 | connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); |
2119 | } | 2119 | } |
2120 | 2120 | ||
2121 | //US we need this function, to plug all actions into the correct menues. | 2121 | //US we need this function, to plug all actions into the correct menues. |
2122 | // KDE uses a XML format to plug the actions, but we work her without this overhead. | 2122 | // KDE uses a XML format to plug the actions, but we work her without this overhead. |
2123 | void KABCore::addActionsManually() | 2123 | void KABCore::addActionsManually() |
2124 | { | 2124 | { |
2125 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); | 2125 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); |
2126 | 2126 | ||
2127 | #ifdef KAB_EMBEDDED | 2127 | #ifdef KAB_EMBEDDED |
2128 | QPopupMenu *fileMenu = new QPopupMenu( this ); | 2128 | QPopupMenu *fileMenu = new QPopupMenu( this ); |
2129 | QPopupMenu *editMenu = new QPopupMenu( this ); | 2129 | QPopupMenu *editMenu = new QPopupMenu( this ); |
2130 | QPopupMenu *helpMenu = new QPopupMenu( this ); | 2130 | QPopupMenu *helpMenu = new QPopupMenu( this ); |
2131 | 2131 | ||
2132 | KToolBar* tb = mMainWindow->toolBar(); | 2132 | KToolBar* tb = mMainWindow->toolBar(); |
2133 | mMainWindow->setToolBarsMovable (false ); | 2133 | mMainWindow->setToolBarsMovable (false ); |
2134 | #ifndef DESKTOP_VERSION | 2134 | #ifndef DESKTOP_VERSION |
2135 | if ( KABPrefs::instance()->mFullMenuBarVisible ) { | 2135 | if ( KABPrefs::instance()->mFullMenuBarVisible ) { |
2136 | #endif | 2136 | #endif |
2137 | QMenuBar* mb = mMainWindow->menuBar(); | 2137 | QMenuBar* mb = mMainWindow->menuBar(); |
2138 | 2138 | ||
2139 | //US setup menubar. | 2139 | //US setup menubar. |
2140 | //Disable the following block if you do not want to have a menubar. | 2140 | //Disable the following block if you do not want to have a menubar. |
2141 | mb->insertItem( i18n("&File"), fileMenu ); | 2141 | mb->insertItem( i18n("&File"), fileMenu ); |
2142 | mb->insertItem( i18n("&Edit"), editMenu ); | 2142 | mb->insertItem( i18n("&Edit"), editMenu ); |
2143 | mb->insertItem( i18n("&View"), viewMenu ); | 2143 | mb->insertItem( i18n("&View"), viewMenu ); |
2144 | mb->insertItem( i18n("&Settings"), settingsMenu ); | 2144 | mb->insertItem( i18n("&Settings"), settingsMenu ); |
2145 | #ifdef DESKTOP_VERSION | 2145 | #ifdef DESKTOP_VERSION |
2146 | mb->insertItem( i18n("Synchronize"), syncMenu ); | 2146 | mb->insertItem( i18n("Synchronize"), syncMenu ); |
2147 | #else | 2147 | #else |
2148 | mb->insertItem( i18n("Sync"), syncMenu ); | 2148 | mb->insertItem( i18n("Sync"), syncMenu ); |
2149 | #endif | 2149 | #endif |
2150 | //mb->insertItem( i18n("&Change"), changeMenu ); | 2150 | //mb->insertItem( i18n("&Change"), changeMenu ); |
2151 | mb->insertItem( i18n("&Help"), helpMenu ); | 2151 | mb->insertItem( i18n("&Help"), helpMenu ); |
2152 | mIncSearchWidget = new IncSearchWidget( tb ); | 2152 | mIncSearchWidget = new IncSearchWidget( tb ); |
2153 | // tb->insertWidget(-1, 0, mIncSearchWidget); | 2153 | // tb->insertWidget(-1, 0, mIncSearchWidget); |
2154 | #ifndef DESKTOP_VERSION | 2154 | #ifndef DESKTOP_VERSION |
2155 | } else { | 2155 | } else { |
2156 | //US setup toolbar | 2156 | //US setup toolbar |
2157 | QPEMenuBar *menuBarTB = new QPEMenuBar( tb ); | 2157 | QPEMenuBar *menuBarTB = new QPEMenuBar( tb ); |
2158 | QPopupMenu *popupBarTB = new QPopupMenu( this ); | 2158 | QPopupMenu *popupBarTB = new QPopupMenu( this ); |
2159 | menuBarTB->insertItem( SmallIcon( "z_menu" ) , popupBarTB); | 2159 | menuBarTB->insertItem( SmallIcon( "z_menu" ) , popupBarTB); |
2160 | tb->insertWidget(-1, 0, menuBarTB); | 2160 | tb->insertWidget(-1, 0, menuBarTB); |
2161 | mIncSearchWidget = new IncSearchWidget( tb ); | 2161 | mIncSearchWidget = new IncSearchWidget( tb ); |
2162 | tb->enableMoving(false); | 2162 | tb->enableMoving(false); |
2163 | popupBarTB->insertItem( i18n("&File"), fileMenu ); | 2163 | popupBarTB->insertItem( i18n("&File"), fileMenu ); |
2164 | popupBarTB->insertItem( i18n("&Edit"), editMenu ); | 2164 | popupBarTB->insertItem( i18n("&Edit"), editMenu ); |
2165 | popupBarTB->insertItem( i18n("&View"), viewMenu ); | 2165 | popupBarTB->insertItem( i18n("&View"), viewMenu ); |
2166 | popupBarTB->insertItem( i18n("&Settings"), settingsMenu ); | 2166 | popupBarTB->insertItem( i18n("&Settings"), settingsMenu ); |
2167 | popupBarTB->insertItem( i18n("Synchronize"), syncMenu ); | 2167 | popupBarTB->insertItem( i18n("Synchronize"), syncMenu ); |
2168 | mViewManager->getFilterAction()->plug ( popupBarTB); | 2168 | mViewManager->getFilterAction()->plug ( popupBarTB); |
2169 | //popupBarTB->insertItem( i18n("&Change selected"), changeMenu ); | 2169 | //popupBarTB->insertItem( i18n("&Change selected"), changeMenu ); |
2170 | popupBarTB->insertItem( i18n("&Help"), helpMenu ); | 2170 | popupBarTB->insertItem( i18n("&Help"), helpMenu ); |
2171 | if (QApplication::desktop()->width() > 320 ) { | 2171 | if (QApplication::desktop()->width() > 320 ) { |
2172 | // mViewManager->getFilterAction()->plug ( tb); | 2172 | // mViewManager->getFilterAction()->plug ( tb); |
2173 | } | 2173 | } |
2174 | } | 2174 | } |
2175 | #endif | 2175 | #endif |
2176 | mIncSearchWidget->setSize(); | 2176 | mIncSearchWidget->setSize(); |
2177 | // mActionQuit->plug ( mMainWindow->toolBar()); | 2177 | // mActionQuit->plug ( mMainWindow->toolBar()); |
2178 | 2178 | ||
2179 | 2179 | ||
2180 | 2180 | ||
2181 | //US Now connect the actions with the menue entries. | 2181 | //US Now connect the actions with the menue entries. |
2182 | #ifdef DESKTOP_VERSION | 2182 | #ifdef DESKTOP_VERSION |
2183 | mActionPrint->plug( fileMenu ); | 2183 | mActionPrint->plug( fileMenu ); |
2184 | mActionPrintDetails->plug( fileMenu ); | 2184 | mActionPrintDetails->plug( fileMenu ); |
2185 | fileMenu->insertSeparator(); | 2185 | fileMenu->insertSeparator(); |
2186 | #endif | 2186 | #endif |
2187 | mActionMail->plug( fileMenu ); | 2187 | mActionMail->plug( fileMenu ); |
2188 | fileMenu->insertSeparator(); | 2188 | fileMenu->insertSeparator(); |
2189 | 2189 | ||
2190 | mActionNewContact->plug( editMenu ); | 2190 | mActionNewContact->plug( editMenu ); |
2191 | mActionNewContact->plug( tb ); | 2191 | mActionNewContact->plug( tb ); |
2192 | 2192 | ||
2193 | mActionEditAddressee->plug( editMenu ); | 2193 | mActionEditAddressee->plug( editMenu ); |
2194 | editMenu->insertSeparator(); | 2194 | editMenu->insertSeparator(); |
2195 | // if ((KGlobal::getDesktopSize() > KGlobal::Small ) || | 2195 | // if ((KGlobal::getDesktopSize() > KGlobal::Small ) || |
2196 | // (!KABPrefs::instance()->mMultipleViewsAtOnce )) | 2196 | // (!KABPrefs::instance()->mMultipleViewsAtOnce )) |
2197 | mActionEditAddressee->plug( tb ); | 2197 | mActionEditAddressee->plug( tb ); |
2198 | 2198 | ||
2199 | // fileMenu->insertSeparator(); | 2199 | // fileMenu->insertSeparator(); |
2200 | mActionSave->plug( fileMenu ); | 2200 | mActionSave->plug( fileMenu ); |
2201 | fileMenu->insertItem( "&Import", ImportMenu ); | 2201 | fileMenu->insertItem( "&Import", ImportMenu ); |
2202 | fileMenu->insertItem( "&Export", ExportMenu ); | 2202 | fileMenu->insertItem( "&Export", ExportMenu ); |
2203 | editMenu->insertItem( i18n("&Change"), changeMenu ); | 2203 | editMenu->insertItem( i18n("&Change"), changeMenu ); |
2204 | editMenu->insertSeparator(); | 2204 | editMenu->insertSeparator(); |
2205 | #ifndef DESKTOP_VERSION | 2205 | #ifndef DESKTOP_VERSION |
2206 | if ( Ir::supported() ) fileMenu->insertItem( i18n("&Beam"), beamMenu ); | 2206 | if ( Ir::supported() ) fileMenu->insertItem( i18n("&Beam"), beamMenu ); |
2207 | #endif | 2207 | #endif |
2208 | #if 0 | 2208 | #if 0 |
2209 | // PENDING fix MailVCard | 2209 | // PENDING fix MailVCard |
2210 | fileMenu->insertSeparator(); | 2210 | fileMenu->insertSeparator(); |
2211 | mActionMailVCard->plug( fileMenu ); | 2211 | mActionMailVCard->plug( fileMenu ); |
2212 | #endif | 2212 | #endif |
2213 | #ifndef DESKTOP_VERSION | 2213 | #ifndef DESKTOP_VERSION |
2214 | if ( Ir::supported() ) mActionBR->plug( beamMenu ); | 2214 | if ( Ir::supported() ) mActionBR->plug( beamMenu ); |
2215 | if ( Ir::supported() ) mActionBeamVCard->plug( beamMenu ); | 2215 | if ( Ir::supported() ) mActionBeamVCard->plug( beamMenu ); |
2216 | if ( Ir::supported() ) mActionBeam->plug( beamMenu ); | 2216 | if ( Ir::supported() ) mActionBeam->plug( beamMenu ); |
2217 | #endif | 2217 | #endif |
2218 | fileMenu->insertSeparator(); | 2218 | fileMenu->insertSeparator(); |
2219 | mActionQuit->plug( fileMenu ); | 2219 | mActionQuit->plug( fileMenu ); |
2220 | #ifdef _OL_IMPORT_ | 2220 | #ifdef _OL_IMPORT_ |
2221 | mActionImportOL->plug( ImportMenu ); | 2221 | mActionImportOL->plug( ImportMenu ); |
2222 | #endif | 2222 | #endif |
2223 | // edit menu | 2223 | // edit menu |
2224 | mActionUndo->plug( editMenu ); | 2224 | mActionUndo->plug( editMenu ); |
2225 | mActionRedo->plug( editMenu ); | 2225 | mActionRedo->plug( editMenu ); |
2226 | editMenu->insertSeparator(); | 2226 | editMenu->insertSeparator(); |
2227 | mActionCut->plug( editMenu ); | 2227 | mActionCut->plug( editMenu ); |
2228 | mActionCopy->plug( editMenu ); | 2228 | mActionCopy->plug( editMenu ); |
2229 | mActionPaste->plug( editMenu ); | 2229 | mActionPaste->plug( editMenu ); |
2230 | mActionDelete->plug( editMenu ); | 2230 | mActionDelete->plug( editMenu ); |
2231 | editMenu->insertSeparator(); | 2231 | editMenu->insertSeparator(); |
2232 | mActionSelectAll->plug( editMenu ); | 2232 | mActionSelectAll->plug( editMenu ); |
2233 | 2233 | ||
2234 | mActionSetFormattedName->plug( changeMenu ); | 2234 | mActionSetFormattedName->plug( changeMenu ); |
2235 | mActionRemoveVoice->plug( changeMenu ); | 2235 | mActionRemoveVoice->plug( changeMenu ); |
2236 | // settingsmings menu | 2236 | // settingsmings menu |
2237 | //US special menuentry to configure the addressbook resources. On KDE | 2237 | //US special menuentry to configure the addressbook resources. On KDE |
2238 | // you do that through the control center !!! | 2238 | // you do that through the control center !!! |
2239 | // settingsMenu->insertSeparator(); | 2239 | // settingsMenu->insertSeparator(); |
2240 | 2240 | ||
2241 | mActionConfigKAddressbook->plug( settingsMenu, 0 ); | 2241 | mActionConfigKAddressbook->plug( settingsMenu, 0 ); |
2242 | mActionConfigResources->plug( settingsMenu,1 ); | 2242 | mActionConfigResources->plug( settingsMenu,1 ); |
2243 | settingsMenu->insertSeparator(2); | 2243 | settingsMenu->insertSeparator(2); |
2244 | 2244 | ||
2245 | if ( mIsPart ) { | 2245 | if ( mIsPart ) { |
2246 | //US not implemented yet | 2246 | //US not implemented yet |
2247 | //mActionConfigShortcuts->plug( settingsMenu ); | 2247 | //mActionConfigShortcuts->plug( settingsMenu ); |
2248 | //mActionConfigureToolbars->plug( settingsMenu ); | 2248 | //mActionConfigureToolbars->plug( settingsMenu ); |
2249 | 2249 | ||
2250 | } else { | 2250 | } else { |
2251 | //US not implemented yet | 2251 | //US not implemented yet |
2252 | //mActionKeyBindings->plug( settingsMenu ); | 2252 | //mActionKeyBindings->plug( settingsMenu ); |
2253 | } | 2253 | } |
2254 | 2254 | ||
2255 | mActionEditCategories->plug( settingsMenu ); | 2255 | mActionEditCategories->plug( settingsMenu ); |
2256 | mActionManageCategories->plug( settingsMenu ); | 2256 | mActionManageCategories->plug( settingsMenu ); |
2257 | mActionJumpBar->plug( viewMenu,0 ); | 2257 | mActionJumpBar->plug( viewMenu,0 ); |
2258 | mActionDetails->plug( viewMenu,0 ); | 2258 | mActionDetails->plug( viewMenu,0 ); |
2259 | //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) | 2259 | //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) |
2260 | mActionDetails->plug( tb ); | 2260 | mActionDetails->plug( tb ); |
2261 | settingsMenu->insertSeparator(); | 2261 | settingsMenu->insertSeparator(); |
2262 | #ifndef DESKTOP_VERSION | 2262 | #ifndef DESKTOP_VERSION |
2263 | if ( Ir::supported() ) mActionBR->plug(settingsMenu ); | 2263 | if ( Ir::supported() ) mActionBR->plug(settingsMenu ); |
2264 | settingsMenu->insertSeparator(); | 2264 | settingsMenu->insertSeparator(); |
2265 | #endif | 2265 | #endif |
2266 | 2266 | ||
2267 | mActionWhoAmI->plug( settingsMenu ); | 2267 | mActionWhoAmI->plug( settingsMenu ); |
2268 | //mActionEditCategories->plug( changeMenu ); | 2268 | //mActionEditCategories->plug( changeMenu ); |
2269 | mActionCategories->plug( changeMenu ); | 2269 | mActionCategories->plug( changeMenu ); |
2270 | //mActionManageCategories->plug( changeMenu ); | 2270 | //mActionManageCategories->plug( changeMenu ); |
2271 | 2271 | ||
2272 | //mActionCategories->plug( settingsMenu ); | 2272 | //mActionCategories->plug( settingsMenu ); |
2273 | 2273 | ||
2274 | 2274 | ||
2275 | mActionWN->plug( helpMenu ); | 2275 | mActionWN->plug( helpMenu ); |
2276 | mActionSyncHowto->plug( helpMenu ); | 2276 | mActionSyncHowto->plug( helpMenu ); |
2277 | mActionKdeSyncHowto->plug( helpMenu ); | 2277 | mActionKdeSyncHowto->plug( helpMenu ); |
2278 | mActionMultiSyncHowto->plug( helpMenu ); | 2278 | mActionMultiSyncHowto->plug( helpMenu ); |
2279 | mActionFaq->plug( helpMenu ); | 2279 | mActionFaq->plug( helpMenu ); |
2280 | mActionLicence->plug( helpMenu ); | 2280 | mActionLicence->plug( helpMenu ); |
2281 | mActionAboutKAddressbook->plug( helpMenu ); | 2281 | mActionAboutKAddressbook->plug( helpMenu ); |
2282 | 2282 | ||
2283 | if (KGlobal::getDesktopSize() > KGlobal::Small ) { | 2283 | if (KGlobal::getDesktopSize() > KGlobal::Small ) { |
2284 | 2284 | ||
2285 | mActionSave->plug( tb ); | 2285 | mActionSave->plug( tb ); |
2286 | mViewManager->getFilterAction()->plug ( tb); | 2286 | mViewManager->getFilterAction()->plug ( tb); |
2287 | //LR hide filteraction on started in 480x640 | 2287 | //LR hide filteraction on started in 480x640 |
2288 | if (QApplication::desktop()->width() == 480 ) { | 2288 | if (QApplication::desktop()->width() == 480 ) { |
2289 | mViewManager->getFilterAction()->setComboWidth( 0 ); | 2289 | mViewManager->getFilterAction()->setComboWidth( 0 ); |
2290 | } | 2290 | } |
2291 | mActionUndo->plug( tb ); | 2291 | mActionUndo->plug( tb ); |
2292 | mActionDelete->plug( tb ); | 2292 | mActionDelete->plug( tb ); |
2293 | mActionRedo->plug( tb ); | 2293 | mActionRedo->plug( tb ); |
2294 | } else { | 2294 | } else { |
2295 | mActionSave->plug( tb ); | 2295 | mActionSave->plug( tb ); |
2296 | tb->enableMoving(false); | 2296 | tb->enableMoving(false); |
2297 | } | 2297 | } |
2298 | //mActionQuit->plug ( tb ); | 2298 | //mActionQuit->plug ( tb ); |
2299 | //tb->insertWidget(-1, 0, mIncSearchWidget, 6); | 2299 | //tb->insertWidget(-1, 0, mIncSearchWidget, 6); |
2300 | 2300 | ||
2301 | //US link the searchwidget first to this. | 2301 | //US link the searchwidget first to this. |
2302 | // The real linkage to the toolbar happens later. | 2302 | // The real linkage to the toolbar happens later. |
2303 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); | 2303 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); |
2304 | //US tb->insertItem( mIncSearchWidget ); | 2304 | //US tb->insertItem( mIncSearchWidget ); |
2305 | /*US | 2305 | /*US |
2306 | mIncSearchWidget = new IncSearchWidget( tb ); | 2306 | mIncSearchWidget = new IncSearchWidget( tb ); |
2307 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 2307 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
2308 | SLOT( incrementalSearch( const QString& ) ) ); | 2308 | SLOT( incrementalSearch( const QString& ) ) ); |
2309 | 2309 | ||
2310 | mJumpButtonBar = new JumpButtonBar( this, this ); | 2310 | mJumpButtonBar = new JumpButtonBar( this, this ); |
2311 | 2311 | ||
2312 | //US topLayout->addWidget( mJumpButtonBar ); | 2312 | //US topLayout->addWidget( mJumpButtonBar ); |
2313 | this->layout()->add( mJumpButtonBar ); | 2313 | this->layout()->add( mJumpButtonBar ); |
2314 | */ | 2314 | */ |
2315 | 2315 | ||
2316 | #endif //KAB_EMBEDDED | 2316 | #endif //KAB_EMBEDDED |
2317 | 2317 | ||
2318 | mActionExport2phone->plug( ExportMenu ); | 2318 | mActionExport2phone->plug( ExportMenu ); |
2319 | connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); | 2319 | connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); |
2320 | syncManager->fillSyncMenu(); | 2320 | syncManager->fillSyncMenu(); |
2321 | 2321 | ||
2322 | } | 2322 | } |
2323 | void KABCore::showLicence() | 2323 | void KABCore::showLicence() |
2324 | { | 2324 | { |
2325 | KApplication::showLicence(); | 2325 | KApplication::showLicence(); |
2326 | } | 2326 | } |
2327 | 2327 | ||
2328 | void KABCore::manageCategories( ) | 2328 | void KABCore::manageCategories( ) |
2329 | { | 2329 | { |
2330 | KABCatPrefs* cp = new KABCatPrefs(); | 2330 | KABCatPrefs* cp = new KABCatPrefs(); |
2331 | cp->show(); | 2331 | cp->show(); |
2332 | int w =cp->sizeHint().width() ; | 2332 | int w =cp->sizeHint().width() ; |
2333 | int h = cp->sizeHint().height() ; | 2333 | int h = cp->sizeHint().height() ; |
2334 | int dw = QApplication::desktop()->width(); | 2334 | int dw = QApplication::desktop()->width(); |
2335 | int dh = QApplication::desktop()->height(); | 2335 | int dh = QApplication::desktop()->height(); |
2336 | cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 2336 | cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
2337 | if ( !cp->exec() ) { | 2337 | if ( !cp->exec() ) { |
2338 | delete cp; | 2338 | delete cp; |
2339 | return; | 2339 | return; |
2340 | } | 2340 | } |
2341 | int count = 0; | 2341 | int count = 0; |
2342 | int cc = 0; | 2342 | int cc = 0; |
2343 | message( i18n("Please wait, processing categories...")); | 2343 | message( i18n("Please wait, processing categories...")); |
2344 | if ( cp->addCat() ) { | 2344 | if ( cp->addCat() ) { |
2345 | KABC::AddressBook::Iterator it; | 2345 | KABC::AddressBook::Iterator it; |
2346 | QStringList catList = KABPrefs::instance()->mCustomCategories; | 2346 | QStringList catList = KABPrefs::instance()->mCustomCategories; |
2347 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 2347 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
2348 | ++cc; | 2348 | ++cc; |
2349 | if ( cc %10 == 0) | 2349 | if ( cc %10 == 0) |
2350 | message(i18n("Processing contact #%1").arg(cc)); | 2350 | message(i18n("Processing contact #%1").arg(cc)); |
2351 | QStringList catIncList = (*it).categories(); | 2351 | QStringList catIncList = (*it).categories(); |
2352 | int i; | 2352 | int i; |
2353 | for( i = 0; i< catIncList.count(); ++i ) { | 2353 | for( i = 0; i< catIncList.count(); ++i ) { |
2354 | if ( !catList.contains (catIncList[i])) { | 2354 | if ( !catList.contains (catIncList[i])) { |
2355 | catList.append( catIncList[i] ); | 2355 | catList.append( catIncList[i] ); |
2356 | //qDebug("add cat %s ", catIncList[i].latin1()); | 2356 | //qDebug("add cat %s ", catIncList[i].latin1()); |
2357 | ++count; | 2357 | ++count; |
2358 | } | 2358 | } |
2359 | } | 2359 | } |
2360 | } | 2360 | } |
2361 | catList.sort(); | 2361 | catList.sort(); |
2362 | KABPrefs::instance()->mCustomCategories = catList; | 2362 | KABPrefs::instance()->mCustomCategories = catList; |
2363 | KABPrefs::instance()->writeConfig(); | 2363 | KABPrefs::instance()->writeConfig(); |
2364 | message(QString::number( count )+ i18n(" categories added to list! ")); | 2364 | message(QString::number( count )+ i18n(" categories added to list! ")); |
2365 | } else { | 2365 | } else { |
2366 | QStringList catList = KABPrefs::instance()->mCustomCategories; | 2366 | QStringList catList = KABPrefs::instance()->mCustomCategories; |
2367 | QStringList catIncList; | 2367 | QStringList catIncList; |
2368 | QStringList newCatList; | 2368 | QStringList newCatList; |
2369 | KABC::AddressBook::Iterator it; | 2369 | KABC::AddressBook::Iterator it; |
2370 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 2370 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
2371 | ++cc; | 2371 | ++cc; |
2372 | if ( cc %10 == 0) | 2372 | if ( cc %10 == 0) |
2373 | message(i18n("Processing contact #%1").arg(cc)); | 2373 | message(i18n("Processing contact #%1").arg(cc)); |
2374 | QStringList catIncList = (*it).categories(); | 2374 | QStringList catIncList = (*it).categories(); |
2375 | int i; | 2375 | int i; |
2376 | if ( catIncList.count() ) { | 2376 | if ( catIncList.count() ) { |
2377 | newCatList.clear(); | 2377 | newCatList.clear(); |
2378 | for( i = 0; i< catIncList.count(); ++i ) { | 2378 | for( i = 0; i< catIncList.count(); ++i ) { |
2379 | if ( catList.contains (catIncList[i])) { | 2379 | if ( catList.contains (catIncList[i])) { |
2380 | newCatList.append( catIncList[i] ); | 2380 | newCatList.append( catIncList[i] ); |
2381 | } | 2381 | } |
2382 | } | 2382 | } |
2383 | newCatList.sort(); | 2383 | newCatList.sort(); |
2384 | (*it).setCategories( newCatList ); | 2384 | (*it).setCategories( newCatList ); |
2385 | mAddressBook->insertAddressee( (*it) ); | 2385 | mAddressBook->insertAddressee( (*it) ); |
2386 | } | 2386 | } |
2387 | } | 2387 | } |
2388 | setModified( true ); | 2388 | setModified( true ); |
2389 | mViewManager->refreshView(); | 2389 | mViewManager->refreshView(); |
2390 | message( i18n("Removing categories done!")); | 2390 | message( i18n("Removing categories done!")); |
2391 | } | 2391 | } |
2392 | delete cp; | 2392 | delete cp; |
2393 | } | 2393 | } |
2394 | void KABCore::removeVoice() | 2394 | void KABCore::removeVoice() |
2395 | { | 2395 | { |
2396 | if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No ) | 2396 | if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No ) |
2397 | return; | 2397 | return; |
2398 | XXPortSelectDialog dlg( this, false, this ); | 2398 | XXPortSelectDialog dlg( this, false, this ); |
2399 | if ( !dlg.exec() ) | 2399 | if ( !dlg.exec() ) |
2400 | return; | 2400 | return; |
2401 | mAddressBook->setUntagged(); | 2401 | mAddressBook->setUntagged(); |
2402 | dlg.tagSelected(); | 2402 | dlg.tagSelected(); |
2403 | message(i18n("Removing voice..."), false ); | 2403 | message(i18n("Removing voice..."), false ); |
2404 | KABC::AddressBook::Iterator it; | 2404 | KABC::AddressBook::Iterator it; |
2405 | for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 2405 | for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
2406 | if ( (*it).tagged() ) { | 2406 | if ( (*it).tagged() ) { |
2407 | (*it).removeVoice(); | 2407 | (*it).removeVoice(); |
2408 | } | 2408 | } |
2409 | } | 2409 | } |
2410 | message(i18n("Refreshing view...") ); | 2410 | message(i18n("Refreshing view...") ); |
2411 | qApp->processEvents(); | 2411 | qApp->processEvents(); |
2412 | mViewManager->refreshView( "" ); | 2412 | mViewManager->refreshView( "" ); |
2413 | Addressee add; | 2413 | Addressee add; |
2414 | mDetails->setAddressee( add ); | 2414 | mDetails->setAddressee( add ); |
2415 | message(i18n("Remove voice completed!") ); | 2415 | message(i18n("Remove voice completed!") ); |
2416 | 2416 | ||
2417 | 2417 | ||
2418 | 2418 | ||
2419 | } | 2419 | } |
2420 | 2420 | ||
2421 | void KABCore::setFormattedName() | 2421 | void KABCore::setFormattedName() |
2422 | { | 2422 | { |
2423 | KABFormatPrefs setpref; | 2423 | KABFormatPrefs setpref; |
2424 | if ( !setpref.exec() ) { | 2424 | if ( !setpref.exec() ) { |
2425 | return; | 2425 | return; |
2426 | } | 2426 | } |
2427 | XXPortSelectDialog dlg( this, false, this ); | 2427 | XXPortSelectDialog dlg( this, false, this ); |
2428 | if ( !dlg.exec() ) | 2428 | if ( !dlg.exec() ) |
2429 | return; | 2429 | return; |
2430 | mAddressBook->setUntagged(); | 2430 | mAddressBook->setUntagged(); |
2431 | dlg.tagSelected(); | 2431 | dlg.tagSelected(); |
2432 | int count = 0; | 2432 | int count = 0; |
2433 | KABC::AddressBook::Iterator it; | 2433 | KABC::AddressBook::Iterator it; |
2434 | for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 2434 | for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
2435 | if ( (*it).tagged() ) { | 2435 | if ( (*it).tagged() ) { |
2436 | ++count; | 2436 | ++count; |
2437 | if ( count %10 == 0 ) | 2437 | if ( count %10 == 0 ) |
2438 | message(i18n("Changing contact #%1").arg( count ) ); | 2438 | message(i18n("Changing contact #%1").arg( count ) ); |
2439 | qApp->processEvents(); | 2439 | qApp->processEvents(); |
2440 | QString fName; | 2440 | QString fName; |
2441 | if ( setpref.simple->isChecked() ) | 2441 | if ( setpref.simple->isChecked() ) |
2442 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::SimpleName ); | 2442 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::SimpleName ); |
2443 | else if ( setpref.full->isChecked() ) | 2443 | else if ( setpref.full->isChecked() ) |
2444 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::FullName ); | 2444 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::FullName ); |
2445 | else if ( setpref.reverse->isChecked() ) | 2445 | else if ( setpref.reverse->isChecked() ) |
2446 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::ReverseName ); | 2446 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::ReverseName ); |
2447 | else | 2447 | else |
2448 | fName = (*it).organization(); | 2448 | fName = (*it).organization(); |
2449 | if ( setpref.setCompany->isChecked() ) | 2449 | if ( setpref.setCompany->isChecked() ) |
2450 | if ( fName.isEmpty() || fName =="," ) | 2450 | if ( fName.isEmpty() || fName =="," ) |
2451 | fName = (*it).organization(); | 2451 | fName = (*it).organization(); |
2452 | (*it).setFormattedName( fName ); | 2452 | (*it).setFormattedName( fName ); |
2453 | } | 2453 | } |
2454 | } | 2454 | } |
2455 | message(i18n("Refreshing view...") ); | 2455 | message(i18n("Refreshing view...") ); |
2456 | qApp->processEvents(); | 2456 | qApp->processEvents(); |
2457 | mViewManager->refreshView( "" ); | 2457 | mViewManager->refreshView( "" ); |
2458 | Addressee add; | 2458 | Addressee add; |
2459 | mDetails->setAddressee( add ); | 2459 | mDetails->setAddressee( add ); |
2460 | message(i18n("Setting formatted name completed!") ); | 2460 | message(i18n("Setting formatted name completed!") ); |
2461 | } | 2461 | } |
2462 | 2462 | ||
2463 | void KABCore::clipboardDataChanged() | 2463 | void KABCore::clipboardDataChanged() |
2464 | { | 2464 | { |
2465 | 2465 | ||
2466 | if ( mReadWrite ) | 2466 | if ( mReadWrite ) |
2467 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); | 2467 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); |
2468 | 2468 | ||
2469 | } | 2469 | } |
2470 | 2470 | ||
2471 | void KABCore::updateActionMenu() | 2471 | void KABCore::updateActionMenu() |
2472 | { | 2472 | { |
2473 | UndoStack *undo = UndoStack::instance(); | 2473 | UndoStack *undo = UndoStack::instance(); |
2474 | RedoStack *redo = RedoStack::instance(); | 2474 | RedoStack *redo = RedoStack::instance(); |
2475 | 2475 | ||
2476 | if ( undo->isEmpty() ) | 2476 | if ( undo->isEmpty() ) |
2477 | mActionUndo->setText( i18n( "Undo" ) ); | 2477 | mActionUndo->setText( i18n( "Undo" ) ); |
2478 | else | 2478 | else |
2479 | mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); | 2479 | mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); |
2480 | 2480 | ||
2481 | mActionUndo->setEnabled( !undo->isEmpty() ); | 2481 | mActionUndo->setEnabled( !undo->isEmpty() ); |
2482 | 2482 | ||
2483 | if ( !redo->top() ) | 2483 | if ( !redo->top() ) |
2484 | mActionRedo->setText( i18n( "Redo" ) ); | 2484 | mActionRedo->setText( i18n( "Redo" ) ); |
2485 | else | 2485 | else |
2486 | mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); | 2486 | mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); |
2487 | 2487 | ||
2488 | mActionRedo->setEnabled( !redo->isEmpty() ); | 2488 | mActionRedo->setEnabled( !redo->isEmpty() ); |
2489 | } | 2489 | } |
2490 | 2490 | ||
2491 | void KABCore::configureKeyBindings() | 2491 | void KABCore::configureKeyBindings() |
2492 | { | 2492 | { |
2493 | #ifndef KAB_EMBEDDED | 2493 | #ifndef KAB_EMBEDDED |
2494 | KKeyDialog::configure( actionCollection(), true ); | 2494 | KKeyDialog::configure( actionCollection(), true ); |
2495 | #else //KAB_EMBEDDED | 2495 | #else //KAB_EMBEDDED |
2496 | qDebug("KABCore::configureKeyBindings() not implemented"); | 2496 | qDebug("KABCore::configureKeyBindings() not implemented"); |
2497 | #endif //KAB_EMBEDDED | 2497 | #endif //KAB_EMBEDDED |
2498 | } | 2498 | } |
2499 | 2499 | ||
2500 | #ifdef KAB_EMBEDDED | 2500 | #ifdef KAB_EMBEDDED |
2501 | void KABCore::configureResources() | 2501 | void KABCore::configureResources() |
2502 | { | 2502 | { |
2503 | KRES::KCMKResources dlg( this, "" , 0 ); | 2503 | KRES::KCMKResources dlg( this, "" , 0 ); |
2504 | 2504 | ||
2505 | if ( !dlg.exec() ) | 2505 | if ( !dlg.exec() ) |
2506 | return; | 2506 | return; |
2507 | KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); | 2507 | KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); |
2508 | } | 2508 | } |
2509 | #endif //KAB_EMBEDDED | 2509 | #endif //KAB_EMBEDDED |
2510 | 2510 | ||
2511 | 2511 | ||
2512 | /* this method will be called through the QCop interface from Ko/Pi to select addresses | 2512 | /* this method will be called through the QCop interface from Ko/Pi to select addresses |
2513 | * for the attendees list of an event. | 2513 | * for the attendees list of an event. |
2514 | */ | 2514 | */ |
2515 | void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) | 2515 | void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) |
2516 | { | 2516 | { |
2517 | 2517 | ||
2518 | bool ok = false; | 2518 | bool ok = false; |
2519 | mEmailSourceChannel = sourceChannel; | 2519 | mEmailSourceChannel = sourceChannel; |
2520 | mEmailSourceUID = uid; | ||
2521 | callContactdialog(); | ||
2522 | #if 0 | ||
2520 | int wid = uid.toInt( &ok ); | 2523 | int wid = uid.toInt( &ok ); |
2521 | qDebug("UID %s ", uid.latin1()); | 2524 | qDebug("UID %s ", uid.latin1()); |
2522 | if ( ok ) { | 2525 | if ( ok ) { |
2523 | if ( wid != QApplication::desktop()->width() ) { | 2526 | if ( wid != QApplication::desktop()->width() ) { |
2524 | qDebug("KA/Pi: Request from different desktop geometry. Resizing ..."); | 2527 | qDebug("KA/Pi: Request from different desktop geometry. Resizing ..."); |
2525 | message( i18n("Resizing, please wait...") ); | 2528 | message( i18n("Resizing, please wait...") ); |
2526 | mMainWindow->showMinimized(); | 2529 | mMainWindow->showMinimized(); |
2527 | /* | 2530 | /* |
2528 | { | 2531 | { |
2529 | QCopEnvelope e("QPE/Application/kapi", "callContactdialog()"); | 2532 | QCopEnvelope e("QPE/Application/kapi", "callContactdialog()"); |
2530 | } | 2533 | } |
2531 | */ | 2534 | */ |
2532 | QTimer::singleShot( 1,this, SLOT ( resizeAndCallContactdialog() ) ); | 2535 | QTimer::singleShot( 1,this, SLOT ( resizeAndCallContactdialog() ) ); |
2533 | return; | 2536 | return; |
2534 | } | 2537 | } |
2535 | 2538 | ||
2536 | } else { | 2539 | } else { |
2537 | qDebug("KABCore::requestForNameEmailUidList:: Got invalid uid "); | 2540 | qDebug("KABCore::requestForNameEmailUidList:: Got invalid uid "); |
2538 | } | 2541 | } |
2539 | callContactdialog(); | 2542 | callContactdialog(); |
2540 | //QCopEnvelope e("QPE/Application/kapi", "callContactdialog()"); | 2543 | //QCopEnvelope e("QPE/Application/kapi", "callContactdialog()"); |
2541 | 2544 | #endif | |
2542 | } | 2545 | } |
2543 | void KABCore::resizeAndCallContactdialog() | 2546 | void KABCore::resizeAndCallContactdialog() |
2544 | { | 2547 | { |
2545 | updateMainWindow(); | 2548 | updateMainWindow(); |
2546 | QTimer::singleShot( 100,this, SLOT ( callContactdialog() ) ); | 2549 | QTimer::singleShot( 100,this, SLOT ( callContactdialog() ) ); |
2547 | } | 2550 | } |
2548 | 2551 | ||
2549 | void KABCore::callContactdialog() | 2552 | void KABCore::callContactdialog() |
2550 | { | 2553 | { |
2551 | QStringList nameList; | 2554 | QStringList nameList; |
2552 | QStringList emailList; | 2555 | QStringList emailList; |
2553 | QStringList uidList; | 2556 | QStringList uidList; |
2554 | qDebug("WIDTH %d ", QApplication::desktop()->width() ); | 2557 | qDebug(" KABCore::callContactdialog:DESKTOP WIDTH %d ", QApplication::desktop()->width() ); |
2555 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); | 2558 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); |
2556 | uint i=0; | 2559 | uint i=0; |
2557 | for (i=0; i < list.count(); i++) | 2560 | for (i=0; i < list.count(); i++) |
2558 | { | 2561 | { |
2559 | nameList.append(list[i].realName()); | 2562 | nameList.append(list[i].realName()); |
2560 | emailList.append(list[i].preferredEmail()); | 2563 | emailList.append(list[i].preferredEmail()); |
2561 | uidList.append(list[i].uid()); | 2564 | uidList.append(list[i].uid()); |
2562 | } | 2565 | } |
2563 | QString uid = "unnamed"; | 2566 | QString uid = mEmailSourceUID; |
2564 | //qDebug("%s %s ", sourceChannel.latin1(), uid.latin1()); | 2567 | //qDebug("%s %s ", sourceChannel.latin1(), uid.latin1()); |
2565 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(mEmailSourceChannel, uid, nameList, emailList, uidList); | 2568 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(mEmailSourceChannel, uid, nameList, emailList, uidList); |
2566 | 2569 | ||
2567 | } | 2570 | } |
2568 | /* this method will be called through the QCop interface from Ko/Pi to select birthdays | 2571 | /* this method will be called through the QCop interface from Ko/Pi to select birthdays |
2569 | * to put them into the calendar. | 2572 | * to put them into the calendar. |
2570 | */ | 2573 | */ |
2571 | void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid) | 2574 | void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid) |
2572 | { | 2575 | { |
2573 | // qDebug("KABCore::requestForBirthdayList"); | 2576 | // qDebug("KABCore::requestForBirthdayList"); |
2574 | QStringList birthdayList; | 2577 | QStringList birthdayList; |
2575 | QStringList anniversaryList; | 2578 | QStringList anniversaryList; |
2576 | QStringList realNameList; | 2579 | QStringList realNameList; |
2577 | QStringList preferredEmailList; | 2580 | QStringList preferredEmailList; |
2578 | QStringList assembledNameList; | 2581 | QStringList assembledNameList; |
2579 | QStringList uidList; | 2582 | QStringList uidList; |
2580 | 2583 | ||
2581 | KABC::AddressBook::Iterator it; | 2584 | KABC::AddressBook::Iterator it; |
2582 | 2585 | ||
2583 | int count = 0; | 2586 | int count = 0; |
2584 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 2587 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
2585 | ++count; | 2588 | ++count; |
2586 | } | 2589 | } |
2587 | QProgressBar bar(count,0 ); | 2590 | QProgressBar bar(count,0 ); |
2588 | int w = 300; | 2591 | int w = 300; |
2589 | if ( QApplication::desktop()->width() < 320 ) | 2592 | if ( QApplication::desktop()->width() < 320 ) |
2590 | w = 220; | 2593 | w = 220; |
2591 | int h = bar.sizeHint().height() ; | 2594 | int h = bar.sizeHint().height() ; |
2592 | int dw = QApplication::desktop()->width(); | 2595 | int dw = QApplication::desktop()->width(); |
2593 | int dh = QApplication::desktop()->height(); | 2596 | int dh = QApplication::desktop()->height(); |
2594 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 2597 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
2595 | bar.show(); | 2598 | bar.show(); |
2596 | bar.setCaption (i18n("Collecting birthdays - close to abort!") ); | 2599 | bar.setCaption (i18n("Collecting birthdays - close to abort!") ); |
2597 | qApp->processEvents(); | 2600 | qApp->processEvents(); |
2598 | 2601 | ||
2599 | QDate bday; | 2602 | QDate bday; |
2600 | QString anni; | 2603 | QString anni; |
2601 | QString formattedbday; | 2604 | QString formattedbday; |
2602 | 2605 | ||
2603 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) | 2606 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) |
2604 | { | 2607 | { |
2605 | if ( ! bar.isVisible() ) | 2608 | if ( ! bar.isVisible() ) |
2606 | return; | 2609 | return; |
2607 | bar.setProgress( count++ ); | 2610 | bar.setProgress( count++ ); |
2608 | qApp->processEvents(); | 2611 | qApp->processEvents(); |
2609 | bday = (*it).birthday().date(); | 2612 | bday = (*it).birthday().date(); |
2610 | anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" ); | 2613 | anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" ); |
2611 | 2614 | ||
2612 | if ( bday.isValid() || !anni.isEmpty()) | 2615 | if ( bday.isValid() || !anni.isEmpty()) |
2613 | { | 2616 | { |
2614 | if (bday.isValid()) | 2617 | if (bday.isValid()) |
2615 | formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate); | 2618 | formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate); |
2616 | else | 2619 | else |
2617 | formattedbday = "NOTVALID"; | 2620 | formattedbday = "NOTVALID"; |
2618 | if (anni.isEmpty()) | 2621 | if (anni.isEmpty()) |
2619 | anni = "INVALID"; | 2622 | anni = "INVALID"; |
2620 | 2623 | ||
2621 | birthdayList.append(formattedbday); | 2624 | birthdayList.append(formattedbday); |
2622 | anniversaryList.append(anni); //should be ISODate | 2625 | anniversaryList.append(anni); //should be ISODate |
2623 | realNameList.append((*it).realName()); | 2626 | realNameList.append((*it).realName()); |
2624 | preferredEmailList.append((*it).preferredEmail()); | 2627 | preferredEmailList.append((*it).preferredEmail()); |
2625 | assembledNameList.append((*it).assembledName()); | 2628 | assembledNameList.append((*it).assembledName()); |
2626 | uidList.append((*it).uid()); | 2629 | uidList.append((*it).uid()); |
2627 | 2630 | ||
2628 | //qDebug("found birthday in KA/Pi: %s,%s,%s,%s: %s, %s", (*it).realName().latin1(), (*it).preferredEmail().latin1(), (*it).assembledName().latin1(), (*it).uid().latin1(), formattedbday.latin1(), anni.latin1() ); | 2631 | //qDebug("found birthday in KA/Pi: %s,%s,%s,%s: %s, %s", (*it).realName().latin1(), (*it).preferredEmail().latin1(), (*it).assembledName().latin1(), (*it).uid().latin1(), formattedbday.latin1(), anni.latin1() ); |
2629 | } | 2632 | } |
2630 | } | 2633 | } |
2631 | 2634 | ||
2632 | bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList); | 2635 | bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList); |
2633 | 2636 | ||
2634 | } | 2637 | } |
2635 | 2638 | ||
2636 | /* this method will be called through the QCop interface from other apps to show details of a contact. | 2639 | /* this method will be called through the QCop interface from other apps to show details of a contact. |
2637 | */ | 2640 | */ |
2638 | void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) | 2641 | void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) |
2639 | { | 2642 | { |
2640 | //qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); | 2643 | //qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); |
2641 | 2644 | ||
2642 | QString foundUid = QString::null; | 2645 | QString foundUid = QString::null; |
2643 | if ( ! uid.isEmpty() ) { | 2646 | if ( ! uid.isEmpty() ) { |
2644 | Addressee adrr = mAddressBook->findByUid( uid ); | 2647 | Addressee adrr = mAddressBook->findByUid( uid ); |
2645 | if ( !adrr.isEmpty() ) { | 2648 | if ( !adrr.isEmpty() ) { |
2646 | foundUid = uid; | 2649 | foundUid = uid; |
2647 | } | 2650 | } |
2648 | if ( email == "sendbacklist" ) { | 2651 | if ( email == "sendbacklist" ) { |
2649 | //qDebug("ssssssssssssssssssssssend "); | 2652 | //qDebug("ssssssssssssssssssssssend "); |
2650 | QStringList nameList; | 2653 | QStringList nameList; |
2651 | QStringList emailList; | 2654 | QStringList emailList; |
2652 | QStringList uidList; | 2655 | QStringList uidList; |
2653 | nameList.append(adrr.realName()); | 2656 | nameList.append(adrr.realName()); |
2654 | emailList = adrr.emails(); | 2657 | emailList = adrr.emails(); |
2655 | uidList.append( adrr.preferredEmail()); | 2658 | uidList.append( adrr.preferredEmail()); |
2656 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); | 2659 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); |
2657 | return; | 2660 | return; |
2658 | } | 2661 | } |
2659 | 2662 | ||
2660 | } | 2663 | } |
2661 | 2664 | ||
2662 | if ( email == "sendbacklist" ) | 2665 | if ( email == "sendbacklist" ) |
2663 | return; | 2666 | return; |
2664 | if (foundUid.isEmpty()) | 2667 | if (foundUid.isEmpty()) |
2665 | { | 2668 | { |
2666 | //find the uid of the person first | 2669 | //find the uid of the person first |
2667 | Addressee::List namelist; | 2670 | Addressee::List namelist; |
2668 | Addressee::List emaillist; | 2671 | Addressee::List emaillist; |
2669 | 2672 | ||
2670 | if (!name.isEmpty()) | 2673 | if (!name.isEmpty()) |
2671 | namelist = mAddressBook->findByName( name ); | 2674 | namelist = mAddressBook->findByName( name ); |
2672 | 2675 | ||
2673 | if (!email.isEmpty()) | 2676 | if (!email.isEmpty()) |
2674 | emaillist = mAddressBook->findByEmail( email ); | 2677 | emaillist = mAddressBook->findByEmail( email ); |
2675 | //qDebug("count %d %d ", namelist.count(),emaillist.count() ); | 2678 | //qDebug("count %d %d ", namelist.count(),emaillist.count() ); |
2676 | //check if we have a match in Namelist and Emaillist | 2679 | //check if we have a match in Namelist and Emaillist |
2677 | if ((namelist.count() == 0) && (emaillist.count() > 0)) { | 2680 | if ((namelist.count() == 0) && (emaillist.count() > 0)) { |
2678 | foundUid = emaillist[0].uid(); | 2681 | foundUid = emaillist[0].uid(); |
2679 | } | 2682 | } |
2680 | else if ((namelist.count() > 0) && (emaillist.count() == 0)) | 2683 | else if ((namelist.count() > 0) && (emaillist.count() == 0)) |
2681 | foundUid = namelist[0].uid(); | 2684 | foundUid = namelist[0].uid(); |
2682 | else | 2685 | else |
2683 | { | 2686 | { |
2684 | for (int i = 0; i < namelist.count(); i++) | 2687 | for (int i = 0; i < namelist.count(); i++) |
2685 | { | 2688 | { |
2686 | for (int j = 0; j < emaillist.count(); j++) | 2689 | for (int j = 0; j < emaillist.count(); j++) |
2687 | { | 2690 | { |
2688 | if (namelist[i] == emaillist[j]) | 2691 | if (namelist[i] == emaillist[j]) |
2689 | { | 2692 | { |
2690 | foundUid = namelist[i].uid(); | 2693 | foundUid = namelist[i].uid(); |
2691 | } | 2694 | } |
2692 | } | 2695 | } |
2693 | } | 2696 | } |
2694 | } | 2697 | } |
2695 | } | 2698 | } |
2696 | else | 2699 | else |
2697 | { | 2700 | { |
2698 | foundUid = uid; | 2701 | foundUid = uid; |
2699 | } | 2702 | } |
2700 | 2703 | ||
2701 | if (!foundUid.isEmpty()) | 2704 | if (!foundUid.isEmpty()) |
2702 | { | 2705 | { |
2703 | 2706 | ||
2704 | // raise Ka/Pi if it is in the background | 2707 | // raise Ka/Pi if it is in the background |
2705 | #ifndef DESKTOP_VERSION | 2708 | #ifndef DESKTOP_VERSION |
2706 | #ifndef KORG_NODCOP | 2709 | #ifndef KORG_NODCOP |
2707 | //QCopEnvelope e("QPE/Application/kapi", "raise()"); | 2710 | //QCopEnvelope e("QPE/Application/kapi", "raise()"); |
2708 | #endif | 2711 | #endif |
2709 | #endif | 2712 | #endif |
2710 | 2713 | ||
2711 | mMainWindow->showMaximized(); | 2714 | mMainWindow->showMaximized(); |
2712 | mMainWindow-> raise(); | 2715 | mMainWindow-> raise(); |
2713 | 2716 | ||
2714 | mViewManager->setSelected( "", false); | 2717 | mViewManager->setSelected( "", false); |
2715 | mViewManager->refreshView( "" ); | 2718 | mViewManager->refreshView( "" ); |
2716 | mViewManager->setSelected( foundUid, true ); | 2719 | mViewManager->setSelected( foundUid, true ); |
2717 | mViewManager->refreshView( foundUid ); | 2720 | mViewManager->refreshView( foundUid ); |
2718 | 2721 | ||
2719 | if ( !mMultipleViewsAtOnce ) | 2722 | if ( !mMultipleViewsAtOnce ) |
2720 | { | 2723 | { |
2721 | setDetailsVisible( true ); | 2724 | setDetailsVisible( true ); |
2722 | mActionDetails->setChecked(true); | 2725 | mActionDetails->setChecked(true); |
2723 | } | 2726 | } |
2724 | } | 2727 | } |
2725 | } | 2728 | } |
2726 | 2729 | ||
2727 | void KABCore::whatsnew() | 2730 | void KABCore::whatsnew() |
2728 | { | 2731 | { |
2729 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); | 2732 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); |
2730 | } | 2733 | } |
2731 | void KABCore::synchowto() | 2734 | void KABCore::synchowto() |
2732 | { | 2735 | { |
2733 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); | 2736 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); |
2734 | } | 2737 | } |
2735 | void KABCore::kdesynchowto() | 2738 | void KABCore::kdesynchowto() |
2736 | { | 2739 | { |
2737 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); | 2740 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); |
2738 | } | 2741 | } |
2739 | void KABCore::multisynchowto() | 2742 | void KABCore::multisynchowto() |
2740 | { | 2743 | { |
2741 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); | 2744 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); |
2742 | } | 2745 | } |
2743 | void KABCore::faq() | 2746 | void KABCore::faq() |
2744 | { | 2747 | { |
2745 | KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" ); | 2748 | KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" ); |
2746 | } | 2749 | } |
2747 | 2750 | ||
2748 | #include <libkcal/syncdefines.h> | 2751 | #include <libkcal/syncdefines.h> |
2749 | 2752 | ||
2750 | KABC::Addressee KABCore::getLastSyncAddressee() | 2753 | KABC::Addressee KABCore::getLastSyncAddressee() |
2751 | { | 2754 | { |
2752 | Addressee lse; | 2755 | Addressee lse; |
2753 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); | 2756 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); |
2754 | 2757 | ||
2755 | //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); | 2758 | //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); |
2756 | lse = mAddressBook->findByUid( "last-syncAddressee-"+mCurrentSyncDevice ); | 2759 | lse = mAddressBook->findByUid( "last-syncAddressee-"+mCurrentSyncDevice ); |
2757 | if (lse.isEmpty()) { | 2760 | if (lse.isEmpty()) { |
2758 | qDebug("KA: Creating new last-syncAddressee "); | 2761 | qDebug("KA: Creating new last-syncAddressee "); |
2759 | lse.setUid( "last-syncAddressee-"+mCurrentSyncDevice ); | 2762 | lse.setUid( "last-syncAddressee-"+mCurrentSyncDevice ); |
2760 | QString sum = ""; | 2763 | QString sum = ""; |
2761 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) | 2764 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) |
2762 | sum = "E: "; | 2765 | sum = "E: "; |
2763 | lse.setFamilyName("!"+sum+mCurrentSyncDevice + i18n(" - sync event")); | 2766 | lse.setFamilyName("!"+sum+mCurrentSyncDevice + i18n(" - sync event")); |
2764 | lse.setRevision( mLastAddressbookSync ); | 2767 | lse.setRevision( mLastAddressbookSync ); |
2765 | lse.setCategories( i18n("SyncEvent") ); | 2768 | lse.setCategories( i18n("SyncEvent") ); |
2766 | mAddressBook->insertAddressee( lse ); | 2769 | mAddressBook->insertAddressee( lse ); |
2767 | } | 2770 | } |
2768 | return lse; | 2771 | return lse; |
2769 | } | 2772 | } |
2770 | int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ) | 2773 | int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ) |
2771 | { | 2774 | { |
2772 | 2775 | ||
2773 | //void setZaurusId(int id); | 2776 | //void setZaurusId(int id); |
2774 | // int zaurusId() const; | 2777 | // int zaurusId() const; |
2775 | // void setZaurusUid(int id); | 2778 | // void setZaurusUid(int id); |
2776 | // int zaurusUid() const; | 2779 | // int zaurusUid() const; |
2777 | // void setZaurusStat(int id); | 2780 | // void setZaurusStat(int id); |
2778 | // int zaurusStat() const; | 2781 | // int zaurusStat() const; |
2779 | // 0 equal | 2782 | // 0 equal |
2780 | // 1 take local | 2783 | // 1 take local |
2781 | // 2 take remote | 2784 | // 2 take remote |
2782 | // 3 cancel | 2785 | // 3 cancel |
2783 | QDateTime lastSync = mLastAddressbookSync; | 2786 | QDateTime lastSync = mLastAddressbookSync; |
2784 | QDateTime localMod = local->revision(); | 2787 | QDateTime localMod = local->revision(); |
2785 | QDateTime remoteMod = remote->revision(); | 2788 | QDateTime remoteMod = remote->revision(); |
2786 | 2789 | ||
2787 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); | 2790 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); |
2788 | 2791 | ||
2789 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2792 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2790 | bool remCh, locCh; | 2793 | bool remCh, locCh; |
2791 | remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); | 2794 | remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); |
2792 | //if ( remCh ) | 2795 | //if ( remCh ) |
2793 | // qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); | 2796 | // qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); |
2794 | locCh = ( localMod > mLastAddressbookSync ); | 2797 | locCh = ( localMod > mLastAddressbookSync ); |
2795 | //qDebug("cahnged rem %d loc %d",remCh, locCh ); | 2798 | //qDebug("cahnged rem %d loc %d",remCh, locCh ); |
2796 | if ( !remCh && ! locCh ) { | 2799 | if ( !remCh && ! locCh ) { |
2797 | //qDebug("both not changed "); | 2800 | //qDebug("both not changed "); |
2798 | lastSync = localMod.addDays(1); | 2801 | lastSync = localMod.addDays(1); |
2799 | if ( mode <= SYNC_PREF_ASK ) | 2802 | if ( mode <= SYNC_PREF_ASK ) |
2800 | return 0; | 2803 | return 0; |
2801 | } else { | 2804 | } else { |
2802 | if ( locCh ) { | 2805 | if ( locCh ) { |
2803 | //qDebug("loc changed %s %s", localMod.toString().latin1(), mLastAddressbookSync.toString().latin1()); | 2806 | //qDebug("loc changed %s %s", localMod.toString().latin1(), mLastAddressbookSync.toString().latin1()); |
2804 | lastSync = localMod.addDays( -1 ); | 2807 | lastSync = localMod.addDays( -1 ); |
2805 | if ( !remCh ) | 2808 | if ( !remCh ) |
2806 | remoteMod =( lastSync.addDays( -1 ) ); | 2809 | remoteMod =( lastSync.addDays( -1 ) ); |
2807 | } else { | 2810 | } else { |
2808 | //qDebug(" not loc changed "); | 2811 | //qDebug(" not loc changed "); |
2809 | lastSync = localMod.addDays( 1 ); | 2812 | lastSync = localMod.addDays( 1 ); |
2810 | if ( remCh ) { | 2813 | if ( remCh ) { |
2811 | //qDebug("rem changed "); | 2814 | //qDebug("rem changed "); |
2812 | remoteMod =( lastSync.addDays( 1 ) ); | 2815 | remoteMod =( lastSync.addDays( 1 ) ); |
2813 | } | 2816 | } |
2814 | 2817 | ||
2815 | } | 2818 | } |
2816 | } | 2819 | } |
2817 | full = true; | 2820 | full = true; |
2818 | if ( mode < SYNC_PREF_ASK ) | 2821 | if ( mode < SYNC_PREF_ASK ) |
2819 | mode = SYNC_PREF_ASK; | 2822 | mode = SYNC_PREF_ASK; |
2820 | } else { | 2823 | } else { |
2821 | if ( localMod == remoteMod ) | 2824 | if ( localMod == remoteMod ) |
2822 | return 0; | 2825 | return 0; |
2823 | 2826 | ||
2824 | } | 2827 | } |
2825 | //qDebug("%s %s --- %d %d", localMod.toString().latin1() , remoteMod.toString().latin1(), localMod.time().msec(), remoteMod.time().msec()); | 2828 | //qDebug("%s %s --- %d %d", localMod.toString().latin1() , remoteMod.toString().latin1(), localMod.time().msec(), remoteMod.time().msec()); |
2826 | //qDebug("lastsync %s ", lastSync.toString().latin1() ); | 2829 | //qDebug("lastsync %s ", lastSync.toString().latin1() ); |
2827 | //full = true; //debug only | 2830 | //full = true; //debug only |
2828 | if ( full ) { | 2831 | if ( full ) { |
2829 | bool equ = ( (*local) == (*remote) ); | 2832 | bool equ = ( (*local) == (*remote) ); |
2830 | if ( equ ) { | 2833 | if ( equ ) { |
2831 | //qDebug("equal "); | 2834 | //qDebug("equal "); |
2832 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2835 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2833 | local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); | 2836 | local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); |
2834 | } | 2837 | } |
2835 | if ( mode < SYNC_PREF_FORCE_LOCAL ) | 2838 | if ( mode < SYNC_PREF_FORCE_LOCAL ) |
2836 | return 0; | 2839 | return 0; |
2837 | 2840 | ||
2838 | }//else //debug only | 2841 | }//else //debug only |
2839 | //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); | 2842 | //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); |
2840 | } | 2843 | } |
2841 | int result; | 2844 | int result; |
2842 | bool localIsNew; | 2845 | bool localIsNew; |
2843 | //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , local->lastModified().toString().latin1() , remote->lastModified().toString().latin1() ); | 2846 | //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , local->lastModified().toString().latin1() , remote->lastModified().toString().latin1() ); |
2844 | 2847 | ||
2845 | if ( full && mode < SYNC_PREF_NEWEST ) | 2848 | if ( full && mode < SYNC_PREF_NEWEST ) |
2846 | mode = SYNC_PREF_ASK; | 2849 | mode = SYNC_PREF_ASK; |
2847 | 2850 | ||
2848 | switch( mode ) { | 2851 | switch( mode ) { |
2849 | case SYNC_PREF_LOCAL: | 2852 | case SYNC_PREF_LOCAL: |
2850 | if ( lastSync > remoteMod ) | 2853 | if ( lastSync > remoteMod ) |
2851 | return 1; | 2854 | return 1; |
2852 | if ( lastSync > localMod ) | 2855 | if ( lastSync > localMod ) |
2853 | return 2; | 2856 | return 2; |
2854 | return 1; | 2857 | return 1; |
2855 | break; | 2858 | break; |
2856 | case SYNC_PREF_REMOTE: | 2859 | case SYNC_PREF_REMOTE: |
2857 | if ( lastSync > remoteMod ) | 2860 | if ( lastSync > remoteMod ) |
2858 | return 1; | 2861 | return 1; |
2859 | if ( lastSync > localMod ) | 2862 | if ( lastSync > localMod ) |
2860 | return 2; | 2863 | return 2; |
2861 | return 2; | 2864 | return 2; |
2862 | break; | 2865 | break; |
2863 | case SYNC_PREF_NEWEST: | 2866 | case SYNC_PREF_NEWEST: |
2864 | if ( localMod > remoteMod ) | 2867 | if ( localMod > remoteMod ) |
2865 | return 1; | 2868 | return 1; |
2866 | else | 2869 | else |
2867 | return 2; | 2870 | return 2; |
2868 | break; | 2871 | break; |
2869 | case SYNC_PREF_ASK: | 2872 | case SYNC_PREF_ASK: |
2870 | //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); | 2873 | //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); |
2871 | if ( lastSync > remoteMod ) | 2874 | if ( lastSync > remoteMod ) |
2872 | return 1; | 2875 | return 1; |
2873 | if ( lastSync > localMod ) { | 2876 | if ( lastSync > localMod ) { |
2874 | return 2; | 2877 | return 2; |
2875 | } | 2878 | } |
2876 | localIsNew = localMod >= remoteMod; | 2879 | localIsNew = localMod >= remoteMod; |
2877 | //qDebug("conflict! ************************************** "); | 2880 | //qDebug("conflict! ************************************** "); |
2878 | { | 2881 | { |
2879 | KABC::AddresseeChooser acd ( *local,*remote, localIsNew , this ); | 2882 | KABC::AddresseeChooser acd ( *local,*remote, localIsNew , this ); |
2880 | result = acd.executeD(localIsNew); | 2883 | result = acd.executeD(localIsNew); |
2881 | return result; | 2884 | return result; |
2882 | } | 2885 | } |
2883 | break; | 2886 | break; |
2884 | case SYNC_PREF_FORCE_LOCAL: | 2887 | case SYNC_PREF_FORCE_LOCAL: |
2885 | return 1; | 2888 | return 1; |
2886 | break; | 2889 | break; |
2887 | case SYNC_PREF_FORCE_REMOTE: | 2890 | case SYNC_PREF_FORCE_REMOTE: |
2888 | return 2; | 2891 | return 2; |
2889 | break; | 2892 | break; |
2890 | 2893 | ||
2891 | default: | 2894 | default: |
2892 | // SYNC_PREF_TAKE_BOTH not implemented | 2895 | // SYNC_PREF_TAKE_BOTH not implemented |
2893 | break; | 2896 | break; |
2894 | } | 2897 | } |
2895 | return 0; | 2898 | return 0; |
2896 | } | 2899 | } |
2897 | 2900 | ||
2898 | 2901 | ||
2899 | bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode) | 2902 | bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode) |
2900 | { | 2903 | { |
2901 | bool syncOK = true; | 2904 | bool syncOK = true; |
2902 | int addedAddressee = 0; | 2905 | int addedAddressee = 0; |
2903 | int addedAddresseeR = 0; | 2906 | int addedAddresseeR = 0; |
2904 | int deletedAddresseeR = 0; | 2907 | int deletedAddresseeR = 0; |
2905 | int deletedAddresseeL = 0; | 2908 | int deletedAddresseeL = 0; |
2906 | int changedLocal = 0; | 2909 | int changedLocal = 0; |
2907 | int changedRemote = 0; | 2910 | int changedRemote = 0; |
2908 | int filteredIN = 0; | 2911 | int filteredIN = 0; |
2909 | int filteredOUT = 0; | 2912 | int filteredOUT = 0; |
2910 | 2913 | ||
2911 | QString mCurrentSyncName = syncManager->getCurrentSyncName(); | 2914 | QString mCurrentSyncName = syncManager->getCurrentSyncName(); |
2912 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); | 2915 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); |
2913 | 2916 | ||
2914 | //QPtrList<Addressee> el = local->rawAddressees(); | 2917 | //QPtrList<Addressee> el = local->rawAddressees(); |
2915 | Addressee addresseeR; | 2918 | Addressee addresseeR; |
2916 | QString uid; | 2919 | QString uid; |
2917 | int take; | 2920 | int take; |
2918 | Addressee addresseeL; | 2921 | Addressee addresseeL; |
2919 | Addressee addresseeRSync; | 2922 | Addressee addresseeRSync; |
2920 | Addressee addresseeLSync; | 2923 | Addressee addresseeLSync; |
2921 | // KABC::Addressee::List addresseeRSyncSharp = remote->getExternLastSyncAddressees(); | 2924 | // KABC::Addressee::List addresseeRSyncSharp = remote->getExternLastSyncAddressees(); |
2922 | //KABC::Addressee::List addresseeLSyncSharp = local->getExternLastSyncAddressees(); | 2925 | //KABC::Addressee::List addresseeLSyncSharp = local->getExternLastSyncAddressees(); |
2923 | bool fullDateRange = false; | 2926 | bool fullDateRange = false; |
2924 | local->resetTempSyncStat(); | 2927 | local->resetTempSyncStat(); |
2925 | mLastAddressbookSync = QDateTime::currentDateTime(); | 2928 | mLastAddressbookSync = QDateTime::currentDateTime(); |
2926 | if ( syncManager->syncWithDesktop() ) { | 2929 | if ( syncManager->syncWithDesktop() ) { |
2927 | // remote->removeSyncInfo( QString());//remove all info | 2930 | // remote->removeSyncInfo( QString());//remove all info |
2928 | if ( KSyncManager::mRequestedSyncEvent.isValid() ) { | 2931 | if ( KSyncManager::mRequestedSyncEvent.isValid() ) { |
2929 | mLastAddressbookSync = KSyncManager::mRequestedSyncEvent; | 2932 | mLastAddressbookSync = KSyncManager::mRequestedSyncEvent; |
2930 | qDebug("KA: using extern time for calendar sync: %s ", mLastAddressbookSync.toString().latin1() ); | 2933 | qDebug("KA: using extern time for calendar sync: %s ", mLastAddressbookSync.toString().latin1() ); |
2931 | } else { | 2934 | } else { |
2932 | qDebug("KA: KSyncManager::mRequestedSyncEvent has invalid datatime "); | 2935 | qDebug("KA: KSyncManager::mRequestedSyncEvent has invalid datatime "); |
2933 | } | 2936 | } |
2934 | } | 2937 | } |
2935 | QDateTime modifiedCalendar = mLastAddressbookSync; | 2938 | QDateTime modifiedCalendar = mLastAddressbookSync; |
2936 | addresseeLSync = getLastSyncAddressee(); | 2939 | addresseeLSync = getLastSyncAddressee(); |
2937 | qDebug("KA: Last Sync %s ", addresseeLSync.revision().toString().latin1()); | 2940 | qDebug("KA: Last Sync %s ", addresseeLSync.revision().toString().latin1()); |
2938 | addresseeR = remote->findByUid("last-syncAddressee-"+mCurrentSyncName ); | 2941 | addresseeR = remote->findByUid("last-syncAddressee-"+mCurrentSyncName ); |
2939 | if ( !addresseeR.isEmpty() ) { | 2942 | if ( !addresseeR.isEmpty() ) { |
2940 | addresseeRSync = addresseeR; | 2943 | addresseeRSync = addresseeR; |
2941 | remote->removeAddressee(addresseeR ); | 2944 | remote->removeAddressee(addresseeR ); |
2942 | 2945 | ||
2943 | } else { | 2946 | } else { |
2944 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2947 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2945 | addresseeRSync = addresseeLSync ; | 2948 | addresseeRSync = addresseeLSync ; |
2946 | } else { | 2949 | } else { |
2947 | //qDebug("FULLDATE 1"); | 2950 | //qDebug("FULLDATE 1"); |
2948 | fullDateRange = true; | 2951 | fullDateRange = true; |
2949 | Addressee newAdd; | 2952 | Addressee newAdd; |
2950 | addresseeRSync = newAdd; | 2953 | addresseeRSync = newAdd; |
2951 | addresseeRSync.setFamilyName(mCurrentSyncName + i18n(" - sync addressee")); | 2954 | addresseeRSync.setFamilyName(mCurrentSyncName + i18n(" - sync addressee")); |
2952 | addresseeRSync.setUid("last-syncAddressee-"+mCurrentSyncName ); | 2955 | addresseeRSync.setUid("last-syncAddressee-"+mCurrentSyncName ); |
2953 | addresseeRSync.setRevision( mLastAddressbookSync ); | 2956 | addresseeRSync.setRevision( mLastAddressbookSync ); |
2954 | addresseeRSync.setCategories( i18n("SyncAddressee") ); | 2957 | addresseeRSync.setCategories( i18n("SyncAddressee") ); |
2955 | } | 2958 | } |
2956 | } | 2959 | } |
2957 | if ( addresseeLSync.revision() == mLastAddressbookSync ) { | 2960 | if ( addresseeLSync.revision() == mLastAddressbookSync ) { |
2958 | // qDebug("FULLDATE 2"); | 2961 | // qDebug("FULLDATE 2"); |
2959 | fullDateRange = true; | 2962 | fullDateRange = true; |
2960 | } | 2963 | } |
2961 | if ( ! fullDateRange ) { | 2964 | if ( ! fullDateRange ) { |
2962 | if ( addresseeLSync.revision() != addresseeRSync.revision() ) { | 2965 | if ( addresseeLSync.revision() != addresseeRSync.revision() ) { |
2963 | 2966 | ||
2964 | // qDebug("set fulldate to true %s %s" ,addresseeLSync->dtStart().toString().latin1(), addresseeRSync->dtStart().toString().latin1() ); | 2967 | // qDebug("set fulldate to true %s %s" ,addresseeLSync->dtStart().toString().latin1(), addresseeRSync->dtStart().toString().latin1() ); |
2965 | //qDebug("%d %d %d %d ", addresseeLSync->dtStart().time().second(), addresseeLSync->dtStart().time().msec() , addresseeRSync->dtStart().time().second(), addresseeRSync->dtStart().time().msec()); | 2968 | //qDebug("%d %d %d %d ", addresseeLSync->dtStart().time().second(), addresseeLSync->dtStart().time().msec() , addresseeRSync->dtStart().time().second(), addresseeRSync->dtStart().time().msec()); |
2966 | fullDateRange = true; | 2969 | fullDateRange = true; |
2967 | //qDebug("FULLDATE 3 %s %s", addresseeLSync.revision().toString().latin1() , addresseeRSync.revision().toString().latin1() ); | 2970 | //qDebug("FULLDATE 3 %s %s", addresseeLSync.revision().toString().latin1() , addresseeRSync.revision().toString().latin1() ); |
2968 | } | 2971 | } |
2969 | } | 2972 | } |
2970 | // fullDateRange = true; // debug only! | 2973 | // fullDateRange = true; // debug only! |
2971 | if ( fullDateRange ) | 2974 | if ( fullDateRange ) |
2972 | mLastAddressbookSync = QDateTime::currentDateTime().addDays( -100*365); | 2975 | mLastAddressbookSync = QDateTime::currentDateTime().addDays( -100*365); |
2973 | else | 2976 | else |
2974 | mLastAddressbookSync = addresseeLSync.revision(); | 2977 | mLastAddressbookSync = addresseeLSync.revision(); |
2975 | // for resyncing if own file has changed | 2978 | // for resyncing if own file has changed |
2976 | // PENDING fixme later when implemented | 2979 | // PENDING fixme later when implemented |
2977 | #if 0 | 2980 | #if 0 |
2978 | if ( mCurrentSyncDevice == "deleteaftersync" ) { | 2981 | if ( mCurrentSyncDevice == "deleteaftersync" ) { |
2979 | mLastAddressbookSync = loadedFileVersion; | 2982 | mLastAddressbookSync = loadedFileVersion; |
2980 | qDebug("setting mLastAddressbookSync "); | 2983 | qDebug("setting mLastAddressbookSync "); |
2981 | } | 2984 | } |
2982 | #endif | 2985 | #endif |
2983 | 2986 | ||
2984 | 2987 | ||
2985 | // ********** setting filters **************** | 2988 | // ********** setting filters **************** |
2986 | Filter filterIN = mViewManager->getFilterByName( syncManager->mFilterInAB ); | 2989 | Filter filterIN = mViewManager->getFilterByName( syncManager->mFilterInAB ); |
2987 | Filter filterOUT = mViewManager->getFilterByName( syncManager->mFilterOutAB ); | 2990 | Filter filterOUT = mViewManager->getFilterByName( syncManager->mFilterOutAB ); |
2988 | 2991 | ||
2989 | //qDebug("*************************** "); | 2992 | //qDebug("*************************** "); |
2990 | // qDebug("mLastAddressbookSync %s ",mLastAddressbookSync.toString().latin1() ); | 2993 | // qDebug("mLastAddressbookSync %s ",mLastAddressbookSync.toString().latin1() ); |
2991 | QStringList er = remote->uidList(); | 2994 | QStringList er = remote->uidList(); |
2992 | Addressee inR ;//= er.first(); | 2995 | Addressee inR ;//= er.first(); |
2993 | Addressee inL; | 2996 | Addressee inL; |
2994 | 2997 | ||
2995 | syncManager->showProgressBar(0, i18n("Syncing - close to abort!"), er.count()); | 2998 | syncManager->showProgressBar(0, i18n("Syncing - close to abort!"), er.count()); |
2996 | 2999 | ||
2997 | int modulo = (er.count()/10)+1; | 3000 | int modulo = (er.count()/10)+1; |
2998 | int incCounter = 0; | 3001 | int incCounter = 0; |
2999 | while ( incCounter < er.count()) { | 3002 | while ( incCounter < er.count()) { |
3000 | if (syncManager->isProgressBarCanceled()) | 3003 | if (syncManager->isProgressBarCanceled()) |
3001 | return false; | 3004 | return false; |
3002 | if ( incCounter % modulo == 0 ) | 3005 | if ( incCounter % modulo == 0 ) |
3003 | syncManager->showProgressBar(incCounter); | 3006 | syncManager->showProgressBar(incCounter); |
3004 | 3007 | ||
3005 | uid = er[ incCounter ]; | 3008 | uid = er[ incCounter ]; |
3006 | bool skipIncidence = false; | 3009 | bool skipIncidence = false; |
3007 | if ( uid.left(19) == QString("last-syncAddressee-") ) | 3010 | if ( uid.left(19) == QString("last-syncAddressee-") ) |
3008 | skipIncidence = true; | 3011 | skipIncidence = true; |
3009 | QString idS,OidS; | 3012 | QString idS,OidS; |
3010 | qApp->processEvents(); | 3013 | qApp->processEvents(); |
3011 | if ( !skipIncidence ) { | 3014 | if ( !skipIncidence ) { |
3012 | inL = local->findByUid( uid ); | 3015 | inL = local->findByUid( uid ); |
3013 | inR = remote->findByUid( uid ); | 3016 | inR = remote->findByUid( uid ); |
3014 | //inL.setResource( 0 ); | 3017 | //inL.setResource( 0 ); |
3015 | //inR.setResource( 0 ); | 3018 | //inR.setResource( 0 ); |
3016 | if ( !inL.isEmpty() ) { // maybe conflict - same uid in both calendars | 3019 | if ( !inL.isEmpty() ) { // maybe conflict - same uid in both calendars |
3017 | if ( !inL.resource() || inL.resource()->includeInSync() ) { | 3020 | if ( !inL.resource() || inL.resource()->includeInSync() ) { |
3018 | if ( (take = takeAddressee( &inL, &inR, mode, fullDateRange )) ) { | 3021 | if ( (take = takeAddressee( &inL, &inR, mode, fullDateRange )) ) { |
3019 | //qDebug("take %d %s ", take, inL.summary().latin1()); | 3022 | //qDebug("take %d %s ", take, inL.summary().latin1()); |
3020 | if ( take == 3 ) | 3023 | if ( take == 3 ) |
3021 | return false; | 3024 | return false; |
3022 | if ( take == 1 ) {// take local ********************** | 3025 | if ( take == 1 ) {// take local ********************** |
3023 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 3026 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
3024 | inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); | 3027 | inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); |
3025 | inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); | 3028 | inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); |
3026 | local->insertAddressee( inL, false ); | 3029 | local->insertAddressee( inL, false ); |
3027 | idS = inR.externalUID(); | 3030 | idS = inR.externalUID(); |
3028 | OidS = inR.originalExternalUID(); | 3031 | OidS = inR.originalExternalUID(); |
3029 | } | 3032 | } |
3030 | else | 3033 | else |
3031 | idS = inR.IDStr(); | 3034 | idS = inR.IDStr(); |
3032 | remote->removeAddressee( inR ); | 3035 | remote->removeAddressee( inR ); |
3033 | inR = inL; | 3036 | inR = inL; |
3034 | inR.setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); | 3037 | inR.setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); |
3035 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 3038 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
3036 | inR.setOriginalExternalUID( OidS ); | 3039 | inR.setOriginalExternalUID( OidS ); |
3037 | inR.setExternalUID( idS ); | 3040 | inR.setExternalUID( idS ); |
3038 | if ( syncManager->syncWithDesktop() ) { | 3041 | if ( syncManager->syncWithDesktop() ) { |
3039 | inR.setIDStr("changed" ); | 3042 | inR.setIDStr("changed" ); |
3040 | } | 3043 | } |
3041 | //inR.insertCustom( "KADDRESSBOOK", "X-KDESYNC","changed" ); | 3044 | //inR.insertCustom( "KADDRESSBOOK", "X-KDESYNC","changed" ); |
3042 | } else { | 3045 | } else { |
3043 | inR.setIDStr( idS ); | 3046 | inR.setIDStr( idS ); |
3044 | } | 3047 | } |
3045 | inR.setResource( 0 ); | 3048 | inR.setResource( 0 ); |
3046 | remote->insertAddressee( inR , false); | 3049 | remote->insertAddressee( inR , false); |
3047 | ++changedRemote; | 3050 | ++changedRemote; |
3048 | } else { // take == 2 take remote ********************** | 3051 | } else { // take == 2 take remote ********************** |
3049 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 3052 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
3050 | if ( inR.revision().date().year() < 2004 ) | 3053 | if ( inR.revision().date().year() < 2004 ) |
3051 | inR.setRevision( modifiedCalendar ); | 3054 | inR.setRevision( modifiedCalendar ); |
3052 | } | 3055 | } |
3053 | idS = inL.IDStr(); | 3056 | idS = inL.IDStr(); |
3054 | local->removeAddressee( inL ); | 3057 | local->removeAddressee( inL ); |
3055 | inL = inR; | 3058 | inL = inR; |
3056 | inL.setIDStr( idS ); | 3059 | inL.setIDStr( idS ); |
3057 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 3060 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
3058 | inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); | 3061 | inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); |
3059 | inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); | 3062 | inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); |
3060 | } | 3063 | } |
3061 | inL.setResource( 0 ); | 3064 | inL.setResource( 0 ); |
3062 | local->insertAddressee( inL , false ); | 3065 | local->insertAddressee( inL , false ); |
3063 | ++changedLocal; | 3066 | ++changedLocal; |
3064 | } | 3067 | } |
3065 | } | 3068 | } |
3066 | } | 3069 | } |
3067 | } else { // no conflict ********** add or delete remote | 3070 | } else { // no conflict ********** add or delete remote |
3068 | if ( filterIN.name().isEmpty() || filterIN.filterAddressee( inR ) ) { | 3071 | if ( filterIN.name().isEmpty() || filterIN.filterAddressee( inR ) ) { |
3069 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 3072 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
3070 | QString des = addresseeLSync.note(); | 3073 | QString des = addresseeLSync.note(); |
3071 | if ( des.find( inR.getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it | 3074 | if ( des.find( inR.getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it |
3072 | inR.setTempSyncStat( SYNC_TEMPSTATE_DELETE ); | 3075 | inR.setTempSyncStat( SYNC_TEMPSTATE_DELETE ); |
3073 | remote->insertAddressee( inR, false ); | 3076 | remote->insertAddressee( inR, false ); |
3074 | ++deletedAddresseeR; | 3077 | ++deletedAddresseeR; |
3075 | } else { | 3078 | } else { |
3076 | inR.setRevision( modifiedCalendar ); | 3079 | inR.setRevision( modifiedCalendar ); |
3077 | remote->insertAddressee( inR, false ); | 3080 | remote->insertAddressee( inR, false ); |
3078 | inL = inR; | 3081 | inL = inR; |
3079 | inL.setIDStr( ":" ); | 3082 | inL.setIDStr( ":" ); |
3080 | inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); | 3083 | inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); |
3081 | inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); | 3084 | inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); |
3082 | inL.setResource( 0 ); | 3085 | inL.setResource( 0 ); |
3083 | local->insertAddressee( inL , false); | 3086 | local->insertAddressee( inL , false); |
3084 | ++addedAddressee; | 3087 | ++addedAddressee; |
3085 | } | 3088 | } |
3086 | } else { | 3089 | } else { |
3087 | if ( inR.revision() > mLastAddressbookSync || mode == 5 ) { | 3090 | if ( inR.revision() > mLastAddressbookSync || mode == 5 ) { |
3088 | inR.setRevision( modifiedCalendar ); | 3091 | inR.setRevision( modifiedCalendar ); |
3089 | remote->insertAddressee( inR, false ); | 3092 | remote->insertAddressee( inR, false ); |
3090 | inR.setResource( 0 ); | 3093 | inR.setResource( 0 ); |
3091 | local->insertAddressee( inR, false ); | 3094 | local->insertAddressee( inR, false ); |
3092 | ++addedAddressee; | 3095 | ++addedAddressee; |
3093 | } else { | 3096 | } else { |
3094 | // pending checkExternSyncAddressee(addresseeRSyncSharp, inR); | 3097 | // pending checkExternSyncAddressee(addresseeRSyncSharp, inR); |
3095 | remote->removeAddressee( inR ); | 3098 | remote->removeAddressee( inR ); |
3096 | ++deletedAddresseeR; | 3099 | ++deletedAddresseeR; |
3097 | } | 3100 | } |
3098 | } | 3101 | } |
3099 | } else { | 3102 | } else { |
3100 | ++filteredIN; | 3103 | ++filteredIN; |
3101 | } | 3104 | } |
3102 | } | 3105 | } |
3103 | } | 3106 | } |
3104 | ++incCounter; | 3107 | ++incCounter; |
3105 | } | 3108 | } |
3106 | er.clear(); | 3109 | er.clear(); |
3107 | QStringList el = local->uidList(); | 3110 | QStringList el = local->uidList(); |
3108 | modulo = (el.count()/10)+1; | 3111 | modulo = (el.count()/10)+1; |
3109 | 3112 | ||
3110 | syncManager->showProgressBar(0, i18n("Add / remove addressees"), el.count()); | 3113 | syncManager->showProgressBar(0, i18n("Add / remove addressees"), el.count()); |
3111 | incCounter = 0; | 3114 | incCounter = 0; |
3112 | while ( incCounter < el.count()) { | 3115 | while ( incCounter < el.count()) { |
3113 | qApp->processEvents(); | 3116 | qApp->processEvents(); |
3114 | if (syncManager->isProgressBarCanceled()) | 3117 | if (syncManager->isProgressBarCanceled()) |
3115 | return false; | 3118 | return false; |
3116 | if ( incCounter % modulo == 0 ) | 3119 | if ( incCounter % modulo == 0 ) |
3117 | syncManager->showProgressBar(incCounter); | 3120 | syncManager->showProgressBar(incCounter); |
3118 | uid = el[ incCounter ]; | 3121 | uid = el[ incCounter ]; |
3119 | bool skipIncidence = false; | 3122 | bool skipIncidence = false; |
3120 | if ( uid.left(19) == QString("last-syncAddressee-") ) | 3123 | if ( uid.left(19) == QString("last-syncAddressee-") ) |
3121 | skipIncidence = true; | 3124 | skipIncidence = true; |
3122 | if ( !skipIncidence ) { | 3125 | if ( !skipIncidence ) { |
3123 | inL = local->findByUid( uid ); | 3126 | inL = local->findByUid( uid ); |
3124 | if ( !inL.resource() || inL.resource()->includeInSync() ) { | 3127 | if ( !inL.resource() || inL.resource()->includeInSync() ) { |
3125 | inR = remote->findByUid( uid ); | 3128 | inR = remote->findByUid( uid ); |
3126 | if ( inR.isEmpty() ){ | 3129 | if ( inR.isEmpty() ){ |
3127 | if ( filterOUT.name().isEmpty() || filterOUT.filterAddressee( inL ) ) { | 3130 | if ( filterOUT.name().isEmpty() || filterOUT.filterAddressee( inL ) ) { |
3128 | // no conflict ********** add or delete local | 3131 | // no conflict ********** add or delete local |
3129 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 3132 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
3130 | if ( !inL.getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { | 3133 | if ( !inL.getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { |
3131 | // pending checkExternSyncAddressee(addresseeLSyncSharp, inL); | 3134 | // pending checkExternSyncAddressee(addresseeLSyncSharp, inL); |
3132 | local->removeAddressee( inL ); | 3135 | local->removeAddressee( inL ); |
3133 | ++deletedAddresseeL; | 3136 | ++deletedAddresseeL; |
3134 | } else { | 3137 | } else { |
3135 | if ( ! syncManager->mWriteBackExistingOnly ) { | 3138 | if ( ! syncManager->mWriteBackExistingOnly ) { |
3136 | inL.removeID(mCurrentSyncDevice ); | 3139 | inL.removeID(mCurrentSyncDevice ); |
3137 | ++addedAddresseeR; | 3140 | ++addedAddresseeR; |
3138 | inL.setRevision( modifiedCalendar ); | 3141 | inL.setRevision( modifiedCalendar ); |
3139 | local->insertAddressee( inL, false ); | 3142 | local->insertAddressee( inL, false ); |
3140 | inR = inL; | 3143 | inR = inL; |
3141 | inR.setTempSyncStat( SYNC_TEMPSTATE_ADDED_EXTERNAL ); | 3144 | inR.setTempSyncStat( SYNC_TEMPSTATE_ADDED_EXTERNAL ); |
3142 | inR.setResource( 0 ); | 3145 | inR.setResource( 0 ); |
3143 | remote->insertAddressee( inR, false ); | 3146 | remote->insertAddressee( inR, false ); |
3144 | } | 3147 | } |
3145 | } | 3148 | } |
3146 | } else { | 3149 | } else { |
3147 | if ( inL.revision() < mLastAddressbookSync && mode != 4 ) { | 3150 | if ( inL.revision() < mLastAddressbookSync && mode != 4 ) { |
3148 | //qDebug("data %s ", inL.revision().toString().latin1()); | 3151 | //qDebug("data %s ", inL.revision().toString().latin1()); |
3149 | // pending checkExternSyncAddressee(addresseeLSyncSharp, inL); | 3152 | // pending checkExternSyncAddressee(addresseeLSyncSharp, inL); |
3150 | local->removeAddressee( inL ); | 3153 | local->removeAddressee( inL ); |
3151 | ++deletedAddresseeL; | 3154 | ++deletedAddresseeL; |
3152 | } else { | 3155 | } else { |
3153 | if ( ! syncManager->mWriteBackExistingOnly ) { | 3156 | if ( ! syncManager->mWriteBackExistingOnly ) { |
3154 | ++addedAddresseeR; | 3157 | ++addedAddresseeR; |
3155 | inL.setRevision( modifiedCalendar ); | 3158 | inL.setRevision( modifiedCalendar ); |
3156 | local->insertAddressee( inL, false ); | 3159 | local->insertAddressee( inL, false ); |
3157 | inR = inL; | 3160 | inR = inL; |
3158 | inR.setIDStr( ":" ); | 3161 | inR.setIDStr( ":" ); |
3159 | inR.setResource( 0 ); | 3162 | inR.setResource( 0 ); |
3160 | remote->insertAddressee( inR, false ); | 3163 | remote->insertAddressee( inR, false ); |
3161 | } | 3164 | } |
3162 | } | 3165 | } |
3163 | } | 3166 | } |
3164 | } else { | 3167 | } else { |
3165 | ++filteredOUT; | 3168 | ++filteredOUT; |
3166 | } | 3169 | } |
3167 | } | 3170 | } |
3168 | } | 3171 | } |
3169 | } | 3172 | } |
3170 | ++incCounter; | 3173 | ++incCounter; |
3171 | } | 3174 | } |
3172 | el.clear(); | 3175 | el.clear(); |
3173 | syncManager->hideProgressBar(); | 3176 | syncManager->hideProgressBar(); |
3174 | mLastAddressbookSync = QDateTime::currentDateTime().addSecs( 1 ); | 3177 | mLastAddressbookSync = QDateTime::currentDateTime().addSecs( 1 ); |
3175 | // get rid of micro seconds | 3178 | // get rid of micro seconds |
3176 | QTime t = mLastAddressbookSync.time(); | 3179 | QTime t = mLastAddressbookSync.time(); |
3177 | mLastAddressbookSync.setTime( QTime (t.hour (), t.minute (), t.second () ) ); | 3180 | mLastAddressbookSync.setTime( QTime (t.hour (), t.minute (), t.second () ) ); |
3178 | addresseeLSync.setRevision( mLastAddressbookSync ); | 3181 | addresseeLSync.setRevision( mLastAddressbookSync ); |
3179 | addresseeRSync.setRevision( mLastAddressbookSync ); | 3182 | addresseeRSync.setRevision( mLastAddressbookSync ); |
3180 | addresseeRSync.setRole( i18n("!Remote from: ")+mCurrentSyncName ) ; | 3183 | addresseeRSync.setRole( i18n("!Remote from: ")+mCurrentSyncName ) ; |
3181 | addresseeLSync.setRole(i18n("!Local from: ") + mCurrentSyncName ); | 3184 | addresseeLSync.setRole(i18n("!Local from: ") + mCurrentSyncName ); |
3182 | addresseeRSync.setGivenName( i18n("!DO NOT EDIT!") ) ; | 3185 | addresseeRSync.setGivenName( i18n("!DO NOT EDIT!") ) ; |
3183 | addresseeLSync.setGivenName(i18n("!DO NOT EDIT!") ); | 3186 | addresseeLSync.setGivenName(i18n("!DO NOT EDIT!") ); |
3184 | addresseeRSync.setOrganization( "!"+mLastAddressbookSync.toString() ) ; | 3187 | addresseeRSync.setOrganization( "!"+mLastAddressbookSync.toString() ) ; |
3185 | addresseeLSync.setOrganization("!"+ mLastAddressbookSync.toString() ); | 3188 | addresseeLSync.setOrganization("!"+ mLastAddressbookSync.toString() ); |
3186 | addresseeRSync.setNote( "" ) ; | 3189 | addresseeRSync.setNote( "" ) ; |
3187 | addresseeLSync.setNote( "" ); | 3190 | addresseeLSync.setNote( "" ); |
3188 | 3191 | ||
3189 | if ( mGlobalSyncMode == SYNC_MODE_NORMAL) | 3192 | if ( mGlobalSyncMode == SYNC_MODE_NORMAL) |
3190 | remote->insertAddressee( addresseeRSync, false ); | 3193 | remote->insertAddressee( addresseeRSync, false ); |
3191 | local->insertAddressee( addresseeLSync, false ); | 3194 | local->insertAddressee( addresseeLSync, false ); |
3192 | QString mes; | 3195 | QString mes; |
3193 | mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n %d incoming filtered out\n %d outgoing filtered out"),addedAddressee, addedAddresseeR, changedLocal, changedRemote, deletedAddresseeL, deletedAddresseeR, filteredIN, filteredOUT ); | 3196 | mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n %d incoming filtered out\n %d outgoing filtered out"),addedAddressee, addedAddresseeR, changedLocal, changedRemote, deletedAddresseeL, deletedAddresseeR, filteredIN, filteredOUT ); |
3194 | qDebug( mes ); | 3197 | qDebug( mes ); |
3195 | mes = i18n("Local addressbook changed!\n") +mes; | 3198 | mes = i18n("Local addressbook changed!\n") +mes; |
3196 | if ( syncManager->mShowSyncSummary ) { | 3199 | if ( syncManager->mShowSyncSummary ) { |
3197 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes, | 3200 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes, |
3198 | i18n("KA/Pi Synchronization"),i18n("Write back"))) { | 3201 | i18n("KA/Pi Synchronization"),i18n("Write back"))) { |
3199 | qDebug("KA: WB cancelled "); | 3202 | qDebug("KA: WB cancelled "); |
3200 | syncManager->mWriteBackFile = false; | 3203 | syncManager->mWriteBackFile = false; |
3201 | return syncOK; | 3204 | return syncOK; |
3202 | } | 3205 | } |
3203 | } | 3206 | } |
3204 | return syncOK; | 3207 | return syncOK; |
3205 | } | 3208 | } |
3206 | 3209 | ||
3207 | 3210 | ||
3208 | //this is a overwritten callbackmethods from the syncinterface | 3211 | //this is a overwritten callbackmethods from the syncinterface |
3209 | bool KABCore::sync(KSyncManager* manager, QString filename, int mode) | 3212 | bool KABCore::sync(KSyncManager* manager, QString filename, int mode) |
3210 | { | 3213 | { |
3211 | 3214 | ||
3212 | //pending prepare addresseeview for output | 3215 | //pending prepare addresseeview for output |
3213 | //pending detect, if remote file has REV field. if not switch to external sync | 3216 | //pending detect, if remote file has REV field. if not switch to external sync |
3214 | mGlobalSyncMode = SYNC_MODE_NORMAL; | 3217 | mGlobalSyncMode = SYNC_MODE_NORMAL; |
3215 | if ( manager != syncManager ) | 3218 | if ( manager != syncManager ) |
3216 | qDebug("KABCore::sync:: ERROR! :: manager != syncManager "); | 3219 | qDebug("KABCore::sync:: ERROR! :: manager != syncManager "); |
3217 | QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); | 3220 | QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); |
3218 | 3221 | ||
3219 | AddressBook abLocal(filename,"syncContact"); | 3222 | AddressBook abLocal(filename,"syncContact"); |
3220 | bool syncOK = false; | 3223 | bool syncOK = false; |
3221 | if ( abLocal.load() ) { | 3224 | if ( abLocal.load() ) { |
3222 | qDebug("KA: Sync::AB loaded %s,sync mode %d",filename.latin1(), mode ); | 3225 | qDebug("KA: Sync::AB loaded %s,sync mode %d",filename.latin1(), mode ); |
3223 | bool external = false; | 3226 | bool external = false; |
3224 | bool isXML = false; | 3227 | bool isXML = false; |
3225 | if ( filename.right(4) == ".xml") { | 3228 | if ( filename.right(4) == ".xml") { |
3226 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 3229 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
3227 | isXML = true; | 3230 | isXML = true; |
3228 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); | 3231 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); |
3229 | } else { | 3232 | } else { |
3230 | external = !manager->mIsKapiFile; | 3233 | external = !manager->mIsKapiFile; |
3231 | if ( external ) { | 3234 | if ( external ) { |
3232 | qDebug("KA: Sync::Setting vcf mode to external "); | 3235 | qDebug("KA: Sync::Setting vcf mode to external "); |
3233 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 3236 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
3234 | AddressBook::Iterator it; | 3237 | AddressBook::Iterator it; |
3235 | for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { | 3238 | for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { |
3236 | (*it).setID( mCurrentSyncDevice, (*it).uid() ); | 3239 | (*it).setID( mCurrentSyncDevice, (*it).uid() ); |
3237 | (*it).computeCsum( mCurrentSyncDevice ); | 3240 | (*it).computeCsum( mCurrentSyncDevice ); |
3238 | } | 3241 | } |
3239 | } | 3242 | } |
3240 | } | 3243 | } |
3241 | //AddressBook::Iterator it; | 3244 | //AddressBook::Iterator it; |
3242 | //QStringList vcards; | 3245 | //QStringList vcards; |
3243 | //for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { | 3246 | //for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { |
3244 | // qDebug("Name %s ", (*it).familyName().latin1()); | 3247 | // qDebug("Name %s ", (*it).familyName().latin1()); |
3245 | //} | 3248 | //} |
3246 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, mode ); | 3249 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, mode ); |
3247 | syncManager->hideProgressBar(); | 3250 | syncManager->hideProgressBar(); |
3248 | if ( syncOK ) { | 3251 | if ( syncOK ) { |
3249 | if ( syncManager->mWriteBackFile ) | 3252 | if ( syncManager->mWriteBackFile ) |
3250 | { | 3253 | { |
3251 | if ( external ) | 3254 | if ( external ) |
3252 | abLocal.removeSyncAddressees( !isXML); | 3255 | abLocal.removeSyncAddressees( !isXML); |
3253 | qDebug("KA: Sync::Saving remote AB "); | 3256 | qDebug("KA: Sync::Saving remote AB "); |
3254 | if ( ! abLocal.saveAB()) | 3257 | if ( ! abLocal.saveAB()) |
3255 | qDebug("KA: sync::Error writing back AB to file "); | 3258 | qDebug("KA: sync::Error writing back AB to file "); |
3256 | if ( external ) { | 3259 | if ( external ) { |
3257 | // afterwrite processing | 3260 | // afterwrite processing |
3258 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ,isXML); | 3261 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ,isXML); |
3259 | } | 3262 | } |
3260 | } | 3263 | } |
3261 | } | 3264 | } |
3262 | setModified(); | 3265 | setModified(); |
3263 | 3266 | ||
3264 | } | 3267 | } |
3265 | abLocal.removeResources(); | 3268 | abLocal.removeResources(); |
3266 | if ( syncOK ) | 3269 | if ( syncOK ) |
3267 | mViewManager->refreshView(); | 3270 | mViewManager->refreshView(); |
3268 | return syncOK; | 3271 | return syncOK; |
3269 | 3272 | ||
3270 | } | 3273 | } |
3271 | void KABCore::removeSyncInfo( QString syncProfile) | 3274 | void KABCore::removeSyncInfo( QString syncProfile) |
3272 | { | 3275 | { |
3273 | qDebug("KA: AB:removeSyncInfo for profile %s ", syncProfile.latin1()); | 3276 | qDebug("KA: AB:removeSyncInfo for profile %s ", syncProfile.latin1()); |
3274 | mAddressBook->removeSyncInfo( syncProfile ); | 3277 | mAddressBook->removeSyncInfo( syncProfile ); |
3275 | setModified(); | 3278 | setModified(); |
3276 | } | 3279 | } |
3277 | 3280 | ||
3278 | 3281 | ||
3279 | //this is a overwritten callbackmethods from the syncinterface | 3282 | //this is a overwritten callbackmethods from the syncinterface |
3280 | bool KABCore::syncExternal(KSyncManager* manager, QString resource) | 3283 | bool KABCore::syncExternal(KSyncManager* manager, QString resource) |
3281 | { | 3284 | { |
3282 | if ( resource == "phone" ) | 3285 | if ( resource == "phone" ) |
3283 | return syncPhone(); | 3286 | return syncPhone(); |
3284 | disableBR( true ); | 3287 | disableBR( true ); |
3285 | if ( manager != syncManager ) | 3288 | if ( manager != syncManager ) |
3286 | qDebug("KABCore::syncExternal:: ERROR! :: manager != syncManager "); | 3289 | qDebug("KABCore::syncExternal:: ERROR! :: manager != syncManager "); |
3287 | QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); | 3290 | QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); |
3288 | 3291 | ||
3289 | AddressBook abLocal( resource,"syncContact"); | 3292 | AddressBook abLocal( resource,"syncContact"); |
3290 | bool syncOK = false; | 3293 | bool syncOK = false; |
3291 | message(i18n("Loading DTM address data..."), false); | 3294 | message(i18n("Loading DTM address data..."), false); |
3292 | if ( abLocal.load() ) { | 3295 | if ( abLocal.load() ) { |
3293 | qDebug("KA: AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1()); | 3296 | qDebug("KA: AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1()); |
3294 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 3297 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
3295 | message(i18n("Sync preprocessing..."),false); | 3298 | message(i18n("Sync preprocessing..."),false); |
3296 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, false ); | 3299 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, false ); |
3297 | message(i18n("Synchronizing..."),false); | 3300 | message(i18n("Synchronizing..."),false); |
3298 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); | 3301 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); |
3299 | syncManager->hideProgressBar(); | 3302 | syncManager->hideProgressBar(); |
3300 | if ( syncOK ) { | 3303 | if ( syncOK ) { |
3301 | if ( syncManager->mWriteBackFile ) { | 3304 | if ( syncManager->mWriteBackFile ) { |
3302 | abLocal.removeSyncAddressees( false ); | 3305 | abLocal.removeSyncAddressees( false ); |
3303 | message(i18n("Saving DTM address data..."),false); | 3306 | message(i18n("Saving DTM address data..."),false); |
3304 | abLocal.saveAB(); | 3307 | abLocal.saveAB(); |
3305 | message(i18n("Sync postprocessing..."),false); | 3308 | message(i18n("Sync postprocessing..."),false); |
3306 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true ); | 3309 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true ); |
3307 | } | 3310 | } |
3308 | } else | 3311 | } else |
3309 | message( i18n("Sync cancelled or failed.") ); | 3312 | message( i18n("Sync cancelled or failed.") ); |
3310 | setModified(); | 3313 | setModified(); |
3311 | } | 3314 | } |
3312 | abLocal.removeResources(); | 3315 | abLocal.removeResources(); |
3313 | if ( syncOK ) { | 3316 | if ( syncOK ) { |
3314 | mViewManager->refreshView(); | 3317 | mViewManager->refreshView(); |
3315 | message(i18n("DTM syncing finished.")); | 3318 | message(i18n("DTM syncing finished.")); |
3316 | } | 3319 | } |
3317 | disableBR( false ); | 3320 | disableBR( false ); |
3318 | return syncOK; | 3321 | return syncOK; |
3319 | 3322 | ||
3320 | } | 3323 | } |
3321 | void KABCore::message( QString m, bool startTimer) | 3324 | void KABCore::message( QString m, bool startTimer) |
3322 | { | 3325 | { |
3323 | topLevelWidget()->setCaption( m ); | 3326 | topLevelWidget()->setCaption( m ); |
3324 | qApp->processEvents(); | 3327 | qApp->processEvents(); |
3325 | if ( startTimer ) | 3328 | if ( startTimer ) |
3326 | mMessageTimer->start( 15000, true ); | 3329 | mMessageTimer->start( 15000, true ); |
3327 | else | 3330 | else |
3328 | mMessageTimer->stop(); | 3331 | mMessageTimer->stop(); |
3329 | } | 3332 | } |
3330 | bool KABCore::syncPhone() | 3333 | bool KABCore::syncPhone() |
3331 | { | 3334 | { |
3332 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); | 3335 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); |
3333 | QString fileName = getPhoneFile(); | 3336 | QString fileName = getPhoneFile(); |
3334 | if ( !PhoneAccess::readFromPhone( fileName) ) { | 3337 | if ( !PhoneAccess::readFromPhone( fileName) ) { |
3335 | message(i18n("Phone access failed!")); | 3338 | message(i18n("Phone access failed!")); |
3336 | return false; | 3339 | return false; |
3337 | } | 3340 | } |
3338 | AddressBook abLocal( fileName,"syncContact"); | 3341 | AddressBook abLocal( fileName,"syncContact"); |
3339 | bool syncOK = false; | 3342 | bool syncOK = false; |
3340 | { | 3343 | { |
3341 | abLocal.importFromFile( fileName ); | 3344 | abLocal.importFromFile( fileName ); |
3342 | qDebug("KA: AB phone loaded ,sync device %s",mCurrentSyncDevice.latin1()); | 3345 | qDebug("KA: AB phone loaded ,sync device %s",mCurrentSyncDevice.latin1()); |
3343 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 3346 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
3344 | abLocal.preparePhoneSync( mCurrentSyncDevice, true ); | 3347 | abLocal.preparePhoneSync( mCurrentSyncDevice, true ); |
3345 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); | 3348 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); |
3346 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); | 3349 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); |
3347 | syncManager->hideProgressBar(); | 3350 | syncManager->hideProgressBar(); |
3348 | if ( syncOK ) { | 3351 | if ( syncOK ) { |
3349 | if ( syncManager->mWriteBackFile ) { | 3352 | if ( syncManager->mWriteBackFile ) { |
3350 | abLocal.removeSyncAddressees( true ); | 3353 | abLocal.removeSyncAddressees( true ); |
3351 | abLocal.saveABphone( fileName ); | 3354 | abLocal.saveABphone( fileName ); |
3352 | abLocal.findNewExtIds( fileName, mCurrentSyncDevice ); | 3355 | abLocal.findNewExtIds( fileName, mCurrentSyncDevice ); |
3353 | //abLocal.preparePhoneSync( mCurrentSyncDevice, false ); | 3356 | //abLocal.preparePhoneSync( mCurrentSyncDevice, false ); |
3354 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true ); | 3357 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true ); |
3355 | } | 3358 | } |
3356 | } | 3359 | } |
3357 | setModified(); | 3360 | setModified(); |
3358 | } | 3361 | } |
3359 | abLocal.removeResources(); | 3362 | abLocal.removeResources(); |
3360 | if ( syncOK ) | 3363 | if ( syncOK ) |
3361 | mViewManager->refreshView(); | 3364 | mViewManager->refreshView(); |
3362 | return syncOK; | 3365 | return syncOK; |
3363 | } | 3366 | } |
3364 | void KABCore::getFile( bool success ) | 3367 | void KABCore::getFile( bool success ) |
3365 | { | 3368 | { |
3366 | if ( ! success ) { | 3369 | if ( ! success ) { |
3367 | message( i18n("Error receiving file. Nothing changed!") ); | 3370 | message( i18n("Error receiving file. Nothing changed!") ); |
3368 | return; | 3371 | return; |
3369 | } | 3372 | } |
3370 | int count = mAddressBook->importFromFile( sentSyncFile() , false, true ); | 3373 | int count = mAddressBook->importFromFile( sentSyncFile() , false, true ); |
3371 | if ( count ) | 3374 | if ( count ) |
3372 | setModified( true ); | 3375 | setModified( true ); |
3373 | message( i18n("Pi-Sync successful!") ); | 3376 | message( i18n("Pi-Sync successful!") ); |
3374 | mViewManager->refreshView(); | 3377 | mViewManager->refreshView(); |
3375 | } | 3378 | } |
3376 | void KABCore::syncFileRequest() | 3379 | void KABCore::syncFileRequest() |
3377 | { | 3380 | { |
3378 | if ( KABPrefs::instance()->mPassiveSyncWithDesktop ) { | 3381 | if ( KABPrefs::instance()->mPassiveSyncWithDesktop ) { |
3379 | syncManager->slotSyncMenu( 999 ); | 3382 | syncManager->slotSyncMenu( 999 ); |
3380 | } | 3383 | } |
3381 | mAddressBook->export2File( sentSyncFile() ); | 3384 | mAddressBook->export2File( sentSyncFile() ); |
3382 | } | 3385 | } |
3383 | QString KABCore::sentSyncFile() | 3386 | QString KABCore::sentSyncFile() |
3384 | { | 3387 | { |
3385 | #ifdef DESKTOP_VERSION | 3388 | #ifdef DESKTOP_VERSION |
3386 | return locateLocal( "tmp", "copysyncab.vcf" ); | 3389 | return locateLocal( "tmp", "copysyncab.vcf" ); |
3387 | #else | 3390 | #else |
3388 | return QString( "/tmp/copysyncab.vcf" ); | 3391 | return QString( "/tmp/copysyncab.vcf" ); |
3389 | #endif | 3392 | #endif |
3390 | } | 3393 | } |
3391 | 3394 | ||
3392 | void KABCore::setCaptionBack() | 3395 | void KABCore::setCaptionBack() |
3393 | { | 3396 | { |
3394 | mMessageTimer->stop(); | 3397 | mMessageTimer->stop(); |
3395 | topLevelWidget()->setCaption( i18n("KAddressbook/Pi") ); | 3398 | topLevelWidget()->setCaption( i18n("KAddressbook/Pi") ); |
3396 | } | 3399 | } |
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h index d89daee..4cef73a 100644 --- a/kaddressbook/kabcore.h +++ b/kaddressbook/kabcore.h | |||
@@ -1,525 +1,526 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KAddressbook. | 2 | This file is part of KAddressbook. |
3 | Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> | 3 | Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 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 | 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 | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 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 | 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. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef KABCORE_H | 24 | #ifndef KABCORE_H |
25 | #define KABCORE_H | 25 | #define KABCORE_H |
26 | 26 | ||
27 | #include <kabc/field.h> | 27 | #include <kabc/field.h> |
28 | 28 | ||
29 | #ifndef KAB_EMBEDDED | 29 | #ifndef KAB_EMBEDDED |
30 | #endif //KAB_EMBEDDED | 30 | #endif //KAB_EMBEDDED |
31 | #include <qdict.h> | 31 | #include <qdict.h> |
32 | #include <qtimer.h> | 32 | #include <qtimer.h> |
33 | 33 | ||
34 | #include <qwidget.h> | 34 | #include <qwidget.h> |
35 | #include <qpopupmenu.h> | 35 | #include <qpopupmenu.h> |
36 | #include <ksyncmanager.h> | 36 | #include <ksyncmanager.h> |
37 | #ifndef DESKTOP_VERSION | 37 | #ifndef DESKTOP_VERSION |
38 | #include <qcopchannel_qws.h> | 38 | #include <qcopchannel_qws.h> |
39 | #endif | 39 | #endif |
40 | 40 | ||
41 | namespace KABC { | 41 | namespace KABC { |
42 | class AddressBook; | 42 | class AddressBook; |
43 | } | 43 | } |
44 | 44 | ||
45 | #ifndef KAB_EMBEDDED | 45 | #ifndef KAB_EMBEDDED |
46 | class KAboutData; | 46 | class KAboutData; |
47 | class KConfig; | 47 | class KConfig; |
48 | 48 | ||
49 | class KAddressBookService; | 49 | class KAddressBookService; |
50 | class LDAPSearchDialog; | 50 | class LDAPSearchDialog; |
51 | #else //KAB_EMBEDDED | 51 | #else //KAB_EMBEDDED |
52 | class KAddressBookMain; | 52 | class KAddressBookMain; |
53 | //US class QAction; | 53 | //US class QAction; |
54 | #endif //KAB_EMBEDDED | 54 | #endif //KAB_EMBEDDED |
55 | class KCMultiDialog; | 55 | class KCMultiDialog; |
56 | class KXMLGUIClient; | 56 | class KXMLGUIClient; |
57 | class ExtensionManager; | 57 | class ExtensionManager; |
58 | class XXPortManager; | 58 | class XXPortManager; |
59 | class JumpButtonBar; | 59 | class JumpButtonBar; |
60 | class IncSearchWidget; | 60 | class IncSearchWidget; |
61 | class KDGanttMinimizeSplitter; | 61 | class KDGanttMinimizeSplitter; |
62 | class KAction; | 62 | class KAction; |
63 | class KActionCollection; | 63 | class KActionCollection; |
64 | class KToggleAction; | 64 | class KToggleAction; |
65 | class KSyncProfile; | 65 | class KSyncProfile; |
66 | 66 | ||
67 | class QAction; | 67 | class QAction; |
68 | class QMenuBar; | 68 | class QMenuBar; |
69 | class QSplitter; | 69 | class QSplitter; |
70 | class ViewContainer; | 70 | class ViewContainer; |
71 | class ViewManager; | 71 | class ViewManager; |
72 | class AddresseeEditorDialog; | 72 | class AddresseeEditorDialog; |
73 | class Ir; | 73 | class Ir; |
74 | 74 | ||
75 | class KABCore : public QWidget, public KSyncInterface | 75 | class KABCore : public QWidget, public KSyncInterface |
76 | { | 76 | { |
77 | Q_OBJECT | 77 | Q_OBJECT |
78 | 78 | ||
79 | public: | 79 | public: |
80 | KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name = 0 ); | 80 | KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name = 0 ); |
81 | 81 | ||
82 | 82 | ||
83 | ~KABCore(); | 83 | ~KABCore(); |
84 | 84 | ||
85 | 85 | ||
86 | #ifdef KAB_EMBEDDED | 86 | #ifdef KAB_EMBEDDED |
87 | //US added functionality | 87 | //US added functionality |
88 | QPopupMenu* getViewMenu() {return viewMenu;} | 88 | QPopupMenu* getViewMenu() {return viewMenu;} |
89 | QPopupMenu* getFilterMenu() {return filterMenu;} | 89 | QPopupMenu* getFilterMenu() {return filterMenu;} |
90 | QPopupMenu* getSettingsMenu() {return settingsMenu;} | 90 | QPopupMenu* getSettingsMenu() {return settingsMenu;} |
91 | void addActionsManually(); | 91 | void addActionsManually(); |
92 | #endif //KAB_EMBEDDED | 92 | #endif //KAB_EMBEDDED |
93 | /** | 93 | /** |
94 | Restores the global settings. | 94 | Restores the global settings. |
95 | */ | 95 | */ |
96 | void restoreSettings(); | 96 | void restoreSettings(); |
97 | 97 | ||
98 | 98 | ||
99 | 99 | ||
100 | /** | 100 | /** |
101 | Returns a pointer to the StdAddressBook of the application. | 101 | Returns a pointer to the StdAddressBook of the application. |
102 | */ | 102 | */ |
103 | KABC::AddressBook *addressBook() const; | 103 | KABC::AddressBook *addressBook() const; |
104 | 104 | ||
105 | /** | 105 | /** |
106 | Returns a pointer to the KConfig object of the application. | 106 | Returns a pointer to the KConfig object of the application. |
107 | */ | 107 | */ |
108 | static KConfig *config(); | 108 | static KConfig *config(); |
109 | 109 | ||
110 | /** | 110 | /** |
111 | Returns a pointer to the global KActionCollection object. So | 111 | Returns a pointer to the global KActionCollection object. So |
112 | other classes can register their actions easily. | 112 | other classes can register their actions easily. |
113 | */ | 113 | */ |
114 | KActionCollection *actionCollection() const; | 114 | KActionCollection *actionCollection() const; |
115 | 115 | ||
116 | /** | 116 | /** |
117 | Returns the current search field of the Incremental Search Widget. | 117 | Returns the current search field of the Incremental Search Widget. |
118 | */ | 118 | */ |
119 | KABC::Field *currentSearchField() const; | 119 | KABC::Field *currentSearchField() const; |
120 | 120 | ||
121 | /** | 121 | /** |
122 | Returns the uid list of the currently selected contacts. | 122 | Returns the uid list of the currently selected contacts. |
123 | */ | 123 | */ |
124 | QStringList selectedUIDs() const; | 124 | QStringList selectedUIDs() const; |
125 | 125 | ||
126 | /** | 126 | /** |
127 | Displays the ResourceSelectDialog and returns the selected | 127 | Displays the ResourceSelectDialog and returns the selected |
128 | resource or a null pointer if no resource was selected by | 128 | resource or a null pointer if no resource was selected by |
129 | the user. | 129 | the user. |
130 | */ | 130 | */ |
131 | KABC::Resource *requestResource( QWidget *parent ); | 131 | KABC::Resource *requestResource( QWidget *parent ); |
132 | 132 | ||
133 | #ifndef KAB_EMBEDDED | 133 | #ifndef KAB_EMBEDDED |
134 | static KAboutData *createAboutData(); | 134 | static KAboutData *createAboutData(); |
135 | #endif //KAB_EMBEDDED | 135 | #endif //KAB_EMBEDDED |
136 | 136 | ||
137 | #ifdef KAB_EMBEDDED | 137 | #ifdef KAB_EMBEDDED |
138 | inline QPopupMenu* getImportMenu() { return ImportMenu;} | 138 | inline QPopupMenu* getImportMenu() { return ImportMenu;} |
139 | inline QPopupMenu* getExportMenu() { return ExportMenu;} | 139 | inline QPopupMenu* getExportMenu() { return ExportMenu;} |
140 | #endif //KAB_EMBEDDED | 140 | #endif //KAB_EMBEDDED |
141 | 141 | ||
142 | public slots: | 142 | public slots: |
143 | #ifdef KAB_EMBEDDED | 143 | #ifdef KAB_EMBEDDED |
144 | void createAboutData(); | 144 | void createAboutData(); |
145 | #endif //KAB_EMBEDDED | 145 | #endif //KAB_EMBEDDED |
146 | void setDetailsToggle(); | 146 | void setDetailsToggle(); |
147 | 147 | ||
148 | void showLicence(); | 148 | void showLicence(); |
149 | void faq(); | 149 | void faq(); |
150 | void whatsnew() ; | 150 | void whatsnew() ; |
151 | void synchowto() ; | 151 | void synchowto() ; |
152 | void multisynchowto() ; | 152 | void multisynchowto() ; |
153 | void kdesynchowto() ; | 153 | void kdesynchowto() ; |
154 | void writeToPhone(); | 154 | void writeToPhone(); |
155 | 155 | ||
156 | /** | 156 | /** |
157 | Is called whenever a contact is selected in the view. | 157 | Is called whenever a contact is selected in the view. |
158 | */ | 158 | */ |
159 | void setContactSelected( const QString &uid ); | 159 | void setContactSelected( const QString &uid ); |
160 | 160 | ||
161 | /** | 161 | /** |
162 | Opens the preferred mail composer with all selected contacts as | 162 | Opens the preferred mail composer with all selected contacts as |
163 | arguments. | 163 | arguments. |
164 | */ | 164 | */ |
165 | void sendMail(); | 165 | void sendMail(); |
166 | 166 | ||
167 | /** | 167 | /** |
168 | Opens the preferred mail composer with the given contacts as | 168 | Opens the preferred mail composer with the given contacts as |
169 | arguments. | 169 | arguments. |
170 | */ | 170 | */ |
171 | void sendMail( const QString& email ); | 171 | void sendMail( const QString& email ); |
172 | 172 | ||
173 | 173 | ||
174 | void mailVCard(); | 174 | void mailVCard(); |
175 | void mailVCard(const QStringList& uids); | 175 | void mailVCard(const QStringList& uids); |
176 | 176 | ||
177 | /** | 177 | /** |
178 | Beams the "WhoAmI contact. | 178 | Beams the "WhoAmI contact. |
179 | */ | 179 | */ |
180 | void beamMySelf(); | 180 | void beamMySelf(); |
181 | 181 | ||
182 | void beamVCard(); | 182 | void beamVCard(); |
183 | void export2phone(); | 183 | void export2phone(); |
184 | void beamVCard(const QStringList& uids); | 184 | void beamVCard(const QStringList& uids); |
185 | void beamDone( Ir *ir ); | 185 | void beamDone( Ir *ir ); |
186 | 186 | ||
187 | 187 | ||
188 | /** | 188 | /** |
189 | Starts the preferred web browser with the given URL as argument. | 189 | Starts the preferred web browser with the given URL as argument. |
190 | */ | 190 | */ |
191 | void browse( const QString& url ); | 191 | void browse( const QString& url ); |
192 | 192 | ||
193 | /** | 193 | /** |
194 | Select all contacts in the view. | 194 | Select all contacts in the view. |
195 | */ | 195 | */ |
196 | void selectAllContacts(); | 196 | void selectAllContacts(); |
197 | 197 | ||
198 | /** | 198 | /** |
199 | Deletes all selected contacts from the address book. | 199 | Deletes all selected contacts from the address book. |
200 | */ | 200 | */ |
201 | void deleteContacts(); | 201 | void deleteContacts(); |
202 | 202 | ||
203 | /** | 203 | /** |
204 | Deletes given contacts from the address book. | 204 | Deletes given contacts from the address book. |
205 | 205 | ||
206 | @param uids The uids of the contacts, which shall be deleted. | 206 | @param uids The uids of the contacts, which shall be deleted. |
207 | */ | 207 | */ |
208 | void deleteContacts( const QStringList &uids ); | 208 | void deleteContacts( const QStringList &uids ); |
209 | 209 | ||
210 | /** | 210 | /** |
211 | Copys the selected contacts into clipboard for later pasting. | 211 | Copys the selected contacts into clipboard for later pasting. |
212 | */ | 212 | */ |
213 | void copyContacts(); | 213 | void copyContacts(); |
214 | 214 | ||
215 | /** | 215 | /** |
216 | Cuts the selected contacts and stores them for later pasting. | 216 | Cuts the selected contacts and stores them for later pasting. |
217 | */ | 217 | */ |
218 | void cutContacts(); | 218 | void cutContacts(); |
219 | 219 | ||
220 | /** | 220 | /** |
221 | Paste contacts from clipboard into the address book. | 221 | Paste contacts from clipboard into the address book. |
222 | */ | 222 | */ |
223 | void pasteContacts(); | 223 | void pasteContacts(); |
224 | 224 | ||
225 | /** | 225 | /** |
226 | Paste given contacts into the address book. | 226 | Paste given contacts into the address book. |
227 | 227 | ||
228 | @param list The list of addressee, which shall be pasted. | 228 | @param list The list of addressee, which shall be pasted. |
229 | */ | 229 | */ |
230 | void pasteContacts( KABC::Addressee::List &list ); | 230 | void pasteContacts( KABC::Addressee::List &list ); |
231 | 231 | ||
232 | /** | 232 | /** |
233 | Sets the whoAmI contact, that is used by many other programs to | 233 | Sets the whoAmI contact, that is used by many other programs to |
234 | get personal information about the current user. | 234 | get personal information about the current user. |
235 | */ | 235 | */ |
236 | void setWhoAmI(); | 236 | void setWhoAmI(); |
237 | 237 | ||
238 | /** | 238 | /** |
239 | Displays the category dialog and applies the result to all | 239 | Displays the category dialog and applies the result to all |
240 | selected contacts. | 240 | selected contacts. |
241 | */ | 241 | */ |
242 | void setCategories(); | 242 | void setCategories(); |
243 | void manageCategories(); | 243 | void manageCategories(); |
244 | void editCategories(); | 244 | void editCategories(); |
245 | 245 | ||
246 | /** | 246 | /** |
247 | Sets the field list of the Incremental Search Widget. | 247 | Sets the field list of the Incremental Search Widget. |
248 | */ | 248 | */ |
249 | void setSearchFields( const KABC::Field::List &fields ); | 249 | void setSearchFields( const KABC::Field::List &fields ); |
250 | 250 | ||
251 | /** | 251 | /** |
252 | Search with the current search field for a contact, that matches | 252 | Search with the current search field for a contact, that matches |
253 | the given text, and selects it in the view. | 253 | the given text, and selects it in the view. |
254 | */ | 254 | */ |
255 | void incrementalSearch( const QString& text ); | 255 | void incrementalSearch( const QString& text ); |
256 | void incrementalSearchJump( const QString& text ); | 256 | void incrementalSearchJump( const QString& text ); |
257 | 257 | ||
258 | /** | 258 | /** |
259 | Marks the address book as modified. | 259 | Marks the address book as modified. |
260 | */ | 260 | */ |
261 | void setModified(); | 261 | void setModified(); |
262 | /** | 262 | /** |
263 | Marks the address book as modified without refreshing the view. | 263 | Marks the address book as modified without refreshing the view. |
264 | */ | 264 | */ |
265 | void setModifiedWOrefresh(); | 265 | void setModifiedWOrefresh(); |
266 | 266 | ||
267 | /** | 267 | /** |
268 | Marks the address book as modified concerning the argument. | 268 | Marks the address book as modified concerning the argument. |
269 | */ | 269 | */ |
270 | void setModified( bool modified ); | 270 | void setModified( bool modified ); |
271 | 271 | ||
272 | /** | 272 | /** |
273 | Returns whether the address book is modified. | 273 | Returns whether the address book is modified. |
274 | */ | 274 | */ |
275 | bool modified() const; | 275 | bool modified() const; |
276 | 276 | ||
277 | /** | 277 | /** |
278 | Called whenever an contact is modified in the contact editor | 278 | Called whenever an contact is modified in the contact editor |
279 | dialog or the quick edit. | 279 | dialog or the quick edit. |
280 | */ | 280 | */ |
281 | void contactModified( const KABC::Addressee &addr ); | 281 | void contactModified( const KABC::Addressee &addr ); |
282 | void addrModified( const KABC::Addressee &addr, bool updateDetails = true ); | 282 | void addrModified( const KABC::Addressee &addr, bool updateDetails = true ); |
283 | 283 | ||
284 | /** | 284 | /** |
285 | DCOP METHODS. | 285 | DCOP METHODS. |
286 | */ | 286 | */ |
287 | void addEmail( QString addr ); | 287 | void addEmail( QString addr ); |
288 | void importVCard( const KURL& url, bool showPreview ); | 288 | void importVCard( const KURL& url, bool showPreview ); |
289 | void importVCard( const QString& vCard, bool showPreview ); | 289 | void importVCard( const QString& vCard, bool showPreview ); |
290 | void newContact(); | 290 | void newContact(); |
291 | QString getNameByPhone( const QString& phone ); | 291 | QString getNameByPhone( const QString& phone ); |
292 | /** | 292 | /** |
293 | END DCOP METHODS | 293 | END DCOP METHODS |
294 | */ | 294 | */ |
295 | 295 | ||
296 | /** | 296 | /** |
297 | Saves the contents of the AddressBook back to disk. | 297 | Saves the contents of the AddressBook back to disk. |
298 | */ | 298 | */ |
299 | void save(); | 299 | void save(); |
300 | 300 | ||
301 | /** | 301 | /** |
302 | Undos the last command using the undo stack. | 302 | Undos the last command using the undo stack. |
303 | */ | 303 | */ |
304 | void undo(); | 304 | void undo(); |
305 | 305 | ||
306 | /** | 306 | /** |
307 | Redos the last command that was undone, using the redo stack. | 307 | Redos the last command that was undone, using the redo stack. |
308 | */ | 308 | */ |
309 | void redo(); | 309 | void redo(); |
310 | 310 | ||
311 | /** | 311 | /** |
312 | Shows the edit dialog for the given uid. If the uid is QString::null, | 312 | Shows the edit dialog for the given uid. If the uid is QString::null, |
313 | the method will try to find a selected addressee in the view. | 313 | the method will try to find a selected addressee in the view. |
314 | */ | 314 | */ |
315 | void editContact( const QString &uid /*US = QString::null*/ ); | 315 | void editContact( const QString &uid /*US = QString::null*/ ); |
316 | //US added a second method without defaultparameter | 316 | //US added a second method without defaultparameter |
317 | void editContact2(); | 317 | void editContact2(); |
318 | 318 | ||
319 | /** | 319 | /** |
320 | Shows or edits the detail view for the given uid. If the uid is QString::null, | 320 | Shows or edits the detail view for the given uid. If the uid is QString::null, |
321 | the method will try to find a selected addressee in the view. | 321 | the method will try to find a selected addressee in the view. |
322 | */ | 322 | */ |
323 | void executeContact( const QString &uid /*US = QString::null*/ ); | 323 | void executeContact( const QString &uid /*US = QString::null*/ ); |
324 | 324 | ||
325 | /** | 325 | /** |
326 | Launches the configuration dialog. | 326 | Launches the configuration dialog. |
327 | */ | 327 | */ |
328 | void openConfigDialog(); | 328 | void openConfigDialog(); |
329 | 329 | ||
330 | /** | 330 | /** |
331 | Launches the ldap search dialog. | 331 | Launches the ldap search dialog. |
332 | */ | 332 | */ |
333 | void openLDAPDialog(); | 333 | void openLDAPDialog(); |
334 | 334 | ||
335 | /** | 335 | /** |
336 | Creates a KAddressBookPrinter, which will display the print | 336 | Creates a KAddressBookPrinter, which will display the print |
337 | dialog and do the printing. | 337 | dialog and do the printing. |
338 | */ | 338 | */ |
339 | void print(); | 339 | void print(); |
340 | 340 | ||
341 | /** | 341 | /** |
342 | Registers a new GUI client, so plugins can register its actions. | 342 | Registers a new GUI client, so plugins can register its actions. |
343 | */ | 343 | */ |
344 | void addGUIClient( KXMLGUIClient *client ); | 344 | void addGUIClient( KXMLGUIClient *client ); |
345 | 345 | ||
346 | void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid); | 346 | void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid); |
347 | void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); | 347 | void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); |
348 | void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid); | 348 | void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid); |
349 | 349 | ||
350 | 350 | ||
351 | signals: | 351 | signals: |
352 | void contactSelected( const QString &name ); | 352 | void contactSelected( const QString &name ); |
353 | void contactSelected( const QPixmap &pixmap ); | 353 | void contactSelected( const QPixmap &pixmap ); |
354 | public slots: | 354 | public slots: |
355 | void recieve(QString cmsg ); | 355 | void recieve(QString cmsg ); |
356 | void getFile( bool success ); | 356 | void getFile( bool success ); |
357 | void syncFileRequest(); | 357 | void syncFileRequest(); |
358 | void setDetailsVisible( bool visible ); | 358 | void setDetailsVisible( bool visible ); |
359 | void setDetailsToState(); | 359 | void setDetailsToState(); |
360 | 360 | ||
361 | void saveSettings(); | 361 | void saveSettings(); |
362 | 362 | ||
363 | private slots: | 363 | private slots: |
364 | void updateToolBar(); | 364 | void updateToolBar(); |
365 | void updateMainWindow(); | 365 | void updateMainWindow(); |
366 | void receive( const QCString& cmsg, const QByteArray& data ); | 366 | void receive( const QCString& cmsg, const QByteArray& data ); |
367 | void toggleBeamReceive( ); | 367 | void toggleBeamReceive( ); |
368 | void disableBR(bool); | 368 | void disableBR(bool); |
369 | void setJumpButtonBarVisible( bool visible ); | 369 | void setJumpButtonBarVisible( bool visible ); |
370 | void setJumpButtonBar( bool visible ); | 370 | void setJumpButtonBar( bool visible ); |
371 | void setCaptionBack(); | 371 | void setCaptionBack(); |
372 | void resizeAndCallContactdialog(); | 372 | void resizeAndCallContactdialog(); |
373 | void callContactdialog(); | 373 | void callContactdialog(); |
374 | 374 | ||
375 | void importFromOL(); | 375 | void importFromOL(); |
376 | void extensionModified( const KABC::Addressee::List &list ); | 376 | void extensionModified( const KABC::Addressee::List &list ); |
377 | void extensionChanged( int id ); | 377 | void extensionChanged( int id ); |
378 | void clipboardDataChanged(); | 378 | void clipboardDataChanged(); |
379 | void updateActionMenu(); | 379 | void updateActionMenu(); |
380 | void configureKeyBindings(); | 380 | void configureKeyBindings(); |
381 | void removeVoice(); | 381 | void removeVoice(); |
382 | void setFormattedName(); | 382 | void setFormattedName(); |
383 | #ifdef KAB_EMBEDDED | 383 | #ifdef KAB_EMBEDDED |
384 | void configureResources(); | 384 | void configureResources(); |
385 | #endif //KAB_EMBEDDED | 385 | #endif //KAB_EMBEDDED |
386 | 386 | ||
387 | void slotEditorDestroyed( const QString &uid ); | 387 | void slotEditorDestroyed( const QString &uid ); |
388 | void configurationChanged(); | 388 | void configurationChanged(); |
389 | void addressBookChanged(); | 389 | void addressBookChanged(); |
390 | 390 | ||
391 | private: | 391 | private: |
392 | QString mEmailSourceChannel; | 392 | QString mEmailSourceChannel; |
393 | QString mEmailSourceUID; | ||
393 | void resizeEvent(QResizeEvent* e ); | 394 | void resizeEvent(QResizeEvent* e ); |
394 | bool mBRdisabled; | 395 | bool mBRdisabled; |
395 | #ifndef DESKTOP_VERSION | 396 | #ifndef DESKTOP_VERSION |
396 | QCopChannel* infrared; | 397 | QCopChannel* infrared; |
397 | #endif | 398 | #endif |
398 | QTimer *mMessageTimer; | 399 | QTimer *mMessageTimer; |
399 | void initGUI(); | 400 | void initGUI(); |
400 | void initActions(); | 401 | void initActions(); |
401 | QString getPhoneFile(); | 402 | QString getPhoneFile(); |
402 | 403 | ||
403 | AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, | 404 | AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, |
404 | const char *name = 0 ); | 405 | const char *name = 0 ); |
405 | 406 | ||
406 | KXMLGUIClient *mGUIClient; | 407 | KXMLGUIClient *mGUIClient; |
407 | 408 | ||
408 | KABC::AddressBook *mAddressBook; | 409 | KABC::AddressBook *mAddressBook; |
409 | 410 | ||
410 | ViewManager *mViewManager; | 411 | ViewManager *mViewManager; |
411 | // QSplitter *mDetailsSplitter; | 412 | // QSplitter *mDetailsSplitter; |
412 | KDGanttMinimizeSplitter *mExtensionBarSplitter; | 413 | KDGanttMinimizeSplitter *mExtensionBarSplitter; |
413 | ViewContainer *mDetails; | 414 | ViewContainer *mDetails; |
414 | KDGanttMinimizeSplitter* mMiniSplitter; | 415 | KDGanttMinimizeSplitter* mMiniSplitter; |
415 | XXPortManager *mXXPortManager; | 416 | XXPortManager *mXXPortManager; |
416 | JumpButtonBar *mJumpButtonBar; | 417 | JumpButtonBar *mJumpButtonBar; |
417 | IncSearchWidget *mIncSearchWidget; | 418 | IncSearchWidget *mIncSearchWidget; |
418 | ExtensionManager *mExtensionManager; | 419 | ExtensionManager *mExtensionManager; |
419 | 420 | ||
420 | KCMultiDialog *mConfigureDialog; | 421 | KCMultiDialog *mConfigureDialog; |
421 | 422 | ||
422 | #ifndef KAB_EMBEDDED | 423 | #ifndef KAB_EMBEDDED |
423 | LDAPSearchDialog *mLdapSearchDialog; | 424 | LDAPSearchDialog *mLdapSearchDialog; |
424 | #endif //KAB_EMBEDDED | 425 | #endif //KAB_EMBEDDED |
425 | // QDict<AddresseeEditorDialog> mEditorDict; | 426 | // QDict<AddresseeEditorDialog> mEditorDict; |
426 | AddresseeEditorDialog *mEditorDialog; | 427 | AddresseeEditorDialog *mEditorDialog; |
427 | bool mReadWrite; | 428 | bool mReadWrite; |
428 | bool mModified; | 429 | bool mModified; |
429 | bool mIsPart; | 430 | bool mIsPart; |
430 | bool mMultipleViewsAtOnce; | 431 | bool mMultipleViewsAtOnce; |
431 | 432 | ||
432 | 433 | ||
433 | //US file menu | 434 | //US file menu |
434 | KAction *mActionMail; | 435 | KAction *mActionMail; |
435 | KAction *mActionBeam; | 436 | KAction *mActionBeam; |
436 | KToggleAction *mActionBR; | 437 | KToggleAction *mActionBR; |
437 | KAction *mActionExport2phone; | 438 | KAction *mActionExport2phone; |
438 | KAction* mActionPrint; | 439 | KAction* mActionPrint; |
439 | KAction* mActionPrintDetails; | 440 | KAction* mActionPrintDetails; |
440 | KAction* mActionNewContact; | 441 | KAction* mActionNewContact; |
441 | KAction *mActionSave; | 442 | KAction *mActionSave; |
442 | KAction *mActionEditAddressee; | 443 | KAction *mActionEditAddressee; |
443 | KAction *mActionMailVCard; | 444 | KAction *mActionMailVCard; |
444 | KAction *mActionBeamVCard; | 445 | KAction *mActionBeamVCard; |
445 | 446 | ||
446 | KAction *mActionQuit; | 447 | KAction *mActionQuit; |
447 | 448 | ||
448 | //US edit menu | 449 | //US edit menu |
449 | KAction *mActionCopy; | 450 | KAction *mActionCopy; |
450 | KAction *mActionCut; | 451 | KAction *mActionCut; |
451 | KAction *mActionPaste; | 452 | KAction *mActionPaste; |
452 | KAction *mActionSelectAll; | 453 | KAction *mActionSelectAll; |
453 | KAction *mActionUndo; | 454 | KAction *mActionUndo; |
454 | KAction *mActionRedo; | 455 | KAction *mActionRedo; |
455 | KAction *mActionDelete; | 456 | KAction *mActionDelete; |
456 | 457 | ||
457 | //US settings menu | 458 | //US settings menu |
458 | KAction *mActionConfigResources; | 459 | KAction *mActionConfigResources; |
459 | KAction *mActionConfigKAddressbook; | 460 | KAction *mActionConfigKAddressbook; |
460 | KAction *mActionConfigShortcuts; | 461 | KAction *mActionConfigShortcuts; |
461 | KAction *mActionConfigureToolbars; | 462 | KAction *mActionConfigureToolbars; |
462 | KAction *mActionKeyBindings; | 463 | KAction *mActionKeyBindings; |
463 | KToggleAction *mActionJumpBar; | 464 | KToggleAction *mActionJumpBar; |
464 | KToggleAction *mActionDetails; | 465 | KToggleAction *mActionDetails; |
465 | KAction *mActionWhoAmI; | 466 | KAction *mActionWhoAmI; |
466 | KAction *mActionCategories; | 467 | KAction *mActionCategories; |
467 | KAction *mActionEditCategories; | 468 | KAction *mActionEditCategories; |
468 | KAction *mActionManageCategories; | 469 | KAction *mActionManageCategories; |
469 | KAction *mActionAboutKAddressbook; | 470 | KAction *mActionAboutKAddressbook; |
470 | KAction *mActionLicence; | 471 | KAction *mActionLicence; |
471 | KAction *mActionFaq; | 472 | KAction *mActionFaq; |
472 | KAction *mActionWN; | 473 | KAction *mActionWN; |
473 | KAction *mActionSyncHowto; | 474 | KAction *mActionSyncHowto; |
474 | KAction *mActionKdeSyncHowto; | 475 | KAction *mActionKdeSyncHowto; |
475 | KAction *mActionMultiSyncHowto; | 476 | KAction *mActionMultiSyncHowto; |
476 | 477 | ||
477 | KAction *mActionDeleteView; | 478 | KAction *mActionDeleteView; |
478 | 479 | ||
479 | QPopupMenu *viewMenu; | 480 | QPopupMenu *viewMenu; |
480 | QPopupMenu *filterMenu; | 481 | QPopupMenu *filterMenu; |
481 | QPopupMenu *settingsMenu; | 482 | QPopupMenu *settingsMenu; |
482 | QPopupMenu *changeMenu; | 483 | QPopupMenu *changeMenu; |
483 | QPopupMenu *beamMenu; | 484 | QPopupMenu *beamMenu; |
484 | //US QAction *mActionSave; | 485 | //US QAction *mActionSave; |
485 | QPopupMenu *ImportMenu; | 486 | QPopupMenu *ImportMenu; |
486 | QPopupMenu *ExportMenu; | 487 | QPopupMenu *ExportMenu; |
487 | //LR additional methods | 488 | //LR additional methods |
488 | KAction *mActionRemoveVoice; | 489 | KAction *mActionRemoveVoice; |
489 | KAction *mActionSetFormattedName; | 490 | KAction *mActionSetFormattedName; |
490 | KAction * mActionImportOL; | 491 | KAction * mActionImportOL; |
491 | 492 | ||
492 | #ifndef KAB_EMBEDDED | 493 | #ifndef KAB_EMBEDDED |
493 | KAddressBookService *mAddressBookService; | 494 | KAddressBookService *mAddressBookService; |
494 | #endif //KAB_EMBEDDED | 495 | #endif //KAB_EMBEDDED |
495 | 496 | ||
496 | class KABCorePrivate; | 497 | class KABCorePrivate; |
497 | KABCorePrivate *d; | 498 | KABCorePrivate *d; |
498 | //US bool mBlockSaveFlag; | 499 | //US bool mBlockSaveFlag; |
499 | 500 | ||
500 | #ifdef KAB_EMBEDDED | 501 | #ifdef KAB_EMBEDDED |
501 | KAddressBookMain *mMainWindow; // should be the same like mGUIClient | 502 | KAddressBookMain *mMainWindow; // should be the same like mGUIClient |
502 | #endif //KAB_EMBEDDED | 503 | #endif //KAB_EMBEDDED |
503 | 504 | ||
504 | //this are the overwritten callbackmethods from the syncinterface | 505 | //this are the overwritten callbackmethods from the syncinterface |
505 | virtual bool sync(KSyncManager* manager, QString filename, int mode); | 506 | virtual bool sync(KSyncManager* manager, QString filename, int mode); |
506 | virtual bool syncExternal(KSyncManager* manager, QString resource); | 507 | virtual bool syncExternal(KSyncManager* manager, QString resource); |
507 | virtual void removeSyncInfo( QString syncProfile); | 508 | virtual void removeSyncInfo( QString syncProfile); |
508 | bool syncPhone(); | 509 | bool syncPhone(); |
509 | void message( QString m , bool startTimer = true); | 510 | void message( QString m , bool startTimer = true); |
510 | 511 | ||
511 | // LR ******************************* | 512 | // LR ******************************* |
512 | // sync stuff! | 513 | // sync stuff! |
513 | QString sentSyncFile(); | 514 | QString sentSyncFile(); |
514 | QPopupMenu *syncMenu; | 515 | QPopupMenu *syncMenu; |
515 | KSyncManager* syncManager; | 516 | KSyncManager* syncManager; |
516 | int mGlobalSyncMode; | 517 | int mGlobalSyncMode; |
517 | bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode); | 518 | bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode); |
518 | KABC::Addressee getLastSyncAddressee(); | 519 | KABC::Addressee getLastSyncAddressee(); |
519 | QDateTime mLastAddressbookSync; | 520 | QDateTime mLastAddressbookSync; |
520 | int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ); | 521 | int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ); |
521 | // ********************* | 522 | // ********************* |
522 | 523 | ||
523 | }; | 524 | }; |
524 | 525 | ||
525 | #endif | 526 | #endif |
diff --git a/kaddressbook/xxportselectdialog.cpp b/kaddressbook/xxportselectdialog.cpp index e7bc8c0..0127fc0 100644 --- a/kaddressbook/xxportselectdialog.cpp +++ b/kaddressbook/xxportselectdialog.cpp | |||
@@ -1,334 +1,335 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KAddressBook. | 2 | This file is part of KAddressBook. |
3 | Copyright (c) 2002 Anders Lund <anders.lund@lund.tdcadsl.dk> | 3 | Copyright (c) 2002 Anders Lund <anders.lund@lund.tdcadsl.dk> |
4 | Tobias Koenig <tokoe@kde.org> | 4 | Tobias Koenig <tokoe@kde.org> |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
7 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
8 | the Free Software Foundation; either version 2 of the License, or | 8 | the Free Software Foundation; either version 2 of the License, or |
9 | (at your option) any later version. | 9 | (at your option) any later version. |
10 | 10 | ||
11 | This program is distributed in the hope that it will be useful, | 11 | This program is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public License | 16 | You should have received a copy of the GNU General Public License |
17 | along with this program; if not, write to the Free Software | 17 | along with this program; if not, write to the Free Software |
18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
19 | 19 | ||
20 | As a special exception, permission is given to link this program | 20 | As a special exception, permission is given to link this program |
21 | with any edition of Qt, and distribute the resulting executable, | 21 | with any edition of Qt, and distribute the resulting executable, |
22 | without including the source code for Qt in the source distribution. | 22 | without including the source code for Qt in the source distribution. |
23 | */ | 23 | */ |
24 | 24 | ||
25 | /* | 25 | /* |
26 | Enhanced Version of the file for platform independent KDE tools. | 26 | Enhanced Version of the file for platform independent KDE tools. |
27 | Copyright (c) 2004 Ulf Schenk | 27 | Copyright (c) 2004 Ulf Schenk |
28 | 28 | ||
29 | $Id$ | 29 | $Id$ |
30 | */ | 30 | */ |
31 | 31 | ||
32 | #include <kabc/addressbook.h> | 32 | #include <kabc/addressbook.h> |
33 | #include <kapplication.h> | 33 | #include <kapplication.h> |
34 | #include <kcombobox.h> | 34 | #include <kcombobox.h> |
35 | #include <klocale.h> | 35 | #include <klocale.h> |
36 | #include <kglobal.h> | 36 | #include <kglobal.h> |
37 | 37 | ||
38 | #include <qapplication.h> | 38 | #include <qapplication.h> |
39 | #include <qbuttongroup.h> | 39 | #include <qbuttongroup.h> |
40 | #include <qcombobox.h> | 40 | #include <qcombobox.h> |
41 | #include <qheader.h> | 41 | #include <qheader.h> |
42 | #include <qlabel.h> | 42 | #include <qlabel.h> |
43 | #include <qlayout.h> | 43 | #include <qlayout.h> |
44 | #include <qlistview.h> | 44 | #include <qlistview.h> |
45 | #include <qpushbutton.h> | 45 | #include <qpushbutton.h> |
46 | #include <qradiobutton.h> | 46 | #include <qradiobutton.h> |
47 | #include <qstringlist.h> | 47 | #include <qstringlist.h> |
48 | #include <qwhatsthis.h> | 48 | #include <qwhatsthis.h> |
49 | 49 | ||
50 | #include "kabcore.h" | 50 | #include "kabcore.h" |
51 | #include "kabprefs.h" | 51 | #include "kabprefs.h" |
52 | 52 | ||
53 | #include "xxportselectdialog.h" | 53 | #include "xxportselectdialog.h" |
54 | 54 | ||
55 | XXPortSelectDialog::XXPortSelectDialog( KABCore *core, bool sort, | 55 | XXPortSelectDialog::XXPortSelectDialog( KABCore *core, bool sort, |
56 | QWidget* parent, const char* name ) | 56 | QWidget* parent, const char* name ) |
57 | : KDialogBase( Plain, i18n( "Choose contact selection" ), Help | Ok | Cancel, | 57 | : KDialogBase( Plain, i18n( "Choose contact selection" ), Help | Ok | Cancel, |
58 | Ok, parent, name, true, true ), mCore( core ), | 58 | Ok, parent, name, true, true ), mCore( core ), |
59 | mUseSorting( sort ) | 59 | mUseSorting( sort ) |
60 | { | 60 | { |
61 | initGUI(); | 61 | initGUI(); |
62 | 62 | ||
63 | connect( mFiltersCombo, SIGNAL( activated( int ) ), | 63 | connect( mFiltersCombo, SIGNAL( activated( int ) ), |
64 | SLOT( filterChanged( int ) ) ); | 64 | SLOT( filterChanged( int ) ) ); |
65 | connect( mCategoriesView, SIGNAL( clicked( QListViewItem* ) ), | 65 | connect( mCategoriesView, SIGNAL( clicked( QListViewItem* ) ), |
66 | SLOT( categoryClicked( QListViewItem* ) ) ); | 66 | SLOT( categoryClicked( QListViewItem* ) ) ); |
67 | 67 | ||
68 | // setup filters | 68 | // setup filters |
69 | #ifndef KAB_EMBEDDED | 69 | #ifndef KAB_EMBEDDED |
70 | mFilters = Filter::restore( kapp->config(), "Filter" ); | 70 | mFilters = Filter::restore( kapp->config(), "Filter" ); |
71 | Filter::List::iterator filterIt; | 71 | Filter::List::iterator filterIt; |
72 | #else //KAB_EMBEDDED | 72 | #else //KAB_EMBEDDED |
73 | mFilters = Filter::restore( KGlobal::config(), "Filter" ); | 73 | mFilters = Filter::restore( KGlobal::config(), "Filter" ); |
74 | Filter::List::Iterator filterIt; | 74 | Filter::List::Iterator filterIt; |
75 | #endif //KAB_EMBEDDED | 75 | #endif //KAB_EMBEDDED |
76 | QStringList filters; | 76 | QStringList filters; |
77 | for ( filterIt = mFilters.begin(); filterIt != mFilters.end(); ++filterIt ) | 77 | for ( filterIt = mFilters.begin(); filterIt != mFilters.end(); ++filterIt ) |
78 | filters.append( (*filterIt).name() ); | 78 | filters.append( (*filterIt).name() ); |
79 | 79 | ||
80 | mFiltersCombo->insertStringList( filters ); | 80 | mFiltersCombo->insertStringList( filters ); |
81 | mUseFilters->setEnabled( filters.count() > 0 ); | 81 | mUseFilters->setEnabled( filters.count() > 0 ); |
82 | 82 | ||
83 | // setup categories | 83 | // setup categories |
84 | QStringList categories = KABPrefs::instance()->mCustomCategories; | 84 | QStringList categories = KABPrefs::instance()->mCustomCategories; |
85 | QStringList::Iterator it; | 85 | QStringList::Iterator it; |
86 | for ( it = categories.begin(); it != categories.end(); ++it ) | 86 | for ( it = categories.begin(); it != categories.end(); ++it ) |
87 | new QCheckListItem( mCategoriesView, *it, QCheckListItem::CheckBox ); | 87 | new QCheckListItem( mCategoriesView, *it, QCheckListItem::CheckBox ); |
88 | mUseCategories->setEnabled( categories.count() > 0 ); | 88 | mUseCategories->setEnabled( categories.count() > 0 ); |
89 | 89 | ||
90 | int count = mCore->selectedUIDs().count(); | 90 | int count = mCore->selectedUIDs().count(); |
91 | mUseSelection->setEnabled( count != 0 ); | 91 | mUseSelection->setEnabled( count != 0 ); |
92 | mUseSelection->setChecked( count > 1 ); | 92 | mUseSelection->setChecked( count > 1 ); |
93 | 93 | ||
94 | mSortTypeCombo->insertItem( i18n( "Ascending" ) ); | 94 | mSortTypeCombo->insertItem( i18n( "Ascending" ) ); |
95 | mSortTypeCombo->insertItem( i18n( "Descending" ) ); | 95 | mSortTypeCombo->insertItem( i18n( "Descending" ) ); |
96 | 96 | ||
97 | mFields = mCore->addressBook()->fields( KABC::Field::All ); | 97 | mFields = mCore->addressBook()->fields( KABC::Field::All ); |
98 | KABC::Field::List::Iterator fieldIt; | 98 | KABC::Field::List::Iterator fieldIt; |
99 | for ( fieldIt = mFields.begin(); fieldIt != mFields.end(); ++fieldIt ) | 99 | for ( fieldIt = mFields.begin(); fieldIt != mFields.end(); ++fieldIt ) |
100 | mFieldCombo->insertItem( (*fieldIt)->label() ); | 100 | mFieldCombo->insertItem( (*fieldIt)->label() ); |
101 | } | 101 | } |
102 | 102 | ||
103 | QStringList XXPortSelectDialog::uids() | 103 | QStringList XXPortSelectDialog::uids() |
104 | { | 104 | { |
105 | QStringList uidlist; | 105 | QStringList uidlist; |
106 | KABC::AddresseeList list = contacts(); | 106 | KABC::AddresseeList list = contacts(); |
107 | KABC::Addressee::List::Iterator it; | 107 | KABC::Addressee::List::Iterator it; |
108 | for ( it = list.begin(); it != list.end(); ++it ) | 108 | for ( it = list.begin(); it != list.end(); ++it ) |
109 | uidlist.append((*it).uid()); | 109 | uidlist.append((*it).uid()); |
110 | return uidlist; | 110 | return uidlist; |
111 | } | 111 | } |
112 | void XXPortSelectDialog::tagSelected() | 112 | void XXPortSelectDialog::tagSelected() |
113 | { | 113 | { |
114 | if ( mUseSelection->isChecked() ) { | 114 | if ( mUseSelection->isChecked() ) { |
115 | 115 | ||
116 | QStringList selection = mCore->selectedUIDs(); | 116 | QStringList selection = mCore->selectedUIDs(); |
117 | KABC::AddressBook::Iterator it; | 117 | KABC::AddressBook::Iterator it; |
118 | for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) { | 118 | for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) { |
119 | if ( selection.findIndex((*it).uid()) >= 0 ) | 119 | if ( selection.findIndex((*it).uid()) >= 0 ) |
120 | (*it).setTagged( true ); | 120 | (*it).setTagged( true ); |
121 | } | 121 | } |
122 | } else if ( mUseFilters->isChecked() ) { | 122 | } else if ( mUseFilters->isChecked() ) { |
123 | // find contacts that can pass selected filter | 123 | // find contacts that can pass selected filter |
124 | Filter::List::Iterator filterIt; | 124 | Filter::List::Iterator filterIt; |
125 | for ( filterIt = mFilters.begin(); filterIt != mFilters.end(); ++filterIt ) | 125 | for ( filterIt = mFilters.begin(); filterIt != mFilters.end(); ++filterIt ) |
126 | if ( (*filterIt).name() == mFiltersCombo->currentText() ) | 126 | if ( (*filterIt).name() == mFiltersCombo->currentText() ) |
127 | break; | 127 | break; |
128 | KABC::AddressBook::Iterator it; | 128 | KABC::AddressBook::Iterator it; |
129 | for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) { | 129 | for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) { |
130 | if ( (*filterIt).filterAddressee( *it ) ) | 130 | if ( (*filterIt).filterAddressee( *it ) ) |
131 | (*it).setTagged( true ); | 131 | (*it).setTagged( true ); |
132 | } | 132 | } |
133 | } else if ( mUseCategories->isChecked() ) { | 133 | } else if ( mUseCategories->isChecked() ) { |
134 | QStringList categorieList = categories(); | 134 | QStringList categorieList = categories(); |
135 | KABC::AddressBook::Iterator it; | 135 | KABC::AddressBook::Iterator it; |
136 | for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) { | 136 | for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) { |
137 | QStringList tmp( (*it).categories() ); | 137 | QStringList tmp( (*it).categories() ); |
138 | QStringList::Iterator tmpIt; | 138 | QStringList::Iterator tmpIt; |
139 | for ( tmpIt = tmp.begin(); tmpIt != tmp.end(); ++tmpIt ) | 139 | for ( tmpIt = tmp.begin(); tmpIt != tmp.end(); ++tmpIt ) |
140 | if ( categorieList.contains( *tmpIt ) ) { | 140 | if ( categorieList.contains( *tmpIt ) ) { |
141 | (*it).setTagged( true ); | 141 | (*it).setTagged( true ); |
142 | break; | 142 | break; |
143 | } | 143 | } |
144 | } | 144 | } |
145 | } else { | 145 | } else { |
146 | // create a string list of all entries: | 146 | // create a string list of all entries: |
147 | KABC::AddressBook::Iterator it; | 147 | KABC::AddressBook::Iterator it; |
148 | for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) | 148 | for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) |
149 | (*it).setTagged( true ); | 149 | (*it).setTagged( true ); |
150 | } | 150 | } |
151 | } | 151 | } |
152 | KABC::AddresseeList XXPortSelectDialog::contacts() | 152 | KABC::AddresseeList XXPortSelectDialog::contacts() |
153 | { | 153 | { |
154 | 154 | ||
155 | KABC::AddresseeList list; | 155 | KABC::AddresseeList list; |
156 | if ( mUseSelection->isChecked() ) { | 156 | if ( mUseSelection->isChecked() ) { |
157 | QStringList::Iterator it; | 157 | QStringList::Iterator it; |
158 | QStringList selection = mCore->selectedUIDs(); | 158 | QStringList selection = mCore->selectedUIDs(); |
159 | for ( it = selection.begin(); it != selection.end(); ++it ) { | 159 | for ( it = selection.begin(); it != selection.end(); ++it ) { |
160 | KABC::Addressee addr = mCore->addressBook()->findByUid( *it ); | 160 | KABC::Addressee addr = mCore->addressBook()->findByUid( *it ); |
161 | if ( !addr.isEmpty() ) | 161 | if ( !addr.isEmpty() ) |
162 | list.append( addr ); | 162 | list.append( addr ); |
163 | } | 163 | } |
164 | } else if ( mUseFilters->isChecked() ) { | 164 | } else if ( mUseFilters->isChecked() ) { |
165 | // find contacts that can pass selected filter | 165 | // find contacts that can pass selected filter |
166 | Filter::List::Iterator filterIt; | 166 | Filter::List::Iterator filterIt; |
167 | for ( filterIt = mFilters.begin(); filterIt != mFilters.end(); ++filterIt ) | 167 | for ( filterIt = mFilters.begin(); filterIt != mFilters.end(); ++filterIt ) |
168 | if ( (*filterIt).name() == mFiltersCombo->currentText() ) | 168 | if ( (*filterIt).name() == mFiltersCombo->currentText() ) |
169 | break; | 169 | break; |
170 | 170 | ||
171 | KABC::AddressBook::Iterator it; | 171 | KABC::AddressBook::Iterator it; |
172 | for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) { | 172 | for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) { |
173 | if ( (*filterIt).filterAddressee( *it ) ) | 173 | if ( (*filterIt).filterAddressee( *it ) ) |
174 | list.append( *it ); | 174 | list.append( *it ); |
175 | } | 175 | } |
176 | } else if ( mUseCategories->isChecked() ) { | 176 | } else if ( mUseCategories->isChecked() ) { |
177 | QStringList categorieList = categories(); | 177 | QStringList categorieList = categories(); |
178 | KABC::AddressBook::Iterator it; | 178 | KABC::AddressBook::Iterator it; |
179 | for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) { | 179 | for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) { |
180 | QStringList tmp( (*it).categories() ); | 180 | QStringList tmp( (*it).categories() ); |
181 | QStringList::Iterator tmpIt; | 181 | QStringList::Iterator tmpIt; |
182 | for ( tmpIt = tmp.begin(); tmpIt != tmp.end(); ++tmpIt ) | 182 | for ( tmpIt = tmp.begin(); tmpIt != tmp.end(); ++tmpIt ) |
183 | if ( categorieList.contains( *tmpIt ) ) { | 183 | if ( categorieList.contains( *tmpIt ) ) { |
184 | list.append( *it ); | 184 | list.append( *it ); |
185 | break; | 185 | break; |
186 | } | 186 | } |
187 | } | 187 | } |
188 | } else { | 188 | } else { |
189 | // create a string list of all entries: | 189 | // create a string list of all entries: |
190 | KABC::AddressBook::Iterator it; | 190 | KABC::AddressBook::Iterator it; |
191 | for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) | 191 | for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) |
192 | list.append( *it ); | 192 | list.append( *it ); |
193 | } | 193 | } |
194 | 194 | ||
195 | if ( mUseSorting ) { | 195 | if ( mUseSorting ) { |
196 | list.setReverseSorting( mSortTypeCombo->currentItem() == 1 ); | 196 | list.setReverseSorting( mSortTypeCombo->currentItem() == 1 ); |
197 | uint pos = mFieldCombo->currentItem(); | 197 | uint pos = mFieldCombo->currentItem(); |
198 | if ( pos < mFields.count() ) | 198 | if ( pos < mFields.count() ) |
199 | list.sortByField( mFields[ pos ] ); | 199 | list.sortByField( mFields[ pos ] ); |
200 | } | 200 | } |
201 | 201 | ||
202 | return list; | 202 | return list; |
203 | } | 203 | } |
204 | 204 | ||
205 | QStringList XXPortSelectDialog::categories() const | 205 | QStringList XXPortSelectDialog::categories() const |
206 | { | 206 | { |
207 | QStringList list; | 207 | QStringList list; |
208 | 208 | ||
209 | QListViewItemIterator it( mCategoriesView ); | 209 | QListViewItemIterator it( mCategoriesView ); |
210 | for ( ; it.current(); ++it ) { | 210 | for ( ; it.current(); ++it ) { |
211 | QCheckListItem* qcli = static_cast<QCheckListItem*>(it.current()); | 211 | QCheckListItem* qcli = static_cast<QCheckListItem*>(it.current()); |
212 | if ( qcli->isOn() ) | 212 | if ( qcli->isOn() ) |
213 | list.append( it.current()->text( 0 ) ); | 213 | list.append( it.current()->text( 0 ) ); |
214 | } | 214 | } |
215 | 215 | ||
216 | return list; | 216 | return list; |
217 | } | 217 | } |
218 | 218 | ||
219 | void XXPortSelectDialog::filterChanged( int ) | 219 | void XXPortSelectDialog::filterChanged( int ) |
220 | { | 220 | { |
221 | mUseFilters->setChecked( true ); | 221 | mUseFilters->setChecked( true ); |
222 | } | 222 | } |
223 | 223 | ||
224 | void XXPortSelectDialog::categoryClicked( QListViewItem *i ) | 224 | void XXPortSelectDialog::categoryClicked( QListViewItem *i ) |
225 | { | 225 | { |
226 | QCheckListItem *qcli = static_cast<QCheckListItem*>( i ); | 226 | QCheckListItem *qcli = static_cast<QCheckListItem*>( i ); |
227 | if ( qcli->isOn() ) | 227 | if ( qcli->isOn() ) |
228 | mUseCategories->setChecked( true ); | 228 | mUseCategories->setChecked( true ); |
229 | } | 229 | } |
230 | 230 | ||
231 | void XXPortSelectDialog::slotHelp() | 231 | void XXPortSelectDialog::slotHelp() |
232 | { | 232 | { |
233 | #ifndef KAB_EMBEDDED | 233 | #ifndef KAB_EMBEDDED |
234 | kapp->invokeHelp( "import-and-export" ); | 234 | kapp->invokeHelp( "import-and-export" ); |
235 | #else //KAB_EMBEDDED | 235 | #else //KAB_EMBEDDED |
236 | qDebug("XXPortSelectDialog::slotHelp is not implemented yet"); | 236 | qDebug("XXPortSelectDialog::slotHelp is not implemented yet"); |
237 | #endif //KAB_EMBEDDED | 237 | #endif //KAB_EMBEDDED |
238 | 238 | ||
239 | } | 239 | } |
240 | 240 | ||
241 | void XXPortSelectDialog::initGUI() | 241 | void XXPortSelectDialog::initGUI() |
242 | { | 242 | { |
243 | QFrame *page = plainPage(); | 243 | QFrame *page = plainPage(); |
244 | 244 | ||
245 | QVBoxLayout *topLayout = new QVBoxLayout( page, KDialog::marginHint(), | 245 | QVBoxLayout *topLayout = new QVBoxLayout( page, KDialog::marginHintSmall(), |
246 | KDialog::spacingHint() ); | 246 | KDialog::spacingHintSmall() ); |
247 | 247 | ||
248 | QLabel *label = new QLabel( i18n( "Which contacts do you want to select?" ), page ); | 248 | QLabel *label = new QLabel( i18n( "Which contacts do you want to select?" ), page ); |
249 | topLayout->addWidget( label ); | 249 | topLayout->addWidget( label ); |
250 | 250 | ||
251 | mButtonGroup = new QButtonGroup( i18n( "Contact Selection" ), page ); | 251 | mButtonGroup = new QButtonGroup( i18n( "Contact Selection" ), page ); |
252 | mButtonGroup->setColumnLayout( 0, Qt::Vertical ); | 252 | mButtonGroup->setColumnLayout( 0, Qt::Vertical ); |
253 | mButtonGroup->layout()->setSpacing( KDialog::spacingHint() ); | 253 | mButtonGroup->layout()->setSpacing( KDialog::spacingHint() ); |
254 | mButtonGroup->layout()->setMargin( KDialog::marginHint() ); | 254 | mButtonGroup->layout()->setMargin( KDialog::marginHint() ); |
255 | 255 | ||
256 | QGridLayout *groupLayout = new QGridLayout( mButtonGroup->layout() ); | 256 | QGridLayout *groupLayout = new QGridLayout( mButtonGroup->layout() ); |
257 | groupLayout->setAlignment( Qt::AlignTop ); | 257 | groupLayout->setAlignment( Qt::AlignTop ); |
258 | 258 | ||
259 | mUseWholeBook = new QRadioButton( i18n( "&All" ), mButtonGroup ); | 259 | mUseWholeBook = new QRadioButton( i18n( "&All" ), mButtonGroup ); |
260 | mUseWholeBook->setChecked( true ); | 260 | mUseWholeBook->setChecked( true ); |
261 | QWhatsThis::add( mUseWholeBook, i18n( "Select the entire address book" ) ); | 261 | QWhatsThis::add( mUseWholeBook, i18n( "Select the entire address book" ) ); |
262 | groupLayout->addWidget( mUseWholeBook, 0, 0 ); | 262 | groupLayout->addWidget( mUseWholeBook, 0, 0 ); |
263 | 263 | ||
264 | mUseSelection = new QRadioButton( i18n( "&Selected" ), mButtonGroup ); | 264 | mUseSelection = new QRadioButton( i18n( "&Selected" ), mButtonGroup ); |
265 | QWhatsThis::add( mUseSelection, i18n( "Only contacts selected in KAddressBook.\n" | 265 | QWhatsThis::add( mUseSelection, i18n( "Only contacts selected in KAddressBook.\n" |
266 | "This option is disabled if no contacts are selected." ) ); | 266 | "This option is disabled if no contacts are selected." ) ); |
267 | groupLayout->addWidget( mUseSelection, 1, 0 ); | 267 | groupLayout->addWidget( mUseSelection, 1, 0 ); |
268 | 268 | ||
269 | mUseFilters = new QRadioButton( i18n( "By matching &filter" ), mButtonGroup ); | 269 | mUseFilters = new QRadioButton( i18n( "By matching &filter" ), mButtonGroup ); |
270 | QWhatsThis::add( mUseFilters, i18n( "Only contacts matching the selected filter.\n" | 270 | QWhatsThis::add( mUseFilters, i18n( "Only contacts matching the selected filter.\n" |
271 | "This option is disabled if you haven't defined any filters" ) ); | 271 | "This option is disabled if you haven't defined any filters" ) ); |
272 | groupLayout->addWidget( mUseFilters, 2, 0 ); | 272 | groupLayout->addWidget( mUseFilters, 2, 0 ); |
273 | 273 | ||
274 | mUseCategories = new QRadioButton( i18n( "By Cate&gories" ), mButtonGroup ); | 274 | mUseCategories = new QRadioButton( i18n( "By Cate&gories" ), mButtonGroup ); |
275 | QWhatsThis::add( mUseCategories, i18n( "Only contacts who are members of a category that is checked on the list to the left.\n" | 275 | QWhatsThis::add( mUseCategories, i18n( "Only contacts who are members of a category that is checked on the list to the left.\n" |
276 | "This option is disabled if you have no categories." ) ); | 276 | "This option is disabled if you have no categories." ) ); |
277 | groupLayout->addWidget( mUseCategories, 3, 0 ); | 277 | groupLayout->addWidget( mUseCategories, 3, 0 ); |
278 | 278 | ||
279 | mFiltersCombo = new QComboBox( false, mButtonGroup ); | 279 | mFiltersCombo = new QComboBox( false, mButtonGroup ); |
280 | mFiltersCombo->setSizePolicy(QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) ); | ||
280 | QWhatsThis::add( mFiltersCombo, i18n( "Select a filter to decide which contacts to select." ) ); | 281 | QWhatsThis::add( mFiltersCombo, i18n( "Select a filter to decide which contacts to select." ) ); |
281 | groupLayout->addWidget( mFiltersCombo, 2, 1 ); | 282 | groupLayout->addWidget( mFiltersCombo, 2, 1 ); |
282 | 283 | ||
283 | mCategoriesView = new QListView( mButtonGroup ); | 284 | mCategoriesView = new QListView( mButtonGroup ); |
284 | mCategoriesView->addColumn( "" ); | 285 | mCategoriesView->addColumn( "" ); |
285 | mCategoriesView->header()->hide(); | 286 | mCategoriesView->header()->hide(); |
286 | QWhatsThis::add( mCategoriesView, i18n( "Check the categories whose members you want to select." ) ); | 287 | QWhatsThis::add( mCategoriesView, i18n( "Check the categories whose members you want to select." ) ); |
287 | groupLayout->addWidget( mCategoriesView, 3, 1 ); | 288 | groupLayout->addWidget( mCategoriesView, 3, 1 ); |
288 | 289 | mCategoriesView->setSizePolicy(QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) ); | |
289 | if (QApplication::desktop()->height() == 480 ) | 290 | //if (QApplication::desktop()->height() == 480 ) |
290 | mCategoriesView->setMaximumHeight( 240 ); | 291 | // mCategoriesView->setMaximumHeight( 240 ); |
291 | topLayout->addWidget( mButtonGroup ); | 292 | topLayout->addWidget( mButtonGroup ); |
292 | 293 | ||
293 | QButtonGroup *sortingGroup = new QButtonGroup( i18n( "Sorting" ), page ); | 294 | QButtonGroup *sortingGroup = new QButtonGroup( i18n( "Sorting" ), page ); |
294 | sortingGroup->setColumnLayout( 0, Qt::Vertical ); | 295 | sortingGroup->setColumnLayout( 0, Qt::Vertical ); |
295 | QGridLayout *sortLayout = new QGridLayout( sortingGroup->layout(), 2, 2, | 296 | QGridLayout *sortLayout = new QGridLayout( sortingGroup->layout(), 2, 2, |
296 | KDialog::spacingHint() ); | 297 | KDialog::spacingHint() ); |
297 | sortLayout->setAlignment( Qt::AlignTop ); | 298 | sortLayout->setAlignment( Qt::AlignTop ); |
298 | 299 | ||
299 | label = new QLabel( i18n( "Criterion:" ), sortingGroup ); | 300 | label = new QLabel( i18n( "Criterion:" ), sortingGroup ); |
300 | sortLayout->addWidget( label, 0, 0 ); | 301 | sortLayout->addWidget( label, 0, 0 ); |
301 | 302 | ||
302 | #ifndef KAB_EMBEDDED | 303 | #ifndef KAB_EMBEDDED |
303 | mFieldCombo = new KComboBox( false, sortingGroup ); | 304 | mFieldCombo = new KComboBox( false, sortingGroup ); |
304 | #else //KAB_EMBEDDED | 305 | #else //KAB_EMBEDDED |
305 | //US Combobox is not editable anyway | 306 | //US Combobox is not editable anyway |
306 | mFieldCombo = new KComboBox( sortingGroup ); | 307 | mFieldCombo = new KComboBox( sortingGroup ); |
307 | #endif //KAB_EMBEDDED | 308 | #endif //KAB_EMBEDDED |
308 | sortLayout->addWidget( mFieldCombo, 0, 1 ); | 309 | sortLayout->addWidget( mFieldCombo, 0, 1 ); |
309 | 310 | ||
310 | label = new QLabel( i18n( "Order:" ), sortingGroup ); | 311 | label = new QLabel( i18n( "Order:" ), sortingGroup ); |
311 | sortLayout->addWidget( label, 1, 0 ); | 312 | sortLayout->addWidget( label, 1, 0 ); |
312 | 313 | ||
313 | #ifndef KAB_EMBEDDED | 314 | #ifndef KAB_EMBEDDED |
314 | mSortTypeCombo = new KComboBox( false, sortingGroup ); | 315 | mSortTypeCombo = new KComboBox( false, sortingGroup ); |
315 | #else //KAB_EMBEDDED | 316 | #else //KAB_EMBEDDED |
316 | //US Combobox is not editable anyway | 317 | //US Combobox is not editable anyway |
317 | mSortTypeCombo = new KComboBox( sortingGroup ); | 318 | mSortTypeCombo = new KComboBox( sortingGroup ); |
318 | #endif //KAB_EMBEDDED | 319 | #endif //KAB_EMBEDDED |
319 | sortLayout->addWidget( mSortTypeCombo, 1, 1 ); | 320 | sortLayout->addWidget( mSortTypeCombo, 1, 1 ); |
320 | 321 | ||
321 | topLayout->addWidget( sortingGroup ); | 322 | topLayout->addWidget( sortingGroup ); |
322 | 323 | ||
323 | if ( !mUseSorting ) | 324 | if ( !mUseSorting ) |
324 | sortingGroup->hide(); | 325 | sortingGroup->hide(); |
325 | #ifndef DESKTOP_VERSION | 326 | #ifndef DESKTOP_VERSION |
326 | hideButtons(); | 327 | hideButtons(); |
327 | #endif | 328 | #endif |
328 | } | 329 | } |
329 | 330 | ||
330 | #ifndef KAB_EMBEDDED | 331 | #ifndef KAB_EMBEDDED |
331 | #include "xxportselectdialog.moc" | 332 | #include "xxportselectdialog.moc" |
332 | #endif //KAB_EMBEDDED | 333 | #endif //KAB_EMBEDDED |
333 | 334 | ||
334 | 335 | ||
diff --git a/libkdepim/externalapphandler.cpp b/libkdepim/externalapphandler.cpp index 0d66a5a..0e9c5e5 100644 --- a/libkdepim/externalapphandler.cpp +++ b/libkdepim/externalapphandler.cpp | |||
@@ -1,1211 +1,1211 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkdepim. | 2 | This file is part of libkdepim. |
3 | Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 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 | 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 | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 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 | 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. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | /* | 24 | /* |
25 | Enhanced Version of the file for platform independent KDE tools. | 25 | Enhanced Version of the file for platform independent KDE tools. |
26 | Copyright (c) 2004 Ulf Schenk | 26 | Copyright (c) 2004 Ulf Schenk |
27 | 27 | ||
28 | $Id$ | 28 | $Id$ |
29 | */ | 29 | */ |
30 | #include <stdlib.h> | 30 | #include <stdlib.h> |
31 | 31 | ||
32 | #include <qfile.h> | 32 | #include <qfile.h> |
33 | #include <qmap.h> | 33 | #include <qmap.h> |
34 | #include <qregexp.h> | 34 | #include <qregexp.h> |
35 | 35 | ||
36 | #ifndef DESKTOP_VERSION | 36 | #ifndef DESKTOP_VERSION |
37 | #include <qpe/qpeapplication.h> | 37 | #include <qpe/qpeapplication.h> |
38 | #include <qtopia/qcopenvelope_qws.h> | 38 | #include <qtopia/qcopenvelope_qws.h> |
39 | #else | 39 | #else |
40 | #include <qapplication.h> | 40 | #include <qapplication.h> |
41 | #endif | 41 | #endif |
42 | 42 | ||
43 | #include <kstaticdeleter.h> | 43 | #include <kstaticdeleter.h> |
44 | #include <kmessagebox.h> | 44 | #include <kmessagebox.h> |
45 | 45 | ||
46 | 46 | ||
47 | #include "externalapphandler.h" | 47 | #include "externalapphandler.h" |
48 | 48 | ||
49 | #include "kpimglobalprefs.h" | 49 | #include "kpimglobalprefs.h" |
50 | 50 | ||
51 | //uncomment line to get debug output | 51 | //uncomment line to get debug output |
52 | //#define DEBUG_EXT_APP_HANDLER | 52 | //#define DEBUG_EXT_APP_HANDLER |
53 | 53 | ||
54 | /********************************************************************************* | 54 | /********************************************************************************* |
55 | * | 55 | * |
56 | ********************************************************************************/ | 56 | ********************************************************************************/ |
57 | 57 | ||
58 | 58 | ||
59 | QCopTransferItem::QCopTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage) | 59 | QCopTransferItem::QCopTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage) |
60 | : _usedSourceParameters(usedSourceParameters), _sourceMessage(sourceMessage), _targetChannel(targetChannel), _targetMessage(targetMessage) | 60 | : _usedSourceParameters(usedSourceParameters), _sourceMessage(sourceMessage), _targetChannel(targetChannel), _targetMessage(targetMessage) |
61 | { | 61 | { |
62 | //sourceMessage passes later three parameters: sourceChannel, uid, param1 | 62 | //sourceMessage passes later three parameters: sourceChannel, uid, param1 |
63 | if (_usedSourceParameters == 0) | 63 | if (_usedSourceParameters == 0) |
64 | _sourceMessageParameters = "QString,QString)"; | 64 | _sourceMessageParameters = "QString,QString)"; |
65 | else if (_usedSourceParameters == 1) | 65 | else if (_usedSourceParameters == 1) |
66 | _sourceMessageParameters = "(QString,QString,QString)"; | 66 | _sourceMessageParameters = "(QString,QString,QString)"; |
67 | else if (_usedSourceParameters == 2) | 67 | else if (_usedSourceParameters == 2) |
68 | _sourceMessageParameters = "(QString,QString,QString,QString)"; | 68 | _sourceMessageParameters = "(QString,QString,QString,QString)"; |
69 | else if (_usedSourceParameters == 3) | 69 | else if (_usedSourceParameters == 3) |
70 | _sourceMessageParameters = "(QString,QString,QString,QString,QString)"; | 70 | _sourceMessageParameters = "(QString,QString,QString,QString,QString)"; |
71 | } | 71 | } |
72 | 72 | ||
73 | /*********************************************************************************/ | 73 | /*********************************************************************************/ |
74 | 74 | ||
75 | QCopTransferItem::QCopTransferItem() | 75 | QCopTransferItem::QCopTransferItem() |
76 | { | 76 | { |
77 | } | 77 | } |
78 | 78 | ||
79 | /*********************************************************************************/ | 79 | /*********************************************************************************/ |
80 | bool QCopTransferItem::sendMessageToTarget(const QString& uid, const QString& param1, const QString& param2, const QString& param3) | 80 | bool QCopTransferItem::sendMessageToTarget(const QString& uid, const QString& param1, const QString& param2, const QString& param3) |
81 | { | 81 | { |
82 | 82 | ||
83 | #ifndef DESKTOP_VERSION | 83 | #ifndef DESKTOP_VERSION |
84 | //sourceMessage passes two parameters: sourceChannel, uid | 84 | //sourceMessage passes two parameters: sourceChannel, uid |
85 | QString sourceMessage = _sourceMessage + _sourceMessageParameters; | 85 | QString sourceMessage = _sourceMessage + _sourceMessageParameters; |
86 | #ifdef DEBUG_EXT_APP_HANDLER | 86 | #ifdef DEBUG_EXT_APP_HANDLER |
87 | qDebug("1Using QCopEnvelope e(\"%s\",\"%s\")", _targetChannel.latin1(), sourceMessage.latin1()); | 87 | qDebug("1Using QCopEnvelope e(\"%s\",\"%s\")", _targetChannel.latin1(), sourceMessage.latin1()); |
88 | qDebug("passing sourcechannel(%s), uid(%s), param1(%s), param2(%s), param3(%s) as parameter to QCopEnvelope", _sourceChannel.latin1(), uid.latin1(), param1.latin1(), param2.latin1(), param3.latin1()); | 88 | qDebug("passing sourcechannel(%s), uid(%s), param1(%s), param2(%s), param3(%s) as parameter to QCopEnvelope", _sourceChannel.latin1(), uid.latin1(), param1.latin1(), param2.latin1(), param3.latin1()); |
89 | #endif | 89 | #endif |
90 | 90 | ||
91 | QCopEnvelope e(_targetChannel.latin1(), sourceMessage.latin1()); | 91 | QCopEnvelope e(_targetChannel.latin1(), sourceMessage.latin1()); |
92 | 92 | ||
93 | e << _sourceChannel << uid; | 93 | e << _sourceChannel << uid; |
94 | 94 | ||
95 | if (_usedSourceParameters == 1) | 95 | if (_usedSourceParameters == 1) |
96 | e << param1; | 96 | e << param1; |
97 | else if (_usedSourceParameters == 2) | 97 | else if (_usedSourceParameters == 2) |
98 | e << param1 << param2; | 98 | e << param1 << param2; |
99 | else if (_usedSourceParameters == 3) | 99 | else if (_usedSourceParameters == 3) |
100 | e << param1 << param2 << param3; | 100 | e << param1 << param2 << param3; |
101 | 101 | ||
102 | qApp->processEvents(); | 102 | qApp->processEvents(); |
103 | 103 | ||
104 | return true; | 104 | return true; |
105 | 105 | ||
106 | #else | 106 | #else |
107 | KMessageBox::sorry( 0, i18n( "This version does not support QCop." ) ); | 107 | KMessageBox::sorry( 0, i18n( "This version does not support QCop." ) ); |
108 | return false; | 108 | return false; |
109 | #endif | 109 | #endif |
110 | 110 | ||
111 | } | 111 | } |
112 | 112 | ||
113 | 113 | ||
114 | /*********************************************************************************/ | 114 | /*********************************************************************************/ |
115 | void QCopTransferItem::setSourceChannel(const QString& sourceChannel) | 115 | void QCopTransferItem::setSourceChannel(const QString& sourceChannel) |
116 | { | 116 | { |
117 | 117 | ||
118 | if ( !sourceChannel.isEmpty()) | 118 | if ( !sourceChannel.isEmpty()) |
119 | _sourceChannel = sourceChannel; | 119 | _sourceChannel = sourceChannel; |
120 | } | 120 | } |
121 | 121 | ||
122 | 122 | ||
123 | /*********************************************************************************/ | 123 | /*********************************************************************************/ |
124 | bool QCopTransferItem::appMessage( const QCString& cmsg, const QByteArray& data ) | 124 | bool QCopTransferItem::appMessage( const QCString& cmsg, const QByteArray& data ) |
125 | { | 125 | { |
126 | 126 | ||
127 | // copied from old mail2 | 127 | // copied from old mail2 |
128 | /* | 128 | /* |
129 | static int ii = 0; | 129 | static int ii = 0; |
130 | 130 | ||
131 | // block second call | 131 | // block second call |
132 | if ( ii < 2 ) { | 132 | if ( ii < 2 ) { |
133 | ++ii; | 133 | ++ii; |
134 | if ( ii > 1 ) { | 134 | if ( ii > 1 ) { |
135 | qDebug("qcop call blocked "); | 135 | qDebug("qcop call blocked "); |
136 | return true; | 136 | return true; |
137 | } | 137 | } |
138 | } | 138 | } |
139 | */ | 139 | */ |
140 | 140 | ||
141 | // qDebug("QCopTransferItem- QCOP message received: %s ", cmsg.data() ); | 141 | // qDebug("QCopTransferItem- QCOP message received: %s ", cmsg.data() ); |
142 | 142 | ||
143 | //we are in the target and get a request from the source | 143 | //we are in the target and get a request from the source |
144 | if ( (_sourceMessage + _sourceMessageParameters) == cmsg.data()) | 144 | if ( (_sourceMessage + _sourceMessageParameters) == cmsg.data()) |
145 | { | 145 | { |
146 | 146 | ||
147 | QDataStream stream( data, IO_ReadOnly ); | 147 | QDataStream stream( data, IO_ReadOnly ); |
148 | 148 | ||
149 | 149 | ||
150 | QString sourceChannel; | 150 | QString sourceChannel; |
151 | QString uid; | 151 | QString uid; |
152 | QString param1; | 152 | QString param1; |
153 | QString param2; | 153 | QString param2; |
154 | QString param3; | 154 | QString param3; |
155 | 155 | ||
156 | stream >> sourceChannel >> uid; | 156 | stream >> sourceChannel >> uid; |
157 | 157 | ||
158 | if (_usedSourceParameters == 0) | 158 | if (_usedSourceParameters == 0) |
159 | { | 159 | { |
160 | emit receivedMessageFromSource(sourceChannel, uid); | 160 | emit receivedMessageFromSource(sourceChannel, uid); |
161 | } | 161 | } |
162 | else if (_usedSourceParameters == 1) | 162 | else if (_usedSourceParameters == 1) |
163 | { | 163 | { |
164 | stream >> param1; | 164 | stream >> param1; |
165 | emit receivedMessageFromSource(sourceChannel, uid, param1); | 165 | emit receivedMessageFromSource(sourceChannel, uid, param1); |
166 | } | 166 | } |
167 | else if (_usedSourceParameters == 2) | 167 | else if (_usedSourceParameters == 2) |
168 | { | 168 | { |
169 | stream >> param1 >> param2; | 169 | stream >> param1 >> param2; |
170 | emit receivedMessageFromSource(sourceChannel, uid, param1, param2); | 170 | emit receivedMessageFromSource(sourceChannel, uid, param1, param2); |
171 | } | 171 | } |
172 | else if (_usedSourceParameters == 3) | 172 | else if (_usedSourceParameters == 3) |
173 | { | 173 | { |
174 | stream >> param1 >> param2 >> param3; | 174 | stream >> param1 >> param2 >> param3; |
175 | emit receivedMessageFromSource(sourceChannel, uid, param1, param2, param3); | 175 | emit receivedMessageFromSource(sourceChannel, uid, param1, param2, param3); |
176 | } | 176 | } |
177 | 177 | ||
178 | return true; | 178 | return true; |
179 | } | 179 | } |
180 | 180 | ||
181 | return false; | 181 | return false; |
182 | } | 182 | } |
183 | 183 | ||
184 | 184 | ||
185 | /********************************************************************************* | 185 | /********************************************************************************* |
186 | * | 186 | * |
187 | ********************************************************************************/ | 187 | ********************************************************************************/ |
188 | 188 | ||
189 | 189 | ||
190 | QCopMapTransferItem::QCopMapTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage) | 190 | QCopMapTransferItem::QCopMapTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage) |
191 | : QCopTransferItem(usedSourceParameters, sourceMessage, targetChannel,targetMessage) | 191 | : QCopTransferItem(usedSourceParameters, sourceMessage, targetChannel,targetMessage) |
192 | { | 192 | { |
193 | //targetMessage returns later two parameters: uid, and map<qstring,qstring> | 193 | //targetMessage returns later two parameters: uid, and map<qstring,qstring> |
194 | _targetMessageParameters = "(QString,QMAP<QString,QString>)"; | 194 | _targetMessageParameters = "(QString,QMAP<QString,QString>)"; |
195 | } | 195 | } |
196 | 196 | ||
197 | /*********************************************************************************/ | 197 | /*********************************************************************************/ |
198 | bool QCopMapTransferItem::sendMessageToSource(const QString& uid, const QMap<QString,QString>& nameEmailMap) | 198 | bool QCopMapTransferItem::sendMessageToSource(const QString& uid, const QMap<QString,QString>& nameEmailMap) |
199 | { | 199 | { |
200 | #ifndef DESKTOP_VERSION | 200 | #ifndef DESKTOP_VERSION |
201 | //targetMessage passes two parameters: uid, map | 201 | //targetMessage passes two parameters: uid, map |
202 | QString targetMessage = _targetMessage + _targetMessageParameters; | 202 | QString targetMessage = _targetMessage + _targetMessageParameters; |
203 | 203 | ||
204 | #ifdef DEBUG_EXT_APP_HANDLER | 204 | #ifdef DEBUG_EXT_APP_HANDLER |
205 | qDebug("2Using QCopEnvelope e(\"%s\",\"%s\")", _sourceChannel.latin1(), targetMessage.latin1()); | 205 | qDebug("2Using QCopEnvelope e(\"%s\",\"%s\")", _sourceChannel.latin1(), targetMessage.latin1()); |
206 | qDebug("passing uid(%s) and map as parameter to QCopEnvelope", uid.latin1()); | 206 | qDebug("passing uid(%s) and map as parameter to QCopEnvelope", uid.latin1()); |
207 | #endif | 207 | #endif |
208 | 208 | ||
209 | QCopEnvelope e(_sourceChannel.latin1(), targetMessage.latin1()); | 209 | QCopEnvelope e(_sourceChannel.latin1(), targetMessage.latin1()); |
210 | //US we need no names in the To field. The emailadresses are enough | 210 | //US we need no names in the To field. The emailadresses are enough |
211 | 211 | ||
212 | e << uid << nameEmailMap; | 212 | e << uid << nameEmailMap; |
213 | 213 | ||
214 | qApp->processEvents(); | 214 | qApp->processEvents(); |
215 | 215 | ||
216 | return true; | 216 | return true; |
217 | 217 | ||
218 | #else | 218 | #else |
219 | KMessageBox::sorry( 0, i18n( "This version does not support QCop." ) ); | 219 | KMessageBox::sorry( 0, i18n( "This version does not support QCop." ) ); |
220 | return false; | 220 | return false; |
221 | #endif | 221 | #endif |
222 | 222 | ||
223 | } | 223 | } |
224 | 224 | ||
225 | 225 | ||
226 | /*********************************************************************************/ | 226 | /*********************************************************************************/ |
227 | bool QCopMapTransferItem::appMessage( const QCString& cmsg, const QByteArray& data ) | 227 | bool QCopMapTransferItem::appMessage( const QCString& cmsg, const QByteArray& data ) |
228 | { | 228 | { |
229 | bool res = QCopTransferItem::appMessage( cmsg, data ); | 229 | bool res = QCopTransferItem::appMessage( cmsg, data ); |
230 | 230 | ||
231 | if (res == false) | 231 | if (res == false) |
232 | { | 232 | { |
233 | QDataStream stream( data, IO_ReadOnly ); | 233 | QDataStream stream( data, IO_ReadOnly ); |
234 | 234 | ||
235 | // qDebug("QCopMapTransferItem- QCOP message received: %s ", cmsg.data() ); | 235 | // qDebug("QCopMapTransferItem- QCOP message received: %s ", cmsg.data() ); |
236 | 236 | ||
237 | //we are in the source and get an answer from the target | 237 | //we are in the source and get an answer from the target |
238 | if ((_targetMessage + _targetMessageParameters) == cmsg.data()) | 238 | if ((_targetMessage + _targetMessageParameters) == cmsg.data()) |
239 | { | 239 | { |
240 | QMap<QString,QString> adrMap; | 240 | QMap<QString,QString> adrMap; |
241 | QString uid; | 241 | QString uid; |
242 | 242 | ||
243 | stream >> uid >> adrMap; | 243 | stream >> uid >> adrMap; |
244 | 244 | ||
245 | emit receivedMessageFromTarget(uid, adrMap); | 245 | emit receivedMessageFromTarget(uid, adrMap); |
246 | 246 | ||
247 | 247 | ||
248 | return true; | 248 | return true; |
249 | } | 249 | } |
250 | } | 250 | } |
251 | 251 | ||
252 | return false; | 252 | return false; |
253 | } | 253 | } |
254 | 254 | ||
255 | 255 | ||
256 | /********************************************************************************* | 256 | /********************************************************************************* |
257 | * | 257 | * |
258 | ********************************************************************************/ | 258 | ********************************************************************************/ |
259 | 259 | ||
260 | QCopListTransferItem::~QCopListTransferItem() | 260 | QCopListTransferItem::~QCopListTransferItem() |
261 | { | 261 | { |
262 | 262 | ||
263 | } | 263 | } |
264 | 264 | ||
265 | QCopListTransferItem::QCopListTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage) | 265 | QCopListTransferItem::QCopListTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage) |
266 | : QCopTransferItem(usedSourceParameters, sourceMessage, targetChannel,targetMessage) | 266 | : QCopTransferItem(usedSourceParameters, sourceMessage, targetChannel,targetMessage) |
267 | { | 267 | { |
268 | //targetMessage returns later two parameters: uid, and three lists | 268 | //targetMessage returns later two parameters: uid, and three lists |
269 | _targetMessageParameters = "(QString,QStringList,QStringList,QStringList,QStringList,QStringList,QStringList)"; | 269 | _targetMessageParameters = "(QString,QStringList,QStringList,QStringList,QStringList,QStringList,QStringList)"; |
270 | } | 270 | } |
271 | 271 | ||
272 | /*********************************************************************************/ | 272 | /*********************************************************************************/ |
273 | bool QCopListTransferItem::sendMessageToSource(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3, const QStringList& list4, const QStringList& list5, const QStringList& list6) | 273 | bool QCopListTransferItem::sendMessageToSource(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3, const QStringList& list4, const QStringList& list5, const QStringList& list6) |
274 | { | 274 | { |
275 | #ifndef DESKTOP_VERSION | 275 | #ifndef DESKTOP_VERSION |
276 | //targetMessage passes two parameters: uid, map | 276 | //targetMessage passes two parameters: uid, map |
277 | QString targetMessage = _targetMessage + _targetMessageParameters; | 277 | QString targetMessage = _targetMessage + _targetMessageParameters; |
278 | 278 | ||
279 | #ifdef DEBUG_EXT_APP_HANDLER | 279 | #ifdef DEBUG_EXT_APP_HANDLER |
280 | qDebug("3Using QCopEnvelope e(\"%s\",\"%s\")", _sourceChannel.latin1(), targetMessage.latin1()); | 280 | qDebug("3Using QCopEnvelope e(\"%s\",\"%s\")", _sourceChannel.latin1(), targetMessage.latin1()); |
281 | qDebug("passing uid(%s) and list1, list2, list3, list4, list5, list6 as parameter to QCopEnvelope", uid.latin1()); | 281 | qDebug("passing uid(%s) and list1, list2, list3, list4, list5, list6 as parameter to QCopEnvelope", uid.latin1()); |
282 | 282 | ||
283 | 283 | ||
284 | for ( int i = 0; i < list3.count(); i++) | 284 | for ( int i = 0; i < list3.count(); i++) |
285 | qDebug("listentry list3: %s",list3[i].latin1()); | 285 | qDebug("listentry list3: %s",list3[i].latin1()); |
286 | #endif | 286 | #endif |
287 | 287 | ||
288 | QCopEnvelope e(_sourceChannel.latin1(), targetMessage.latin1()); | 288 | QCopEnvelope e(_sourceChannel.latin1(), targetMessage.latin1()); |
289 | //US we need no names in the To field. The emailadresses are enough | 289 | //US we need no names in the To field. The emailadresses are enough |
290 | 290 | ||
291 | e << uid << list1 << list2 << list3 << list4 << list5 << list6; | 291 | e << uid << list1 << list2 << list3 << list4 << list5 << list6; |
292 | 292 | ||
293 | qApp->processEvents(); | 293 | qApp->processEvents(); |
294 | 294 | ||
295 | return true; | 295 | return true; |
296 | 296 | ||
297 | #else | 297 | #else |
298 | KMessageBox::sorry( 0, i18n( "This version does not support QCop." ) ); | 298 | KMessageBox::sorry( 0, i18n( "This version does not support QCop." ) ); |
299 | return false; | 299 | return false; |
300 | #endif | 300 | #endif |
301 | 301 | ||
302 | } | 302 | } |
303 | 303 | ||
304 | 304 | ||
305 | /*********************************************************************************/ | 305 | /*********************************************************************************/ |
306 | bool QCopListTransferItem::appMessage( const QCString& cmsg, const QByteArray& data ) | 306 | bool QCopListTransferItem::appMessage( const QCString& cmsg, const QByteArray& data ) |
307 | { | 307 | { |
308 | bool res = QCopTransferItem::appMessage( cmsg, data ); | 308 | bool res = QCopTransferItem::appMessage( cmsg, data ); |
309 | #ifdef DEBUG_EXT_APP_HANDLER | 309 | #ifdef DEBUG_EXT_APP_HANDLER |
310 | qDebug("1QCopListTransferItem- QCOP message received: %s ", cmsg.data() ); | 310 | qDebug("1QCopListTransferItem- QCOP message received: %s ", cmsg.data() ); |
311 | #endif | 311 | #endif |
312 | 312 | ||
313 | if (res == false) | 313 | if (res == false) |
314 | { | 314 | { |
315 | QDataStream stream( data, IO_ReadOnly ); | 315 | QDataStream stream( data, IO_ReadOnly ); |
316 | 316 | ||
317 | #ifdef DEBUG_EXT_APP_HANDLER | 317 | #ifdef DEBUG_EXT_APP_HANDLER |
318 | qDebug("2QCopListTransferItem- QCOP message received: %s ", cmsg.data() ); | 318 | qDebug("2QCopListTransferItem- QCOP message received: %s ", cmsg.data() ); |
319 | #endif | 319 | #endif |
320 | 320 | ||
321 | //we are in the source and get an answer from the target | 321 | //we are in the source and get an answer from the target |
322 | if ((_targetMessage + _targetMessageParameters) == cmsg.data()) | 322 | if ((_targetMessage + _targetMessageParameters) == cmsg.data()) |
323 | { | 323 | { |
324 | QStringList list1; | 324 | QStringList list1; |
325 | QStringList list2; | 325 | QStringList list2; |
326 | QStringList list3; | 326 | QStringList list3; |
327 | QStringList list4; | 327 | QStringList list4; |
328 | QStringList list5; | 328 | QStringList list5; |
329 | QStringList list6; | 329 | QStringList list6; |
330 | QString uid; | 330 | QString uid; |
331 | 331 | ||
332 | #ifdef DEBUG_EXT_APP_HANDLER | 332 | #ifdef DEBUG_EXT_APP_HANDLER |
333 | qDebug("3QCopListTransferItem- QCOP message received: %s ", cmsg.data() ); | 333 | qDebug("3QCopListTransferItem- QCOP message received: %s ", cmsg.data() ); |
334 | #endif | 334 | #endif |
335 | 335 | ||
336 | stream >> uid >> list1 >> list2 >> list3 >> list4 >> list5 >> list6; | 336 | stream >> uid >> list1 >> list2 >> list3 >> list4 >> list5 >> list6; |
337 | emit receivedMessageFromTarget(uid, list1, list2, list3, list4, list5, list6); | 337 | emit receivedMessageFromTarget(uid, list1, list2, list3, list4, list5, list6); |
338 | 338 | ||
339 | 339 | ||
340 | return true; | 340 | return true; |
341 | } | 341 | } |
342 | } | 342 | } |
343 | 343 | ||
344 | return false; | 344 | return false; |
345 | } | 345 | } |
346 | 346 | ||
347 | 347 | ||
348 | 348 | ||
349 | /********************************************************************************* | 349 | /********************************************************************************* |
350 | * | 350 | * |
351 | ********************************************************************************/ | 351 | ********************************************************************************/ |
352 | 352 | ||
353 | 353 | ||
354 | ExternalAppHandler *ExternalAppHandler::sInstance = 0; | 354 | ExternalAppHandler *ExternalAppHandler::sInstance = 0; |
355 | static KStaticDeleter<ExternalAppHandler> staticDeleter; | 355 | static KStaticDeleter<ExternalAppHandler> staticDeleter; |
356 | 356 | ||
357 | ExternalAppHandler::ExternalAppHandler() | 357 | ExternalAppHandler::ExternalAppHandler() |
358 | { | 358 | { |
359 | mDefaultItems.setAutoDelete(true); | 359 | mDefaultItems.setAutoDelete(true); |
360 | 360 | ||
361 | mNameEmailUidListFromKAPITransfer = new QCopListTransferItem(0, "requestNameEmailUIDListFromKAPI", "QPE/Application/kapi", "receiveNameEmailUIDList"); | 361 | mNameEmailUidListFromKAPITransfer = new QCopListTransferItem(0, "requestNameEmailUIDListFromKAPI", "QPE/Application/kapi", "receiveNameEmailUIDList"); |
362 | connect(mNameEmailUidListFromKAPITransfer, SIGNAL (receivedMessageFromSource(const QString&, const QString&)), this, SIGNAL (requestForNameEmailUidList(const QString&, const QString&))); | 362 | connect(mNameEmailUidListFromKAPITransfer, SIGNAL (receivedMessageFromSource(const QString&, const QString&)), this, SIGNAL (requestForNameEmailUidList(const QString&, const QString&))); |
363 | connect(mNameEmailUidListFromKAPITransfer, SIGNAL (receivedMessageFromTarget(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), this, SLOT (receivedNameEmailUidList_Slot(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); | 363 | connect(mNameEmailUidListFromKAPITransfer, SIGNAL (receivedMessageFromTarget(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), this, SLOT (receivedNameEmailUidList_Slot(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); |
364 | 364 | ||
365 | //US mFindByEmailFromKAPITransfer = new QCopListTransferItem(1, "requestFindByEmailFromKAPI", "QPE/Application/kapi", "receiveFindByEmailNameEmailUIDList"); | 365 | //US mFindByEmailFromKAPITransfer = new QCopListTransferItem(1, "requestFindByEmailFromKAPI", "QPE/Application/kapi", "receiveFindByEmailNameEmailUIDList"); |
366 | //US connect(mFindByEmailFromKAPITransfer, SIGNAL (receivedMessageFromSource(const QString&, const QString&, const QString&)), this, SIGNAL (requestForFindByEmail(const QString&, const QString&, const QString&))); | 366 | //US connect(mFindByEmailFromKAPITransfer, SIGNAL (receivedMessageFromSource(const QString&, const QString&, const QString&)), this, SIGNAL (requestForFindByEmail(const QString&, const QString&, const QString&))); |
367 | //US connect(mFindByEmailFromKAPITransfer, SIGNAL (receivedMessageFromTarget(const QString&, const QStringList&, const QStringList&, const QStringList&)), this, SIGNAL (receivedFindByEmailEvent(const QString&, const QStringList&, const QStringList&, const QStringList&))); | 367 | //US connect(mFindByEmailFromKAPITransfer, SIGNAL (receivedMessageFromTarget(const QString&, const QStringList&, const QStringList&, const QStringList&)), this, SIGNAL (receivedFindByEmailEvent(const QString&, const QStringList&, const QStringList&, const QStringList&))); |
368 | 368 | ||
369 | mDisplayDetails = new QCopListTransferItem(3, "requestDisplayDetailsFromKAPI", "QPE/Application/kapi", ""); | 369 | mDisplayDetails = new QCopListTransferItem(3, "requestDisplayDetailsFromKAPI", "QPE/Application/kapi", ""); |
370 | connect(mDisplayDetails, SIGNAL (receivedMessageFromSource(const QString&, const QString&, const QString&, const QString&, const QString&)), this, SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&))); | 370 | connect(mDisplayDetails, SIGNAL (receivedMessageFromSource(const QString&, const QString&, const QString&, const QString&, const QString&)), this, SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&))); |
371 | 371 | ||
372 | 372 | ||
373 | 373 | ||
374 | mBirthdayListFromKAPITransfer = new QCopListTransferItem(0, "requestBirthdayListFromKAPI", "QPE/Application/kapi", "receiveBirthdayList"); | 374 | mBirthdayListFromKAPITransfer = new QCopListTransferItem(0, "requestBirthdayListFromKAPI", "QPE/Application/kapi", "receiveBirthdayList"); |
375 | connect(mBirthdayListFromKAPITransfer, SIGNAL (receivedMessageFromSource(const QString&, const QString&)), this, SIGNAL (requestForBirthdayList(const QString&, const QString&))); | 375 | connect(mBirthdayListFromKAPITransfer, SIGNAL (receivedMessageFromSource(const QString&, const QString&)), this, SIGNAL (requestForBirthdayList(const QString&, const QString&))); |
376 | connect(mBirthdayListFromKAPITransfer, SIGNAL (receivedMessageFromTarget(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), this, SIGNAL (receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); | 376 | connect(mBirthdayListFromKAPITransfer, SIGNAL (receivedMessageFromTarget(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), this, SIGNAL (receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); |
377 | 377 | ||
378 | 378 | ||
379 | } | 379 | } |
380 | 380 | ||
381 | ExternalAppHandler::~ExternalAppHandler() | 381 | ExternalAppHandler::~ExternalAppHandler() |
382 | { | 382 | { |
383 | delete mNameEmailUidListFromKAPITransfer; | 383 | delete mNameEmailUidListFromKAPITransfer; |
384 | //delete mFindByEmailFromKAPITransfer; | 384 | //delete mFindByEmailFromKAPITransfer; |
385 | delete mDisplayDetails; | 385 | delete mDisplayDetails; |
386 | delete mBirthdayListFromKAPITransfer; | 386 | delete mBirthdayListFromKAPITransfer; |
387 | } | 387 | } |
388 | 388 | ||
389 | void ExternalAppHandler::receivedNameEmailUidList_Slot(const QString& uid, | 389 | void ExternalAppHandler::receivedNameEmailUidList_Slot(const QString& uid, |
390 | const QStringList& nameList, | 390 | const QStringList& nameList, |
391 | const QStringList& emailList, | 391 | const QStringList& emailList, |
392 | const QStringList& uidList, | 392 | const QStringList& uidList, |
393 | const QStringList&, | 393 | const QStringList&, |
394 | const QStringList&, | 394 | const QStringList&, |
395 | const QStringList& ) | 395 | const QStringList& ) |
396 | { | 396 | { |
397 | // this method is a conevnient way to reduce the number of parameters I have to pass | 397 | // this method is a conevnient way to reduce the number of parameters I have to pass |
398 | emit receivedNameEmailUidListEvent(uid, nameList, emailList, uidList); | 398 | emit receivedNameEmailUidListEvent(uid, nameList, emailList, uidList); |
399 | } | 399 | } |
400 | 400 | ||
401 | 401 | ||
402 | void ExternalAppHandler::loadConfig() | 402 | void ExternalAppHandler::loadConfig() |
403 | { | 403 | { |
404 | 404 | ||
405 | mDefaultItems.clear(); | 405 | mDefaultItems.clear(); |
406 | mEmailAppAvailable = UNDEFINED; | 406 | mEmailAppAvailable = UNDEFINED; |
407 | mPhoneAppAvailable = UNDEFINED; | 407 | mPhoneAppAvailable = UNDEFINED; |
408 | mFaxAppAvailable = UNDEFINED; | 408 | mFaxAppAvailable = UNDEFINED; |
409 | mSMSAppAvailable = UNDEFINED; | 409 | mSMSAppAvailable = UNDEFINED; |
410 | mPagerAppAvailable = UNDEFINED; | 410 | mPagerAppAvailable = UNDEFINED; |
411 | mSIPAppAvailable = UNDEFINED; | 411 | mSIPAppAvailable = UNDEFINED; |
412 | 412 | ||
413 | QString opiepath = QString::fromLatin1( getenv("OPIEDIR") ); | 413 | QString opiepath = QString::fromLatin1( getenv("OPIEDIR") ); |
414 | QString qtopiapath = QString::fromLatin1( getenv("QPEDIR") ); | 414 | QString qtopiapath = QString::fromLatin1( getenv("QPEDIR") ); |
415 | QString qtpath = QString::fromLatin1( getenv("QTDIR") ); | 415 | QString qtpath = QString::fromLatin1( getenv("QTDIR") ); |
416 | 416 | ||
417 | //if qtopiapath is not set, fallback to qt | 417 | //if qtopiapath is not set, fallback to qt |
418 | if (qtopiapath.isEmpty()) | 418 | if (qtopiapath.isEmpty()) |
419 | qtopiapath = qtpath; | 419 | qtopiapath = qtpath; |
420 | 420 | ||
421 | //if opiepath is not set, fallback to qtopia | 421 | //if opiepath is not set, fallback to qtopia |
422 | if (opiepath.isEmpty()) | 422 | if (opiepath.isEmpty()) |
423 | opiepath = qtopiapath; | 423 | opiepath = qtopiapath; |
424 | 424 | ||
425 | 425 | ||
426 | 426 | ||
427 | //mailclients | 427 | //mailclients |
428 | QString mailmsg1 = "writeMail(QString,QString)"; | 428 | QString mailmsg1 = "writeMail(QString,QString)"; |
429 | QString mailmsg2 = "writeMail(QMap(QString,QString))"; | 429 | QString mailmsg2 = "writeMail(QMap(QString,QString))"; |
430 | 430 | ||
431 | QString undefined = ""; | 431 | QString undefined = ""; |
432 | 432 | ||
433 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::NONE_EMC, "No email client installed", undefined, undefined, undefined, undefined, undefined); | 433 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::NONE_EMC, "No email client installed", undefined, undefined, undefined, undefined, undefined); |
434 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OTHER_EMC, "Userdefined email client", undefined, undefined, undefined, undefined, undefined); | 434 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OTHER_EMC, "Userdefined email client", undefined, undefined, undefined, undefined, undefined); |
435 | 435 | ||
436 | if (( QFile::exists( qtopiapath + "/bin/ompi" )) || | 436 | if (( QFile::exists( qtopiapath + "/bin/ompi" )) || |
437 | ( QFile::exists( opiepath + "/bin/ompi" )) || | 437 | ( QFile::exists( opiepath + "/bin/ompi" )) || |
438 | ( QFile::exists( qtpath + "/bin/ompi" ))) | 438 | ( QFile::exists( qtpath + "/bin/ompi" ))) |
439 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OMPI_EMC, "OM/Pi email client", "QPE/Application/ompi", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); | 439 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OMPI_EMC, "OM/Pi email client", "QPE/Application/ompi", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); |
440 | 440 | ||
441 | if (( QFile::exists( qtopiapath + "/bin/qtmail" )) || | 441 | if (( QFile::exists( qtopiapath + "/bin/qtmail" )) || |
442 | ( QFile::exists( qtpath + "/bin/qtmail" ))) | 442 | ( QFile::exists( qtpath + "/bin/qtmail" ))) |
443 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::QTOPIA_EMC, "Qtopia email client", "QPE/Application/qtmail", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); | 443 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::QTOPIA_EMC, "Qtopia email client", "QPE/Application/qtmail", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); |
444 | 444 | ||
445 | if ( QFile::exists( opiepath + "/bin/opiemail" )) | 445 | if ( QFile::exists( opiepath + "/bin/opiemail" )) |
446 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OPIE_EMC, "Opie email client", "QPE/Application/opiemail", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); | 446 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OPIE_EMC, "Opie email client", "QPE/Application/opiemail", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); |
447 | 447 | ||
448 | if ( QFile::exists( opiepath + "/bin/mailit" )) | 448 | if ( QFile::exists( opiepath + "/bin/mailit" )) |
449 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OPIE_MAILIT_EMC, "Opie mailit email client", "QPE/Application/mailit", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); | 449 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OPIE_MAILIT_EMC, "Opie mailit email client", "QPE/Application/mailit", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); |
450 | 450 | ||
451 | 451 | ||
452 | 452 | ||
453 | //phoneclients | 453 | //phoneclients |
454 | 454 | ||
455 | addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::NONE_PHC, "No phone client installed", undefined, undefined, undefined, undefined, undefined); | 455 | addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::NONE_PHC, "No phone client installed", undefined, undefined, undefined, undefined, undefined); |
456 | addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::OTHER_PHC, "Other phone client", undefined, undefined, undefined, undefined, undefined); | 456 | addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::OTHER_PHC, "Other phone client", undefined, undefined, undefined, undefined, undefined); |
457 | if (( QFile::exists( qtopiapath + "/bin/kppi" )) || | 457 | if (( QFile::exists( qtopiapath + "/bin/kppi" )) || |
458 | ( QFile::exists( opiepath + "/bin/kppi" ))) | 458 | ( QFile::exists( opiepath + "/bin/kppi" ))) |
459 | addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::KPPI_PHC, "KP/Pi phone client", "QPE/Application/kppi", "-ring:%1", "", undefined, undefined); | 459 | addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::KPPI_PHC, "KP/Pi phone client", "QPE/Application/kppi", "-ring:%1", "", undefined, undefined); |
460 | 460 | ||
461 | //faxclients | 461 | //faxclients |
462 | addDefaultAppItem(ExternalAppHandler::FAX, KPimGlobalPrefs::NONE_FAC, "No fax client installed", undefined, undefined, undefined, undefined, undefined); | 462 | addDefaultAppItem(ExternalAppHandler::FAX, KPimGlobalPrefs::NONE_FAC, "No fax client installed", undefined, undefined, undefined, undefined, undefined); |
463 | addDefaultAppItem(ExternalAppHandler::FAX, KPimGlobalPrefs::OTHER_FAC, "Other fax client", undefined, undefined, undefined, undefined, undefined); | 463 | addDefaultAppItem(ExternalAppHandler::FAX, KPimGlobalPrefs::OTHER_FAC, "Other fax client", undefined, undefined, undefined, undefined, undefined); |
464 | 464 | ||
465 | //smsclients | 465 | //smsclients |
466 | addDefaultAppItem(ExternalAppHandler::SMS, KPimGlobalPrefs::NONE_SMC, "No sms client installed", undefined, undefined, undefined, undefined, undefined); | 466 | addDefaultAppItem(ExternalAppHandler::SMS, KPimGlobalPrefs::NONE_SMC, "No sms client installed", undefined, undefined, undefined, undefined, undefined); |
467 | addDefaultAppItem(ExternalAppHandler::SMS, KPimGlobalPrefs::OTHER_SMC, "Other sms client", undefined, undefined, undefined, undefined, undefined); | 467 | addDefaultAppItem(ExternalAppHandler::SMS, KPimGlobalPrefs::OTHER_SMC, "Other sms client", undefined, undefined, undefined, undefined, undefined); |
468 | 468 | ||
469 | //pagerclients | 469 | //pagerclients |
470 | addDefaultAppItem(ExternalAppHandler::PAGER, KPimGlobalPrefs::NONE_PAC, "No pager client installed", undefined, undefined, undefined, undefined, undefined); | 470 | addDefaultAppItem(ExternalAppHandler::PAGER, KPimGlobalPrefs::NONE_PAC, "No pager client installed", undefined, undefined, undefined, undefined, undefined); |
471 | addDefaultAppItem(ExternalAppHandler::PAGER, KPimGlobalPrefs::OTHER_PAC, "Other pager client", undefined, undefined, undefined, undefined, undefined); | 471 | addDefaultAppItem(ExternalAppHandler::PAGER, KPimGlobalPrefs::OTHER_PAC, "Other pager client", undefined, undefined, undefined, undefined, undefined); |
472 | 472 | ||
473 | //sipclients | 473 | //sipclients |
474 | addDefaultAppItem(ExternalAppHandler::SIP, KPimGlobalPrefs::NONE_SIC, "No SIP client installed", undefined, undefined, undefined, undefined, undefined); | 474 | addDefaultAppItem(ExternalAppHandler::SIP, KPimGlobalPrefs::NONE_SIC, "No SIP client installed", undefined, undefined, undefined, undefined, undefined); |
475 | addDefaultAppItem(ExternalAppHandler::SIP, KPimGlobalPrefs::OTHER_SIC, "Other SIP client", undefined, undefined, undefined, undefined, undefined); | 475 | addDefaultAppItem(ExternalAppHandler::SIP, KPimGlobalPrefs::OTHER_SIC, "Other SIP client", undefined, undefined, undefined, undefined, undefined); |
476 | if (( QFile::exists( qtopiapath + "/bin/kppi" )) || | 476 | if (( QFile::exists( qtopiapath + "/bin/kppi" )) || |
477 | ( QFile::exists( opiepath + "/bin/kppi" ))) | 477 | ( QFile::exists( opiepath + "/bin/kppi" ))) |
478 | addDefaultAppItem(ExternalAppHandler::SIP, KPimGlobalPrefs::KPPI_SIC, "KP/Pi SIP client", "QPE/Application/kppi", "-ring:%1", "", undefined, undefined); | 478 | addDefaultAppItem(ExternalAppHandler::SIP, KPimGlobalPrefs::KPPI_SIC, "KP/Pi SIP client", "QPE/Application/kppi", "-ring:%1", "", undefined, undefined); |
479 | 479 | ||
480 | } | 480 | } |
481 | 481 | ||
482 | ExternalAppHandler *ExternalAppHandler::instance() | 482 | ExternalAppHandler *ExternalAppHandler::instance() |
483 | { | 483 | { |
484 | if ( !sInstance ) { | 484 | if ( !sInstance ) { |
485 | sInstance = staticDeleter.setObject( new ExternalAppHandler() ); | 485 | sInstance = staticDeleter.setObject( new ExternalAppHandler() ); |
486 | sInstance->loadConfig(); | 486 | sInstance->loadConfig(); |
487 | } | 487 | } |
488 | 488 | ||
489 | return sInstance; | 489 | return sInstance; |
490 | } | 490 | } |
491 | 491 | ||
492 | void ExternalAppHandler::addDefaultAppItem(Types type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameter, const QString& message2, const QString& parameter2) | 492 | void ExternalAppHandler::addDefaultAppItem(Types type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameter, const QString& message2, const QString& parameter2) |
493 | { | 493 | { |
494 | DefaultAppItem* dai = new DefaultAppItem(type, id, label, channel, message, parameter, message2, parameter2); | 494 | DefaultAppItem* dai = new DefaultAppItem(type, id, label, channel, message, parameter, message2, parameter2); |
495 | // qDebug("%d %d %s %s ", type, id, label.latin1(), channel.latin1() ); | 495 | // qDebug("%d %d %s %s ", type, id, label.latin1(), channel.latin1() ); |
496 | mDefaultItems.append(dai); | 496 | mDefaultItems.append(dai); |
497 | } | 497 | } |
498 | 498 | ||
499 | 499 | ||
500 | QList<DefaultAppItem> ExternalAppHandler::getAvailableDefaultItems(Types type) | 500 | QList<DefaultAppItem> ExternalAppHandler::getAvailableDefaultItems(Types type) |
501 | { | 501 | { |
502 | QList<DefaultAppItem> list; | 502 | QList<DefaultAppItem> list; |
503 | 503 | ||
504 | DefaultAppItem* dai; | 504 | DefaultAppItem* dai; |
505 | 505 | ||
506 | for ( dai=mDefaultItems.first(); dai != 0; dai=mDefaultItems.next() ) | 506 | for ( dai=mDefaultItems.first(); dai != 0; dai=mDefaultItems.next() ) |
507 | { | 507 | { |
508 | if (dai->_type == type) | 508 | if (dai->_type == type) |
509 | list.append(dai); | 509 | list.append(dai); |
510 | } | 510 | } |
511 | 511 | ||
512 | return list; | 512 | return list; |
513 | } | 513 | } |
514 | 514 | ||
515 | DefaultAppItem* ExternalAppHandler::getDefaultItem(Types type, int clientid) | 515 | DefaultAppItem* ExternalAppHandler::getDefaultItem(Types type, int clientid) |
516 | { | 516 | { |
517 | DefaultAppItem* dai; | 517 | DefaultAppItem* dai; |
518 | 518 | ||
519 | for ( dai=mDefaultItems.first(); dai != 0; dai=mDefaultItems.next() ) | 519 | for ( dai=mDefaultItems.first(); dai != 0; dai=mDefaultItems.next() ) |
520 | { | 520 | { |
521 | if (dai->_type == type && dai->_id == clientid) | 521 | if (dai->_type == type && dai->_id == clientid) |
522 | return dai; | 522 | return dai; |
523 | } | 523 | } |
524 | 524 | ||
525 | return 0; | 525 | return 0; |
526 | } | 526 | } |
527 | 527 | ||
528 | bool ExternalAppHandler::isEmailAppAvailable() | 528 | bool ExternalAppHandler::isEmailAppAvailable() |
529 | { | 529 | { |
530 | #ifndef DESKTOP_VERSION | 530 | #ifndef DESKTOP_VERSION |
531 | if (mEmailAppAvailable == UNDEFINED) | 531 | if (mEmailAppAvailable == UNDEFINED) |
532 | { | 532 | { |
533 | int client = KPimGlobalPrefs::instance()->mEmailClient; | 533 | int client = KPimGlobalPrefs::instance()->mEmailClient; |
534 | if (client == KPimGlobalPrefs::NONE_EMC) | 534 | if (client == KPimGlobalPrefs::NONE_EMC) |
535 | mEmailAppAvailable = UNAVAILABLE; | 535 | mEmailAppAvailable = UNAVAILABLE; |
536 | else | 536 | else |
537 | mEmailAppAvailable = AVAILABLE; | 537 | mEmailAppAvailable = AVAILABLE; |
538 | } | 538 | } |
539 | return (mEmailAppAvailable == AVAILABLE); | 539 | return (mEmailAppAvailable == AVAILABLE); |
540 | 540 | ||
541 | #else //DESKTOP_VERSION | 541 | #else //DESKTOP_VERSION |
542 | return false; | 542 | return false; |
543 | #endif //DESKTOP_VERSION | 543 | #endif //DESKTOP_VERSION |
544 | } | 544 | } |
545 | 545 | ||
546 | bool ExternalAppHandler::isSMSAppAvailable() | 546 | bool ExternalAppHandler::isSMSAppAvailable() |
547 | { | 547 | { |
548 | #ifndef DESKTOP_VERSION | 548 | #ifndef DESKTOP_VERSION |
549 | if (mSMSAppAvailable == UNDEFINED) | 549 | if (mSMSAppAvailable == UNDEFINED) |
550 | { | 550 | { |
551 | int client = KPimGlobalPrefs::instance()->mSMSClient; | 551 | int client = KPimGlobalPrefs::instance()->mSMSClient; |
552 | if (client == KPimGlobalPrefs::NONE_SMC) | 552 | if (client == KPimGlobalPrefs::NONE_SMC) |
553 | mSMSAppAvailable = UNAVAILABLE; | 553 | mSMSAppAvailable = UNAVAILABLE; |
554 | else | 554 | else |
555 | mSMSAppAvailable = AVAILABLE; | 555 | mSMSAppAvailable = AVAILABLE; |
556 | } | 556 | } |
557 | 557 | ||
558 | return (mSMSAppAvailable == AVAILABLE); | 558 | return (mSMSAppAvailable == AVAILABLE); |
559 | #else //DESKTOP_VERSION | 559 | #else //DESKTOP_VERSION |
560 | return false; | 560 | return false; |
561 | #endif //DESKTOP_VERSION | 561 | #endif //DESKTOP_VERSION |
562 | } | 562 | } |
563 | 563 | ||
564 | bool ExternalAppHandler::isPhoneAppAvailable() | 564 | bool ExternalAppHandler::isPhoneAppAvailable() |
565 | { | 565 | { |
566 | #ifndef DESKTOP_VERSION | 566 | #ifndef DESKTOP_VERSION |
567 | if (mPhoneAppAvailable == UNDEFINED) | 567 | if (mPhoneAppAvailable == UNDEFINED) |
568 | { | 568 | { |
569 | int client = KPimGlobalPrefs::instance()->mPhoneClient; | 569 | int client = KPimGlobalPrefs::instance()->mPhoneClient; |
570 | if (client == KPimGlobalPrefs::NONE_PHC) | 570 | if (client == KPimGlobalPrefs::NONE_PHC) |
571 | mPhoneAppAvailable = UNAVAILABLE; | 571 | mPhoneAppAvailable = UNAVAILABLE; |
572 | else | 572 | else |
573 | mPhoneAppAvailable = AVAILABLE; | 573 | mPhoneAppAvailable = AVAILABLE; |
574 | } | 574 | } |
575 | 575 | ||
576 | return (mPhoneAppAvailable == AVAILABLE); | 576 | return (mPhoneAppAvailable == AVAILABLE); |
577 | #else //DESKTOP_VERSION | 577 | #else //DESKTOP_VERSION |
578 | return false; | 578 | return false; |
579 | #endif //DESKTOP_VERSION | 579 | #endif //DESKTOP_VERSION |
580 | } | 580 | } |
581 | 581 | ||
582 | bool ExternalAppHandler::isFaxAppAvailable() | 582 | bool ExternalAppHandler::isFaxAppAvailable() |
583 | { | 583 | { |
584 | #ifndef DESKTOP_VERSION | 584 | #ifndef DESKTOP_VERSION |
585 | if (mFaxAppAvailable == UNDEFINED) | 585 | if (mFaxAppAvailable == UNDEFINED) |
586 | { | 586 | { |
587 | int client = KPimGlobalPrefs::instance()->mFaxClient; | 587 | int client = KPimGlobalPrefs::instance()->mFaxClient; |
588 | if (client == KPimGlobalPrefs::NONE_FAC) | 588 | if (client == KPimGlobalPrefs::NONE_FAC) |
589 | mFaxAppAvailable = UNAVAILABLE; | 589 | mFaxAppAvailable = UNAVAILABLE; |
590 | else | 590 | else |
591 | mFaxAppAvailable = AVAILABLE; | 591 | mFaxAppAvailable = AVAILABLE; |
592 | } | 592 | } |
593 | 593 | ||
594 | return (mFaxAppAvailable == AVAILABLE); | 594 | return (mFaxAppAvailable == AVAILABLE); |
595 | #else //DESKTOP_VERSION | 595 | #else //DESKTOP_VERSION |
596 | return false; | 596 | return false; |
597 | #endif //DESKTOP_VERSION | 597 | #endif //DESKTOP_VERSION |
598 | } | 598 | } |
599 | 599 | ||
600 | bool ExternalAppHandler::isPagerAppAvailable() | 600 | bool ExternalAppHandler::isPagerAppAvailable() |
601 | { | 601 | { |
602 | #ifndef DESKTOP_VERSION | 602 | #ifndef DESKTOP_VERSION |
603 | if (mPagerAppAvailable == UNDEFINED) | 603 | if (mPagerAppAvailable == UNDEFINED) |
604 | { | 604 | { |
605 | int client = KPimGlobalPrefs::instance()->mPagerClient; | 605 | int client = KPimGlobalPrefs::instance()->mPagerClient; |
606 | if (client == KPimGlobalPrefs::NONE_PAC) | 606 | if (client == KPimGlobalPrefs::NONE_PAC) |
607 | mPagerAppAvailable = UNAVAILABLE; | 607 | mPagerAppAvailable = UNAVAILABLE; |
608 | else | 608 | else |
609 | mPagerAppAvailable = AVAILABLE; | 609 | mPagerAppAvailable = AVAILABLE; |
610 | } | 610 | } |
611 | 611 | ||
612 | return (mPagerAppAvailable == AVAILABLE); | 612 | return (mPagerAppAvailable == AVAILABLE); |
613 | #else //DESKTOP_VERSION | 613 | #else //DESKTOP_VERSION |
614 | return false; | 614 | return false; |
615 | #endif //DESKTOP_VERSION | 615 | #endif //DESKTOP_VERSION |
616 | } | 616 | } |
617 | 617 | ||
618 | 618 | ||
619 | bool ExternalAppHandler::isSIPAppAvailable() | 619 | bool ExternalAppHandler::isSIPAppAvailable() |
620 | { | 620 | { |
621 | #ifndef DESKTOP_VERSION | 621 | #ifndef DESKTOP_VERSION |
622 | if (mSIPAppAvailable == UNDEFINED) | 622 | if (mSIPAppAvailable == UNDEFINED) |
623 | { | 623 | { |
624 | int client = KPimGlobalPrefs::instance()->mSipClient; | 624 | int client = KPimGlobalPrefs::instance()->mSipClient; |
625 | if (client == KPimGlobalPrefs::NONE_SIC) | 625 | if (client == KPimGlobalPrefs::NONE_SIC) |
626 | mSIPAppAvailable = UNAVAILABLE; | 626 | mSIPAppAvailable = UNAVAILABLE; |
627 | else | 627 | else |
628 | mSIPAppAvailable = AVAILABLE; | 628 | mSIPAppAvailable = AVAILABLE; |
629 | } | 629 | } |
630 | 630 | ||
631 | return (mSIPAppAvailable == AVAILABLE); | 631 | return (mSIPAppAvailable == AVAILABLE); |
632 | #else //DESKTOP_VERSION | 632 | #else //DESKTOP_VERSION |
633 | return false; | 633 | return false; |
634 | #endif //DESKTOP_VERSION | 634 | #endif //DESKTOP_VERSION |
635 | } | 635 | } |
636 | 636 | ||
637 | /************************************************************************** | 637 | /************************************************************************** |
638 | * | 638 | * |
639 | **************************************************************************/ | 639 | **************************************************************************/ |
640 | 640 | ||
641 | 641 | ||
642 | //calls the emailapplication with a number of attachments that need to be send (Seperated by Comma) | 642 | //calls the emailapplication with a number of attachments that need to be send (Seperated by Comma) |
643 | bool ExternalAppHandler::mailToMultipleContacts( const QString& emails, const QString& urls ) | 643 | bool ExternalAppHandler::mailToMultipleContacts( const QString& emails, const QString& urls ) |
644 | { | 644 | { |
645 | 645 | ||
646 | #ifndef DESKTOP_VERSION | 646 | #ifndef DESKTOP_VERSION |
647 | QString channel; | 647 | QString channel; |
648 | QString message2; | 648 | QString message2; |
649 | QString parameters2; | 649 | QString parameters2; |
650 | 650 | ||
651 | 651 | ||
652 | int client = KPimGlobalPrefs::instance()->mEmailClient; | 652 | int client = KPimGlobalPrefs::instance()->mEmailClient; |
653 | if (client == KPimGlobalPrefs::OTHER_EMC) | 653 | if (client == KPimGlobalPrefs::OTHER_EMC) |
654 | { | 654 | { |
655 | channel = KPimGlobalPrefs::instance()->mEmailOtherChannel; | 655 | channel = KPimGlobalPrefs::instance()->mEmailOtherChannel; |
656 | message2 = KPimGlobalPrefs::instance()->mEmailOtherMessage; | 656 | message2 = KPimGlobalPrefs::instance()->mEmailOtherMessage; |
657 | parameters2 = KPimGlobalPrefs::instance()->mEmailOtherMessageParameters; | 657 | parameters2 = KPimGlobalPrefs::instance()->mEmailOtherMessageParameters; |
658 | } | 658 | } |
659 | else | 659 | else |
660 | { | 660 | { |
661 | DefaultAppItem* dai = getDefaultItem(EMAIL, client); | 661 | DefaultAppItem* dai = getDefaultItem(EMAIL, client); |
662 | if (!dai) | 662 | if (!dai) |
663 | { | 663 | { |
664 | qDebug("could not find configured email application."); | 664 | qDebug("could not find configured email application."); |
665 | return false; | 665 | return false; |
666 | } | 666 | } |
667 | channel = dai->_channel; | 667 | channel = dai->_channel; |
668 | message2 = dai->_message2; | 668 | message2 = dai->_message2; |
669 | parameters2 = dai->_parameters2; | 669 | parameters2 = dai->_parameters2; |
670 | } | 670 | } |
671 | 671 | ||
672 | //first check if one of the mailers need the emails right in the message. | 672 | //first check if one of the mailers need the emails right in the message. |
673 | message2 = translateMessage(message2, emails, urls); | 673 | message2 = translateMessage(message2, emails, urls); |
674 | 674 | ||
675 | 675 | ||
676 | #ifdef DEBUG_EXT_APP_HANDLER | 676 | #ifdef DEBUG_EXT_APP_HANDLER |
677 | qDebug("4Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message2.latin1()); | 677 | qDebug("4Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message2.latin1()); |
678 | qDebug("passing emailadresses(%s), attachmenturls(%s) as parameters in the form %s to QCopEnvelope", emails.latin1() , urls.latin1(), parameters2.latin1()); | 678 | qDebug("passing emailadresses(%s), attachmenturls(%s) as parameters in the form %s to QCopEnvelope", emails.latin1() , urls.latin1(), parameters2.latin1()); |
679 | #endif | 679 | #endif |
680 | 680 | ||
681 | 681 | ||
682 | QCopEnvelope e(channel.latin1(), message2.latin1()); | 682 | QCopEnvelope e(channel.latin1(), message2.latin1()); |
683 | //US we need no names in the To field. The emailadresses are enough | 683 | //US we need no names in the To field. The emailadresses are enough |
684 | 684 | ||
685 | passParameters(&e, parameters2, emails, urls); | 685 | passParameters(&e, parameters2, emails, urls); |
686 | 686 | ||
687 | 687 | ||
688 | 688 | ||
689 | #else | 689 | #else |
690 | KMessageBox::sorry( 0, i18n( "This version does not support the sending of emails." ) ); | 690 | KMessageBox::sorry( 0, i18n( "This version does not support the sending of emails." ) ); |
691 | #endif | 691 | #endif |
692 | 692 | ||
693 | return true; | 693 | return true; |
694 | } | 694 | } |
695 | 695 | ||
696 | /************************************************************************** | 696 | /************************************************************************** |
697 | * | 697 | * |
698 | **************************************************************************/ | 698 | **************************************************************************/ |
699 | 699 | ||
700 | 700 | ||
701 | //calls the emailapplication and creates a mail with parameter emails as recipients | 701 | //calls the emailapplication and creates a mail with parameter emails as recipients |
702 | bool ExternalAppHandler::mailToOneContact( const QString& name, const QString& emailadress ) | 702 | bool ExternalAppHandler::mailToOneContact( const QString& name, const QString& emailadress ) |
703 | { | 703 | { |
704 | #ifndef DESKTOP_VERSION | 704 | #ifndef DESKTOP_VERSION |
705 | QString channel; | 705 | QString channel; |
706 | QString message; | 706 | QString message; |
707 | QString parameters; | 707 | QString parameters; |
708 | 708 | ||
709 | 709 | ||
710 | int client = KPimGlobalPrefs::instance()->mEmailClient; | 710 | int client = KPimGlobalPrefs::instance()->mEmailClient; |
711 | if (client == KPimGlobalPrefs::OTHER_EMC) | 711 | if (client == KPimGlobalPrefs::OTHER_EMC) |
712 | { | 712 | { |
713 | channel = KPimGlobalPrefs::instance()->mEmailOtherChannel; | 713 | channel = KPimGlobalPrefs::instance()->mEmailOtherChannel; |
714 | message = KPimGlobalPrefs::instance()->mEmailOtherMessage; | 714 | message = KPimGlobalPrefs::instance()->mEmailOtherMessage; |
715 | parameters = KPimGlobalPrefs::instance()->mEmailOtherMessageParameters; | 715 | parameters = KPimGlobalPrefs::instance()->mEmailOtherMessageParameters; |
716 | } | 716 | } |
717 | else | 717 | else |
718 | { | 718 | { |
719 | DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(EMAIL, client); | 719 | DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(EMAIL, client); |
720 | if (!dai) | 720 | if (!dai) |
721 | { | 721 | { |
722 | qDebug("could not find configured email application."); | 722 | qDebug("could not find configured email application."); |
723 | return false; | 723 | return false; |
724 | } | 724 | } |
725 | channel = dai->_channel; | 725 | channel = dai->_channel; |
726 | message = dai->_message; | 726 | message = dai->_message; |
727 | parameters = dai->_parameters; | 727 | parameters = dai->_parameters; |
728 | } | 728 | } |
729 | 729 | ||
730 | 730 | ||
731 | //first check if one of the mailers need the emails right in the message. | 731 | //first check if one of the mailers need the emails right in the message. |
732 | message = translateMessage(message, name, emailadress); | 732 | message = translateMessage(message, name, emailadress); |
733 | 733 | ||
734 | 734 | ||
735 | #ifdef DEBUG_EXT_APP_HANDLER | 735 | #ifdef DEBUG_EXT_APP_HANDLER |
736 | qDebug("5Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); | 736 | qDebug("5Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); |
737 | qDebug("passing name(%s), emailadresses(%s) as parameters in the form %s to QCopEnvelope", name.latin1(), emailadress.latin1(), parameters.latin1()); | 737 | qDebug("passing name(%s), emailadresses(%s) as parameters in the form %s to QCopEnvelope", name.latin1(), emailadress.latin1(), parameters.latin1()); |
738 | #endif | 738 | #endif |
739 | 739 | ||
740 | QCopEnvelope e(channel.latin1(), message.latin1()); | 740 | QCopEnvelope e(channel.latin1(), message.latin1()); |
741 | //US we need no names in the To field. The emailadresses are enough | 741 | //US we need no names in the To field. The emailadresses are enough |
742 | 742 | ||
743 | passParameters(&e, parameters, name, emailadress); | 743 | passParameters(&e, parameters, name, emailadress); |
744 | 744 | ||
745 | 745 | ||
746 | #else | 746 | #else |
747 | KMessageBox::sorry( 0, i18n( "This version does not support the sending of emails." ) ); | 747 | KMessageBox::sorry( 0, i18n( "This version does not support the sending of emails." ) ); |
748 | #endif | 748 | #endif |
749 | 749 | ||
750 | 750 | ||
751 | return true; | 751 | return true; |
752 | } | 752 | } |
753 | 753 | ||
754 | /************************************************************************** | 754 | /************************************************************************** |
755 | * | 755 | * |
756 | **************************************************************************/ | 756 | **************************************************************************/ |
757 | 757 | ||
758 | //calls the emailapplication and creates a mail with parameter as recipients | 758 | //calls the emailapplication and creates a mail with parameter as recipients |
759 | // parameters format is | 759 | // parameters format is |
760 | // NAME <EMAIL>:SUBJECT | 760 | // NAME <EMAIL>:SUBJECT |
761 | bool ExternalAppHandler::mailToOneContact( const QString& adressline ) | 761 | bool ExternalAppHandler::mailToOneContact( const QString& adressline ) |
762 | { | 762 | { |
763 | QString line = adressline; | 763 | QString line = adressline; |
764 | 764 | ||
765 | int first = line.find( "<"); | 765 | int first = line.find( "<"); |
766 | int last = line.find( ">"); | 766 | int last = line.find( ">"); |
767 | QString name = line.left(first); | 767 | QString name = line.left(first); |
768 | QString emailadress = line.mid(first+1, last-first-1); | 768 | QString emailadress = line.mid(first+1, last-first-1); |
769 | 769 | ||
770 | //Subject can not be handled right now. | 770 | //Subject can not be handled right now. |
771 | return mailToOneContact( name, emailadress ); | 771 | return mailToOneContact( name, emailadress ); |
772 | 772 | ||
773 | } | 773 | } |
774 | 774 | ||
775 | 775 | ||
776 | /************************************************************************** | 776 | /************************************************************************** |
777 | * | 777 | * |
778 | **************************************************************************/ | 778 | **************************************************************************/ |
779 | 779 | ||
780 | //calls the phoneapplication with the number | 780 | //calls the phoneapplication with the number |
781 | bool ExternalAppHandler::callByPhone( const QString& phonenumber ) | 781 | bool ExternalAppHandler::callByPhone( const QString& phonenumber ) |
782 | { | 782 | { |
783 | #ifndef DESKTOP_VERSION | 783 | #ifndef DESKTOP_VERSION |
784 | QString channel; | 784 | QString channel; |
785 | QString message; | 785 | QString message; |
786 | QString parameters; | 786 | QString parameters; |
787 | 787 | ||
788 | 788 | ||
789 | int client = KPimGlobalPrefs::instance()->mPhoneClient; | 789 | int client = KPimGlobalPrefs::instance()->mPhoneClient; |
790 | if (client == KPimGlobalPrefs::OTHER_PHC) | 790 | if (client == KPimGlobalPrefs::OTHER_PHC) |
791 | { | 791 | { |
792 | channel = KPimGlobalPrefs::instance()->mPhoneOtherChannel; | 792 | channel = KPimGlobalPrefs::instance()->mPhoneOtherChannel; |
793 | message = KPimGlobalPrefs::instance()->mPhoneOtherMessage; | 793 | message = KPimGlobalPrefs::instance()->mPhoneOtherMessage; |
794 | parameters = KPimGlobalPrefs::instance()->mPhoneOtherMessageParameters; | 794 | parameters = KPimGlobalPrefs::instance()->mPhoneOtherMessageParameters; |
795 | } | 795 | } |
796 | else | 796 | else |
797 | { | 797 | { |
798 | DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(PHONE, client); | 798 | DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(PHONE, client); |
799 | if (!dai) | 799 | if (!dai) |
800 | { | 800 | { |
801 | qDebug("could not find configured phone application."); | 801 | qDebug("could not find configured phone application."); |
802 | return false; | 802 | return false; |
803 | } | 803 | } |
804 | channel = dai->_channel; | 804 | channel = dai->_channel; |
805 | message = dai->_message; | 805 | message = dai->_message; |
806 | parameters = dai->_parameters; | 806 | parameters = dai->_parameters; |
807 | } | 807 | } |
808 | 808 | ||
809 | 809 | ||
810 | //first check if one of the mailers need the emails right in the message. | 810 | //first check if one of the mailers need the emails right in the message. |
811 | message = translateMessage(message, phonenumber, ""); | 811 | message = translateMessage(message, phonenumber, ""); |
812 | 812 | ||
813 | 813 | ||
814 | #ifdef DEBUG_EXT_APP_HANDLER | 814 | #ifdef DEBUG_EXT_APP_HANDLER |
815 | qDebug("6Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); | 815 | qDebug("6Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); |
816 | qDebug("passing phonenumber(%s) as parameter in the form %s to QCopEnvelope", phonenumber.latin1(), parameters.latin1()); | 816 | qDebug("passing phonenumber(%s) as parameter in the form %s to QCopEnvelope", phonenumber.latin1(), parameters.latin1()); |
817 | #endif | 817 | #endif |
818 | 818 | ||
819 | QCopEnvelope e(channel.latin1(), message.latin1()); | 819 | QCopEnvelope e(channel.latin1(), message.latin1()); |
820 | //US we need no names in the To field. The emailadresses are enough | 820 | //US we need no names in the To field. The emailadresses are enough |
821 | 821 | ||
822 | passParameters(&e, parameters, phonenumber, ""); | 822 | passParameters(&e, parameters, phonenumber, ""); |
823 | 823 | ||
824 | 824 | ||
825 | #else | 825 | #else |
826 | KMessageBox::sorry( 0, i18n( "This version does not support phonecalls." ) ); | 826 | KMessageBox::sorry( 0, i18n( "This version does not support phonecalls." ) ); |
827 | #endif | 827 | #endif |
828 | 828 | ||
829 | 829 | ||
830 | return true; | 830 | return true; |
831 | } | 831 | } |
832 | 832 | ||
833 | /************************************************************************** | 833 | /************************************************************************** |
834 | * | 834 | * |
835 | **************************************************************************/ | 835 | **************************************************************************/ |
836 | 836 | ||
837 | //calls the smsapplication with the number | 837 | //calls the smsapplication with the number |
838 | bool ExternalAppHandler::callBySMS( const QString& phonenumber ) | 838 | bool ExternalAppHandler::callBySMS( const QString& phonenumber ) |
839 | { | 839 | { |
840 | #ifndef DESKTOP_VERSION | 840 | #ifndef DESKTOP_VERSION |
841 | QString channel; | 841 | QString channel; |
842 | QString message; | 842 | QString message; |
843 | QString parameters; | 843 | QString parameters; |
844 | 844 | ||
845 | 845 | ||
846 | int client = KPimGlobalPrefs::instance()->mSMSClient; | 846 | int client = KPimGlobalPrefs::instance()->mSMSClient; |
847 | if (client == KPimGlobalPrefs::OTHER_SMC) | 847 | if (client == KPimGlobalPrefs::OTHER_SMC) |
848 | { | 848 | { |
849 | channel = KPimGlobalPrefs::instance()->mSMSOtherChannel; | 849 | channel = KPimGlobalPrefs::instance()->mSMSOtherChannel; |
850 | message = KPimGlobalPrefs::instance()->mSMSOtherMessage; | 850 | message = KPimGlobalPrefs::instance()->mSMSOtherMessage; |
851 | parameters = KPimGlobalPrefs::instance()->mSMSOtherMessageParameters; | 851 | parameters = KPimGlobalPrefs::instance()->mSMSOtherMessageParameters; |
852 | } | 852 | } |
853 | else | 853 | else |
854 | { | 854 | { |
855 | DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(SMS, client); | 855 | DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(SMS, client); |
856 | if (!dai) | 856 | if (!dai) |
857 | { | 857 | { |
858 | qDebug("could not find configured sms application."); | 858 | qDebug("could not find configured sms application."); |
859 | return false; | 859 | return false; |
860 | } | 860 | } |
861 | channel = dai->_channel; | 861 | channel = dai->_channel; |
862 | message = dai->_message; | 862 | message = dai->_message; |
863 | parameters = dai->_parameters; | 863 | parameters = dai->_parameters; |
864 | } | 864 | } |
865 | 865 | ||
866 | 866 | ||
867 | //first check if one of the mailers need the emails right in the message. | 867 | //first check if one of the mailers need the emails right in the message. |
868 | message = translateMessage(message, phonenumber, ""); | 868 | message = translateMessage(message, phonenumber, ""); |
869 | 869 | ||
870 | 870 | ||
871 | #ifdef DEBUG_EXT_APP_HANDLER | 871 | #ifdef DEBUG_EXT_APP_HANDLER |
872 | qDebug("7Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); | 872 | qDebug("7Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); |
873 | qDebug("passing phonenumber(%s) as parameter in the form %s to QCopEnvelope", phonenumber.latin1(), parameters.latin1()); | 873 | qDebug("passing phonenumber(%s) as parameter in the form %s to QCopEnvelope", phonenumber.latin1(), parameters.latin1()); |
874 | #endif | 874 | #endif |
875 | 875 | ||
876 | QCopEnvelope e(channel.latin1(), message.latin1()); | 876 | QCopEnvelope e(channel.latin1(), message.latin1()); |
877 | //US we need no names in the To field. The emailadresses are enough | 877 | //US we need no names in the To field. The emailadresses are enough |
878 | 878 | ||
879 | passParameters(&e, parameters, phonenumber, ""); | 879 | passParameters(&e, parameters, phonenumber, ""); |
880 | 880 | ||
881 | 881 | ||
882 | #else | 882 | #else |
883 | KMessageBox::sorry( 0, i18n( "This version does not support the sending of sms." ) ); | 883 | KMessageBox::sorry( 0, i18n( "This version does not support the sending of sms." ) ); |
884 | #endif | 884 | #endif |
885 | 885 | ||
886 | 886 | ||
887 | return true; | 887 | return true; |
888 | } | 888 | } |
889 | 889 | ||
890 | /************************************************************************** | 890 | /************************************************************************** |
891 | * | 891 | * |
892 | **************************************************************************/ | 892 | **************************************************************************/ |
893 | 893 | ||
894 | //calls the pagerapplication with the number | 894 | //calls the pagerapplication with the number |
895 | bool ExternalAppHandler::callByPager( const QString& pagernumber ) | 895 | bool ExternalAppHandler::callByPager( const QString& pagernumber ) |
896 | { | 896 | { |
897 | #ifndef DESKTOP_VERSION | 897 | #ifndef DESKTOP_VERSION |
898 | QString channel; | 898 | QString channel; |
899 | QString message; | 899 | QString message; |
900 | QString parameters; | 900 | QString parameters; |
901 | 901 | ||
902 | 902 | ||
903 | int client = KPimGlobalPrefs::instance()->mPagerClient; | 903 | int client = KPimGlobalPrefs::instance()->mPagerClient; |
904 | if (client == KPimGlobalPrefs::OTHER_PAC) | 904 | if (client == KPimGlobalPrefs::OTHER_PAC) |
905 | { | 905 | { |
906 | channel = KPimGlobalPrefs::instance()->mPagerOtherChannel; | 906 | channel = KPimGlobalPrefs::instance()->mPagerOtherChannel; |
907 | message = KPimGlobalPrefs::instance()->mPagerOtherMessage; | 907 | message = KPimGlobalPrefs::instance()->mPagerOtherMessage; |
908 | parameters = KPimGlobalPrefs::instance()->mPagerOtherMessageParameters; | 908 | parameters = KPimGlobalPrefs::instance()->mPagerOtherMessageParameters; |
909 | } | 909 | } |
910 | else | 910 | else |
911 | { | 911 | { |
912 | DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(PAGER, client); | 912 | DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(PAGER, client); |
913 | if (!dai) | 913 | if (!dai) |
914 | { | 914 | { |
915 | qDebug("could not find configured pager application."); | 915 | qDebug("could not find configured pager application."); |
916 | return false; | 916 | return false; |
917 | } | 917 | } |
918 | channel = dai->_channel; | 918 | channel = dai->_channel; |
919 | message = dai->_message; | 919 | message = dai->_message; |
920 | parameters = dai->_parameters; | 920 | parameters = dai->_parameters; |
921 | } | 921 | } |
922 | 922 | ||
923 | 923 | ||
924 | //first check if one of the mailers need the emails right in the message. | 924 | //first check if one of the mailers need the emails right in the message. |
925 | message = translateMessage(message, pagernumber, ""); | 925 | message = translateMessage(message, pagernumber, ""); |
926 | 926 | ||
927 | 927 | ||
928 | #ifdef DEBUG_EXT_APP_HANDLER | 928 | #ifdef DEBUG_EXT_APP_HANDLER |
929 | qDebug("8Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); | 929 | qDebug("8Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); |
930 | qDebug("passing pagernumber(%s) as parameter in the form %s to QCopEnvelope", pagernumber.latin1(), parameters.latin1()); | 930 | qDebug("passing pagernumber(%s) as parameter in the form %s to QCopEnvelope", pagernumber.latin1(), parameters.latin1()); |
931 | #endif | 931 | #endif |
932 | 932 | ||
933 | QCopEnvelope e(channel.latin1(), message.latin1()); | 933 | QCopEnvelope e(channel.latin1(), message.latin1()); |
934 | //US we need no names in the To field. The emailadresses are enough | 934 | //US we need no names in the To field. The emailadresses are enough |
935 | 935 | ||
936 | passParameters(&e, parameters, pagernumber, ""); | 936 | passParameters(&e, parameters, pagernumber, ""); |
937 | 937 | ||
938 | 938 | ||
939 | #else | 939 | #else |
940 | KMessageBox::sorry( 0, i18n( "This version does not support paging." ) ); | 940 | KMessageBox::sorry( 0, i18n( "This version does not support paging." ) ); |
941 | #endif | 941 | #endif |
942 | 942 | ||
943 | 943 | ||
944 | return true; | 944 | return true; |
945 | } | 945 | } |
946 | 946 | ||
947 | /************************************************************************** | 947 | /************************************************************************** |
948 | * | 948 | * |
949 | **************************************************************************/ | 949 | **************************************************************************/ |
950 | 950 | ||
951 | //calls the faxapplication with the number | 951 | //calls the faxapplication with the number |
952 | bool ExternalAppHandler::callByFax( const QString& faxnumber ) | 952 | bool ExternalAppHandler::callByFax( const QString& faxnumber ) |
953 | { | 953 | { |
954 | #ifndef DESKTOP_VERSION | 954 | #ifndef DESKTOP_VERSION |
955 | QString channel; | 955 | QString channel; |
956 | QString message; | 956 | QString message; |
957 | QString parameters; | 957 | QString parameters; |
958 | 958 | ||
959 | 959 | ||
960 | int client = KPimGlobalPrefs::instance()->mFaxClient; | 960 | int client = KPimGlobalPrefs::instance()->mFaxClient; |
961 | if (client == KPimGlobalPrefs::OTHER_FAC) | 961 | if (client == KPimGlobalPrefs::OTHER_FAC) |
962 | { | 962 | { |
963 | channel = KPimGlobalPrefs::instance()->mFaxOtherChannel; | 963 | channel = KPimGlobalPrefs::instance()->mFaxOtherChannel; |
964 | message = KPimGlobalPrefs::instance()->mFaxOtherMessage; | 964 | message = KPimGlobalPrefs::instance()->mFaxOtherMessage; |
965 | parameters = KPimGlobalPrefs::instance()->mFaxOtherMessageParameters; | 965 | parameters = KPimGlobalPrefs::instance()->mFaxOtherMessageParameters; |
966 | } | 966 | } |
967 | else | 967 | else |
968 | { | 968 | { |
969 | DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(FAX, client); | 969 | DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(FAX, client); |
970 | if (!dai) | 970 | if (!dai) |
971 | { | 971 | { |
972 | qDebug("could not find configured fax application."); | 972 | qDebug("could not find configured fax application."); |
973 | return false; | 973 | return false; |
974 | } | 974 | } |
975 | channel = dai->_channel; | 975 | channel = dai->_channel; |
976 | message = dai->_message; | 976 | message = dai->_message; |
977 | parameters = dai->_parameters; | 977 | parameters = dai->_parameters; |
978 | } | 978 | } |
979 | 979 | ||
980 | 980 | ||
981 | //first check if one of the mailers need the emails right in the message. | 981 | //first check if one of the mailers need the emails right in the message. |
982 | message = translateMessage(message, faxnumber, ""); | 982 | message = translateMessage(message, faxnumber, ""); |
983 | 983 | ||
984 | 984 | ||
985 | #ifdef DEBUG_EXT_APP_HANDLER | 985 | #ifdef DEBUG_EXT_APP_HANDLER |
986 | qDebug("9Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); | 986 | qDebug("9Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); |
987 | qDebug("passing faxnumber(%s) as parameter in the form %s to QCopEnvelope", faxnumber.latin1(), parameters.latin1()); | 987 | qDebug("passing faxnumber(%s) as parameter in the form %s to QCopEnvelope", faxnumber.latin1(), parameters.latin1()); |
988 | #endif | 988 | #endif |
989 | 989 | ||
990 | QCopEnvelope e(channel.latin1(), message.latin1()); | 990 | QCopEnvelope e(channel.latin1(), message.latin1()); |
991 | //US we need no names in the To field. The emailadresses are enough | 991 | //US we need no names in the To field. The emailadresses are enough |
992 | 992 | ||
993 | passParameters(&e, parameters, faxnumber, ""); | 993 | passParameters(&e, parameters, faxnumber, ""); |
994 | 994 | ||
995 | 995 | ||
996 | #else | 996 | #else |
997 | KMessageBox::sorry( 0, i18n( "This version does not support the sending of faxes." ) ); | 997 | KMessageBox::sorry( 0, i18n( "This version does not support the sending of faxes." ) ); |
998 | #endif | 998 | #endif |
999 | 999 | ||
1000 | 1000 | ||
1001 | return true; | 1001 | return true; |
1002 | } | 1002 | } |
1003 | 1003 | ||
1004 | /************************************************************************** | 1004 | /************************************************************************** |
1005 | * | 1005 | * |
1006 | **************************************************************************/ | 1006 | **************************************************************************/ |
1007 | 1007 | ||
1008 | //calls the sipapplication with the number | 1008 | //calls the sipapplication with the number |
1009 | bool ExternalAppHandler::callBySIP( const QString& sipnumber ) | 1009 | bool ExternalAppHandler::callBySIP( const QString& sipnumber ) |
1010 | { | 1010 | { |
1011 | #ifndef DESKTOP_VERSION | 1011 | #ifndef DESKTOP_VERSION |
1012 | QString channel; | 1012 | QString channel; |
1013 | QString message; | 1013 | QString message; |
1014 | QString parameters; | 1014 | QString parameters; |
1015 | 1015 | ||
1016 | 1016 | ||
1017 | int client = KPimGlobalPrefs::instance()->mSipClient; | 1017 | int client = KPimGlobalPrefs::instance()->mSipClient; |
1018 | if (client == KPimGlobalPrefs::OTHER_SIC) | 1018 | if (client == KPimGlobalPrefs::OTHER_SIC) |
1019 | { | 1019 | { |
1020 | channel = KPimGlobalPrefs::instance()->mSipOtherChannel; | 1020 | channel = KPimGlobalPrefs::instance()->mSipOtherChannel; |
1021 | message = KPimGlobalPrefs::instance()->mSipOtherMessage; | 1021 | message = KPimGlobalPrefs::instance()->mSipOtherMessage; |
1022 | parameters = KPimGlobalPrefs::instance()->mSipOtherMessageParameters; | 1022 | parameters = KPimGlobalPrefs::instance()->mSipOtherMessageParameters; |
1023 | } | 1023 | } |
1024 | else | 1024 | else |
1025 | { | 1025 | { |
1026 | DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(SIP, client); | 1026 | DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(SIP, client); |
1027 | if (!dai) | 1027 | if (!dai) |
1028 | { | 1028 | { |
1029 | qDebug("could not find configured sip application."); | 1029 | qDebug("could not find configured sip application."); |
1030 | return false; | 1030 | return false; |
1031 | } | 1031 | } |
1032 | channel = dai->_channel; | 1032 | channel = dai->_channel; |
1033 | message = dai->_message; | 1033 | message = dai->_message; |
1034 | parameters = dai->_parameters; | 1034 | parameters = dai->_parameters; |
1035 | } | 1035 | } |
1036 | 1036 | ||
1037 | 1037 | ||
1038 | //first check if one of the sip apps need the emails right in the message. | 1038 | //first check if one of the sip apps need the emails right in the message. |
1039 | message = translateMessage(message, sipnumber, ""); | 1039 | message = translateMessage(message, sipnumber, ""); |
1040 | 1040 | ||
1041 | 1041 | ||
1042 | #ifdef DEBUG_EXT_APP_HANDLER | 1042 | #ifdef DEBUG_EXT_APP_HANDLER |
1043 | qDebug("10Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); | 1043 | qDebug("10Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); |
1044 | qDebug("passing sipnumber(%s) as parameter in the form %s to QCopEnvelope", sipnumber.latin1(), parameters.latin1()); | 1044 | qDebug("passing sipnumber(%s) as parameter in the form %s to QCopEnvelope", sipnumber.latin1(), parameters.latin1()); |
1045 | #endif | 1045 | #endif |
1046 | 1046 | ||
1047 | QCopEnvelope e(channel.latin1(), message.latin1()); | 1047 | QCopEnvelope e(channel.latin1(), message.latin1()); |
1048 | //US we need no names in the To field. The emailadresses are enough | 1048 | //US we need no names in the To field. The emailadresses are enough |
1049 | 1049 | ||
1050 | passParameters(&e, parameters, sipnumber, ""); | 1050 | passParameters(&e, parameters, sipnumber, ""); |
1051 | 1051 | ||
1052 | 1052 | ||
1053 | #else | 1053 | #else |
1054 | KMessageBox::sorry( 0, i18n( "This version does not support sip." ) ); | 1054 | KMessageBox::sorry( 0, i18n( "This version does not support sip." ) ); |
1055 | #endif | 1055 | #endif |
1056 | 1056 | ||
1057 | 1057 | ||
1058 | return true; | 1058 | return true; |
1059 | } | 1059 | } |
1060 | 1060 | ||
1061 | 1061 | ||
1062 | /************************************************************************** | 1062 | /************************************************************************** |
1063 | * | 1063 | * |
1064 | **************************************************************************/ | 1064 | **************************************************************************/ |
1065 | 1065 | ||
1066 | 1066 | ||
1067 | QString& ExternalAppHandler::translateMessage(QString& message, const QString& param1, const QString& param2 ) const | 1067 | QString& ExternalAppHandler::translateMessage(QString& message, const QString& param1, const QString& param2 ) const |
1068 | { | 1068 | { |
1069 | message = message.replace( QRegExp("%1"), param1 ); | 1069 | message = message.replace( QRegExp("%1"), param1 ); |
1070 | return message.replace( QRegExp("%2"), param2 ); | 1070 | return message.replace( QRegExp("%2"), param2 ); |
1071 | } | 1071 | } |
1072 | 1072 | ||
1073 | /************************************************************************** | 1073 | /************************************************************************** |
1074 | * | 1074 | * |
1075 | **************************************************************************/ | 1075 | **************************************************************************/ |
1076 | 1076 | ||
1077 | void ExternalAppHandler::passParameters(QCopEnvelope* e, const QString& parameters, const QString& param1 , const QString& param2) const | 1077 | void ExternalAppHandler::passParameters(QCopEnvelope* e, const QString& parameters, const QString& param1 , const QString& param2) const |
1078 | { | 1078 | { |
1079 | #ifndef DESKTOP_VERSION | 1079 | #ifndef DESKTOP_VERSION |
1080 | QMap<QString, QString> valmap; | 1080 | QMap<QString, QString> valmap; |
1081 | bool useValMap = false; | 1081 | bool useValMap = false; |
1082 | 1082 | ||
1083 | // first extract all parts of the parameters. | 1083 | // first extract all parts of the parameters. |
1084 | QStringList paramlist = QStringList::split(";", parameters); | 1084 | QStringList paramlist = QStringList::split(";", parameters); |
1085 | 1085 | ||
1086 | //Now check how many parts we have. | 1086 | //Now check how many parts we have. |
1087 | //=0 :no params to pass | 1087 | //=0 :no params to pass |
1088 | //>0 :parameters to pass | 1088 | //>0 :parameters to pass |
1089 | for ( QStringList::Iterator it = paramlist.begin(); it != paramlist.end(); ++it ) | 1089 | for ( QStringList::Iterator it = paramlist.begin(); it != paramlist.end(); ++it ) |
1090 | { | 1090 | { |
1091 | QString param = (*it); | 1091 | QString param = (*it); |
1092 | QStringList keyvallist = QStringList::split("=", param); | 1092 | QStringList keyvallist = QStringList::split("=", param); |
1093 | 1093 | ||
1094 | //if we have keyvalue pairs, we assume that we pass a map to the envelope | 1094 | //if we have keyvalue pairs, we assume that we pass a map to the envelope |
1095 | QStringList::Iterator it2 = keyvallist.begin(); | 1095 | QStringList::Iterator it2 = keyvallist.begin(); |
1096 | QString key = (*it2); | 1096 | QString key = (*it2); |
1097 | key = key.replace( QRegExp("%1"), param1 ); | 1097 | key = key.replace( QRegExp("%1"), param1 ); |
1098 | key = key.replace( QRegExp("%2"), param2 ); | 1098 | key = key.replace( QRegExp("%2"), param2 ); |
1099 | ++it2; | 1099 | ++it2; |
1100 | 1100 | ||
1101 | if(it2 != keyvallist.end()) | 1101 | if(it2 != keyvallist.end()) |
1102 | { | 1102 | { |
1103 | QString value = (*it2); | 1103 | QString value = (*it2); |
1104 | value = value.replace( QRegExp("%1"), param1 ); | 1104 | value = value.replace( QRegExp("%1"), param1 ); |
1105 | value = value.replace( QRegExp("%2"), param2 ); | 1105 | value = value.replace( QRegExp("%2"), param2 ); |
1106 | 1106 | ||
1107 | valmap.insert(key, value); | 1107 | valmap.insert(key, value); |
1108 | useValMap = true; | 1108 | useValMap = true; |
1109 | } | 1109 | } |
1110 | else | 1110 | else |
1111 | { | 1111 | { |
1112 | // qDebug("pass parameter << %s", key.latin1()); | 1112 | // qDebug("pass parameter << %s", key.latin1()); |
1113 | (*e) << key; | 1113 | (*e) << key; |
1114 | } | 1114 | } |
1115 | } | 1115 | } |
1116 | 1116 | ||
1117 | if (useValMap == true) | 1117 | if (useValMap == true) |
1118 | (*e) << valmap; | 1118 | (*e) << valmap; |
1119 | 1119 | ||
1120 | #endif | 1120 | #endif |
1121 | 1121 | ||
1122 | } | 1122 | } |
1123 | 1123 | ||
1124 | 1124 | ||
1125 | 1125 | ||
1126 | /************************************************************************** | 1126 | /************************************************************************** |
1127 | * | 1127 | * |
1128 | **************************************************************************/ | 1128 | **************************************************************************/ |
1129 | 1129 | ||
1130 | void ExternalAppHandler::appMessage( const QCString& cmsg, const QByteArray& data ) | 1130 | void ExternalAppHandler::appMessage( const QCString& cmsg, const QByteArray& data ) |
1131 | { | 1131 | { |
1132 | 1132 | ||
1133 | if ( cmsg == "nextView()" ) { | 1133 | if ( cmsg == "nextView()" ) { |
1134 | qDebug("nextView()"); | 1134 | qDebug("nextView()"); |
1135 | emit nextView(); | 1135 | emit nextView(); |
1136 | return; | 1136 | return; |
1137 | } | 1137 | } |
1138 | if ( cmsg == "callContactdialog()" ) { | 1138 | if ( cmsg == "callContactdialog()" ) { |
1139 | qDebug("callContactdialog()"); | 1139 | qDebug("callContactdialog()"); |
1140 | emit callContactdialog(); | 1140 | emit callContactdialog(); |
1141 | return; | 1141 | return; |
1142 | } | 1142 | } |
1143 | 1143 | ||
1144 | bool res = mNameEmailUidListFromKAPITransfer->appMessage( cmsg, data ); | 1144 | bool res = mNameEmailUidListFromKAPITransfer->appMessage( cmsg, data ); |
1145 | if (!res) | 1145 | if (!res) |
1146 | res = mBirthdayListFromKAPITransfer->appMessage( cmsg, data ); | 1146 | res = mBirthdayListFromKAPITransfer->appMessage( cmsg, data ); |
1147 | 1147 | ||
1148 | if (!res) | 1148 | if (!res) |
1149 | res = mDisplayDetails->appMessage( cmsg, data ); | 1149 | res = mDisplayDetails->appMessage( cmsg, data ); |
1150 | 1150 | ||
1151 | // if (!res) | 1151 | // if (!res) |
1152 | // res = mNameEmailUidListFromKAPITransfer->appMessage( cmsg, data ); | 1152 | // res = mNameEmailUidListFromKAPITransfer->appMessage( cmsg, data ); |
1153 | } | 1153 | } |
1154 | 1154 | ||
1155 | 1155 | ||
1156 | 1156 | ||
1157 | bool ExternalAppHandler::requestNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid) | 1157 | bool ExternalAppHandler::requestNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid) |
1158 | { | 1158 | { |
1159 | mNameEmailUidListFromKAPITransfer->setSourceChannel(sourceChannel); | 1159 | mNameEmailUidListFromKAPITransfer->setSourceChannel(sourceChannel); |
1160 | // maybe we are sending to KA/Pi fom a different worldd... | 1160 | // maybe we are sending to KA/Pi fom a different worldd... |
1161 | // it may be that the QAplication::desktop()->width() values in KA/Pi are not the same as in our application | 1161 | // it may be that the QAplication::desktop()->width() values in KA/Pi are not the same as in our application |
1162 | // for that reason we send the current QApplication::desktop()->width() to KA/Pi | 1162 | // for that reason we send the current QApplication::desktop()->width() to KA/Pi |
1163 | //qDebug("UID %s ", sessionuid.latin1()); | 1163 | //qDebug("UID %s ", sessionuid.latin1()); |
1164 | return mNameEmailUidListFromKAPITransfer->sendMessageToTarget(QString::number ( QApplication::desktop()->width() )); | 1164 | //return mNameEmailUidListFromKAPITransfer->sendMessageToTarget(QString::number ( QApplication::desktop()->width() )); |
1165 | //return mNameEmailUidListFromKAPITransfer->sendMessageToTarget(sessionuid); | 1165 | return mNameEmailUidListFromKAPITransfer->sendMessageToTarget(sessionuid); |
1166 | } | 1166 | } |
1167 | 1167 | ||
1168 | bool ExternalAppHandler::returnNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& list1, const QStringList& list2, const QStringList& list3) | 1168 | bool ExternalAppHandler::returnNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& list1, const QStringList& list2, const QStringList& list3) |
1169 | { | 1169 | { |
1170 | QStringList list4, list5, list6; | 1170 | QStringList list4, list5, list6; |
1171 | 1171 | ||
1172 | mNameEmailUidListFromKAPITransfer->setSourceChannel(sourceChannel); | 1172 | mNameEmailUidListFromKAPITransfer->setSourceChannel(sourceChannel); |
1173 | return mNameEmailUidListFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3, list4, list5, list6); | 1173 | return mNameEmailUidListFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3, list4, list5, list6); |
1174 | } | 1174 | } |
1175 | 1175 | ||
1176 | bool ExternalAppHandler::requestFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QString& email) | 1176 | bool ExternalAppHandler::requestFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QString& email) |
1177 | { | 1177 | { |
1178 | mFindByEmailFromKAPITransfer->setSourceChannel(sourceChannel); | 1178 | mFindByEmailFromKAPITransfer->setSourceChannel(sourceChannel); |
1179 | return mFindByEmailFromKAPITransfer->sendMessageToTarget(sessionuid, email); | 1179 | return mFindByEmailFromKAPITransfer->sendMessageToTarget(sessionuid, email); |
1180 | } | 1180 | } |
1181 | 1181 | ||
1182 | bool ExternalAppHandler::returnFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& list1, const QStringList& list2, const QStringList& list3) | 1182 | bool ExternalAppHandler::returnFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& list1, const QStringList& list2, const QStringList& list3) |
1183 | { | 1183 | { |
1184 | QStringList list4, list5, list6; | 1184 | QStringList list4, list5, list6; |
1185 | 1185 | ||
1186 | mFindByEmailFromKAPITransfer->setSourceChannel(sourceChannel); | 1186 | mFindByEmailFromKAPITransfer->setSourceChannel(sourceChannel); |
1187 | return mFindByEmailFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3, list4, list5, list6); | 1187 | return mFindByEmailFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3, list4, list5, list6); |
1188 | } | 1188 | } |
1189 | 1189 | ||
1190 | bool ExternalAppHandler::requestDetailsFromKAPI(const QString& name, const QString& email, const QString& uid) | 1190 | bool ExternalAppHandler::requestDetailsFromKAPI(const QString& name, const QString& email, const QString& uid) |
1191 | { | 1191 | { |
1192 | mDisplayDetails->setSourceChannel(""); | 1192 | mDisplayDetails->setSourceChannel(""); |
1193 | return mDisplayDetails->sendMessageToTarget("", name, email, uid); | 1193 | return mDisplayDetails->sendMessageToTarget("", name, email, uid); |
1194 | } | 1194 | } |
1195 | 1195 | ||
1196 | bool ExternalAppHandler::requestBirthdayListFromKAPI(const QString& sourceChannel, const QString& sessionuid) | 1196 | bool ExternalAppHandler::requestBirthdayListFromKAPI(const QString& sourceChannel, const QString& sessionuid) |
1197 | { | 1197 | { |
1198 | mBirthdayListFromKAPITransfer->setSourceChannel(sourceChannel); | 1198 | mBirthdayListFromKAPITransfer->setSourceChannel(sourceChannel); |
1199 | return mBirthdayListFromKAPITransfer->sendMessageToTarget(sessionuid); | 1199 | return mBirthdayListFromKAPITransfer->sendMessageToTarget(sessionuid); |
1200 | } | 1200 | } |
1201 | 1201 | ||
1202 | bool ExternalAppHandler::returnBirthdayListFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& list1, const QStringList& list2, const QStringList& list3, const QStringList& list4, const QStringList& list5, const QStringList& list6) | 1202 | bool ExternalAppHandler::returnBirthdayListFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& list1, const QStringList& list2, const QStringList& list3, const QStringList& list4, const QStringList& list5, const QStringList& list6) |
1203 | { | 1203 | { |
1204 | mBirthdayListFromKAPITransfer->setSourceChannel(sourceChannel); | 1204 | mBirthdayListFromKAPITransfer->setSourceChannel(sourceChannel); |
1205 | return mBirthdayListFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3, list4, list5, list6); | 1205 | return mBirthdayListFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3, list4, list5, list6); |
1206 | } | 1206 | } |
1207 | 1207 | ||
1208 | 1208 | ||
1209 | 1209 | ||
1210 | 1210 | ||
1211 | 1211 | ||