-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 | |||
@@ -18,277 +18,287 @@ | |||
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 |
@@ -386,122 +396,122 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const | |||
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 "); |
@@ -539,49 +549,49 @@ void KABCore::restoreSettings() | |||
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(); |
@@ -629,52 +639,52 @@ KConfig *KABCore::config() | |||
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> |
@@ -774,56 +784,56 @@ void KABCore::mailVCard() | |||
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 | */ |
@@ -995,53 +1005,53 @@ void KABCore::beamVCard(const QStringList& uids) | |||
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 ) |
@@ -1276,52 +1286,52 @@ void KABCore::addrModified( const KABC::Addressee &addr ,bool updateDetails ) | |||
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 ); |
@@ -1835,122 +1845,122 @@ AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, | |||
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 ); |
@@ -2013,126 +2023,126 @@ void KABCore::initGUI() | |||
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 |
@@ -2225,79 +2235,79 @@ void KABCore::initActions() | |||
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 |
@@ -2610,49 +2620,49 @@ void KABCore::updateActionMenu() | |||
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() ) { |
@@ -2706,49 +2716,49 @@ void KABCore::callContactdialog() | |||
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 | ||
@@ -2887,49 +2897,49 @@ void KABCore::multisynchowto() | |||
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 ) { |
@@ -3078,49 +3088,49 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo | |||
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" ) { |