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