summaryrefslogtreecommitdiffabout
authorulf69 <ulf69>2004-08-11 01:57:44 (UTC)
committer ulf69 <ulf69>2004-08-11 01:57:44 (UTC)
commit4e4e196bc4fbe4e078b4fbe6b372bd643bf372f1 (patch) (unidiff)
treec582e58964a01157962c2c9b605bc501ddbe2771
parent42860986468bb90c55783fcebc1b20bd3ee460ac (diff)
downloadkdepimpi-4e4e196bc4fbe4e078b4fbe6b372bd643bf372f1.zip
kdepimpi-4e4e196bc4fbe4e078b4fbe6b372bd643bf372f1.tar.gz
kdepimpi-4e4e196bc4fbe4e078b4fbe6b372bd643bf372f1.tar.bz2
added special detailview handling for small devices. Now the behavior is
a little bit similar to qtopia and opie addressbook
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp108
-rw-r--r--kaddressbook/kabcore.h6
2 files changed, 94 insertions, 20 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 6610288..96603e6 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -1,610 +1,625 @@
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#include "kabcore.h" 24#include "kabcore.h"
25 25
26#include <stdaddressbook.h> 26#include <stdaddressbook.h>
27#include <klocale.h> 27#include <klocale.h>
28 28
29#ifndef KAB_EMBEDDED 29#ifndef KAB_EMBEDDED
30#include <qclipboard.h> 30#include <qclipboard.h>
31#include <qdir.h> 31#include <qdir.h>
32#include <qfile.h> 32#include <qfile.h>
33#include <qapplicaton.h> 33#include <qapplicaton.h>
34#include <qlayout.h> 34#include <qlayout.h>
35#include <qregexp.h> 35#include <qregexp.h>
36#include <qvbox.h> 36#include <qvbox.h>
37#include <kabc/addresseelist.h> 37#include <kabc/addresseelist.h>
38#include <kabc/errorhandler.h> 38#include <kabc/errorhandler.h>
39#include <kabc/resource.h> 39#include <kabc/resource.h>
40#include <kabc/vcardconverter.h> 40#include <kabc/vcardconverter.h>
41#include <kapplication.h> 41#include <kapplication.h>
42#include <kactionclasses.h> 42#include <kactionclasses.h>
43#include <kcmultidialog.h> 43#include <kcmultidialog.h>
44#include <kdebug.h> 44#include <kdebug.h>
45#include <kdeversion.h> 45#include <kdeversion.h>
46#include <kkeydialog.h> 46#include <kkeydialog.h>
47#include <kmessagebox.h> 47#include <kmessagebox.h>
48#include <kprinter.h> 48#include <kprinter.h>
49#include <kprotocolinfo.h> 49#include <kprotocolinfo.h>
50#include <kresources/selectdialog.h> 50#include <kresources/selectdialog.h>
51#include <kstandarddirs.h> 51#include <kstandarddirs.h>
52#include <ktempfile.h> 52#include <ktempfile.h>
53#include <kxmlguiclient.h> 53#include <kxmlguiclient.h>
54#include <kaboutdata.h> 54#include <kaboutdata.h>
55#include <libkdepim/categoryselectdialog.h> 55#include <libkdepim/categoryselectdialog.h>
56 56
57#include "addresseeutil.h" 57#include "addresseeutil.h"
58#include "addresseeeditordialog.h" 58#include "addresseeeditordialog.h"
59#include "extensionmanager.h" 59#include "extensionmanager.h"
60#include "kstdaction.h" 60#include "kstdaction.h"
61#include "kaddressbookservice.h" 61#include "kaddressbookservice.h"
62#include "ldapsearchdialog.h" 62#include "ldapsearchdialog.h"
63#include "printing/printingwizard.h" 63#include "printing/printingwizard.h"
64#else // KAB_EMBEDDED 64#else // KAB_EMBEDDED
65 65
66#include <kapplication.h> 66#include <kapplication.h>
67#include "KDGanttMinimizeSplitter.h" 67#include "KDGanttMinimizeSplitter.h"
68#include "kaddressbookmain.h" 68#include "kaddressbookmain.h"
69#include "kactioncollection.h" 69#include "kactioncollection.h"
70#include <qapp.h> 70#include <qapp.h>
71#include <qmenubar.h> 71#include <qmenubar.h>
72//#include <qtoolbar.h> 72//#include <qtoolbar.h>
73#include <qmessagebox.h> 73#include <qmessagebox.h>
74#include <kdebug.h> 74#include <kdebug.h>
75#include <kiconloader.h> // needed for SmallIcon 75#include <kiconloader.h> // needed for SmallIcon
76#include <kresources/kcmkresources.h> 76#include <kresources/kcmkresources.h>
77#include <ktoolbar.h> 77#include <ktoolbar.h>
78 78
79 79
80//#include <qlabel.h> 80//#include <qlabel.h>
81 81
82 82
83#ifndef DESKTOP_VERSION 83#ifndef DESKTOP_VERSION
84#include <qpe/ir.h> 84#include <qpe/ir.h>
85#endif 85#endif
86 86
87#endif // KAB_EMBEDDED 87#endif // KAB_EMBEDDED
88#include "kcmconfigs/kcmkabconfig.h" 88#include "kcmconfigs/kcmkabconfig.h"
89#include "kcmconfigs/kcmkdepimconfig.h" 89#include "kcmconfigs/kcmkdepimconfig.h"
90#include "kpimglobalprefs.h" 90#include "kpimglobalprefs.h"
91#include "externalapphandler.h" 91#include "externalapphandler.h"
92 92
93 93
94#include <kresources/selectdialog.h> 94#include <kresources/selectdialog.h>
95#include <kmessagebox.h> 95#include <kmessagebox.h>
96 96
97#include <picture.h> 97#include <picture.h>
98#include <resource.h> 98#include <resource.h>
99 99
100//US#include <qsplitter.h> 100//US#include <qsplitter.h>
101#include <qmap.h> 101#include <qmap.h>
102#include <qdir.h> 102#include <qdir.h>
103#include <qfile.h> 103#include <qfile.h>
104#include <qvbox.h> 104#include <qvbox.h>
105#include <qlayout.h> 105#include <qlayout.h>
106#include <qclipboard.h> 106#include <qclipboard.h>
107#include <qtextstream.h> 107#include <qtextstream.h>
108 108
109#include <libkdepim/categoryselectdialog.h> 109#include <libkdepim/categoryselectdialog.h>
110#include <kabc/vcardconverter.h> 110#include <kabc/vcardconverter.h>
111 111
112 112
113#include "addresseeutil.h" 113#include "addresseeutil.h"
114#include "undocmds.h" 114#include "undocmds.h"
115#include "addresseeeditordialog.h" 115#include "addresseeeditordialog.h"
116#include "viewmanager.h" 116#include "viewmanager.h"
117#include "details/detailsviewcontainer.h" 117#include "details/detailsviewcontainer.h"
118#include "kabprefs.h" 118#include "kabprefs.h"
119#include "xxportmanager.h" 119#include "xxportmanager.h"
120#include "incsearchwidget.h" 120#include "incsearchwidget.h"
121#include "jumpbuttonbar.h" 121#include "jumpbuttonbar.h"
122#include "extensionmanager.h" 122#include "extensionmanager.h"
123#include "addresseeconfig.h" 123#include "addresseeconfig.h"
124#include <kcmultidialog.h> 124#include <kcmultidialog.h>
125 125
126#ifdef _WIN32_ 126#ifdef _WIN32_
127 127
128#include "kaimportoldialog.h" 128#include "kaimportoldialog.h"
129#endif 129#endif
130 130
131bool pasteWithNewUid = true; 131bool pasteWithNewUid = true;
132 132
133#ifdef KAB_EMBEDDED 133#ifdef KAB_EMBEDDED
134KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) 134KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name )
135 : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), 135 : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ),
136 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ 136 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/
137 mReadWrite( readWrite ), mModified( false ), mMainWindow(client) 137 mReadWrite( readWrite ), mModified( false ), mMainWindow(client)
138#else //KAB_EMBEDDED 138#else //KAB_EMBEDDED
139KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) 139KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name )
140 : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), 140 : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ),
141 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), 141 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ),
142 mReadWrite( readWrite ), mModified( false ) 142 mReadWrite( readWrite ), mModified( false )
143#endif //KAB_EMBEDDED 143#endif //KAB_EMBEDDED
144{ 144{
145 145
146 mExtensionBarSplitter = 0; 146 mExtensionBarSplitter = 0;
147 mIsPart = !parent->inherits( "KAddressBookMain" ); 147 mIsPart = !parent->inherits( "KAddressBookMain" );
148 148
149 mAddressBook = KABC::StdAddressBook::self(); 149 mAddressBook = KABC::StdAddressBook::self();
150 KABC::StdAddressBook::setAutomaticSave( false ); 150 KABC::StdAddressBook::setAutomaticSave( false );
151 151
152#ifndef KAB_EMBEDDED 152#ifndef KAB_EMBEDDED
153 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); 153 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler );
154#endif //KAB_EMBEDDED 154#endif //KAB_EMBEDDED
155 155
156 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), 156 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ),
157 SLOT( addressBookChanged() ) ); 157 SLOT( addressBookChanged() ) );
158 158
159 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, 159 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization,
160 "X-Department", "KADDRESSBOOK" ); 160 "X-Department", "KADDRESSBOOK" );
161 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, 161 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization,
162 "X-Profession", "KADDRESSBOOK" ); 162 "X-Profession", "KADDRESSBOOK" );
163 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, 163 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization,
164 "X-AssistantsName", "KADDRESSBOOK" ); 164 "X-AssistantsName", "KADDRESSBOOK" );
165 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, 165 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization,
166 "X-ManagersName", "KADDRESSBOOK" ); 166 "X-ManagersName", "KADDRESSBOOK" );
167 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, 167 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal,
168 "X-SpousesName", "KADDRESSBOOK" ); 168 "X-SpousesName", "KADDRESSBOOK" );
169 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, 169 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal,
170 "X-Office", "KADDRESSBOOK" ); 170 "X-Office", "KADDRESSBOOK" );
171 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, 171 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal,
172 "X-IMAddress", "KADDRESSBOOK" ); 172 "X-IMAddress", "KADDRESSBOOK" );
173 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, 173 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal,
174 "X-Anniversary", "KADDRESSBOOK" ); 174 "X-Anniversary", "KADDRESSBOOK" );
175 175
176 //US added this field to become compatible with Opie/qtopia addressbook 176 //US added this field to become compatible with Opie/qtopia addressbook
177 // values can be "female" or "male" or "". An empty field represents undefined. 177 // values can be "female" or "male" or "". An empty field represents undefined.
178 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, 178 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal,
179 "X-Gender", "KADDRESSBOOK" ); 179 "X-Gender", "KADDRESSBOOK" );
180 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, 180 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal,
181 "X-Children", "KADDRESSBOOK" ); 181 "X-Children", "KADDRESSBOOK" );
182 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, 182 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal,
183 "X-FreeBusyUrl", "KADDRESSBOOK" ); 183 "X-FreeBusyUrl", "KADDRESSBOOK" );
184 184
185 initGUI(); 185 initGUI();
186 186
187 mIncSearchWidget->setFocus(); 187 mIncSearchWidget->setFocus();
188 188
189 189
190 connect( mViewManager, SIGNAL( selected( const QString& ) ), 190 connect( mViewManager, SIGNAL( selected( const QString& ) ),
191 SLOT( setContactSelected( const QString& ) ) ); 191 SLOT( setContactSelected( const QString& ) ) );
192 connect( mViewManager, SIGNAL( executed( const QString& ) ), 192
193 //small devices show only the details view. bigger devices can edit the entry
194 if (KGlobal::getDesktopSize() > KGlobal::Small ) {
195 connect( mViewManager, SIGNAL( executed( const QString& ) ),
193 SLOT( editContact( const QString& ) ) ); 196 SLOT( editContact( const QString& ) ) );
197 }
198 else
199 {
200 connect( mViewManager, SIGNAL( executed( const QString& ) ),
201 SLOT( showContact( const QString& ) ) );
202 }
203
194 connect( mViewManager, SIGNAL( deleteRequest( ) ), 204 connect( mViewManager, SIGNAL( deleteRequest( ) ),
195 SLOT( deleteContacts( ) ) ); 205 SLOT( deleteContacts( ) ) );
196 connect( mViewManager, SIGNAL( modified() ), 206 connect( mViewManager, SIGNAL( modified() ),
197 SLOT( setModified() ) ); 207 SLOT( setModified() ) );
198 208
199 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); 209 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) );
200 210
201 connect( mXXPortManager, SIGNAL( modified() ), 211 connect( mXXPortManager, SIGNAL( modified() ),
202 SLOT( setModified() ) ); 212 SLOT( setModified() ) );
203 213
204 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), 214 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ),
205 SLOT( incrementalSearch( const QString& ) ) ); 215 SLOT( incrementalSearch( const QString& ) ) );
206 connect( mIncSearchWidget, SIGNAL( fieldChanged() ), 216 connect( mIncSearchWidget, SIGNAL( fieldChanged() ),
207 mJumpButtonBar, SLOT( recreateButtons() ) ); 217 mJumpButtonBar, SLOT( recreateButtons() ) );
208 218
209 connect( mDetails, SIGNAL( sendEmail( const QString& ) ), 219 connect( mDetails, SIGNAL( sendEmail( const QString& ) ),
210 SLOT( sendMail( const QString& ) ) ); 220 SLOT( sendMail( const QString& ) ) );
211 221
212#ifndef KAB_EMBEDDED 222#ifndef KAB_EMBEDDED
213 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), 223 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ),
214 mXXPortManager, SLOT( importVCard( const KURL& ) ) ); 224 mXXPortManager, SLOT( importVCard( const KURL& ) ) );
215 225
216 connect( mDetails, SIGNAL( browse( const QString& ) ), 226 connect( mDetails, SIGNAL( browse( const QString& ) ),
217 SLOT( browse( const QString& ) ) ); 227 SLOT( browse( const QString& ) ) );
218 228
219 mAddressBookService = new KAddressBookService( this ); 229 mAddressBookService = new KAddressBookService( this );
220 230
221#endif //KAB_EMBEDDED 231#endif //KAB_EMBEDDED
222 mEditorDialog = 0; 232 mEditorDialog = 0;
223 createAddresseeEditorDialog( this ); 233 createAddresseeEditorDialog( this );
224 setModified( false ); 234 setModified( false );
225} 235}
226 236
227KABCore::~KABCore() 237KABCore::~KABCore()
228{ 238{
229 // save(); 239 // save();
230 //saveSettings(); 240 //saveSettings();
231 //KABPrefs::instance()->writeConfig(); 241 //KABPrefs::instance()->writeConfig();
232 delete AddresseeConfig::instance(); 242 delete AddresseeConfig::instance();
233 mAddressBook = 0; 243 mAddressBook = 0;
234 KABC::StdAddressBook::close(); 244 KABC::StdAddressBook::close();
235} 245}
236 246
237void KABCore::restoreSettings() 247void KABCore::restoreSettings()
238{ 248{
239 bool state = KABPrefs::instance()->mJumpButtonBarVisible; 249 bool state;
240 250
241 mActionJumpBar->setChecked( state ); 251 //small devices have at startup the details view disabled
242 setJumpButtonBarVisible( state ); 252 if (KGlobal::getDesktopSize() > KGlobal::Small )
243 253 state = KABPrefs::instance()->mDetailsPageVisible;
244 state = KABPrefs::instance()->mDetailsPageVisible; 254 else
255 state = false;
245 256
246 mActionDetails->setChecked( state ); 257 mActionDetails->setChecked( state );
247 setDetailsVisible( state ); 258 setDetailsVisible( state );
259
260 state = KABPrefs::instance()->mJumpButtonBarVisible;
261
262 mActionJumpBar->setChecked( state );
263 setJumpButtonBarVisible( state );
264
248 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; 265 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter;
249 if ( splitterSize.count() == 0 ) { 266 if ( splitterSize.count() == 0 ) {
250 splitterSize.append( width() / 2 ); 267 splitterSize.append( width() / 2 );
251 splitterSize.append( width() / 2 ); 268 splitterSize.append( width() / 2 );
252 } 269 }
253 mMiniSplitter->setSizes( splitterSize ); 270 mMiniSplitter->setSizes( splitterSize );
254 if ( mExtensionBarSplitter ) { 271 if ( mExtensionBarSplitter ) {
255 splitterSize = KABPrefs::instance()->mExtensionsSplitter; 272 splitterSize = KABPrefs::instance()->mExtensionsSplitter;
256 if ( splitterSize.count() == 0 ) { 273 if ( splitterSize.count() == 0 ) {
257 splitterSize.append( width() / 2 ); 274 splitterSize.append( width() / 2 );
258 splitterSize.append( width() / 2 ); 275 splitterSize.append( width() / 2 );
259 } 276 }
260 mExtensionBarSplitter->setSizes( splitterSize ); 277 mExtensionBarSplitter->setSizes( splitterSize );
261 278
262 } 279 }
263#ifndef KAB_EMBEDDED 280#ifndef KAB_EMBEDDED
264 QValueList<int> splitterSize = KABPrefs::instance()->mExtensionsSplitter; 281 QValueList<int> splitterSize = KABPrefs::instance()->mExtensionsSplitter;
265 if ( splitterSize.count() == 0 ) { 282 if ( splitterSize.count() == 0 ) {
266 splitterSize.append( width() / 2 ); 283 splitterSize.append( width() / 2 );
267 splitterSize.append( width() / 2 ); 284 splitterSize.append( width() / 2 );
268 } 285 }
269 mExtensionBarSplitter->setSizes( splitterSize ); 286 mExtensionBarSplitter->setSizes( splitterSize );
270 287
271 splitterSize = KABPrefs::instance()->mDetailsSplitter; 288 splitterSize = KABPrefs::instance()->mDetailsSplitter;
272 if ( splitterSize.count() == 0 ) { 289 if ( splitterSize.count() == 0 ) {
273 splitterSize.append( height() / 2 ); 290 splitterSize.append( height() / 2 );
274 splitterSize.append( height() / 2 ); 291 splitterSize.append( height() / 2 );
275 } 292 }
276 mDetailsSplitter->setSizes( splitterSize ); 293 mDetailsSplitter->setSizes( splitterSize );
277 294
278 mExtensionManager->restoreSettings(); 295 mExtensionManager->restoreSettings();
279 296
280#endif //KAB_EMBEDDED 297#endif //KAB_EMBEDDED
281 298
282 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField );
283
284 mViewManager->restoreSettings(); 299 mViewManager->restoreSettings();
300 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField );
285 mExtensionManager->restoreSettings(); 301 mExtensionManager->restoreSettings();
286} 302}
287 303
288void KABCore::saveSettings() 304void KABCore::saveSettings()
289{ 305{
290 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); 306 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked();
291 if ( mExtensionBarSplitter ) 307 if ( mExtensionBarSplitter )
292 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 308 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
293 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); 309 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked();
294 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); 310 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes();
295#ifndef KAB_EMBEDDED 311#ifndef KAB_EMBEDDED
296 312
297 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 313 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
298 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); 314 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes();
299#endif //KAB_EMBEDDED 315#endif //KAB_EMBEDDED
300 mExtensionManager->saveSettings(); 316 mExtensionManager->saveSettings();
301 mViewManager->saveSettings(); 317 mViewManager->saveSettings();
302 318
303 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); 319 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem();
304
305} 320}
306 321
307KABC::AddressBook *KABCore::addressBook() const 322KABC::AddressBook *KABCore::addressBook() const
308{ 323{
309 return mAddressBook; 324 return mAddressBook;
310} 325}
311 326
312KConfig *KABCore::config() 327KConfig *KABCore::config()
313{ 328{
314#ifndef KAB_EMBEDDED 329#ifndef KAB_EMBEDDED
315 return KABPrefs::instance()->config(); 330 return KABPrefs::instance()->config();
316#else //KAB_EMBEDDED 331#else //KAB_EMBEDDED
317 return KABPrefs::instance()->getConfig(); 332 return KABPrefs::instance()->getConfig();
318#endif //KAB_EMBEDDED 333#endif //KAB_EMBEDDED
319} 334}
320 335
321KActionCollection *KABCore::actionCollection() const 336KActionCollection *KABCore::actionCollection() const
322{ 337{
323 return mGUIClient->actionCollection(); 338 return mGUIClient->actionCollection();
324} 339}
325 340
326KABC::Field *KABCore::currentSearchField() const 341KABC::Field *KABCore::currentSearchField() const
327{ 342{
328 if (mIncSearchWidget) 343 if (mIncSearchWidget)
329 return mIncSearchWidget->currentField(); 344 return mIncSearchWidget->currentField();
330 else 345 else
331 return 0; 346 return 0;
332} 347}
333 348
334QStringList KABCore::selectedUIDs() const 349QStringList KABCore::selectedUIDs() const
335{ 350{
336 return mViewManager->selectedUids(); 351 return mViewManager->selectedUids();
337} 352}
338 353
339KABC::Resource *KABCore::requestResource( QWidget *parent ) 354KABC::Resource *KABCore::requestResource( QWidget *parent )
340{ 355{
341 QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); 356 QPtrList<KABC::Resource> kabcResources = addressBook()->resources();
342 357
343 QPtrList<KRES::Resource> kresResources; 358 QPtrList<KRES::Resource> kresResources;
344 QPtrListIterator<KABC::Resource> resIt( kabcResources ); 359 QPtrListIterator<KABC::Resource> resIt( kabcResources );
345 KABC::Resource *resource; 360 KABC::Resource *resource;
346 while ( ( resource = resIt.current() ) != 0 ) { 361 while ( ( resource = resIt.current() ) != 0 ) {
347 ++resIt; 362 ++resIt;
348 if ( !resource->readOnly() ) { 363 if ( !resource->readOnly() ) {
349 KRES::Resource *res = static_cast<KRES::Resource*>( resource ); 364 KRES::Resource *res = static_cast<KRES::Resource*>( resource );
350 if ( res ) 365 if ( res )
351 kresResources.append( res ); 366 kresResources.append( res );
352 } 367 }
353 } 368 }
354 369
355 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); 370 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent );
356 return static_cast<KABC::Resource*>( res ); 371 return static_cast<KABC::Resource*>( res );
357} 372}
358 373
359#ifndef KAB_EMBEDDED 374#ifndef KAB_EMBEDDED
360KAboutData *KABCore::createAboutData() 375KAboutData *KABCore::createAboutData()
361#else //KAB_EMBEDDED 376#else //KAB_EMBEDDED
362void KABCore::createAboutData() 377void KABCore::createAboutData()
363#endif //KAB_EMBEDDED 378#endif //KAB_EMBEDDED
364{ 379{
365#ifndef KAB_EMBEDDED 380#ifndef KAB_EMBEDDED
366 KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ), 381 KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ),
367 "3.1", I18N_NOOP( "The KDE Address Book" ), 382 "3.1", I18N_NOOP( "The KDE Address Book" ),
368 KAboutData::License_GPL_V2, 383 KAboutData::License_GPL_V2,
369 I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) ); 384 I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) );
370 about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" ); 385 about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" );
371 about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) ); 386 about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) );
372 about->addAuthor( "Cornelius Schumacher", 387 about->addAuthor( "Cornelius Schumacher",
373 I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ), 388 I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ),
374 "schumacher@kde.org" ); 389 "schumacher@kde.org" );
375 about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ), 390 about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ),
376 "mpilone@slac.com" ); 391 "mpilone@slac.com" );
377 about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) ); 392 about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) );
378 about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) ); 393 about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) );
379 about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ), 394 about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ),
380 "michel@klaralvdalens-datakonsult.se" ); 395 "michel@klaralvdalens-datakonsult.se" );
381 about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ), 396 about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ),
382 "hansen@kde.org" ); 397 "hansen@kde.org" );
383 398
384 return about; 399 return about;
385#endif //KAB_EMBEDDED 400#endif //KAB_EMBEDDED
386 401
387 QString version; 402 QString version;
388#include <../version> 403#include <../version>
389 QMessageBox::about( this, "About KAddressbook/Pi", 404 QMessageBox::about( this, "About KAddressbook/Pi",
390 "KAddressbook/Platform-independent\n" 405 "KAddressbook/Platform-independent\n"
391 "(KA/Pi) " +version + " - " + 406 "(KA/Pi) " +version + " - " +
392#ifdef DESKTOP_VERSION 407#ifdef DESKTOP_VERSION
393 "Desktop Edition\n" 408 "Desktop Edition\n"
394#else 409#else
395 "PDA-Edition\n" 410 "PDA-Edition\n"
396 "for: Zaurus 5500 / 7x0 / 8x0\n" 411 "for: Zaurus 5500 / 7x0 / 8x0\n"
397#endif 412#endif
398 413
399 "(c) 2004 Ulf Schenk\n" 414 "(c) 2004 Ulf Schenk\n"
400 "(c) 1997-2003, The KDE PIM Team\n" 415 "(c) 1997-2003, The KDE PIM Team\n"
401 "Tobias Koenig Current maintainer tokoe@kde.org\n" 416 "Tobias Koenig Current maintainer tokoe@kde.org\n"
402 "Don Sanders Original author\n" 417 "Don Sanders Original author\n"
403 "Cornelius Schumacher Co-maintainer schumacher@kde.org\n" 418 "Cornelius Schumacher Co-maintainer schumacher@kde.org\n"
404 "Mike Pilone GUI and framework redesign mpilone@slac.com\n" 419 "Mike Pilone GUI and framework redesign mpilone@slac.com\n"
405 "Greg Stern DCOP interface\n" 420 "Greg Stern DCOP interface\n"
406 "Mark Westcot Contact pinning\n" 421 "Mark Westcot Contact pinning\n"
407 "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n" 422 "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n"
408 "Steffen Hansen LDAP Lookup hansen@kde.org\n" 423 "Steffen Hansen LDAP Lookup hansen@kde.org\n"
409#ifdef _WIN32_ 424#ifdef _WIN32_
410 "(c) 2004 Lutz Rogowski Import from OL rogowski@kde.org\n" 425 "(c) 2004 Lutz Rogowski Import from OL rogowski@kde.org\n"
411#endif 426#endif
412 ); 427 );
413} 428}
414 429
415void KABCore::setContactSelected( const QString &uid ) 430void KABCore::setContactSelected( const QString &uid )
416{ 431{
417 KABC::Addressee addr = mAddressBook->findByUid( uid ); 432 KABC::Addressee addr = mAddressBook->findByUid( uid );
418 if ( !mDetails->isHidden() ) 433//US if ( !mDetails->isHidden() )
419 mDetails->setAddressee( addr ); 434 mDetails->setAddressee( addr );
420 435
421 if ( !addr.isEmpty() ) { 436 if ( !addr.isEmpty() ) {
422 emit contactSelected( addr.formattedName() ); 437 emit contactSelected( addr.formattedName() );
423 KABC::Picture pic = addr.photo(); 438 KABC::Picture pic = addr.photo();
424 if ( pic.isIntern() ) { 439 if ( pic.isIntern() ) {
425//US emit contactSelected( pic.data() ); 440//US emit contactSelected( pic.data() );
426//US instead use: 441//US instead use:
427 QPixmap px; 442 QPixmap px;
428 if (pic.data().isNull() != true) 443 if (pic.data().isNull() != true)
429 { 444 {
430 px.convertFromImage(pic.data()); 445 px.convertFromImage(pic.data());
431 } 446 }
432 447
433 emit contactSelected( px ); 448 emit contactSelected( px );
434 } 449 }
435 } 450 }
436 451
437 452
438 mExtensionManager->setSelectionChanged(); 453 mExtensionManager->setSelectionChanged();
439 454
440 // update the actions 455 // update the actions
441 bool selected = !uid.isEmpty(); 456 bool selected = !uid.isEmpty();
442 457
443 if ( mReadWrite ) { 458 if ( mReadWrite ) {
444 mActionCut->setEnabled( selected ); 459 mActionCut->setEnabled( selected );
445 mActionPaste->setEnabled( selected ); 460 mActionPaste->setEnabled( selected );
446 } 461 }
447 462
448 mActionCopy->setEnabled( selected ); 463 mActionCopy->setEnabled( selected );
449 mActionDelete->setEnabled( selected ); 464 mActionDelete->setEnabled( selected );
450 mActionEditAddressee->setEnabled( selected ); 465 mActionEditAddressee->setEnabled( selected );
451 mActionMail->setEnabled( selected ); 466 mActionMail->setEnabled( selected );
452 mActionMailVCard->setEnabled( selected ); 467 mActionMailVCard->setEnabled( selected );
453 //if (mActionBeam) 468 //if (mActionBeam)
454 //mActionBeam->setEnabled( selected ); 469 //mActionBeam->setEnabled( selected );
455 470
456 if (mActionBeamVCard) 471 if (mActionBeamVCard)
457 mActionBeamVCard->setEnabled( selected ); 472 mActionBeamVCard->setEnabled( selected );
458 473
459 mActionWhoAmI->setEnabled( selected ); 474 mActionWhoAmI->setEnabled( selected );
460 mActionCategories->setEnabled( selected ); 475 mActionCategories->setEnabled( selected );
461} 476}
462 477
463void KABCore::sendMail() 478void KABCore::sendMail()
464{ 479{
465 sendMail( mViewManager->selectedEmails().join( ", " ) ); 480 sendMail( mViewManager->selectedEmails().join( ", " ) );
466} 481}
467 482
468void KABCore::sendMail( const QString& emaillist ) 483void KABCore::sendMail( const QString& emaillist )
469{ 484{
470 // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... " 485 // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... "
471 if (emaillist.contains(",") > 0) 486 if (emaillist.contains(",") > 0)
472 ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null ); 487 ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null );
473 else 488 else
474 ExternalAppHandler::instance()->mailToOneContact( emaillist ); 489 ExternalAppHandler::instance()->mailToOneContact( emaillist );
475} 490}
476 491
477 492
478 493
479void KABCore::mailVCard() 494void KABCore::mailVCard()
480{ 495{
481 QStringList uids = mViewManager->selectedUids(); 496 QStringList uids = mViewManager->selectedUids();
482 if ( !uids.isEmpty() ) 497 if ( !uids.isEmpty() )
483 mailVCard( uids ); 498 mailVCard( uids );
484} 499}
485 500
486void KABCore::mailVCard( const QStringList& uids ) 501void KABCore::mailVCard( const QStringList& uids )
487{ 502{
488 QStringList urls; 503 QStringList urls;
489 504
490// QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); 505// QString tmpdir = locateLocal("tmp", KGlobal::getAppName());
491 506
492 QString dirName = "/tmp/" + KApplication::randomString( 8 ); 507 QString dirName = "/tmp/" + KApplication::randomString( 8 );
493 508
494 509
495 510
496 QDir().mkdir( dirName, true ); 511 QDir().mkdir( dirName, true );
497 512
498 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { 513 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
499 KABC::Addressee a = mAddressBook->findByUid( *it ); 514 KABC::Addressee a = mAddressBook->findByUid( *it );
500 515
501 if ( a.isEmpty() ) 516 if ( a.isEmpty() )
502 continue; 517 continue;
503 518
504 QString name = a.givenName() + "_" + a.familyName() + ".vcf"; 519 QString name = a.givenName() + "_" + a.familyName() + ".vcf";
505 520
506 QString fileName = dirName + "/" + name; 521 QString fileName = dirName + "/" + name;
507 522
508 QFile outFile(fileName); 523 QFile outFile(fileName);
509 524
510 if ( outFile.open(IO_WriteOnly) ) { // file opened successfully 525 if ( outFile.open(IO_WriteOnly) ) { // file opened successfully
511 KABC::VCardConverter converter; 526 KABC::VCardConverter converter;
512 QString vcard; 527 QString vcard;
513 528
514 converter.addresseeToVCard( a, vcard ); 529 converter.addresseeToVCard( a, vcard );
515 530
516 QTextStream t( &outFile ); // use a text stream 531 QTextStream t( &outFile ); // use a text stream
517 t.setEncoding( QTextStream::UnicodeUTF8 ); 532 t.setEncoding( QTextStream::UnicodeUTF8 );
518 t << vcard; 533 t << vcard;
519 534
520 outFile.close(); 535 outFile.close();
521 536
522 urls.append( fileName ); 537 urls.append( fileName );
523 } 538 }
524 } 539 }
525 540
526 bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") ); 541 bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") );
527 542
528 543
529/*US 544/*US
530 kapp->invokeMailer( QString::null, QString::null, QString::null, 545 kapp->invokeMailer( QString::null, QString::null, QString::null,
531 QString::null, // subject 546 QString::null, // subject
532 QString::null, // body 547 QString::null, // body
533 QString::null, 548 QString::null,
534 urls ); // attachments 549 urls ); // attachments
535*/ 550*/
536 551
537} 552}
538 553
539/** 554/**
540 Beams the "WhoAmI contact. 555 Beams the "WhoAmI contact.
541*/ 556*/
542void KABCore::beamMySelf() 557void KABCore::beamMySelf()
543{ 558{
544 KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); 559 KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI();
545 if (!a.isEmpty()) 560 if (!a.isEmpty())
546 { 561 {
547 QStringList uids; 562 QStringList uids;
548 uids << a.uid(); 563 uids << a.uid();
549 564
550 beamVCard(uids); 565 beamVCard(uids);
551 } else { 566 } else {
552 KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); 567 KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) );
553 568
554 569
555 } 570 }
556} 571}
557 572
558void KABCore::beamVCard() 573void KABCore::beamVCard()
559{ 574{
560 QStringList uids = mViewManager->selectedUids(); 575 QStringList uids = mViewManager->selectedUids();
561 if ( !uids.isEmpty() ) 576 if ( !uids.isEmpty() )
562 beamVCard( uids ); 577 beamVCard( uids );
563} 578}
564 579
565 580
566void KABCore::beamVCard(const QStringList& uids) 581void KABCore::beamVCard(const QStringList& uids)
567{ 582{
568/*US 583/*US
569 QString beamFilename; 584 QString beamFilename;
570 Opie::OPimContact c; 585 Opie::OPimContact c;
571 if ( actionPersonal->isOn() ) { 586 if ( actionPersonal->isOn() ) {
572 beamFilename = addressbookPersonalVCardName(); 587 beamFilename = addressbookPersonalVCardName();
573 if ( !QFile::exists( beamFilename ) ) 588 if ( !QFile::exists( beamFilename ) )
574 return; // can't beam a non-existent file 589 return; // can't beam a non-existent file
575 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, 590 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null,
576 beamFilename ); 591 beamFilename );
577 Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); 592 Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true );
578 Opie::OPimContactAccess::List allList = access->allRecords(); 593 Opie::OPimContactAccess::List allList = access->allRecords();
579 Opie::OPimContactAccess::List::Iterator it = allList.begin(); // Just take first 594 Opie::OPimContactAccess::List::Iterator it = allList.begin(); // Just take first
580 c = *it; 595 c = *it;
581 596
582 delete access; 597 delete access;
583 } else { 598 } else {
584 unlink( beamfile ); // delete if exists 599 unlink( beamfile ); // delete if exists
585 mkdir("/tmp/obex/", 0755); 600 mkdir("/tmp/obex/", 0755);
586 c = m_abView -> currentEntry(); 601 c = m_abView -> currentEntry();
587 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, 602 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null,
588 beamfile ); 603 beamfile );
589 Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); 604 Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true );
590 access->add( c ); 605 access->add( c );
591 access->save(); 606 access->save();
592 delete access; 607 delete access;
593 608
594 beamFilename = beamfile; 609 beamFilename = beamfile;
595 } 610 }
596 611
597 owarn << "Beaming: " << beamFilename << oendl; 612 owarn << "Beaming: " << beamFilename << oendl;
598*/ 613*/
599 614
600#if 0 615#if 0
601 QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); 616 QString tmpdir = locateLocal("tmp", KGlobal::getAppName());
602 617
603 QString dirName = tmpdir + "/" + KApplication::randomString( 8 ); 618 QString dirName = tmpdir + "/" + KApplication::randomString( 8 );
604 619
605 QString name = "contact.vcf"; 620 QString name = "contact.vcf";
606 621
607 QString fileName = dirName + "/" + name; 622 QString fileName = dirName + "/" + name;
608#endif 623#endif
609 // LR: we should use the /tmp dir, because: /tmp = RAM, (HOME)/kdepim = flash memory 624 // LR: we should use the /tmp dir, because: /tmp = RAM, (HOME)/kdepim = flash memory
610 // 625 //
@@ -852,447 +867,498 @@ void KABCore::incrementalSearch( const QString& text )
852 } 867 }
853#endif 868#endif
854 } 869 }
855} 870}
856 871
857void KABCore::setModified() 872void KABCore::setModified()
858{ 873{
859 setModified( true ); 874 setModified( true );
860} 875}
861 876
862void KABCore::setModifiedWOrefresh() 877void KABCore::setModifiedWOrefresh()
863{ 878{
864 // qDebug("KABCore::setModifiedWOrefresh() "); 879 // qDebug("KABCore::setModifiedWOrefresh() ");
865 mModified = true; 880 mModified = true;
866 mActionSave->setEnabled( mModified ); 881 mActionSave->setEnabled( mModified );
867#ifdef DESKTOP_VERSION 882#ifdef DESKTOP_VERSION
868 mDetails->refreshView(); 883 mDetails->refreshView();
869#endif 884#endif
870 885
871} 886}
872void KABCore::setModified( bool modified ) 887void KABCore::setModified( bool modified )
873{ 888{
874 mModified = modified; 889 mModified = modified;
875 mActionSave->setEnabled( mModified ); 890 mActionSave->setEnabled( mModified );
876 891
877 if ( modified ) 892 if ( modified )
878 mJumpButtonBar->recreateButtons(); 893 mJumpButtonBar->recreateButtons();
879 894
880 mViewManager->refreshView(); 895 mViewManager->refreshView();
881 mDetails->refreshView(); 896 mDetails->refreshView();
882 897
883} 898}
884 899
885bool KABCore::modified() const 900bool KABCore::modified() const
886{ 901{
887 return mModified; 902 return mModified;
888} 903}
889 904
890void KABCore::contactModified( const KABC::Addressee &addr ) 905void KABCore::contactModified( const KABC::Addressee &addr )
891{ 906{
892 907
893 Command *command = 0; 908 Command *command = 0;
894 QString uid; 909 QString uid;
895 910
896 // check if it exists already 911 // check if it exists already
897 KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() ); 912 KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() );
898 if ( origAddr.isEmpty() ) 913 if ( origAddr.isEmpty() )
899 command = new PwNewCommand( mAddressBook, addr ); 914 command = new PwNewCommand( mAddressBook, addr );
900 else { 915 else {
901 command = new PwEditCommand( mAddressBook, origAddr, addr ); 916 command = new PwEditCommand( mAddressBook, origAddr, addr );
902 uid = addr.uid(); 917 uid = addr.uid();
903 } 918 }
904 919
905 UndoStack::instance()->push( command ); 920 UndoStack::instance()->push( command );
906 RedoStack::instance()->clear(); 921 RedoStack::instance()->clear();
907 922
908 setModified( true ); 923 setModified( true );
909} 924}
910 925
911void KABCore::newContact() 926void KABCore::newContact()
912{ 927{
913 928
914 929
915 QPtrList<KABC::Resource> kabcResources = mAddressBook->resources(); 930 QPtrList<KABC::Resource> kabcResources = mAddressBook->resources();
916 931
917 QPtrList<KRES::Resource> kresResources; 932 QPtrList<KRES::Resource> kresResources;
918 QPtrListIterator<KABC::Resource> it( kabcResources ); 933 QPtrListIterator<KABC::Resource> it( kabcResources );
919 KABC::Resource *resource; 934 KABC::Resource *resource;
920 while ( ( resource = it.current() ) != 0 ) { 935 while ( ( resource = it.current() ) != 0 ) {
921 ++it; 936 ++it;
922 if ( !resource->readOnly() ) { 937 if ( !resource->readOnly() ) {
923 KRES::Resource *res = static_cast<KRES::Resource*>( resource ); 938 KRES::Resource *res = static_cast<KRES::Resource*>( resource );
924 if ( res ) 939 if ( res )
925 kresResources.append( res ); 940 kresResources.append( res );
926 } 941 }
927 } 942 }
928 943
929 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); 944 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this );
930 resource = static_cast<KABC::Resource*>( res ); 945 resource = static_cast<KABC::Resource*>( res );
931 946
932 if ( resource ) { 947 if ( resource ) {
933 KABC::Addressee addr; 948 KABC::Addressee addr;
934 addr.setResource( resource ); 949 addr.setResource( resource );
935 mEditorDialog->setAddressee( addr ); 950 mEditorDialog->setAddressee( addr );
936 KApplication::execDialog ( mEditorDialog ); 951 KApplication::execDialog ( mEditorDialog );
937 952
938 } else 953 } else
939 return; 954 return;
940 955
941 // mEditorDict.insert( dialog->addressee().uid(), dialog ); 956 // mEditorDict.insert( dialog->addressee().uid(), dialog );
942 957
943 958
944} 959}
945 960
946void KABCore::addEmail( QString aStr ) 961void KABCore::addEmail( QString aStr )
947{ 962{
948#ifndef KAB_EMBEDDED 963#ifndef KAB_EMBEDDED
949 QString fullName, email; 964 QString fullName, email;
950 965
951 KABC::Addressee::parseEmailAddress( aStr, fullName, email ); 966 KABC::Addressee::parseEmailAddress( aStr, fullName, email );
952 967
953 // Try to lookup the addressee matching the email address 968 // Try to lookup the addressee matching the email address
954 bool found = false; 969 bool found = false;
955 QStringList emailList; 970 QStringList emailList;
956 KABC::AddressBook::Iterator it; 971 KABC::AddressBook::Iterator it;
957 for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) { 972 for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) {
958 emailList = (*it).emails(); 973 emailList = (*it).emails();
959 if ( emailList.contains( email ) > 0 ) { 974 if ( emailList.contains( email ) > 0 ) {
960 found = true; 975 found = true;
961 (*it).setNameFromString( fullName ); 976 (*it).setNameFromString( fullName );
962 editContact( (*it).uid() ); 977 editContact( (*it).uid() );
963 } 978 }
964 } 979 }
965 980
966 if ( !found ) { 981 if ( !found ) {
967 KABC::Addressee addr; 982 KABC::Addressee addr;
968 addr.setNameFromString( fullName ); 983 addr.setNameFromString( fullName );
969 addr.insertEmail( email, true ); 984 addr.insertEmail( email, true );
970 985
971 mAddressBook->insertAddressee( addr ); 986 mAddressBook->insertAddressee( addr );
972 mViewManager->refreshView( addr.uid() ); 987 mViewManager->refreshView( addr.uid() );
973 editContact( addr.uid() ); 988 editContact( addr.uid() );
974 } 989 }
975#else //KAB_EMBEDDED 990#else //KAB_EMBEDDED
976 qDebug("KABCore::addEmail finsih method"); 991 qDebug("KABCore::addEmail finsih method");
977#endif //KAB_EMBEDDED 992#endif //KAB_EMBEDDED
978} 993}
979 994
980void KABCore::importVCard( const KURL &url, bool showPreview ) 995void KABCore::importVCard( const KURL &url, bool showPreview )
981{ 996{
982 mXXPortManager->importVCard( url, showPreview ); 997 mXXPortManager->importVCard( url, showPreview );
983} 998}
984void KABCore::importFromOL() 999void KABCore::importFromOL()
985{ 1000{
986#ifdef _WIN32_ 1001#ifdef _WIN32_
987 KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this ); 1002 KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this );
988 idgl->exec(); 1003 idgl->exec();
989 KABC::Addressee::List list = idgl->getAddressList(); 1004 KABC::Addressee::List list = idgl->getAddressList();
990 if ( list.count() > 0 ) { 1005 if ( list.count() > 0 ) {
991 KABC::Addressee::List listNew; 1006 KABC::Addressee::List listNew;
992 KABC::Addressee::List listExisting; 1007 KABC::Addressee::List listExisting;
993 KABC::Addressee::List::Iterator it; 1008 KABC::Addressee::List::Iterator it;
994 KABC::AddressBook::Iterator iter; 1009 KABC::AddressBook::Iterator iter;
995 for ( it = list.begin(); it != list.end(); ++it ) { 1010 for ( it = list.begin(); it != list.end(); ++it ) {
996 if ( mAddressBook->findByUid((*it).uid() ).isEmpty()) 1011 if ( mAddressBook->findByUid((*it).uid() ).isEmpty())
997 listNew.append( (*it) ); 1012 listNew.append( (*it) );
998 else 1013 else
999 listExisting.append( (*it) ); 1014 listExisting.append( (*it) );
1000 } 1015 }
1001 if ( listExisting.count() > 0 ) 1016 if ( listExisting.count() > 0 )
1002 KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() )); 1017 KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() ));
1003 if ( listNew.count() > 0 ) { 1018 if ( listNew.count() > 0 ) {
1004 pasteWithNewUid = false; 1019 pasteWithNewUid = false;
1005 pasteContacts( listNew ); 1020 pasteContacts( listNew );
1006 pasteWithNewUid = true; 1021 pasteWithNewUid = true;
1007 } 1022 }
1008 } 1023 }
1009 delete idgl; 1024 delete idgl;
1010#endif 1025#endif
1011} 1026}
1012 1027
1013void KABCore::importVCard( const QString &vCard, bool showPreview ) 1028void KABCore::importVCard( const QString &vCard, bool showPreview )
1014{ 1029{
1015 mXXPortManager->importVCard( vCard, showPreview ); 1030 mXXPortManager->importVCard( vCard, showPreview );
1016} 1031}
1017 1032
1018//US added a second method without defaultparameter 1033//US added a second method without defaultparameter
1019void KABCore::editContact2() { 1034void KABCore::editContact2() {
1020 editContact( QString::null ); 1035 editContact( QString::null );
1021} 1036}
1022 1037
1023void KABCore::editContact( const QString &uid ) 1038void KABCore::editContact( const QString &uid )
1024{ 1039{
1025 1040
1026 if ( mExtensionManager->isQuickEditVisible() ) 1041 if ( mExtensionManager->isQuickEditVisible() )
1027 return; 1042 return;
1028 1043
1029 // First, locate the contact entry 1044 // First, locate the contact entry
1030 QString localUID = uid; 1045 QString localUID = uid;
1031 if ( localUID.isNull() ) { 1046 if ( localUID.isNull() ) {
1032 QStringList uidList = mViewManager->selectedUids(); 1047 QStringList uidList = mViewManager->selectedUids();
1033 if ( uidList.count() > 0 ) 1048 if ( uidList.count() > 0 )
1034 localUID = *( uidList.at( 0 ) ); 1049 localUID = *( uidList.at( 0 ) );
1035 } 1050 }
1036 1051
1037 KABC::Addressee addr = mAddressBook->findByUid( localUID ); 1052 KABC::Addressee addr = mAddressBook->findByUid( localUID );
1038 if ( !addr.isEmpty() ) { 1053 if ( !addr.isEmpty() ) {
1039 mEditorDialog->setAddressee( addr ); 1054 mEditorDialog->setAddressee( addr );
1040 KApplication::execDialog ( mEditorDialog ); 1055 KApplication::execDialog ( mEditorDialog );
1041 } 1056 }
1042} 1057}
1043 1058
1059/**
1060 Shows the detail view for the given uid. If the uid is QString::null,
1061 the method will try to find a selected addressee in the view.
1062 We call this method only if we use a small device. Bigger devices are calling editContact instead
1063 */
1064void KABCore::showContact( const QString &uid /*US = QString::null*/ )
1065{
1066 setDetailsVisible( true );
1067 mActionDetails->setChecked(true);
1068}
1069
1044void KABCore::save() 1070void KABCore::save()
1045{ 1071{
1046 if ( !mModified ) 1072 if ( !mModified )
1047 return; 1073 return;
1048 QString text = i18n( "There was an error while attempting to save\n the " 1074 QString text = i18n( "There was an error while attempting to save\n the "
1049 "address book. Please check that some \nother application is " 1075 "address book. Please check that some \nother application is "
1050 "not using it. " ); 1076 "not using it. " );
1051 statusMessage(i18n("Saving addressbook ... ")); 1077 statusMessage(i18n("Saving addressbook ... "));
1052#ifndef KAB_EMBEDDED 1078#ifndef KAB_EMBEDDED
1053 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); 1079 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook );
1054 if ( !b || !b->save() ) { 1080 if ( !b || !b->save() ) {
1055 KMessageBox::error( this, text, i18n( "Unable to Save" ) ); 1081 KMessageBox::error( this, text, i18n( "Unable to Save" ) );
1056 } 1082 }
1057#else //KAB_EMBEDDED 1083#else //KAB_EMBEDDED
1058 KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); 1084 KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook );
1059 if ( !b || !b->save() ) { 1085 if ( !b || !b->save() ) {
1060 QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok")); 1086 QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok"));
1061 } 1087 }
1062#endif //KAB_EMBEDDED 1088#endif //KAB_EMBEDDED
1063 1089
1064 statusMessage(i18n("Addressbook saved!")); 1090 statusMessage(i18n("Addressbook saved!"));
1065 setModified( false ); 1091 setModified( false );
1066} 1092}
1067 1093
1068void KABCore::statusMessage(QString mess , int time ) 1094void KABCore::statusMessage(QString mess , int time )
1069{ 1095{
1070 //topLevelWidget()->setCaption( mess ); 1096 //topLevelWidget()->setCaption( mess );
1071 // pending setting timer to revome message 1097 // pending setting timer to revome message
1072} 1098}
1073void KABCore::undo() 1099void KABCore::undo()
1074{ 1100{
1075 UndoStack::instance()->undo(); 1101 UndoStack::instance()->undo();
1076 1102
1077 // Refresh the view 1103 // Refresh the view
1078 mViewManager->refreshView(); 1104 mViewManager->refreshView();
1079} 1105}
1080 1106
1081void KABCore::redo() 1107void KABCore::redo()
1082{ 1108{
1083 RedoStack::instance()->redo(); 1109 RedoStack::instance()->redo();
1084 1110
1085 // Refresh the view 1111 // Refresh the view
1086 mViewManager->refreshView(); 1112 mViewManager->refreshView();
1087} 1113}
1088 1114
1089void KABCore::setJumpButtonBarVisible( bool visible ) 1115void KABCore::setJumpButtonBarVisible( bool visible )
1090{ 1116{
1091 if ( visible ) 1117 if (KGlobal::getDesktopSize() > KGlobal::Small ) {
1092 mJumpButtonBar->show(); 1118 if ( visible )
1119 mJumpButtonBar->show();
1120 else
1121 mJumpButtonBar->hide();
1122 }
1093 else 1123 else
1094 mJumpButtonBar->hide(); 1124 {
1125 // for the Z5500, show the jumpbar only if "the details are hidden" == "viewmanager are shown"
1126 if (mViewManager->isVisible())
1127 {
1128 if ( visible )
1129 mJumpButtonBar->show();
1130 else
1131 mJumpButtonBar->hide();
1132 }
1133 else
1134 {
1135 mJumpButtonBar->hide();
1136 }
1137 }
1095} 1138}
1096void KABCore::setDetailsToState() 1139void KABCore::setDetailsToState()
1097{ 1140{
1098 setDetailsVisible( mActionDetails->isChecked() ); 1141 setDetailsVisible( mActionDetails->isChecked() );
1099} 1142}
1100 1143
1144
1145
1101void KABCore::setDetailsVisible( bool visible ) 1146void KABCore::setDetailsVisible( bool visible )
1102{ 1147{
1103 if ( visible ) 1148 //US "details visible" has two different meanings for small devices like the 5500
1104 mDetails->show(); 1149 // compared with large devices like the c series.
1150
1151 // small devices: mDetails is always visible. But we switch between
1152 // the listview and the detailview. We do that by changing the splitbar size.
1153 if (KGlobal::getDesktopSize() > KGlobal::Small ) {
1154 if ( visible )
1155 mDetails->show();
1156 else
1157 mDetails->hide();
1158 }
1105 else 1159 else
1106 mDetails->hide(); 1160 {
1161 if ( visible ) {
1162 mViewManager->hide();
1163 mDetails->show();
1164// mDetails->show();
1165 }
1166 else {
1167 mViewManager->show();
1168 mDetails->hide();
1169 }
1170 setJumpButtonBarVisible( !visible );
1171
1172 }
1107} 1173}
1108 1174
1109void KABCore::extensionModified( const KABC::Addressee::List &list ) 1175void KABCore::extensionModified( const KABC::Addressee::List &list )
1110{ 1176{
1111 1177
1112 if ( list.count() != 0 ) { 1178 if ( list.count() != 0 ) {
1113 KABC::Addressee::List::ConstIterator it; 1179 KABC::Addressee::List::ConstIterator it;
1114 for ( it = list.begin(); it != list.end(); ++it ) 1180 for ( it = list.begin(); it != list.end(); ++it )
1115 mAddressBook->insertAddressee( *it ); 1181 mAddressBook->insertAddressee( *it );
1116 if ( list.count() > 1 ) 1182 if ( list.count() > 1 )
1117 setModified(); 1183 setModified();
1118 else 1184 else
1119 setModifiedWOrefresh(); 1185 setModifiedWOrefresh();
1120 } 1186 }
1121 if ( list.count() == 0 ) 1187 if ( list.count() == 0 )
1122 mViewManager->refreshView(); 1188 mViewManager->refreshView();
1123 else 1189 else
1124 mViewManager->refreshView( list[ 0 ].uid() ); 1190 mViewManager->refreshView( list[ 0 ].uid() );
1125 1191
1126 1192
1127 1193
1128} 1194}
1129 1195
1130QString KABCore::getNameByPhone( const QString &phone ) 1196QString KABCore::getNameByPhone( const QString &phone )
1131{ 1197{
1132#ifndef KAB_EMBEDDED 1198#ifndef KAB_EMBEDDED
1133 QRegExp r( "[/*/-/ ]" ); 1199 QRegExp r( "[/*/-/ ]" );
1134 QString localPhone( phone ); 1200 QString localPhone( phone );
1135 1201
1136 bool found = false; 1202 bool found = false;
1137 QString ownerName = ""; 1203 QString ownerName = "";
1138 KABC::AddressBook::Iterator iter; 1204 KABC::AddressBook::Iterator iter;
1139 KABC::PhoneNumber::List::Iterator phoneIter; 1205 KABC::PhoneNumber::List::Iterator phoneIter;
1140 KABC::PhoneNumber::List phoneList; 1206 KABC::PhoneNumber::List phoneList;
1141 for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) { 1207 for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) {
1142 phoneList = (*iter).phoneNumbers(); 1208 phoneList = (*iter).phoneNumbers();
1143 for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() ); 1209 for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() );
1144 ++phoneIter) { 1210 ++phoneIter) {
1145 // Get rid of separator chars so just the numbers are compared. 1211 // Get rid of separator chars so just the numbers are compared.
1146 if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) { 1212 if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) {
1147 ownerName = (*iter).formattedName(); 1213 ownerName = (*iter).formattedName();
1148 found = true; 1214 found = true;
1149 } 1215 }
1150 } 1216 }
1151 } 1217 }
1152 1218
1153 return ownerName; 1219 return ownerName;
1154#else //KAB_EMBEDDED 1220#else //KAB_EMBEDDED
1155 qDebug("KABCore::getNameByPhone finsih method"); 1221 qDebug("KABCore::getNameByPhone finsih method");
1156 return ""; 1222 return "";
1157#endif //KAB_EMBEDDED 1223#endif //KAB_EMBEDDED
1158 1224
1159} 1225}
1160 1226
1161void KABCore::openConfigDialog() 1227void KABCore::openConfigDialog()
1162{ 1228{
1163 KABPrefs* kab_prefs = KABPrefs::instance(); 1229 KABPrefs* kab_prefs = KABPrefs::instance();
1164 KPimGlobalPrefs* kpim_prefs = KPimGlobalPrefs::instance(); 1230 KPimGlobalPrefs* kpim_prefs = KPimGlobalPrefs::instance();
1165 1231
1166 KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true ); 1232 KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true );
1167 KCMKabConfig* kabcfg = new KCMKabConfig( kab_prefs, ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" ); 1233 KCMKabConfig* kabcfg = new KCMKabConfig( kab_prefs, ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" );
1168 ConfigureDialog->addModule(kabcfg ); 1234 ConfigureDialog->addModule(kabcfg );
1169 KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( kpim_prefs, ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" ); 1235 KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( kpim_prefs, ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" );
1170 ConfigureDialog->addModule(kdelibcfg ); 1236 ConfigureDialog->addModule(kdelibcfg );
1171 1237
1172 1238
1173 1239
1174 connect( ConfigureDialog, SIGNAL( applyClicked() ), 1240 connect( ConfigureDialog, SIGNAL( applyClicked() ),
1175 this, SLOT( configurationChanged() ) ); 1241 this, SLOT( configurationChanged() ) );
1176 connect( ConfigureDialog, SIGNAL( okClicked() ), 1242 connect( ConfigureDialog, SIGNAL( okClicked() ),
1177 this, SLOT( configurationChanged() ) ); 1243 this, SLOT( configurationChanged() ) );
1178 saveSettings(); 1244 saveSettings();
1179 ConfigureDialog->showMaximized(); 1245 ConfigureDialog->showMaximized();
1180 if ( ConfigureDialog->exec() ) 1246 if ( ConfigureDialog->exec() )
1181 KMessageBox::information( this, i18n("If you configured \nExtensions,\nplease restart!\n") ); 1247 KMessageBox::information( this, i18n("If you configured \nExtensions,\nplease restart!\n") );
1182 delete ConfigureDialog; 1248 delete ConfigureDialog;
1183} 1249}
1184 1250
1185void KABCore::openLDAPDialog() 1251void KABCore::openLDAPDialog()
1186{ 1252{
1187#ifndef KAB_EMBEDDED 1253#ifndef KAB_EMBEDDED
1188 if ( !mLdapSearchDialog ) { 1254 if ( !mLdapSearchDialog ) {
1189 mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this ); 1255 mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this );
1190 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager, 1256 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager,
1191 SLOT( refreshView() ) ); 1257 SLOT( refreshView() ) );
1192 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this, 1258 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this,
1193 SLOT( setModified() ) ); 1259 SLOT( setModified() ) );
1194 } else 1260 } else
1195 mLdapSearchDialog->restoreSettings(); 1261 mLdapSearchDialog->restoreSettings();
1196 1262
1197 if ( mLdapSearchDialog->isOK() ) 1263 if ( mLdapSearchDialog->isOK() )
1198 mLdapSearchDialog->exec(); 1264 mLdapSearchDialog->exec();
1199#else //KAB_EMBEDDED 1265#else //KAB_EMBEDDED
1200 qDebug("KABCore::openLDAPDialog() finsih method"); 1266 qDebug("KABCore::openLDAPDialog() finsih method");
1201#endif //KAB_EMBEDDED 1267#endif //KAB_EMBEDDED
1202} 1268}
1203 1269
1204void KABCore::print() 1270void KABCore::print()
1205{ 1271{
1206#ifndef KAB_EMBEDDED 1272#ifndef KAB_EMBEDDED
1207 KPrinter printer; 1273 KPrinter printer;
1208 if ( !printer.setup( this ) ) 1274 if ( !printer.setup( this ) )
1209 return; 1275 return;
1210 1276
1211 KABPrinting::PrintingWizard wizard( &printer, mAddressBook, 1277 KABPrinting::PrintingWizard wizard( &printer, mAddressBook,
1212 mViewManager->selectedUids(), this ); 1278 mViewManager->selectedUids(), this );
1213 1279
1214 wizard.exec(); 1280 wizard.exec();
1215#else //KAB_EMBEDDED 1281#else //KAB_EMBEDDED
1216 qDebug("KABCore::print() finsih method"); 1282 qDebug("KABCore::print() finsih method");
1217#endif //KAB_EMBEDDED 1283#endif //KAB_EMBEDDED
1218 1284
1219} 1285}
1220 1286
1221 1287
1222void KABCore::addGUIClient( KXMLGUIClient *client ) 1288void KABCore::addGUIClient( KXMLGUIClient *client )
1223{ 1289{
1224 if ( mGUIClient ) 1290 if ( mGUIClient )
1225 mGUIClient->insertChildClient( client ); 1291 mGUIClient->insertChildClient( client );
1226 else 1292 else
1227 KMessageBox::error( this, "no KXMLGUICLient"); 1293 KMessageBox::error( this, "no KXMLGUICLient");
1228} 1294}
1229 1295
1230 1296
1231void KABCore::configurationChanged() 1297void KABCore::configurationChanged()
1232{ 1298{
1233 mExtensionManager->reconfigure(); 1299 mExtensionManager->reconfigure();
1234} 1300}
1235 1301
1236void KABCore::addressBookChanged() 1302void KABCore::addressBookChanged()
1237{ 1303{
1238/*US 1304/*US
1239 QDictIterator<AddresseeEditorDialog> it( mEditorDict ); 1305 QDictIterator<AddresseeEditorDialog> it( mEditorDict );
1240 while ( it.current() ) { 1306 while ( it.current() ) {
1241 if ( it.current()->dirty() ) { 1307 if ( it.current()->dirty() ) {
1242 QString text = i18n( "Data has been changed externally. Unsaved " 1308 QString text = i18n( "Data has been changed externally. Unsaved "
1243 "changes will be lost." ); 1309 "changes will be lost." );
1244 KMessageBox::information( this, text ); 1310 KMessageBox::information( this, text );
1245 } 1311 }
1246 it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) ); 1312 it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) );
1247 ++it; 1313 ++it;
1248 } 1314 }
1249*/ 1315*/
1250 if (mEditorDialog) 1316 if (mEditorDialog)
1251 { 1317 {
1252 if (mEditorDialog->dirty()) 1318 if (mEditorDialog->dirty())
1253 { 1319 {
1254 QString text = i18n( "Data has been changed externally. Unsaved " 1320 QString text = i18n( "Data has been changed externally. Unsaved "
1255 "changes will be lost." ); 1321 "changes will be lost." );
1256 KMessageBox::information( this, text ); 1322 KMessageBox::information( this, text );
1257 } 1323 }
1258 QString currentuid = mEditorDialog->addressee().uid(); 1324 QString currentuid = mEditorDialog->addressee().uid();
1259 mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) ); 1325 mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) );
1260 } 1326 }
1261 mViewManager->refreshView(); 1327 mViewManager->refreshView();
1262// mDetails->refreshView(); 1328// mDetails->refreshView();
1263 1329
1264 1330
1265} 1331}
1266 1332
1267AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, 1333AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent,
1268 const char *name ) 1334 const char *name )
1269{ 1335{
1270 1336
1271 if ( mEditorDialog == 0 ) { 1337 if ( mEditorDialog == 0 ) {
1272 mEditorDialog = new AddresseeEditorDialog( this, parent, 1338 mEditorDialog = new AddresseeEditorDialog( this, parent,
1273 name ? name : "editorDialog" ); 1339 name ? name : "editorDialog" );
1274 1340
1275 1341
1276 connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ), 1342 connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ),
1277 SLOT( contactModified( const KABC::Addressee& ) ) ); 1343 SLOT( contactModified( const KABC::Addressee& ) ) );
1278 //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ), 1344 //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ),
1279 // SLOT( slotEditorDestroyed( const QString& ) ) ); 1345 // SLOT( slotEditorDestroyed( const QString& ) ) );
1280 } 1346 }
1281 1347
1282 return mEditorDialog; 1348 return mEditorDialog;
1283} 1349}
1284 1350
1285void KABCore::slotEditorDestroyed( const QString &uid ) 1351void KABCore::slotEditorDestroyed( const QString &uid )
1286{ 1352{
1287 //mEditorDict.remove( uid ); 1353 //mEditorDict.remove( uid );
1288} 1354}
1289 1355
1290void KABCore::initGUI() 1356void KABCore::initGUI()
1291{ 1357{
1292#ifndef KAB_EMBEDDED 1358#ifndef KAB_EMBEDDED
1293 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1359 QHBoxLayout *topLayout = new QHBoxLayout( this );
1294 topLayout->setSpacing( KDialogBase::spacingHint() ); 1360 topLayout->setSpacing( KDialogBase::spacingHint() );
1295 1361
1296 mExtensionBarSplitter = new QSplitter( this ); 1362 mExtensionBarSplitter = new QSplitter( this );
1297 mExtensionBarSplitter->setOrientation( Qt::Vertical ); 1363 mExtensionBarSplitter->setOrientation( Qt::Vertical );
1298 1364
@@ -1382,470 +1448,472 @@ void KABCore::initGUI()
1382#ifndef KAB_NOSPLITTER 1448#ifndef KAB_NOSPLITTER
1383 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1449 QHBoxLayout *topLayout = new QHBoxLayout( this );
1384//US topLayout->setSpacing( KDialogBase::spacingHint() ); 1450//US topLayout->setSpacing( KDialogBase::spacingHint() );
1385 topLayout->setSpacing( 10 ); 1451 topLayout->setSpacing( 10 );
1386 1452
1387 mDetailsSplitter = new QSplitter( this ); 1453 mDetailsSplitter = new QSplitter( this );
1388 1454
1389 QVBox *viewSpace = new QVBox( mDetailsSplitter ); 1455 QVBox *viewSpace = new QVBox( mDetailsSplitter );
1390 1456
1391 mViewManager = new ViewManager( this, viewSpace ); 1457 mViewManager = new ViewManager( this, viewSpace );
1392 viewSpace->setStretchFactor( mViewManager, 1 ); 1458 viewSpace->setStretchFactor( mViewManager, 1 );
1393 1459
1394 mDetails = new ViewContainer( mDetailsSplitter ); 1460 mDetails = new ViewContainer( mDetailsSplitter );
1395 1461
1396 topLayout->addWidget( mDetailsSplitter ); 1462 topLayout->addWidget( mDetailsSplitter );
1397 topLayout->setStretchFactor( mDetailsSplitter, 100 ); 1463 topLayout->setStretchFactor( mDetailsSplitter, 100 );
1398#else //KAB_NOSPLITTER 1464#else //KAB_NOSPLITTER
1399 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1465 QHBoxLayout *topLayout = new QHBoxLayout( this );
1400//US topLayout->setSpacing( KDialogBase::spacingHint() ); 1466//US topLayout->setSpacing( KDialogBase::spacingHint() );
1401 topLayout->setSpacing( 10 ); 1467 topLayout->setSpacing( 10 );
1402 1468
1403// mDetailsSplitter = new QSplitter( this ); 1469// mDetailsSplitter = new QSplitter( this );
1404 1470
1405 QVBox *viewSpace = new QVBox( this ); 1471 QVBox *viewSpace = new QVBox( this );
1406 1472
1407 mViewManager = new ViewManager( this, viewSpace ); 1473 mViewManager = new ViewManager( this, viewSpace );
1408 viewSpace->setStretchFactor( mViewManager, 1 ); 1474 viewSpace->setStretchFactor( mViewManager, 1 );
1409 1475
1410 mDetails = new ViewContainer( this ); 1476 mDetails = new ViewContainer( this );
1411 1477
1412 topLayout->addWidget( viewSpace ); 1478 topLayout->addWidget( viewSpace );
1413// topLayout->setStretchFactor( mDetailsSplitter, 100 ); 1479// topLayout->setStretchFactor( mDetailsSplitter, 100 );
1414 topLayout->addWidget( mDetails ); 1480 topLayout->addWidget( mDetails );
1415#endif //KAB_NOSPLITTER 1481#endif //KAB_NOSPLITTER
1416*/ 1482*/
1417 1483
1418 1484
1419#endif //KAB_EMBEDDED 1485#endif //KAB_EMBEDDED
1420 initActions(); 1486 initActions();
1421 1487
1422#ifdef KAB_EMBEDDED 1488#ifdef KAB_EMBEDDED
1423 addActionsManually(); 1489 addActionsManually();
1424 //US make sure the export and import menues are initialized before creating the xxPortManager. 1490 //US make sure the export and import menues are initialized before creating the xxPortManager.
1425 mXXPortManager = new XXPortManager( this, this ); 1491 mXXPortManager = new XXPortManager( this, this );
1426 1492
1427 // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); 1493 // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() );
1428 //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); 1494 //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget);
1429 // mActionQuit->plug ( mMainWindow->toolBar()); 1495 // mActionQuit->plug ( mMainWindow->toolBar());
1430 //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); 1496 //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() );
1431 //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); 1497 //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget);
1432 // mIncSearchWidget->hide(); 1498 // mIncSearchWidget->hide();
1433 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1499 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1434 SLOT( incrementalSearch( const QString& ) ) ); 1500 SLOT( incrementalSearch( const QString& ) ) );
1435 1501
1436 1502
1437 mJumpButtonBar = new JumpButtonBar( this, this ); 1503 mJumpButtonBar = new JumpButtonBar( this, this );
1438 1504
1439 topLayout->addWidget( mJumpButtonBar ); 1505 topLayout->addWidget( mJumpButtonBar );
1440//US topLayout->setStretchFactor( mJumpButtonBar, 10 ); 1506//US topLayout->setStretchFactor( mJumpButtonBar, 10 );
1441 1507
1442// mMainWindow->getIconToolBar()->raise(); 1508// mMainWindow->getIconToolBar()->raise();
1443 1509
1444#endif //KAB_EMBEDDED 1510#endif //KAB_EMBEDDED
1445 1511
1446} 1512}
1447void KABCore::initActions() 1513void KABCore::initActions()
1448{ 1514{
1449//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); 1515//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
1450 1516
1451#ifndef KAB_EMBEDDED 1517#ifndef KAB_EMBEDDED
1452 connect( QApplication::clipboard(), SIGNAL( dataChanged() ), 1518 connect( QApplication::clipboard(), SIGNAL( dataChanged() ),
1453 SLOT( clipboardDataChanged() ) ); 1519 SLOT( clipboardDataChanged() ) );
1454#endif //KAB_EMBEDDED 1520#endif //KAB_EMBEDDED
1455 1521
1456 // file menu 1522 // file menu
1457 if ( mIsPart ) { 1523 if ( mIsPart ) {
1458 mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, 1524 mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this,
1459 SLOT( sendMail() ), actionCollection(), 1525 SLOT( sendMail() ), actionCollection(),
1460 "kaddressbook_mail" ); 1526 "kaddressbook_mail" );
1461 mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, 1527 mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this,
1462 SLOT( print() ), actionCollection(), "kaddressbook_print" ); 1528 SLOT( print() ), actionCollection(), "kaddressbook_print" );
1463 1529
1464 } else { 1530 } else {
1465 mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); 1531 mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() );
1466 mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); 1532 mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() );
1467 } 1533 }
1468 1534
1469 1535
1470 mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, 1536 mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this,
1471 SLOT( save() ), actionCollection(), "file_sync" ); 1537 SLOT( save() ), actionCollection(), "file_sync" );
1472 1538
1473 mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, 1539 mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this,
1474 SLOT( newContact() ), actionCollection(), "file_new_contact" ); 1540 SLOT( newContact() ), actionCollection(), "file_new_contact" );
1475 1541
1476 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, 1542 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0,
1477 this, SLOT( mailVCard() ), 1543 this, SLOT( mailVCard() ),
1478 actionCollection(), "file_mail_vcard"); 1544 actionCollection(), "file_mail_vcard");
1479 1545
1480 mActionBeamVCard = 0; 1546 mActionBeamVCard = 0;
1481 mActionBeam = 0; 1547 mActionBeam = 0;
1482 1548
1483#ifndef DESKTOP_VERSION 1549#ifndef DESKTOP_VERSION
1484 if ( Ir::supported() ) { 1550 if ( Ir::supported() ) {
1485 mActionBeamVCard = new KAction( i18n( "Beam selected v&Card(s)" ), "beam", 0, this, 1551 mActionBeamVCard = new KAction( i18n( "Beam selected v&Card(s)" ), "beam", 0, this,
1486 SLOT( beamVCard() ), actionCollection(), 1552 SLOT( beamVCard() ), actionCollection(),
1487 "kaddressbook_beam_vcard" ); 1553 "kaddressbook_beam_vcard" );
1488 1554
1489 mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, 1555 mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this,
1490 SLOT( beamMySelf() ), actionCollection(), 1556 SLOT( beamMySelf() ), actionCollection(),
1491 "kaddressbook_beam_myself" ); 1557 "kaddressbook_beam_myself" );
1492 } 1558 }
1493#endif 1559#endif
1494 1560
1495 mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, 1561 mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0,
1496 this, SLOT( editContact2() ), 1562 this, SLOT( editContact2() ),
1497 actionCollection(), "file_properties" ); 1563 actionCollection(), "file_properties" );
1498 1564
1499#ifdef KAB_EMBEDDED 1565#ifdef KAB_EMBEDDED
1500 // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); 1566 // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() );
1501 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, 1567 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0,
1502 mMainWindow, SLOT( exit() ), 1568 mMainWindow, SLOT( exit() ),
1503 actionCollection(), "quit" ); 1569 actionCollection(), "quit" );
1504#endif //KAB_EMBEDDED 1570#endif //KAB_EMBEDDED
1505 1571
1506 // edit menu 1572 // edit menu
1507 if ( mIsPart ) { 1573 if ( mIsPart ) {
1508 mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, 1574 mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this,
1509 SLOT( copyContacts() ), actionCollection(), 1575 SLOT( copyContacts() ), actionCollection(),
1510 "kaddressbook_copy" ); 1576 "kaddressbook_copy" );
1511 mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, 1577 mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this,
1512 SLOT( cutContacts() ), actionCollection(), 1578 SLOT( cutContacts() ), actionCollection(),
1513 "kaddressbook_cut" ); 1579 "kaddressbook_cut" );
1514 mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, 1580 mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this,
1515 SLOT( pasteContacts() ), actionCollection(), 1581 SLOT( pasteContacts() ), actionCollection(),
1516 "kaddressbook_paste" ); 1582 "kaddressbook_paste" );
1517 mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, 1583 mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this,
1518 SLOT( selectAllContacts() ), actionCollection(), 1584 SLOT( selectAllContacts() ), actionCollection(),
1519 "kaddressbook_select_all" ); 1585 "kaddressbook_select_all" );
1520 mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, 1586 mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this,
1521 SLOT( undo() ), actionCollection(), 1587 SLOT( undo() ), actionCollection(),
1522 "kaddressbook_undo" ); 1588 "kaddressbook_undo" );
1523 mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, 1589 mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z,
1524 this, SLOT( redo() ), actionCollection(), 1590 this, SLOT( redo() ), actionCollection(),
1525 "kaddressbook_redo" ); 1591 "kaddressbook_redo" );
1526 } else { 1592 } else {
1527 mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); 1593 mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() );
1528 mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); 1594 mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() );
1529 mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); 1595 mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() );
1530 mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); 1596 mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() );
1531 mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); 1597 mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() );
1532 mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); 1598 mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() );
1533 } 1599 }
1534 1600
1535 mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", 1601 mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete",
1536 Key_Delete, this, SLOT( deleteContacts() ), 1602 Key_Delete, this, SLOT( deleteContacts() ),
1537 actionCollection(), "edit_delete" ); 1603 actionCollection(), "edit_delete" );
1538 1604
1539 mActionUndo->setEnabled( false ); 1605 mActionUndo->setEnabled( false );
1540 mActionRedo->setEnabled( false ); 1606 mActionRedo->setEnabled( false );
1541 1607
1542 // settings menu 1608 // settings menu
1543#ifdef KAB_EMBEDDED 1609#ifdef KAB_EMBEDDED
1544//US special menuentry to configure the addressbook resources. On KDE 1610//US special menuentry to configure the addressbook resources. On KDE
1545// you do that through the control center !!! 1611// you do that through the control center !!!
1546 mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, 1612 mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this,
1547 SLOT( configureResources() ), actionCollection(), 1613 SLOT( configureResources() ), actionCollection(),
1548 "kaddressbook_configure_resources" ); 1614 "kaddressbook_configure_resources" );
1549#endif //KAB_EMBEDDED 1615#endif //KAB_EMBEDDED
1550 1616
1551 if ( mIsPart ) { 1617 if ( mIsPart ) {
1552 mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, 1618 mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this,
1553 SLOT( openConfigDialog() ), actionCollection(), 1619 SLOT( openConfigDialog() ), actionCollection(),
1554 "kaddressbook_configure" ); 1620 "kaddressbook_configure" );
1555 1621
1556 mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, 1622 mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0,
1557 this, SLOT( configureKeyBindings() ), actionCollection(), 1623 this, SLOT( configureKeyBindings() ), actionCollection(),
1558 "kaddressbook_configure_shortcuts" ); 1624 "kaddressbook_configure_shortcuts" );
1559#ifdef KAB_EMBEDDED 1625#ifdef KAB_EMBEDDED
1560 mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); 1626 mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() );
1561 mActionConfigureToolbars->setEnabled( false ); 1627 mActionConfigureToolbars->setEnabled( false );
1562#endif //KAB_EMBEDDED 1628#endif //KAB_EMBEDDED
1563 1629
1564 } else { 1630 } else {
1565 mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); 1631 mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() );
1566 1632
1567 mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); 1633 mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() );
1568 } 1634 }
1569 1635
1570 mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, 1636 mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0,
1571 actionCollection(), "options_show_jump_bar" ); 1637 actionCollection(), "options_show_jump_bar" );
1572 connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); 1638 connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) );
1573 1639
1574 mActionDetails = new KToggleAction( i18n( "Show Details" ), 0, 0, 1640 mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0,
1575 actionCollection(), "options_show_details" ); 1641 actionCollection(), "options_show_details" );
1576 connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); 1642 connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) );
1577 1643
1578 // misc 1644 // misc
1579 // only enable LDAP lookup if we can handle the protocol 1645 // only enable LDAP lookup if we can handle the protocol
1580#ifndef KAB_EMBEDDED 1646#ifndef KAB_EMBEDDED
1581 if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { 1647 if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) {
1582 new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, 1648 new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0,
1583 this, SLOT( openLDAPDialog() ), actionCollection(), 1649 this, SLOT( openLDAPDialog() ), actionCollection(),
1584 "ldap_lookup" ); 1650 "ldap_lookup" );
1585 } 1651 }
1586#else //KAB_EMBEDDED 1652#else //KAB_EMBEDDED
1587 //qDebug("KABCore::initActions() LDAP has to be implemented"); 1653 //qDebug("KABCore::initActions() LDAP has to be implemented");
1588#endif //KAB_EMBEDDED 1654#endif //KAB_EMBEDDED
1589 1655
1590 1656
1591 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, 1657 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this,
1592 SLOT( setWhoAmI() ), actionCollection(), 1658 SLOT( setWhoAmI() ), actionCollection(),
1593 "set_personal" ); 1659 "set_personal" );
1594 1660
1595 1661
1596 1662
1597 1663
1598 mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, 1664 mActionCategories = new KAction( i18n( "Set Categories" ), 0, this,
1599 SLOT( setCategories() ), actionCollection(), 1665 SLOT( setCategories() ), actionCollection(),
1600 "edit_set_categories" ); 1666 "edit_set_categories" );
1601 1667
1602 mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, 1668 mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this,
1603 SLOT( removeVoice() ), actionCollection(), 1669 SLOT( removeVoice() ), actionCollection(),
1604 "remove_voice" ); 1670 "remove_voice" );
1605 mActionImportOL = new KAction( i18n( "Import from OL..." ), 0, this, 1671 mActionImportOL = new KAction( i18n( "Import from OL..." ), 0, this,
1606 SLOT( importFromOL() ), actionCollection(), 1672 SLOT( importFromOL() ), actionCollection(),
1607 "import_OL" ); 1673 "import_OL" );
1608#ifdef KAB_EMBEDDED 1674#ifdef KAB_EMBEDDED
1609 mActionLicence = new KAction( i18n( "Licence" ), "licence", 0, 1675 mActionLicence = new KAction( i18n( "Licence" ), "licence", 0,
1610 this, SLOT( showLicence() ), actionCollection(), 1676 this, SLOT( showLicence() ), actionCollection(),
1611 "licence_about_data" ); 1677 "licence_about_data" );
1612 mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, 1678 mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0,
1613 this, SLOT( createAboutData() ), actionCollection(), 1679 this, SLOT( createAboutData() ), actionCollection(),
1614 "kaddressbook_about_data" ); 1680 "kaddressbook_about_data" );
1615#endif //KAB_EMBEDDED 1681#endif //KAB_EMBEDDED
1616 1682
1617 clipboardDataChanged(); 1683 clipboardDataChanged();
1618 connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); 1684 connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
1619 connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); 1685 connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
1620} 1686}
1621 1687
1622//US we need this function, to plug all actions into the correct menues. 1688//US we need this function, to plug all actions into the correct menues.
1623// KDE uses a XML format to plug the actions, but we work her without this overhead. 1689// KDE uses a XML format to plug the actions, but we work her without this overhead.
1624void KABCore::addActionsManually() 1690void KABCore::addActionsManually()
1625{ 1691{
1626//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); 1692//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
1627 1693
1628#ifdef KAB_EMBEDDED 1694#ifdef KAB_EMBEDDED
1629 QPopupMenu *fileMenu = new QPopupMenu( this ); 1695 QPopupMenu *fileMenu = new QPopupMenu( this );
1630 QPopupMenu *editMenu = new QPopupMenu( this ); 1696 QPopupMenu *editMenu = new QPopupMenu( this );
1631 QPopupMenu *helpMenu = new QPopupMenu( this ); 1697 QPopupMenu *helpMenu = new QPopupMenu( this );
1632 1698
1633 KToolBar* tb = mMainWindow->toolBar(); 1699 KToolBar* tb = mMainWindow->toolBar();
1634 1700
1635#ifdef DESKTOP_VERSION 1701#ifdef DESKTOP_VERSION
1636 QMenuBar* mb = mMainWindow->menuBar(); 1702 QMenuBar* mb = mMainWindow->menuBar();
1637 1703
1638 //US setup menubar. 1704 //US setup menubar.
1639 //Disable the following block if you do not want to have a menubar. 1705 //Disable the following block if you do not want to have a menubar.
1640 mb->insertItem( "&File", fileMenu ); 1706 mb->insertItem( "&File", fileMenu );
1641 mb->insertItem( "&Edit", editMenu ); 1707 mb->insertItem( "&Edit", editMenu );
1642 mb->insertItem( "&View", viewMenu ); 1708 mb->insertItem( "&View", viewMenu );
1643 mb->insertItem( "&Settings", settingsMenu ); 1709 mb->insertItem( "&Settings", settingsMenu );
1644 mb->insertItem( "&Change selected", changeMenu ); 1710 mb->insertItem( "&Change selected", changeMenu );
1645 mb->insertItem( "&Help", helpMenu ); 1711 mb->insertItem( "&Help", helpMenu );
1646 mIncSearchWidget = new IncSearchWidget( tb ); 1712 mIncSearchWidget = new IncSearchWidget( tb );
1647 // tb->insertWidget(-1, 0, mIncSearchWidget); 1713 // tb->insertWidget(-1, 0, mIncSearchWidget);
1648 1714
1649#else 1715#else
1650 //US setup toolbar 1716 //US setup toolbar
1651 QMenuBar *menuBarTB = new QMenuBar( tb ); 1717 QMenuBar *menuBarTB = new QMenuBar( tb );
1652 QPopupMenu *popupBarTB = new QPopupMenu( this ); 1718 QPopupMenu *popupBarTB = new QPopupMenu( this );
1653 menuBarTB->insertItem( "ME", popupBarTB); 1719 menuBarTB->insertItem( "ME", popupBarTB);
1654 tb->insertWidget(-1, 0, menuBarTB); 1720 tb->insertWidget(-1, 0, menuBarTB);
1655 mIncSearchWidget = new IncSearchWidget( tb ); 1721 mIncSearchWidget = new IncSearchWidget( tb );
1656 1722
1657 tb->enableMoving(false); 1723 tb->enableMoving(false);
1658 popupBarTB->insertItem( "&File", fileMenu ); 1724 popupBarTB->insertItem( "&File", fileMenu );
1659 popupBarTB->insertItem( "&Edit", editMenu ); 1725 popupBarTB->insertItem( "&Edit", editMenu );
1660 popupBarTB->insertItem( "&View", viewMenu ); 1726 popupBarTB->insertItem( "&View", viewMenu );
1661 popupBarTB->insertItem( "&Settings", settingsMenu ); 1727 popupBarTB->insertItem( "&Settings", settingsMenu );
1662 mViewManager->getFilterAction()->plug ( popupBarTB); 1728 mViewManager->getFilterAction()->plug ( popupBarTB);
1663 popupBarTB->insertItem( "&Change selected", changeMenu ); 1729 popupBarTB->insertItem( "&Change selected", changeMenu );
1664 popupBarTB->insertItem( "&Help", helpMenu ); 1730 popupBarTB->insertItem( "&Help", helpMenu );
1665 if (QApplication::desktop()->width() > 320 ) { 1731 if (QApplication::desktop()->width() > 320 ) {
1666 // mViewManager->getFilterAction()->plug ( tb); 1732 // mViewManager->getFilterAction()->plug ( tb);
1667 } 1733 }
1668#endif 1734#endif
1669 // mActionQuit->plug ( mMainWindow->toolBar()); 1735 // mActionQuit->plug ( mMainWindow->toolBar());
1670 1736
1671 1737
1672 1738
1673 //US Now connect the actions with the menue entries. 1739 //US Now connect the actions with the menue entries.
1674 mActionPrint->plug( fileMenu ); 1740 mActionPrint->plug( fileMenu );
1675 mActionMail->plug( fileMenu ); 1741 mActionMail->plug( fileMenu );
1676 fileMenu->insertSeparator(); 1742 fileMenu->insertSeparator();
1677 1743
1678 mActionNewContact->plug( fileMenu ); 1744 mActionNewContact->plug( fileMenu );
1679 mActionNewContact->plug( tb ); 1745 mActionNewContact->plug( tb );
1680 1746
1681 mActionEditAddressee->plug( fileMenu ); 1747 mActionEditAddressee->plug( fileMenu );
1748 mActionEditAddressee->plug( tb );
1682 fileMenu->insertSeparator(); 1749 fileMenu->insertSeparator();
1683 mActionSave->plug( fileMenu ); 1750 mActionSave->plug( fileMenu );
1684 fileMenu->insertItem( "&Import", ImportMenu ); 1751 fileMenu->insertItem( "&Import", ImportMenu );
1685 fileMenu->insertItem( "&Emport", ExportMenu ); 1752 fileMenu->insertItem( "&Emport", ExportMenu );
1686 fileMenu->insertSeparator(); 1753 fileMenu->insertSeparator();
1687 mActionMailVCard->plug( fileMenu ); 1754 mActionMailVCard->plug( fileMenu );
1688#ifndef DESKTOP_VERSION 1755#ifndef DESKTOP_VERSION
1689 if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu ); 1756 if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu );
1690 if ( Ir::supported() ) mActionBeam->plug(fileMenu ); 1757 if ( Ir::supported() ) mActionBeam->plug(fileMenu );
1691#endif 1758#endif
1692 fileMenu->insertSeparator(); 1759 fileMenu->insertSeparator();
1693 mActionQuit->plug( fileMenu ); 1760 mActionQuit->plug( fileMenu );
1694#ifdef _WIN32_ 1761#ifdef _WIN32_
1695 mActionImportOL->plug( ImportMenu ); 1762 mActionImportOL->plug( ImportMenu );
1696#endif 1763#endif
1697 // edit menu 1764 // edit menu
1698 mActionUndo->plug( editMenu ); 1765 mActionUndo->plug( editMenu );
1699 mActionRedo->plug( editMenu ); 1766 mActionRedo->plug( editMenu );
1700 editMenu->insertSeparator(); 1767 editMenu->insertSeparator();
1701 mActionCut->plug( editMenu ); 1768 mActionCut->plug( editMenu );
1702 mActionCopy->plug( editMenu ); 1769 mActionCopy->plug( editMenu );
1703 mActionPaste->plug( editMenu ); 1770 mActionPaste->plug( editMenu );
1704 mActionDelete->plug( editMenu ); 1771 mActionDelete->plug( editMenu );
1705 editMenu->insertSeparator(); 1772 editMenu->insertSeparator();
1706 mActionSelectAll->plug( editMenu ); 1773 mActionSelectAll->plug( editMenu );
1707 1774
1708 mActionRemoveVoice->plug( changeMenu ); 1775 mActionRemoveVoice->plug( changeMenu );
1709 // settings menu 1776 // settings menu
1710//US special menuentry to configure the addressbook resources. On KDE 1777//US special menuentry to configure the addressbook resources. On KDE
1711// you do that through the control center !!! 1778// you do that through the control center !!!
1712 mActionConfigResources->plug( settingsMenu ); 1779 mActionConfigResources->plug( settingsMenu );
1713 settingsMenu->insertSeparator(); 1780 settingsMenu->insertSeparator();
1714 1781
1715 mActionConfigKAddressbook->plug( settingsMenu ); 1782 mActionConfigKAddressbook->plug( settingsMenu );
1716 1783
1717 if ( mIsPart ) { 1784 if ( mIsPart ) {
1718 mActionConfigShortcuts->plug( settingsMenu ); 1785 mActionConfigShortcuts->plug( settingsMenu );
1719 mActionConfigureToolbars->plug( settingsMenu ); 1786 mActionConfigureToolbars->plug( settingsMenu );
1720 1787
1721 } else { 1788 } else {
1722 mActionKeyBindings->plug( settingsMenu ); 1789 mActionKeyBindings->plug( settingsMenu );
1723 } 1790 }
1724 1791
1725 settingsMenu->insertSeparator(); 1792 settingsMenu->insertSeparator();
1726 1793
1727 mActionJumpBar->plug( settingsMenu ); 1794 mActionJumpBar->plug( settingsMenu );
1728 mActionDetails->plug( settingsMenu ); 1795 mActionDetails->plug( settingsMenu );
1796 if (KGlobal::getDesktopSize() == KGlobal::Small )
1797 mActionDetails->plug( tb );
1729 settingsMenu->insertSeparator(); 1798 settingsMenu->insertSeparator();
1730 1799
1731 mActionWhoAmI->plug( settingsMenu ); 1800 mActionWhoAmI->plug( settingsMenu );
1732 mActionCategories->plug( settingsMenu ); 1801 mActionCategories->plug( settingsMenu );
1733 1802
1734 mActionAboutKAddressbook->plug( helpMenu ); 1803 mActionAboutKAddressbook->plug( helpMenu );
1735 mActionLicence->plug( helpMenu ); 1804 mActionLicence->plug( helpMenu );
1736 1805
1737 if (QApplication::desktop()->width() > 320 ) { 1806 if (KGlobal::getDesktopSize() > KGlobal::Small ) {
1738 1807
1739 mActionEditAddressee->plug( tb );
1740 mActionSave->plug( tb ); 1808 mActionSave->plug( tb );
1741 mViewManager->getFilterAction()->plug ( tb); 1809 mViewManager->getFilterAction()->plug ( tb);
1742 if (QApplication::desktop()->width() > 480 ) { 1810 if (KGlobal::getDesktopSize() == KGlobal::Desktop ) {
1743 mActionUndo->plug( tb ); 1811 mActionUndo->plug( tb );
1744 mActionDelete->plug( tb ); 1812 mActionDelete->plug( tb );
1745 mActionRedo->plug( tb ); 1813 mActionRedo->plug( tb );
1746 } 1814 }
1747 } 1815 }
1748 //mActionQuit->plug ( tb ); 1816 //mActionQuit->plug ( tb );
1749 // tb->insertWidget(-1, 0, mIncSearchWidget, 6); 1817 // tb->insertWidget(-1, 0, mIncSearchWidget, 6);
1750 1818
1751 //US link the searchwidget first to this. 1819 //US link the searchwidget first to this.
1752 // The real linkage to the toolbar happens later. 1820 // The real linkage to the toolbar happens later.
1753//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); 1821//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE);
1754//US tb->insertItem( mIncSearchWidget ); 1822//US tb->insertItem( mIncSearchWidget );
1755/*US 1823/*US
1756 mIncSearchWidget = new IncSearchWidget( tb ); 1824 mIncSearchWidget = new IncSearchWidget( tb );
1757 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1825 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1758 SLOT( incrementalSearch( const QString& ) ) ); 1826 SLOT( incrementalSearch( const QString& ) ) );
1759 1827
1760 mJumpButtonBar = new JumpButtonBar( this, this ); 1828 mJumpButtonBar = new JumpButtonBar( this, this );
1761 1829
1762//US topLayout->addWidget( mJumpButtonBar ); 1830//US topLayout->addWidget( mJumpButtonBar );
1763 this->layout()->add( mJumpButtonBar ); 1831 this->layout()->add( mJumpButtonBar );
1764*/ 1832*/
1765 1833
1766#endif //KAB_EMBEDDED 1834#endif //KAB_EMBEDDED
1767} 1835}
1768void KABCore::showLicence() 1836void KABCore::showLicence()
1769{ 1837{
1770 KApplication::showLicence(); 1838 KApplication::showLicence();
1771} 1839}
1772void KABCore::removeVoice() 1840void KABCore::removeVoice()
1773{ 1841{
1774 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 ) 1842 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 )
1775 return; 1843 return;
1776 KABC::Addressee::List list = mViewManager->selectedAddressees(); 1844 KABC::Addressee::List list = mViewManager->selectedAddressees();
1777 KABC::Addressee::List::Iterator it; 1845 KABC::Addressee::List::Iterator it;
1778 for ( it = list.begin(); it != list.end(); ++it ) { 1846 for ( it = list.begin(); it != list.end(); ++it ) {
1779 PhoneNumber::List phoneNumbers = (*it).phoneNumbers(); 1847 PhoneNumber::List phoneNumbers = (*it).phoneNumbers();
1780 PhoneNumber::List::Iterator phoneIt; 1848 PhoneNumber::List::Iterator phoneIt;
1781 bool found = false; 1849 bool found = false;
1782 for ( phoneIt = phoneNumbers.begin(); phoneIt != phoneNumbers.end(); ++phoneIt ) { 1850 for ( phoneIt = phoneNumbers.begin(); phoneIt != phoneNumbers.end(); ++phoneIt ) {
1783 if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found 1851 if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found
1784 if ((*phoneIt).type() - PhoneNumber::Voice ) { 1852 if ((*phoneIt).type() - PhoneNumber::Voice ) {
1785 (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice ); 1853 (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice );
1786 (*it).insertPhoneNumber( (*phoneIt) ); 1854 (*it).insertPhoneNumber( (*phoneIt) );
1787 found = true; 1855 found = true;
1788 } 1856 }
1789 } 1857 }
1790 1858
1791 } 1859 }
1792 if ( found ) 1860 if ( found )
1793 contactModified((*it) ); 1861 contactModified((*it) );
1794 } 1862 }
1795} 1863}
1796 1864
1797 1865
1798 1866
1799void KABCore::clipboardDataChanged() 1867void KABCore::clipboardDataChanged()
1800{ 1868{
1801 1869
1802 if ( mReadWrite ) 1870 if ( mReadWrite )
1803 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); 1871 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() );
1804 1872
1805} 1873}
1806 1874
1807void KABCore::updateActionMenu() 1875void KABCore::updateActionMenu()
1808{ 1876{
1809 UndoStack *undo = UndoStack::instance(); 1877 UndoStack *undo = UndoStack::instance();
1810 RedoStack *redo = RedoStack::instance(); 1878 RedoStack *redo = RedoStack::instance();
1811 1879
1812 if ( undo->isEmpty() ) 1880 if ( undo->isEmpty() )
1813 mActionUndo->setText( i18n( "Undo" ) ); 1881 mActionUndo->setText( i18n( "Undo" ) );
1814 else 1882 else
1815 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); 1883 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) );
1816 1884
1817 mActionUndo->setEnabled( !undo->isEmpty() ); 1885 mActionUndo->setEnabled( !undo->isEmpty() );
1818 1886
1819 if ( !redo->top() ) 1887 if ( !redo->top() )
1820 mActionRedo->setText( i18n( "Redo" ) ); 1888 mActionRedo->setText( i18n( "Redo" ) );
1821 else 1889 else
1822 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); 1890 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) );
1823 1891
1824 mActionRedo->setEnabled( !redo->isEmpty() ); 1892 mActionRedo->setEnabled( !redo->isEmpty() );
1825} 1893}
1826 1894
1827void KABCore::configureKeyBindings() 1895void KABCore::configureKeyBindings()
1828{ 1896{
1829#ifndef KAB_EMBEDDED 1897#ifndef KAB_EMBEDDED
1830 KKeyDialog::configure( actionCollection(), true ); 1898 KKeyDialog::configure( actionCollection(), true );
1831#else //KAB_EMBEDDED 1899#else //KAB_EMBEDDED
1832 qDebug("KABCore::configureKeyBindings() not implemented"); 1900 qDebug("KABCore::configureKeyBindings() not implemented");
1833#endif //KAB_EMBEDDED 1901#endif //KAB_EMBEDDED
1834} 1902}
1835 1903
1836#ifdef KAB_EMBEDDED 1904#ifdef KAB_EMBEDDED
1837void KABCore::configureResources() 1905void KABCore::configureResources()
1838{ 1906{
1839 KRES::KCMKResources dlg( this, "" , 0 ); 1907 KRES::KCMKResources dlg( this, "" , 0 );
1840 1908
1841 if ( !dlg.exec() ) 1909 if ( !dlg.exec() )
1842 return; 1910 return;
1843 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); 1911 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") );
1844} 1912}
1845#endif //KAB_EMBEDDED 1913#endif //KAB_EMBEDDED
1846 1914
1847 1915
1848 1916
1849#ifndef KAB_EMBEDDED 1917#ifndef KAB_EMBEDDED
1850#include "kabcore.moc" 1918#include "kabcore.moc"
1851#endif //KAB_EMBEDDED 1919#endif //KAB_EMBEDDED
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index 6bbdfd4..a45c4c6 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -113,328 +113,334 @@ class KABCore : public QWidget
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 /** 146 /**
147 Is called whenever a contact is selected in the view. 147 Is called whenever a contact is selected in the view.
148 */ 148 */
149 void setContactSelected( const QString &uid ); 149 void setContactSelected( const QString &uid );
150 150
151 /** 151 /**
152 Opens the preferred mail composer with all selected contacts as 152 Opens the preferred mail composer with all selected contacts as
153 arguments. 153 arguments.
154 */ 154 */
155 void sendMail(); 155 void sendMail();
156 156
157 /** 157 /**
158 Opens the preferred mail composer with the given contacts as 158 Opens the preferred mail composer with the given contacts as
159 arguments. 159 arguments.
160 */ 160 */
161 void sendMail( const QString& email ); 161 void sendMail( const QString& email );
162 162
163 163
164 void mailVCard(); 164 void mailVCard();
165 void mailVCard(const QStringList& uids); 165 void mailVCard(const QStringList& uids);
166 166
167 /** 167 /**
168 Beams the "WhoAmI contact. 168 Beams the "WhoAmI contact.
169 */ 169 */
170 void beamMySelf(); 170 void beamMySelf();
171 171
172 void beamVCard(); 172 void beamVCard();
173 void beamVCard(const QStringList& uids); 173 void beamVCard(const QStringList& uids);
174 void beamDone( Ir *ir ); 174 void beamDone( Ir *ir );
175 175
176 176
177 /** 177 /**
178 Starts the preferred web browser with the given URL as argument. 178 Starts the preferred web browser with the given URL as argument.
179 */ 179 */
180 void browse( const QString& url ); 180 void browse( const QString& url );
181 181
182 /** 182 /**
183 Select all contacts in the view. 183 Select all contacts in the view.
184 */ 184 */
185 void selectAllContacts(); 185 void selectAllContacts();
186 186
187 /** 187 /**
188 Deletes all selected contacts from the address book. 188 Deletes all selected contacts from the address book.
189 */ 189 */
190 void deleteContacts(); 190 void deleteContacts();
191 191
192 /** 192 /**
193 Deletes given contacts from the address book. 193 Deletes given contacts from the address book.
194 194
195 @param uids The uids of the contacts, which shall be deleted. 195 @param uids The uids of the contacts, which shall be deleted.
196 */ 196 */
197 void deleteContacts( const QStringList &uids ); 197 void deleteContacts( const QStringList &uids );
198 198
199 /** 199 /**
200 Copys the selected contacts into clipboard for later pasting. 200 Copys the selected contacts into clipboard for later pasting.
201 */ 201 */
202 void copyContacts(); 202 void copyContacts();
203 203
204 /** 204 /**
205 Cuts the selected contacts and stores them for later pasting. 205 Cuts the selected contacts and stores them for later pasting.
206 */ 206 */
207 void cutContacts(); 207 void cutContacts();
208 208
209 /** 209 /**
210 Paste contacts from clipboard into the address book. 210 Paste contacts from clipboard into the address book.
211 */ 211 */
212 void pasteContacts(); 212 void pasteContacts();
213 213
214 /** 214 /**
215 Paste given contacts into the address book. 215 Paste given contacts into the address book.
216 216
217 @param list The list of addressee, which shall be pasted. 217 @param list The list of addressee, which shall be pasted.
218 */ 218 */
219 void pasteContacts( KABC::Addressee::List &list ); 219 void pasteContacts( KABC::Addressee::List &list );
220 220
221 /** 221 /**
222 Sets the whoAmI contact, that is used by many other programs to 222 Sets the whoAmI contact, that is used by many other programs to
223 get personal information about the current user. 223 get personal information about the current user.
224 */ 224 */
225 void setWhoAmI(); 225 void setWhoAmI();
226 226
227 /** 227 /**
228 Displays the category dialog and applies the result to all 228 Displays the category dialog and applies the result to all
229 selected contacts. 229 selected contacts.
230 */ 230 */
231 void setCategories(); 231 void setCategories();
232 232
233 /** 233 /**
234 Sets the field list of the Incremental Search Widget. 234 Sets the field list of the Incremental Search Widget.
235 */ 235 */
236 void setSearchFields( const KABC::Field::List &fields ); 236 void setSearchFields( const KABC::Field::List &fields );
237 237
238 /** 238 /**
239 Search with the current search field for a contact, that matches 239 Search with the current search field for a contact, that matches
240 the given text, and selects it in the view. 240 the given text, and selects it in the view.
241 */ 241 */
242 void incrementalSearch( const QString& text ); 242 void incrementalSearch( const QString& text );
243 243
244 /** 244 /**
245 Marks the address book as modified. 245 Marks the address book as modified.
246 */ 246 */
247 void setModified(); 247 void setModified();
248 /** 248 /**
249 Marks the address book as modified without refreshing the view. 249 Marks the address book as modified without refreshing the view.
250 */ 250 */
251 void setModifiedWOrefresh(); 251 void setModifiedWOrefresh();
252 252
253 /** 253 /**
254 Marks the address book as modified concerning the argument. 254 Marks the address book as modified concerning the argument.
255 */ 255 */
256 void setModified( bool modified ); 256 void setModified( bool modified );
257 257
258 /** 258 /**
259 Returns whether the address book is modified. 259 Returns whether the address book is modified.
260 */ 260 */
261 bool modified() const; 261 bool modified() const;
262 262
263 /** 263 /**
264 Called whenever an contact is modified in the contact editor 264 Called whenever an contact is modified in the contact editor
265 dialog or the quick edit. 265 dialog or the quick edit.
266 */ 266 */
267 void contactModified( const KABC::Addressee &addr ); 267 void contactModified( const KABC::Addressee &addr );
268 268
269 /** 269 /**
270 DCOP METHODS. 270 DCOP METHODS.
271 */ 271 */
272 void addEmail( QString addr ); 272 void addEmail( QString addr );
273 void importVCard( const KURL& url, bool showPreview ); 273 void importVCard( const KURL& url, bool showPreview );
274 void importVCard( const QString& vCard, bool showPreview ); 274 void importVCard( const QString& vCard, bool showPreview );
275 void newContact(); 275 void newContact();
276 QString getNameByPhone( const QString& phone ); 276 QString getNameByPhone( const QString& phone );
277 /** 277 /**
278 END DCOP METHODS 278 END DCOP METHODS
279 */ 279 */
280 280
281 /** 281 /**
282 Saves the contents of the AddressBook back to disk. 282 Saves the contents of the AddressBook back to disk.
283 */ 283 */
284 void save(); 284 void save();
285 285
286 /** 286 /**
287 Undos the last command using the undo stack. 287 Undos the last command using the undo stack.
288 */ 288 */
289 void undo(); 289 void undo();
290 290
291 /** 291 /**
292 Redos the last command that was undone, using the redo stack. 292 Redos the last command that was undone, using the redo stack.
293 */ 293 */
294 void redo(); 294 void redo();
295 295
296 /** 296 /**
297 Shows the edit dialog for the given uid. If the uid is QString::null, 297 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. 298 the method will try to find a selected addressee in the view.
299 */ 299 */
300 void editContact( const QString &uid /*US = QString::null*/ ); 300 void editContact( const QString &uid /*US = QString::null*/ );
301//US added a second method without defaultparameter 301//US added a second method without defaultparameter
302 void editContact2(); 302 void editContact2();
303 303
304 /** 304 /**
305 Shows 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.
307 */
308 void showContact( const QString &uid /*US = QString::null*/ );
309
310 /**
305 Launches the configuration dialog. 311 Launches the configuration dialog.
306 */ 312 */
307 void openConfigDialog(); 313 void openConfigDialog();
308 314
309 /** 315 /**
310 Launches the ldap search dialog. 316 Launches the ldap search dialog.
311 */ 317 */
312 void openLDAPDialog(); 318 void openLDAPDialog();
313 319
314 /** 320 /**
315 Creates a KAddressBookPrinter, which will display the print 321 Creates a KAddressBookPrinter, which will display the print
316 dialog and do the printing. 322 dialog and do the printing.
317 */ 323 */
318 void print(); 324 void print();
319 325
320 /** 326 /**
321 Registers a new GUI client, so plugins can register its actions. 327 Registers a new GUI client, so plugins can register its actions.
322 */ 328 */
323 void addGUIClient( KXMLGUIClient *client ); 329 void addGUIClient( KXMLGUIClient *client );
324 330
325 signals: 331 signals:
326 void contactSelected( const QString &name ); 332 void contactSelected( const QString &name );
327 void contactSelected( const QPixmap &pixmap ); 333 void contactSelected( const QPixmap &pixmap );
328 public slots: 334 public slots:
329 void setDetailsVisible( bool visible ); 335 void setDetailsVisible( bool visible );
330 void setDetailsToState(); 336 void setDetailsToState();
331 private slots: 337 private slots:
332 void setJumpButtonBarVisible( bool visible ); 338 void setJumpButtonBarVisible( bool visible );
333 void importFromOL(); 339 void importFromOL();
334 void extensionModified( const KABC::Addressee::List &list ); 340 void extensionModified( const KABC::Addressee::List &list );
335 void clipboardDataChanged(); 341 void clipboardDataChanged();
336 void updateActionMenu(); 342 void updateActionMenu();
337 void configureKeyBindings(); 343 void configureKeyBindings();
338 void removeVoice(); 344 void removeVoice();
339#ifdef KAB_EMBEDDED 345#ifdef KAB_EMBEDDED
340 void configureResources(); 346 void configureResources();
341#endif //KAB_EMBEDDED 347#endif //KAB_EMBEDDED
342 348
343 void slotEditorDestroyed( const QString &uid ); 349 void slotEditorDestroyed( const QString &uid );
344 void configurationChanged(); 350 void configurationChanged();
345 void addressBookChanged(); 351 void addressBookChanged();
346 352
347 private: 353 private:
348 void initGUI(); 354 void initGUI();
349 void initActions(); 355 void initActions();
350 356
351 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, 357 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent,
352 const char *name = 0 ); 358 const char *name = 0 );
353 359
354 KXMLGUIClient *mGUIClient; 360 KXMLGUIClient *mGUIClient;
355 361
356 KABC::AddressBook *mAddressBook; 362 KABC::AddressBook *mAddressBook;
357 363
358 ViewManager *mViewManager; 364 ViewManager *mViewManager;
359 // QSplitter *mDetailsSplitter; 365 // QSplitter *mDetailsSplitter;
360 KDGanttMinimizeSplitter *mExtensionBarSplitter; 366 KDGanttMinimizeSplitter *mExtensionBarSplitter;
361 ViewContainer *mDetails; 367 ViewContainer *mDetails;
362 KDGanttMinimizeSplitter* mMiniSplitter; 368 KDGanttMinimizeSplitter* mMiniSplitter;
363 XXPortManager *mXXPortManager; 369 XXPortManager *mXXPortManager;
364 JumpButtonBar *mJumpButtonBar; 370 JumpButtonBar *mJumpButtonBar;
365 IncSearchWidget *mIncSearchWidget; 371 IncSearchWidget *mIncSearchWidget;
366 ExtensionManager *mExtensionManager; 372 ExtensionManager *mExtensionManager;
367 373
368 KCMultiDialog *mConfigureDialog; 374 KCMultiDialog *mConfigureDialog;
369 375
370#ifndef KAB_EMBEDDED 376#ifndef KAB_EMBEDDED
371 LDAPSearchDialog *mLdapSearchDialog; 377 LDAPSearchDialog *mLdapSearchDialog;
372#endif //KAB_EMBEDDED 378#endif //KAB_EMBEDDED
373 // QDict<AddresseeEditorDialog> mEditorDict; 379 // QDict<AddresseeEditorDialog> mEditorDict;
374 AddresseeEditorDialog *mEditorDialog; 380 AddresseeEditorDialog *mEditorDialog;
375 bool mReadWrite; 381 bool mReadWrite;
376 bool mModified; 382 bool mModified;
377 bool mIsPart; 383 bool mIsPart;
378 384
379 //US file menu 385 //US file menu
380 KAction *mActionMail; 386 KAction *mActionMail;
381 KAction *mActionBeam; 387 KAction *mActionBeam;
382 KAction* mActionPrint; 388 KAction* mActionPrint;
383 KAction* mActionNewContact; 389 KAction* mActionNewContact;
384 KAction *mActionSave; 390 KAction *mActionSave;
385 KAction *mActionEditAddressee; 391 KAction *mActionEditAddressee;
386 KAction *mActionMailVCard; 392 KAction *mActionMailVCard;
387 KAction *mActionBeamVCard; 393 KAction *mActionBeamVCard;
388 394
389 KAction *mActionQuit; 395 KAction *mActionQuit;
390 396
391 //US edit menu 397 //US edit menu
392 KAction *mActionCopy; 398 KAction *mActionCopy;
393 KAction *mActionCut; 399 KAction *mActionCut;
394 KAction *mActionPaste; 400 KAction *mActionPaste;
395 KAction *mActionSelectAll; 401 KAction *mActionSelectAll;
396 KAction *mActionUndo; 402 KAction *mActionUndo;
397 KAction *mActionRedo; 403 KAction *mActionRedo;
398 KAction *mActionDelete; 404 KAction *mActionDelete;
399 405
400 //US settings menu 406 //US settings menu
401 KAction *mActionConfigResources; 407 KAction *mActionConfigResources;
402 KAction *mActionConfigKAddressbook; 408 KAction *mActionConfigKAddressbook;
403 KAction *mActionConfigShortcuts; 409 KAction *mActionConfigShortcuts;
404 KAction *mActionConfigureToolbars; 410 KAction *mActionConfigureToolbars;
405 KAction *mActionKeyBindings; 411 KAction *mActionKeyBindings;
406 KToggleAction *mActionJumpBar; 412 KToggleAction *mActionJumpBar;
407 KToggleAction *mActionDetails; 413 KToggleAction *mActionDetails;
408 KAction *mActionWhoAmI; 414 KAction *mActionWhoAmI;
409 KAction *mActionCategories; 415 KAction *mActionCategories;
410 KAction *mActionAboutKAddressbook; 416 KAction *mActionAboutKAddressbook;
411 KAction *mActionLicence; 417 KAction *mActionLicence;
412 418
413 KAction *mActionDeleteView; 419 KAction *mActionDeleteView;
414 420
415 QPopupMenu *viewMenu; 421 QPopupMenu *viewMenu;
416 QPopupMenu *filterMenu; 422 QPopupMenu *filterMenu;
417 QPopupMenu *settingsMenu; 423 QPopupMenu *settingsMenu;
418 QPopupMenu *changeMenu; 424 QPopupMenu *changeMenu;
419 425
420//US QAction *mActionSave; 426//US QAction *mActionSave;
421 QPopupMenu *ImportMenu; 427 QPopupMenu *ImportMenu;
422 QPopupMenu *ExportMenu; 428 QPopupMenu *ExportMenu;
423 //LR additional methods 429 //LR additional methods
424 KAction *mActionRemoveVoice; 430 KAction *mActionRemoveVoice;
425 KAction * mActionImportOL; 431 KAction * mActionImportOL;
426 432
427#ifndef KAB_EMBEDDED 433#ifndef KAB_EMBEDDED
428 KAddressBookService *mAddressBookService; 434 KAddressBookService *mAddressBookService;
429#endif //KAB_EMBEDDED 435#endif //KAB_EMBEDDED
430 436
431 class KABCorePrivate; 437 class KABCorePrivate;
432 KABCorePrivate *d; 438 KABCorePrivate *d;
433 439
434#ifdef KAB_EMBEDDED 440#ifdef KAB_EMBEDDED
435 KAddressBookMain *mMainWindow; // should be the same like mGUIClient 441 KAddressBookMain *mMainWindow; // should be the same like mGUIClient
436#endif //KAB_EMBEDDED 442#endif //KAB_EMBEDDED
437 443
438}; 444};
439 445
440#endif 446#endif