summaryrefslogtreecommitdiffabout
path: root/kaddressbook/kabcore.cpp
Unidiff
Diffstat (limited to 'kaddressbook/kabcore.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp146
1 files changed, 78 insertions, 68 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index ab2824c..03b44d1 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -30,36 +30,46 @@ $Id$
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 <q3progressbar.h>
43#include <QDesktopWidget>
44//Added by qt3to4:
45#include <QResizeEvent>
46#include <QPixmap>
47#include <Q3ValueList>
48#include <Q3HBoxLayout>
49#include <Q3VBoxLayout>
50#include <Q3CString>
51#include <Q3PopupMenu>
52#include <Q3PtrList>
43#include <libkdepim/phoneaccess.h> 53#include <libkdepim/phoneaccess.h>
44 54
45#ifndef KAB_EMBEDDED 55#ifndef KAB_EMBEDDED
46#include <qclipboard.h> 56#include <qclipboard.h>
47#include <qdir.h> 57#include <qdir.h>
48#include <qfile.h> 58#include <qfile.h>
49#include <qapplicaton.h> 59#include <qapplicaton.h>
50#include <qprogressbar.h> 60#include <q3progressbar.h>
51#include <qlayout.h> 61#include <qlayout.h>
52#include <qregexp.h> 62#include <qregexp.h>
53#include <qvbox.h> 63#include <q3vbox.h>
54#include <kabc/addresseelist.h> 64#include <kabc/addresseelist.h>
55#include <kabc/errorhandler.h> 65#include <kabc/errorhandler.h>
56#include <kabc/resource.h> 66#include <kabc/resource.h>
57#include <kabc/vcardconverter.h> 67#include <kabc/vcardconverter.h>
58#include <kapplication.h> 68#include <kapplication.h>
59#include <kactionclasses.h> 69#include <kactionclasses.h>
60#include <kcmultidialog.h> 70#include <kcmultidialog.h>
61#include <kdebug.h> 71#include <kdebug.h>
62#include <kdeversion.h> 72#include <kdeversion.h>
63#include <kkeydialog.h> 73#include <kkeydialog.h>
64#include <kmessagebox.h> 74#include <kmessagebox.h>
65#include <kprinter.h> 75#include <kprinter.h>
@@ -79,25 +89,25 @@ $Id$
79#include "ldapsearchdialog.h" 89#include "ldapsearchdialog.h"
80#include "printing/printingwizard.h" 90#include "printing/printingwizard.h"
81#else // KAB_EMBEDDED 91#else // KAB_EMBEDDED
82 92
83#include <kapplication.h> 93#include <kapplication.h>
84#include "KDGanttMinimizeSplitter.h" 94#include "KDGanttMinimizeSplitter.h"
85#include "kaddressbookmain.h" 95#include "kaddressbookmain.h"
86#include "kactioncollection.h" 96#include "kactioncollection.h"
87#include "addresseedialog.h" 97#include "addresseedialog.h"
88//US 98//US
89#include <addresseeview.h> 99#include <addresseeview.h>
90 100
91#include <qapp.h> 101#include <qapplication.h>
92#include <qmenubar.h> 102#include <qmenubar.h>
93//#include <qtoolbar.h> 103//#include <qtoolbar.h>
94#include <qmessagebox.h> 104#include <qmessagebox.h>
95#include <kdebug.h> 105#include <kdebug.h>
96#include <kiconloader.h> // needed for SmallIcon 106#include <kiconloader.h> // needed for SmallIcon
97#include <kresources/kcmkresources.h> 107#include <kresources/kcmkresources.h>
98#include <ktoolbar.h> 108#include <ktoolbar.h>
99#include <kprefsdialog.h> 109#include <kprefsdialog.h>
100 110
101 111
102//#include <qlabel.h> 112//#include <qlabel.h>
103 113
@@ -120,30 +130,30 @@ $Id$
120 130
121 131
122#include <kresources/selectdialog.h> 132#include <kresources/selectdialog.h>
123#include <kmessagebox.h> 133#include <kmessagebox.h>
124 134
125#include <picture.h> 135#include <picture.h>
126#include <resource.h> 136#include <resource.h>
127 137
128//US#include <qsplitter.h> 138//US#include <qsplitter.h>
129#include <qmap.h> 139#include <qmap.h>
130#include <qdir.h> 140#include <qdir.h>
131#include <qfile.h> 141#include <qfile.h>
132#include <qvbox.h> 142#include <q3vbox.h>
133#include <qlayout.h> 143#include <qlayout.h>
134#include <qclipboard.h> 144#include <qclipboard.h>
135#include <qtextstream.h> 145#include <q3textstream.h>
136#include <qradiobutton.h> 146#include <qradiobutton.h>
137#include <qbuttongroup.h> 147#include <q3buttongroup.h>
138 148
139#include <libkdepim/categoryselectdialog.h> 149#include <libkdepim/categoryselectdialog.h>
140#include <libkdepim/categoryeditdialog.h> 150#include <libkdepim/categoryeditdialog.h>
141#include <kabc/vcardconverter.h> 151#include <kabc/vcardconverter.h>
142 152
143 153
144#include "addresseeutil.h" 154#include "addresseeutil.h"
145#include "undocmds.h" 155#include "undocmds.h"
146#include "addresseeeditordialog.h" 156#include "addresseeeditordialog.h"
147#include "viewmanager.h" 157#include "viewmanager.h"
148#include "details/detailsviewcontainer.h" 158#include "details/detailsviewcontainer.h"
149#include "kabprefs.h" 159#include "kabprefs.h"
@@ -166,30 +176,30 @@ $Id$
166// sync includes 176// sync includes
167#include <libkdepim/ksyncprofile.h> 177#include <libkdepim/ksyncprofile.h>
168#include <libkdepim/ksyncprefsdialog.h> 178#include <libkdepim/ksyncprefsdialog.h>
169 179
170 180
171class KABCatPrefs : public QDialog 181class KABCatPrefs : public QDialog
172{ 182{
173 public: 183 public:
174 KABCatPrefs( QWidget *parent=0, const char *name=0 ) : 184 KABCatPrefs( QWidget *parent=0, const char *name=0 ) :
175 QDialog( parent, name, true ) 185 QDialog( parent, name, true )
176 { 186 {
177 setCaption( i18n("Manage new Categories") ); 187 setCaption( i18n("Manage new Categories") );
178 QVBoxLayout* lay = new QVBoxLayout( this ); 188 Q3VBoxLayout* lay = new Q3VBoxLayout( this );
179 lay->setSpacing( 3 ); 189 lay->setSpacing( 3 );
180 lay->setMargin( 3 ); 190 lay->setMargin( 3 );
181 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 ); 191 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 );
182 lay->addWidget( lab ); 192 lay->addWidget( lab );
183 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); 193 Q3ButtonGroup* format = new Q3ButtonGroup( 1, Qt::Horizontal, i18n("New categories not in list:"), this );
184 lay->addWidget( format ); 194 lay->addWidget( format );
185 format->setExclusive ( true ) ; 195 format->setExclusive ( true ) ;
186 addCatBut = new QRadioButton(i18n("Add to category list"), format ); 196 addCatBut = new QRadioButton(i18n("Add to category list"), format );
187 new QRadioButton(i18n("Remove from addressees"), format ); 197 new QRadioButton(i18n("Remove from addressees"), format );
188 addCatBut->setChecked( true ); 198 addCatBut->setChecked( true );
189 QPushButton * ok = new QPushButton( i18n("OK"), this ); 199 QPushButton * ok = new QPushButton( i18n("OK"), this );
190 lay->addWidget( ok ); 200 lay->addWidget( ok );
191 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 201 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
192 lay->addWidget( cancel ); 202 lay->addWidget( cancel );
193 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 203 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
194 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 204 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
195 resize( 200, 200 ); 205 resize( 200, 200 );
@@ -198,30 +208,30 @@ class KABCatPrefs : public QDialog
198 bool addCat() { return addCatBut->isChecked(); } 208 bool addCat() { return addCatBut->isChecked(); }
199private: 209private:
200 QRadioButton* addCatBut; 210 QRadioButton* addCatBut;
201}; 211};
202 212
203class KABFormatPrefs : public QDialog 213class KABFormatPrefs : public QDialog
204{ 214{
205 public: 215 public:
206 KABFormatPrefs( QWidget *parent=0, const char *name=0 ) : 216 KABFormatPrefs( QWidget *parent=0, const char *name=0 ) :
207 QDialog( parent, name, true ) 217 QDialog( parent, name, true )
208 { 218 {
209 setCaption( i18n("Set formatted name") ); 219 setCaption( i18n("Set formatted name") );
210 QVBoxLayout* lay = new QVBoxLayout( this ); 220 Q3VBoxLayout* lay = new Q3VBoxLayout( this );
211 lay->setSpacing( 3 ); 221 lay->setSpacing( 3 );
212 lay->setMargin( 3 ); 222 lay->setMargin( 3 );
213 QLabel * lab = new QLabel( i18n("You can set the formatted name\nfor a list of contacts in one go."), this ); 223 QLabel * lab = new QLabel( i18n("You can set the formatted name\nfor a list of contacts in one go."), this );
214 lay->addWidget( lab ); 224 lay->addWidget( lab );
215 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("Set formatted name to:"), this ); 225 Q3ButtonGroup* format = new Q3ButtonGroup( 1, Qt::Horizontal, i18n("Set formatted name to:"), this );
216 lay->addWidget( format ); 226 lay->addWidget( format );
217 format->setExclusive ( true ) ; 227 format->setExclusive ( true ) ;
218 simple = new QRadioButton(i18n("Simple: James Bond"), format ); 228 simple = new QRadioButton(i18n("Simple: James Bond"), format );
219 full = new QRadioButton(i18n("Full: Mr. James 007 Bond I"), format ); 229 full = new QRadioButton(i18n("Full: Mr. James 007 Bond I"), format );
220 reverse = new QRadioButton(i18n("Reverse: Bond, James"), format ); 230 reverse = new QRadioButton(i18n("Reverse: Bond, James"), format );
221 company = new QRadioButton(i18n("Organization: MI6"), format ); 231 company = new QRadioButton(i18n("Organization: MI6"), format );
222 simple->setChecked( true ); 232 simple->setChecked( true );
223 setCompany = new QCheckBox(i18n("Set formatted name to\norganization, if name empty"), this); 233 setCompany = new QCheckBox(i18n("Set formatted name to\norganization, if name empty"), this);
224 lay->addWidget( setCompany ); 234 lay->addWidget( setCompany );
225 QPushButton * ok = new QPushButton( i18n("Select contact list"), this ); 235 QPushButton * ok = new QPushButton( i18n("Select contact list"), this );
226 lay->addWidget( ok ); 236 lay->addWidget( ok );
227 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 237 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
@@ -236,47 +246,47 @@ public:
236 QCheckBox* setCompany; 246 QCheckBox* setCompany;
237}; 247};
238 248
239 249
240 250
241class KAex2phonePrefs : public QDialog 251class KAex2phonePrefs : public QDialog
242{ 252{
243 public: 253 public:
244 KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) : 254 KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) :
245 QDialog( parent, name, true ) 255 QDialog( parent, name, true )
246 { 256 {
247 setCaption( i18n("Export to phone options") ); 257 setCaption( i18n("Export to phone options") );
248 QVBoxLayout* lay = new QVBoxLayout( this ); 258 Q3VBoxLayout* lay = new Q3VBoxLayout( this );
249 lay->setSpacing( 3 ); 259 lay->setSpacing( 3 );
250 lay->setMargin( 3 ); 260 lay->setMargin( 3 );
251 QLabel *lab; 261 QLabel *lab;
252 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); 262 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) );
253 lab->setAlignment (AlignHCenter ); 263 lab->setAlignment (Qt::AlignHCenter );
254 QHBox* temphb; 264 Q3HBox* temphb;
255 temphb = new QHBox( this ); 265 temphb = new Q3HBox( this );
256 new QLabel( i18n("I/O device: "), temphb ); 266 new QLabel( i18n("I/O device: "), temphb );
257 mPhoneDevice = new QLineEdit( temphb); 267 mPhoneDevice = new QLineEdit( temphb);
258 lay->addWidget( temphb ); 268 lay->addWidget( temphb );
259 temphb = new QHBox( this ); 269 temphb = new Q3HBox( this );
260 new QLabel( i18n("Connection: "), temphb ); 270 new QLabel( i18n("Connection: "), temphb );
261 mPhoneConnection = new QLineEdit( temphb); 271 mPhoneConnection = new QLineEdit( temphb);
262 lay->addWidget( temphb ); 272 lay->addWidget( temphb );
263 temphb = new QHBox( this ); 273 temphb = new Q3HBox( this );
264 new QLabel( i18n("Model(opt.): "), temphb ); 274 new QLabel( i18n("Model(opt.): "), temphb );
265 mPhoneModel = new QLineEdit( temphb); 275 mPhoneModel = new QLineEdit( temphb);
266 lay->addWidget( temphb ); 276 lay->addWidget( temphb );
267 // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this ); 277 // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this );
268 // lay->addWidget( mWriteToSim ); 278 // lay->addWidget( mWriteToSim );
269 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) ); 279 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) );
270 lab->setAlignment (AlignHCenter); 280 lab->setAlignment (Qt::AlignHCenter);
271 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); 281 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
272 lay->addWidget( ok ); 282 lay->addWidget( ok );
273 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 283 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
274 lay->addWidget( cancel ); 284 lay->addWidget( cancel );
275 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 285 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
276 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 286 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
277 resize( 220, 240 ); 287 resize( 220, 240 );
278 288
279 } 289 }
280 290
281public: 291public:
282 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; 292 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
@@ -398,41 +408,41 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const
398 createAddresseeEditorDialog( this ); 408 createAddresseeEditorDialog( this );
399 setModified( false ); 409 setModified( false );
400 mBRdisabled = false; 410 mBRdisabled = false;
401#ifndef DESKTOP_VERSION 411#ifndef DESKTOP_VERSION
402 infrared = 0; 412 infrared = 0;
403#endif 413#endif
404 //toggleBeamReceive( ); 414 //toggleBeamReceive( );
405 mMainWindow->toolBar()->show(); 415 mMainWindow->toolBar()->show();
406 // we have a toolbar repainting error on the Zaurus when starting KA/Pi 416 // we have a toolbar repainting error on the Zaurus when starting KA/Pi
407 //QTimer::singleShot( 10, this , SLOT ( updateToolBar())); 417 //QTimer::singleShot( 10, this , SLOT ( updateToolBar()));
408 QTimer::singleShot( 100, this, SLOT ( loadDataAfterStart() )); 418 QTimer::singleShot( 100, this, SLOT ( loadDataAfterStart() ));
409} 419}
410void KABCore::receiveStart( const QCString& cmsg, const QByteArray& data ) 420void KABCore::receiveStart( const Q3CString& cmsg, const QByteArray& data )
411{ 421{
412 //qDebug("KO: QCOP start message received: %s ", cmsg.data() ); 422 //qDebug("KO: QCOP start message received: %s ", cmsg.data() );
413 mCStringMess = cmsg; 423 mCStringMess = cmsg;
414 mByteData = data; 424 mByteData = data;
415} 425}
416 426
417void KABCore::loadDataAfterStart() 427void KABCore::loadDataAfterStart()
418{ 428{
419 //qDebug("KABCore::loadDataAfterStart() "); 429 //qDebug("KABCore::loadDataAfterStart() ");
420 ((StdAddressBook*)mAddressBook)->init( true ); 430 ((StdAddressBook*)mAddressBook)->init( true );
421 mViewManager->refreshView(); 431 mViewManager->refreshView();
422 432
423#ifndef DESKTOP_VERSION 433#ifndef DESKTOP_VERSION
424 disconnect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), this, SLOT (receiveStart ( const QCString &, const QByteArray & ))); 434 disconnect(qApp, SIGNAL (appMessage ( const Q3CString &, const QByteArray & )), this, SLOT (receiveStart ( const Q3CString &, const QByteArray & )));
425 435
426 QObject::connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 436 QObject::connect(qApp, SIGNAL (appMessage ( const Q3CString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const Q3CString &, const QByteArray & )));
427 if ( !mCStringMess.isEmpty() ) 437 if ( !mCStringMess.isEmpty() )
428 ExternalAppHandler::instance()->appMessage( mCStringMess, mByteData ); 438 ExternalAppHandler::instance()->appMessage( mCStringMess, mByteData );
429#endif 439#endif
430 // QTimer::singleShot( 10, this , SLOT ( updateToolBar())); 440 // QTimer::singleShot( 10, this , SLOT ( updateToolBar()));
431 setCaptionBack(); 441 setCaptionBack();
432} 442}
433void KABCore::updateToolBar() 443void KABCore::updateToolBar()
434{ 444{
435 static int iii = 0; 445 static int iii = 0;
436 ++iii; 446 ++iii;
437 mMainWindow->toolBar()->repaintMe(); 447 mMainWindow->toolBar()->repaintMe();
438 if ( iii < 4 ) 448 if ( iii < 4 )
@@ -444,52 +454,52 @@ KABCore::~KABCore()
444 //saveSettings(); 454 //saveSettings();
445 //KABPrefs::instance()->writeConfig(); 455 //KABPrefs::instance()->writeConfig();
446 delete AddresseeConfig::instance(); 456 delete AddresseeConfig::instance();
447 mAddressBook = 0; 457 mAddressBook = 0;
448 KABC::StdAddressBook::close(); 458 KABC::StdAddressBook::close();
449 459
450 delete syncManager; 460 delete syncManager;
451#ifndef DESKTOP_VERSION 461#ifndef DESKTOP_VERSION
452 if ( infrared ) 462 if ( infrared )
453 delete infrared; 463 delete infrared;
454#endif 464#endif
455} 465}
456void KABCore::receive( const QCString& cmsg, const QByteArray& data ) 466void KABCore::receive( const Q3CString& cmsg, const QByteArray& data )
457{ 467{
458 //qDebug("KA: QCOP message received: %s ", cmsg.data() ); 468 //qDebug("KA: QCOP message received: %s ", cmsg.data() );
459 if ( cmsg == "setDocument(QString)" ) { 469 if ( cmsg == "setDocument(QString)" ) {
460 QDataStream stream( data, IO_ReadOnly ); 470 QDataStream stream( const_cast<QByteArray*>(&data), QIODevice::ReadOnly );
461 QString fileName; 471 QString fileName;
462 stream >> fileName; 472 stream >> fileName;
463 recieve( fileName ); 473 recieve( fileName );
464 return; 474 return;
465 } 475 }
466} 476}
467void KABCore::toggleBeamReceive( ) 477void KABCore::toggleBeamReceive( )
468{ 478{
469 if ( mBRdisabled ) 479 if ( mBRdisabled )
470 return; 480 return;
471#ifndef DESKTOP_VERSION 481#ifndef DESKTOP_VERSION
472 if ( infrared ) { 482 if ( infrared ) {
473 qDebug("KA: AB disable BeamReceive "); 483 qDebug("KA: AB disable BeamReceive ");
474 delete infrared; 484 delete infrared;
475 infrared = 0; 485 infrared = 0;
476 mActionBR->setChecked(false); 486 mActionBR->setChecked(false);
477 return; 487 return;
478 } 488 }
479 qDebug("KA: AB enable BeamReceive "); 489 qDebug("KA: AB enable BeamReceive ");
480 mActionBR->setChecked(true); 490 mActionBR->setChecked(true);
481 491
482 infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ; 492 infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ;
483 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& ))); 493 QObject::connect( infrared, SIGNAL (received ( const Q3CString &, const QByteArray & )),this, SLOT(receive( const Q3CString&, const QByteArray& )));
484#endif 494#endif
485} 495}
486 496
487 497
488void KABCore::disableBR(bool b) 498void KABCore::disableBR(bool b)
489{ 499{
490#ifndef DESKTOP_VERSION 500#ifndef DESKTOP_VERSION
491 if ( b ) { 501 if ( b ) {
492 if ( infrared ) { 502 if ( infrared ) {
493 toggleBeamReceive( ); 503 toggleBeamReceive( );
494 } 504 }
495 mBRdisabled = true; 505 mBRdisabled = true;
@@ -551,25 +561,25 @@ void KABCore::restoreSettings()
551 mViewManager->restoreSettings(); 561 mViewManager->restoreSettings();
552 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); 562 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField );
553 mExtensionManager->restoreSettings(); 563 mExtensionManager->restoreSettings();
554#ifdef DESKTOP_VERSION 564#ifdef DESKTOP_VERSION
555 int wid = width(); 565 int wid = width();
556 if ( wid < 10 ) 566 if ( wid < 10 )
557 wid = 400; 567 wid = 400;
558#else 568#else
559 int wid = QApplication::desktop()->width(); 569 int wid = QApplication::desktop()->width();
560 if ( wid < 640 ) 570 if ( wid < 640 )
561 wid = QApplication::desktop()->height(); 571 wid = QApplication::desktop()->height();
562#endif 572#endif
563 QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; 573 Q3ValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter;
564 if ( true /*splitterSize.count() == 0*/ ) { 574 if ( true /*splitterSize.count() == 0*/ ) {
565 splitterSize.append( wid / 2 ); 575 splitterSize.append( wid / 2 );
566 splitterSize.append( wid / 2 ); 576 splitterSize.append( wid / 2 );
567 } 577 }
568 mMiniSplitter->setSizes( splitterSize ); 578 mMiniSplitter->setSizes( splitterSize );
569 if ( mExtensionBarSplitter ) { 579 if ( mExtensionBarSplitter ) {
570 //splitterSize = KABPrefs::instance()->mExtensionsSplitter; 580 //splitterSize = KABPrefs::instance()->mExtensionsSplitter;
571 if ( true /*splitterSize.count() == 0*/ ) { 581 if ( true /*splitterSize.count() == 0*/ ) {
572 splitterSize.append( wid / 2 ); 582 splitterSize.append( wid / 2 );
573 splitterSize.append( wid / 2 ); 583 splitterSize.append( wid / 2 );
574 } 584 }
575 mExtensionBarSplitter->setSizes( splitterSize ); 585 mExtensionBarSplitter->setSizes( splitterSize );
@@ -641,28 +651,28 @@ KABC::Field *KABCore::currentSearchField() const
641 return mIncSearchWidget->currentField(); 651 return mIncSearchWidget->currentField();
642 else 652 else
643 return 0; 653 return 0;
644} 654}
645 655
646QStringList KABCore::selectedUIDs() const 656QStringList KABCore::selectedUIDs() const
647{ 657{
648 return mViewManager->selectedUids(); 658 return mViewManager->selectedUids();
649} 659}
650 660
651KABC::Resource *KABCore::requestResource( QWidget *parent ) 661KABC::Resource *KABCore::requestResource( QWidget *parent )
652{ 662{
653 QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); 663 Q3PtrList<KABC::Resource> kabcResources = addressBook()->resources();
654 664
655 QPtrList<KRES::Resource> kresResources; 665 Q3PtrList<KRES::Resource> kresResources;
656 QPtrListIterator<KABC::Resource> resIt( kabcResources ); 666 Q3PtrListIterator<KABC::Resource> resIt( kabcResources );
657 KABC::Resource *resource; 667 KABC::Resource *resource;
658 while ( ( resource = resIt.current() ) != 0 ) { 668 while ( ( resource = resIt.current() ) != 0 ) {
659 ++resIt; 669 ++resIt;
660 if ( !resource->readOnly() ) { 670 if ( !resource->readOnly() ) {
661 KRES::Resource *res = static_cast<KRES::Resource*>( resource ); 671 KRES::Resource *res = static_cast<KRES::Resource*>( resource );
662 if ( res ) 672 if ( res )
663 kresResources.append( res ); 673 kresResources.append( res );
664 } 674 }
665 } 675 }
666 676
667 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); 677 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent );
668 return static_cast<KABC::Resource*>( res ); 678 return static_cast<KABC::Resource*>( res );
@@ -786,32 +796,32 @@ void KABCore::mailVCard( const QStringList& uids )
786 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { 796 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
787 KABC::Addressee a = mAddressBook->findByUid( *it ); 797 KABC::Addressee a = mAddressBook->findByUid( *it );
788 798
789 if ( a.isEmpty() ) 799 if ( a.isEmpty() )
790 continue; 800 continue;
791 801
792 QString name = a.givenName() + "_" + a.familyName() + ".vcf"; 802 QString name = a.givenName() + "_" + a.familyName() + ".vcf";
793 803
794 QString fileName = dirName + "/" + name; 804 QString fileName = dirName + "/" + name;
795 805
796 QFile outFile(fileName); 806 QFile outFile(fileName);
797 807
798 if ( outFile.open(IO_WriteOnly) ) { // file opened successfully 808 if ( outFile.open(QIODevice::WriteOnly) ) { // file opened successfully
799 KABC::VCardConverter converter; 809 KABC::VCardConverter converter;
800 QString vcard; 810 QString vcard;
801 811
802 converter.addresseeToVCard( a, vcard ); 812 converter.addresseeToVCard( a, vcard );
803 813
804 QTextStream t( &outFile ); // use a text stream 814 Q3TextStream t( &outFile ); // use a text stream
805 t.setEncoding( QTextStream::UnicodeUTF8 ); 815 t.setEncoding( Q3TextStream::UnicodeUTF8 );
806 t << vcard; 816 t << vcard;
807 817
808 outFile.close(); 818 outFile.close();
809 819
810 urls.append( fileName ); 820 urls.append( fileName );
811 } 821 }
812 } 822 }
813 823
814 bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") ); 824 bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") );
815 825
816 826
817/*US 827/*US
@@ -1007,29 +1017,29 @@ void KABCore::beamVCard(const QStringList& uids)
1007 if ( semi < dopp && semi >= 0 ) 1017 if ( semi < dopp && semi >= 0 )
1008 sep = semi ; 1018 sep = semi ;
1009 else 1019 else
1010 sep = dopp; 1020 sep = dopp;
1011 datastream +=vcard.mid( start, next - start); 1021 datastream +=vcard.mid( start, next - start);
1012 datastream +=vcard.mid( next+5,sep -next -5 ).upper(); 1022 datastream +=vcard.mid( next+5,sep -next -5 ).upper();
1013 start = sep; 1023 start = sep;
1014 } 1024 }
1015 datastream += vcard.mid( start,vcard.length() ); 1025 datastream += vcard.mid( start,vcard.length() );
1016 } 1026 }
1017#ifndef DESKTOP_VERSION 1027#ifndef DESKTOP_VERSION
1018 QFile outFile(fileName); 1028 QFile outFile(fileName);
1019 if ( outFile.open(IO_WriteOnly) ) { 1029 if ( outFile.open(QIODevice::WriteOnly) ) {
1020 datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); 1030 datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" );
1021 QTextStream t( &outFile ); // use a text stream 1031 Q3TextStream t( &outFile ); // use a text stream
1022 //t.setEncoding( QTextStream::UnicodeUTF8 ); 1032 //t.setEncoding( QTextStream::UnicodeUTF8 );
1023 t.setEncoding( QTextStream::Latin1 ); 1033 t.setEncoding( Q3TextStream::Latin1 );
1024 t <<datastream.latin1(); 1034 t <<datastream.latin1();
1025 outFile.close(); 1035 outFile.close();
1026 Ir *ir = new Ir( this ); 1036 Ir *ir = new Ir( this );
1027 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); 1037 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) );
1028 ir->send( fileName, description, "text/x-vCard" ); 1038 ir->send( fileName, description, "text/x-vCard" );
1029 } else { 1039 } else {
1030 qDebug("KA: Error open temp beam file "); 1040 qDebug("KA: Error open temp beam file ");
1031 return; 1041 return;
1032 } 1042 }
1033#endif 1043#endif
1034 1044
1035} 1045}
@@ -1288,28 +1298,28 @@ void KABCore::addrModified( const KABC::Addressee &addr ,bool updateDetails )
1288 1298
1289 UndoStack::instance()->push( command ); 1299 UndoStack::instance()->push( command );
1290 RedoStack::instance()->clear(); 1300 RedoStack::instance()->clear();
1291 if ( updateDetails ) 1301 if ( updateDetails )
1292 mDetails->setAddressee( addr ); 1302 mDetails->setAddressee( addr );
1293 setModified( true ); 1303 setModified( true );
1294} 1304}
1295 1305
1296void KABCore::newContact() 1306void KABCore::newContact()
1297{ 1307{
1298 1308
1299 1309
1300 QPtrList<KABC::Resource> kabcResources = mAddressBook->resources(); 1310 Q3PtrList<KABC::Resource> kabcResources = mAddressBook->resources();
1301 1311
1302 QPtrList<KRES::Resource> kresResources; 1312 Q3PtrList<KRES::Resource> kresResources;
1303 QPtrListIterator<KABC::Resource> it( kabcResources ); 1313 Q3PtrListIterator<KABC::Resource> it( kabcResources );
1304 KABC::Resource *resource; 1314 KABC::Resource *resource;
1305 while ( ( resource = it.current() ) != 0 ) { 1315 while ( ( resource = it.current() ) != 0 ) {
1306 ++it; 1316 ++it;
1307 if ( !resource->readOnly() ) { 1317 if ( !resource->readOnly() ) {
1308 KRES::Resource *res = static_cast<KRES::Resource*>( resource ); 1318 KRES::Resource *res = static_cast<KRES::Resource*>( resource );
1309 if ( res ) 1319 if ( res )
1310 kresResources.append( res ); 1320 kresResources.append( res );
1311 } 1321 }
1312 } 1322 }
1313 1323
1314 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); 1324 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this );
1315 resource = static_cast<KABC::Resource*>( res ); 1325 resource = static_cast<KABC::Resource*>( res );
@@ -1847,98 +1857,98 @@ AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent,
1847 1857
1848 return mEditorDialog; 1858 return mEditorDialog;
1849} 1859}
1850 1860
1851void KABCore::slotEditorDestroyed( const QString &uid ) 1861void KABCore::slotEditorDestroyed( const QString &uid )
1852{ 1862{
1853 //mEditorDict.remove( uid ); 1863 //mEditorDict.remove( uid );
1854} 1864}
1855 1865
1856void KABCore::initGUI() 1866void KABCore::initGUI()
1857{ 1867{
1858#ifndef KAB_EMBEDDED 1868#ifndef KAB_EMBEDDED
1859 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1869 Q3HBoxLayout *topLayout = new Q3HBoxLayout( this );
1860 topLayout->setSpacing( KDialogBase::spacingHint() ); 1870 topLayout->setSpacing( KDialogBase::spacingHint() );
1861 1871
1862 mExtensionBarSplitter = new QSplitter( this ); 1872 mExtensionBarSplitter = new QSplitter( this );
1863 mExtensionBarSplitter->setOrientation( Qt::Vertical ); 1873 mExtensionBarSplitter->setOrientation( Qt::Vertical );
1864 1874
1865 mDetailsSplitter = new QSplitter( mExtensionBarSplitter ); 1875 mDetailsSplitter = new QSplitter( mExtensionBarSplitter );
1866 1876
1867 QVBox *viewSpace = new QVBox( mDetailsSplitter ); 1877 Q3VBox *viewSpace = new Q3VBox( mDetailsSplitter );
1868 mIncSearchWidget = new IncSearchWidget( viewSpace ); 1878 mIncSearchWidget = new IncSearchWidget( viewSpace );
1869 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1879 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1870 SLOT( incrementalSearch( const QString& ) ) ); 1880 SLOT( incrementalSearch( const QString& ) ) );
1871 1881
1872 mViewManager = new ViewManager( this, viewSpace ); 1882 mViewManager = new ViewManager( this, viewSpace );
1873 viewSpace->setStretchFactor( mViewManager, 1 ); 1883 viewSpace->setStretchFactor( mViewManager, 1 );
1874 1884
1875 mDetails = new ViewContainer( mDetailsSplitter ); 1885 mDetails = new ViewContainer( mDetailsSplitter );
1876 1886
1877 mJumpButtonBar = new JumpButtonBar( this, this ); 1887 mJumpButtonBar = new JumpButtonBar( this, this );
1878 1888
1879 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); 1889 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter );
1880 1890
1881 topLayout->addWidget( mExtensionBarSplitter ); 1891 topLayout->addWidget( mExtensionBarSplitter );
1882 topLayout->setStretchFactor( mExtensionBarSplitter, 100 ); 1892 topLayout->setStretchFactor( mExtensionBarSplitter, 100 );
1883 topLayout->addWidget( mJumpButtonBar ); 1893 topLayout->addWidget( mJumpButtonBar );
1884 //topLayout->setStretchFactor( mJumpButtonBar, 1 ); 1894 //topLayout->setStretchFactor( mJumpButtonBar, 1 );
1885 1895
1886 mXXPortManager = new XXPortManager( this, this ); 1896 mXXPortManager = new XXPortManager( this, this );
1887 1897
1888#else //KAB_EMBEDDED 1898#else //KAB_EMBEDDED
1889 //US initialize viewMenu before settingup viewmanager. 1899 //US initialize viewMenu before settingup viewmanager.
1890 // Viewmanager needs this menu to plugin submenues. 1900 // Viewmanager needs this menu to plugin submenues.
1891 viewMenu = new QPopupMenu( this ); 1901 viewMenu = new Q3PopupMenu( this );
1892 settingsMenu = new QPopupMenu( this ); 1902 settingsMenu = new Q3PopupMenu( this );
1893 //filterMenu = new QPopupMenu( this ); 1903 //filterMenu = new QPopupMenu( this );
1894 ImportMenu = new QPopupMenu( this ); 1904 ImportMenu = new Q3PopupMenu( this );
1895 ExportMenu = new QPopupMenu( this ); 1905 ExportMenu = new Q3PopupMenu( this );
1896 syncMenu = new QPopupMenu( this ); 1906 syncMenu = new Q3PopupMenu( this );
1897 changeMenu= new QPopupMenu( this ); 1907 changeMenu= new Q3PopupMenu( this );
1898 beamMenu= new QPopupMenu( this ); 1908 beamMenu= new Q3PopupMenu( this );
1899 1909
1900//US since we have no splitter for the embedded system, setup 1910//US since we have no splitter for the embedded system, setup
1901// a layout with two frames. One left and one right. 1911// a layout with two frames. One left and one right.
1902 1912
1903 QBoxLayout *topLayout; 1913 Q3BoxLayout *topLayout;
1904 1914
1905 // = new QHBoxLayout( this ); 1915 // = new QHBoxLayout( this );
1906// QBoxLayout *topLayout = (QBoxLayout*)layout(); 1916// QBoxLayout *topLayout = (QBoxLayout*)layout();
1907 1917
1908// QWidget *mainBox = new QWidget( this ); 1918// QWidget *mainBox = new QWidget( this );
1909// QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); 1919// QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox);
1910 1920
1911#ifdef DESKTOP_VERSION 1921#ifdef DESKTOP_VERSION
1912 topLayout = new QHBoxLayout( this ); 1922 topLayout = new Q3HBoxLayout( this );
1913 1923
1914 1924
1915 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 1925 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
1916 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 1926 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
1917 1927
1918 topLayout->addWidget(mMiniSplitter ); 1928 topLayout->addWidget(mMiniSplitter );
1919 1929
1920 mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); 1930 mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter );
1921 mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); 1931 mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
1922 mViewManager = new ViewManager( this, mExtensionBarSplitter ); 1932 mViewManager = new ViewManager( this, mExtensionBarSplitter );
1923 mDetails = new ViewContainer( mMiniSplitter ); 1933 mDetails = new ViewContainer( mMiniSplitter );
1924 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); 1934 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter );
1925#else 1935#else
1926 if ( QApplication::desktop()->width() > 480 ) { 1936 if ( QApplication::desktop()->width() > 480 ) {
1927 topLayout = new QHBoxLayout( this ); 1937 topLayout = new Q3HBoxLayout( this );
1928 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 1938 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
1929 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 1939 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
1930 } else { 1940 } else {
1931 1941
1932 topLayout = new QHBoxLayout( this ); 1942 topLayout = new Q3HBoxLayout( this );
1933 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); 1943 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this);
1934 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); 1944 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
1935 } 1945 }
1936 1946
1937 topLayout->addWidget(mMiniSplitter ); 1947 topLayout->addWidget(mMiniSplitter );
1938 mViewManager = new ViewManager( this, mMiniSplitter ); 1948 mViewManager = new ViewManager( this, mMiniSplitter );
1939 mDetails = new ViewContainer( mMiniSplitter ); 1949 mDetails = new ViewContainer( mMiniSplitter );
1940 1950
1941 1951
1942 mExtensionManager = new ExtensionManager( this, mMiniSplitter ); 1952 mExtensionManager = new ExtensionManager( this, mMiniSplitter );
1943#endif 1953#endif
1944 //eh->hide(); 1954 //eh->hide();
@@ -2025,35 +2035,35 @@ void KABCore::initActions()
2025{ 2035{
2026//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); 2036//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
2027 2037
2028#ifndef KAB_EMBEDDED 2038#ifndef KAB_EMBEDDED
2029 connect( QApplication::clipboard(), SIGNAL( dataChanged() ), 2039 connect( QApplication::clipboard(), SIGNAL( dataChanged() ),
2030 SLOT( clipboardDataChanged() ) ); 2040 SLOT( clipboardDataChanged() ) );
2031#endif //KAB_EMBEDDED 2041#endif //KAB_EMBEDDED
2032 2042
2033 // file menu 2043 // file menu
2034 2044
2035 mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); 2045 mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() );
2036 //mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); 2046 //mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() );
2037 mActionPrint = new KAction( i18n( "&Print View" ), "fileprint", CTRL + Key_P, mViewManager, 2047 mActionPrint = new KAction( i18n( "&Print View" ), "fileprint", Qt::CTRL + Qt::Key_P, mViewManager,
2038 SLOT( printView() ), actionCollection(), "kaddressbook_print" ); 2048 SLOT( printView() ), actionCollection(), "kaddressbook_print" );
2039 2049
2040 2050
2041 mActionPrintDetails = new KAction( i18n( "&Print Details" ), "fileprint", 0, mDetails, 2051 mActionPrintDetails = new KAction( i18n( "&Print Details" ), "fileprint", 0, mDetails,
2042 SLOT( printView() ), actionCollection(), "kaddressbook_print2" ); 2052 SLOT( printView() ), actionCollection(), "kaddressbook_print2" );
2043 2053
2044 mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, 2054 mActionSave = new KAction( i18n( "&Save" ), "filesave", Qt::CTRL+Qt::Key_S, this,
2045 SLOT( save() ), actionCollection(), "file_sync" ); 2055 SLOT( save() ), actionCollection(), "file_sync" );
2046 2056
2047 mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, 2057 mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", Qt::CTRL+Qt::Key_N, this,
2048 SLOT( newContact() ), actionCollection(), "file_new_contact" ); 2058 SLOT( newContact() ), actionCollection(), "file_new_contact" );
2049 2059
2050 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, 2060 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0,
2051 this, SLOT( mailVCard() ), 2061 this, SLOT( mailVCard() ),
2052 actionCollection(), "file_mail_vcard"); 2062 actionCollection(), "file_mail_vcard");
2053 2063
2054 mActionExport2phone = new KAction( i18n( "Export to phone" ), "ex2phone", 0, this, 2064 mActionExport2phone = new KAction( i18n( "Export to phone" ), "ex2phone", 0, this,
2055 SLOT( export2phone() ), actionCollection(), 2065 SLOT( export2phone() ), actionCollection(),
2056 "kaddressbook_ex2phone" ); 2066 "kaddressbook_ex2phone" );
2057 2067
2058 mActionBeamVCard = 0; 2068 mActionBeamVCard = 0;
2059 mActionBeam = 0; 2069 mActionBeam = 0;
@@ -2074,53 +2084,53 @@ void KABCore::initActions()
2074 this, SLOT( editContact2() ), 2084 this, SLOT( editContact2() ),
2075 actionCollection(), "file_properties" ); 2085 actionCollection(), "file_properties" );
2076 2086
2077#ifdef KAB_EMBEDDED 2087#ifdef KAB_EMBEDDED
2078 // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); 2088 // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() );
2079 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, 2089 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0,
2080 mMainWindow, SLOT( exit() ), 2090 mMainWindow, SLOT( exit() ),
2081 actionCollection(), "quit" ); 2091 actionCollection(), "quit" );
2082#endif //KAB_EMBEDDED 2092#endif //KAB_EMBEDDED
2083 2093
2084 // edit menu 2094 // edit menu
2085 if ( mIsPart ) { 2095 if ( mIsPart ) {
2086 mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, 2096 mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", Qt::CTRL + Qt::Key_C, this,
2087 SLOT( copyContacts() ), actionCollection(), 2097 SLOT( copyContacts() ), actionCollection(),
2088 "kaddressbook_copy" ); 2098 "kaddressbook_copy" );
2089 mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, 2099 mActionCut = new KAction( i18n( "Cu&t" ), "editcut", Qt::CTRL + Qt::Key_X, this,
2090 SLOT( cutContacts() ), actionCollection(), 2100 SLOT( cutContacts() ), actionCollection(),
2091 "kaddressbook_cut" ); 2101 "kaddressbook_cut" );
2092 mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, 2102 mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", Qt::CTRL + Qt::Key_V, this,
2093 SLOT( pasteContacts() ), actionCollection(), 2103 SLOT( pasteContacts() ), actionCollection(),
2094 "kaddressbook_paste" ); 2104 "kaddressbook_paste" );
2095 mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, 2105 mActionSelectAll = new KAction( i18n( "Select &All" ), Qt::CTRL + Qt::Key_A, this,
2096 SLOT( selectAllContacts() ), actionCollection(), 2106 SLOT( selectAllContacts() ), actionCollection(),
2097 "kaddressbook_select_all" ); 2107 "kaddressbook_select_all" );
2098 mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, 2108 mActionUndo = new KAction( i18n( "&Undo" ), "undo", Qt::CTRL + Qt::Key_Z, this,
2099 SLOT( undo() ), actionCollection(), 2109 SLOT( undo() ), actionCollection(),
2100 "kaddressbook_undo" ); 2110 "kaddressbook_undo" );
2101 mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, 2111 mActionRedo = new KAction( i18n( "Re&do" ), "redo", Qt::CTRL + Qt::SHIFT + Qt::Key_Z,
2102 this, SLOT( redo() ), actionCollection(), 2112 this, SLOT( redo() ), actionCollection(),
2103 "kaddressbook_redo" ); 2113 "kaddressbook_redo" );
2104 } else { 2114 } else {
2105 mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); 2115 mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() );
2106 mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); 2116 mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() );
2107 mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); 2117 mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() );
2108 mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); 2118 mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() );
2109 mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); 2119 mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() );
2110 mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); 2120 mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() );
2111 } 2121 }
2112 2122
2113 mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", 2123 mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete",
2114 Key_Delete, this, SLOT( deleteContacts() ), 2124 Qt::Key_Delete, this, SLOT( deleteContacts() ),
2115 actionCollection(), "edit_delete" ); 2125 actionCollection(), "edit_delete" );
2116 2126
2117 mActionUndo->setEnabled( false ); 2127 mActionUndo->setEnabled( false );
2118 mActionRedo->setEnabled( false ); 2128 mActionRedo->setEnabled( false );
2119 2129
2120 // settings menu 2130 // settings menu
2121#ifdef KAB_EMBEDDED 2131#ifdef KAB_EMBEDDED
2122//US special menuentry to configure the addressbook resources. On KDE 2132//US special menuentry to configure the addressbook resources. On KDE
2123// you do that through the control center !!! 2133// you do that through the control center !!!
2124 mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, 2134 mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this,
2125 SLOT( configureResources() ), actionCollection(), 2135 SLOT( configureResources() ), actionCollection(),
2126 "kaddressbook_configure_resources" ); 2136 "kaddressbook_configure_resources" );
@@ -2237,27 +2247,27 @@ void KABCore::initActions()
2237 clipboardDataChanged(); 2247 clipboardDataChanged();
2238 connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); 2248 connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
2239 connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); 2249 connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
2240} 2250}
2241 2251
2242//US we need this function, to plug all actions into the correct menues. 2252//US we need this function, to plug all actions into the correct menues.
2243// KDE uses a XML format to plug the actions, but we work her without this overhead. 2253// KDE uses a XML format to plug the actions, but we work her without this overhead.
2244void KABCore::addActionsManually() 2254void KABCore::addActionsManually()
2245{ 2255{
2246//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); 2256//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
2247 2257
2248#ifdef KAB_EMBEDDED 2258#ifdef KAB_EMBEDDED
2249 QPopupMenu *fileMenu = new QPopupMenu( this ); 2259 Q3PopupMenu *fileMenu = new Q3PopupMenu( this );
2250 QPopupMenu *editMenu = new QPopupMenu( this ); 2260 Q3PopupMenu *editMenu = new Q3PopupMenu( this );
2251 QPopupMenu *helpMenu = new QPopupMenu( this ); 2261 Q3PopupMenu *helpMenu = new Q3PopupMenu( this );
2252 2262
2253 KToolBar* tb = mMainWindow->toolBar(); 2263 KToolBar* tb = mMainWindow->toolBar();
2254 mMainWindow->setToolBarsMovable (false ); 2264 mMainWindow->setToolBarsMovable (false );
2255#ifndef DESKTOP_VERSION 2265#ifndef DESKTOP_VERSION
2256 if ( KABPrefs::instance()->mFullMenuBarVisible ) { 2266 if ( KABPrefs::instance()->mFullMenuBarVisible ) {
2257#endif 2267#endif
2258 QMenuBar* mb = mMainWindow->menuBar(); 2268 QMenuBar* mb = mMainWindow->menuBar();
2259 2269
2260 //US setup menubar. 2270 //US setup menubar.
2261 //Disable the following block if you do not want to have a menubar. 2271 //Disable the following block if you do not want to have a menubar.
2262 mb->insertItem( i18n("&File"), fileMenu ); 2272 mb->insertItem( i18n("&File"), fileMenu );
2263 mb->insertItem( i18n("&Edit"), editMenu ); 2273 mb->insertItem( i18n("&Edit"), editMenu );
@@ -2267,25 +2277,25 @@ void KABCore::addActionsManually()
2267 mb->insertItem( i18n("Synchronize"), syncMenu ); 2277 mb->insertItem( i18n("Synchronize"), syncMenu );
2268#else 2278#else
2269 mb->insertItem( i18n("Sync"), syncMenu ); 2279 mb->insertItem( i18n("Sync"), syncMenu );
2270#endif 2280#endif
2271 //mb->insertItem( i18n("&Change"), changeMenu ); 2281 //mb->insertItem( i18n("&Change"), changeMenu );
2272 mb->insertItem( i18n("&Help"), helpMenu ); 2282 mb->insertItem( i18n("&Help"), helpMenu );
2273 mIncSearchWidget = new IncSearchWidget( tb ); 2283 mIncSearchWidget = new IncSearchWidget( tb );
2274 // tb->insertWidget(-1, 0, mIncSearchWidget); 2284 // tb->insertWidget(-1, 0, mIncSearchWidget);
2275#ifndef DESKTOP_VERSION 2285#ifndef DESKTOP_VERSION
2276 } else { 2286 } else {
2277 //US setup toolbar 2287 //US setup toolbar
2278 QPEMenuBar *menuBarTB = new QPEMenuBar( tb ); 2288 QPEMenuBar *menuBarTB = new QPEMenuBar( tb );
2279 QPopupMenu *popupBarTB = new QPopupMenu( this ); 2289 Q3PopupMenu *popupBarTB = new Q3PopupMenu( this );
2280 menuBarTB->insertItem( SmallIcon( "z_menu" ) , popupBarTB); 2290 menuBarTB->insertItem( SmallIcon( "z_menu" ) , popupBarTB);
2281 tb->insertWidget(-1, 0, menuBarTB); 2291 tb->insertWidget(-1, 0, menuBarTB);
2282 mIncSearchWidget = new IncSearchWidget( tb ); 2292 mIncSearchWidget = new IncSearchWidget( tb );
2283 tb->enableMoving(false); 2293 tb->enableMoving(false);
2284 popupBarTB->insertItem( i18n("&File"), fileMenu ); 2294 popupBarTB->insertItem( i18n("&File"), fileMenu );
2285 popupBarTB->insertItem( i18n("&Edit"), editMenu ); 2295 popupBarTB->insertItem( i18n("&Edit"), editMenu );
2286 popupBarTB->insertItem( i18n("&View"), viewMenu ); 2296 popupBarTB->insertItem( i18n("&View"), viewMenu );
2287 popupBarTB->insertItem( i18n("&Settings"), settingsMenu ); 2297 popupBarTB->insertItem( i18n("&Settings"), settingsMenu );
2288 popupBarTB->insertItem( i18n("Synchronize"), syncMenu ); 2298 popupBarTB->insertItem( i18n("Synchronize"), syncMenu );
2289 mViewManager->getFilterAction()->plug ( popupBarTB); 2299 mViewManager->getFilterAction()->plug ( popupBarTB);
2290 //popupBarTB->insertItem( i18n("&Change selected"), changeMenu ); 2300 //popupBarTB->insertItem( i18n("&Change selected"), changeMenu );
2291 popupBarTB->insertItem( i18n("&Help"), helpMenu ); 2301 popupBarTB->insertItem( i18n("&Help"), helpMenu );
@@ -2622,25 +2632,25 @@ void KABCore::updateActionMenu()
2622void KABCore::configureKeyBindings() 2632void KABCore::configureKeyBindings()
2623{ 2633{
2624#ifndef KAB_EMBEDDED 2634#ifndef KAB_EMBEDDED
2625 KKeyDialog::configure( actionCollection(), true ); 2635 KKeyDialog::configure( actionCollection(), true );
2626#else //KAB_EMBEDDED 2636#else //KAB_EMBEDDED
2627 qDebug("KABCore::configureKeyBindings() not implemented"); 2637 qDebug("KABCore::configureKeyBindings() not implemented");
2628#endif //KAB_EMBEDDED 2638#endif //KAB_EMBEDDED
2629} 2639}
2630 2640
2631#ifdef KAB_EMBEDDED 2641#ifdef KAB_EMBEDDED
2632void KABCore::configureResources() 2642void KABCore::configureResources()
2633{ 2643{
2634 KRES::KCMKResources dlg( this, "" , 0 ); 2644 KRES::KCMKResources dlg( this, "" , QStringList() );
2635 2645
2636 if ( !dlg.exec() ) 2646 if ( !dlg.exec() )
2637 return; 2647 return;
2638 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); 2648 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") );
2639} 2649}
2640#endif //KAB_EMBEDDED 2650#endif //KAB_EMBEDDED
2641 2651
2642 2652
2643/* this method will be called through the QCop interface from Ko/Pi to select addresses 2653/* this method will be called through the QCop interface from Ko/Pi to select addresses
2644 * for the attendees list of an event. 2654 * for the attendees list of an event.
2645 */ 2655 */
2646void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) 2656void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid)
@@ -2718,25 +2728,25 @@ void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString
2718 QStringList anniversaryList; 2728 QStringList anniversaryList;
2719 QStringList realNameList; 2729 QStringList realNameList;
2720 QStringList preferredEmailList; 2730 QStringList preferredEmailList;
2721 QStringList assembledNameList; 2731 QStringList assembledNameList;
2722 QStringList uidList; 2732 QStringList uidList;
2723 2733
2724 KABC::AddressBook::Iterator it; 2734 KABC::AddressBook::Iterator it;
2725 2735
2726 int count = 0; 2736 int count = 0;
2727 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 2737 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2728 ++count; 2738 ++count;
2729 } 2739 }
2730 QProgressBar bar(count,0 ); 2740 Q3ProgressBar bar(count,0 );
2731 int w = 300; 2741 int w = 300;
2732 if ( QApplication::desktop()->width() < 320 ) 2742 if ( QApplication::desktop()->width() < 320 )
2733 w = 220; 2743 w = 220;
2734 int h = bar.sizeHint().height() ; 2744 int h = bar.sizeHint().height() ;
2735 int dw = QApplication::desktop()->width(); 2745 int dw = QApplication::desktop()->width();
2736 int dh = QApplication::desktop()->height(); 2746 int dh = QApplication::desktop()->height();
2737 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2747 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2738 bar.show(); 2748 bar.show();
2739 bar.setCaption (i18n("Collecting birthdays - close to abort!") ); 2749 bar.setCaption (i18n("Collecting birthdays - close to abort!") );
2740 qApp->processEvents(); 2750 qApp->processEvents();
2741 2751
2742 QDate bday; 2752 QDate bday;
@@ -2899,25 +2909,25 @@ KABC::Addressee KABCore::getLastSyncAddressee()
2899 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); 2909 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice();
2900 2910
2901 //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); 2911 //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() );
2902 lse = mAddressBook->findByUid( "last-syncAddressee-"+mCurrentSyncDevice ); 2912 lse = mAddressBook->findByUid( "last-syncAddressee-"+mCurrentSyncDevice );
2903 if (lse.isEmpty()) { 2913 if (lse.isEmpty()) {
2904 qDebug("KA: Creating new last-syncAddressee "); 2914 qDebug("KA: Creating new last-syncAddressee ");
2905 lse.setUid( "last-syncAddressee-"+mCurrentSyncDevice ); 2915 lse.setUid( "last-syncAddressee-"+mCurrentSyncDevice );
2906 QString sum = ""; 2916 QString sum = "";
2907 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) 2917 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL )
2908 sum = "E: "; 2918 sum = "E: ";
2909 lse.setFamilyName("!"+sum+mCurrentSyncDevice + i18n(" - sync event")); 2919 lse.setFamilyName("!"+sum+mCurrentSyncDevice + i18n(" - sync event"));
2910 lse.setRevision( mLastAddressbookSync ); 2920 lse.setRevision( mLastAddressbookSync );
2911 lse.setCategories( i18n("SyncEvent") ); 2921 lse.setCategories( QStringList(i18n("SyncEvent")) );
2912 mAddressBook->insertAddressee( lse ); 2922 mAddressBook->insertAddressee( lse );
2913 } 2923 }
2914 return lse; 2924 return lse;
2915} 2925}
2916int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ) 2926int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full )
2917{ 2927{
2918 2928
2919 //void setZaurusId(int id); 2929 //void setZaurusId(int id);
2920 // int zaurusId() const; 2930 // int zaurusId() const;
2921 // void setZaurusUid(int id); 2931 // void setZaurusUid(int id);
2922 // int zaurusUid() const; 2932 // int zaurusUid() const;
2923 // void setZaurusStat(int id); 2933 // void setZaurusStat(int id);
@@ -3090,25 +3100,25 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo
3090 3100
3091 } else { 3101 } else {
3092 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 3102 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
3093 addresseeRSync = addresseeLSync ; 3103 addresseeRSync = addresseeLSync ;
3094 } else { 3104 } else {
3095 //qDebug("FULLDATE 1"); 3105 //qDebug("FULLDATE 1");
3096 fullDateRange = true; 3106 fullDateRange = true;
3097 Addressee newAdd; 3107 Addressee newAdd;
3098 addresseeRSync = newAdd; 3108 addresseeRSync = newAdd;
3099 addresseeRSync.setFamilyName(mCurrentSyncName + i18n(" - sync addressee")); 3109 addresseeRSync.setFamilyName(mCurrentSyncName + i18n(" - sync addressee"));
3100 addresseeRSync.setUid("last-syncAddressee-"+mCurrentSyncName ); 3110 addresseeRSync.setUid("last-syncAddressee-"+mCurrentSyncName );
3101 addresseeRSync.setRevision( mLastAddressbookSync ); 3111 addresseeRSync.setRevision( mLastAddressbookSync );
3102 addresseeRSync.setCategories( i18n("SyncAddressee") ); 3112 addresseeRSync.setCategories( QStringList(i18n("SyncAddressee")) );
3103 } 3113 }
3104 } 3114 }
3105 if ( addresseeLSync.revision() == mLastAddressbookSync ) { 3115 if ( addresseeLSync.revision() == mLastAddressbookSync ) {
3106 // qDebug("FULLDATE 2"); 3116 // qDebug("FULLDATE 2");
3107 fullDateRange = true; 3117 fullDateRange = true;
3108 } 3118 }
3109 if ( ! fullDateRange ) { 3119 if ( ! fullDateRange ) {
3110 if ( addresseeLSync.revision() != addresseeRSync.revision() ) { 3120 if ( addresseeLSync.revision() != addresseeRSync.revision() ) {
3111 3121
3112 // qDebug("set fulldate to true %s %s" ,addresseeLSync->dtStart().toString().latin1(), addresseeRSync->dtStart().toString().latin1() ); 3122 // qDebug("set fulldate to true %s %s" ,addresseeLSync->dtStart().toString().latin1(), addresseeRSync->dtStart().toString().latin1() );
3113 //qDebug("%d %d %d %d ", addresseeLSync->dtStart().time().second(), addresseeLSync->dtStart().time().msec() , addresseeRSync->dtStart().time().second(), addresseeRSync->dtStart().time().msec()); 3123 //qDebug("%d %d %d %d ", addresseeLSync->dtStart().time().second(), addresseeLSync->dtStart().time().msec() , addresseeRSync->dtStart().time().second(), addresseeRSync->dtStart().time().msec());
3114 fullDateRange = true; 3124 fullDateRange = true;