summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-04-08 13:58:07 (UTC)
committer zautrix <zautrix>2005-04-08 13:58:07 (UTC)
commitc0f1d38e29ee0d0a1d1dcb5bda08089923926b41 (patch) (unidiff)
treea235fdef5d4b8b519bfd8141247993ba778b39b2
parent19a95939a6469ab5469f6904f57263a792598f07 (diff)
downloadkdepimpi-c0f1d38e29ee0d0a1d1dcb5bda08089923926b41.zip
kdepimpi-c0f1d38e29ee0d0a1d1dcb5bda08089923926b41.tar.gz
kdepimpi-c0f1d38e29ee0d0a1d1dcb5bda08089923926b41.tar.bz2
fix
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp34
-rw-r--r--korganizer/koagendaview.cpp11
2 files changed, 16 insertions, 29 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index fa9f130..9c40142 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -250,813 +250,793 @@ class KAex2phonePrefs : public QDialog
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
635 KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ),
636 "3.1", I18N_NOOP( "The KDE Address Book" ),
637 KAboutData::License_GPL_V2,
638 I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) );
639 about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" );
640 about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) );
641 about->addAuthor( "Cornelius Schumacher",
642 I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ),
643 "schumacher@kde.org" );
644 about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ),
645 "mpilone@slac.com" );
646 about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) );
647 about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) );
648 about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ),
649 "michel@klaralvdalens-datakonsult.se" );
650 about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ),
651 "hansen@kde.org" );
652
653 return about;
654#endif //KAB_EMBEDDED
655 635
656 QString version; 636 QString version;
657#include <../version> 637#include <../version>
658 QMessageBox::about( this, "About KAddressbook/Pi", 638 QMessageBox::about( this, "About KAddressbook/Pi",
659 "KAddressbook/Platform-independent\n" 639 "KAddressbook/Platform-independent\n"
660 "(KA/Pi) " +version + " - " + 640 "(KA/Pi) " +version + " - " +
661#ifdef DESKTOP_VERSION 641#ifdef DESKTOP_VERSION
662 "Desktop Edition\n" 642 "Desktop Edition\n"
663#else 643#else
664 "PDA-Edition\n" 644 "PDA-Edition\n"
665 "for: Zaurus 5500 / 7x0 / 8x0\n" 645 "for: Zaurus 5500 / 7x0 / 8x0\n"
666#endif 646#endif
667 647
668 "(c) 2004 Ulf Schenk\n" 648 "(c) 2004 Ulf Schenk\n"
669 "(c) 2004 Lutz Rogowski\n" 649 "(c) 2004-2005 Lutz Rogowski\nrogowski@kde.org\n"
670 "(c) 1997-2003, The KDE PIM Team\n" 650 "(c) 1997-2003, The KDE PIM Team\n"
671 "Tobias Koenig Current maintainer\ntokoe@kde.org\n" 651 "Tobias Koenig Maintainer\n"
672 "Don Sanders Original author\n" 652 "Don Sanders Original author\n"
673 "Cornelius Schumacher Co-maintainer\nschumacher@kde.org\n" 653 "Cornelius Schumacher Co-maintainer\n"
674 "Mike Pilone GUI and framework redesign\nmpilone@slac.com\n" 654 "Mike Pilone GUI and framework redesign\n"
675 "Greg Stern DCOP interface\n" 655 "Greg Stern DCOP interface\n"
676 "Mark Westcot Contact pinning\n" 656 "Mark Westcot Contact pinning\n"
677 "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n" 657 "Michel Boyer de la Giroday LDAP Lookup\n"
678 "Steffen Hansen LDAP Lookup\nhansen@kde.org\n" 658 "Steffen Hansen LDAP Lookup"
679#ifdef _WIN32_ 659#ifdef _WIN32_
680 "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n" 660 "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n"
681#endif 661#endif
682 ); 662 );
683} 663}
684 664
685void KABCore::setContactSelected( const QString &uid ) 665void KABCore::setContactSelected( const QString &uid )
686{ 666{
687 KABC::Addressee addr = mAddressBook->findByUid( uid ); 667 KABC::Addressee addr = mAddressBook->findByUid( uid );
688 if ( !mDetails->isHidden() ) 668 if ( !mDetails->isHidden() )
689 mDetails->setAddressee( addr ); 669 mDetails->setAddressee( addr );
690 670
691 if ( !addr.isEmpty() ) { 671 if ( !addr.isEmpty() ) {
692 emit contactSelected( addr.formattedName() ); 672 emit contactSelected( addr.formattedName() );
693 KABC::Picture pic = addr.photo(); 673 KABC::Picture pic = addr.photo();
694 if ( pic.isIntern() ) { 674 if ( pic.isIntern() ) {
695//US emit contactSelected( pic.data() ); 675//US emit contactSelected( pic.data() );
696//US instead use: 676//US instead use:
697 QPixmap px; 677 QPixmap px;
698 if (pic.data().isNull() != true) 678 if (pic.data().isNull() != true)
699 { 679 {
700 px.convertFromImage(pic.data()); 680 px.convertFromImage(pic.data());
701 } 681 }
702 682
703 emit contactSelected( px ); 683 emit contactSelected( px );
704 } 684 }
705 } 685 }
706 686
707 687
708 mExtensionManager->setSelectionChanged(); 688 mExtensionManager->setSelectionChanged();
709 689
710 // update the actions 690 // update the actions
711 bool selected = !uid.isEmpty(); 691 bool selected = !uid.isEmpty();
712 692
713 if ( mReadWrite ) { 693 if ( mReadWrite ) {
714 mActionCut->setEnabled( selected ); 694 mActionCut->setEnabled( selected );
715 mActionPaste->setEnabled( selected ); 695 mActionPaste->setEnabled( selected );
716 } 696 }
717 697
718 mActionCopy->setEnabled( selected ); 698 mActionCopy->setEnabled( selected );
719 mActionDelete->setEnabled( selected ); 699 mActionDelete->setEnabled( selected );
720 mActionEditAddressee->setEnabled( selected ); 700 mActionEditAddressee->setEnabled( selected );
721 mActionMail->setEnabled( selected ); 701 mActionMail->setEnabled( selected );
722 mActionMailVCard->setEnabled( selected ); 702 mActionMailVCard->setEnabled( selected );
723 //if (mActionBeam) 703 //if (mActionBeam)
724 //mActionBeam->setEnabled( selected ); 704 //mActionBeam->setEnabled( selected );
725 mActionWhoAmI->setEnabled( selected ); 705 mActionWhoAmI->setEnabled( selected );
726} 706}
727 707
728void KABCore::sendMail() 708void KABCore::sendMail()
729{ 709{
730 sendMail( mViewManager->selectedEmails().join( ", " ) ); 710 sendMail( mViewManager->selectedEmails().join( ", " ) );
731} 711}
732 712
733void KABCore::sendMail( const QString& emaillist ) 713void KABCore::sendMail( const QString& emaillist )
734{ 714{
735 // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... " 715 // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... "
736 if (emaillist.contains(",") > 0) 716 if (emaillist.contains(",") > 0)
737 ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null ); 717 ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null );
738 else 718 else
739 ExternalAppHandler::instance()->mailToOneContact( emaillist ); 719 ExternalAppHandler::instance()->mailToOneContact( emaillist );
740} 720}
741 721
742 722
743 723
744void KABCore::mailVCard() 724void KABCore::mailVCard()
745{ 725{
746 QStringList uids = mViewManager->selectedUids(); 726 QStringList uids = mViewManager->selectedUids();
747 if ( !uids.isEmpty() ) 727 if ( !uids.isEmpty() )
748 mailVCard( uids ); 728 mailVCard( uids );
749} 729}
750 730
751void KABCore::mailVCard( const QStringList& uids ) 731void KABCore::mailVCard( const QStringList& uids )
752{ 732{
753 QStringList urls; 733 QStringList urls;
754 734
755// QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); 735// QString tmpdir = locateLocal("tmp", KGlobal::getAppName());
756 736
757 QString dirName = "/tmp/" + KApplication::randomString( 8 ); 737 QString dirName = "/tmp/" + KApplication::randomString( 8 );
758 738
759 739
760 740
761 QDir().mkdir( dirName, true ); 741 QDir().mkdir( dirName, true );
762 742
763 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { 743 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
764 KABC::Addressee a = mAddressBook->findByUid( *it ); 744 KABC::Addressee a = mAddressBook->findByUid( *it );
765 745
766 if ( a.isEmpty() ) 746 if ( a.isEmpty() )
767 continue; 747 continue;
768 748
769 QString name = a.givenName() + "_" + a.familyName() + ".vcf"; 749 QString name = a.givenName() + "_" + a.familyName() + ".vcf";
770 750
771 QString fileName = dirName + "/" + name; 751 QString fileName = dirName + "/" + name;
772 752
773 QFile outFile(fileName); 753 QFile outFile(fileName);
774 754
775 if ( outFile.open(IO_WriteOnly) ) { // file opened successfully 755 if ( outFile.open(IO_WriteOnly) ) { // file opened successfully
776 KABC::VCardConverter converter; 756 KABC::VCardConverter converter;
777 QString vcard; 757 QString vcard;
778 758
779 converter.addresseeToVCard( a, vcard ); 759 converter.addresseeToVCard( a, vcard );
780 760
781 QTextStream t( &outFile ); // use a text stream 761 QTextStream t( &outFile ); // use a text stream
782 t.setEncoding( QTextStream::UnicodeUTF8 ); 762 t.setEncoding( QTextStream::UnicodeUTF8 );
783 t << vcard; 763 t << vcard;
784 764
785 outFile.close(); 765 outFile.close();
786 766
787 urls.append( fileName ); 767 urls.append( fileName );
788 } 768 }
789 } 769 }
790 770
791 bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") ); 771 bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") );
792 772
793 773
794/*US 774/*US
795 kapp->invokeMailer( QString::null, QString::null, QString::null, 775 kapp->invokeMailer( QString::null, QString::null, QString::null,
796 QString::null, // subject 776 QString::null, // subject
797 QString::null, // body 777 QString::null, // body
798 QString::null, 778 QString::null,
799 urls ); // attachments 779 urls ); // attachments
800*/ 780*/
801 781
802} 782}
803 783
804/** 784/**
805 Beams the "WhoAmI contact. 785 Beams the "WhoAmI contact.
806*/ 786*/
807void KABCore::beamMySelf() 787void KABCore::beamMySelf()
808{ 788{
809 KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); 789 KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI();
810 if (!a.isEmpty()) 790 if (!a.isEmpty())
811 { 791 {
812 QStringList uids; 792 QStringList uids;
813 uids << a.uid(); 793 uids << a.uid();
814 794
815 beamVCard(uids); 795 beamVCard(uids);
816 } else { 796 } else {
817 KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); 797 KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) );
818 798
819 799
820 } 800 }
821} 801}
822void KABCore::updateMainWindow() 802void KABCore::updateMainWindow()
823{ 803{
824 mMainWindow->showMaximized(); 804 mMainWindow->showMaximized();
825 mMainWindow->update(); 805 mMainWindow->update();
826} 806}
827void KABCore::resizeEvent(QResizeEvent* e ) 807void KABCore::resizeEvent(QResizeEvent* e )
828{ 808{
829 if ( !mMiniSplitter ) 809 if ( !mMiniSplitter )
830 return; 810 return;
831 //qDebug("KABCore::resizeEvent(QResizeEvent* e ) "); 811 //qDebug("KABCore::resizeEvent(QResizeEvent* e ) ");
832 if ( QApplication::desktop()->width() >= 480 ) { 812 if ( QApplication::desktop()->width() >= 480 ) {
833 if (QApplication::desktop()->width() == 640 ) { // e.g. 640x480 813 if (QApplication::desktop()->width() == 640 ) { // e.g. 640x480
834 if ( mMiniSplitter->orientation() == Qt::Vertical ) { 814 if ( mMiniSplitter->orientation() == Qt::Vertical ) {
835 mMiniSplitter->setOrientation( Qt::Horizontal); 815 mMiniSplitter->setOrientation( Qt::Horizontal);
836 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 816 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
837 } 817 }
838 if ( QApplication::desktop()->width() <= 640 ) { 818 if ( QApplication::desktop()->width() <= 640 ) {
839 mMainWindow->showMinimized(); 819 mMainWindow->showMinimized();
840 //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); 820 //mMainWindow->setMaximumSize( QApplication::desktop()->size() );
841 mViewManager->getFilterAction()->setComboWidth( 150 ); 821 mViewManager->getFilterAction()->setComboWidth( 150 );
842 if ( mIncSearchWidget ) 822 if ( mIncSearchWidget )
843 mIncSearchWidget->setSize(); 823 mIncSearchWidget->setSize();
844 QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); 824 QTimer::singleShot( 1, this , SLOT ( updateMainWindow()));
845 } 825 }
846 826
847 } else if (QApplication::desktop()->width() == 480 ){// e.g. 480x640 827 } else if (QApplication::desktop()->width() == 480 ){// e.g. 480x640
848 if ( mMiniSplitter->orientation() == Qt::Horizontal ) { 828 if ( mMiniSplitter->orientation() == Qt::Horizontal ) {
849 mMiniSplitter->setOrientation( Qt::Vertical ); 829 mMiniSplitter->setOrientation( Qt::Vertical );
850 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); 830 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
851 } 831 }
852 if ( QApplication::desktop()->width() <= 640 ) { 832 if ( QApplication::desktop()->width() <= 640 ) {
853 //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); 833 //mMainWindow->setMaximumSize( QApplication::desktop()->size() );
854 mMainWindow->showMinimized(); 834 mMainWindow->showMinimized();
855 if ( KABPrefs::instance()->mHideSearchOnSwitch ) { 835 if ( KABPrefs::instance()->mHideSearchOnSwitch ) {
856 if ( mIncSearchWidget ) { 836 if ( mIncSearchWidget ) {
857 mIncSearchWidget->setSize(); 837 mIncSearchWidget->setSize();
858 } 838 }
859 } else { 839 } else {
860 mViewManager->getFilterAction()->setComboWidth( 0 ); 840 mViewManager->getFilterAction()->setComboWidth( 0 );
861 } 841 }
862 QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); 842 QTimer::singleShot( 1, this , SLOT ( updateMainWindow()));
863 } 843 }
864 } 844 }
865 } 845 }
866 QWidget::resizeEvent( e ); 846 QWidget::resizeEvent( e );
867 847
868} 848}
869void KABCore::export2phone() 849void KABCore::export2phone()
870{ 850{
871 851
872 QStringList uids; 852 QStringList uids;
873 XXPortSelectDialog dlg( this, false, this ); 853 XXPortSelectDialog dlg( this, false, this );
874 if ( dlg.exec() ) 854 if ( dlg.exec() )
875 uids = dlg.uids(); 855 uids = dlg.uids();
876 else 856 else
877 return; 857 return;
878 if ( uids.isEmpty() ) 858 if ( uids.isEmpty() )
879 return; 859 return;
880 // qDebug("count %d ", uids.count()); 860 // qDebug("count %d ", uids.count());
881 861
882 KAex2phonePrefs ex2phone; 862 KAex2phonePrefs ex2phone;
883 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); 863 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
884 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); 864 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
885 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); 865 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
886 866
887 if ( !ex2phone.exec() ) { 867 if ( !ex2phone.exec() ) {
888 return; 868 return;
889 } 869 }
890 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 870 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
891 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 871 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
892 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 872 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
893 873
894 874
895 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, 875 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
896 KPimGlobalPrefs::instance()->mEx2PhoneConnection, 876 KPimGlobalPrefs::instance()->mEx2PhoneConnection,
897 KPimGlobalPrefs::instance()->mEx2PhoneModel ); 877 KPimGlobalPrefs::instance()->mEx2PhoneModel );
898 878
899 QString fileName = getPhoneFile(); 879 QString fileName = getPhoneFile();
900 if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) ) 880 if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) )
901 return; 881 return;
902 882
903 message(i18n("Exporting to phone...")); 883 message(i18n("Exporting to phone..."));
904 QTimer::singleShot( 1, this , SLOT ( writeToPhone())); 884 QTimer::singleShot( 1, this , SLOT ( writeToPhone()));
905 885
906} 886}
907QString KABCore::getPhoneFile() 887QString KABCore::getPhoneFile()
908{ 888{
909#ifdef DESKTOP_VERSION 889#ifdef DESKTOP_VERSION
910 return locateLocal("tmp", "phonefile.vcf"); 890 return locateLocal("tmp", "phonefile.vcf");
911#else 891#else
912 return "/tmp/phonefile.vcf"; 892 return "/tmp/phonefile.vcf";
913#endif 893#endif
914 894
915} 895}
916void KABCore::writeToPhone( ) 896void KABCore::writeToPhone( )
917{ 897{
918 if ( PhoneAccess::writeToPhone( getPhoneFile() ) ) 898 if ( PhoneAccess::writeToPhone( getPhoneFile() ) )
919 message(i18n("Export to phone finished!")); 899 message(i18n("Export to phone finished!"));
920 else 900 else
921 qDebug(i18n("KA: Error exporting to phone")); 901 qDebug(i18n("KA: Error exporting to phone"));
922} 902}
923void KABCore::beamVCard() 903void KABCore::beamVCard()
924{ 904{
925 QStringList uids; 905 QStringList uids;
926 XXPortSelectDialog dlg( this, false, this ); 906 XXPortSelectDialog dlg( this, false, this );
927 if ( dlg.exec() ) 907 if ( dlg.exec() )
928 uids = dlg.uids(); 908 uids = dlg.uids();
929 else 909 else
930 return; 910 return;
931 if ( uids.isEmpty() ) 911 if ( uids.isEmpty() )
932 return; 912 return;
933 beamVCard( uids ); 913 beamVCard( uids );
934} 914}
935 915
936 916
937void KABCore::beamVCard(const QStringList& uids) 917void KABCore::beamVCard(const QStringList& uids)
938{ 918{
939 919
940 // LR: we should use the /tmp dir on the Zaurus, 920 // LR: we should use the /tmp dir on the Zaurus,
941 // because: /tmp = RAM, (HOME)/kdepim = flash memory 921 // because: /tmp = RAM, (HOME)/kdepim = flash memory
942 922
943#ifdef DESKTOP_VERSION 923#ifdef DESKTOP_VERSION
944 QString fileName = locateLocal("tmp", "kapibeamfile.vcf"); 924 QString fileName = locateLocal("tmp", "kapibeamfile.vcf");
945#else 925#else
946 QString fileName = "/tmp/kapibeamfile.vcf"; 926 QString fileName = "/tmp/kapibeamfile.vcf";
947#endif 927#endif
948 928
949 KABC::VCardConverter converter; 929 KABC::VCardConverter converter;
950 QString description; 930 QString description;
951 QString datastream; 931 QString datastream;
952 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { 932 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
953 KABC::Addressee a = mAddressBook->findByUid( *it ); 933 KABC::Addressee a = mAddressBook->findByUid( *it );
954 934
955 if ( a.isEmpty() ) 935 if ( a.isEmpty() )
956 continue; 936 continue;
957 937
958 if (description.isEmpty()) 938 if (description.isEmpty())
959 description = a.formattedName(); 939 description = a.formattedName();
960 940
961 QString vcard; 941 QString vcard;
962 converter.addresseeToVCard( a, vcard ); 942 converter.addresseeToVCard( a, vcard );
963 int start = 0; 943 int start = 0;
964 int next; 944 int next;
965 while ( (next = vcard.find("TYPE=", start) )>= 0 ) { 945 while ( (next = vcard.find("TYPE=", start) )>= 0 ) {
966 int semi = vcard.find(";", next); 946 int semi = vcard.find(";", next);
967 int dopp = vcard.find(":", next); 947 int dopp = vcard.find(":", next);
968 int sep; 948 int sep;
969 if ( semi < dopp && semi >= 0 ) 949 if ( semi < dopp && semi >= 0 )
970 sep = semi ; 950 sep = semi ;
971 else 951 else
972 sep = dopp; 952 sep = dopp;
973 datastream +=vcard.mid( start, next - start); 953 datastream +=vcard.mid( start, next - start);
974 datastream +=vcard.mid( next+5,sep -next -5 ).upper(); 954 datastream +=vcard.mid( next+5,sep -next -5 ).upper();
975 start = sep; 955 start = sep;
976 } 956 }
977 datastream += vcard.mid( start,vcard.length() ); 957 datastream += vcard.mid( start,vcard.length() );
978 } 958 }
979#ifndef DESKTOP_VERSION 959#ifndef DESKTOP_VERSION
980 QFile outFile(fileName); 960 QFile outFile(fileName);
981 if ( outFile.open(IO_WriteOnly) ) { 961 if ( outFile.open(IO_WriteOnly) ) {
982 datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); 962 datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" );
983 QTextStream t( &outFile ); // use a text stream 963 QTextStream t( &outFile ); // use a text stream
984 //t.setEncoding( QTextStream::UnicodeUTF8 ); 964 //t.setEncoding( QTextStream::UnicodeUTF8 );
985 t.setEncoding( QTextStream::Latin1 ); 965 t.setEncoding( QTextStream::Latin1 );
986 t <<datastream.latin1(); 966 t <<datastream.latin1();
987 outFile.close(); 967 outFile.close();
988 Ir *ir = new Ir( this ); 968 Ir *ir = new Ir( this );
989 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); 969 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) );
990 ir->send( fileName, description, "text/x-vCard" ); 970 ir->send( fileName, description, "text/x-vCard" );
991 } else { 971 } else {
992 qDebug("KA: Error open temp beam file "); 972 qDebug("KA: Error open temp beam file ");
993 return; 973 return;
994 } 974 }
995#endif 975#endif
996 976
997} 977}
998 978
999void KABCore::beamDone( Ir *ir ) 979void KABCore::beamDone( Ir *ir )
1000{ 980{
1001#ifndef DESKTOP_VERSION 981#ifndef DESKTOP_VERSION
1002 delete ir; 982 delete ir;
1003#endif 983#endif
1004 topLevelWidget()->raise(); 984 topLevelWidget()->raise();
1005 message( i18n("Beaming finished!") ); 985 message( i18n("Beaming finished!") );
1006} 986}
1007 987
1008 988
1009void KABCore::browse( const QString& url ) 989void KABCore::browse( const QString& url )
1010{ 990{
1011#ifndef KAB_EMBEDDED 991#ifndef KAB_EMBEDDED
1012 kapp->invokeBrowser( url ); 992 kapp->invokeBrowser( url );
1013#else //KAB_EMBEDDED 993#else //KAB_EMBEDDED
1014 qDebug("KABCore::browse must be fixed"); 994 qDebug("KABCore::browse must be fixed");
1015#endif //KAB_EMBEDDED 995#endif //KAB_EMBEDDED
1016} 996}
1017 997
1018void KABCore::selectAllContacts() 998void KABCore::selectAllContacts()
1019{ 999{
1020 mViewManager->setSelected( QString::null, true ); 1000 mViewManager->setSelected( QString::null, true );
1021} 1001}
1022 1002
1023void KABCore::deleteContacts() 1003void KABCore::deleteContacts()
1024{ 1004{
1025 QStringList uidList = mViewManager->selectedUids(); 1005 QStringList uidList = mViewManager->selectedUids();
1026 deleteContacts( uidList ); 1006 deleteContacts( uidList );
1027} 1007}
1028 1008
1029void KABCore::deleteContacts( const QStringList &uids ) 1009void KABCore::deleteContacts( const QStringList &uids )
1030{ 1010{
1031 if ( uids.count() > 0 ) { 1011 if ( uids.count() > 0 ) {
1032 PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids ); 1012 PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids );
1033 UndoStack::instance()->push( command ); 1013 UndoStack::instance()->push( command );
1034 RedoStack::instance()->clear(); 1014 RedoStack::instance()->clear();
1035 1015
1036 // now if we deleted anything, refresh 1016 // now if we deleted anything, refresh
1037 setContactSelected( QString::null ); 1017 setContactSelected( QString::null );
1038 setModified( true ); 1018 setModified( true );
1039 } 1019 }
1040} 1020}
1041 1021
1042void KABCore::copyContacts() 1022void KABCore::copyContacts()
1043{ 1023{
1044 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 1024 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
1045 1025
1046 QString clipText = AddresseeUtil::addresseesToClipboard( addrList ); 1026 QString clipText = AddresseeUtil::addresseesToClipboard( addrList );
1047 1027
1048 kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl; 1028 kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl;
1049 1029
1050 QClipboard *cb = QApplication::clipboard(); 1030 QClipboard *cb = QApplication::clipboard();
1051 cb->setText( clipText ); 1031 cb->setText( clipText );
1052} 1032}
1053 1033
1054void KABCore::cutContacts() 1034void KABCore::cutContacts()
1055{ 1035{
1056 QStringList uidList = mViewManager->selectedUids(); 1036 QStringList uidList = mViewManager->selectedUids();
1057 1037
1058//US if ( uidList.size() > 0 ) { 1038//US if ( uidList.size() > 0 ) {
1059 if ( uidList.count() > 0 ) { 1039 if ( uidList.count() > 0 ) {
1060 PwCutCommand *command = new PwCutCommand( mAddressBook, uidList ); 1040 PwCutCommand *command = new PwCutCommand( mAddressBook, uidList );
1061 UndoStack::instance()->push( command ); 1041 UndoStack::instance()->push( command );
1062 RedoStack::instance()->clear(); 1042 RedoStack::instance()->clear();
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index 20a5b74..76d5c4b 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -571,770 +571,777 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) :
571} 571}
572 572
573void KOAgendaView::toggleAllDay() 573void KOAgendaView::toggleAllDay()
574{ 574{
575 if ( mSplitterAgenda->firstHandle() ) 575 if ( mSplitterAgenda->firstHandle() )
576 mSplitterAgenda->firstHandle()->toggle(); 576 mSplitterAgenda->firstHandle()->toggle();
577} 577}
578void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld ) 578void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld )
579{ 579{
580 calendar()->addIncidence( inc ); 580 calendar()->addIncidence( inc );
581 581
582 if ( incOld ) { 582 if ( incOld ) {
583 if ( incOld->type() == "Todo" ) 583 if ( incOld->type() == "Todo" )
584 emit todoMoved((Todo*)incOld, KOGlobals::EVENTEDITED ); 584 emit todoMoved((Todo*)incOld, KOGlobals::EVENTEDITED );
585 else 585 else
586 emit incidenceChanged(incOld, KOGlobals::EVENTEDITED); 586 emit incidenceChanged(incOld, KOGlobals::EVENTEDITED);
587 } 587 }
588 588
589} 589}
590 590
591KOAgendaView::~KOAgendaView() 591KOAgendaView::~KOAgendaView()
592{ 592{
593 delete mAllAgendaPopup; 593 delete mAllAgendaPopup;
594 //delete mAllDayAgendaPopup; 594 //delete mAllDayAgendaPopup;
595 delete KOAgendaItem::paintPix(); 595 delete KOAgendaItem::paintPix();
596 delete KOAgendaItem::paintPixSel(); 596 delete KOAgendaItem::paintPixSel();
597} 597}
598void KOAgendaView::resizeEvent( QResizeEvent* e ) 598void KOAgendaView::resizeEvent( QResizeEvent* e )
599{ 599{
600 //qDebug("KOAgendaView::resizeEvent( QResizeEvent* e ) %d ", e->size().width()); 600 //qDebug("KOAgendaView::resizeEvent( QResizeEvent* e ) %d ", e->size().width());
601 bool uc = false; 601 bool uc = false;
602 int ow = e->oldSize().width(); 602 int ow = e->oldSize().width();
603 int oh = e->oldSize().height(); 603 int oh = e->oldSize().height();
604 int w = e->size().width(); 604 int w = e->size().width();
605 int h = e->size().height(); 605 int h = e->size().height();
606 if ( (ow > oh && w< h ) || (ow < oh && w > h ) ) { 606 if ( (ow > oh && w< h ) || (ow < oh && w > h ) ) {
607 if ( ! mBlockUpdating && !globalFlagBlockStartup && !globalFlagBlockAgenda ) 607 if ( ! mBlockUpdating && !globalFlagBlockStartup && !globalFlagBlockAgenda )
608 uc = true; 608 uc = true;
609 //qDebug("view changed %d %d %d %d ", ow, oh , w , h); 609 //qDebug("view changed %d %d %d %d ", ow, oh , w , h);
610 } 610 }
611 mUpcomingWidth = e->size().width() ; 611 mUpcomingWidth = e->size().width() ;
612 if ( mBlockUpdating || uc ) { 612 if ( mBlockUpdating || uc ) {
613 mBlockUpdating = false; 613 mBlockUpdating = false;
614 //mAgenda->setMinimumSize(800 , 600 ); 614 //mAgenda->setMinimumSize(800 , 600 );
615 //qDebug("mAgenda->resize+++++++++++++++ "); 615 //qDebug("mAgenda->resize+++++++++++++++ ");
616 updateConfig(); 616 updateConfig();
617 //qDebug("KOAgendaView::Updating now possible "); 617 //qDebug("KOAgendaView::Updating now possible ");
618 } else 618 } else
619 createDayLabels(); 619 createDayLabels();
620 //qDebug("resizeEvent end "); 620 //qDebug("resizeEvent end ");
621 621
622} 622}
623void KOAgendaView::slotDaylabelClicked( int num ) 623void KOAgendaView::slotDaylabelClicked( int num )
624{ 624{
625 625
626 QDate firstDate = mSelectedDates.first(); 626 QDate firstDate = mSelectedDates.first();
627 if ( num == -1 ) 627 if ( num == -1 )
628 emit showDateView( 6, firstDate ); 628 emit showDateView( 6, firstDate );
629 else if (num >= 0 ) { 629 else if (num >= 0 ) {
630 if ( mSelectedDates.count() == 1) 630 if ( mSelectedDates.count() == 1)
631 emit showDateView( 9, firstDate.addDays( num ) ); 631 emit showDateView( 9, firstDate.addDays( num ) );
632 else 632 else
633 emit showDateView( 3, firstDate.addDays( num ) ); 633 emit showDateView( 3, firstDate.addDays( num ) );
634 } 634 }
635 else 635 else
636 showDateView( 10, firstDate.addDays(1) ); 636 showDateView( 10, firstDate.addDays(1) );
637} 637}
638 638
639KOAgendaButton* KOAgendaView::getNewDaylabel() 639KOAgendaButton* KOAgendaView::getNewDaylabel()
640{ 640{
641 641
642 KOAgendaButton * dayLabel = new KOAgendaButton(mDayLabels); 642 KOAgendaButton * dayLabel = new KOAgendaButton(mDayLabels);
643 connect( dayLabel, SIGNAL( numClicked(int) ), this, SLOT ( slotDaylabelClicked(int) ) ); 643 connect( dayLabel, SIGNAL( numClicked(int) ), this, SLOT ( slotDaylabelClicked(int) ) );
644 mDayLabelsList.append( dayLabel ); 644 mDayLabelsList.append( dayLabel );
645 mLayoutDayLabels->addWidget(dayLabel); 645 mLayoutDayLabels->addWidget(dayLabel);
646 return dayLabel ; 646 return dayLabel ;
647} 647}
648 648
649void KOAgendaView::createDayLabels() 649void KOAgendaView::createDayLabels()
650{ 650{
651 651
652 if ( mBlockUpdating || globalFlagBlockLabel == 1) { 652 if ( mBlockUpdating || globalFlagBlockLabel == 1) {
653 // qDebug(" KOAgendaView::createDayLabels() blocked "); 653 // qDebug(" KOAgendaView::createDayLabels() blocked ");
654 return; 654 return;
655 655
656 } 656 }
657 int newHight; 657 int newHight;
658 if ( !mSelectedDates.count()) 658 if ( !mSelectedDates.count())
659 return; 659 return;
660 660
661 // ### Before deleting and recreating we could check if mSelectedDates changed... 661 // ### Before deleting and recreating we could check if mSelectedDates changed...
662 // It would remove some flickering and gain speed (since this is called by 662 // It would remove some flickering and gain speed (since this is called by
663 // each updateView() call) 663 // each updateView() call)
664 664
665 int maxWid = mUpcomingWidth - mTimeLabels->width()- mAgenda->verticalScrollBar()->width() - mAgenda->frameWidth()*2; 665 int maxWid = mUpcomingWidth - mTimeLabels->width()- mAgenda->verticalScrollBar()->width() - mAgenda->frameWidth()*2;
666 mDayLabelsFrame->setMaximumWidth( mUpcomingWidth ); 666 mDayLabelsFrame->setMaximumWidth( mUpcomingWidth );
667 if ( maxWid < 20 ) 667 if ( maxWid < 20 )
668 maxWid = 20; 668 maxWid = 20;
669 669
670 QFont dlf = KOPrefs::instance()->mTimeLabelsFont; 670 QFont dlf = KOPrefs::instance()->mTimeLabelsFont;
671 QFontMetrics fm ( dlf ); 671 QFontMetrics fm ( dlf );
672 int selCount = mSelectedDates.count(); 672 int selCount = mSelectedDates.count();
673 int widModulo = maxWid - (mAgenda->gridSpacingX() * selCount)+1; 673 int widModulo = maxWid - (mAgenda->gridSpacingX() * selCount)+1;
674 QString dayTest = "Mon 20"; 674 QString dayTest = "Mon 20";
675 //QString dayTest = "Mon 20"; 675 //QString dayTest = "Mon 20";
676 int wid = fm.width( dayTest ); 676 int wid = fm.width( dayTest );
677 //maxWid -= ( selCount * 3 ); //working for QLabels 677 //maxWid -= ( selCount * 3 ); //working for QLabels
678 if ( QApplication::desktop()->width() <= 320 ) 678 if ( QApplication::desktop()->width() <= 320 )
679 maxWid -= ( selCount * 3 ); //working for QPushButton 679 maxWid -= ( selCount * 3 ); //working for QPushButton
680 else 680 else
681 maxWid -= ( selCount * 3 ); //working for QPushButton 681 maxWid -= ( selCount * 3 ); //working for QPushButton
682 if ( maxWid < 0 ) 682 if ( maxWid < 0 )
683 maxWid = 20; 683 maxWid = 20;
684 int needWid = wid * selCount; 684 int needWid = wid * selCount;
685 //qDebug("++++++++Needed : %d MaxWidth: %d", needWid, maxWid ); 685 //qDebug("++++++++Needed : %d MaxWidth: %d", needWid, maxWid );
686 //if ( needWid > maxWid ) 686 //if ( needWid > maxWid )
687 // qDebug("DAYLABELS TOOOOOOO BIG "); 687 // qDebug("DAYLABELS TOOOOOOO BIG ");
688 while ( needWid > maxWid ) { 688 while ( needWid > maxWid ) {
689 dayTest = dayTest.left( dayTest.length() - 1 ); 689 dayTest = dayTest.left( dayTest.length() - 1 );
690 wid = fm.width( dayTest ); 690 wid = fm.width( dayTest );
691 needWid = wid * selCount; 691 needWid = wid * selCount;
692 } 692 }
693 int maxLen = dayTest.length(); 693 int maxLen = dayTest.length();
694 int fontPoint = dlf.pointSize(); 694 int fontPoint = dlf.pointSize();
695 if ( maxLen < 2 ) { 695 if ( maxLen < 2 ) {
696 int fontPoint = dlf.pointSize(); 696 int fontPoint = dlf.pointSize();
697 while ( fontPoint > 4 ) { 697 while ( fontPoint > 4 ) {
698 --fontPoint; 698 --fontPoint;
699 dlf.setPointSize( fontPoint ); 699 dlf.setPointSize( fontPoint );
700 QFontMetrics f( dlf ); 700 QFontMetrics f( dlf );
701 wid = f.width( "30" ); 701 wid = f.width( "30" );
702 needWid = wid * selCount; 702 needWid = wid * selCount;
703 if ( needWid < maxWid ) 703 if ( needWid < maxWid )
704 break; 704 break;
705 } 705 }
706 maxLen = 2; 706 maxLen = 2;
707 } 707 }
708 //qDebug("Max len %d ", dayTest.length() ); 708 //qDebug("Max len %d ", dayTest.length() );
709 709
710 QFontMetrics tempF( dlf ); 710 QFontMetrics tempF( dlf );
711 newHight = tempF.height(); 711 newHight = tempF.height();
712 mDayLabels->setFont( dlf ); 712 mDayLabels->setFont( dlf );
713 // mLayoutDayLabels = new QHBoxLayout(mDayLabels);; 713 // mLayoutDayLabels = new QHBoxLayout(mDayLabels);;
714 // mLayoutDayLabels->addSpacing(mTimeLabels->width()); 714 // mLayoutDayLabels->addSpacing(mTimeLabels->width());
715 //mLayoutDayLabels->addSpacing( 2 ); 715 //mLayoutDayLabels->addSpacing( 2 );
716 // QFont lFont = dlf; 716 // QFont lFont = dlf;
717 bool appendLabels = false; 717 bool appendLabels = false;
718 KOAgendaButton *dayLabel; 718 KOAgendaButton *dayLabel;
719 dayLabel = mDayLabelsList.first(); 719 dayLabel = mDayLabelsList.first();
720 if ( !dayLabel ) { 720 if ( !dayLabel ) {
721 appendLabels = true; 721 appendLabels = true;
722 dayLabel = getNewDaylabel(); 722 dayLabel = getNewDaylabel();
723 } 723 }
724 dayLabel->setFixedWidth( mTimeLabels->width()+mAgenda->frameWidth() ); 724 dayLabel->setFixedWidth( mTimeLabels->width()+mAgenda->frameWidth() );
725 dayLabel->setFont( dlf ); 725 dayLabel->setFont( dlf );
726 dayLabel->setNum( -1 ); 726 dayLabel->setNum( -1 );
727 //dayLabel->setAlignment(QLabel::AlignHCenter); 727 //dayLabel->setAlignment(QLabel::AlignHCenter);
728#if 0 728#if 0
729 if ( QApplication::desktop()->width() <= 320 ) 729 if ( QApplication::desktop()->width() <= 320 )
730 dayLabel->setText( KOGlobals::self()->calendarSystem()->monthName( mSelectedDates.first(), true ).left(2) ); 730 dayLabel->setText( KOGlobals::self()->calendarSystem()->monthName( mSelectedDates.first(), true ).left(2) );
731 else 731 else
732#endif 732#endif
733 dayLabel->setText( KOGlobals::self()->calendarSystem()->monthName( mSelectedDates.first(), true ) ); 733 dayLabel->setText( KOGlobals::self()->calendarSystem()->monthName( mSelectedDates.first(), true ) );
734 dayLabel->show(); 734 dayLabel->show();
735 DateList::ConstIterator dit; 735 DateList::ConstIterator dit;
736 bool oneday = (mSelectedDates.first() == mSelectedDates.last() ); 736 bool oneday = (mSelectedDates.first() == mSelectedDates.last() );
737 int counter = -1; 737 int counter = -1;
738 for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) { 738 for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) {
739 ++counter; 739 ++counter;
740 QDate date = *dit; 740 QDate date = *dit;
741 // QBoxLayout *dayLayout = new QVBoxLayout(mLayoutDayLabels); 741 // QBoxLayout *dayLayout = new QVBoxLayout(mLayoutDayLabels);
742 if ( ! appendLabels ) { 742 if ( ! appendLabels ) {
743 dayLabel = mDayLabelsList.next(); 743 dayLabel = mDayLabelsList.next();
744 if ( !dayLabel ) 744 if ( !dayLabel )
745 appendLabels = true; 745 appendLabels = true;
746 } 746 }
747 if ( appendLabels ) { 747 if ( appendLabels ) {
748 dayLabel = getNewDaylabel(); 748 dayLabel = getNewDaylabel();
749 } 749 }
750 dayLabel->setMinimumWidth( 1 ); 750 dayLabel->setMinimumWidth( 1 );
751 dayLabel->setMaximumWidth( 10240 ); 751 dayLabel->setMaximumWidth( 10240 );
752 dayLabel->setFont( dlf ); 752 dayLabel->setFont( dlf );
753 dayLabel->show(); 753 dayLabel->show();
754 dayLabel->setAutoRepeat( false ); 754 dayLabel->setAutoRepeat( false );
755 dayLabel->setNum( counter ); 755 dayLabel->setNum( counter );
756 QString str; 756 QString str;
757 int dW = KOGlobals::self()->calendarSystem()->dayOfWeek(date); 757 int dW = KOGlobals::self()->calendarSystem()->dayOfWeek(date);
758 QString dayName = KOGlobals::self()->calendarSystem()->weekDayName( dW, true ); 758 QString dayName = KOGlobals::self()->calendarSystem()->weekDayName( dW, true );
759 switch ( maxLen ) { 759 switch ( maxLen ) {
760 case 2: 760 case 2:
761 str = QString::number( date.day() ); 761 str = QString::number( date.day() );
762 break; 762 break;
763 763
764 case 3: 764 case 3:
765 str = dayName.left( 1 ) +QString::number( date.day()); 765 str = dayName.left( 1 ) +QString::number( date.day());
766 766
767 break; 767 break;
768 case 4: 768 case 4:
769 str = dayName.left( 1 ) + " " +QString::number( date.day()); 769 str = dayName.left( 1 ) + " " +QString::number( date.day());
770 770
771 break; 771 break;
772 case 5: 772 case 5:
773 str = dayName.left( 2 ) + " " +QString::number( date.day()); 773 str = dayName.left( 2 ) + " " +QString::number( date.day());
774 774
775 break; 775 break;
776 case 6: 776 case 6:
777 str = dayName.left( 3 ) + " " +QString::number( date.day()); 777 str = dayName.left( 3 ) + " " +QString::number( date.day());
778 break; 778 break;
779 779
780 default: 780 default:
781 break; 781 break;
782 } 782 }
783 if ( oneday ) { 783 if ( oneday ) {
784 QString addString; 784 QString addString;
785 if ( mSelectedDates.first() == QDateTime::currentDateTime().date() ) 785 if ( mSelectedDates.first() == QDateTime::currentDateTime().date() )
786 addString = i18n("Today"); 786 addString = i18n("Today");
787 else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(1) ) 787 else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(1) )
788 addString = i18n("Tomorrow"); 788 addString = i18n("Tomorrow");
789 else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(-1) ) 789 else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(-1) )
790 addString = i18n("Yesterday"); 790 addString = i18n("Yesterday");
791 else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(-2) ) 791 else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(-2) )
792 addString = i18n("Day before yesterday"); 792 addString = i18n("Day before yesterday");
793 else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(2) ) 793 else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(2) )
794 addString = i18n("Day after tomorrow"); 794 addString = i18n("Day after tomorrow");
795 if ( !addString.isEmpty() ) { 795 if ( !addString.isEmpty() ) {
796 str = addString+", " + str; 796 str = addString+", " + str;
797 } else { 797 } else {
798 str = KGlobal::locale()->formatDate( date, KOPrefs::instance()->mShortDateInViewer); 798 str = KGlobal::locale()->formatDate( date, KOPrefs::instance()->mShortDateInViewer);
799 } 799 }
800 } 800 }
801 dayLabel->setText(str); 801 dayLabel->setText(str);
802 //dayLabel->setAlignment(QLabel::AlignHCenter); 802 //dayLabel->setAlignment(QLabel::AlignHCenter);
803 if (date == QDate::currentDate()) { 803 if (date == QDate::currentDate()) {
804 QFont bFont = dlf; 804 QFont bFont = dlf;
805 bFont.setBold( true ); 805 bFont.setBold( true );
806 dayLabel->setFont(bFont); 806 dayLabel->setFont(bFont);
807 } 807 }
808 //dayLayout->addWidget(dayLabel); 808 //dayLayout->addWidget(dayLabel);
809 809
810#ifndef KORG_NOPLUGINS 810#ifndef KORG_NOPLUGINS
811 CalendarDecoration::List cds = KOCore::self()->calendarDecorations(); 811 CalendarDecoration::List cds = KOCore::self()->calendarDecorations();
812 CalendarDecoration *it; 812 CalendarDecoration *it;
813 for(it = cds.first(); it; it = cds.next()) { 813 for(it = cds.first(); it; it = cds.next()) {
814 QString text = it->shortText( date ); 814 QString text = it->shortText( date );
815 if ( !text.isEmpty() ) { 815 if ( !text.isEmpty() ) {
816 QLabel *label = new QLabel(text,mDayLabels); 816 QLabel *label = new QLabel(text,mDayLabels);
817 label->setAlignment(AlignCenter); 817 label->setAlignment(AlignCenter);
818 dayLayout->addWidget(label); 818 dayLayout->addWidget(label);
819 } 819 }
820 } 820 }
821 821
822 for(it = cds.first(); it; it = cds.next()) { 822 for(it = cds.first(); it; it = cds.next()) {
823 QWidget *wid = it->smallWidget(mDayLabels,date); 823 QWidget *wid = it->smallWidget(mDayLabels,date);
824 if ( wid ) { 824 if ( wid ) {
825 // wid->setHeight(20); 825 // wid->setHeight(20);
826 dayLayout->addWidget(wid); 826 dayLayout->addWidget(wid);
827 } 827 }
828 } 828 }
829#endif 829#endif
830 } 830 }
831 if ( ! appendLabels ) { 831 if ( ! appendLabels ) {
832 dayLabel = mDayLabelsList.next(); 832 dayLabel = mDayLabelsList.next();
833 if ( !dayLabel ) 833 if ( !dayLabel )
834 appendLabels = true; 834 appendLabels = true;
835 } 835 }
836 if ( appendLabels ) { 836 if ( appendLabels ) {
837 dayLabel = getNewDaylabel(); 837 dayLabel = getNewDaylabel();
838 } 838 }
839 //dayLabel->hide();//test only 839 //dayLabel->hide();//test only
840 840
841 dayLabel->setText(">"); 841 dayLabel->setText(">");
842 dayLabel->setFont( dlf ); 842 dayLabel->setFont( dlf );
843 dayLabel->setAutoRepeat( true ); 843 dayLabel->setAutoRepeat( true );
844 dayLabel->show(); 844 dayLabel->show();
845 dayLabel->setNum( -2 ); 845 dayLabel->setNum( -2 );
846 dayLabel->setFixedWidth( mAgenda->verticalScrollBar()->width()+ widModulo ); 846 dayLabel->setFixedWidth( mAgenda->verticalScrollBar()->width()+ widModulo );
847 847
848 //mLayoutDayLabels->addSpacing(mAgenda->verticalScrollBar()->width()+ offset+2); 848 //mLayoutDayLabels->addSpacing(mAgenda->verticalScrollBar()->width()+ offset+2);
849 if ( !appendLabels ) { 849 if ( !appendLabels ) {
850 dayLabel = mDayLabelsList.next(); 850 dayLabel = mDayLabelsList.next();
851 while ( dayLabel ) { 851 while ( dayLabel ) {
852 //qDebug("!dayLabel %d",dayLabel ); 852 //qDebug("!dayLabel %d",dayLabel );
853 dayLabel->hide(); 853 dayLabel->hide();
854 dayLabel = mDayLabelsList.next(); 854 dayLabel = mDayLabelsList.next();
855 } 855 }
856 } 856 }
857 857
858 mDayLabelsFrame->setFixedHeight( newHight + 4 ); 858 mDayLabelsFrame->setFixedHeight( newHight + 4 );
859} 859}
860 860
861int KOAgendaView::maxDatesHint() 861int KOAgendaView::maxDatesHint()
862{ 862{
863 // Not sure about the max number of events, so return 0 for now. 863 // Not sure about the max number of events, so return 0 for now.
864 return 0; 864 return 0;
865} 865}
866 866
867int KOAgendaView::currentDateCount() 867int KOAgendaView::currentDateCount()
868{ 868{
869 return mSelectedDates.count(); 869 return mSelectedDates.count();
870} 870}
871 871
872QPtrList<Incidence> KOAgendaView::selectedIncidences() 872QPtrList<Incidence> KOAgendaView::selectedIncidences()
873{ 873{
874 QPtrList<Incidence> selected; 874 QPtrList<Incidence> selected;
875 Incidence *incidence; 875 Incidence *incidence;
876 876
877 incidence = mAgenda->selectedIncidence(); 877 incidence = mAgenda->selectedIncidence();
878 if (incidence) selected.append(incidence); 878 if (incidence) selected.append(incidence);
879 879
880 incidence = mAllDayAgenda->selectedIncidence(); 880 incidence = mAllDayAgenda->selectedIncidence();
881 if (incidence) selected.append(incidence); 881 if (incidence) selected.append(incidence);
882 882
883 return selected; 883 return selected;
884} 884}
885 885
886DateList KOAgendaView::selectedDates() 886DateList KOAgendaView::selectedDates()
887{ 887{
888 DateList selected; 888 DateList selected;
889 QDate qd; 889 QDate qd;
890 890
891 qd = mAgenda->selectedIncidenceDate(); 891 qd = mAgenda->selectedIncidenceDate();
892 if (qd.isValid()) selected.append(qd); 892 if (qd.isValid()) selected.append(qd);
893 893
894 qd = mAllDayAgenda->selectedIncidenceDate(); 894 qd = mAllDayAgenda->selectedIncidenceDate();
895 if (qd.isValid()) selected.append(qd); 895 if (qd.isValid()) selected.append(qd);
896 896
897 return selected; 897 return selected;
898} 898}
899 899
900 900
901void KOAgendaView::updateView() 901void KOAgendaView::updateView()
902{ 902{
903 if ( mBlockUpdating ) 903 if ( mBlockUpdating )
904 return; 904 return;
905 // kdDebug() << "KOAgendaView::updateView()" << endl; 905 // kdDebug() << "KOAgendaView::updateView()" << endl;
906 fillAgenda(); 906 fillAgenda();
907 907
908} 908}
909 909
910 910
911/* 911/*
912 Update configuration settings for the agenda view. This method is not 912 Update configuration settings for the agenda view. This method is not
913 complete. 913 complete.
914*/ 914*/
915void KOAgendaView::updateConfig() 915void KOAgendaView::updateConfig()
916{ 916{
917 if ( mBlockUpdating ) 917 if ( mBlockUpdating )
918 return; 918 return;
919 if ( mAgenda->height() > 96 * KOPrefs::instance()->mHourSize ) { 919 if ( mAgenda->height() > 96 * KOPrefs::instance()->mHourSize ) {
920 int old = KOPrefs::instance()->mHourSize; 920 int old = KOPrefs::instance()->mHourSize;
921 KOPrefs::instance()->mHourSize = mAgenda->height()/96 +1; 921 KOPrefs::instance()->mHourSize = mAgenda->height()/96 +1;
922 qDebug("KOPrefs::instance()->mHourSize adjusted %d to %d ", old,KOPrefs::instance()->mHourSize ); 922 qDebug("KOPrefs::instance()->mHourSize adjusted %d to %d ", old,KOPrefs::instance()->mHourSize );
923 } 923 }
924 924
925 925
926 // update config for children 926 // update config for children
927 mTimeLabels->updateConfig(); 927 mTimeLabels->updateConfig();
928 mAgenda->storePosition(); 928 mAgenda->storePosition();
929 mAgenda->updateConfig(); 929 mAgenda->updateConfig();
930 mAllDayAgenda->updateConfig(); 930 mAllDayAgenda->updateConfig();
931 // widget synchronization 931 // widget synchronization
932 //TODO: find a better way, maybe signal/slot 932 //TODO: find a better way, maybe signal/slot
933 mTimeLabels->positionChanged(); 933 mTimeLabels->positionChanged();
934 934
935 // for some reason, this needs to be called explicitly 935 // for some reason, this needs to be called explicitly
936 mTimeLabels->repaint(); 936 mTimeLabels->repaint();
937 937
938 mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); 938 mDummyAllDayLeft->setFixedWidth(mTimeLabels->width());
939 939
940 // ToolTips displaying summary of events 940 // ToolTips displaying summary of events
941 KOAgendaItem::toolTipGroup()->setEnabled(KOPrefs::instance() 941 KOAgendaItem::toolTipGroup()->setEnabled(KOPrefs::instance()
942 ->mEnableToolTips); 942 ->mEnableToolTips);
943 943
944 //setHolidayMasks(); 944 //setHolidayMasks();
945 945
946 //createDayLabels(); called by via updateView(); 946 //createDayLabels(); called by via updateView();
947 mEventIndicatorTop->setXOffset(mTimeLabels->width() + mAgenda->frameWidth()); 947 mEventIndicatorTop->setXOffset(mTimeLabels->width() + mAgenda->frameWidth());
948 updateView(); 948 updateView();
949 mAgenda->restorePosition(); 949 mAgenda->restorePosition();
950} 950}
951 951
952 952
953void KOAgendaView::updateEventDates(KOAgendaItem *item, int type) 953void KOAgendaView::updateEventDates(KOAgendaItem *item, int type)
954{ 954{
955 // kdDebug() << "KOAgendaView::updateEventDates(): " << item->text() << endl; 955
956 //qDebug("KOAgendaView::updateEventDates "); 956
957 int xxx = item->cellX();
958 //qDebug("KOAgendaView::updateEventDates %d %d %d %d %d", xxx, mMinY.at(xxx),mMaxY.at(xxx),item->cellYTop(),item->cellYBottom() );
959 if ( mMinY.at(xxx) > item->cellYTop() )
960 mMinY.at(xxx) = item->cellYTop();
961 if ( mMaxY.at(xxx) < item->cellYBottom() )
962 mMaxY.at(xxx) = item->cellYBottom();
963
957 QDateTime startDt,endDt; 964 QDateTime startDt,endDt;
958 QDate startDate; 965 QDate startDate;
959 int lenInSecs; 966 int lenInSecs;
960 // if ( type == KOAgenda::RESIZETOP ) 967 // if ( type == KOAgenda::RESIZETOP )
961 // qDebug("RESIZETOP "); 968 // qDebug("RESIZETOP ");
962 // if ( type == KOAgenda::RESIZEBOTTOM ) 969 // if ( type == KOAgenda::RESIZEBOTTOM )
963 // qDebug("RESIZEBOTTOM "); 970 // qDebug("RESIZEBOTTOM ");
964 // if ( type == KOAgenda::MOVE ) 971 // if ( type == KOAgenda::MOVE )
965 // qDebug("MOVE "); 972 // qDebug("MOVE ");
966 if ( item->incidence()->type() == "Event" ) { 973 if ( item->incidence()->type() == "Event" ) {
967 startDt =item->incidence()->dtStart(); 974 startDt =item->incidence()->dtStart();
968 endDt = item->incidence()->dtEnd(); 975 endDt = item->incidence()->dtEnd();
969 lenInSecs = startDt.secsTo( endDt ); 976 lenInSecs = startDt.secsTo( endDt );
970 } 977 }
971 978
972 // emit incidenceItemChanged( item->incidence(), KOGlobals::EVENTEDITED ); 979 // emit incidenceItemChanged( item->incidence(), KOGlobals::EVENTEDITED );
973 980
974 if ( item->incidence()->type()=="Todo" && item->mLastMoveXPos > 0 ) { 981 if ( item->incidence()->type()=="Todo" && item->mLastMoveXPos > 0 ) {
975 startDate = mSelectedDates[item->mLastMoveXPos]; 982 startDate = mSelectedDates[item->mLastMoveXPos];
976 } else { 983 } else {
977 if (item->cellX() < 0) { 984 if (item->cellX() < 0) {
978 startDate = (mSelectedDates.first()).addDays(item->cellX()); 985 startDate = (mSelectedDates.first()).addDays(item->cellX());
979 } else { 986 } else {
980 startDate = mSelectedDates[item->cellX()]; 987 startDate = mSelectedDates[item->cellX()];
981 } 988 }
982 } 989 }
983 startDt.setDate(startDate); 990 startDt.setDate(startDate);
984 991
985 if (item->incidence()->doesFloat()) { 992 if (item->incidence()->doesFloat()) {
986 endDt.setDate(startDate.addDays(item->cellWidth() - 1)); 993 endDt.setDate(startDate.addDays(item->cellWidth() - 1));
987 } else { 994 } else {
988 if ( type == KOAgenda::RESIZETOP || type == KOAgenda::MOVE ) 995 if ( type == KOAgenda::RESIZETOP || type == KOAgenda::MOVE )
989 startDt.setTime(mAgenda->gyToTime(item->cellYTop())); 996 startDt.setTime(mAgenda->gyToTime(item->cellYTop()));
990 if ( item->incidence()->type() == "Event" ) { 997 if ( item->incidence()->type() == "Event" ) {
991 if ( type == KOAgenda::MOVE ) { 998 if ( type == KOAgenda::MOVE ) {
992 endDt = startDt.addSecs(lenInSecs); 999 endDt = startDt.addSecs(lenInSecs);
993 1000
994 } else if ( type == KOAgenda::RESIZEBOTTOM ) { 1001 } else if ( type == KOAgenda::RESIZEBOTTOM ) {
995 if (item->lastMultiItem()) { 1002 if (item->lastMultiItem()) {
996 endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1)); 1003 endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1));
997 endDt.setDate(startDate. 1004 endDt.setDate(startDate.
998 addDays(item->lastMultiItem()->cellX() - item->cellX())); 1005 addDays(item->lastMultiItem()->cellX() - item->cellX()));
999 } else { 1006 } else {
1000 endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); 1007 endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1));
1001 endDt.setDate(startDate); 1008 endDt.setDate(startDate);
1002 } 1009 }
1003 } 1010 }
1004 } else { 1011 } else {
1005 // todo 1012 // todo
1006 if (item->lastMultiItem()) { 1013 if (item->lastMultiItem()) {
1007 endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1)); 1014 endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1));
1008 endDt.setDate(startDate. 1015 endDt.setDate(startDate.
1009 addDays(item->lastMultiItem()->cellX() - item->cellX())); 1016 addDays(item->lastMultiItem()->cellX() - item->cellX()));
1010 } else { 1017 } else {
1011 //qDebug("tem->cellYBottom() %d",item->cellYBottom() ); 1018 //qDebug("tem->cellYBottom() %d",item->cellYBottom() );
1012 if ( item->cellYBottom() > 0 ) 1019 if ( item->cellYBottom() > 0 )
1013 endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); 1020 endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1));
1014 else 1021 else
1015 endDt.setTime((static_cast<Todo*>(item->incidence()))->dtDue().time()); 1022 endDt.setTime((static_cast<Todo*>(item->incidence()))->dtDue().time());
1016 endDt.setDate(startDate); 1023 endDt.setDate(startDate);
1017 } 1024 }
1018 } 1025 }
1019 } 1026 }
1020 if ( item->incidence()->type() == "Event" ) { 1027 if ( item->incidence()->type() == "Event" ) {
1021 item->incidence()->setDtStart(startDt); 1028 item->incidence()->setDtStart(startDt);
1022 (static_cast<Event*>(item->incidence()))->setDtEnd(endDt); 1029 (static_cast<Event*>(item->incidence()))->setDtEnd(endDt);
1023 } else if ( item->incidence()->type() == "Todo" ) { 1030 } else if ( item->incidence()->type() == "Todo" ) {
1024 Todo* to = static_cast<Todo*>(item->incidence()); 1031 Todo* to = static_cast<Todo*>(item->incidence());
1025 1032
1026 to->setDtDue(endDt); 1033 to->setDtDue(endDt);
1027 if ( to->hasStartDate() ) { 1034 if ( to->hasStartDate() ) {
1028 if (to->dtStart() >= to->dtDue() ) 1035 if (to->dtStart() >= to->dtDue() )
1029 to->setDtStart(to->dtDue().addDays( -2 )); 1036 to->setDtStart(to->dtDue().addDays( -2 ));
1030 } 1037 }
1031 1038
1032 } 1039 }
1033 //qDebug("KOAgendaView::updateEventDates stsart %s end %s ", startDt.toString().latin1(), endDt.toString().latin1() ); 1040 //qDebug("KOAgendaView::updateEventDates stsart %s end %s ", startDt.toString().latin1(), endDt.toString().latin1() );
1034 item->incidence()->setRevision(item->incidence()->revision()+1); 1041 item->incidence()->setRevision(item->incidence()->revision()+1);
1035 item->setItemDate(startDt.date()); 1042 item->setItemDate(startDt.date());
1036 //item->updateItem(); 1043 //item->updateItem();
1037 if ( item->incidence()->type() == "Todo" ) { 1044 if ( item->incidence()->type() == "Todo" ) {
1038 emit todoMoved((Todo*)item->incidence(), KOGlobals::EVENTEDITED ); 1045 emit todoMoved((Todo*)item->incidence(), KOGlobals::EVENTEDITED );
1039 1046
1040 } 1047 }
1041 else 1048 else
1042 emit incidenceChanged(item->incidence(), KOGlobals::EVENTEDITED); 1049 emit incidenceChanged(item->incidence(), KOGlobals::EVENTEDITED);
1043 item->updateItem(); 1050 item->updateItem();
1044} 1051}
1045 1052
1046void KOAgendaView::showDates( const QDate &start, const QDate &end ) 1053void KOAgendaView::showDates( const QDate &start, const QDate &end )
1047{ 1054{
1048 // kdDebug() << "KOAgendaView::selectDates" << endl; 1055 // kdDebug() << "KOAgendaView::selectDates" << endl;
1049 1056
1050 mSelectedDates.clear(); 1057 mSelectedDates.clear();
1051 // qDebug("KOAgendaView::showDates "); 1058 // qDebug("KOAgendaView::showDates ");
1052 QDate d = start; 1059 QDate d = start;
1053 while (d <= end) { 1060 while (d <= end) {
1054 mSelectedDates.append(d); 1061 mSelectedDates.append(d);
1055 d = d.addDays( 1 ); 1062 d = d.addDays( 1 );
1056 } 1063 }
1057 1064
1058 // and update the view 1065 // and update the view
1059 fillAgenda(); 1066 fillAgenda();
1060} 1067}
1061 1068
1062 1069
1063void KOAgendaView::showEvents(QPtrList<Event>) 1070void KOAgendaView::showEvents(QPtrList<Event>)
1064{ 1071{
1065 kdDebug() << "KOAgendaView::showEvents() is not yet implemented" << endl; 1072 kdDebug() << "KOAgendaView::showEvents() is not yet implemented" << endl;
1066} 1073}
1067 1074
1068void KOAgendaView::changeEventDisplay(Event *, int) 1075void KOAgendaView::changeEventDisplay(Event *, int)
1069{ 1076{
1070 // qDebug("KOAgendaView::changeEventDisplay "); 1077 // qDebug("KOAgendaView::changeEventDisplay ");
1071 // kdDebug() << "KOAgendaView::changeEventDisplay" << endl; 1078 // kdDebug() << "KOAgendaView::changeEventDisplay" << endl;
1072 // this should be re-written to be MUCH smarter. Right now we 1079 // this should be re-written to be MUCH smarter. Right now we
1073 // are just playing dumb. 1080 // are just playing dumb.
1074 fillAgenda(); 1081 fillAgenda();
1075} 1082}
1076 1083
1077void KOAgendaView::fillAgenda(const QDate &) 1084void KOAgendaView::fillAgenda(const QDate &)
1078{ 1085{
1079 // qDebug("KOAgendaView::fillAgenda "); 1086 // qDebug("KOAgendaView::fillAgenda ");
1080 fillAgenda(); 1087 fillAgenda();
1081} 1088}
1082 1089
1083void KOAgendaView::fillAgenda() 1090void KOAgendaView::fillAgenda()
1084{ 1091{
1085 if ( globalFlagBlockStartup ) 1092 if ( globalFlagBlockStartup )
1086 return; 1093 return;
1087 if ( globalFlagBlockAgenda == 1 ) 1094 if ( globalFlagBlockAgenda == 1 )
1088 return; 1095 return;
1089 static bool onlyOne = false; 1096 static bool onlyOne = false;
1090 if ( onlyOne ) 1097 if ( onlyOne )
1091 return; 1098 return;
1092 onlyOne = true; 1099 onlyOne = true;
1093 //if ( globalFlagBlockAgenda == 2 ) 1100 //if ( globalFlagBlockAgenda == 2 )
1094 //globalFlagBlockAgenda = 0; 1101 //globalFlagBlockAgenda = 0;
1095 // globalFlagBlockPainting = false; 1102 // globalFlagBlockPainting = false;
1096 if ( globalFlagBlockAgenda == 0 ) 1103 if ( globalFlagBlockAgenda == 0 )
1097 globalFlagBlockAgenda = 1; 1104 globalFlagBlockAgenda = 1;
1098 // clearView(); 1105 // clearView();
1099 //qDebug("fillAgenda()++++ "); 1106 //qDebug("fillAgenda()++++ ");
1100 globalFlagBlockAgendaItemPaint = 1; 1107 globalFlagBlockAgendaItemPaint = 1;
1101 1108
1102 mAllDayAgenda->changeColumns(mSelectedDates.count()); 1109 mAllDayAgenda->changeColumns(mSelectedDates.count());
1103 mAgenda->changeColumns(mSelectedDates.count()); 1110 mAgenda->changeColumns(mSelectedDates.count());
1104 qApp->processEvents(); 1111 qApp->processEvents();
1105 mEventIndicatorTop->changeColumns(mSelectedDates.count()); 1112 mEventIndicatorTop->changeColumns(mSelectedDates.count());
1106 mEventIndicatorBottom->changeColumns(mSelectedDates.count()); 1113 mEventIndicatorBottom->changeColumns(mSelectedDates.count());
1107 setHolidayMasks(); 1114 setHolidayMasks();
1108 1115
1109 //mAgenda->hideUnused(); 1116 //mAgenda->hideUnused();
1110 //mAllDayAgenda->hideUnused(); 1117 //mAllDayAgenda->hideUnused();
1111 1118
1112 // mAgenda->blockNextRepaint( false ); 1119 // mAgenda->blockNextRepaint( false );
1113 // mAgenda->viewport()->repaint(); 1120 // mAgenda->viewport()->repaint();
1114 // mAgenda->blockNextRepaint( true ); 1121 // mAgenda->blockNextRepaint( true );
1115 mMinY.resize(mSelectedDates.count()); 1122 mMinY.resize(mSelectedDates.count());
1116 mMaxY.resize(mSelectedDates.count()); 1123 mMaxY.resize(mSelectedDates.count());
1117 1124
1118 QPtrList<Event> dayEvents; 1125 QPtrList<Event> dayEvents;
1119 1126
1120 // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. 1127 // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue.
1121 // Therefore, gtodoset all of them. 1128 // Therefore, gtodoset all of them.
1122 QPtrList<Todo> todos = calendar()->todos(); 1129 QPtrList<Todo> todos = calendar()->todos();
1123 1130
1124 mAgenda->setDateList(mSelectedDates); 1131 mAgenda->setDateList(mSelectedDates);
1125 1132
1126 QDate today = QDate::currentDate(); 1133 QDate today = QDate::currentDate();
1127 1134
1128 DateList::ConstIterator dit; 1135 DateList::ConstIterator dit;
1129 int curCol = 0; 1136 int curCol = 0;
1130 for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) { 1137 for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) {
1131 QDate currentDate = *dit; 1138 QDate currentDate = *dit;
1132 // kdDebug() << "KOAgendaView::fillAgenda(): " << currentDate.toString() 1139 // kdDebug() << "KOAgendaView::fillAgenda(): " << currentDate.toString()
1133 // << endl; 1140 // << endl;
1134 1141
1135 dayEvents = calendar()->events(currentDate,true); 1142 dayEvents = calendar()->events(currentDate,true);
1136 1143
1137 // Default values, which can never be reached 1144 // Default values, which can never be reached
1138 mMinY[curCol] = mAgenda->timeToY(QTime(23,59)) + 1; 1145 mMinY[curCol] = mAgenda->timeToY(QTime(23,59)) + 1;
1139 mMaxY[curCol] = mAgenda->timeToY(QTime(0,0)) - 1; 1146 mMaxY[curCol] = mAgenda->timeToY(QTime(0,0)) - 1;
1140 1147
1141 unsigned int numEvent; 1148 unsigned int numEvent;
1142 for(numEvent=0;numEvent<dayEvents.count();++numEvent) { 1149 for(numEvent=0;numEvent<dayEvents.count();++numEvent) {
1143 Event *event = dayEvents.at(numEvent); 1150 Event *event = dayEvents.at(numEvent);
1144 if ( !KOPrefs::instance()->mShowSyncEvents && event->uid().left(2) == QString("la") ) 1151 if ( !KOPrefs::instance()->mShowSyncEvents && event->uid().left(2) == QString("la") )
1145 if ( event->uid().left(15) == QString("last-syncEvent-") ) 1152 if ( event->uid().left(15) == QString("last-syncEvent-") )
1146 continue; 1153 continue;
1147 // kdDebug() << " Event: " << event->summary() << endl; 1154 // kdDebug() << " Event: " << event->summary() << endl;
1148 1155
1149 int beginX = currentDate.daysTo(event->dtStart().date()) + curCol; 1156 int beginX = currentDate.daysTo(event->dtStart().date()) + curCol;
1150 int endX = currentDate.daysTo(event->dtEnd().date()) + curCol; 1157 int endX = currentDate.daysTo(event->dtEnd().date()) + curCol;
1151 1158
1152 // kdDebug() << " beginX: " << beginX << " endX: " << endX << endl; 1159 // kdDebug() << " beginX: " << beginX << " endX: " << endX << endl;
1153 1160
1154 if (event->doesFloat()) { 1161 if (event->doesFloat()) {
1155 if (event->recurrence()->doesRecur()) { 1162 if (event->recurrence()->doesRecur()) {
1156 mAllDayAgenda->insertAllDayItem(event,currentDate,curCol,curCol); 1163 mAllDayAgenda->insertAllDayItem(event,currentDate,curCol,curCol);
1157 } else { 1164 } else {
1158 if (beginX <= 0 && curCol == 0) { 1165 if (beginX <= 0 && curCol == 0) {
1159 mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); 1166 mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX);
1160 } else if (beginX == curCol) { 1167 } else if (beginX == curCol) {
1161 mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); 1168 mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX);
1162 } 1169 }
1163 } 1170 }
1164 } else if (event->isMultiDay()) { 1171 } else if (event->isMultiDay()) {
1165 if ( event->doesRecur () ) { 1172 if ( event->doesRecur () ) {
1166 QDate dateit = currentDate; 1173 QDate dateit = currentDate;
1167 int count = 0; 1174 int count = 0;
1168 int max = event->dtStart().daysTo( event->dtEnd() ) +2; 1175 int max = event->dtStart().daysTo( event->dtEnd() ) +2;
1169 while (! event->recursOn( dateit ) && count <= max ) { 1176 while (! event->recursOn( dateit ) && count <= max ) {
1170 ++count; 1177 ++count;
1171 dateit = dateit.addDays( -1 ); 1178 dateit = dateit.addDays( -1 );
1172 } 1179 }
1173 bool ok; 1180 bool ok;
1174 QDateTime nextOcstart = event->getNextOccurence( QDateTime(dateit) ,&ok ); 1181 QDateTime nextOcstart = event->getNextOccurence( QDateTime(dateit) ,&ok );
1175 if ( ok ) 1182 if ( ok )
1176 { 1183 {
1177 int secs = event->dtStart().secsTo( event->dtEnd() ); 1184 int secs = event->dtStart().secsTo( event->dtEnd() );
1178 QDateTime nextOcend =nextOcstart.addSecs( secs ); ; 1185 QDateTime nextOcend =nextOcstart.addSecs( secs ); ;
1179 beginX = currentDate.daysTo(nextOcstart.date()) + curCol; 1186 beginX = currentDate.daysTo(nextOcstart.date()) + curCol;
1180 endX = currentDate.daysTo(nextOcend.date()) + curCol; 1187 endX = currentDate.daysTo(nextOcend.date()) + curCol;
1181 1188
1182 } 1189 }
1183 } 1190 }
1184 int startY = mAgenda->timeToY(event->dtStart().time()); 1191 int startY = mAgenda->timeToY(event->dtStart().time());
1185 int endY = mAgenda->timeToY(event->dtEnd().time()) - 1; 1192 int endY = mAgenda->timeToY(event->dtEnd().time()) - 1;
1186 //qDebug("insert %d %d %d %d %d ",beginX,endX,startY,endY , curCol ); 1193 //qDebug("insert %d %d %d %d %d ",beginX,endX,startY,endY , curCol );
1187 if ((beginX <= 0 && curCol == 0) || beginX == curCol) { 1194 if ((beginX <= 0 && curCol == 0) || beginX == curCol) {
1188 //qDebug("insert!!! "); 1195 //qDebug("insert!!! ");
1189 mAgenda->insertMultiItem(event,currentDate,beginX,endX,startY,endY); 1196 mAgenda->insertMultiItem(event,currentDate,beginX,endX,startY,endY);
1190 } 1197 }
1191 if (beginX == curCol) { 1198 if (beginX == curCol) {
1192 mMaxY[curCol] = mAgenda->timeToY(QTime(23,59)); 1199 mMaxY[curCol] = mAgenda->timeToY(QTime(23,59));
1193 if (startY < mMinY[curCol]) mMinY[curCol] = startY; 1200 if (startY < mMinY[curCol]) mMinY[curCol] = startY;
1194 } else if (endX == curCol) { 1201 } else if (endX == curCol) {
1195 mMinY[curCol] = mAgenda->timeToY(QTime(0,0)); 1202 mMinY[curCol] = mAgenda->timeToY(QTime(0,0));
1196 if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; 1203 if (endY > mMaxY[curCol]) mMaxY[curCol] = endY;
1197 } else { 1204 } else {
1198 mMinY[curCol] = mAgenda->timeToY(QTime(0,0)); 1205 mMinY[curCol] = mAgenda->timeToY(QTime(0,0));
1199 mMaxY[curCol] = mAgenda->timeToY(QTime(23,59)); 1206 mMaxY[curCol] = mAgenda->timeToY(QTime(23,59));
1200 } 1207 }
1201 } else { 1208 } else {
1202 int startY = mAgenda->timeToY(event->dtStart().time()); 1209 int startY = mAgenda->timeToY(event->dtStart().time());
1203 int endY = mAgenda->timeToY(event->dtEnd().time()) - 1; 1210 int endY = mAgenda->timeToY(event->dtEnd().time()) - 1;
1204 if (endY < startY) endY = startY; 1211 if (endY < startY) endY = startY;
1205 mAgenda->insertItem(event,currentDate,curCol,startY,endY); 1212 mAgenda->insertItem(event,currentDate,curCol,startY,endY);
1206 if (startY < mMinY[curCol]) mMinY[curCol] = startY; 1213 if (startY < mMinY[curCol]) mMinY[curCol] = startY;
1207 if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; 1214 if (endY > mMaxY[curCol]) mMaxY[curCol] = endY;
1208 } 1215 }
1209 } 1216 }
1210 // ---------- [display Todos -------------- 1217 // ---------- [display Todos --------------
1211 unsigned int numTodo; 1218 unsigned int numTodo;
1212 for (numTodo = 0; numTodo < todos.count(); ++numTodo) { 1219 for (numTodo = 0; numTodo < todos.count(); ++numTodo) {
1213 Todo *todo = todos.at(numTodo); 1220 Todo *todo = todos.at(numTodo);
1214 1221
1215 if ( ! todo->hasDueDate() && !todo->hasCompletedDate()) continue; // todo shall not be displayed if it has no date 1222 if ( ! todo->hasDueDate() && !todo->hasCompletedDate()) continue; // todo shall not be displayed if it has no date
1216 1223
1217 // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. 1224 // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue.
1218 // Already completed items can be displayed on their original due date 1225 // Already completed items can be displayed on their original due date
1219 //if not KOPrefs::instance()->mShowTodoInAgenda, show overdue in agenda 1226 //if not KOPrefs::instance()->mShowTodoInAgenda, show overdue in agenda
1220 bool overdue = (!todo->isCompleted()) && (todo->dtDue() < today) && KOPrefs::instance()->mShowTodoInAgenda; 1227 bool overdue = (!todo->isCompleted()) && (todo->dtDue() < today) && KOPrefs::instance()->mShowTodoInAgenda;
1221 bool fillIn = false; 1228 bool fillIn = false;
1222 if ( todo->hasCompletedDate() && todo->completed().date() == currentDate ) 1229 if ( todo->hasCompletedDate() && todo->completed().date() == currentDate )
1223 fillIn = true; 1230 fillIn = true;
1224 if ( ! fillIn && !todo->hasCompletedDate() ) 1231 if ( ! fillIn && !todo->hasCompletedDate() )
1225 fillIn = ((todo->dtDue().date() == currentDate) && !overdue) || ((currentDate == today) && overdue); 1232 fillIn = ((todo->dtDue().date() == currentDate) && !overdue) || ((currentDate == today) && overdue);
1226 if ( fillIn ) { 1233 if ( fillIn ) {
1227 if ( (todo->doesFloat() || overdue ) && !todo->hasCompletedDate() ) { // Todo has no due-time set or is already overdue 1234 if ( (todo->doesFloat() || overdue ) && !todo->hasCompletedDate() ) { // Todo has no due-time set or is already overdue
1228 if ( KOPrefs::instance()->mShowTodoInAgenda ) 1235 if ( KOPrefs::instance()->mShowTodoInAgenda )
1229 mAllDayAgenda->insertAllDayItem(todo, currentDate, curCol, curCol); 1236 mAllDayAgenda->insertAllDayItem(todo, currentDate, curCol, curCol);
1230 } 1237 }
1231 else { 1238 else {
1232 QDateTime dt; 1239 QDateTime dt;
1233 if ( todo->hasCompletedDate() ) 1240 if ( todo->hasCompletedDate() )
1234 dt = todo->completed(); 1241 dt = todo->completed();
1235 else 1242 else
1236 dt = todo->dtDue();; 1243 dt = todo->dtDue();;
1237 1244
1238 1245
1239 int endY = mAgenda->timeToY(dt.time()) - 1; 1246 int endY = mAgenda->timeToY(dt.time()) - 1;
1240 int hi = (18/KOPrefs::instance()->mHourSize); 1247 int hi = (18/KOPrefs::instance()->mHourSize);
1241 //qDebug("hei %d ",KOPrefs::instance()->mHourSize); 1248 //qDebug("hei %d ",KOPrefs::instance()->mHourSize);
1242 int startY = endY -hi; 1249 int startY = endY -hi;
1243 1250
1244 mAgenda->insertItem(todo,currentDate,curCol,startY,endY); 1251 mAgenda->insertItem(todo,currentDate,curCol,startY,endY);
1245 1252
1246 if (startY < mMinY[curCol]) mMinY[curCol] = startY; 1253 if (startY < mMinY[curCol]) mMinY[curCol] = startY;
1247 if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; 1254 if (endY > mMaxY[curCol]) mMaxY[curCol] = endY;
1248 } 1255 }
1249 } 1256 }
1250 } 1257 }
1251 // ---------- display Todos] -------------- 1258 // ---------- display Todos] --------------
1252 1259
1253 ++curCol; 1260 ++curCol;
1254 } 1261 }
1255 mAgenda->hideUnused(); 1262 mAgenda->hideUnused();
1256 mAllDayAgenda->hideUnused(); 1263 mAllDayAgenda->hideUnused();
1257 mAgenda->checkScrollBoundaries(); 1264 mAgenda->checkScrollBoundaries();
1258 1265
1259 deleteSelectedDateTime(); 1266 deleteSelectedDateTime();
1260 1267
1261 createDayLabels(); 1268 createDayLabels();
1262 emit incidenceSelected( 0 ); 1269 emit incidenceSelected( 0 );
1263 1270
1264 if ( globalFlagBlockAgenda == 2 ) { 1271 if ( globalFlagBlockAgenda == 2 ) {
1265 if ( KOPrefs::instance()->mSetTimeToDayStartAt ) 1272 if ( KOPrefs::instance()->mSetTimeToDayStartAt )
1266 setStartHour( KOPrefs::instance()->mDayBegins ); 1273 setStartHour( KOPrefs::instance()->mDayBegins );
1267 else if ( KOPrefs::instance()->mCenterOnCurrentTime ) 1274 else if ( KOPrefs::instance()->mCenterOnCurrentTime )
1268 setStartHour( QTime::currentTime ().hour() ); 1275 setStartHour( QTime::currentTime ().hour() );
1269 // qApp->processEvents(); 1276 // qApp->processEvents();
1270 } 1277 }
1271 qApp->processEvents(); 1278 qApp->processEvents();
1272 //qDebug("qApp->processEvents(); END "); 1279 //qDebug("qApp->processEvents(); END ");
1273 globalFlagBlockAgenda = 0; 1280 globalFlagBlockAgenda = 0;
1274 1281
1275 // mAgenda->hideUnused(); 1282 // mAgenda->hideUnused();
1276 //mAllDayAgenda->hideUnused(); 1283 //mAllDayAgenda->hideUnused();
1277 mAllDayAgenda->drawContentsToPainter(); 1284 mAllDayAgenda->drawContentsToPainter();
1278 mAgenda->drawContentsToPainter(); 1285 mAgenda->drawContentsToPainter();
1279 repaintAgenda(); 1286 repaintAgenda();
1280 onlyOne = false; 1287 onlyOne = false;
1281 // mAgenda->finishUpdate(); 1288 // mAgenda->finishUpdate();
1282 //mAllDayAgenda->finishUpdate(); 1289 //mAllDayAgenda->finishUpdate();
1283 1290
1284 // repaintAgenda(); 1291 // repaintAgenda();
1285 //qApp->processEvents(); 1292 //qApp->processEvents();
1286 // globalFlagBlockAgenda = 0; 1293 // globalFlagBlockAgenda = 0;
1287} 1294}
1288void KOAgendaView::repaintAgenda() 1295void KOAgendaView::repaintAgenda()
1289{ 1296{
1290 // mAllDayAgenda->drawContentsToPainter(); 1297 // mAllDayAgenda->drawContentsToPainter();
1291// mAllDayAgenda->viewport()->repaint( false ); 1298// mAllDayAgenda->viewport()->repaint( false );
1292// mAgenda->drawContentsToPainter(); 1299// mAgenda->drawContentsToPainter();
1293// mAgenda->viewport()->repaint( false ); 1300// mAgenda->viewport()->repaint( false );
1294// qApp->processEvents(); 1301// qApp->processEvents();
1295 1302
1296 //qDebug("KOAgendaView::repaintAgenda() "); 1303 //qDebug("KOAgendaView::repaintAgenda() ");
1297 //qApp->processEvents(); 1304 //qApp->processEvents();
1298 mAgenda->viewport()->repaint( false ); 1305 mAgenda->viewport()->repaint( false );
1299 mAllDayAgenda->viewport()->repaint( false ); 1306 mAllDayAgenda->viewport()->repaint( false );
1300 mAgenda->finishUpdate(); 1307 mAgenda->finishUpdate();
1301 mAllDayAgenda->finishUpdate(); 1308 mAllDayAgenda->finishUpdate();
1302} 1309}
1303 1310
1304 1311
1305void KOAgendaView::clearView() 1312void KOAgendaView::clearView()
1306{ 1313{
1307 // kdDebug() << "ClearView" << endl; 1314 // kdDebug() << "ClearView" << endl;
1308 mAllDayAgenda->clear(); 1315 mAllDayAgenda->clear();
1309 mAgenda->clear(); 1316 mAgenda->clear();
1310} 1317}
1311 1318
1312void KOAgendaView::printPreview(CalPrinter *calPrinter, const QDate &fd, 1319void KOAgendaView::printPreview(CalPrinter *calPrinter, const QDate &fd,
1313 const QDate &td) 1320 const QDate &td)
1314{ 1321{
1315#ifndef KORG_NOPRINTER 1322#ifndef KORG_NOPRINTER
1316 if (fd == td) 1323 if (fd == td)
1317 calPrinter->preview(CalPrinter::Day, fd, td); 1324 calPrinter->preview(CalPrinter::Day, fd, td);
1318 else 1325 else
1319 calPrinter->preview(CalPrinter::Week, fd, td); 1326 calPrinter->preview(CalPrinter::Week, fd, td);
1320#endif 1327#endif
1321} 1328}
1322 1329
1323// void KOAgendaView::updateMovedTodo() 1330// void KOAgendaView::updateMovedTodo()
1324// { 1331// {
1325// // updateConfig(); 1332// // updateConfig();
1326// // emit updateTodoViews(); 1333// // emit updateTodoViews();
1327// } 1334// }
1328 1335
1329void KOAgendaView::slotShowDateView( int mode , int d ) 1336void KOAgendaView::slotShowDateView( int mode , int d )
1330{ 1337{
1331 if ( d >= mSelectedDates.count() ) { 1338 if ( d >= mSelectedDates.count() ) {
1332 qDebug("KOAgendaView::slotShowDateView datecounterror %d d ", d, mSelectedDates.count() ); 1339 qDebug("KOAgendaView::slotShowDateView datecounterror %d d ", d, mSelectedDates.count() );
1333 1340
1334 } else { 1341 } else {
1335 QDate day = mSelectedDates[d]; 1342 QDate day = mSelectedDates[d];
1336 emit showDateView(mode , day ); 1343 emit showDateView(mode , day );
1337 } 1344 }
1338 1345
1339} 1346}
1340void KOAgendaView::newEvent(int gx, int gy) 1347void KOAgendaView::newEvent(int gx, int gy)