summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp33
-rw-r--r--kaddressbook/kabcore.h3
2 files changed, 29 insertions, 7 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index dabb8e9..cb9b992 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -1,215 +1,222 @@
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/*
25Enhanced Version of the file for platform independent KDE tools.
26Copyright (c) 2004 Ulf Schenk
27
28$Id$
29*/
30
24#include "kabcore.h" 31#include "kabcore.h"
25 32
26#include <stdaddressbook.h> 33#include <stdaddressbook.h>
27#include <klocale.h> 34#include <klocale.h>
28 35
29#ifndef KAB_EMBEDDED 36#ifndef KAB_EMBEDDED
30#include <qclipboard.h> 37#include <qclipboard.h>
31#include <qdir.h> 38#include <qdir.h>
32#include <qfile.h> 39#include <qfile.h>
33#include <qapplicaton.h> 40#include <qapplicaton.h>
34#include <qlayout.h> 41#include <qlayout.h>
35#include <qregexp.h> 42#include <qregexp.h>
36#include <qvbox.h> 43#include <qvbox.h>
37#include <kabc/addresseelist.h> 44#include <kabc/addresseelist.h>
38#include <kabc/errorhandler.h> 45#include <kabc/errorhandler.h>
39#include <kabc/resource.h> 46#include <kabc/resource.h>
40#include <kabc/vcardconverter.h> 47#include <kabc/vcardconverter.h>
41#include <kapplication.h> 48#include <kapplication.h>
42#include <kactionclasses.h> 49#include <kactionclasses.h>
43#include <kcmultidialog.h> 50#include <kcmultidialog.h>
44#include <kdebug.h> 51#include <kdebug.h>
45#include <kdeversion.h> 52#include <kdeversion.h>
46#include <kkeydialog.h> 53#include <kkeydialog.h>
47#include <kmessagebox.h> 54#include <kmessagebox.h>
48#include <kprinter.h> 55#include <kprinter.h>
49#include <kprotocolinfo.h> 56#include <kprotocolinfo.h>
50#include <kresources/selectdialog.h> 57#include <kresources/selectdialog.h>
51#include <kstandarddirs.h> 58#include <kstandarddirs.h>
52#include <ktempfile.h> 59#include <ktempfile.h>
53#include <kxmlguiclient.h> 60#include <kxmlguiclient.h>
54#include <kaboutdata.h> 61#include <kaboutdata.h>
55#include <libkdepim/categoryselectdialog.h> 62#include <libkdepim/categoryselectdialog.h>
56 63
57#include "addresseeutil.h" 64#include "addresseeutil.h"
58#include "addresseeeditordialog.h" 65#include "addresseeeditordialog.h"
59#include "extensionmanager.h" 66#include "extensionmanager.h"
60#include "kstdaction.h" 67#include "kstdaction.h"
61#include "kaddressbookservice.h" 68#include "kaddressbookservice.h"
62#include "ldapsearchdialog.h" 69#include "ldapsearchdialog.h"
63#include "printing/printingwizard.h" 70#include "printing/printingwizard.h"
64#else // KAB_EMBEDDED 71#else // KAB_EMBEDDED
65 72
66#include <kapplication.h> 73#include <kapplication.h>
67#include "KDGanttMinimizeSplitter.h" 74#include "KDGanttMinimizeSplitter.h"
68#include "kaddressbookmain.h" 75#include "kaddressbookmain.h"
69#include "kactioncollection.h" 76#include "kactioncollection.h"
70#include "addresseedialog.h" 77#include "addresseedialog.h"
71//US 78//US
72#include <libkdepim/addresseeview.h> 79#include <libkdepim/addresseeview.h>
73 80
74#include <qapp.h> 81#include <qapp.h>
75#include <qmenubar.h> 82#include <qmenubar.h>
76//#include <qtoolbar.h> 83//#include <qtoolbar.h>
77#include <qmessagebox.h> 84#include <qmessagebox.h>
78#include <kdebug.h> 85#include <kdebug.h>
79#include <kiconloader.h> // needed for SmallIcon 86#include <kiconloader.h> // needed for SmallIcon
80#include <kresources/kcmkresources.h> 87#include <kresources/kcmkresources.h>
81#include <ktoolbar.h> 88#include <ktoolbar.h>
82 89
83 90
84//#include <qlabel.h> 91//#include <qlabel.h>
85 92
86 93
87#ifndef DESKTOP_VERSION 94#ifndef DESKTOP_VERSION
88#include <qpe/ir.h> 95#include <qpe/ir.h>
89#include <qtopia/qcopenvelope_qws.h> 96#include <qtopia/qcopenvelope_qws.h>
90#else 97#else
91 98
92#endif 99#endif
93 100
94#endif // KAB_EMBEDDED 101#endif // KAB_EMBEDDED
95#include "kcmconfigs/kcmkabconfig.h" 102#include "kcmconfigs/kcmkabconfig.h"
96#include "kcmconfigs/kcmkdepimconfig.h" 103#include "kcmconfigs/kcmkdepimconfig.h"
97#include "kpimglobalprefs.h" 104#include "kpimglobalprefs.h"
98#include "externalapphandler.h" 105#include "externalapphandler.h"
99 106
100 107
101#include <kresources/selectdialog.h> 108#include <kresources/selectdialog.h>
102#include <kmessagebox.h> 109#include <kmessagebox.h>
103 110
104#include <picture.h> 111#include <picture.h>
105#include <resource.h> 112#include <resource.h>
106 113
107//US#include <qsplitter.h> 114//US#include <qsplitter.h>
108#include <qmap.h> 115#include <qmap.h>
109#include <qdir.h> 116#include <qdir.h>
110#include <qfile.h> 117#include <qfile.h>
111#include <qvbox.h> 118#include <qvbox.h>
112#include <qlayout.h> 119#include <qlayout.h>
113#include <qclipboard.h> 120#include <qclipboard.h>
114#include <qtextstream.h> 121#include <qtextstream.h>
115 122
116#include <libkdepim/categoryselectdialog.h> 123#include <libkdepim/categoryselectdialog.h>
117#include <kabc/vcardconverter.h> 124#include <kabc/vcardconverter.h>
118 125
119 126
120#include "addresseeutil.h" 127#include "addresseeutil.h"
121#include "undocmds.h" 128#include "undocmds.h"
122#include "addresseeeditordialog.h" 129#include "addresseeeditordialog.h"
123#include "viewmanager.h" 130#include "viewmanager.h"
124#include "details/detailsviewcontainer.h" 131#include "details/detailsviewcontainer.h"
125#include "kabprefs.h" 132#include "kabprefs.h"
126#include "xxportmanager.h" 133#include "xxportmanager.h"
127#include "incsearchwidget.h" 134#include "incsearchwidget.h"
128#include "jumpbuttonbar.h" 135#include "jumpbuttonbar.h"
129#include "extensionmanager.h" 136#include "extensionmanager.h"
130#include "addresseeconfig.h" 137#include "addresseeconfig.h"
131#include <kcmultidialog.h> 138#include <kcmultidialog.h>
132 139
133#ifdef _WIN32_ 140#ifdef _WIN32_
134 141
135#include "kaimportoldialog.h" 142#include "kaimportoldialog.h"
136#endif 143#endif
137 144
138bool pasteWithNewUid = true; 145bool pasteWithNewUid = true;
139 146
140#ifdef KAB_EMBEDDED 147#ifdef KAB_EMBEDDED
141KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) 148KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name )
142 : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), 149 : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ),
143 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ 150 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/
144 mReadWrite( readWrite ), mModified( false ), mMainWindow(client) 151 mReadWrite( readWrite ), mModified( false ), mMainWindow(client)
145#else //KAB_EMBEDDED 152#else //KAB_EMBEDDED
146KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) 153KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name )
147 : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), 154 : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ),
148 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), 155 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ),
149 mReadWrite( readWrite ), mModified( false ) 156 mReadWrite( readWrite ), mModified( false )
150#endif //KAB_EMBEDDED 157#endif //KAB_EMBEDDED
151{ 158{
152 159
153 mExtensionBarSplitter = 0; 160 mExtensionBarSplitter = 0;
154 mIsPart = !parent->inherits( "KAddressBookMain" ); 161 mIsPart = !parent->inherits( "KAddressBookMain" );
155 162
156 mAddressBook = KABC::StdAddressBook::self(); 163 mAddressBook = KABC::StdAddressBook::self();
157 KABC::StdAddressBook::setAutomaticSave( false ); 164 KABC::StdAddressBook::setAutomaticSave( false );
158 165
159#ifndef KAB_EMBEDDED 166#ifndef KAB_EMBEDDED
160 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); 167 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler );
161#endif //KAB_EMBEDDED 168#endif //KAB_EMBEDDED
162 169
163 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), 170 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ),
164 SLOT( addressBookChanged() ) ); 171 SLOT( addressBookChanged() ) );
165 172
166 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, 173 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization,
167 "X-Department", "KADDRESSBOOK" ); 174 "X-Department", "KADDRESSBOOK" );
168 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, 175 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization,
169 "X-Profession", "KADDRESSBOOK" ); 176 "X-Profession", "KADDRESSBOOK" );
170 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, 177 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization,
171 "X-AssistantsName", "KADDRESSBOOK" ); 178 "X-AssistantsName", "KADDRESSBOOK" );
172 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, 179 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization,
173 "X-ManagersName", "KADDRESSBOOK" ); 180 "X-ManagersName", "KADDRESSBOOK" );
174 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, 181 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal,
175 "X-SpousesName", "KADDRESSBOOK" ); 182 "X-SpousesName", "KADDRESSBOOK" );
176 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, 183 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal,
177 "X-Office", "KADDRESSBOOK" ); 184 "X-Office", "KADDRESSBOOK" );
178 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, 185 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal,
179 "X-IMAddress", "KADDRESSBOOK" ); 186 "X-IMAddress", "KADDRESSBOOK" );
180 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, 187 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal,
181 "X-Anniversary", "KADDRESSBOOK" ); 188 "X-Anniversary", "KADDRESSBOOK" );
182 189
183 //US added this field to become compatible with Opie/qtopia addressbook 190 //US added this field to become compatible with Opie/qtopia addressbook
184 // values can be "female" or "male" or "". An empty field represents undefined. 191 // values can be "female" or "male" or "". An empty field represents undefined.
185 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, 192 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal,
186 "X-Gender", "KADDRESSBOOK" ); 193 "X-Gender", "KADDRESSBOOK" );
187 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, 194 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal,
188 "X-Children", "KADDRESSBOOK" ); 195 "X-Children", "KADDRESSBOOK" );
189 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, 196 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal,
190 "X-FreeBusyUrl", "KADDRESSBOOK" ); 197 "X-FreeBusyUrl", "KADDRESSBOOK" );
191 198
192 initGUI(); 199 initGUI();
193 200
194 mIncSearchWidget->setFocus(); 201 mIncSearchWidget->setFocus();
195 202
196 203
197 connect( mViewManager, SIGNAL( selected( const QString& ) ), 204 connect( mViewManager, SIGNAL( selected( const QString& ) ),
198 SLOT( setContactSelected( const QString& ) ) ); 205 SLOT( setContactSelected( const QString& ) ) );
199 connect( mViewManager, SIGNAL( executed( const QString& ) ), 206 connect( mViewManager, SIGNAL( executed( const QString& ) ),
200 SLOT( executeContact( const QString& ) ) ); 207 SLOT( executeContact( const QString& ) ) );
201 208
202 connect( mViewManager, SIGNAL( deleteRequest( ) ), 209 connect( mViewManager, SIGNAL( deleteRequest( ) ),
203 SLOT( deleteContacts( ) ) ); 210 SLOT( deleteContacts( ) ) );
204 connect( mViewManager, SIGNAL( modified() ), 211 connect( mViewManager, SIGNAL( modified() ),
205 SLOT( setModified() ) ); 212 SLOT( setModified() ) );
206 213
207 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); 214 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) );
208 connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); 215 connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) );
209 216
210 connect( mXXPortManager, SIGNAL( modified() ), 217 connect( mXXPortManager, SIGNAL( modified() ),
211 SLOT( setModified() ) ); 218 SLOT( setModified() ) );
212 219
213 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), 220 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ),
214 SLOT( incrementalSearch( const QString& ) ) ); 221 SLOT( incrementalSearch( const QString& ) ) );
215 connect( mIncSearchWidget, SIGNAL( fieldChanged() ), 222 connect( mIncSearchWidget, SIGNAL( fieldChanged() ),
@@ -229,395 +236,396 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const
229 236
230 connect( mDetails, SIGNAL( browse( const QString& ) ), 237 connect( mDetails, SIGNAL( browse( const QString& ) ),
231 SLOT( browse( const QString& ) ) ); 238 SLOT( browse( const QString& ) ) );
232 239
233 240
234 mAddressBookService = new KAddressBookService( this ); 241 mAddressBookService = new KAddressBookService( this );
235 242
236#endif //KAB_EMBEDDED 243#endif //KAB_EMBEDDED
237 mEditorDialog = 0; 244 mEditorDialog = 0;
238 createAddresseeEditorDialog( this ); 245 createAddresseeEditorDialog( this );
239 setModified( false ); 246 setModified( false );
240} 247}
241 248
242KABCore::~KABCore() 249KABCore::~KABCore()
243{ 250{
244 // save(); 251 // save();
245 //saveSettings(); 252 //saveSettings();
246 //KABPrefs::instance()->writeConfig(); 253 //KABPrefs::instance()->writeConfig();
247 delete AddresseeConfig::instance(); 254 delete AddresseeConfig::instance();
248 mAddressBook = 0; 255 mAddressBook = 0;
249 KABC::StdAddressBook::close(); 256 KABC::StdAddressBook::close();
250} 257}
251 258
252void KABCore::restoreSettings() 259void KABCore::restoreSettings()
253{ 260{
254 mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; 261 mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce;
255 262
256 bool state; 263 bool state;
257 264
258 if (mMultipleViewsAtOnce) 265 if (mMultipleViewsAtOnce)
259 state = KABPrefs::instance()->mDetailsPageVisible; 266 state = KABPrefs::instance()->mDetailsPageVisible;
260 else 267 else
261 state = false; 268 state = false;
262 269
263 mActionDetails->setChecked( state ); 270 mActionDetails->setChecked( state );
264 setDetailsVisible( state ); 271 setDetailsVisible( state );
265 272
266 state = KABPrefs::instance()->mJumpButtonBarVisible; 273 state = KABPrefs::instance()->mJumpButtonBarVisible;
267 274
268 mActionJumpBar->setChecked( state ); 275 mActionJumpBar->setChecked( state );
269 setJumpButtonBarVisible( state ); 276 setJumpButtonBarVisible( state );
270/*US 277/*US
271 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; 278 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter;
272 if ( splitterSize.count() == 0 ) { 279 if ( splitterSize.count() == 0 ) {
273 splitterSize.append( width() / 2 ); 280 splitterSize.append( width() / 2 );
274 splitterSize.append( width() / 2 ); 281 splitterSize.append( width() / 2 );
275 } 282 }
276 mMiniSplitter->setSizes( splitterSize ); 283 mMiniSplitter->setSizes( splitterSize );
277 if ( mExtensionBarSplitter ) { 284 if ( mExtensionBarSplitter ) {
278 splitterSize = KABPrefs::instance()->mExtensionsSplitter; 285 splitterSize = KABPrefs::instance()->mExtensionsSplitter;
279 if ( splitterSize.count() == 0 ) { 286 if ( splitterSize.count() == 0 ) {
280 splitterSize.append( width() / 2 ); 287 splitterSize.append( width() / 2 );
281 splitterSize.append( width() / 2 ); 288 splitterSize.append( width() / 2 );
282 } 289 }
283 mExtensionBarSplitter->setSizes( splitterSize ); 290 mExtensionBarSplitter->setSizes( splitterSize );
284 291
285 } 292 }
286*/ 293*/
287 mViewManager->restoreSettings(); 294 mViewManager->restoreSettings();
288 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); 295 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField );
289 mExtensionManager->restoreSettings(); 296 mExtensionManager->restoreSettings();
290 297
291 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; 298 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter;
292 if ( splitterSize.count() == 0 ) { 299 if ( splitterSize.count() == 0 ) {
293 splitterSize.append( width() / 2 ); 300 splitterSize.append( width() / 2 );
294 splitterSize.append( width() / 2 ); 301 splitterSize.append( width() / 2 );
295 } 302 }
296 mMiniSplitter->setSizes( splitterSize ); 303 mMiniSplitter->setSizes( splitterSize );
297 if ( mExtensionBarSplitter ) { 304 if ( mExtensionBarSplitter ) {
298 splitterSize = KABPrefs::instance()->mExtensionsSplitter; 305 splitterSize = KABPrefs::instance()->mExtensionsSplitter;
299 if ( splitterSize.count() == 0 ) { 306 if ( splitterSize.count() == 0 ) {
300 splitterSize.append( width() / 2 ); 307 splitterSize.append( width() / 2 );
301 splitterSize.append( width() / 2 ); 308 splitterSize.append( width() / 2 );
302 } 309 }
303 mExtensionBarSplitter->setSizes( splitterSize ); 310 mExtensionBarSplitter->setSizes( splitterSize );
304 311
305 } 312 }
306 313
307 314
308} 315}
309 316
310void KABCore::saveSettings() 317void KABCore::saveSettings()
311{ 318{
312 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); 319 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked();
313 if ( mExtensionBarSplitter ) 320 if ( mExtensionBarSplitter )
314 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 321 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
315 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); 322 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked();
316 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); 323 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes();
317#ifndef KAB_EMBEDDED 324#ifndef KAB_EMBEDDED
318 325
319 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 326 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
320 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); 327 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes();
321#endif //KAB_EMBEDDED 328#endif //KAB_EMBEDDED
322 mExtensionManager->saveSettings(); 329 mExtensionManager->saveSettings();
323 mViewManager->saveSettings(); 330 mViewManager->saveSettings();
324 331
325 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); 332 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem();
326} 333}
327 334
328KABC::AddressBook *KABCore::addressBook() const 335KABC::AddressBook *KABCore::addressBook() const
329{ 336{
330 return mAddressBook; 337 return mAddressBook;
331} 338}
332 339
333KConfig *KABCore::config() 340KConfig *KABCore::config()
334{ 341{
335#ifndef KAB_EMBEDDED 342#ifndef KAB_EMBEDDED
336 return KABPrefs::instance()->config(); 343 return KABPrefs::instance()->config();
337#else //KAB_EMBEDDED 344#else //KAB_EMBEDDED
338 return KABPrefs::instance()->getConfig(); 345 return KABPrefs::instance()->getConfig();
339#endif //KAB_EMBEDDED 346#endif //KAB_EMBEDDED
340} 347}
341 348
342KActionCollection *KABCore::actionCollection() const 349KActionCollection *KABCore::actionCollection() const
343{ 350{
344 return mGUIClient->actionCollection(); 351 return mGUIClient->actionCollection();
345} 352}
346 353
347KABC::Field *KABCore::currentSearchField() const 354KABC::Field *KABCore::currentSearchField() const
348{ 355{
349 if (mIncSearchWidget) 356 if (mIncSearchWidget)
350 return mIncSearchWidget->currentField(); 357 return mIncSearchWidget->currentField();
351 else 358 else
352 return 0; 359 return 0;
353} 360}
354 361
355QStringList KABCore::selectedUIDs() const 362QStringList KABCore::selectedUIDs() const
356{ 363{
357 return mViewManager->selectedUids(); 364 return mViewManager->selectedUids();
358} 365}
359 366
360KABC::Resource *KABCore::requestResource( QWidget *parent ) 367KABC::Resource *KABCore::requestResource( QWidget *parent )
361{ 368{
362 QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); 369 QPtrList<KABC::Resource> kabcResources = addressBook()->resources();
363 370
364 QPtrList<KRES::Resource> kresResources; 371 QPtrList<KRES::Resource> kresResources;
365 QPtrListIterator<KABC::Resource> resIt( kabcResources ); 372 QPtrListIterator<KABC::Resource> resIt( kabcResources );
366 KABC::Resource *resource; 373 KABC::Resource *resource;
367 while ( ( resource = resIt.current() ) != 0 ) { 374 while ( ( resource = resIt.current() ) != 0 ) {
368 ++resIt; 375 ++resIt;
369 if ( !resource->readOnly() ) { 376 if ( !resource->readOnly() ) {
370 KRES::Resource *res = static_cast<KRES::Resource*>( resource ); 377 KRES::Resource *res = static_cast<KRES::Resource*>( resource );
371 if ( res ) 378 if ( res )
372 kresResources.append( res ); 379 kresResources.append( res );
373 } 380 }
374 } 381 }
375 382
376 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); 383 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent );
377 return static_cast<KABC::Resource*>( res ); 384 return static_cast<KABC::Resource*>( res );
378} 385}
379 386
380#ifndef KAB_EMBEDDED 387#ifndef KAB_EMBEDDED
381KAboutData *KABCore::createAboutData() 388KAboutData *KABCore::createAboutData()
382#else //KAB_EMBEDDED 389#else //KAB_EMBEDDED
383void KABCore::createAboutData() 390void KABCore::createAboutData()
384#endif //KAB_EMBEDDED 391#endif //KAB_EMBEDDED
385{ 392{
386#ifndef KAB_EMBEDDED 393#ifndef KAB_EMBEDDED
387 KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ), 394 KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ),
388 "3.1", I18N_NOOP( "The KDE Address Book" ), 395 "3.1", I18N_NOOP( "The KDE Address Book" ),
389 KAboutData::License_GPL_V2, 396 KAboutData::License_GPL_V2,
390 I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) ); 397 I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) );
391 about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" ); 398 about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" );
392 about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) ); 399 about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) );
393 about->addAuthor( "Cornelius Schumacher", 400 about->addAuthor( "Cornelius Schumacher",
394 I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ), 401 I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ),
395 "schumacher@kde.org" ); 402 "schumacher@kde.org" );
396 about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ), 403 about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ),
397 "mpilone@slac.com" ); 404 "mpilone@slac.com" );
398 about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) ); 405 about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) );
399 about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) ); 406 about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) );
400 about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ), 407 about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ),
401 "michel@klaralvdalens-datakonsult.se" ); 408 "michel@klaralvdalens-datakonsult.se" );
402 about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ), 409 about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ),
403 "hansen@kde.org" ); 410 "hansen@kde.org" );
404 411
405 return about; 412 return about;
406#endif //KAB_EMBEDDED 413#endif //KAB_EMBEDDED
407 414
408 QString version; 415 QString version;
409#include <../version> 416#include <../version>
410 QMessageBox::about( this, "About KAddressbook/Pi", 417 QMessageBox::about( this, "About KAddressbook/Pi",
411 "KAddressbook/Platform-independent\n" 418 "KAddressbook/Platform-independent\n"
412 "(KA/Pi) " +version + " - " + 419 "(KA/Pi) " +version + " - " +
413#ifdef DESKTOP_VERSION 420#ifdef DESKTOP_VERSION
414 "Desktop Edition\n" 421 "Desktop Edition\n"
415#else 422#else
416 "PDA-Edition\n" 423 "PDA-Edition\n"
417 "for: Zaurus 5500 / 7x0 / 8x0\n" 424 "for: Zaurus 5500 / 7x0 / 8x0\n"
418#endif 425#endif
419 426
420 "(c) 2004 Ulf Schenk\n" 427 "(c) 2004 Ulf Schenk\n"
428 "(c) 2004 Lutz Rogowski\n"
421 "(c) 1997-2003, The KDE PIM Team\n" 429 "(c) 1997-2003, The KDE PIM Team\n"
422 "Tobias Koenig Current maintainer tokoe@kde.org\n" 430 "Tobias Koenig Current maintainer\ntokoe@kde.org\n"
423 "Don Sanders Original author\n" 431 "Don Sanders Original author\n"
424 "Cornelius Schumacher Co-maintainer schumacher@kde.org\n" 432 "Cornelius Schumacher Co-maintainer\nschumacher@kde.org\n"
425 "Mike Pilone GUI and framework redesign mpilone@slac.com\n" 433 "Mike Pilone GUI and framework redesign\nmpilone@slac.com\n"
426 "Greg Stern DCOP interface\n" 434 "Greg Stern DCOP interface\n"
427 "Mark Westcot Contact pinning\n" 435 "Mark Westcot Contact pinning\n"
428 "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n" 436 "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n"
429 "Steffen Hansen LDAP Lookup hansen@kde.org\n" 437 "Steffen Hansen LDAP Lookup\nhansen@kde.org\n"
430#ifdef _WIN32_ 438#ifdef _WIN32_
431 "(c) 2004 Lutz Rogowski Import from OL rogowski@kde.org\n" 439 "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n"
432#endif 440#endif
433 ); 441 );
434} 442}
435 443
436void KABCore::setContactSelected( const QString &uid ) 444void KABCore::setContactSelected( const QString &uid )
437{ 445{
438 KABC::Addressee addr = mAddressBook->findByUid( uid ); 446 KABC::Addressee addr = mAddressBook->findByUid( uid );
439 if ( !mDetails->isHidden() ) 447 if ( !mDetails->isHidden() )
440 mDetails->setAddressee( addr ); 448 mDetails->setAddressee( addr );
441 449
442 if ( !addr.isEmpty() ) { 450 if ( !addr.isEmpty() ) {
443 emit contactSelected( addr.formattedName() ); 451 emit contactSelected( addr.formattedName() );
444 KABC::Picture pic = addr.photo(); 452 KABC::Picture pic = addr.photo();
445 if ( pic.isIntern() ) { 453 if ( pic.isIntern() ) {
446//US emit contactSelected( pic.data() ); 454//US emit contactSelected( pic.data() );
447//US instead use: 455//US instead use:
448 QPixmap px; 456 QPixmap px;
449 if (pic.data().isNull() != true) 457 if (pic.data().isNull() != true)
450 { 458 {
451 px.convertFromImage(pic.data()); 459 px.convertFromImage(pic.data());
452 } 460 }
453 461
454 emit contactSelected( px ); 462 emit contactSelected( px );
455 } 463 }
456 } 464 }
457 465
458 466
459 mExtensionManager->setSelectionChanged(); 467 mExtensionManager->setSelectionChanged();
460 468
461 // update the actions 469 // update the actions
462 bool selected = !uid.isEmpty(); 470 bool selected = !uid.isEmpty();
463 471
464 if ( mReadWrite ) { 472 if ( mReadWrite ) {
465 mActionCut->setEnabled( selected ); 473 mActionCut->setEnabled( selected );
466 mActionPaste->setEnabled( selected ); 474 mActionPaste->setEnabled( selected );
467 } 475 }
468 476
469 mActionCopy->setEnabled( selected ); 477 mActionCopy->setEnabled( selected );
470 mActionDelete->setEnabled( selected ); 478 mActionDelete->setEnabled( selected );
471 mActionEditAddressee->setEnabled( selected ); 479 mActionEditAddressee->setEnabled( selected );
472 mActionMail->setEnabled( selected ); 480 mActionMail->setEnabled( selected );
473 mActionMailVCard->setEnabled( selected ); 481 mActionMailVCard->setEnabled( selected );
474 //if (mActionBeam) 482 //if (mActionBeam)
475 //mActionBeam->setEnabled( selected ); 483 //mActionBeam->setEnabled( selected );
476 484
477 if (mActionBeamVCard) 485 if (mActionBeamVCard)
478 mActionBeamVCard->setEnabled( selected ); 486 mActionBeamVCard->setEnabled( selected );
479 487
480 mActionWhoAmI->setEnabled( selected ); 488 mActionWhoAmI->setEnabled( selected );
481 mActionCategories->setEnabled( selected ); 489 mActionCategories->setEnabled( selected );
482} 490}
483 491
484void KABCore::sendMail() 492void KABCore::sendMail()
485{ 493{
486 sendMail( mViewManager->selectedEmails().join( ", " ) ); 494 sendMail( mViewManager->selectedEmails().join( ", " ) );
487} 495}
488 496
489void KABCore::sendMail( const QString& emaillist ) 497void KABCore::sendMail( const QString& emaillist )
490{ 498{
491 // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... " 499 // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... "
492 if (emaillist.contains(",") > 0) 500 if (emaillist.contains(",") > 0)
493 ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null ); 501 ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null );
494 else 502 else
495 ExternalAppHandler::instance()->mailToOneContact( emaillist ); 503 ExternalAppHandler::instance()->mailToOneContact( emaillist );
496} 504}
497 505
498 506
499 507
500void KABCore::mailVCard() 508void KABCore::mailVCard()
501{ 509{
502 QStringList uids = mViewManager->selectedUids(); 510 QStringList uids = mViewManager->selectedUids();
503 if ( !uids.isEmpty() ) 511 if ( !uids.isEmpty() )
504 mailVCard( uids ); 512 mailVCard( uids );
505} 513}
506 514
507void KABCore::mailVCard( const QStringList& uids ) 515void KABCore::mailVCard( const QStringList& uids )
508{ 516{
509 QStringList urls; 517 QStringList urls;
510 518
511// QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); 519// QString tmpdir = locateLocal("tmp", KGlobal::getAppName());
512 520
513 QString dirName = "/tmp/" + KApplication::randomString( 8 ); 521 QString dirName = "/tmp/" + KApplication::randomString( 8 );
514 522
515 523
516 524
517 QDir().mkdir( dirName, true ); 525 QDir().mkdir( dirName, true );
518 526
519 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { 527 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
520 KABC::Addressee a = mAddressBook->findByUid( *it ); 528 KABC::Addressee a = mAddressBook->findByUid( *it );
521 529
522 if ( a.isEmpty() ) 530 if ( a.isEmpty() )
523 continue; 531 continue;
524 532
525 QString name = a.givenName() + "_" + a.familyName() + ".vcf"; 533 QString name = a.givenName() + "_" + a.familyName() + ".vcf";
526 534
527 QString fileName = dirName + "/" + name; 535 QString fileName = dirName + "/" + name;
528 536
529 QFile outFile(fileName); 537 QFile outFile(fileName);
530 538
531 if ( outFile.open(IO_WriteOnly) ) { // file opened successfully 539 if ( outFile.open(IO_WriteOnly) ) { // file opened successfully
532 KABC::VCardConverter converter; 540 KABC::VCardConverter converter;
533 QString vcard; 541 QString vcard;
534 542
535 converter.addresseeToVCard( a, vcard ); 543 converter.addresseeToVCard( a, vcard );
536 544
537 QTextStream t( &outFile ); // use a text stream 545 QTextStream t( &outFile ); // use a text stream
538 t.setEncoding( QTextStream::UnicodeUTF8 ); 546 t.setEncoding( QTextStream::UnicodeUTF8 );
539 t << vcard; 547 t << vcard;
540 548
541 outFile.close(); 549 outFile.close();
542 550
543 urls.append( fileName ); 551 urls.append( fileName );
544 } 552 }
545 } 553 }
546 554
547 bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") ); 555 bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") );
548 556
549 557
550/*US 558/*US
551 kapp->invokeMailer( QString::null, QString::null, QString::null, 559 kapp->invokeMailer( QString::null, QString::null, QString::null,
552 QString::null, // subject 560 QString::null, // subject
553 QString::null, // body 561 QString::null, // body
554 QString::null, 562 QString::null,
555 urls ); // attachments 563 urls ); // attachments
556*/ 564*/
557 565
558} 566}
559 567
560/** 568/**
561 Beams the "WhoAmI contact. 569 Beams the "WhoAmI contact.
562*/ 570*/
563void KABCore::beamMySelf() 571void KABCore::beamMySelf()
564{ 572{
565 KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); 573 KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI();
566 if (!a.isEmpty()) 574 if (!a.isEmpty())
567 { 575 {
568 QStringList uids; 576 QStringList uids;
569 uids << a.uid(); 577 uids << a.uid();
570 578
571 beamVCard(uids); 579 beamVCard(uids);
572 } else { 580 } else {
573 KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); 581 KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) );
574 582
575 583
576 } 584 }
577} 585}
578 586
579void KABCore::beamVCard() 587void KABCore::beamVCard()
580{ 588{
581 QStringList uids = mViewManager->selectedUids(); 589 QStringList uids = mViewManager->selectedUids();
582 if ( !uids.isEmpty() ) 590 if ( !uids.isEmpty() )
583 beamVCard( uids ); 591 beamVCard( uids );
584} 592}
585 593
586 594
587void KABCore::beamVCard(const QStringList& uids) 595void KABCore::beamVCard(const QStringList& uids)
588{ 596{
589/*US 597/*US
590 QString beamFilename; 598 QString beamFilename;
591 Opie::OPimContact c; 599 Opie::OPimContact c;
592 if ( actionPersonal->isOn() ) { 600 if ( actionPersonal->isOn() ) {
593 beamFilename = addressbookPersonalVCardName(); 601 beamFilename = addressbookPersonalVCardName();
594 if ( !QFile::exists( beamFilename ) ) 602 if ( !QFile::exists( beamFilename ) )
595 return; // can't beam a non-existent file 603 return; // can't beam a non-existent file
596 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, 604 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null,
597 beamFilename ); 605 beamFilename );
598 Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); 606 Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true );
599 Opie::OPimContactAccess::List allList = access->allRecords(); 607 Opie::OPimContactAccess::List allList = access->allRecords();
600 Opie::OPimContactAccess::List::Iterator it = allList.begin(); // Just take first 608 Opie::OPimContactAccess::List::Iterator it = allList.begin(); // Just take first
601 c = *it; 609 c = *it;
602 610
603 delete access; 611 delete access;
604 } else { 612 } else {
605 unlink( beamfile ); // delete if exists 613 unlink( beamfile ); // delete if exists
606 mkdir("/tmp/obex/", 0755); 614 mkdir("/tmp/obex/", 0755);
607 c = m_abView -> currentEntry(); 615 c = m_abView -> currentEntry();
608 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, 616 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null,
609 beamfile ); 617 beamfile );
610 Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); 618 Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true );
611 access->add( c ); 619 access->add( c );
612 access->save(); 620 access->save();
613 delete access; 621 delete access;
614 622
615 beamFilename = beamfile; 623 beamFilename = beamfile;
616 } 624 }
617 625
618 owarn << "Beaming: " << beamFilename << oendl; 626 owarn << "Beaming: " << beamFilename << oendl;
619*/ 627*/
620 628
621#if 0 629#if 0
622 QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); 630 QString tmpdir = locateLocal("tmp", KGlobal::getAppName());
623 631
@@ -1545,531 +1553,542 @@ void KABCore::initGUI()
1545 1553
1546 1554
1547#endif //KAB_EMBEDDED 1555#endif //KAB_EMBEDDED
1548 initActions(); 1556 initActions();
1549 1557
1550#ifdef KAB_EMBEDDED 1558#ifdef KAB_EMBEDDED
1551 addActionsManually(); 1559 addActionsManually();
1552 //US make sure the export and import menues are initialized before creating the xxPortManager. 1560 //US make sure the export and import menues are initialized before creating the xxPortManager.
1553 mXXPortManager = new XXPortManager( this, this ); 1561 mXXPortManager = new XXPortManager( this, this );
1554 1562
1555 // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); 1563 // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() );
1556 //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); 1564 //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget);
1557 // mActionQuit->plug ( mMainWindow->toolBar()); 1565 // mActionQuit->plug ( mMainWindow->toolBar());
1558 //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); 1566 //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() );
1559 //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); 1567 //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget);
1560 // mIncSearchWidget->hide(); 1568 // mIncSearchWidget->hide();
1561 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1569 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1562 SLOT( incrementalSearch( const QString& ) ) ); 1570 SLOT( incrementalSearch( const QString& ) ) );
1563 1571
1564 1572
1565 mJumpButtonBar = new JumpButtonBar( this, this ); 1573 mJumpButtonBar = new JumpButtonBar( this, this );
1566 1574
1567 topLayout->addWidget( mJumpButtonBar ); 1575 topLayout->addWidget( mJumpButtonBar );
1568//US topLayout->setStretchFactor( mJumpButtonBar, 10 ); 1576//US topLayout->setStretchFactor( mJumpButtonBar, 10 );
1569 1577
1570// mMainWindow->getIconToolBar()->raise(); 1578// mMainWindow->getIconToolBar()->raise();
1571 1579
1572#endif //KAB_EMBEDDED 1580#endif //KAB_EMBEDDED
1573 1581
1574} 1582}
1575void KABCore::initActions() 1583void KABCore::initActions()
1576{ 1584{
1577//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); 1585//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
1578 1586
1579#ifndef KAB_EMBEDDED 1587#ifndef KAB_EMBEDDED
1580 connect( QApplication::clipboard(), SIGNAL( dataChanged() ), 1588 connect( QApplication::clipboard(), SIGNAL( dataChanged() ),
1581 SLOT( clipboardDataChanged() ) ); 1589 SLOT( clipboardDataChanged() ) );
1582#endif //KAB_EMBEDDED 1590#endif //KAB_EMBEDDED
1583 1591
1584 // file menu 1592 // file menu
1585 if ( mIsPart ) { 1593 if ( mIsPart ) {
1586 mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, 1594 mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this,
1587 SLOT( sendMail() ), actionCollection(), 1595 SLOT( sendMail() ), actionCollection(),
1588 "kaddressbook_mail" ); 1596 "kaddressbook_mail" );
1589 mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, 1597 mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this,
1590 SLOT( print() ), actionCollection(), "kaddressbook_print" ); 1598 SLOT( print() ), actionCollection(), "kaddressbook_print" );
1591 1599
1592 } else { 1600 } else {
1593 mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); 1601 mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() );
1594 mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); 1602 mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() );
1595 } 1603 }
1596 1604
1597 1605
1598 mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, 1606 mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this,
1599 SLOT( save() ), actionCollection(), "file_sync" ); 1607 SLOT( save() ), actionCollection(), "file_sync" );
1600 1608
1601 mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, 1609 mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this,
1602 SLOT( newContact() ), actionCollection(), "file_new_contact" ); 1610 SLOT( newContact() ), actionCollection(), "file_new_contact" );
1603 1611
1604 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, 1612 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0,
1605 this, SLOT( mailVCard() ), 1613 this, SLOT( mailVCard() ),
1606 actionCollection(), "file_mail_vcard"); 1614 actionCollection(), "file_mail_vcard");
1607 1615
1608 mActionBeamVCard = 0; 1616 mActionBeamVCard = 0;
1609 mActionBeam = 0; 1617 mActionBeam = 0;
1610 1618
1611#ifndef DESKTOP_VERSION 1619#ifndef DESKTOP_VERSION
1612 if ( Ir::supported() ) { 1620 if ( Ir::supported() ) {
1613 mActionBeamVCard = new KAction( i18n( "Beam selected v&Card(s)" ), "beam", 0, this, 1621 mActionBeamVCard = new KAction( i18n( "Beam selected v&Card(s)" ), "beam", 0, this,
1614 SLOT( beamVCard() ), actionCollection(), 1622 SLOT( beamVCard() ), actionCollection(),
1615 "kaddressbook_beam_vcard" ); 1623 "kaddressbook_beam_vcard" );
1616 1624
1617 mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, 1625 mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this,
1618 SLOT( beamMySelf() ), actionCollection(), 1626 SLOT( beamMySelf() ), actionCollection(),
1619 "kaddressbook_beam_myself" ); 1627 "kaddressbook_beam_myself" );
1620 } 1628 }
1621#endif 1629#endif
1622 1630
1623 mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, 1631 mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0,
1624 this, SLOT( editContact2() ), 1632 this, SLOT( editContact2() ),
1625 actionCollection(), "file_properties" ); 1633 actionCollection(), "file_properties" );
1626 1634
1627#ifdef KAB_EMBEDDED 1635#ifdef KAB_EMBEDDED
1628 // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); 1636 // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() );
1629 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, 1637 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0,
1630 mMainWindow, SLOT( exit() ), 1638 mMainWindow, SLOT( exit() ),
1631 actionCollection(), "quit" ); 1639 actionCollection(), "quit" );
1632#endif //KAB_EMBEDDED 1640#endif //KAB_EMBEDDED
1633 1641
1634 // edit menu 1642 // edit menu
1635 if ( mIsPart ) { 1643 if ( mIsPart ) {
1636 mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, 1644 mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this,
1637 SLOT( copyContacts() ), actionCollection(), 1645 SLOT( copyContacts() ), actionCollection(),
1638 "kaddressbook_copy" ); 1646 "kaddressbook_copy" );
1639 mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, 1647 mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this,
1640 SLOT( cutContacts() ), actionCollection(), 1648 SLOT( cutContacts() ), actionCollection(),
1641 "kaddressbook_cut" ); 1649 "kaddressbook_cut" );
1642 mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, 1650 mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this,
1643 SLOT( pasteContacts() ), actionCollection(), 1651 SLOT( pasteContacts() ), actionCollection(),
1644 "kaddressbook_paste" ); 1652 "kaddressbook_paste" );
1645 mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, 1653 mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this,
1646 SLOT( selectAllContacts() ), actionCollection(), 1654 SLOT( selectAllContacts() ), actionCollection(),
1647 "kaddressbook_select_all" ); 1655 "kaddressbook_select_all" );
1648 mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, 1656 mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this,
1649 SLOT( undo() ), actionCollection(), 1657 SLOT( undo() ), actionCollection(),
1650 "kaddressbook_undo" ); 1658 "kaddressbook_undo" );
1651 mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, 1659 mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z,
1652 this, SLOT( redo() ), actionCollection(), 1660 this, SLOT( redo() ), actionCollection(),
1653 "kaddressbook_redo" ); 1661 "kaddressbook_redo" );
1654 } else { 1662 } else {
1655 mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); 1663 mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() );
1656 mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); 1664 mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() );
1657 mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); 1665 mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() );
1658 mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); 1666 mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() );
1659 mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); 1667 mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() );
1660 mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); 1668 mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() );
1661 } 1669 }
1662 1670
1663 mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", 1671 mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete",
1664 Key_Delete, this, SLOT( deleteContacts() ), 1672 Key_Delete, this, SLOT( deleteContacts() ),
1665 actionCollection(), "edit_delete" ); 1673 actionCollection(), "edit_delete" );
1666 1674
1667 mActionUndo->setEnabled( false ); 1675 mActionUndo->setEnabled( false );
1668 mActionRedo->setEnabled( false ); 1676 mActionRedo->setEnabled( false );
1669 1677
1670 // settings menu 1678 // settings menu
1671#ifdef KAB_EMBEDDED 1679#ifdef KAB_EMBEDDED
1672//US special menuentry to configure the addressbook resources. On KDE 1680//US special menuentry to configure the addressbook resources. On KDE
1673// you do that through the control center !!! 1681// you do that through the control center !!!
1674 mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, 1682 mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this,
1675 SLOT( configureResources() ), actionCollection(), 1683 SLOT( configureResources() ), actionCollection(),
1676 "kaddressbook_configure_resources" ); 1684 "kaddressbook_configure_resources" );
1677#endif //KAB_EMBEDDED 1685#endif //KAB_EMBEDDED
1678 1686
1679 if ( mIsPart ) { 1687 if ( mIsPart ) {
1680 mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, 1688 mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this,
1681 SLOT( openConfigDialog() ), actionCollection(), 1689 SLOT( openConfigDialog() ), actionCollection(),
1682 "kaddressbook_configure" ); 1690 "kaddressbook_configure" );
1683 1691
1684 mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, 1692 mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0,
1685 this, SLOT( configureKeyBindings() ), actionCollection(), 1693 this, SLOT( configureKeyBindings() ), actionCollection(),
1686 "kaddressbook_configure_shortcuts" ); 1694 "kaddressbook_configure_shortcuts" );
1687#ifdef KAB_EMBEDDED 1695#ifdef KAB_EMBEDDED
1688 mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); 1696 mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() );
1689 mActionConfigureToolbars->setEnabled( false ); 1697 mActionConfigureToolbars->setEnabled( false );
1690#endif //KAB_EMBEDDED 1698#endif //KAB_EMBEDDED
1691 1699
1692 } else { 1700 } else {
1693 mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); 1701 mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() );
1694 1702
1695 mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); 1703 mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() );
1696 } 1704 }
1697 1705
1698 mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, 1706 mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0,
1699 actionCollection(), "options_show_jump_bar" ); 1707 actionCollection(), "options_show_jump_bar" );
1700 connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); 1708 connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) );
1701 1709
1702 mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0, 1710 mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0,
1703 actionCollection(), "options_show_details" ); 1711 actionCollection(), "options_show_details" );
1704 connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); 1712 connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) );
1705 1713
1706 // misc 1714 // misc
1707 // only enable LDAP lookup if we can handle the protocol 1715 // only enable LDAP lookup if we can handle the protocol
1708#ifndef KAB_EMBEDDED 1716#ifndef KAB_EMBEDDED
1709 if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { 1717 if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) {
1710 new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, 1718 new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0,
1711 this, SLOT( openLDAPDialog() ), actionCollection(), 1719 this, SLOT( openLDAPDialog() ), actionCollection(),
1712 "ldap_lookup" ); 1720 "ldap_lookup" );
1713 } 1721 }
1714#else //KAB_EMBEDDED 1722#else //KAB_EMBEDDED
1715 //qDebug("KABCore::initActions() LDAP has to be implemented"); 1723 //qDebug("KABCore::initActions() LDAP has to be implemented");
1716#endif //KAB_EMBEDDED 1724#endif //KAB_EMBEDDED
1717 1725
1718 1726
1719 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, 1727 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this,
1720 SLOT( setWhoAmI() ), actionCollection(), 1728 SLOT( setWhoAmI() ), actionCollection(),
1721 "set_personal" ); 1729 "set_personal" );
1722 1730
1723 1731
1724 1732
1725 1733
1726 mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, 1734 mActionCategories = new KAction( i18n( "Set Categories" ), 0, this,
1727 SLOT( setCategories() ), actionCollection(), 1735 SLOT( setCategories() ), actionCollection(),
1728 "edit_set_categories" ); 1736 "edit_set_categories" );
1729 1737
1730 mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, 1738 mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this,
1731 SLOT( removeVoice() ), actionCollection(), 1739 SLOT( removeVoice() ), actionCollection(),
1732 "remove_voice" ); 1740 "remove_voice" );
1733 mActionImportOL = new KAction( i18n( "Import from OL..." ), 0, this, 1741 mActionImportOL = new KAction( i18n( "Import from OL..." ), 0, this,
1734 SLOT( importFromOL() ), actionCollection(), 1742 SLOT( importFromOL() ), actionCollection(),
1735 "import_OL" ); 1743 "import_OL" );
1736#ifdef KAB_EMBEDDED 1744#ifdef KAB_EMBEDDED
1737 mActionLicence = new KAction( i18n( "Licence" ), "licence", 0, 1745 mActionLicence = new KAction( i18n( "Licence" ), 0,
1738 this, SLOT( showLicence() ), actionCollection(), 1746 this, SLOT( showLicence() ), actionCollection(),
1739 "licence_about_data" ); 1747 "licence_about_data" );
1748 mActionFaq = new KAction( i18n( "Faq" ), 0,
1749 this, SLOT( faq() ), actionCollection(),
1750 "faq_about_data" );
1751
1740 mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, 1752 mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0,
1741 this, SLOT( createAboutData() ), actionCollection(), 1753 this, SLOT( createAboutData() ), actionCollection(),
1742 "kaddressbook_about_data" ); 1754 "kaddressbook_about_data" );
1743#endif //KAB_EMBEDDED 1755#endif //KAB_EMBEDDED
1744 1756
1745 clipboardDataChanged(); 1757 clipboardDataChanged();
1746 connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); 1758 connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
1747 connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); 1759 connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
1748} 1760}
1749 1761
1750//US we need this function, to plug all actions into the correct menues. 1762//US we need this function, to plug all actions into the correct menues.
1751// KDE uses a XML format to plug the actions, but we work her without this overhead. 1763// KDE uses a XML format to plug the actions, but we work her without this overhead.
1752void KABCore::addActionsManually() 1764void KABCore::addActionsManually()
1753{ 1765{
1754//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); 1766//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
1755 1767
1756#ifdef KAB_EMBEDDED 1768#ifdef KAB_EMBEDDED
1757 QPopupMenu *fileMenu = new QPopupMenu( this ); 1769 QPopupMenu *fileMenu = new QPopupMenu( this );
1758 QPopupMenu *editMenu = new QPopupMenu( this ); 1770 QPopupMenu *editMenu = new QPopupMenu( this );
1759 QPopupMenu *helpMenu = new QPopupMenu( this ); 1771 QPopupMenu *helpMenu = new QPopupMenu( this );
1760 1772
1761 KToolBar* tb = mMainWindow->toolBar(); 1773 KToolBar* tb = mMainWindow->toolBar();
1762 1774
1763#ifdef DESKTOP_VERSION 1775#ifdef DESKTOP_VERSION
1764 QMenuBar* mb = mMainWindow->menuBar(); 1776 QMenuBar* mb = mMainWindow->menuBar();
1765 1777
1766 //US setup menubar. 1778 //US setup menubar.
1767 //Disable the following block if you do not want to have a menubar. 1779 //Disable the following block if you do not want to have a menubar.
1768 mb->insertItem( "&File", fileMenu ); 1780 mb->insertItem( "&File", fileMenu );
1769 mb->insertItem( "&Edit", editMenu ); 1781 mb->insertItem( "&Edit", editMenu );
1770 mb->insertItem( "&View", viewMenu ); 1782 mb->insertItem( "&View", viewMenu );
1771 mb->insertItem( "&Settings", settingsMenu ); 1783 mb->insertItem( "&Settings", settingsMenu );
1772 mb->insertItem( "&Change selected", changeMenu ); 1784 mb->insertItem( "&Change selected", changeMenu );
1773 mb->insertItem( "&Help", helpMenu ); 1785 mb->insertItem( "&Help", helpMenu );
1774 mIncSearchWidget = new IncSearchWidget( tb ); 1786 mIncSearchWidget = new IncSearchWidget( tb );
1775 // tb->insertWidget(-1, 0, mIncSearchWidget); 1787 // tb->insertWidget(-1, 0, mIncSearchWidget);
1776 1788
1777#else 1789#else
1778 //US setup toolbar 1790 //US setup toolbar
1779 QMenuBar *menuBarTB = new QMenuBar( tb ); 1791 QMenuBar *menuBarTB = new QMenuBar( tb );
1780 QPopupMenu *popupBarTB = new QPopupMenu( this ); 1792 QPopupMenu *popupBarTB = new QPopupMenu( this );
1781 menuBarTB->insertItem( "ME", popupBarTB); 1793 menuBarTB->insertItem( "ME", popupBarTB);
1782 tb->insertWidget(-1, 0, menuBarTB); 1794 tb->insertWidget(-1, 0, menuBarTB);
1783 mIncSearchWidget = new IncSearchWidget( tb ); 1795 mIncSearchWidget = new IncSearchWidget( tb );
1784 1796
1785 tb->enableMoving(false); 1797 tb->enableMoving(false);
1786 popupBarTB->insertItem( "&File", fileMenu ); 1798 popupBarTB->insertItem( "&File", fileMenu );
1787 popupBarTB->insertItem( "&Edit", editMenu ); 1799 popupBarTB->insertItem( "&Edit", editMenu );
1788 popupBarTB->insertItem( "&View", viewMenu ); 1800 popupBarTB->insertItem( "&View", viewMenu );
1789 popupBarTB->insertItem( "&Settings", settingsMenu ); 1801 popupBarTB->insertItem( "&Settings", settingsMenu );
1790 mViewManager->getFilterAction()->plug ( popupBarTB); 1802 mViewManager->getFilterAction()->plug ( popupBarTB);
1791 popupBarTB->insertItem( "&Change selected", changeMenu ); 1803 popupBarTB->insertItem( "&Change selected", changeMenu );
1792 popupBarTB->insertItem( "&Help", helpMenu ); 1804 popupBarTB->insertItem( "&Help", helpMenu );
1793 if (QApplication::desktop()->width() > 320 ) { 1805 if (QApplication::desktop()->width() > 320 ) {
1794 // mViewManager->getFilterAction()->plug ( tb); 1806 // mViewManager->getFilterAction()->plug ( tb);
1795 } 1807 }
1796#endif 1808#endif
1797 // mActionQuit->plug ( mMainWindow->toolBar()); 1809 // mActionQuit->plug ( mMainWindow->toolBar());
1798 1810
1799 1811
1800 1812
1801 //US Now connect the actions with the menue entries. 1813 //US Now connect the actions with the menue entries.
1802 mActionPrint->plug( fileMenu ); 1814 mActionPrint->plug( fileMenu );
1803 mActionMail->plug( fileMenu ); 1815 mActionMail->plug( fileMenu );
1804 fileMenu->insertSeparator(); 1816 fileMenu->insertSeparator();
1805 1817
1806 mActionNewContact->plug( fileMenu ); 1818 mActionNewContact->plug( fileMenu );
1807 mActionNewContact->plug( tb ); 1819 mActionNewContact->plug( tb );
1808 1820
1809 mActionEditAddressee->plug( fileMenu ); 1821 mActionEditAddressee->plug( fileMenu );
1810 if ((KGlobal::getDesktopSize() > KGlobal::Small ) || 1822 if ((KGlobal::getDesktopSize() > KGlobal::Small ) ||
1811 (!KABPrefs::instance()->mMultipleViewsAtOnce )) 1823 (!KABPrefs::instance()->mMultipleViewsAtOnce ))
1812 mActionEditAddressee->plug( tb ); 1824 mActionEditAddressee->plug( tb );
1813 1825
1814 fileMenu->insertSeparator(); 1826 fileMenu->insertSeparator();
1815 mActionSave->plug( fileMenu ); 1827 mActionSave->plug( fileMenu );
1816 fileMenu->insertItem( "&Import", ImportMenu ); 1828 fileMenu->insertItem( "&Import", ImportMenu );
1817 fileMenu->insertItem( "&Emport", ExportMenu ); 1829 fileMenu->insertItem( "&Emport", ExportMenu );
1818 fileMenu->insertSeparator(); 1830 fileMenu->insertSeparator();
1819 mActionMailVCard->plug( fileMenu ); 1831 mActionMailVCard->plug( fileMenu );
1820#ifndef DESKTOP_VERSION 1832#ifndef DESKTOP_VERSION
1821 if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu ); 1833 if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu );
1822 if ( Ir::supported() ) mActionBeam->plug(fileMenu ); 1834 if ( Ir::supported() ) mActionBeam->plug(fileMenu );
1823#endif 1835#endif
1824 fileMenu->insertSeparator(); 1836 fileMenu->insertSeparator();
1825 mActionQuit->plug( fileMenu ); 1837 mActionQuit->plug( fileMenu );
1826#ifdef _WIN32_ 1838#ifdef _WIN32_
1827 mActionImportOL->plug( ImportMenu ); 1839 mActionImportOL->plug( ImportMenu );
1828#endif 1840#endif
1829 // edit menu 1841 // edit menu
1830 mActionUndo->plug( editMenu ); 1842 mActionUndo->plug( editMenu );
1831 mActionRedo->plug( editMenu ); 1843 mActionRedo->plug( editMenu );
1832 editMenu->insertSeparator(); 1844 editMenu->insertSeparator();
1833 mActionCut->plug( editMenu ); 1845 mActionCut->plug( editMenu );
1834 mActionCopy->plug( editMenu ); 1846 mActionCopy->plug( editMenu );
1835 mActionPaste->plug( editMenu ); 1847 mActionPaste->plug( editMenu );
1836 mActionDelete->plug( editMenu ); 1848 mActionDelete->plug( editMenu );
1837 editMenu->insertSeparator(); 1849 editMenu->insertSeparator();
1838 mActionSelectAll->plug( editMenu ); 1850 mActionSelectAll->plug( editMenu );
1839 1851
1840 mActionRemoveVoice->plug( changeMenu ); 1852 mActionRemoveVoice->plug( changeMenu );
1841 // settings menu 1853 // settings menu
1842//US special menuentry to configure the addressbook resources. On KDE 1854//US special menuentry to configure the addressbook resources. On KDE
1843// you do that through the control center !!! 1855// you do that through the control center !!!
1844 mActionConfigResources->plug( settingsMenu ); 1856 mActionConfigResources->plug( settingsMenu );
1845 settingsMenu->insertSeparator(); 1857 settingsMenu->insertSeparator();
1846 1858
1847 mActionConfigKAddressbook->plug( settingsMenu ); 1859 mActionConfigKAddressbook->plug( settingsMenu );
1848 1860
1849 if ( mIsPart ) { 1861 if ( mIsPart ) {
1850 mActionConfigShortcuts->plug( settingsMenu ); 1862 mActionConfigShortcuts->plug( settingsMenu );
1851 mActionConfigureToolbars->plug( settingsMenu ); 1863 mActionConfigureToolbars->plug( settingsMenu );
1852 1864
1853 } else { 1865 } else {
1854 mActionKeyBindings->plug( settingsMenu ); 1866 mActionKeyBindings->plug( settingsMenu );
1855 } 1867 }
1856 1868
1857 settingsMenu->insertSeparator(); 1869 settingsMenu->insertSeparator();
1858 1870
1859 mActionJumpBar->plug( settingsMenu ); 1871 mActionJumpBar->plug( settingsMenu );
1860 mActionDetails->plug( settingsMenu ); 1872 mActionDetails->plug( settingsMenu );
1861 if (!KABPrefs::instance()->mMultipleViewsAtOnce ) 1873 if (!KABPrefs::instance()->mMultipleViewsAtOnce )
1862 mActionDetails->plug( tb ); 1874 mActionDetails->plug( tb );
1863 settingsMenu->insertSeparator(); 1875 settingsMenu->insertSeparator();
1864 1876
1865 mActionWhoAmI->plug( settingsMenu ); 1877 mActionWhoAmI->plug( settingsMenu );
1866 mActionCategories->plug( settingsMenu ); 1878 mActionCategories->plug( settingsMenu );
1867 1879
1868 mActionAboutKAddressbook->plug( helpMenu );
1869 mActionLicence->plug( helpMenu ); 1880 mActionLicence->plug( helpMenu );
1881 mActionFaq->plug( helpMenu );
1882 mActionAboutKAddressbook->plug( helpMenu );
1870 1883
1871 if (KGlobal::getDesktopSize() > KGlobal::Small ) { 1884 if (KGlobal::getDesktopSize() > KGlobal::Small ) {
1872 1885
1873 mActionSave->plug( tb ); 1886 mActionSave->plug( tb );
1874 mViewManager->getFilterAction()->plug ( tb); 1887 mViewManager->getFilterAction()->plug ( tb);
1875 if (KGlobal::getDesktopSize() == KGlobal::Desktop ) { 1888 if (KGlobal::getDesktopSize() == KGlobal::Desktop ) {
1876 mActionUndo->plug( tb ); 1889 mActionUndo->plug( tb );
1877 mActionDelete->plug( tb ); 1890 mActionDelete->plug( tb );
1878 mActionRedo->plug( tb ); 1891 mActionRedo->plug( tb );
1879 } 1892 }
1880 } 1893 }
1881 //mActionQuit->plug ( tb ); 1894 //mActionQuit->plug ( tb );
1882 // tb->insertWidget(-1, 0, mIncSearchWidget, 6); 1895 // tb->insertWidget(-1, 0, mIncSearchWidget, 6);
1883 1896
1884 //US link the searchwidget first to this. 1897 //US link the searchwidget first to this.
1885 // The real linkage to the toolbar happens later. 1898 // The real linkage to the toolbar happens later.
1886//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); 1899//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE);
1887//US tb->insertItem( mIncSearchWidget ); 1900//US tb->insertItem( mIncSearchWidget );
1888/*US 1901/*US
1889 mIncSearchWidget = new IncSearchWidget( tb ); 1902 mIncSearchWidget = new IncSearchWidget( tb );
1890 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1903 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1891 SLOT( incrementalSearch( const QString& ) ) ); 1904 SLOT( incrementalSearch( const QString& ) ) );
1892 1905
1893 mJumpButtonBar = new JumpButtonBar( this, this ); 1906 mJumpButtonBar = new JumpButtonBar( this, this );
1894 1907
1895//US topLayout->addWidget( mJumpButtonBar ); 1908//US topLayout->addWidget( mJumpButtonBar );
1896 this->layout()->add( mJumpButtonBar ); 1909 this->layout()->add( mJumpButtonBar );
1897*/ 1910*/
1898 1911
1899#endif //KAB_EMBEDDED 1912#endif //KAB_EMBEDDED
1900} 1913}
1901void KABCore::showLicence() 1914void KABCore::showLicence()
1902{ 1915{
1903 KApplication::showLicence(); 1916 KApplication::showLicence();
1904} 1917}
1905void KABCore::removeVoice() 1918void KABCore::removeVoice()
1906{ 1919{
1907 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 ) 1920 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 )
1908 return; 1921 return;
1909 KABC::Addressee::List list = mViewManager->selectedAddressees(); 1922 KABC::Addressee::List list = mViewManager->selectedAddressees();
1910 KABC::Addressee::List::Iterator it; 1923 KABC::Addressee::List::Iterator it;
1911 for ( it = list.begin(); it != list.end(); ++it ) { 1924 for ( it = list.begin(); it != list.end(); ++it ) {
1912 PhoneNumber::List phoneNumbers = (*it).phoneNumbers(); 1925 PhoneNumber::List phoneNumbers = (*it).phoneNumbers();
1913 PhoneNumber::List::Iterator phoneIt; 1926 PhoneNumber::List::Iterator phoneIt;
1914 bool found = false; 1927 bool found = false;
1915 for ( phoneIt = phoneNumbers.begin(); phoneIt != phoneNumbers.end(); ++phoneIt ) { 1928 for ( phoneIt = phoneNumbers.begin(); phoneIt != phoneNumbers.end(); ++phoneIt ) {
1916 if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found 1929 if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found
1917 if ((*phoneIt).type() - PhoneNumber::Voice ) { 1930 if ((*phoneIt).type() - PhoneNumber::Voice ) {
1918 (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice ); 1931 (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice );
1919 (*it).insertPhoneNumber( (*phoneIt) ); 1932 (*it).insertPhoneNumber( (*phoneIt) );
1920 found = true; 1933 found = true;
1921 } 1934 }
1922 } 1935 }
1923 1936
1924 } 1937 }
1925 if ( found ) 1938 if ( found )
1926 contactModified((*it) ); 1939 contactModified((*it) );
1927 } 1940 }
1928} 1941}
1929 1942
1930 1943
1931 1944
1932void KABCore::clipboardDataChanged() 1945void KABCore::clipboardDataChanged()
1933{ 1946{
1934 1947
1935 if ( mReadWrite ) 1948 if ( mReadWrite )
1936 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); 1949 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() );
1937 1950
1938} 1951}
1939 1952
1940void KABCore::updateActionMenu() 1953void KABCore::updateActionMenu()
1941{ 1954{
1942 UndoStack *undo = UndoStack::instance(); 1955 UndoStack *undo = UndoStack::instance();
1943 RedoStack *redo = RedoStack::instance(); 1956 RedoStack *redo = RedoStack::instance();
1944 1957
1945 if ( undo->isEmpty() ) 1958 if ( undo->isEmpty() )
1946 mActionUndo->setText( i18n( "Undo" ) ); 1959 mActionUndo->setText( i18n( "Undo" ) );
1947 else 1960 else
1948 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); 1961 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) );
1949 1962
1950 mActionUndo->setEnabled( !undo->isEmpty() ); 1963 mActionUndo->setEnabled( !undo->isEmpty() );
1951 1964
1952 if ( !redo->top() ) 1965 if ( !redo->top() )
1953 mActionRedo->setText( i18n( "Redo" ) ); 1966 mActionRedo->setText( i18n( "Redo" ) );
1954 else 1967 else
1955 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); 1968 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) );
1956 1969
1957 mActionRedo->setEnabled( !redo->isEmpty() ); 1970 mActionRedo->setEnabled( !redo->isEmpty() );
1958} 1971}
1959 1972
1960void KABCore::configureKeyBindings() 1973void KABCore::configureKeyBindings()
1961{ 1974{
1962#ifndef KAB_EMBEDDED 1975#ifndef KAB_EMBEDDED
1963 KKeyDialog::configure( actionCollection(), true ); 1976 KKeyDialog::configure( actionCollection(), true );
1964#else //KAB_EMBEDDED 1977#else //KAB_EMBEDDED
1965 qDebug("KABCore::configureKeyBindings() not implemented"); 1978 qDebug("KABCore::configureKeyBindings() not implemented");
1966#endif //KAB_EMBEDDED 1979#endif //KAB_EMBEDDED
1967} 1980}
1968 1981
1969#ifdef KAB_EMBEDDED 1982#ifdef KAB_EMBEDDED
1970void KABCore::configureResources() 1983void KABCore::configureResources()
1971{ 1984{
1972 KRES::KCMKResources dlg( this, "" , 0 ); 1985 KRES::KCMKResources dlg( this, "" , 0 );
1973 1986
1974 if ( !dlg.exec() ) 1987 if ( !dlg.exec() )
1975 return; 1988 return;
1976 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); 1989 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") );
1977} 1990}
1978#endif //KAB_EMBEDDED 1991#endif //KAB_EMBEDDED
1979 1992
1980 1993
1981/* this method will be called through the QCop interface from Ko/Pi to select addresses 1994/* this method will be called through the QCop interface from Ko/Pi to select addresses
1982 * for the attendees list of an event. 1995 * for the attendees list of an event.
1983 */ 1996 */
1984void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) 1997void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid)
1985{ 1998{
1986 QStringList nameList; 1999 QStringList nameList;
1987 QStringList emailList; 2000 QStringList emailList;
1988 QStringList uidList; 2001 QStringList uidList;
1989 2002
1990 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); 2003 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this);
1991 uint i=0; 2004 uint i=0;
1992 for (i=0; i < list.count(); i++) 2005 for (i=0; i < list.count(); i++)
1993 { 2006 {
1994 nameList.append(list[i].realName()); 2007 nameList.append(list[i].realName());
1995 emailList.append(list[i].preferredEmail()); 2008 emailList.append(list[i].preferredEmail());
1996 uidList.append(list[i].uid()); 2009 uidList.append(list[i].uid());
1997 } 2010 }
1998 2011
1999 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList); 2012 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList);
2000 2013
2001} 2014}
2002 2015
2003/* this method will be called through the QCop interface from other apps to show details of a contact. 2016/* this method will be called through the QCop interface from other apps to show details of a contact.
2004 */ 2017 */
2005void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) 2018void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid)
2006{ 2019{
2007// qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); 2020// qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1());
2008 2021
2009 QString foundUid = QString::null; 2022 QString foundUid = QString::null;
2010 if (uid.isEmpty()) 2023 if (uid.isEmpty())
2011 { 2024 {
2012 //find the uid of the person first 2025 //find the uid of the person first
2013 Addressee::List namelist; 2026 Addressee::List namelist;
2014 Addressee::List emaillist; 2027 Addressee::List emaillist;
2015 2028
2016 if (!name.isEmpty()) 2029 if (!name.isEmpty())
2017 namelist = mAddressBook->findByName( name ); 2030 namelist = mAddressBook->findByName( name );
2018 2031
2019 if (!email.isEmpty()) 2032 if (!email.isEmpty())
2020 emaillist = mAddressBook->findByEmail( email ); 2033 emaillist = mAddressBook->findByEmail( email );
2021 2034
2022 //check if we have a match in Namelist and Emaillist 2035 //check if we have a match in Namelist and Emaillist
2023 if ((namelist.count() == 0) && (emaillist.count() > 0)) 2036 if ((namelist.count() == 0) && (emaillist.count() > 0))
2024 foundUid == emaillist[0].uid(); 2037 foundUid == emaillist[0].uid();
2025 else if ((namelist.count() > 0) && (emaillist.count() == 0)) 2038 else if ((namelist.count() > 0) && (emaillist.count() == 0))
2026 foundUid == namelist[0].uid(); 2039 foundUid == namelist[0].uid();
2027 else 2040 else
2028 { 2041 {
2029 for (int i = 0; i < namelist.count(); i++) 2042 for (int i = 0; i < namelist.count(); i++)
2030 { 2043 {
2031 for (int j = 0; j < emaillist.count(); j++) 2044 for (int j = 0; j < emaillist.count(); j++)
2032 { 2045 {
2033 if (namelist[i] == emaillist[j]) 2046 if (namelist[i] == emaillist[j])
2034 { 2047 {
2035 foundUid == namelist[i].uid(); 2048 foundUid == namelist[i].uid();
2036 } 2049 }
2037 } 2050 }
2038 } 2051 }
2039 } 2052 }
2040 } 2053 }
2041 else 2054 else
2042 { 2055 {
2043 foundUid = uid; 2056 foundUid = uid;
2044 } 2057 }
2045 2058
2046 if (!foundUid.isEmpty()) 2059 if (!foundUid.isEmpty())
2047 { 2060 {
2048 // raise Ka/Pi if it is in the background 2061 // raise Ka/Pi if it is in the background
2049#ifndef DESKTOP_VERSION 2062#ifndef DESKTOP_VERSION
2050#ifndef KORG_NODCOP 2063#ifndef KORG_NODCOP
2051 QCopEnvelope e("QPE/Application/kapi", "raise()"); 2064 QCopEnvelope e("QPE/Application/kapi", "raise()");
2052#endif 2065#endif
2053#endif 2066#endif
2054 2067
2055 mMainWindow->showMaximized(); 2068 mMainWindow->showMaximized();
2056 2069
2057 mViewManager->setSelected( "", false); 2070 mViewManager->setSelected( "", false);
2058 mViewManager->refreshView( "" ); 2071 mViewManager->refreshView( "" );
2059 mViewManager->setSelected( foundUid, true ); 2072 mViewManager->setSelected( foundUid, true );
2060 mViewManager->refreshView( foundUid ); 2073 mViewManager->refreshView( foundUid );
2061 2074
2062 if ( !mMultipleViewsAtOnce ) 2075 if ( !mMultipleViewsAtOnce )
2063 { 2076 {
2064 setDetailsVisible( true ); 2077 setDetailsVisible( true );
2065 mActionDetails->setChecked(true); 2078 mActionDetails->setChecked(true);
2066 } 2079 }
2067 } 2080 }
2068} 2081}
2069 2082
2070 2083
2084void KABCore::faq()
2085{
2086 KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" );
2087}
2088
2089
2071 2090
2072 2091
2073#ifndef KAB_EMBEDDED 2092#ifndef KAB_EMBEDDED
2074#include "kabcore.moc" 2093#include "kabcore.moc"
2075#endif //KAB_EMBEDDED 2094#endif //KAB_EMBEDDED
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index 040b6aa..39d043f 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -1,453 +1,456 @@
1/* 1/*
2 This file is part of KAddressbook. 2 This file is part of KAddressbook.
3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> 3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#ifndef KABCORE_H 24#ifndef KABCORE_H
25#define KABCORE_H 25#define KABCORE_H
26 26
27#include <kabc/field.h> 27#include <kabc/field.h>
28 28
29#ifndef KAB_EMBEDDED 29#ifndef KAB_EMBEDDED
30#endif //KAB_EMBEDDED 30#endif //KAB_EMBEDDED
31#include <qdict.h> 31#include <qdict.h>
32 32
33#include <qwidget.h> 33#include <qwidget.h>
34#include <qpopupmenu.h> 34#include <qpopupmenu.h>
35 35
36namespace KABC { 36namespace KABC {
37class AddressBook; 37class AddressBook;
38} 38}
39 39
40#ifndef KAB_EMBEDDED 40#ifndef KAB_EMBEDDED
41class KAboutData; 41class KAboutData;
42class KConfig; 42class KConfig;
43 43
44class KAddressBookService; 44class KAddressBookService;
45class LDAPSearchDialog; 45class LDAPSearchDialog;
46#else //KAB_EMBEDDED 46#else //KAB_EMBEDDED
47class KAddressBookMain; 47class KAddressBookMain;
48//US class QAction; 48//US class QAction;
49#endif //KAB_EMBEDDED 49#endif //KAB_EMBEDDED
50class KCMultiDialog; 50class KCMultiDialog;
51class KXMLGUIClient; 51class KXMLGUIClient;
52class ExtensionManager; 52class ExtensionManager;
53class XXPortManager; 53class XXPortManager;
54class JumpButtonBar; 54class JumpButtonBar;
55class IncSearchWidget; 55class IncSearchWidget;
56class KDGanttMinimizeSplitter; 56class KDGanttMinimizeSplitter;
57class KAction; 57class KAction;
58class KActionCollection; 58class KActionCollection;
59class KToggleAction; 59class KToggleAction;
60 60
61class QAction; 61class QAction;
62class QMenuBar; 62class QMenuBar;
63class QSplitter; 63class QSplitter;
64class ViewContainer; 64class ViewContainer;
65class ViewManager; 65class ViewManager;
66class AddresseeEditorDialog; 66class AddresseeEditorDialog;
67class Ir; 67class Ir;
68 68
69class KABCore : public QWidget 69class KABCore : public QWidget
70{ 70{
71 Q_OBJECT 71 Q_OBJECT
72 72
73 public: 73 public:
74 KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name = 0 ); 74 KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name = 0 );
75 75
76 76
77 ~KABCore(); 77 ~KABCore();
78 78
79 79
80#ifdef KAB_EMBEDDED 80#ifdef KAB_EMBEDDED
81 //US added functionality 81 //US added functionality
82 QPopupMenu* getViewMenu() {return viewMenu;} 82 QPopupMenu* getViewMenu() {return viewMenu;}
83 QPopupMenu* getFilterMenu() {return filterMenu;} 83 QPopupMenu* getFilterMenu() {return filterMenu;}
84 QPopupMenu* getSettingsMenu() {return settingsMenu;} 84 QPopupMenu* getSettingsMenu() {return settingsMenu;}
85 void addActionsManually(); 85 void addActionsManually();
86#endif //KAB_EMBEDDED 86#endif //KAB_EMBEDDED
87 /** 87 /**
88 Restores the global settings. 88 Restores the global settings.
89 */ 89 */
90 void restoreSettings(); 90 void restoreSettings();
91 91
92 /** 92 /**
93 Saves the global settings. 93 Saves the global settings.
94 */ 94 */
95 void saveSettings(); 95 void saveSettings();
96 96
97 /** 97 /**
98 Returns a pointer to the StdAddressBook of the application. 98 Returns a pointer to the StdAddressBook of the application.
99 */ 99 */
100 KABC::AddressBook *addressBook() const; 100 KABC::AddressBook *addressBook() const;
101 101
102 /** 102 /**
103 Returns a pointer to the KConfig object of the application. 103 Returns a pointer to the KConfig object of the application.
104 */ 104 */
105 static KConfig *config(); 105 static KConfig *config();
106 106
107 /** 107 /**
108 Returns a pointer to the global KActionCollection object. So 108 Returns a pointer to the global KActionCollection object. So
109 other classes can register their actions easily. 109 other classes can register their actions easily.
110 */ 110 */
111 KActionCollection *actionCollection() const; 111 KActionCollection *actionCollection() const;
112 112
113 /** 113 /**
114 Returns the current search field of the Incremental Search Widget. 114 Returns the current search field of the Incremental Search Widget.
115 */ 115 */
116 KABC::Field *currentSearchField() const; 116 KABC::Field *currentSearchField() const;
117 117
118 /** 118 /**
119 Returns the uid list of the currently selected contacts. 119 Returns the uid list of the currently selected contacts.
120 */ 120 */
121 QStringList selectedUIDs() const; 121 QStringList selectedUIDs() const;
122 122
123 /** 123 /**
124 Displays the ResourceSelectDialog and returns the selected 124 Displays the ResourceSelectDialog and returns the selected
125 resource or a null pointer if no resource was selected by 125 resource or a null pointer if no resource was selected by
126 the user. 126 the user.
127 */ 127 */
128 KABC::Resource *requestResource( QWidget *parent ); 128 KABC::Resource *requestResource( QWidget *parent );
129 129
130#ifndef KAB_EMBEDDED 130#ifndef KAB_EMBEDDED
131 static KAboutData *createAboutData(); 131 static KAboutData *createAboutData();
132#endif //KAB_EMBEDDED 132#endif //KAB_EMBEDDED
133 133
134#ifdef KAB_EMBEDDED 134#ifdef KAB_EMBEDDED
135 inline QPopupMenu* getImportMenu() { return ImportMenu;} 135 inline QPopupMenu* getImportMenu() { return ImportMenu;}
136 inline QPopupMenu* getExportMenu() { return ExportMenu;} 136 inline QPopupMenu* getExportMenu() { return ExportMenu;}
137#endif //KAB_EMBEDDED 137#endif //KAB_EMBEDDED
138 138
139 public slots: 139 public slots:
140#ifdef KAB_EMBEDDED 140#ifdef KAB_EMBEDDED
141 void createAboutData(); 141 void createAboutData();
142#endif //KAB_EMBEDDED 142#endif //KAB_EMBEDDED
143 143
144 void statusMessage(QString, int time = 0 ); 144 void statusMessage(QString, int time = 0 );
145 void showLicence(); 145 void showLicence();
146 void faq();
147
146 /** 148 /**
147 Is called whenever a contact is selected in the view. 149 Is called whenever a contact is selected in the view.
148 */ 150 */
149 void setContactSelected( const QString &uid ); 151 void setContactSelected( const QString &uid );
150 152
151 /** 153 /**
152 Opens the preferred mail composer with all selected contacts as 154 Opens the preferred mail composer with all selected contacts as
153 arguments. 155 arguments.
154 */ 156 */
155 void sendMail(); 157 void sendMail();
156 158
157 /** 159 /**
158 Opens the preferred mail composer with the given contacts as 160 Opens the preferred mail composer with the given contacts as
159 arguments. 161 arguments.
160 */ 162 */
161 void sendMail( const QString& email ); 163 void sendMail( const QString& email );
162 164
163 165
164 void mailVCard(); 166 void mailVCard();
165 void mailVCard(const QStringList& uids); 167 void mailVCard(const QStringList& uids);
166 168
167 /** 169 /**
168 Beams the "WhoAmI contact. 170 Beams the "WhoAmI contact.
169 */ 171 */
170 void beamMySelf(); 172 void beamMySelf();
171 173
172 void beamVCard(); 174 void beamVCard();
173 void beamVCard(const QStringList& uids); 175 void beamVCard(const QStringList& uids);
174 void beamDone( Ir *ir ); 176 void beamDone( Ir *ir );
175 177
176 178
177 /** 179 /**
178 Starts the preferred web browser with the given URL as argument. 180 Starts the preferred web browser with the given URL as argument.
179 */ 181 */
180 void browse( const QString& url ); 182 void browse( const QString& url );
181 183
182 /** 184 /**
183 Select all contacts in the view. 185 Select all contacts in the view.
184 */ 186 */
185 void selectAllContacts(); 187 void selectAllContacts();
186 188
187 /** 189 /**
188 Deletes all selected contacts from the address book. 190 Deletes all selected contacts from the address book.
189 */ 191 */
190 void deleteContacts(); 192 void deleteContacts();
191 193
192 /** 194 /**
193 Deletes given contacts from the address book. 195 Deletes given contacts from the address book.
194 196
195 @param uids The uids of the contacts, which shall be deleted. 197 @param uids The uids of the contacts, which shall be deleted.
196 */ 198 */
197 void deleteContacts( const QStringList &uids ); 199 void deleteContacts( const QStringList &uids );
198 200
199 /** 201 /**
200 Copys the selected contacts into clipboard for later pasting. 202 Copys the selected contacts into clipboard for later pasting.
201 */ 203 */
202 void copyContacts(); 204 void copyContacts();
203 205
204 /** 206 /**
205 Cuts the selected contacts and stores them for later pasting. 207 Cuts the selected contacts and stores them for later pasting.
206 */ 208 */
207 void cutContacts(); 209 void cutContacts();
208 210
209 /** 211 /**
210 Paste contacts from clipboard into the address book. 212 Paste contacts from clipboard into the address book.
211 */ 213 */
212 void pasteContacts(); 214 void pasteContacts();
213 215
214 /** 216 /**
215 Paste given contacts into the address book. 217 Paste given contacts into the address book.
216 218
217 @param list The list of addressee, which shall be pasted. 219 @param list The list of addressee, which shall be pasted.
218 */ 220 */
219 void pasteContacts( KABC::Addressee::List &list ); 221 void pasteContacts( KABC::Addressee::List &list );
220 222
221 /** 223 /**
222 Sets the whoAmI contact, that is used by many other programs to 224 Sets the whoAmI contact, that is used by many other programs to
223 get personal information about the current user. 225 get personal information about the current user.
224 */ 226 */
225 void setWhoAmI(); 227 void setWhoAmI();
226 228
227 /** 229 /**
228 Displays the category dialog and applies the result to all 230 Displays the category dialog and applies the result to all
229 selected contacts. 231 selected contacts.
230 */ 232 */
231 void setCategories(); 233 void setCategories();
232 234
233 /** 235 /**
234 Sets the field list of the Incremental Search Widget. 236 Sets the field list of the Incremental Search Widget.
235 */ 237 */
236 void setSearchFields( const KABC::Field::List &fields ); 238 void setSearchFields( const KABC::Field::List &fields );
237 239
238 /** 240 /**
239 Search with the current search field for a contact, that matches 241 Search with the current search field for a contact, that matches
240 the given text, and selects it in the view. 242 the given text, and selects it in the view.
241 */ 243 */
242 void incrementalSearch( const QString& text ); 244 void incrementalSearch( const QString& text );
243 245
244 /** 246 /**
245 Marks the address book as modified. 247 Marks the address book as modified.
246 */ 248 */
247 void setModified(); 249 void setModified();
248 /** 250 /**
249 Marks the address book as modified without refreshing the view. 251 Marks the address book as modified without refreshing the view.
250 */ 252 */
251 void setModifiedWOrefresh(); 253 void setModifiedWOrefresh();
252 254
253 /** 255 /**
254 Marks the address book as modified concerning the argument. 256 Marks the address book as modified concerning the argument.
255 */ 257 */
256 void setModified( bool modified ); 258 void setModified( bool modified );
257 259
258 /** 260 /**
259 Returns whether the address book is modified. 261 Returns whether the address book is modified.
260 */ 262 */
261 bool modified() const; 263 bool modified() const;
262 264
263 /** 265 /**
264 Called whenever an contact is modified in the contact editor 266 Called whenever an contact is modified in the contact editor
265 dialog or the quick edit. 267 dialog or the quick edit.
266 */ 268 */
267 void contactModified( const KABC::Addressee &addr ); 269 void contactModified( const KABC::Addressee &addr );
268 270
269 /** 271 /**
270 DCOP METHODS. 272 DCOP METHODS.
271 */ 273 */
272 void addEmail( QString addr ); 274 void addEmail( QString addr );
273 void importVCard( const KURL& url, bool showPreview ); 275 void importVCard( const KURL& url, bool showPreview );
274 void importVCard( const QString& vCard, bool showPreview ); 276 void importVCard( const QString& vCard, bool showPreview );
275 void newContact(); 277 void newContact();
276 QString getNameByPhone( const QString& phone ); 278 QString getNameByPhone( const QString& phone );
277 /** 279 /**
278 END DCOP METHODS 280 END DCOP METHODS
279 */ 281 */
280 282
281 /** 283 /**
282 Saves the contents of the AddressBook back to disk. 284 Saves the contents of the AddressBook back to disk.
283 */ 285 */
284 void save(); 286 void save();
285 287
286 /** 288 /**
287 Undos the last command using the undo stack. 289 Undos the last command using the undo stack.
288 */ 290 */
289 void undo(); 291 void undo();
290 292
291 /** 293 /**
292 Redos the last command that was undone, using the redo stack. 294 Redos the last command that was undone, using the redo stack.
293 */ 295 */
294 void redo(); 296 void redo();
295 297
296 /** 298 /**
297 Shows the edit dialog for the given uid. If the uid is QString::null, 299 Shows the edit dialog for the given uid. If the uid is QString::null,
298 the method will try to find a selected addressee in the view. 300 the method will try to find a selected addressee in the view.
299 */ 301 */
300 void editContact( const QString &uid /*US = QString::null*/ ); 302 void editContact( const QString &uid /*US = QString::null*/ );
301//US added a second method without defaultparameter 303//US added a second method without defaultparameter
302 void editContact2(); 304 void editContact2();
303 305
304 /** 306 /**
305 Shows or edits the detail view for the given uid. If the uid is QString::null, 307 Shows or edits the detail view for the given uid. If the uid is QString::null,
306 the method will try to find a selected addressee in the view. 308 the method will try to find a selected addressee in the view.
307 */ 309 */
308 void executeContact( const QString &uid /*US = QString::null*/ ); 310 void executeContact( const QString &uid /*US = QString::null*/ );
309 311
310 /** 312 /**
311 Launches the configuration dialog. 313 Launches the configuration dialog.
312 */ 314 */
313 void openConfigDialog(); 315 void openConfigDialog();
314 316
315 /** 317 /**
316 Launches the ldap search dialog. 318 Launches the ldap search dialog.
317 */ 319 */
318 void openLDAPDialog(); 320 void openLDAPDialog();
319 321
320 /** 322 /**
321 Creates a KAddressBookPrinter, which will display the print 323 Creates a KAddressBookPrinter, which will display the print
322 dialog and do the printing. 324 dialog and do the printing.
323 */ 325 */
324 void print(); 326 void print();
325 327
326 /** 328 /**
327 Registers a new GUI client, so plugins can register its actions. 329 Registers a new GUI client, so plugins can register its actions.
328 */ 330 */
329 void addGUIClient( KXMLGUIClient *client ); 331 void addGUIClient( KXMLGUIClient *client );
330 332
331 void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid); 333 void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid);
332 void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); 334 void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid);
333 335
334 336
335 signals: 337 signals:
336 void contactSelected( const QString &name ); 338 void contactSelected( const QString &name );
337 void contactSelected( const QPixmap &pixmap ); 339 void contactSelected( const QPixmap &pixmap );
338 public slots: 340 public slots:
339 void setDetailsVisible( bool visible ); 341 void setDetailsVisible( bool visible );
340 void setDetailsToState(); 342 void setDetailsToState();
341 private slots: 343 private slots:
342 void setJumpButtonBarVisible( bool visible ); 344 void setJumpButtonBarVisible( bool visible );
343 void importFromOL(); 345 void importFromOL();
344 void extensionModified( const KABC::Addressee::List &list ); 346 void extensionModified( const KABC::Addressee::List &list );
345 void extensionChanged( int id ); 347 void extensionChanged( int id );
346 void clipboardDataChanged(); 348 void clipboardDataChanged();
347 void updateActionMenu(); 349 void updateActionMenu();
348 void configureKeyBindings(); 350 void configureKeyBindings();
349 void removeVoice(); 351 void removeVoice();
350#ifdef KAB_EMBEDDED 352#ifdef KAB_EMBEDDED
351 void configureResources(); 353 void configureResources();
352#endif //KAB_EMBEDDED 354#endif //KAB_EMBEDDED
353 355
354 void slotEditorDestroyed( const QString &uid ); 356 void slotEditorDestroyed( const QString &uid );
355 void configurationChanged(); 357 void configurationChanged();
356 void addressBookChanged(); 358 void addressBookChanged();
357 359
358 private: 360 private:
359 void initGUI(); 361 void initGUI();
360 void initActions(); 362 void initActions();
361 363
362 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, 364 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent,
363 const char *name = 0 ); 365 const char *name = 0 );
364 366
365 KXMLGUIClient *mGUIClient; 367 KXMLGUIClient *mGUIClient;
366 368
367 KABC::AddressBook *mAddressBook; 369 KABC::AddressBook *mAddressBook;
368 370
369 ViewManager *mViewManager; 371 ViewManager *mViewManager;
370 // QSplitter *mDetailsSplitter; 372 // QSplitter *mDetailsSplitter;
371 KDGanttMinimizeSplitter *mExtensionBarSplitter; 373 KDGanttMinimizeSplitter *mExtensionBarSplitter;
372 ViewContainer *mDetails; 374 ViewContainer *mDetails;
373 KDGanttMinimizeSplitter* mMiniSplitter; 375 KDGanttMinimizeSplitter* mMiniSplitter;
374 XXPortManager *mXXPortManager; 376 XXPortManager *mXXPortManager;
375 JumpButtonBar *mJumpButtonBar; 377 JumpButtonBar *mJumpButtonBar;
376 IncSearchWidget *mIncSearchWidget; 378 IncSearchWidget *mIncSearchWidget;
377 ExtensionManager *mExtensionManager; 379 ExtensionManager *mExtensionManager;
378 380
379 KCMultiDialog *mConfigureDialog; 381 KCMultiDialog *mConfigureDialog;
380 382
381#ifndef KAB_EMBEDDED 383#ifndef KAB_EMBEDDED
382 LDAPSearchDialog *mLdapSearchDialog; 384 LDAPSearchDialog *mLdapSearchDialog;
383#endif //KAB_EMBEDDED 385#endif //KAB_EMBEDDED
384 // QDict<AddresseeEditorDialog> mEditorDict; 386 // QDict<AddresseeEditorDialog> mEditorDict;
385 AddresseeEditorDialog *mEditorDialog; 387 AddresseeEditorDialog *mEditorDialog;
386 bool mReadWrite; 388 bool mReadWrite;
387 bool mModified; 389 bool mModified;
388 bool mIsPart; 390 bool mIsPart;
389 bool mMultipleViewsAtOnce; 391 bool mMultipleViewsAtOnce;
390 392
391 393
392 //US file menu 394 //US file menu
393 KAction *mActionMail; 395 KAction *mActionMail;
394 KAction *mActionBeam; 396 KAction *mActionBeam;
395 KAction* mActionPrint; 397 KAction* mActionPrint;
396 KAction* mActionNewContact; 398 KAction* mActionNewContact;
397 KAction *mActionSave; 399 KAction *mActionSave;
398 KAction *mActionEditAddressee; 400 KAction *mActionEditAddressee;
399 KAction *mActionMailVCard; 401 KAction *mActionMailVCard;
400 KAction *mActionBeamVCard; 402 KAction *mActionBeamVCard;
401 403
402 KAction *mActionQuit; 404 KAction *mActionQuit;
403 405
404 //US edit menu 406 //US edit menu
405 KAction *mActionCopy; 407 KAction *mActionCopy;
406 KAction *mActionCut; 408 KAction *mActionCut;
407 KAction *mActionPaste; 409 KAction *mActionPaste;
408 KAction *mActionSelectAll; 410 KAction *mActionSelectAll;
409 KAction *mActionUndo; 411 KAction *mActionUndo;
410 KAction *mActionRedo; 412 KAction *mActionRedo;
411 KAction *mActionDelete; 413 KAction *mActionDelete;
412 414
413 //US settings menu 415 //US settings menu
414 KAction *mActionConfigResources; 416 KAction *mActionConfigResources;
415 KAction *mActionConfigKAddressbook; 417 KAction *mActionConfigKAddressbook;
416 KAction *mActionConfigShortcuts; 418 KAction *mActionConfigShortcuts;
417 KAction *mActionConfigureToolbars; 419 KAction *mActionConfigureToolbars;
418 KAction *mActionKeyBindings; 420 KAction *mActionKeyBindings;
419 KToggleAction *mActionJumpBar; 421 KToggleAction *mActionJumpBar;
420 KToggleAction *mActionDetails; 422 KToggleAction *mActionDetails;
421 KAction *mActionWhoAmI; 423 KAction *mActionWhoAmI;
422 KAction *mActionCategories; 424 KAction *mActionCategories;
423 KAction *mActionAboutKAddressbook; 425 KAction *mActionAboutKAddressbook;
424 KAction *mActionLicence; 426 KAction *mActionLicence;
427 KAction *mActionFaq;
425 428
426 KAction *mActionDeleteView; 429 KAction *mActionDeleteView;
427 430
428 QPopupMenu *viewMenu; 431 QPopupMenu *viewMenu;
429 QPopupMenu *filterMenu; 432 QPopupMenu *filterMenu;
430 QPopupMenu *settingsMenu; 433 QPopupMenu *settingsMenu;
431 QPopupMenu *changeMenu; 434 QPopupMenu *changeMenu;
432 435
433//US QAction *mActionSave; 436//US QAction *mActionSave;
434 QPopupMenu *ImportMenu; 437 QPopupMenu *ImportMenu;
435 QPopupMenu *ExportMenu; 438 QPopupMenu *ExportMenu;
436 //LR additional methods 439 //LR additional methods
437 KAction *mActionRemoveVoice; 440 KAction *mActionRemoveVoice;
438 KAction * mActionImportOL; 441 KAction * mActionImportOL;
439 442
440#ifndef KAB_EMBEDDED 443#ifndef KAB_EMBEDDED
441 KAddressBookService *mAddressBookService; 444 KAddressBookService *mAddressBookService;
442#endif //KAB_EMBEDDED 445#endif //KAB_EMBEDDED
443 446
444 class KABCorePrivate; 447 class KABCorePrivate;
445 KABCorePrivate *d; 448 KABCorePrivate *d;
446 449
447#ifdef KAB_EMBEDDED 450#ifdef KAB_EMBEDDED
448 KAddressBookMain *mMainWindow; // should be the same like mGUIClient 451 KAddressBookMain *mMainWindow; // should be the same like mGUIClient
449#endif //KAB_EMBEDDED 452#endif //KAB_EMBEDDED
450 453
451}; 454};
452 455
453#endif 456#endif