summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/todo/mainwindow.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp
index ad7899f..7f40645 100644
--- a/core/pim/todo/mainwindow.cpp
+++ b/core/pim/todo/mainwindow.cpp
@@ -348,129 +348,129 @@ bool MainWindow::isSyncing()const {
348 return m_syncing; 348 return m_syncing;
349} 349}
350TemplateManager* MainWindow::templateManager() { 350TemplateManager* MainWindow::templateManager() {
351 return m_tempManager; 351 return m_tempManager;
352} 352}
353Editor* MainWindow::currentEditor() { 353Editor* MainWindow::currentEditor() {
354 return m_curEdit; 354 return m_curEdit;
355} 355}
356TodoShow* MainWindow::currentShow() { 356TodoShow* MainWindow::currentShow() {
357 return m_curShow; 357 return m_curShow;
358} 358}
359void MainWindow::slotReload() { 359void MainWindow::slotReload() {
360 m_syncing = FALSE; 360 m_syncing = FALSE;
361 m_todoMgr.reload(); 361 m_todoMgr.reload();
362 currentView()->updateView( ); 362 currentView()->updateView( );
363 raiseCurrentView(); 363 raiseCurrentView();
364} 364}
365void MainWindow::closeEvent( QCloseEvent* e ) { 365void MainWindow::closeEvent( QCloseEvent* e ) {
366 if (m_stack->visibleWidget() == currentShow()->widget() ) { 366 if (m_stack->visibleWidget() == currentShow()->widget() ) {
367 m_showing = false; 367 m_showing = false;
368 raiseCurrentView(); 368 raiseCurrentView();
369 e->ignore(); 369 e->ignore();
370 return; 370 return;
371 } 371 }
372 /* 372 /*
373 * we should have flushed and now we're still saving 373 * we should have flushed and now we're still saving
374 * so there is no need to flush 374 * so there is no need to flush
375 */ 375 */
376 if (m_syncing ) { 376 if (m_syncing ) {
377 e->accept(); 377 e->accept();
378 return; 378 return;
379 } 379 }
380 bool quit = false; 380 bool quit = false;
381 if ( m_todoMgr.saveAll() ){ 381 if ( m_todoMgr.saveAll() ){
382 qWarning("saved"); 382 qWarning("saved");
383 quit = true; 383 quit = true;
384 }else { 384 }else {
385 if ( QMessageBox::critical( this, QWidget::tr("Out of space"), 385 if ( QMessageBox::critical( this, QWidget::tr("Out of space"),
386 QWidget::tr("Todo was unable\n" 386 QWidget::tr("Todo was unable\n"
387 "to save your changes.\n" 387 "to save your changes.\n"
388 "Free up some space\n" 388 "Free up some space\n"
389 "and try again.\n" 389 "and try again.\n"
390 "\nQuit Anyway?"), 390 "\nQuit Anyway?"),
391 QMessageBox::Yes|QMessageBox::Escape, 391 QMessageBox::Yes|QMessageBox::Escape,
392 QMessageBox::No|QMessageBox::Default) 392 QMessageBox::No|QMessageBox::Default)
393 != QMessageBox::No ) { 393 != QMessageBox::No ) {
394 e->accept(); 394 e->accept();
395 quit = true; 395 quit = true;
396 }else 396 }else
397 e->ignore(); 397 e->ignore();
398 398
399 } 399 }
400 400
401 if (quit ) { 401 if (quit ) {
402 Config config( "todo" ); 402 Config config( "todo" );
403 config.setGroup( "View" ); 403 config.setGroup( "View" );
404 config.writeEntry( "ShowComplete", showCompleted() ); 404 config.writeEntry( "ShowComplete", showCompleted() );
405 config.writeEntry( "Category", currentCategory() ); 405 config.writeEntry( "Category", currentCategory() );
406 config.writeEntry( "ShowDeadLine", showDeadline()); 406 config.writeEntry( "ShowDeadLine", showDeadline());
407 config.writeEntry( "ShowOverDue", showOverDue() ); 407 config.writeEntry( "ShowOverDue", showOverDue() );
408 config.writeEntry( "ShowQuickTask", showQuickTask() ); 408 config.writeEntry( "ShowQuickTask", showQuickTask() );
409 /* save templates */ 409 /* save templates */
410 templateManager()->save(); 410 templateManager()->save();
411 e->accept(); 411 e->accept();
412 qApp->quit(); 412 QTimer::singleShot(0, qApp, SLOT(closeAllWindows()) );
413 } 413 }
414} 414}
415void MainWindow::populateTemplates() { 415void MainWindow::populateTemplates() {
416 m_template->clear(); 416 m_template->clear();
417 QStringList list = templateManager()->templates(); 417 QStringList list = templateManager()->templates();
418 QStringList::Iterator it; 418 QStringList::Iterator it;
419 for ( it = list.begin(); it != list.end(); ++it ) { 419 for ( it = list.begin(); it != list.end(); ++it ) {
420 m_template->insertItem( (*it) ); 420 m_template->insertItem( (*it) );
421 } 421 }
422} 422}
423/* 423/*
424 * slotNewFromTemplate 424 * slotNewFromTemplate
425 * We use the edit widget to do 425 * We use the edit widget to do
426 * the config but we setUid(1) 426 * the config but we setUid(1)
427 * to get a new uid 427 * to get a new uid
428 */ 428 */
429/* 429/*
430 * first we get the name of the template 430 * first we get the name of the template
431 * then we will use the TemplateManager 431 * then we will use the TemplateManager
432 */ 432 */
433void MainWindow::slotNewFromTemplate( int id ) { 433void MainWindow::slotNewFromTemplate( int id ) {
434 QString name = m_template->text( id ); 434 QString name = m_template->text( id );
435 435
436 OTodo event = templateManager()->templateEvent( name ); 436 OTodo event = templateManager()->templateEvent( name );
437 event = currentEditor()->edit(this, 437 event = currentEditor()->edit(this,
438 event ); 438 event );
439 439
440 if ( currentEditor()->accepted() ) { 440 if ( currentEditor()->accepted() ) {
441 /* assign new todo */ 441 /* assign new todo */
442 event.setUid( 1 ); 442 event.setUid( 1 );
443 handleAlarms( OTodo(), event ); 443 handleAlarms( OTodo(), event );
444 m_todoMgr.add( event ); 444 m_todoMgr.add( event );
445 currentView()->addEvent( event ); 445 currentView()->addEvent( event );
446 446
447 populateCategories(); 447 populateCategories();
448 } 448 }
449 raiseCurrentView(); 449 raiseCurrentView();
450} 450}
451void MainWindow::slotNew() { 451void MainWindow::slotNew() {
452 create(); 452 create();
453} 453}
454void MainWindow::slotDuplicate() { 454void MainWindow::slotDuplicate() {
455 if(m_syncing) { 455 if(m_syncing) {
456 QMessageBox::warning(this, QWidget::tr("Todo"), 456 QMessageBox::warning(this, QWidget::tr("Todo"),
457 QWidget::tr("Data can not be edited, currently syncing")); 457 QWidget::tr("Data can not be edited, currently syncing"));
458 return; 458 return;
459 } 459 }
460 OTodo ev = m_todoMgr.event( currentView()->current() ); 460 OTodo ev = m_todoMgr.event( currentView()->current() );
461 /* let's generate a new uid */ 461 /* let's generate a new uid */
462 ev.setUid(1); 462 ev.setUid(1);
463 m_todoMgr.add( ev ); 463 m_todoMgr.add( ev );
464 464
465 currentView()->addEvent( ev ); 465 currentView()->addEvent( ev );
466 raiseCurrentView(); 466 raiseCurrentView();
467} 467}
468void MainWindow::slotDelete() { 468void MainWindow::slotDelete() {
469 if (!currentView()->current() ) 469 if (!currentView()->current() )
470 return; 470 return;
471 471
472 if(m_syncing) { 472 if(m_syncing) {
473 QMessageBox::warning(this, QWidget::tr("Todo"), 473 QMessageBox::warning(this, QWidget::tr("Todo"),
474 QWidget::tr("Data can not be edited, currently syncing")); 474 QWidget::tr("Data can not be edited, currently syncing"));
475 return; 475 return;
476 } 476 }