author | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
commit | a08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (unidiff) | |
tree | 8ee90d686081c52e7c69b5ce946e9b1a7d690001 /kaddressbook/kabcore.cpp | |
parent | 11edc920afe4f274c0964436633aa632c8288a40 (diff) | |
download | kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.zip kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.gz kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.bz2 |
initial public commit of qt4 portp1
-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,334 +1,344 @@ | |||
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" ); |
@@ -346,375 +356,375 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const | |||
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; |
@@ -734,136 +744,136 @@ void KABCore::setContactSelected( const QString &uid ) | |||
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(); |
@@ -955,133 +965,133 @@ 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 ); |
@@ -1236,132 +1246,132 @@ 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 | { |
@@ -1795,384 +1805,384 @@ void KABCore::addGUIClient( KXMLGUIClient *client ) | |||
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, |
@@ -2185,159 +2195,159 @@ void KABCore::initActions() | |||
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 |
@@ -2570,225 +2580,225 @@ void KABCore::setFormattedName() | |||
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; |
@@ -2847,129 +2857,129 @@ void KABCore::requestForDetails(const QString& sourceChannel, const QString& ses | |||
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) ); |
@@ -3038,129 +3048,129 @@ int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, i | |||
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 )) ) { |