summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-09-19 00:01:34 (UTC)
committer zautrix <zautrix>2005-09-19 00:01:34 (UTC)
commitd73247ed44cab687a0d94a96ea7b3cf604b80ba0 (patch) (unidiff)
tree7e72ac8e0239163cfec8df67c0053e0cb3a8dd2f
parent2d346e4052fd726e657daee4ac3f2bcc7103f5fb (diff)
downloadkdepimpi-d73247ed44cab687a0d94a96ea7b3cf604b80ba0.zip
kdepimpi-d73247ed44cab687a0d94a96ea7b3cf604b80ba0.tar.gz
kdepimpi-d73247ed44cab687a0d94a96ea7b3cf604b80ba0.tar.bz2
wn
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/mainwindow.cpp3
1 files changed, 0 insertions, 3 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index fb0b4ad..1776dcc 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -232,406 +232,403 @@ MainWindow::MainWindow( QWidget *parent, const char *name ) :
232 filterPopupMenu = new QPopupMenu( this ); 232 filterPopupMenu = new QPopupMenu( this );
233 filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 ); 233 filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 );
234 QString addTest = "A"; 234 QString addTest = "A";
235 filterMenubar->setMinimumWidth( fm.width( i18n("No Filter")+addTest ) ); 235 filterMenubar->setMinimumWidth( fm.width( i18n("No Filter")+addTest ) );
236#ifdef DESKTOP_VERSION 236#ifdef DESKTOP_VERSION
237 addTest = "AAAAAABBBCCCx"; 237 addTest = "AAAAAABBBCCCx";
238#else 238#else
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
425 qDebug("KO: Start loading files..." ); 424 qDebug("KO: Start loading files..." );
426 QTime neededSaveTime = QDateTime::currentDateTime().time(); 425 QTime neededSaveTime = QDateTime::currentDateTime().time();
427 mView->loadCalendars(); 426 mView->loadCalendars();
428 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 427 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
429 qDebug("KO: Calendar loading time: %d ms",msNeeded ); 428 qDebug("KO: Calendar loading time: %d ms",msNeeded );
430 //QTimer::singleShot( 1000, mView, SLOT ( checkFiles() )); 429 //QTimer::singleShot( 1000, mView, SLOT ( checkFiles() ));
431 mView->setModified( false ); 430 mView->setModified( false );
432 mBlockAtStartup = false; 431 mBlockAtStartup = false;
433 mView->setModified( false ); 432 mView->setModified( false );
434 connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); 433 connect(mView , SIGNAL( save() ), this, SLOT( save() ) );
435 processIncidenceSelection( 0 ); 434 processIncidenceSelection( 0 );
436 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), 435 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ),
437 SLOT( processIncidenceSelection( Incidence * ) ) ); 436 SLOT( processIncidenceSelection( Incidence * ) ) );
438 connect( mView, SIGNAL( modifiedChanged( bool ) ), 437 connect( mView, SIGNAL( modifiedChanged( bool ) ),
439 SLOT( slotModifiedChanged( bool ) ) ); 438 SLOT( slotModifiedChanged( bool ) ) );
440
441#ifndef DESKTOP_VERSION 439#ifndef DESKTOP_VERSION
442 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 & )));
443 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& )));
444 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& )));
445 ((QPEApplication*) qApp)->showMainWidget( this );
446 if ( !mCStringMess.isEmpty() ) 443 if ( !mCStringMess.isEmpty() )
447 recieve( mCStringMess, mByteData ); 444 recieve( mCStringMess, mByteData );
448#endif 445#endif
449 QTimer::singleShot( 1000, mView, SLOT ( checkFiles() )); 446 QTimer::singleShot( 1000, mView, SLOT ( checkFiles() ));
450} 447}
451 448
452void MainWindow::slotResetFocus() 449void MainWindow::slotResetFocus()
453{ 450{
454 //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);
455 mFocusLoop = 3; 452 mFocusLoop = 3;
456 QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() )); 453 QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() ));
457} 454}
458void MainWindow::slotResetFocusLoop() 455void MainWindow::slotResetFocusLoop()
459{ 456{
460 --mFocusLoop; 457 --mFocusLoop;
461 QWidget* fw = mView->viewManager()->currentView(); 458 QWidget* fw = mView->viewManager()->currentView();
462 if ( fw ) { 459 if ( fw ) {
463 //qDebug("loop "); 460 //qDebug("loop ");
464 fw->setFocus(); 461 fw->setFocus();
465 if ( qApp->focusWidget() != fw && mFocusLoop > 0 ) 462 if ( qApp->focusWidget() != fw && mFocusLoop > 0 )
466 QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() )); 463 QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() ));
467 } 464 }
468 465
469} 466}
470void MainWindow::disableBR(bool b) 467void MainWindow::disableBR(bool b)
471{ 468{
472#ifndef DESKTOP_VERSION 469#ifndef DESKTOP_VERSION
473 if ( b ) { 470 if ( b ) {
474 if ( infrared ) { 471 if ( infrared ) {
475 toggleBeamReceive(); 472 toggleBeamReceive();
476 mBRdisabled = true; 473 mBRdisabled = true;
477 } 474 }
478 mBRdisabled = true; 475 mBRdisabled = true;
479 } else { 476 } else {
480 if ( mBRdisabled ) { 477 if ( mBRdisabled ) {
481 mBRdisabled = false; 478 mBRdisabled = false;
482 //makes no sense,because other cal ap is probably running 479 //makes no sense,because other cal ap is probably running
483 // toggleBeamReceive(); 480 // toggleBeamReceive();
484 } 481 }
485 } 482 }
486#endif 483#endif
487 484
488} 485}
489bool MainWindow::beamReceiveEnabled() 486bool MainWindow::beamReceiveEnabled()
490{ 487{
491#ifndef DESKTOP_VERSION 488#ifndef DESKTOP_VERSION
492 return ( infrared != 0 ); 489 return ( infrared != 0 );
493#endif 490#endif
494 return false; 491 return false;
495} 492}
496 493
497void MainWindow::toggleBeamReceive() 494void MainWindow::toggleBeamReceive()
498{ 495{
499 if ( mBRdisabled ) 496 if ( mBRdisabled )
500 return; 497 return;
501#ifndef DESKTOP_VERSION 498#ifndef DESKTOP_VERSION
502 if ( infrared ) { 499 if ( infrared ) {
503 qDebug("KO: Disable BeamReceive "); 500 qDebug("KO: Disable BeamReceive ");
504 delete infrared; 501 delete infrared;
505 infrared = 0; 502 infrared = 0;
506 brAction->setOn(false); 503 brAction->setOn(false);
507 return; 504 return;
508 } 505 }
509 qDebug("KO: Enable BeamReceive "); 506 qDebug("KO: Enable BeamReceive ");
510 brAction->setOn(true); 507 brAction->setOn(true);
511 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; 508 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ;
512 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& )));
513#endif 510#endif
514} 511}
515void MainWindow::showMaximized () 512void MainWindow::showMaximized ()
516{ 513{
517#ifndef DESKTOP_VERSION 514#ifndef DESKTOP_VERSION
518 if ( ! globalFlagBlockStartup ) 515 if ( ! globalFlagBlockStartup )
519 if ( mClosed ) 516 if ( mClosed )
520 mView->goToday(); 517 mView->goToday();
521#endif 518#endif
522 QWidget::showMaximized () ; 519 QWidget::showMaximized () ;
523 mClosed = false; 520 mClosed = false;
524} 521}
525 522
526bool MainWindow::askForQuitOnSaveError() 523bool MainWindow::askForQuitOnSaveError()
527{ 524{
528 bool retval = false; 525 bool retval = false;
529 switch( QMessageBox::information( this, "KO/Pi", 526 switch( QMessageBox::information( this, "KO/Pi",
530 i18n("Error saving data") + "!\n" + 527 i18n("Error saving data") + "!\n" +
531 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" +
532 i18n("Do you really want\nto close KO/Pi?"), 529 i18n("Do you really want\nto close KO/Pi?"),
533 i18n(" Yes, close "), i18n("No"), 530 i18n(" Yes, close "), i18n("No"),
534 0, 1 ) ) { 531 0, 1 ) ) {
535 case 0: 532 case 0:
536 retval = true; 533 retval = true;
537 break; 534 break;
538 default: 535 default:
539 break; 536 break;
540 } 537 }
541 return retval; 538 return retval;
542} 539}
543 540
544void MainWindow::closeEvent( QCloseEvent* ce ) 541void MainWindow::closeEvent( QCloseEvent* ce )
545{ 542{
546 543
547 544
548 545
549 if ( ! KOPrefs::instance()->mAskForQuit ) { 546 if ( ! KOPrefs::instance()->mAskForQuit ) {
550 saveOnClose(); 547 saveOnClose();
551 if ( mCalendarModifiedFlag && !askForQuitOnSaveError() ) { 548 if ( mCalendarModifiedFlag && !askForQuitOnSaveError() ) {
552 ce->ignore(); 549 ce->ignore();
553 return; 550 return;
554 } 551 }
555 mClosed = true; 552 mClosed = true;
556 ce->accept(); 553 ce->accept();
557 return; 554 return;
558 555
559 } 556 }
560 557
561 switch( QMessageBox::information( this, "KO/Pi", 558 switch( QMessageBox::information( this, "KO/Pi",
562 i18n("Do you really want\nto close KO/Pi?"), 559 i18n("Do you really want\nto close KO/Pi?"),
563 i18n("Close"), i18n("No"), 560 i18n("Close"), i18n("No"),
564 0, 0 ) ) { 561 0, 0 ) ) {
565 case 0: 562 case 0:
566 saveOnClose(); 563 saveOnClose();
567 if ( mCalendarModifiedFlag && !askForQuitOnSaveError() ) { 564 if ( mCalendarModifiedFlag && !askForQuitOnSaveError() ) {
568 ce->ignore(); 565 ce->ignore();
569 return; 566 return;
570 } 567 }
571 mClosed = true; 568 mClosed = true;
572 ce->accept(); 569 ce->accept();
573 break; 570 break;
574 case 1: 571 case 1:
575 ce->ignore(); 572 ce->ignore();
576 break; 573 break;
577 case 2: 574 case 2:
578 575
579 default: 576 default:
580 break; 577 break;
581 } 578 }
582 579
583 580
584} 581}
585void MainWindow::receiveStart( const QCString& cmsg, const QByteArray& data ) 582void MainWindow::receiveStart( const QCString& cmsg, const QByteArray& data )
586{ 583{
587 qDebug("KO: QCOP start message received: %s ", cmsg.data() ); 584 qDebug("KO: QCOP start message received: %s ", cmsg.data() );
588 mCStringMess = cmsg; 585 mCStringMess = cmsg;
589 mByteData = data; 586 mByteData = data;
590} 587}
591void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) 588void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
592{ 589{
593 QDataStream stream( data, IO_ReadOnly ); 590 QDataStream stream( data, IO_ReadOnly );
594 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); 591 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" );
595 //QString datamess; 592 //QString datamess;
596 //qDebug("message "); 593 //qDebug("message ");
597 qDebug("KO: QCOP message received: %s ", cmsg.data() ); 594 qDebug("KO: QCOP message received: %s ", cmsg.data() );
598 595
599 if ( cmsg == "setDocument(QString)" ) { 596 if ( cmsg == "setDocument(QString)" ) {
600 QDataStream stream( data, IO_ReadOnly ); 597 QDataStream stream( data, IO_ReadOnly );
601 QString fileName; 598 QString fileName;
602 stream >> fileName; 599 stream >> fileName;
603 //qDebug("filename %s ", fileName.latin1()); 600 //qDebug("filename %s ", fileName.latin1());
604 showMaximized(); 601 showMaximized();
605 raise(); 602 raise();
606 KOPrefs::instance()->mLastSyncedLocalFile = fileName ; 603 KOPrefs::instance()->mLastSyncedLocalFile = fileName ;
607 mSyncManager->slotSyncMenu( 1002 ); 604 mSyncManager->slotSyncMenu( 1002 );
608 return; 605 return;
609 } 606 }
610 607
611 if ( cmsg == "-writeFile" ) { 608 if ( cmsg == "-writeFile" ) {
612 // I made from the "-writeFile" an "-writeAlarm" 609 // I made from the "-writeFile" an "-writeAlarm"
613 mView->viewManager()->showWhatsNextView(); 610 mView->viewManager()->showWhatsNextView();
614 mCalendar->checkAlarmForIncidence( 0, true); 611 mCalendar->checkAlarmForIncidence( 0, true);
615 showMaximized(); 612 showMaximized();
616 raise(); 613 raise();
617 return; 614 return;
618 615
619 } 616 }
620 if ( cmsg == "-writeFileSilent" ) { 617 if ( cmsg == "-writeFileSilent" ) {
621 // I made from the "-writeFile" an "-writeAlarm" 618 // I made from the "-writeFile" an "-writeAlarm"
622 // mView->viewManager()->showWhatsNextView(); 619 // mView->viewManager()->showWhatsNextView();
623 mCalendar->checkAlarmForIncidence( 0, true); 620 mCalendar->checkAlarmForIncidence( 0, true);
624 //showMaximized(); 621 //showMaximized();
625 //raise(); 622 //raise();
626 hide(); 623 hide();
627 return; 624 return;
628 } 625 }
629 if ( cmsg == "-newCountdown" ) { 626 if ( cmsg == "-newCountdown" ) {
630 qDebug("newCountdown "); 627 qDebug("newCountdown ");
631 628
632 } 629 }
633 QString msg ; 630 QString msg ;
634 QString allmsg = cmsg; 631 QString allmsg = cmsg;
635 while ( allmsg.length() > 0 ) { 632 while ( allmsg.length() > 0 ) {
636 int nextC = allmsg.find( "-", 1 ); 633 int nextC = allmsg.find( "-", 1 );
637 if ( nextC == -1 ) { 634 if ( nextC == -1 ) {