summaryrefslogtreecommitdiffabout
path: root/kaddressbook/kabcore.cpp
Unidiff
Diffstat (limited to 'kaddressbook/kabcore.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 5ef61b1..e34951a 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -18,769 +18,769 @@
18 18
19 Async a special exception, permission is given to link this program 19 Async a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24/*s 24/*s
25Enhanced Version of the file for platform independent KDE tools. 25Enhanced Version of the file for platform independent KDE tools.
26Copyright (c) 2004 Ulf Schenk 26Copyright (c) 2004 Ulf Schenk
27 27
28$Id$ 28$Id$
29*/ 29*/
30 30
31#include "kabcore.h" 31#include "kabcore.h"
32 32
33#include <stdaddressbook.h> 33#include <stdaddressbook.h>
34#include <klocale.h> 34#include <klocale.h>
35#include <kfiledialog.h> 35#include <kfiledialog.h>
36#include <qtimer.h> 36#include <qtimer.h>
37#include <qlabel.h> 37#include <qlabel.h>
38#include <qregexp.h> 38#include <qregexp.h>
39#include <qlineedit.h> 39#include <qlineedit.h>
40#include <qcheckbox.h> 40#include <qcheckbox.h>
41#include <qpushbutton.h> 41#include <qpushbutton.h>
42#include <qprogressbar.h> 42#include <qprogressbar.h>
43#include <libkdepim/phoneaccess.h> 43#include <libkdepim/phoneaccess.h>
44 44
45#ifndef KAB_EMBEDDED 45#ifndef KAB_EMBEDDED
46#include <qclipboard.h> 46#include <qclipboard.h>
47#include <qdir.h> 47#include <qdir.h>
48#include <qfile.h> 48#include <qfile.h>
49#include <qapplicaton.h> 49#include <qapplicaton.h>
50#include <qprogressbar.h> 50#include <qprogressbar.h>
51#include <qlayout.h> 51#include <qlayout.h>
52#include <qregexp.h> 52#include <qregexp.h>
53#include <qvbox.h> 53#include <qvbox.h>
54#include <kabc/addresseelist.h> 54#include <kabc/addresseelist.h>
55#include <kabc/errorhandler.h> 55#include <kabc/errorhandler.h>
56#include <kabc/resource.h> 56#include <kabc/resource.h>
57#include <kabc/vcardconverter.h> 57#include <kabc/vcardconverter.h>
58#include <kapplication.h> 58#include <kapplication.h>
59#include <kactionclasses.h> 59#include <kactionclasses.h>
60#include <kcmultidialog.h> 60#include <kcmultidialog.h>
61#include <kdebug.h> 61#include <kdebug.h>
62#include <kdeversion.h> 62#include <kdeversion.h>
63#include <kkeydialog.h> 63#include <kkeydialog.h>
64#include <kmessagebox.h> 64#include <kmessagebox.h>
65#include <kprinter.h> 65#include <kprinter.h>
66#include <kprotocolinfo.h> 66#include <kprotocolinfo.h>
67#include <kresources/selectdialog.h> 67#include <kresources/selectdialog.h>
68#include <kstandarddirs.h> 68#include <kstandarddirs.h>
69#include <ktempfile.h> 69#include <ktempfile.h>
70#include <kxmlguiclient.h> 70#include <kxmlguiclient.h>
71#include <kaboutdata.h> 71#include <kaboutdata.h>
72#include <libkdepim/categoryselectdialog.h> 72#include <libkdepim/categoryselectdialog.h>
73 73
74#include "addresseeutil.h" 74#include "addresseeutil.h"
75#include "addresseeeditordialog.h" 75#include "addresseeeditordialog.h"
76#include "extensionmanager.h" 76#include "extensionmanager.h"
77#include "kstdaction.h" 77#include "kstdaction.h"
78#include "kaddressbookservice.h" 78#include "kaddressbookservice.h"
79#include "ldapsearchdialog.h" 79#include "ldapsearchdialog.h"
80#include "printing/printingwizard.h" 80#include "printing/printingwizard.h"
81#else // KAB_EMBEDDED 81#else // KAB_EMBEDDED
82 82
83#include <kapplication.h> 83#include <kapplication.h>
84#include "KDGanttMinimizeSplitter.h" 84#include "KDGanttMinimizeSplitter.h"
85#include "kaddressbookmain.h" 85#include "kaddressbookmain.h"
86#include "kactioncollection.h" 86#include "kactioncollection.h"
87#include "addresseedialog.h" 87#include "addresseedialog.h"
88//US 88//US
89#include <addresseeview.h> 89#include <addresseeview.h>
90 90
91#include <qapp.h> 91#include <qapp.h>
92#include <qmenubar.h> 92#include <qmenubar.h>
93//#include <qtoolbar.h> 93//#include <qtoolbar.h>
94#include <qmessagebox.h> 94#include <qmessagebox.h>
95#include <kdebug.h> 95#include <kdebug.h>
96#include <kiconloader.h> // needed for SmallIcon 96#include <kiconloader.h> // needed for SmallIcon
97#include <kresources/kcmkresources.h> 97#include <kresources/kcmkresources.h>
98#include <ktoolbar.h> 98#include <ktoolbar.h>
99 99
100 100
101//#include <qlabel.h> 101//#include <qlabel.h>
102 102
103 103
104#ifndef DESKTOP_VERSION 104#ifndef DESKTOP_VERSION
105#include <qpe/ir.h> 105#include <qpe/ir.h>
106#include <qpe/qpemenubar.h> 106#include <qpe/qpemenubar.h>
107#include <qtopia/qcopenvelope_qws.h> 107#include <qtopia/qcopenvelope_qws.h>
108#else 108#else
109 109
110#include <qmenubar.h> 110#include <qmenubar.h>
111#endif 111#endif
112 112
113#endif // KAB_EMBEDDED 113#endif // KAB_EMBEDDED
114#include "kcmconfigs/kcmkabconfig.h" 114#include "kcmconfigs/kcmkabconfig.h"
115#include "kcmconfigs/kcmkdepimconfig.h" 115#include "kcmconfigs/kcmkdepimconfig.h"
116#include "kpimglobalprefs.h" 116#include "kpimglobalprefs.h"
117#include "externalapphandler.h" 117#include "externalapphandler.h"
118#include "xxportselectdialog.h" 118#include "xxportselectdialog.h"
119 119
120 120
121#include <kresources/selectdialog.h> 121#include <kresources/selectdialog.h>
122#include <kmessagebox.h> 122#include <kmessagebox.h>
123 123
124#include <picture.h> 124#include <picture.h>
125#include <resource.h> 125#include <resource.h>
126 126
127//US#include <qsplitter.h> 127//US#include <qsplitter.h>
128#include <qmap.h> 128#include <qmap.h>
129#include <qdir.h> 129#include <qdir.h>
130#include <qfile.h> 130#include <qfile.h>
131#include <qvbox.h> 131#include <qvbox.h>
132#include <qlayout.h> 132#include <qlayout.h>
133#include <qclipboard.h> 133#include <qclipboard.h>
134#include <qtextstream.h> 134#include <qtextstream.h>
135#include <qradiobutton.h> 135#include <qradiobutton.h>
136#include <qbuttongroup.h> 136#include <qbuttongroup.h>
137 137
138#include <libkdepim/categoryselectdialog.h> 138#include <libkdepim/categoryselectdialog.h>
139#include <libkdepim/categoryeditdialog.h> 139#include <libkdepim/categoryeditdialog.h>
140#include <kabc/vcardconverter.h> 140#include <kabc/vcardconverter.h>
141 141
142 142
143#include "addresseeutil.h" 143#include "addresseeutil.h"
144#include "undocmds.h" 144#include "undocmds.h"
145#include "addresseeeditordialog.h" 145#include "addresseeeditordialog.h"
146#include "viewmanager.h" 146#include "viewmanager.h"
147#include "details/detailsviewcontainer.h" 147#include "details/detailsviewcontainer.h"
148#include "kabprefs.h" 148#include "kabprefs.h"
149#include "xxportmanager.h" 149#include "xxportmanager.h"
150#include "incsearchwidget.h" 150#include "incsearchwidget.h"
151#include "jumpbuttonbar.h" 151#include "jumpbuttonbar.h"
152#include "extensionmanager.h" 152#include "extensionmanager.h"
153#include "addresseeconfig.h" 153#include "addresseeconfig.h"
154#include "nameeditdialog.h" 154#include "nameeditdialog.h"
155#include <kcmultidialog.h> 155#include <kcmultidialog.h>
156 156
157#ifdef _WIN32_ 157#ifdef _WIN32_
158#ifdef _OL_IMPORT_ 158#ifdef _OL_IMPORT_
159#include "kaimportoldialog.h" 159#include "kaimportoldialog.h"
160#endif 160#endif
161#else 161#else
162#include <unistd.h> 162#include <unistd.h>
163#endif 163#endif
164// sync includes 164// sync includes
165#include <libkdepim/ksyncprofile.h> 165#include <libkdepim/ksyncprofile.h>
166#include <libkdepim/ksyncprefsdialog.h> 166#include <libkdepim/ksyncprefsdialog.h>
167 167
168 168
169class KABCatPrefs : public QDialog 169class KABCatPrefs : public QDialog
170{ 170{
171 public: 171 public:
172 KABCatPrefs( QWidget *parent=0, const char *name=0 ) : 172 KABCatPrefs( QWidget *parent=0, const char *name=0 ) :
173 QDialog( parent, name, true ) 173 QDialog( parent, name, true )
174 { 174 {
175 setCaption( i18n("Manage new Categories") ); 175 setCaption( i18n("Manage new Categories") );
176 QVBoxLayout* lay = new QVBoxLayout( this ); 176 QVBoxLayout* lay = new QVBoxLayout( this );
177 lay->setSpacing( 3 ); 177 lay->setSpacing( 3 );
178 lay->setMargin( 3 ); 178 lay->setMargin( 3 );
179 QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\naddressees\nwhich are not in the category list.\nPlease choose what to do:\n "), this ); 179 QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\naddressees\nwhich are not in the category list.\nPlease choose what to do:\n "), this );
180 lay->addWidget( lab ); 180 lay->addWidget( lab );
181 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); 181 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this );
182 lay->addWidget( format ); 182 lay->addWidget( format );
183 format->setExclusive ( true ) ; 183 format->setExclusive ( true ) ;
184 addCatBut = new QRadioButton(i18n("Add to category list"), format ); 184 addCatBut = new QRadioButton(i18n("Add to category list"), format );
185 new QRadioButton(i18n("Remove from addressees"), format ); 185 new QRadioButton(i18n("Remove from addressees"), format );
186 addCatBut->setChecked( true ); 186 addCatBut->setChecked( true );
187 QPushButton * ok = new QPushButton( i18n("OK"), this ); 187 QPushButton * ok = new QPushButton( i18n("OK"), this );
188 lay->addWidget( ok ); 188 lay->addWidget( ok );
189 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 189 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
190 lay->addWidget( cancel ); 190 lay->addWidget( cancel );
191 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 191 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
192 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 192 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
193 resize( 200, 200 ); 193 resize( 200, 200 );
194 } 194 }
195 195
196 bool addCat() { return addCatBut->isChecked(); } 196 bool addCat() { return addCatBut->isChecked(); }
197private: 197private:
198 QRadioButton* addCatBut; 198 QRadioButton* addCatBut;
199}; 199};
200 200
201class KABFormatPrefs : public QDialog 201class KABFormatPrefs : public QDialog
202{ 202{
203 public: 203 public:
204 KABFormatPrefs( QWidget *parent=0, const char *name=0 ) : 204 KABFormatPrefs( QWidget *parent=0, const char *name=0 ) :
205 QDialog( parent, name, true ) 205 QDialog( parent, name, true )
206 { 206 {
207 setCaption( i18n("Set formatted name") ); 207 setCaption( i18n("Set formatted name") );
208 QVBoxLayout* lay = new QVBoxLayout( this ); 208 QVBoxLayout* lay = new QVBoxLayout( this );
209 lay->setSpacing( 3 ); 209 lay->setSpacing( 3 );
210 lay->setMargin( 3 ); 210 lay->setMargin( 3 );
211 QLabel * lab = new QLabel( i18n("You can set the formatted name\nfor a list of contacts in one go."), this ); 211 QLabel * lab = new QLabel( i18n("You can set the formatted name\nfor a list of contacts in one go."), this );
212 lay->addWidget( lab ); 212 lay->addWidget( lab );
213 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("Set formatted name to:"), this ); 213 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("Set formatted name to:"), this );
214 lay->addWidget( format ); 214 lay->addWidget( format );
215 format->setExclusive ( true ) ; 215 format->setExclusive ( true ) ;
216 simple = new QRadioButton(i18n("Simple: James Bond"), format ); 216 simple = new QRadioButton(i18n("Simple: James Bond"), format );
217 full = new QRadioButton(i18n("Full: Mr. James 007 Bond I"), format ); 217 full = new QRadioButton(i18n("Full: Mr. James 007 Bond I"), format );
218 reverse = new QRadioButton(i18n("Reverse: Bond, James"), format ); 218 reverse = new QRadioButton(i18n("Reverse: Bond, James"), format );
219 company = new QRadioButton(i18n("Organization: MI6"), format ); 219 company = new QRadioButton(i18n("Organization: MI6"), format );
220 simple->setChecked( true ); 220 simple->setChecked( true );
221 setCompany = new QCheckBox(i18n("Set formatted name to\norganization, if name empty"), this); 221 setCompany = new QCheckBox(i18n("Set formatted name to\norganization, if name empty"), this);
222 lay->addWidget( setCompany ); 222 lay->addWidget( setCompany );
223 QPushButton * ok = new QPushButton( i18n("Select contact list"), this ); 223 QPushButton * ok = new QPushButton( i18n("Select contact list"), this );
224 lay->addWidget( ok ); 224 lay->addWidget( ok );
225 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 225 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
226 lay->addWidget( cancel ); 226 lay->addWidget( cancel );
227 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 227 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
228 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 228 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
229 //resize( 200, 200 ); 229 //resize( 200, 200 );
230 230
231 } 231 }
232public: 232public:
233 QRadioButton* simple, *full, *reverse, *company; 233 QRadioButton* simple, *full, *reverse, *company;
234 QCheckBox* setCompany; 234 QCheckBox* setCompany;
235}; 235};
236 236
237 237
238 238
239class KAex2phonePrefs : public QDialog 239class KAex2phonePrefs : public QDialog
240{ 240{
241 public: 241 public:
242 KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) : 242 KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) :
243 QDialog( parent, name, true ) 243 QDialog( parent, name, true )
244 { 244 {
245 setCaption( i18n("Export to phone options") ); 245 setCaption( i18n("Export to phone options") );
246 QVBoxLayout* lay = new QVBoxLayout( this ); 246 QVBoxLayout* lay = new QVBoxLayout( this );
247 lay->setSpacing( 3 ); 247 lay->setSpacing( 3 );
248 lay->setMargin( 3 ); 248 lay->setMargin( 3 );
249 QLabel *lab; 249 QLabel *lab;
250 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); 250 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) );
251 lab->setAlignment (AlignHCenter ); 251 lab->setAlignment (AlignHCenter );
252 QHBox* temphb; 252 QHBox* temphb;
253 temphb = new QHBox( this ); 253 temphb = new QHBox( this );
254 new QLabel( i18n("I/O device: "), temphb ); 254 new QLabel( i18n("I/O device: "), temphb );
255 mPhoneDevice = new QLineEdit( temphb); 255 mPhoneDevice = new QLineEdit( temphb);
256 lay->addWidget( temphb ); 256 lay->addWidget( temphb );
257 temphb = new QHBox( this ); 257 temphb = new QHBox( this );
258 new QLabel( i18n("Connection: "), temphb ); 258 new QLabel( i18n("Connection: "), temphb );
259 mPhoneConnection = new QLineEdit( temphb); 259 mPhoneConnection = new QLineEdit( temphb);
260 lay->addWidget( temphb ); 260 lay->addWidget( temphb );
261 temphb = new QHBox( this ); 261 temphb = new QHBox( this );
262 new QLabel( i18n("Model(opt.): "), temphb ); 262 new QLabel( i18n("Model(opt.): "), temphb );
263 mPhoneModel = new QLineEdit( temphb); 263 mPhoneModel = new QLineEdit( temphb);
264 lay->addWidget( temphb ); 264 lay->addWidget( temphb );
265 // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this ); 265 // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this );
266 // lay->addWidget( mWriteToSim ); 266 // lay->addWidget( mWriteToSim );
267 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) ); 267 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) );
268 lab->setAlignment (AlignHCenter); 268 lab->setAlignment (AlignHCenter);
269 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); 269 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
270 lay->addWidget( ok ); 270 lay->addWidget( ok );
271 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 271 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
272 lay->addWidget( cancel ); 272 lay->addWidget( cancel );
273 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 273 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
274 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 274 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
275 resize( 220, 240 ); 275 resize( 220, 240 );
276 276
277 } 277 }
278 278
279public: 279public:
280 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; 280 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
281 QCheckBox* mWriteToSim; 281 QCheckBox* mWriteToSim;
282}; 282};
283 283
284 284
285bool pasteWithNewUid = true; 285bool pasteWithNewUid = true;
286 286
287#ifdef KAB_EMBEDDED 287#ifdef KAB_EMBEDDED
288KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) 288KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name )
289 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), 289 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ),
290 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ 290 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/
291 mReadWrite( readWrite ), mModified( false ), mMainWindow(client) 291 mReadWrite( readWrite ), mModified( false ), mMainWindow(client)
292#else //KAB_EMBEDDED 292#else //KAB_EMBEDDED
293KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) 293KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name )
294 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), 294 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ),
295 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), 295 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ),
296 mReadWrite( readWrite ), mModified( false ) 296 mReadWrite( readWrite ), mModified( false )
297#endif //KAB_EMBEDDED 297#endif //KAB_EMBEDDED
298{ 298{
299 // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); 299 // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu);
300 // syncManager->setBlockSave(false); 300 // syncManager->setBlockSave(false);
301 mIncSearchWidget = 0; 301 mIncSearchWidget = 0;
302 mMiniSplitter = 0; 302 mMiniSplitter = 0;
303 mExtensionBarSplitter = 0; 303 mExtensionBarSplitter = 0;
304 mIsPart = !parent->inherits( "KAddressBookMain" ); 304 mIsPart = !parent->inherits( "KAddressBookMain" );
305 mAddressBook = KABC::StdAddressBook::self(); 305 mAddressBook = KABC::StdAddressBook::self();
306 KABC::StdAddressBook::setAutomaticSave( false ); 306 KABC::StdAddressBook::setAutomaticSave( false );
307 307
308#ifndef KAB_EMBEDDED 308#ifndef KAB_EMBEDDED
309 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); 309 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler );
310#endif //KAB_EMBEDDED 310#endif //KAB_EMBEDDED
311 311
312 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), 312 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ),
313 SLOT( addressBookChanged() ) ); 313 SLOT( addressBookChanged() ) );
314 314
315#if 0 315#if 0
316 // LR moved to addressbook init method 316 // LR moved to addressbook init method
317 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, 317 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization,
318 "X-Department", "KADDRESSBOOK" ); 318 "X-Department", "KADDRESSBOOK" );
319 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, 319 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization,
320 "X-Profession", "KADDRESSBOOK" ); 320 "X-Profession", "KADDRESSBOOK" );
321 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, 321 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization,
322 "X-AssistantsName", "KADDRESSBOOK" ); 322 "X-AssistantsName", "KADDRESSBOOK" );
323 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, 323 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization,
324 "X-ManagersName", "KADDRESSBOOK" ); 324 "X-ManagersName", "KADDRESSBOOK" );
325 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, 325 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal,
326 "X-SpousesName", "KADDRESSBOOK" ); 326 "X-SpousesName", "KADDRESSBOOK" );
327 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, 327 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal,
328 "X-Office", "KADDRESSBOOK" ); 328 "X-Office", "KADDRESSBOOK" );
329 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, 329 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal,
330 "X-IMAddress", "KADDRESSBOOK" ); 330 "X-IMAddress", "KADDRESSBOOK" );
331 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, 331 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal,
332 "X-Anniversary", "KADDRESSBOOK" ); 332 "X-Anniversary", "KADDRESSBOOK" );
333 333
334 //US added this field to become compatible with Opie/qtopia addressbook 334 //US added this field to become compatible with Opie/qtopia addressbook
335 // values can be "female" or "male" or "". An empty field represents undefined. 335 // values can be "female" or "male" or "". An empty field represents undefined.
336 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, 336 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal,
337 "X-Gender", "KADDRESSBOOK" ); 337 "X-Gender", "KADDRESSBOOK" );
338 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, 338 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal,
339 "X-Children", "KADDRESSBOOK" ); 339 "X-Children", "KADDRESSBOOK" );
340 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, 340 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal,
341 "X-FreeBusyUrl", "KADDRESSBOOK" ); 341 "X-FreeBusyUrl", "KADDRESSBOOK" );
342#endif 342#endif
343 initGUI(); 343 initGUI();
344 344
345 mIncSearchWidget->setFocus(); 345 mIncSearchWidget->setFocus();
346 346
347 347
348 connect( mViewManager, SIGNAL( selected( const QString& ) ), 348 connect( mViewManager, SIGNAL( selected( const QString& ) ),
349 SLOT( setContactSelected( const QString& ) ) ); 349 SLOT( setContactSelected( const QString& ) ) );
350 connect( mViewManager, SIGNAL( executed( const QString& ) ), 350 connect( mViewManager, SIGNAL( executed( const QString& ) ),
351 SLOT( executeContact( const QString& ) ) ); 351 SLOT( executeContact( const QString& ) ) );
352 352
353 connect( mViewManager, SIGNAL( deleteRequest( ) ), 353 connect( mViewManager, SIGNAL( deleteRequest( ) ),
354 SLOT( deleteContacts( ) ) ); 354 SLOT( deleteContacts( ) ) );
355 connect( mViewManager, SIGNAL( modified() ), 355 connect( mViewManager, SIGNAL( modified() ),
356 SLOT( setModified() ) ); 356 SLOT( setModified() ) );
357 357
358 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); 358 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) );
359 connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); 359 connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) );
360 360
361 connect( mXXPortManager, SIGNAL( modified() ), 361 connect( mXXPortManager, SIGNAL( modified() ),
362 SLOT( setModified() ) ); 362 SLOT( setModified() ) );
363 363
364 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), 364 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ),
365 SLOT( incrementalSearchJump( const QString& ) ) ); 365 SLOT( incrementalSearchJump( const QString& ) ) );
366 connect( mIncSearchWidget, SIGNAL( fieldChanged() ), 366 connect( mIncSearchWidget, SIGNAL( fieldChanged() ),
367 mJumpButtonBar, SLOT( recreateButtons() ) ); 367 mJumpButtonBar, SLOT( recreateButtons() ) );
368 368
369 connect( mDetails, SIGNAL( sendEmail( const QString& ) ), 369 connect( mDetails, SIGNAL( sendEmail( const QString& ) ),
370 SLOT( sendMail( const QString& ) ) ); 370 SLOT( sendMail( const QString& ) ) );
371 371
372 372
373 connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); 373 connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&)));
374 connect( ExternalAppHandler::instance(), SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)),this, SLOT(requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&))); 374 connect( ExternalAppHandler::instance(), SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)),this, SLOT(requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)));
375 connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&))); 375 connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&)));
376 connect( ExternalAppHandler::instance(), SIGNAL (nextView()),this, SLOT(setDetailsToggle())); 376 connect( ExternalAppHandler::instance(), SIGNAL (nextView()),this, SLOT(setDetailsToggle()));
377 connect( ExternalAppHandler::instance(), SIGNAL (callContactdialog()),this, SLOT(callContactdialog())); 377 connect( ExternalAppHandler::instance(), SIGNAL (callContactdialog()),this, SLOT(callContactdialog()));
378 378
379 379
380#ifndef KAB_EMBEDDED 380#ifndef KAB_EMBEDDED
381 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), 381 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ),
382 mXXPortManager, SLOT( importVCard( const KURL& ) ) ); 382 mXXPortManager, SLOT( importVCard( const KURL& ) ) );
383 383
384 connect( mDetails, SIGNAL( browse( const QString& ) ), 384 connect( mDetails, SIGNAL( browse( const QString& ) ),
385 SLOT( browse( const QString& ) ) ); 385 SLOT( browse( const QString& ) ) );
386 386
387 387
388 mAddressBookService = new KAddressBookService( this ); 388 mAddressBookService = new KAddressBookService( this );
389 389
390#endif //KAB_EMBEDDED 390#endif //KAB_EMBEDDED
391 391
392 mMessageTimer = new QTimer( this ); 392 mMessageTimer = new QTimer( this );
393 connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) ); 393 connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) );
394 mEditorDialog = 0; 394 mEditorDialog = 0;
395 createAddresseeEditorDialog( this ); 395 createAddresseeEditorDialog( this );
396 setModified( false ); 396 setModified( false );
397 mBRdisabled = false; 397 mBRdisabled = false;
398#ifndef DESKTOP_VERSION 398#ifndef DESKTOP_VERSION
399 infrared = 0; 399 infrared = 0;
400#endif 400#endif
401 //toggleBeamReceive( ); 401 //toggleBeamReceive( );
402 //mMainWindow->toolBar()->show(); 402 mMainWindow->toolBar()->show();
403 // we have a toolbar repainting error on the Zaurus when starting KA/Pi 403 // we have a toolbar repainting error on the Zaurus when starting KA/Pi
404 QTimer::singleShot( 10, this , SLOT ( updateToolBar())); 404 QTimer::singleShot( 10, this , SLOT ( updateToolBar()));
405} 405}
406 406
407void KABCore::updateToolBar() 407void KABCore::updateToolBar()
408{ 408{
409 static int iii = 0; 409 static int iii = 0;
410 ++iii; 410 ++iii;
411 mMainWindow->toolBar()->repaintMe(); 411 mMainWindow->toolBar()->repaintMe();
412 if ( iii < 4 ) 412 if ( iii < 4 )
413 QTimer::singleShot( 100*iii, this , SLOT ( updateToolBar())); 413 QTimer::singleShot( 100*iii, this , SLOT ( updateToolBar()));
414} 414}
415KABCore::~KABCore() 415KABCore::~KABCore()
416{ 416{
417 // save(); 417 // save();
418 //saveSettings(); 418 //saveSettings();
419 //KABPrefs::instance()->writeConfig(); 419 //KABPrefs::instance()->writeConfig();
420 delete AddresseeConfig::instance(); 420 delete AddresseeConfig::instance();
421 mAddressBook = 0; 421 mAddressBook = 0;
422 KABC::StdAddressBook::close(); 422 KABC::StdAddressBook::close();
423 423
424 delete syncManager; 424 delete syncManager;
425#ifndef DESKTOP_VERSION 425#ifndef DESKTOP_VERSION
426 if ( infrared ) 426 if ( infrared )
427 delete infrared; 427 delete infrared;
428#endif 428#endif
429} 429}
430void KABCore::receive( const QCString& cmsg, const QByteArray& data ) 430void KABCore::receive( const QCString& cmsg, const QByteArray& data )
431{ 431{
432 //qDebug("KA: QCOP message received: %s ", cmsg.data() ); 432 //qDebug("KA: QCOP message received: %s ", cmsg.data() );
433 if ( cmsg == "setDocument(QString)" ) { 433 if ( cmsg == "setDocument(QString)" ) {
434 QDataStream stream( data, IO_ReadOnly ); 434 QDataStream stream( data, IO_ReadOnly );
435 QString fileName; 435 QString fileName;
436 stream >> fileName; 436 stream >> fileName;
437 recieve( fileName ); 437 recieve( fileName );
438 return; 438 return;
439 } 439 }
440} 440}
441void KABCore::toggleBeamReceive( ) 441void KABCore::toggleBeamReceive( )
442{ 442{
443 if ( mBRdisabled ) 443 if ( mBRdisabled )
444 return; 444 return;
445#ifndef DESKTOP_VERSION 445#ifndef DESKTOP_VERSION
446 if ( infrared ) { 446 if ( infrared ) {
447 qDebug("KA: AB disable BeamReceive "); 447 qDebug("KA: AB disable BeamReceive ");
448 delete infrared; 448 delete infrared;
449 infrared = 0; 449 infrared = 0;
450 mActionBR->setChecked(false); 450 mActionBR->setChecked(false);
451 return; 451 return;
452 } 452 }
453 qDebug("KA: AB enable BeamReceive "); 453 qDebug("KA: AB enable BeamReceive ");
454 mActionBR->setChecked(true); 454 mActionBR->setChecked(true);
455 455
456 infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ; 456 infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ;
457 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& ))); 457 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& )));
458#endif 458#endif
459} 459}
460 460
461 461
462void KABCore::disableBR(bool b) 462void KABCore::disableBR(bool b)
463{ 463{
464#ifndef DESKTOP_VERSION 464#ifndef DESKTOP_VERSION
465 if ( b ) { 465 if ( b ) {
466 if ( infrared ) { 466 if ( infrared ) {
467 toggleBeamReceive( ); 467 toggleBeamReceive( );
468 } 468 }
469 mBRdisabled = true; 469 mBRdisabled = true;
470 } else { 470 } else {
471 if ( mBRdisabled ) { 471 if ( mBRdisabled ) {
472 mBRdisabled = false; 472 mBRdisabled = false;
473 //toggleBeamReceive( ); 473 //toggleBeamReceive( );
474 } 474 }
475 } 475 }
476#endif 476#endif
477 477
478} 478}
479void KABCore::recieve( QString fn ) 479void KABCore::recieve( QString fn )
480{ 480{
481 //qDebug("KABCore::recieve "); 481 //qDebug("KABCore::recieve ");
482 int count = mAddressBook->importFromFile( fn, true ); 482 int count = mAddressBook->importFromFile( fn, true );
483 if ( count ) 483 if ( count )
484 setModified( true ); 484 setModified( true );
485 mViewManager->refreshView(); 485 mViewManager->refreshView();
486 message(i18n("%1 contact(s) received!").arg( count )); 486 message(i18n("%1 contact(s) received!").arg( count ));
487 topLevelWidget()->showMaximized(); 487 topLevelWidget()->showMaximized();
488 topLevelWidget()->raise(); 488 topLevelWidget()->raise();
489} 489}
490void KABCore::restoreSettings() 490void KABCore::restoreSettings()
491{ 491{
492 mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; 492 mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce;
493 493
494 bool state; 494 bool state;
495 495
496 if (mMultipleViewsAtOnce) 496 if (mMultipleViewsAtOnce)
497 state = KABPrefs::instance()->mDetailsPageVisible; 497 state = KABPrefs::instance()->mDetailsPageVisible;
498 else 498 else
499 state = false; 499 state = false;
500 500
501 mActionDetails->setChecked( state ); 501 mActionDetails->setChecked( state );
502 setDetailsVisible( state ); 502 setDetailsVisible( state );
503 503
504 state = KABPrefs::instance()->mJumpButtonBarVisible; 504 state = KABPrefs::instance()->mJumpButtonBarVisible;
505 505
506 mActionJumpBar->setChecked( state ); 506 mActionJumpBar->setChecked( state );
507 setJumpButtonBarVisible( state ); 507 setJumpButtonBarVisible( state );
508/*US 508/*US
509 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; 509 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter;
510 if ( splitterSize.count() == 0 ) { 510 if ( splitterSize.count() == 0 ) {
511 splitterSize.append( width() / 2 ); 511 splitterSize.append( width() / 2 );
512 splitterSize.append( width() / 2 ); 512 splitterSize.append( width() / 2 );
513 } 513 }
514 mMiniSplitter->setSizes( splitterSize ); 514 mMiniSplitter->setSizes( splitterSize );
515 if ( mExtensionBarSplitter ) { 515 if ( mExtensionBarSplitter ) {
516 splitterSize = KABPrefs::instance()->mExtensionsSplitter; 516 splitterSize = KABPrefs::instance()->mExtensionsSplitter;
517 if ( splitterSize.count() == 0 ) { 517 if ( splitterSize.count() == 0 ) {
518 splitterSize.append( width() / 2 ); 518 splitterSize.append( width() / 2 );
519 splitterSize.append( width() / 2 ); 519 splitterSize.append( width() / 2 );
520 } 520 }
521 mExtensionBarSplitter->setSizes( splitterSize ); 521 mExtensionBarSplitter->setSizes( splitterSize );
522 522
523 } 523 }
524*/ 524*/
525 mViewManager->restoreSettings(); 525 mViewManager->restoreSettings();
526 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); 526 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField );
527 mExtensionManager->restoreSettings(); 527 mExtensionManager->restoreSettings();
528#ifdef DESKTOP_VERSION 528#ifdef DESKTOP_VERSION
529 int wid = width(); 529 int wid = width();
530 if ( wid < 10 ) 530 if ( wid < 10 )
531 wid = 400; 531 wid = 400;
532#else 532#else
533 int wid = QApplication::desktop()->width(); 533 int wid = QApplication::desktop()->width();
534 if ( wid < 640 ) 534 if ( wid < 640 )
535 wid = QApplication::desktop()->height(); 535 wid = QApplication::desktop()->height();
536#endif 536#endif
537 QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; 537 QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter;
538 if ( true /*splitterSize.count() == 0*/ ) { 538 if ( true /*splitterSize.count() == 0*/ ) {
539 splitterSize.append( wid / 2 ); 539 splitterSize.append( wid / 2 );
540 splitterSize.append( wid / 2 ); 540 splitterSize.append( wid / 2 );
541 } 541 }
542 mMiniSplitter->setSizes( splitterSize ); 542 mMiniSplitter->setSizes( splitterSize );
543 if ( mExtensionBarSplitter ) { 543 if ( mExtensionBarSplitter ) {
544 //splitterSize = KABPrefs::instance()->mExtensionsSplitter; 544 //splitterSize = KABPrefs::instance()->mExtensionsSplitter;
545 if ( true /*splitterSize.count() == 0*/ ) { 545 if ( true /*splitterSize.count() == 0*/ ) {
546 splitterSize.append( wid / 2 ); 546 splitterSize.append( wid / 2 );
547 splitterSize.append( wid / 2 ); 547 splitterSize.append( wid / 2 );
548 } 548 }
549 mExtensionBarSplitter->setSizes( splitterSize ); 549 mExtensionBarSplitter->setSizes( splitterSize );
550 550
551 } 551 }
552 552
553 553
554} 554}
555 555
556void KABCore::saveSettings() 556void KABCore::saveSettings()
557{ 557{
558 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); 558 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked();
559 if ( mExtensionBarSplitter ) 559 if ( mExtensionBarSplitter )
560 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 560 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
561 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); 561 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked();
562 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); 562 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes();
563#ifndef KAB_EMBEDDED 563#ifndef KAB_EMBEDDED
564 564
565 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 565 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
566 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); 566 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes();
567#endif //KAB_EMBEDDED 567#endif //KAB_EMBEDDED
568 mExtensionManager->saveSettings(); 568 mExtensionManager->saveSettings();
569 mViewManager->saveSettings(); 569 mViewManager->saveSettings();
570 570
571 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); 571 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem();
572 KABPrefs::instance()->writeConfig(); 572 KABPrefs::instance()->writeConfig();
573 qDebug("KA: KABCore::saveSettings() "); 573 qDebug("KA: KABCore::saveSettings() ");
574} 574}
575 575
576KABC::AddressBook *KABCore::addressBook() const 576KABC::AddressBook *KABCore::addressBook() const
577{ 577{
578 return mAddressBook; 578 return mAddressBook;
579} 579}
580 580
581KConfig *KABCore::config() 581KConfig *KABCore::config()
582{ 582{
583#ifndef KAB_EMBEDDED 583#ifndef KAB_EMBEDDED
584 return KABPrefs::instance()->config(); 584 return KABPrefs::instance()->config();
585#else //KAB_EMBEDDED 585#else //KAB_EMBEDDED
586 return KABPrefs::instance()->getConfig(); 586 return KABPrefs::instance()->getConfig();
587#endif //KAB_EMBEDDED 587#endif //KAB_EMBEDDED
588} 588}
589 589
590KActionCollection *KABCore::actionCollection() const 590KActionCollection *KABCore::actionCollection() const
591{ 591{
592 return mGUIClient->actionCollection(); 592 return mGUIClient->actionCollection();
593} 593}
594 594
595KABC::Field *KABCore::currentSearchField() const 595KABC::Field *KABCore::currentSearchField() const
596{ 596{
597 if (mIncSearchWidget) 597 if (mIncSearchWidget)
598 return mIncSearchWidget->currentField(); 598 return mIncSearchWidget->currentField();
599 else 599 else
600 return 0; 600 return 0;
601} 601}
602 602
603QStringList KABCore::selectedUIDs() const 603QStringList KABCore::selectedUIDs() const
604{ 604{
605 return mViewManager->selectedUids(); 605 return mViewManager->selectedUids();
606} 606}
607 607
608KABC::Resource *KABCore::requestResource( QWidget *parent ) 608KABC::Resource *KABCore::requestResource( QWidget *parent )
609{ 609{
610 QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); 610 QPtrList<KABC::Resource> kabcResources = addressBook()->resources();
611 611
612 QPtrList<KRES::Resource> kresResources; 612 QPtrList<KRES::Resource> kresResources;
613 QPtrListIterator<KABC::Resource> resIt( kabcResources ); 613 QPtrListIterator<KABC::Resource> resIt( kabcResources );
614 KABC::Resource *resource; 614 KABC::Resource *resource;
615 while ( ( resource = resIt.current() ) != 0 ) { 615 while ( ( resource = resIt.current() ) != 0 ) {
616 ++resIt; 616 ++resIt;
617 if ( !resource->readOnly() ) { 617 if ( !resource->readOnly() ) {
618 KRES::Resource *res = static_cast<KRES::Resource*>( resource ); 618 KRES::Resource *res = static_cast<KRES::Resource*>( resource );
619 if ( res ) 619 if ( res )
620 kresResources.append( res ); 620 kresResources.append( res );
621 } 621 }
622 } 622 }
623 623
624 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); 624 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent );
625 return static_cast<KABC::Resource*>( res ); 625 return static_cast<KABC::Resource*>( res );
626} 626}
627 627
628#ifndef KAB_EMBEDDED 628#ifndef KAB_EMBEDDED
629KAboutData *KABCore::createAboutData() 629KAboutData *KABCore::createAboutData()
630#else //KAB_EMBEDDED 630#else //KAB_EMBEDDED
631void KABCore::createAboutData() 631void KABCore::createAboutData()
632#endif //KAB_EMBEDDED 632#endif //KAB_EMBEDDED
633{ 633{
634#ifndef KAB_EMBEDDED 634#ifndef KAB_EMBEDDED
635 KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ), 635 KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ),
636 "3.1", I18N_NOOP( "The KDE Address Book" ), 636 "3.1", I18N_NOOP( "The KDE Address Book" ),
637 KAboutData::License_GPL_V2, 637 KAboutData::License_GPL_V2,
638 I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) ); 638 I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) );
639 about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" ); 639 about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" );
640 about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) ); 640 about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) );
641 about->addAuthor( "Cornelius Schumacher", 641 about->addAuthor( "Cornelius Schumacher",
642 I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ), 642 I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ),
643 "schumacher@kde.org" ); 643 "schumacher@kde.org" );
644 about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ), 644 about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ),
645 "mpilone@slac.com" ); 645 "mpilone@slac.com" );
646 about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) ); 646 about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) );
647 about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) ); 647 about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) );
648 about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ), 648 about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ),
649 "michel@klaralvdalens-datakonsult.se" ); 649 "michel@klaralvdalens-datakonsult.se" );
650 about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ), 650 about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ),
651 "hansen@kde.org" ); 651 "hansen@kde.org" );
652 652
653 return about; 653 return about;
654#endif //KAB_EMBEDDED 654#endif //KAB_EMBEDDED
655 655
656 QString version; 656 QString version;
657#include <../version> 657#include <../version>
658 QMessageBox::about( this, "About KAddressbook/Pi", 658 QMessageBox::about( this, "About KAddressbook/Pi",
659 "KAddressbook/Platform-independent\n" 659 "KAddressbook/Platform-independent\n"
660 "(KA/Pi) " +version + " - " + 660 "(KA/Pi) " +version + " - " +
661#ifdef DESKTOP_VERSION 661#ifdef DESKTOP_VERSION
662 "Desktop Edition\n" 662 "Desktop Edition\n"
663#else 663#else
664 "PDA-Edition\n" 664 "PDA-Edition\n"
665 "for: Zaurus 5500 / 7x0 / 8x0\n" 665 "for: Zaurus 5500 / 7x0 / 8x0\n"
666#endif 666#endif
667 667
668 "(c) 2004 Ulf Schenk\n" 668 "(c) 2004 Ulf Schenk\n"
669 "(c) 2004 Lutz Rogowski\n" 669 "(c) 2004 Lutz Rogowski\n"
670 "(c) 1997-2003, The KDE PIM Team\n" 670 "(c) 1997-2003, The KDE PIM Team\n"
671 "Tobias Koenig Current maintainer\ntokoe@kde.org\n" 671 "Tobias Koenig Current maintainer\ntokoe@kde.org\n"
672 "Don Sanders Original author\n" 672 "Don Sanders Original author\n"
673 "Cornelius Schumacher Co-maintainer\nschumacher@kde.org\n" 673 "Cornelius Schumacher Co-maintainer\nschumacher@kde.org\n"
674 "Mike Pilone GUI and framework redesign\nmpilone@slac.com\n" 674 "Mike Pilone GUI and framework redesign\nmpilone@slac.com\n"
675 "Greg Stern DCOP interface\n" 675 "Greg Stern DCOP interface\n"
676 "Mark Westcot Contact pinning\n" 676 "Mark Westcot Contact pinning\n"
677 "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n" 677 "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n"
678 "Steffen Hansen LDAP Lookup\nhansen@kde.org\n" 678 "Steffen Hansen LDAP Lookup\nhansen@kde.org\n"
679#ifdef _WIN32_ 679#ifdef _WIN32_
680 "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n" 680 "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n"
681#endif 681#endif
682 ); 682 );
683} 683}
684 684
685void KABCore::setContactSelected( const QString &uid ) 685void KABCore::setContactSelected( const QString &uid )
686{ 686{
687 KABC::Addressee addr = mAddressBook->findByUid( uid ); 687 KABC::Addressee addr = mAddressBook->findByUid( uid );
688 if ( !mDetails->isHidden() ) 688 if ( !mDetails->isHidden() )
689 mDetails->setAddressee( addr ); 689 mDetails->setAddressee( addr );
690 690
691 if ( !addr.isEmpty() ) { 691 if ( !addr.isEmpty() ) {
692 emit contactSelected( addr.formattedName() ); 692 emit contactSelected( addr.formattedName() );
693 KABC::Picture pic = addr.photo(); 693 KABC::Picture pic = addr.photo();
694 if ( pic.isIntern() ) { 694 if ( pic.isIntern() ) {
695//US emit contactSelected( pic.data() ); 695//US emit contactSelected( pic.data() );
696//US instead use: 696//US instead use:
697 QPixmap px; 697 QPixmap px;
698 if (pic.data().isNull() != true) 698 if (pic.data().isNull() != true)
699 { 699 {
700 px.convertFromImage(pic.data()); 700 px.convertFromImage(pic.data());
701 } 701 }
702 702
703 emit contactSelected( px ); 703 emit contactSelected( px );
704 } 704 }
705 } 705 }
706 706
707 707
708 mExtensionManager->setSelectionChanged(); 708 mExtensionManager->setSelectionChanged();
709 709
710 // update the actions 710 // update the actions
711 bool selected = !uid.isEmpty(); 711 bool selected = !uid.isEmpty();
712 712
713 if ( mReadWrite ) { 713 if ( mReadWrite ) {
714 mActionCut->setEnabled( selected ); 714 mActionCut->setEnabled( selected );
715 mActionPaste->setEnabled( selected ); 715 mActionPaste->setEnabled( selected );
716 } 716 }
717 717
718 mActionCopy->setEnabled( selected ); 718 mActionCopy->setEnabled( selected );
719 mActionDelete->setEnabled( selected ); 719 mActionDelete->setEnabled( selected );
720 mActionEditAddressee->setEnabled( selected ); 720 mActionEditAddressee->setEnabled( selected );
721 mActionMail->setEnabled( selected ); 721 mActionMail->setEnabled( selected );
722 mActionMailVCard->setEnabled( selected ); 722 mActionMailVCard->setEnabled( selected );
723 //if (mActionBeam) 723 //if (mActionBeam)
724 //mActionBeam->setEnabled( selected ); 724 //mActionBeam->setEnabled( selected );
725 mActionWhoAmI->setEnabled( selected ); 725 mActionWhoAmI->setEnabled( selected );
726} 726}
727 727
728void KABCore::sendMail() 728void KABCore::sendMail()
729{ 729{
730 sendMail( mViewManager->selectedEmails().join( ", " ) ); 730 sendMail( mViewManager->selectedEmails().join( ", " ) );
731} 731}
732 732
733void KABCore::sendMail( const QString& emaillist ) 733void KABCore::sendMail( const QString& emaillist )
734{ 734{
735 // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... " 735 // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... "
736 if (emaillist.contains(",") > 0) 736 if (emaillist.contains(",") > 0)
737 ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null ); 737 ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null );
738 else 738 else
739 ExternalAppHandler::instance()->mailToOneContact( emaillist ); 739 ExternalAppHandler::instance()->mailToOneContact( emaillist );
740} 740}
741 741
742 742
743 743
744void KABCore::mailVCard() 744void KABCore::mailVCard()
745{ 745{
746 QStringList uids = mViewManager->selectedUids(); 746 QStringList uids = mViewManager->selectedUids();
747 if ( !uids.isEmpty() ) 747 if ( !uids.isEmpty() )
748 mailVCard( uids ); 748 mailVCard( uids );
749} 749}
750 750
751void KABCore::mailVCard( const QStringList& uids ) 751void KABCore::mailVCard( const QStringList& uids )
752{ 752{
753 QStringList urls; 753 QStringList urls;
754 754
755// QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); 755// QString tmpdir = locateLocal("tmp", KGlobal::getAppName());
756 756
757 QString dirName = "/tmp/" + KApplication::randomString( 8 ); 757 QString dirName = "/tmp/" + KApplication::randomString( 8 );
758 758
759 759
760 760
761 QDir().mkdir( dirName, true ); 761 QDir().mkdir( dirName, true );
762 762
763 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { 763 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
764 KABC::Addressee a = mAddressBook->findByUid( *it ); 764 KABC::Addressee a = mAddressBook->findByUid( *it );
765 765
766 if ( a.isEmpty() ) 766 if ( a.isEmpty() )
767 continue; 767 continue;
768 768
769 QString name = a.givenName() + "_" + a.familyName() + ".vcf"; 769 QString name = a.givenName() + "_" + a.familyName() + ".vcf";
770 770
771 QString fileName = dirName + "/" + name; 771 QString fileName = dirName + "/" + name;
772 772
773 QFile outFile(fileName); 773 QFile outFile(fileName);
774 774
775 if ( outFile.open(IO_WriteOnly) ) { // file opened successfully 775 if ( outFile.open(IO_WriteOnly) ) { // file opened successfully
776 KABC::VCardConverter converter; 776 KABC::VCardConverter converter;
777 QString vcard; 777 QString vcard;
778 778
779 converter.addresseeToVCard( a, vcard ); 779 converter.addresseeToVCard( a, vcard );
780 780
781 QTextStream t( &outFile ); // use a text stream 781 QTextStream t( &outFile ); // use a text stream
782 t.setEncoding( QTextStream::UnicodeUTF8 ); 782 t.setEncoding( QTextStream::UnicodeUTF8 );
783 t << vcard; 783 t << vcard;
784 784
785 outFile.close(); 785 outFile.close();
786 786
@@ -1792,891 +1792,892 @@ void KABCore::initGUI()
1792 // = new QHBoxLayout( this ); 1792 // = new QHBoxLayout( this );
1793// QBoxLayout *topLayout = (QBoxLayout*)layout(); 1793// QBoxLayout *topLayout = (QBoxLayout*)layout();
1794 1794
1795// QWidget *mainBox = new QWidget( this ); 1795// QWidget *mainBox = new QWidget( this );
1796// QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); 1796// QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox);
1797 1797
1798#ifdef DESKTOP_VERSION 1798#ifdef DESKTOP_VERSION
1799 topLayout = new QHBoxLayout( this ); 1799 topLayout = new QHBoxLayout( this );
1800 1800
1801 1801
1802 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 1802 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
1803 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 1803 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
1804 1804
1805 topLayout->addWidget(mMiniSplitter ); 1805 topLayout->addWidget(mMiniSplitter );
1806 1806
1807 mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); 1807 mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter );
1808 mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); 1808 mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
1809 mViewManager = new ViewManager( this, mExtensionBarSplitter ); 1809 mViewManager = new ViewManager( this, mExtensionBarSplitter );
1810 mDetails = new ViewContainer( mMiniSplitter ); 1810 mDetails = new ViewContainer( mMiniSplitter );
1811 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); 1811 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter );
1812#else 1812#else
1813 if ( QApplication::desktop()->width() > 480 ) { 1813 if ( QApplication::desktop()->width() > 480 ) {
1814 topLayout = new QHBoxLayout( this ); 1814 topLayout = new QHBoxLayout( this );
1815 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 1815 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
1816 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 1816 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
1817 } else { 1817 } else {
1818 1818
1819 topLayout = new QHBoxLayout( this ); 1819 topLayout = new QHBoxLayout( this );
1820 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); 1820 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this);
1821 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); 1821 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
1822 } 1822 }
1823 1823
1824 topLayout->addWidget(mMiniSplitter ); 1824 topLayout->addWidget(mMiniSplitter );
1825 mViewManager = new ViewManager( this, mMiniSplitter ); 1825 mViewManager = new ViewManager( this, mMiniSplitter );
1826 mDetails = new ViewContainer( mMiniSplitter ); 1826 mDetails = new ViewContainer( mMiniSplitter );
1827 1827
1828 1828
1829 mExtensionManager = new ExtensionManager( this, mMiniSplitter ); 1829 mExtensionManager = new ExtensionManager( this, mMiniSplitter );
1830#endif 1830#endif
1831 //eh->hide(); 1831 //eh->hide();
1832 // topLayout->addWidget(mExtensionManager ); 1832 // topLayout->addWidget(mExtensionManager );
1833 1833
1834 1834
1835/*US 1835/*US
1836#ifndef KAB_NOSPLITTER 1836#ifndef KAB_NOSPLITTER
1837 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1837 QHBoxLayout *topLayout = new QHBoxLayout( this );
1838//US topLayout->setSpacing( KDialogBase::spacingHint() ); 1838//US topLayout->setSpacing( KDialogBase::spacingHint() );
1839 topLayout->setSpacing( 10 ); 1839 topLayout->setSpacing( 10 );
1840 1840
1841 mDetailsSplitter = new QSplitter( this ); 1841 mDetailsSplitter = new QSplitter( this );
1842 1842
1843 QVBox *viewSpace = new QVBox( mDetailsSplitter ); 1843 QVBox *viewSpace = new QVBox( mDetailsSplitter );
1844 1844
1845 mViewManager = new ViewManager( this, viewSpace ); 1845 mViewManager = new ViewManager( this, viewSpace );
1846 viewSpace->setStretchFactor( mViewManager, 1 ); 1846 viewSpace->setStretchFactor( mViewManager, 1 );
1847 1847
1848 mDetails = new ViewContainer( mDetailsSplitter ); 1848 mDetails = new ViewContainer( mDetailsSplitter );
1849 1849
1850 topLayout->addWidget( mDetailsSplitter ); 1850 topLayout->addWidget( mDetailsSplitter );
1851 topLayout->setStretchFactor( mDetailsSplitter, 100 ); 1851 topLayout->setStretchFactor( mDetailsSplitter, 100 );
1852#else //KAB_NOSPLITTER 1852#else //KAB_NOSPLITTER
1853 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1853 QHBoxLayout *topLayout = new QHBoxLayout( this );
1854//US topLayout->setSpacing( KDialogBase::spacingHint() ); 1854//US topLayout->setSpacing( KDialogBase::spacingHint() );
1855 topLayout->setSpacing( 10 ); 1855 topLayout->setSpacing( 10 );
1856 1856
1857// mDetailsSplitter = new QSplitter( this ); 1857// mDetailsSplitter = new QSplitter( this );
1858 1858
1859 QVBox *viewSpace = new QVBox( this ); 1859 QVBox *viewSpace = new QVBox( this );
1860 1860
1861 mViewManager = new ViewManager( this, viewSpace ); 1861 mViewManager = new ViewManager( this, viewSpace );
1862 viewSpace->setStretchFactor( mViewManager, 1 ); 1862 viewSpace->setStretchFactor( mViewManager, 1 );
1863 1863
1864 mDetails = new ViewContainer( this ); 1864 mDetails = new ViewContainer( this );
1865 1865
1866 topLayout->addWidget( viewSpace ); 1866 topLayout->addWidget( viewSpace );
1867// topLayout->setStretchFactor( mDetailsSplitter, 100 ); 1867// topLayout->setStretchFactor( mDetailsSplitter, 100 );
1868 topLayout->addWidget( mDetails ); 1868 topLayout->addWidget( mDetails );
1869#endif //KAB_NOSPLITTER 1869#endif //KAB_NOSPLITTER
1870*/ 1870*/
1871 1871
1872 syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); 1872 syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu);
1873 syncManager->setBlockSave(false); 1873 syncManager->setBlockSave(false);
1874 1874
1875 connect(syncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); 1875 connect(syncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) );
1876 connect(syncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); 1876 connect(syncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
1877 QString sync_file = sentSyncFile(); 1877 QString sync_file = sentSyncFile();
1878 //qDebug("KABCore::initGUI()::setting tmp sync file to:%s ",sync_file.latin1()); 1878 //qDebug("KABCore::initGUI()::setting tmp sync file to:%s ",sync_file.latin1());
1879 syncManager->setDefaultFileName( sync_file ); 1879 syncManager->setDefaultFileName( sync_file );
1880 //connect(syncManager , SIGNAL( ), this, SLOT( ) ); 1880 //connect(syncManager , SIGNAL( ), this, SLOT( ) );
1881 1881
1882#endif //KAB_EMBEDDED 1882#endif //KAB_EMBEDDED
1883 initActions(); 1883 initActions();
1884 1884
1885#ifdef KAB_EMBEDDED 1885#ifdef KAB_EMBEDDED
1886 addActionsManually(); 1886 addActionsManually();
1887 //US make sure the export and import menues are initialized before creating the xxPortManager. 1887 //US make sure the export and import menues are initialized before creating the xxPortManager.
1888 mXXPortManager = new XXPortManager( this, this ); 1888 mXXPortManager = new XXPortManager( this, this );
1889 1889
1890 // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); 1890 // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() );
1891 //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); 1891 //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget);
1892 // mActionQuit->plug ( mMainWindow->toolBar()); 1892 // mActionQuit->plug ( mMainWindow->toolBar());
1893 //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); 1893 //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() );
1894 //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); 1894 //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget);
1895 // mIncSearchWidget->hide(); 1895 // mIncSearchWidget->hide();
1896 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1896 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1897 SLOT( incrementalSearch( const QString& ) ) ); 1897 SLOT( incrementalSearch( const QString& ) ) );
1898 connect( mIncSearchWidget, SIGNAL( scrollUP() ),mViewManager, SLOT( scrollUP() ) ); 1898 connect( mIncSearchWidget, SIGNAL( scrollUP() ),mViewManager, SLOT( scrollUP() ) );
1899 connect( mIncSearchWidget, SIGNAL( scrollDOWN() ),mViewManager, SLOT( scrollDOWN() ) ); 1899 connect( mIncSearchWidget, SIGNAL( scrollDOWN() ),mViewManager, SLOT( scrollDOWN() ) );
1900 1900
1901 mJumpButtonBar = new JumpButtonBar( this, this ); 1901 mJumpButtonBar = new JumpButtonBar( this, this );
1902 1902
1903 topLayout->addWidget( mJumpButtonBar ); 1903 topLayout->addWidget( mJumpButtonBar );
1904//US topLayout->setStretchFactor( mJumpButtonBar, 10 ); 1904//US topLayout->setStretchFactor( mJumpButtonBar, 10 );
1905 1905
1906// mMainWindow->getIconToolBar()->raise(); 1906// mMainWindow->getIconToolBar()->raise();
1907 1907
1908#endif //KAB_EMBEDDED 1908#endif //KAB_EMBEDDED
1909 1909
1910} 1910}
1911void KABCore::initActions() 1911void KABCore::initActions()
1912{ 1912{
1913//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); 1913//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
1914 1914
1915#ifndef KAB_EMBEDDED 1915#ifndef KAB_EMBEDDED
1916 connect( QApplication::clipboard(), SIGNAL( dataChanged() ), 1916 connect( QApplication::clipboard(), SIGNAL( dataChanged() ),
1917 SLOT( clipboardDataChanged() ) ); 1917 SLOT( clipboardDataChanged() ) );
1918#endif //KAB_EMBEDDED 1918#endif //KAB_EMBEDDED
1919 1919
1920 // file menu 1920 // file menu
1921 1921
1922 mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); 1922 mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() );
1923 //mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); 1923 //mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() );
1924 mActionPrint = new KAction( i18n( "&Print View" ), "fileprint", CTRL + Key_P, mViewManager, 1924 mActionPrint = new KAction( i18n( "&Print View" ), "fileprint", CTRL + Key_P, mViewManager,
1925 SLOT( printView() ), actionCollection(), "kaddressbook_print" ); 1925 SLOT( printView() ), actionCollection(), "kaddressbook_print" );
1926 1926
1927 1927
1928 mActionPrintDetails = new KAction( i18n( "&Print Details" ), "fileprint", 0, mDetails, 1928 mActionPrintDetails = new KAction( i18n( "&Print Details" ), "fileprint", 0, mDetails,
1929 SLOT( printView() ), actionCollection(), "kaddressbook_print2" ); 1929 SLOT( printView() ), actionCollection(), "kaddressbook_print2" );
1930 1930
1931 mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, 1931 mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this,
1932 SLOT( save() ), actionCollection(), "file_sync" ); 1932 SLOT( save() ), actionCollection(), "file_sync" );
1933 1933
1934 mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, 1934 mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this,
1935 SLOT( newContact() ), actionCollection(), "file_new_contact" ); 1935 SLOT( newContact() ), actionCollection(), "file_new_contact" );
1936 1936
1937 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, 1937 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0,
1938 this, SLOT( mailVCard() ), 1938 this, SLOT( mailVCard() ),
1939 actionCollection(), "file_mail_vcard"); 1939 actionCollection(), "file_mail_vcard");
1940 1940
1941 mActionExport2phone = new KAction( i18n( "Export to phone" ), "ex2phone", 0, this, 1941 mActionExport2phone = new KAction( i18n( "Export to phone" ), "ex2phone", 0, this,
1942 SLOT( export2phone() ), actionCollection(), 1942 SLOT( export2phone() ), actionCollection(),
1943 "kaddressbook_ex2phone" ); 1943 "kaddressbook_ex2phone" );
1944 1944
1945 mActionBeamVCard = 0; 1945 mActionBeamVCard = 0;
1946 mActionBeam = 0; 1946 mActionBeam = 0;
1947 1947
1948#ifndef DESKTOP_VERSION 1948#ifndef DESKTOP_VERSION
1949 if ( Ir::supported() ) { 1949 if ( Ir::supported() ) {
1950 mActionBeamVCard = new KAction( i18n( "Beam v&Card(s)..." ), "beam", 0, this, 1950 mActionBeamVCard = new KAction( i18n( "Beam v&Card(s)..." ), "beam", 0, this,
1951 SLOT( beamVCard() ), actionCollection(), 1951 SLOT( beamVCard() ), actionCollection(),
1952 "kaddressbook_beam_vcard" ); 1952 "kaddressbook_beam_vcard" );
1953 1953
1954 mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, 1954 mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this,
1955 SLOT( beamMySelf() ), actionCollection(), 1955 SLOT( beamMySelf() ), actionCollection(),
1956 "kaddressbook_beam_myself" ); 1956 "kaddressbook_beam_myself" );
1957 } 1957 }
1958#endif 1958#endif
1959 1959
1960 mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, 1960 mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0,
1961 this, SLOT( editContact2() ), 1961 this, SLOT( editContact2() ),
1962 actionCollection(), "file_properties" ); 1962 actionCollection(), "file_properties" );
1963 1963
1964#ifdef KAB_EMBEDDED 1964#ifdef KAB_EMBEDDED
1965 // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); 1965 // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() );
1966 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, 1966 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0,
1967 mMainWindow, SLOT( exit() ), 1967 mMainWindow, SLOT( exit() ),
1968 actionCollection(), "quit" ); 1968 actionCollection(), "quit" );
1969#endif //KAB_EMBEDDED 1969#endif //KAB_EMBEDDED
1970 1970
1971 // edit menu 1971 // edit menu
1972 if ( mIsPart ) { 1972 if ( mIsPart ) {
1973 mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, 1973 mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this,
1974 SLOT( copyContacts() ), actionCollection(), 1974 SLOT( copyContacts() ), actionCollection(),
1975 "kaddressbook_copy" ); 1975 "kaddressbook_copy" );
1976 mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, 1976 mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this,
1977 SLOT( cutContacts() ), actionCollection(), 1977 SLOT( cutContacts() ), actionCollection(),
1978 "kaddressbook_cut" ); 1978 "kaddressbook_cut" );
1979 mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, 1979 mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this,
1980 SLOT( pasteContacts() ), actionCollection(), 1980 SLOT( pasteContacts() ), actionCollection(),
1981 "kaddressbook_paste" ); 1981 "kaddressbook_paste" );
1982 mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, 1982 mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this,
1983 SLOT( selectAllContacts() ), actionCollection(), 1983 SLOT( selectAllContacts() ), actionCollection(),
1984 "kaddressbook_select_all" ); 1984 "kaddressbook_select_all" );
1985 mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, 1985 mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this,
1986 SLOT( undo() ), actionCollection(), 1986 SLOT( undo() ), actionCollection(),
1987 "kaddressbook_undo" ); 1987 "kaddressbook_undo" );
1988 mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, 1988 mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z,
1989 this, SLOT( redo() ), actionCollection(), 1989 this, SLOT( redo() ), actionCollection(),
1990 "kaddressbook_redo" ); 1990 "kaddressbook_redo" );
1991 } else { 1991 } else {
1992 mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); 1992 mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() );
1993 mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); 1993 mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() );
1994 mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); 1994 mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() );
1995 mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); 1995 mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() );
1996 mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); 1996 mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() );
1997 mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); 1997 mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() );
1998 } 1998 }
1999 1999
2000 mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", 2000 mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete",
2001 Key_Delete, this, SLOT( deleteContacts() ), 2001 Key_Delete, this, SLOT( deleteContacts() ),
2002 actionCollection(), "edit_delete" ); 2002 actionCollection(), "edit_delete" );
2003 2003
2004 mActionUndo->setEnabled( false ); 2004 mActionUndo->setEnabled( false );
2005 mActionRedo->setEnabled( false ); 2005 mActionRedo->setEnabled( false );
2006 2006
2007 // settings menu 2007 // settings menu
2008#ifdef KAB_EMBEDDED 2008#ifdef KAB_EMBEDDED
2009//US special menuentry to configure the addressbook resources. On KDE 2009//US special menuentry to configure the addressbook resources. On KDE
2010// you do that through the control center !!! 2010// you do that through the control center !!!
2011 mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, 2011 mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this,
2012 SLOT( configureResources() ), actionCollection(), 2012 SLOT( configureResources() ), actionCollection(),
2013 "kaddressbook_configure_resources" ); 2013 "kaddressbook_configure_resources" );
2014#endif //KAB_EMBEDDED 2014#endif //KAB_EMBEDDED
2015 2015
2016 if ( mIsPart ) { 2016 if ( mIsPart ) {
2017 mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, 2017 mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this,
2018 SLOT( openConfigDialog() ), actionCollection(), 2018 SLOT( openConfigDialog() ), actionCollection(),
2019 "kaddressbook_configure" ); 2019 "kaddressbook_configure" );
2020 2020
2021 //US not implemented yet 2021 //US not implemented yet
2022 //mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, 2022 //mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0,
2023 // this, SLOT( configureKeyBindings() ), actionCollection(), 2023 // this, SLOT( configureKeyBindings() ), actionCollection(),
2024 // "kaddressbook_configure_shortcuts" ); 2024 // "kaddressbook_configure_shortcuts" );
2025#ifdef KAB_EMBEDDED 2025#ifdef KAB_EMBEDDED
2026 mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); 2026 mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() );
2027 mActionConfigureToolbars->setEnabled( false ); 2027 mActionConfigureToolbars->setEnabled( false );
2028#endif //KAB_EMBEDDED 2028#endif //KAB_EMBEDDED
2029 2029
2030 } else { 2030 } else {
2031 mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); 2031 mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() );
2032 2032
2033 //US not implemented yet 2033 //US not implemented yet
2034 //mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); 2034 //mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() );
2035 } 2035 }
2036 2036
2037 mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, 2037 mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0,
2038 actionCollection(), "options_show_jump_bar" ); 2038 actionCollection(), "options_show_jump_bar" );
2039 connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBar( bool ) ) ); 2039 connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBar( bool ) ) );
2040 2040
2041 mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0, 2041 mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0,
2042 actionCollection(), "options_show_details" ); 2042 actionCollection(), "options_show_details" );
2043 connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); 2043 connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) );
2044 2044
2045 2045
2046 mActionBR = new KToggleAction( i18n( "Beam receive enabled" ), "beam", 0, this, 2046 mActionBR = new KToggleAction( i18n( "Beam receive enabled" ), "beam", 0, this,
2047 SLOT( toggleBeamReceive() ), actionCollection(), 2047 SLOT( toggleBeamReceive() ), actionCollection(),
2048 "kaddressbook_beam_rec" ); 2048 "kaddressbook_beam_rec" );
2049 2049
2050 2050
2051 // misc 2051 // misc
2052 // only enable LDAP lookup if we can handle the protocol 2052 // only enable LDAP lookup if we can handle the protocol
2053#ifndef KAB_EMBEDDED 2053#ifndef KAB_EMBEDDED
2054 if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { 2054 if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) {
2055 new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, 2055 new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0,
2056 this, SLOT( openLDAPDialog() ), actionCollection(), 2056 this, SLOT( openLDAPDialog() ), actionCollection(),
2057 "ldap_lookup" ); 2057 "ldap_lookup" );
2058 } 2058 }
2059#else //KAB_EMBEDDED 2059#else //KAB_EMBEDDED
2060 //qDebug("KABCore::initActions() LDAP has to be implemented"); 2060 //qDebug("KABCore::initActions() LDAP has to be implemented");
2061#endif //KAB_EMBEDDED 2061#endif //KAB_EMBEDDED
2062 2062
2063 2063
2064 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, 2064 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this,
2065 SLOT( setWhoAmI() ), actionCollection(), 2065 SLOT( setWhoAmI() ), actionCollection(),
2066 "set_personal" ); 2066 "set_personal" );
2067 2067
2068 2068
2069 mActionCategories = new KAction( i18n( "Set Categories for Contacts..." ), 0, this, 2069 mActionCategories = new KAction( i18n( "Set Categories for Contacts..." ), 0, this,
2070 SLOT( setCategories() ), actionCollection(), 2070 SLOT( setCategories() ), actionCollection(),
2071 "edit_set_categories" ); 2071 "edit_set_categories" );
2072 mActionEditCategories = new KAction( i18n( "Edit Category List..." ), 0, this, 2072 mActionEditCategories = new KAction( i18n( "Edit Category List..." ), 0, this,
2073 SLOT( editCategories() ), actionCollection(), 2073 SLOT( editCategories() ), actionCollection(),
2074 "edit__categories" ); 2074 "edit__categories" );
2075 2075
2076 mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, 2076 mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this,
2077 SLOT( removeVoice() ), actionCollection(), 2077 SLOT( removeVoice() ), actionCollection(),
2078 "remove_voice" ); 2078 "remove_voice" );
2079 mActionSetFormattedName = new KAction( i18n( "Set formatted name..." ), 0, this, 2079 mActionSetFormattedName = new KAction( i18n( "Set formatted name..." ), 0, this,
2080 SLOT( setFormattedName() ), actionCollection(), 2080 SLOT( setFormattedName() ), actionCollection(),
2081 "set_formatted" ); 2081 "set_formatted" );
2082 2082
2083 mActionManageCategories= new KAction( i18n( "Manage new categories..." ), 0, this, 2083 mActionManageCategories= new KAction( i18n( "Manage new categories..." ), 0, this,
2084 SLOT( manageCategories() ), actionCollection(), 2084 SLOT( manageCategories() ), actionCollection(),
2085 "remove_voice" ); 2085 "remove_voice" );
2086 2086
2087 2087
2088 mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this, 2088 mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this,
2089 SLOT( importFromOL() ), actionCollection(), 2089 SLOT( importFromOL() ), actionCollection(),
2090 "import_OL" ); 2090 "import_OL" );
2091#ifdef KAB_EMBEDDED 2091#ifdef KAB_EMBEDDED
2092 mActionLicence = new KAction( i18n( "Licence" ), 0, 2092 mActionLicence = new KAction( i18n( "Licence" ), 0,
2093 this, SLOT( showLicence() ), actionCollection(), 2093 this, SLOT( showLicence() ), actionCollection(),
2094 "licence_about_data" ); 2094 "licence_about_data" );
2095 mActionFaq = new KAction( i18n( "Faq" ), 0, 2095 mActionFaq = new KAction( i18n( "Faq" ), 0,
2096 this, SLOT( faq() ), actionCollection(), 2096 this, SLOT( faq() ), actionCollection(),
2097 "faq_about_data" ); 2097 "faq_about_data" );
2098 mActionWN = new KAction( i18n( "What's New?" ), 0, 2098 mActionWN = new KAction( i18n( "What's New?" ), 0,
2099 this, SLOT( whatsnew() ), actionCollection(), 2099 this, SLOT( whatsnew() ), actionCollection(),
2100 "wn" ); 2100 "wn" );
2101 mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0, 2101 mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0,
2102 this, SLOT( synchowto() ), actionCollection(), 2102 this, SLOT( synchowto() ), actionCollection(),
2103 "sync" ); 2103 "sync" );
2104 mActionKdeSyncHowto = new KAction( i18n( "Kde Sync HowTo" ), 0, 2104 mActionKdeSyncHowto = new KAction( i18n( "Kde Sync HowTo" ), 0,
2105 this, SLOT( kdesynchowto() ), actionCollection(), 2105 this, SLOT( kdesynchowto() ), actionCollection(),
2106 "kdesync" ); 2106 "kdesync" );
2107 mActionMultiSyncHowto = new KAction( i18n( "Multi Sync HowTo" ), 0, 2107 mActionMultiSyncHowto = new KAction( i18n( "Multi Sync HowTo" ), 0,
2108 this, SLOT( multisynchowto() ), actionCollection(), 2108 this, SLOT( multisynchowto() ), actionCollection(),
2109 "multisync" ); 2109 "multisync" );
2110 2110
2111 mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, 2111 mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0,
2112 this, SLOT( createAboutData() ), actionCollection(), 2112 this, SLOT( createAboutData() ), actionCollection(),
2113 "kaddressbook_about_data" ); 2113 "kaddressbook_about_data" );
2114#endif //KAB_EMBEDDED 2114#endif //KAB_EMBEDDED
2115 2115
2116 clipboardDataChanged(); 2116 clipboardDataChanged();
2117 connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); 2117 connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
2118 connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); 2118 connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
2119} 2119}
2120 2120
2121//US we need this function, to plug all actions into the correct menues. 2121//US we need this function, to plug all actions into the correct menues.
2122// KDE uses a XML format to plug the actions, but we work her without this overhead. 2122// KDE uses a XML format to plug the actions, but we work her without this overhead.
2123void KABCore::addActionsManually() 2123void KABCore::addActionsManually()
2124{ 2124{
2125//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); 2125//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
2126 2126
2127#ifdef KAB_EMBEDDED 2127#ifdef KAB_EMBEDDED
2128 QPopupMenu *fileMenu = new QPopupMenu( this ); 2128 QPopupMenu *fileMenu = new QPopupMenu( this );
2129 QPopupMenu *editMenu = new QPopupMenu( this ); 2129 QPopupMenu *editMenu = new QPopupMenu( this );
2130 QPopupMenu *helpMenu = new QPopupMenu( this ); 2130 QPopupMenu *helpMenu = new QPopupMenu( this );
2131 2131
2132 KToolBar* tb = mMainWindow->toolBar(); 2132 KToolBar* tb = mMainWindow->toolBar();
2133 mMainWindow->setToolBarsMovable (false ); 2133 mMainWindow->setToolBarsMovable (false );
2134#ifndef DESKTOP_VERSION 2134#ifndef DESKTOP_VERSION
2135 if ( KABPrefs::instance()->mFullMenuBarVisible ) { 2135 if ( KABPrefs::instance()->mFullMenuBarVisible ) {
2136#endif 2136#endif
2137 QMenuBar* mb = mMainWindow->menuBar(); 2137 QMenuBar* mb = mMainWindow->menuBar();
2138 2138
2139 //US setup menubar. 2139 //US setup menubar.
2140 //Disable the following block if you do not want to have a menubar. 2140 //Disable the following block if you do not want to have a menubar.
2141 mb->insertItem( i18n("&File"), fileMenu ); 2141 mb->insertItem( i18n("&File"), fileMenu );
2142 mb->insertItem( i18n("&Edit"), editMenu ); 2142 mb->insertItem( i18n("&Edit"), editMenu );
2143 mb->insertItem( i18n("&View"), viewMenu ); 2143 mb->insertItem( i18n("&View"), viewMenu );
2144 mb->insertItem( i18n("&Settings"), settingsMenu ); 2144 mb->insertItem( i18n("&Settings"), settingsMenu );
2145#ifdef DESKTOP_VERSION 2145#ifdef DESKTOP_VERSION
2146 mb->insertItem( i18n("Synchronize"), syncMenu ); 2146 mb->insertItem( i18n("Synchronize"), syncMenu );
2147#else 2147#else
2148 mb->insertItem( i18n("Sync"), syncMenu ); 2148 mb->insertItem( i18n("Sync"), syncMenu );
2149#endif 2149#endif
2150 //mb->insertItem( i18n("&Change"), changeMenu ); 2150 //mb->insertItem( i18n("&Change"), changeMenu );
2151 mb->insertItem( i18n("&Help"), helpMenu ); 2151 mb->insertItem( i18n("&Help"), helpMenu );
2152 mIncSearchWidget = new IncSearchWidget( tb ); 2152 mIncSearchWidget = new IncSearchWidget( tb );
2153 // tb->insertWidget(-1, 0, mIncSearchWidget); 2153 // tb->insertWidget(-1, 0, mIncSearchWidget);
2154#ifndef DESKTOP_VERSION 2154#ifndef DESKTOP_VERSION
2155 } else { 2155 } else {
2156 //US setup toolbar 2156 //US setup toolbar
2157 QPEMenuBar *menuBarTB = new QPEMenuBar( tb ); 2157 QPEMenuBar *menuBarTB = new QPEMenuBar( tb );
2158 QPopupMenu *popupBarTB = new QPopupMenu( this ); 2158 QPopupMenu *popupBarTB = new QPopupMenu( this );
2159 menuBarTB->insertItem( SmallIcon( "z_menu" ) , popupBarTB); 2159 menuBarTB->insertItem( SmallIcon( "z_menu" ) , popupBarTB);
2160 tb->insertWidget(-1, 0, menuBarTB); 2160 tb->insertWidget(-1, 0, menuBarTB);
2161 mIncSearchWidget = new IncSearchWidget( tb ); 2161 mIncSearchWidget = new IncSearchWidget( tb );
2162 tb->enableMoving(false); 2162 tb->enableMoving(false);
2163 popupBarTB->insertItem( i18n("&File"), fileMenu ); 2163 popupBarTB->insertItem( i18n("&File"), fileMenu );
2164 popupBarTB->insertItem( i18n("&Edit"), editMenu ); 2164 popupBarTB->insertItem( i18n("&Edit"), editMenu );
2165 popupBarTB->insertItem( i18n("&View"), viewMenu ); 2165 popupBarTB->insertItem( i18n("&View"), viewMenu );
2166 popupBarTB->insertItem( i18n("&Settings"), settingsMenu ); 2166 popupBarTB->insertItem( i18n("&Settings"), settingsMenu );
2167 popupBarTB->insertItem( i18n("Synchronize"), syncMenu ); 2167 popupBarTB->insertItem( i18n("Synchronize"), syncMenu );
2168 mViewManager->getFilterAction()->plug ( popupBarTB); 2168 mViewManager->getFilterAction()->plug ( popupBarTB);
2169 //popupBarTB->insertItem( i18n("&Change selected"), changeMenu ); 2169 //popupBarTB->insertItem( i18n("&Change selected"), changeMenu );
2170 popupBarTB->insertItem( i18n("&Help"), helpMenu ); 2170 popupBarTB->insertItem( i18n("&Help"), helpMenu );
2171 if (QApplication::desktop()->width() > 320 ) { 2171 if (QApplication::desktop()->width() > 320 ) {
2172 // mViewManager->getFilterAction()->plug ( tb); 2172 // mViewManager->getFilterAction()->plug ( tb);
2173 } 2173 }
2174 } 2174 }
2175#endif 2175#endif
2176 mIncSearchWidget->setSize();
2176 // mActionQuit->plug ( mMainWindow->toolBar()); 2177 // mActionQuit->plug ( mMainWindow->toolBar());
2177 2178
2178 2179
2179 2180
2180 //US Now connect the actions with the menue entries. 2181 //US Now connect the actions with the menue entries.
2181#ifdef DESKTOP_VERSION 2182#ifdef DESKTOP_VERSION
2182 mActionPrint->plug( fileMenu ); 2183 mActionPrint->plug( fileMenu );
2183 mActionPrintDetails->plug( fileMenu ); 2184 mActionPrintDetails->plug( fileMenu );
2184 fileMenu->insertSeparator(); 2185 fileMenu->insertSeparator();
2185#endif 2186#endif
2186 mActionMail->plug( fileMenu ); 2187 mActionMail->plug( fileMenu );
2187 fileMenu->insertSeparator(); 2188 fileMenu->insertSeparator();
2188 2189
2189 mActionNewContact->plug( editMenu ); 2190 mActionNewContact->plug( editMenu );
2190 mActionNewContact->plug( tb ); 2191 mActionNewContact->plug( tb );
2191 2192
2192 mActionEditAddressee->plug( editMenu ); 2193 mActionEditAddressee->plug( editMenu );
2193 editMenu->insertSeparator(); 2194 editMenu->insertSeparator();
2194 // if ((KGlobal::getDesktopSize() > KGlobal::Small ) || 2195 // if ((KGlobal::getDesktopSize() > KGlobal::Small ) ||
2195 // (!KABPrefs::instance()->mMultipleViewsAtOnce )) 2196 // (!KABPrefs::instance()->mMultipleViewsAtOnce ))
2196 mActionEditAddressee->plug( tb ); 2197 mActionEditAddressee->plug( tb );
2197 2198
2198 // fileMenu->insertSeparator(); 2199 // fileMenu->insertSeparator();
2199 mActionSave->plug( fileMenu ); 2200 mActionSave->plug( fileMenu );
2200 fileMenu->insertItem( "&Import", ImportMenu ); 2201 fileMenu->insertItem( "&Import", ImportMenu );
2201 fileMenu->insertItem( "&Export", ExportMenu ); 2202 fileMenu->insertItem( "&Export", ExportMenu );
2202 editMenu->insertItem( i18n("&Change"), changeMenu ); 2203 editMenu->insertItem( i18n("&Change"), changeMenu );
2203 editMenu->insertSeparator(); 2204 editMenu->insertSeparator();
2204#ifndef DESKTOP_VERSION 2205#ifndef DESKTOP_VERSION
2205 if ( Ir::supported() ) fileMenu->insertItem( i18n("&Beam"), beamMenu ); 2206 if ( Ir::supported() ) fileMenu->insertItem( i18n("&Beam"), beamMenu );
2206#endif 2207#endif
2207#if 0 2208#if 0
2208 // PENDING fix MailVCard 2209 // PENDING fix MailVCard
2209 fileMenu->insertSeparator(); 2210 fileMenu->insertSeparator();
2210 mActionMailVCard->plug( fileMenu ); 2211 mActionMailVCard->plug( fileMenu );
2211#endif 2212#endif
2212#ifndef DESKTOP_VERSION 2213#ifndef DESKTOP_VERSION
2213 if ( Ir::supported() ) mActionBR->plug( beamMenu ); 2214 if ( Ir::supported() ) mActionBR->plug( beamMenu );
2214 if ( Ir::supported() ) mActionBeamVCard->plug( beamMenu ); 2215 if ( Ir::supported() ) mActionBeamVCard->plug( beamMenu );
2215 if ( Ir::supported() ) mActionBeam->plug( beamMenu ); 2216 if ( Ir::supported() ) mActionBeam->plug( beamMenu );
2216#endif 2217#endif
2217 fileMenu->insertSeparator(); 2218 fileMenu->insertSeparator();
2218 mActionQuit->plug( fileMenu ); 2219 mActionQuit->plug( fileMenu );
2219#ifdef _OL_IMPORT_ 2220#ifdef _OL_IMPORT_
2220 mActionImportOL->plug( ImportMenu ); 2221 mActionImportOL->plug( ImportMenu );
2221#endif 2222#endif
2222 // edit menu 2223 // edit menu
2223 mActionUndo->plug( editMenu ); 2224 mActionUndo->plug( editMenu );
2224 mActionRedo->plug( editMenu ); 2225 mActionRedo->plug( editMenu );
2225 editMenu->insertSeparator(); 2226 editMenu->insertSeparator();
2226 mActionCut->plug( editMenu ); 2227 mActionCut->plug( editMenu );
2227 mActionCopy->plug( editMenu ); 2228 mActionCopy->plug( editMenu );
2228 mActionPaste->plug( editMenu ); 2229 mActionPaste->plug( editMenu );
2229 mActionDelete->plug( editMenu ); 2230 mActionDelete->plug( editMenu );
2230 editMenu->insertSeparator(); 2231 editMenu->insertSeparator();
2231 mActionSelectAll->plug( editMenu ); 2232 mActionSelectAll->plug( editMenu );
2232 2233
2233 mActionSetFormattedName->plug( changeMenu ); 2234 mActionSetFormattedName->plug( changeMenu );
2234 mActionRemoveVoice->plug( changeMenu ); 2235 mActionRemoveVoice->plug( changeMenu );
2235 // settingsmings menu 2236 // settingsmings menu
2236//US special menuentry to configure the addressbook resources. On KDE 2237//US special menuentry to configure the addressbook resources. On KDE
2237// you do that through the control center !!! 2238// you do that through the control center !!!
2238 // settingsMenu->insertSeparator(); 2239 // settingsMenu->insertSeparator();
2239 2240
2240 mActionConfigKAddressbook->plug( settingsMenu, 0 ); 2241 mActionConfigKAddressbook->plug( settingsMenu, 0 );
2241 mActionConfigResources->plug( settingsMenu,1 ); 2242 mActionConfigResources->plug( settingsMenu,1 );
2242 settingsMenu->insertSeparator(2); 2243 settingsMenu->insertSeparator(2);
2243 2244
2244 if ( mIsPart ) { 2245 if ( mIsPart ) {
2245 //US not implemented yet 2246 //US not implemented yet
2246 //mActionConfigShortcuts->plug( settingsMenu ); 2247 //mActionConfigShortcuts->plug( settingsMenu );
2247 //mActionConfigureToolbars->plug( settingsMenu ); 2248 //mActionConfigureToolbars->plug( settingsMenu );
2248 2249
2249 } else { 2250 } else {
2250 //US not implemented yet 2251 //US not implemented yet
2251 //mActionKeyBindings->plug( settingsMenu ); 2252 //mActionKeyBindings->plug( settingsMenu );
2252 } 2253 }
2253 2254
2254 mActionEditCategories->plug( settingsMenu ); 2255 mActionEditCategories->plug( settingsMenu );
2255 mActionManageCategories->plug( settingsMenu ); 2256 mActionManageCategories->plug( settingsMenu );
2256 mActionJumpBar->plug( viewMenu,0 ); 2257 mActionJumpBar->plug( viewMenu,0 );
2257 mActionDetails->plug( viewMenu,0 ); 2258 mActionDetails->plug( viewMenu,0 );
2258 //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) 2259 //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop )
2259 mActionDetails->plug( tb ); 2260 mActionDetails->plug( tb );
2260 settingsMenu->insertSeparator(); 2261 settingsMenu->insertSeparator();
2261#ifndef DESKTOP_VERSION 2262#ifndef DESKTOP_VERSION
2262 if ( Ir::supported() ) mActionBR->plug(settingsMenu ); 2263 if ( Ir::supported() ) mActionBR->plug(settingsMenu );
2263 settingsMenu->insertSeparator(); 2264 settingsMenu->insertSeparator();
2264#endif 2265#endif
2265 2266
2266 mActionWhoAmI->plug( settingsMenu ); 2267 mActionWhoAmI->plug( settingsMenu );
2267 //mActionEditCategories->plug( changeMenu ); 2268 //mActionEditCategories->plug( changeMenu );
2268 mActionCategories->plug( changeMenu ); 2269 mActionCategories->plug( changeMenu );
2269 //mActionManageCategories->plug( changeMenu ); 2270 //mActionManageCategories->plug( changeMenu );
2270 2271
2271 //mActionCategories->plug( settingsMenu ); 2272 //mActionCategories->plug( settingsMenu );
2272 2273
2273 2274
2274 mActionWN->plug( helpMenu ); 2275 mActionWN->plug( helpMenu );
2275 mActionSyncHowto->plug( helpMenu ); 2276 mActionSyncHowto->plug( helpMenu );
2276 mActionKdeSyncHowto->plug( helpMenu ); 2277 mActionKdeSyncHowto->plug( helpMenu );
2277 mActionMultiSyncHowto->plug( helpMenu ); 2278 mActionMultiSyncHowto->plug( helpMenu );
2278 mActionFaq->plug( helpMenu ); 2279 mActionFaq->plug( helpMenu );
2279 mActionLicence->plug( helpMenu ); 2280 mActionLicence->plug( helpMenu );
2280 mActionAboutKAddressbook->plug( helpMenu ); 2281 mActionAboutKAddressbook->plug( helpMenu );
2281 2282
2282 if (KGlobal::getDesktopSize() > KGlobal::Small ) { 2283 if (KGlobal::getDesktopSize() > KGlobal::Small ) {
2283 2284
2284 mActionSave->plug( tb ); 2285 mActionSave->plug( tb );
2285 mViewManager->getFilterAction()->plug ( tb); 2286 mViewManager->getFilterAction()->plug ( tb);
2286 //LR hide filteraction on started in 480x640 2287 //LR hide filteraction on started in 480x640
2287 if (QApplication::desktop()->width() == 480 ) { 2288 if (QApplication::desktop()->width() == 480 ) {
2288 mViewManager->getFilterAction()->setComboWidth( 0 ); 2289 mViewManager->getFilterAction()->setComboWidth( 0 );
2289 } 2290 }
2290 mActionUndo->plug( tb ); 2291 mActionUndo->plug( tb );
2291 mActionDelete->plug( tb ); 2292 mActionDelete->plug( tb );
2292 mActionRedo->plug( tb ); 2293 mActionRedo->plug( tb );
2293 } else { 2294 } else {
2294 mActionSave->plug( tb ); 2295 mActionSave->plug( tb );
2295 tb->enableMoving(false); 2296 tb->enableMoving(false);
2296 } 2297 }
2297 //mActionQuit->plug ( tb ); 2298 //mActionQuit->plug ( tb );
2298 // tb->insertWidget(-1, 0, mIncSearchWidget, 6); 2299 //tb->insertWidget(-1, 0, mIncSearchWidget, 6);
2299 2300
2300 //US link the searchwidget first to this. 2301 //US link the searchwidget first to this.
2301 // The real linkage to the toolbar happens later. 2302 // The real linkage to the toolbar happens later.
2302//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); 2303//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE);
2303//US tb->insertItem( mIncSearchWidget ); 2304//US tb->insertItem( mIncSearchWidget );
2304/*US 2305/*US
2305 mIncSearchWidget = new IncSearchWidget( tb ); 2306 mIncSearchWidget = new IncSearchWidget( tb );
2306 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 2307 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
2307 SLOT( incrementalSearch( const QString& ) ) ); 2308 SLOT( incrementalSearch( const QString& ) ) );
2308 2309
2309 mJumpButtonBar = new JumpButtonBar( this, this ); 2310 mJumpButtonBar = new JumpButtonBar( this, this );
2310 2311
2311//US topLayout->addWidget( mJumpButtonBar ); 2312//US topLayout->addWidget( mJumpButtonBar );
2312 this->layout()->add( mJumpButtonBar ); 2313 this->layout()->add( mJumpButtonBar );
2313*/ 2314*/
2314 2315
2315#endif //KAB_EMBEDDED 2316#endif //KAB_EMBEDDED
2316 2317
2317 mActionExport2phone->plug( ExportMenu ); 2318 mActionExport2phone->plug( ExportMenu );
2318 connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); 2319 connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) );
2319 syncManager->fillSyncMenu(); 2320 syncManager->fillSyncMenu();
2320 2321
2321} 2322}
2322void KABCore::showLicence() 2323void KABCore::showLicence()
2323{ 2324{
2324 KApplication::showLicence(); 2325 KApplication::showLicence();
2325} 2326}
2326 2327
2327void KABCore::manageCategories( ) 2328void KABCore::manageCategories( )
2328{ 2329{
2329 KABCatPrefs* cp = new KABCatPrefs(); 2330 KABCatPrefs* cp = new KABCatPrefs();
2330 cp->show(); 2331 cp->show();
2331 int w =cp->sizeHint().width() ; 2332 int w =cp->sizeHint().width() ;
2332 int h = cp->sizeHint().height() ; 2333 int h = cp->sizeHint().height() ;
2333 int dw = QApplication::desktop()->width(); 2334 int dw = QApplication::desktop()->width();
2334 int dh = QApplication::desktop()->height(); 2335 int dh = QApplication::desktop()->height();
2335 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2336 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2336 if ( !cp->exec() ) { 2337 if ( !cp->exec() ) {
2337 delete cp; 2338 delete cp;
2338 return; 2339 return;
2339 } 2340 }
2340 int count = 0; 2341 int count = 0;
2341 int cc = 0; 2342 int cc = 0;
2342 message( i18n("Please wait, processing categories...")); 2343 message( i18n("Please wait, processing categories..."));
2343 if ( cp->addCat() ) { 2344 if ( cp->addCat() ) {
2344 KABC::AddressBook::Iterator it; 2345 KABC::AddressBook::Iterator it;
2345 QStringList catList = KABPrefs::instance()->mCustomCategories; 2346 QStringList catList = KABPrefs::instance()->mCustomCategories;
2346 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 2347 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2347 ++cc; 2348 ++cc;
2348 if ( cc %10 == 0) 2349 if ( cc %10 == 0)
2349 message(i18n("Processing contact #%1").arg(cc)); 2350 message(i18n("Processing contact #%1").arg(cc));
2350 QStringList catIncList = (*it).categories(); 2351 QStringList catIncList = (*it).categories();
2351 int i; 2352 int i;
2352 for( i = 0; i< catIncList.count(); ++i ) { 2353 for( i = 0; i< catIncList.count(); ++i ) {
2353 if ( !catList.contains (catIncList[i])) { 2354 if ( !catList.contains (catIncList[i])) {
2354 catList.append( catIncList[i] ); 2355 catList.append( catIncList[i] );
2355 //qDebug("add cat %s ", catIncList[i].latin1()); 2356 //qDebug("add cat %s ", catIncList[i].latin1());
2356 ++count; 2357 ++count;
2357 } 2358 }
2358 } 2359 }
2359 } 2360 }
2360 catList.sort(); 2361 catList.sort();
2361 KABPrefs::instance()->mCustomCategories = catList; 2362 KABPrefs::instance()->mCustomCategories = catList;
2362 KABPrefs::instance()->writeConfig(); 2363 KABPrefs::instance()->writeConfig();
2363 message(QString::number( count )+ i18n(" categories added to list! ")); 2364 message(QString::number( count )+ i18n(" categories added to list! "));
2364 } else { 2365 } else {
2365 QStringList catList = KABPrefs::instance()->mCustomCategories; 2366 QStringList catList = KABPrefs::instance()->mCustomCategories;
2366 QStringList catIncList; 2367 QStringList catIncList;
2367 QStringList newCatList; 2368 QStringList newCatList;
2368 KABC::AddressBook::Iterator it; 2369 KABC::AddressBook::Iterator it;
2369 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 2370 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2370 ++cc; 2371 ++cc;
2371 if ( cc %10 == 0) 2372 if ( cc %10 == 0)
2372 message(i18n("Processing contact #%1").arg(cc)); 2373 message(i18n("Processing contact #%1").arg(cc));
2373 QStringList catIncList = (*it).categories(); 2374 QStringList catIncList = (*it).categories();
2374 int i; 2375 int i;
2375 if ( catIncList.count() ) { 2376 if ( catIncList.count() ) {
2376 newCatList.clear(); 2377 newCatList.clear();
2377 for( i = 0; i< catIncList.count(); ++i ) { 2378 for( i = 0; i< catIncList.count(); ++i ) {
2378 if ( catList.contains (catIncList[i])) { 2379 if ( catList.contains (catIncList[i])) {
2379 newCatList.append( catIncList[i] ); 2380 newCatList.append( catIncList[i] );
2380 } 2381 }
2381 } 2382 }
2382 newCatList.sort(); 2383 newCatList.sort();
2383 (*it).setCategories( newCatList ); 2384 (*it).setCategories( newCatList );
2384 mAddressBook->insertAddressee( (*it) ); 2385 mAddressBook->insertAddressee( (*it) );
2385 } 2386 }
2386 } 2387 }
2387 setModified( true ); 2388 setModified( true );
2388 mViewManager->refreshView(); 2389 mViewManager->refreshView();
2389 message( i18n("Removing categories done!")); 2390 message( i18n("Removing categories done!"));
2390 } 2391 }
2391 delete cp; 2392 delete cp;
2392} 2393}
2393void KABCore::removeVoice() 2394void KABCore::removeVoice()
2394{ 2395{
2395 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 ) 2396 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 )
2396 return; 2397 return;
2397 XXPortSelectDialog dlg( this, false, this ); 2398 XXPortSelectDialog dlg( this, false, this );
2398 if ( !dlg.exec() ) 2399 if ( !dlg.exec() )
2399 return; 2400 return;
2400 mAddressBook->setUntagged(); 2401 mAddressBook->setUntagged();
2401 dlg.tagSelected(); 2402 dlg.tagSelected();
2402 message(i18n("Removing voice..."), false ); 2403 message(i18n("Removing voice..."), false );
2403 KABC::AddressBook::Iterator it; 2404 KABC::AddressBook::Iterator it;
2404 for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 2405 for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2405 if ( (*it).tagged() ) { 2406 if ( (*it).tagged() ) {
2406 (*it).removeVoice(); 2407 (*it).removeVoice();
2407 } 2408 }
2408 } 2409 }
2409 message(i18n("Refreshing view...") ); 2410 message(i18n("Refreshing view...") );
2410 qApp->processEvents(); 2411 qApp->processEvents();
2411 mViewManager->refreshView( "" ); 2412 mViewManager->refreshView( "" );
2412 Addressee add; 2413 Addressee add;
2413 mDetails->setAddressee( add ); 2414 mDetails->setAddressee( add );
2414 message(i18n("Remove voice completed!") ); 2415 message(i18n("Remove voice completed!") );
2415 2416
2416 2417
2417 2418
2418} 2419}
2419 2420
2420void KABCore::setFormattedName() 2421void KABCore::setFormattedName()
2421{ 2422{
2422 KABFormatPrefs setpref; 2423 KABFormatPrefs setpref;
2423 if ( !setpref.exec() ) { 2424 if ( !setpref.exec() ) {
2424 return; 2425 return;
2425 } 2426 }
2426 XXPortSelectDialog dlg( this, false, this ); 2427 XXPortSelectDialog dlg( this, false, this );
2427 if ( !dlg.exec() ) 2428 if ( !dlg.exec() )
2428 return; 2429 return;
2429 mAddressBook->setUntagged(); 2430 mAddressBook->setUntagged();
2430 dlg.tagSelected(); 2431 dlg.tagSelected();
2431 int count = 0; 2432 int count = 0;
2432 KABC::AddressBook::Iterator it; 2433 KABC::AddressBook::Iterator it;
2433 for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 2434 for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2434 if ( (*it).tagged() ) { 2435 if ( (*it).tagged() ) {
2435 ++count; 2436 ++count;
2436 if ( count %10 == 0 ) 2437 if ( count %10 == 0 )
2437 message(i18n("Changing contact #%1").arg( count ) ); 2438 message(i18n("Changing contact #%1").arg( count ) );
2438 qApp->processEvents(); 2439 qApp->processEvents();
2439 QString fName; 2440 QString fName;
2440 if ( setpref.simple->isChecked() ) 2441 if ( setpref.simple->isChecked() )
2441 fName = NameEditDialog::formattedName( (*it), NameEditDialog::SimpleName ); 2442 fName = NameEditDialog::formattedName( (*it), NameEditDialog::SimpleName );
2442 else if ( setpref.full->isChecked() ) 2443 else if ( setpref.full->isChecked() )
2443 fName = NameEditDialog::formattedName( (*it), NameEditDialog::FullName ); 2444 fName = NameEditDialog::formattedName( (*it), NameEditDialog::FullName );
2444 else if ( setpref.reverse->isChecked() ) 2445 else if ( setpref.reverse->isChecked() )
2445 fName = NameEditDialog::formattedName( (*it), NameEditDialog::ReverseName ); 2446 fName = NameEditDialog::formattedName( (*it), NameEditDialog::ReverseName );
2446 else 2447 else
2447 fName = (*it).organization(); 2448 fName = (*it).organization();
2448 if ( setpref.setCompany->isChecked() ) 2449 if ( setpref.setCompany->isChecked() )
2449 if ( fName.isEmpty() || fName =="," ) 2450 if ( fName.isEmpty() || fName =="," )
2450 fName = (*it).organization(); 2451 fName = (*it).organization();
2451 (*it).setFormattedName( fName ); 2452 (*it).setFormattedName( fName );
2452 } 2453 }
2453 } 2454 }
2454 message(i18n("Refreshing view...") ); 2455 message(i18n("Refreshing view...") );
2455 qApp->processEvents(); 2456 qApp->processEvents();
2456 mViewManager->refreshView( "" ); 2457 mViewManager->refreshView( "" );
2457 Addressee add; 2458 Addressee add;
2458 mDetails->setAddressee( add ); 2459 mDetails->setAddressee( add );
2459 message(i18n("Setting formatted name completed!") ); 2460 message(i18n("Setting formatted name completed!") );
2460} 2461}
2461 2462
2462void KABCore::clipboardDataChanged() 2463void KABCore::clipboardDataChanged()
2463{ 2464{
2464 2465
2465 if ( mReadWrite ) 2466 if ( mReadWrite )
2466 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); 2467 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() );
2467 2468
2468} 2469}
2469 2470
2470void KABCore::updateActionMenu() 2471void KABCore::updateActionMenu()
2471{ 2472{
2472 UndoStack *undo = UndoStack::instance(); 2473 UndoStack *undo = UndoStack::instance();
2473 RedoStack *redo = RedoStack::instance(); 2474 RedoStack *redo = RedoStack::instance();
2474 2475
2475 if ( undo->isEmpty() ) 2476 if ( undo->isEmpty() )
2476 mActionUndo->setText( i18n( "Undo" ) ); 2477 mActionUndo->setText( i18n( "Undo" ) );
2477 else 2478 else
2478 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); 2479 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) );
2479 2480
2480 mActionUndo->setEnabled( !undo->isEmpty() ); 2481 mActionUndo->setEnabled( !undo->isEmpty() );
2481 2482
2482 if ( !redo->top() ) 2483 if ( !redo->top() )
2483 mActionRedo->setText( i18n( "Redo" ) ); 2484 mActionRedo->setText( i18n( "Redo" ) );
2484 else 2485 else
2485 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); 2486 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) );
2486 2487
2487 mActionRedo->setEnabled( !redo->isEmpty() ); 2488 mActionRedo->setEnabled( !redo->isEmpty() );
2488} 2489}
2489 2490
2490void KABCore::configureKeyBindings() 2491void KABCore::configureKeyBindings()
2491{ 2492{
2492#ifndef KAB_EMBEDDED 2493#ifndef KAB_EMBEDDED
2493 KKeyDialog::configure( actionCollection(), true ); 2494 KKeyDialog::configure( actionCollection(), true );
2494#else //KAB_EMBEDDED 2495#else //KAB_EMBEDDED
2495 qDebug("KABCore::configureKeyBindings() not implemented"); 2496 qDebug("KABCore::configureKeyBindings() not implemented");
2496#endif //KAB_EMBEDDED 2497#endif //KAB_EMBEDDED
2497} 2498}
2498 2499
2499#ifdef KAB_EMBEDDED 2500#ifdef KAB_EMBEDDED
2500void KABCore::configureResources() 2501void KABCore::configureResources()
2501{ 2502{
2502 KRES::KCMKResources dlg( this, "" , 0 ); 2503 KRES::KCMKResources dlg( this, "" , 0 );
2503 2504
2504 if ( !dlg.exec() ) 2505 if ( !dlg.exec() )
2505 return; 2506 return;
2506 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); 2507 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") );
2507} 2508}
2508#endif //KAB_EMBEDDED 2509#endif //KAB_EMBEDDED
2509 2510
2510 2511
2511/* this method will be called through the QCop interface from Ko/Pi to select addresses 2512/* this method will be called through the QCop interface from Ko/Pi to select addresses
2512 * for the attendees list of an event. 2513 * for the attendees list of an event.
2513 */ 2514 */
2514void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) 2515void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid)
2515{ 2516{
2516 2517
2517 bool ok = false; 2518 bool ok = false;
2518 mEmailSourceChannel = sourceChannel; 2519 mEmailSourceChannel = sourceChannel;
2519 int wid = uid.toInt( &ok ); 2520 int wid = uid.toInt( &ok );
2520 qDebug("UID %s ", uid.latin1()); 2521 qDebug("UID %s ", uid.latin1());
2521 if ( ok ) { 2522 if ( ok ) {
2522 if ( wid != QApplication::desktop()->width() ) { 2523 if ( wid != QApplication::desktop()->width() ) {
2523 qDebug("KA/Pi: Request from different desktop geometry. Resizing ..."); 2524 qDebug("KA/Pi: Request from different desktop geometry. Resizing ...");
2524 message( i18n("Resizing, please wait...") ); 2525 message( i18n("Resizing, please wait...") );
2525 mMainWindow->showMinimized(); 2526 mMainWindow->showMinimized();
2526 /* 2527 /*
2527 { 2528 {
2528 QCopEnvelope e("QPE/Application/kapi", "callContactdialog()"); 2529 QCopEnvelope e("QPE/Application/kapi", "callContactdialog()");
2529 } 2530 }
2530 */ 2531 */
2531 QTimer::singleShot( 1,this, SLOT ( resizeAndCallContactdialog() ) ); 2532 QTimer::singleShot( 1,this, SLOT ( resizeAndCallContactdialog() ) );
2532 return; 2533 return;
2533 } 2534 }
2534 2535
2535 } else { 2536 } else {
2536 qDebug("KABCore::requestForNameEmailUidList:: Got invalid uid "); 2537 qDebug("KABCore::requestForNameEmailUidList:: Got invalid uid ");
2537 } 2538 }
2538 callContactdialog(); 2539 callContactdialog();
2539 //QCopEnvelope e("QPE/Application/kapi", "callContactdialog()"); 2540 //QCopEnvelope e("QPE/Application/kapi", "callContactdialog()");
2540 2541
2541} 2542}
2542void KABCore::resizeAndCallContactdialog() 2543void KABCore::resizeAndCallContactdialog()
2543{ 2544{
2544 updateMainWindow(); 2545 updateMainWindow();
2545 QTimer::singleShot( 100,this, SLOT ( callContactdialog() ) ); 2546 QTimer::singleShot( 100,this, SLOT ( callContactdialog() ) );
2546} 2547}
2547 2548
2548void KABCore::callContactdialog() 2549void KABCore::callContactdialog()
2549{ 2550{
2550 QStringList nameList; 2551 QStringList nameList;
2551 QStringList emailList; 2552 QStringList emailList;
2552 QStringList uidList; 2553 QStringList uidList;
2553 qDebug("WIDTH %d ", QApplication::desktop()->width() ); 2554 qDebug("WIDTH %d ", QApplication::desktop()->width() );
2554 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); 2555 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this);
2555 uint i=0; 2556 uint i=0;
2556 for (i=0; i < list.count(); i++) 2557 for (i=0; i < list.count(); i++)
2557 { 2558 {
2558 nameList.append(list[i].realName()); 2559 nameList.append(list[i].realName());
2559 emailList.append(list[i].preferredEmail()); 2560 emailList.append(list[i].preferredEmail());
2560 uidList.append(list[i].uid()); 2561 uidList.append(list[i].uid());
2561 } 2562 }
2562 QString uid = "unnamed"; 2563 QString uid = "unnamed";
2563 //qDebug("%s %s ", sourceChannel.latin1(), uid.latin1()); 2564 //qDebug("%s %s ", sourceChannel.latin1(), uid.latin1());
2564 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(mEmailSourceChannel, uid, nameList, emailList, uidList); 2565 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(mEmailSourceChannel, uid, nameList, emailList, uidList);
2565 2566
2566} 2567}
2567/* this method will be called through the QCop interface from Ko/Pi to select birthdays 2568/* this method will be called through the QCop interface from Ko/Pi to select birthdays
2568 * to put them into the calendar. 2569 * to put them into the calendar.
2569 */ 2570 */
2570void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid) 2571void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid)
2571{ 2572{
2572 // qDebug("KABCore::requestForBirthdayList"); 2573 // qDebug("KABCore::requestForBirthdayList");
2573 QStringList birthdayList; 2574 QStringList birthdayList;
2574 QStringList anniversaryList; 2575 QStringList anniversaryList;
2575 QStringList realNameList; 2576 QStringList realNameList;
2576 QStringList preferredEmailList; 2577 QStringList preferredEmailList;
2577 QStringList assembledNameList; 2578 QStringList assembledNameList;
2578 QStringList uidList; 2579 QStringList uidList;
2579 2580
2580 KABC::AddressBook::Iterator it; 2581 KABC::AddressBook::Iterator it;
2581 2582
2582 int count = 0; 2583 int count = 0;
2583 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 2584 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2584 ++count; 2585 ++count;
2585 } 2586 }
2586 QProgressBar bar(count,0 ); 2587 QProgressBar bar(count,0 );
2587 int w = 300; 2588 int w = 300;
2588 if ( QApplication::desktop()->width() < 320 ) 2589 if ( QApplication::desktop()->width() < 320 )
2589 w = 220; 2590 w = 220;
2590 int h = bar.sizeHint().height() ; 2591 int h = bar.sizeHint().height() ;
2591 int dw = QApplication::desktop()->width(); 2592 int dw = QApplication::desktop()->width();
2592 int dh = QApplication::desktop()->height(); 2593 int dh = QApplication::desktop()->height();
2593 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2594 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2594 bar.show(); 2595 bar.show();
2595 bar.setCaption (i18n("Collecting birthdays - close to abort!") ); 2596 bar.setCaption (i18n("Collecting birthdays - close to abort!") );
2596 qApp->processEvents(); 2597 qApp->processEvents();
2597 2598
2598 QDate bday; 2599 QDate bday;
2599 QString anni; 2600 QString anni;
2600 QString formattedbday; 2601 QString formattedbday;
2601 2602
2602 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) 2603 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it )
2603 { 2604 {
2604 if ( ! bar.isVisible() ) 2605 if ( ! bar.isVisible() )
2605 return; 2606 return;
2606 bar.setProgress( count++ ); 2607 bar.setProgress( count++ );
2607 qApp->processEvents(); 2608 qApp->processEvents();
2608 bday = (*it).birthday().date(); 2609 bday = (*it).birthday().date();
2609 anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" ); 2610 anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" );
2610 2611
2611 if ( bday.isValid() || !anni.isEmpty()) 2612 if ( bday.isValid() || !anni.isEmpty())
2612 { 2613 {
2613 if (bday.isValid()) 2614 if (bday.isValid())
2614 formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate); 2615 formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate);
2615 else 2616 else
2616 formattedbday = "NOTVALID"; 2617 formattedbday = "NOTVALID";
2617 if (anni.isEmpty()) 2618 if (anni.isEmpty())
2618 anni = "INVALID"; 2619 anni = "INVALID";
2619 2620
2620 birthdayList.append(formattedbday); 2621 birthdayList.append(formattedbday);
2621 anniversaryList.append(anni); //should be ISODate 2622 anniversaryList.append(anni); //should be ISODate
2622 realNameList.append((*it).realName()); 2623 realNameList.append((*it).realName());
2623 preferredEmailList.append((*it).preferredEmail()); 2624 preferredEmailList.append((*it).preferredEmail());
2624 assembledNameList.append((*it).assembledName()); 2625 assembledNameList.append((*it).assembledName());
2625 uidList.append((*it).uid()); 2626 uidList.append((*it).uid());
2626 2627
2627 //qDebug("found birthday in KA/Pi: %s,%s,%s,%s: %s, %s", (*it).realName().latin1(), (*it).preferredEmail().latin1(), (*it).assembledName().latin1(), (*it).uid().latin1(), formattedbday.latin1(), anni.latin1() ); 2628 //qDebug("found birthday in KA/Pi: %s,%s,%s,%s: %s, %s", (*it).realName().latin1(), (*it).preferredEmail().latin1(), (*it).assembledName().latin1(), (*it).uid().latin1(), formattedbday.latin1(), anni.latin1() );
2628 } 2629 }
2629 } 2630 }
2630 2631
2631 bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList); 2632 bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList);
2632 2633
2633} 2634}
2634 2635
2635/* this method will be called through the QCop interface from other apps to show details of a contact. 2636/* this method will be called through the QCop interface from other apps to show details of a contact.
2636 */ 2637 */
2637void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) 2638void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid)
2638{ 2639{
2639 //qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); 2640 //qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1());
2640 2641
2641 QString foundUid = QString::null; 2642 QString foundUid = QString::null;
2642 if ( ! uid.isEmpty() ) { 2643 if ( ! uid.isEmpty() ) {
2643 Addressee adrr = mAddressBook->findByUid( uid ); 2644 Addressee adrr = mAddressBook->findByUid( uid );
2644 if ( !adrr.isEmpty() ) { 2645 if ( !adrr.isEmpty() ) {
2645 foundUid = uid; 2646 foundUid = uid;
2646 } 2647 }
2647 if ( email == "sendbacklist" ) { 2648 if ( email == "sendbacklist" ) {
2648 //qDebug("ssssssssssssssssssssssend "); 2649 //qDebug("ssssssssssssssssssssssend ");
2649 QStringList nameList; 2650 QStringList nameList;
2650 QStringList emailList; 2651 QStringList emailList;
2651 QStringList uidList; 2652 QStringList uidList;
2652 nameList.append(adrr.realName()); 2653 nameList.append(adrr.realName());
2653 emailList = adrr.emails(); 2654 emailList = adrr.emails();
2654 uidList.append( adrr.preferredEmail()); 2655 uidList.append( adrr.preferredEmail());
2655 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); 2656 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList);
2656 return; 2657 return;
2657 } 2658 }
2658 2659
2659 } 2660 }
2660 2661
2661 if ( email == "sendbacklist" ) 2662 if ( email == "sendbacklist" )
2662 return; 2663 return;
2663 if (foundUid.isEmpty()) 2664 if (foundUid.isEmpty())
2664 { 2665 {
2665 //find the uid of the person first 2666 //find the uid of the person first
2666 Addressee::List namelist; 2667 Addressee::List namelist;
2667 Addressee::List emaillist; 2668 Addressee::List emaillist;
2668 2669
2669 if (!name.isEmpty()) 2670 if (!name.isEmpty())
2670 namelist = mAddressBook->findByName( name ); 2671 namelist = mAddressBook->findByName( name );
2671 2672
2672 if (!email.isEmpty()) 2673 if (!email.isEmpty())
2673 emaillist = mAddressBook->findByEmail( email ); 2674 emaillist = mAddressBook->findByEmail( email );
2674 //qDebug("count %d %d ", namelist.count(),emaillist.count() ); 2675 //qDebug("count %d %d ", namelist.count(),emaillist.count() );
2675 //check if we have a match in Namelist and Emaillist 2676 //check if we have a match in Namelist and Emaillist
2676 if ((namelist.count() == 0) && (emaillist.count() > 0)) { 2677 if ((namelist.count() == 0) && (emaillist.count() > 0)) {
2677 foundUid = emaillist[0].uid(); 2678 foundUid = emaillist[0].uid();
2678 } 2679 }
2679 else if ((namelist.count() > 0) && (emaillist.count() == 0)) 2680 else if ((namelist.count() > 0) && (emaillist.count() == 0))
2680 foundUid = namelist[0].uid(); 2681 foundUid = namelist[0].uid();
2681 else 2682 else
2682 { 2683 {