summaryrefslogtreecommitdiffabout
path: root/kaddressbook
authorzautrix <zautrix>2004-12-05 12:12:10 (UTC)
committer zautrix <zautrix>2004-12-05 12:12:10 (UTC)
commit5ab47964d8b52897bb0662ef4a5fcf9604acaf6c (patch) (unidiff)
tree0f80433206ddd6b4ef901cb346d0f06caf76b20f /kaddressbook
parent196365e533c6fd1a8f47aa9579763ef5afcebcda (diff)
downloadkdepimpi-5ab47964d8b52897bb0662ef4a5fcf9604acaf6c.zip
kdepimpi-5ab47964d8b52897bb0662ef4a5fcf9604acaf6c.tar.gz
kdepimpi-5ab47964d8b52897bb0662ef4a5fcf9604acaf6c.tar.bz2
fixed kapi toolbar repaint problem
Diffstat (limited to 'kaddressbook') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 76f9ab6..15cab73 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -170,392 +170,396 @@ class KABCatPrefs : public QDialog
170 KABCatPrefs( QWidget *parent=0, const char *name=0 ) : 170 KABCatPrefs( QWidget *parent=0, const char *name=0 ) :
171 QDialog( parent, name, true ) 171 QDialog( parent, name, true )
172 { 172 {
173 setCaption( i18n("Manage new Categories") ); 173 setCaption( i18n("Manage new Categories") );
174 QVBoxLayout* lay = new QVBoxLayout( this ); 174 QVBoxLayout* lay = new QVBoxLayout( this );
175 lay->setSpacing( 3 ); 175 lay->setSpacing( 3 );
176 lay->setMargin( 3 ); 176 lay->setMargin( 3 );
177 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 ); 177 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 );
178 lay->addWidget( lab ); 178 lay->addWidget( lab );
179 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); 179 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this );
180 lay->addWidget( format ); 180 lay->addWidget( format );
181 format->setExclusive ( true ) ; 181 format->setExclusive ( true ) ;
182 addCatBut = new QRadioButton(i18n("Add to category list"), format ); 182 addCatBut = new QRadioButton(i18n("Add to category list"), format );
183 new QRadioButton(i18n("Remove from addressees"), format ); 183 new QRadioButton(i18n("Remove from addressees"), format );
184 addCatBut->setChecked( true ); 184 addCatBut->setChecked( true );
185 QPushButton * ok = new QPushButton( i18n("OK"), this ); 185 QPushButton * ok = new QPushButton( i18n("OK"), this );
186 lay->addWidget( ok ); 186 lay->addWidget( ok );
187 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 187 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
188 lay->addWidget( cancel ); 188 lay->addWidget( cancel );
189 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 189 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
190 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 190 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
191 resize( 200, 200 ); 191 resize( 200, 200 );
192 } 192 }
193 193
194 bool addCat() { return addCatBut->isChecked(); } 194 bool addCat() { return addCatBut->isChecked(); }
195private: 195private:
196 QRadioButton* addCatBut; 196 QRadioButton* addCatBut;
197}; 197};
198 198
199 199
200 200
201class KAex2phonePrefs : public QDialog 201class KAex2phonePrefs : public QDialog
202{ 202{
203 public: 203 public:
204 KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) : 204 KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) :
205 QDialog( parent, name, true ) 205 QDialog( parent, name, true )
206 { 206 {
207 setCaption( i18n("Export to phone options") ); 207 setCaption( i18n("Export to phone options") );
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; 211 QLabel *lab;
212 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); 212 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) );
213 lab->setAlignment (AlignHCenter ); 213 lab->setAlignment (AlignHCenter );
214 QHBox* temphb; 214 QHBox* temphb;
215 temphb = new QHBox( this ); 215 temphb = new QHBox( this );
216 new QLabel( i18n("I/O device: "), temphb ); 216 new QLabel( i18n("I/O device: "), temphb );
217 mPhoneDevice = new QLineEdit( temphb); 217 mPhoneDevice = new QLineEdit( temphb);
218 lay->addWidget( temphb ); 218 lay->addWidget( temphb );
219 temphb = new QHBox( this ); 219 temphb = new QHBox( this );
220 new QLabel( i18n("Connection: "), temphb ); 220 new QLabel( i18n("Connection: "), temphb );
221 mPhoneConnection = new QLineEdit( temphb); 221 mPhoneConnection = new QLineEdit( temphb);
222 lay->addWidget( temphb ); 222 lay->addWidget( temphb );
223 temphb = new QHBox( this ); 223 temphb = new QHBox( this );
224 new QLabel( i18n("Model(opt.): "), temphb ); 224 new QLabel( i18n("Model(opt.): "), temphb );
225 mPhoneModel = new QLineEdit( temphb); 225 mPhoneModel = new QLineEdit( temphb);
226 lay->addWidget( temphb ); 226 lay->addWidget( temphb );
227 // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this ); 227 // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this );
228 // lay->addWidget( mWriteToSim ); 228 // lay->addWidget( mWriteToSim );
229 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) ); 229 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) );
230 lab->setAlignment (AlignHCenter ); 230 lab->setAlignment (AlignHCenter );
231 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); 231 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
232 lay->addWidget( ok ); 232 lay->addWidget( ok );
233 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 233 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
234 lay->addWidget( cancel ); 234 lay->addWidget( cancel );
235 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 235 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
236 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 236 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
237 resize( 220, 240 ); 237 resize( 220, 240 );
238 238
239 } 239 }
240 240
241public: 241public:
242 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; 242 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
243 QCheckBox* mWriteToSim; 243 QCheckBox* mWriteToSim;
244}; 244};
245 245
246 246
247bool pasteWithNewUid = true; 247bool pasteWithNewUid = true;
248 248
249#ifdef KAB_EMBEDDED 249#ifdef KAB_EMBEDDED
250KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) 250KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name )
251 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), 251 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ),
252 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ 252 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/
253 mReadWrite( readWrite ), mModified( false ), mMainWindow(client) 253 mReadWrite( readWrite ), mModified( false ), mMainWindow(client)
254#else //KAB_EMBEDDED 254#else //KAB_EMBEDDED
255KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) 255KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name )
256 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), 256 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ),
257 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), 257 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ),
258 mReadWrite( readWrite ), mModified( false ) 258 mReadWrite( readWrite ), mModified( false )
259#endif //KAB_EMBEDDED 259#endif //KAB_EMBEDDED
260{ 260{
261 // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); 261 // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu);
262 // syncManager->setBlockSave(false); 262 // syncManager->setBlockSave(false);
263 mMiniSplitter = 0; 263 mMiniSplitter = 0;
264 mExtensionBarSplitter = 0; 264 mExtensionBarSplitter = 0;
265 mIsPart = !parent->inherits( "KAddressBookMain" ); 265 mIsPart = !parent->inherits( "KAddressBookMain" );
266 mAddressBook = KABC::StdAddressBook::self(); 266 mAddressBook = KABC::StdAddressBook::self();
267 KABC::StdAddressBook::setAutomaticSave( false ); 267 KABC::StdAddressBook::setAutomaticSave( false );
268 268
269#ifndef KAB_EMBEDDED 269#ifndef KAB_EMBEDDED
270 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); 270 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler );
271#endif //KAB_EMBEDDED 271#endif //KAB_EMBEDDED
272 272
273 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), 273 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ),
274 SLOT( addressBookChanged() ) ); 274 SLOT( addressBookChanged() ) );
275 275
276#if 0 276#if 0
277 // LP moved to addressbook init method 277 // LP moved to addressbook init method
278 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, 278 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization,
279 "X-Department", "KADDRESSBOOK" ); 279 "X-Department", "KADDRESSBOOK" );
280 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, 280 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization,
281 "X-Profession", "KADDRESSBOOK" ); 281 "X-Profession", "KADDRESSBOOK" );
282 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, 282 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization,
283 "X-AssistantsName", "KADDRESSBOOK" ); 283 "X-AssistantsName", "KADDRESSBOOK" );
284 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, 284 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization,
285 "X-ManagersName", "KADDRESSBOOK" ); 285 "X-ManagersName", "KADDRESSBOOK" );
286 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, 286 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal,
287 "X-SpousesName", "KADDRESSBOOK" ); 287 "X-SpousesName", "KADDRESSBOOK" );
288 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, 288 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal,
289 "X-Office", "KADDRESSBOOK" ); 289 "X-Office", "KADDRESSBOOK" );
290 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, 290 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal,
291 "X-IMAddress", "KADDRESSBOOK" ); 291 "X-IMAddress", "KADDRESSBOOK" );
292 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, 292 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal,
293 "X-Anniversary", "KADDRESSBOOK" ); 293 "X-Anniversary", "KADDRESSBOOK" );
294 294
295 //US added this field to become compatible with Opie/qtopia addressbook 295 //US added this field to become compatible with Opie/qtopia addressbook
296 // values can be "female" or "male" or "". An empty field represents undefined. 296 // values can be "female" or "male" or "". An empty field represents undefined.
297 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, 297 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal,
298 "X-Gender", "KADDRESSBOOK" ); 298 "X-Gender", "KADDRESSBOOK" );
299 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, 299 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal,
300 "X-Children", "KADDRESSBOOK" ); 300 "X-Children", "KADDRESSBOOK" );
301 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, 301 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal,
302 "X-FreeBusyUrl", "KADDRESSBOOK" ); 302 "X-FreeBusyUrl", "KADDRESSBOOK" );
303#endif 303#endif
304 initGUI(); 304 initGUI();
305 305
306 mIncSearchWidget->setFocus(); 306 mIncSearchWidget->setFocus();
307 307
308 308
309 connect( mViewManager, SIGNAL( selected( const QString& ) ), 309 connect( mViewManager, SIGNAL( selected( const QString& ) ),
310 SLOT( setContactSelected( const QString& ) ) ); 310 SLOT( setContactSelected( const QString& ) ) );
311 connect( mViewManager, SIGNAL( executed( const QString& ) ), 311 connect( mViewManager, SIGNAL( executed( const QString& ) ),
312 SLOT( executeContact( const QString& ) ) ); 312 SLOT( executeContact( const QString& ) ) );
313 313
314 connect( mViewManager, SIGNAL( deleteRequest( ) ), 314 connect( mViewManager, SIGNAL( deleteRequest( ) ),
315 SLOT( deleteContacts( ) ) ); 315 SLOT( deleteContacts( ) ) );
316 connect( mViewManager, SIGNAL( modified() ), 316 connect( mViewManager, SIGNAL( modified() ),
317 SLOT( setModified() ) ); 317 SLOT( setModified() ) );
318 318
319 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); 319 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) );
320 connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); 320 connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) );
321 321
322 connect( mXXPortManager, SIGNAL( modified() ), 322 connect( mXXPortManager, SIGNAL( modified() ),
323 SLOT( setModified() ) ); 323 SLOT( setModified() ) );
324 324
325 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), 325 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ),
326 SLOT( incrementalSearch( const QString& ) ) ); 326 SLOT( incrementalSearch( const QString& ) ) );
327 connect( mIncSearchWidget, SIGNAL( fieldChanged() ), 327 connect( mIncSearchWidget, SIGNAL( fieldChanged() ),
328 mJumpButtonBar, SLOT( recreateButtons() ) ); 328 mJumpButtonBar, SLOT( recreateButtons() ) );
329 329
330 connect( mDetails, SIGNAL( sendEmail( const QString& ) ), 330 connect( mDetails, SIGNAL( sendEmail( const QString& ) ),
331 SLOT( sendMail( const QString& ) ) ); 331 SLOT( sendMail( const QString& ) ) );
332 332
333 333
334 connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); 334 connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&)));
335 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&))); 335 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&)));
336 connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&))); 336 connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&)));
337 connect( ExternalAppHandler::instance(), SIGNAL (nextView()),this, SLOT(setDetailsToggle())); 337 connect( ExternalAppHandler::instance(), SIGNAL (nextView()),this, SLOT(setDetailsToggle()));
338 338
339 339
340#ifndef KAB_EMBEDDED 340#ifndef KAB_EMBEDDED
341 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), 341 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ),
342 mXXPortManager, SLOT( importVCard( const KURL& ) ) ); 342 mXXPortManager, SLOT( importVCard( const KURL& ) ) );
343 343
344 connect( mDetails, SIGNAL( browse( const QString& ) ), 344 connect( mDetails, SIGNAL( browse( const QString& ) ),
345 SLOT( browse( const QString& ) ) ); 345 SLOT( browse( const QString& ) ) );
346 346
347 347
348 mAddressBookService = new KAddressBookService( this ); 348 mAddressBookService = new KAddressBookService( this );
349 349
350#endif //KAB_EMBEDDED 350#endif //KAB_EMBEDDED
351 351
352 mMessageTimer = new QTimer( this ); 352 mMessageTimer = new QTimer( this );
353 connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) ); 353 connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) );
354 mEditorDialog = 0; 354 mEditorDialog = 0;
355 createAddresseeEditorDialog( this ); 355 createAddresseeEditorDialog( this );
356 setModified( false ); 356 setModified( false );
357 mBRdisabled = false; 357 mBRdisabled = false;
358#ifndef DESKTOP_VERSION 358#ifndef DESKTOP_VERSION
359 infrared = 0; 359 infrared = 0;
360#endif 360#endif
361 //toggleBeamReceive( ); 361 //toggleBeamReceive( );
362 362 //mMainWindow->toolBar()->show();
363 // we have a toolbar repainting error on the Zaurus when starting KA/Pi 363 // we have a toolbar repainting error on the Zaurus when starting KA/Pi
364 QTimer::singleShot( 10000, this , SLOT ( updateToolBar())); 364 QTimer::singleShot( 10, this , SLOT ( updateToolBar()));
365} 365}
366 366
367void KABCore::updateToolBar() 367void KABCore::updateToolBar()
368{ 368{
369 mMainWindow->toolBar()->update(); 369 static int iii = 0;
370 ++iii;
371 mMainWindow->toolBar()->repaintMe();
372 if ( iii < 5 )
373 QTimer::singleShot( 10, this , SLOT ( updateToolBar()));
370} 374}
371KABCore::~KABCore() 375KABCore::~KABCore()
372{ 376{
373 // save(); 377 // save();
374 //saveSettings(); 378 //saveSettings();
375 //KABPrefs::instance()->writeConfig(); 379 //KABPrefs::instance()->writeConfig();
376 delete AddresseeConfig::instance(); 380 delete AddresseeConfig::instance();
377 mAddressBook = 0; 381 mAddressBook = 0;
378 KABC::StdAddressBook::close(); 382 KABC::StdAddressBook::close();
379 383
380 delete syncManager; 384 delete syncManager;
381#ifndef DESKTOP_VERSION 385#ifndef DESKTOP_VERSION
382 if ( infrared ) 386 if ( infrared )
383 delete infrared; 387 delete infrared;
384#endif 388#endif
385} 389}
386void KABCore::receive( const QCString& cmsg, const QByteArray& data ) 390void KABCore::receive( const QCString& cmsg, const QByteArray& data )
387{ 391{
388 qDebug("KA: QCOP message received: %s ", cmsg.data() ); 392 qDebug("KA: QCOP message received: %s ", cmsg.data() );
389 if ( cmsg == "setDocument(QString)" ) { 393 if ( cmsg == "setDocument(QString)" ) {
390 QDataStream stream( data, IO_ReadOnly ); 394 QDataStream stream( data, IO_ReadOnly );
391 QString fileName; 395 QString fileName;
392 stream >> fileName; 396 stream >> fileName;
393 recieve( fileName ); 397 recieve( fileName );
394 return; 398 return;
395 } 399 }
396} 400}
397void KABCore::toggleBeamReceive( ) 401void KABCore::toggleBeamReceive( )
398{ 402{
399 if ( mBRdisabled ) 403 if ( mBRdisabled )
400 return; 404 return;
401#ifndef DESKTOP_VERSION 405#ifndef DESKTOP_VERSION
402 if ( infrared ) { 406 if ( infrared ) {
403 qDebug("AB disable BeamReceive "); 407 qDebug("AB disable BeamReceive ");
404 delete infrared; 408 delete infrared;
405 infrared = 0; 409 infrared = 0;
406 mActionBR->setChecked(false); 410 mActionBR->setChecked(false);
407 return; 411 return;
408 } 412 }
409 qDebug("AB enable BeamReceive "); 413 qDebug("AB enable BeamReceive ");
410 mActionBR->setChecked(true); 414 mActionBR->setChecked(true);
411 415
412 infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ; 416 infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ;
413 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& ))); 417 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& )));
414#endif 418#endif
415} 419}
416 420
417 421
418void KABCore::disableBR(bool b) 422void KABCore::disableBR(bool b)
419{ 423{
420#ifndef DESKTOP_VERSION 424#ifndef DESKTOP_VERSION
421 if ( b ) { 425 if ( b ) {
422 if ( infrared ) { 426 if ( infrared ) {
423 toggleBeamReceive( ); 427 toggleBeamReceive( );
424 } 428 }
425 mBRdisabled = true; 429 mBRdisabled = true;
426 } else { 430 } else {
427 if ( mBRdisabled ) { 431 if ( mBRdisabled ) {
428 mBRdisabled = false; 432 mBRdisabled = false;
429 //toggleBeamReceive( ); 433 //toggleBeamReceive( );
430 } 434 }
431 } 435 }
432#endif 436#endif
433 437
434} 438}
435void KABCore::recieve( QString fn ) 439void KABCore::recieve( QString fn )
436{ 440{
437 //qDebug("KABCore::recieve "); 441 //qDebug("KABCore::recieve ");
438 int count = mAddressBook->importFromFile( fn, true ); 442 int count = mAddressBook->importFromFile( fn, true );
439 if ( count ) 443 if ( count )
440 setModified( true ); 444 setModified( true );
441 mViewManager->refreshView(); 445 mViewManager->refreshView();
442 message(i18n("%1 contact(s) received!").arg( count )); 446 message(i18n("%1 contact(s) received!").arg( count ));
443 topLevelWidget()->showMaximized(); 447 topLevelWidget()->showMaximized();
444 topLevelWidget()->raise(); 448 topLevelWidget()->raise();
445} 449}
446void KABCore::restoreSettings() 450void KABCore::restoreSettings()
447{ 451{
448 mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; 452 mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce;
449 453
450 bool state; 454 bool state;
451 455
452 if (mMultipleViewsAtOnce) 456 if (mMultipleViewsAtOnce)
453 state = KABPrefs::instance()->mDetailsPageVisible; 457 state = KABPrefs::instance()->mDetailsPageVisible;
454 else 458 else
455 state = false; 459 state = false;
456 460
457 mActionDetails->setChecked( state ); 461 mActionDetails->setChecked( state );
458 setDetailsVisible( state ); 462 setDetailsVisible( state );
459 463
460 state = KABPrefs::instance()->mJumpButtonBarVisible; 464 state = KABPrefs::instance()->mJumpButtonBarVisible;
461 465
462 mActionJumpBar->setChecked( state ); 466 mActionJumpBar->setChecked( state );
463 setJumpButtonBarVisible( state ); 467 setJumpButtonBarVisible( state );
464/*US 468/*US
465 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; 469 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter;
466 if ( splitterSize.count() == 0 ) { 470 if ( splitterSize.count() == 0 ) {
467 splitterSize.append( width() / 2 ); 471 splitterSize.append( width() / 2 );
468 splitterSize.append( width() / 2 ); 472 splitterSize.append( width() / 2 );
469 } 473 }
470 mMiniSplitter->setSizes( splitterSize ); 474 mMiniSplitter->setSizes( splitterSize );
471 if ( mExtensionBarSplitter ) { 475 if ( mExtensionBarSplitter ) {
472 splitterSize = KABPrefs::instance()->mExtensionsSplitter; 476 splitterSize = KABPrefs::instance()->mExtensionsSplitter;
473 if ( splitterSize.count() == 0 ) { 477 if ( splitterSize.count() == 0 ) {
474 splitterSize.append( width() / 2 ); 478 splitterSize.append( width() / 2 );
475 splitterSize.append( width() / 2 ); 479 splitterSize.append( width() / 2 );
476 } 480 }
477 mExtensionBarSplitter->setSizes( splitterSize ); 481 mExtensionBarSplitter->setSizes( splitterSize );
478 482
479 } 483 }
480*/ 484*/
481 mViewManager->restoreSettings(); 485 mViewManager->restoreSettings();
482 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); 486 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField );
483 mExtensionManager->restoreSettings(); 487 mExtensionManager->restoreSettings();
484#ifdef DESKTOP_VERSION 488#ifdef DESKTOP_VERSION
485 int wid = width(); 489 int wid = width();
486 if ( wid < 10 ) 490 if ( wid < 10 )
487 wid = 400; 491 wid = 400;
488#else 492#else
489 int wid = QApplication::desktop()->width(); 493 int wid = QApplication::desktop()->width();
490 if ( wid < 640 ) 494 if ( wid < 640 )
491 wid = QApplication::desktop()->height(); 495 wid = QApplication::desktop()->height();
492#endif 496#endif
493 QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; 497 QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter;
494 if ( true /*splitterSize.count() == 0*/ ) { 498 if ( true /*splitterSize.count() == 0*/ ) {
495 splitterSize.append( wid / 2 ); 499 splitterSize.append( wid / 2 );
496 splitterSize.append( wid / 2 ); 500 splitterSize.append( wid / 2 );
497 } 501 }
498 mMiniSplitter->setSizes( splitterSize ); 502 mMiniSplitter->setSizes( splitterSize );
499 if ( mExtensionBarSplitter ) { 503 if ( mExtensionBarSplitter ) {
500 //splitterSize = KABPrefs::instance()->mExtensionsSplitter; 504 //splitterSize = KABPrefs::instance()->mExtensionsSplitter;
501 if ( true /*splitterSize.count() == 0*/ ) { 505 if ( true /*splitterSize.count() == 0*/ ) {
502 splitterSize.append( wid / 2 ); 506 splitterSize.append( wid / 2 );
503 splitterSize.append( wid / 2 ); 507 splitterSize.append( wid / 2 );
504 } 508 }
505 mExtensionBarSplitter->setSizes( splitterSize ); 509 mExtensionBarSplitter->setSizes( splitterSize );
506 510
507 } 511 }
508 512
509 513
510} 514}
511 515
512void KABCore::saveSettings() 516void KABCore::saveSettings()
513{ 517{
514 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); 518 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked();
515 if ( mExtensionBarSplitter ) 519 if ( mExtensionBarSplitter )
516 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 520 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
517 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); 521 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked();
518 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); 522 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes();
519#ifndef KAB_EMBEDDED 523#ifndef KAB_EMBEDDED
520 524
521 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 525 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
522 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); 526 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes();
523#endif //KAB_EMBEDDED 527#endif //KAB_EMBEDDED
524 mExtensionManager->saveSettings(); 528 mExtensionManager->saveSettings();
525 mViewManager->saveSettings(); 529 mViewManager->saveSettings();
526 530
527 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); 531 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem();
528} 532}
529 533
530KABC::AddressBook *KABCore::addressBook() const 534KABC::AddressBook *KABCore::addressBook() const
531{ 535{
532 return mAddressBook; 536 return mAddressBook;
533} 537}
534 538
535KConfig *KABCore::config() 539KConfig *KABCore::config()
536{ 540{
537#ifndef KAB_EMBEDDED 541#ifndef KAB_EMBEDDED
538 return KABPrefs::instance()->config(); 542 return KABPrefs::instance()->config();
539#else //KAB_EMBEDDED 543#else //KAB_EMBEDDED
540 return KABPrefs::instance()->getConfig(); 544 return KABPrefs::instance()->getConfig();
541#endif //KAB_EMBEDDED 545#endif //KAB_EMBEDDED
542} 546}
543 547
544KActionCollection *KABCore::actionCollection() const 548KActionCollection *KABCore::actionCollection() const
545{ 549{
546 return mGUIClient->actionCollection(); 550 return mGUIClient->actionCollection();
547} 551}
548 552
549KABC::Field *KABCore::currentSearchField() const 553KABC::Field *KABCore::currentSearchField() const
550{ 554{
551 if (mIncSearchWidget) 555 if (mIncSearchWidget)
552 return mIncSearchWidget->currentField(); 556 return mIncSearchWidget->currentField();
553 else 557 else
554 return 0; 558 return 0;
555} 559}
556 560
557QStringList KABCore::selectedUIDs() const 561QStringList KABCore::selectedUIDs() const
558{ 562{
559 return mViewManager->selectedUids(); 563 return mViewManager->selectedUids();
560} 564}
561 565