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