summaryrefslogtreecommitdiffabout
path: root/kaddressbook
Unidiff
Diffstat (limited to 'kaddressbook') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp40
-rw-r--r--kaddressbook/kabcore.h2
-rw-r--r--kaddressbook/kcmconfigs/kcmkabconfig.h2
3 files changed, 30 insertions, 14 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index cba5850..cd833cf 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -1,610 +1,611 @@
1/* 1/*
2 This file is part of KAddressbook. 2 This file is part of KAddressbook.
3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> 3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 Async a special exception, permission is given to link this program 19 Async a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24/*s 24/*s
25Enhanced Version of the file for platform independent KDE tools. 25Enhanced Version of the file for platform independent KDE tools.
26Copyright (c) 2004 Ulf Schenk 26Copyright (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#include <kprefsdialog.h>
99 100
100 101
101//#include <qlabel.h> 102//#include <qlabel.h>
102 103
103 104
104#ifndef DESKTOP_VERSION 105#ifndef DESKTOP_VERSION
105#include <qpe/ir.h> 106#include <qpe/ir.h>
106#include <qpe/qpemenubar.h> 107#include <qpe/qpemenubar.h>
107#include <qtopia/qcopenvelope_qws.h> 108#include <qtopia/qcopenvelope_qws.h>
108#else 109#else
109 110
110#include <qmenubar.h> 111#include <qmenubar.h>
111#endif 112#endif
112 113
113#endif // KAB_EMBEDDED 114#endif // KAB_EMBEDDED
114#include "kcmconfigs/kcmkabconfig.h" 115#include "kcmconfigs/kcmkabconfig.h"
115#include "kcmconfigs/kcmkdepimconfig.h" 116#include "kcmconfigs/kcmkdepimconfig.h"
116#include "kpimglobalprefs.h" 117#include "kpimglobalprefs.h"
117#include "externalapphandler.h" 118#include "externalapphandler.h"
118#include "xxportselectdialog.h" 119#include "xxportselectdialog.h"
119 120
120 121
121#include <kresources/selectdialog.h> 122#include <kresources/selectdialog.h>
122#include <kmessagebox.h> 123#include <kmessagebox.h>
123 124
124#include <picture.h> 125#include <picture.h>
125#include <resource.h> 126#include <resource.h>
126 127
127//US#include <qsplitter.h> 128//US#include <qsplitter.h>
128#include <qmap.h> 129#include <qmap.h>
129#include <qdir.h> 130#include <qdir.h>
130#include <qfile.h> 131#include <qfile.h>
131#include <qvbox.h> 132#include <qvbox.h>
132#include <qlayout.h> 133#include <qlayout.h>
133#include <qclipboard.h> 134#include <qclipboard.h>
134#include <qtextstream.h> 135#include <qtextstream.h>
135#include <qradiobutton.h> 136#include <qradiobutton.h>
136#include <qbuttongroup.h> 137#include <qbuttongroup.h>
137 138
138#include <libkdepim/categoryselectdialog.h> 139#include <libkdepim/categoryselectdialog.h>
139#include <libkdepim/categoryeditdialog.h> 140#include <libkdepim/categoryeditdialog.h>
140#include <kabc/vcardconverter.h> 141#include <kabc/vcardconverter.h>
141 142
142 143
143#include "addresseeutil.h" 144#include "addresseeutil.h"
144#include "undocmds.h" 145#include "undocmds.h"
145#include "addresseeeditordialog.h" 146#include "addresseeeditordialog.h"
146#include "viewmanager.h" 147#include "viewmanager.h"
147#include "details/detailsviewcontainer.h" 148#include "details/detailsviewcontainer.h"
148#include "kabprefs.h" 149#include "kabprefs.h"
149#include "xxportmanager.h" 150#include "xxportmanager.h"
150#include "incsearchwidget.h" 151#include "incsearchwidget.h"
151#include "jumpbuttonbar.h" 152#include "jumpbuttonbar.h"
152#include "extensionmanager.h" 153#include "extensionmanager.h"
153#include "addresseeconfig.h" 154#include "addresseeconfig.h"
154#include "nameeditdialog.h" 155#include "nameeditdialog.h"
155#include <kcmultidialog.h> 156#include <kcmultidialog.h>
156 157
157#ifdef _WIN32_ 158#ifdef _WIN32_
158#ifdef _OL_IMPORT_ 159#ifdef _OL_IMPORT_
159#include "kaimportoldialog.h" 160#include "kaimportoldialog.h"
160#endif 161#endif
161#else 162#else
162#include <unistd.h> 163#include <unistd.h>
163#endif 164#endif
164// sync includes 165// sync includes
165#include <libkdepim/ksyncprofile.h> 166#include <libkdepim/ksyncprofile.h>
166#include <libkdepim/ksyncprefsdialog.h> 167#include <libkdepim/ksyncprefsdialog.h>
167 168
168 169
169class KABCatPrefs : public QDialog 170class KABCatPrefs : public QDialog
170{ 171{
171 public: 172 public:
172 KABCatPrefs( QWidget *parent=0, const char *name=0 ) : 173 KABCatPrefs( QWidget *parent=0, const char *name=0 ) :
173 QDialog( parent, name, true ) 174 QDialog( parent, name, true )
174 { 175 {
175 setCaption( i18n("Manage new Categories") ); 176 setCaption( i18n("Manage new Categories") );
176 QVBoxLayout* lay = new QVBoxLayout( this ); 177 QVBoxLayout* lay = new QVBoxLayout( this );
177 lay->setSpacing( 3 ); 178 lay->setSpacing( 3 );
178 lay->setMargin( 3 ); 179 lay->setMargin( 3 );
179 QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\naddressees\nwhich are not in the category list.\nPlease choose what to do:\n "), this ); 180 QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\naddressees\nwhich are not in the category list.\nPlease choose what to do:\n "), this );
180 lay->addWidget( lab ); 181 lay->addWidget( lab );
181 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); 182 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this );
182 lay->addWidget( format ); 183 lay->addWidget( format );
183 format->setExclusive ( true ) ; 184 format->setExclusive ( true ) ;
184 addCatBut = new QRadioButton(i18n("Add to category list"), format ); 185 addCatBut = new QRadioButton(i18n("Add to category list"), format );
185 new QRadioButton(i18n("Remove from addressees"), format ); 186 new QRadioButton(i18n("Remove from addressees"), format );
186 addCatBut->setChecked( true ); 187 addCatBut->setChecked( true );
187 QPushButton * ok = new QPushButton( i18n("OK"), this ); 188 QPushButton * ok = new QPushButton( i18n("OK"), this );
188 lay->addWidget( ok ); 189 lay->addWidget( ok );
189 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 190 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
190 lay->addWidget( cancel ); 191 lay->addWidget( cancel );
191 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 192 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
192 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 193 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
193 resize( 200, 200 ); 194 resize( 200, 200 );
194 } 195 }
195 196
196 bool addCat() { return addCatBut->isChecked(); } 197 bool addCat() { return addCatBut->isChecked(); }
197private: 198private:
198 QRadioButton* addCatBut; 199 QRadioButton* addCatBut;
199}; 200};
200 201
201class KABFormatPrefs : public QDialog 202class KABFormatPrefs : public QDialog
202{ 203{
203 public: 204 public:
204 KABFormatPrefs( QWidget *parent=0, const char *name=0 ) : 205 KABFormatPrefs( QWidget *parent=0, const char *name=0 ) :
205 QDialog( parent, name, true ) 206 QDialog( parent, name, true )
206 { 207 {
207 setCaption( i18n("Set formatted name") ); 208 setCaption( i18n("Set formatted name") );
208 QVBoxLayout* lay = new QVBoxLayout( this ); 209 QVBoxLayout* lay = new QVBoxLayout( this );
209 lay->setSpacing( 3 ); 210 lay->setSpacing( 3 );
210 lay->setMargin( 3 ); 211 lay->setMargin( 3 );
211 QLabel * lab = new QLabel( i18n("You can set the formatted name\nfor a list of contacts in one go."), this ); 212 QLabel * lab = new QLabel( i18n("You can set the formatted name\nfor a list of contacts in one go."), this );
212 lay->addWidget( lab ); 213 lay->addWidget( lab );
213 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("Set formatted name to:"), this ); 214 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("Set formatted name to:"), this );
214 lay->addWidget( format ); 215 lay->addWidget( format );
215 format->setExclusive ( true ) ; 216 format->setExclusive ( true ) ;
216 simple = new QRadioButton(i18n("Simple: James Bond"), format ); 217 simple = new QRadioButton(i18n("Simple: James Bond"), format );
217 full = new QRadioButton(i18n("Full: Mr. James 007 Bond I"), format ); 218 full = new QRadioButton(i18n("Full: Mr. James 007 Bond I"), format );
218 reverse = new QRadioButton(i18n("Reverse: Bond, James"), format ); 219 reverse = new QRadioButton(i18n("Reverse: Bond, James"), format );
219 company = new QRadioButton(i18n("Organization: MI6"), format ); 220 company = new QRadioButton(i18n("Organization: MI6"), format );
220 simple->setChecked( true ); 221 simple->setChecked( true );
221 setCompany = new QCheckBox(i18n("Set formatted name to\norganization, if name empty"), this); 222 setCompany = new QCheckBox(i18n("Set formatted name to\norganization, if name empty"), this);
222 lay->addWidget( setCompany ); 223 lay->addWidget( setCompany );
223 QPushButton * ok = new QPushButton( i18n("Select contact list"), this ); 224 QPushButton * ok = new QPushButton( i18n("Select contact list"), this );
224 lay->addWidget( ok ); 225 lay->addWidget( ok );
225 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 226 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
226 lay->addWidget( cancel ); 227 lay->addWidget( cancel );
227 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 228 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
228 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 229 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
229 //resize( 200, 200 ); 230 //resize( 200, 200 );
230 231
231 } 232 }
232public: 233public:
233 QRadioButton* simple, *full, *reverse, *company; 234 QRadioButton* simple, *full, *reverse, *company;
234 QCheckBox* setCompany; 235 QCheckBox* setCompany;
235}; 236};
236 237
237 238
238 239
239class KAex2phonePrefs : public QDialog 240class KAex2phonePrefs : public QDialog
240{ 241{
241 public: 242 public:
242 KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) : 243 KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) :
243 QDialog( parent, name, true ) 244 QDialog( parent, name, true )
244 { 245 {
245 setCaption( i18n("Export to phone options") ); 246 setCaption( i18n("Export to phone options") );
246 QVBoxLayout* lay = new QVBoxLayout( this ); 247 QVBoxLayout* lay = new QVBoxLayout( this );
247 lay->setSpacing( 3 ); 248 lay->setSpacing( 3 );
248 lay->setMargin( 3 ); 249 lay->setMargin( 3 );
249 QLabel *lab; 250 QLabel *lab;
250 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); 251 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) );
251 lab->setAlignment (AlignHCenter ); 252 lab->setAlignment (AlignHCenter );
252 QHBox* temphb; 253 QHBox* temphb;
253 temphb = new QHBox( this ); 254 temphb = new QHBox( this );
254 new QLabel( i18n("I/O device: "), temphb ); 255 new QLabel( i18n("I/O device: "), temphb );
255 mPhoneDevice = new QLineEdit( temphb); 256 mPhoneDevice = new QLineEdit( temphb);
256 lay->addWidget( temphb ); 257 lay->addWidget( temphb );
257 temphb = new QHBox( this ); 258 temphb = new QHBox( this );
258 new QLabel( i18n("Connection: "), temphb ); 259 new QLabel( i18n("Connection: "), temphb );
259 mPhoneConnection = new QLineEdit( temphb); 260 mPhoneConnection = new QLineEdit( temphb);
260 lay->addWidget( temphb ); 261 lay->addWidget( temphb );
261 temphb = new QHBox( this ); 262 temphb = new QHBox( this );
262 new QLabel( i18n("Model(opt.): "), temphb ); 263 new QLabel( i18n("Model(opt.): "), temphb );
263 mPhoneModel = new QLineEdit( temphb); 264 mPhoneModel = new QLineEdit( temphb);
264 lay->addWidget( temphb ); 265 lay->addWidget( temphb );
265 // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this ); 266 // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this );
266 // lay->addWidget( mWriteToSim ); 267 // lay->addWidget( mWriteToSim );
267 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) ); 268 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) );
268 lab->setAlignment (AlignHCenter); 269 lab->setAlignment (AlignHCenter);
269 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); 270 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
270 lay->addWidget( ok ); 271 lay->addWidget( ok );
271 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 272 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
272 lay->addWidget( cancel ); 273 lay->addWidget( cancel );
273 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 274 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
274 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 275 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
275 resize( 220, 240 ); 276 resize( 220, 240 );
276 277
277 } 278 }
278 279
279public: 280public:
280 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; 281 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
281 QCheckBox* mWriteToSim; 282 QCheckBox* mWriteToSim;
282}; 283};
283 284
284 285
285bool pasteWithNewUid = true; 286bool pasteWithNewUid = true;
286 287
287#ifdef KAB_EMBEDDED 288#ifdef KAB_EMBEDDED
288KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) 289KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name )
289 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), 290 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ),
290 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ 291 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/
291 mReadWrite( readWrite ), mModified( false ), mMainWindow(client) 292 mReadWrite( readWrite ), mModified( false ), mMainWindow(client)
292#else //KAB_EMBEDDED 293#else //KAB_EMBEDDED
293KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) 294KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name )
294 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), 295 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ),
295 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), 296 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ),
296 mReadWrite( readWrite ), mModified( false ) 297 mReadWrite( readWrite ), mModified( false )
297#endif //KAB_EMBEDDED 298#endif //KAB_EMBEDDED
298{ 299{
299 // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); 300 // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu);
300 // syncManager->setBlockSave(false); 301 // syncManager->setBlockSave(false);
301 mIncSearchWidget = 0; 302 mIncSearchWidget = 0;
302 mMiniSplitter = 0; 303 mMiniSplitter = 0;
303 mExtensionBarSplitter = 0; 304 mExtensionBarSplitter = 0;
304 mIsPart = !parent->inherits( "KAddressBookMain" ); 305 mIsPart = !parent->inherits( "KAddressBookMain" );
305 mAddressBook = KABC::StdAddressBook::self(); 306 mAddressBook = KABC::StdAddressBook::self();
306 KABC::StdAddressBook::setAutomaticSave( false ); 307 KABC::StdAddressBook::setAutomaticSave( false );
307 308
308#ifndef KAB_EMBEDDED 309#ifndef KAB_EMBEDDED
309 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); 310 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler );
310#endif //KAB_EMBEDDED 311#endif //KAB_EMBEDDED
311 312
312 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), 313 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ),
313 SLOT( addressBookChanged() ) ); 314 SLOT( addressBookChanged() ) );
314 315
315#if 0 316#if 0
316 // LR moved to addressbook init method 317 // LR moved to addressbook init method
317 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, 318 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization,
318 "X-Department", "KADDRESSBOOK" ); 319 "X-Department", "KADDRESSBOOK" );
319 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, 320 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization,
320 "X-Profession", "KADDRESSBOOK" ); 321 "X-Profession", "KADDRESSBOOK" );
321 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, 322 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization,
322 "X-AssistantsName", "KADDRESSBOOK" ); 323 "X-AssistantsName", "KADDRESSBOOK" );
323 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, 324 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization,
324 "X-ManagersName", "KADDRESSBOOK" ); 325 "X-ManagersName", "KADDRESSBOOK" );
325 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, 326 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal,
326 "X-SpousesName", "KADDRESSBOOK" ); 327 "X-SpousesName", "KADDRESSBOOK" );
327 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, 328 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal,
328 "X-Office", "KADDRESSBOOK" ); 329 "X-Office", "KADDRESSBOOK" );
329 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, 330 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal,
330 "X-IMAddress", "KADDRESSBOOK" ); 331 "X-IMAddress", "KADDRESSBOOK" );
331 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, 332 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal,
332 "X-Anniversary", "KADDRESSBOOK" ); 333 "X-Anniversary", "KADDRESSBOOK" );
333 334
334 //US added this field to become compatible with Opie/qtopia addressbook 335 //US added this field to become compatible with Opie/qtopia addressbook
335 // values can be "female" or "male" or "". An empty field represents undefined. 336 // values can be "female" or "male" or "". An empty field represents undefined.
336 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, 337 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal,
337 "X-Gender", "KADDRESSBOOK" ); 338 "X-Gender", "KADDRESSBOOK" );
338 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, 339 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal,
339 "X-Children", "KADDRESSBOOK" ); 340 "X-Children", "KADDRESSBOOK" );
340 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, 341 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal,
341 "X-FreeBusyUrl", "KADDRESSBOOK" ); 342 "X-FreeBusyUrl", "KADDRESSBOOK" );
342#endif 343#endif
343 initGUI(); 344 initGUI();
344 345
345 mIncSearchWidget->setFocus(); 346 mIncSearchWidget->setFocus();
346 347
347 348
348 connect( mViewManager, SIGNAL( selected( const QString& ) ), 349 connect( mViewManager, SIGNAL( selected( const QString& ) ),
349 SLOT( setContactSelected( const QString& ) ) ); 350 SLOT( setContactSelected( const QString& ) ) );
350 connect( mViewManager, SIGNAL( executed( const QString& ) ), 351 connect( mViewManager, SIGNAL( executed( const QString& ) ),
351 SLOT( executeContact( const QString& ) ) ); 352 SLOT( executeContact( const QString& ) ) );
352 353
353 connect( mViewManager, SIGNAL( deleteRequest( ) ), 354 connect( mViewManager, SIGNAL( deleteRequest( ) ),
354 SLOT( deleteContacts( ) ) ); 355 SLOT( deleteContacts( ) ) );
355 connect( mViewManager, SIGNAL( modified() ), 356 connect( mViewManager, SIGNAL( modified() ),
356 SLOT( setModified() ) ); 357 SLOT( setModified() ) );
357 358
358 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); 359 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) );
359 connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); 360 connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) );
360 361
361 connect( mXXPortManager, SIGNAL( modified() ), 362 connect( mXXPortManager, SIGNAL( modified() ),
362 SLOT( setModified() ) ); 363 SLOT( setModified() ) );
363 364
364 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), 365 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ),
365 SLOT( incrementalSearchJump( const QString& ) ) ); 366 SLOT( incrementalSearchJump( const QString& ) ) );
366 connect( mIncSearchWidget, SIGNAL( fieldChanged() ), 367 connect( mIncSearchWidget, SIGNAL( fieldChanged() ),
367 mJumpButtonBar, SLOT( recreateButtons() ) ); 368 mJumpButtonBar, SLOT( recreateButtons() ) );
368 369
369 connect( mDetails, SIGNAL( sendEmail( const QString& ) ), 370 connect( mDetails, SIGNAL( sendEmail( const QString& ) ),
370 SLOT( sendMail( const QString& ) ) ); 371 SLOT( sendMail( const QString& ) ) );
371 372
372 373
373 connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); 374 connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&)));
374 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&))); 375 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&)));
375 connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&))); 376 connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&)));
376 connect( ExternalAppHandler::instance(), SIGNAL (nextView()),this, SLOT(setDetailsToggle())); 377 connect( ExternalAppHandler::instance(), SIGNAL (nextView()),this, SLOT(setDetailsToggle()));
377 connect( ExternalAppHandler::instance(), SIGNAL (callContactdialog()),this, SLOT(callContactdialog())); 378 connect( ExternalAppHandler::instance(), SIGNAL (callContactdialog()),this, SLOT(callContactdialog()));
378 379
379 380
380#ifndef KAB_EMBEDDED 381#ifndef KAB_EMBEDDED
381 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), 382 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ),
382 mXXPortManager, SLOT( importVCard( const KURL& ) ) ); 383 mXXPortManager, SLOT( importVCard( const KURL& ) ) );
383 384
384 connect( mDetails, SIGNAL( browse( const QString& ) ), 385 connect( mDetails, SIGNAL( browse( const QString& ) ),
385 SLOT( browse( const QString& ) ) ); 386 SLOT( browse( const QString& ) ) );
386 387
387 388
388 mAddressBookService = new KAddressBookService( this ); 389 mAddressBookService = new KAddressBookService( this );
389 390
390#endif //KAB_EMBEDDED 391#endif //KAB_EMBEDDED
391 392
392 mMessageTimer = new QTimer( this ); 393 mMessageTimer = new QTimer( this );
393 connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) ); 394 connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) );
394 mEditorDialog = 0; 395 mEditorDialog = 0;
395 createAddresseeEditorDialog( this ); 396 createAddresseeEditorDialog( this );
396 setModified( false ); 397 setModified( false );
397 mBRdisabled = false; 398 mBRdisabled = false;
398#ifndef DESKTOP_VERSION 399#ifndef DESKTOP_VERSION
399 infrared = 0; 400 infrared = 0;
400#endif 401#endif
401 //toggleBeamReceive( ); 402 //toggleBeamReceive( );
402 mMainWindow->toolBar()->show(); 403 mMainWindow->toolBar()->show();
403 // we have a toolbar repainting error on the Zaurus when starting KA/Pi 404 // we have a toolbar repainting error on the Zaurus when starting KA/Pi
404 QTimer::singleShot( 10, this , SLOT ( updateToolBar())); 405 QTimer::singleShot( 10, this , SLOT ( updateToolBar()));
405} 406}
406 407
407void KABCore::updateToolBar() 408void KABCore::updateToolBar()
408{ 409{
409 static int iii = 0; 410 static int iii = 0;
410 ++iii; 411 ++iii;
411 mMainWindow->toolBar()->repaintMe(); 412 mMainWindow->toolBar()->repaintMe();
412 if ( iii < 4 ) 413 if ( iii < 4 )
413 QTimer::singleShot( 100*iii, this , SLOT ( updateToolBar())); 414 QTimer::singleShot( 100*iii, this , SLOT ( updateToolBar()));
414} 415}
415KABCore::~KABCore() 416KABCore::~KABCore()
416{ 417{
417 // save(); 418 // save();
418 //saveSettings(); 419 //saveSettings();
419 //KABPrefs::instance()->writeConfig(); 420 //KABPrefs::instance()->writeConfig();
420 delete AddresseeConfig::instance(); 421 delete AddresseeConfig::instance();
421 mAddressBook = 0; 422 mAddressBook = 0;
422 KABC::StdAddressBook::close(); 423 KABC::StdAddressBook::close();
423 424
424 delete syncManager; 425 delete syncManager;
425#ifndef DESKTOP_VERSION 426#ifndef DESKTOP_VERSION
426 if ( infrared ) 427 if ( infrared )
427 delete infrared; 428 delete infrared;
428#endif 429#endif
429} 430}
430void KABCore::receive( const QCString& cmsg, const QByteArray& data ) 431void KABCore::receive( const QCString& cmsg, const QByteArray& data )
431{ 432{
432 //qDebug("KA: QCOP message received: %s ", cmsg.data() ); 433 //qDebug("KA: QCOP message received: %s ", cmsg.data() );
433 if ( cmsg == "setDocument(QString)" ) { 434 if ( cmsg == "setDocument(QString)" ) {
434 QDataStream stream( data, IO_ReadOnly ); 435 QDataStream stream( data, IO_ReadOnly );
435 QString fileName; 436 QString fileName;
436 stream >> fileName; 437 stream >> fileName;
437 recieve( fileName ); 438 recieve( fileName );
438 return; 439 return;
439 } 440 }
440} 441}
441void KABCore::toggleBeamReceive( ) 442void KABCore::toggleBeamReceive( )
442{ 443{
443 if ( mBRdisabled ) 444 if ( mBRdisabled )
444 return; 445 return;
445#ifndef DESKTOP_VERSION 446#ifndef DESKTOP_VERSION
446 if ( infrared ) { 447 if ( infrared ) {
447 qDebug("KA: AB disable BeamReceive "); 448 qDebug("KA: AB disable BeamReceive ");
448 delete infrared; 449 delete infrared;
449 infrared = 0; 450 infrared = 0;
450 mActionBR->setChecked(false); 451 mActionBR->setChecked(false);
451 return; 452 return;
452 } 453 }
453 qDebug("KA: AB enable BeamReceive "); 454 qDebug("KA: AB enable BeamReceive ");
454 mActionBR->setChecked(true); 455 mActionBR->setChecked(true);
455 456
456 infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ; 457 infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ;
457 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& ))); 458 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& )));
458#endif 459#endif
459} 460}
460 461
461 462
462void KABCore::disableBR(bool b) 463void KABCore::disableBR(bool b)
463{ 464{
464#ifndef DESKTOP_VERSION 465#ifndef DESKTOP_VERSION
465 if ( b ) { 466 if ( b ) {
466 if ( infrared ) { 467 if ( infrared ) {
467 toggleBeamReceive( ); 468 toggleBeamReceive( );
468 } 469 }
469 mBRdisabled = true; 470 mBRdisabled = true;
470 } else { 471 } else {
471 if ( mBRdisabled ) { 472 if ( mBRdisabled ) {
472 mBRdisabled = false; 473 mBRdisabled = false;
473 //toggleBeamReceive( ); 474 //toggleBeamReceive( );
474 } 475 }
475 } 476 }
476#endif 477#endif
477 478
478} 479}
479void KABCore::recieve( QString fn ) 480void KABCore::recieve( QString fn )
480{ 481{
481 //qDebug("KABCore::recieve "); 482 //qDebug("KABCore::recieve ");
482 int count = mAddressBook->importFromFile( fn, true ); 483 int count = mAddressBook->importFromFile( fn, true );
483 if ( count ) 484 if ( count )
484 setModified( true ); 485 setModified( true );
485 mViewManager->refreshView(); 486 mViewManager->refreshView();
486 message(i18n("%1 contact(s) received!").arg( count )); 487 message(i18n("%1 contact(s) received!").arg( count ));
487 topLevelWidget()->showMaximized(); 488 topLevelWidget()->showMaximized();
488 topLevelWidget()->raise(); 489 topLevelWidget()->raise();
489} 490}
490void KABCore::restoreSettings() 491void KABCore::restoreSettings()
491{ 492{
492 mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; 493 mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce;
493 494
494 bool state; 495 bool state;
495 496
496 if (mMultipleViewsAtOnce) 497 if (mMultipleViewsAtOnce)
497 state = KABPrefs::instance()->mDetailsPageVisible; 498 state = KABPrefs::instance()->mDetailsPageVisible;
498 else 499 else
499 state = false; 500 state = false;
500 501
501 mActionDetails->setChecked( state ); 502 mActionDetails->setChecked( state );
502 setDetailsVisible( state ); 503 setDetailsVisible( state );
503 504
504 state = KABPrefs::instance()->mJumpButtonBarVisible; 505 state = KABPrefs::instance()->mJumpButtonBarVisible;
505 506
506 mActionJumpBar->setChecked( state ); 507 mActionJumpBar->setChecked( state );
507 setJumpButtonBarVisible( state ); 508 setJumpButtonBarVisible( state );
508/*US 509/*US
509 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; 510 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter;
510 if ( splitterSize.count() == 0 ) { 511 if ( splitterSize.count() == 0 ) {
511 splitterSize.append( width() / 2 ); 512 splitterSize.append( width() / 2 );
512 splitterSize.append( width() / 2 ); 513 splitterSize.append( width() / 2 );
513 } 514 }
514 mMiniSplitter->setSizes( splitterSize ); 515 mMiniSplitter->setSizes( splitterSize );
515 if ( mExtensionBarSplitter ) { 516 if ( mExtensionBarSplitter ) {
516 splitterSize = KABPrefs::instance()->mExtensionsSplitter; 517 splitterSize = KABPrefs::instance()->mExtensionsSplitter;
517 if ( splitterSize.count() == 0 ) { 518 if ( splitterSize.count() == 0 ) {
518 splitterSize.append( width() / 2 ); 519 splitterSize.append( width() / 2 );
519 splitterSize.append( width() / 2 ); 520 splitterSize.append( width() / 2 );
520 } 521 }
521 mExtensionBarSplitter->setSizes( splitterSize ); 522 mExtensionBarSplitter->setSizes( splitterSize );
522 523
523 } 524 }
524*/ 525*/
525 mViewManager->restoreSettings(); 526 mViewManager->restoreSettings();
526 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); 527 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField );
527 mExtensionManager->restoreSettings(); 528 mExtensionManager->restoreSettings();
528#ifdef DESKTOP_VERSION 529#ifdef DESKTOP_VERSION
529 int wid = width(); 530 int wid = width();
530 if ( wid < 10 ) 531 if ( wid < 10 )
531 wid = 400; 532 wid = 400;
532#else 533#else
533 int wid = QApplication::desktop()->width(); 534 int wid = QApplication::desktop()->width();
534 if ( wid < 640 ) 535 if ( wid < 640 )
535 wid = QApplication::desktop()->height(); 536 wid = QApplication::desktop()->height();
536#endif 537#endif
537 QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; 538 QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter;
538 if ( true /*splitterSize.count() == 0*/ ) { 539 if ( true /*splitterSize.count() == 0*/ ) {
539 splitterSize.append( wid / 2 ); 540 splitterSize.append( wid / 2 );
540 splitterSize.append( wid / 2 ); 541 splitterSize.append( wid / 2 );
541 } 542 }
542 mMiniSplitter->setSizes( splitterSize ); 543 mMiniSplitter->setSizes( splitterSize );
543 if ( mExtensionBarSplitter ) { 544 if ( mExtensionBarSplitter ) {
544 //splitterSize = KABPrefs::instance()->mExtensionsSplitter; 545 //splitterSize = KABPrefs::instance()->mExtensionsSplitter;
545 if ( true /*splitterSize.count() == 0*/ ) { 546 if ( true /*splitterSize.count() == 0*/ ) {
546 splitterSize.append( wid / 2 ); 547 splitterSize.append( wid / 2 );
547 splitterSize.append( wid / 2 ); 548 splitterSize.append( wid / 2 );
548 } 549 }
549 mExtensionBarSplitter->setSizes( splitterSize ); 550 mExtensionBarSplitter->setSizes( splitterSize );
550 551
551 } 552 }
552#ifdef DESKTOP_VERSION 553#ifdef DESKTOP_VERSION
553 KConfig *config = KABPrefs::instance()->getConfig(); 554 KConfig *config = KABPrefs::instance()->getConfig();
554 config->setGroup("WidgetLayout"); 555 config->setGroup("WidgetLayout");
555 QStringList list; 556 QStringList list;
556 list = config->readListEntry("MainLayout"); 557 list = config->readListEntry("MainLayout");
557 int x,y,w,h; 558 int x,y,w,h;
558 if ( ! list.isEmpty() ) { 559 if ( ! list.isEmpty() ) {
559 x = list[0].toInt(); 560 x = list[0].toInt();
560 y = list[1].toInt(); 561 y = list[1].toInt();
561 w = list[2].toInt(); 562 w = list[2].toInt();
562 h = list[3].toInt(); 563 h = list[3].toInt();
563 KApplication::testCoords( &x,&y,&w,&h ); 564 KApplication::testCoords( &x,&y,&w,&h );
564 topLevelWidget()->setGeometry(x,y,w,h); 565 topLevelWidget()->setGeometry(x,y,w,h);
565 566
566 } else { 567 } else {
567 topLevelWidget()->setGeometry( 40 ,40 , 640, 440); 568 topLevelWidget()->setGeometry( 40 ,40 , 640, 440);
568 } 569 }
569#endif 570#endif
570} 571}
571 572
572void KABCore::saveSettings() 573void KABCore::saveSettings()
573{ 574{
574 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); 575 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked();
575 if ( mExtensionBarSplitter ) 576 if ( mExtensionBarSplitter )
576 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 577 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
577 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); 578 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked();
578 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); 579 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes();
579#ifndef KAB_EMBEDDED 580#ifndef KAB_EMBEDDED
580 581
581 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 582 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
582 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); 583 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes();
583#endif //KAB_EMBEDDED 584#endif //KAB_EMBEDDED
584 mExtensionManager->saveSettings(); 585 mExtensionManager->saveSettings();
585 mViewManager->saveSettings(); 586 mViewManager->saveSettings();
586 587
587 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); 588 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem();
588 589
589 KABPrefs::instance()->writeConfig(); 590 KABPrefs::instance()->writeConfig();
590 qDebug("KA: KABCore::saveSettings() "); 591 qDebug("KA: KABCore::saveSettings() ");
591} 592}
592 593
593KABC::AddressBook *KABCore::addressBook() const 594KABC::AddressBook *KABCore::addressBook() const
594{ 595{
595 return mAddressBook; 596 return mAddressBook;
596} 597}
597 598
598KConfig *KABCore::config() 599KConfig *KABCore::config()
599{ 600{
600#ifndef KAB_EMBEDDED 601#ifndef KAB_EMBEDDED
601 return KABPrefs::instance()->config(); 602 return KABPrefs::instance()->config();
602#else //KAB_EMBEDDED 603#else //KAB_EMBEDDED
603 return KABPrefs::instance()->getConfig(); 604 return KABPrefs::instance()->getConfig();
604#endif //KAB_EMBEDDED 605#endif //KAB_EMBEDDED
605} 606}
606 607
607KActionCollection *KABCore::actionCollection() const 608KActionCollection *KABCore::actionCollection() const
608{ 609{
609 return mGUIClient->actionCollection(); 610 return mGUIClient->actionCollection();
610} 611}
@@ -1102,1658 +1103,1671 @@ void KABCore::editCategories()
1102{ 1103{
1103 KPIM::CategoryEditDialog dlg ( KABPrefs::instance(), this, "", true ); 1104 KPIM::CategoryEditDialog dlg ( KABPrefs::instance(), this, "", true );
1104 dlg.exec(); 1105 dlg.exec();
1105} 1106}
1106void KABCore::setCategories() 1107void KABCore::setCategories()
1107{ 1108{
1108 1109
1109 QStringList uids; 1110 QStringList uids;
1110 XXPortSelectDialog dlgx( this, false, this ); 1111 XXPortSelectDialog dlgx( this, false, this );
1111 if ( dlgx.exec() ) 1112 if ( dlgx.exec() )
1112 uids = dlgx.uids(); 1113 uids = dlgx.uids();
1113 else 1114 else
1114 return; 1115 return;
1115 if ( uids.isEmpty() ) 1116 if ( uids.isEmpty() )
1116 return; 1117 return;
1117 // qDebug("count %d ", uids.count()); 1118 // qDebug("count %d ", uids.count());
1118 1119
1119 1120
1120 KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true ); 1121 KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true );
1121 if ( !dlg.exec() ) { 1122 if ( !dlg.exec() ) {
1122 message( i18n("Setting categories cancelled") ); 1123 message( i18n("Setting categories cancelled") );
1123 return; 1124 return;
1124 } 1125 }
1125 bool merge = false; 1126 bool merge = false;
1126 QString msg = i18n( "Merge with existing categories?" ); 1127 QString msg = i18n( "Merge with existing categories?" );
1127 if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes ) 1128 if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes )
1128 merge = true; 1129 merge = true;
1129 1130
1130 message( i18n("Setting categories ... please wait!") ); 1131 message( i18n("Setting categories ... please wait!") );
1131 QStringList categories = dlg.selectedCategories(); 1132 QStringList categories = dlg.selectedCategories();
1132 1133
1133 //QStringList uids = mViewManager->selectedUids(); 1134 //QStringList uids = mViewManager->selectedUids();
1134 QStringList::Iterator it; 1135 QStringList::Iterator it;
1135 for ( it = uids.begin(); it != uids.end(); ++it ) { 1136 for ( it = uids.begin(); it != uids.end(); ++it ) {
1136 KABC::Addressee addr = mAddressBook->findByUid( *it ); 1137 KABC::Addressee addr = mAddressBook->findByUid( *it );
1137 if ( !addr.isEmpty() ) { 1138 if ( !addr.isEmpty() ) {
1138 if ( !merge ) 1139 if ( !merge )
1139 addr.setCategories( categories ); 1140 addr.setCategories( categories );
1140 else { 1141 else {
1141 QStringList addrCategories = addr.categories(); 1142 QStringList addrCategories = addr.categories();
1142 QStringList::Iterator catIt; 1143 QStringList::Iterator catIt;
1143 for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) { 1144 for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) {
1144 if ( !addrCategories.contains( *catIt ) ) 1145 if ( !addrCategories.contains( *catIt ) )
1145 addrCategories.append( *catIt ); 1146 addrCategories.append( *catIt );
1146 } 1147 }
1147 addr.setCategories( addrCategories ); 1148 addr.setCategories( addrCategories );
1148 } 1149 }
1149 mAddressBook->insertAddressee( addr ); 1150 mAddressBook->insertAddressee( addr );
1150 } 1151 }
1151 } 1152 }
1152 1153
1153 if ( uids.count() > 0 ) 1154 if ( uids.count() > 0 )
1154 setModified( true ); 1155 setModified( true );
1155 message( i18n("Setting categories completed!") ); 1156 message( i18n("Setting categories completed!") );
1156} 1157}
1157 1158
1158void KABCore::setSearchFields( const KABC::Field::List &fields ) 1159void KABCore::setSearchFields( const KABC::Field::List &fields )
1159{ 1160{
1160 mIncSearchWidget->setFields( fields ); 1161 mIncSearchWidget->setFields( fields );
1161} 1162}
1162 1163
1163void KABCore::incrementalSearch( const QString& text ) 1164void KABCore::incrementalSearch( const QString& text )
1164{ 1165{
1165 QString stext; 1166 QString stext;
1166 if ( KABPrefs::instance()->mAutoSearchWithWildcard ) { 1167 if ( KABPrefs::instance()->mAutoSearchWithWildcard ) {
1167 stext = "*" + text; 1168 stext = "*" + text;
1168 } else { 1169 } else {
1169 stext = text; 1170 stext = text;
1170 } 1171 }
1171 mViewManager->doSearch( stext, mIncSearchWidget->currentField() ); 1172 mViewManager->doSearch( stext, mIncSearchWidget->currentField() );
1172} 1173}
1173void KABCore::incrementalSearchJump( const QString& text ) 1174void KABCore::incrementalSearchJump( const QString& text )
1174{ 1175{
1175 mViewManager->doSearch( text, mIncSearchWidget->currentField() ); 1176 mViewManager->doSearch( text, mIncSearchWidget->currentField() );
1176} 1177}
1177 1178
1178void KABCore::setModified() 1179void KABCore::setModified()
1179{ 1180{
1180 setModified( true ); 1181 setModified( true );
1181} 1182}
1182 1183
1183void KABCore::setModifiedWOrefresh() 1184void KABCore::setModifiedWOrefresh()
1184{ 1185{
1185 // qDebug("KABCore::setModifiedWOrefresh() "); 1186 // qDebug("KABCore::setModifiedWOrefresh() ");
1186 mModified = true; 1187 mModified = true;
1187 mActionSave->setEnabled( mModified ); 1188 mActionSave->setEnabled( mModified );
1188 1189
1189 1190
1190} 1191}
1191void KABCore::setModified( bool modified ) 1192void KABCore::setModified( bool modified )
1192{ 1193{
1193 mModified = modified; 1194 mModified = modified;
1194 mActionSave->setEnabled( mModified ); 1195 mActionSave->setEnabled( mModified );
1195 1196
1196 if ( modified ) 1197 if ( modified )
1197 mJumpButtonBar->recreateButtons(); 1198 mJumpButtonBar->recreateButtons();
1198 1199
1199 mViewManager->refreshView(); 1200 mViewManager->refreshView();
1200 1201
1201} 1202}
1202 1203
1203bool KABCore::modified() const 1204bool KABCore::modified() const
1204{ 1205{
1205 return mModified; 1206 return mModified;
1206} 1207}
1207 1208
1208void KABCore::contactModified( const KABC::Addressee &addr ) 1209void KABCore::contactModified( const KABC::Addressee &addr )
1209{ 1210{
1210 addrModified( addr ); 1211 addrModified( addr );
1211#if 0 // debug only 1212#if 0 // debug only
1212 KABC::Addressee ad = addr; 1213 KABC::Addressee ad = addr;
1213 ad.computeCsum( "123"); 1214 ad.computeCsum( "123");
1214#endif 1215#endif
1215} 1216}
1216 1217
1217void KABCore::addrModified( const KABC::Addressee &addr ,bool updateDetails ) 1218void KABCore::addrModified( const KABC::Addressee &addr ,bool updateDetails )
1218{ 1219{
1219 1220
1220 Command *command = 0; 1221 Command *command = 0;
1221 QString uid; 1222 QString uid;
1222 1223
1223 // check if it exists already 1224 // check if it exists already
1224 KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() ); 1225 KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() );
1225 if ( origAddr.isEmpty() ) 1226 if ( origAddr.isEmpty() )
1226 command = new PwNewCommand( mAddressBook, addr ); 1227 command = new PwNewCommand( mAddressBook, addr );
1227 else { 1228 else {
1228 command = new PwEditCommand( mAddressBook, origAddr, addr ); 1229 command = new PwEditCommand( mAddressBook, origAddr, addr );
1229 uid = addr.uid(); 1230 uid = addr.uid();
1230 } 1231 }
1231 1232
1232 UndoStack::instance()->push( command ); 1233 UndoStack::instance()->push( command );
1233 RedoStack::instance()->clear(); 1234 RedoStack::instance()->clear();
1234 if ( updateDetails ) 1235 if ( updateDetails )
1235 mDetails->setAddressee( addr ); 1236 mDetails->setAddressee( addr );
1236 setModified( true ); 1237 setModified( true );
1237} 1238}
1238 1239
1239void KABCore::newContact() 1240void KABCore::newContact()
1240{ 1241{
1241 1242
1242 1243
1243 QPtrList<KABC::Resource> kabcResources = mAddressBook->resources(); 1244 QPtrList<KABC::Resource> kabcResources = mAddressBook->resources();
1244 1245
1245 QPtrList<KRES::Resource> kresResources; 1246 QPtrList<KRES::Resource> kresResources;
1246 QPtrListIterator<KABC::Resource> it( kabcResources ); 1247 QPtrListIterator<KABC::Resource> it( kabcResources );
1247 KABC::Resource *resource; 1248 KABC::Resource *resource;
1248 while ( ( resource = it.current() ) != 0 ) { 1249 while ( ( resource = it.current() ) != 0 ) {
1249 ++it; 1250 ++it;
1250 if ( !resource->readOnly() ) { 1251 if ( !resource->readOnly() ) {
1251 KRES::Resource *res = static_cast<KRES::Resource*>( resource ); 1252 KRES::Resource *res = static_cast<KRES::Resource*>( resource );
1252 if ( res ) 1253 if ( res )
1253 kresResources.append( res ); 1254 kresResources.append( res );
1254 } 1255 }
1255 } 1256 }
1256 1257
1257 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); 1258 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this );
1258 resource = static_cast<KABC::Resource*>( res ); 1259 resource = static_cast<KABC::Resource*>( res );
1259 1260
1260 if ( resource ) { 1261 if ( resource ) {
1261 KABC::Addressee addr; 1262 KABC::Addressee addr;
1262 addr.setResource( resource ); 1263 addr.setResource( resource );
1263 mEditorDialog->setAddressee( addr ); 1264 mEditorDialog->setAddressee( addr );
1264 mEditorDialog->setCaption( i18n("Edit new contact")); 1265 mEditorDialog->setCaption( i18n("Edit new contact"));
1265 KApplication::execDialog ( mEditorDialog ); 1266 KApplication::execDialog ( mEditorDialog );
1266 1267
1267 } else 1268 } else
1268 return; 1269 return;
1269 1270
1270 // mEditorDict.insert( dialog->addressee().uid(), dialog ); 1271 // mEditorDict.insert( dialog->addressee().uid(), dialog );
1271 1272
1272 1273
1273} 1274}
1274 1275
1275void KABCore::addEmail( QString aStr ) 1276void KABCore::addEmail( QString aStr )
1276{ 1277{
1277#ifndef KAB_EMBEDDED 1278#ifndef KAB_EMBEDDED
1278 QString fullName, email; 1279 QString fullName, email;
1279 1280
1280 KABC::Addressee::parseEmailAddress( aStr, fullName, email ); 1281 KABC::Addressee::parseEmailAddress( aStr, fullName, email );
1281 1282
1282 // Try to lookup the addressee matching the email address 1283 // Try to lookup the addressee matching the email address
1283 bool found = false; 1284 bool found = false;
1284 QStringList emailList; 1285 QStringList emailList;
1285 KABC::AddressBook::Iterator it; 1286 KABC::AddressBook::Iterator it;
1286 for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) { 1287 for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) {
1287 emailList = (*it).emails(); 1288 emailList = (*it).emails();
1288 if ( emailList.contains( email ) > 0 ) { 1289 if ( emailList.contains( email ) > 0 ) {
1289 found = true; 1290 found = true;
1290 (*it).setNameFromString( fullName ); 1291 (*it).setNameFromString( fullName );
1291 editContact( (*it).uid() ); 1292 editContact( (*it).uid() );
1292 } 1293 }
1293 } 1294 }
1294 1295
1295 if ( !found ) { 1296 if ( !found ) {
1296 KABC::Addressee addr; 1297 KABC::Addressee addr;
1297 addr.setNameFromString( fullName ); 1298 addr.setNameFromString( fullName );
1298 addr.insertEmail( email, true ); 1299 addr.insertEmail( email, true );
1299 1300
1300 mAddressBook->insertAddressee( addr ); 1301 mAddressBook->insertAddressee( addr );
1301 mViewManager->refreshView( addr.uid() ); 1302 mViewManager->refreshView( addr.uid() );
1302 editContact( addr.uid() ); 1303 editContact( addr.uid() );
1303 } 1304 }
1304#else //KAB_EMBEDDED 1305#else //KAB_EMBEDDED
1305 qDebug("KABCore::addEmail finsih method"); 1306 qDebug("KABCore::addEmail finsih method");
1306#endif //KAB_EMBEDDED 1307#endif //KAB_EMBEDDED
1307} 1308}
1308 1309
1309void KABCore::importVCard( const KURL &url, bool showPreview ) 1310void KABCore::importVCard( const KURL &url, bool showPreview )
1310{ 1311{
1311 mXXPortManager->importVCard( url, showPreview ); 1312 mXXPortManager->importVCard( url, showPreview );
1312} 1313}
1313void KABCore::importFromOL() 1314void KABCore::importFromOL()
1314{ 1315{
1315#ifdef _OL_IMPORT_ 1316#ifdef _OL_IMPORT_
1316 KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this ); 1317 KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this );
1317 idgl->exec(); 1318 idgl->exec();
1318 KABC::Addressee::List list = idgl->getAddressList(); 1319 KABC::Addressee::List list = idgl->getAddressList();
1319 if ( list.count() > 0 ) { 1320 if ( list.count() > 0 ) {
1320 KABC::Addressee::List listNew; 1321 KABC::Addressee::List listNew;
1321 KABC::Addressee::List listExisting; 1322 KABC::Addressee::List listExisting;
1322 KABC::Addressee::List::Iterator it; 1323 KABC::Addressee::List::Iterator it;
1323 KABC::AddressBook::Iterator iter; 1324 KABC::AddressBook::Iterator iter;
1324 for ( it = list.begin(); it != list.end(); ++it ) { 1325 for ( it = list.begin(); it != list.end(); ++it ) {
1325 if ( mAddressBook->findByUid((*it).uid() ).isEmpty()) 1326 if ( mAddressBook->findByUid((*it).uid() ).isEmpty())
1326 listNew.append( (*it) ); 1327 listNew.append( (*it) );
1327 else 1328 else
1328 listExisting.append( (*it) ); 1329 listExisting.append( (*it) );
1329 } 1330 }
1330 if ( listExisting.count() > 0 ) 1331 if ( listExisting.count() > 0 )
1331 KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() )); 1332 KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() ));
1332 if ( listNew.count() > 0 ) { 1333 if ( listNew.count() > 0 ) {
1333 pasteWithNewUid = false; 1334 pasteWithNewUid = false;
1334 pasteContacts( listNew ); 1335 pasteContacts( listNew );
1335 pasteWithNewUid = true; 1336 pasteWithNewUid = true;
1336 } 1337 }
1337 } 1338 }
1338 delete idgl; 1339 delete idgl;
1339#endif 1340#endif
1340} 1341}
1341 1342
1342void KABCore::importVCard( const QString &vCard, bool showPreview ) 1343void KABCore::importVCard( const QString &vCard, bool showPreview )
1343{ 1344{
1344 mXXPortManager->importVCard( vCard, showPreview ); 1345 mXXPortManager->importVCard( vCard, showPreview );
1345} 1346}
1346 1347
1347//US added a second method without defaultparameter 1348//US added a second method without defaultparameter
1348void KABCore::editContact2() { 1349void KABCore::editContact2() {
1349 editContact( QString::null ); 1350 editContact( QString::null );
1350} 1351}
1351 1352
1352void KABCore::editContact( const QString &uid ) 1353void KABCore::editContact( const QString &uid )
1353{ 1354{
1354 1355
1355 if ( mExtensionManager->isQuickEditVisible() ) 1356 if ( mExtensionManager->isQuickEditVisible() )
1356 return; 1357 return;
1357 1358
1358 // First, locate the contact entry 1359 // First, locate the contact entry
1359 QString localUID = uid; 1360 QString localUID = uid;
1360 if ( localUID.isNull() ) { 1361 if ( localUID.isNull() ) {
1361 QStringList uidList = mViewManager->selectedUids(); 1362 QStringList uidList = mViewManager->selectedUids();
1362 if ( uidList.count() > 0 ) 1363 if ( uidList.count() > 0 )
1363 localUID = *( uidList.at( 0 ) ); 1364 localUID = *( uidList.at( 0 ) );
1364 } 1365 }
1365 1366
1366 KABC::Addressee addr = mAddressBook->findByUid( localUID ); 1367 KABC::Addressee addr = mAddressBook->findByUid( localUID );
1367 if ( !addr.isEmpty() ) { 1368 if ( !addr.isEmpty() ) {
1368 mEditorDialog->setAddressee( addr ); 1369 mEditorDialog->setAddressee( addr );
1369 KApplication::execDialog ( mEditorDialog ); 1370 KApplication::execDialog ( mEditorDialog );
1370 } 1371 }
1371} 1372}
1372 1373
1373/** 1374/**
1374 Shows or edits the detail view for the given uid. If the uid is QString::null, 1375 Shows or edits the detail view for the given uid. If the uid is QString::null,
1375 the method will try to find a selected addressee in the view. 1376 the method will try to find a selected addressee in the view.
1376 */ 1377 */
1377void KABCore::executeContact( const QString &uid /*US = QString::null*/ ) 1378void KABCore::executeContact( const QString &uid /*US = QString::null*/ )
1378{ 1379{
1379 if ( mMultipleViewsAtOnce ) 1380 if ( mMultipleViewsAtOnce )
1380 { 1381 {
1381 editContact( uid ); 1382 editContact( uid );
1382 } 1383 }
1383 else 1384 else
1384 { 1385 {
1385 setDetailsVisible( true ); 1386 setDetailsVisible( true );
1386 mActionDetails->setChecked(true); 1387 mActionDetails->setChecked(true);
1387 } 1388 }
1388 1389
1389} 1390}
1390 1391
1391void KABCore::save() 1392void KABCore::save()
1392{ 1393{
1393 if (syncManager->blockSave()) 1394 if (syncManager->blockSave())
1394 return; 1395 return;
1395 if ( !mModified ) 1396 if ( !mModified )
1396 return; 1397 return;
1397 1398
1398 syncManager->setBlockSave(true); 1399 syncManager->setBlockSave(true);
1399 QString text = i18n( "There was an error while attempting to save\n the " 1400 QString text = i18n( "There was an error while attempting to save\n the "
1400 "address book. Please check that some \nother application is " 1401 "address book. Please check that some \nother application is "
1401 "not using it. " ); 1402 "not using it. " );
1402 message(i18n("Saving ... please wait! "), false); 1403 message(i18n("Saving ... please wait! "), false);
1403 //qApp->processEvents(); 1404 //qApp->processEvents();
1404#ifndef KAB_EMBEDDED 1405#ifndef KAB_EMBEDDED
1405 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); 1406 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook );
1406 if ( !b || !b->save() ) { 1407 if ( !b || !b->save() ) {
1407 KMessageBox::error( this, text, i18n( "Unable to Save" ) ); 1408 KMessageBox::error( this, text, i18n( "Unable to Save" ) );
1408 } 1409 }
1409#else //KAB_EMBEDDED 1410#else //KAB_EMBEDDED
1410 KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); 1411 KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook );
1411 if ( !b || !b->save() ) { 1412 if ( !b || !b->save() ) {
1412 QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok")); 1413 QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok"));
1413 } 1414 }
1414#endif //KAB_EMBEDDED 1415#endif //KAB_EMBEDDED
1415 1416
1416 message(i18n("Addressbook saved!")); 1417 message(i18n("Addressbook saved!"));
1417 setModified( false ); 1418 setModified( false );
1418 syncManager->setBlockSave(false); 1419 syncManager->setBlockSave(false);
1419} 1420}
1420 1421
1421 1422
1422void KABCore::undo() 1423void KABCore::undo()
1423{ 1424{
1424 UndoStack::instance()->undo(); 1425 UndoStack::instance()->undo();
1425 1426
1426 // Refresh the view 1427 // Refresh the view
1427 mViewManager->refreshView(); 1428 mViewManager->refreshView();
1428} 1429}
1429 1430
1430void KABCore::redo() 1431void KABCore::redo()
1431{ 1432{
1432 RedoStack::instance()->redo(); 1433 RedoStack::instance()->redo();
1433 1434
1434 // Refresh the view 1435 // Refresh the view
1435 mViewManager->refreshView(); 1436 mViewManager->refreshView();
1436} 1437}
1437void KABCore::setJumpButtonBar( bool visible ) 1438void KABCore::setJumpButtonBar( bool visible )
1438{ 1439{
1439 setJumpButtonBarVisible(visible ); 1440 setJumpButtonBarVisible(visible );
1440 saveSettings(); 1441 saveSettings();
1441} 1442}
1442void KABCore::setJumpButtonBarVisible( bool visible ) 1443void KABCore::setJumpButtonBarVisible( bool visible )
1443{ 1444{
1444 if (mMultipleViewsAtOnce) 1445 if (mMultipleViewsAtOnce)
1445 { 1446 {
1446 if ( visible ) 1447 if ( visible )
1447 mJumpButtonBar->show(); 1448 mJumpButtonBar->show();
1448 else 1449 else
1449 mJumpButtonBar->hide(); 1450 mJumpButtonBar->hide();
1450 } 1451 }
1451 else 1452 else
1452 { 1453 {
1453 // show the jumpbar only if "the details are hidden" == "viewmanager are shown" 1454 // show the jumpbar only if "the details are hidden" == "viewmanager are shown"
1454 if (mViewManager->isVisible()) 1455 if (mViewManager->isVisible())
1455 { 1456 {
1456 if ( visible ) 1457 if ( visible )
1457 mJumpButtonBar->show(); 1458 mJumpButtonBar->show();
1458 else 1459 else
1459 mJumpButtonBar->hide(); 1460 mJumpButtonBar->hide();
1460 } 1461 }
1461 else 1462 else
1462 { 1463 {
1463 mJumpButtonBar->hide(); 1464 mJumpButtonBar->hide();
1464 } 1465 }
1465 } 1466 }
1466 if ( visible ) { 1467 if ( visible ) {
1467 if ( mIncSearchWidget->currentItem() == 0 ) { 1468 if ( mIncSearchWidget->currentItem() == 0 ) {
1468 message( i18n("Change search field enable jump bar") ); 1469 message( i18n("Change search field enable jump bar") );
1469 } 1470 }
1470 } 1471 }
1471} 1472}
1472 1473
1473 1474
1474void KABCore::setDetailsToState() 1475void KABCore::setDetailsToState()
1475{ 1476{
1476 setDetailsVisible( mActionDetails->isChecked() ); 1477 setDetailsVisible( mActionDetails->isChecked() );
1477} 1478}
1478void KABCore::setDetailsToggle() 1479void KABCore::setDetailsToggle()
1479{ 1480{
1480 mActionDetails->setChecked( !mActionDetails->isChecked() ); 1481 mActionDetails->setChecked( !mActionDetails->isChecked() );
1481 setDetailsToState(); 1482 setDetailsToState();
1482} 1483}
1483 1484
1484 1485
1485 1486
1486void KABCore::setDetailsVisible( bool visible ) 1487void KABCore::setDetailsVisible( bool visible )
1487{ 1488{
1488 if (visible && mDetails->isHidden()) 1489 if (visible && mDetails->isHidden())
1489 { 1490 {
1490 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 1491 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
1491 if ( addrList.count() > 0 ) 1492 if ( addrList.count() > 0 )
1492 mDetails->setAddressee( addrList[ 0 ] ); 1493 mDetails->setAddressee( addrList[ 0 ] );
1493 } 1494 }
1494 1495
1495 // mMultipleViewsAtOnce=false: mDetails is always visible. But we switch between 1496 // mMultipleViewsAtOnce=false: mDetails is always visible. But we switch between
1496 // the listview and the detailview. We do that by changing the splitbar size. 1497 // the listview and the detailview. We do that by changing the splitbar size.
1497 if (mMultipleViewsAtOnce) 1498 if (mMultipleViewsAtOnce)
1498 { 1499 {
1499 if ( visible ) 1500 if ( visible )
1500 mDetails->show(); 1501 mDetails->show();
1501 else 1502 else
1502 mDetails->hide(); 1503 mDetails->hide();
1503 } 1504 }
1504 else 1505 else
1505 { 1506 {
1506 if ( visible ) { 1507 if ( visible ) {
1507 mViewManager->hide(); 1508 mViewManager->hide();
1508 mDetails->show(); 1509 mDetails->show();
1509 mIncSearchWidget->setFocus(); 1510 mIncSearchWidget->setFocus();
1510 } 1511 }
1511 else { 1512 else {
1512 mViewManager->show(); 1513 mViewManager->show();
1513 mDetails->hide(); 1514 mDetails->hide();
1514 mViewManager->setFocusAV(); 1515 mViewManager->setFocusAV();
1515 } 1516 }
1516 setJumpButtonBarVisible( !visible ); 1517 setJumpButtonBarVisible( !visible );
1517 } 1518 }
1518 1519
1519} 1520}
1520 1521
1521void KABCore::extensionChanged( int id ) 1522void KABCore::extensionChanged( int id )
1522{ 1523{
1523 //change the details view only for non desktop systems 1524 //change the details view only for non desktop systems
1524#ifndef DESKTOP_VERSION 1525#ifndef DESKTOP_VERSION
1525 1526
1526 if (id == 0) 1527 if (id == 0)
1527 { 1528 {
1528 //the user disabled the extension. 1529 //the user disabled the extension.
1529 1530
1530 if (mMultipleViewsAtOnce) 1531 if (mMultipleViewsAtOnce)
1531 { // enable detailsview again 1532 { // enable detailsview again
1532 setDetailsVisible( true ); 1533 setDetailsVisible( true );
1533 mActionDetails->setChecked( true ); 1534 mActionDetails->setChecked( true );
1534 } 1535 }
1535 else 1536 else
1536 { //go back to the listview 1537 { //go back to the listview
1537 setDetailsVisible( false ); 1538 setDetailsVisible( false );
1538 mActionDetails->setChecked( false ); 1539 mActionDetails->setChecked( false );
1539 mActionDetails->setEnabled(true); 1540 mActionDetails->setEnabled(true);
1540 } 1541 }
1541 1542
1542 } 1543 }
1543 else 1544 else
1544 { 1545 {
1545 //the user enabled the extension. 1546 //the user enabled the extension.
1546 setDetailsVisible( false ); 1547 setDetailsVisible( false );
1547 mActionDetails->setChecked( false ); 1548 mActionDetails->setChecked( false );
1548 1549
1549 if (!mMultipleViewsAtOnce) 1550 if (!mMultipleViewsAtOnce)
1550 { 1551 {
1551 mActionDetails->setEnabled(false); 1552 mActionDetails->setEnabled(false);
1552 } 1553 }
1553 1554
1554 mExtensionManager->setSelectionChanged(); 1555 mExtensionManager->setSelectionChanged();
1555 1556
1556 } 1557 }
1557 1558
1558#endif// DESKTOP_VERSION 1559#endif// DESKTOP_VERSION
1559 1560
1560} 1561}
1561 1562
1562 1563
1563void KABCore::extensionModified( const KABC::Addressee::List &list ) 1564void KABCore::extensionModified( const KABC::Addressee::List &list )
1564{ 1565{
1565 1566
1566 if ( list.count() != 0 ) { 1567 if ( list.count() != 0 ) {
1567 KABC::Addressee::List::ConstIterator it; 1568 KABC::Addressee::List::ConstIterator it;
1568 for ( it = list.begin(); it != list.end(); ++it ) 1569 for ( it = list.begin(); it != list.end(); ++it )
1569 mAddressBook->insertAddressee( *it ); 1570 mAddressBook->insertAddressee( *it );
1570 if ( list.count() > 1 ) 1571 if ( list.count() > 1 )
1571 setModified(); 1572 setModified();
1572 else 1573 else
1573 setModifiedWOrefresh(); 1574 setModifiedWOrefresh();
1574 } 1575 }
1575 if ( list.count() == 0 ) 1576 if ( list.count() == 0 )
1576 mViewManager->refreshView(); 1577 mViewManager->refreshView();
1577 else 1578 else
1578 mViewManager->refreshView( list[ 0 ].uid() ); 1579 mViewManager->refreshView( list[ 0 ].uid() );
1579 1580
1580 1581
1581 1582
1582} 1583}
1583 1584
1584QString KABCore::getNameByPhone( const QString &phone ) 1585QString KABCore::getNameByPhone( const QString &phone )
1585{ 1586{
1586#ifndef KAB_EMBEDDED 1587#ifndef KAB_EMBEDDED
1587 QRegExp r( "[/*/-/ ]" ); 1588 QRegExp r( "[/*/-/ ]" );
1588 QString localPhone( phone ); 1589 QString localPhone( phone );
1589 1590
1590 bool found = false; 1591 bool found = false;
1591 QString ownerName = ""; 1592 QString ownerName = "";
1592 KABC::AddressBook::Iterator iter; 1593 KABC::AddressBook::Iterator iter;
1593 KABC::PhoneNumber::List::Iterator phoneIter; 1594 KABC::PhoneNumber::List::Iterator phoneIter;
1594 KABC::PhoneNumber::List phoneList; 1595 KABC::PhoneNumber::List phoneList;
1595 for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) { 1596 for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) {
1596 phoneList = (*iter).phoneNumbers(); 1597 phoneList = (*iter).phoneNumbers();
1597 for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() ); 1598 for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() );
1598 ++phoneIter) { 1599 ++phoneIter) {
1599 // Get rid of separator chars so just the numbers are compared. 1600 // Get rid of separator chars so just the numbers are compared.
1600 if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) { 1601 if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) {
1601 ownerName = (*iter).formattedName(); 1602 ownerName = (*iter).formattedName();
1602 found = true; 1603 found = true;
1603 } 1604 }
1604 } 1605 }
1605 } 1606 }
1606 1607
1607 return ownerName; 1608 return ownerName;
1608#else //KAB_EMBEDDED 1609#else //KAB_EMBEDDED
1609 qDebug("KABCore::getNameByPhone finsih method"); 1610 qDebug("KABCore::getNameByPhone finsih method");
1610 return ""; 1611 return "";
1611#endif //KAB_EMBEDDED 1612#endif //KAB_EMBEDDED
1612 1613
1613} 1614}
1614 1615void KABCore::openConfigGlobalDialog()
1616{
1617 KPimPrefsGlobalDialog gc ( this );
1618 gc.exec();
1619}
1615void KABCore::openConfigDialog() 1620void KABCore::openConfigDialog()
1616{ 1621{
1617 KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true ); 1622 KDialogBase * ConfigureDialog = new KDialogBase ( KDialogBase::Plain , i18n("Configure KA/Pi"), KDialogBase::Default |KDialogBase::Cancel | KDialogBase::Apply | KDialogBase::Ok, KDialogBase::Ok,0, "name", true, true);
1618 KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" );
1619 ConfigureDialog->addModule(kabcfg );
1620 KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" );
1621 ConfigureDialog->addModule(kdelibcfg );
1622 1623
1624 KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog , "KCMKabConfig" );
1625 ConfigureDialog->setMainWidget( kabcfg );
1623 connect( ConfigureDialog, SIGNAL( applyClicked() ), 1626 connect( ConfigureDialog, SIGNAL( applyClicked() ),
1624 this, SLOT( configurationChanged() ) ); 1627 this, SLOT( configurationChanged() ) );
1628 connect( ConfigureDialog, SIGNAL( applyClicked() ),
1629 kabcfg, SLOT( save() ) );
1625 connect( ConfigureDialog, SIGNAL( okClicked() ), 1630 connect( ConfigureDialog, SIGNAL( okClicked() ),
1626 this, SLOT( configurationChanged() ) ); 1631 this, SLOT( configurationChanged() ) );
1632 connect( ConfigureDialog, SIGNAL( okClicked() ),
1633 kabcfg, SLOT( save() ) );
1634 connect( ConfigureDialog, SIGNAL( defaultClicked() ),
1635 kabcfg, SLOT( defaults() ) );
1627 saveSettings(); 1636 saveSettings();
1637 kabcfg->load();
1628#ifndef DESKTOP_VERSION 1638#ifndef DESKTOP_VERSION
1639 if ( QApplication::desktop()->height() <= 480 )
1640 ConfigureDialog->hideButtons();
1629 ConfigureDialog->showMaximized(); 1641 ConfigureDialog->showMaximized();
1630#endif 1642#endif
1631 if ( ConfigureDialog->exec() ) 1643 if ( ConfigureDialog->exec() )
1632 KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") ); 1644 KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") );
1633 delete ConfigureDialog; 1645 delete ConfigureDialog;
1634} 1646}
1635 1647
1636void KABCore::openLDAPDialog() 1648void KABCore::openLDAPDialog()
1637{ 1649{
1638#ifndef KAB_EMBEDDED 1650#ifndef KAB_EMBEDDED
1639 if ( !mLdapSearchDialog ) { 1651 if ( !mLdapSearchDialog ) {
1640 mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this ); 1652 mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this );
1641 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager, 1653 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager,
1642 SLOT( refreshView() ) ); 1654 SLOT( refreshView() ) );
1643 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this, 1655 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this,
1644 SLOT( setModified() ) ); 1656 SLOT( setModified() ) );
1645 } else 1657 } else
1646 mLdapSearchDialog->restoreSettings(); 1658 mLdapSearchDialog->restoreSettings();
1647 1659
1648 if ( mLdapSearchDialog->isOK() ) 1660 if ( mLdapSearchDialog->isOK() )
1649 mLdapSearchDialog->exec(); 1661 mLdapSearchDialog->exec();
1650#else //KAB_EMBEDDED 1662#else //KAB_EMBEDDED
1651 qDebug("KABCore::openLDAPDialog() finsih method"); 1663 qDebug("KABCore::openLDAPDialog() finsih method");
1652#endif //KAB_EMBEDDED 1664#endif //KAB_EMBEDDED
1653} 1665}
1654 1666
1655void KABCore::print() 1667void KABCore::print()
1656{ 1668{
1657#ifndef KAB_EMBEDDED 1669#ifndef KAB_EMBEDDED
1658 KPrinter printer; 1670 KPrinter printer;
1659 if ( !printer.setup( this ) ) 1671 if ( !printer.setup( this ) )
1660 return; 1672 return;
1661 1673
1662 KABPrinting::PrintingWizard wizard( &printer, mAddressBook, 1674 KABPrinting::PrintingWizard wizard( &printer, mAddressBook,
1663 mViewManager->selectedUids(), this ); 1675 mViewManager->selectedUids(), this );
1664 1676
1665 wizard.exec(); 1677 wizard.exec();
1666#else //KAB_EMBEDDED 1678#else //KAB_EMBEDDED
1667 qDebug("KABCore::print() finsih method"); 1679 qDebug("KABCore::print() finsih method");
1668#endif //KAB_EMBEDDED 1680#endif //KAB_EMBEDDED
1669 1681
1670} 1682}
1671 1683
1672 1684
1673void KABCore::addGUIClient( KXMLGUIClient *client ) 1685void KABCore::addGUIClient( KXMLGUIClient *client )
1674{ 1686{
1675 if ( mGUIClient ) 1687 if ( mGUIClient )
1676 mGUIClient->insertChildClient( client ); 1688 mGUIClient->insertChildClient( client );
1677 else 1689 else
1678 KMessageBox::error( this, "no KXMLGUICLient"); 1690 KMessageBox::error( this, "no KXMLGUICLient");
1679} 1691}
1680 1692
1681 1693
1682void KABCore::configurationChanged() 1694void KABCore::configurationChanged()
1683{ 1695{
1684 mExtensionManager->reconfigure(); 1696 mExtensionManager->reconfigure();
1685} 1697}
1686 1698
1687void KABCore::addressBookChanged() 1699void KABCore::addressBookChanged()
1688{ 1700{
1689/*US 1701/*US
1690 QDictIterator<AddresseeEditorDialog> it( mEditorDict ); 1702 QDictIterator<AddresseeEditorDialog> it( mEditorDict );
1691 while ( it.current() ) { 1703 while ( it.current() ) {
1692 if ( it.current()->dirty() ) { 1704 if ( it.current()->dirty() ) {
1693 QString text = i18n( "Data has been changed externally. Unsaved " 1705 QString text = i18n( "Data has been changed externally. Unsaved "
1694 "changes will be lost." ); 1706 "changes will be lost." );
1695 KMessageBox::information( this, text ); 1707 KMessageBox::information( this, text );
1696 } 1708 }
1697 it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) ); 1709 it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) );
1698 ++it; 1710 ++it;
1699 } 1711 }
1700*/ 1712*/
1701 if (mEditorDialog) 1713 if (mEditorDialog)
1702 { 1714 {
1703 if (mEditorDialog->dirty()) 1715 if (mEditorDialog->dirty())
1704 { 1716 {
1705 QString text = i18n( "Data has been changed externally. Unsaved " 1717 QString text = i18n( "Data has been changed externally. Unsaved "
1706 "changes will be lost." ); 1718 "changes will be lost." );
1707 KMessageBox::information( this, text ); 1719 KMessageBox::information( this, text );
1708 } 1720 }
1709 QString currentuid = mEditorDialog->addressee().uid(); 1721 QString currentuid = mEditorDialog->addressee().uid();
1710 mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) ); 1722 mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) );
1711 } 1723 }
1712 mViewManager->refreshView(); 1724 mViewManager->refreshView();
1713 1725
1714 1726
1715} 1727}
1716 1728
1717AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, 1729AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent,
1718 const char *name ) 1730 const char *name )
1719{ 1731{
1720 1732
1721 if ( mEditorDialog == 0 ) { 1733 if ( mEditorDialog == 0 ) {
1722 mEditorDialog = new AddresseeEditorDialog( this, parent, 1734 mEditorDialog = new AddresseeEditorDialog( this, parent,
1723 name ? name : "editorDialog" ); 1735 name ? name : "editorDialog" );
1724 1736
1725 1737
1726 connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ), 1738 connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ),
1727 SLOT( contactModified( const KABC::Addressee& ) ) ); 1739 SLOT( contactModified( const KABC::Addressee& ) ) );
1728 //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ), 1740 //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ),
1729 // SLOT( slotEditorDestroyed( const QString& ) ) ; 1741 // SLOT( slotEditorDestroyed( const QString& ) ) ;
1730 } 1742 }
1731 1743
1732 return mEditorDialog; 1744 return mEditorDialog;
1733} 1745}
1734 1746
1735void KABCore::slotEditorDestroyed( const QString &uid ) 1747void KABCore::slotEditorDestroyed( const QString &uid )
1736{ 1748{
1737 //mEditorDict.remove( uid ); 1749 //mEditorDict.remove( uid );
1738} 1750}
1739 1751
1740void KABCore::initGUI() 1752void KABCore::initGUI()
1741{ 1753{
1742#ifndef KAB_EMBEDDED 1754#ifndef KAB_EMBEDDED
1743 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1755 QHBoxLayout *topLayout = new QHBoxLayout( this );
1744 topLayout->setSpacing( KDialogBase::spacingHint() ); 1756 topLayout->setSpacing( KDialogBase::spacingHint() );
1745 1757
1746 mExtensionBarSplitter = new QSplitter( this ); 1758 mExtensionBarSplitter = new QSplitter( this );
1747 mExtensionBarSplitter->setOrientation( Qt::Vertical ); 1759 mExtensionBarSplitter->setOrientation( Qt::Vertical );
1748 1760
1749 mDetailsSplitter = new QSplitter( mExtensionBarSplitter ); 1761 mDetailsSplitter = new QSplitter( mExtensionBarSplitter );
1750 1762
1751 QVBox *viewSpace = new QVBox( mDetailsSplitter ); 1763 QVBox *viewSpace = new QVBox( mDetailsSplitter );
1752 mIncSearchWidget = new IncSearchWidget( viewSpace ); 1764 mIncSearchWidget = new IncSearchWidget( viewSpace );
1753 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1765 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1754 SLOT( incrementalSearch( const QString& ) ) ); 1766 SLOT( incrementalSearch( const QString& ) ) );
1755 1767
1756 mViewManager = new ViewManager( this, viewSpace ); 1768 mViewManager = new ViewManager( this, viewSpace );
1757 viewSpace->setStretchFactor( mViewManager, 1 ); 1769 viewSpace->setStretchFactor( mViewManager, 1 );
1758 1770
1759 mDetails = new ViewContainer( mDetailsSplitter ); 1771 mDetails = new ViewContainer( mDetailsSplitter );
1760 1772
1761 mJumpButtonBar = new JumpButtonBar( this, this ); 1773 mJumpButtonBar = new JumpButtonBar( this, this );
1762 1774
1763 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); 1775 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter );
1764 1776
1765 topLayout->addWidget( mExtensionBarSplitter ); 1777 topLayout->addWidget( mExtensionBarSplitter );
1766 topLayout->setStretchFactor( mExtensionBarSplitter, 100 ); 1778 topLayout->setStretchFactor( mExtensionBarSplitter, 100 );
1767 topLayout->addWidget( mJumpButtonBar ); 1779 topLayout->addWidget( mJumpButtonBar );
1768 //topLayout->setStretchFactor( mJumpButtonBar, 1 ); 1780 //topLayout->setStretchFactor( mJumpButtonBar, 1 );
1769 1781
1770 mXXPortManager = new XXPortManager( this, this ); 1782 mXXPortManager = new XXPortManager( this, this );
1771 1783
1772#else //KAB_EMBEDDED 1784#else //KAB_EMBEDDED
1773 //US initialize viewMenu before settingup viewmanager. 1785 //US initialize viewMenu before settingup viewmanager.
1774 // Viewmanager needs this menu to plugin submenues. 1786 // Viewmanager needs this menu to plugin submenues.
1775 viewMenu = new QPopupMenu( this ); 1787 viewMenu = new QPopupMenu( this );
1776 settingsMenu = new QPopupMenu( this ); 1788 settingsMenu = new QPopupMenu( this );
1777 //filterMenu = new QPopupMenu( this ); 1789 //filterMenu = new QPopupMenu( this );
1778 ImportMenu = new QPopupMenu( this ); 1790 ImportMenu = new QPopupMenu( this );
1779 ExportMenu = new QPopupMenu( this ); 1791 ExportMenu = new QPopupMenu( this );
1780 syncMenu = new QPopupMenu( this ); 1792 syncMenu = new QPopupMenu( this );
1781 changeMenu= new QPopupMenu( this ); 1793 changeMenu= new QPopupMenu( this );
1782 beamMenu= new QPopupMenu( this ); 1794 beamMenu= new QPopupMenu( this );
1783 1795
1784//US since we have no splitter for the embedded system, setup 1796//US since we have no splitter for the embedded system, setup
1785// a layout with two frames. One left and one right. 1797// a layout with two frames. One left and one right.
1786 1798
1787 QBoxLayout *topLayout; 1799 QBoxLayout *topLayout;
1788 1800
1789 // = new QHBoxLayout( this ); 1801 // = new QHBoxLayout( this );
1790// QBoxLayout *topLayout = (QBoxLayout*)layout(); 1802// QBoxLayout *topLayout = (QBoxLayout*)layout();
1791 1803
1792// QWidget *mainBox = new QWidget( this ); 1804// QWidget *mainBox = new QWidget( this );
1793// QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); 1805// QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox);
1794 1806
1795#ifdef DESKTOP_VERSION 1807#ifdef DESKTOP_VERSION
1796 topLayout = new QHBoxLayout( this ); 1808 topLayout = new QHBoxLayout( this );
1797 1809
1798 1810
1799 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 1811 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
1800 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 1812 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
1801 1813
1802 topLayout->addWidget(mMiniSplitter ); 1814 topLayout->addWidget(mMiniSplitter );
1803 1815
1804 mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); 1816 mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter );
1805 mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); 1817 mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
1806 mViewManager = new ViewManager( this, mExtensionBarSplitter ); 1818 mViewManager = new ViewManager( this, mExtensionBarSplitter );
1807 mDetails = new ViewContainer( mMiniSplitter ); 1819 mDetails = new ViewContainer( mMiniSplitter );
1808 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); 1820 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter );
1809#else 1821#else
1810 if ( QApplication::desktop()->width() > 480 ) { 1822 if ( QApplication::desktop()->width() > 480 ) {
1811 topLayout = new QHBoxLayout( this ); 1823 topLayout = new QHBoxLayout( this );
1812 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 1824 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
1813 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 1825 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
1814 } else { 1826 } else {
1815 1827
1816 topLayout = new QHBoxLayout( this ); 1828 topLayout = new QHBoxLayout( this );
1817 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); 1829 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this);
1818 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); 1830 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
1819 } 1831 }
1820 1832
1821 topLayout->addWidget(mMiniSplitter ); 1833 topLayout->addWidget(mMiniSplitter );
1822 mViewManager = new ViewManager( this, mMiniSplitter ); 1834 mViewManager = new ViewManager( this, mMiniSplitter );
1823 mDetails = new ViewContainer( mMiniSplitter ); 1835 mDetails = new ViewContainer( mMiniSplitter );
1824 1836
1825 1837
1826 mExtensionManager = new ExtensionManager( this, mMiniSplitter ); 1838 mExtensionManager = new ExtensionManager( this, mMiniSplitter );
1827#endif 1839#endif
1828 //eh->hide(); 1840 //eh->hide();
1829 // topLayout->addWidget(mExtensionManager ); 1841 // topLayout->addWidget(mExtensionManager );
1830 1842
1831 1843
1832/*US 1844/*US
1833#ifndef KAB_NOSPLITTER 1845#ifndef KAB_NOSPLITTER
1834 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1846 QHBoxLayout *topLayout = new QHBoxLayout( this );
1835//US topLayout->setSpacing( KDialogBase::spacingHint() ); 1847//US topLayout->setSpacing( KDialogBase::spacingHint() );
1836 topLayout->setSpacing( 10 ); 1848 topLayout->setSpacing( 10 );
1837 1849
1838 mDetailsSplitter = new QSplitter( this ); 1850 mDetailsSplitter = new QSplitter( this );
1839 1851
1840 QVBox *viewSpace = new QVBox( mDetailsSplitter ); 1852 QVBox *viewSpace = new QVBox( mDetailsSplitter );
1841 1853
1842 mViewManager = new ViewManager( this, viewSpace ); 1854 mViewManager = new ViewManager( this, viewSpace );
1843 viewSpace->setStretchFactor( mViewManager, 1 ); 1855 viewSpace->setStretchFactor( mViewManager, 1 );
1844 1856
1845 mDetails = new ViewContainer( mDetailsSplitter ); 1857 mDetails = new ViewContainer( mDetailsSplitter );
1846 1858
1847 topLayout->addWidget( mDetailsSplitter ); 1859 topLayout->addWidget( mDetailsSplitter );
1848 topLayout->setStretchFactor( mDetailsSplitter, 100 ); 1860 topLayout->setStretchFactor( mDetailsSplitter, 100 );
1849#else //KAB_NOSPLITTER 1861#else //KAB_NOSPLITTER
1850 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1862 QHBoxLayout *topLayout = new QHBoxLayout( this );
1851//US topLayout->setSpacing( KDialogBase::spacingHint() ); 1863//US topLayout->setSpacing( KDialogBase::spacingHint() );
1852 topLayout->setSpacing( 10 ); 1864 topLayout->setSpacing( 10 );
1853 1865
1854// mDetailsSplitter = new QSplitter( this ); 1866// mDetailsSplitter = new QSplitter( this );
1855 1867
1856 QVBox *viewSpace = new QVBox( this ); 1868 QVBox *viewSpace = new QVBox( this );
1857 1869
1858 mViewManager = new ViewManager( this, viewSpace ); 1870 mViewManager = new ViewManager( this, viewSpace );
1859 viewSpace->setStretchFactor( mViewManager, 1 ); 1871 viewSpace->setStretchFactor( mViewManager, 1 );
1860 1872
1861 mDetails = new ViewContainer( this ); 1873 mDetails = new ViewContainer( this );
1862 1874
1863 topLayout->addWidget( viewSpace ); 1875 topLayout->addWidget( viewSpace );
1864// topLayout->setStretchFactor( mDetailsSplitter, 100 ); 1876// topLayout->setStretchFactor( mDetailsSplitter, 100 );
1865 topLayout->addWidget( mDetails ); 1877 topLayout->addWidget( mDetails );
1866#endif //KAB_NOSPLITTER 1878#endif //KAB_NOSPLITTER
1867*/ 1879*/
1868 1880
1869 syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); 1881 syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu);
1870 syncManager->setBlockSave(false); 1882 syncManager->setBlockSave(false);
1871 1883
1872 connect(syncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); 1884 connect(syncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) );
1873 connect(syncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); 1885 connect(syncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
1874 QString sync_file = sentSyncFile(); 1886 QString sync_file = sentSyncFile();
1875 //qDebug("KABCore::initGUI()::setting tmp sync file to:%s ",sync_file.latin1()); 1887 //qDebug("KABCore::initGUI()::setting tmp sync file to:%s ",sync_file.latin1());
1876 syncManager->setDefaultFileName( sync_file ); 1888 syncManager->setDefaultFileName( sync_file );
1877 //connect(syncManager , SIGNAL( ), this, SLOT( ) ); 1889 //connect(syncManager , SIGNAL( ), this, SLOT( ) );
1878 1890
1879#endif //KAB_EMBEDDED 1891#endif //KAB_EMBEDDED
1880 initActions(); 1892 initActions();
1881 1893
1882#ifdef KAB_EMBEDDED 1894#ifdef KAB_EMBEDDED
1883 addActionsManually(); 1895 addActionsManually();
1884 //US make sure the export and import menues are initialized before creating the xxPortManager. 1896 //US make sure the export and import menues are initialized before creating the xxPortManager.
1885 mXXPortManager = new XXPortManager( this, this ); 1897 mXXPortManager = new XXPortManager( this, this );
1886 1898
1887 // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); 1899 // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() );
1888 //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); 1900 //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget);
1889 // mActionQuit->plug ( mMainWindow->toolBar()); 1901 // mActionQuit->plug ( mMainWindow->toolBar());
1890 //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); 1902 //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() );
1891 //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); 1903 //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget);
1892 // mIncSearchWidget->hide(); 1904 // mIncSearchWidget->hide();
1893 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1905 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1894 SLOT( incrementalSearch( const QString& ) ) ); 1906 SLOT( incrementalSearch( const QString& ) ) );
1895 connect( mIncSearchWidget, SIGNAL( scrollUP() ),mViewManager, SLOT( scrollUP() ) ); 1907 connect( mIncSearchWidget, SIGNAL( scrollUP() ),mViewManager, SLOT( scrollUP() ) );
1896 connect( mIncSearchWidget, SIGNAL( scrollDOWN() ),mViewManager, SLOT( scrollDOWN() ) ); 1908 connect( mIncSearchWidget, SIGNAL( scrollDOWN() ),mViewManager, SLOT( scrollDOWN() ) );
1897 1909
1898 mJumpButtonBar = new JumpButtonBar( this, this ); 1910 mJumpButtonBar = new JumpButtonBar( this, this );
1899 1911
1900 topLayout->addWidget( mJumpButtonBar ); 1912 topLayout->addWidget( mJumpButtonBar );
1901//US topLayout->setStretchFactor( mJumpButtonBar, 10 ); 1913//US topLayout->setStretchFactor( mJumpButtonBar, 10 );
1902 1914
1903// mMainWindow->getIconToolBar()->raise(); 1915// mMainWindow->getIconToolBar()->raise();
1904 1916
1905#endif //KAB_EMBEDDED 1917#endif //KAB_EMBEDDED
1906 1918
1907} 1919}
1908void KABCore::initActions() 1920void KABCore::initActions()
1909{ 1921{
1910//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); 1922//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
1911 1923
1912#ifndef KAB_EMBEDDED 1924#ifndef KAB_EMBEDDED
1913 connect( QApplication::clipboard(), SIGNAL( dataChanged() ), 1925 connect( QApplication::clipboard(), SIGNAL( dataChanged() ),
1914 SLOT( clipboardDataChanged() ) ); 1926 SLOT( clipboardDataChanged() ) );
1915#endif //KAB_EMBEDDED 1927#endif //KAB_EMBEDDED
1916 1928
1917 // file menu 1929 // file menu
1918 1930
1919 mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); 1931 mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() );
1920 //mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); 1932 //mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() );
1921 mActionPrint = new KAction( i18n( "&Print View" ), "fileprint", CTRL + Key_P, mViewManager, 1933 mActionPrint = new KAction( i18n( "&Print View" ), "fileprint", CTRL + Key_P, mViewManager,
1922 SLOT( printView() ), actionCollection(), "kaddressbook_print" ); 1934 SLOT( printView() ), actionCollection(), "kaddressbook_print" );
1923 1935
1924 1936
1925 mActionPrintDetails = new KAction( i18n( "&Print Details" ), "fileprint", 0, mDetails, 1937 mActionPrintDetails = new KAction( i18n( "&Print Details" ), "fileprint", 0, mDetails,
1926 SLOT( printView() ), actionCollection(), "kaddressbook_print2" ); 1938 SLOT( printView() ), actionCollection(), "kaddressbook_print2" );
1927 1939
1928 mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, 1940 mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this,
1929 SLOT( save() ), actionCollection(), "file_sync" ); 1941 SLOT( save() ), actionCollection(), "file_sync" );
1930 1942
1931 mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, 1943 mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this,
1932 SLOT( newContact() ), actionCollection(), "file_new_contact" ); 1944 SLOT( newContact() ), actionCollection(), "file_new_contact" );
1933 1945
1934 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, 1946 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0,
1935 this, SLOT( mailVCard() ), 1947 this, SLOT( mailVCard() ),
1936 actionCollection(), "file_mail_vcard"); 1948 actionCollection(), "file_mail_vcard");
1937 1949
1938 mActionExport2phone = new KAction( i18n( "Export to phone" ), "ex2phone", 0, this, 1950 mActionExport2phone = new KAction( i18n( "Export to phone" ), "ex2phone", 0, this,
1939 SLOT( export2phone() ), actionCollection(), 1951 SLOT( export2phone() ), actionCollection(),
1940 "kaddressbook_ex2phone" ); 1952 "kaddressbook_ex2phone" );
1941 1953
1942 mActionBeamVCard = 0; 1954 mActionBeamVCard = 0;
1943 mActionBeam = 0; 1955 mActionBeam = 0;
1944 1956
1945#ifndef DESKTOP_VERSION 1957#ifndef DESKTOP_VERSION
1946 if ( Ir::supported() ) { 1958 if ( Ir::supported() ) {
1947 mActionBeamVCard = new KAction( i18n( "Beam v&Card(s)..." ), "beam", 0, this, 1959 mActionBeamVCard = new KAction( i18n( "Beam v&Card(s)..." ), "beam", 0, this,
1948 SLOT( beamVCard() ), actionCollection(), 1960 SLOT( beamVCard() ), actionCollection(),
1949 "kaddressbook_beam_vcard" ); 1961 "kaddressbook_beam_vcard" );
1950 1962
1951 mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, 1963 mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this,
1952 SLOT( beamMySelf() ), actionCollection(), 1964 SLOT( beamMySelf() ), actionCollection(),
1953 "kaddressbook_beam_myself" ); 1965 "kaddressbook_beam_myself" );
1954 } 1966 }
1955#endif 1967#endif
1956 1968
1957 mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, 1969 mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0,
1958 this, SLOT( editContact2() ), 1970 this, SLOT( editContact2() ),
1959 actionCollection(), "file_properties" ); 1971 actionCollection(), "file_properties" );
1960 1972
1961#ifdef KAB_EMBEDDED 1973#ifdef KAB_EMBEDDED
1962 // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); 1974 // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() );
1963 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, 1975 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0,
1964 mMainWindow, SLOT( exit() ), 1976 mMainWindow, SLOT( exit() ),
1965 actionCollection(), "quit" ); 1977 actionCollection(), "quit" );
1966#endif //KAB_EMBEDDED 1978#endif //KAB_EMBEDDED
1967 1979
1968 // edit menu 1980 // edit menu
1969 if ( mIsPart ) { 1981 if ( mIsPart ) {
1970 mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, 1982 mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this,
1971 SLOT( copyContacts() ), actionCollection(), 1983 SLOT( copyContacts() ), actionCollection(),
1972 "kaddressbook_copy" ); 1984 "kaddressbook_copy" );
1973 mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, 1985 mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this,
1974 SLOT( cutContacts() ), actionCollection(), 1986 SLOT( cutContacts() ), actionCollection(),
1975 "kaddressbook_cut" ); 1987 "kaddressbook_cut" );
1976 mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, 1988 mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this,
1977 SLOT( pasteContacts() ), actionCollection(), 1989 SLOT( pasteContacts() ), actionCollection(),
1978 "kaddressbook_paste" ); 1990 "kaddressbook_paste" );
1979 mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, 1991 mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this,
1980 SLOT( selectAllContacts() ), actionCollection(), 1992 SLOT( selectAllContacts() ), actionCollection(),
1981 "kaddressbook_select_all" ); 1993 "kaddressbook_select_all" );
1982 mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, 1994 mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this,
1983 SLOT( undo() ), actionCollection(), 1995 SLOT( undo() ), actionCollection(),
1984 "kaddressbook_undo" ); 1996 "kaddressbook_undo" );
1985 mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, 1997 mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z,
1986 this, SLOT( redo() ), actionCollection(), 1998 this, SLOT( redo() ), actionCollection(),
1987 "kaddressbook_redo" ); 1999 "kaddressbook_redo" );
1988 } else { 2000 } else {
1989 mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); 2001 mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() );
1990 mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); 2002 mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() );
1991 mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); 2003 mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() );
1992 mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); 2004 mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() );
1993 mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); 2005 mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() );
1994 mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); 2006 mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() );
1995 } 2007 }
1996 2008
1997 mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", 2009 mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete",
1998 Key_Delete, this, SLOT( deleteContacts() ), 2010 Key_Delete, this, SLOT( deleteContacts() ),
1999 actionCollection(), "edit_delete" ); 2011 actionCollection(), "edit_delete" );
2000 2012
2001 mActionUndo->setEnabled( false ); 2013 mActionUndo->setEnabled( false );
2002 mActionRedo->setEnabled( false ); 2014 mActionRedo->setEnabled( false );
2003 2015
2004 // settings menu 2016 // settings menu
2005#ifdef KAB_EMBEDDED 2017#ifdef KAB_EMBEDDED
2006//US special menuentry to configure the addressbook resources. On KDE 2018//US special menuentry to configure the addressbook resources. On KDE
2007// you do that through the control center !!! 2019// you do that through the control center !!!
2008 mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, 2020 mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this,
2009 SLOT( configureResources() ), actionCollection(), 2021 SLOT( configureResources() ), actionCollection(),
2010 "kaddressbook_configure_resources" ); 2022 "kaddressbook_configure_resources" );
2011#endif //KAB_EMBEDDED 2023#endif //KAB_EMBEDDED
2012 2024
2013 if ( mIsPart ) { 2025 if ( mIsPart ) {
2014 mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, 2026 mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this,
2015 SLOT( openConfigDialog() ), actionCollection(), 2027 SLOT( openConfigDialog() ), actionCollection(),
2016 "kaddressbook_configure" ); 2028 "kaddressbook_configure" );
2017 2029
2018 //US not implemented yet 2030 //US not implemented yet
2019 //mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, 2031 //mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0,
2020 // this, SLOT( configureKeyBindings() ), actionCollection(), 2032 // this, SLOT( configureKeyBindings() ), actionCollection(),
2021 // "kaddressbook_configure_shortcuts" ); 2033 // "kaddressbook_configure_shortcuts" );
2022#ifdef KAB_EMBEDDED 2034#ifdef KAB_EMBEDDED
2023 mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); 2035 mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() );
2024 mActionConfigureToolbars->setEnabled( false ); 2036 mActionConfigureToolbars->setEnabled( false );
2025#endif //KAB_EMBEDDED 2037#endif //KAB_EMBEDDED
2026 2038
2027 } else { 2039 } else {
2028 mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); 2040 mActionConfigKAddressbook = new KAction( i18n( "&Configure KA/Pi..." ), "configure", 0, this,
2029 2041 SLOT( openConfigDialog() ), actionCollection(),
2030 //US not implemented yet 2042 "kaddressbook_configure" );
2031 //mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); 2043 mActionConfigGlobal = new KAction( i18n( "Global Settings..." ), "configure", 0, this,
2044 SLOT( openConfigGlobalDialog() ), actionCollection(),
2045 "kaddressbook_configure" );
2032 } 2046 }
2033
2034 mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, 2047 mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0,
2035 actionCollection(), "options_show_jump_bar" ); 2048 actionCollection(), "options_show_jump_bar" );
2036 connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBar( bool ) ) ); 2049 connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBar( bool ) ) );
2037 2050
2038 mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0, 2051 mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0,
2039 actionCollection(), "options_show_details" ); 2052 actionCollection(), "options_show_details" );
2040 connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); 2053 connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) );
2041 2054
2042 2055
2043 mActionBR = new KToggleAction( i18n( "Beam receive enabled" ), "beam", 0, this, 2056 mActionBR = new KToggleAction( i18n( "Beam receive enabled" ), "beam", 0, this,
2044 SLOT( toggleBeamReceive() ), actionCollection(), 2057 SLOT( toggleBeamReceive() ), actionCollection(),
2045 "kaddressbook_beam_rec" ); 2058 "kaddressbook_beam_rec" );
2046 2059
2047 2060
2048 // misc 2061 // misc
2049 // only enable LDAP lookup if we can handle the protocol 2062 // only enable LDAP lookup if we can handle the protocol
2050#ifndef KAB_EMBEDDED 2063#ifndef KAB_EMBEDDED
2051 if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { 2064 if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) {
2052 new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, 2065 new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0,
2053 this, SLOT( openLDAPDialog() ), actionCollection(), 2066 this, SLOT( openLDAPDialog() ), actionCollection(),
2054 "ldap_lookup" ); 2067 "ldap_lookup" );
2055 } 2068 }
2056#else //KAB_EMBEDDED 2069#else //KAB_EMBEDDED
2057 //qDebug("KABCore::initActions() LDAP has to be implemented"); 2070 //qDebug("KABCore::initActions() LDAP has to be implemented");
2058#endif //KAB_EMBEDDED 2071#endif //KAB_EMBEDDED
2059 2072
2060 2073
2061 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, 2074 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this,
2062 SLOT( setWhoAmI() ), actionCollection(), 2075 SLOT( setWhoAmI() ), actionCollection(),
2063 "set_personal" ); 2076 "set_personal" );
2064 2077
2065 2078
2066 mActionCategories = new KAction( i18n( "Set Categories for Contacts..." ), 0, this, 2079 mActionCategories = new KAction( i18n( "Set Categories for Contacts..." ), 0, this,
2067 SLOT( setCategories() ), actionCollection(), 2080 SLOT( setCategories() ), actionCollection(),
2068 "edit_set_categories" ); 2081 "edit_set_categories" );
2069 mActionEditCategories = new KAction( i18n( "Edit Category List..." ), 0, this, 2082 mActionEditCategories = new KAction( i18n( "Edit Category List..." ), 0, this,
2070 SLOT( editCategories() ), actionCollection(), 2083 SLOT( editCategories() ), actionCollection(),
2071 "edit__categories" ); 2084 "edit__categories" );
2072 2085
2073 mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, 2086 mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this,
2074 SLOT( removeVoice() ), actionCollection(), 2087 SLOT( removeVoice() ), actionCollection(),
2075 "remove_voice" ); 2088 "remove_voice" );
2076 mActionSetFormattedName = new KAction( i18n( "Set formatted name..." ), 0, this, 2089 mActionSetFormattedName = new KAction( i18n( "Set formatted name..." ), 0, this,
2077 SLOT( setFormattedName() ), actionCollection(), 2090 SLOT( setFormattedName() ), actionCollection(),
2078 "set_formatted" ); 2091 "set_formatted" );
2079 2092
2080 mActionManageCategories= new KAction( i18n( "Manage new categories..." ), 0, this, 2093 mActionManageCategories= new KAction( i18n( "Manage new categories..." ), 0, this,
2081 SLOT( manageCategories() ), actionCollection(), 2094 SLOT( manageCategories() ), actionCollection(),
2082 "remove_voice" ); 2095 "remove_voice" );
2083 2096
2084 2097
2085 mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this, 2098 mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this,
2086 SLOT( importFromOL() ), actionCollection(), 2099 SLOT( importFromOL() ), actionCollection(),
2087 "import_OL" ); 2100 "import_OL" );
2088#ifdef KAB_EMBEDDED 2101#ifdef KAB_EMBEDDED
2089 mActionLicence = new KAction( i18n( "Licence" ), 0, 2102 mActionLicence = new KAction( i18n( "Licence" ), 0,
2090 this, SLOT( showLicence() ), actionCollection(), 2103 this, SLOT( showLicence() ), actionCollection(),
2091 "licence_about_data" ); 2104 "licence_about_data" );
2092 mActionFaq = new KAction( i18n( "Faq" ), 0, 2105 mActionFaq = new KAction( i18n( "Faq" ), 0,
2093 this, SLOT( faq() ), actionCollection(), 2106 this, SLOT( faq() ), actionCollection(),
2094 "faq_about_data" ); 2107 "faq_about_data" );
2095 mActionWN = new KAction( i18n( "What's New?" ), 0, 2108 mActionWN = new KAction( i18n( "What's New?" ), 0,
2096 this, SLOT( whatsnew() ), actionCollection(), 2109 this, SLOT( whatsnew() ), actionCollection(),
2097 "wn" ); 2110 "wn" );
2098 2111
2099 2112
2100 2113
2101 mActionStorageHowto = new KAction( i18n( "Storage HowTo" ), 0, 2114 mActionStorageHowto = new KAction( i18n( "Storage HowTo" ), 0,
2102 this, SLOT( storagehowto() ), actionCollection(), 2115 this, SLOT( storagehowto() ), actionCollection(),
2103 "storage" ); 2116 "storage" );
2104 2117
2105 mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0, 2118 mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0,
2106 this, SLOT( synchowto() ), actionCollection(), 2119 this, SLOT( synchowto() ), actionCollection(),
2107 "sync" ); 2120 "sync" );
2108 mActionKdeSyncHowto = new KAction( i18n( "Kde Sync HowTo" ), 0, 2121 mActionKdeSyncHowto = new KAction( i18n( "Kde Sync HowTo" ), 0,
2109 this, SLOT( kdesynchowto() ), actionCollection(), 2122 this, SLOT( kdesynchowto() ), actionCollection(),
2110 "kdesync" ); 2123 "kdesync" );
2111 mActionMultiSyncHowto = new KAction( i18n( "Multi Sync HowTo" ), 0, 2124 mActionMultiSyncHowto = new KAction( i18n( "Multi Sync HowTo" ), 0,
2112 this, SLOT( multisynchowto() ), actionCollection(), 2125 this, SLOT( multisynchowto() ), actionCollection(),
2113 "multisync" ); 2126 "multisync" );
2114 2127
2115 mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, 2128 mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0,
2116 this, SLOT( createAboutData() ), actionCollection(), 2129 this, SLOT( createAboutData() ), actionCollection(),
2117 "kaddressbook_about_data" ); 2130 "kaddressbook_about_data" );
2118#endif //KAB_EMBEDDED 2131#endif //KAB_EMBEDDED
2119 2132
2120 clipboardDataChanged(); 2133 clipboardDataChanged();
2121 connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); 2134 connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
2122 connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); 2135 connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
2123} 2136}
2124 2137
2125//US we need this function, to plug all actions into the correct menues. 2138//US we need this function, to plug all actions into the correct menues.
2126// KDE uses a XML format to plug the actions, but we work her without this overhead. 2139// KDE uses a XML format to plug the actions, but we work her without this overhead.
2127void KABCore::addActionsManually() 2140void KABCore::addActionsManually()
2128{ 2141{
2129//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); 2142//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
2130 2143
2131#ifdef KAB_EMBEDDED 2144#ifdef KAB_EMBEDDED
2132 QPopupMenu *fileMenu = new QPopupMenu( this ); 2145 QPopupMenu *fileMenu = new QPopupMenu( this );
2133 QPopupMenu *editMenu = new QPopupMenu( this ); 2146 QPopupMenu *editMenu = new QPopupMenu( this );
2134 QPopupMenu *helpMenu = new QPopupMenu( this ); 2147 QPopupMenu *helpMenu = new QPopupMenu( this );
2135 2148
2136 KToolBar* tb = mMainWindow->toolBar(); 2149 KToolBar* tb = mMainWindow->toolBar();
2137 mMainWindow->setToolBarsMovable (false ); 2150 mMainWindow->setToolBarsMovable (false );
2138#ifndef DESKTOP_VERSION 2151#ifndef DESKTOP_VERSION
2139 if ( KABPrefs::instance()->mFullMenuBarVisible ) { 2152 if ( KABPrefs::instance()->mFullMenuBarVisible ) {
2140#endif 2153#endif
2141 QMenuBar* mb = mMainWindow->menuBar(); 2154 QMenuBar* mb = mMainWindow->menuBar();
2142 2155
2143 //US setup menubar. 2156 //US setup menubar.
2144 //Disable the following block if you do not want to have a menubar. 2157 //Disable the following block if you do not want to have a menubar.
2145 mb->insertItem( i18n("&File"), fileMenu ); 2158 mb->insertItem( i18n("&File"), fileMenu );
2146 mb->insertItem( i18n("&Edit"), editMenu ); 2159 mb->insertItem( i18n("&Edit"), editMenu );
2147 mb->insertItem( i18n("&View"), viewMenu ); 2160 mb->insertItem( i18n("&View"), viewMenu );
2148 mb->insertItem( i18n("&Settings"), settingsMenu ); 2161 mb->insertItem( i18n("&Settings"), settingsMenu );
2149#ifdef DESKTOP_VERSION 2162#ifdef DESKTOP_VERSION
2150 mb->insertItem( i18n("Synchronize"), syncMenu ); 2163 mb->insertItem( i18n("Synchronize"), syncMenu );
2151#else 2164#else
2152 mb->insertItem( i18n("Sync"), syncMenu ); 2165 mb->insertItem( i18n("Sync"), syncMenu );
2153#endif 2166#endif
2154 //mb->insertItem( i18n("&Change"), changeMenu ); 2167 //mb->insertItem( i18n("&Change"), changeMenu );
2155 mb->insertItem( i18n("&Help"), helpMenu ); 2168 mb->insertItem( i18n("&Help"), helpMenu );
2156 mIncSearchWidget = new IncSearchWidget( tb ); 2169 mIncSearchWidget = new IncSearchWidget( tb );
2157 // tb->insertWidget(-1, 0, mIncSearchWidget); 2170 // tb->insertWidget(-1, 0, mIncSearchWidget);
2158#ifndef DESKTOP_VERSION 2171#ifndef DESKTOP_VERSION
2159 } else { 2172 } else {
2160 //US setup toolbar 2173 //US setup toolbar
2161 QPEMenuBar *menuBarTB = new QPEMenuBar( tb ); 2174 QPEMenuBar *menuBarTB = new QPEMenuBar( tb );
2162 QPopupMenu *popupBarTB = new QPopupMenu( this ); 2175 QPopupMenu *popupBarTB = new QPopupMenu( this );
2163 menuBarTB->insertItem( SmallIcon( "z_menu" ) , popupBarTB); 2176 menuBarTB->insertItem( SmallIcon( "z_menu" ) , popupBarTB);
2164 tb->insertWidget(-1, 0, menuBarTB); 2177 tb->insertWidget(-1, 0, menuBarTB);
2165 mIncSearchWidget = new IncSearchWidget( tb ); 2178 mIncSearchWidget = new IncSearchWidget( tb );
2166 tb->enableMoving(false); 2179 tb->enableMoving(false);
2167 popupBarTB->insertItem( i18n("&File"), fileMenu ); 2180 popupBarTB->insertItem( i18n("&File"), fileMenu );
2168 popupBarTB->insertItem( i18n("&Edit"), editMenu ); 2181 popupBarTB->insertItem( i18n("&Edit"), editMenu );
2169 popupBarTB->insertItem( i18n("&View"), viewMenu ); 2182 popupBarTB->insertItem( i18n("&View"), viewMenu );
2170 popupBarTB->insertItem( i18n("&Settings"), settingsMenu ); 2183 popupBarTB->insertItem( i18n("&Settings"), settingsMenu );
2171 popupBarTB->insertItem( i18n("Synchronize"), syncMenu ); 2184 popupBarTB->insertItem( i18n("Synchronize"), syncMenu );
2172 mViewManager->getFilterAction()->plug ( popupBarTB); 2185 mViewManager->getFilterAction()->plug ( popupBarTB);
2173 //popupBarTB->insertItem( i18n("&Change selected"), changeMenu ); 2186 //popupBarTB->insertItem( i18n("&Change selected"), changeMenu );
2174 popupBarTB->insertItem( i18n("&Help"), helpMenu ); 2187 popupBarTB->insertItem( i18n("&Help"), helpMenu );
2175 if (QApplication::desktop()->width() > 320 ) { 2188 if (QApplication::desktop()->width() > 320 ) {
2176 // mViewManager->getFilterAction()->plug ( tb); 2189 // mViewManager->getFilterAction()->plug ( tb);
2177 } 2190 }
2178 } 2191 }
2179#endif 2192#endif
2180 mIncSearchWidget->setSize(); 2193 mIncSearchWidget->setSize();
2181 // mActionQuit->plug ( mMainWindow->toolBar()); 2194 // mActionQuit->plug ( mMainWindow->toolBar());
2182 2195
2183 2196
2184 2197
2185 //US Now connect the actions with the menue entries. 2198 //US Now connect the actions with the menue entries.
2186#ifdef DESKTOP_VERSION 2199#ifdef DESKTOP_VERSION
2187 mActionPrint->plug( fileMenu ); 2200 mActionPrint->plug( fileMenu );
2188 mActionPrintDetails->plug( fileMenu ); 2201 mActionPrintDetails->plug( fileMenu );
2189 fileMenu->insertSeparator(); 2202 fileMenu->insertSeparator();
2190#endif 2203#endif
2191 mActionMail->plug( fileMenu ); 2204 mActionMail->plug( fileMenu );
2192 fileMenu->insertSeparator(); 2205 fileMenu->insertSeparator();
2193 2206
2194 mActionNewContact->plug( editMenu ); 2207 mActionNewContact->plug( editMenu );
2195 mActionNewContact->plug( tb ); 2208 mActionNewContact->plug( tb );
2196 2209
2197 mActionEditAddressee->plug( editMenu ); 2210 mActionEditAddressee->plug( editMenu );
2198 editMenu->insertSeparator(); 2211 editMenu->insertSeparator();
2199 // if ((KGlobal::getDesktopSize() > KGlobal::Small ) || 2212 // if ((KGlobal::getDesktopSize() > KGlobal::Small ) ||
2200 // (!KABPrefs::instance()->mMultipleViewsAtOnce )) 2213 // (!KABPrefs::instance()->mMultipleViewsAtOnce ))
2201 mActionEditAddressee->plug( tb ); 2214 mActionEditAddressee->plug( tb );
2202 2215
2203 // fileMenu->insertSeparator(); 2216 // fileMenu->insertSeparator();
2204 mActionSave->plug( fileMenu ); 2217 mActionSave->plug( fileMenu );
2205 fileMenu->insertItem( "&Import", ImportMenu ); 2218 fileMenu->insertItem( "&Import", ImportMenu );
2206 fileMenu->insertItem( "&Export", ExportMenu ); 2219 fileMenu->insertItem( "&Export", ExportMenu );
2207 editMenu->insertItem( i18n("&Change"), changeMenu ); 2220 editMenu->insertItem( i18n("&Change"), changeMenu );
2208 editMenu->insertSeparator(); 2221 editMenu->insertSeparator();
2209#ifndef DESKTOP_VERSION 2222#ifndef DESKTOP_VERSION
2210 if ( Ir::supported() ) fileMenu->insertItem( i18n("&Beam"), beamMenu ); 2223 if ( Ir::supported() ) fileMenu->insertItem( i18n("&Beam"), beamMenu );
2211#endif 2224#endif
2212#if 0 2225#if 0
2213 // PENDING fix MailVCard 2226 // PENDING fix MailVCard
2214 fileMenu->insertSeparator(); 2227 fileMenu->insertSeparator();
2215 mActionMailVCard->plug( fileMenu ); 2228 mActionMailVCard->plug( fileMenu );
2216#endif 2229#endif
2217#ifndef DESKTOP_VERSION 2230#ifndef DESKTOP_VERSION
2218 if ( Ir::supported() ) mActionBR->plug( beamMenu ); 2231 if ( Ir::supported() ) mActionBR->plug( beamMenu );
2219 if ( Ir::supported() ) mActionBeamVCard->plug( beamMenu ); 2232 if ( Ir::supported() ) mActionBeamVCard->plug( beamMenu );
2220 if ( Ir::supported() ) mActionBeam->plug( beamMenu ); 2233 if ( Ir::supported() ) mActionBeam->plug( beamMenu );
2221#endif 2234#endif
2222 fileMenu->insertSeparator(); 2235 fileMenu->insertSeparator();
2223 mActionQuit->plug( fileMenu ); 2236 mActionQuit->plug( fileMenu );
2224#ifdef _OL_IMPORT_ 2237#ifdef _OL_IMPORT_
2225 mActionImportOL->plug( ImportMenu ); 2238 mActionImportOL->plug( ImportMenu );
2226#endif 2239#endif
2227 // edit menu 2240 // edit menu
2228 mActionUndo->plug( editMenu ); 2241 mActionUndo->plug( editMenu );
2229 mActionRedo->plug( editMenu ); 2242 mActionRedo->plug( editMenu );
2230 editMenu->insertSeparator(); 2243 editMenu->insertSeparator();
2231 mActionCut->plug( editMenu ); 2244 mActionCut->plug( editMenu );
2232 mActionCopy->plug( editMenu ); 2245 mActionCopy->plug( editMenu );
2233 mActionPaste->plug( editMenu ); 2246 mActionPaste->plug( editMenu );
2234 mActionDelete->plug( editMenu ); 2247 mActionDelete->plug( editMenu );
2235 editMenu->insertSeparator(); 2248 editMenu->insertSeparator();
2236 mActionSelectAll->plug( editMenu ); 2249 mActionSelectAll->plug( editMenu );
2237 2250
2238 mActionSetFormattedName->plug( changeMenu ); 2251 mActionSetFormattedName->plug( changeMenu );
2239 mActionRemoveVoice->plug( changeMenu ); 2252 mActionRemoveVoice->plug( changeMenu );
2240 // settingsmings menu 2253 // settingsmings menu
2241//US special menuentry to configure the addressbook resources. On KDE 2254//US special menuentry to configure the addressbook resources. On KDE
2242// you do that through the control center !!! 2255// you do that through the control center !!!
2243 // settingsMenu->insertSeparator(); 2256 // settingsMenu->insertSeparator();
2244 2257
2245 mActionConfigKAddressbook->plug( settingsMenu, 0 ); 2258 mActionConfigKAddressbook->plug( settingsMenu, 0 );
2246 mActionConfigResources->plug( settingsMenu,1 ); 2259 mActionConfigGlobal->plug( settingsMenu, 1 );
2247 settingsMenu->insertSeparator(2); 2260 mActionConfigResources->plug( settingsMenu,2 );
2261 settingsMenu->insertSeparator(3);
2248 2262
2249 if ( mIsPart ) { 2263 if ( mIsPart ) {
2250 //US not implemented yet 2264 //US not implemented yet
2251 //mActionConfigShortcuts->plug( settingsMenu ); 2265 //mActionConfigShortcuts->plug( settingsMenu );
2252 //mActionConfigureToolbars->plug( settingsMenu ); 2266 //mActionConfigureToolbars->plug( settingsMenu );
2253 2267
2254 } else { 2268 } else {
2255 //US not implemented yet 2269 //US not implemented yet
2256 //mActionKeyBindings->plug( settingsMenu ); 2270 //mActionKeyBindings->plug( settingsMenu );
2257 } 2271 }
2258 2272
2259 mActionEditCategories->plug( settingsMenu ); 2273 mActionEditCategories->plug( settingsMenu );
2260 mActionManageCategories->plug( settingsMenu ); 2274 mActionManageCategories->plug( settingsMenu );
2261 mActionJumpBar->plug( viewMenu,0 ); 2275 mActionJumpBar->plug( viewMenu,0 );
2262 mActionDetails->plug( viewMenu,0 ); 2276 mActionDetails->plug( viewMenu,0 );
2263 //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) 2277 //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop )
2264 mActionDetails->plug( tb ); 2278 mActionDetails->plug( tb );
2265 settingsMenu->insertSeparator(); 2279 settingsMenu->insertSeparator();
2266#ifndef DESKTOP_VERSION 2280#ifndef DESKTOP_VERSION
2267 if ( Ir::supported() ) mActionBR->plug(settingsMenu ); 2281 if ( Ir::supported() ) mActionBR->plug(settingsMenu );
2268 settingsMenu->insertSeparator(); 2282 settingsMenu->insertSeparator();
2269#endif 2283#endif
2270 2284
2271 mActionWhoAmI->plug( settingsMenu ); 2285 mActionWhoAmI->plug( settingsMenu );
2272 //mActionEditCategories->plug( changeMenu ); 2286 //mActionEditCategories->plug( changeMenu );
2273 mActionCategories->plug( changeMenu ); 2287 mActionCategories->plug( changeMenu );
2274 //mActionManageCategories->plug( changeMenu ); 2288 //mActionManageCategories->plug( changeMenu );
2275 2289
2276 //mActionCategories->plug( settingsMenu ); 2290 //mActionCategories->plug( settingsMenu );
2277 2291
2278 2292
2279 mActionWN->plug( helpMenu ); 2293 mActionWN->plug( helpMenu );
2280 mActionStorageHowto->plug( helpMenu ); 2294 mActionStorageHowto->plug( helpMenu );
2281 mActionSyncHowto->plug( helpMenu ); 2295 mActionSyncHowto->plug( helpMenu );
2282 mActionKdeSyncHowto->plug( helpMenu ); 2296 mActionKdeSyncHowto->plug( helpMenu );
2283 mActionMultiSyncHowto->plug( helpMenu ); 2297 mActionMultiSyncHowto->plug( helpMenu );
2284 mActionFaq->plug( helpMenu ); 2298 mActionFaq->plug( helpMenu );
2285 mActionLicence->plug( helpMenu ); 2299 mActionLicence->plug( helpMenu );
2286 mActionAboutKAddressbook->plug( helpMenu ); 2300 mActionAboutKAddressbook->plug( helpMenu );
2287 2301
2288 if (KGlobal::getDesktopSize() > KGlobal::Small ) { 2302 if (KGlobal::getDesktopSize() > KGlobal::Small ) {
2289 2303
2290 mActionSave->plug( tb ); 2304 mActionSave->plug( tb );
2291 mViewManager->getFilterAction()->plug ( tb); 2305 mViewManager->getFilterAction()->plug ( tb);
2292 //LR hide filteraction on started in 480x640 2306 //LR hide filteraction on started in 480x640
2293 if (QApplication::desktop()->width() == 480 ) { 2307 if (QApplication::desktop()->width() == 480 ) {
2294 mViewManager->getFilterAction()->setComboWidth( 0 ); 2308 mViewManager->getFilterAction()->setComboWidth( 0 );
2295 } 2309 }
2296 mActionUndo->plug( tb ); 2310 mActionUndo->plug( tb );
2297 mActionDelete->plug( tb ); 2311 mActionDelete->plug( tb );
2298 mActionRedo->plug( tb ); 2312 mActionRedo->plug( tb );
2299 } else { 2313 } else {
2300 mActionSave->plug( tb ); 2314 mActionSave->plug( tb );
2301 tb->enableMoving(false); 2315 tb->enableMoving(false);
2302 } 2316 }
2303 //mActionQuit->plug ( tb ); 2317 //mActionQuit->plug ( tb );
2304 //tb->insertWidget(-1, 0, mIncSearchWidget, 6); 2318 //tb->insertWidget(-1, 0, mIncSearchWidget, 6);
2305 2319
2306 //US link the searchwidget first to this. 2320 //US link the searchwidget first to this.
2307 // The real linkage to the toolbar happens later. 2321 // The real linkage to the toolbar happens later.
2308//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); 2322//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE);
2309//US tb->insertItem( mIncSearchWidget ); 2323//US tb->insertItem( mIncSearchWidget );
2310/*US 2324/*US
2311 mIncSearchWidget = new IncSearchWidget( tb ); 2325 mIncSearchWidget = new IncSearchWidget( tb );
2312 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 2326 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
2313 SLOT( incrementalSearch( const QString& ) ) ); 2327 SLOT( incrementalSearch( const QString& ) ) );
2314 2328
2315 mJumpButtonBar = new JumpButtonBar( this, this ); 2329 mJumpButtonBar = new JumpButtonBar( this, this );
2316 2330
2317//US topLayout->addWidget( mJumpButtonBar ); 2331//US topLayout->addWidget( mJumpButtonBar );
2318 this->layout()->add( mJumpButtonBar ); 2332 this->layout()->add( mJumpButtonBar );
2319*/ 2333*/
2320 2334
2321#endif //KAB_EMBEDDED 2335#endif //KAB_EMBEDDED
2322 2336
2323 mActionExport2phone->plug( ExportMenu ); 2337 mActionExport2phone->plug( ExportMenu );
2324 connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); 2338 connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) );
2325 syncManager->fillSyncMenu(); 2339 syncManager->fillSyncMenu();
2326 2340
2327} 2341}
2328void KABCore::showLicence() 2342void KABCore::showLicence()
2329{ 2343{
2330 KApplication::showLicence(); 2344 KApplication::showLicence();
2331} 2345}
2332 2346
2333void KABCore::manageCategories( ) 2347void KABCore::manageCategories( )
2334{ 2348{
2335 KABCatPrefs* cp = new KABCatPrefs(); 2349 KABCatPrefs* cp = new KABCatPrefs();
2336 cp->show(); 2350 cp->show();
2337 int w =cp->sizeHint().width() ; 2351 int w =cp->sizeHint().width() ;
2338 int h = cp->sizeHint().height() ; 2352 int h = cp->sizeHint().height() ;
2339 int dw = QApplication::desktop()->width(); 2353 int dw = QApplication::desktop()->width();
2340 int dh = QApplication::desktop()->height(); 2354 int dh = QApplication::desktop()->height();
2341 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2355 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2342 if ( !cp->exec() ) { 2356 if ( !cp->exec() ) {
2343 delete cp; 2357 delete cp;
2344 return; 2358 return;
2345 } 2359 }
2346 int count = 0; 2360 int count = 0;
2347 int cc = 0; 2361 int cc = 0;
2348 message( i18n("Please wait, processing categories...")); 2362 message( i18n("Please wait, processing categories..."));
2349 if ( cp->addCat() ) { 2363 if ( cp->addCat() ) {
2350 KABC::AddressBook::Iterator it; 2364 KABC::AddressBook::Iterator it;
2351 QStringList catList = KABPrefs::instance()->mCustomCategories; 2365 QStringList catList = KABPrefs::instance()->mCustomCategories;
2352 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 2366 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2353 ++cc; 2367 ++cc;
2354 if ( cc %10 == 0) 2368 if ( cc %10 == 0)
2355 message(i18n("Processing contact #%1").arg(cc)); 2369 message(i18n("Processing contact #%1").arg(cc));
2356 QStringList catIncList = (*it).categories(); 2370 QStringList catIncList = (*it).categories();
2357 int i; 2371 int i;
2358 for( i = 0; i< catIncList.count(); ++i ) { 2372 for( i = 0; i< catIncList.count(); ++i ) {
2359 if ( !catList.contains (catIncList[i])) { 2373 if ( !catList.contains (catIncList[i])) {
2360 catList.append( catIncList[i] ); 2374 catList.append( catIncList[i] );
2361 //qDebug("add cat %s ", catIncList[i].latin1()); 2375 //qDebug("add cat %s ", catIncList[i].latin1());
2362 ++count; 2376 ++count;
2363 } 2377 }
2364 } 2378 }
2365 } 2379 }
2366 catList.sort(); 2380 catList.sort();
2367 KABPrefs::instance()->mCustomCategories = catList; 2381 KABPrefs::instance()->mCustomCategories = catList;
2368 KABPrefs::instance()->writeConfig(); 2382 KABPrefs::instance()->writeConfig();
2369 message(QString::number( count )+ i18n(" categories added to list! ")); 2383 message(QString::number( count )+ i18n(" categories added to list! "));
2370 } else { 2384 } else {
2371 QStringList catList = KABPrefs::instance()->mCustomCategories; 2385 QStringList catList = KABPrefs::instance()->mCustomCategories;
2372 QStringList catIncList; 2386 QStringList catIncList;
2373 QStringList newCatList; 2387 QStringList newCatList;
2374 KABC::AddressBook::Iterator it; 2388 KABC::AddressBook::Iterator it;
2375 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 2389 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2376 ++cc; 2390 ++cc;
2377 if ( cc %10 == 0) 2391 if ( cc %10 == 0)
2378 message(i18n("Processing contact #%1").arg(cc)); 2392 message(i18n("Processing contact #%1").arg(cc));
2379 QStringList catIncList = (*it).categories(); 2393 QStringList catIncList = (*it).categories();
2380 int i; 2394 int i;
2381 if ( catIncList.count() ) { 2395 if ( catIncList.count() ) {
2382 newCatList.clear(); 2396 newCatList.clear();
2383 for( i = 0; i< catIncList.count(); ++i ) { 2397 for( i = 0; i< catIncList.count(); ++i ) {
2384 if ( catList.contains (catIncList[i])) { 2398 if ( catList.contains (catIncList[i])) {
2385 newCatList.append( catIncList[i] ); 2399 newCatList.append( catIncList[i] );
2386 } 2400 }
2387 } 2401 }
2388 newCatList.sort(); 2402 newCatList.sort();
2389 (*it).setCategories( newCatList ); 2403 (*it).setCategories( newCatList );
2390 mAddressBook->insertAddressee( (*it) ); 2404 mAddressBook->insertAddressee( (*it) );
2391 } 2405 }
2392 } 2406 }
2393 setModified( true ); 2407 setModified( true );
2394 mViewManager->refreshView(); 2408 mViewManager->refreshView();
2395 message( i18n("Removing categories done!")); 2409 message( i18n("Removing categories done!"));
2396 } 2410 }
2397 delete cp; 2411 delete cp;
2398} 2412}
2399void KABCore::removeVoice() 2413void KABCore::removeVoice()
2400{ 2414{
2401 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 ) 2415 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 )
2402 return; 2416 return;
2403 XXPortSelectDialog dlg( this, false, this ); 2417 XXPortSelectDialog dlg( this, false, this );
2404 if ( !dlg.exec() ) 2418 if ( !dlg.exec() )
2405 return; 2419 return;
2406 mAddressBook->setUntagged(); 2420 mAddressBook->setUntagged();
2407 dlg.tagSelected(); 2421 dlg.tagSelected();
2408 message(i18n("Removing voice..."), false ); 2422 message(i18n("Removing voice..."), false );
2409 KABC::AddressBook::Iterator it; 2423 KABC::AddressBook::Iterator it;
2410 for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 2424 for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2411 if ( (*it).tagged() ) { 2425 if ( (*it).tagged() ) {
2412 (*it).removeVoice(); 2426 (*it).removeVoice();
2413 } 2427 }
2414 } 2428 }
2415 message(i18n("Refreshing view...") ); 2429 message(i18n("Refreshing view...") );
2416 qApp->processEvents(); 2430 qApp->processEvents();
2417 mViewManager->refreshView( "" ); 2431 mViewManager->refreshView( "" );
2418 Addressee add; 2432 Addressee add;
2419 mDetails->setAddressee( add ); 2433 mDetails->setAddressee( add );
2420 message(i18n("Remove voice completed!") ); 2434 message(i18n("Remove voice completed!") );
2421 2435
2422 2436
2423 2437
2424} 2438}
2425 2439
2426void KABCore::setFormattedName() 2440void KABCore::setFormattedName()
2427{ 2441{
2428 KABFormatPrefs setpref; 2442 KABFormatPrefs setpref;
2429 if ( !setpref.exec() ) { 2443 if ( !setpref.exec() ) {
2430 return; 2444 return;
2431 } 2445 }
2432 XXPortSelectDialog dlg( this, false, this ); 2446 XXPortSelectDialog dlg( this, false, this );
2433 if ( !dlg.exec() ) 2447 if ( !dlg.exec() )
2434 return; 2448 return;
2435 mAddressBook->setUntagged(); 2449 mAddressBook->setUntagged();
2436 dlg.tagSelected(); 2450 dlg.tagSelected();
2437 int count = 0; 2451 int count = 0;
2438 KABC::AddressBook::Iterator it; 2452 KABC::AddressBook::Iterator it;
2439 bool modified = false; 2453 bool modified = false;
2440 for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 2454 for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2441 if ( (*it).tagged() ) { 2455 if ( (*it).tagged() ) {
2442 if ( (*it).uid().left( 2 ) == "la" ) 2456 if ( (*it).uid().left( 2 ) == "la" )
2443 if ( (*it).uid().left( 19 ) == QString("last-syncAddressee-") ) 2457 if ( (*it).uid().left( 19 ) == QString("last-syncAddressee-") )
2444 continue; 2458 continue;
2445 ++count; 2459 ++count;
2446 if ( count %10 == 0 ) 2460 if ( count %10 == 0 )
2447 message(i18n("Changing contact #%1").arg( count ) ); 2461 message(i18n("Changing contact #%1").arg( count ) );
2448 qApp->processEvents(); 2462 qApp->processEvents();
2449 QString fName; 2463 QString fName;
2450 if ( setpref.simple->isChecked() ) 2464 if ( setpref.simple->isChecked() )
2451 fName = NameEditDialog::formattedName( (*it), NameEditDialog::SimpleName ); 2465 fName = NameEditDialog::formattedName( (*it), NameEditDialog::SimpleName );
2452 else if ( setpref.full->isChecked() ) 2466 else if ( setpref.full->isChecked() )
2453 fName = NameEditDialog::formattedName( (*it), NameEditDialog::FullName ); 2467 fName = NameEditDialog::formattedName( (*it), NameEditDialog::FullName );
2454 else if ( setpref.reverse->isChecked() ) 2468 else if ( setpref.reverse->isChecked() )
2455 fName = NameEditDialog::formattedName( (*it), NameEditDialog::ReverseName ); 2469 fName = NameEditDialog::formattedName( (*it), NameEditDialog::ReverseName );
2456 else 2470 else
2457 fName = (*it).organization(); 2471 fName = (*it).organization();
2458 if ( setpref.setCompany->isChecked() ) 2472 if ( setpref.setCompany->isChecked() )
2459 if ( fName.isEmpty() || fName =="," ) 2473 if ( fName.isEmpty() || fName =="," )
2460 fName = (*it).organization(); 2474 fName = (*it).organization();
2461 (*it).setFormattedName( fName ); 2475 (*it).setFormattedName( fName );
2462 (*it).setChanged( true ); 2476 (*it).setChanged( true );
2463 modified = true; 2477 modified = true;
2464 (*it).setRevision( QDateTime::currentDateTime() ); 2478 (*it).setRevision( QDateTime::currentDateTime() );
2465 } 2479 }
2466 } 2480 }
2467 message(i18n("Refreshing view...") ); 2481 message(i18n("Refreshing view...") );
2468 qApp->processEvents(); 2482 qApp->processEvents();
2469 if ( modified ) 2483 if ( modified )
2470 setModified( true ); 2484 setModified( true );
2471 Addressee add; 2485 Addressee add;
2472 mDetails->setAddressee( add ); 2486 mDetails->setAddressee( add );
2473 if ( count == 0 ) 2487 if ( count == 0 )
2474 message(i18n("No contact changed!") ); 2488 message(i18n("No contact changed!") );
2475 else 2489 else
2476 message(i18n("%1 contacts changed!").arg( count ) ); 2490 message(i18n("%1 contacts changed!").arg( count ) );
2477} 2491}
2478 2492
2479void KABCore::clipboardDataChanged() 2493void KABCore::clipboardDataChanged()
2480{ 2494{
2481 2495
2482 if ( mReadWrite ) 2496 if ( mReadWrite )
2483 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); 2497 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() );
2484 2498
2485} 2499}
2486 2500
2487void KABCore::updateActionMenu() 2501void KABCore::updateActionMenu()
2488{ 2502{
2489 UndoStack *undo = UndoStack::instance(); 2503 UndoStack *undo = UndoStack::instance();
2490 RedoStack *redo = RedoStack::instance(); 2504 RedoStack *redo = RedoStack::instance();
2491 2505
2492 if ( undo->isEmpty() ) 2506 if ( undo->isEmpty() )
2493 mActionUndo->setText( i18n( "Undo" ) ); 2507 mActionUndo->setText( i18n( "Undo" ) );
2494 else 2508 else
2495 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); 2509 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) );
2496 2510
2497 mActionUndo->setEnabled( !undo->isEmpty() ); 2511 mActionUndo->setEnabled( !undo->isEmpty() );
2498 2512
2499 if ( !redo->top() ) 2513 if ( !redo->top() )
2500 mActionRedo->setText( i18n( "Redo" ) ); 2514 mActionRedo->setText( i18n( "Redo" ) );
2501 else 2515 else
2502 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); 2516 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) );
2503 2517
2504 mActionRedo->setEnabled( !redo->isEmpty() ); 2518 mActionRedo->setEnabled( !redo->isEmpty() );
2505} 2519}
2506 2520
2507void KABCore::configureKeyBindings() 2521void KABCore::configureKeyBindings()
2508{ 2522{
2509#ifndef KAB_EMBEDDED 2523#ifndef KAB_EMBEDDED
2510 KKeyDialog::configure( actionCollection(), true ); 2524 KKeyDialog::configure( actionCollection(), true );
2511#else //KAB_EMBEDDED 2525#else //KAB_EMBEDDED
2512 qDebug("KABCore::configureKeyBindings() not implemented"); 2526 qDebug("KABCore::configureKeyBindings() not implemented");
2513#endif //KAB_EMBEDDED 2527#endif //KAB_EMBEDDED
2514} 2528}
2515 2529
2516#ifdef KAB_EMBEDDED 2530#ifdef KAB_EMBEDDED
2517void KABCore::configureResources() 2531void KABCore::configureResources()
2518{ 2532{
2519 KRES::KCMKResources dlg( this, "" , 0 ); 2533 KRES::KCMKResources dlg( this, "" , 0 );
2520 2534
2521 if ( !dlg.exec() ) 2535 if ( !dlg.exec() )
2522 return; 2536 return;
2523 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); 2537 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") );
2524} 2538}
2525#endif //KAB_EMBEDDED 2539#endif //KAB_EMBEDDED
2526 2540
2527 2541
2528/* this method will be called through the QCop interface from Ko/Pi to select addresses 2542/* this method will be called through the QCop interface from Ko/Pi to select addresses
2529 * for the attendees list of an event. 2543 * for the attendees list of an event.
2530 */ 2544 */
2531void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) 2545void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid)
2532{ 2546{
2533 2547
2534 bool ok = false; 2548 bool ok = false;
2535 mEmailSourceChannel = sourceChannel; 2549 mEmailSourceChannel = sourceChannel;
2536 mEmailSourceUID = uid; 2550 mEmailSourceUID = uid;
2537 callContactdialog(); 2551 callContactdialog();
2538#if 0 2552#if 0
2539 int wid = uid.toInt( &ok ); 2553 int wid = uid.toInt( &ok );
2540 qDebug("UID %s ", uid.latin1()); 2554 qDebug("UID %s ", uid.latin1());
2541 if ( ok ) { 2555 if ( ok ) {
2542 if ( wid != QApplication::desktop()->width() ) { 2556 if ( wid != QApplication::desktop()->width() ) {
2543 qDebug("KA/Pi: Request from different desktop geometry. Resizing ..."); 2557 qDebug("KA/Pi: Request from different desktop geometry. Resizing ...");
2544 message( i18n("Resizing, please wait...") ); 2558 message( i18n("Resizing, please wait...") );
2545 mMainWindow->showMinimized(); 2559 mMainWindow->showMinimized();
2546 /* 2560 /*
2547 { 2561 {
2548 QCopEnvelope e("QPE/Application/kapi", "callContactdialog()"); 2562 QCopEnvelope e("QPE/Application/kapi", "callContactdialog()");
2549 } 2563 }
2550 */ 2564 */
2551 QTimer::singleShot( 1,this, SLOT ( resizeAndCallContactdialog() ) ); 2565 QTimer::singleShot( 1,this, SLOT ( resizeAndCallContactdialog() ) );
2552 return; 2566 return;
2553 } 2567 }
2554 2568
2555 } else { 2569 } else {
2556 qDebug("KABCore::requestForNameEmailUidList:: Got invalid uid "); 2570 qDebug("KABCore::requestForNameEmailUidList:: Got invalid uid ");
2557 } 2571 }
2558 callContactdialog(); 2572 callContactdialog();
2559 //QCopEnvelope e("QPE/Application/kapi", "callContactdialog()"); 2573 //QCopEnvelope e("QPE/Application/kapi", "callContactdialog()");
2560#endif 2574#endif
2561} 2575}
2562void KABCore::resizeAndCallContactdialog() 2576void KABCore::resizeAndCallContactdialog()
2563{ 2577{
2564 updateMainWindow(); 2578 updateMainWindow();
2565 QTimer::singleShot( 100,this, SLOT ( callContactdialog() ) ); 2579 QTimer::singleShot( 100,this, SLOT ( callContactdialog() ) );
2566} 2580}
2567 2581
2568void KABCore::callContactdialog() 2582void KABCore::callContactdialog()
2569{ 2583{
2570 QStringList nameList; 2584 QStringList nameList;
2571 QStringList emailList; 2585 QStringList emailList;
2572 QStringList uidList; 2586 QStringList uidList;
2573 qDebug(" KABCore::callContactdialog:DESKTOP WIDTH %d ", QApplication::desktop()->width() ); 2587 qDebug(" KABCore::callContactdialog:DESKTOP WIDTH %d ", QApplication::desktop()->width() );
2574 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); 2588 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this);
2575 uint i=0; 2589 uint i=0;
2576 for (i=0; i < list.count(); i++) 2590 for (i=0; i < list.count(); i++)
2577 { 2591 {
2578 nameList.append(list[i].realName()); 2592 nameList.append(list[i].realName());
2579 emailList.append(list[i].preferredEmail()); 2593 emailList.append(list[i].preferredEmail());
2580 uidList.append(list[i].uid()); 2594 uidList.append(list[i].uid());
2581 } 2595 }
2582 QString uid = mEmailSourceUID; 2596 QString uid = mEmailSourceUID;
2583 //qDebug("%s %s ", sourceChannel.latin1(), uid.latin1()); 2597 //qDebug("%s %s ", sourceChannel.latin1(), uid.latin1());
2584 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(mEmailSourceChannel, uid, nameList, emailList, uidList); 2598 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(mEmailSourceChannel, uid, nameList, emailList, uidList);
2585 2599
2586} 2600}
2587/* this method will be called through the QCop interface from Ko/Pi to select birthdays 2601/* this method will be called through the QCop interface from Ko/Pi to select birthdays
2588 * to put them into the calendar. 2602 * to put them into the calendar.
2589 */ 2603 */
2590void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid) 2604void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid)
2591{ 2605{
2592 // qDebug("KABCore::requestForBirthdayList"); 2606 // qDebug("KABCore::requestForBirthdayList");
2593 QStringList birthdayList; 2607 QStringList birthdayList;
2594 QStringList anniversaryList; 2608 QStringList anniversaryList;
2595 QStringList realNameList; 2609 QStringList realNameList;
2596 QStringList preferredEmailList; 2610 QStringList preferredEmailList;
2597 QStringList assembledNameList; 2611 QStringList assembledNameList;
2598 QStringList uidList; 2612 QStringList uidList;
2599 2613
2600 KABC::AddressBook::Iterator it; 2614 KABC::AddressBook::Iterator it;
2601 2615
2602 int count = 0; 2616 int count = 0;
2603 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 2617 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2604 ++count; 2618 ++count;
2605 } 2619 }
2606 QProgressBar bar(count,0 ); 2620 QProgressBar bar(count,0 );
2607 int w = 300; 2621 int w = 300;
2608 if ( QApplication::desktop()->width() < 320 ) 2622 if ( QApplication::desktop()->width() < 320 )
2609 w = 220; 2623 w = 220;
2610 int h = bar.sizeHint().height() ; 2624 int h = bar.sizeHint().height() ;
2611 int dw = QApplication::desktop()->width(); 2625 int dw = QApplication::desktop()->width();
2612 int dh = QApplication::desktop()->height(); 2626 int dh = QApplication::desktop()->height();
2613 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2627 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2614 bar.show(); 2628 bar.show();
2615 bar.setCaption (i18n("Collecting birthdays - close to abort!") ); 2629 bar.setCaption (i18n("Collecting birthdays - close to abort!") );
2616 qApp->processEvents(); 2630 qApp->processEvents();
2617 2631
2618 QDate bday; 2632 QDate bday;
2619 QString anni; 2633 QString anni;
2620 QString formattedbday; 2634 QString formattedbday;
2621 2635
2622 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) 2636 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it )
2623 { 2637 {
2624 if ( ! bar.isVisible() ) 2638 if ( ! bar.isVisible() )
2625 return; 2639 return;
2626 bar.setProgress( count++ ); 2640 bar.setProgress( count++ );
2627 qApp->processEvents(); 2641 qApp->processEvents();
2628 bday = (*it).birthday().date(); 2642 bday = (*it).birthday().date();
2629 anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" ); 2643 anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" );
2630 2644
2631 if ( bday.isValid() || !anni.isEmpty()) 2645 if ( bday.isValid() || !anni.isEmpty())
2632 { 2646 {
2633 if (bday.isValid()) 2647 if (bday.isValid())
2634 formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate); 2648 formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate);
2635 else 2649 else
2636 formattedbday = "NOTVALID"; 2650 formattedbday = "NOTVALID";
2637 if (anni.isEmpty()) 2651 if (anni.isEmpty())
2638 anni = "INVALID"; 2652 anni = "INVALID";
2639 2653
2640 birthdayList.append(formattedbday); 2654 birthdayList.append(formattedbday);
2641 anniversaryList.append(anni); //should be ISODate 2655 anniversaryList.append(anni); //should be ISODate
2642 realNameList.append((*it).realName()); 2656 realNameList.append((*it).realName());
2643 preferredEmailList.append((*it).preferredEmail()); 2657 preferredEmailList.append((*it).preferredEmail());
2644 assembledNameList.append((*it).assembledName()); 2658 assembledNameList.append((*it).assembledName());
2645 uidList.append((*it).uid()); 2659 uidList.append((*it).uid());
2646 2660
2647 //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() ); 2661 //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() );
2648 } 2662 }
2649 } 2663 }
2650 2664
2651 bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList); 2665 bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList);
2652 2666
2653} 2667}
2654 2668
2655/* this method will be called through the QCop interface from other apps to show details of a contact. 2669/* this method will be called through the QCop interface from other apps to show details of a contact.
2656 */ 2670 */
2657void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) 2671void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid)
2658{ 2672{
2659 //qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); 2673 //qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1());
2660 2674
2661 QString foundUid = QString::null; 2675 QString foundUid = QString::null;
2662 if ( ! uid.isEmpty() ) { 2676 if ( ! uid.isEmpty() ) {
2663 Addressee adrr = mAddressBook->findByUid( uid ); 2677 Addressee adrr = mAddressBook->findByUid( uid );
2664 if ( !adrr.isEmpty() ) { 2678 if ( !adrr.isEmpty() ) {
2665 foundUid = uid; 2679 foundUid = uid;
2666 } 2680 }
2667 if ( email == "sendbacklist" ) { 2681 if ( email == "sendbacklist" ) {
2668 //qDebug("ssssssssssssssssssssssend "); 2682 //qDebug("ssssssssssssssssssssssend ");
2669 QStringList nameList; 2683 QStringList nameList;
2670 QStringList emailList; 2684 QStringList emailList;
2671 QStringList uidList; 2685 QStringList uidList;
2672 nameList.append(adrr.realName()); 2686 nameList.append(adrr.realName());
2673 emailList = adrr.emails(); 2687 emailList = adrr.emails();
2674 uidList.append( adrr.preferredEmail()); 2688 uidList.append( adrr.preferredEmail());
2675 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); 2689 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList);
2676 return; 2690 return;
2677 } 2691 }
2678 2692
2679 } 2693 }
2680 2694
2681 if ( email == "sendbacklist" ) 2695 if ( email == "sendbacklist" )
2682 return; 2696 return;
2683 if (foundUid.isEmpty()) 2697 if (foundUid.isEmpty())
2684 { 2698 {
2685 //find the uid of the person first 2699 //find the uid of the person first
2686 Addressee::List namelist; 2700 Addressee::List namelist;
2687 Addressee::List emaillist; 2701 Addressee::List emaillist;
2688 2702
2689 if (!name.isEmpty()) 2703 if (!name.isEmpty())
2690 namelist = mAddressBook->findByName( name ); 2704 namelist = mAddressBook->findByName( name );
2691 2705
2692 if (!email.isEmpty()) 2706 if (!email.isEmpty())
2693 emaillist = mAddressBook->findByEmail( email ); 2707 emaillist = mAddressBook->findByEmail( email );
2694 //qDebug("count %d %d ", namelist.count(),emaillist.count() ); 2708 //qDebug("count %d %d ", namelist.count(),emaillist.count() );
2695 //check if we have a match in Namelist and Emaillist 2709 //check if we have a match in Namelist and Emaillist
2696 if ((namelist.count() == 0) && (emaillist.count() > 0)) { 2710 if ((namelist.count() == 0) && (emaillist.count() > 0)) {
2697 foundUid = emaillist[0].uid(); 2711 foundUid = emaillist[0].uid();
2698 } 2712 }
2699 else if ((namelist.count() > 0) && (emaillist.count() == 0)) 2713 else if ((namelist.count() > 0) && (emaillist.count() == 0))
2700 foundUid = namelist[0].uid(); 2714 foundUid = namelist[0].uid();
2701 else 2715 else
2702 { 2716 {
2703 for (int i = 0; i < namelist.count(); i++) 2717 for (int i = 0; i < namelist.count(); i++)
2704 { 2718 {
2705 for (int j = 0; j < emaillist.count(); j++) 2719 for (int j = 0; j < emaillist.count(); j++)
2706 { 2720 {
2707 if (namelist[i] == emaillist[j]) 2721 if (namelist[i] == emaillist[j])
2708 { 2722 {
2709 foundUid = namelist[i].uid(); 2723 foundUid = namelist[i].uid();
2710 } 2724 }
2711 } 2725 }
2712 } 2726 }
2713 } 2727 }
2714 } 2728 }
2715 else 2729 else
2716 { 2730 {
2717 foundUid = uid; 2731 foundUid = uid;
2718 } 2732 }
2719 2733
2720 if (!foundUid.isEmpty()) 2734 if (!foundUid.isEmpty())
2721 { 2735 {
2722 2736
2723 // raise Ka/Pi if it is in the background 2737 // raise Ka/Pi if it is in the background
2724#ifndef DESKTOP_VERSION 2738#ifndef DESKTOP_VERSION
2725#ifndef KORG_NODCOP 2739#ifndef KORG_NODCOP
2726 //QCopEnvelope e("QPE/Application/kapi", "raise()"); 2740 //QCopEnvelope e("QPE/Application/kapi", "raise()");
2727#endif 2741#endif
2728#endif 2742#endif
2729 2743
2730 mMainWindow->showMaximized(); 2744 mMainWindow->showMaximized();
2731 mMainWindow-> raise(); 2745 mMainWindow-> raise();
2732 2746
2733 mViewManager->setSelected( "", false); 2747 mViewManager->setSelected( "", false);
2734 mViewManager->refreshView( "" ); 2748 mViewManager->refreshView( "" );
2735 mViewManager->setSelected( foundUid, true ); 2749 mViewManager->setSelected( foundUid, true );
2736 mViewManager->refreshView( foundUid ); 2750 mViewManager->refreshView( foundUid );
2737 2751
2738 if ( !mMultipleViewsAtOnce ) 2752 if ( !mMultipleViewsAtOnce )
2739 { 2753 {
2740 setDetailsVisible( true ); 2754 setDetailsVisible( true );
2741 mActionDetails->setChecked(true); 2755 mActionDetails->setChecked(true);
2742 } 2756 }
2743 } 2757 }
2744} 2758}
2745void KABCore::storagehowto() 2759void KABCore::storagehowto()
2746{ 2760{
2747 KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" ); 2761 KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" );
2748} 2762}
2749void KABCore::whatsnew() 2763void KABCore::whatsnew()
2750{ 2764{
2751 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); 2765 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" );
2752} 2766}
2753void KABCore::synchowto() 2767void KABCore::synchowto()
2754{ 2768{
2755 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); 2769 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" );
2756} 2770}
2757void KABCore::kdesynchowto() 2771void KABCore::kdesynchowto()
2758{ 2772{
2759 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); 2773 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" );
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index 80dbf08..6479a58 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -1,528 +1,530 @@
1/* 1/*
2 This file is part of KAddressbook. 2 This file is part of KAddressbook.
3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> 3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#ifndef KABCORE_H 24#ifndef KABCORE_H
25#define KABCORE_H 25#define KABCORE_H
26 26
27#include <kabc/field.h> 27#include <kabc/field.h>
28 28
29#ifndef KAB_EMBEDDED 29#ifndef KAB_EMBEDDED
30#endif //KAB_EMBEDDED 30#endif //KAB_EMBEDDED
31#include <qdict.h> 31#include <qdict.h>
32#include <qtimer.h> 32#include <qtimer.h>
33 33
34#include <qwidget.h> 34#include <qwidget.h>
35#include <qpopupmenu.h> 35#include <qpopupmenu.h>
36#include <ksyncmanager.h> 36#include <ksyncmanager.h>
37#ifndef DESKTOP_VERSION 37#ifndef DESKTOP_VERSION
38#include <qcopchannel_qws.h> 38#include <qcopchannel_qws.h>
39#endif 39#endif
40 40
41namespace KABC { 41namespace KABC {
42class AddressBook; 42class AddressBook;
43} 43}
44 44
45#ifndef KAB_EMBEDDED 45#ifndef KAB_EMBEDDED
46class KAboutData; 46class KAboutData;
47class KConfig; 47class KConfig;
48 48
49class KAddressBookService; 49class KAddressBookService;
50class LDAPSearchDialog; 50class LDAPSearchDialog;
51#else //KAB_EMBEDDED 51#else //KAB_EMBEDDED
52class KAddressBookMain; 52class KAddressBookMain;
53//US class QAction; 53//US class QAction;
54#endif //KAB_EMBEDDED 54#endif //KAB_EMBEDDED
55class KCMultiDialog; 55class KCMultiDialog;
56class KXMLGUIClient; 56class KXMLGUIClient;
57class ExtensionManager; 57class ExtensionManager;
58class XXPortManager; 58class XXPortManager;
59class JumpButtonBar; 59class JumpButtonBar;
60class IncSearchWidget; 60class IncSearchWidget;
61class KDGanttMinimizeSplitter; 61class KDGanttMinimizeSplitter;
62class KAction; 62class KAction;
63class KActionCollection; 63class KActionCollection;
64class KToggleAction; 64class KToggleAction;
65class KSyncProfile; 65class KSyncProfile;
66 66
67class QAction; 67class QAction;
68class QMenuBar; 68class QMenuBar;
69class QSplitter; 69class QSplitter;
70class ViewContainer; 70class ViewContainer;
71class ViewManager; 71class ViewManager;
72class AddresseeEditorDialog; 72class AddresseeEditorDialog;
73class Ir; 73class Ir;
74 74
75class KABCore : public QWidget, public KSyncInterface 75class KABCore : public QWidget, public KSyncInterface
76{ 76{
77 Q_OBJECT 77 Q_OBJECT
78 78
79 public: 79 public:
80 KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name = 0 ); 80 KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name = 0 );
81 81
82 82
83 ~KABCore(); 83 ~KABCore();
84 84
85 85
86#ifdef KAB_EMBEDDED 86#ifdef KAB_EMBEDDED
87 //US added functionality 87 //US added functionality
88 QPopupMenu* getViewMenu() {return viewMenu;} 88 QPopupMenu* getViewMenu() {return viewMenu;}
89 QPopupMenu* getFilterMenu() {return filterMenu;} 89 QPopupMenu* getFilterMenu() {return filterMenu;}
90 QPopupMenu* getSettingsMenu() {return settingsMenu;} 90 QPopupMenu* getSettingsMenu() {return settingsMenu;}
91 void addActionsManually(); 91 void addActionsManually();
92#endif //KAB_EMBEDDED 92#endif //KAB_EMBEDDED
93 /** 93 /**
94 Restores the global settings. 94 Restores the global settings.
95 */ 95 */
96 void restoreSettings(); 96 void restoreSettings();
97 97
98 98
99 99
100 /** 100 /**
101 Returns a pointer to the StdAddressBook of the application. 101 Returns a pointer to the StdAddressBook of the application.
102 */ 102 */
103 KABC::AddressBook *addressBook() const; 103 KABC::AddressBook *addressBook() const;
104 104
105 /** 105 /**
106 Returns a pointer to the KConfig object of the application. 106 Returns a pointer to the KConfig object of the application.
107 */ 107 */
108 static KConfig *config(); 108 static KConfig *config();
109 109
110 /** 110 /**
111 Returns a pointer to the global KActionCollection object. So 111 Returns a pointer to the global KActionCollection object. So
112 other classes can register their actions easily. 112 other classes can register their actions easily.
113 */ 113 */
114 KActionCollection *actionCollection() const; 114 KActionCollection *actionCollection() const;
115 115
116 /** 116 /**
117 Returns the current search field of the Incremental Search Widget. 117 Returns the current search field of the Incremental Search Widget.
118 */ 118 */
119 KABC::Field *currentSearchField() const; 119 KABC::Field *currentSearchField() const;
120 120
121 /** 121 /**
122 Returns the uid list of the currently selected contacts. 122 Returns the uid list of the currently selected contacts.
123 */ 123 */
124 QStringList selectedUIDs() const; 124 QStringList selectedUIDs() const;
125 125
126 /** 126 /**
127 Displays the ResourceSelectDialog and returns the selected 127 Displays the ResourceSelectDialog and returns the selected
128 resource or a null pointer if no resource was selected by 128 resource or a null pointer if no resource was selected by
129 the user. 129 the user.
130 */ 130 */
131 KABC::Resource *requestResource( QWidget *parent ); 131 KABC::Resource *requestResource( QWidget *parent );
132 132
133#ifndef KAB_EMBEDDED 133#ifndef KAB_EMBEDDED
134 static KAboutData *createAboutData(); 134 static KAboutData *createAboutData();
135#endif //KAB_EMBEDDED 135#endif //KAB_EMBEDDED
136 136
137#ifdef KAB_EMBEDDED 137#ifdef KAB_EMBEDDED
138 inline QPopupMenu* getImportMenu() { return ImportMenu;} 138 inline QPopupMenu* getImportMenu() { return ImportMenu;}
139 inline QPopupMenu* getExportMenu() { return ExportMenu;} 139 inline QPopupMenu* getExportMenu() { return ExportMenu;}
140#endif //KAB_EMBEDDED 140#endif //KAB_EMBEDDED
141 141
142 public slots: 142 public slots:
143#ifdef KAB_EMBEDDED 143#ifdef KAB_EMBEDDED
144 void createAboutData(); 144 void createAboutData();
145#endif //KAB_EMBEDDED 145#endif //KAB_EMBEDDED
146 void setDetailsToggle(); 146 void setDetailsToggle();
147 147
148 void showLicence(); 148 void showLicence();
149 void faq(); 149 void faq();
150 void whatsnew() ; 150 void whatsnew() ;
151 void synchowto() ; 151 void synchowto() ;
152 void storagehowto() ; 152 void storagehowto() ;
153 void multisynchowto() ; 153 void multisynchowto() ;
154 void kdesynchowto() ; 154 void kdesynchowto() ;
155 void writeToPhone(); 155 void writeToPhone();
156 156
157 /** 157 /**
158 Is called whenever a contact is selected in the view. 158 Is called whenever a contact is selected in the view.
159 */ 159 */
160 void setContactSelected( const QString &uid ); 160 void setContactSelected( const QString &uid );
161 161
162 /** 162 /**
163 Opens the preferred mail composer with all selected contacts as 163 Opens the preferred mail composer with all selected contacts as
164 arguments. 164 arguments.
165 */ 165 */
166 void sendMail(); 166 void sendMail();
167 167
168 /** 168 /**
169 Opens the preferred mail composer with the given contacts as 169 Opens the preferred mail composer with the given contacts as
170 arguments. 170 arguments.
171 */ 171 */
172 void sendMail( const QString& email ); 172 void sendMail( const QString& email );
173 173
174 174
175 void mailVCard(); 175 void mailVCard();
176 void mailVCard(const QStringList& uids); 176 void mailVCard(const QStringList& uids);
177 177
178 /** 178 /**
179 Beams the "WhoAmI contact. 179 Beams the "WhoAmI contact.
180 */ 180 */
181 void beamMySelf(); 181 void beamMySelf();
182 182
183 void beamVCard(); 183 void beamVCard();
184 void export2phone(); 184 void export2phone();
185 void beamVCard(const QStringList& uids); 185 void beamVCard(const QStringList& uids);
186 void beamDone( Ir *ir ); 186 void beamDone( Ir *ir );
187 187
188 188
189 /** 189 /**
190 Starts the preferred web browser with the given URL as argument. 190 Starts the preferred web browser with the given URL as argument.
191 */ 191 */
192 void browse( const QString& url ); 192 void browse( const QString& url );
193 193
194 /** 194 /**
195 Select all contacts in the view. 195 Select all contacts in the view.
196 */ 196 */
197 void selectAllContacts(); 197 void selectAllContacts();
198 198
199 /** 199 /**
200 Deletes all selected contacts from the address book. 200 Deletes all selected contacts from the address book.
201 */ 201 */
202 void deleteContacts(); 202 void deleteContacts();
203 203
204 /** 204 /**
205 Deletes given contacts from the address book. 205 Deletes given contacts from the address book.
206 206
207 @param uids The uids of the contacts, which shall be deleted. 207 @param uids The uids of the contacts, which shall be deleted.
208 */ 208 */
209 void deleteContacts( const QStringList &uids ); 209 void deleteContacts( const QStringList &uids );
210 210
211 /** 211 /**
212 Copys the selected contacts into clipboard for later pasting. 212 Copys the selected contacts into clipboard for later pasting.
213 */ 213 */
214 void copyContacts(); 214 void copyContacts();
215 215
216 /** 216 /**
217 Cuts the selected contacts and stores them for later pasting. 217 Cuts the selected contacts and stores them for later pasting.
218 */ 218 */
219 void cutContacts(); 219 void cutContacts();
220 220
221 /** 221 /**
222 Paste contacts from clipboard into the address book. 222 Paste contacts from clipboard into the address book.
223 */ 223 */
224 void pasteContacts(); 224 void pasteContacts();
225 225
226 /** 226 /**
227 Paste given contacts into the address book. 227 Paste given contacts into the address book.
228 228
229 @param list The list of addressee, which shall be pasted. 229 @param list The list of addressee, which shall be pasted.
230 */ 230 */
231 void pasteContacts( KABC::Addressee::List &list ); 231 void pasteContacts( KABC::Addressee::List &list );
232 232
233 /** 233 /**
234 Sets the whoAmI contact, that is used by many other programs to 234 Sets the whoAmI contact, that is used by many other programs to
235 get personal information about the current user. 235 get personal information about the current user.
236 */ 236 */
237 void setWhoAmI(); 237 void setWhoAmI();
238 238
239 /** 239 /**
240 Displays the category dialog and applies the result to all 240 Displays the category dialog and applies the result to all
241 selected contacts. 241 selected contacts.
242 */ 242 */
243 void setCategories(); 243 void setCategories();
244 void manageCategories(); 244 void manageCategories();
245 void editCategories(); 245 void editCategories();
246 246
247 /** 247 /**
248 Sets the field list of the Incremental Search Widget. 248 Sets the field list of the Incremental Search Widget.
249 */ 249 */
250 void setSearchFields( const KABC::Field::List &fields ); 250 void setSearchFields( const KABC::Field::List &fields );
251 251
252 /** 252 /**
253 Search with the current search field for a contact, that matches 253 Search with the current search field for a contact, that matches
254 the given text, and selects it in the view. 254 the given text, and selects it in the view.
255 */ 255 */
256 void incrementalSearch( const QString& text ); 256 void incrementalSearch( const QString& text );
257 void incrementalSearchJump( const QString& text ); 257 void incrementalSearchJump( const QString& text );
258 258
259 /** 259 /**
260 Marks the address book as modified. 260 Marks the address book as modified.
261 */ 261 */
262 void setModified(); 262 void setModified();
263 /** 263 /**
264 Marks the address book as modified without refreshing the view. 264 Marks the address book as modified without refreshing the view.
265 */ 265 */
266 void setModifiedWOrefresh(); 266 void setModifiedWOrefresh();
267 267
268 /** 268 /**
269 Marks the address book as modified concerning the argument. 269 Marks the address book as modified concerning the argument.
270 */ 270 */
271 void setModified( bool modified ); 271 void setModified( bool modified );
272 272
273 /** 273 /**
274 Returns whether the address book is modified. 274 Returns whether the address book is modified.
275 */ 275 */
276 bool modified() const; 276 bool modified() const;
277 277
278 /** 278 /**
279 Called whenever an contact is modified in the contact editor 279 Called whenever an contact is modified in the contact editor
280 dialog or the quick edit. 280 dialog or the quick edit.
281 */ 281 */
282 void contactModified( const KABC::Addressee &addr ); 282 void contactModified( const KABC::Addressee &addr );
283 void addrModified( const KABC::Addressee &addr, bool updateDetails = true ); 283 void addrModified( const KABC::Addressee &addr, bool updateDetails = true );
284 284
285 /** 285 /**
286 DCOP METHODS. 286 DCOP METHODS.
287 */ 287 */
288 void addEmail( QString addr ); 288 void addEmail( QString addr );
289 void importVCard( const KURL& url, bool showPreview ); 289 void importVCard( const KURL& url, bool showPreview );
290 void importVCard( const QString& vCard, bool showPreview ); 290 void importVCard( const QString& vCard, bool showPreview );
291 void newContact(); 291 void newContact();
292 QString getNameByPhone( const QString& phone ); 292 QString getNameByPhone( const QString& phone );
293 /** 293 /**
294 END DCOP METHODS 294 END DCOP METHODS
295 */ 295 */
296 296
297 /** 297 /**
298 Saves the contents of the AddressBook back to disk. 298 Saves the contents of the AddressBook back to disk.
299 */ 299 */
300 void save(); 300 void save();
301 301
302 /** 302 /**
303 Undos the last command using the undo stack. 303 Undos the last command using the undo stack.
304 */ 304 */
305 void undo(); 305 void undo();
306 306
307 /** 307 /**
308 Redos the last command that was undone, using the redo stack. 308 Redos the last command that was undone, using the redo stack.
309 */ 309 */
310 void redo(); 310 void redo();
311 311
312 /** 312 /**
313 Shows the edit dialog for the given uid. If the uid is QString::null, 313 Shows the edit dialog for the given uid. If the uid is QString::null,
314 the method will try to find a selected addressee in the view. 314 the method will try to find a selected addressee in the view.
315 */ 315 */
316 void editContact( const QString &uid /*US = QString::null*/ ); 316 void editContact( const QString &uid /*US = QString::null*/ );
317//US added a second method without defaultparameter 317//US added a second method without defaultparameter
318 void editContact2(); 318 void editContact2();
319 319
320 /** 320 /**
321 Shows or edits the detail view for the given uid. If the uid is QString::null, 321 Shows or edits the detail view for the given uid. If the uid is QString::null,
322 the method will try to find a selected addressee in the view. 322 the method will try to find a selected addressee in the view.
323 */ 323 */
324 void executeContact( const QString &uid /*US = QString::null*/ ); 324 void executeContact( const QString &uid /*US = QString::null*/ );
325 325
326 /** 326 /**
327 Launches the configuration dialog. 327 Launches the configuration dialog.
328 */ 328 */
329 void openConfigDialog(); 329 void openConfigDialog();
330 void openConfigGlobalDialog();
330 331
331 /** 332 /**
332 Launches the ldap search dialog. 333 Launches the ldap search dialog.
333 */ 334 */
334 void openLDAPDialog(); 335 void openLDAPDialog();
335 336
336 /** 337 /**
337 Creates a KAddressBookPrinter, which will display the print 338 Creates a KAddressBookPrinter, which will display the print
338 dialog and do the printing. 339 dialog and do the printing.
339 */ 340 */
340 void print(); 341 void print();
341 342
342 /** 343 /**
343 Registers a new GUI client, so plugins can register its actions. 344 Registers a new GUI client, so plugins can register its actions.
344 */ 345 */
345 void addGUIClient( KXMLGUIClient *client ); 346 void addGUIClient( KXMLGUIClient *client );
346 347
347 void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid); 348 void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid);
348 void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); 349 void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid);
349 void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid); 350 void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid);
350 351
351 352
352 signals: 353 signals:
353 void contactSelected( const QString &name ); 354 void contactSelected( const QString &name );
354 void contactSelected( const QPixmap &pixmap ); 355 void contactSelected( const QPixmap &pixmap );
355 public slots: 356 public slots:
356 void recieve(QString cmsg ); 357 void recieve(QString cmsg );
357 void getFile( bool success ); 358 void getFile( bool success );
358 void syncFileRequest(); 359 void syncFileRequest();
359 void setDetailsVisible( bool visible ); 360 void setDetailsVisible( bool visible );
360 void setDetailsToState(); 361 void setDetailsToState();
361 362
362 void saveSettings(); 363 void saveSettings();
363 364
364 private slots: 365 private slots:
365 void updateToolBar(); 366 void updateToolBar();
366 void updateMainWindow(); 367 void updateMainWindow();
367 void receive( const QCString& cmsg, const QByteArray& data ); 368 void receive( const QCString& cmsg, const QByteArray& data );
368 void toggleBeamReceive( ); 369 void toggleBeamReceive( );
369 void disableBR(bool); 370 void disableBR(bool);
370 void setJumpButtonBarVisible( bool visible ); 371 void setJumpButtonBarVisible( bool visible );
371 void setJumpButtonBar( bool visible ); 372 void setJumpButtonBar( bool visible );
372 void setCaptionBack(); 373 void setCaptionBack();
373 void resizeAndCallContactdialog(); 374 void resizeAndCallContactdialog();
374 void callContactdialog(); 375 void callContactdialog();
375 376
376 void importFromOL(); 377 void importFromOL();
377 void extensionModified( const KABC::Addressee::List &list ); 378 void extensionModified( const KABC::Addressee::List &list );
378 void extensionChanged( int id ); 379 void extensionChanged( int id );
379 void clipboardDataChanged(); 380 void clipboardDataChanged();
380 void updateActionMenu(); 381 void updateActionMenu();
381 void configureKeyBindings(); 382 void configureKeyBindings();
382 void removeVoice(); 383 void removeVoice();
383 void setFormattedName(); 384 void setFormattedName();
384#ifdef KAB_EMBEDDED 385#ifdef KAB_EMBEDDED
385 void configureResources(); 386 void configureResources();
386#endif //KAB_EMBEDDED 387#endif //KAB_EMBEDDED
387 388
388 void slotEditorDestroyed( const QString &uid ); 389 void slotEditorDestroyed( const QString &uid );
389 void configurationChanged(); 390 void configurationChanged();
390 void addressBookChanged(); 391 void addressBookChanged();
391 392
392 private: 393 private:
393 QString mEmailSourceChannel; 394 QString mEmailSourceChannel;
394 QString mEmailSourceUID; 395 QString mEmailSourceUID;
395 void resizeEvent(QResizeEvent* e ); 396 void resizeEvent(QResizeEvent* e );
396 bool mBRdisabled; 397 bool mBRdisabled;
397#ifndef DESKTOP_VERSION 398#ifndef DESKTOP_VERSION
398 QCopChannel* infrared; 399 QCopChannel* infrared;
399#endif 400#endif
400 QTimer *mMessageTimer; 401 QTimer *mMessageTimer;
401 void initGUI(); 402 void initGUI();
402 void initActions(); 403 void initActions();
403 QString getPhoneFile(); 404 QString getPhoneFile();
404 405
405 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, 406 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent,
406 const char *name = 0 ); 407 const char *name = 0 );
407 408
408 KXMLGUIClient *mGUIClient; 409 KXMLGUIClient *mGUIClient;
409 410
410 KABC::AddressBook *mAddressBook; 411 KABC::AddressBook *mAddressBook;
411 412
412 ViewManager *mViewManager; 413 ViewManager *mViewManager;
413 // QSplitter *mDetailsSplitter; 414 // QSplitter *mDetailsSplitter;
414 KDGanttMinimizeSplitter *mExtensionBarSplitter; 415 KDGanttMinimizeSplitter *mExtensionBarSplitter;
415 ViewContainer *mDetails; 416 ViewContainer *mDetails;
416 KDGanttMinimizeSplitter* mMiniSplitter; 417 KDGanttMinimizeSplitter* mMiniSplitter;
417 XXPortManager *mXXPortManager; 418 XXPortManager *mXXPortManager;
418 JumpButtonBar *mJumpButtonBar; 419 JumpButtonBar *mJumpButtonBar;
419 IncSearchWidget *mIncSearchWidget; 420 IncSearchWidget *mIncSearchWidget;
420 ExtensionManager *mExtensionManager; 421 ExtensionManager *mExtensionManager;
421 422
422 KCMultiDialog *mConfigureDialog; 423 KCMultiDialog *mConfigureDialog;
423 424
424#ifndef KAB_EMBEDDED 425#ifndef KAB_EMBEDDED
425 LDAPSearchDialog *mLdapSearchDialog; 426 LDAPSearchDialog *mLdapSearchDialog;
426#endif //KAB_EMBEDDED 427#endif //KAB_EMBEDDED
427 // QDict<AddresseeEditorDialog> mEditorDict; 428 // QDict<AddresseeEditorDialog> mEditorDict;
428 AddresseeEditorDialog *mEditorDialog; 429 AddresseeEditorDialog *mEditorDialog;
429 bool mReadWrite; 430 bool mReadWrite;
430 bool mModified; 431 bool mModified;
431 bool mIsPart; 432 bool mIsPart;
432 bool mMultipleViewsAtOnce; 433 bool mMultipleViewsAtOnce;
433 434
434 435
435 //US file menu 436 //US file menu
436 KAction *mActionMail; 437 KAction *mActionMail;
437 KAction *mActionBeam; 438 KAction *mActionBeam;
438 KToggleAction *mActionBR; 439 KToggleAction *mActionBR;
439 KAction *mActionExport2phone; 440 KAction *mActionExport2phone;
440 KAction* mActionPrint; 441 KAction* mActionPrint;
441 KAction* mActionPrintDetails; 442 KAction* mActionPrintDetails;
442 KAction* mActionNewContact; 443 KAction* mActionNewContact;
443 KAction *mActionSave; 444 KAction *mActionSave;
444 KAction *mActionEditAddressee; 445 KAction *mActionEditAddressee;
445 KAction *mActionMailVCard; 446 KAction *mActionMailVCard;
446 KAction *mActionBeamVCard; 447 KAction *mActionBeamVCard;
447 448
448 KAction *mActionQuit; 449 KAction *mActionQuit;
449 450
450 //US edit menu 451 //US edit menu
451 KAction *mActionCopy; 452 KAction *mActionCopy;
452 KAction *mActionCut; 453 KAction *mActionCut;
453 KAction *mActionPaste; 454 KAction *mActionPaste;
454 KAction *mActionSelectAll; 455 KAction *mActionSelectAll;
455 KAction *mActionUndo; 456 KAction *mActionUndo;
456 KAction *mActionRedo; 457 KAction *mActionRedo;
457 KAction *mActionDelete; 458 KAction *mActionDelete;
458 459
459 //US settings menu 460 //US settings menu
460 KAction *mActionConfigResources; 461 KAction *mActionConfigResources;
462 KAction *mActionConfigGlobal;
461 KAction *mActionConfigKAddressbook; 463 KAction *mActionConfigKAddressbook;
462 KAction *mActionConfigShortcuts; 464 KAction *mActionConfigShortcuts;
463 KAction *mActionConfigureToolbars; 465 KAction *mActionConfigureToolbars;
464 KAction *mActionKeyBindings; 466 KAction *mActionKeyBindings;
465 KToggleAction *mActionJumpBar; 467 KToggleAction *mActionJumpBar;
466 KToggleAction *mActionDetails; 468 KToggleAction *mActionDetails;
467 KAction *mActionWhoAmI; 469 KAction *mActionWhoAmI;
468 KAction *mActionCategories; 470 KAction *mActionCategories;
469 KAction *mActionEditCategories; 471 KAction *mActionEditCategories;
470 KAction *mActionManageCategories; 472 KAction *mActionManageCategories;
471 KAction *mActionAboutKAddressbook; 473 KAction *mActionAboutKAddressbook;
472 KAction *mActionLicence; 474 KAction *mActionLicence;
473 KAction *mActionFaq; 475 KAction *mActionFaq;
474 KAction *mActionWN; 476 KAction *mActionWN;
475 KAction *mActionSyncHowto; 477 KAction *mActionSyncHowto;
476 KAction *mActionStorageHowto; 478 KAction *mActionStorageHowto;
477 KAction *mActionKdeSyncHowto; 479 KAction *mActionKdeSyncHowto;
478 KAction *mActionMultiSyncHowto; 480 KAction *mActionMultiSyncHowto;
479 481
480 KAction *mActionDeleteView; 482 KAction *mActionDeleteView;
481 483
482 QPopupMenu *viewMenu; 484 QPopupMenu *viewMenu;
483 QPopupMenu *filterMenu; 485 QPopupMenu *filterMenu;
484 QPopupMenu *settingsMenu; 486 QPopupMenu *settingsMenu;
485 QPopupMenu *changeMenu; 487 QPopupMenu *changeMenu;
486 QPopupMenu *beamMenu; 488 QPopupMenu *beamMenu;
487//US QAction *mActionSave; 489//US QAction *mActionSave;
488 QPopupMenu *ImportMenu; 490 QPopupMenu *ImportMenu;
489 QPopupMenu *ExportMenu; 491 QPopupMenu *ExportMenu;
490 //LR additional methods 492 //LR additional methods
491 KAction *mActionRemoveVoice; 493 KAction *mActionRemoveVoice;
492 KAction *mActionSetFormattedName; 494 KAction *mActionSetFormattedName;
493 KAction * mActionImportOL; 495 KAction * mActionImportOL;
494 496
495#ifndef KAB_EMBEDDED 497#ifndef KAB_EMBEDDED
496 KAddressBookService *mAddressBookService; 498 KAddressBookService *mAddressBookService;
497#endif //KAB_EMBEDDED 499#endif //KAB_EMBEDDED
498 500
499 class KABCorePrivate; 501 class KABCorePrivate;
500 KABCorePrivate *d; 502 KABCorePrivate *d;
501 //US bool mBlockSaveFlag; 503 //US bool mBlockSaveFlag;
502 504
503#ifdef KAB_EMBEDDED 505#ifdef KAB_EMBEDDED
504 KAddressBookMain *mMainWindow; // should be the same like mGUIClient 506 KAddressBookMain *mMainWindow; // should be the same like mGUIClient
505#endif //KAB_EMBEDDED 507#endif //KAB_EMBEDDED
506 508
507 //this are the overwritten callbackmethods from the syncinterface 509 //this are the overwritten callbackmethods from the syncinterface
508 virtual bool sync(KSyncManager* manager, QString filename, int mode); 510 virtual bool sync(KSyncManager* manager, QString filename, int mode);
509 virtual bool syncExternal(KSyncManager* manager, QString resource); 511 virtual bool syncExternal(KSyncManager* manager, QString resource);
510 virtual void removeSyncInfo( QString syncProfile); 512 virtual void removeSyncInfo( QString syncProfile);
511 bool syncPhone(); 513 bool syncPhone();
512 void message( QString m , bool startTimer = true); 514 void message( QString m , bool startTimer = true);
513 515
514 // LR ******************************* 516 // LR *******************************
515 // sync stuff! 517 // sync stuff!
516 QString sentSyncFile(); 518 QString sentSyncFile();
517 QPopupMenu *syncMenu; 519 QPopupMenu *syncMenu;
518 KSyncManager* syncManager; 520 KSyncManager* syncManager;
519 int mGlobalSyncMode; 521 int mGlobalSyncMode;
520 bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode); 522 bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode);
521 KABC::Addressee getLastSyncAddressee(); 523 KABC::Addressee getLastSyncAddressee();
522 QDateTime mLastAddressbookSync; 524 QDateTime mLastAddressbookSync;
523 int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ); 525 int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full );
524 // ********************* 526 // *********************
525 527
526}; 528};
527 529
528#endif 530#endif
diff --git a/kaddressbook/kcmconfigs/kcmkabconfig.h b/kaddressbook/kcmconfigs/kcmkabconfig.h
index 2ecbfef..2af10d7 100644
--- a/kaddressbook/kcmconfigs/kcmkabconfig.h
+++ b/kaddressbook/kcmconfigs/kcmkabconfig.h
@@ -1,47 +1,47 @@
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 KCMKABCONFIG_H 24#ifndef KCMKABCONFIG_H
25#define KCMKABCONFIG_H 25#define KCMKABCONFIG_H
26 26
27#include <kcmodule.h> 27#include <kcmodule.h>
28 28
29class KABConfigWidget; 29class KABConfigWidget;
30class KABPrefs; 30class KABPrefs;
31 31
32class KCMKabConfig : public KCModule 32class KCMKabConfig : public KCModule
33{ 33{
34 Q_OBJECT 34 Q_OBJECT
35 35
36 public: 36 public:
37 KCMKabConfig( QWidget *parent = 0, const char *name = 0 ); 37 KCMKabConfig( QWidget *parent = 0, const char *name = 0 );
38 38 public slots:
39 virtual void load(); 39 virtual void load();
40 virtual void save(); 40 virtual void save();
41 virtual void defaults(); 41 virtual void defaults();
42 42
43 private: 43 private:
44 KABConfigWidget *mConfigWidget; 44 KABConfigWidget *mConfigWidget;
45}; 45};
46 46
47#endif 47#endif