-rw-r--r-- | kaddressbook/kabcore.cpp | 146 |
1 files changed, 78 insertions, 68 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index ab2824c..03b44d1 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -1,1495 +1,1505 @@ | |||
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 <q3progressbar.h> |
43 | #include <QDesktopWidget> | ||
44 | //Added by qt3to4: | ||
45 | #include <QResizeEvent> | ||
46 | #include <QPixmap> | ||
47 | #include <Q3ValueList> | ||
48 | #include <Q3HBoxLayout> | ||
49 | #include <Q3VBoxLayout> | ||
50 | #include <Q3CString> | ||
51 | #include <Q3PopupMenu> | ||
52 | #include <Q3PtrList> | ||
43 | #include <libkdepim/phoneaccess.h> | 53 | #include <libkdepim/phoneaccess.h> |
44 | 54 | ||
45 | #ifndef KAB_EMBEDDED | 55 | #ifndef KAB_EMBEDDED |
46 | #include <qclipboard.h> | 56 | #include <qclipboard.h> |
47 | #include <qdir.h> | 57 | #include <qdir.h> |
48 | #include <qfile.h> | 58 | #include <qfile.h> |
49 | #include <qapplicaton.h> | 59 | #include <qapplicaton.h> |
50 | #include <qprogressbar.h> | 60 | #include <q3progressbar.h> |
51 | #include <qlayout.h> | 61 | #include <qlayout.h> |
52 | #include <qregexp.h> | 62 | #include <qregexp.h> |
53 | #include <qvbox.h> | 63 | #include <q3vbox.h> |
54 | #include <kabc/addresseelist.h> | 64 | #include <kabc/addresseelist.h> |
55 | #include <kabc/errorhandler.h> | 65 | #include <kabc/errorhandler.h> |
56 | #include <kabc/resource.h> | 66 | #include <kabc/resource.h> |
57 | #include <kabc/vcardconverter.h> | 67 | #include <kabc/vcardconverter.h> |
58 | #include <kapplication.h> | 68 | #include <kapplication.h> |
59 | #include <kactionclasses.h> | 69 | #include <kactionclasses.h> |
60 | #include <kcmultidialog.h> | 70 | #include <kcmultidialog.h> |
61 | #include <kdebug.h> | 71 | #include <kdebug.h> |
62 | #include <kdeversion.h> | 72 | #include <kdeversion.h> |
63 | #include <kkeydialog.h> | 73 | #include <kkeydialog.h> |
64 | #include <kmessagebox.h> | 74 | #include <kmessagebox.h> |
65 | #include <kprinter.h> | 75 | #include <kprinter.h> |
66 | #include <kprotocolinfo.h> | 76 | #include <kprotocolinfo.h> |
67 | #include <kresources/selectdialog.h> | 77 | #include <kresources/selectdialog.h> |
68 | #include <kstandarddirs.h> | 78 | #include <kstandarddirs.h> |
69 | #include <ktempfile.h> | 79 | #include <ktempfile.h> |
70 | #include <kxmlguiclient.h> | 80 | #include <kxmlguiclient.h> |
71 | #include <kaboutdata.h> | 81 | #include <kaboutdata.h> |
72 | #include <libkdepim/categoryselectdialog.h> | 82 | #include <libkdepim/categoryselectdialog.h> |
73 | 83 | ||
74 | #include "addresseeutil.h" | 84 | #include "addresseeutil.h" |
75 | #include "addresseeeditordialog.h" | 85 | #include "addresseeeditordialog.h" |
76 | #include "extensionmanager.h" | 86 | #include "extensionmanager.h" |
77 | #include "kstdaction.h" | 87 | #include "kstdaction.h" |
78 | #include "kaddressbookservice.h" | 88 | #include "kaddressbookservice.h" |
79 | #include "ldapsearchdialog.h" | 89 | #include "ldapsearchdialog.h" |
80 | #include "printing/printingwizard.h" | 90 | #include "printing/printingwizard.h" |
81 | #else // KAB_EMBEDDED | 91 | #else // KAB_EMBEDDED |
82 | 92 | ||
83 | #include <kapplication.h> | 93 | #include <kapplication.h> |
84 | #include "KDGanttMinimizeSplitter.h" | 94 | #include "KDGanttMinimizeSplitter.h" |
85 | #include "kaddressbookmain.h" | 95 | #include "kaddressbookmain.h" |
86 | #include "kactioncollection.h" | 96 | #include "kactioncollection.h" |
87 | #include "addresseedialog.h" | 97 | #include "addresseedialog.h" |
88 | //US | 98 | //US |
89 | #include <addresseeview.h> | 99 | #include <addresseeview.h> |
90 | 100 | ||
91 | #include <qapp.h> | 101 | #include <qapplication.h> |
92 | #include <qmenubar.h> | 102 | #include <qmenubar.h> |
93 | //#include <qtoolbar.h> | 103 | //#include <qtoolbar.h> |
94 | #include <qmessagebox.h> | 104 | #include <qmessagebox.h> |
95 | #include <kdebug.h> | 105 | #include <kdebug.h> |
96 | #include <kiconloader.h> // needed for SmallIcon | 106 | #include <kiconloader.h> // needed for SmallIcon |
97 | #include <kresources/kcmkresources.h> | 107 | #include <kresources/kcmkresources.h> |
98 | #include <ktoolbar.h> | 108 | #include <ktoolbar.h> |
99 | #include <kprefsdialog.h> | 109 | #include <kprefsdialog.h> |
100 | 110 | ||
101 | 111 | ||
102 | //#include <qlabel.h> | 112 | //#include <qlabel.h> |
103 | 113 | ||
104 | 114 | ||
105 | #ifndef DESKTOP_VERSION | 115 | #ifndef DESKTOP_VERSION |
106 | #include <qpe/ir.h> | 116 | #include <qpe/ir.h> |
107 | #include <qpe/qpemenubar.h> | 117 | #include <qpe/qpemenubar.h> |
108 | #include <qtopia/qcopenvelope_qws.h> | 118 | #include <qtopia/qcopenvelope_qws.h> |
109 | #else | 119 | #else |
110 | 120 | ||
111 | #include <qmenubar.h> | 121 | #include <qmenubar.h> |
112 | #endif | 122 | #endif |
113 | 123 | ||
114 | #endif // KAB_EMBEDDED | 124 | #endif // KAB_EMBEDDED |
115 | #include "kcmconfigs/kcmkabconfig.h" | 125 | #include "kcmconfigs/kcmkabconfig.h" |
116 | #include "kcmconfigs/kcmkdepimconfig.h" | 126 | #include "kcmconfigs/kcmkdepimconfig.h" |
117 | #include "kpimglobalprefs.h" | 127 | #include "kpimglobalprefs.h" |
118 | #include "externalapphandler.h" | 128 | #include "externalapphandler.h" |
119 | #include "xxportselectdialog.h" | 129 | #include "xxportselectdialog.h" |
120 | 130 | ||
121 | 131 | ||
122 | #include <kresources/selectdialog.h> | 132 | #include <kresources/selectdialog.h> |
123 | #include <kmessagebox.h> | 133 | #include <kmessagebox.h> |
124 | 134 | ||
125 | #include <picture.h> | 135 | #include <picture.h> |
126 | #include <resource.h> | 136 | #include <resource.h> |
127 | 137 | ||
128 | //US#include <qsplitter.h> | 138 | //US#include <qsplitter.h> |
129 | #include <qmap.h> | 139 | #include <qmap.h> |
130 | #include <qdir.h> | 140 | #include <qdir.h> |
131 | #include <qfile.h> | 141 | #include <qfile.h> |
132 | #include <qvbox.h> | 142 | #include <q3vbox.h> |
133 | #include <qlayout.h> | 143 | #include <qlayout.h> |
134 | #include <qclipboard.h> | 144 | #include <qclipboard.h> |
135 | #include <qtextstream.h> | 145 | #include <q3textstream.h> |
136 | #include <qradiobutton.h> | 146 | #include <qradiobutton.h> |
137 | #include <qbuttongroup.h> | 147 | #include <q3buttongroup.h> |
138 | 148 | ||
139 | #include <libkdepim/categoryselectdialog.h> | 149 | #include <libkdepim/categoryselectdialog.h> |
140 | #include <libkdepim/categoryeditdialog.h> | 150 | #include <libkdepim/categoryeditdialog.h> |
141 | #include <kabc/vcardconverter.h> | 151 | #include <kabc/vcardconverter.h> |
142 | 152 | ||
143 | 153 | ||
144 | #include "addresseeutil.h" | 154 | #include "addresseeutil.h" |
145 | #include "undocmds.h" | 155 | #include "undocmds.h" |
146 | #include "addresseeeditordialog.h" | 156 | #include "addresseeeditordialog.h" |
147 | #include "viewmanager.h" | 157 | #include "viewmanager.h" |
148 | #include "details/detailsviewcontainer.h" | 158 | #include "details/detailsviewcontainer.h" |
149 | #include "kabprefs.h" | 159 | #include "kabprefs.h" |
150 | #include "xxportmanager.h" | 160 | #include "xxportmanager.h" |
151 | #include "incsearchwidget.h" | 161 | #include "incsearchwidget.h" |
152 | #include "jumpbuttonbar.h" | 162 | #include "jumpbuttonbar.h" |
153 | #include "extensionmanager.h" | 163 | #include "extensionmanager.h" |
154 | #include "addresseeconfig.h" | 164 | #include "addresseeconfig.h" |
155 | #include "nameeditdialog.h" | 165 | #include "nameeditdialog.h" |
156 | #include <kcmultidialog.h> | 166 | #include <kcmultidialog.h> |
157 | 167 | ||
158 | #ifdef _WIN32_ | 168 | #ifdef _WIN32_ |
159 | #ifdef _OL_IMPORT_ | 169 | #ifdef _OL_IMPORT_ |
160 | #include "kaimportoldialog.h" | 170 | #include "kaimportoldialog.h" |
161 | #include <libkdepim/ol_access.h> | 171 | #include <libkdepim/ol_access.h> |
162 | #endif | 172 | #endif |
163 | #else | 173 | #else |
164 | #include <unistd.h> | 174 | #include <unistd.h> |
165 | #endif | 175 | #endif |
166 | // sync includes | 176 | // sync includes |
167 | #include <libkdepim/ksyncprofile.h> | 177 | #include <libkdepim/ksyncprofile.h> |
168 | #include <libkdepim/ksyncprefsdialog.h> | 178 | #include <libkdepim/ksyncprefsdialog.h> |
169 | 179 | ||
170 | 180 | ||
171 | class KABCatPrefs : public QDialog | 181 | class KABCatPrefs : public QDialog |
172 | { | 182 | { |
173 | public: | 183 | public: |
174 | KABCatPrefs( QWidget *parent=0, const char *name=0 ) : | 184 | KABCatPrefs( QWidget *parent=0, const char *name=0 ) : |
175 | QDialog( parent, name, true ) | 185 | QDialog( parent, name, true ) |
176 | { | 186 | { |
177 | setCaption( i18n("Manage new Categories") ); | 187 | setCaption( i18n("Manage new Categories") ); |
178 | QVBoxLayout* lay = new QVBoxLayout( this ); | 188 | Q3VBoxLayout* lay = new Q3VBoxLayout( this ); |
179 | lay->setSpacing( 3 ); | 189 | lay->setSpacing( 3 ); |
180 | lay->setMargin( 3 ); | 190 | lay->setMargin( 3 ); |
181 | 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 ); | 191 | 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 ); |
182 | lay->addWidget( lab ); | 192 | lay->addWidget( lab ); |
183 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); | 193 | Q3ButtonGroup* format = new Q3ButtonGroup( 1, Qt::Horizontal, i18n("New categories not in list:"), this ); |
184 | lay->addWidget( format ); | 194 | lay->addWidget( format ); |
185 | format->setExclusive ( true ) ; | 195 | format->setExclusive ( true ) ; |
186 | addCatBut = new QRadioButton(i18n("Add to category list"), format ); | 196 | addCatBut = new QRadioButton(i18n("Add to category list"), format ); |
187 | new QRadioButton(i18n("Remove from addressees"), format ); | 197 | new QRadioButton(i18n("Remove from addressees"), format ); |
188 | addCatBut->setChecked( true ); | 198 | addCatBut->setChecked( true ); |
189 | QPushButton * ok = new QPushButton( i18n("OK"), this ); | 199 | QPushButton * ok = new QPushButton( i18n("OK"), this ); |
190 | lay->addWidget( ok ); | 200 | lay->addWidget( ok ); |
191 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 201 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
192 | lay->addWidget( cancel ); | 202 | lay->addWidget( cancel ); |
193 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 203 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
194 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 204 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
195 | resize( 200, 200 ); | 205 | resize( 200, 200 ); |
196 | } | 206 | } |
197 | 207 | ||
198 | bool addCat() { return addCatBut->isChecked(); } | 208 | bool addCat() { return addCatBut->isChecked(); } |
199 | private: | 209 | private: |
200 | QRadioButton* addCatBut; | 210 | QRadioButton* addCatBut; |
201 | }; | 211 | }; |
202 | 212 | ||
203 | class KABFormatPrefs : public QDialog | 213 | class KABFormatPrefs : public QDialog |
204 | { | 214 | { |
205 | public: | 215 | public: |
206 | KABFormatPrefs( QWidget *parent=0, const char *name=0 ) : | 216 | KABFormatPrefs( QWidget *parent=0, const char *name=0 ) : |
207 | QDialog( parent, name, true ) | 217 | QDialog( parent, name, true ) |
208 | { | 218 | { |
209 | setCaption( i18n("Set formatted name") ); | 219 | setCaption( i18n("Set formatted name") ); |
210 | QVBoxLayout* lay = new QVBoxLayout( this ); | 220 | Q3VBoxLayout* lay = new Q3VBoxLayout( this ); |
211 | lay->setSpacing( 3 ); | 221 | lay->setSpacing( 3 ); |
212 | lay->setMargin( 3 ); | 222 | lay->setMargin( 3 ); |
213 | QLabel * lab = new QLabel( i18n("You can set the formatted name\nfor a list of contacts in one go."), this ); | 223 | QLabel * lab = new QLabel( i18n("You can set the formatted name\nfor a list of contacts in one go."), this ); |
214 | lay->addWidget( lab ); | 224 | lay->addWidget( lab ); |
215 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("Set formatted name to:"), this ); | 225 | Q3ButtonGroup* format = new Q3ButtonGroup( 1, Qt::Horizontal, i18n("Set formatted name to:"), this ); |
216 | lay->addWidget( format ); | 226 | lay->addWidget( format ); |
217 | format->setExclusive ( true ) ; | 227 | format->setExclusive ( true ) ; |
218 | simple = new QRadioButton(i18n("Simple: James Bond"), format ); | 228 | simple = new QRadioButton(i18n("Simple: James Bond"), format ); |
219 | full = new QRadioButton(i18n("Full: Mr. James 007 Bond I"), format ); | 229 | full = new QRadioButton(i18n("Full: Mr. James 007 Bond I"), format ); |
220 | reverse = new QRadioButton(i18n("Reverse: Bond, James"), format ); | 230 | reverse = new QRadioButton(i18n("Reverse: Bond, James"), format ); |
221 | company = new QRadioButton(i18n("Organization: MI6"), format ); | 231 | company = new QRadioButton(i18n("Organization: MI6"), format ); |
222 | simple->setChecked( true ); | 232 | simple->setChecked( true ); |
223 | setCompany = new QCheckBox(i18n("Set formatted name to\norganization, if name empty"), this); | 233 | setCompany = new QCheckBox(i18n("Set formatted name to\norganization, if name empty"), this); |
224 | lay->addWidget( setCompany ); | 234 | lay->addWidget( setCompany ); |
225 | QPushButton * ok = new QPushButton( i18n("Select contact list"), this ); | 235 | QPushButton * ok = new QPushButton( i18n("Select contact list"), this ); |
226 | lay->addWidget( ok ); | 236 | lay->addWidget( ok ); |
227 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 237 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
228 | lay->addWidget( cancel ); | 238 | lay->addWidget( cancel ); |
229 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 239 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
230 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 240 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
231 | //resize( 200, 200 ); | 241 | //resize( 200, 200 ); |
232 | 242 | ||
233 | } | 243 | } |
234 | public: | 244 | public: |
235 | QRadioButton* simple, *full, *reverse, *company; | 245 | QRadioButton* simple, *full, *reverse, *company; |
236 | QCheckBox* setCompany; | 246 | QCheckBox* setCompany; |
237 | }; | 247 | }; |
238 | 248 | ||
239 | 249 | ||
240 | 250 | ||
241 | class KAex2phonePrefs : public QDialog | 251 | class KAex2phonePrefs : public QDialog |
242 | { | 252 | { |
243 | public: | 253 | public: |
244 | KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) : | 254 | KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) : |
245 | QDialog( parent, name, true ) | 255 | QDialog( parent, name, true ) |
246 | { | 256 | { |
247 | setCaption( i18n("Export to phone options") ); | 257 | setCaption( i18n("Export to phone options") ); |
248 | QVBoxLayout* lay = new QVBoxLayout( this ); | 258 | Q3VBoxLayout* lay = new Q3VBoxLayout( this ); |
249 | lay->setSpacing( 3 ); | 259 | lay->setSpacing( 3 ); |
250 | lay->setMargin( 3 ); | 260 | lay->setMargin( 3 ); |
251 | QLabel *lab; | 261 | QLabel *lab; |
252 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); | 262 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); |
253 | lab->setAlignment (AlignHCenter ); | 263 | lab->setAlignment (Qt::AlignHCenter ); |
254 | QHBox* temphb; | 264 | Q3HBox* temphb; |
255 | temphb = new QHBox( this ); | 265 | temphb = new Q3HBox( this ); |
256 | new QLabel( i18n("I/O device: "), temphb ); | 266 | new QLabel( i18n("I/O device: "), temphb ); |
257 | mPhoneDevice = new QLineEdit( temphb); | 267 | mPhoneDevice = new QLineEdit( temphb); |
258 | lay->addWidget( temphb ); | 268 | lay->addWidget( temphb ); |
259 | temphb = new QHBox( this ); | 269 | temphb = new Q3HBox( this ); |
260 | new QLabel( i18n("Connection: "), temphb ); | 270 | new QLabel( i18n("Connection: "), temphb ); |
261 | mPhoneConnection = new QLineEdit( temphb); | 271 | mPhoneConnection = new QLineEdit( temphb); |
262 | lay->addWidget( temphb ); | 272 | lay->addWidget( temphb ); |
263 | temphb = new QHBox( this ); | 273 | temphb = new Q3HBox( this ); |
264 | new QLabel( i18n("Model(opt.): "), temphb ); | 274 | new QLabel( i18n("Model(opt.): "), temphb ); |
265 | mPhoneModel = new QLineEdit( temphb); | 275 | mPhoneModel = new QLineEdit( temphb); |
266 | lay->addWidget( temphb ); | 276 | lay->addWidget( temphb ); |
267 | // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this ); | 277 | // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this ); |
268 | // lay->addWidget( mWriteToSim ); | 278 | // lay->addWidget( mWriteToSim ); |
269 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) ); | 279 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) ); |
270 | lab->setAlignment (AlignHCenter); | 280 | lab->setAlignment (Qt::AlignHCenter); |
271 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); | 281 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); |
272 | lay->addWidget( ok ); | 282 | lay->addWidget( ok ); |
273 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 283 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
274 | lay->addWidget( cancel ); | 284 | lay->addWidget( cancel ); |
275 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 285 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
276 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 286 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
277 | resize( 220, 240 ); | 287 | resize( 220, 240 ); |
278 | 288 | ||
279 | } | 289 | } |
280 | 290 | ||
281 | public: | 291 | public: |
282 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; | 292 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; |
283 | QCheckBox* mWriteToSim; | 293 | QCheckBox* mWriteToSim; |
284 | }; | 294 | }; |
285 | 295 | ||
286 | 296 | ||
287 | bool pasteWithNewUid = true; | 297 | bool pasteWithNewUid = true; |
288 | 298 | ||
289 | #ifdef KAB_EMBEDDED | 299 | #ifdef KAB_EMBEDDED |
290 | KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) | 300 | KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) |
291 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), | 301 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), |
292 | mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ | 302 | mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ |
293 | mReadWrite( readWrite ), mModified( false ), mMainWindow(client) | 303 | mReadWrite( readWrite ), mModified( false ), mMainWindow(client) |
294 | #else //KAB_EMBEDDED | 304 | #else //KAB_EMBEDDED |
295 | KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) | 305 | KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) |
296 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), | 306 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), |
297 | mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), | 307 | mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), |
298 | mReadWrite( readWrite ), mModified( false ) | 308 | mReadWrite( readWrite ), mModified( false ) |
299 | #endif //KAB_EMBEDDED | 309 | #endif //KAB_EMBEDDED |
300 | { | 310 | { |
301 | // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); | 311 | // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); |
302 | // syncManager->setBlockSave(false); | 312 | // syncManager->setBlockSave(false); |
303 | mIncSearchWidget = 0; | 313 | mIncSearchWidget = 0; |
304 | mMiniSplitter = 0; | 314 | mMiniSplitter = 0; |
305 | mExtensionBarSplitter = 0; | 315 | mExtensionBarSplitter = 0; |
306 | mIsPart = !parent->inherits( "KAddressBookMain" ); | 316 | mIsPart = !parent->inherits( "KAddressBookMain" ); |
307 | mAddressBook = KABC::StdAddressBook::selfNoLoad(); | 317 | mAddressBook = KABC::StdAddressBook::selfNoLoad(); |
308 | KABC::StdAddressBook::setAutomaticSave( false ); | 318 | KABC::StdAddressBook::setAutomaticSave( false ); |
309 | 319 | ||
310 | #ifndef KAB_EMBEDDED | 320 | #ifndef KAB_EMBEDDED |
311 | mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); | 321 | mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); |
312 | #endif //KAB_EMBEDDED | 322 | #endif //KAB_EMBEDDED |
313 | 323 | ||
314 | connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), | 324 | connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), |
315 | SLOT( addressBookChanged() ) ); | 325 | SLOT( addressBookChanged() ) ); |
316 | 326 | ||
317 | #if 0 | 327 | #if 0 |
318 | // LR moved to addressbook init method | 328 | // LR moved to addressbook init method |
319 | mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, | 329 | mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, |
320 | "X-Department", "KADDRESSBOOK" ); | 330 | "X-Department", "KADDRESSBOOK" ); |
321 | mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, | 331 | mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, |
322 | "X-Profession", "KADDRESSBOOK" ); | 332 | "X-Profession", "KADDRESSBOOK" ); |
323 | mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, | 333 | mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, |
324 | "X-AssistantsName", "KADDRESSBOOK" ); | 334 | "X-AssistantsName", "KADDRESSBOOK" ); |
325 | mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, | 335 | mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, |
326 | "X-ManagersName", "KADDRESSBOOK" ); | 336 | "X-ManagersName", "KADDRESSBOOK" ); |
327 | mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, | 337 | mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, |
328 | "X-SpousesName", "KADDRESSBOOK" ); | 338 | "X-SpousesName", "KADDRESSBOOK" ); |
329 | mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, | 339 | mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, |
330 | "X-Office", "KADDRESSBOOK" ); | 340 | "X-Office", "KADDRESSBOOK" ); |
331 | mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, | 341 | mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, |
332 | "X-IMAddress", "KADDRESSBOOK" ); | 342 | "X-IMAddress", "KADDRESSBOOK" ); |
333 | mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, | 343 | mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, |
334 | "X-Anniversary", "KADDRESSBOOK" ); | 344 | "X-Anniversary", "KADDRESSBOOK" ); |
335 | 345 | ||
336 | //US added this field to become compatible with Opie/qtopia addressbook | 346 | //US added this field to become compatible with Opie/qtopia addressbook |
337 | // values can be "female" or "male" or "". An empty field represents undefined. | 347 | // values can be "female" or "male" or "". An empty field represents undefined. |
338 | mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, | 348 | mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, |
339 | "X-Gender", "KADDRESSBOOK" ); | 349 | "X-Gender", "KADDRESSBOOK" ); |
340 | mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, | 350 | mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, |
341 | "X-Children", "KADDRESSBOOK" ); | 351 | "X-Children", "KADDRESSBOOK" ); |
342 | mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, | 352 | mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, |
343 | "X-FreeBusyUrl", "KADDRESSBOOK" ); | 353 | "X-FreeBusyUrl", "KADDRESSBOOK" ); |
344 | #endif | 354 | #endif |
345 | initGUI(); | 355 | initGUI(); |
346 | 356 | ||
347 | mIncSearchWidget->setFocus(); | 357 | mIncSearchWidget->setFocus(); |
348 | 358 | ||
349 | 359 | ||
350 | connect( mViewManager, SIGNAL( selected( const QString& ) ), | 360 | connect( mViewManager, SIGNAL( selected( const QString& ) ), |
351 | SLOT( setContactSelected( const QString& ) ) ); | 361 | SLOT( setContactSelected( const QString& ) ) ); |
352 | connect( mViewManager, SIGNAL( executed( const QString& ) ), | 362 | connect( mViewManager, SIGNAL( executed( const QString& ) ), |
353 | SLOT( executeContact( const QString& ) ) ); | 363 | SLOT( executeContact( const QString& ) ) ); |
354 | 364 | ||
355 | connect( mViewManager, SIGNAL( deleteRequest( ) ), | 365 | connect( mViewManager, SIGNAL( deleteRequest( ) ), |
356 | SLOT( deleteContacts( ) ) ); | 366 | SLOT( deleteContacts( ) ) ); |
357 | connect( mViewManager, SIGNAL( modified() ), | 367 | connect( mViewManager, SIGNAL( modified() ), |
358 | SLOT( setModified() ) ); | 368 | SLOT( setModified() ) ); |
359 | 369 | ||
360 | connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); | 370 | connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); |
361 | connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); | 371 | connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); |
362 | 372 | ||
363 | connect( mXXPortManager, SIGNAL( modified() ), | 373 | connect( mXXPortManager, SIGNAL( modified() ), |
364 | SLOT( setModified() ) ); | 374 | SLOT( setModified() ) ); |
365 | 375 | ||
366 | connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), | 376 | connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), |
367 | SLOT( incrementalSearchJump( const QString& ) ) ); | 377 | SLOT( incrementalSearchJump( const QString& ) ) ); |
368 | connect( mIncSearchWidget, SIGNAL( fieldChanged() ), | 378 | connect( mIncSearchWidget, SIGNAL( fieldChanged() ), |
369 | mJumpButtonBar, SLOT( recreateButtons() ) ); | 379 | mJumpButtonBar, SLOT( recreateButtons() ) ); |
370 | 380 | ||
371 | connect( mDetails, SIGNAL( sendEmail( const QString& ) ), | 381 | connect( mDetails, SIGNAL( sendEmail( const QString& ) ), |
372 | SLOT( sendMail( const QString& ) ) ); | 382 | SLOT( sendMail( const QString& ) ) ); |
373 | 383 | ||
374 | 384 | ||
375 | connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); | 385 | connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); |
376 | 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&))); | 386 | 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&))); |
377 | connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&))); | 387 | connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&))); |
378 | connect( ExternalAppHandler::instance(), SIGNAL (nextView()),this, SLOT(setDetailsToggle())); | 388 | connect( ExternalAppHandler::instance(), SIGNAL (nextView()),this, SLOT(setDetailsToggle())); |
379 | connect( ExternalAppHandler::instance(), SIGNAL (doRingSync()),this, SLOT( doRingSync())); | 389 | connect( ExternalAppHandler::instance(), SIGNAL (doRingSync()),this, SLOT( doRingSync())); |
380 | connect( ExternalAppHandler::instance(), SIGNAL (callContactdialog()),this, SLOT(callContactdialog())); | 390 | connect( ExternalAppHandler::instance(), SIGNAL (callContactdialog()),this, SLOT(callContactdialog())); |
381 | 391 | ||
382 | 392 | ||
383 | #ifndef KAB_EMBEDDED | 393 | #ifndef KAB_EMBEDDED |
384 | connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), | 394 | connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), |
385 | mXXPortManager, SLOT( importVCard( const KURL& ) ) ); | 395 | mXXPortManager, SLOT( importVCard( const KURL& ) ) ); |
386 | 396 | ||
387 | connect( mDetails, SIGNAL( browse( const QString& ) ), | 397 | connect( mDetails, SIGNAL( browse( const QString& ) ), |
388 | SLOT( browse( const QString& ) ) ); | 398 | SLOT( browse( const QString& ) ) ); |
389 | 399 | ||
390 | 400 | ||
391 | mAddressBookService = new KAddressBookService( this ); | 401 | mAddressBookService = new KAddressBookService( this ); |
392 | 402 | ||
393 | #endif //KAB_EMBEDDED | 403 | #endif //KAB_EMBEDDED |
394 | 404 | ||
395 | mMessageTimer = new QTimer( this ); | 405 | mMessageTimer = new QTimer( this ); |
396 | connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) ); | 406 | connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) ); |
397 | mEditorDialog = 0; | 407 | mEditorDialog = 0; |
398 | createAddresseeEditorDialog( this ); | 408 | createAddresseeEditorDialog( this ); |
399 | setModified( false ); | 409 | setModified( false ); |
400 | mBRdisabled = false; | 410 | mBRdisabled = false; |
401 | #ifndef DESKTOP_VERSION | 411 | #ifndef DESKTOP_VERSION |
402 | infrared = 0; | 412 | infrared = 0; |
403 | #endif | 413 | #endif |
404 | //toggleBeamReceive( ); | 414 | //toggleBeamReceive( ); |
405 | mMainWindow->toolBar()->show(); | 415 | mMainWindow->toolBar()->show(); |
406 | // we have a toolbar repainting error on the Zaurus when starting KA/Pi | 416 | // we have a toolbar repainting error on the Zaurus when starting KA/Pi |
407 | //QTimer::singleShot( 10, this , SLOT ( updateToolBar())); | 417 | //QTimer::singleShot( 10, this , SLOT ( updateToolBar())); |
408 | QTimer::singleShot( 100, this, SLOT ( loadDataAfterStart() )); | 418 | QTimer::singleShot( 100, this, SLOT ( loadDataAfterStart() )); |
409 | } | 419 | } |
410 | void KABCore::receiveStart( const QCString& cmsg, const QByteArray& data ) | 420 | void KABCore::receiveStart( const Q3CString& cmsg, const QByteArray& data ) |
411 | { | 421 | { |
412 | //qDebug("KO: QCOP start message received: %s ", cmsg.data() ); | 422 | //qDebug("KO: QCOP start message received: %s ", cmsg.data() ); |
413 | mCStringMess = cmsg; | 423 | mCStringMess = cmsg; |
414 | mByteData = data; | 424 | mByteData = data; |
415 | } | 425 | } |
416 | 426 | ||
417 | void KABCore::loadDataAfterStart() | 427 | void KABCore::loadDataAfterStart() |
418 | { | 428 | { |
419 | //qDebug("KABCore::loadDataAfterStart() "); | 429 | //qDebug("KABCore::loadDataAfterStart() "); |
420 | ((StdAddressBook*)mAddressBook)->init( true ); | 430 | ((StdAddressBook*)mAddressBook)->init( true ); |
421 | mViewManager->refreshView(); | 431 | mViewManager->refreshView(); |
422 | 432 | ||
423 | #ifndef DESKTOP_VERSION | 433 | #ifndef DESKTOP_VERSION |
424 | disconnect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), this, SLOT (receiveStart ( const QCString &, const QByteArray & ))); | 434 | disconnect(qApp, SIGNAL (appMessage ( const Q3CString &, const QByteArray & )), this, SLOT (receiveStart ( const Q3CString &, const QByteArray & ))); |
425 | 435 | ||
426 | QObject::connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); | 436 | QObject::connect(qApp, SIGNAL (appMessage ( const Q3CString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const Q3CString &, const QByteArray & ))); |
427 | if ( !mCStringMess.isEmpty() ) | 437 | if ( !mCStringMess.isEmpty() ) |
428 | ExternalAppHandler::instance()->appMessage( mCStringMess, mByteData ); | 438 | ExternalAppHandler::instance()->appMessage( mCStringMess, mByteData ); |
429 | #endif | 439 | #endif |
430 | // QTimer::singleShot( 10, this , SLOT ( updateToolBar())); | 440 | // QTimer::singleShot( 10, this , SLOT ( updateToolBar())); |
431 | setCaptionBack(); | 441 | setCaptionBack(); |
432 | } | 442 | } |
433 | void KABCore::updateToolBar() | 443 | void KABCore::updateToolBar() |
434 | { | 444 | { |
435 | static int iii = 0; | 445 | static int iii = 0; |
436 | ++iii; | 446 | ++iii; |
437 | mMainWindow->toolBar()->repaintMe(); | 447 | mMainWindow->toolBar()->repaintMe(); |
438 | if ( iii < 4 ) | 448 | if ( iii < 4 ) |
439 | QTimer::singleShot( 100*iii, this , SLOT ( updateToolBar())); | 449 | QTimer::singleShot( 100*iii, this , SLOT ( updateToolBar())); |
440 | } | 450 | } |
441 | KABCore::~KABCore() | 451 | KABCore::~KABCore() |
442 | { | 452 | { |
443 | // save(); | 453 | // save(); |
444 | //saveSettings(); | 454 | //saveSettings(); |
445 | //KABPrefs::instance()->writeConfig(); | 455 | //KABPrefs::instance()->writeConfig(); |
446 | delete AddresseeConfig::instance(); | 456 | delete AddresseeConfig::instance(); |
447 | mAddressBook = 0; | 457 | mAddressBook = 0; |
448 | KABC::StdAddressBook::close(); | 458 | KABC::StdAddressBook::close(); |
449 | 459 | ||
450 | delete syncManager; | 460 | delete syncManager; |
451 | #ifndef DESKTOP_VERSION | 461 | #ifndef DESKTOP_VERSION |
452 | if ( infrared ) | 462 | if ( infrared ) |
453 | delete infrared; | 463 | delete infrared; |
454 | #endif | 464 | #endif |
455 | } | 465 | } |
456 | void KABCore::receive( const QCString& cmsg, const QByteArray& data ) | 466 | void KABCore::receive( const Q3CString& cmsg, const QByteArray& data ) |
457 | { | 467 | { |
458 | //qDebug("KA: QCOP message received: %s ", cmsg.data() ); | 468 | //qDebug("KA: QCOP message received: %s ", cmsg.data() ); |
459 | if ( cmsg == "setDocument(QString)" ) { | 469 | if ( cmsg == "setDocument(QString)" ) { |
460 | QDataStream stream( data, IO_ReadOnly ); | 470 | QDataStream stream( const_cast<QByteArray*>(&data), QIODevice::ReadOnly ); |
461 | QString fileName; | 471 | QString fileName; |
462 | stream >> fileName; | 472 | stream >> fileName; |
463 | recieve( fileName ); | 473 | recieve( fileName ); |
464 | return; | 474 | return; |
465 | } | 475 | } |
466 | } | 476 | } |
467 | void KABCore::toggleBeamReceive( ) | 477 | void KABCore::toggleBeamReceive( ) |
468 | { | 478 | { |
469 | if ( mBRdisabled ) | 479 | if ( mBRdisabled ) |
470 | return; | 480 | return; |
471 | #ifndef DESKTOP_VERSION | 481 | #ifndef DESKTOP_VERSION |
472 | if ( infrared ) { | 482 | if ( infrared ) { |
473 | qDebug("KA: AB disable BeamReceive "); | 483 | qDebug("KA: AB disable BeamReceive "); |
474 | delete infrared; | 484 | delete infrared; |
475 | infrared = 0; | 485 | infrared = 0; |
476 | mActionBR->setChecked(false); | 486 | mActionBR->setChecked(false); |
477 | return; | 487 | return; |
478 | } | 488 | } |
479 | qDebug("KA: AB enable BeamReceive "); | 489 | qDebug("KA: AB enable BeamReceive "); |
480 | mActionBR->setChecked(true); | 490 | mActionBR->setChecked(true); |
481 | 491 | ||
482 | infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ; | 492 | infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ; |
483 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& ))); | 493 | QObject::connect( infrared, SIGNAL (received ( const Q3CString &, const QByteArray & )),this, SLOT(receive( const Q3CString&, const QByteArray& ))); |
484 | #endif | 494 | #endif |
485 | } | 495 | } |
486 | 496 | ||
487 | 497 | ||
488 | void KABCore::disableBR(bool b) | 498 | void KABCore::disableBR(bool b) |
489 | { | 499 | { |
490 | #ifndef DESKTOP_VERSION | 500 | #ifndef DESKTOP_VERSION |
491 | if ( b ) { | 501 | if ( b ) { |
492 | if ( infrared ) { | 502 | if ( infrared ) { |
493 | toggleBeamReceive( ); | 503 | toggleBeamReceive( ); |
494 | } | 504 | } |
495 | mBRdisabled = true; | 505 | mBRdisabled = true; |
496 | } else { | 506 | } else { |
497 | if ( mBRdisabled ) { | 507 | if ( mBRdisabled ) { |
498 | mBRdisabled = false; | 508 | mBRdisabled = false; |
499 | //toggleBeamReceive( ); | 509 | //toggleBeamReceive( ); |
500 | } | 510 | } |
501 | } | 511 | } |
502 | #endif | 512 | #endif |
503 | 513 | ||
504 | } | 514 | } |
505 | void KABCore::recieve( QString fn ) | 515 | void KABCore::recieve( QString fn ) |
506 | { | 516 | { |
507 | //qDebug("KABCore::recieve "); | 517 | //qDebug("KABCore::recieve "); |
508 | int count = mAddressBook->importFromFile( fn, true ); | 518 | int count = mAddressBook->importFromFile( fn, true ); |
509 | if ( count ) | 519 | if ( count ) |
510 | setModified( true ); | 520 | setModified( true ); |
511 | mViewManager->refreshView(); | 521 | mViewManager->refreshView(); |
512 | message(i18n("%1 contact(s) received!").arg( count )); | 522 | message(i18n("%1 contact(s) received!").arg( count )); |
513 | topLevelWidget()->showMaximized(); | 523 | topLevelWidget()->showMaximized(); |
514 | topLevelWidget()->raise(); | 524 | topLevelWidget()->raise(); |
515 | } | 525 | } |
516 | void KABCore::restoreSettings() | 526 | void KABCore::restoreSettings() |
517 | { | 527 | { |
518 | mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; | 528 | mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; |
519 | 529 | ||
520 | bool state; | 530 | bool state; |
521 | 531 | ||
522 | if (mMultipleViewsAtOnce) | 532 | if (mMultipleViewsAtOnce) |
523 | state = KABPrefs::instance()->mDetailsPageVisible; | 533 | state = KABPrefs::instance()->mDetailsPageVisible; |
524 | else | 534 | else |
525 | state = false; | 535 | state = false; |
526 | 536 | ||
527 | mActionDetails->setChecked( state ); | 537 | mActionDetails->setChecked( state ); |
528 | setDetailsVisible( state ); | 538 | setDetailsVisible( state ); |
529 | 539 | ||
530 | state = KABPrefs::instance()->mJumpButtonBarVisible; | 540 | state = KABPrefs::instance()->mJumpButtonBarVisible; |
531 | 541 | ||
532 | mActionJumpBar->setChecked( state ); | 542 | mActionJumpBar->setChecked( state ); |
533 | setJumpButtonBarVisible( state ); | 543 | setJumpButtonBarVisible( state ); |
534 | /*US | 544 | /*US |
535 | QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; | 545 | QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; |
536 | if ( splitterSize.count() == 0 ) { | 546 | if ( splitterSize.count() == 0 ) { |
537 | splitterSize.append( width() / 2 ); | 547 | splitterSize.append( width() / 2 ); |
538 | splitterSize.append( width() / 2 ); | 548 | splitterSize.append( width() / 2 ); |
539 | } | 549 | } |
540 | mMiniSplitter->setSizes( splitterSize ); | 550 | mMiniSplitter->setSizes( splitterSize ); |
541 | if ( mExtensionBarSplitter ) { | 551 | if ( mExtensionBarSplitter ) { |
542 | splitterSize = KABPrefs::instance()->mExtensionsSplitter; | 552 | splitterSize = KABPrefs::instance()->mExtensionsSplitter; |
543 | if ( splitterSize.count() == 0 ) { | 553 | if ( splitterSize.count() == 0 ) { |
544 | splitterSize.append( width() / 2 ); | 554 | splitterSize.append( width() / 2 ); |
545 | splitterSize.append( width() / 2 ); | 555 | splitterSize.append( width() / 2 ); |
546 | } | 556 | } |
547 | mExtensionBarSplitter->setSizes( splitterSize ); | 557 | mExtensionBarSplitter->setSizes( splitterSize ); |
548 | 558 | ||
549 | } | 559 | } |
550 | */ | 560 | */ |
551 | mViewManager->restoreSettings(); | 561 | mViewManager->restoreSettings(); |
552 | mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); | 562 | mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); |
553 | mExtensionManager->restoreSettings(); | 563 | mExtensionManager->restoreSettings(); |
554 | #ifdef DESKTOP_VERSION | 564 | #ifdef DESKTOP_VERSION |
555 | int wid = width(); | 565 | int wid = width(); |
556 | if ( wid < 10 ) | 566 | if ( wid < 10 ) |
557 | wid = 400; | 567 | wid = 400; |
558 | #else | 568 | #else |
559 | int wid = QApplication::desktop()->width(); | 569 | int wid = QApplication::desktop()->width(); |
560 | if ( wid < 640 ) | 570 | if ( wid < 640 ) |
561 | wid = QApplication::desktop()->height(); | 571 | wid = QApplication::desktop()->height(); |
562 | #endif | 572 | #endif |
563 | QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; | 573 | Q3ValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; |
564 | if ( true /*splitterSize.count() == 0*/ ) { | 574 | if ( true /*splitterSize.count() == 0*/ ) { |
565 | splitterSize.append( wid / 2 ); | 575 | splitterSize.append( wid / 2 ); |
566 | splitterSize.append( wid / 2 ); | 576 | splitterSize.append( wid / 2 ); |
567 | } | 577 | } |
568 | mMiniSplitter->setSizes( splitterSize ); | 578 | mMiniSplitter->setSizes( splitterSize ); |
569 | if ( mExtensionBarSplitter ) { | 579 | if ( mExtensionBarSplitter ) { |
570 | //splitterSize = KABPrefs::instance()->mExtensionsSplitter; | 580 | //splitterSize = KABPrefs::instance()->mExtensionsSplitter; |
571 | if ( true /*splitterSize.count() == 0*/ ) { | 581 | if ( true /*splitterSize.count() == 0*/ ) { |
572 | splitterSize.append( wid / 2 ); | 582 | splitterSize.append( wid / 2 ); |
573 | splitterSize.append( wid / 2 ); | 583 | splitterSize.append( wid / 2 ); |
574 | } | 584 | } |
575 | mExtensionBarSplitter->setSizes( splitterSize ); | 585 | mExtensionBarSplitter->setSizes( splitterSize ); |
576 | 586 | ||
577 | } | 587 | } |
578 | #ifdef DESKTOP_VERSION | 588 | #ifdef DESKTOP_VERSION |
579 | KConfig *config = KABPrefs::instance()->getConfig(); | 589 | KConfig *config = KABPrefs::instance()->getConfig(); |
580 | config->setGroup("WidgetLayout"); | 590 | config->setGroup("WidgetLayout"); |
581 | QStringList list; | 591 | QStringList list; |
582 | list = config->readListEntry("MainLayout"); | 592 | list = config->readListEntry("MainLayout"); |
583 | int x,y,w,h; | 593 | int x,y,w,h; |
584 | if ( ! list.isEmpty() ) { | 594 | if ( ! list.isEmpty() ) { |
585 | x = list[0].toInt(); | 595 | x = list[0].toInt(); |
586 | y = list[1].toInt(); | 596 | y = list[1].toInt(); |
587 | w = list[2].toInt(); | 597 | w = list[2].toInt(); |
588 | h = list[3].toInt(); | 598 | h = list[3].toInt(); |
589 | KApplication::testCoords( &x,&y,&w,&h ); | 599 | KApplication::testCoords( &x,&y,&w,&h ); |
590 | topLevelWidget()->setGeometry(x,y,w,h); | 600 | topLevelWidget()->setGeometry(x,y,w,h); |
591 | 601 | ||
592 | } else { | 602 | } else { |
593 | topLevelWidget()->setGeometry( 40 ,40 , 640, 440); | 603 | topLevelWidget()->setGeometry( 40 ,40 , 640, 440); |
594 | } | 604 | } |
595 | #endif | 605 | #endif |
596 | } | 606 | } |
597 | 607 | ||
598 | void KABCore::saveSettings() | 608 | void KABCore::saveSettings() |
599 | { | 609 | { |
600 | KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); | 610 | KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); |
601 | if ( mExtensionBarSplitter ) | 611 | if ( mExtensionBarSplitter ) |
602 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); | 612 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); |
603 | KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); | 613 | KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); |
604 | KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); | 614 | KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); |
605 | #ifndef KAB_EMBEDDED | 615 | #ifndef KAB_EMBEDDED |
606 | 616 | ||
607 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); | 617 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); |
608 | KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); | 618 | KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); |
609 | #endif //KAB_EMBEDDED | 619 | #endif //KAB_EMBEDDED |
610 | mExtensionManager->saveSettings(); | 620 | mExtensionManager->saveSettings(); |
611 | mViewManager->saveSettings(); | 621 | mViewManager->saveSettings(); |
612 | 622 | ||
613 | KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); | 623 | KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); |
614 | 624 | ||
615 | KABPrefs::instance()->writeConfig(); | 625 | KABPrefs::instance()->writeConfig(); |
616 | //qDebug("KA: KABCore::saveSettings() "); | 626 | //qDebug("KA: KABCore::saveSettings() "); |
617 | } | 627 | } |
618 | 628 | ||
619 | KABC::AddressBook *KABCore::addressBook() const | 629 | KABC::AddressBook *KABCore::addressBook() const |
620 | { | 630 | { |
621 | return mAddressBook; | 631 | return mAddressBook; |
622 | } | 632 | } |
623 | 633 | ||
624 | KConfig *KABCore::config() | 634 | KConfig *KABCore::config() |
625 | { | 635 | { |
626 | #ifndef KAB_EMBEDDED | 636 | #ifndef KAB_EMBEDDED |
627 | return KABPrefs::instance()->config(); | 637 | return KABPrefs::instance()->config(); |
628 | #else //KAB_EMBEDDED | 638 | #else //KAB_EMBEDDED |
629 | return KABPrefs::instance()->getConfig(); | 639 | return KABPrefs::instance()->getConfig(); |
630 | #endif //KAB_EMBEDDED | 640 | #endif //KAB_EMBEDDED |
631 | } | 641 | } |
632 | 642 | ||
633 | KActionCollection *KABCore::actionCollection() const | 643 | KActionCollection *KABCore::actionCollection() const |
634 | { | 644 | { |
635 | return mGUIClient->actionCollection(); | 645 | return mGUIClient->actionCollection(); |
636 | } | 646 | } |
637 | 647 | ||
638 | KABC::Field *KABCore::currentSearchField() const | 648 | KABC::Field *KABCore::currentSearchField() const |
639 | { | 649 | { |
640 | if (mIncSearchWidget) | 650 | if (mIncSearchWidget) |
641 | return mIncSearchWidget->currentField(); | 651 | return mIncSearchWidget->currentField(); |
642 | else | 652 | else |
643 | return 0; | 653 | return 0; |
644 | } | 654 | } |
645 | 655 | ||
646 | QStringList KABCore::selectedUIDs() const | 656 | QStringList KABCore::selectedUIDs() const |
647 | { | 657 | { |
648 | return mViewManager->selectedUids(); | 658 | return mViewManager->selectedUids(); |
649 | } | 659 | } |
650 | 660 | ||
651 | KABC::Resource *KABCore::requestResource( QWidget *parent ) | 661 | KABC::Resource *KABCore::requestResource( QWidget *parent ) |
652 | { | 662 | { |
653 | QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); | 663 | Q3PtrList<KABC::Resource> kabcResources = addressBook()->resources(); |
654 | 664 | ||
655 | QPtrList<KRES::Resource> kresResources; | 665 | Q3PtrList<KRES::Resource> kresResources; |
656 | QPtrListIterator<KABC::Resource> resIt( kabcResources ); | 666 | Q3PtrListIterator<KABC::Resource> resIt( kabcResources ); |
657 | KABC::Resource *resource; | 667 | KABC::Resource *resource; |
658 | while ( ( resource = resIt.current() ) != 0 ) { | 668 | while ( ( resource = resIt.current() ) != 0 ) { |
659 | ++resIt; | 669 | ++resIt; |
660 | if ( !resource->readOnly() ) { | 670 | if ( !resource->readOnly() ) { |
661 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); | 671 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); |
662 | if ( res ) | 672 | if ( res ) |
663 | kresResources.append( res ); | 673 | kresResources.append( res ); |
664 | } | 674 | } |
665 | } | 675 | } |
666 | 676 | ||
667 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); | 677 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); |
668 | return static_cast<KABC::Resource*>( res ); | 678 | return static_cast<KABC::Resource*>( res ); |
669 | } | 679 | } |
670 | 680 | ||
671 | #ifndef KAB_EMBEDDED | 681 | #ifndef KAB_EMBEDDED |
672 | KAboutData *KABCore::createAboutData() | 682 | KAboutData *KABCore::createAboutData() |
673 | #else //KAB_EMBEDDED | 683 | #else //KAB_EMBEDDED |
674 | void KABCore::createAboutData() | 684 | void KABCore::createAboutData() |
675 | #endif //KAB_EMBEDDED | 685 | #endif //KAB_EMBEDDED |
676 | { | 686 | { |
677 | 687 | ||
678 | 688 | ||
679 | QString version; | 689 | QString version; |
680 | #include <../version> | 690 | #include <../version> |
681 | QMessageBox::about( this, "About KAddressbook/Pi", | 691 | QMessageBox::about( this, "About KAddressbook/Pi", |
682 | "KAddressbook/Platform-independent\n" | 692 | "KAddressbook/Platform-independent\n" |
683 | "(KA/Pi) " +version + " - " + | 693 | "(KA/Pi) " +version + " - " + |
684 | #ifdef DESKTOP_VERSION | 694 | #ifdef DESKTOP_VERSION |
685 | "Desktop Edition\n" | 695 | "Desktop Edition\n" |
686 | #else | 696 | #else |
687 | "PDA-Edition\n" | 697 | "PDA-Edition\n" |
688 | "for: Zaurus 5500 / 7x0 / 8x0\n" | 698 | "for: Zaurus 5500 / 7x0 / 8x0\n" |
689 | #endif | 699 | #endif |
690 | 700 | ||
691 | "(c) 2004 Ulf Schenk\n" | 701 | "(c) 2004 Ulf Schenk\n" |
692 | "(c) 2004-2005 Lutz Rogowski\nrogowski@kde.org\n" | 702 | "(c) 2004-2005 Lutz Rogowski\nrogowski@kde.org\n" |
693 | "(c) 1997-2003, The KDE PIM Team\n" | 703 | "(c) 1997-2003, The KDE PIM Team\n" |
694 | "Tobias Koenig Maintainer\n" | 704 | "Tobias Koenig Maintainer\n" |
695 | "Don Sanders Original author\n" | 705 | "Don Sanders Original author\n" |
696 | "Cornelius Schumacher Co-maintainer\n" | 706 | "Cornelius Schumacher Co-maintainer\n" |
697 | "Mike Pilone GUI and framework redesign\n" | 707 | "Mike Pilone GUI and framework redesign\n" |
698 | "Greg Stern DCOP interface\n" | 708 | "Greg Stern DCOP interface\n" |
699 | "Mark Westcot Contact pinning\n" | 709 | "Mark Westcot Contact pinning\n" |
700 | "Michel Boyer de la Giroday LDAP Lookup\n" | 710 | "Michel Boyer de la Giroday LDAP Lookup\n" |
701 | "Steffen Hansen LDAP Lookup" | 711 | "Steffen Hansen LDAP Lookup" |
702 | #ifdef _WIN32_ | 712 | #ifdef _WIN32_ |
703 | "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n" | 713 | "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n" |
704 | #endif | 714 | #endif |
705 | ); | 715 | ); |
706 | } | 716 | } |
707 | 717 | ||
708 | void KABCore::setContactSelected( const QString &uid ) | 718 | void KABCore::setContactSelected( const QString &uid ) |
709 | { | 719 | { |
710 | KABC::Addressee addr = mAddressBook->findByUid( uid ); | 720 | KABC::Addressee addr = mAddressBook->findByUid( uid ); |
711 | if ( !mDetails->isHidden() ) | 721 | if ( !mDetails->isHidden() ) |
712 | mDetails->setAddressee( addr ); | 722 | mDetails->setAddressee( addr ); |
713 | 723 | ||
714 | if ( !addr.isEmpty() ) { | 724 | if ( !addr.isEmpty() ) { |
715 | emit contactSelected( addr.formattedName() ); | 725 | emit contactSelected( addr.formattedName() ); |
716 | KABC::Picture pic = addr.photo(); | 726 | KABC::Picture pic = addr.photo(); |
717 | if ( pic.isIntern() ) { | 727 | if ( pic.isIntern() ) { |
718 | //US emit contactSelected( pic.data() ); | 728 | //US emit contactSelected( pic.data() ); |
719 | //US instead use: | 729 | //US instead use: |
720 | QPixmap px; | 730 | QPixmap px; |
721 | if (pic.data().isNull() != true) | 731 | if (pic.data().isNull() != true) |
722 | { | 732 | { |
723 | px.convertFromImage(pic.data()); | 733 | px.convertFromImage(pic.data()); |
724 | } | 734 | } |
725 | 735 | ||
726 | emit contactSelected( px ); | 736 | emit contactSelected( px ); |
727 | } | 737 | } |
728 | } | 738 | } |
729 | 739 | ||
730 | 740 | ||
731 | mExtensionManager->setSelectionChanged(); | 741 | mExtensionManager->setSelectionChanged(); |
732 | 742 | ||
733 | // update the actions | 743 | // update the actions |
734 | bool selected = !uid.isEmpty(); | 744 | bool selected = !uid.isEmpty(); |
735 | 745 | ||
736 | if ( mReadWrite ) { | 746 | if ( mReadWrite ) { |
737 | mActionCut->setEnabled( selected ); | 747 | mActionCut->setEnabled( selected ); |
738 | mActionPaste->setEnabled( selected ); | 748 | mActionPaste->setEnabled( selected ); |
739 | } | 749 | } |
740 | 750 | ||
741 | mActionCopy->setEnabled( selected ); | 751 | mActionCopy->setEnabled( selected ); |
742 | mActionDelete->setEnabled( selected ); | 752 | mActionDelete->setEnabled( selected ); |
743 | mActionEditAddressee->setEnabled( selected ); | 753 | mActionEditAddressee->setEnabled( selected ); |
744 | mActionMail->setEnabled( selected ); | 754 | mActionMail->setEnabled( selected ); |
745 | mActionMailVCard->setEnabled( selected ); | 755 | mActionMailVCard->setEnabled( selected ); |
746 | //if (mActionBeam) | 756 | //if (mActionBeam) |
747 | //mActionBeam->setEnabled( selected ); | 757 | //mActionBeam->setEnabled( selected ); |
748 | mActionWhoAmI->setEnabled( selected ); | 758 | mActionWhoAmI->setEnabled( selected ); |
749 | } | 759 | } |
750 | 760 | ||
751 | void KABCore::sendMail() | 761 | void KABCore::sendMail() |
752 | { | 762 | { |
753 | sendMail( mViewManager->selectedEmails().join( ", " ) ); | 763 | sendMail( mViewManager->selectedEmails().join( ", " ) ); |
754 | } | 764 | } |
755 | 765 | ||
756 | void KABCore::sendMail( const QString& emaillist ) | 766 | void KABCore::sendMail( const QString& emaillist ) |
757 | { | 767 | { |
758 | // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... " | 768 | // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... " |
759 | if (emaillist.contains(",") > 0) | 769 | if (emaillist.contains(",") > 0) |
760 | ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null ); | 770 | ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null ); |
761 | else | 771 | else |
762 | ExternalAppHandler::instance()->mailToOneContact( emaillist ); | 772 | ExternalAppHandler::instance()->mailToOneContact( emaillist ); |
763 | } | 773 | } |
764 | 774 | ||
765 | 775 | ||
766 | 776 | ||
767 | void KABCore::mailVCard() | 777 | void KABCore::mailVCard() |
768 | { | 778 | { |
769 | QStringList uids = mViewManager->selectedUids(); | 779 | QStringList uids = mViewManager->selectedUids(); |
770 | if ( !uids.isEmpty() ) | 780 | if ( !uids.isEmpty() ) |
771 | mailVCard( uids ); | 781 | mailVCard( uids ); |
772 | } | 782 | } |
773 | 783 | ||
774 | void KABCore::mailVCard( const QStringList& uids ) | 784 | void KABCore::mailVCard( const QStringList& uids ) |
775 | { | 785 | { |
776 | QStringList urls; | 786 | QStringList urls; |
777 | 787 | ||
778 | // QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); | 788 | // QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); |
779 | 789 | ||
780 | QString dirName = "/tmp/" + KApplication::randomString( 8 ); | 790 | QString dirName = "/tmp/" + KApplication::randomString( 8 ); |
781 | 791 | ||
782 | 792 | ||
783 | 793 | ||
784 | QDir().mkdir( dirName, true ); | 794 | QDir().mkdir( dirName, true ); |
785 | 795 | ||
786 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { | 796 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { |
787 | KABC::Addressee a = mAddressBook->findByUid( *it ); | 797 | KABC::Addressee a = mAddressBook->findByUid( *it ); |
788 | 798 | ||
789 | if ( a.isEmpty() ) | 799 | if ( a.isEmpty() ) |
790 | continue; | 800 | continue; |
791 | 801 | ||
792 | QString name = a.givenName() + "_" + a.familyName() + ".vcf"; | 802 | QString name = a.givenName() + "_" + a.familyName() + ".vcf"; |
793 | 803 | ||
794 | QString fileName = dirName + "/" + name; | 804 | QString fileName = dirName + "/" + name; |
795 | 805 | ||
796 | QFile outFile(fileName); | 806 | QFile outFile(fileName); |
797 | 807 | ||
798 | if ( outFile.open(IO_WriteOnly) ) { // file opened successfully | 808 | if ( outFile.open(QIODevice::WriteOnly) ) { // file opened successfully |
799 | KABC::VCardConverter converter; | 809 | KABC::VCardConverter converter; |
800 | QString vcard; | 810 | QString vcard; |
801 | 811 | ||
802 | converter.addresseeToVCard( a, vcard ); | 812 | converter.addresseeToVCard( a, vcard ); |
803 | 813 | ||
804 | QTextStream t( &outFile ); // use a text stream | 814 | Q3TextStream t( &outFile ); // use a text stream |
805 | t.setEncoding( QTextStream::UnicodeUTF8 ); | 815 | t.setEncoding( Q3TextStream::UnicodeUTF8 ); |
806 | t << vcard; | 816 | t << vcard; |
807 | 817 | ||
808 | outFile.close(); | 818 | outFile.close(); |
809 | 819 | ||
810 | urls.append( fileName ); | 820 | urls.append( fileName ); |
811 | } | 821 | } |
812 | } | 822 | } |
813 | 823 | ||
814 | bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") ); | 824 | bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") ); |
815 | 825 | ||
816 | 826 | ||
817 | /*US | 827 | /*US |
818 | kapp->invokeMailer( QString::null, QString::null, QString::null, | 828 | kapp->invokeMailer( QString::null, QString::null, QString::null, |
819 | QString::null, // subject | 829 | QString::null, // subject |
820 | QString::null, // body | 830 | QString::null, // body |
821 | QString::null, | 831 | QString::null, |
822 | urls ); // attachments | 832 | urls ); // attachments |
823 | */ | 833 | */ |
824 | 834 | ||
825 | } | 835 | } |
826 | 836 | ||
827 | /** | 837 | /** |
828 | Beams the "WhoAmI contact. | 838 | Beams the "WhoAmI contact. |
829 | */ | 839 | */ |
830 | void KABCore::beamMySelf() | 840 | void KABCore::beamMySelf() |
831 | { | 841 | { |
832 | KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); | 842 | KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); |
833 | if (!a.isEmpty()) | 843 | if (!a.isEmpty()) |
834 | { | 844 | { |
835 | QStringList uids; | 845 | QStringList uids; |
836 | uids << a.uid(); | 846 | uids << a.uid(); |
837 | 847 | ||
838 | beamVCard(uids); | 848 | beamVCard(uids); |
839 | } else { | 849 | } else { |
840 | KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); | 850 | KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); |
841 | 851 | ||
842 | 852 | ||
843 | } | 853 | } |
844 | } | 854 | } |
845 | void KABCore::updateMainWindow() | 855 | void KABCore::updateMainWindow() |
846 | { | 856 | { |
847 | mMainWindow->showMaximized(); | 857 | mMainWindow->showMaximized(); |
848 | //mMainWindow->repaint(); | 858 | //mMainWindow->repaint(); |
849 | } | 859 | } |
850 | void KABCore::resizeEvent(QResizeEvent* e ) | 860 | void KABCore::resizeEvent(QResizeEvent* e ) |
851 | { | 861 | { |
852 | if ( !mMiniSplitter ) { | 862 | if ( !mMiniSplitter ) { |
853 | QWidget::resizeEvent( e ); | 863 | QWidget::resizeEvent( e ); |
854 | return; | 864 | return; |
855 | } | 865 | } |
856 | #ifndef DESKTOP_VERSION | 866 | #ifndef DESKTOP_VERSION |
857 | static int desktop_width = 0; | 867 | static int desktop_width = 0; |
858 | //qDebug("KABCore::resizeEvent %d %d ",desktop_width,QApplication::desktop()->width() ); | 868 | //qDebug("KABCore::resizeEvent %d %d ",desktop_width,QApplication::desktop()->width() ); |
859 | if ( desktop_width != QApplication::desktop()->width() ) | 869 | if ( desktop_width != QApplication::desktop()->width() ) |
860 | if ( QApplication::desktop()->width() >= 480 ) { | 870 | if ( QApplication::desktop()->width() >= 480 ) { |
861 | if (QApplication::desktop()->width() == 640 ) { // e.g. 640x480 | 871 | if (QApplication::desktop()->width() == 640 ) { // e.g. 640x480 |
862 | //qDebug("640 "); | 872 | //qDebug("640 "); |
863 | if ( mMiniSplitter->orientation() == Qt::Vertical ) { | 873 | if ( mMiniSplitter->orientation() == Qt::Vertical ) { |
864 | //qDebug("switch V->H "); | 874 | //qDebug("switch V->H "); |
865 | mMiniSplitter->setOrientation( Qt::Horizontal); | 875 | mMiniSplitter->setOrientation( Qt::Horizontal); |
866 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 876 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
867 | } | 877 | } |
868 | if ( QApplication::desktop()->width() <= 640 ) { | 878 | if ( QApplication::desktop()->width() <= 640 ) { |
869 | bool shot = mMainWindow->isVisible(); | 879 | bool shot = mMainWindow->isVisible(); |
870 | mMainWindow->showMinimized(); | 880 | mMainWindow->showMinimized(); |
871 | //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); | 881 | //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); |
872 | mViewManager->getFilterAction()->setComboWidth( 150 ); | 882 | mViewManager->getFilterAction()->setComboWidth( 150 ); |
873 | if ( mIncSearchWidget ) | 883 | if ( mIncSearchWidget ) |
874 | mIncSearchWidget->setSize(); | 884 | mIncSearchWidget->setSize(); |
875 | if ( shot ) | 885 | if ( shot ) |
876 | QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); | 886 | QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); |
877 | } | 887 | } |
878 | 888 | ||
879 | } else if (QApplication::desktop()->width() == 480 ){// e.g. 480x640 | 889 | } else if (QApplication::desktop()->width() == 480 ){// e.g. 480x640 |
880 | //qDebug("480 "); | 890 | //qDebug("480 "); |
881 | if ( mMiniSplitter->orientation() == Qt::Horizontal ) { | 891 | if ( mMiniSplitter->orientation() == Qt::Horizontal ) { |
882 | //qDebug("switch H->V "); | 892 | //qDebug("switch H->V "); |
883 | mMiniSplitter->setOrientation( Qt::Vertical ); | 893 | mMiniSplitter->setOrientation( Qt::Vertical ); |
884 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); | 894 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); |
885 | } | 895 | } |
886 | if ( QApplication::desktop()->width() <= 640 ) { | 896 | if ( QApplication::desktop()->width() <= 640 ) { |
887 | //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); | 897 | //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); |
888 | bool shot = mMainWindow->isVisible(); | 898 | bool shot = mMainWindow->isVisible(); |
889 | mMainWindow->showMinimized(); | 899 | mMainWindow->showMinimized(); |
890 | if ( KABPrefs::instance()->mHideSearchOnSwitch ) { | 900 | if ( KABPrefs::instance()->mHideSearchOnSwitch ) { |
891 | if ( mIncSearchWidget ) { | 901 | if ( mIncSearchWidget ) { |
892 | mIncSearchWidget->setSize(); | 902 | mIncSearchWidget->setSize(); |
893 | } | 903 | } |
894 | } else { | 904 | } else { |
895 | mViewManager->getFilterAction()->setComboWidth( 0 ); | 905 | mViewManager->getFilterAction()->setComboWidth( 0 ); |
896 | } | 906 | } |
897 | if ( shot ) | 907 | if ( shot ) |
898 | QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); | 908 | QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); |
899 | } | 909 | } |
900 | } | 910 | } |
901 | } | 911 | } |
902 | desktop_width = QApplication::desktop()->width(); | 912 | desktop_width = QApplication::desktop()->width(); |
903 | #endif | 913 | #endif |
904 | QWidget::resizeEvent( e ); | 914 | QWidget::resizeEvent( e ); |
905 | 915 | ||
906 | } | 916 | } |
907 | void KABCore::export2phone() | 917 | void KABCore::export2phone() |
908 | { | 918 | { |
909 | 919 | ||
910 | QStringList uids; | 920 | QStringList uids; |
911 | XXPortSelectDialog dlg( this, false, this ); | 921 | XXPortSelectDialog dlg( this, false, this ); |
912 | if ( dlg.exec() ) | 922 | if ( dlg.exec() ) |
913 | uids = dlg.uids(); | 923 | uids = dlg.uids(); |
914 | else | 924 | else |
915 | return; | 925 | return; |
916 | if ( uids.isEmpty() ) | 926 | if ( uids.isEmpty() ) |
917 | return; | 927 | return; |
918 | // qDebug("count %d ", uids.count()); | 928 | // qDebug("count %d ", uids.count()); |
919 | 929 | ||
920 | KAex2phonePrefs ex2phone; | 930 | KAex2phonePrefs ex2phone; |
921 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); | 931 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); |
922 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); | 932 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); |
923 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 933 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
924 | 934 | ||
925 | if ( !ex2phone.exec() ) { | 935 | if ( !ex2phone.exec() ) { |
926 | return; | 936 | return; |
927 | } | 937 | } |
928 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); | 938 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); |
929 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); | 939 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); |
930 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); | 940 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); |
931 | 941 | ||
932 | 942 | ||
933 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, | 943 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, |
934 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, | 944 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, |
935 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 945 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
936 | 946 | ||
937 | QString fileName = getPhoneFile(); | 947 | QString fileName = getPhoneFile(); |
938 | if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) ) | 948 | if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) ) |
939 | return; | 949 | return; |
940 | 950 | ||
941 | message(i18n("Exporting to phone...")); | 951 | message(i18n("Exporting to phone...")); |
942 | QTimer::singleShot( 1, this , SLOT ( writeToPhone())); | 952 | QTimer::singleShot( 1, this , SLOT ( writeToPhone())); |
943 | 953 | ||
944 | } | 954 | } |
945 | QString KABCore::getPhoneFile() | 955 | QString KABCore::getPhoneFile() |
946 | { | 956 | { |
947 | #ifdef DESKTOP_VERSION | 957 | #ifdef DESKTOP_VERSION |
948 | return locateLocal("tmp", "phonefile.vcf"); | 958 | return locateLocal("tmp", "phonefile.vcf"); |
949 | #else | 959 | #else |
950 | return "/tmp/phonefile.vcf"; | 960 | return "/tmp/phonefile.vcf"; |
951 | #endif | 961 | #endif |
952 | 962 | ||
953 | } | 963 | } |
954 | void KABCore::writeToPhone( ) | 964 | void KABCore::writeToPhone( ) |
955 | { | 965 | { |
956 | if ( PhoneAccess::writeToPhone( getPhoneFile() ) ) | 966 | if ( PhoneAccess::writeToPhone( getPhoneFile() ) ) |
957 | message(i18n("Export to phone finished!")); | 967 | message(i18n("Export to phone finished!")); |
958 | else | 968 | else |
959 | qDebug(i18n("KA: Error exporting to phone")); | 969 | qDebug(i18n("KA: Error exporting to phone")); |
960 | } | 970 | } |
961 | void KABCore::beamVCard() | 971 | void KABCore::beamVCard() |
962 | { | 972 | { |
963 | QStringList uids; | 973 | QStringList uids; |
964 | XXPortSelectDialog dlg( this, false, this ); | 974 | XXPortSelectDialog dlg( this, false, this ); |
965 | if ( dlg.exec() ) | 975 | if ( dlg.exec() ) |
966 | uids = dlg.uids(); | 976 | uids = dlg.uids(); |
967 | else | 977 | else |
968 | return; | 978 | return; |
969 | if ( uids.isEmpty() ) | 979 | if ( uids.isEmpty() ) |
970 | return; | 980 | return; |
971 | beamVCard( uids ); | 981 | beamVCard( uids ); |
972 | } | 982 | } |
973 | 983 | ||
974 | 984 | ||
975 | void KABCore::beamVCard(const QStringList& uids) | 985 | void KABCore::beamVCard(const QStringList& uids) |
976 | { | 986 | { |
977 | 987 | ||
978 | // LR: we should use the /tmp dir on the Zaurus, | 988 | // LR: we should use the /tmp dir on the Zaurus, |
979 | // because: /tmp = RAM, (HOME)/kdepim = flash memory | 989 | // because: /tmp = RAM, (HOME)/kdepim = flash memory |
980 | 990 | ||
981 | #ifdef DESKTOP_VERSION | 991 | #ifdef DESKTOP_VERSION |
982 | QString fileName = locateLocal("tmp", "kapibeamfile.vcf"); | 992 | QString fileName = locateLocal("tmp", "kapibeamfile.vcf"); |
983 | #else | 993 | #else |
984 | QString fileName = "/tmp/kapibeamfile.vcf"; | 994 | QString fileName = "/tmp/kapibeamfile.vcf"; |
985 | #endif | 995 | #endif |
986 | 996 | ||
987 | KABC::VCardConverter converter; | 997 | KABC::VCardConverter converter; |
988 | QString description; | 998 | QString description; |
989 | QString datastream; | 999 | QString datastream; |
990 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { | 1000 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { |
991 | KABC::Addressee a = mAddressBook->findByUid( *it ); | 1001 | KABC::Addressee a = mAddressBook->findByUid( *it ); |
992 | 1002 | ||
993 | if ( a.isEmpty() ) | 1003 | if ( a.isEmpty() ) |
994 | continue; | 1004 | continue; |
995 | 1005 | ||
996 | if (description.isEmpty()) | 1006 | if (description.isEmpty()) |
997 | description = a.formattedName(); | 1007 | description = a.formattedName(); |
998 | 1008 | ||
999 | QString vcard; | 1009 | QString vcard; |
1000 | converter.addresseeToVCard( a, vcard ); | 1010 | converter.addresseeToVCard( a, vcard ); |
1001 | int start = 0; | 1011 | int start = 0; |
1002 | int next; | 1012 | int next; |
1003 | while ( (next = vcard.find("TYPE=", start) )>= 0 ) { | 1013 | while ( (next = vcard.find("TYPE=", start) )>= 0 ) { |
1004 | int semi = vcard.find(";", next); | 1014 | int semi = vcard.find(";", next); |
1005 | int dopp = vcard.find(":", next); | 1015 | int dopp = vcard.find(":", next); |
1006 | int sep; | 1016 | int sep; |
1007 | if ( semi < dopp && semi >= 0 ) | 1017 | if ( semi < dopp && semi >= 0 ) |
1008 | sep = semi ; | 1018 | sep = semi ; |
1009 | else | 1019 | else |
1010 | sep = dopp; | 1020 | sep = dopp; |
1011 | datastream +=vcard.mid( start, next - start); | 1021 | datastream +=vcard.mid( start, next - start); |
1012 | datastream +=vcard.mid( next+5,sep -next -5 ).upper(); | 1022 | datastream +=vcard.mid( next+5,sep -next -5 ).upper(); |
1013 | start = sep; | 1023 | start = sep; |
1014 | } | 1024 | } |
1015 | datastream += vcard.mid( start,vcard.length() ); | 1025 | datastream += vcard.mid( start,vcard.length() ); |
1016 | } | 1026 | } |
1017 | #ifndef DESKTOP_VERSION | 1027 | #ifndef DESKTOP_VERSION |
1018 | QFile outFile(fileName); | 1028 | QFile outFile(fileName); |
1019 | if ( outFile.open(IO_WriteOnly) ) { | 1029 | if ( outFile.open(QIODevice::WriteOnly) ) { |
1020 | datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); | 1030 | datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); |
1021 | QTextStream t( &outFile ); // use a text stream | 1031 | Q3TextStream t( &outFile ); // use a text stream |
1022 | //t.setEncoding( QTextStream::UnicodeUTF8 ); | 1032 | //t.setEncoding( QTextStream::UnicodeUTF8 ); |
1023 | t.setEncoding( QTextStream::Latin1 ); | 1033 | t.setEncoding( Q3TextStream::Latin1 ); |
1024 | t <<datastream.latin1(); | 1034 | t <<datastream.latin1(); |
1025 | outFile.close(); | 1035 | outFile.close(); |
1026 | Ir *ir = new Ir( this ); | 1036 | Ir *ir = new Ir( this ); |
1027 | connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); | 1037 | connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); |
1028 | ir->send( fileName, description, "text/x-vCard" ); | 1038 | ir->send( fileName, description, "text/x-vCard" ); |
1029 | } else { | 1039 | } else { |
1030 | qDebug("KA: Error open temp beam file "); | 1040 | qDebug("KA: Error open temp beam file "); |
1031 | return; | 1041 | return; |
1032 | } | 1042 | } |
1033 | #endif | 1043 | #endif |
1034 | 1044 | ||
1035 | } | 1045 | } |
1036 | 1046 | ||
1037 | void KABCore::beamDone( Ir *ir ) | 1047 | void KABCore::beamDone( Ir *ir ) |
1038 | { | 1048 | { |
1039 | #ifndef DESKTOP_VERSION | 1049 | #ifndef DESKTOP_VERSION |
1040 | delete ir; | 1050 | delete ir; |
1041 | #endif | 1051 | #endif |
1042 | topLevelWidget()->raise(); | 1052 | topLevelWidget()->raise(); |
1043 | message( i18n("Beaming finished!") ); | 1053 | message( i18n("Beaming finished!") ); |
1044 | } | 1054 | } |
1045 | 1055 | ||
1046 | 1056 | ||
1047 | void KABCore::browse( const QString& url ) | 1057 | void KABCore::browse( const QString& url ) |
1048 | { | 1058 | { |
1049 | #ifndef KAB_EMBEDDED | 1059 | #ifndef KAB_EMBEDDED |
1050 | kapp->invokeBrowser( url ); | 1060 | kapp->invokeBrowser( url ); |
1051 | #else //KAB_EMBEDDED | 1061 | #else //KAB_EMBEDDED |
1052 | qDebug("KABCore::browse must be fixed"); | 1062 | qDebug("KABCore::browse must be fixed"); |
1053 | #endif //KAB_EMBEDDED | 1063 | #endif //KAB_EMBEDDED |
1054 | } | 1064 | } |
1055 | 1065 | ||
1056 | void KABCore::selectAllContacts() | 1066 | void KABCore::selectAllContacts() |
1057 | { | 1067 | { |
1058 | mViewManager->setSelected( QString::null, true ); | 1068 | mViewManager->setSelected( QString::null, true ); |
1059 | } | 1069 | } |
1060 | 1070 | ||
1061 | void KABCore::deleteContacts() | 1071 | void KABCore::deleteContacts() |
1062 | { | 1072 | { |
1063 | QStringList uidList = mViewManager->selectedUids(); | 1073 | QStringList uidList = mViewManager->selectedUids(); |
1064 | deleteContacts( uidList ); | 1074 | deleteContacts( uidList ); |
1065 | } | 1075 | } |
1066 | 1076 | ||
1067 | void KABCore::deleteContacts( const QStringList &uids ) | 1077 | void KABCore::deleteContacts( const QStringList &uids ) |
1068 | { | 1078 | { |
1069 | 1079 | ||
1070 | if ( uids.count() > 0 ) { | 1080 | if ( uids.count() > 0 ) { |
1071 | 1081 | ||
1072 | if ( KABPrefs::instance()->mAskForDelete ) { | 1082 | if ( KABPrefs::instance()->mAskForDelete ) { |
1073 | int count = uids.count(); | 1083 | int count = uids.count(); |
1074 | if ( count > 5 ) count = 5; | 1084 | if ( count > 5 ) count = 5; |
1075 | QString cNames; | 1085 | QString cNames; |
1076 | int i; | 1086 | int i; |
1077 | for ( i = 0; i < count ; ++i ) { | 1087 | for ( i = 0; i < count ; ++i ) { |
1078 | cNames += KGlobal::formatMessage( mAddressBook->findByUid( uids[i] ).realName() ,0) + "\n"; | 1088 | cNames += KGlobal::formatMessage( mAddressBook->findByUid( uids[i] ).realName() ,0) + "\n"; |
1079 | } | 1089 | } |
1080 | if ( uids.count() > 5 ) | 1090 | if ( uids.count() > 5 ) |
1081 | cNames += i18n("...and %1 more\ncontact(s) selected").arg( uids.count() - 5 ); | 1091 | cNames += i18n("...and %1 more\ncontact(s) selected").arg( uids.count() - 5 ); |
1082 | QString text = i18n( "Do you really\nwant to delete the\nsetected contact(s)?\n\n" ) + cNames ; | 1092 | QString text = i18n( "Do you really\nwant to delete the\nsetected contact(s)?\n\n" ) + cNames ; |
1083 | if ( KMessageBox::questionYesNo( this, text ) != KMessageBox::Yes ) | 1093 | if ( KMessageBox::questionYesNo( this, text ) != KMessageBox::Yes ) |
1084 | return; | 1094 | return; |
1085 | } | 1095 | } |
1086 | PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids ); | 1096 | PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids ); |
1087 | UndoStack::instance()->push( command ); | 1097 | UndoStack::instance()->push( command ); |
1088 | RedoStack::instance()->clear(); | 1098 | RedoStack::instance()->clear(); |
1089 | 1099 | ||
1090 | // now if we deleted anything, refresh | 1100 | // now if we deleted anything, refresh |
1091 | setContactSelected( QString::null ); | 1101 | setContactSelected( QString::null ); |
1092 | setModified( true ); | 1102 | setModified( true ); |
1093 | } | 1103 | } |
1094 | } | 1104 | } |
1095 | 1105 | ||
1096 | void KABCore::copyContacts() | 1106 | void KABCore::copyContacts() |
1097 | { | 1107 | { |
1098 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); | 1108 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); |
1099 | 1109 | ||
1100 | QString clipText = AddresseeUtil::addresseesToClipboard( addrList ); | 1110 | QString clipText = AddresseeUtil::addresseesToClipboard( addrList ); |
1101 | 1111 | ||
1102 | kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl; | 1112 | kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl; |
1103 | 1113 | ||
1104 | QClipboard *cb = QApplication::clipboard(); | 1114 | QClipboard *cb = QApplication::clipboard(); |
1105 | cb->setText( clipText ); | 1115 | cb->setText( clipText ); |
1106 | } | 1116 | } |
1107 | 1117 | ||
1108 | void KABCore::cutContacts() | 1118 | void KABCore::cutContacts() |
1109 | { | 1119 | { |
1110 | QStringList uidList = mViewManager->selectedUids(); | 1120 | QStringList uidList = mViewManager->selectedUids(); |
1111 | 1121 | ||
1112 | //US if ( uidList.size() > 0 ) { | 1122 | //US if ( uidList.size() > 0 ) { |
1113 | if ( uidList.count() > 0 ) { | 1123 | if ( uidList.count() > 0 ) { |
1114 | PwCutCommand *command = new PwCutCommand( mAddressBook, uidList ); | 1124 | PwCutCommand *command = new PwCutCommand( mAddressBook, uidList ); |
1115 | UndoStack::instance()->push( command ); | 1125 | UndoStack::instance()->push( command ); |
1116 | RedoStack::instance()->clear(); | 1126 | RedoStack::instance()->clear(); |
1117 | 1127 | ||
1118 | setModified( true ); | 1128 | setModified( true ); |
1119 | } | 1129 | } |
1120 | } | 1130 | } |
1121 | 1131 | ||
1122 | void KABCore::pasteContacts() | 1132 | void KABCore::pasteContacts() |
1123 | { | 1133 | { |
1124 | QClipboard *cb = QApplication::clipboard(); | 1134 | QClipboard *cb = QApplication::clipboard(); |
1125 | 1135 | ||
1126 | KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() ); | 1136 | KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() ); |
1127 | 1137 | ||
1128 | pasteContacts( list ); | 1138 | pasteContacts( list ); |
1129 | } | 1139 | } |
1130 | 1140 | ||
1131 | void KABCore::pasteContacts( KABC::Addressee::List &list ) | 1141 | void KABCore::pasteContacts( KABC::Addressee::List &list ) |
1132 | { | 1142 | { |
1133 | KABC::Resource *resource = requestResource( this ); | 1143 | KABC::Resource *resource = requestResource( this ); |
1134 | KABC::Addressee::List::Iterator it; | 1144 | KABC::Addressee::List::Iterator it; |
1135 | for ( it = list.begin(); it != list.end(); ++it ) | 1145 | for ( it = list.begin(); it != list.end(); ++it ) |
1136 | (*it).setResource( resource ); | 1146 | (*it).setResource( resource ); |
1137 | 1147 | ||
1138 | PwPasteCommand *command = new PwPasteCommand( this, list ); | 1148 | PwPasteCommand *command = new PwPasteCommand( this, list ); |
1139 | UndoStack::instance()->push( command ); | 1149 | UndoStack::instance()->push( command ); |
1140 | RedoStack::instance()->clear(); | 1150 | RedoStack::instance()->clear(); |
1141 | 1151 | ||
1142 | setModified( true ); | 1152 | setModified( true ); |
1143 | } | 1153 | } |
1144 | 1154 | ||
1145 | void KABCore::setWhoAmI() | 1155 | void KABCore::setWhoAmI() |
1146 | { | 1156 | { |
1147 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); | 1157 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); |
1148 | 1158 | ||
1149 | if ( addrList.count() > 1 ) { | 1159 | if ( addrList.count() > 1 ) { |
1150 | KMessageBox::sorry( this, i18n( "Please select only one contact." ) ); | 1160 | KMessageBox::sorry( this, i18n( "Please select only one contact." ) ); |
1151 | return; | 1161 | return; |
1152 | } | 1162 | } |
1153 | 1163 | ||
1154 | QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) ); | 1164 | QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) ); |
1155 | if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].realName() ) ) == KMessageBox::Yes ) | 1165 | if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].realName() ) ) == KMessageBox::Yes ) |
1156 | static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] ); | 1166 | static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] ); |
1157 | } | 1167 | } |
1158 | void KABCore::editCategories() | 1168 | void KABCore::editCategories() |
1159 | { | 1169 | { |
1160 | KPIM::CategoryEditDialog dlg ( KABPrefs::instance(), this, "", true ); | 1170 | KPIM::CategoryEditDialog dlg ( KABPrefs::instance(), this, "", true ); |
1161 | dlg.exec(); | 1171 | dlg.exec(); |
1162 | } | 1172 | } |
1163 | void KABCore::setCategories() | 1173 | void KABCore::setCategories() |
1164 | { | 1174 | { |
1165 | 1175 | ||
1166 | QStringList uids; | 1176 | QStringList uids; |
1167 | XXPortSelectDialog dlgx( this, false, this ); | 1177 | XXPortSelectDialog dlgx( this, false, this ); |
1168 | if ( dlgx.exec() ) | 1178 | if ( dlgx.exec() ) |
1169 | uids = dlgx.uids(); | 1179 | uids = dlgx.uids(); |
1170 | else | 1180 | else |
1171 | return; | 1181 | return; |
1172 | if ( uids.isEmpty() ) | 1182 | if ( uids.isEmpty() ) |
1173 | return; | 1183 | return; |
1174 | // qDebug("count %d ", uids.count()); | 1184 | // qDebug("count %d ", uids.count()); |
1175 | 1185 | ||
1176 | 1186 | ||
1177 | KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true ); | 1187 | KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true ); |
1178 | if ( !dlg.exec() ) { | 1188 | if ( !dlg.exec() ) { |
1179 | message( i18n("Setting categories cancelled") ); | 1189 | message( i18n("Setting categories cancelled") ); |
1180 | return; | 1190 | return; |
1181 | } | 1191 | } |
1182 | bool merge = false; | 1192 | bool merge = false; |
1183 | QString msg = i18n( "Merge with existing categories?" ); | 1193 | QString msg = i18n( "Merge with existing categories?" ); |
1184 | if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes ) | 1194 | if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes ) |
1185 | merge = true; | 1195 | merge = true; |
1186 | 1196 | ||
1187 | message( i18n("Setting categories ... please wait!") ); | 1197 | message( i18n("Setting categories ... please wait!") ); |
1188 | QStringList categories = dlg.selectedCategories(); | 1198 | QStringList categories = dlg.selectedCategories(); |
1189 | 1199 | ||
1190 | //QStringList uids = mViewManager->selectedUids(); | 1200 | //QStringList uids = mViewManager->selectedUids(); |
1191 | QStringList::Iterator it; | 1201 | QStringList::Iterator it; |
1192 | for ( it = uids.begin(); it != uids.end(); ++it ) { | 1202 | for ( it = uids.begin(); it != uids.end(); ++it ) { |
1193 | KABC::Addressee addr = mAddressBook->findByUid( *it ); | 1203 | KABC::Addressee addr = mAddressBook->findByUid( *it ); |
1194 | if ( !addr.isEmpty() ) { | 1204 | if ( !addr.isEmpty() ) { |
1195 | if ( !merge ) | 1205 | if ( !merge ) |
1196 | addr.setCategories( categories ); | 1206 | addr.setCategories( categories ); |
1197 | else { | 1207 | else { |
1198 | QStringList addrCategories = addr.categories(); | 1208 | QStringList addrCategories = addr.categories(); |
1199 | QStringList::Iterator catIt; | 1209 | QStringList::Iterator catIt; |
1200 | for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) { | 1210 | for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) { |
1201 | if ( !addrCategories.contains( *catIt ) ) | 1211 | if ( !addrCategories.contains( *catIt ) ) |
1202 | addrCategories.append( *catIt ); | 1212 | addrCategories.append( *catIt ); |
1203 | } | 1213 | } |
1204 | addr.setCategories( addrCategories ); | 1214 | addr.setCategories( addrCategories ); |
1205 | } | 1215 | } |
1206 | mAddressBook->insertAddressee( addr ); | 1216 | mAddressBook->insertAddressee( addr ); |
1207 | } | 1217 | } |
1208 | } | 1218 | } |
1209 | 1219 | ||
1210 | if ( uids.count() > 0 ) | 1220 | if ( uids.count() > 0 ) |
1211 | setModified( true ); | 1221 | setModified( true ); |
1212 | message( i18n("Setting categories completed!") ); | 1222 | message( i18n("Setting categories completed!") ); |
1213 | } | 1223 | } |
1214 | 1224 | ||
1215 | void KABCore::setSearchFields( const KABC::Field::List &fields ) | 1225 | void KABCore::setSearchFields( const KABC::Field::List &fields ) |
1216 | { | 1226 | { |
1217 | mIncSearchWidget->setFields( fields ); | 1227 | mIncSearchWidget->setFields( fields ); |
1218 | } | 1228 | } |
1219 | 1229 | ||
1220 | void KABCore::incrementalSearch( const QString& text ) | 1230 | void KABCore::incrementalSearch( const QString& text ) |
1221 | { | 1231 | { |
1222 | QString stext; | 1232 | QString stext; |
1223 | if ( KABPrefs::instance()->mAutoSearchWithWildcard ) { | 1233 | if ( KABPrefs::instance()->mAutoSearchWithWildcard ) { |
1224 | stext = "*" + text; | 1234 | stext = "*" + text; |
1225 | } else { | 1235 | } else { |
1226 | stext = text; | 1236 | stext = text; |
1227 | } | 1237 | } |
1228 | mViewManager->doSearch( stext, mIncSearchWidget->currentField() ); | 1238 | mViewManager->doSearch( stext, mIncSearchWidget->currentField() ); |
1229 | } | 1239 | } |
1230 | void KABCore::incrementalSearchJump( const QString& text ) | 1240 | void KABCore::incrementalSearchJump( const QString& text ) |
1231 | { | 1241 | { |
1232 | mViewManager->doSearch( text, mIncSearchWidget->currentField() ); | 1242 | mViewManager->doSearch( text, mIncSearchWidget->currentField() ); |
1233 | } | 1243 | } |
1234 | 1244 | ||
1235 | void KABCore::setModified() | 1245 | void KABCore::setModified() |
1236 | { | 1246 | { |
1237 | setModified( true ); | 1247 | setModified( true ); |
1238 | } | 1248 | } |
1239 | 1249 | ||
1240 | void KABCore::setModifiedWOrefresh() | 1250 | void KABCore::setModifiedWOrefresh() |
1241 | { | 1251 | { |
1242 | // qDebug("KABCore::setModifiedWOrefresh() "); | 1252 | // qDebug("KABCore::setModifiedWOrefresh() "); |
1243 | mModified = true; | 1253 | mModified = true; |
1244 | mActionSave->setEnabled( mModified ); | 1254 | mActionSave->setEnabled( mModified ); |
1245 | 1255 | ||
1246 | 1256 | ||
1247 | } | 1257 | } |
1248 | void KABCore::setModified( bool modified ) | 1258 | void KABCore::setModified( bool modified ) |
1249 | { | 1259 | { |
1250 | mModified = modified; | 1260 | mModified = modified; |
1251 | mActionSave->setEnabled( mModified ); | 1261 | mActionSave->setEnabled( mModified ); |
1252 | 1262 | ||
1253 | if ( modified ) | 1263 | if ( modified ) |
1254 | mJumpButtonBar->recreateButtons(); | 1264 | mJumpButtonBar->recreateButtons(); |
1255 | 1265 | ||
1256 | mViewManager->refreshView(); | 1266 | mViewManager->refreshView(); |
1257 | 1267 | ||
1258 | } | 1268 | } |
1259 | 1269 | ||
1260 | bool KABCore::modified() const | 1270 | bool KABCore::modified() const |
1261 | { | 1271 | { |
1262 | return mModified; | 1272 | return mModified; |
1263 | } | 1273 | } |
1264 | 1274 | ||
1265 | void KABCore::contactModified( const KABC::Addressee &addr ) | 1275 | void KABCore::contactModified( const KABC::Addressee &addr ) |
1266 | { | 1276 | { |
1267 | addrModified( addr ); | 1277 | addrModified( addr ); |
1268 | #if 0 // debug only | 1278 | #if 0 // debug only |
1269 | KABC::Addressee ad = addr; | 1279 | KABC::Addressee ad = addr; |
1270 | ad.computeCsum( "123"); | 1280 | ad.computeCsum( "123"); |
1271 | #endif | 1281 | #endif |
1272 | } | 1282 | } |
1273 | 1283 | ||
1274 | void KABCore::addrModified( const KABC::Addressee &addr ,bool updateDetails ) | 1284 | void KABCore::addrModified( const KABC::Addressee &addr ,bool updateDetails ) |
1275 | { | 1285 | { |
1276 | 1286 | ||
1277 | Command *command = 0; | 1287 | Command *command = 0; |
1278 | QString uid; | 1288 | QString uid; |
1279 | 1289 | ||
1280 | // check if it exists already | 1290 | // check if it exists already |
1281 | KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() ); | 1291 | KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() ); |
1282 | if ( origAddr.isEmpty() ) | 1292 | if ( origAddr.isEmpty() ) |
1283 | command = new PwNewCommand( mAddressBook, addr ); | 1293 | command = new PwNewCommand( mAddressBook, addr ); |
1284 | else { | 1294 | else { |
1285 | command = new PwEditCommand( mAddressBook, origAddr, addr ); | 1295 | command = new PwEditCommand( mAddressBook, origAddr, addr ); |
1286 | uid = addr.uid(); | 1296 | uid = addr.uid(); |
1287 | } | 1297 | } |
1288 | 1298 | ||
1289 | UndoStack::instance()->push( command ); | 1299 | UndoStack::instance()->push( command ); |
1290 | RedoStack::instance()->clear(); | 1300 | RedoStack::instance()->clear(); |
1291 | if ( updateDetails ) | 1301 | if ( updateDetails ) |
1292 | mDetails->setAddressee( addr ); | 1302 | mDetails->setAddressee( addr ); |
1293 | setModified( true ); | 1303 | setModified( true ); |
1294 | } | 1304 | } |
1295 | 1305 | ||
1296 | void KABCore::newContact() | 1306 | void KABCore::newContact() |
1297 | { | 1307 | { |
1298 | 1308 | ||
1299 | 1309 | ||
1300 | QPtrList<KABC::Resource> kabcResources = mAddressBook->resources(); | 1310 | Q3PtrList<KABC::Resource> kabcResources = mAddressBook->resources(); |
1301 | 1311 | ||
1302 | QPtrList<KRES::Resource> kresResources; | 1312 | Q3PtrList<KRES::Resource> kresResources; |
1303 | QPtrListIterator<KABC::Resource> it( kabcResources ); | 1313 | Q3PtrListIterator<KABC::Resource> it( kabcResources ); |
1304 | KABC::Resource *resource; | 1314 | KABC::Resource *resource; |
1305 | while ( ( resource = it.current() ) != 0 ) { | 1315 | while ( ( resource = it.current() ) != 0 ) { |
1306 | ++it; | 1316 | ++it; |
1307 | if ( !resource->readOnly() ) { | 1317 | if ( !resource->readOnly() ) { |
1308 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); | 1318 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); |
1309 | if ( res ) | 1319 | if ( res ) |
1310 | kresResources.append( res ); | 1320 | kresResources.append( res ); |
1311 | } | 1321 | } |
1312 | } | 1322 | } |
1313 | 1323 | ||
1314 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); | 1324 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); |
1315 | resource = static_cast<KABC::Resource*>( res ); | 1325 | resource = static_cast<KABC::Resource*>( res ); |
1316 | 1326 | ||
1317 | if ( resource ) { | 1327 | if ( resource ) { |
1318 | KABC::Addressee addr; | 1328 | KABC::Addressee addr; |
1319 | addr.setResource( resource ); | 1329 | addr.setResource( resource ); |
1320 | mEditorDialog->setAddressee( addr ); | 1330 | mEditorDialog->setAddressee( addr ); |
1321 | mEditorDialog->setCaption( i18n("Edit new contact")); | 1331 | mEditorDialog->setCaption( i18n("Edit new contact")); |
1322 | KApplication::execDialog ( mEditorDialog ); | 1332 | KApplication::execDialog ( mEditorDialog ); |
1323 | 1333 | ||
1324 | } else | 1334 | } else |
1325 | return; | 1335 | return; |
1326 | 1336 | ||
1327 | // mEditorDict.insert( dialog->addressee().uid(), dialog ); | 1337 | // mEditorDict.insert( dialog->addressee().uid(), dialog ); |
1328 | 1338 | ||
1329 | 1339 | ||
1330 | } | 1340 | } |
1331 | 1341 | ||
1332 | void KABCore::addEmail( QString aStr ) | 1342 | void KABCore::addEmail( QString aStr ) |
1333 | { | 1343 | { |
1334 | #ifndef KAB_EMBEDDED | 1344 | #ifndef KAB_EMBEDDED |
1335 | QString fullName, email; | 1345 | QString fullName, email; |
1336 | 1346 | ||
1337 | KABC::Addressee::parseEmailAddress( aStr, fullName, email ); | 1347 | KABC::Addressee::parseEmailAddress( aStr, fullName, email ); |
1338 | 1348 | ||
1339 | // Try to lookup the addressee matching the email address | 1349 | // Try to lookup the addressee matching the email address |
1340 | bool found = false; | 1350 | bool found = false; |
1341 | QStringList emailList; | 1351 | QStringList emailList; |
1342 | KABC::AddressBook::Iterator it; | 1352 | KABC::AddressBook::Iterator it; |
1343 | for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) { | 1353 | for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) { |
1344 | emailList = (*it).emails(); | 1354 | emailList = (*it).emails(); |
1345 | if ( emailList.contains( email ) > 0 ) { | 1355 | if ( emailList.contains( email ) > 0 ) { |
1346 | found = true; | 1356 | found = true; |
1347 | (*it).setNameFromString( fullName ); | 1357 | (*it).setNameFromString( fullName ); |
1348 | editContact( (*it).uid() ); | 1358 | editContact( (*it).uid() ); |
1349 | } | 1359 | } |
1350 | } | 1360 | } |
1351 | 1361 | ||
1352 | if ( !found ) { | 1362 | if ( !found ) { |
1353 | KABC::Addressee addr; | 1363 | KABC::Addressee addr; |
1354 | addr.setNameFromString( fullName ); | 1364 | addr.setNameFromString( fullName ); |
1355 | addr.insertEmail( email, true ); | 1365 | addr.insertEmail( email, true ); |
1356 | 1366 | ||
1357 | mAddressBook->insertAddressee( addr ); | 1367 | mAddressBook->insertAddressee( addr ); |
1358 | mViewManager->refreshView( addr.uid() ); | 1368 | mViewManager->refreshView( addr.uid() ); |
1359 | editContact( addr.uid() ); | 1369 | editContact( addr.uid() ); |
1360 | } | 1370 | } |
1361 | #else //KAB_EMBEDDED | 1371 | #else //KAB_EMBEDDED |
1362 | qDebug("KABCore::addEmail finsih method"); | 1372 | qDebug("KABCore::addEmail finsih method"); |
1363 | #endif //KAB_EMBEDDED | 1373 | #endif //KAB_EMBEDDED |
1364 | } | 1374 | } |
1365 | 1375 | ||
1366 | void KABCore::importVCard( const KURL &url, bool showPreview ) | 1376 | void KABCore::importVCard( const KURL &url, bool showPreview ) |
1367 | { | 1377 | { |
1368 | mXXPortManager->importVCard( url, showPreview ); | 1378 | mXXPortManager->importVCard( url, showPreview ); |
1369 | } | 1379 | } |
1370 | void KABCore::importFromOL() | 1380 | void KABCore::importFromOL() |
1371 | { | 1381 | { |
1372 | #ifdef _OL_IMPORT_ | 1382 | #ifdef _OL_IMPORT_ |
1373 | KABC::Addressee::List list = OL_access::instance()->importOLcontacts(); | 1383 | KABC::Addressee::List list = OL_access::instance()->importOLcontacts(); |
1374 | if ( list.count() > 0 ) { | 1384 | if ( list.count() > 0 ) { |
1375 | KABC::Addressee::List listNew; | 1385 | KABC::Addressee::List listNew; |
1376 | KABC::Addressee::List listExisting; | 1386 | KABC::Addressee::List listExisting; |
1377 | KABC::Addressee::List::Iterator it; | 1387 | KABC::Addressee::List::Iterator it; |
1378 | KABC::AddressBook::Iterator iter; | 1388 | KABC::AddressBook::Iterator iter; |
1379 | for ( it = list.begin(); it != list.end(); ++it ) { | 1389 | for ( it = list.begin(); it != list.end(); ++it ) { |
1380 | if ( mAddressBook->findByUid((*it).uid() ).isEmpty()) | 1390 | if ( mAddressBook->findByUid((*it).uid() ).isEmpty()) |
1381 | listNew.append( (*it) ); | 1391 | listNew.append( (*it) ); |
1382 | else | 1392 | else |
1383 | listExisting.append( (*it) ); | 1393 | listExisting.append( (*it) ); |
1384 | } | 1394 | } |
1385 | QString mess = i18n("%1 contacts read from OL.\n\n%2 contacts added to addressbook!").arg( list.count()).arg( listNew.count() ); | 1395 | QString mess = i18n("%1 contacts read from OL.\n\n%2 contacts added to addressbook!").arg( list.count()).arg( listNew.count() ); |
1386 | if ( listExisting.count() > 0 ) | 1396 | if ( listExisting.count() > 0 ) |
1387 | mess += "\n\n"+ i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() ); | 1397 | mess += "\n\n"+ i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() ); |
1388 | 1398 | ||
1389 | KMessageBox::information( this, mess ); | 1399 | KMessageBox::information( this, mess ); |
1390 | if ( listNew.count() > 0 ) { | 1400 | if ( listNew.count() > 0 ) { |
1391 | pasteWithNewUid = false; | 1401 | pasteWithNewUid = false; |
1392 | pasteContacts( listNew ); | 1402 | pasteContacts( listNew ); |
1393 | pasteWithNewUid = true; | 1403 | pasteWithNewUid = true; |
1394 | } | 1404 | } |
1395 | } | 1405 | } |
1396 | #endif | 1406 | #endif |
1397 | } | 1407 | } |
1398 | 1408 | ||
1399 | bool KABCore::readOLdata( KABC::AddressBook* local ) | 1409 | bool KABCore::readOLdata( KABC::AddressBook* local ) |
1400 | { | 1410 | { |
1401 | #ifdef _OL_IMPORT_ | 1411 | #ifdef _OL_IMPORT_ |
1402 | QStringList folderList = OL_access::instance()->getFolderSelection( OL_CONTACT_DATA , i18n("Select Folder to sync")); | 1412 | QStringList folderList = OL_access::instance()->getFolderSelection( OL_CONTACT_DATA , i18n("Select Folder to sync")); |
1403 | KABC::Addressee::List list; | 1413 | KABC::Addressee::List list; |
1404 | if ( folderList.count() ) { | 1414 | if ( folderList.count() ) { |
1405 | OL_access::instance()->readContactData( OL_access::instance()->getFolderFromID( 0, folderList[1] ) , &list, true ); | 1415 | OL_access::instance()->readContactData( OL_access::instance()->getFolderFromID( 0, folderList[1] ) , &list, true ); |
1406 | KABC::Addressee::List::Iterator it; | 1416 | KABC::Addressee::List::Iterator it; |
1407 | for ( it = list.begin(); it != list.end(); ++it ) { | 1417 | for ( it = list.begin(); it != list.end(); ++it ) { |
1408 | (*it).setExternalUID( (*it).uid() ); | 1418 | (*it).setExternalUID( (*it).uid() ); |
1409 | (*it).setOriginalExternalUID( (*it).uid() ); | 1419 | (*it).setOriginalExternalUID( (*it).uid() ); |
1410 | (*it).setTempSyncStat( SYNC_TEMPSTATE_NEW_EXTERNAL ); | 1420 | (*it).setTempSyncStat( SYNC_TEMPSTATE_NEW_EXTERNAL ); |
1411 | local->insertAddressee( (*it) , false, false ); | 1421 | local->insertAddressee( (*it) , false, false ); |
1412 | } | 1422 | } |
1413 | mOLsyncFolderID = folderList[1]; | 1423 | mOLsyncFolderID = folderList[1]; |
1414 | //KMessageBox::information( this, i18n("OLsync folder ID ") + mOLsyncFolderID ); | 1424 | //KMessageBox::information( this, i18n("OLsync folder ID ") + mOLsyncFolderID ); |
1415 | } | 1425 | } |
1416 | return list.count() > 0; | 1426 | return list.count() > 0; |
1417 | #else | 1427 | #else |
1418 | return false; | 1428 | return false; |
1419 | #endif | 1429 | #endif |
1420 | } | 1430 | } |
1421 | bool KABCore::writeOLdata( KABC::AddressBook* aBook ) | 1431 | bool KABCore::writeOLdata( KABC::AddressBook* aBook ) |
1422 | { | 1432 | { |
1423 | #ifdef _OL_IMPORT_ | 1433 | #ifdef _OL_IMPORT_ |
1424 | if ( !OL_access::instance()->setSelectedFolder( mOLsyncFolderID ) ) | 1434 | if ( !OL_access::instance()->setSelectedFolder( mOLsyncFolderID ) ) |
1425 | return false; | 1435 | return false; |
1426 | KABC::AddressBook::Iterator it; | 1436 | KABC::AddressBook::Iterator it; |
1427 | for ( it = aBook->begin(); it != aBook->end(); ++it ) { | 1437 | for ( it = aBook->begin(); it != aBook->end(); ++it ) { |
1428 | if ( (*it).tempSyncStat() != SYNC_TEMPSTATE_NEW_EXTERNAL ) { | 1438 | if ( (*it).tempSyncStat() != SYNC_TEMPSTATE_NEW_EXTERNAL ) { |
1429 | KABC::Addressee addressee = (*it); | 1439 | KABC::Addressee addressee = (*it); |
1430 | if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_ADDED_EXTERNAL ) { | 1440 | if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_ADDED_EXTERNAL ) { |
1431 | (*it) = OL_access::instance()->addAddressee( (*it) ); | 1441 | (*it) = OL_access::instance()->addAddressee( (*it) ); |
1432 | (*it).setTempSyncStat( SYNC_TEMPSTATE_NEW_ID ); | 1442 | (*it).setTempSyncStat( SYNC_TEMPSTATE_NEW_ID ); |
1433 | } else if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_DELETE ) { | 1443 | } else if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_DELETE ) { |
1434 | OL_access::instance()->deleteAddressee( (*it) ); | 1444 | OL_access::instance()->deleteAddressee( (*it) ); |
1435 | } else if ( (*it).tempSyncStat() != SYNC_TEMPSTATE_NEW_EXTERNAL ) { | 1445 | } else if ( (*it).tempSyncStat() != SYNC_TEMPSTATE_NEW_EXTERNAL ) { |
1436 | //changed | 1446 | //changed |
1437 | (*it) = OL_access::instance()->changeAddressee( (*it) ); | 1447 | (*it) = OL_access::instance()->changeAddressee( (*it) ); |
1438 | (*it).setTempSyncStat( SYNC_TEMPSTATE_NEW_CSUM ); | 1448 | (*it).setTempSyncStat( SYNC_TEMPSTATE_NEW_CSUM ); |
1439 | } | 1449 | } |
1440 | } | 1450 | } |
1441 | } | 1451 | } |
1442 | return true; | 1452 | return true; |
1443 | #else | 1453 | #else |
1444 | return false; | 1454 | return false; |
1445 | #endif | 1455 | #endif |
1446 | } | 1456 | } |
1447 | void KABCore::importVCard( const QString &vCard, bool showPreview ) | 1457 | void KABCore::importVCard( const QString &vCard, bool showPreview ) |
1448 | { | 1458 | { |
1449 | mXXPortManager->importVCard( vCard, showPreview ); | 1459 | mXXPortManager->importVCard( vCard, showPreview ); |
1450 | } | 1460 | } |
1451 | 1461 | ||
1452 | //US added a second method without defaultparameter | 1462 | //US added a second method without defaultparameter |
1453 | void KABCore::editContact2() { | 1463 | void KABCore::editContact2() { |
1454 | editContact( QString::null ); | 1464 | editContact( QString::null ); |
1455 | } | 1465 | } |
1456 | 1466 | ||
1457 | void KABCore::editContact( const QString &uid ) | 1467 | void KABCore::editContact( const QString &uid ) |
1458 | { | 1468 | { |
1459 | 1469 | ||
1460 | if ( mExtensionManager->isQuickEditVisible() ) | 1470 | if ( mExtensionManager->isQuickEditVisible() ) |
1461 | return; | 1471 | return; |
1462 | 1472 | ||
1463 | // First, locate the contact entry | 1473 | // First, locate the contact entry |
1464 | QString localUID = uid; | 1474 | QString localUID = uid; |
1465 | if ( localUID.isNull() ) { | 1475 | if ( localUID.isNull() ) { |
1466 | QStringList uidList = mViewManager->selectedUids(); | 1476 | QStringList uidList = mViewManager->selectedUids(); |
1467 | if ( uidList.count() > 0 ) | 1477 | if ( uidList.count() > 0 ) |
1468 | localUID = *( uidList.at( 0 ) ); | 1478 | localUID = *( uidList.at( 0 ) ); |
1469 | } | 1479 | } |
1470 | 1480 | ||
1471 | KABC::Addressee addr = mAddressBook->findByUid( localUID ); | 1481 | KABC::Addressee addr = mAddressBook->findByUid( localUID ); |
1472 | if ( !addr.isEmpty() ) { | 1482 | if ( !addr.isEmpty() ) { |
1473 | mEditorDialog->setAddressee( addr ); | 1483 | mEditorDialog->setAddressee( addr ); |
1474 | KApplication::execDialog ( mEditorDialog ); | 1484 | KApplication::execDialog ( mEditorDialog ); |
1475 | } | 1485 | } |
1476 | } | 1486 | } |
1477 | 1487 | ||
1478 | /** | 1488 | /** |
1479 | Shows or edits the detail view for the given uid. If the uid is QString::null, | 1489 | Shows or edits the detail view for the given uid. If the uid is QString::null, |
1480 | the method will try to find a selected addressee in the view. | 1490 | the method will try to find a selected addressee in the view. |
1481 | */ | 1491 | */ |
1482 | void KABCore::executeContact( const QString &uid /*US = QString::null*/ ) | 1492 | void KABCore::executeContact( const QString &uid /*US = QString::null*/ ) |
1483 | { | 1493 | { |
1484 | if ( mMultipleViewsAtOnce ) | 1494 | if ( mMultipleViewsAtOnce ) |
1485 | { | 1495 | { |
1486 | editContact( uid ); | 1496 | editContact( uid ); |
1487 | } | 1497 | } |
1488 | else | 1498 | else |
1489 | { | 1499 | { |
1490 | setDetailsVisible( true ); | 1500 | setDetailsVisible( true ); |
1491 | mActionDetails->setChecked(true); | 1501 | mActionDetails->setChecked(true); |
1492 | } | 1502 | } |
1493 | 1503 | ||
1494 | } | 1504 | } |
1495 | 1505 | ||
@@ -1667,1628 +1677,1628 @@ void KABCore::extensionChanged( int id ) | |||
1667 | 1677 | ||
1668 | void KABCore::extensionModified( const KABC::Addressee::List &list ) | 1678 | void KABCore::extensionModified( const KABC::Addressee::List &list ) |
1669 | { | 1679 | { |
1670 | 1680 | ||
1671 | if ( list.count() != 0 ) { | 1681 | if ( list.count() != 0 ) { |
1672 | KABC::Addressee::List::ConstIterator it; | 1682 | KABC::Addressee::List::ConstIterator it; |
1673 | for ( it = list.begin(); it != list.end(); ++it ) | 1683 | for ( it = list.begin(); it != list.end(); ++it ) |
1674 | mAddressBook->insertAddressee( *it ); | 1684 | mAddressBook->insertAddressee( *it ); |
1675 | if ( list.count() > 1 ) | 1685 | if ( list.count() > 1 ) |
1676 | setModified(); | 1686 | setModified(); |
1677 | else | 1687 | else |
1678 | setModifiedWOrefresh(); | 1688 | setModifiedWOrefresh(); |
1679 | } | 1689 | } |
1680 | if ( list.count() == 0 ) | 1690 | if ( list.count() == 0 ) |
1681 | mViewManager->refreshView(); | 1691 | mViewManager->refreshView(); |
1682 | else | 1692 | else |
1683 | mViewManager->refreshView( list[ 0 ].uid() ); | 1693 | mViewManager->refreshView( list[ 0 ].uid() ); |
1684 | 1694 | ||
1685 | 1695 | ||
1686 | 1696 | ||
1687 | } | 1697 | } |
1688 | 1698 | ||
1689 | QString KABCore::getNameByPhone( const QString &phone ) | 1699 | QString KABCore::getNameByPhone( const QString &phone ) |
1690 | { | 1700 | { |
1691 | #ifndef KAB_EMBEDDED | 1701 | #ifndef KAB_EMBEDDED |
1692 | QRegExp r( "[/*/-/ ]" ); | 1702 | QRegExp r( "[/*/-/ ]" ); |
1693 | QString localPhone( phone ); | 1703 | QString localPhone( phone ); |
1694 | 1704 | ||
1695 | bool found = false; | 1705 | bool found = false; |
1696 | QString ownerName = ""; | 1706 | QString ownerName = ""; |
1697 | KABC::AddressBook::Iterator iter; | 1707 | KABC::AddressBook::Iterator iter; |
1698 | KABC::PhoneNumber::List::Iterator phoneIter; | 1708 | KABC::PhoneNumber::List::Iterator phoneIter; |
1699 | KABC::PhoneNumber::List phoneList; | 1709 | KABC::PhoneNumber::List phoneList; |
1700 | for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) { | 1710 | for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) { |
1701 | phoneList = (*iter).phoneNumbers(); | 1711 | phoneList = (*iter).phoneNumbers(); |
1702 | for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() ); | 1712 | for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() ); |
1703 | ++phoneIter) { | 1713 | ++phoneIter) { |
1704 | // Get rid of separator chars so just the numbers are compared. | 1714 | // Get rid of separator chars so just the numbers are compared. |
1705 | if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) { | 1715 | if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) { |
1706 | ownerName = (*iter).formattedName(); | 1716 | ownerName = (*iter).formattedName(); |
1707 | found = true; | 1717 | found = true; |
1708 | } | 1718 | } |
1709 | } | 1719 | } |
1710 | } | 1720 | } |
1711 | 1721 | ||
1712 | return ownerName; | 1722 | return ownerName; |
1713 | #else //KAB_EMBEDDED | 1723 | #else //KAB_EMBEDDED |
1714 | qDebug("KABCore::getNameByPhone finsih method"); | 1724 | qDebug("KABCore::getNameByPhone finsih method"); |
1715 | return ""; | 1725 | return ""; |
1716 | #endif //KAB_EMBEDDED | 1726 | #endif //KAB_EMBEDDED |
1717 | 1727 | ||
1718 | } | 1728 | } |
1719 | void KABCore::openConfigGlobalDialog() | 1729 | void KABCore::openConfigGlobalDialog() |
1720 | { | 1730 | { |
1721 | KPimPrefsGlobalDialog gc ( this ); | 1731 | KPimPrefsGlobalDialog gc ( this ); |
1722 | gc.exec(); | 1732 | gc.exec(); |
1723 | } | 1733 | } |
1724 | void KABCore::openConfigDialog() | 1734 | void KABCore::openConfigDialog() |
1725 | { | 1735 | { |
1726 | KDialogBase * ConfigureDialog = new KDialogBase ( KDialogBase::Plain , i18n("Configure KA/Pi"), KDialogBase::Default |KDialogBase::Cancel | KDialogBase::Apply | KDialogBase::Ok, KDialogBase::Ok,0, "name", true, true); | 1736 | KDialogBase * ConfigureDialog = new KDialogBase ( KDialogBase::Plain , i18n("Configure KA/Pi"), KDialogBase::Default |KDialogBase::Cancel | KDialogBase::Apply | KDialogBase::Ok, KDialogBase::Ok,0, "name", true, true); |
1727 | 1737 | ||
1728 | KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog , "KCMKabConfig" ); | 1738 | KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog , "KCMKabConfig" ); |
1729 | ConfigureDialog->setMainWidget( kabcfg ); | 1739 | ConfigureDialog->setMainWidget( kabcfg ); |
1730 | connect( ConfigureDialog, SIGNAL( applyClicked() ), | 1740 | connect( ConfigureDialog, SIGNAL( applyClicked() ), |
1731 | this, SLOT( configurationChanged() ) ); | 1741 | this, SLOT( configurationChanged() ) ); |
1732 | connect( ConfigureDialog, SIGNAL( applyClicked() ), | 1742 | connect( ConfigureDialog, SIGNAL( applyClicked() ), |
1733 | kabcfg, SLOT( save() ) ); | 1743 | kabcfg, SLOT( save() ) ); |
1734 | connect( ConfigureDialog, SIGNAL( acceptClicked() ), | 1744 | connect( ConfigureDialog, SIGNAL( acceptClicked() ), |
1735 | this, SLOT( configurationChanged() ) ); | 1745 | this, SLOT( configurationChanged() ) ); |
1736 | connect( ConfigureDialog, SIGNAL( acceptClicked() ), | 1746 | connect( ConfigureDialog, SIGNAL( acceptClicked() ), |
1737 | kabcfg, SLOT( save() ) ); | 1747 | kabcfg, SLOT( save() ) ); |
1738 | connect( ConfigureDialog, SIGNAL( defaultClicked() ), | 1748 | connect( ConfigureDialog, SIGNAL( defaultClicked() ), |
1739 | kabcfg, SLOT( defaults() ) ); | 1749 | kabcfg, SLOT( defaults() ) ); |
1740 | saveSettings(); | 1750 | saveSettings(); |
1741 | kabcfg->load(); | 1751 | kabcfg->load(); |
1742 | #ifndef DESKTOP_VERSION | 1752 | #ifndef DESKTOP_VERSION |
1743 | if ( QApplication::desktop()->height() <= 480 ) | 1753 | if ( QApplication::desktop()->height() <= 480 ) |
1744 | ConfigureDialog->hideButtons(); | 1754 | ConfigureDialog->hideButtons(); |
1745 | ConfigureDialog->showMaximized(); | 1755 | ConfigureDialog->showMaximized(); |
1746 | #endif | 1756 | #endif |
1747 | if ( ConfigureDialog->exec() ) | 1757 | if ( ConfigureDialog->exec() ) |
1748 | KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") ); | 1758 | KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") ); |
1749 | delete ConfigureDialog; | 1759 | delete ConfigureDialog; |
1750 | } | 1760 | } |
1751 | 1761 | ||
1752 | void KABCore::openLDAPDialog() | 1762 | void KABCore::openLDAPDialog() |
1753 | { | 1763 | { |
1754 | #ifndef KAB_EMBEDDED | 1764 | #ifndef KAB_EMBEDDED |
1755 | if ( !mLdapSearchDialog ) { | 1765 | if ( !mLdapSearchDialog ) { |
1756 | mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this ); | 1766 | mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this ); |
1757 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager, | 1767 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager, |
1758 | SLOT( refreshView() ) ); | 1768 | SLOT( refreshView() ) ); |
1759 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this, | 1769 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this, |
1760 | SLOT( setModified() ) ); | 1770 | SLOT( setModified() ) ); |
1761 | } else | 1771 | } else |
1762 | mLdapSearchDialog->restoreSettings(); | 1772 | mLdapSearchDialog->restoreSettings(); |
1763 | 1773 | ||
1764 | if ( mLdapSearchDialog->isOK() ) | 1774 | if ( mLdapSearchDialog->isOK() ) |
1765 | mLdapSearchDialog->exec(); | 1775 | mLdapSearchDialog->exec(); |
1766 | #else //KAB_EMBEDDED | 1776 | #else //KAB_EMBEDDED |
1767 | qDebug("KABCore::openLDAPDialog() finsih method"); | 1777 | qDebug("KABCore::openLDAPDialog() finsih method"); |
1768 | #endif //KAB_EMBEDDED | 1778 | #endif //KAB_EMBEDDED |
1769 | } | 1779 | } |
1770 | 1780 | ||
1771 | void KABCore::print() | 1781 | void KABCore::print() |
1772 | { | 1782 | { |
1773 | #ifndef KAB_EMBEDDED | 1783 | #ifndef KAB_EMBEDDED |
1774 | KPrinter printer; | 1784 | KPrinter printer; |
1775 | if ( !printer.setup( this ) ) | 1785 | if ( !printer.setup( this ) ) |
1776 | return; | 1786 | return; |
1777 | 1787 | ||
1778 | KABPrinting::PrintingWizard wizard( &printer, mAddressBook, | 1788 | KABPrinting::PrintingWizard wizard( &printer, mAddressBook, |
1779 | mViewManager->selectedUids(), this ); | 1789 | mViewManager->selectedUids(), this ); |
1780 | 1790 | ||
1781 | wizard.exec(); | 1791 | wizard.exec(); |
1782 | #else //KAB_EMBEDDED | 1792 | #else //KAB_EMBEDDED |
1783 | qDebug("KABCore::print() finsih method"); | 1793 | qDebug("KABCore::print() finsih method"); |
1784 | #endif //KAB_EMBEDDED | 1794 | #endif //KAB_EMBEDDED |
1785 | 1795 | ||
1786 | } | 1796 | } |
1787 | 1797 | ||
1788 | 1798 | ||
1789 | void KABCore::addGUIClient( KXMLGUIClient *client ) | 1799 | void KABCore::addGUIClient( KXMLGUIClient *client ) |
1790 | { | 1800 | { |
1791 | if ( mGUIClient ) | 1801 | if ( mGUIClient ) |
1792 | mGUIClient->insertChildClient( client ); | 1802 | mGUIClient->insertChildClient( client ); |
1793 | else | 1803 | else |
1794 | KMessageBox::error( this, "no KXMLGUICLient"); | 1804 | KMessageBox::error( this, "no KXMLGUICLient"); |
1795 | } | 1805 | } |
1796 | 1806 | ||
1797 | 1807 | ||
1798 | void KABCore::configurationChanged() | 1808 | void KABCore::configurationChanged() |
1799 | { | 1809 | { |
1800 | mExtensionManager->reconfigure(); | 1810 | mExtensionManager->reconfigure(); |
1801 | } | 1811 | } |
1802 | 1812 | ||
1803 | void KABCore::addressBookChanged() | 1813 | void KABCore::addressBookChanged() |
1804 | { | 1814 | { |
1805 | /*US | 1815 | /*US |
1806 | QDictIterator<AddresseeEditorDialog> it( mEditorDict ); | 1816 | QDictIterator<AddresseeEditorDialog> it( mEditorDict ); |
1807 | while ( it.current() ) { | 1817 | while ( it.current() ) { |
1808 | if ( it.current()->dirty() ) { | 1818 | if ( it.current()->dirty() ) { |
1809 | QString text = i18n( "Data has been changed externally. Unsaved " | 1819 | QString text = i18n( "Data has been changed externally. Unsaved " |
1810 | "changes will be lost." ); | 1820 | "changes will be lost." ); |
1811 | KMessageBox::information( this, text ); | 1821 | KMessageBox::information( this, text ); |
1812 | } | 1822 | } |
1813 | it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) ); | 1823 | it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) ); |
1814 | ++it; | 1824 | ++it; |
1815 | } | 1825 | } |
1816 | */ | 1826 | */ |
1817 | if (mEditorDialog) | 1827 | if (mEditorDialog) |
1818 | { | 1828 | { |
1819 | if (mEditorDialog->dirty()) | 1829 | if (mEditorDialog->dirty()) |
1820 | { | 1830 | { |
1821 | QString text = i18n( "Data has been changed externally. Unsaved " | 1831 | QString text = i18n( "Data has been changed externally. Unsaved " |
1822 | "changes will be lost." ); | 1832 | "changes will be lost." ); |
1823 | KMessageBox::information( this, text ); | 1833 | KMessageBox::information( this, text ); |
1824 | } | 1834 | } |
1825 | QString currentuid = mEditorDialog->addressee().uid(); | 1835 | QString currentuid = mEditorDialog->addressee().uid(); |
1826 | mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) ); | 1836 | mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) ); |
1827 | } | 1837 | } |
1828 | mViewManager->refreshView(); | 1838 | mViewManager->refreshView(); |
1829 | 1839 | ||
1830 | 1840 | ||
1831 | } | 1841 | } |
1832 | 1842 | ||
1833 | AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, | 1843 | AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, |
1834 | const char *name ) | 1844 | const char *name ) |
1835 | { | 1845 | { |
1836 | 1846 | ||
1837 | if ( mEditorDialog == 0 ) { | 1847 | if ( mEditorDialog == 0 ) { |
1838 | mEditorDialog = new AddresseeEditorDialog( this, parent, | 1848 | mEditorDialog = new AddresseeEditorDialog( this, parent, |
1839 | name ? name : "editorDialog" ); | 1849 | name ? name : "editorDialog" ); |
1840 | 1850 | ||
1841 | 1851 | ||
1842 | connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ), | 1852 | connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ), |
1843 | SLOT( contactModified( const KABC::Addressee& ) ) ); | 1853 | SLOT( contactModified( const KABC::Addressee& ) ) ); |
1844 | //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ), | 1854 | //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ), |
1845 | // SLOT( slotEditorDestroyed( const QString& ) ) ; | 1855 | // SLOT( slotEditorDestroyed( const QString& ) ) ; |
1846 | } | 1856 | } |
1847 | 1857 | ||
1848 | return mEditorDialog; | 1858 | return mEditorDialog; |
1849 | } | 1859 | } |
1850 | 1860 | ||
1851 | void KABCore::slotEditorDestroyed( const QString &uid ) | 1861 | void KABCore::slotEditorDestroyed( const QString &uid ) |
1852 | { | 1862 | { |
1853 | //mEditorDict.remove( uid ); | 1863 | //mEditorDict.remove( uid ); |
1854 | } | 1864 | } |
1855 | 1865 | ||
1856 | void KABCore::initGUI() | 1866 | void KABCore::initGUI() |
1857 | { | 1867 | { |
1858 | #ifndef KAB_EMBEDDED | 1868 | #ifndef KAB_EMBEDDED |
1859 | QHBoxLayout *topLayout = new QHBoxLayout( this ); | 1869 | Q3HBoxLayout *topLayout = new Q3HBoxLayout( this ); |
1860 | topLayout->setSpacing( KDialogBase::spacingHint() ); | 1870 | topLayout->setSpacing( KDialogBase::spacingHint() ); |
1861 | 1871 | ||
1862 | mExtensionBarSplitter = new QSplitter( this ); | 1872 | mExtensionBarSplitter = new QSplitter( this ); |
1863 | mExtensionBarSplitter->setOrientation( Qt::Vertical ); | 1873 | mExtensionBarSplitter->setOrientation( Qt::Vertical ); |
1864 | 1874 | ||
1865 | mDetailsSplitter = new QSplitter( mExtensionBarSplitter ); | 1875 | mDetailsSplitter = new QSplitter( mExtensionBarSplitter ); |
1866 | 1876 | ||
1867 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); | 1877 | Q3VBox *viewSpace = new Q3VBox( mDetailsSplitter ); |
1868 | mIncSearchWidget = new IncSearchWidget( viewSpace ); | 1878 | mIncSearchWidget = new IncSearchWidget( viewSpace ); |
1869 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 1879 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
1870 | SLOT( incrementalSearch( const QString& ) ) ); | 1880 | SLOT( incrementalSearch( const QString& ) ) ); |
1871 | 1881 | ||
1872 | mViewManager = new ViewManager( this, viewSpace ); | 1882 | mViewManager = new ViewManager( this, viewSpace ); |
1873 | viewSpace->setStretchFactor( mViewManager, 1 ); | 1883 | viewSpace->setStretchFactor( mViewManager, 1 ); |
1874 | 1884 | ||
1875 | mDetails = new ViewContainer( mDetailsSplitter ); | 1885 | mDetails = new ViewContainer( mDetailsSplitter ); |
1876 | 1886 | ||
1877 | mJumpButtonBar = new JumpButtonBar( this, this ); | 1887 | mJumpButtonBar = new JumpButtonBar( this, this ); |
1878 | 1888 | ||
1879 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); | 1889 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); |
1880 | 1890 | ||
1881 | topLayout->addWidget( mExtensionBarSplitter ); | 1891 | topLayout->addWidget( mExtensionBarSplitter ); |
1882 | topLayout->setStretchFactor( mExtensionBarSplitter, 100 ); | 1892 | topLayout->setStretchFactor( mExtensionBarSplitter, 100 ); |
1883 | topLayout->addWidget( mJumpButtonBar ); | 1893 | topLayout->addWidget( mJumpButtonBar ); |
1884 | //topLayout->setStretchFactor( mJumpButtonBar, 1 ); | 1894 | //topLayout->setStretchFactor( mJumpButtonBar, 1 ); |
1885 | 1895 | ||
1886 | mXXPortManager = new XXPortManager( this, this ); | 1896 | mXXPortManager = new XXPortManager( this, this ); |
1887 | 1897 | ||
1888 | #else //KAB_EMBEDDED | 1898 | #else //KAB_EMBEDDED |
1889 | //US initialize viewMenu before settingup viewmanager. | 1899 | //US initialize viewMenu before settingup viewmanager. |
1890 | // Viewmanager needs this menu to plugin submenues. | 1900 | // Viewmanager needs this menu to plugin submenues. |
1891 | viewMenu = new QPopupMenu( this ); | 1901 | viewMenu = new Q3PopupMenu( this ); |
1892 | settingsMenu = new QPopupMenu( this ); | 1902 | settingsMenu = new Q3PopupMenu( this ); |
1893 | //filterMenu = new QPopupMenu( this ); | 1903 | //filterMenu = new QPopupMenu( this ); |
1894 | ImportMenu = new QPopupMenu( this ); | 1904 | ImportMenu = new Q3PopupMenu( this ); |
1895 | ExportMenu = new QPopupMenu( this ); | 1905 | ExportMenu = new Q3PopupMenu( this ); |
1896 | syncMenu = new QPopupMenu( this ); | 1906 | syncMenu = new Q3PopupMenu( this ); |
1897 | changeMenu= new QPopupMenu( this ); | 1907 | changeMenu= new Q3PopupMenu( this ); |
1898 | beamMenu= new QPopupMenu( this ); | 1908 | beamMenu= new Q3PopupMenu( this ); |
1899 | 1909 | ||
1900 | //US since we have no splitter for the embedded system, setup | 1910 | //US since we have no splitter for the embedded system, setup |
1901 | // a layout with two frames. One left and one right. | 1911 | // a layout with two frames. One left and one right. |
1902 | 1912 | ||
1903 | QBoxLayout *topLayout; | 1913 | Q3BoxLayout *topLayout; |
1904 | 1914 | ||
1905 | // = new QHBoxLayout( this ); | 1915 | // = new QHBoxLayout( this ); |
1906 | // QBoxLayout *topLayout = (QBoxLayout*)layout(); | 1916 | // QBoxLayout *topLayout = (QBoxLayout*)layout(); |
1907 | 1917 | ||
1908 | // QWidget *mainBox = new QWidget( this ); | 1918 | // QWidget *mainBox = new QWidget( this ); |
1909 | // QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); | 1919 | // QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); |
1910 | 1920 | ||
1911 | #ifdef DESKTOP_VERSION | 1921 | #ifdef DESKTOP_VERSION |
1912 | topLayout = new QHBoxLayout( this ); | 1922 | topLayout = new Q3HBoxLayout( this ); |
1913 | 1923 | ||
1914 | 1924 | ||
1915 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); | 1925 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); |
1916 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 1926 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
1917 | 1927 | ||
1918 | topLayout->addWidget(mMiniSplitter ); | 1928 | topLayout->addWidget(mMiniSplitter ); |
1919 | 1929 | ||
1920 | mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); | 1930 | mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); |
1921 | mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); | 1931 | mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); |
1922 | mViewManager = new ViewManager( this, mExtensionBarSplitter ); | 1932 | mViewManager = new ViewManager( this, mExtensionBarSplitter ); |
1923 | mDetails = new ViewContainer( mMiniSplitter ); | 1933 | mDetails = new ViewContainer( mMiniSplitter ); |
1924 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); | 1934 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); |
1925 | #else | 1935 | #else |
1926 | if ( QApplication::desktop()->width() > 480 ) { | 1936 | if ( QApplication::desktop()->width() > 480 ) { |
1927 | topLayout = new QHBoxLayout( this ); | 1937 | topLayout = new Q3HBoxLayout( this ); |
1928 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); | 1938 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); |
1929 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 1939 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
1930 | } else { | 1940 | } else { |
1931 | 1941 | ||
1932 | topLayout = new QHBoxLayout( this ); | 1942 | topLayout = new Q3HBoxLayout( this ); |
1933 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); | 1943 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); |
1934 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); | 1944 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); |
1935 | } | 1945 | } |
1936 | 1946 | ||
1937 | topLayout->addWidget(mMiniSplitter ); | 1947 | topLayout->addWidget(mMiniSplitter ); |
1938 | mViewManager = new ViewManager( this, mMiniSplitter ); | 1948 | mViewManager = new ViewManager( this, mMiniSplitter ); |
1939 | mDetails = new ViewContainer( mMiniSplitter ); | 1949 | mDetails = new ViewContainer( mMiniSplitter ); |
1940 | 1950 | ||
1941 | 1951 | ||
1942 | mExtensionManager = new ExtensionManager( this, mMiniSplitter ); | 1952 | mExtensionManager = new ExtensionManager( this, mMiniSplitter ); |
1943 | #endif | 1953 | #endif |
1944 | //eh->hide(); | 1954 | //eh->hide(); |
1945 | // topLayout->addWidget(mExtensionManager ); | 1955 | // topLayout->addWidget(mExtensionManager ); |
1946 | 1956 | ||
1947 | 1957 | ||
1948 | /*US | 1958 | /*US |
1949 | #ifndef KAB_NOSPLITTER | 1959 | #ifndef KAB_NOSPLITTER |
1950 | QHBoxLayout *topLayout = new QHBoxLayout( this ); | 1960 | QHBoxLayout *topLayout = new QHBoxLayout( this ); |
1951 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); | 1961 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); |
1952 | topLayout->setSpacing( 10 ); | 1962 | topLayout->setSpacing( 10 ); |
1953 | 1963 | ||
1954 | mDetailsSplitter = new QSplitter( this ); | 1964 | mDetailsSplitter = new QSplitter( this ); |
1955 | 1965 | ||
1956 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); | 1966 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); |
1957 | 1967 | ||
1958 | mViewManager = new ViewManager( this, viewSpace ); | 1968 | mViewManager = new ViewManager( this, viewSpace ); |
1959 | viewSpace->setStretchFactor( mViewManager, 1 ); | 1969 | viewSpace->setStretchFactor( mViewManager, 1 ); |
1960 | 1970 | ||
1961 | mDetails = new ViewContainer( mDetailsSplitter ); | 1971 | mDetails = new ViewContainer( mDetailsSplitter ); |
1962 | 1972 | ||
1963 | topLayout->addWidget( mDetailsSplitter ); | 1973 | topLayout->addWidget( mDetailsSplitter ); |
1964 | topLayout->setStretchFactor( mDetailsSplitter, 100 ); | 1974 | topLayout->setStretchFactor( mDetailsSplitter, 100 ); |
1965 | #else //KAB_NOSPLITTER | 1975 | #else //KAB_NOSPLITTER |
1966 | QHBoxLayout *topLayout = new QHBoxLayout( this ); | 1976 | QHBoxLayout *topLayout = new QHBoxLayout( this ); |
1967 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); | 1977 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); |
1968 | topLayout->setSpacing( 10 ); | 1978 | topLayout->setSpacing( 10 ); |
1969 | 1979 | ||
1970 | // mDetailsSplitter = new QSplitter( this ); | 1980 | // mDetailsSplitter = new QSplitter( this ); |
1971 | 1981 | ||
1972 | QVBox *viewSpace = new QVBox( this ); | 1982 | QVBox *viewSpace = new QVBox( this ); |
1973 | 1983 | ||
1974 | mViewManager = new ViewManager( this, viewSpace ); | 1984 | mViewManager = new ViewManager( this, viewSpace ); |
1975 | viewSpace->setStretchFactor( mViewManager, 1 ); | 1985 | viewSpace->setStretchFactor( mViewManager, 1 ); |
1976 | 1986 | ||
1977 | mDetails = new ViewContainer( this ); | 1987 | mDetails = new ViewContainer( this ); |
1978 | 1988 | ||
1979 | topLayout->addWidget( viewSpace ); | 1989 | topLayout->addWidget( viewSpace ); |
1980 | // topLayout->setStretchFactor( mDetailsSplitter, 100 ); | 1990 | // topLayout->setStretchFactor( mDetailsSplitter, 100 ); |
1981 | topLayout->addWidget( mDetails ); | 1991 | topLayout->addWidget( mDetails ); |
1982 | #endif //KAB_NOSPLITTER | 1992 | #endif //KAB_NOSPLITTER |
1983 | */ | 1993 | */ |
1984 | 1994 | ||
1985 | syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); | 1995 | syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); |
1986 | syncManager->setBlockSave(false); | 1996 | syncManager->setBlockSave(false); |
1987 | 1997 | ||
1988 | connect(syncManager , SIGNAL( request_file(const QString &) ), this, SLOT( syncFileRequest(const QString &) ) ); | 1998 | connect(syncManager , SIGNAL( request_file(const QString &) ), this, SLOT( syncFileRequest(const QString &) ) ); |
1989 | connect(syncManager , SIGNAL( getFile( bool ,const QString &)), this, SLOT(getFile( bool ,const QString &) ) ); | 1999 | connect(syncManager , SIGNAL( getFile( bool ,const QString &)), this, SLOT(getFile( bool ,const QString &) ) ); |
1990 | QString sync_file = sentSyncFile(); | 2000 | QString sync_file = sentSyncFile(); |
1991 | //qDebug("KABCore::initGUI()::setting tmp sync file to:%s ",sync_file.latin1()); | 2001 | //qDebug("KABCore::initGUI()::setting tmp sync file to:%s ",sync_file.latin1()); |
1992 | syncManager->setDefaultFileName( sync_file ); | 2002 | syncManager->setDefaultFileName( sync_file ); |
1993 | //connect(syncManager , SIGNAL( ), this, SLOT( ) ); | 2003 | //connect(syncManager , SIGNAL( ), this, SLOT( ) ); |
1994 | 2004 | ||
1995 | #endif //KAB_EMBEDDED | 2005 | #endif //KAB_EMBEDDED |
1996 | initActions(); | 2006 | initActions(); |
1997 | 2007 | ||
1998 | #ifdef KAB_EMBEDDED | 2008 | #ifdef KAB_EMBEDDED |
1999 | addActionsManually(); | 2009 | addActionsManually(); |
2000 | //US make sure the export and import menues are initialized before creating the xxPortManager. | 2010 | //US make sure the export and import menues are initialized before creating the xxPortManager. |
2001 | mXXPortManager = new XXPortManager( this, this ); | 2011 | mXXPortManager = new XXPortManager( this, this ); |
2002 | 2012 | ||
2003 | // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); | 2013 | // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); |
2004 | //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); | 2014 | //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); |
2005 | // mActionQuit->plug ( mMainWindow->toolBar()); | 2015 | // mActionQuit->plug ( mMainWindow->toolBar()); |
2006 | //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); | 2016 | //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); |
2007 | //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); | 2017 | //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); |
2008 | // mIncSearchWidget->hide(); | 2018 | // mIncSearchWidget->hide(); |
2009 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 2019 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
2010 | SLOT( incrementalSearch( const QString& ) ) ); | 2020 | SLOT( incrementalSearch( const QString& ) ) ); |
2011 | connect( mIncSearchWidget, SIGNAL( scrollUP() ),mViewManager, SLOT( scrollUP() ) ); | 2021 | connect( mIncSearchWidget, SIGNAL( scrollUP() ),mViewManager, SLOT( scrollUP() ) ); |
2012 | connect( mIncSearchWidget, SIGNAL( scrollDOWN() ),mViewManager, SLOT( scrollDOWN() ) ); | 2022 | connect( mIncSearchWidget, SIGNAL( scrollDOWN() ),mViewManager, SLOT( scrollDOWN() ) ); |
2013 | 2023 | ||
2014 | mJumpButtonBar = new JumpButtonBar( this, this ); | 2024 | mJumpButtonBar = new JumpButtonBar( this, this ); |
2015 | 2025 | ||
2016 | topLayout->addWidget( mJumpButtonBar ); | 2026 | topLayout->addWidget( mJumpButtonBar ); |
2017 | //US topLayout->setStretchFactor( mJumpButtonBar, 10 ); | 2027 | //US topLayout->setStretchFactor( mJumpButtonBar, 10 ); |
2018 | 2028 | ||
2019 | // mMainWindow->getIconToolBar()->raise(); | 2029 | // mMainWindow->getIconToolBar()->raise(); |
2020 | 2030 | ||
2021 | #endif //KAB_EMBEDDED | 2031 | #endif //KAB_EMBEDDED |
2022 | 2032 | ||
2023 | } | 2033 | } |
2024 | void KABCore::initActions() | 2034 | void KABCore::initActions() |
2025 | { | 2035 | { |
2026 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); | 2036 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); |
2027 | 2037 | ||
2028 | #ifndef KAB_EMBEDDED | 2038 | #ifndef KAB_EMBEDDED |
2029 | connect( QApplication::clipboard(), SIGNAL( dataChanged() ), | 2039 | connect( QApplication::clipboard(), SIGNAL( dataChanged() ), |
2030 | SLOT( clipboardDataChanged() ) ); | 2040 | SLOT( clipboardDataChanged() ) ); |
2031 | #endif //KAB_EMBEDDED | 2041 | #endif //KAB_EMBEDDED |
2032 | 2042 | ||
2033 | // file menu | 2043 | // file menu |
2034 | 2044 | ||
2035 | mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); | 2045 | mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); |
2036 | //mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); | 2046 | //mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); |
2037 | mActionPrint = new KAction( i18n( "&Print View" ), "fileprint", CTRL + Key_P, mViewManager, | 2047 | mActionPrint = new KAction( i18n( "&Print View" ), "fileprint", Qt::CTRL + Qt::Key_P, mViewManager, |
2038 | SLOT( printView() ), actionCollection(), "kaddressbook_print" ); | 2048 | SLOT( printView() ), actionCollection(), "kaddressbook_print" ); |
2039 | 2049 | ||
2040 | 2050 | ||
2041 | mActionPrintDetails = new KAction( i18n( "&Print Details" ), "fileprint", 0, mDetails, | 2051 | mActionPrintDetails = new KAction( i18n( "&Print Details" ), "fileprint", 0, mDetails, |
2042 | SLOT( printView() ), actionCollection(), "kaddressbook_print2" ); | 2052 | SLOT( printView() ), actionCollection(), "kaddressbook_print2" ); |
2043 | 2053 | ||
2044 | mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, | 2054 | mActionSave = new KAction( i18n( "&Save" ), "filesave", Qt::CTRL+Qt::Key_S, this, |
2045 | SLOT( save() ), actionCollection(), "file_sync" ); | 2055 | SLOT( save() ), actionCollection(), "file_sync" ); |
2046 | 2056 | ||
2047 | mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, | 2057 | mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", Qt::CTRL+Qt::Key_N, this, |
2048 | SLOT( newContact() ), actionCollection(), "file_new_contact" ); | 2058 | SLOT( newContact() ), actionCollection(), "file_new_contact" ); |
2049 | 2059 | ||
2050 | mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, | 2060 | mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, |
2051 | this, SLOT( mailVCard() ), | 2061 | this, SLOT( mailVCard() ), |
2052 | actionCollection(), "file_mail_vcard"); | 2062 | actionCollection(), "file_mail_vcard"); |
2053 | 2063 | ||
2054 | mActionExport2phone = new KAction( i18n( "Export to phone" ), "ex2phone", 0, this, | 2064 | mActionExport2phone = new KAction( i18n( "Export to phone" ), "ex2phone", 0, this, |
2055 | SLOT( export2phone() ), actionCollection(), | 2065 | SLOT( export2phone() ), actionCollection(), |
2056 | "kaddressbook_ex2phone" ); | 2066 | "kaddressbook_ex2phone" ); |
2057 | 2067 | ||
2058 | mActionBeamVCard = 0; | 2068 | mActionBeamVCard = 0; |
2059 | mActionBeam = 0; | 2069 | mActionBeam = 0; |
2060 | 2070 | ||
2061 | #ifndef DESKTOP_VERSION | 2071 | #ifndef DESKTOP_VERSION |
2062 | if ( Ir::supported() ) { | 2072 | if ( Ir::supported() ) { |
2063 | mActionBeamVCard = new KAction( i18n( "Beam v&Card(s)..." ), "beam", 0, this, | 2073 | mActionBeamVCard = new KAction( i18n( "Beam v&Card(s)..." ), "beam", 0, this, |
2064 | SLOT( beamVCard() ), actionCollection(), | 2074 | SLOT( beamVCard() ), actionCollection(), |
2065 | "kaddressbook_beam_vcard" ); | 2075 | "kaddressbook_beam_vcard" ); |
2066 | 2076 | ||
2067 | mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, | 2077 | mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, |
2068 | SLOT( beamMySelf() ), actionCollection(), | 2078 | SLOT( beamMySelf() ), actionCollection(), |
2069 | "kaddressbook_beam_myself" ); | 2079 | "kaddressbook_beam_myself" ); |
2070 | } | 2080 | } |
2071 | #endif | 2081 | #endif |
2072 | 2082 | ||
2073 | mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, | 2083 | mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, |
2074 | this, SLOT( editContact2() ), | 2084 | this, SLOT( editContact2() ), |
2075 | actionCollection(), "file_properties" ); | 2085 | actionCollection(), "file_properties" ); |
2076 | 2086 | ||
2077 | #ifdef KAB_EMBEDDED | 2087 | #ifdef KAB_EMBEDDED |
2078 | // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); | 2088 | // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); |
2079 | mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, | 2089 | mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, |
2080 | mMainWindow, SLOT( exit() ), | 2090 | mMainWindow, SLOT( exit() ), |
2081 | actionCollection(), "quit" ); | 2091 | actionCollection(), "quit" ); |
2082 | #endif //KAB_EMBEDDED | 2092 | #endif //KAB_EMBEDDED |
2083 | 2093 | ||
2084 | // edit menu | 2094 | // edit menu |
2085 | if ( mIsPart ) { | 2095 | if ( mIsPart ) { |
2086 | mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, | 2096 | mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", Qt::CTRL + Qt::Key_C, this, |
2087 | SLOT( copyContacts() ), actionCollection(), | 2097 | SLOT( copyContacts() ), actionCollection(), |
2088 | "kaddressbook_copy" ); | 2098 | "kaddressbook_copy" ); |
2089 | mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, | 2099 | mActionCut = new KAction( i18n( "Cu&t" ), "editcut", Qt::CTRL + Qt::Key_X, this, |
2090 | SLOT( cutContacts() ), actionCollection(), | 2100 | SLOT( cutContacts() ), actionCollection(), |
2091 | "kaddressbook_cut" ); | 2101 | "kaddressbook_cut" ); |
2092 | mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, | 2102 | mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", Qt::CTRL + Qt::Key_V, this, |
2093 | SLOT( pasteContacts() ), actionCollection(), | 2103 | SLOT( pasteContacts() ), actionCollection(), |
2094 | "kaddressbook_paste" ); | 2104 | "kaddressbook_paste" ); |
2095 | mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, | 2105 | mActionSelectAll = new KAction( i18n( "Select &All" ), Qt::CTRL + Qt::Key_A, this, |
2096 | SLOT( selectAllContacts() ), actionCollection(), | 2106 | SLOT( selectAllContacts() ), actionCollection(), |
2097 | "kaddressbook_select_all" ); | 2107 | "kaddressbook_select_all" ); |
2098 | mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, | 2108 | mActionUndo = new KAction( i18n( "&Undo" ), "undo", Qt::CTRL + Qt::Key_Z, this, |
2099 | SLOT( undo() ), actionCollection(), | 2109 | SLOT( undo() ), actionCollection(), |
2100 | "kaddressbook_undo" ); | 2110 | "kaddressbook_undo" ); |
2101 | mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, | 2111 | mActionRedo = new KAction( i18n( "Re&do" ), "redo", Qt::CTRL + Qt::SHIFT + Qt::Key_Z, |
2102 | this, SLOT( redo() ), actionCollection(), | 2112 | this, SLOT( redo() ), actionCollection(), |
2103 | "kaddressbook_redo" ); | 2113 | "kaddressbook_redo" ); |
2104 | } else { | 2114 | } else { |
2105 | mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); | 2115 | mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); |
2106 | mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); | 2116 | mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); |
2107 | mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); | 2117 | mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); |
2108 | mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); | 2118 | mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); |
2109 | mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); | 2119 | mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); |
2110 | mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); | 2120 | mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); |
2111 | } | 2121 | } |
2112 | 2122 | ||
2113 | mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", | 2123 | mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", |
2114 | Key_Delete, this, SLOT( deleteContacts() ), | 2124 | Qt::Key_Delete, this, SLOT( deleteContacts() ), |
2115 | actionCollection(), "edit_delete" ); | 2125 | actionCollection(), "edit_delete" ); |
2116 | 2126 | ||
2117 | mActionUndo->setEnabled( false ); | 2127 | mActionUndo->setEnabled( false ); |
2118 | mActionRedo->setEnabled( false ); | 2128 | mActionRedo->setEnabled( false ); |
2119 | 2129 | ||
2120 | // settings menu | 2130 | // settings menu |
2121 | #ifdef KAB_EMBEDDED | 2131 | #ifdef KAB_EMBEDDED |
2122 | //US special menuentry to configure the addressbook resources. On KDE | 2132 | //US special menuentry to configure the addressbook resources. On KDE |
2123 | // you do that through the control center !!! | 2133 | // you do that through the control center !!! |
2124 | mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, | 2134 | mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, |
2125 | SLOT( configureResources() ), actionCollection(), | 2135 | SLOT( configureResources() ), actionCollection(), |
2126 | "kaddressbook_configure_resources" ); | 2136 | "kaddressbook_configure_resources" ); |
2127 | #endif //KAB_EMBEDDED | 2137 | #endif //KAB_EMBEDDED |
2128 | 2138 | ||
2129 | if ( mIsPart ) { | 2139 | if ( mIsPart ) { |
2130 | mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, | 2140 | mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, |
2131 | SLOT( openConfigDialog() ), actionCollection(), | 2141 | SLOT( openConfigDialog() ), actionCollection(), |
2132 | "kaddressbook_configure" ); | 2142 | "kaddressbook_configure" ); |
2133 | 2143 | ||
2134 | //US not implemented yet | 2144 | //US not implemented yet |
2135 | //mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, | 2145 | //mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, |
2136 | // this, SLOT( configureKeyBindings() ), actionCollection(), | 2146 | // this, SLOT( configureKeyBindings() ), actionCollection(), |
2137 | // "kaddressbook_configure_shortcuts" ); | 2147 | // "kaddressbook_configure_shortcuts" ); |
2138 | #ifdef KAB_EMBEDDED | 2148 | #ifdef KAB_EMBEDDED |
2139 | mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); | 2149 | mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); |
2140 | mActionConfigureToolbars->setEnabled( false ); | 2150 | mActionConfigureToolbars->setEnabled( false ); |
2141 | #endif //KAB_EMBEDDED | 2151 | #endif //KAB_EMBEDDED |
2142 | 2152 | ||
2143 | } else { | 2153 | } else { |
2144 | mActionConfigKAddressbook = new KAction( i18n( "&Configure KA/Pi..." ), "configure", 0, this, | 2154 | mActionConfigKAddressbook = new KAction( i18n( "&Configure KA/Pi..." ), "configure", 0, this, |
2145 | SLOT( openConfigDialog() ), actionCollection(), | 2155 | SLOT( openConfigDialog() ), actionCollection(), |
2146 | "kaddressbook_configure" ); | 2156 | "kaddressbook_configure" ); |
2147 | mActionConfigGlobal = new KAction( i18n( "Global Settings..." ), "configure", 0, this, | 2157 | mActionConfigGlobal = new KAction( i18n( "Global Settings..." ), "configure", 0, this, |
2148 | SLOT( openConfigGlobalDialog() ), actionCollection(), | 2158 | SLOT( openConfigGlobalDialog() ), actionCollection(), |
2149 | "kaddressbook_configure" ); | 2159 | "kaddressbook_configure" ); |
2150 | } | 2160 | } |
2151 | mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, | 2161 | mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, |
2152 | actionCollection(), "options_show_jump_bar" ); | 2162 | actionCollection(), "options_show_jump_bar" ); |
2153 | connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBar( bool ) ) ); | 2163 | connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBar( bool ) ) ); |
2154 | 2164 | ||
2155 | mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0, | 2165 | mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0, |
2156 | actionCollection(), "options_show_details" ); | 2166 | actionCollection(), "options_show_details" ); |
2157 | connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); | 2167 | connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); |
2158 | 2168 | ||
2159 | 2169 | ||
2160 | mActionBR = new KToggleAction( i18n( "Beam receive enabled" ), "beam", 0, this, | 2170 | mActionBR = new KToggleAction( i18n( "Beam receive enabled" ), "beam", 0, this, |
2161 | SLOT( toggleBeamReceive() ), actionCollection(), | 2171 | SLOT( toggleBeamReceive() ), actionCollection(), |
2162 | "kaddressbook_beam_rec" ); | 2172 | "kaddressbook_beam_rec" ); |
2163 | 2173 | ||
2164 | 2174 | ||
2165 | // misc | 2175 | // misc |
2166 | // only enable LDAP lookup if we can handle the protocol | 2176 | // only enable LDAP lookup if we can handle the protocol |
2167 | #ifndef KAB_EMBEDDED | 2177 | #ifndef KAB_EMBEDDED |
2168 | if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { | 2178 | if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { |
2169 | new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, | 2179 | new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, |
2170 | this, SLOT( openLDAPDialog() ), actionCollection(), | 2180 | this, SLOT( openLDAPDialog() ), actionCollection(), |
2171 | "ldap_lookup" ); | 2181 | "ldap_lookup" ); |
2172 | } | 2182 | } |
2173 | #else //KAB_EMBEDDED | 2183 | #else //KAB_EMBEDDED |
2174 | //qDebug("KABCore::initActions() LDAP has to be implemented"); | 2184 | //qDebug("KABCore::initActions() LDAP has to be implemented"); |
2175 | #endif //KAB_EMBEDDED | 2185 | #endif //KAB_EMBEDDED |
2176 | 2186 | ||
2177 | 2187 | ||
2178 | mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, | 2188 | mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, |
2179 | SLOT( setWhoAmI() ), actionCollection(), | 2189 | SLOT( setWhoAmI() ), actionCollection(), |
2180 | "set_personal" ); | 2190 | "set_personal" ); |
2181 | 2191 | ||
2182 | 2192 | ||
2183 | mActionCategories = new KAction( i18n( "Set Categories for Contacts..." ), 0, this, | 2193 | mActionCategories = new KAction( i18n( "Set Categories for Contacts..." ), 0, this, |
2184 | SLOT( setCategories() ), actionCollection(), | 2194 | SLOT( setCategories() ), actionCollection(), |
2185 | "edit_set_categories" ); | 2195 | "edit_set_categories" ); |
2186 | mActionEditCategories = new KAction( i18n( "Edit Category List..." ), 0, this, | 2196 | mActionEditCategories = new KAction( i18n( "Edit Category List..." ), 0, this, |
2187 | SLOT( editCategories() ), actionCollection(), | 2197 | SLOT( editCategories() ), actionCollection(), |
2188 | "edit__categories" ); | 2198 | "edit__categories" ); |
2189 | 2199 | ||
2190 | mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, | 2200 | mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, |
2191 | SLOT( removeVoice() ), actionCollection(), | 2201 | SLOT( removeVoice() ), actionCollection(), |
2192 | "remove_voice" ); | 2202 | "remove_voice" ); |
2193 | mActionSetFormattedName = new KAction( i18n( "Set formatted name..." ), 0, this, | 2203 | mActionSetFormattedName = new KAction( i18n( "Set formatted name..." ), 0, this, |
2194 | SLOT( setFormattedName() ), actionCollection(), | 2204 | SLOT( setFormattedName() ), actionCollection(), |
2195 | "set_formatted" ); | 2205 | "set_formatted" ); |
2196 | 2206 | ||
2197 | mActionManageCategories= new KAction( i18n( "Manage new categories..." ), 0, this, | 2207 | mActionManageCategories= new KAction( i18n( "Manage new categories..." ), 0, this, |
2198 | SLOT( manageCategories() ), actionCollection(), | 2208 | SLOT( manageCategories() ), actionCollection(), |
2199 | "remove_voice" ); | 2209 | "remove_voice" ); |
2200 | 2210 | ||
2201 | 2211 | ||
2202 | mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this, | 2212 | mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this, |
2203 | SLOT( importFromOL() ), actionCollection(), | 2213 | SLOT( importFromOL() ), actionCollection(), |
2204 | "import_OL" ); | 2214 | "import_OL" ); |
2205 | #ifdef KAB_EMBEDDED | 2215 | #ifdef KAB_EMBEDDED |
2206 | mActionLicence = new KAction( i18n( "Licence" ), 0, | 2216 | mActionLicence = new KAction( i18n( "Licence" ), 0, |
2207 | this, SLOT( showLicence() ), actionCollection(), | 2217 | this, SLOT( showLicence() ), actionCollection(), |
2208 | "licence_about_data" ); | 2218 | "licence_about_data" ); |
2209 | mActionFaq = new KAction( i18n( "Faq" ), 0, | 2219 | mActionFaq = new KAction( i18n( "Faq" ), 0, |
2210 | this, SLOT( faq() ), actionCollection(), | 2220 | this, SLOT( faq() ), actionCollection(), |
2211 | "faq_about_data" ); | 2221 | "faq_about_data" ); |
2212 | mActionWN = new KAction( i18n( "What's New?" ), 0, | 2222 | mActionWN = new KAction( i18n( "What's New?" ), 0, |
2213 | this, SLOT( whatsnew() ), actionCollection(), | 2223 | this, SLOT( whatsnew() ), actionCollection(), |
2214 | "wn" ); | 2224 | "wn" ); |
2215 | 2225 | ||
2216 | 2226 | ||
2217 | 2227 | ||
2218 | mActionStorageHowto = new KAction( i18n( "Storage HowTo" ), 0, | 2228 | mActionStorageHowto = new KAction( i18n( "Storage HowTo" ), 0, |
2219 | this, SLOT( storagehowto() ), actionCollection(), | 2229 | this, SLOT( storagehowto() ), actionCollection(), |
2220 | "storage" ); | 2230 | "storage" ); |
2221 | 2231 | ||
2222 | mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0, | 2232 | mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0, |
2223 | this, SLOT( synchowto() ), actionCollection(), | 2233 | this, SLOT( synchowto() ), actionCollection(), |
2224 | "sync" ); | 2234 | "sync" ); |
2225 | mActionKdeSyncHowto = new KAction( i18n( "Kde Sync HowTo" ), 0, | 2235 | mActionKdeSyncHowto = new KAction( i18n( "Kde Sync HowTo" ), 0, |
2226 | this, SLOT( kdesynchowto() ), actionCollection(), | 2236 | this, SLOT( kdesynchowto() ), actionCollection(), |
2227 | "kdesync" ); | 2237 | "kdesync" ); |
2228 | mActionMultiSyncHowto = new KAction( i18n( "Multi Sync HowTo" ), 0, | 2238 | mActionMultiSyncHowto = new KAction( i18n( "Multi Sync HowTo" ), 0, |
2229 | this, SLOT( multisynchowto() ), actionCollection(), | 2239 | this, SLOT( multisynchowto() ), actionCollection(), |
2230 | "multisync" ); | 2240 | "multisync" ); |
2231 | 2241 | ||
2232 | mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, | 2242 | mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, |
2233 | this, SLOT( createAboutData() ), actionCollection(), | 2243 | this, SLOT( createAboutData() ), actionCollection(), |
2234 | "kaddressbook_about_data" ); | 2244 | "kaddressbook_about_data" ); |
2235 | #endif //KAB_EMBEDDED | 2245 | #endif //KAB_EMBEDDED |
2236 | 2246 | ||
2237 | clipboardDataChanged(); | 2247 | clipboardDataChanged(); |
2238 | connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); | 2248 | connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); |
2239 | connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); | 2249 | connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); |
2240 | } | 2250 | } |
2241 | 2251 | ||
2242 | //US we need this function, to plug all actions into the correct menues. | 2252 | //US we need this function, to plug all actions into the correct menues. |
2243 | // KDE uses a XML format to plug the actions, but we work her without this overhead. | 2253 | // KDE uses a XML format to plug the actions, but we work her without this overhead. |
2244 | void KABCore::addActionsManually() | 2254 | void KABCore::addActionsManually() |
2245 | { | 2255 | { |
2246 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); | 2256 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); |
2247 | 2257 | ||
2248 | #ifdef KAB_EMBEDDED | 2258 | #ifdef KAB_EMBEDDED |
2249 | QPopupMenu *fileMenu = new QPopupMenu( this ); | 2259 | Q3PopupMenu *fileMenu = new Q3PopupMenu( this ); |
2250 | QPopupMenu *editMenu = new QPopupMenu( this ); | 2260 | Q3PopupMenu *editMenu = new Q3PopupMenu( this ); |
2251 | QPopupMenu *helpMenu = new QPopupMenu( this ); | 2261 | Q3PopupMenu *helpMenu = new Q3PopupMenu( this ); |
2252 | 2262 | ||
2253 | KToolBar* tb = mMainWindow->toolBar(); | 2263 | KToolBar* tb = mMainWindow->toolBar(); |
2254 | mMainWindow->setToolBarsMovable (false ); | 2264 | mMainWindow->setToolBarsMovable (false ); |
2255 | #ifndef DESKTOP_VERSION | 2265 | #ifndef DESKTOP_VERSION |
2256 | if ( KABPrefs::instance()->mFullMenuBarVisible ) { | 2266 | if ( KABPrefs::instance()->mFullMenuBarVisible ) { |
2257 | #endif | 2267 | #endif |
2258 | QMenuBar* mb = mMainWindow->menuBar(); | 2268 | QMenuBar* mb = mMainWindow->menuBar(); |
2259 | 2269 | ||
2260 | //US setup menubar. | 2270 | //US setup menubar. |
2261 | //Disable the following block if you do not want to have a menubar. | 2271 | //Disable the following block if you do not want to have a menubar. |
2262 | mb->insertItem( i18n("&File"), fileMenu ); | 2272 | mb->insertItem( i18n("&File"), fileMenu ); |
2263 | mb->insertItem( i18n("&Edit"), editMenu ); | 2273 | mb->insertItem( i18n("&Edit"), editMenu ); |
2264 | mb->insertItem( i18n("&View"), viewMenu ); | 2274 | mb->insertItem( i18n("&View"), viewMenu ); |
2265 | mb->insertItem( i18n("&Settings"), settingsMenu ); | 2275 | mb->insertItem( i18n("&Settings"), settingsMenu ); |
2266 | #ifdef DESKTOP_VERSION | 2276 | #ifdef DESKTOP_VERSION |
2267 | mb->insertItem( i18n("Synchronize"), syncMenu ); | 2277 | mb->insertItem( i18n("Synchronize"), syncMenu ); |
2268 | #else | 2278 | #else |
2269 | mb->insertItem( i18n("Sync"), syncMenu ); | 2279 | mb->insertItem( i18n("Sync"), syncMenu ); |
2270 | #endif | 2280 | #endif |
2271 | //mb->insertItem( i18n("&Change"), changeMenu ); | 2281 | //mb->insertItem( i18n("&Change"), changeMenu ); |
2272 | mb->insertItem( i18n("&Help"), helpMenu ); | 2282 | mb->insertItem( i18n("&Help"), helpMenu ); |
2273 | mIncSearchWidget = new IncSearchWidget( tb ); | 2283 | mIncSearchWidget = new IncSearchWidget( tb ); |
2274 | // tb->insertWidget(-1, 0, mIncSearchWidget); | 2284 | // tb->insertWidget(-1, 0, mIncSearchWidget); |
2275 | #ifndef DESKTOP_VERSION | 2285 | #ifndef DESKTOP_VERSION |
2276 | } else { | 2286 | } else { |
2277 | //US setup toolbar | 2287 | //US setup toolbar |
2278 | QPEMenuBar *menuBarTB = new QPEMenuBar( tb ); | 2288 | QPEMenuBar *menuBarTB = new QPEMenuBar( tb ); |
2279 | QPopupMenu *popupBarTB = new QPopupMenu( this ); | 2289 | Q3PopupMenu *popupBarTB = new Q3PopupMenu( this ); |
2280 | menuBarTB->insertItem( SmallIcon( "z_menu" ) , popupBarTB); | 2290 | menuBarTB->insertItem( SmallIcon( "z_menu" ) , popupBarTB); |
2281 | tb->insertWidget(-1, 0, menuBarTB); | 2291 | tb->insertWidget(-1, 0, menuBarTB); |
2282 | mIncSearchWidget = new IncSearchWidget( tb ); | 2292 | mIncSearchWidget = new IncSearchWidget( tb ); |
2283 | tb->enableMoving(false); | 2293 | tb->enableMoving(false); |
2284 | popupBarTB->insertItem( i18n("&File"), fileMenu ); | 2294 | popupBarTB->insertItem( i18n("&File"), fileMenu ); |
2285 | popupBarTB->insertItem( i18n("&Edit"), editMenu ); | 2295 | popupBarTB->insertItem( i18n("&Edit"), editMenu ); |
2286 | popupBarTB->insertItem( i18n("&View"), viewMenu ); | 2296 | popupBarTB->insertItem( i18n("&View"), viewMenu ); |
2287 | popupBarTB->insertItem( i18n("&Settings"), settingsMenu ); | 2297 | popupBarTB->insertItem( i18n("&Settings"), settingsMenu ); |
2288 | popupBarTB->insertItem( i18n("Synchronize"), syncMenu ); | 2298 | popupBarTB->insertItem( i18n("Synchronize"), syncMenu ); |
2289 | mViewManager->getFilterAction()->plug ( popupBarTB); | 2299 | mViewManager->getFilterAction()->plug ( popupBarTB); |
2290 | //popupBarTB->insertItem( i18n("&Change selected"), changeMenu ); | 2300 | //popupBarTB->insertItem( i18n("&Change selected"), changeMenu ); |
2291 | popupBarTB->insertItem( i18n("&Help"), helpMenu ); | 2301 | popupBarTB->insertItem( i18n("&Help"), helpMenu ); |
2292 | if (QApplication::desktop()->width() > 320 ) { | 2302 | if (QApplication::desktop()->width() > 320 ) { |
2293 | // mViewManager->getFilterAction()->plug ( tb); | 2303 | // mViewManager->getFilterAction()->plug ( tb); |
2294 | } | 2304 | } |
2295 | } | 2305 | } |
2296 | #endif | 2306 | #endif |
2297 | mIncSearchWidget->setSize(); | 2307 | mIncSearchWidget->setSize(); |
2298 | // mActionQuit->plug ( mMainWindow->toolBar()); | 2308 | // mActionQuit->plug ( mMainWindow->toolBar()); |
2299 | 2309 | ||
2300 | 2310 | ||
2301 | 2311 | ||
2302 | //US Now connect the actions with the menue entries. | 2312 | //US Now connect the actions with the menue entries. |
2303 | #ifdef DESKTOP_VERSION | 2313 | #ifdef DESKTOP_VERSION |
2304 | mActionPrint->plug( fileMenu ); | 2314 | mActionPrint->plug( fileMenu ); |
2305 | mActionPrintDetails->plug( fileMenu ); | 2315 | mActionPrintDetails->plug( fileMenu ); |
2306 | fileMenu->insertSeparator(); | 2316 | fileMenu->insertSeparator(); |
2307 | #endif | 2317 | #endif |
2308 | mActionMail->plug( fileMenu ); | 2318 | mActionMail->plug( fileMenu ); |
2309 | fileMenu->insertSeparator(); | 2319 | fileMenu->insertSeparator(); |
2310 | 2320 | ||
2311 | mActionNewContact->plug( editMenu ); | 2321 | mActionNewContact->plug( editMenu ); |
2312 | mActionNewContact->plug( tb ); | 2322 | mActionNewContact->plug( tb ); |
2313 | 2323 | ||
2314 | mActionEditAddressee->plug( editMenu ); | 2324 | mActionEditAddressee->plug( editMenu ); |
2315 | editMenu->insertSeparator(); | 2325 | editMenu->insertSeparator(); |
2316 | // if ((KGlobal::getDesktopSize() > KGlobal::Small ) || | 2326 | // if ((KGlobal::getDesktopSize() > KGlobal::Small ) || |
2317 | // (!KABPrefs::instance()->mMultipleViewsAtOnce )) | 2327 | // (!KABPrefs::instance()->mMultipleViewsAtOnce )) |
2318 | mActionEditAddressee->plug( tb ); | 2328 | mActionEditAddressee->plug( tb ); |
2319 | 2329 | ||
2320 | // fileMenu->insertSeparator(); | 2330 | // fileMenu->insertSeparator(); |
2321 | mActionSave->plug( fileMenu ); | 2331 | mActionSave->plug( fileMenu ); |
2322 | fileMenu->insertItem( "&Import", ImportMenu ); | 2332 | fileMenu->insertItem( "&Import", ImportMenu ); |
2323 | fileMenu->insertItem( "&Export", ExportMenu ); | 2333 | fileMenu->insertItem( "&Export", ExportMenu ); |
2324 | editMenu->insertItem( i18n("&Change"), changeMenu ); | 2334 | editMenu->insertItem( i18n("&Change"), changeMenu ); |
2325 | editMenu->insertSeparator(); | 2335 | editMenu->insertSeparator(); |
2326 | #ifndef DESKTOP_VERSION | 2336 | #ifndef DESKTOP_VERSION |
2327 | if ( Ir::supported() ) fileMenu->insertItem( i18n("&Beam"), beamMenu ); | 2337 | if ( Ir::supported() ) fileMenu->insertItem( i18n("&Beam"), beamMenu ); |
2328 | #endif | 2338 | #endif |
2329 | #if 0 | 2339 | #if 0 |
2330 | // PENDING fix MailVCard | 2340 | // PENDING fix MailVCard |
2331 | fileMenu->insertSeparator(); | 2341 | fileMenu->insertSeparator(); |
2332 | mActionMailVCard->plug( fileMenu ); | 2342 | mActionMailVCard->plug( fileMenu ); |
2333 | #endif | 2343 | #endif |
2334 | #ifndef DESKTOP_VERSION | 2344 | #ifndef DESKTOP_VERSION |
2335 | if ( Ir::supported() ) mActionBR->plug( beamMenu ); | 2345 | if ( Ir::supported() ) mActionBR->plug( beamMenu ); |
2336 | if ( Ir::supported() ) mActionBeamVCard->plug( beamMenu ); | 2346 | if ( Ir::supported() ) mActionBeamVCard->plug( beamMenu ); |
2337 | if ( Ir::supported() ) mActionBeam->plug( beamMenu ); | 2347 | if ( Ir::supported() ) mActionBeam->plug( beamMenu ); |
2338 | #endif | 2348 | #endif |
2339 | fileMenu->insertSeparator(); | 2349 | fileMenu->insertSeparator(); |
2340 | mActionQuit->plug( fileMenu ); | 2350 | mActionQuit->plug( fileMenu ); |
2341 | #ifdef _OL_IMPORT_ | 2351 | #ifdef _OL_IMPORT_ |
2342 | mActionImportOL->plug( ImportMenu ); | 2352 | mActionImportOL->plug( ImportMenu ); |
2343 | #endif | 2353 | #endif |
2344 | // edit menu | 2354 | // edit menu |
2345 | mActionUndo->plug( editMenu ); | 2355 | mActionUndo->plug( editMenu ); |
2346 | mActionRedo->plug( editMenu ); | 2356 | mActionRedo->plug( editMenu ); |
2347 | editMenu->insertSeparator(); | 2357 | editMenu->insertSeparator(); |
2348 | mActionCut->plug( editMenu ); | 2358 | mActionCut->plug( editMenu ); |
2349 | mActionCopy->plug( editMenu ); | 2359 | mActionCopy->plug( editMenu ); |
2350 | mActionPaste->plug( editMenu ); | 2360 | mActionPaste->plug( editMenu ); |
2351 | mActionDelete->plug( editMenu ); | 2361 | mActionDelete->plug( editMenu ); |
2352 | editMenu->insertSeparator(); | 2362 | editMenu->insertSeparator(); |
2353 | mActionSelectAll->plug( editMenu ); | 2363 | mActionSelectAll->plug( editMenu ); |
2354 | 2364 | ||
2355 | mActionSetFormattedName->plug( changeMenu ); | 2365 | mActionSetFormattedName->plug( changeMenu ); |
2356 | mActionRemoveVoice->plug( changeMenu ); | 2366 | mActionRemoveVoice->plug( changeMenu ); |
2357 | // settingsmings menu | 2367 | // settingsmings menu |
2358 | //US special menuentry to configure the addressbook resources. On KDE | 2368 | //US special menuentry to configure the addressbook resources. On KDE |
2359 | // you do that through the control center !!! | 2369 | // you do that through the control center !!! |
2360 | // settingsMenu->insertSeparator(); | 2370 | // settingsMenu->insertSeparator(); |
2361 | 2371 | ||
2362 | mActionConfigKAddressbook->plug( settingsMenu, 0 ); | 2372 | mActionConfigKAddressbook->plug( settingsMenu, 0 ); |
2363 | mActionConfigGlobal->plug( settingsMenu, 1 ); | 2373 | mActionConfigGlobal->plug( settingsMenu, 1 ); |
2364 | mActionConfigResources->plug( settingsMenu,2 ); | 2374 | mActionConfigResources->plug( settingsMenu,2 ); |
2365 | settingsMenu->insertSeparator(3); | 2375 | settingsMenu->insertSeparator(3); |
2366 | 2376 | ||
2367 | if ( mIsPart ) { | 2377 | if ( mIsPart ) { |
2368 | //US not implemented yet | 2378 | //US not implemented yet |
2369 | //mActionConfigShortcuts->plug( settingsMenu ); | 2379 | //mActionConfigShortcuts->plug( settingsMenu ); |
2370 | //mActionConfigureToolbars->plug( settingsMenu ); | 2380 | //mActionConfigureToolbars->plug( settingsMenu ); |
2371 | 2381 | ||
2372 | } else { | 2382 | } else { |
2373 | //US not implemented yet | 2383 | //US not implemented yet |
2374 | //mActionKeyBindings->plug( settingsMenu ); | 2384 | //mActionKeyBindings->plug( settingsMenu ); |
2375 | } | 2385 | } |
2376 | 2386 | ||
2377 | mActionEditCategories->plug( settingsMenu ); | 2387 | mActionEditCategories->plug( settingsMenu ); |
2378 | mActionManageCategories->plug( settingsMenu ); | 2388 | mActionManageCategories->plug( settingsMenu ); |
2379 | mActionJumpBar->plug( viewMenu,0 ); | 2389 | mActionJumpBar->plug( viewMenu,0 ); |
2380 | mActionDetails->plug( viewMenu,0 ); | 2390 | mActionDetails->plug( viewMenu,0 ); |
2381 | //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) | 2391 | //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) |
2382 | mActionDetails->plug( tb ); | 2392 | mActionDetails->plug( tb ); |
2383 | settingsMenu->insertSeparator(); | 2393 | settingsMenu->insertSeparator(); |
2384 | #ifndef DESKTOP_VERSION | 2394 | #ifndef DESKTOP_VERSION |
2385 | if ( Ir::supported() ) mActionBR->plug(settingsMenu ); | 2395 | if ( Ir::supported() ) mActionBR->plug(settingsMenu ); |
2386 | settingsMenu->insertSeparator(); | 2396 | settingsMenu->insertSeparator(); |
2387 | #endif | 2397 | #endif |
2388 | 2398 | ||
2389 | mActionWhoAmI->plug( settingsMenu ); | 2399 | mActionWhoAmI->plug( settingsMenu ); |
2390 | //mActionEditCategories->plug( changeMenu ); | 2400 | //mActionEditCategories->plug( changeMenu ); |
2391 | mActionCategories->plug( changeMenu ); | 2401 | mActionCategories->plug( changeMenu ); |
2392 | //mActionManageCategories->plug( changeMenu ); | 2402 | //mActionManageCategories->plug( changeMenu ); |
2393 | 2403 | ||
2394 | //mActionCategories->plug( settingsMenu ); | 2404 | //mActionCategories->plug( settingsMenu ); |
2395 | 2405 | ||
2396 | 2406 | ||
2397 | mActionWN->plug( helpMenu ); | 2407 | mActionWN->plug( helpMenu ); |
2398 | mActionStorageHowto->plug( helpMenu ); | 2408 | mActionStorageHowto->plug( helpMenu ); |
2399 | mActionSyncHowto->plug( helpMenu ); | 2409 | mActionSyncHowto->plug( helpMenu ); |
2400 | mActionKdeSyncHowto->plug( helpMenu ); | 2410 | mActionKdeSyncHowto->plug( helpMenu ); |
2401 | mActionMultiSyncHowto->plug( helpMenu ); | 2411 | mActionMultiSyncHowto->plug( helpMenu ); |
2402 | mActionFaq->plug( helpMenu ); | 2412 | mActionFaq->plug( helpMenu ); |
2403 | mActionLicence->plug( helpMenu ); | 2413 | mActionLicence->plug( helpMenu ); |
2404 | mActionAboutKAddressbook->plug( helpMenu ); | 2414 | mActionAboutKAddressbook->plug( helpMenu ); |
2405 | 2415 | ||
2406 | if (KGlobal::getDesktopSize() > KGlobal::Small ) { | 2416 | if (KGlobal::getDesktopSize() > KGlobal::Small ) { |
2407 | 2417 | ||
2408 | mActionSave->plug( tb ); | 2418 | mActionSave->plug( tb ); |
2409 | mViewManager->getFilterAction()->plug ( tb); | 2419 | mViewManager->getFilterAction()->plug ( tb); |
2410 | //LR hide filteraction on started in 480x640 | 2420 | //LR hide filteraction on started in 480x640 |
2411 | if (QApplication::desktop()->width() == 480 ) { | 2421 | if (QApplication::desktop()->width() == 480 ) { |
2412 | mViewManager->getFilterAction()->setComboWidth( 0 ); | 2422 | mViewManager->getFilterAction()->setComboWidth( 0 ); |
2413 | } | 2423 | } |
2414 | mActionUndo->plug( tb ); | 2424 | mActionUndo->plug( tb ); |
2415 | mActionDelete->plug( tb ); | 2425 | mActionDelete->plug( tb ); |
2416 | mActionRedo->plug( tb ); | 2426 | mActionRedo->plug( tb ); |
2417 | } else { | 2427 | } else { |
2418 | mActionSave->plug( tb ); | 2428 | mActionSave->plug( tb ); |
2419 | tb->enableMoving(false); | 2429 | tb->enableMoving(false); |
2420 | } | 2430 | } |
2421 | //mActionQuit->plug ( tb ); | 2431 | //mActionQuit->plug ( tb ); |
2422 | //tb->insertWidget(-1, 0, mIncSearchWidget, 6); | 2432 | //tb->insertWidget(-1, 0, mIncSearchWidget, 6); |
2423 | 2433 | ||
2424 | //US link the searchwidget first to this. | 2434 | //US link the searchwidget first to this. |
2425 | // The real linkage to the toolbar happens later. | 2435 | // The real linkage to the toolbar happens later. |
2426 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); | 2436 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); |
2427 | //US tb->insertItem( mIncSearchWidget ); | 2437 | //US tb->insertItem( mIncSearchWidget ); |
2428 | /*US | 2438 | /*US |
2429 | mIncSearchWidget = new IncSearchWidget( tb ); | 2439 | mIncSearchWidget = new IncSearchWidget( tb ); |
2430 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 2440 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
2431 | SLOT( incrementalSearch( const QString& ) ) ); | 2441 | SLOT( incrementalSearch( const QString& ) ) ); |
2432 | 2442 | ||
2433 | mJumpButtonBar = new JumpButtonBar( this, this ); | 2443 | mJumpButtonBar = new JumpButtonBar( this, this ); |
2434 | 2444 | ||
2435 | //US topLayout->addWidget( mJumpButtonBar ); | 2445 | //US topLayout->addWidget( mJumpButtonBar ); |
2436 | this->layout()->add( mJumpButtonBar ); | 2446 | this->layout()->add( mJumpButtonBar ); |
2437 | */ | 2447 | */ |
2438 | 2448 | ||
2439 | #endif //KAB_EMBEDDED | 2449 | #endif //KAB_EMBEDDED |
2440 | 2450 | ||
2441 | mActionExport2phone->plug( ExportMenu ); | 2451 | mActionExport2phone->plug( ExportMenu ); |
2442 | connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); | 2452 | connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); |
2443 | syncManager->fillSyncMenu(); | 2453 | syncManager->fillSyncMenu(); |
2444 | 2454 | ||
2445 | } | 2455 | } |
2446 | void KABCore::showLicence() | 2456 | void KABCore::showLicence() |
2447 | { | 2457 | { |
2448 | KApplication::showLicence(); | 2458 | KApplication::showLicence(); |
2449 | } | 2459 | } |
2450 | 2460 | ||
2451 | void KABCore::manageCategories( ) | 2461 | void KABCore::manageCategories( ) |
2452 | { | 2462 | { |
2453 | KABCatPrefs* cp = new KABCatPrefs(); | 2463 | KABCatPrefs* cp = new KABCatPrefs(); |
2454 | cp->show(); | 2464 | cp->show(); |
2455 | int w =cp->sizeHint().width() ; | 2465 | int w =cp->sizeHint().width() ; |
2456 | int h = cp->sizeHint().height() ; | 2466 | int h = cp->sizeHint().height() ; |
2457 | int dw = QApplication::desktop()->width(); | 2467 | int dw = QApplication::desktop()->width(); |
2458 | int dh = QApplication::desktop()->height(); | 2468 | int dh = QApplication::desktop()->height(); |
2459 | cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 2469 | cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
2460 | if ( !cp->exec() ) { | 2470 | if ( !cp->exec() ) { |
2461 | delete cp; | 2471 | delete cp; |
2462 | return; | 2472 | return; |
2463 | } | 2473 | } |
2464 | int count = 0; | 2474 | int count = 0; |
2465 | int cc = 0; | 2475 | int cc = 0; |
2466 | message( i18n("Please wait, processing categories...")); | 2476 | message( i18n("Please wait, processing categories...")); |
2467 | if ( cp->addCat() ) { | 2477 | if ( cp->addCat() ) { |
2468 | KABC::AddressBook::Iterator it; | 2478 | KABC::AddressBook::Iterator it; |
2469 | QStringList catList = KABPrefs::instance()->mCustomCategories; | 2479 | QStringList catList = KABPrefs::instance()->mCustomCategories; |
2470 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 2480 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
2471 | ++cc; | 2481 | ++cc; |
2472 | if ( cc %10 == 0) | 2482 | if ( cc %10 == 0) |
2473 | message(i18n("Processing contact #%1").arg(cc)); | 2483 | message(i18n("Processing contact #%1").arg(cc)); |
2474 | QStringList catIncList = (*it).categories(); | 2484 | QStringList catIncList = (*it).categories(); |
2475 | int i; | 2485 | int i; |
2476 | for( i = 0; i< catIncList.count(); ++i ) { | 2486 | for( i = 0; i< catIncList.count(); ++i ) { |
2477 | if ( !catList.contains (catIncList[i])) { | 2487 | if ( !catList.contains (catIncList[i])) { |
2478 | catList.append( catIncList[i] ); | 2488 | catList.append( catIncList[i] ); |
2479 | //qDebug("add cat %s ", catIncList[i].latin1()); | 2489 | //qDebug("add cat %s ", catIncList[i].latin1()); |
2480 | ++count; | 2490 | ++count; |
2481 | } | 2491 | } |
2482 | } | 2492 | } |
2483 | } | 2493 | } |
2484 | catList.sort(); | 2494 | catList.sort(); |
2485 | KABPrefs::instance()->mCustomCategories = catList; | 2495 | KABPrefs::instance()->mCustomCategories = catList; |
2486 | KABPrefs::instance()->writeConfig(); | 2496 | KABPrefs::instance()->writeConfig(); |
2487 | message(QString::number( count )+ i18n(" categories added to list! ")); | 2497 | message(QString::number( count )+ i18n(" categories added to list! ")); |
2488 | } else { | 2498 | } else { |
2489 | QStringList catList = KABPrefs::instance()->mCustomCategories; | 2499 | QStringList catList = KABPrefs::instance()->mCustomCategories; |
2490 | QStringList catIncList; | 2500 | QStringList catIncList; |
2491 | QStringList newCatList; | 2501 | QStringList newCatList; |
2492 | KABC::AddressBook::Iterator it; | 2502 | KABC::AddressBook::Iterator it; |
2493 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 2503 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
2494 | ++cc; | 2504 | ++cc; |
2495 | if ( cc %10 == 0) | 2505 | if ( cc %10 == 0) |
2496 | message(i18n("Processing contact #%1").arg(cc)); | 2506 | message(i18n("Processing contact #%1").arg(cc)); |
2497 | QStringList catIncList = (*it).categories(); | 2507 | QStringList catIncList = (*it).categories(); |
2498 | int i; | 2508 | int i; |
2499 | if ( catIncList.count() ) { | 2509 | if ( catIncList.count() ) { |
2500 | newCatList.clear(); | 2510 | newCatList.clear(); |
2501 | for( i = 0; i< catIncList.count(); ++i ) { | 2511 | for( i = 0; i< catIncList.count(); ++i ) { |
2502 | if ( catList.contains (catIncList[i])) { | 2512 | if ( catList.contains (catIncList[i])) { |
2503 | newCatList.append( catIncList[i] ); | 2513 | newCatList.append( catIncList[i] ); |
2504 | } | 2514 | } |
2505 | } | 2515 | } |
2506 | newCatList.sort(); | 2516 | newCatList.sort(); |
2507 | (*it).setCategories( newCatList ); | 2517 | (*it).setCategories( newCatList ); |
2508 | mAddressBook->insertAddressee( (*it) ); | 2518 | mAddressBook->insertAddressee( (*it) ); |
2509 | } | 2519 | } |
2510 | } | 2520 | } |
2511 | setModified( true ); | 2521 | setModified( true ); |
2512 | mViewManager->refreshView(); | 2522 | mViewManager->refreshView(); |
2513 | message( i18n("Removing categories done!")); | 2523 | message( i18n("Removing categories done!")); |
2514 | } | 2524 | } |
2515 | delete cp; | 2525 | delete cp; |
2516 | } | 2526 | } |
2517 | void KABCore::removeVoice() | 2527 | void KABCore::removeVoice() |
2518 | { | 2528 | { |
2519 | 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 ) | 2529 | 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 ) |
2520 | return; | 2530 | return; |
2521 | XXPortSelectDialog dlg( this, false, this ); | 2531 | XXPortSelectDialog dlg( this, false, this ); |
2522 | if ( !dlg.exec() ) | 2532 | if ( !dlg.exec() ) |
2523 | return; | 2533 | return; |
2524 | mAddressBook->setUntagged(); | 2534 | mAddressBook->setUntagged(); |
2525 | dlg.tagSelected(); | 2535 | dlg.tagSelected(); |
2526 | message(i18n("Removing voice..."), false ); | 2536 | message(i18n("Removing voice..."), false ); |
2527 | KABC::AddressBook::Iterator it; | 2537 | KABC::AddressBook::Iterator it; |
2528 | for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 2538 | for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
2529 | if ( (*it).tagged() ) { | 2539 | if ( (*it).tagged() ) { |
2530 | (*it).removeVoice(); | 2540 | (*it).removeVoice(); |
2531 | } | 2541 | } |
2532 | } | 2542 | } |
2533 | message(i18n("Refreshing view...") ); | 2543 | message(i18n("Refreshing view...") ); |
2534 | mViewManager->refreshView( "" ); | 2544 | mViewManager->refreshView( "" ); |
2535 | Addressee add; | 2545 | Addressee add; |
2536 | mDetails->setAddressee( add ); | 2546 | mDetails->setAddressee( add ); |
2537 | message(i18n("Remove voice completed!") ); | 2547 | message(i18n("Remove voice completed!") ); |
2538 | 2548 | ||
2539 | 2549 | ||
2540 | 2550 | ||
2541 | } | 2551 | } |
2542 | 2552 | ||
2543 | void KABCore::setFormattedName() | 2553 | void KABCore::setFormattedName() |
2544 | { | 2554 | { |
2545 | KABFormatPrefs setpref; | 2555 | KABFormatPrefs setpref; |
2546 | if ( !setpref.exec() ) { | 2556 | if ( !setpref.exec() ) { |
2547 | return; | 2557 | return; |
2548 | } | 2558 | } |
2549 | XXPortSelectDialog dlg( this, false, this ); | 2559 | XXPortSelectDialog dlg( this, false, this ); |
2550 | if ( !dlg.exec() ) | 2560 | if ( !dlg.exec() ) |
2551 | return; | 2561 | return; |
2552 | mAddressBook->setUntagged(); | 2562 | mAddressBook->setUntagged(); |
2553 | dlg.tagSelected(); | 2563 | dlg.tagSelected(); |
2554 | int count = 0; | 2564 | int count = 0; |
2555 | KABC::AddressBook::Iterator it; | 2565 | KABC::AddressBook::Iterator it; |
2556 | bool modified = false; | 2566 | bool modified = false; |
2557 | for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 2567 | for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
2558 | if ( (*it).tagged() ) { | 2568 | if ( (*it).tagged() ) { |
2559 | if ( (*it).uid().left( 2 ) == "la" ) | 2569 | if ( (*it).uid().left( 2 ) == "la" ) |
2560 | if ( (*it).uid().left( 19 ) == QString("last-syncAddressee-") ) | 2570 | if ( (*it).uid().left( 19 ) == QString("last-syncAddressee-") ) |
2561 | continue; | 2571 | continue; |
2562 | ++count; | 2572 | ++count; |
2563 | if ( count %10 == 0 ) | 2573 | if ( count %10 == 0 ) |
2564 | message(i18n("Changing contact #%1").arg( count ) ); | 2574 | message(i18n("Changing contact #%1").arg( count ) ); |
2565 | QString fName; | 2575 | QString fName; |
2566 | if ( setpref.simple->isChecked() ) | 2576 | if ( setpref.simple->isChecked() ) |
2567 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::SimpleName ); | 2577 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::SimpleName ); |
2568 | else if ( setpref.full->isChecked() ) | 2578 | else if ( setpref.full->isChecked() ) |
2569 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::FullName ); | 2579 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::FullName ); |
2570 | else if ( setpref.reverse->isChecked() ) | 2580 | else if ( setpref.reverse->isChecked() ) |
2571 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::ReverseName ); | 2581 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::ReverseName ); |
2572 | else | 2582 | else |
2573 | fName = (*it).organization(); | 2583 | fName = (*it).organization(); |
2574 | if ( setpref.setCompany->isChecked() ) | 2584 | if ( setpref.setCompany->isChecked() ) |
2575 | if ( fName.isEmpty() || fName =="," ) | 2585 | if ( fName.isEmpty() || fName =="," ) |
2576 | fName = (*it).organization(); | 2586 | fName = (*it).organization(); |
2577 | (*it).setFormattedName( fName ); | 2587 | (*it).setFormattedName( fName ); |
2578 | (*it).setChanged( true ); | 2588 | (*it).setChanged( true ); |
2579 | modified = true; | 2589 | modified = true; |
2580 | (*it).setRevision( QDateTime::currentDateTime() ); | 2590 | (*it).setRevision( QDateTime::currentDateTime() ); |
2581 | } | 2591 | } |
2582 | } | 2592 | } |
2583 | message(i18n("Refreshing view...") ); | 2593 | message(i18n("Refreshing view...") ); |
2584 | if ( modified ) | 2594 | if ( modified ) |
2585 | setModified( true ); | 2595 | setModified( true ); |
2586 | Addressee add; | 2596 | Addressee add; |
2587 | mDetails->setAddressee( add ); | 2597 | mDetails->setAddressee( add ); |
2588 | if ( count == 0 ) | 2598 | if ( count == 0 ) |
2589 | message(i18n("No contact changed!") ); | 2599 | message(i18n("No contact changed!") ); |
2590 | else | 2600 | else |
2591 | message(i18n("%1 contacts changed!").arg( count ) ); | 2601 | message(i18n("%1 contacts changed!").arg( count ) ); |
2592 | } | 2602 | } |
2593 | 2603 | ||
2594 | void KABCore::clipboardDataChanged() | 2604 | void KABCore::clipboardDataChanged() |
2595 | { | 2605 | { |
2596 | 2606 | ||
2597 | if ( mReadWrite ) | 2607 | if ( mReadWrite ) |
2598 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); | 2608 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); |
2599 | 2609 | ||
2600 | } | 2610 | } |
2601 | 2611 | ||
2602 | void KABCore::updateActionMenu() | 2612 | void KABCore::updateActionMenu() |
2603 | { | 2613 | { |
2604 | UndoStack *undo = UndoStack::instance(); | 2614 | UndoStack *undo = UndoStack::instance(); |
2605 | RedoStack *redo = RedoStack::instance(); | 2615 | RedoStack *redo = RedoStack::instance(); |
2606 | 2616 | ||
2607 | if ( undo->isEmpty() ) | 2617 | if ( undo->isEmpty() ) |
2608 | mActionUndo->setText( i18n( "Undo" ) ); | 2618 | mActionUndo->setText( i18n( "Undo" ) ); |
2609 | else | 2619 | else |
2610 | mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); | 2620 | mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); |
2611 | 2621 | ||
2612 | mActionUndo->setEnabled( !undo->isEmpty() ); | 2622 | mActionUndo->setEnabled( !undo->isEmpty() ); |
2613 | 2623 | ||
2614 | if ( !redo->top() ) | 2624 | if ( !redo->top() ) |
2615 | mActionRedo->setText( i18n( "Redo" ) ); | 2625 | mActionRedo->setText( i18n( "Redo" ) ); |
2616 | else | 2626 | else |
2617 | mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); | 2627 | mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); |
2618 | 2628 | ||
2619 | mActionRedo->setEnabled( !redo->isEmpty() ); | 2629 | mActionRedo->setEnabled( !redo->isEmpty() ); |
2620 | } | 2630 | } |
2621 | 2631 | ||
2622 | void KABCore::configureKeyBindings() | 2632 | void KABCore::configureKeyBindings() |
2623 | { | 2633 | { |
2624 | #ifndef KAB_EMBEDDED | 2634 | #ifndef KAB_EMBEDDED |
2625 | KKeyDialog::configure( actionCollection(), true ); | 2635 | KKeyDialog::configure( actionCollection(), true ); |
2626 | #else //KAB_EMBEDDED | 2636 | #else //KAB_EMBEDDED |
2627 | qDebug("KABCore::configureKeyBindings() not implemented"); | 2637 | qDebug("KABCore::configureKeyBindings() not implemented"); |
2628 | #endif //KAB_EMBEDDED | 2638 | #endif //KAB_EMBEDDED |
2629 | } | 2639 | } |
2630 | 2640 | ||
2631 | #ifdef KAB_EMBEDDED | 2641 | #ifdef KAB_EMBEDDED |
2632 | void KABCore::configureResources() | 2642 | void KABCore::configureResources() |
2633 | { | 2643 | { |
2634 | KRES::KCMKResources dlg( this, "" , 0 ); | 2644 | KRES::KCMKResources dlg( this, "" , QStringList() ); |
2635 | 2645 | ||
2636 | if ( !dlg.exec() ) | 2646 | if ( !dlg.exec() ) |
2637 | return; | 2647 | return; |
2638 | KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); | 2648 | KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); |
2639 | } | 2649 | } |
2640 | #endif //KAB_EMBEDDED | 2650 | #endif //KAB_EMBEDDED |
2641 | 2651 | ||
2642 | 2652 | ||
2643 | /* this method will be called through the QCop interface from Ko/Pi to select addresses | 2653 | /* this method will be called through the QCop interface from Ko/Pi to select addresses |
2644 | * for the attendees list of an event. | 2654 | * for the attendees list of an event. |
2645 | */ | 2655 | */ |
2646 | void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) | 2656 | void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) |
2647 | { | 2657 | { |
2648 | qDebug("KABCore::requestForNameEmailUidList "); | 2658 | qDebug("KABCore::requestForNameEmailUidList "); |
2649 | bool ok = false; | 2659 | bool ok = false; |
2650 | mEmailSourceChannel = sourceChannel; | 2660 | mEmailSourceChannel = sourceChannel; |
2651 | mEmailSourceUID = uid; | 2661 | mEmailSourceUID = uid; |
2652 | QTimer::singleShot( 10,this, SLOT ( callContactdialog() ) ); | 2662 | QTimer::singleShot( 10,this, SLOT ( callContactdialog() ) ); |
2653 | //callContactdialog(); | 2663 | //callContactdialog(); |
2654 | #if 0 | 2664 | #if 0 |
2655 | int wid = uid.toInt( &ok ); | 2665 | int wid = uid.toInt( &ok ); |
2656 | qDebug("UID %s ", uid.latin1()); | 2666 | qDebug("UID %s ", uid.latin1()); |
2657 | if ( ok ) { | 2667 | if ( ok ) { |
2658 | if ( wid != QApplication::desktop()->width() ) { | 2668 | if ( wid != QApplication::desktop()->width() ) { |
2659 | qDebug("KA/Pi: Request from different desktop geometry. Resizing ..."); | 2669 | qDebug("KA/Pi: Request from different desktop geometry. Resizing ..."); |
2660 | message( i18n("Resizing, please wait...") ); | 2670 | message( i18n("Resizing, please wait...") ); |
2661 | mMainWindow->showMinimized(); | 2671 | mMainWindow->showMinimized(); |
2662 | /* | 2672 | /* |
2663 | { | 2673 | { |
2664 | QCopEnvelope e("QPE/Application/kapi", "callContactdialog()"); | 2674 | QCopEnvelope e("QPE/Application/kapi", "callContactdialog()"); |
2665 | } | 2675 | } |
2666 | */ | 2676 | */ |
2667 | QTimer::singleShot( 1,this, SLOT ( resizeAndCallContactdialog() ) ); | 2677 | QTimer::singleShot( 1,this, SLOT ( resizeAndCallContactdialog() ) ); |
2668 | return; | 2678 | return; |
2669 | } | 2679 | } |
2670 | 2680 | ||
2671 | } else { | 2681 | } else { |
2672 | qDebug("KABCore::requestForNameEmailUidList:: Got invalid uid "); | 2682 | qDebug("KABCore::requestForNameEmailUidList:: Got invalid uid "); |
2673 | } | 2683 | } |
2674 | callContactdialog(); | 2684 | callContactdialog(); |
2675 | //QCopEnvelope e("QPE/Application/kapi", "callContactdialog()"); | 2685 | //QCopEnvelope e("QPE/Application/kapi", "callContactdialog()"); |
2676 | #endif | 2686 | #endif |
2677 | } | 2687 | } |
2678 | void KABCore::resizeAndCallContactdialog() | 2688 | void KABCore::resizeAndCallContactdialog() |
2679 | { | 2689 | { |
2680 | updateMainWindow(); | 2690 | updateMainWindow(); |
2681 | QTimer::singleShot( 10,this, SLOT ( callContactdialog() ) ); | 2691 | QTimer::singleShot( 10,this, SLOT ( callContactdialog() ) ); |
2682 | } | 2692 | } |
2683 | 2693 | ||
2684 | void KABCore::doRingSync() | 2694 | void KABCore::doRingSync() |
2685 | { | 2695 | { |
2686 | topLevelWidget()->raise(); | 2696 | topLevelWidget()->raise(); |
2687 | syncManager->multiSync( false ); | 2697 | syncManager->multiSync( false ); |
2688 | } | 2698 | } |
2689 | void KABCore::callContactdialog() | 2699 | void KABCore::callContactdialog() |
2690 | { | 2700 | { |
2691 | static bool running = false; | 2701 | static bool running = false; |
2692 | if (running) return; | 2702 | if (running) return; |
2693 | running = true; | 2703 | running = true; |
2694 | QStringList nameList; | 2704 | QStringList nameList; |
2695 | QStringList emailList; | 2705 | QStringList emailList; |
2696 | QStringList uidList; | 2706 | QStringList uidList; |
2697 | qDebug(" KABCore::callContactdialog:DESKTOP WIDTH %d ", QApplication::desktop()->width() ); | 2707 | qDebug(" KABCore::callContactdialog:DESKTOP WIDTH %d ", QApplication::desktop()->width() ); |
2698 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); | 2708 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); |
2699 | uint i=0; | 2709 | uint i=0; |
2700 | for (i=0; i < list.count(); i++) | 2710 | for (i=0; i < list.count(); i++) |
2701 | { | 2711 | { |
2702 | nameList.append(list[i].realName()); | 2712 | nameList.append(list[i].realName()); |
2703 | emailList.append(list[i].preferredEmail()); | 2713 | emailList.append(list[i].preferredEmail()); |
2704 | uidList.append(list[i].uid()); | 2714 | uidList.append(list[i].uid()); |
2705 | } | 2715 | } |
2706 | QString uid = mEmailSourceUID; | 2716 | QString uid = mEmailSourceUID; |
2707 | //qDebug("%s %s ", sourceChannel.latin1(), uid.latin1()); | 2717 | //qDebug("%s %s ", sourceChannel.latin1(), uid.latin1()); |
2708 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(mEmailSourceChannel, uid, nameList, emailList, uidList); | 2718 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(mEmailSourceChannel, uid, nameList, emailList, uidList); |
2709 | running = false; | 2719 | running = false; |
2710 | } | 2720 | } |
2711 | /* this method will be called through the QCop interface from Ko/Pi to select birthdays | 2721 | /* this method will be called through the QCop interface from Ko/Pi to select birthdays |
2712 | * to put them into the calendar. | 2722 | * to put them into the calendar. |
2713 | */ | 2723 | */ |
2714 | void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid) | 2724 | void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid) |
2715 | { | 2725 | { |
2716 | // qDebug("KABCore::requestForBirthdayList"); | 2726 | // qDebug("KABCore::requestForBirthdayList"); |
2717 | QStringList birthdayList; | 2727 | QStringList birthdayList; |
2718 | QStringList anniversaryList; | 2728 | QStringList anniversaryList; |
2719 | QStringList realNameList; | 2729 | QStringList realNameList; |
2720 | QStringList preferredEmailList; | 2730 | QStringList preferredEmailList; |
2721 | QStringList assembledNameList; | 2731 | QStringList assembledNameList; |
2722 | QStringList uidList; | 2732 | QStringList uidList; |
2723 | 2733 | ||
2724 | KABC::AddressBook::Iterator it; | 2734 | KABC::AddressBook::Iterator it; |
2725 | 2735 | ||
2726 | int count = 0; | 2736 | int count = 0; |
2727 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 2737 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
2728 | ++count; | 2738 | ++count; |
2729 | } | 2739 | } |
2730 | QProgressBar bar(count,0 ); | 2740 | Q3ProgressBar bar(count,0 ); |
2731 | int w = 300; | 2741 | int w = 300; |
2732 | if ( QApplication::desktop()->width() < 320 ) | 2742 | if ( QApplication::desktop()->width() < 320 ) |
2733 | w = 220; | 2743 | w = 220; |
2734 | int h = bar.sizeHint().height() ; | 2744 | int h = bar.sizeHint().height() ; |
2735 | int dw = QApplication::desktop()->width(); | 2745 | int dw = QApplication::desktop()->width(); |
2736 | int dh = QApplication::desktop()->height(); | 2746 | int dh = QApplication::desktop()->height(); |
2737 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 2747 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
2738 | bar.show(); | 2748 | bar.show(); |
2739 | bar.setCaption (i18n("Collecting birthdays - close to abort!") ); | 2749 | bar.setCaption (i18n("Collecting birthdays - close to abort!") ); |
2740 | qApp->processEvents(); | 2750 | qApp->processEvents(); |
2741 | 2751 | ||
2742 | QDate bday; | 2752 | QDate bday; |
2743 | QString anni; | 2753 | QString anni; |
2744 | QString formattedbday; | 2754 | QString formattedbday; |
2745 | 2755 | ||
2746 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) | 2756 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) |
2747 | { | 2757 | { |
2748 | if ( ! bar.isVisible() ) | 2758 | if ( ! bar.isVisible() ) |
2749 | return; | 2759 | return; |
2750 | bar.setProgress( count++ ); | 2760 | bar.setProgress( count++ ); |
2751 | qApp->processEvents(); | 2761 | qApp->processEvents(); |
2752 | bday = (*it).birthday().date(); | 2762 | bday = (*it).birthday().date(); |
2753 | anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" ); | 2763 | anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" ); |
2754 | 2764 | ||
2755 | if ( bday.isValid() || !anni.isEmpty()) | 2765 | if ( bday.isValid() || !anni.isEmpty()) |
2756 | { | 2766 | { |
2757 | if (bday.isValid()) | 2767 | if (bday.isValid()) |
2758 | formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate); | 2768 | formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate); |
2759 | else | 2769 | else |
2760 | formattedbday = "NOTVALID"; | 2770 | formattedbday = "NOTVALID"; |
2761 | if (anni.isEmpty()) | 2771 | if (anni.isEmpty()) |
2762 | anni = "INVALID"; | 2772 | anni = "INVALID"; |
2763 | 2773 | ||
2764 | birthdayList.append(formattedbday); | 2774 | birthdayList.append(formattedbday); |
2765 | anniversaryList.append(anni); //should be ISODate | 2775 | anniversaryList.append(anni); //should be ISODate |
2766 | realNameList.append((*it).realName()); | 2776 | realNameList.append((*it).realName()); |
2767 | preferredEmailList.append((*it).preferredEmail()); | 2777 | preferredEmailList.append((*it).preferredEmail()); |
2768 | assembledNameList.append((*it).realName()); | 2778 | assembledNameList.append((*it).realName()); |
2769 | uidList.append((*it).uid()); | 2779 | uidList.append((*it).uid()); |
2770 | 2780 | ||
2771 | //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() ); | 2781 | //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() ); |
2772 | } | 2782 | } |
2773 | } | 2783 | } |
2774 | 2784 | ||
2775 | bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList); | 2785 | bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList); |
2776 | 2786 | ||
2777 | } | 2787 | } |
2778 | 2788 | ||
2779 | /* this method will be called through the QCop interface from other apps to show details of a contact. | 2789 | /* this method will be called through the QCop interface from other apps to show details of a contact. |
2780 | */ | 2790 | */ |
2781 | void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) | 2791 | void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) |
2782 | { | 2792 | { |
2783 | //qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); | 2793 | //qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); |
2784 | 2794 | ||
2785 | QString foundUid = QString::null; | 2795 | QString foundUid = QString::null; |
2786 | if ( ! uid.isEmpty() ) { | 2796 | if ( ! uid.isEmpty() ) { |
2787 | Addressee adrr = mAddressBook->findByUid( uid ); | 2797 | Addressee adrr = mAddressBook->findByUid( uid ); |
2788 | if ( !adrr.isEmpty() ) { | 2798 | if ( !adrr.isEmpty() ) { |
2789 | foundUid = uid; | 2799 | foundUid = uid; |
2790 | } | 2800 | } |
2791 | if ( email == "sendbacklist" ) { | 2801 | if ( email == "sendbacklist" ) { |
2792 | //qDebug("ssssssssssssssssssssssend "); | 2802 | //qDebug("ssssssssssssssssssssssend "); |
2793 | QStringList nameList; | 2803 | QStringList nameList; |
2794 | QStringList emailList; | 2804 | QStringList emailList; |
2795 | QStringList uidList; | 2805 | QStringList uidList; |
2796 | nameList.append(adrr.realName()); | 2806 | nameList.append(adrr.realName()); |
2797 | emailList = adrr.emails(); | 2807 | emailList = adrr.emails(); |
2798 | uidList.append( adrr.preferredEmail()); | 2808 | uidList.append( adrr.preferredEmail()); |
2799 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); | 2809 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); |
2800 | return; | 2810 | return; |
2801 | } | 2811 | } |
2802 | 2812 | ||
2803 | } | 2813 | } |
2804 | 2814 | ||
2805 | if ( email == "sendbacklist" ) | 2815 | if ( email == "sendbacklist" ) |
2806 | return; | 2816 | return; |
2807 | if (foundUid.isEmpty()) | 2817 | if (foundUid.isEmpty()) |
2808 | { | 2818 | { |
2809 | //find the uid of the person first | 2819 | //find the uid of the person first |
2810 | Addressee::List namelist; | 2820 | Addressee::List namelist; |
2811 | Addressee::List emaillist; | 2821 | Addressee::List emaillist; |
2812 | 2822 | ||
2813 | if (!name.isEmpty()) | 2823 | if (!name.isEmpty()) |
2814 | namelist = mAddressBook->findByName( name ); | 2824 | namelist = mAddressBook->findByName( name ); |
2815 | 2825 | ||
2816 | if (!email.isEmpty()) | 2826 | if (!email.isEmpty()) |
2817 | emaillist = mAddressBook->findByEmail( email ); | 2827 | emaillist = mAddressBook->findByEmail( email ); |
2818 | //qDebug("count %d %d ", namelist.count(),emaillist.count() ); | 2828 | //qDebug("count %d %d ", namelist.count(),emaillist.count() ); |
2819 | //check if we have a match in Namelist and Emaillist | 2829 | //check if we have a match in Namelist and Emaillist |
2820 | if ((namelist.count() == 0) && (emaillist.count() > 0)) { | 2830 | if ((namelist.count() == 0) && (emaillist.count() > 0)) { |
2821 | foundUid = emaillist[0].uid(); | 2831 | foundUid = emaillist[0].uid(); |
2822 | } | 2832 | } |
2823 | else if ((namelist.count() > 0) && (emaillist.count() == 0)) | 2833 | else if ((namelist.count() > 0) && (emaillist.count() == 0)) |
2824 | foundUid = namelist[0].uid(); | 2834 | foundUid = namelist[0].uid(); |
2825 | else | 2835 | else |
2826 | { | 2836 | { |
2827 | for (int i = 0; i < namelist.count(); i++) | 2837 | for (int i = 0; i < namelist.count(); i++) |
2828 | { | 2838 | { |
2829 | for (int j = 0; j < emaillist.count(); j++) | 2839 | for (int j = 0; j < emaillist.count(); j++) |
2830 | { | 2840 | { |
2831 | if (namelist[i] == emaillist[j]) | 2841 | if (namelist[i] == emaillist[j]) |
2832 | { | 2842 | { |
2833 | foundUid = namelist[i].uid(); | 2843 | foundUid = namelist[i].uid(); |
2834 | } | 2844 | } |
2835 | } | 2845 | } |
2836 | } | 2846 | } |
2837 | } | 2847 | } |
2838 | } | 2848 | } |
2839 | else | 2849 | else |
2840 | { | 2850 | { |
2841 | foundUid = uid; | 2851 | foundUid = uid; |
2842 | } | 2852 | } |
2843 | 2853 | ||
2844 | if (!foundUid.isEmpty()) | 2854 | if (!foundUid.isEmpty()) |
2845 | { | 2855 | { |
2846 | 2856 | ||
2847 | // raise Ka/Pi if it is in the background | 2857 | // raise Ka/Pi if it is in the background |
2848 | #ifndef DESKTOP_VERSION | 2858 | #ifndef DESKTOP_VERSION |
2849 | #ifndef KORG_NODCOP | 2859 | #ifndef KORG_NODCOP |
2850 | //QCopEnvelope e("QPE/Application/kapi", "raise()"); | 2860 | //QCopEnvelope e("QPE/Application/kapi", "raise()"); |
2851 | #endif | 2861 | #endif |
2852 | #endif | 2862 | #endif |
2853 | 2863 | ||
2854 | mMainWindow->showMaximized(); | 2864 | mMainWindow->showMaximized(); |
2855 | mMainWindow-> raise(); | 2865 | mMainWindow-> raise(); |
2856 | 2866 | ||
2857 | mViewManager->setSelected( "", false); | 2867 | mViewManager->setSelected( "", false); |
2858 | mViewManager->refreshView( "" ); | 2868 | mViewManager->refreshView( "" ); |
2859 | mViewManager->setSelected( foundUid, true ); | 2869 | mViewManager->setSelected( foundUid, true ); |
2860 | mViewManager->refreshView( foundUid ); | 2870 | mViewManager->refreshView( foundUid ); |
2861 | 2871 | ||
2862 | if ( !mMultipleViewsAtOnce ) | 2872 | if ( !mMultipleViewsAtOnce ) |
2863 | { | 2873 | { |
2864 | setDetailsVisible( true ); | 2874 | setDetailsVisible( true ); |
2865 | mActionDetails->setChecked(true); | 2875 | mActionDetails->setChecked(true); |
2866 | } | 2876 | } |
2867 | } | 2877 | } |
2868 | } | 2878 | } |
2869 | void KABCore::storagehowto() | 2879 | void KABCore::storagehowto() |
2870 | { | 2880 | { |
2871 | KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" ); | 2881 | KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" ); |
2872 | } | 2882 | } |
2873 | void KABCore::whatsnew() | 2883 | void KABCore::whatsnew() |
2874 | { | 2884 | { |
2875 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); | 2885 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); |
2876 | } | 2886 | } |
2877 | void KABCore::synchowto() | 2887 | void KABCore::synchowto() |
2878 | { | 2888 | { |
2879 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); | 2889 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); |
2880 | } | 2890 | } |
2881 | void KABCore::kdesynchowto() | 2891 | void KABCore::kdesynchowto() |
2882 | { | 2892 | { |
2883 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); | 2893 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); |
2884 | } | 2894 | } |
2885 | void KABCore::multisynchowto() | 2895 | void KABCore::multisynchowto() |
2886 | { | 2896 | { |
2887 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); | 2897 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); |
2888 | } | 2898 | } |
2889 | void KABCore::faq() | 2899 | void KABCore::faq() |
2890 | { | 2900 | { |
2891 | KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" ); | 2901 | KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" ); |
2892 | } | 2902 | } |
2893 | 2903 | ||
2894 | #include <libkcal/syncdefines.h> | 2904 | #include <libkcal/syncdefines.h> |
2895 | 2905 | ||
2896 | KABC::Addressee KABCore::getLastSyncAddressee() | 2906 | KABC::Addressee KABCore::getLastSyncAddressee() |
2897 | { | 2907 | { |
2898 | Addressee lse; | 2908 | Addressee lse; |
2899 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); | 2909 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); |
2900 | 2910 | ||
2901 | //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); | 2911 | //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); |
2902 | lse = mAddressBook->findByUid( "last-syncAddressee-"+mCurrentSyncDevice ); | 2912 | lse = mAddressBook->findByUid( "last-syncAddressee-"+mCurrentSyncDevice ); |
2903 | if (lse.isEmpty()) { | 2913 | if (lse.isEmpty()) { |
2904 | qDebug("KA: Creating new last-syncAddressee "); | 2914 | qDebug("KA: Creating new last-syncAddressee "); |
2905 | lse.setUid( "last-syncAddressee-"+mCurrentSyncDevice ); | 2915 | lse.setUid( "last-syncAddressee-"+mCurrentSyncDevice ); |
2906 | QString sum = ""; | 2916 | QString sum = ""; |
2907 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) | 2917 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) |
2908 | sum = "E: "; | 2918 | sum = "E: "; |
2909 | lse.setFamilyName("!"+sum+mCurrentSyncDevice + i18n(" - sync event")); | 2919 | lse.setFamilyName("!"+sum+mCurrentSyncDevice + i18n(" - sync event")); |
2910 | lse.setRevision( mLastAddressbookSync ); | 2920 | lse.setRevision( mLastAddressbookSync ); |
2911 | lse.setCategories( i18n("SyncEvent") ); | 2921 | lse.setCategories( QStringList(i18n("SyncEvent")) ); |
2912 | mAddressBook->insertAddressee( lse ); | 2922 | mAddressBook->insertAddressee( lse ); |
2913 | } | 2923 | } |
2914 | return lse; | 2924 | return lse; |
2915 | } | 2925 | } |
2916 | int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ) | 2926 | int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ) |
2917 | { | 2927 | { |
2918 | 2928 | ||
2919 | //void setZaurusId(int id); | 2929 | //void setZaurusId(int id); |
2920 | // int zaurusId() const; | 2930 | // int zaurusId() const; |
2921 | // void setZaurusUid(int id); | 2931 | // void setZaurusUid(int id); |
2922 | // int zaurusUid() const; | 2932 | // int zaurusUid() const; |
2923 | // void setZaurusStat(int id); | 2933 | // void setZaurusStat(int id); |
2924 | // int zaurusStat() const; | 2934 | // int zaurusStat() const; |
2925 | // 0 equal | 2935 | // 0 equal |
2926 | // 1 take local | 2936 | // 1 take local |
2927 | // 2 take remote | 2937 | // 2 take remote |
2928 | // 3 cancel | 2938 | // 3 cancel |
2929 | QDateTime lastSync = mLastAddressbookSync; | 2939 | QDateTime lastSync = mLastAddressbookSync; |
2930 | QDateTime localMod = local->revision(); | 2940 | QDateTime localMod = local->revision(); |
2931 | QDateTime remoteMod = remote->revision(); | 2941 | QDateTime remoteMod = remote->revision(); |
2932 | 2942 | ||
2933 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); | 2943 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); |
2934 | 2944 | ||
2935 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2945 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2936 | bool remCh, locCh; | 2946 | bool remCh, locCh; |
2937 | remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); | 2947 | remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); |
2938 | //if ( remCh ) | 2948 | //if ( remCh ) |
2939 | // qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); | 2949 | // qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); |
2940 | locCh = ( localMod > mLastAddressbookSync ); | 2950 | locCh = ( localMod > mLastAddressbookSync ); |
2941 | //qDebug("cahnged rem %d loc %d",remCh, locCh ); | 2951 | //qDebug("cahnged rem %d loc %d",remCh, locCh ); |
2942 | if ( !remCh && ! locCh ) { | 2952 | if ( !remCh && ! locCh ) { |
2943 | //qDebug("both not changed "); | 2953 | //qDebug("both not changed "); |
2944 | lastSync = localMod.addDays(1); | 2954 | lastSync = localMod.addDays(1); |
2945 | if ( mode <= SYNC_PREF_ASK ) | 2955 | if ( mode <= SYNC_PREF_ASK ) |
2946 | return 0; | 2956 | return 0; |
2947 | } else { | 2957 | } else { |
2948 | if ( locCh ) { | 2958 | if ( locCh ) { |
2949 | //qDebug("loc changed %s %s", localMod.toString().latin1(), mLastAddressbookSync.toString().latin1()); | 2959 | //qDebug("loc changed %s %s", localMod.toString().latin1(), mLastAddressbookSync.toString().latin1()); |
2950 | lastSync = localMod.addDays( -1 ); | 2960 | lastSync = localMod.addDays( -1 ); |
2951 | if ( !remCh ) | 2961 | if ( !remCh ) |
2952 | remoteMod =( lastSync.addDays( -1 ) ); | 2962 | remoteMod =( lastSync.addDays( -1 ) ); |
2953 | } else { | 2963 | } else { |
2954 | //qDebug(" not loc changed "); | 2964 | //qDebug(" not loc changed "); |
2955 | lastSync = localMod.addDays( 1 ); | 2965 | lastSync = localMod.addDays( 1 ); |
2956 | if ( remCh ) { | 2966 | if ( remCh ) { |
2957 | //qDebug("rem changed "); | 2967 | //qDebug("rem changed "); |
2958 | remoteMod =( lastSync.addDays( 1 ) ); | 2968 | remoteMod =( lastSync.addDays( 1 ) ); |
2959 | } | 2969 | } |
2960 | 2970 | ||
2961 | } | 2971 | } |
2962 | } | 2972 | } |
2963 | full = true; | 2973 | full = true; |
2964 | if ( mode < SYNC_PREF_ASK ) | 2974 | if ( mode < SYNC_PREF_ASK ) |
2965 | mode = SYNC_PREF_ASK; | 2975 | mode = SYNC_PREF_ASK; |
2966 | } else { | 2976 | } else { |
2967 | if ( localMod == remoteMod ) | 2977 | if ( localMod == remoteMod ) |
2968 | return 0; | 2978 | return 0; |
2969 | 2979 | ||
2970 | } | 2980 | } |
2971 | //qDebug("%s %s --- %d %d", localMod.toString().latin1() , remoteMod.toString().latin1(), localMod.time().msec(), remoteMod.time().msec()); | 2981 | //qDebug("%s %s --- %d %d", localMod.toString().latin1() , remoteMod.toString().latin1(), localMod.time().msec(), remoteMod.time().msec()); |
2972 | //qDebug("lastsync %s ", lastSync.toString().latin1() ); | 2982 | //qDebug("lastsync %s ", lastSync.toString().latin1() ); |
2973 | //full = true; //debug only | 2983 | //full = true; //debug only |
2974 | if ( full ) { | 2984 | if ( full ) { |
2975 | bool equ = ( (*local) == (*remote) ); | 2985 | bool equ = ( (*local) == (*remote) ); |
2976 | if ( equ ) { | 2986 | if ( equ ) { |
2977 | //qDebug("equal "); | 2987 | //qDebug("equal "); |
2978 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2988 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2979 | local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); | 2989 | local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); |
2980 | } | 2990 | } |
2981 | if ( mode < SYNC_PREF_FORCE_LOCAL ) | 2991 | if ( mode < SYNC_PREF_FORCE_LOCAL ) |
2982 | return 0; | 2992 | return 0; |
2983 | 2993 | ||
2984 | }//else //debug only | 2994 | }//else //debug only |
2985 | //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); | 2995 | //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); |
2986 | } | 2996 | } |
2987 | int result; | 2997 | int result; |
2988 | bool localIsNew; | 2998 | bool localIsNew; |
2989 | //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() ); | 2999 | //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() ); |
2990 | 3000 | ||
2991 | if ( full && mode < SYNC_PREF_NEWEST ) | 3001 | if ( full && mode < SYNC_PREF_NEWEST ) |
2992 | mode = SYNC_PREF_ASK; | 3002 | mode = SYNC_PREF_ASK; |
2993 | 3003 | ||
2994 | switch( mode ) { | 3004 | switch( mode ) { |
2995 | case SYNC_PREF_LOCAL: | 3005 | case SYNC_PREF_LOCAL: |
2996 | if ( lastSync > remoteMod ) | 3006 | if ( lastSync > remoteMod ) |
2997 | return 1; | 3007 | return 1; |
2998 | if ( lastSync > localMod ) | 3008 | if ( lastSync > localMod ) |
2999 | return 2; | 3009 | return 2; |
3000 | return 1; | 3010 | return 1; |
3001 | break; | 3011 | break; |
3002 | case SYNC_PREF_REMOTE: | 3012 | case SYNC_PREF_REMOTE: |
3003 | if ( lastSync > localMod ) | 3013 | if ( lastSync > localMod ) |
3004 | return 2; | 3014 | return 2; |
3005 | if ( lastSync > remoteMod ) | 3015 | if ( lastSync > remoteMod ) |
3006 | return 1; | 3016 | return 1; |
3007 | return 2; | 3017 | return 2; |
3008 | break; | 3018 | break; |
3009 | case SYNC_PREF_NEWEST: | 3019 | case SYNC_PREF_NEWEST: |
3010 | if ( localMod > remoteMod ) | 3020 | if ( localMod > remoteMod ) |
3011 | return 1; | 3021 | return 1; |
3012 | else | 3022 | else |
3013 | return 2; | 3023 | return 2; |
3014 | break; | 3024 | break; |
3015 | case SYNC_PREF_ASK: | 3025 | case SYNC_PREF_ASK: |
3016 | //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); | 3026 | //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); |
3017 | if ( lastSync > remoteMod && lastSync > localMod) | 3027 | if ( lastSync > remoteMod && lastSync > localMod) |
3018 | return 0; | 3028 | return 0; |
3019 | if ( lastSync > remoteMod ) | 3029 | if ( lastSync > remoteMod ) |
3020 | return 1; | 3030 | return 1; |
3021 | if ( lastSync > localMod ) { | 3031 | if ( lastSync > localMod ) { |
3022 | return 2; | 3032 | return 2; |
3023 | } | 3033 | } |
3024 | localIsNew = localMod >= remoteMod; | 3034 | localIsNew = localMod >= remoteMod; |
3025 | //qDebug("conflict! ************************************** "); | 3035 | //qDebug("conflict! ************************************** "); |
3026 | { | 3036 | { |
3027 | KABC::AddresseeChooser acd ( *local,*remote, localIsNew , this ); | 3037 | KABC::AddresseeChooser acd ( *local,*remote, localIsNew , this ); |
3028 | result = acd.executeD(localIsNew); | 3038 | result = acd.executeD(localIsNew); |
3029 | return result; | 3039 | return result; |
3030 | } | 3040 | } |
3031 | break; | 3041 | break; |
3032 | case SYNC_PREF_FORCE_LOCAL: | 3042 | case SYNC_PREF_FORCE_LOCAL: |
3033 | return 1; | 3043 | return 1; |
3034 | break; | 3044 | break; |
3035 | case SYNC_PREF_FORCE_REMOTE: | 3045 | case SYNC_PREF_FORCE_REMOTE: |
3036 | return 2; | 3046 | return 2; |
3037 | break; | 3047 | break; |
3038 | 3048 | ||
3039 | default: | 3049 | default: |
3040 | // SYNC_PREF_TAKE_BOTH not implemented | 3050 | // SYNC_PREF_TAKE_BOTH not implemented |
3041 | break; | 3051 | break; |
3042 | } | 3052 | } |
3043 | return 0; | 3053 | return 0; |
3044 | } | 3054 | } |
3045 | 3055 | ||
3046 | 3056 | ||
3047 | bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode) | 3057 | bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode) |
3048 | { | 3058 | { |
3049 | bool syncOK = true; | 3059 | bool syncOK = true; |
3050 | int addedAddressee = 0; | 3060 | int addedAddressee = 0; |
3051 | int addedAddresseeR = 0; | 3061 | int addedAddresseeR = 0; |
3052 | int deletedAddresseeR = 0; | 3062 | int deletedAddresseeR = 0; |
3053 | int deletedAddresseeL = 0; | 3063 | int deletedAddresseeL = 0; |
3054 | int changedLocal = 0; | 3064 | int changedLocal = 0; |
3055 | int changedRemote = 0; | 3065 | int changedRemote = 0; |
3056 | int filteredIN = 0; | 3066 | int filteredIN = 0; |
3057 | int filteredOUT = 0; | 3067 | int filteredOUT = 0; |
3058 | 3068 | ||
3059 | QString mCurrentSyncName = syncManager->getCurrentSyncName(); | 3069 | QString mCurrentSyncName = syncManager->getCurrentSyncName(); |
3060 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); | 3070 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); |
3061 | 3071 | ||
3062 | //QPtrList<Addressee> el = local->rawAddressees(); | 3072 | //QPtrList<Addressee> el = local->rawAddressees(); |
3063 | Addressee addresseeR; | 3073 | Addressee addresseeR; |
3064 | QString uid; | 3074 | QString uid; |
3065 | int take; | 3075 | int take; |
3066 | Addressee addresseeL; | 3076 | Addressee addresseeL; |
3067 | Addressee addresseeRSync; | 3077 | Addressee addresseeRSync; |
3068 | Addressee addresseeLSync; | 3078 | Addressee addresseeLSync; |
3069 | // KABC::Addressee::List addresseeRSyncSharp = remote->getExternLastSyncAddressees(); | 3079 | // KABC::Addressee::List addresseeRSyncSharp = remote->getExternLastSyncAddressees(); |
3070 | //KABC::Addressee::List addresseeLSyncSharp = local->getExternLastSyncAddressees(); | 3080 | //KABC::Addressee::List addresseeLSyncSharp = local->getExternLastSyncAddressees(); |
3071 | bool fullDateRange = false; | 3081 | bool fullDateRange = false; |
3072 | local->resetTempSyncStat(); | 3082 | local->resetTempSyncStat(); |
3073 | mLastAddressbookSync = QDateTime::currentDateTime(); | 3083 | mLastAddressbookSync = QDateTime::currentDateTime(); |
3074 | if ( syncManager->syncWithDesktop() ) { | 3084 | if ( syncManager->syncWithDesktop() ) { |
3075 | // remote->removeSyncInfo( QString());//remove all info | 3085 | // remote->removeSyncInfo( QString());//remove all info |
3076 | if ( KSyncManager::mRequestedSyncEvent.isValid() ) { | 3086 | if ( KSyncManager::mRequestedSyncEvent.isValid() ) { |
3077 | mLastAddressbookSync = KSyncManager::mRequestedSyncEvent; | 3087 | mLastAddressbookSync = KSyncManager::mRequestedSyncEvent; |
3078 | qDebug("KA: using extern time for calendar sync: %s ", mLastAddressbookSync.toString().latin1() ); | 3088 | qDebug("KA: using extern time for calendar sync: %s ", mLastAddressbookSync.toString().latin1() ); |
3079 | } else { | 3089 | } else { |
3080 | qDebug("KA: KSyncManager::mRequestedSyncEvent has invalid datatime "); | 3090 | qDebug("KA: KSyncManager::mRequestedSyncEvent has invalid datatime "); |
3081 | } | 3091 | } |
3082 | } | 3092 | } |
3083 | QDateTime modifiedCalendar = mLastAddressbookSync; | 3093 | QDateTime modifiedCalendar = mLastAddressbookSync; |
3084 | addresseeLSync = getLastSyncAddressee(); | 3094 | addresseeLSync = getLastSyncAddressee(); |
3085 | qDebug("KA: Last Sync %s ", addresseeLSync.revision().toString().latin1()); | 3095 | qDebug("KA: Last Sync %s ", addresseeLSync.revision().toString().latin1()); |
3086 | addresseeR = remote->findByUid("last-syncAddressee-"+mCurrentSyncName ); | 3096 | addresseeR = remote->findByUid("last-syncAddressee-"+mCurrentSyncName ); |
3087 | if ( !addresseeR.isEmpty() ) { | 3097 | if ( !addresseeR.isEmpty() ) { |
3088 | addresseeRSync = addresseeR; | 3098 | addresseeRSync = addresseeR; |
3089 | remote->removeAddressee(addresseeR ); | 3099 | remote->removeAddressee(addresseeR ); |
3090 | 3100 | ||
3091 | } else { | 3101 | } else { |
3092 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 3102 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
3093 | addresseeRSync = addresseeLSync ; | 3103 | addresseeRSync = addresseeLSync ; |
3094 | } else { | 3104 | } else { |
3095 | //qDebug("FULLDATE 1"); | 3105 | //qDebug("FULLDATE 1"); |
3096 | fullDateRange = true; | 3106 | fullDateRange = true; |
3097 | Addressee newAdd; | 3107 | Addressee newAdd; |
3098 | addresseeRSync = newAdd; | 3108 | addresseeRSync = newAdd; |
3099 | addresseeRSync.setFamilyName(mCurrentSyncName + i18n(" - sync addressee")); | 3109 | addresseeRSync.setFamilyName(mCurrentSyncName + i18n(" - sync addressee")); |
3100 | addresseeRSync.setUid("last-syncAddressee-"+mCurrentSyncName ); | 3110 | addresseeRSync.setUid("last-syncAddressee-"+mCurrentSyncName ); |
3101 | addresseeRSync.setRevision( mLastAddressbookSync ); | 3111 | addresseeRSync.setRevision( mLastAddressbookSync ); |
3102 | addresseeRSync.setCategories( i18n("SyncAddressee") ); | 3112 | addresseeRSync.setCategories( QStringList(i18n("SyncAddressee")) ); |
3103 | } | 3113 | } |
3104 | } | 3114 | } |
3105 | if ( addresseeLSync.revision() == mLastAddressbookSync ) { | 3115 | if ( addresseeLSync.revision() == mLastAddressbookSync ) { |
3106 | // qDebug("FULLDATE 2"); | 3116 | // qDebug("FULLDATE 2"); |
3107 | fullDateRange = true; | 3117 | fullDateRange = true; |
3108 | } | 3118 | } |
3109 | if ( ! fullDateRange ) { | 3119 | if ( ! fullDateRange ) { |
3110 | if ( addresseeLSync.revision() != addresseeRSync.revision() ) { | 3120 | if ( addresseeLSync.revision() != addresseeRSync.revision() ) { |
3111 | 3121 | ||
3112 | // qDebug("set fulldate to true %s %s" ,addresseeLSync->dtStart().toString().latin1(), addresseeRSync->dtStart().toString().latin1() ); | 3122 | // qDebug("set fulldate to true %s %s" ,addresseeLSync->dtStart().toString().latin1(), addresseeRSync->dtStart().toString().latin1() ); |
3113 | //qDebug("%d %d %d %d ", addresseeLSync->dtStart().time().second(), addresseeLSync->dtStart().time().msec() , addresseeRSync->dtStart().time().second(), addresseeRSync->dtStart().time().msec()); | 3123 | //qDebug("%d %d %d %d ", addresseeLSync->dtStart().time().second(), addresseeLSync->dtStart().time().msec() , addresseeRSync->dtStart().time().second(), addresseeRSync->dtStart().time().msec()); |
3114 | fullDateRange = true; | 3124 | fullDateRange = true; |
3115 | //qDebug("FULLDATE 3 %s %s", addresseeLSync.revision().toString().latin1() , addresseeRSync.revision().toString().latin1() ); | 3125 | //qDebug("FULLDATE 3 %s %s", addresseeLSync.revision().toString().latin1() , addresseeRSync.revision().toString().latin1() ); |
3116 | } | 3126 | } |
3117 | } | 3127 | } |
3118 | // fullDateRange = true; // debug only! | 3128 | // fullDateRange = true; // debug only! |
3119 | if ( fullDateRange ) | 3129 | if ( fullDateRange ) |
3120 | mLastAddressbookSync = QDateTime::currentDateTime().addDays( -100*365); | 3130 | mLastAddressbookSync = QDateTime::currentDateTime().addDays( -100*365); |
3121 | else | 3131 | else |
3122 | mLastAddressbookSync = addresseeLSync.revision(); | 3132 | mLastAddressbookSync = addresseeLSync.revision(); |
3123 | // for resyncing if own file has changed | 3133 | // for resyncing if own file has changed |
3124 | // PENDING fixme later when implemented | 3134 | // PENDING fixme later when implemented |
3125 | #if 0 | 3135 | #if 0 |
3126 | if ( mCurrentSyncDevice == "deleteaftersync" ) { | 3136 | if ( mCurrentSyncDevice == "deleteaftersync" ) { |
3127 | mLastAddressbookSync = loadedFileVersion; | 3137 | mLastAddressbookSync = loadedFileVersion; |
3128 | qDebug("setting mLastAddressbookSync "); | 3138 | qDebug("setting mLastAddressbookSync "); |
3129 | } | 3139 | } |
3130 | #endif | 3140 | #endif |
3131 | 3141 | ||
3132 | 3142 | ||
3133 | // ********** setting filters **************** | 3143 | // ********** setting filters **************** |
3134 | Filter filterIN = mViewManager->getFilterByName( syncManager->mFilterInAB ); | 3144 | Filter filterIN = mViewManager->getFilterByName( syncManager->mFilterInAB ); |
3135 | Filter filterOUT = mViewManager->getFilterByName( syncManager->mFilterOutAB ); | 3145 | Filter filterOUT = mViewManager->getFilterByName( syncManager->mFilterOutAB ); |
3136 | 3146 | ||
3137 | //qDebug("*************************** "); | 3147 | //qDebug("*************************** "); |
3138 | // qDebug("mLastAddressbookSync %s ",mLastAddressbookSync.toString().latin1() ); | 3148 | // qDebug("mLastAddressbookSync %s ",mLastAddressbookSync.toString().latin1() ); |
3139 | QStringList er = remote->uidList(); | 3149 | QStringList er = remote->uidList(); |
3140 | Addressee inR ;//= er.first(); | 3150 | Addressee inR ;//= er.first(); |
3141 | Addressee inL; | 3151 | Addressee inL; |
3142 | 3152 | ||
3143 | syncManager->showProgressBar(0, i18n("Syncing - close to abort!"), er.count()); | 3153 | syncManager->showProgressBar(0, i18n("Syncing - close to abort!"), er.count()); |
3144 | 3154 | ||
3145 | int modulo = (er.count()/10)+1; | 3155 | int modulo = (er.count()/10)+1; |
3146 | int incCounter = 0; | 3156 | int incCounter = 0; |
3147 | while ( incCounter < er.count()) { | 3157 | while ( incCounter < er.count()) { |
3148 | if (syncManager->isProgressBarCanceled()) | 3158 | if (syncManager->isProgressBarCanceled()) |
3149 | return false; | 3159 | return false; |
3150 | if ( incCounter % modulo == 0 ) | 3160 | if ( incCounter % modulo == 0 ) |
3151 | syncManager->showProgressBar(incCounter); | 3161 | syncManager->showProgressBar(incCounter); |
3152 | 3162 | ||
3153 | uid = er[ incCounter ]; | 3163 | uid = er[ incCounter ]; |
3154 | bool skipIncidence = false; | 3164 | bool skipIncidence = false; |
3155 | if ( uid.left(19) == QString("last-syncAddressee-") ) | 3165 | if ( uid.left(19) == QString("last-syncAddressee-") ) |
3156 | skipIncidence = true; | 3166 | skipIncidence = true; |
3157 | QString idS,OidS; | 3167 | QString idS,OidS; |
3158 | qApp->processEvents(); | 3168 | qApp->processEvents(); |
3159 | if ( !skipIncidence ) { | 3169 | if ( !skipIncidence ) { |
3160 | inL = local->findByUid( uid ); | 3170 | inL = local->findByUid( uid ); |
3161 | inR = remote->findByUid( uid ); | 3171 | inR = remote->findByUid( uid ); |
3162 | //inL.setResource( 0 ); | 3172 | //inL.setResource( 0 ); |
3163 | //inR.setResource( 0 ); | 3173 | //inR.setResource( 0 ); |
3164 | if ( !inL.isEmpty() ) { // maybe conflict - same uid in both calendars | 3174 | if ( !inL.isEmpty() ) { // maybe conflict - same uid in both calendars |
3165 | if ( !inL.resource() || inL.resource()->includeInSync() ) { | 3175 | if ( !inL.resource() || inL.resource()->includeInSync() ) { |
3166 | if ( (take = takeAddressee( &inL, &inR, mode, fullDateRange )) ) { | 3176 | if ( (take = takeAddressee( &inL, &inR, mode, fullDateRange )) ) { |
3167 | //qDebug("take %d %s ", take, inL.summary().latin1()); | 3177 | //qDebug("take %d %s ", take, inL.summary().latin1()); |
3168 | if ( take == 3 ) | 3178 | if ( take == 3 ) |
3169 | return false; | 3179 | return false; |
3170 | if ( take == 1 ) {// take local ********************** | 3180 | if ( take == 1 ) {// take local ********************** |
3171 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 3181 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
3172 | inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); | 3182 | inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); |
3173 | inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); | 3183 | inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); |
3174 | local->insertAddressee( inL, false ); | 3184 | local->insertAddressee( inL, false ); |
3175 | idS = inR.externalUID(); | 3185 | idS = inR.externalUID(); |
3176 | OidS = inR.originalExternalUID(); | 3186 | OidS = inR.originalExternalUID(); |
3177 | } | 3187 | } |
3178 | else | 3188 | else |
3179 | idS = inR.IDStr(); | 3189 | idS = inR.IDStr(); |
3180 | remote->removeAddressee( inR ); | 3190 | remote->removeAddressee( inR ); |
3181 | inR = inL; | 3191 | inR = inL; |
3182 | inR.setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); | 3192 | inR.setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); |
3183 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 3193 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
3184 | inR.setOriginalExternalUID( OidS ); | 3194 | inR.setOriginalExternalUID( OidS ); |
3185 | inR.setExternalUID( idS ); | 3195 | inR.setExternalUID( idS ); |
3186 | if ( syncManager->syncWithDesktop() ) { | 3196 | if ( syncManager->syncWithDesktop() ) { |
3187 | inR.setIDStr("changed" ); | 3197 | inR.setIDStr("changed" ); |
3188 | } | 3198 | } |
3189 | //inR.insertCustom( "KADDRESSBOOK", "X-KDESYNC","changed" ); | 3199 | //inR.insertCustom( "KADDRESSBOOK", "X-KDESYNC","changed" ); |
3190 | } else { | 3200 | } else { |
3191 | inR.setIDStr( idS ); | 3201 | inR.setIDStr( idS ); |
3192 | } | 3202 | } |
3193 | inR.setResource( 0 ); | 3203 | inR.setResource( 0 ); |
3194 | remote->insertAddressee( inR , false); | 3204 | remote->insertAddressee( inR , false); |
3195 | ++changedRemote; | 3205 | ++changedRemote; |
3196 | } else { // take == 2 take remote ********************** | 3206 | } else { // take == 2 take remote ********************** |
3197 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 3207 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
3198 | if ( inR.revision().date().year() < 2004 ) | 3208 | if ( inR.revision().date().year() < 2004 ) |
3199 | inR.setRevision( modifiedCalendar ); | 3209 | inR.setRevision( modifiedCalendar ); |
3200 | } | 3210 | } |
3201 | idS = inL.IDStr(); | 3211 | idS = inL.IDStr(); |
3202 | local->removeAddressee( inL ); | 3212 | local->removeAddressee( inL ); |
3203 | inL = inR; | 3213 | inL = inR; |
3204 | inL.setIDStr( idS ); | 3214 | inL.setIDStr( idS ); |
3205 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 3215 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
3206 | inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); | 3216 | inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); |
3207 | inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); | 3217 | inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); |
3208 | } | 3218 | } |
3209 | inL.setResource( 0 ); | 3219 | inL.setResource( 0 ); |
3210 | local->insertAddressee( inL , false ); | 3220 | local->insertAddressee( inL , false ); |
3211 | ++changedLocal; | 3221 | ++changedLocal; |
3212 | } | 3222 | } |
3213 | } | 3223 | } |
3214 | } | 3224 | } |
3215 | } else { // no conflict ********** add or delete remote | 3225 | } else { // no conflict ********** add or delete remote |
3216 | if ( filterIN.name().isEmpty() || filterIN.filterAddressee( inR ) ) { | 3226 | if ( filterIN.name().isEmpty() || filterIN.filterAddressee( inR ) ) { |
3217 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 3227 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
3218 | QString des = addresseeLSync.note(); | 3228 | QString des = addresseeLSync.note(); |
3219 | if ( des.find( inR.getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it | 3229 | if ( des.find( inR.getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it |
3220 | inR.setTempSyncStat( SYNC_TEMPSTATE_DELETE ); | 3230 | inR.setTempSyncStat( SYNC_TEMPSTATE_DELETE ); |
3221 | remote->insertAddressee( inR, false ); | 3231 | remote->insertAddressee( inR, false ); |
3222 | ++deletedAddresseeR; | 3232 | ++deletedAddresseeR; |
3223 | } else { | 3233 | } else { |
3224 | inR.setRevision( modifiedCalendar ); | 3234 | inR.setRevision( modifiedCalendar ); |
3225 | remote->insertAddressee( inR, false ); | 3235 | remote->insertAddressee( inR, false ); |
3226 | inL = inR; | 3236 | inL = inR; |
3227 | inL.setIDStr( ":" ); | 3237 | inL.setIDStr( ":" ); |
3228 | inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); | 3238 | inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); |
3229 | inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); | 3239 | inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); |
3230 | inL.setResource( 0 ); | 3240 | inL.setResource( 0 ); |
3231 | local->insertAddressee( inL , false); | 3241 | local->insertAddressee( inL , false); |
3232 | ++addedAddressee; | 3242 | ++addedAddressee; |
3233 | } | 3243 | } |
3234 | } else { | 3244 | } else { |
3235 | if ( inR.revision() > mLastAddressbookSync || mode == 5 ) { | 3245 | if ( inR.revision() > mLastAddressbookSync || mode == 5 ) { |
3236 | inR.setRevision( modifiedCalendar ); | 3246 | inR.setRevision( modifiedCalendar ); |
3237 | remote->insertAddressee( inR, false ); | 3247 | remote->insertAddressee( inR, false ); |
3238 | inR.setResource( 0 ); | 3248 | inR.setResource( 0 ); |
3239 | local->insertAddressee( inR, false ); | 3249 | local->insertAddressee( inR, false ); |
3240 | ++addedAddressee; | 3250 | ++addedAddressee; |
3241 | } else { | 3251 | } else { |
3242 | // pending checkExternSyncAddressee(addresseeRSyncSharp, inR); | 3252 | // pending checkExternSyncAddressee(addresseeRSyncSharp, inR); |
3243 | remote->removeAddressee( inR ); | 3253 | remote->removeAddressee( inR ); |
3244 | ++deletedAddresseeR; | 3254 | ++deletedAddresseeR; |
3245 | } | 3255 | } |
3246 | } | 3256 | } |
3247 | } else { | 3257 | } else { |
3248 | ++filteredIN; | 3258 | ++filteredIN; |
3249 | } | 3259 | } |
3250 | } | 3260 | } |
3251 | } | 3261 | } |
3252 | ++incCounter; | 3262 | ++incCounter; |
3253 | } | 3263 | } |
3254 | er.clear(); | 3264 | er.clear(); |
3255 | QStringList el = local->uidList(); | 3265 | QStringList el = local->uidList(); |
3256 | modulo = (el.count()/10)+1; | 3266 | modulo = (el.count()/10)+1; |
3257 | 3267 | ||
3258 | syncManager->showProgressBar(0, i18n("Add / remove addressees"), el.count()); | 3268 | syncManager->showProgressBar(0, i18n("Add / remove addressees"), el.count()); |
3259 | incCounter = 0; | 3269 | incCounter = 0; |
3260 | while ( incCounter < el.count()) { | 3270 | while ( incCounter < el.count()) { |
3261 | qApp->processEvents(); | 3271 | qApp->processEvents(); |
3262 | if (syncManager->isProgressBarCanceled()) | 3272 | if (syncManager->isProgressBarCanceled()) |
3263 | return false; | 3273 | return false; |
3264 | if ( incCounter % modulo == 0 ) | 3274 | if ( incCounter % modulo == 0 ) |
3265 | syncManager->showProgressBar(incCounter); | 3275 | syncManager->showProgressBar(incCounter); |
3266 | uid = el[ incCounter ]; | 3276 | uid = el[ incCounter ]; |
3267 | bool skipIncidence = false; | 3277 | bool skipIncidence = false; |
3268 | if ( uid.left(19) == QString("last-syncAddressee-") ) | 3278 | if ( uid.left(19) == QString("last-syncAddressee-") ) |
3269 | skipIncidence = true; | 3279 | skipIncidence = true; |
3270 | if ( !skipIncidence ) { | 3280 | if ( !skipIncidence ) { |
3271 | inL = local->findByUid( uid ); | 3281 | inL = local->findByUid( uid ); |
3272 | if ( !inL.resource() || inL.resource()->includeInSync() ) { | 3282 | if ( !inL.resource() || inL.resource()->includeInSync() ) { |
3273 | inR = remote->findByUid( uid ); | 3283 | inR = remote->findByUid( uid ); |
3274 | if ( inR.isEmpty() ){ | 3284 | if ( inR.isEmpty() ){ |
3275 | if ( filterOUT.name().isEmpty() || filterOUT.filterAddressee( inL ) ) { | 3285 | if ( filterOUT.name().isEmpty() || filterOUT.filterAddressee( inL ) ) { |
3276 | // no conflict ********** add or delete local | 3286 | // no conflict ********** add or delete local |
3277 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 3287 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
3278 | if ( !inL.getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { | 3288 | if ( !inL.getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { |
3279 | // pending checkExternSyncAddressee(addresseeLSyncSharp, inL); | 3289 | // pending checkExternSyncAddressee(addresseeLSyncSharp, inL); |
3280 | local->removeAddressee( inL ); | 3290 | local->removeAddressee( inL ); |
3281 | ++deletedAddresseeL; | 3291 | ++deletedAddresseeL; |
3282 | } else { | 3292 | } else { |
3283 | if ( ! syncManager->mWriteBackExistingOnly ) { | 3293 | if ( ! syncManager->mWriteBackExistingOnly ) { |
3284 | inL.removeID(mCurrentSyncDevice ); | 3294 | inL.removeID(mCurrentSyncDevice ); |
3285 | ++addedAddresseeR; | 3295 | ++addedAddresseeR; |
3286 | inL.setRevision( modifiedCalendar ); | 3296 | inL.setRevision( modifiedCalendar ); |
3287 | local->insertAddressee( inL, false ); | 3297 | local->insertAddressee( inL, false ); |
3288 | inR = inL; | 3298 | inR = inL; |
3289 | inR.setTempSyncStat( SYNC_TEMPSTATE_ADDED_EXTERNAL ); | 3299 | inR.setTempSyncStat( SYNC_TEMPSTATE_ADDED_EXTERNAL ); |
3290 | inR.setResource( 0 ); | 3300 | inR.setResource( 0 ); |
3291 | remote->insertAddressee( inR, false ); | 3301 | remote->insertAddressee( inR, false ); |
3292 | } | 3302 | } |
3293 | } | 3303 | } |
3294 | } else { | 3304 | } else { |