summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/mainwindow.cpp5
1 files changed, 1 insertions, 4 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 1776dcc..883a9d1 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -239,799 +239,796 @@ MainWindow::MainWindow( QWidget *parent, const char *name ) :
239 addTest = "AAAAAx"; 239 addTest = "AAAAAx";
240#endif 240#endif
241 filterMenubar->setMaximumWidth( fm.width( i18n("No Filter")+addTest ) ); 241 filterMenubar->setMaximumWidth( fm.width( i18n("No Filter")+addTest ) );
242 addToolBar (filterToolBar , tbd ); 242 addToolBar (filterToolBar , tbd );
243 connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) ); 243 connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) );
244 connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) ); 244 connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) );
245 if ( !KOPrefs::instance()->mShowIconFilter && !p->mShowIconOnetoolbar ) 245 if ( !KOPrefs::instance()->mShowIconFilter && !p->mShowIconOnetoolbar )
246 filterToolBar->hide(); 246 filterToolBar->hide();
247 } else { 247 } else {
248 filterToolBar = 0; 248 filterToolBar = 0;
249 filterMenubar = 0; 249 filterMenubar = 0;
250 filterPopupMenu = 0; 250 filterPopupMenu = 0;
251 } 251 }
252 if ( p->mShowIconOnetoolbar ) { 252 if ( p->mShowIconOnetoolbar ) {
253 viewToolBar = iconToolBar ; 253 viewToolBar = iconToolBar ;
254 navigatorToolBar = iconToolBar ; 254 navigatorToolBar = iconToolBar ;
255 } else { 255 } else {
256#ifndef DESKTOP_VERSION 256#ifndef DESKTOP_VERSION
257 setToolBarsMovable( false ); 257 setToolBarsMovable( false );
258#endif 258#endif
259 if ( p->mToolBarHorV ) { 259 if ( p->mToolBarHorV ) {
260 if ( p->mToolBarUpV ) 260 if ( p->mToolBarUpV )
261 tbd = Bottom; 261 tbd = Bottom;
262 else 262 else
263 tbd = Top; 263 tbd = Top;
264 } 264 }
265 else { 265 else {
266 if ( p->mToolBarUpV ) 266 if ( p->mToolBarUpV )
267 tbd = Right; 267 tbd = Right;
268 else 268 else
269 tbd = Left; 269 tbd = Left;
270 } 270 }
271 viewToolBar = new QPEToolBar( this ); 271 viewToolBar = new QPEToolBar( this );
272 addToolBar (viewToolBar , tbd ); 272 addToolBar (viewToolBar , tbd );
273 if ( p->mToolBarHorN ) { 273 if ( p->mToolBarHorN ) {
274 if ( p->mToolBarUpN ) 274 if ( p->mToolBarUpN )
275 tbd = Bottom; 275 tbd = Bottom;
276 else 276 else
277 tbd = Top; 277 tbd = Top;
278 } 278 }
279 else { 279 else {
280 if ( p->mToolBarUpN ) 280 if ( p->mToolBarUpN )
281 tbd = Right; 281 tbd = Right;
282 else 282 else
283 tbd = Left; 283 tbd = Left;
284 } 284 }
285 navigatorToolBar = new QPEToolBar( this ); 285 navigatorToolBar = new QPEToolBar( this );
286 addToolBar (navigatorToolBar , tbd ); 286 addToolBar (navigatorToolBar , tbd );
287 } 287 }
288 288
289 289
290 290
291 mCalendarModifiedFlag = false; 291 mCalendarModifiedFlag = false;
292 // QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); 292 // QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this );
293 //splash->setAlignment ( AlignCenter ); 293 //splash->setAlignment ( AlignCenter );
294 //setCentralWidget( splash ); 294 //setCentralWidget( splash );
295#ifndef DESKTOP_VERSION 295#ifndef DESKTOP_VERSION
296 //showMaximized(); 296 //showMaximized();
297#endif 297#endif
298 298
299 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); 299 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ());
300 setDefaultPreferences(); 300 setDefaultPreferences();
301 mCalendar = new CalendarLocal(); 301 mCalendar = new CalendarLocal();
302 mView = new CalendarView( mCalendar, this,"mCalendar " ); 302 mView = new CalendarView( mCalendar, this,"mCalendar " );
303 setCentralWidget( mView ); 303 setCentralWidget( mView );
304 //mView->hide(); 304 //mView->hide();
305 //mView->resize(splash->size() ); 305 //mView->resize(splash->size() );
306 initActions(); 306 initActions();
307 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); 307 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu);
308 mSyncManager->setBlockSave(false); 308 mSyncManager->setBlockSave(false);
309 mView->setSyncManager(mSyncManager); 309 mView->setSyncManager(mSyncManager);
310#ifndef DESKTOP_VERSION 310#ifndef DESKTOP_VERSION
311 //iconToolBar->show(); 311 //iconToolBar->show();
312 //qApp->processEvents(); 312 //qApp->processEvents();
313#endif 313#endif
314 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); 314 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ());
315 int vh = height() ; 315 int vh = height() ;
316 int vw = width(); 316 int vw = width();
317 //qDebug("Toolbar hei %d ",iconToolBar->height() ); 317 //qDebug("Toolbar hei %d ",iconToolBar->height() );
318 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 318 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
319 vh -= iconToolBar->height(); 319 vh -= iconToolBar->height();
320 } else { 320 } else {
321 vw -= iconToolBar->height(); 321 vw -= iconToolBar->height();
322 } 322 }
323 //mView->setMaximumSize( splash->size() ); 323 //mView->setMaximumSize( splash->size() );
324 //mView->resize( splash->size() ); 324 //mView->resize( splash->size() );
325 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 325 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
326 mView->readSettings(); 326 mView->readSettings();
327 bool newFile = false; 327 bool newFile = false;
328 if( !QFile::exists( defaultFileName() ) ) { 328 if( !QFile::exists( defaultFileName() ) ) {
329 QFileInfo finfo ( defaultFileName() ); 329 QFileInfo finfo ( defaultFileName() );
330 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); 330 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics");
331 QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; 331 QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n";
332 finfo.setFile( oldFile ); 332 finfo.setFile( oldFile );
333 if (finfo.exists() ) { 333 if (finfo.exists() ) {
334 KMessageBox::information( this, message); 334 KMessageBox::information( this, message);
335 mView->openCalendar( oldFile ); 335 mView->openCalendar( oldFile );
336 qApp->processEvents(); 336 qApp->processEvents();
337 } else { 337 } else {
338 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); 338 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics");
339 finfo.setFile( oldFile ); 339 finfo.setFile( oldFile );
340 if (finfo.exists() ) { 340 if (finfo.exists() ) {
341 KMessageBox::information( this, message); 341 KMessageBox::information( this, message);
342 mView->openCalendar( oldFile ); 342 mView->openCalendar( oldFile );
343 qApp->processEvents(); 343 qApp->processEvents();
344 } 344 }
345 } 345 }
346 mView->saveCalendar( defaultFileName() ); 346 mView->saveCalendar( defaultFileName() );
347 newFile = true; 347 newFile = true;
348 } 348 }
349 349
350 //QTime neededSaveTime = QDateTime::currentDateTime().time(); 350 //QTime neededSaveTime = QDateTime::currentDateTime().time();
351 //mView->loadCalendars(); 351 //mView->loadCalendars();
352 //int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 352 //int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
353 //qDebug("KO: Calendar loading time: %d ms",msNeeded ); 353 //qDebug("KO: Calendar loading time: %d ms",msNeeded );
354 354
355 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { 355 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) {
356 KOPrefs::instance()->setAllDefaults(); 356 KOPrefs::instance()->setAllDefaults();
357 } 357 }
358 358
359 359
360 connect( mView, SIGNAL( tempDisableBR(bool) ), 360 connect( mView, SIGNAL( tempDisableBR(bool) ),
361 SLOT( disableBR(bool) ) ); 361 SLOT( disableBR(bool) ) );
362 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); 362 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) );
363 setCentralWidget( mView ); 363 setCentralWidget( mView );
364 globalFlagBlockStartup = 0; 364 globalFlagBlockStartup = 0;
365 //mView->show(); 365 //mView->show();
366 //delete splash; 366 //delete splash;
367 if ( newFile ) 367 if ( newFile )
368 mView->updateConfig(); 368 mView->updateConfig();
369 // qApp->processEvents(); 369 // qApp->processEvents();
370 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 370 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
371 //fillSyncMenu(); 371 //fillSyncMenu();
372 372
373 373
374 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); 374 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) );
375 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); 375 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) );
376 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); 376 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) );
377 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); 377 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
378 mSyncManager->setDefaultFileName( sentSyncFile()); 378 mSyncManager->setDefaultFileName( sentSyncFile());
379 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); 379 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) );
380 mSyncManager->fillSyncMenu(); 380 mSyncManager->fillSyncMenu();
381 381
382 382
383 383
384 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); 384 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins );
385 if ( showWarning ) { 385 if ( showWarning ) {
386 KMessageBox::information( this, 386 KMessageBox::information( this,
387 "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); 387 "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information");
388 //qApp->processEvents(); 388 //qApp->processEvents();
389 mView->dialogManager()->showSyncOptions(); 389 mView->dialogManager()->showSyncOptions();
390 } 390 }
391 391
392 //US listen for result adressed from Ka/Pi 392 //US listen for result adressed from Ka/Pi
393 393
394#ifndef DESKTOP_VERSION 394#ifndef DESKTOP_VERSION
395 infrared = 0; 395 infrared = 0;
396#endif 396#endif
397 updateFilterToolbar(); 397 updateFilterToolbar();
398 updateWeek( mView->startDate() ); 398 updateWeek( mView->startDate() );
399 connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), 399 connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ),
400 SLOT( updateWeekNum( const KCal::DateList & ) ) ); 400 SLOT( updateWeekNum( const KCal::DateList & ) ) );
401 mBRdisabled = false; 401 mBRdisabled = false;
402 //toggleBeamReceive(); 402 //toggleBeamReceive();
403 403
404 setCaption(i18n("Loading calendar files ... please wait" )); 404 setCaption(i18n("Loading calendar files ... please wait" ));
405 mSaveDelay = 0; 405 mSaveDelay = 0;
406 QTimer::singleShot( 1, this, SLOT ( loadDataAfterStart() )); 406 QTimer::singleShot( 1, this, SLOT ( loadDataAfterStart() ));
407} 407}
408MainWindow::~MainWindow() 408MainWindow::~MainWindow()
409{ 409{
410 //qDebug("MainWindow::~MainWindow() "); 410 //qDebug("MainWindow::~MainWindow() ");
411 //save toolbar location 411 //save toolbar location
412 delete mCalendar; 412 delete mCalendar;
413 delete mSyncManager; 413 delete mSyncManager;
414#ifndef DESKTOP_VERSION 414#ifndef DESKTOP_VERSION
415 if ( infrared ) 415 if ( infrared )
416 delete infrared; 416 delete infrared;
417#endif 417#endif
418 418
419 419
420} 420}
421 421
422void MainWindow::loadDataAfterStart() 422void MainWindow::loadDataAfterStart()
423{ 423{
424 qDebug("KO: Start loading files..." ); 424 qDebug("KO: Start loading files..." );
425 QTime neededSaveTime = QDateTime::currentDateTime().time(); 425 QTime neededSaveTime = QDateTime::currentDateTime().time();
426 mView->loadCalendars(); 426 mView->loadCalendars();
427 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 427 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
428 qDebug("KO: Calendar loading time: %d ms",msNeeded ); 428 qDebug("KO: Calendar loading time: %d ms",msNeeded );
429 //QTimer::singleShot( 1000, mView, SLOT ( checkFiles() )); 429 //QTimer::singleShot( 1000, mView, SLOT ( checkFiles() ));
430 mView->setModified( false ); 430 mView->setModified( false );
431 mBlockAtStartup = false; 431 mBlockAtStartup = false;
432 mView->setModified( false ); 432 mView->setModified( false );
433 connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); 433 connect(mView , SIGNAL( save() ), this, SLOT( save() ) );
434 processIncidenceSelection( 0 ); 434 processIncidenceSelection( 0 );
435 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), 435 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ),
436 SLOT( processIncidenceSelection( Incidence * ) ) ); 436 SLOT( processIncidenceSelection( Incidence * ) ) );
437 connect( mView, SIGNAL( modifiedChanged( bool ) ), 437 connect( mView, SIGNAL( modifiedChanged( bool ) ),
438 SLOT( slotModifiedChanged( bool ) ) ); 438 SLOT( slotModifiedChanged( bool ) ) );
439#ifndef DESKTOP_VERSION 439#ifndef DESKTOP_VERSION
440 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 440 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
441 connect( qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), this, SLOT(recieve( const QCString&, const QByteArray& ))); 441 connect( qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), this, SLOT(recieve( const QCString&, const QByteArray& )));
442 disconnect( qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), this, SLOT(receiveStart( const QCString&, const QByteArray& ))); 442 disconnect( qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), this, SLOT(receiveStart( const QCString&, const QByteArray& )));
443 if ( !mCStringMess.isEmpty() ) 443 if ( !mCStringMess.isEmpty() )
444 recieve( mCStringMess, mByteData ); 444 recieve( mCStringMess, mByteData );
445#endif 445#endif
446 QTimer::singleShot( 1000, mView, SLOT ( checkFiles() )); 446 QTimer::singleShot( 1000, mView, SLOT ( checkFiles() ));
447} 447}
448 448
449void MainWindow::slotResetFocus() 449void MainWindow::slotResetFocus()
450{ 450{
451 //qDebug(" CalendarView::slotResetFocus() %x %x %x %x", qApp->focusWidget(), menuBar1, mView,iconToolBar); 451 //qDebug(" CalendarView::slotResetFocus() %x %x %x %x", qApp->focusWidget(), menuBar1, mView,iconToolBar);
452 mFocusLoop = 3; 452 mFocusLoop = 3;
453 QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() )); 453 QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() ));
454} 454}
455void MainWindow::slotResetFocusLoop() 455void MainWindow::slotResetFocusLoop()
456{ 456{
457 --mFocusLoop; 457 --mFocusLoop;
458 QWidget* fw = mView->viewManager()->currentView(); 458 QWidget* fw = mView->viewManager()->currentView();
459 if ( fw ) { 459 if ( fw ) {
460 //qDebug("loop "); 460 //qDebug("loop ");
461 fw->setFocus(); 461 fw->setFocus();
462 if ( qApp->focusWidget() != fw && mFocusLoop > 0 ) 462 if ( qApp->focusWidget() != fw && mFocusLoop > 0 )
463 QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() )); 463 QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() ));
464 } 464 }
465 465
466} 466}
467void MainWindow::disableBR(bool b) 467void MainWindow::disableBR(bool b)
468{ 468{
469#ifndef DESKTOP_VERSION 469#ifndef DESKTOP_VERSION
470 if ( b ) { 470 if ( b ) {
471 if ( infrared ) { 471 if ( infrared ) {
472 toggleBeamReceive(); 472 toggleBeamReceive();
473 mBRdisabled = true; 473 mBRdisabled = true;
474 } 474 }
475 mBRdisabled = true; 475 mBRdisabled = true;
476 } else { 476 } else {
477 if ( mBRdisabled ) { 477 if ( mBRdisabled ) {
478 mBRdisabled = false; 478 mBRdisabled = false;
479 //makes no sense,because other cal ap is probably running 479 //makes no sense,because other cal ap is probably running
480 // toggleBeamReceive(); 480 // toggleBeamReceive();
481 } 481 }
482 } 482 }
483#endif 483#endif
484 484
485} 485}
486bool MainWindow::beamReceiveEnabled() 486bool MainWindow::beamReceiveEnabled()
487{ 487{
488#ifndef DESKTOP_VERSION 488#ifndef DESKTOP_VERSION
489 return ( infrared != 0 ); 489 return ( infrared != 0 );
490#endif 490#endif
491 return false; 491 return false;
492} 492}
493 493
494void MainWindow::toggleBeamReceive() 494void MainWindow::toggleBeamReceive()
495{ 495{
496 if ( mBRdisabled ) 496 if ( mBRdisabled )
497 return; 497 return;
498#ifndef DESKTOP_VERSION 498#ifndef DESKTOP_VERSION
499 if ( infrared ) { 499 if ( infrared ) {
500 qDebug("KO: Disable BeamReceive "); 500 qDebug("KO: Disable BeamReceive ");
501 delete infrared; 501 delete infrared;
502 infrared = 0; 502 infrared = 0;
503 brAction->setOn(false); 503 brAction->setOn(false);
504 return; 504 return;
505 } 505 }
506 qDebug("KO: Enable BeamReceive "); 506 qDebug("KO: Enable BeamReceive ");
507 brAction->setOn(true); 507 brAction->setOn(true);
508 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; 508 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ;
509 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); 509 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& )));
510#endif 510#endif
511} 511}
512void MainWindow::showMaximized () 512void MainWindow::showMaximized ()
513{ 513{
514#ifndef DESKTOP_VERSION 514#ifndef DESKTOP_VERSION
515 if ( ! globalFlagBlockStartup ) 515 if ( ! globalFlagBlockStartup )
516 if ( mClosed ) 516 if ( mClosed )
517 mView->goToday(); 517 mView->goToday();
518#endif 518#endif
519 QWidget::showMaximized () ; 519 QWidget::showMaximized () ;
520 mClosed = false; 520 mClosed = false;
521} 521}
522 522
523bool MainWindow::askForQuitOnSaveError() 523bool MainWindow::askForQuitOnSaveError()
524{ 524{
525 bool retval = false; 525 bool retval = false;
526 switch( QMessageBox::information( this, "KO/Pi", 526 switch( QMessageBox::information( this, "KO/Pi",
527 i18n("Error saving data") + "!\n" + 527 i18n("Error saving data") + "!\n" +
528 i18n("You can save all data\nto another file via\nFile->Export->Export All Data") + "!\n" + 528 i18n("You can save all data\nto another file via\nFile->Export->Export All Data") + "!\n" +
529 i18n("Do you really want\nto close KO/Pi?"), 529 i18n("Do you really want\nto close KO/Pi?"),
530 i18n(" Yes, close "), i18n("No"), 530 i18n(" Yes, close "), i18n("No"),
531 0, 1 ) ) { 531 0, 1 ) ) {
532 case 0: 532 case 0:
533 retval = true; 533 retval = true;
534 break; 534 break;
535 default: 535 default:
536 break; 536 break;
537 } 537 }
538 return retval; 538 return retval;
539} 539}
540 540
541void MainWindow::closeEvent( QCloseEvent* ce ) 541void MainWindow::closeEvent( QCloseEvent* ce )
542{ 542{
543 543
544 544
545 545
546 if ( ! KOPrefs::instance()->mAskForQuit ) { 546 if ( ! KOPrefs::instance()->mAskForQuit ) {
547 saveOnClose(); 547 saveOnClose();
548 if ( mCalendarModifiedFlag && !askForQuitOnSaveError() ) { 548 if ( mCalendarModifiedFlag && !askForQuitOnSaveError() ) {
549 ce->ignore(); 549 ce->ignore();
550 return; 550 return;
551 } 551 }
552 mClosed = true; 552 mClosed = true;
553 ce->accept(); 553 ce->accept();
554 return; 554 return;
555 555
556 } 556 }
557 557
558 switch( QMessageBox::information( this, "KO/Pi", 558 switch( QMessageBox::information( this, "KO/Pi",
559 i18n("Do you really want\nto close KO/Pi?"), 559 i18n("Do you really want\nto close KO/Pi?"),
560 i18n("Close"), i18n("No"), 560 i18n("Close"), i18n("No"),
561 0, 0 ) ) { 561 0, 0 ) ) {
562 case 0: 562 case 0:
563 saveOnClose(); 563 saveOnClose();
564 if ( mCalendarModifiedFlag && !askForQuitOnSaveError() ) { 564 if ( mCalendarModifiedFlag && !askForQuitOnSaveError() ) {
565 ce->ignore(); 565 ce->ignore();
566 return; 566 return;
567 } 567 }
568 mClosed = true; 568 mClosed = true;
569 ce->accept(); 569 ce->accept();
570 break; 570 break;
571 case 1: 571 case 1:
572 ce->ignore(); 572 ce->ignore();
573 break; 573 break;
574 case 2: 574 case 2:
575 575
576 default: 576 default:
577 break; 577 break;
578 } 578 }
579 579
580 580
581} 581}
582void MainWindow::receiveStart( const QCString& cmsg, const QByteArray& data ) 582void MainWindow::receiveStart( const QCString& cmsg, const QByteArray& data )
583{ 583{
584 qDebug("KO: QCOP start message received: %s ", cmsg.data() ); 584 qDebug("KO: QCOP start message received: %s ", cmsg.data() );
585 mCStringMess = cmsg; 585 mCStringMess = cmsg;
586 mByteData = data; 586 mByteData = data;
587} 587}
588void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) 588void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
589{ 589{
590 QDataStream stream( data, IO_ReadOnly ); 590 QDataStream stream( data, IO_ReadOnly );
591 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); 591 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" );
592 //QString datamess; 592 //QString datamess;
593 //qDebug("message "); 593 //qDebug("message ");
594 qDebug("KO: QCOP message received: %s ", cmsg.data() ); 594 qDebug("KO: QCOP message received: %s ", cmsg.data() );
595 595
596 if ( cmsg == "setDocument(QString)" ) { 596 if ( cmsg == "setDocument(QString)" ) {
597 QDataStream stream( data, IO_ReadOnly ); 597 QDataStream stream( data, IO_ReadOnly );
598 QString fileName; 598 QString fileName;
599 stream >> fileName; 599 stream >> fileName;
600 //qDebug("filename %s ", fileName.latin1()); 600 //qDebug("filename %s ", fileName.latin1());
601 showMaximized(); 601 showMaximized();
602 raise(); 602 raise();
603 KOPrefs::instance()->mLastSyncedLocalFile = fileName ; 603 KOPrefs::instance()->mLastSyncedLocalFile = fileName ;
604 mSyncManager->slotSyncMenu( 1002 ); 604 mSyncManager->slotSyncMenu( 1002 );
605 return; 605 return;
606 } 606 }
607 607
608 if ( cmsg == "-writeFile" ) { 608 if ( cmsg == "-writeFile" ) {
609 // I made from the "-writeFile" an "-writeAlarm" 609 // I made from the "-writeFile" an "-writeAlarm"
610 mView->viewManager()->showWhatsNextView(); 610 mView->viewManager()->showWhatsNextView();
611 mCalendar->checkAlarmForIncidence( 0, true); 611 mCalendar->checkAlarmForIncidence( 0, true);
612 showMaximized(); 612 showMaximized();
613 raise(); 613 raise();
614 return; 614 return;
615 615
616 } 616 }
617 if ( cmsg == "-writeFileSilent" ) { 617 if ( cmsg == "-writeFileSilent" ) {
618 // I made from the "-writeFile" an "-writeAlarm" 618 // I made from the "-writeFile" an "-writeAlarm"
619 // mView->viewManager()->showWhatsNextView(); 619 // mView->viewManager()->showWhatsNextView();
620 mCalendar->checkAlarmForIncidence( 0, true); 620 mCalendar->checkAlarmForIncidence( 0, true);
621 //showMaximized(); 621 //showMaximized();
622 //raise(); 622 //raise();
623 hide(); 623 //hide();
624 return; 624 return;
625 } 625 }
626 if ( cmsg == "-newCountdown" ) { 626 if ( cmsg == "-newCountdown" ) {
627 qDebug("newCountdown "); 627 qDebug("newCountdown ");
628 628
629 } 629 }
630 QString msg ; 630 QString msg ;
631 QString allmsg = cmsg; 631 QString allmsg = cmsg;
632 while ( allmsg.length() > 0 ) { 632 while ( allmsg.length() > 0 ) {
633 int nextC = allmsg.find( "-", 1 ); 633 int nextC = allmsg.find( "-", 1 );
634 if ( nextC == -1 ) { 634 if ( nextC == -1 ) {
635 msg = allmsg; 635 msg = allmsg;
636 allmsg = ""; 636 allmsg = "";
637 } else{ 637 } else{
638 msg = allmsg.left( nextC ); 638 msg = allmsg.left( nextC );
639 allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); 639 allmsg = allmsg.mid( nextC, allmsg.length()-nextC );
640 } 640 }
641 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); 641 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() );
642 if ( msg == "-newEvent" ) { 642 if ( msg == "-newEvent" ) {
643 QTimer::singleShot( 0, mView, SLOT ( newEvent())); 643 QTimer::singleShot( 0, mView, SLOT ( newEvent()));
644 } 644 }
645 if ( msg == "-newTodo" ) { 645 if ( msg == "-newTodo" ) {
646 QTimer::singleShot( 0, mView, SLOT ( newTodo())); 646 QTimer::singleShot( 0, mView, SLOT ( newTodo()));
647 } 647 }
648 if ( msg == "-showWN" ) { 648 if ( msg == "-showWN" ) {
649 mView->viewManager()->showWhatsNextView(); 649 mView->viewManager()->showWhatsNextView();
650 } 650 }
651 if ( msg == "-showTodo" ) {
652 mView->viewManager()->showTodoView();
653 }
654 if ( msg == "-showList" ) { 651 if ( msg == "-showList" ) {
655 mView->viewManager()->showListView(); 652 mView->viewManager()->showListView();
656 } 653 }
657 else if ( msg == "-showDay" ) { 654 else if ( msg == "-showDay" ) {
658 mView->viewManager()->showDayView(); 655 mView->viewManager()->showDayView();
659 } 656 }
660 else if ( msg == "-showWWeek" ) { 657 else if ( msg == "-showWWeek" ) {
661 mView->viewManager()->showWorkWeekView(); 658 mView->viewManager()->showWorkWeekView();
662 } 659 }
663 else if ( msg == "-ringSync" ) { 660 else if ( msg == "-ringSync" ) {
664 QTimer::singleShot( 0, this, SLOT (startMultiSync())); 661 QTimer::singleShot( 0, this, SLOT (startMultiSync()));
665 } 662 }
666 else if ( msg == "-showWeek" ) { 663 else if ( msg == "-showWeek" ) {
667 mView->viewManager()->showWeekView(); 664 mView->viewManager()->showWeekView();
668 } 665 }
669 else if ( msg == "-showTodo" ) { 666 else if ( msg == "-showTodo" ) {
670 mView->viewManager()->showTodoView(); 667 mView->viewManager()->showTodoView();
671 } 668 }
672 else if ( msg == "-showJournal" ) { 669 else if ( msg == "-showJournal" ) {
673 mView->dateNavigator()->selectDates( 1 ); 670 mView->dateNavigator()->selectDates( 1 );
674 mView->dateNavigator()->selectToday(); 671 mView->dateNavigator()->selectToday();
675 mView->viewManager()->showJournalView(); 672 mView->viewManager()->showJournalView();
676 } 673 }
677 else if ( msg == "-showKO" ) { 674 else if ( msg == "-showKO" ) {
678 mView->viewManager()->showNextXView(); 675 mView->viewManager()->showNextXView();
679 } 676 }
680 else if ( msg == "-showWNext" ) { 677 else if ( msg == "-showWNext" ) {
681 mView->viewManager()->showWhatsNextView(); 678 mView->viewManager()->showWhatsNextView();
682 } 679 }
683 else if ( msg == "nextView()" ) { 680 else if ( msg == "nextView()" ) {
684 mView->viewManager()->showNextView(); 681 mView->viewManager()->showNextView();
685 } 682 }
686 else if ( msg == "-showNextXView" ) { 683 else if ( msg == "-showNextXView" ) {
687 mView->viewManager()->showNextXView(); 684 mView->viewManager()->showNextXView();
688 } 685 }
689 686
690 687
691 } 688 }
692 689
693 showMaximized(); 690 showMaximized();
694 raise(); 691 raise();
695} 692}
696void MainWindow::startMultiSync() 693void MainWindow::startMultiSync()
697{ 694{
698 QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); 695 QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!");
699 if ( QMessageBox::information( this, i18n("KDE-Pim Sync"), 696 if ( QMessageBox::information( this, i18n("KDE-Pim Sync"),
700 question, 697 question,
701 i18n("Yes"), i18n("No"), 698 i18n("Yes"), i18n("No"),
702 0, 0 ) != 0 ) { 699 0, 0 ) != 0 ) {
703 setCaption(i18n("Aborted! Nothing synced!")); 700 setCaption(i18n("Aborted! Nothing synced!"));
704 return; 701 return;
705 } 702 }
706 mSyncManager->multiSync( false ); 703 mSyncManager->multiSync( false );
707#ifndef DESKTOP_VERSION 704#ifndef DESKTOP_VERSION
708 QCopEnvelope e("QPE/Application/kapi", "doRingSync"); 705 QCopEnvelope e("QPE/Application/kapi", "doRingSync");
709#endif 706#endif
710} 707}
711QPixmap MainWindow::loadPixmap( QString name ) 708QPixmap MainWindow::loadPixmap( QString name )
712{ 709{
713 return SmallIcon( name ); 710 return SmallIcon( name );
714 711
715} 712}
716void MainWindow::setUsesBigPixmaps ( bool b ) 713void MainWindow::setUsesBigPixmaps ( bool b )
717{ 714{
718 qDebug("KO: MainWindow::setUsesBigPixmaps %d called", b); 715 qDebug("KO: MainWindow::setUsesBigPixmaps %d called", b);
719 if ( b ) 716 if ( b )
720 qDebug("KO: BigPixmaps are not supported "); 717 qDebug("KO: BigPixmaps are not supported ");
721} 718}
722void MainWindow::initActions() 719void MainWindow::initActions()
723{ 720{
724 //KOPrefs::instance()->mShowFullMenu 721 //KOPrefs::instance()->mShowFullMenu
725 iconToolBar->clear(); 722 iconToolBar->clear();
726 KOPrefs *p = KOPrefs::instance(); 723 KOPrefs *p = KOPrefs::instance();
727 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); 724 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar );
728 725
729 QPopupMenu *viewMenu = new QPopupMenu( this ); 726 QPopupMenu *viewMenu = new QPopupMenu( this );
730 QPopupMenu *actionMenu = new QPopupMenu( this ); 727 QPopupMenu *actionMenu = new QPopupMenu( this );
731 mCurrentItemMenu = new QPopupMenu ( this ); 728 mCurrentItemMenu = new QPopupMenu ( this );
732 QPopupMenu *nextConflictMenu = new QPopupMenu ( this ); 729 QPopupMenu *nextConflictMenu = new QPopupMenu ( this );
733 QPopupMenu *importMenu = new QPopupMenu( this ); 730 QPopupMenu *importMenu = new QPopupMenu( this );
734 QPopupMenu *importMenu_X = new QPopupMenu( this ); 731 QPopupMenu *importMenu_X = new QPopupMenu( this );
735 QPopupMenu *exportMenu_X = new QPopupMenu( this ); 732 QPopupMenu *exportMenu_X = new QPopupMenu( this );
736 QPopupMenu *beamMenu_X = new QPopupMenu( this ); 733 QPopupMenu *beamMenu_X = new QPopupMenu( this );
737 selectFilterMenu = new QPopupMenu( this ); 734 selectFilterMenu = new QPopupMenu( this );
738 selectFilterMenu->setCheckable( true ); 735 selectFilterMenu->setCheckable( true );
739 syncMenu = new QPopupMenu( this ); 736 syncMenu = new QPopupMenu( this );
740 configureAgendaMenu = new QPopupMenu( this ); 737 configureAgendaMenu = new QPopupMenu( this );
741 configureToolBarMenu = new QPopupMenu( this ); 738 configureToolBarMenu = new QPopupMenu( this );
742 QPopupMenu *helpMenu = new QPopupMenu( this ); 739 QPopupMenu *helpMenu = new QPopupMenu( this );
743 QIconSet icon; 740 QIconSet icon;
744 int pixWid = 22, pixHei = 22; 741 int pixWid = 22, pixHei = 22;
745 QString pathString = ""; 742 QString pathString = "";
746 if ( !p->mToolBarMiniIcons ) { 743 if ( !p->mToolBarMiniIcons ) {
747 if ( QApplication::desktop()->width() < 480 /*|| QApplication::desktop()->height() < 320*/) { 744 if ( QApplication::desktop()->width() < 480 /*|| QApplication::desktop()->height() < 320*/) {
748 pathString += "icons16/"; 745 pathString += "icons16/";
749 pixWid = 18; pixHei = 16; 746 pixWid = 18; pixHei = 16;
750 } 747 }
751 } else { 748 } else {
752 pathString += "iconsmini/"; 749 pathString += "iconsmini/";
753 pixWid = 18; pixHei = 16; 750 pixWid = 18; pixHei = 16;
754 } 751 }
755 752
756 if ( KOPrefs::instance()->mShowFullMenu ) { 753 if ( KOPrefs::instance()->mShowFullMenu ) {
757 menuBar1 = new KMenuBar( this );//menuBar(); 754 menuBar1 = new KMenuBar( this );//menuBar();
758 //setMenuBar( menuBar1 ); 755 //setMenuBar( menuBar1 );
759 menuBar1->show(); 756 menuBar1->show();
760 menuBar1->insertItem( i18n("File"), importMenu ); 757 menuBar1->insertItem( i18n("File"), importMenu );
761 menuBar1->insertItem( i18n("View"), viewMenu ); 758 menuBar1->insertItem( i18n("View"), viewMenu );
762 menuBar1->insertItem( i18n("Edit"), mCurrentItemMenu ); 759 menuBar1->insertItem( i18n("Edit"), mCurrentItemMenu );
763 menuBar1->insertItem( i18n("Action"), actionMenu ); 760 menuBar1->insertItem( i18n("Action"), actionMenu );
764#ifdef DESKTOP_VERSION 761#ifdef DESKTOP_VERSION
765 menuBar1->insertItem( i18n("Synchronize"), syncMenu ); 762 menuBar1->insertItem( i18n("Synchronize"), syncMenu );
766 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 763 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu );
767#else 764#else
768 menuBar1->insertItem( i18n("Sync"), syncMenu ); 765 menuBar1->insertItem( i18n("Sync"), syncMenu );
769 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); 766 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu );
770#endif 767#endif
771 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); 768 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu );
772 menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); 769 menuBar1->insertItem( i18n("Filter"),selectFilterMenu );
773 menuBar1->insertItem( i18n("Help"), helpMenu ); 770 menuBar1->insertItem( i18n("Help"), helpMenu );
774 } else { 771 } else {
775 menuBar1 = new KMenuBar( iconToolBar ); 772 menuBar1 = new KMenuBar( iconToolBar );
776 QPopupMenu *menuBar = new QPopupMenu( this ); 773 QPopupMenu *menuBar = new QPopupMenu( this );
777 icon = loadPixmap( pathString + "z_menu" ); 774 icon = loadPixmap( pathString + "z_menu" );
778 menuBar1->insertItem( icon.pixmap(), menuBar); 775 menuBar1->insertItem( icon.pixmap(), menuBar);
779 //menuBar1->insertItem( i18n("ME"), menuBar); 776 //menuBar1->insertItem( i18n("ME"), menuBar);
780 menuBar->insertItem( i18n("File"), importMenu ); 777 menuBar->insertItem( i18n("File"), importMenu );
781 menuBar->insertItem( i18n("View"), viewMenu ); 778 menuBar->insertItem( i18n("View"), viewMenu );
782 menuBar->insertItem( i18n("Edit"), mCurrentItemMenu ); 779 menuBar->insertItem( i18n("Edit"), mCurrentItemMenu );
783 menuBar->insertItem( i18n("Action"), actionMenu ); 780 menuBar->insertItem( i18n("Action"), actionMenu );
784 menuBar->insertItem( i18n("Synchronize"), syncMenu ); 781 menuBar->insertItem( i18n("Synchronize"), syncMenu );
785 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 782 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu );
786 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); 783 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu );
787 menuBar->insertItem( i18n("Filter"),selectFilterMenu ); 784 menuBar->insertItem( i18n("Filter"),selectFilterMenu );
788 menuBar->insertItem( i18n("Help"), helpMenu ); 785 menuBar->insertItem( i18n("Help"), helpMenu );
789 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); 786 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() );
790 menuBar1->setMaximumSize( menuBar1->sizeHint( )); 787 menuBar1->setMaximumSize( menuBar1->sizeHint( ));
791 connect ( menuBar, SIGNAL( aboutToHide () ), this, SLOT ( slotResetFocus() ) ); 788 connect ( menuBar, SIGNAL( aboutToHide () ), this, SLOT ( slotResetFocus() ) );
792 } 789 }
793 connect ( menuBar1, SIGNAL( lostFocus () ), this, SLOT ( slotResetFocus() ) ); 790 connect ( menuBar1, SIGNAL( lostFocus () ), this, SLOT ( slotResetFocus() ) );
794 //connect ( menuBar1, SIGNAL( lostFocus () ), this, SLOT ( slotResetFocus() ) ); 791 //connect ( menuBar1, SIGNAL( lostFocus () ), this, SLOT ( slotResetFocus() ) );
795 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 792 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
796 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); 793 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) );
797 794
798 795
799 mWeekBgColor = iconToolBar->backgroundColor(); 796 mWeekBgColor = iconToolBar->backgroundColor();
800 mWeekPixmap.resize( pixWid , pixHei ); 797 mWeekPixmap.resize( pixWid , pixHei );
801 mWeekPixmap.fill( mWeekBgColor ); 798 mWeekPixmap.fill( mWeekBgColor );
802 icon = mWeekPixmap; 799 icon = mWeekPixmap;
803 mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); 800 mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this );
804 if ( p-> mShowIconWeekNum ) 801 if ( p-> mShowIconWeekNum )
805 mWeekAction->addTo( iconToolBar ); 802 mWeekAction->addTo( iconToolBar );
806 mWeekFont = font(); 803 mWeekFont = font();
807 804
808 int fontPoint = mWeekFont.pointSize(); 805 int fontPoint = mWeekFont.pointSize();
809 QFontMetrics f( mWeekFont ); 806 QFontMetrics f( mWeekFont );
810 int fontWid = f.width( "30" ); 807 int fontWid = f.width( "30" );
811 while ( fontWid > pixWid ) { 808 while ( fontWid > pixWid ) {
812 --fontPoint; 809 --fontPoint;
813 mWeekFont.setPointSize( fontPoint ); 810 mWeekFont.setPointSize( fontPoint );
814 QFontMetrics f( mWeekFont ); 811 QFontMetrics f( mWeekFont );
815 fontWid = f.width( "30" ); 812 fontWid = f.width( "30" );
816 //qDebug("dec-- "); 813 //qDebug("dec-- ");
817 } 814 }
818 815
819 connect( mWeekAction, SIGNAL( activated() ), 816 connect( mWeekAction, SIGNAL( activated() ),
820 this, SLOT( weekAction() ) ); 817 this, SLOT( weekAction() ) );
821 818
822 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); 819 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) );
823 if ( p->mShowIconFilterview ) { 820 if ( p->mShowIconFilterview ) {
824 icon = loadPixmap( pathString + "filter" ); 821 icon = loadPixmap( pathString + "filter" );
825 actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this ); 822 actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this );
826 connect( actionFilterMenuTB, SIGNAL( activated() ), 823 connect( actionFilterMenuTB, SIGNAL( activated() ),
827 this, SLOT( fillFilterMenuTB() ) ); 824 this, SLOT( fillFilterMenuTB() ) );
828 actionFilterMenuTB->addTo( iconToolBar ); 825 actionFilterMenuTB->addTo( iconToolBar );
829 selectFilterMenuTB = new QPopupMenu( this ); 826 selectFilterMenuTB = new QPopupMenu( this );
830 selectFilterMenuTB->setCheckable( true ); 827 selectFilterMenuTB->setCheckable( true );
831 connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 828 connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
832 } 829 }
833 830
834 //#endif 831 //#endif
835 // ****************** 832 // ******************
836 QAction *action; 833 QAction *action;
837 // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); 834 // QPopupMenu *configureMenu= new QPopupMenu( menuBar );
838 configureToolBarMenu->setCheckable( true ); 835 configureToolBarMenu->setCheckable( true );
839 836
840 837
841 configureAgendaMenu->setCheckable( true ); 838 configureAgendaMenu->setCheckable( true );
842 int iii ; 839 int iii ;
843 for ( iii = 1;iii<= 10 ;++iii ){ 840 for ( iii = 1;iii<= 10 ;++iii ){
844 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); 841 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 );
845 } 842 }
846 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); 843 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu );
847 844
848 connect( configureAgendaMenu, SIGNAL( aboutToShow()), 845 connect( configureAgendaMenu, SIGNAL( aboutToShow()),
849 this, SLOT( showConfigureAgenda( ) ) ); 846 this, SLOT( showConfigureAgenda( ) ) );
850 icon = loadPixmap( pathString + "today" ); 847 icon = loadPixmap( pathString + "today" );
851 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); 848 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this );
852 today_action->addTo( actionMenu ); 849 today_action->addTo( actionMenu );
853 connect( today_action, SIGNAL( activated() ), 850 connect( today_action, SIGNAL( activated() ),
854 mView, SLOT( goToday() ) ); 851 mView, SLOT( goToday() ) );
855 852
856 icon = loadPixmap( pathString + "picker" ); 853 icon = loadPixmap( pathString + "picker" );
857 QAction* dPickerAction = new QAction( i18n("Select Date..."), icon, i18n("Select Date..."), 0, this ); 854 QAction* dPickerAction = new QAction( i18n("Select Date..."), icon, i18n("Select Date..."), 0, this );
858 dPickerAction->addTo( actionMenu ); 855 dPickerAction->addTo( actionMenu );
859 connect( dPickerAction, SIGNAL( activated() ), 856 connect( dPickerAction, SIGNAL( activated() ),
860 mView, SLOT( showDatePicker() ) ); 857 mView, SLOT( showDatePicker() ) );
861 858
862 icon = loadPixmap( pathString + "search" ); 859 icon = loadPixmap( pathString + "search" );
863 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); 860 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this );
864 search_action->addTo( actionMenu ); 861 search_action->addTo( actionMenu );
865 connect( search_action, SIGNAL( activated() ), 862 connect( search_action, SIGNAL( activated() ),
866 mView->dialogManager(), SLOT( showSearchDialog() ) ); 863 mView->dialogManager(), SLOT( showSearchDialog() ) );
867 actionMenu->insertItem( i18n("Show next conflict for"), nextConflictMenu ); 864 actionMenu->insertItem( i18n("Show next conflict for"), nextConflictMenu );
868 865
869 action = new QAction( "Undo Delete", i18n("All events"), 0, this ); 866 action = new QAction( "Undo Delete", i18n("All events"), 0, this );
870 action->addTo( nextConflictMenu ); 867 action->addTo( nextConflictMenu );
871 connect( action, SIGNAL( activated() ), 868 connect( action, SIGNAL( activated() ),
872 mView, SLOT( conflictAll() ) ); 869 mView, SLOT( conflictAll() ) );
873 870
874 action = new QAction( "Undo Delete", i18n("Allday events"), 0, this ); 871 action = new QAction( "Undo Delete", i18n("Allday events"), 0, this );
875 action->addTo( nextConflictMenu ); 872 action->addTo( nextConflictMenu );
876 connect( action, SIGNAL( activated() ), 873 connect( action, SIGNAL( activated() ),
877 mView, SLOT( conflictAllday() ) ); 874 mView, SLOT( conflictAllday() ) );
878 875
879 action = new QAction( "Undo Delete", i18n("Events with time"), 0, this ); 876 action = new QAction( "Undo Delete", i18n("Events with time"), 0, this );
880 action->addTo( nextConflictMenu ); 877 action->addTo( nextConflictMenu );
881 connect( action, SIGNAL( activated() ), 878 connect( action, SIGNAL( activated() ),
882 mView, SLOT( conflictNotAll() ) ); 879 mView, SLOT( conflictNotAll() ) );
883 880
884 actionMenu->insertSeparator(); 881 actionMenu->insertSeparator();
885 882
886 icon = loadPixmap( pathString + "newevent" ); 883 icon = loadPixmap( pathString + "newevent" );
887 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); 884 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this );
888 ne_action->addTo( mCurrentItemMenu ); 885 ne_action->addTo( mCurrentItemMenu );
889 connect( ne_action, SIGNAL( activated() ), 886 connect( ne_action, SIGNAL( activated() ),
890 mView, SLOT( newEvent() ) ); 887 mView, SLOT( newEvent() ) );
891 icon = loadPixmap( pathString + "newtodo" ); 888 icon = loadPixmap( pathString + "newtodo" );
892 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); 889 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this );
893 nt_action->addTo( mCurrentItemMenu ); 890 nt_action->addTo( mCurrentItemMenu );
894 connect( nt_action, SIGNAL( activated() ), 891 connect( nt_action, SIGNAL( activated() ),
895 mView, SLOT( newTodo() ) ); 892 mView, SLOT( newTodo() ) );
896 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, 893 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0,
897 this ); 894 this );
898 mNewSubTodoAction->addTo( mCurrentItemMenu ); 895 mNewSubTodoAction->addTo( mCurrentItemMenu );
899 connect( mNewSubTodoAction, SIGNAL( activated() ), 896 connect( mNewSubTodoAction, SIGNAL( activated() ),
900 mView, SLOT( newSubTodo() ) ); 897 mView, SLOT( newSubTodo() ) );
901 898
902 mCurrentItemMenu->insertSeparator(); 899 mCurrentItemMenu->insertSeparator();
903 icon = loadPixmap( pathString + "newevent" ); 900 icon = loadPixmap( pathString + "newevent" );
904 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); 901 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 );
905 configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 ); 902 configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 );
906 configureToolBarMenu->insertSeparator(); 903 configureToolBarMenu->insertSeparator();
907 configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 ); 904 configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 );
908 configureToolBarMenu->insertSeparator(); 905 configureToolBarMenu->insertSeparator();
909 configureToolBarMenu->insertItem(i18n("Week Number"), 400); 906 configureToolBarMenu->insertItem(i18n("Week Number"), 400);
910 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); 907 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 );
911 icon = loadPixmap( pathString + "newtodo" ); 908 icon = loadPixmap( pathString + "newtodo" );
912 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); 909 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 );
913 910
914 //actionMenu->insertItem ( i18n("Selected Item"), mCurrentItemMenu); 911 //actionMenu->insertItem ( i18n("Selected Item"), mCurrentItemMenu);
915 mShowAction = new QAction( "show_incidence", i18n("Show"), 0, this ); 912 mShowAction = new QAction( "show_incidence", i18n("Show"), 0, this );
916 mShowAction->addTo( mCurrentItemMenu ); 913 mShowAction->addTo( mCurrentItemMenu );
917 connect( mShowAction, SIGNAL( activated() ), 914 connect( mShowAction, SIGNAL( activated() ),
918 mView, SLOT( showIncidence() ) ); 915 mView, SLOT( showIncidence() ) );
919 916
920 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); 917 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this );
921 mEditAction->addTo( mCurrentItemMenu ); 918 mEditAction->addTo( mCurrentItemMenu );
922 connect( mEditAction, SIGNAL( activated() ), 919 connect( mEditAction, SIGNAL( activated() ),
923 mView, SLOT( editIncidence() ) ); 920 mView, SLOT( editIncidence() ) );
924 921
925 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); 922 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this );
926 mDeleteAction->addTo( mCurrentItemMenu ); 923 mDeleteAction->addTo( mCurrentItemMenu );
927 connect( mDeleteAction, SIGNAL( activated() ), 924 connect( mDeleteAction, SIGNAL( activated() ),
928 mView, SLOT( deleteIncidence() ) ); 925 mView, SLOT( deleteIncidence() ) );
929 926
930 927
931 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); 928 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this );
932 mCloneAction->addTo( mCurrentItemMenu ); 929 mCloneAction->addTo( mCurrentItemMenu );
933 connect( mCloneAction, SIGNAL( activated() ), 930 connect( mCloneAction, SIGNAL( activated() ),
934 mView, SLOT( cloneIncidence() ) ); 931 mView, SLOT( cloneIncidence() ) );
935 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); 932 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this );
936 mMoveAction->addTo( mCurrentItemMenu ); 933 mMoveAction->addTo( mCurrentItemMenu );
937 connect( mMoveAction, SIGNAL( activated() ), 934 connect( mMoveAction, SIGNAL( activated() ),
938 mView, SLOT( moveIncidence() ) ); 935 mView, SLOT( moveIncidence() ) );
939#ifndef DESKTOP_VERSION 936#ifndef DESKTOP_VERSION
940 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); 937 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this );
941 mBeamAction->addTo(mCurrentItemMenu ); 938 mBeamAction->addTo(mCurrentItemMenu );
942 connect( mBeamAction, SIGNAL( activated() ), 939 connect( mBeamAction, SIGNAL( activated() ),
943 mView, SLOT( beamIncidence() ) ); 940 mView, SLOT( beamIncidence() ) );
944#endif 941#endif
945 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); 942 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this );
946 mCancelAction->addTo( mCurrentItemMenu ); 943 mCancelAction->addTo( mCurrentItemMenu );
947 connect( mCancelAction, SIGNAL( activated() ), 944 connect( mCancelAction, SIGNAL( activated() ),
948 mView, SLOT( toggleCancelIncidence() ) ); 945 mView, SLOT( toggleCancelIncidence() ) );
949 946
950 947
951 mCurrentItemMenu->insertSeparator(); 948 mCurrentItemMenu->insertSeparator();
952 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); 949 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this );
953 action->addTo( mCurrentItemMenu ); 950 action->addTo( mCurrentItemMenu );
954 connect( action, SIGNAL( activated() ), 951 connect( action, SIGNAL( activated() ),
955 mView, SLOT( undo_delete() ) ); 952 mView, SLOT( undo_delete() ) );
956 953
957 // *********************** 954 // ***********************
958 if ( KOPrefs::instance()->mVerticalScreen ) { 955 if ( KOPrefs::instance()->mVerticalScreen ) {
959 icon = SmallIcon( "1updownarrow" ); 956 icon = SmallIcon( "1updownarrow" );
960 } else { 957 } else {
961 icon = SmallIcon("1leftrightarrow" ); 958 icon = SmallIcon("1leftrightarrow" );
962 } 959 }
963 configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 ); 960 configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 );
964 QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this ); 961 QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this );
965 FSaction->addTo( viewMenu ); 962 FSaction->addTo( viewMenu );
966 connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() )); 963 connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() ));
967 964
968 965
969 icon = loadPixmap( pathString + "filter" ); 966 icon = loadPixmap( pathString + "filter" );
970 configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 ); 967 configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 );
971 icon = loadPixmap( pathString + "configure" ); 968 icon = loadPixmap( pathString + "configure" );
972 action = new QAction( i18n("Toggle Resource View"), icon, i18n("Toggle Resource View"), 0, this ); 969 action = new QAction( i18n("Toggle Resource View"), icon, i18n("Toggle Resource View"), 0, this );
973 action->addTo( viewMenu ); 970 action->addTo( viewMenu );
974 connect( action, SIGNAL( activated() ), 971 connect( action, SIGNAL( activated() ),
975 mView, SLOT( toggleFilter() ) ); 972 mView, SLOT( toggleFilter() ) );
976 mToggleFilter = action; 973 mToggleFilter = action;
977 icon = loadPixmap( pathString + "navi" ); 974 icon = loadPixmap( pathString + "navi" );
978 configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 ); 975 configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 );
979 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); 976 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this );
980 action->addTo( viewMenu ); 977 action->addTo( viewMenu );
981 connect( action, SIGNAL( activated() ), 978 connect( action, SIGNAL( activated() ),
982 mView, SLOT( toggleDateNavigatorWidget() ) ); 979 mView, SLOT( toggleDateNavigatorWidget() ) );
983 mToggleNav = action ; 980 mToggleNav = action ;
984 icon = loadPixmap( pathString + "allday" ); 981 icon = loadPixmap( pathString + "allday" );
985 configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 ); 982 configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 );
986 action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); 983 action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this );
987 action->addTo( viewMenu ); 984 action->addTo( viewMenu );
988 connect( action, SIGNAL( activated() ), 985 connect( action, SIGNAL( activated() ),
989 mView, SLOT( toggleAllDaySize() ) ); 986 mView, SLOT( toggleAllDaySize() ) );
990 mToggleAllday = action; 987 mToggleAllday = action;
991 988
992 989
993 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 990 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
994 mToggleNav, SLOT( setEnabled ( bool ) ) ); 991 mToggleNav, SLOT( setEnabled ( bool ) ) );
995 //connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 992 //connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
996 // mToggleFilter, SLOT( setEnabled ( bool ) ) ); 993 // mToggleFilter, SLOT( setEnabled ( bool ) ) );
997 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), 994 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ),
998 mToggleAllday, SLOT( setEnabled ( bool ) ) ); 995 mToggleAllday, SLOT( setEnabled ( bool ) ) );
999 // connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), 996 // connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ),
1000 // configureAgendaMenu, SLOT( setEnabled ( bool ) ) ); 997 // configureAgendaMenu, SLOT( setEnabled ( bool ) ) );
1001 998
1002 999
1003 dPickerAction->addTo( iconToolBar ); 1000 dPickerAction->addTo( iconToolBar );
1004 viewMenu->insertSeparator(); 1001 viewMenu->insertSeparator();
1005 1002
1006 if ( p-> mShowIconToggleFull ) 1003 if ( p-> mShowIconToggleFull )
1007 FSaction->addTo( iconToolBar ); 1004 FSaction->addTo( iconToolBar );
1008 if ( p->mShowIconNavigator ) mToggleNav ->addTo( iconToolBar ); 1005 if ( p->mShowIconNavigator ) mToggleNav ->addTo( iconToolBar );
1009 1006
1010 //******************** 1007 //********************
1011 if ( p->mShowIconAllday ) mToggleAllday->addTo( iconToolBar ); 1008 if ( p->mShowIconAllday ) mToggleAllday->addTo( iconToolBar );
1012 1009
1013 1010
1014 icon = loadPixmap( pathString + "whatsnext" ); 1011 icon = loadPixmap( pathString + "whatsnext" );
1015 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 ); 1012 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 );
1016 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); 1013 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this );
1017 whatsnext_action->addTo( viewMenu ); 1014 whatsnext_action->addTo( viewMenu );
1018 connect( whatsnext_action, SIGNAL( activated() ), 1015 connect( whatsnext_action, SIGNAL( activated() ),
1019 mView->viewManager(), SLOT( showWhatsNextView() ) ); 1016 mView->viewManager(), SLOT( showWhatsNextView() ) );
1020 1017
1021 icon = loadPixmap( pathString + "xdays" ); 1018 icon = loadPixmap( pathString + "xdays" );
1022 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 ); 1019 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 );
1023 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); 1020 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this );
1024 xdays_action->addTo( viewMenu ); 1021 xdays_action->addTo( viewMenu );
1025 connect( xdays_action, SIGNAL( activated() ), 1022 connect( xdays_action, SIGNAL( activated() ),
1026 mView->viewManager(), SLOT( showNextXView() ) ); 1023 mView->viewManager(), SLOT( showNextXView() ) );
1027 1024
1028 1025
1029 icon = loadPixmap( pathString + "journal" ); 1026 icon = loadPixmap( pathString + "journal" );
1030 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); 1027 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 );
1031 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); 1028 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this );
1032 viewjournal_action->addTo( viewMenu ); 1029 viewjournal_action->addTo( viewMenu );
1033 connect( viewjournal_action, SIGNAL( activated() ), 1030 connect( viewjournal_action, SIGNAL( activated() ),
1034 mView->viewManager(), SLOT( showJournalView() ) ); 1031 mView->viewManager(), SLOT( showJournalView() ) );
1035 1032
1036 1033
1037 icon = loadPixmap( pathString + "day" ); 1034 icon = loadPixmap( pathString + "day" );