author | eilers <eilers> | 2003-08-01 14:22:29 (UTC) |
---|---|---|
committer | eilers <eilers> | 2003-08-01 14:22:29 (UTC) |
commit | 7d51872c86155fbbf27aeb8e49e7a336d909caac (patch) (unidiff) | |
tree | 55ecf3452d6711065e36c6bceab8ec52bd5525d8 /core/pim | |
parent | 34991bac7d96b1c17601be6a5607819342571e0c (diff) | |
download | opie-7d51872c86155fbbf27aeb8e49e7a336d909caac.zip opie-7d51872c86155fbbf27aeb8e49e7a336d909caac.tar.gz opie-7d51872c86155fbbf27aeb8e49e7a336d909caac.tar.bz2 |
Merging changes from BRANCH_1_0 to HEAD
-rw-r--r-- | core/pim/todo/main.cpp | 3 | ||||
-rw-r--r-- | core/pim/todo/mainwindow.cpp | 120 | ||||
-rw-r--r-- | core/pim/todo/mainwindow.h | 4 | ||||
-rw-r--r-- | core/pim/todo/opie-todo.control | 6 | ||||
-rw-r--r-- | core/pim/todo/otaskeditor.cpp | 14 | ||||
-rw-r--r-- | core/pim/todo/otaskeditor.h | 3 | ||||
-rw-r--r-- | core/pim/todo/quickedit.cpp | 1 | ||||
-rw-r--r-- | core/pim/todo/quickeditimpl.cpp | 7 | ||||
-rw-r--r-- | core/pim/todo/smalltodo.cpp | 1 | ||||
-rw-r--r-- | core/pim/todo/tableview.cpp | 84 | ||||
-rw-r--r-- | core/pim/todo/tableview.h | 18 | ||||
-rw-r--r-- | core/pim/todo/taskeditoralarms.cpp | 5 | ||||
-rw-r--r-- | core/pim/todo/taskeditoroverview.cpp | 6 | ||||
-rw-r--r-- | core/pim/todo/taskeditorstatus.cpp | 5 | ||||
-rw-r--r-- | core/pim/todo/templatedialogimpl.cpp | 1 | ||||
-rw-r--r-- | core/pim/todo/textviewshow.cpp | 18 | ||||
-rw-r--r-- | core/pim/todo/todomanager.cpp | 1 | ||||
-rw-r--r-- | core/pim/todo/todoshow.cpp | 8 | ||||
-rw-r--r-- | core/pim/todo/todoshow.h | 2 | ||||
-rw-r--r-- | core/pim/todo/todoview.cpp | 3 | ||||
-rw-r--r-- | core/pim/todo/todoview.h | 12 |
21 files changed, 264 insertions, 58 deletions
diff --git a/core/pim/todo/main.cpp b/core/pim/todo/main.cpp index 58ed45c..7763169 100644 --- a/core/pim/todo/main.cpp +++ b/core/pim/todo/main.cpp | |||
@@ -12,38 +12,37 @@ | |||
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include "mainwindow.h" | 21 | #include "mainwindow.h" |
22 | 22 | ||
23 | 23 | ||
24 | #include <qdatetime.h> | ||
25 | 24 | ||
26 | #include <qpe/qpeapplication.h> | 25 | #include <qpe/qpeapplication.h> |
27 | 26 | ||
28 | void myMessages( QtMsgType, const char* ) { | 27 | void myMessages( QtMsgType, const char* ) { |
29 | 28 | ||
30 | } | 29 | } |
31 | 30 | ||
32 | int main( int argc, char **argv ) | 31 | int main( int argc, char **argv ) |
33 | { | 32 | { |
34 | qInstallMsgHandler( myMessages ); | 33 | qInstallMsgHandler( myMessages ); |
35 | QPEApplication a( argc, argv ); | 34 | QPEApplication a( argc, argv ); |
36 | 35 | ||
37 | QTime time; | 36 | QTime time; |
38 | time.start(); | 37 | time.start(); |
39 | Todo::MainWindow mw; | 38 | Todo::MainWindow mw; |
40 | int t = time.elapsed(); | 39 | int t = time.elapsed(); |
41 | qWarning("QTime %d", t/1000 ); | 40 | qWarning("QTime %d", t/1000 ); |
42 | mw.setCaption("Opie Todolist"); | 41 | mw.setCaption( QObject::tr("Opie Todolist")); |
43 | QObject::connect( &a, SIGNAL( flush() ), &mw, SLOT( slotFlush() ) ); | 42 | QObject::connect( &a, SIGNAL( flush() ), &mw, SLOT( slotFlush() ) ); |
44 | QObject::connect( &a, SIGNAL( reload() ), &mw, SLOT( slotReload() ) ); | 43 | QObject::connect( &a, SIGNAL( reload() ), &mw, SLOT( slotReload() ) ); |
45 | 44 | ||
46 | a.showMainWidget(&mw); | 45 | a.showMainWidget(&mw); |
47 | 46 | ||
48 | return a.exec(); | 47 | return a.exec(); |
49 | } | 48 | } |
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp index 5119ae0..6725951 100644 --- a/core/pim/todo/mainwindow.cpp +++ b/core/pim/todo/mainwindow.cpp | |||
@@ -62,24 +62,25 @@ | |||
62 | #include "textviewshow.h" | 62 | #include "textviewshow.h" |
63 | #include "todoeditor.h" | 63 | #include "todoeditor.h" |
64 | #include "mainwindow.h" | 64 | #include "mainwindow.h" |
65 | 65 | ||
66 | 66 | ||
67 | using namespace Todo; | 67 | using namespace Todo; |
68 | 68 | ||
69 | MainWindow::MainWindow( QWidget* parent, | 69 | MainWindow::MainWindow( QWidget* parent, |
70 | const char* name ) | 70 | const char* name ) |
71 | : OPimMainWindow( "Todolist", parent, name, WType_TopLevel | WStyle_ContextHelp ) | 71 | : OPimMainWindow( "Todolist", parent, name, WType_TopLevel | WStyle_ContextHelp ) |
72 | { | 72 | { |
73 | m_syncing = false; | 73 | m_syncing = false; |
74 | m_showing = false; | ||
74 | m_counter = 0; | 75 | m_counter = 0; |
75 | m_tempManager = new TemplateManager(); | 76 | m_tempManager = new TemplateManager(); |
76 | m_tempManager->load(); | 77 | m_tempManager->load(); |
77 | 78 | ||
78 | initUI(); | 79 | initUI(); |
79 | initConfig(); | 80 | initConfig(); |
80 | initViews(); | 81 | initViews(); |
81 | initActions(); | 82 | initActions(); |
82 | initEditor(); | 83 | initEditor(); |
83 | initShow(); | 84 | initShow(); |
84 | initTemplate(); | 85 | initTemplate(); |
85 | 86 | ||
@@ -152,32 +153,35 @@ void MainWindow::initActions() { | |||
152 | m_duplicateAction = a; | 153 | m_duplicateAction = a; |
153 | 154 | ||
154 | m_edit->insertSeparator(); | 155 | m_edit->insertSeparator(); |
155 | 156 | ||
156 | if ( Ir::supported() ) { | 157 | if ( Ir::supported() ) { |
157 | a = new QAction( QWidget::tr( "Beam" ), Resource::loadPixmap( "beam" ), QString::null, 0, this, 0 ); | 158 | a = new QAction( QWidget::tr( "Beam" ), Resource::loadPixmap( "beam" ), QString::null, 0, this, 0 ); |
158 | connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) ); | 159 | connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) ); |
159 | a->setWhatsThis( QWidget::tr( "Click here to send the current task to another device." ) ); | 160 | a->setWhatsThis( QWidget::tr( "Click here to send the current task to another device." ) ); |
160 | a->addTo( m_edit ); | 161 | a->addTo( m_edit ); |
161 | a->addTo( m_tool ); | 162 | a->addTo( m_tool ); |
162 | } | 163 | } |
163 | 164 | ||
165 | #if 0 | ||
164 | // Options menu | 166 | // Options menu |
165 | a = new QAction( QWidget::tr("Find"), Resource::loadIconSet( "mag" ), | 167 | a = new QAction( QWidget::tr("Find"), Resource::loadIconSet( "mag" ), |
166 | QString::null, 0, this, 0 ); | 168 | QString::null, 0, this, 0 ); |
167 | connect(a, SIGNAL( activated() ), this, SLOT( slotFind() ) ); | 169 | connect(a, SIGNAL( activated() ), this, SLOT( slotFind() ) ); |
168 | a->addTo( m_options ); | 170 | a->addTo( m_options ); |
169 | m_findAction = a; | 171 | m_findAction = a; |
170 | 172 | ||
173 | |||
171 | m_options->insertSeparator(); | 174 | m_options->insertSeparator(); |
175 | #endif | ||
172 | 176 | ||
173 | m_completedAction = new QAction( QString::null, QWidget::tr("Show completed tasks"), | 177 | m_completedAction = new QAction( QString::null, QWidget::tr("Show completed tasks"), |
174 | 0, this, 0, TRUE ); | 178 | 0, this, 0, TRUE ); |
175 | m_completedAction->addTo( m_options ); | 179 | m_completedAction->addTo( m_options ); |
176 | m_completedAction->setOn( showCompleted() ); | 180 | m_completedAction->setOn( showCompleted() ); |
177 | connect(m_completedAction, SIGNAL( toggled(bool) ), this, SLOT(slotShowCompleted(bool) ) ); | 181 | connect(m_completedAction, SIGNAL( toggled(bool) ), this, SLOT(slotShowCompleted(bool) ) ); |
178 | 182 | ||
179 | a = new QAction( QString::null, QWidget::tr("Show only over-due tasks"), | 183 | a = new QAction( QString::null, QWidget::tr("Show only over-due tasks"), |
180 | 0, this, 0, TRUE ); | 184 | 0, this, 0, TRUE ); |
181 | a->addTo( m_options ); | 185 | a->addTo( m_options ); |
182 | a->setOn( showOverDue() ); | 186 | a->setOn( showOverDue() ); |
183 | connect(a, SIGNAL(toggled(bool)), this, SLOT(slotShowDue(bool) ) ); | 187 | connect(a, SIGNAL(toggled(bool)), this, SLOT(slotShowDue(bool) ) ); |
@@ -343,24 +347,25 @@ Editor* MainWindow::currentEditor() { | |||
343 | return m_curEdit; | 347 | return m_curEdit; |
344 | } | 348 | } |
345 | TodoShow* MainWindow::currentShow() { | 349 | TodoShow* MainWindow::currentShow() { |
346 | return m_curShow; | 350 | return m_curShow; |
347 | } | 351 | } |
348 | void MainWindow::slotReload() { | 352 | void MainWindow::slotReload() { |
349 | m_todoMgr.reload(); | 353 | m_todoMgr.reload(); |
350 | currentView()->updateView( ); | 354 | currentView()->updateView( ); |
351 | raiseCurrentView(); | 355 | raiseCurrentView(); |
352 | } | 356 | } |
353 | void MainWindow::closeEvent( QCloseEvent* e ) { | 357 | void MainWindow::closeEvent( QCloseEvent* e ) { |
354 | if (m_stack->visibleWidget() == currentShow()->widget() ) { | 358 | if (m_stack->visibleWidget() == currentShow()->widget() ) { |
359 | m_showing = false; | ||
355 | raiseCurrentView(); | 360 | raiseCurrentView(); |
356 | e->ignore(); | 361 | e->ignore(); |
357 | return; | 362 | return; |
358 | } | 363 | } |
359 | /* | 364 | /* |
360 | * we should have flushed and now we're still saving | 365 | * we should have flushed and now we're still saving |
361 | * so there is no need to flush | 366 | * so there is no need to flush |
362 | */ | 367 | */ |
363 | if (m_syncing ) { | 368 | if (m_syncing ) { |
364 | e->accept(); | 369 | e->accept(); |
365 | return; | 370 | return; |
366 | } | 371 | } |
@@ -400,102 +405,120 @@ void MainWindow::closeEvent( QCloseEvent* e ) { | |||
400 | } | 405 | } |
401 | void MainWindow::populateTemplates() { | 406 | void MainWindow::populateTemplates() { |
402 | m_template->clear(); | 407 | m_template->clear(); |
403 | QStringList list = templateManager()->templates(); | 408 | QStringList list = templateManager()->templates(); |
404 | QStringList::Iterator it; | 409 | QStringList::Iterator it; |
405 | for ( it = list.begin(); it != list.end(); ++it ) { | 410 | for ( it = list.begin(); it != list.end(); ++it ) { |
406 | m_template->insertItem( (*it) ); | 411 | m_template->insertItem( (*it) ); |
407 | } | 412 | } |
408 | } | 413 | } |
409 | /* | 414 | /* |
410 | * slotNewFromTemplate | 415 | * slotNewFromTemplate |
411 | * We use the edit widget to do | 416 | * We use the edit widget to do |
412 | * the config but we setUid(-1) | 417 | * the config but we setUid(1) |
413 | * to get a new uid | 418 | * to get a new uid |
414 | */ | 419 | */ |
415 | /* | 420 | /* |
416 | * first we get the name of the template | 421 | * first we get the name of the template |
417 | * then we will use the TemplateManager | 422 | * then we will use the TemplateManager |
418 | */ | 423 | */ |
419 | void MainWindow::slotNewFromTemplate( int id ) { | 424 | void MainWindow::slotNewFromTemplate( int id ) { |
420 | QString name = m_template->text( id ); | 425 | QString name = m_template->text( id ); |
421 | 426 | ||
422 | OTodo event = templateManager()->templateEvent( name ); | 427 | OTodo event = templateManager()->templateEvent( name ); |
423 | event = currentEditor()->edit(this, | 428 | event = currentEditor()->edit(this, |
424 | event ); | 429 | event ); |
425 | 430 | ||
426 | if ( currentEditor()->accepted() ) { | 431 | if ( currentEditor()->accepted() ) { |
427 | /* assign new todo */ | 432 | /* assign new todo */ |
428 | event.setUid( -1 ); | 433 | event.setUid( 1 ); |
429 | currentView()->addEvent( event ); | 434 | handleAlarms( OTodo(), event ); |
430 | m_todoMgr.add( event ); | 435 | m_todoMgr.add( event ); |
436 | currentView()->addEvent( event ); | ||
431 | 437 | ||
432 | populateCategories(); | 438 | populateCategories(); |
433 | } | 439 | } |
440 | raiseCurrentView(); | ||
434 | } | 441 | } |
435 | void MainWindow::slotNew() { | 442 | void MainWindow::slotNew() { |
436 | create(); | 443 | create(); |
437 | } | 444 | } |
438 | void MainWindow::slotDuplicate() { | 445 | void MainWindow::slotDuplicate() { |
439 | if(m_syncing) { | 446 | if(m_syncing) { |
440 | QMessageBox::warning(this, QWidget::tr("Todo"), | 447 | QMessageBox::warning(this, QWidget::tr("Todo"), |
441 | QWidget::tr("Can not edit data, currently syncing")); | 448 | QWidget::tr("Data can not be edited, currently syncing")); |
442 | return; | 449 | return; |
443 | } | 450 | } |
444 | OTodo ev = m_todoMgr.event( currentView()->current() ); | 451 | OTodo ev = m_todoMgr.event( currentView()->current() ); |
445 | /* let's generate a new uid */ | 452 | /* let's generate a new uid */ |
446 | ev.setUid(-1); | 453 | ev.setUid(1); |
447 | m_todoMgr.add( ev ); | 454 | m_todoMgr.add( ev ); |
448 | 455 | ||
449 | currentView()->addEvent( ev ); | 456 | currentView()->addEvent( ev ); |
450 | raiseCurrentView(); | 457 | raiseCurrentView(); |
451 | } | 458 | } |
452 | void MainWindow::slotDelete() { | 459 | void MainWindow::slotDelete() { |
453 | if (!currentView()->current() ) | 460 | if (!currentView()->current() ) |
454 | return; | 461 | return; |
455 | 462 | ||
456 | if(m_syncing) { | 463 | if(m_syncing) { |
457 | QMessageBox::warning(this, QWidget::tr("Todo"), | 464 | QMessageBox::warning(this, QWidget::tr("Todo"), |
458 | QWidget::tr("Can not edit data, currently syncing")); | 465 | QWidget::tr("Data can not be edited, currently syncing")); |
459 | return; | 466 | return; |
460 | } | 467 | } |
461 | QString strName = currentView()->currentRepresentation(); | 468 | QString strName = currentView()->currentRepresentation(); |
462 | if (!QPEMessageBox::confirmDelete(this, QWidget::tr("Todo"), strName ) ) | 469 | if (!QPEMessageBox::confirmDelete(this, QWidget::tr("Todo"), strName ) ) |
463 | return; | 470 | return; |
464 | 471 | ||
465 | handleAlarms( OTodo(), m_todoMgr.event( currentView()->current() ) ); | 472 | handleAlarms( m_todoMgr.event( currentView()->current() ), OTodo() ); |
466 | m_todoMgr.remove( currentView()->current() ); | 473 | m_todoMgr.remove( currentView()->current() ); |
467 | currentView()->removeEvent( currentView()->current() ); | 474 | currentView()->removeEvent( currentView()->current() ); |
468 | raiseCurrentView(); | 475 | raiseCurrentView(); |
469 | } | 476 | } |
477 | void MainWindow::slotDelete(int uid ) { | ||
478 | if( uid == 0 ) return; | ||
479 | if(m_syncing) { | ||
480 | QMessageBox::warning(this, QWidget::tr("Todo"), | ||
481 | QWidget::tr("Data can not be edited, currently syncing")); | ||
482 | return; | ||
483 | } | ||
484 | OTodo to = m_todoMgr.event(uid); | ||
485 | if (!QPEMessageBox::confirmDelete(this, QWidget::tr("Todo"), to.toShortText() ) ) | ||
486 | return; | ||
487 | |||
488 | handleAlarms(to, OTodo() ); | ||
489 | m_todoMgr.remove( to.uid() ); | ||
490 | currentView()->removeEvent( to.uid() ); | ||
491 | raiseCurrentView(); | ||
492 | } | ||
470 | void MainWindow::slotDeleteAll() { | 493 | void MainWindow::slotDeleteAll() { |
471 | if(m_syncing) { | 494 | if(m_syncing) { |
472 | QMessageBox::warning(this, QWidget::tr("Todo"), | 495 | QMessageBox::warning(this, QWidget::tr("Todo"), |
473 | QWidget::tr("Can not edit data, currently syncing")); | 496 | QWidget::tr("Data can not be edited, currently syncing")); |
474 | return; | 497 | return; |
475 | } | 498 | } |
476 | 499 | ||
477 | 500 | ||
478 | if ( !QPEMessageBox::confirmDelete( this, QWidget::tr( "Todo" ), QWidget::tr("all tasks?") ) ) | 501 | if ( !QPEMessageBox::confirmDelete( this, QWidget::tr( "Todo" ), QWidget::tr("all tasks?") ) ) |
479 | return; | 502 | return; |
480 | 503 | ||
481 | m_todoMgr.removeAll(); | 504 | m_todoMgr.removeAll(); |
482 | currentView()->clear(); | 505 | currentView()->clear(); |
483 | 506 | ||
484 | raiseCurrentView(); | 507 | raiseCurrentView(); |
485 | } | 508 | } |
486 | void MainWindow::slotDeleteCompleted() { | 509 | void MainWindow::slotDeleteCompleted() { |
487 | if(m_syncing) { | 510 | if(m_syncing) { |
488 | QMessageBox::warning(this, QWidget::tr("Todo"), | 511 | QMessageBox::warning(this, QWidget::tr("Todo"), |
489 | QWidget::tr("Can not edit data, currently syncing")); | 512 | QWidget::tr("Data can not be edited, currently syncing")); |
490 | return; | 513 | return; |
491 | } | 514 | } |
492 | 515 | ||
493 | if ( !QPEMessageBox::confirmDelete( this, QWidget::tr( "Todo" ), QWidget::tr("all completed tasks?") ) ) | 516 | if ( !QPEMessageBox::confirmDelete( this, QWidget::tr( "Todo" ), QWidget::tr("all completed tasks?") ) ) |
494 | return; | 517 | return; |
495 | 518 | ||
496 | 519 | ||
497 | m_todoMgr.removeCompleted(); | 520 | m_todoMgr.removeCompleted(); |
498 | currentView()->updateView( ); | 521 | currentView()->updateView( ); |
499 | } | 522 | } |
500 | void MainWindow::slotFind() { | 523 | void MainWindow::slotFind() { |
501 | 524 | ||
@@ -557,40 +580,44 @@ void MainWindow::setDocument( const QString& fi) { | |||
557 | } | 580 | } |
558 | 581 | ||
559 | static const char *beamfile = "/tmp/opie-todo.vcs"; | 582 | static const char *beamfile = "/tmp/opie-todo.vcs"; |
560 | void MainWindow::slotBeam() { | 583 | void MainWindow::slotBeam() { |
561 | beam( currentView()->current() ); | 584 | beam( currentView()->current() ); |
562 | } | 585 | } |
563 | void MainWindow::beamDone( Ir* ir) { | 586 | void MainWindow::beamDone( Ir* ir) { |
564 | delete ir; | 587 | delete ir; |
565 | ::unlink( beamfile ); | 588 | ::unlink( beamfile ); |
566 | } | 589 | } |
567 | void MainWindow::receiveFile( const QString& filename ) { | 590 | void MainWindow::receiveFile( const QString& filename ) { |
568 | OTodoAccessVCal* cal = new OTodoAccessVCal(filename ); | 591 | OTodoAccessVCal* cal = new OTodoAccessVCal(filename ); |
592 | |||
569 | OTodoAccess acc( cal ); | 593 | OTodoAccess acc( cal ); |
570 | acc.load(); | 594 | acc.load(); |
571 | OTodoAccess::List list = acc.allRecords(); | 595 | OTodoAccess::List list = acc.allRecords(); |
572 | 596 | ||
597 | if (list.count()){ | ||
598 | |||
573 | QString message = QWidget::tr("<P>%1 new tasks arrived.<p>Would you like to add them to your Todolist?").arg(list.count() ); | 599 | QString message = QWidget::tr("<P>%1 new tasks arrived.<p>Would you like to add them to your Todolist?").arg(list.count() ); |
574 | 600 | ||
575 | if ( QMessageBox::information(this, QWidget::tr("New Tasks"), | 601 | if ( QMessageBox::information(this, QWidget::tr("New Tasks"), |
576 | message, QMessageBox::Ok, | 602 | message, QMessageBox::Ok, |
577 | QMessageBox::Cancel ) == QMessageBox::Ok ) { | 603 | QMessageBox::Cancel ) == QMessageBox::Ok ) { |
578 | OTodoAccess::List::Iterator it; | 604 | OTodoAccess::List::Iterator it; |
579 | for ( it = list.begin(); it != list.end(); ++it ) | 605 | for ( it = list.begin(); it != list.end(); ++it ) |
580 | m_todoMgr.add( (*it) ); | 606 | m_todoMgr.add( (*it) ); |
581 | 607 | ||
582 | currentView()->updateView(); | 608 | currentView()->updateView(); |
583 | } | 609 | } |
584 | } | 610 | } |
611 | } | ||
585 | 612 | ||
586 | void MainWindow::slotFlush() { | 613 | void MainWindow::slotFlush() { |
587 | m_syncing = FALSE; | 614 | m_syncing = FALSE; |
588 | m_todoMgr.save(); | 615 | m_todoMgr.save(); |
589 | } | 616 | } |
590 | void MainWindow::slotShowDetails() { | 617 | void MainWindow::slotShowDetails() { |
591 | slotShow( currentView()->current() ); | 618 | slotShow( currentView()->current() ); |
592 | } | 619 | } |
593 | /* | 620 | /* |
594 | * populate the Categories | 621 | * populate the Categories |
595 | * Menu | 622 | * Menu |
596 | */ | 623 | */ |
@@ -625,51 +652,68 @@ bool MainWindow::showQuickTask()const { | |||
625 | return m_quicktask; | 652 | return m_quicktask; |
626 | } | 653 | } |
627 | QString MainWindow::currentCategory()const { | 654 | QString MainWindow::currentCategory()const { |
628 | return m_curCat; | 655 | return m_curCat; |
629 | } | 656 | } |
630 | int MainWindow::currentCatId() { | 657 | int MainWindow::currentCatId() { |
631 | return m_todoMgr.catId( m_curCat ); | 658 | return m_todoMgr.catId( m_curCat ); |
632 | } | 659 | } |
633 | ViewBase* MainWindow::currentView() { | 660 | ViewBase* MainWindow::currentView() { |
634 | return m_curView; | 661 | return m_curView; |
635 | } | 662 | } |
636 | void MainWindow::raiseCurrentView() { | 663 | void MainWindow::raiseCurrentView() { |
664 | // due QPE/Application/todolist show(int) | ||
665 | // we might not have the populateCategories slot called once | ||
666 | // we would show the otodo but then imediately switch to the currentView | ||
667 | // if we're initially showing we shouldn't raise the table | ||
668 | // in returnFromView we fix up m_showing | ||
669 | if (m_showing ) return; | ||
670 | |||
637 | m_stack->raiseWidget( m_curView->widget() ); | 671 | m_stack->raiseWidget( m_curView->widget() ); |
638 | } | 672 | } |
639 | void MainWindow::slotShowDue(bool ov) { | 673 | void MainWindow::slotShowDue(bool ov) { |
640 | m_overdue = ov; | 674 | m_overdue = ov; |
641 | currentView()->showOverDue( ov ); | 675 | currentView()->showOverDue( ov ); |
642 | raiseCurrentView(); | 676 | raiseCurrentView(); |
643 | } | 677 | } |
644 | void MainWindow::slotShow( int uid ) { | 678 | void MainWindow::slotShow( int uid ) { |
679 | if ( uid == 0 ) return; | ||
645 | qWarning("slotShow"); | 680 | qWarning("slotShow"); |
646 | currentShow()->slotShow( event( uid ) ); | 681 | currentShow()->slotShow( event( uid ) ); |
647 | m_stack->raiseWidget( currentShow()->widget() ); | 682 | m_stack->raiseWidget( currentShow()->widget() ); |
648 | } | 683 | } |
684 | void MainWindow::slotShowNext() { | ||
685 | int l = currentView()->next(); | ||
686 | if (l!=0) | ||
687 | slotShow(l); | ||
688 | } | ||
689 | void MainWindow::slotShowPrev() { | ||
690 | int l = currentView()->prev(); | ||
691 | if (l!=0) | ||
692 | slotShow(l); | ||
693 | } | ||
649 | void MainWindow::slotEdit( int uid ) { | 694 | void MainWindow::slotEdit( int uid ) { |
650 | if (uid == 1 ) return; | 695 | if (uid == 0 ) return; |
651 | if(m_syncing) { | 696 | if(m_syncing) { |
652 | QMessageBox::warning(this, QWidget::tr("Todo"), | 697 | QMessageBox::warning(this, QWidget::tr("Todo"), |
653 | QWidget::tr("Can not edit data, currently syncing")); | 698 | QWidget::tr("Data can't be edited, currently syncing")); |
654 | return; | 699 | return; |
655 | } | 700 | } |
656 | 701 | ||
657 | OTodo old_todo = m_todoMgr.event( uid ); | 702 | OTodo old_todo = m_todoMgr.event( uid ); |
658 | 703 | ||
659 | OTodo todo = currentEditor()->edit(this, old_todo ); | 704 | OTodo todo = currentEditor()->edit(this, old_todo ); |
660 | 705 | ||
661 | /* if completed */ | 706 | /* if completed */ |
662 | if ( currentEditor()->accepted() ) { | 707 | if ( currentEditor()->accepted() ) { |
663 | qWarning("Replacing now" ); | ||
664 | handleAlarms( old_todo, todo ); | 708 | handleAlarms( old_todo, todo ); |
665 | m_todoMgr.update( todo.uid(), todo ); | 709 | m_todoMgr.update( todo.uid(), todo ); |
666 | currentView()->replaceEvent( todo ); | 710 | currentView()->replaceEvent( todo ); |
667 | /* a Category might have changed */ | 711 | /* a Category might have changed */ |
668 | populateCategories(); | 712 | populateCategories(); |
669 | } | 713 | } |
670 | 714 | ||
671 | raiseCurrentView(); | 715 | raiseCurrentView(); |
672 | } | 716 | } |
673 | /* | 717 | /* |
674 | void MainWindow::slotUpdate1( int uid, const SmallTodo& ev) { | 718 | void MainWindow::slotUpdate1( int uid, const SmallTodo& ev) { |
675 | m_todoMgr.update( uid, ev ); | 719 | m_todoMgr.update( uid, ev ); |
@@ -709,78 +753,106 @@ void MainWindow::slotComplete( int uid ) { | |||
709 | } | 753 | } |
710 | void MainWindow::slotComplete( const OTodo& todo ) { | 754 | void MainWindow::slotComplete( const OTodo& todo ) { |
711 | OTodo to = todo; | 755 | OTodo to = todo; |
712 | to.setCompleted( !to.isCompleted() ); | 756 | to.setCompleted( !to.isCompleted() ); |
713 | to.setCompletedDate( QDate::currentDate() ); | 757 | to.setCompletedDate( QDate::currentDate() ); |
714 | 758 | ||
715 | /* | 759 | /* |
716 | * if the item does recur | 760 | * if the item does recur |
717 | * we need to spin it off | 761 | * we need to spin it off |
718 | * and update the items duedate to the next | 762 | * and update the items duedate to the next |
719 | * possible recurrance of this item... | 763 | * possible recurrance of this item... |
720 | * the spinned off one will loose the | 764 | * the spinned off one will loose the |
765 | * recurrence. | ||
766 | * We calculate the difference between the old due date and the | ||
767 | * new one and add this diff to start, completed and alarm dates | ||
768 | * -zecke | ||
721 | */ | 769 | */ |
722 | if ( to.hasRecurrence() && to.isCompleted() ) { | 770 | if ( to.hasRecurrence() && to.isCompleted() ) { |
723 | OTodo to2( to ); | 771 | OTodo to2( to ); |
724 | 772 | ||
725 | /* the spinned off one won't recur anymore */ | 773 | /* the spinned off one won't recur anymore */ |
726 | to.setRecurrence( ORecur() ); | 774 | to.setRecurrence( ORecur() ); |
727 | 775 | ||
728 | ORecur rec = to2.recurrence(); | 776 | ORecur rec = to2.recurrence(); |
729 | rec.setStart( to.dueDate() ); | 777 | rec.setStart( to.dueDate() ); |
730 | to2.setRecurrence( rec ); | 778 | to2.setRecurrence( rec ); |
731 | /* | 779 | /* |
732 | * if there is a next occurence | 780 | * if there is a next occurence |
733 | * from the duedate of the last recurrance | 781 | * from the duedate of the last recurrance |
734 | */ | 782 | */ |
735 | QDate date; | 783 | QDate date; |
736 | if ( to2.recurrence().nextOcurrence( to2.dueDate().addDays(1), date ) ) { | 784 | if ( to2.recurrence().nextOcurrence( to2.dueDate().addDays(1), date ) ) { |
785 | int dayDiff = to.dueDate().daysTo( date ); | ||
786 | qWarning("day diff is %d", dayDiff ); | ||
737 | QDate inval; | 787 | QDate inval; |
738 | /* generate a new uid for the old record */ | 788 | /* generate a new uid for the old record */ |
739 | to.setUid( 1 ); | 789 | to.setUid( 1 ); |
740 | 790 | ||
741 | /* add the old one cause it has a new UID here cause it was spin off */ | 791 | /* add the old one cause it has a new UID here cause it was spin off */ |
742 | m_todoMgr.add( to ); | 792 | m_todoMgr.add( to ); |
743 | 793 | ||
744 | /* | 794 | /* |
745 | * update the due date | 795 | * update the due date |
746 | * start date | 796 | * start date |
747 | * and complete date | 797 | * and complete date |
748 | */ | 798 | */ |
749 | to2.setDueDate( date ); | 799 | to2.setDueDate( date ); |
750 | to2.setStartDate( inval ); | 800 | rec.setStart( date ); |
801 | to2.setRecurrence( rec ); // could be Monday, TuesDay, Thursday every week | ||
802 | |||
803 | /* move start date */ | ||
804 | if (to2.hasStartDate() ) | ||
805 | to2.setStartDate( to2.startDate().addDays( dayDiff ) ); | ||
806 | |||
807 | /* now the alarms */ | ||
808 | if (to2.hasNotifiers() ) { | ||
809 | OPimNotifyManager::Alarms _als = to2.notifiers().alarms(); | ||
810 | OPimNotifyManager::Alarms als; | ||
811 | |||
812 | /* for every alarm move the day */ | ||
813 | for ( OPimNotifyManager::Alarms::Iterator it = _als.begin(); it != _als.end(); ++it ) { | ||
814 | OPimAlarm al = (*it); | ||
815 | al.setDateTime( al.dateTime().addDays( dayDiff ) ); | ||
816 | als.append( al ); | ||
817 | } | ||
818 | to2.notifiers().setAlarms( als ); | ||
819 | handleAlarms( OTodo(), todo ); | ||
820 | } | ||
751 | to2.setCompletedDate( inval ); | 821 | to2.setCompletedDate( inval ); |
752 | to2.setCompleted( false ); | 822 | to2.setCompleted( false ); |
823 | |||
753 | updateTodo( to2 ); | 824 | updateTodo( to2 ); |
754 | }else | 825 | }else |
755 | updateTodo( to ); | 826 | updateTodo( to ); |
756 | }else | 827 | }else |
757 | updateTodo( to ); | 828 | updateTodo( to ); |
758 | 829 | ||
759 | currentView()->updateView(); | 830 | currentView()->updateView(); |
760 | raiseCurrentView(); | 831 | raiseCurrentView(); |
761 | } | 832 | } |
762 | void MainWindow::flush() { | 833 | void MainWindow::flush() { |
763 | slotFlush(); | 834 | slotFlush(); |
764 | } | 835 | } |
765 | void MainWindow::reload() { | 836 | void MainWindow::reload() { |
766 | slotReload(); | 837 | slotReload(); |
767 | } | 838 | } |
768 | int MainWindow::create() { | 839 | int MainWindow::create() { |
769 | int uid = 0; | 840 | int uid = 0; |
770 | if(m_syncing) { | 841 | if(m_syncing) { |
771 | QMessageBox::warning(this, QWidget::tr("Todo"), | 842 | QMessageBox::warning(this, QWidget::tr("Todo"), |
772 | QWidget::tr("Can not edit data, currently syncing")); | 843 | QWidget::tr("Data can not be edited, currently syncing")); |
773 | return uid; | 844 | return uid; |
774 | } | 845 | } |
846 | m_todoMgr.load(); | ||
775 | 847 | ||
776 | 848 | ||
777 | OTodo todo = currentEditor()->newTodo( currentCatId(), | 849 | OTodo todo = currentEditor()->newTodo( currentCatId(), |
778 | this ); | 850 | this ); |
779 | 851 | ||
780 | if ( currentEditor()->accepted() ) { | 852 | if ( currentEditor()->accepted() ) { |
781 | //todo.assignUid(); | 853 | //todo.assignUid(); |
782 | uid = todo.uid(); | 854 | uid = todo.uid(); |
783 | handleAlarms( OTodo(), todo ); | 855 | handleAlarms( OTodo(), todo ); |
784 | m_todoMgr.add( todo ); | 856 | m_todoMgr.add( todo ); |
785 | currentView()->addEvent( todo ); | 857 | currentView()->addEvent( todo ); |
786 | 858 | ||
@@ -795,57 +867,68 @@ int MainWindow::create() { | |||
795 | return uid; | 867 | return uid; |
796 | } | 868 | } |
797 | /* delete it silently... */ | 869 | /* delete it silently... */ |
798 | bool MainWindow::remove( int uid ) { | 870 | bool MainWindow::remove( int uid ) { |
799 | if (m_syncing) return false; | 871 | if (m_syncing) return false; |
800 | 872 | ||
801 | /* argh need to get the whole OEvent... to disable alarms -zecke */ | 873 | /* argh need to get the whole OEvent... to disable alarms -zecke */ |
802 | handleAlarms( OTodo(), m_todoMgr.event( uid ) ); | 874 | handleAlarms( OTodo(), m_todoMgr.event( uid ) ); |
803 | 875 | ||
804 | return m_todoMgr.remove( uid ); | 876 | return m_todoMgr.remove( uid ); |
805 | } | 877 | } |
806 | void MainWindow::beam( int uid) { | 878 | void MainWindow::beam( int uid) { |
879 | if( uid == 0 ) return; | ||
880 | |||
807 | ::unlink( beamfile ); | 881 | ::unlink( beamfile ); |
882 | m_todoMgr.load(); | ||
883 | |||
808 | OTodo todo = event( uid ); | 884 | OTodo todo = event( uid ); |
809 | OTodoAccessVCal* cal = new OTodoAccessVCal(QString::fromLatin1(beamfile) ); | 885 | OTodoAccessVCal* cal = new OTodoAccessVCal(QString::fromLatin1(beamfile) ); |
810 | OTodoAccess acc( cal ); | 886 | OTodoAccess acc( cal ); |
811 | acc.load(); | 887 | acc.load(); |
812 | acc.add( todo ); | 888 | acc.add( todo ); |
813 | acc.save(); | 889 | acc.save(); |
814 | Ir* ir = new Ir(this ); | 890 | Ir* ir = new Ir(this ); |
815 | connect(ir, SIGNAL(done(Ir*) ), | 891 | connect(ir, SIGNAL(done(Ir*) ), |
816 | this, SLOT(beamDone(Ir*) ) ); | 892 | this, SLOT(beamDone(Ir*) ) ); |
817 | ir->send(beamfile, todo.summary(), "text/x-vCalendar" ); | 893 | ir->send(beamfile, todo.summary(), "text/x-vCalendar" ); |
818 | } | 894 | } |
819 | void MainWindow::show( int uid ) { | 895 | void MainWindow::show( int uid ) { |
896 | m_todoMgr.load(); // might not be loaded yet | ||
897 | m_showing = true; | ||
820 | slotShow( uid ); | 898 | slotShow( uid ); |
899 | raise(); | ||
900 | QPEApplication::setKeepRunning(); | ||
821 | } | 901 | } |
822 | void MainWindow::edit( int uid ) { | 902 | void MainWindow::edit( int uid ) { |
903 | m_todoMgr.load(); | ||
823 | slotEdit( uid ); | 904 | slotEdit( uid ); |
824 | } | 905 | } |
825 | void MainWindow::add( const OPimRecord& rec) { | 906 | void MainWindow::add( const OPimRecord& rec) { |
826 | if ( rec.rtti() != OTodo::rtti() ) return; | 907 | if ( rec.rtti() != OTodo::rtti() ) return; |
908 | m_todoMgr.load(); // might not be loaded | ||
827 | 909 | ||
828 | const OTodo& todo = static_cast<const OTodo&>(rec); | 910 | const OTodo& todo = static_cast<const OTodo&>(rec); |
829 | 911 | ||
830 | m_todoMgr.add(todo ); | 912 | m_todoMgr.add(todo ); |
831 | currentView()->addEvent( todo ); | 913 | currentView()->addEvent( todo ); |
832 | 914 | ||
833 | 915 | ||
834 | // I'm afraid we must call this every time now, otherwise | 916 | // I'm afraid we must call this every time now, otherwise |
835 | // spend expensive time comparing all these strings... | 917 | // spend expensive time comparing all these strings... |
836 | // but only call if we changed something -zecke | 918 | // but only call if we changed something -zecke |
837 | populateCategories(); | 919 | populateCategories(); |
838 | } | 920 | } |
839 | void MainWindow::slotReturnFromView() { | 921 | void MainWindow::slotReturnFromView() { |
922 | m_showing = false; | ||
840 | raiseCurrentView(); | 923 | raiseCurrentView(); |
841 | } | 924 | } |
842 | 925 | ||
843 | namespace { | 926 | namespace { |
844 | OPimNotifyManager::Alarms findNonMatching( const OPimNotifyManager::Alarms& oldAls, | 927 | OPimNotifyManager::Alarms findNonMatching( const OPimNotifyManager::Alarms& oldAls, |
845 | const OPimNotifyManager::Alarms& newAls ) { | 928 | const OPimNotifyManager::Alarms& newAls ) { |
846 | OPimNotifyManager::Alarms nonMatching; | 929 | OPimNotifyManager::Alarms nonMatching; |
847 | OPimNotifyManager::Alarms::ConstIterator oldIt = oldAls.begin(); | 930 | OPimNotifyManager::Alarms::ConstIterator oldIt = oldAls.begin(); |
848 | OPimNotifyManager::Alarms::ConstIterator newIt; | 931 | OPimNotifyManager::Alarms::ConstIterator newIt; |
849 | for ( ; oldIt != oldAls.end(); ++oldIt ) { | 932 | for ( ; oldIt != oldAls.end(); ++oldIt ) { |
850 | bool found = false; | 933 | bool found = false; |
851 | QDateTime oldDt = (*oldIt).dateTime(); | 934 | QDateTime oldDt = (*oldIt).dateTime(); |
@@ -923,30 +1006,31 @@ void MainWindow::doAlarm( const QDateTime& dt, int uid ) { | |||
923 | } | 1006 | } |
924 | if (loud) | 1007 | if (loud) |
925 | startAlarm(); | 1008 | startAlarm(); |
926 | 1009 | ||
927 | QDialog dlg(this, 0, TRUE ); | 1010 | QDialog dlg(this, 0, TRUE ); |
928 | QVBoxLayout* lay = new QVBoxLayout( &dlg ); | 1011 | QVBoxLayout* lay = new QVBoxLayout( &dlg ); |
929 | QTextView* view = new QTextView( &dlg ); | 1012 | QTextView* view = new QTextView( &dlg ); |
930 | lay->addWidget( view ); | 1013 | lay->addWidget( view ); |
931 | QPushButton* btnOk = new QPushButton( tr("Ok"), &dlg ); | 1014 | QPushButton* btnOk = new QPushButton( tr("Ok"), &dlg ); |
932 | connect( btnOk, SIGNAL(clicked() ), &dlg, SLOT(accept() ) ); | 1015 | connect( btnOk, SIGNAL(clicked() ), &dlg, SLOT(accept() ) ); |
933 | lay->addWidget( btnOk ); | 1016 | lay->addWidget( btnOk ); |
934 | 1017 | ||
935 | QString text = tr("<h1>Alarm at %0</h1><br>").arg( TimeString::dateString( dt ) ); | 1018 | QString text = tr("<h1>Alarm at %1</h1><br>").arg( TimeString::dateString( dt ) ); |
936 | text += todo.toRichText(); | 1019 | text += todo.toRichText(); |
937 | view->setText( text ); | 1020 | view->setText( text ); |
938 | 1021 | ||
939 | dlg.showMaximized(); | 1022 | dlg.showMaximized(); |
940 | bool needToStay = dlg.exec(); | 1023 | bool needToStay = dlg.exec(); |
941 | 1024 | ||
942 | if (loud) | 1025 | if (loud) |
943 | killAlarm(); | 1026 | killAlarm(); |
944 | 1027 | ||
945 | if (needToStay) { | 1028 | if (needToStay) { |
946 | showMaximized(); | 1029 | // showMaximized(); |
947 | raise(); | 1030 | // raise(); |
948 | QPEApplication::setKeepRunning(); | 1031 | QPEApplication::setKeepRunning(); |
949 | setActiveWindow(); | 1032 | // setActiveWindow(); |
950 | } | 1033 | } |
951 | 1034 | ||
952 | } | 1035 | } |
1036 | |||
diff --git a/core/pim/todo/mainwindow.h b/core/pim/todo/mainwindow.h index 02e2449..b04a958 100644 --- a/core/pim/todo/mainwindow.h +++ b/core/pim/todo/mainwindow.h | |||
@@ -109,24 +109,25 @@ private slots: | |||
109 | void receiveFile( const QString& filename ); | 109 | void receiveFile( const QString& filename ); |
110 | void connectBase( ViewBase* ); | 110 | void connectBase( ViewBase* ); |
111 | void initUI(); | 111 | void initUI(); |
112 | void initActions(); | 112 | void initActions(); |
113 | void initConfig(); | 113 | void initConfig(); |
114 | void initViews(); | 114 | void initViews(); |
115 | void initEditor(); | 115 | void initEditor(); |
116 | void initShow(); | 116 | void initShow(); |
117 | void initTemplate(); | 117 | void initTemplate(); |
118 | void raiseCurrentView(); | 118 | void raiseCurrentView(); |
119 | ViewBase* currentView(); | 119 | ViewBase* currentView(); |
120 | ViewBase* m_curView; | 120 | ViewBase* m_curView; |
121 | bool m_showing : 1; // used to see if we show a todo in the cases we shouldn't change the table | ||
121 | QuickEditBase* m_curQuick; | 122 | QuickEditBase* m_curQuick; |
122 | Editor* m_curEdit; | 123 | Editor* m_curEdit; |
123 | TodoShow* currentShow(); | 124 | TodoShow* currentShow(); |
124 | TodoShow* m_curShow; | 125 | TodoShow* m_curShow; |
125 | TemplateEditor* currentTemplateEditor(); | 126 | TemplateEditor* currentTemplateEditor(); |
126 | TemplateEditor* m_curTempEd; | 127 | TemplateEditor* m_curTempEd; |
127 | 128 | ||
128 | QMenuBar* m_bar; | 129 | QMenuBar* m_bar; |
129 | QToolBar* m_tool; | 130 | QToolBar* m_tool; |
130 | QAction* m_editAction, | 131 | QAction* m_editAction, |
131 | *m_deleteAction, | 132 | *m_deleteAction, |
132 | *m_findAction, | 133 | *m_findAction, |
@@ -158,42 +159,45 @@ private slots: | |||
158 | 159 | ||
159 | private slots: | 160 | private slots: |
160 | void slotShow(int); | 161 | void slotShow(int); |
161 | void slotEdit(int); | 162 | void slotEdit(int); |
162 | void slotUpdate3( QWidget* ); | 163 | void slotUpdate3( QWidget* ); |
163 | void slotComplete( int uid ); | 164 | void slotComplete( int uid ); |
164 | void slotComplete( const OTodo& ev ); | 165 | void slotComplete( const OTodo& ev ); |
165 | void slotNewFromTemplate(int id ); | 166 | void slotNewFromTemplate(int id ); |
166 | void slotNew(); | 167 | void slotNew(); |
167 | void slotDuplicate(); | 168 | void slotDuplicate(); |
168 | 169 | ||
169 | void slotDelete(); | 170 | void slotDelete(); |
171 | void slotDelete(int uid ); | ||
170 | void slotDeleteAll(); | 172 | void slotDeleteAll(); |
171 | void slotDeleteCompleted(); | 173 | void slotDeleteCompleted(); |
172 | 174 | ||
173 | void slotEdit(); | 175 | void slotEdit(); |
174 | void slotFind(); | 176 | void slotFind(); |
175 | 177 | ||
176 | void setCategory( int ); | 178 | void setCategory( int ); |
177 | 179 | ||
178 | void slotShowDeadLine( bool ); | 180 | void slotShowDeadLine( bool ); |
179 | void slotShowCompleted( bool ); | 181 | void slotShowCompleted( bool ); |
180 | void slotShowQuickTask( bool ); | 182 | void slotShowQuickTask( bool ); |
181 | 183 | ||
182 | void setDocument( const QString& ); | 184 | void setDocument( const QString& ); |
183 | 185 | ||
184 | 186 | ||
185 | void slotBeam(); | 187 | void slotBeam(); |
186 | void beamDone( Ir* ); | 188 | void beamDone( Ir* ); |
187 | void slotShowDetails(); | 189 | void slotShowDetails(); |
190 | void slotShowNext(); | ||
191 | void slotShowPrev(); | ||
188 | void slotShowDue( bool ); | 192 | void slotShowDue( bool ); |
189 | void slotReturnFromView(); // for TodoShow... | 193 | void slotReturnFromView(); // for TodoShow... |
190 | /* reimplementation from opimmainwindow */ | 194 | /* reimplementation from opimmainwindow */ |
191 | protected slots: | 195 | protected slots: |
192 | void flush(); | 196 | void flush(); |
193 | void reload(); | 197 | void reload(); |
194 | int create(); | 198 | int create(); |
195 | bool remove( int uid ); | 199 | bool remove( int uid ); |
196 | void beam(int uid); | 200 | void beam(int uid); |
197 | void show( int uid ); | 201 | void show( int uid ); |
198 | void edit( int uid ); | 202 | void edit( int uid ); |
199 | void add( const OPimRecord& ); | 203 | void add( const OPimRecord& ); |
diff --git a/core/pim/todo/opie-todo.control b/core/pim/todo/opie-todo.control index b579306..17a65a8 100644 --- a/core/pim/todo/opie-todo.control +++ b/core/pim/todo/opie-todo.control | |||
@@ -1,10 +1,10 @@ | |||
1 | Package: opie-todo | 1 | Package: opie-todo |
2 | Files: bin/todolist apps/1Pim/todo.desktop pics/todo | 2 | Files: bin/todolist apps/1Pim/todo.desktop |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/applications | 4 | Section: opie/applications |
5 | Maintainer: Holger 'zecke' Freyther <zecke@handhelds.org> | 5 | Maintainer: Holger 'zecke' Freyther <zecke@handhelds.org> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Version: $QPE_VERSION-$SUB_VERSION | 7 | Depends: task-opie-minimal, libopie1, opie-pics |
8 | Depends: task-opie-minimal, libopie1 | ||
9 | Description: TODO-list manager | 8 | Description: TODO-list manager |
10 | A Todo-list manager for the Opie environment. | 9 | A Todo-list manager for the Opie environment. |
10 | Version: $QPE_VERSION$EXTRAVERSION | ||
diff --git a/core/pim/todo/otaskeditor.cpp b/core/pim/todo/otaskeditor.cpp index 84f854f..1ed20b4 100644 --- a/core/pim/todo/otaskeditor.cpp +++ b/core/pim/todo/otaskeditor.cpp | |||
@@ -1,69 +1,65 @@ | |||
1 | #include <qdatetime.h> | ||
2 | #include <qlabel.h> | ||
3 | #include <qlayout.h> | 1 | #include <qlayout.h> |
4 | #include <qmultilineedit.h> | ||
5 | 2 | ||
6 | #include <opie/orecurrancewidget.h> | 3 | #include <opie/orecurrancewidget.h> |
7 | 4 | ||
8 | #include "taskeditoroverview.h" | 5 | #include "taskeditoroverview.h" |
9 | #include "taskeditorstatus.h" | 6 | #include "taskeditorstatus.h" |
10 | #include "taskeditoralarms.h" | 7 | #include "taskeditoralarms.h" |
11 | 8 | ||
12 | #include "otaskeditor.h" | 9 | #include "otaskeditor.h" |
13 | 10 | ||
14 | OTaskEditor::OTaskEditor(int cur) | 11 | OTaskEditor::OTaskEditor(int cur) |
15 | : QDialog( 0, 0, TRUE, WStyle_ContextHelp ) { | 12 | : QDialog( 0, 0, TRUE, WStyle_ContextHelp ) { |
16 | init(); | 13 | init(); |
17 | init( cur ); | 14 | init( cur ); |
18 | } | 15 | } |
19 | OTaskEditor::OTaskEditor( const OTodo& to) | 16 | OTaskEditor::OTaskEditor( const OTodo& to) |
20 | : QDialog( 0, 0, TRUE, WStyle_ContextHelp ) { | 17 | : QDialog( 0, 0, TRUE, WStyle_ContextHelp ) { |
21 | init(); | 18 | init(); |
22 | init( to ); | 19 | init( to ); |
23 | } | 20 | } |
24 | OTaskEditor::~OTaskEditor() { | 21 | OTaskEditor::~OTaskEditor() { |
25 | 22 | ||
26 | } | 23 | } |
27 | void OTaskEditor::init( int cur ) { | 24 | void OTaskEditor::init( int cur ) { |
28 | OTodo to; | 25 | OTodo to; |
26 | to.setUid( 1 ); // generate a new uid | ||
29 | if ( cur != 0 ) | 27 | if ( cur != 0 ) |
30 | to.setCategories( cur ); | 28 | to.setCategories( cur ); |
31 | load(to); | 29 | load(to); |
32 | m_uid = 1; // generate a new one | ||
33 | } | 30 | } |
34 | void OTaskEditor::init( const OTodo& to ) { | 31 | void OTaskEditor::init( const OTodo& to ) { |
35 | load( to ); | 32 | load( to ); |
36 | m_uid = to.uid(); | ||
37 | } | 33 | } |
38 | OTodo OTaskEditor::todo()const{ | 34 | OTodo OTaskEditor::todo()const{ |
39 | qWarning("saving!"); | 35 | qWarning("saving!"); |
40 | OTodo to; | 36 | OTodo to ( m_todo ); |
41 | to.setUid(m_uid ); | ||
42 | m_overView->save( to ); | 37 | m_overView->save( to ); |
43 | m_stat->save( to ); | 38 | m_stat->save( to ); |
44 | to.setRecurrence( m_rec->recurrence() ); | 39 | to.setRecurrence( m_rec->recurrence() ); |
45 | m_alarm->save( to ); | 40 | m_alarm->save( to ); |
46 | 41 | ||
47 | return to; | 42 | return to; |
48 | } | 43 | } |
49 | void OTaskEditor::load(const OTodo& to) { | 44 | void OTaskEditor::load(const OTodo& to) { |
50 | m_overView->load( to ); | 45 | m_overView->load( to ); |
51 | m_stat->load( to ); | 46 | m_stat->load( to ); |
52 | m_rec->setRecurrence( to.recurrence(), to.hasDueDate() ? to.dueDate() : QDate::currentDate() ); | 47 | m_rec->setRecurrence( to.recurrence(), to.hasDueDate() ? to.dueDate() : QDate::currentDate() ); |
53 | m_alarm->setEnabled( !to.hasRecurrence() ); | ||
54 | m_alarm->load( to ); | 48 | m_alarm->load( to ); |
49 | |||
50 | m_todo = to; | ||
55 | } | 51 | } |
56 | void OTaskEditor::init() { | 52 | void OTaskEditor::init() { |
57 | setCaption("Task Editor"); | 53 | setCaption(tr("Task Editor") ); |
58 | 54 | ||
59 | QVBoxLayout* layo = new QVBoxLayout( this ); | 55 | QVBoxLayout* layo = new QVBoxLayout( this ); |
60 | m_tab = new OTabWidget( this ); | 56 | m_tab = new OTabWidget( this ); |
61 | layo->addWidget( m_tab ); | 57 | layo->addWidget( m_tab ); |
62 | 58 | ||
63 | /* | 59 | /* |
64 | * Add the Widgets | 60 | * Add the Widgets |
65 | */ | 61 | */ |
66 | m_overView = new TaskEditorOverView( m_tab ); | 62 | m_overView = new TaskEditorOverView( m_tab ); |
67 | m_tab->addTab( m_overView, "todo/info", tr("Information") ); | 63 | m_tab->addTab( m_overView, "todo/info", tr("Information") ); |
68 | 64 | ||
69 | m_stat = new TaskEditorStatus( m_tab ); | 65 | m_stat = new TaskEditorStatus( m_tab ); |
diff --git a/core/pim/todo/otaskeditor.h b/core/pim/todo/otaskeditor.h index 795f333..2daae52 100644 --- a/core/pim/todo/otaskeditor.h +++ b/core/pim/todo/otaskeditor.h | |||
@@ -28,17 +28,16 @@ public: | |||
28 | 28 | ||
29 | OTodo todo()const; | 29 | OTodo todo()const; |
30 | private: | 30 | private: |
31 | void load( const OTodo& ); | 31 | void load( const OTodo& ); |
32 | void init(); | 32 | void init(); |
33 | 33 | ||
34 | OTabWidget *m_tab; | 34 | OTabWidget *m_tab; |
35 | TaskEditorOverView *m_overView; | 35 | TaskEditorOverView *m_overView; |
36 | TaskEditorStatus *m_stat; | 36 | TaskEditorStatus *m_stat; |
37 | TaskEditorAlarms *m_alarm; | 37 | TaskEditorAlarms *m_alarm; |
38 | TaskEditorAlarms *m_remind; | 38 | TaskEditorAlarms *m_remind; |
39 | ORecurranceWidget *m_rec; | 39 | ORecurranceWidget *m_rec; |
40 | int m_uid; | 40 | OTodo m_todo; |
41 | |||
42 | }; | 41 | }; |
43 | 42 | ||
44 | #endif | 43 | #endif |
diff --git a/core/pim/todo/quickedit.cpp b/core/pim/todo/quickedit.cpp index edcd48a..16fc53a 100644 --- a/core/pim/todo/quickedit.cpp +++ b/core/pim/todo/quickedit.cpp | |||
@@ -1,13 +1,12 @@ | |||
1 | #include "mainwindow.h" | ||
2 | #include "quickedit.h" | 1 | #include "quickedit.h" |
3 | 2 | ||
4 | using namespace Todo; | 3 | using namespace Todo; |
5 | 4 | ||
6 | // not so interesting part base Implementation | 5 | // not so interesting part base Implementation |
7 | QuickEdit::QuickEdit(MainWindow* main ) | 6 | QuickEdit::QuickEdit(MainWindow* main ) |
8 | : m_main( main ) { | 7 | : m_main( main ) { |
9 | m_sig = new QSignal(); | 8 | m_sig = new QSignal(); |
10 | } | 9 | } |
11 | QuickEdit::~QuickEdit() { | 10 | QuickEdit::~QuickEdit() { |
12 | delete m_sig; | 11 | delete m_sig; |
13 | } | 12 | } |
diff --git a/core/pim/todo/quickeditimpl.cpp b/core/pim/todo/quickeditimpl.cpp index f4c7c47..70e0582 100644 --- a/core/pim/todo/quickeditimpl.cpp +++ b/core/pim/todo/quickeditimpl.cpp | |||
@@ -22,30 +22,35 @@ QuickEditImpl::QuickEditImpl( QWidget* parent, bool visible ) | |||
22 | priority5 = Resource::loadPixmap( "todo/priority5" ); | 22 | priority5 = Resource::loadPixmap( "todo/priority5" ); |
23 | 23 | ||
24 | m_lbl = new OClickableLabel( this ); | 24 | m_lbl = new OClickableLabel( this ); |
25 | m_lbl->setMinimumWidth( 15 ); | 25 | m_lbl->setMinimumWidth( 15 ); |
26 | m_lbl->setPixmap( priority3 ); | 26 | m_lbl->setPixmap( priority3 ); |
27 | connect(m_lbl, SIGNAL(clicked() ), this, SLOT(slotPrio()) ); | 27 | connect(m_lbl, SIGNAL(clicked() ), this, SLOT(slotPrio()) ); |
28 | QWhatsThis::add( m_lbl, QWidget::tr( "Click here to set the priority of new task.\n\nThis area is called the quick task bar.\n\nIt allows you to quickly add a new task to your list. This area can be shown or hidden by selecting Options->'Show quick task bar' from the menu above." ) ); | 28 | QWhatsThis::add( m_lbl, QWidget::tr( "Click here to set the priority of new task.\n\nThis area is called the quick task bar.\n\nIt allows you to quickly add a new task to your list. This area can be shown or hidden by selecting Options->'Show quick task bar' from the menu above." ) ); |
29 | 29 | ||
30 | m_edit = new QLineEdit( this ); | 30 | m_edit = new QLineEdit( this ); |
31 | setStretchableWidget( m_edit ); | 31 | setStretchableWidget( m_edit ); |
32 | QWhatsThis::add( m_edit, QWidget::tr( "Enter description of new task here.\n\nThis area is called the quick task bar.\n\nIt allows you to quickly add a new task to your list. This area can be shown or hidden by selecting Options->'Show quick task bar' from the menu above." ) ); | 32 | QWhatsThis::add( m_edit, QWidget::tr( "Enter description of new task here.\n\nThis area is called the quick task bar.\n\nIt allows you to quickly add a new task to your list. This area can be shown or hidden by selecting Options->'Show quick task bar' from the menu above." ) ); |
33 | 33 | ||
34 | /* | ||
35 | * it's not implemented and won't be implemented for 1.0 | ||
36 | */ | ||
37 | #if 0 | ||
34 | QAction *a = new QAction( QWidget::tr( "More" ), Resource::loadPixmap( "todo/more" ), QString::null, 0, this, 0 ); | 38 | QAction *a = new QAction( QWidget::tr( "More" ), Resource::loadPixmap( "todo/more" ), QString::null, 0, this, 0 ); |
35 | connect( a, SIGNAL( activated() ), this, SLOT( slotMore() ) ); | 39 | connect( a, SIGNAL( activated() ), this, SLOT( slotMore() ) ); |
36 | a->addTo( this ); | 40 | a->addTo( this ); |
37 | a->setWhatsThis( QWidget::tr( "Click here to enter additional information for new task.\n\nThis area is called the quick task bar.\n\nIt allows you to quickly add a new task to your list. This area can be shown or hidden by selecting Options->'Show quick task bar' from the menu above." ) ); | 41 | a->setWhatsThis( QWidget::tr( "Click here to enter additional information for new task.\n\nThis area is called the quick task bar.\n\nIt allows you to quickly add a new task to your list. This area can be shown or hidden by selecting Options->'Show quick task bar' from the menu above." ) ); |
42 | #endif | ||
38 | 43 | ||
39 | a = new QAction( QWidget::tr( "Enter" ), Resource::loadPixmap( "enter" ), QString::null, 0, this, 0 ); | 44 | QAction *a = new QAction( QWidget::tr( "Enter" ), Resource::loadPixmap( "enter" ), QString::null, 0, this, 0 ); |
40 | connect( a, SIGNAL( activated() ), this, SLOT( slotEnter() ) ); | 45 | connect( a, SIGNAL( activated() ), this, SLOT( slotEnter() ) ); |
41 | a->addTo( this ); | 46 | a->addTo( this ); |
42 | a->setWhatsThis( QWidget::tr( "Click here to add new task.\n\nThis area is called the quick task bar.\n\nIt allows you to quickly add a new task to your list. This area can be shown or hidden by selecting Options->'Show quick task bar' from the menu above." ) ); | 47 | a->setWhatsThis( QWidget::tr( "Click here to add new task.\n\nThis area is called the quick task bar.\n\nIt allows you to quickly add a new task to your list. This area can be shown or hidden by selecting Options->'Show quick task bar' from the menu above." ) ); |
43 | 48 | ||
44 | a = new QAction( QWidget::tr( "Cancel" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 49 | a = new QAction( QWidget::tr( "Cancel" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
45 | connect( a, SIGNAL( activated() ), this, SLOT( slotCancel() ) ); | 50 | connect( a, SIGNAL( activated() ), this, SLOT( slotCancel() ) ); |
46 | a->addTo( this ); | 51 | a->addTo( this ); |
47 | a->setWhatsThis( QWidget::tr( "Click here to reset new task information.\n\nThis area is called the quick task bar.\n\nIt allows you to quickly add a new task to your list. This area can be shown or hidden by selecting Options->'Show quick task bar' from the menu above." ) ); | 52 | a->setWhatsThis( QWidget::tr( "Click here to reset new task information.\n\nThis area is called the quick task bar.\n\nIt allows you to quickly add a new task to your list. This area can be shown or hidden by selecting Options->'Show quick task bar' from the menu above." ) ); |
48 | 53 | ||
49 | m_visible = visible; | 54 | m_visible = visible; |
50 | if ( !m_visible ) { | 55 | if ( !m_visible ) { |
51 | hide(); | 56 | hide(); |
diff --git a/core/pim/todo/smalltodo.cpp b/core/pim/todo/smalltodo.cpp index 412fe9e..504256d 100644 --- a/core/pim/todo/smalltodo.cpp +++ b/core/pim/todo/smalltodo.cpp | |||
@@ -16,25 +16,24 @@ | |||
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
17 | ..}^=.= = ; Library General Public License for more | 17 | ..}^=.= = ; Library General Public License for more |
18 | ++= -. .` .: details. | 18 | ++= -. .` .: details. |
19 | : = ...= . :.=- | 19 | : = ...= . :.=- |
20 | -. .:....=;==+<; You should have received a copy of the GNU | 20 | -. .:....=;==+<; You should have received a copy of the GNU |
21 | -_. . . )=. = Library General Public License along with | 21 | -_. . . )=. = Library General Public License along with |
22 | -- :-=` this library; see the file COPYING.LIB. | 22 | -- :-=` this library; see the file COPYING.LIB. |
23 | If not, write to the Free Software Foundation, | 23 | If not, write to the Free Software Foundation, |
24 | Inc., 59 Temple Place - Suite 330, | 24 | Inc., 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | #include <qshared.h> | ||
29 | 28 | ||
30 | #include "smalltodo.h" | 29 | #include "smalltodo.h" |
31 | 30 | ||
32 | using namespace Todo; | 31 | using namespace Todo; |
33 | 32 | ||
34 | struct SmallTodo::SmallTodoPrivate : public QShared{ | 33 | struct SmallTodo::SmallTodoPrivate : public QShared{ |
35 | 34 | ||
36 | SmallTodoPrivate() : QShared(), uid(-1) {}; | 35 | SmallTodoPrivate() : QShared(), uid(-1) {}; |
37 | QString name; | 36 | QString name; |
38 | QStringList categories; // as real Names | 37 | QStringList categories; // as real Names |
39 | int uid; | 38 | int uid; |
40 | bool complete:1; | 39 | bool complete:1; |
diff --git a/core/pim/todo/tableview.cpp b/core/pim/todo/tableview.cpp index d9cda09..2e252d5 100644 --- a/core/pim/todo/tableview.cpp +++ b/core/pim/todo/tableview.cpp | |||
@@ -18,47 +18,68 @@ | |||
18 | ++= -. .` .: details. | 18 | ++= -. .` .: details. |
19 | : = ...= . :.=- | 19 | : = ...= . :.=- |
20 | -. .:....=;==+<; You should have received a copy of the GNU | 20 | -. .:....=;==+<; You should have received a copy of the GNU |
21 | -_. . . )=. = Library General Public License along with | 21 | -_. . . )=. = Library General Public License along with |
22 | -- :-=` this library; see the file COPYING.LIB. | 22 | -- :-=` this library; see the file COPYING.LIB. |
23 | If not, write to the Free Software Foundation, | 23 | If not, write to the Free Software Foundation, |
24 | Inc., 59 Temple Place - Suite 330, | 24 | Inc., 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | #include <stdlib.h> | 28 | #include <stdlib.h> |
29 | #include <cmath> | 29 | #include <cmath> |
30 | #include <cctype> | ||
30 | 31 | ||
31 | #include <qcombobox.h> | 32 | #include <qcombobox.h> |
32 | #include <qlineedit.h> | 33 | #include <qlineedit.h> |
33 | #include <qtimer.h> | 34 | #include <qtimer.h> |
34 | #include <qpoint.h> | ||
35 | #include <qpopupmenu.h> | 35 | #include <qpopupmenu.h> |
36 | 36 | ||
37 | #include <qpe/config.h> | 37 | #include <qpe/config.h> |
38 | #include <qpe/resource.h> | 38 | #include <qpe/resource.h> |
39 | 39 | ||
40 | #include <opie/orecur.h> | 40 | #include <opie/orecur.h> |
41 | 41 | ||
42 | #include "mainwindow.h" | 42 | #include "mainwindow.h" |
43 | //#include "tableitems.h" | 43 | //#include "tableitems.h" |
44 | #include "tableview.h" | 44 | #include "tableview.h" |
45 | 45 | ||
46 | using namespace Todo; | 46 | using namespace Todo; |
47 | 47 | ||
48 | namespace { | 48 | namespace { |
49 | static const int BoxSize = 14; | 49 | static const int BoxSize = 14; |
50 | static const int RowHeight = 20; | 50 | static const int RowHeight = 20; |
51 | } | 51 | } |
52 | 52 | ||
53 | TableView::EditorWidget::EditorWidget() : m_wid(0l), m_row(-1), m_col(-1) { | ||
54 | } | ||
55 | void TableView::EditorWidget::setCellWidget(QWidget* wid, int row, int col ) { | ||
56 | m_wid = wid; | ||
57 | m_row = row; | ||
58 | m_col = col; | ||
59 | } | ||
60 | void TableView::EditorWidget::releaseCellWidget() { | ||
61 | m_wid = 0; | ||
62 | m_row = m_col = -1; | ||
63 | } | ||
64 | QWidget* TableView::EditorWidget::cellWidget()const { | ||
65 | return m_wid; | ||
66 | } | ||
67 | int TableView::EditorWidget::cellRow()const { | ||
68 | return m_row; | ||
69 | } | ||
70 | int TableView::EditorWidget::cellCol()const { | ||
71 | return m_col; | ||
72 | } | ||
73 | |||
53 | 74 | ||
54 | void TableView::initConfig() { | 75 | void TableView::initConfig() { |
55 | Config config( "todo" ); | 76 | Config config( "todo" ); |
56 | config.setGroup( "Options" ); | 77 | config.setGroup( "Options" ); |
57 | m_completeStrokeWidth = config.readNumEntry( "CompleteStrokeWidth", 8 ); | 78 | m_completeStrokeWidth = config.readNumEntry( "CompleteStrokeWidth", 8 ); |
58 | for (int i = 0; i < numCols(); i++ ) { | 79 | for (int i = 0; i < numCols(); i++ ) { |
59 | int width = config.readNumEntry("Width"+QString::number(i), -1 ); | 80 | int width = config.readNumEntry("Width"+QString::number(i), -1 ); |
60 | setColumnWidth(i, width == -1 ? columnWidth(i) : width ); | 81 | setColumnWidth(i, width == -1 ? columnWidth(i) : width ); |
61 | } | 82 | } |
62 | } | 83 | } |
63 | 84 | ||
64 | TableView::TableView( MainWindow* window, QWidget* wid ) | 85 | TableView::TableView( MainWindow* window, QWidget* wid ) |
@@ -134,29 +155,42 @@ TableView::~TableView() { | |||
134 | for (int i = 0; i < numCols(); i++ ) | 155 | for (int i = 0; i < numCols(); i++ ) |
135 | config.writeEntry("Width"+QString::number(i), columnWidth(i) ); | 156 | config.writeEntry("Width"+QString::number(i), columnWidth(i) ); |
136 | } | 157 | } |
137 | void TableView::slotShowMenu() { | 158 | void TableView::slotShowMenu() { |
138 | QPopupMenu *menu = todoWindow()->contextMenu( current(), sorted()[currentRow()].recurrence().doesRecur() ); | 159 | QPopupMenu *menu = todoWindow()->contextMenu( current(), sorted()[currentRow()].recurrence().doesRecur() ); |
139 | menu->exec(QCursor::pos() ); | 160 | menu->exec(QCursor::pos() ); |
140 | delete menu; | 161 | delete menu; |
141 | } | 162 | } |
142 | QString TableView::type() const { | 163 | QString TableView::type() const { |
143 | return QString::fromLatin1( tr("Table View") ); | 164 | return QString::fromLatin1( tr("Table View") ); |
144 | } | 165 | } |
145 | int TableView::current() { | 166 | int TableView::current() { |
146 | if (numRows() == 0 ) return 1; | 167 | if (numRows() == 0 ) return 0; |
147 | int uid = sorted().uidAt(currentRow() ); | 168 | int uid = sorted().uidAt(currentRow() ); |
148 | 169 | ||
149 | return uid; | 170 | return uid; |
150 | } | 171 | } |
172 | int TableView::next() { | ||
173 | if ( numRows() == 0 ) return 0; | ||
174 | if ( currentRow() + 1 >= numRows() ) return 0; | ||
175 | setCurrentCell( currentRow() +1, currentColumn() ); | ||
176 | return sorted().uidAt( currentRow() ); | ||
177 | } | ||
178 | int TableView::prev() { | ||
179 | if ( numRows() == 0 ) return 0; | ||
180 | if ( currentRow() - 1 < 0 ) return 0; | ||
181 | setCurrentCell( currentRow() -1, currentColumn() ); | ||
182 | return sorted().uidAt( currentRow() ); | ||
183 | |||
184 | } | ||
151 | QString TableView::currentRepresentation() { | 185 | QString TableView::currentRepresentation() { |
152 | OTodo to = sorted()[currentRow()]; | 186 | OTodo to = sorted()[currentRow()]; |
153 | return to.summary().isEmpty() ? to.description().left(20) : to.summary() ; | 187 | return to.summary().isEmpty() ? to.description().left(20) : to.summary() ; |
154 | } | 188 | } |
155 | /* show overdue */ | 189 | /* show overdue */ |
156 | void TableView::showOverDue( bool ) { | 190 | void TableView::showOverDue( bool ) { |
157 | clear(); | 191 | clear(); |
158 | updateView(); | 192 | updateView(); |
159 | } | 193 | } |
160 | 194 | ||
161 | void TableView::updateView( ) { | 195 | void TableView::updateView( ) { |
162 | qWarning("update view"); | 196 | qWarning("update view"); |
@@ -210,29 +244,29 @@ void TableView::addEvent( const OTodo&) { | |||
210 | void TableView::replaceEvent( const OTodo& ev) { | 244 | void TableView::replaceEvent( const OTodo& ev) { |
211 | addEvent( ev ); | 245 | addEvent( ev ); |
212 | } | 246 | } |
213 | /* | 247 | /* |
214 | * re aligning table can be slow too | 248 | * re aligning table can be slow too |
215 | * FIXME: look what performs better | 249 | * FIXME: look what performs better |
216 | * either this or the old align table | 250 | * either this or the old align table |
217 | */ | 251 | */ |
218 | void TableView::removeEvent( int ) { | 252 | void TableView::removeEvent( int ) { |
219 | updateView(); | 253 | updateView(); |
220 | } | 254 | } |
221 | void TableView::setShowCompleted( bool b) { | 255 | void TableView::setShowCompleted( bool b) { |
222 | qWarning("Show Completed %d" + b ); | 256 | qWarning("Show Completed %d" , b ); |
223 | updateView(); | 257 | updateView(); |
224 | } | 258 | } |
225 | void TableView::setShowDeadline( bool b ) { | 259 | void TableView::setShowDeadline( bool b ) { |
226 | qWarning( "Show DeadLine %d" + b ); | 260 | qWarning( "Show DeadLine %d" , b ); |
227 | if ( b ) | 261 | if ( b ) |
228 | showColumn( 3 ); | 262 | showColumn( 3 ); |
229 | else | 263 | else |
230 | hideColumn( 3 ); | 264 | hideColumn( 3 ); |
231 | 265 | ||
232 | // Try to intelligently size columns | 266 | // Try to intelligently size columns |
233 | // TODO - would use width() below, but doesn't have valid value at time of c'tor | 267 | // TODO - would use width() below, but doesn't have valid value at time of c'tor |
234 | int col2width = 238; | 268 | int col2width = 238; |
235 | int width = m_pic_completed.width(); | 269 | int width = m_pic_completed.width(); |
236 | setColumnWidth( 0, width ); | 270 | setColumnWidth( 0, width ); |
237 | col2width -= width; | 271 | col2width -= width; |
238 | width = fontMetrics().boundingRect( horizontalHeader()->label( 1 ) ).width() + 8; | 272 | width = fontMetrics().boundingRect( horizontalHeader()->label( 1 ) ).width() + 8; |
@@ -250,46 +284,57 @@ void TableView::setShowCategory( const QString& str) { | |||
250 | if ( str != m_oleCat || m_first ) | 284 | if ( str != m_oleCat || m_first ) |
251 | updateView(); | 285 | updateView(); |
252 | 286 | ||
253 | m_oleCat = str; | 287 | m_oleCat = str; |
254 | m_first = false; | 288 | m_first = false; |
255 | 289 | ||
256 | } | 290 | } |
257 | void TableView::clear() { | 291 | void TableView::clear() { |
258 | setNumRows(0); | 292 | setNumRows(0); |
259 | } | 293 | } |
260 | void TableView::slotClicked(int row, int col, int, | 294 | void TableView::slotClicked(int row, int col, int, |
261 | const QPoint& point) { | 295 | const QPoint& point) { |
296 | if ( m_editorWidget.cellWidget() ) { | ||
297 | //setCellContentFromEditor(m_editorWidget.cellRow(), m_editorWidget.cellCol() ); | ||
298 | endEdit(m_editorWidget.cellRow(), m_editorWidget.cellCol(), | ||
299 | true, true ); | ||
300 | m_editorWidget.releaseCellWidget(); | ||
301 | } | ||
302 | |||
262 | if ( !cellGeometry(row, col ).contains(point ) ) | 303 | if ( !cellGeometry(row, col ).contains(point ) ) |
263 | return; | 304 | return; |
264 | 305 | ||
265 | int ui= sorted().uidAt( row ); | 306 | int ui= sorted().uidAt( row ); |
266 | 307 | ||
267 | 308 | ||
268 | switch( col ) { | 309 | switch( col ) { |
269 | case 0:{ | 310 | case 0:{ |
270 | int x = point.x() -columnPos( col ); | 311 | int x = point.x() -columnPos( col ); |
271 | int y = point.y() -rowPos( row ); | 312 | int y = point.y() -rowPos( row ); |
272 | int w = columnWidth( col ); | 313 | int w = columnWidth( col ); |
273 | int h = rowHeight( row ); | 314 | int h = rowHeight( row ); |
274 | if ( x >= ( w - BoxSize ) / 2 && | 315 | if ( x >= ( w - BoxSize ) / 2 && |
275 | x <= ( w - BoxSize ) / 2 + BoxSize && | 316 | x <= ( w - BoxSize ) / 2 + BoxSize && |
276 | y >= ( h - BoxSize ) / 2 && | 317 | y >= ( h - BoxSize ) / 2 && |
277 | y <= ( h - BoxSize ) / 2 + BoxSize ) { | 318 | y <= ( h - BoxSize ) / 2 + BoxSize ) { |
278 | TodoView::complete(sorted()[row] ); | 319 | TodoView::complete(sorted()[row] ); |
279 | } | 320 | } |
280 | } | 321 | } |
281 | break; | 322 | break; |
282 | 323 | ||
283 | case 1: | 324 | // Priority emit a double click... |
325 | case 1:{ | ||
326 | QWidget* wid = beginEdit( row, col, FALSE ); | ||
327 | m_editorWidget.setCellWidget( wid, row, col ); | ||
328 | } | ||
284 | break; | 329 | break; |
285 | 330 | ||
286 | case 2: { | 331 | case 2: { |
287 | m_menuTimer->stop(); | 332 | m_menuTimer->stop(); |
288 | showTodo( ui ); | 333 | showTodo( ui ); |
289 | break; | 334 | break; |
290 | } | 335 | } |
291 | case 3: { | 336 | case 3: { |
292 | m_menuTimer->stop(); | 337 | m_menuTimer->stop(); |
293 | TodoView::edit( ui ); | 338 | TodoView::edit( ui ); |
294 | break; | 339 | break; |
295 | } | 340 | } |
@@ -437,24 +482,25 @@ QWidget* TableView::createEditor(int row, int col, bool )const { | |||
437 | /* summary */ | 482 | /* summary */ |
438 | case 2:{ | 483 | case 2:{ |
439 | QLineEdit* edit = new QLineEdit( viewport() ); | 484 | QLineEdit* edit = new QLineEdit( viewport() ); |
440 | edit->setText( sorted()[row].summary() ); | 485 | edit->setText( sorted()[row].summary() ); |
441 | return edit; | 486 | return edit; |
442 | } | 487 | } |
443 | case 0: | 488 | case 0: |
444 | default: | 489 | default: |
445 | return 0l; | 490 | return 0l; |
446 | } | 491 | } |
447 | } | 492 | } |
448 | void TableView::setCellContentFromEditor(int row, int col ) { | 493 | void TableView::setCellContentFromEditor(int row, int col ) { |
494 | qWarning("set cell content from editor"); | ||
449 | if ( col == 1 ) { | 495 | if ( col == 1 ) { |
450 | QWidget* wid = cellWidget(row, 1 ); | 496 | QWidget* wid = cellWidget(row, 1 ); |
451 | if ( wid->inherits("QComboBox") ) { | 497 | if ( wid->inherits("QComboBox") ) { |
452 | int pri = ((QComboBox*)wid)->currentItem() + 1; | 498 | int pri = ((QComboBox*)wid)->currentItem() + 1; |
453 | OTodo todo = sorted()[row]; | 499 | OTodo todo = sorted()[row]; |
454 | if ( todo.priority() != pri ) { | 500 | if ( todo.priority() != pri ) { |
455 | todo.setPriority( pri ); | 501 | todo.setPriority( pri ); |
456 | TodoView::update( todo.uid(), todo ); | 502 | TodoView::update( todo.uid(), todo ); |
457 | updateView(); | 503 | updateView(); |
458 | } | 504 | } |
459 | } | 505 | } |
460 | }else if ( col == 2) { | 506 | }else if ( col == 2) { |
@@ -533,22 +579,50 @@ void TableView::contentsMouseReleaseEvent( QMouseEvent* e) { | |||
533 | if ( row == rowAt( e->y() ) && row != -1 && | 579 | if ( row == rowAt( e->y() ) && row != -1 && |
534 | colOld != colNew ) { | 580 | colOld != colNew ) { |
535 | TodoView::complete( sorted()[row] ); | 581 | TodoView::complete( sorted()[row] ); |
536 | return; | 582 | return; |
537 | } | 583 | } |
538 | QTable::contentsMouseReleaseEvent( e ); | 584 | QTable::contentsMouseReleaseEvent( e ); |
539 | } | 585 | } |
540 | void TableView::contentsMouseMoveEvent( QMouseEvent* e ) { | 586 | void TableView::contentsMouseMoveEvent( QMouseEvent* e ) { |
541 | m_menuTimer->stop(); | 587 | m_menuTimer->stop(); |
542 | QTable::contentsMouseMoveEvent( e ); | 588 | QTable::contentsMouseMoveEvent( e ); |
543 | } | 589 | } |
544 | void TableView::keyPressEvent( QKeyEvent* event) { | 590 | void TableView::keyPressEvent( QKeyEvent* event) { |
591 | if ( m_editorWidget.cellWidget() ) { | ||
592 | // setCellContentFromEditor(m_editorWidget.cellRow(), m_editorWidget.cellCol() ); | ||
593 | endEdit(m_editorWidget.cellRow(), m_editorWidget.cellCol(), | ||
594 | true, true ); | ||
595 | m_editorWidget.releaseCellWidget(); | ||
596 | setFocus(); | ||
597 | } | ||
598 | int row = currentRow(); | ||
599 | int col = currentColumn(); | ||
600 | |||
601 | char key = ::toupper( event->ascii() ); | ||
602 | /* let QTable also handle the d later */ | ||
603 | if ( key == 'D' ) | ||
604 | removeQuery( sorted().uidAt( row ) ); | ||
605 | |||
606 | |||
545 | switch( event->key() ) { | 607 | switch( event->key() ) { |
546 | case Qt::Key_F33: | 608 | case Qt::Key_F33: |
547 | case Qt::Key_Enter: | 609 | case Qt::Key_Enter: |
548 | case Qt::Key_Return: | 610 | case Qt::Key_Return: |
611 | case Qt::Key_Space: | ||
612 | if ( col == 0 ) { | ||
613 | TodoView::complete(sorted()[row]); | ||
614 | }else if ( col == 1 ) { | ||
615 | QWidget* wid = beginEdit(row, col, FALSE ); | ||
616 | m_editorWidget.setCellWidget( wid, row, col ); | ||
617 | }else if ( col == 2 ) { | ||
549 | showTodo( sorted().uidAt( currentRow() ) ); | 618 | showTodo( sorted().uidAt( currentRow() ) ); |
619 | }else if ( col == 3 ) { | ||
620 | TodoView::edit( sorted().uidAt(row) ); | ||
621 | } | ||
622 | |||
550 | break; | 623 | break; |
551 | default: | 624 | default: |
552 | QTable::keyPressEvent( event ); | 625 | QTable::keyPressEvent( event ); |
553 | } | 626 | } |
554 | } | 627 | } |
628 | |||
diff --git a/core/pim/todo/tableview.h b/core/pim/todo/tableview.h index 689c496..528ddc9 100644 --- a/core/pim/todo/tableview.h +++ b/core/pim/todo/tableview.h | |||
@@ -41,24 +41,26 @@ namespace Todo { | |||
41 | class CheckItem; | 41 | class CheckItem; |
42 | class DueTextItem; | 42 | class DueTextItem; |
43 | class TableView : public QTable, public TodoView { | 43 | class TableView : public QTable, public TodoView { |
44 | Q_OBJECT | 44 | Q_OBJECT |
45 | public: | 45 | public: |
46 | TableView( MainWindow*, QWidget* parent ); | 46 | TableView( MainWindow*, QWidget* parent ); |
47 | ~TableView(); | 47 | ~TableView(); |
48 | 48 | ||
49 | 49 | ||
50 | QString type()const; | 50 | QString type()const; |
51 | int current(); | 51 | int current(); |
52 | QString currentRepresentation(); | 52 | QString currentRepresentation(); |
53 | int next(); | ||
54 | int prev(); | ||
53 | 55 | ||
54 | void clear(); | 56 | void clear(); |
55 | void showOverDue( bool ); | 57 | void showOverDue( bool ); |
56 | void updateView(); | 58 | void updateView(); |
57 | void setTodo( int uid, const OTodo& ); | 59 | void setTodo( int uid, const OTodo& ); |
58 | void addEvent( const OTodo& event ); | 60 | void addEvent( const OTodo& event ); |
59 | void replaceEvent( const OTodo& ); | 61 | void replaceEvent( const OTodo& ); |
60 | void removeEvent( int uid ); | 62 | void removeEvent( int uid ); |
61 | void setShowCompleted( bool ); | 63 | void setShowCompleted( bool ); |
62 | void setShowDeadline( bool ); | 64 | void setShowDeadline( bool ); |
63 | 65 | ||
64 | void setShowCategory(const QString& =QString::null ); | 66 | void setShowCategory(const QString& =QString::null ); |
@@ -82,24 +84,40 @@ namespace Todo { | |||
82 | bool m_first : 1; | 84 | bool m_first : 1; |
83 | 85 | ||
84 | QPixmap m_pic_completed; | 86 | QPixmap m_pic_completed; |
85 | QPixmap m_pic_priority[ 5 ]; | 87 | QPixmap m_pic_priority[ 5 ]; |
86 | 88 | ||
87 | protected: | 89 | protected: |
88 | void keyPressEvent( QKeyEvent* ); | 90 | void keyPressEvent( QKeyEvent* ); |
89 | void contentsMouseReleaseEvent( QMouseEvent* ); | 91 | void contentsMouseReleaseEvent( QMouseEvent* ); |
90 | void contentsMouseMoveEvent( QMouseEvent* ); | 92 | void contentsMouseMoveEvent( QMouseEvent* ); |
91 | void timerEvent( QTimerEvent* e ); | 93 | void timerEvent( QTimerEvent* e ); |
92 | QWidget* createEditor(int row, int col, bool initFromCell )const; | 94 | QWidget* createEditor(int row, int col, bool initFromCell )const; |
93 | void setCellContentFromEditor( int row, int col ); | 95 | void setCellContentFromEditor( int row, int col ); |
96 | /** | ||
97 | * for inline editing on single click and to work around some | ||
98 | * bug in qt2.3.5 | ||
99 | */ | ||
100 | struct EditorWidget { | ||
101 | EditorWidget(); | ||
102 | void setCellWidget(QWidget*, int row, int col ); | ||
103 | void releaseCellWidget(); | ||
104 | QWidget* cellWidget()const; | ||
105 | int cellRow()const; | ||
106 | int cellCol()const; | ||
107 | private: | ||
108 | QWidget* m_wid; | ||
109 | int m_row, m_col; | ||
110 | }; | ||
111 | EditorWidget m_editorWidget; | ||
94 | 112 | ||
95 | private slots: | 113 | private slots: |
96 | void slotShowMenu(); | 114 | void slotShowMenu(); |
97 | void slotClicked(int, int, int, | 115 | void slotClicked(int, int, int, |
98 | const QPoint& ); | 116 | const QPoint& ); |
99 | void slotPressed(int, int, int, | 117 | void slotPressed(int, int, int, |
100 | const QPoint& ); | 118 | const QPoint& ); |
101 | void slotValueChanged(int, int); | 119 | void slotValueChanged(int, int); |
102 | void slotCurrentChanged(int, int ); | 120 | void slotCurrentChanged(int, int ); |
103 | void slotPriority(); | 121 | void slotPriority(); |
104 | private: | 122 | private: |
105 | void initConfig(); | 123 | void initConfig(); |
diff --git a/core/pim/todo/taskeditoralarms.cpp b/core/pim/todo/taskeditoralarms.cpp index bff3338..bcc40fe 100644 --- a/core/pim/todo/taskeditoralarms.cpp +++ b/core/pim/todo/taskeditoralarms.cpp | |||
@@ -25,32 +25,27 @@ | |||
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include "taskeditoralarms.h" | 29 | #include "taskeditoralarms.h" |
30 | 30 | ||
31 | #include <opie/otodo.h> | 31 | #include <opie/otodo.h> |
32 | #include <opie/opimnotifymanager.h> | 32 | #include <opie/opimnotifymanager.h> |
33 | #include <opie/otimepicker.h> | 33 | #include <opie/otimepicker.h> |
34 | 34 | ||
35 | #include <qpe/datebookmonth.h> | 35 | #include <qpe/datebookmonth.h> |
36 | #include <qpe/resource.h> | 36 | #include <qpe/resource.h> |
37 | #include <qpe/timestring.h> | ||
38 | 37 | ||
39 | #include <qdatetime.h> | ||
40 | #include <qlistview.h> | 38 | #include <qlistview.h> |
41 | #include <qpushbutton.h> | ||
42 | #include <qpopupmenu.h> | ||
43 | #include <qlayout.h> | 39 | #include <qlayout.h> |
44 | #include <qwhatsthis.h> | ||
45 | 40 | ||
46 | 41 | ||
47 | class AlarmItem : public QListViewItem { | 42 | class AlarmItem : public QListViewItem { |
48 | public: | 43 | public: |
49 | AlarmItem( QListView*, const OPimAlarm& ); | 44 | AlarmItem( QListView*, const OPimAlarm& ); |
50 | ~AlarmItem(); | 45 | ~AlarmItem(); |
51 | 46 | ||
52 | OPimAlarm alarm()const; | 47 | OPimAlarm alarm()const; |
53 | void setAlarm( const OPimAlarm& ); | 48 | void setAlarm( const OPimAlarm& ); |
54 | private: | 49 | private: |
55 | QDateTime m_dt; | 50 | QDateTime m_dt; |
56 | int m_type; | 51 | int m_type; |
diff --git a/core/pim/todo/taskeditoroverview.cpp b/core/pim/todo/taskeditoroverview.cpp index 9a8abea..415dcf2 100644 --- a/core/pim/todo/taskeditoroverview.cpp +++ b/core/pim/todo/taskeditoroverview.cpp | |||
@@ -24,28 +24,26 @@ | |||
24 | Inc., 59 Temple Place - Suite 330, | 24 | Inc., 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include "taskeditoroverview.h" | 29 | #include "taskeditoroverview.h" |
30 | 30 | ||
31 | #include <opie/orecur.h> | 31 | #include <opie/orecur.h> |
32 | 32 | ||
33 | #include <qpe/categoryselect.h> | 33 | #include <qpe/categoryselect.h> |
34 | #include <qpe/datebookmonth.h> | 34 | #include <qpe/datebookmonth.h> |
35 | #include <qpe/resource.h> | 35 | #include <qpe/resource.h> |
36 | #include <qpe/timestring.h> | ||
37 | 36 | ||
38 | #include <qcheckbox.h> | 37 | #include <qcheckbox.h> |
39 | #include <qcombobox.h> | ||
40 | #include <qlabel.h> | 38 | #include <qlabel.h> |
41 | #include <qlayout.h> | 39 | #include <qlayout.h> |
42 | #include <qmultilineedit.h> | 40 | #include <qmultilineedit.h> |
43 | #include <qwhatsthis.h> | 41 | #include <qwhatsthis.h> |
44 | 42 | ||
45 | TaskEditorOverView::TaskEditorOverView( QWidget* parent, const char* name, WFlags fl ) | 43 | TaskEditorOverView::TaskEditorOverView( QWidget* parent, const char* name, WFlags fl ) |
46 | : QWidget( parent, name, fl ) | 44 | : QWidget( parent, name, fl ) |
47 | { | 45 | { |
48 | // Load icons | 46 | // Load icons |
49 | // TODO - probably should be done globally somewhere else, | 47 | // TODO - probably should be done globally somewhere else, |
50 | // see also quickeditimpl.cpp/h, tableview.cpp/h | 48 | // see also quickeditimpl.cpp/h, tableview.cpp/h |
51 | QString namestr; | 49 | QString namestr; |
@@ -59,25 +57,25 @@ TaskEditorOverView::TaskEditorOverView( QWidget* parent, const char* name, WFla | |||
59 | 57 | ||
60 | QScrollView *sv = new QScrollView( this ); | 58 | QScrollView *sv = new QScrollView( this ); |
61 | vb->addWidget( sv ); | 59 | vb->addWidget( sv ); |
62 | sv->setResizePolicy( QScrollView::AutoOneFit ); | 60 | sv->setResizePolicy( QScrollView::AutoOneFit ); |
63 | sv->setFrameStyle( QFrame::NoFrame ); | 61 | sv->setFrameStyle( QFrame::NoFrame ); |
64 | 62 | ||
65 | QWidget *container = new QWidget( sv->viewport() ); | 63 | QWidget *container = new QWidget( sv->viewport() ); |
66 | sv->addChild( container ); | 64 | sv->addChild( container ); |
67 | 65 | ||
68 | QGridLayout *layout = new QGridLayout( container, 7, 2, 4, 4 ); | 66 | QGridLayout *layout = new QGridLayout( container, 7, 2, 4, 4 ); |
69 | 67 | ||
70 | // Description | 68 | // Description |
71 | QLabel *label = new QLabel( tr( "Description:" ), container ); | 69 | QLabel *label = new QLabel( tr( "Summary:" ), container ); |
72 | layout->addWidget( label, 0, 0 ); | 70 | layout->addWidget( label, 0, 0 ); |
73 | QWhatsThis::add( label, tr( "Enter brief description of the task here." ) ); | 71 | QWhatsThis::add( label, tr( "Enter brief description of the task here." ) ); |
74 | cmbDesc = new QComboBox( TRUE, container ); | 72 | cmbDesc = new QComboBox( TRUE, container ); |
75 | cmbDesc->insertItem( tr( "Complete " ) ); | 73 | cmbDesc->insertItem( tr( "Complete " ) ); |
76 | cmbDesc->insertItem( tr( "Work on " ) ); | 74 | cmbDesc->insertItem( tr( "Work on " ) ); |
77 | cmbDesc->insertItem( tr( "Buy " ) ); | 75 | cmbDesc->insertItem( tr( "Buy " ) ); |
78 | cmbDesc->insertItem( tr( "Organize " ) ); | 76 | cmbDesc->insertItem( tr( "Organize " ) ); |
79 | cmbDesc->insertItem( tr( "Get " ) ); | 77 | cmbDesc->insertItem( tr( "Get " ) ); |
80 | cmbDesc->insertItem( tr( "Update " ) ); | 78 | cmbDesc->insertItem( tr( "Update " ) ); |
81 | cmbDesc->insertItem( tr( "Create " ) ); | 79 | cmbDesc->insertItem( tr( "Create " ) ); |
82 | cmbDesc->insertItem( tr( "Plan " ) ); | 80 | cmbDesc->insertItem( tr( "Plan " ) ); |
83 | cmbDesc->insertItem( tr( "Call " ) ); | 81 | cmbDesc->insertItem( tr( "Call " ) ); |
@@ -107,25 +105,25 @@ TaskEditorOverView::TaskEditorOverView( QWidget* parent, const char* name, WFla | |||
107 | QWhatsThis::add( label, tr( "Select category to organize this task with." ) ); | 105 | QWhatsThis::add( label, tr( "Select category to organize this task with." ) ); |
108 | cmbCategory = new CategorySelect( container ); | 106 | cmbCategory = new CategorySelect( container ); |
109 | layout->addWidget( cmbCategory, 3, 1 ); | 107 | layout->addWidget( cmbCategory, 3, 1 ); |
110 | QWhatsThis::add( cmbCategory, tr( "Select category to organize this task with." ) ); | 108 | QWhatsThis::add( cmbCategory, tr( "Select category to organize this task with." ) ); |
111 | 109 | ||
112 | // Recurrence | 110 | // Recurrence |
113 | ckbRecurrence = new QCheckBox( tr( "Recurring task" ), container ); | 111 | ckbRecurrence = new QCheckBox( tr( "Recurring task" ), container ); |
114 | layout->addMultiCellWidget( ckbRecurrence, 4, 4, 0, 1 ); | 112 | layout->addMultiCellWidget( ckbRecurrence, 4, 4, 0, 1 ); |
115 | QWhatsThis::add( ckbRecurrence, tr( "Click here if task happens on a regular basis. If selected, frequency can be set on the Recurrence tab." ) ); | 113 | QWhatsThis::add( ckbRecurrence, tr( "Click here if task happens on a regular basis. If selected, frequency can be set on the Recurrence tab." ) ); |
116 | connect( ckbRecurrence, SIGNAL(clicked() ), this, SLOT( slotRecClicked() ) ); | 114 | connect( ckbRecurrence, SIGNAL(clicked() ), this, SLOT( slotRecClicked() ) ); |
117 | 115 | ||
118 | // Notes | 116 | // Notes |
119 | label = new QLabel( tr( "Notes:" ), container ); | 117 | label = new QLabel( tr( "Description:" ), container ); |
120 | layout->addWidget( label, 5, 0 ); | 118 | layout->addWidget( label, 5, 0 ); |
121 | QWhatsThis::add( label, tr( "Enter any additional information about this task here." ) ); | 119 | QWhatsThis::add( label, tr( "Enter any additional information about this task here." ) ); |
122 | mleNotes = new QMultiLineEdit( container ); | 120 | mleNotes = new QMultiLineEdit( container ); |
123 | mleNotes->setWordWrap( QMultiLineEdit::WidgetWidth ); | 121 | mleNotes->setWordWrap( QMultiLineEdit::WidgetWidth ); |
124 | layout->addMultiCellWidget( mleNotes, 6, 6, 0, 1 ); | 122 | layout->addMultiCellWidget( mleNotes, 6, 6, 0, 1 ); |
125 | QWhatsThis::add( mleNotes, tr( "Enter any additional information about this task here." ) ); | 123 | QWhatsThis::add( mleNotes, tr( "Enter any additional information about this task here." ) ); |
126 | } | 124 | } |
127 | 125 | ||
128 | TaskEditorOverView::~TaskEditorOverView() | 126 | TaskEditorOverView::~TaskEditorOverView() |
129 | { | 127 | { |
130 | } | 128 | } |
131 | 129 | ||
diff --git a/core/pim/todo/taskeditorstatus.cpp b/core/pim/todo/taskeditorstatus.cpp index 0ab4223..98e3cea 100644 --- a/core/pim/todo/taskeditorstatus.cpp +++ b/core/pim/todo/taskeditorstatus.cpp | |||
@@ -24,33 +24,29 @@ | |||
24 | Inc., 59 Temple Place - Suite 330, | 24 | Inc., 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include "taskeditorstatus.h" | 29 | #include "taskeditorstatus.h" |
30 | 30 | ||
31 | #include <opie/otodo.h> | 31 | #include <opie/otodo.h> |
32 | #include <opie/opimmaintainer.h> | 32 | #include <opie/opimmaintainer.h> |
33 | #include <opie/opimstate.h> | 33 | #include <opie/opimstate.h> |
34 | 34 | ||
35 | #include <qpe/datebookmonth.h> | 35 | #include <qpe/datebookmonth.h> |
36 | #include <qpe/resource.h> | ||
37 | #include <qpe/timestring.h> | ||
38 | 36 | ||
39 | #include <qcheckbox.h> | 37 | #include <qcheckbox.h> |
40 | #include <qcombobox.h> | 38 | #include <qcombobox.h> |
41 | #include <qlabel.h> | 39 | #include <qlabel.h> |
42 | #include <qlayout.h> | 40 | #include <qlayout.h> |
43 | #include <qscrollview.h> | ||
44 | #include <qtoolbutton.h> | ||
45 | #include <qwhatsthis.h> | 41 | #include <qwhatsthis.h> |
46 | 42 | ||
47 | // FIXME add the hack slots instead of setPopup!!!! | 43 | // FIXME add the hack slots instead of setPopup!!!! |
48 | // drw you shouldn't have removed them | 44 | // drw you shouldn't have removed them |
49 | 45 | ||
50 | TaskEditorStatus::TaskEditorStatus( QWidget* parent, const char* name, WFlags fl ) | 46 | TaskEditorStatus::TaskEditorStatus( QWidget* parent, const char* name, WFlags fl ) |
51 | : QWidget( parent, name, fl ) | 47 | : QWidget( parent, name, fl ) |
52 | { | 48 | { |
53 | QDate curDate = QDate::currentDate(); | 49 | QDate curDate = QDate::currentDate(); |
54 | m_start = m_comp = m_due = curDate; | 50 | m_start = m_comp = m_due = curDate; |
55 | QString curDateStr = TimeString::longDateString( curDate ); | 51 | QString curDateStr = TimeString::longDateString( curDate ); |
56 | 52 | ||
@@ -294,13 +290,14 @@ void TaskEditorStatus::slotStartChanged(int y, int m, int d) | |||
294 | } | 290 | } |
295 | 291 | ||
296 | void TaskEditorStatus::slotCompChanged(int y, int m, int d) | 292 | void TaskEditorStatus::slotCompChanged(int y, int m, int d) |
297 | { | 293 | { |
298 | m_comp.setYMD( y, m, d ); | 294 | m_comp.setYMD( y, m, d ); |
299 | btnComp->setText( TimeString::longDateString( m_comp ) ); | 295 | btnComp->setText( TimeString::longDateString( m_comp ) ); |
300 | } | 296 | } |
301 | 297 | ||
302 | void TaskEditorStatus::slotDueChanged(int y, int m, int d) | 298 | void TaskEditorStatus::slotDueChanged(int y, int m, int d) |
303 | { | 299 | { |
304 | m_due.setYMD( y, m, d ); | 300 | m_due.setYMD( y, m, d ); |
305 | btnDue->setText( TimeString::longDateString( m_due ) ); | 301 | btnDue->setText( TimeString::longDateString( m_due ) ); |
302 | emit dueDateChanged( m_due ); | ||
306 | } | 303 | } |
diff --git a/core/pim/todo/templatedialogimpl.cpp b/core/pim/todo/templatedialogimpl.cpp index fed92f0..c2306ac 100644 --- a/core/pim/todo/templatedialogimpl.cpp +++ b/core/pim/todo/templatedialogimpl.cpp | |||
@@ -1,13 +1,12 @@ | |||
1 | #include <qlistview.h> | ||
2 | #include <qlineedit.h> | 1 | #include <qlineedit.h> |
3 | 2 | ||
4 | #include "mainwindow.h" | 3 | #include "mainwindow.h" |
5 | #include "todoeditor.h" | 4 | #include "todoeditor.h" |
6 | #include "todotemplatemanager.h" | 5 | #include "todotemplatemanager.h" |
7 | #include "templatedialogimpl.h" | 6 | #include "templatedialogimpl.h" |
8 | 7 | ||
9 | 8 | ||
10 | using namespace Todo; | 9 | using namespace Todo; |
11 | 10 | ||
12 | /* TRANSLATOR Todo::TemplateDialogImpl */ | 11 | /* TRANSLATOR Todo::TemplateDialogImpl */ |
13 | 12 | ||
diff --git a/core/pim/todo/textviewshow.cpp b/core/pim/todo/textviewshow.cpp index fe8a9c8..35ea74b 100644 --- a/core/pim/todo/textviewshow.cpp +++ b/core/pim/todo/textviewshow.cpp | |||
@@ -1,32 +1,48 @@ | |||
1 | #include "mainwindow.h" | ||
2 | #include "textviewshow.h" | 1 | #include "textviewshow.h" |
3 | 2 | ||
4 | using namespace Todo; | 3 | using namespace Todo; |
5 | 4 | ||
6 | TextViewShow::TextViewShow( QWidget* parent, MainWindow* win) | 5 | TextViewShow::TextViewShow( QWidget* parent, MainWindow* win) |
7 | : QTextView( parent ), TodoShow(win) { | 6 | : QTextView( parent ), TodoShow(win) { |
8 | 7 | ||
9 | } | 8 | } |
10 | TextViewShow::~TextViewShow() { | 9 | TextViewShow::~TextViewShow() { |
11 | } | 10 | } |
12 | QString TextViewShow::type()const { | 11 | QString TextViewShow::type()const { |
13 | return QString::fromLatin1("TextViewShow"); | 12 | return QString::fromLatin1("TextViewShow"); |
14 | } | 13 | } |
15 | void TextViewShow::slotShow( const OTodo& ev ) { | 14 | void TextViewShow::slotShow( const OTodo& ev ) { |
16 | setText( ev.toRichText() ); | 15 | setText( ev.toRichText() ); |
17 | } | 16 | } |
18 | QWidget* TextViewShow::widget() { | 17 | QWidget* TextViewShow::widget() { |
19 | return this; | 18 | return this; |
20 | } | 19 | } |
21 | void TextViewShow::keyPressEvent( QKeyEvent* event ) { | 20 | void TextViewShow::keyPressEvent( QKeyEvent* event ) { |
22 | switch( event->key() ) { | 21 | switch( event->key() ) { |
22 | case Qt::Key_Up: | ||
23 | if ( ( visibleHeight() < contentsHeight() ) && | ||
24 | ( verticalScrollBar()->value() > verticalScrollBar()->minValue() ) ) | ||
25 | scrollBy( 0, -(visibleHeight()-20) ); | ||
26 | else | ||
27 | showPrev(); | ||
28 | break; | ||
29 | case Qt::Key_Down: | ||
30 | if ( ( visibleHeight() < contentsHeight() ) && | ||
31 | ( verticalScrollBar()->value() < verticalScrollBar()->maxValue() ) ) | ||
32 | scrollBy( 0, visibleHeight()-20 ); | ||
33 | else | ||
34 | showNext(); | ||
35 | break; | ||
36 | case Qt::Key_Left: | ||
37 | case Qt::Key_Right: | ||
23 | case Qt::Key_F33: | 38 | case Qt::Key_F33: |
24 | case Qt::Key_Enter: | 39 | case Qt::Key_Enter: |
25 | case Qt::Key_Return: | 40 | case Qt::Key_Return: |
41 | case Qt::Key_Space: | ||
26 | escapeView(); | 42 | escapeView(); |
27 | break; | 43 | break; |
28 | default: | 44 | default: |
29 | QTextView::keyPressEvent( event ); | 45 | QTextView::keyPressEvent( event ); |
30 | break; | 46 | break; |
31 | } | 47 | } |
32 | } | 48 | } |
diff --git a/core/pim/todo/todomanager.cpp b/core/pim/todo/todomanager.cpp index df2e711..501cca7 100644 --- a/core/pim/todo/todomanager.cpp +++ b/core/pim/todo/todomanager.cpp | |||
@@ -16,25 +16,24 @@ | |||
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
17 | ..}^=.= = ; Library General Public License for more | 17 | ..}^=.= = ; Library General Public License for more |
18 | ++= -. .` .: details. | 18 | ++= -. .` .: details. |
19 | : = ...= . :.=- | 19 | : = ...= . :.=- |
20 | -. .:....=;==+<; You should have received a copy of the GNU | 20 | -. .:....=;==+<; You should have received a copy of the GNU |
21 | -_. . . )=. = Library General Public License along with | 21 | -_. . . )=. = Library General Public License along with |
22 | -- :-=` this library; see the file COPYING.LIB. | 22 | -- :-=` this library; see the file COPYING.LIB. |
23 | If not, write to the Free Software Foundation, | 23 | If not, write to the Free Software Foundation, |
24 | Inc., 59 Temple Place - Suite 330, | 24 | Inc., 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | #include <qdatetime.h> | ||
29 | #include <qpe/categoryselect.h> | 28 | #include <qpe/categoryselect.h> |
30 | 29 | ||
31 | #include "todomanager.h" | 30 | #include "todomanager.h" |
32 | 31 | ||
33 | using namespace Todo; | 32 | using namespace Todo; |
34 | 33 | ||
35 | TodoManager::TodoManager( QObject *obj ) | 34 | TodoManager::TodoManager( QObject *obj ) |
36 | : QObject( obj ) { | 35 | : QObject( obj ) { |
37 | m_db = 0l; | 36 | m_db = 0l; |
38 | QTime time; | 37 | QTime time; |
39 | time.start(); | 38 | time.start(); |
40 | int el = time.elapsed(); | 39 | int el = time.elapsed(); |
diff --git a/core/pim/todo/todoshow.cpp b/core/pim/todo/todoshow.cpp index 4dbc9aa..5962028 100644 --- a/core/pim/todo/todoshow.cpp +++ b/core/pim/todo/todoshow.cpp | |||
@@ -5,12 +5,20 @@ | |||
5 | using namespace Todo; | 5 | using namespace Todo; |
6 | 6 | ||
7 | TodoShow::TodoShow(MainWindow* win) { | 7 | TodoShow::TodoShow(MainWindow* win) { |
8 | m_win = win; | 8 | m_win = win; |
9 | } | 9 | } |
10 | TodoShow::~TodoShow() { | 10 | TodoShow::~TodoShow() { |
11 | } | 11 | } |
12 | void TodoShow::escapeView() { | 12 | void TodoShow::escapeView() { |
13 | if (m_win ) | 13 | if (m_win ) |
14 | m_win->slotReturnFromView(); | 14 | m_win->slotReturnFromView(); |
15 | } | 15 | } |
16 | 16 | ||
17 | void TodoShow::showNext() { | ||
18 | if (m_win) | ||
19 | m_win->slotShowNext(); | ||
20 | } | ||
21 | void TodoShow::showPrev() { | ||
22 | if (m_win) | ||
23 | m_win->slotShowPrev(); | ||
24 | } | ||
diff --git a/core/pim/todo/todoshow.h b/core/pim/todo/todoshow.h index 7267b13..2babe93 100644 --- a/core/pim/todo/todoshow.h +++ b/core/pim/todo/todoshow.h | |||
@@ -41,18 +41,20 @@ namespace Todo { | |||
41 | * The first implementation is a QTextView | 41 | * The first implementation is a QTextView |
42 | * implementation showing the Todo as richtext | 42 | * implementation showing the Todo as richtext |
43 | */ | 43 | */ |
44 | class TodoShow { | 44 | class TodoShow { |
45 | public: | 45 | public: |
46 | TodoShow( MainWindow* win); | 46 | TodoShow( MainWindow* win); |
47 | virtual ~TodoShow(); | 47 | virtual ~TodoShow(); |
48 | virtual QString type()const = 0; | 48 | virtual QString type()const = 0; |
49 | virtual void slotShow( const OTodo& ev ) = 0; | 49 | virtual void slotShow( const OTodo& ev ) = 0; |
50 | virtual QWidget* widget() = 0; | 50 | virtual QWidget* widget() = 0; |
51 | protected: | 51 | protected: |
52 | void escapeView(); | 52 | void escapeView(); |
53 | void showNext(); | ||
54 | void showPrev(); | ||
53 | private: | 55 | private: |
54 | MainWindow *m_win; | 56 | MainWindow *m_win; |
55 | }; | 57 | }; |
56 | }; | 58 | }; |
57 | 59 | ||
58 | #endif | 60 | #endif |
diff --git a/core/pim/todo/todoview.cpp b/core/pim/todo/todoview.cpp index 3e808e7..31047cf 100644 --- a/core/pim/todo/todoview.cpp +++ b/core/pim/todo/todoview.cpp | |||
@@ -55,12 +55,15 @@ void TodoView::showTodo( int uid ) { | |||
55 | void TodoView::edit( int uid ) { | 55 | void TodoView::edit( int uid ) { |
56 | m_main->slotEdit( uid ); | 56 | m_main->slotEdit( uid ); |
57 | } | 57 | } |
58 | void TodoView::remove( int uid ) { | 58 | void TodoView::remove( int uid ) { |
59 | m_main->m_todoMgr.remove( uid ); | 59 | m_main->m_todoMgr.remove( uid ); |
60 | } | 60 | } |
61 | void TodoView::complete( int uid ) { | 61 | void TodoView::complete( int uid ) { |
62 | m_main->slotComplete( uid ); | 62 | m_main->slotComplete( uid ); |
63 | } | 63 | } |
64 | void TodoView::complete( const OTodo& ev ) { | 64 | void TodoView::complete( const OTodo& ev ) { |
65 | m_main->slotComplete( ev ); | 65 | m_main->slotComplete( ev ); |
66 | } | 66 | } |
67 | void TodoView::removeQuery( int uid ) { | ||
68 | m_main->slotDelete( uid ); | ||
69 | } | ||
diff --git a/core/pim/todo/todoview.h b/core/pim/todo/todoview.h index e73e808..e5ed66f 100644 --- a/core/pim/todo/todoview.h +++ b/core/pim/todo/todoview.h | |||
@@ -44,24 +44,34 @@ namespace Todo { | |||
44 | 44 | ||
45 | /** | 45 | /** |
46 | * due to inheretince problems we need this base class | 46 | * due to inheretince problems we need this base class |
47 | */ | 47 | */ |
48 | struct ViewBase { | 48 | struct ViewBase { |
49 | public: | 49 | public: |
50 | virtual QWidget* widget() = 0; | 50 | virtual QWidget* widget() = 0; |
51 | virtual QString type()const = 0; | 51 | virtual QString type()const = 0; |
52 | virtual int current() = 0; | 52 | virtual int current() = 0; |
53 | virtual QString currentRepresentation() = 0; | 53 | virtual QString currentRepresentation() = 0; |
54 | virtual void showOverDue( bool ) = 0; | 54 | virtual void showOverDue( bool ) = 0; |
55 | 55 | ||
56 | /** | ||
57 | * the next record in the view or 0 if none is there | ||
58 | */ | ||
59 | virtual int next() = 0; | ||
60 | |||
61 | /** | ||
62 | * the previous record or 0 if none is there.. | ||
63 | */ | ||
64 | virtual int prev() = 0; | ||
65 | |||
56 | /* | 66 | /* |
57 | * update the view | 67 | * update the view |
58 | */ | 68 | */ |
59 | virtual void updateView() = 0; | 69 | virtual void updateView() = 0; |
60 | 70 | ||
61 | virtual void addEvent( const OTodo& ) = 0; | 71 | virtual void addEvent( const OTodo& ) = 0; |
62 | virtual void replaceEvent( const OTodo& ) = 0; | 72 | virtual void replaceEvent( const OTodo& ) = 0; |
63 | virtual void removeEvent( int uid ) = 0; | 73 | virtual void removeEvent( int uid ) = 0; |
64 | virtual void setShowCompleted( bool ) = 0; | 74 | virtual void setShowCompleted( bool ) = 0; |
65 | virtual void setShowDeadline( bool ) = 0; | 75 | virtual void setShowDeadline( bool ) = 0; |
66 | virtual void setShowCategory( const QString& = QString::null ) = 0; | 76 | virtual void setShowCategory( const QString& = QString::null ) = 0; |
67 | virtual void clear() = 0; | 77 | virtual void clear() = 0; |
@@ -102,23 +112,25 @@ namespace Todo { | |||
102 | void setSortOrder( int order ); | 112 | void setSortOrder( int order ); |
103 | void setAscending( bool ); | 113 | void setAscending( bool ); |
104 | 114 | ||
105 | /* | 115 | /* |
106 | * These things needs to be implemented | 116 | * These things needs to be implemented |
107 | * in a implementation | 117 | * in a implementation |
108 | */ | 118 | */ |
109 | void showTodo( int uid ); | 119 | void showTodo( int uid ); |
110 | void edit( int uid ); | 120 | void edit( int uid ); |
111 | void update(int uid, const SmallTodo& to ); | 121 | void update(int uid, const SmallTodo& to ); |
112 | void update(int uid, const OTodo& ev); | 122 | void update(int uid, const OTodo& ev); |
113 | void remove( int uid ); | 123 | void remove( int uid ); |
124 | /* will ask the user if the item should be deleted */ | ||
125 | void removeQuery(int uid ); | ||
114 | void complete( int uid ); | 126 | void complete( int uid ); |
115 | void complete( const OTodo& ev ); | 127 | void complete( const OTodo& ev ); |
116 | private: | 128 | private: |
117 | MainWindow *m_main; | 129 | MainWindow *m_main; |
118 | OTodoAccess::List m_sort; | 130 | OTodoAccess::List m_sort; |
119 | bool m_asc : 1; | 131 | bool m_asc : 1; |
120 | int m_sortOrder; | 132 | int m_sortOrder; |
121 | }; | 133 | }; |
122 | }; | 134 | }; |
123 | 135 | ||
124 | #endif | 136 | #endif |