summaryrefslogtreecommitdiff
authorzecke <zecke>2003-05-12 13:21:59 (UTC)
committer zecke <zecke>2003-05-12 13:21:59 (UTC)
commit9a4c9544a59f8395f2ec5e7c99028570f8bd8bd1 (patch) (unidiff)
tree8af13b984750f743b7f9f06bbf04b531b1a10ff2
parenta4c8b8912c9e87a2fd76103193e6b4f91c2a2c5d (diff)
downloadopie-9a4c9544a59f8395f2ec5e7c99028570f8bd8bd1.zip
opie-9a4c9544a59f8395f2ec5e7c99028570f8bd8bd1.tar.gz
opie-9a4c9544a59f8395f2ec5e7c99028570f8bd8bd1.tar.bz2
Hospital Hacking Session
make more translatable fix up GUI for Opie1.0 in regards what is implemnted implement setting and removing of Alarms!!!! Show Alarms once they got fired...
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/todo/mainwindow.cpp133
-rw-r--r--core/pim/todo/mainwindow.h5
-rw-r--r--core/pim/todo/otaskeditor.cpp13
-rw-r--r--core/pim/todo/quickeditimpl.cpp20
-rw-r--r--core/pim/todo/taskeditoralarms.cpp190
-rw-r--r--core/pim/todo/taskeditoralarms.h26
-rw-r--r--core/pim/todo/taskeditorstatus.cpp11
-rw-r--r--core/pim/todo/templatedialog.cpp10
-rw-r--r--core/pim/todo/templatedialogimpl.cpp10
-rw-r--r--core/pim/todo/templateeditor.cpp5
-rw-r--r--core/pim/todo/todomanager.cpp1
11 files changed, 373 insertions, 51 deletions
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp
index c5cedc6..5119ae0 100644
--- a/core/pim/todo/mainwindow.cpp
+++ b/core/pim/todo/mainwindow.cpp
@@ -3,79 +3,84 @@
3             .=l. Copyright (c) 2002 <> 3             .=l. Copyright (c) 2002 <>
4           .>+-= 4           .>+-=
5 _;:,     .>    :=|. This program is free software; you can 5 _;:,     .>    :=|. This program is free software; you can
6.> <`_,   >  .   <= redistribute it and/or modify it under 6.> <`_,   >  .   <= redistribute it and/or modify it under
7:`=1 )Y*s>-.--   : the terms of the GNU General Public 7:`=1 )Y*s>-.--   : the terms of the GNU General Public
8.="- .-=="i,     .._ License as published by the Free Software 8.="- .-=="i,     .._ License as published by the Free Software
9 - .   .-<_>     .<> Foundation; either version 2 of the License, 9 - .   .-<_>     .<> Foundation; either version 2 of the License,
10     ._= =}       : or (at your option) any later version. 10     ._= =}       : or (at your option) any later version.
11    .%`+i>       _;_. 11    .%`+i>       _;_.
12    .i_,=:_.      -<s. This program is distributed in the hope that 12    .i_,=:_.      -<s. This program is distributed in the hope that
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
14    : ..    .:,     . . . without even the implied warranty of 14    : ..    .:,     . . . without even the implied warranty of
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
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  -_. . .   )=.  = General Public License along with 21  -_. . .   )=.  = 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 28
29#include <unistd.h> 29#include <unistd.h>
30 30
31#include <qmenubar.h> 31#include <qmenubar.h>
32#include <qmessagebox.h> 32#include <qmessagebox.h>
33#include <qtoolbar.h> 33#include <qtoolbar.h>
34#include <qpopupmenu.h> 34#include <qpopupmenu.h>
35#include <qpushbutton.h>
35#include <qwidgetstack.h> 36#include <qwidgetstack.h>
36#include <qaction.h> 37#include <qaction.h>
37#include <qtimer.h> 38#include <qtimer.h>
38#include <qvbox.h> 39#include <qvbox.h>
39#include <qlayout.h> 40#include <qlayout.h>
40#include <qlineedit.h> 41#include <qlineedit.h>
41#include <qwhatsthis.h> 42#include <qwhatsthis.h>
42 43
43#include <qpe/applnk.h> 44#include <qpe/applnk.h>
44#include <qpe/config.h> 45#include <qpe/config.h>
45#include <qpe/ir.h> 46#include <qpe/ir.h>
46#include <qpe/resource.h> 47#include <qpe/resource.h>
47#include <qpe/qpemessagebox.h> 48#include <qpe/qpemessagebox.h>
49#include <qpe/alarmserver.h>
50#include <qpe/timestring.h>
51#include <qpe/qpeapplication.h>
48 52
49#include <opie/orecur.h> 53#include <opie/orecur.h>
54#include <opie/opimnotifymanager.h>
50#include <opie/otodoaccessvcal.h> 55#include <opie/otodoaccessvcal.h>
51 56
52#include "quickeditimpl.h" 57#include "quickeditimpl.h"
53#include "todotemplatemanager.h" 58#include "todotemplatemanager.h"
54#include "templateeditor.h" 59#include "templateeditor.h"
55#include "tableview.h" 60#include "tableview.h"
56 61
57#include "textviewshow.h" 62#include "textviewshow.h"
58#include "todoeditor.h" 63#include "todoeditor.h"
59#include "mainwindow.h" 64#include "mainwindow.h"
60 65
61 66
62using namespace Todo; 67using namespace Todo;
63 68
64MainWindow::MainWindow( QWidget* parent, 69MainWindow::MainWindow( QWidget* parent,
65 const char* name ) 70 const char* name )
66 : OPimMainWindow( "Todolist", parent, name, WType_TopLevel | WStyle_ContextHelp ) 71 : OPimMainWindow( "Todolist", parent, name, WType_TopLevel | WStyle_ContextHelp )
67{ 72{
68 m_syncing = false; 73 m_syncing = false;
69 m_counter = 0; 74 m_counter = 0;
70 m_tempManager = new TemplateManager(); 75 m_tempManager = new TemplateManager();
71 m_tempManager->load(); 76 m_tempManager->load();
72 77
73 initUI(); 78 initUI();
74 initConfig(); 79 initConfig();
75 initViews(); 80 initViews();
76 initActions(); 81 initActions();
77 initEditor(); 82 initEditor();
78 initShow(); 83 initShow();
79 initTemplate(); 84 initTemplate();
80 85
81 populateTemplates(); 86 populateTemplates();
@@ -272,79 +277,86 @@ QPopupMenu* MainWindow::contextMenu( int , bool recur ) {
272 m_duplicateAction->addTo( menu ); 277 m_duplicateAction->addTo( menu );
273 278
274 menu->insertSeparator(); 279 menu->insertSeparator();
275 280
276 /* 281 /*
277 * if this event recurs we allow 282 * if this event recurs we allow
278 * to detach it. 283 * to detach it.
279 * remove all 284 * remove all
280 */ 285 */
281 if ( recur ) { 286 if ( recur ) {
282 ; // FIXME 287 ; // FIXME
283 } 288 }
284 289
285 return menu; 290 return menu;
286} 291}
287QPopupMenu* MainWindow::options() { 292QPopupMenu* MainWindow::options() {
288 qWarning("Options"); 293 qWarning("Options");
289 return m_options; 294 return m_options;
290} 295}
291QPopupMenu* MainWindow::edit() { 296QPopupMenu* MainWindow::edit() {
292 return m_edit; 297 return m_edit;
293} 298}
294QToolBar* MainWindow::toolbar() { 299QToolBar* MainWindow::toolbar() {
295 return m_tool; 300 return m_tool;
296} 301}
297OTodoAccess::List MainWindow::list()const { 302OTodoAccess::List MainWindow::list()const {
298 return m_todoMgr.list(); 303 return m_todoMgr.list();
299} 304}
300OTodoAccess::List MainWindow::sorted( bool asc, int sortOrder ) { 305OTodoAccess::List MainWindow::sorted( bool asc, int sortOrder ) {
301 int cat = 0; 306 int cat = 0;
302 if ( m_curCat != QWidget::tr("All Categories") ) 307 if ( m_curCat != QWidget::tr("All Categories") )
303 cat = currentCatId(); 308 cat = currentCatId();
309 if ( m_curCat == QWidget::tr("Unfiled") )
310 cat = -1;
311
312 qWarning(" Category %d %s", cat, m_curCat.latin1() );
304 313
305 int filter = 1; 314 int filter = 1;
306 315
307 if (!m_completed ) 316 if (!m_completed )
308 filter |= 4; 317 filter |= 4;
309 if (m_overdue) 318 if (m_overdue)
310 filter |= 2; 319 filter |= 2;
311 320
312 return m_todoMgr.sorted( asc, sortOrder, filter, cat ); 321 return m_todoMgr.sorted( asc, sortOrder, filter, cat );
313} 322}
314OTodoAccess::List MainWindow::sorted( bool asc, int sortOrder, int addFilter) { 323OTodoAccess::List MainWindow::sorted( bool asc, int sortOrder, int addFilter) {
315 int cat = 0; 324 int cat = 0;
316 if ( m_curCat != QWidget::tr("All Categories") ) 325 if ( m_curCat != QWidget::tr("All Categories") )
317 cat = currentCatId(); 326 cat = currentCatId();
318 327
328 if ( m_curCat == QWidget::tr("Unfiled") )
329 cat = -1;
330
319 return m_todoMgr.sorted(asc, sortOrder, addFilter, cat ); 331 return m_todoMgr.sorted(asc, sortOrder, addFilter, cat );
320} 332}
321OTodo MainWindow::event( int uid ) { 333OTodo MainWindow::event( int uid ) {
322 return m_todoMgr.event( uid ); 334 return m_todoMgr.event( uid );
323} 335}
324bool MainWindow::isSyncing()const { 336bool MainWindow::isSyncing()const {
325 return m_syncing; 337 return m_syncing;
326} 338}
327TemplateManager* MainWindow::templateManager() { 339TemplateManager* MainWindow::templateManager() {
328 return m_tempManager; 340 return m_tempManager;
329} 341}
330Editor* MainWindow::currentEditor() { 342Editor* MainWindow::currentEditor() {
331 return m_curEdit; 343 return m_curEdit;
332} 344}
333TodoShow* MainWindow::currentShow() { 345TodoShow* MainWindow::currentShow() {
334 return m_curShow; 346 return m_curShow;
335} 347}
336void MainWindow::slotReload() { 348void MainWindow::slotReload() {
337 m_todoMgr.reload(); 349 m_todoMgr.reload();
338 currentView()->updateView( ); 350 currentView()->updateView( );
339 raiseCurrentView(); 351 raiseCurrentView();
340} 352}
341void MainWindow::closeEvent( QCloseEvent* e ) { 353void MainWindow::closeEvent( QCloseEvent* e ) {
342 if (m_stack->visibleWidget() == currentShow()->widget() ) { 354 if (m_stack->visibleWidget() == currentShow()->widget() ) {
343 raiseCurrentView(); 355 raiseCurrentView();
344 e->ignore(); 356 e->ignore();
345 return; 357 return;
346 } 358 }
347 /* 359 /*
348 * we should have flushed and now we're still saving 360 * we should have flushed and now we're still saving
349 * so there is no need to flush 361 * so there is no need to flush
350 */ 362 */
@@ -421,64 +433,65 @@ void MainWindow::slotNewFromTemplate( int id ) {
421 } 433 }
422} 434}
423void MainWindow::slotNew() { 435void MainWindow::slotNew() {
424 create(); 436 create();
425} 437}
426void MainWindow::slotDuplicate() { 438void MainWindow::slotDuplicate() {
427 if(m_syncing) { 439 if(m_syncing) {
428 QMessageBox::warning(this, QWidget::tr("Todo"), 440 QMessageBox::warning(this, QWidget::tr("Todo"),
429 QWidget::tr("Can not edit data, currently syncing")); 441 QWidget::tr("Can not edit data, currently syncing"));
430 return; 442 return;
431 } 443 }
432 OTodo ev = m_todoMgr.event( currentView()->current() ); 444 OTodo ev = m_todoMgr.event( currentView()->current() );
433 /* let's generate a new uid */ 445 /* let's generate a new uid */
434 ev.setUid(-1); 446 ev.setUid(-1);
435 m_todoMgr.add( ev ); 447 m_todoMgr.add( ev );
436 448
437 currentView()->addEvent( ev ); 449 currentView()->addEvent( ev );
438 raiseCurrentView(); 450 raiseCurrentView();
439} 451}
440void MainWindow::slotDelete() { 452void MainWindow::slotDelete() {
441 if (!currentView()->current() ) 453 if (!currentView()->current() )
442 return; 454 return;
443 455
444 if(m_syncing) { 456 if(m_syncing) {
445 QMessageBox::warning(this, QWidget::tr("Todo"), 457 QMessageBox::warning(this, QWidget::tr("Todo"),
446 QWidget::tr("Can not edit data, currently syncing")); 458 QWidget::tr("Can not edit data, currently syncing"));
447 return; 459 return;
448 } 460 }
449 QString strName = currentView()->currentRepresentation(); 461 QString strName = currentView()->currentRepresentation();
450 if (!QPEMessageBox::confirmDelete(this, QWidget::tr("Todo"), strName ) ) 462 if (!QPEMessageBox::confirmDelete(this, QWidget::tr("Todo"), strName ) )
451 return; 463 return;
452 464
465 handleAlarms( OTodo(), m_todoMgr.event( currentView()->current() ) );
453 m_todoMgr.remove( currentView()->current() ); 466 m_todoMgr.remove( currentView()->current() );
454 currentView()->removeEvent( currentView()->current() ); 467 currentView()->removeEvent( currentView()->current() );
455 raiseCurrentView(); 468 raiseCurrentView();
456} 469}
457void MainWindow::slotDeleteAll() { 470void MainWindow::slotDeleteAll() {
458 if(m_syncing) { 471 if(m_syncing) {
459 QMessageBox::warning(this, QWidget::tr("Todo"), 472 QMessageBox::warning(this, QWidget::tr("Todo"),
460 QWidget::tr("Can not edit data, currently syncing")); 473 QWidget::tr("Can not edit data, currently syncing"));
461 return; 474 return;
462 } 475 }
463 476
464 477
465 if ( !QPEMessageBox::confirmDelete( this, QWidget::tr( "Todo" ), QWidget::tr("all tasks?") ) ) 478 if ( !QPEMessageBox::confirmDelete( this, QWidget::tr( "Todo" ), QWidget::tr("all tasks?") ) )
466 return; 479 return;
467 480
468 m_todoMgr.removeAll(); 481 m_todoMgr.removeAll();
469 currentView()->clear(); 482 currentView()->clear();
470 483
471 raiseCurrentView(); 484 raiseCurrentView();
472} 485}
473void MainWindow::slotDeleteCompleted() { 486void MainWindow::slotDeleteCompleted() {
474 if(m_syncing) { 487 if(m_syncing) {
475 QMessageBox::warning(this, QWidget::tr("Todo"), 488 QMessageBox::warning(this, QWidget::tr("Todo"),
476 QWidget::tr("Can not edit data, currently syncing")); 489 QWidget::tr("Can not edit data, currently syncing"));
477 return; 490 return;
478 } 491 }
479 492
480 if ( !QPEMessageBox::confirmDelete( this, QWidget::tr( "Todo" ), QWidget::tr("all completed tasks?") ) ) 493 if ( !QPEMessageBox::confirmDelete( this, QWidget::tr( "Todo" ), QWidget::tr("all completed tasks?") ) )
481 return; 494 return;
482 495
483 496
484 m_todoMgr.removeCompleted(); 497 m_todoMgr.removeCompleted();
@@ -612,71 +625,72 @@ bool MainWindow::showQuickTask()const {
612 return m_quicktask; 625 return m_quicktask;
613} 626}
614QString MainWindow::currentCategory()const { 627QString MainWindow::currentCategory()const {
615 return m_curCat; 628 return m_curCat;
616} 629}
617int MainWindow::currentCatId() { 630int MainWindow::currentCatId() {
618 return m_todoMgr.catId( m_curCat ); 631 return m_todoMgr.catId( m_curCat );
619} 632}
620ViewBase* MainWindow::currentView() { 633ViewBase* MainWindow::currentView() {
621 return m_curView; 634 return m_curView;
622} 635}
623void MainWindow::raiseCurrentView() { 636void MainWindow::raiseCurrentView() {
624 m_stack->raiseWidget( m_curView->widget() ); 637 m_stack->raiseWidget( m_curView->widget() );
625} 638}
626void MainWindow::slotShowDue(bool ov) { 639void MainWindow::slotShowDue(bool ov) {
627 m_overdue = ov; 640 m_overdue = ov;
628 currentView()->showOverDue( ov ); 641 currentView()->showOverDue( ov );
629 raiseCurrentView(); 642 raiseCurrentView();
630} 643}
631void MainWindow::slotShow( int uid ) { 644void MainWindow::slotShow( int uid ) {
632 qWarning("slotShow"); 645 qWarning("slotShow");
633 currentShow()->slotShow( event( uid ) ); 646 currentShow()->slotShow( event( uid ) );
634 m_stack->raiseWidget( currentShow()->widget() ); 647 m_stack->raiseWidget( currentShow()->widget() );
635} 648}
636void MainWindow::slotEdit( int uid ) { 649void MainWindow::slotEdit( int uid ) {
637 if (uid == 1 ) return; 650 if (uid == 1 ) return;
638 if(m_syncing) { 651 if(m_syncing) {
639 QMessageBox::warning(this, QWidget::tr("Todo"), 652 QMessageBox::warning(this, QWidget::tr("Todo"),
640 QWidget::tr("Can not edit data, currently syncing")); 653 QWidget::tr("Can not edit data, currently syncing"));
641 return; 654 return;
642 } 655 }
643 656
644 OTodo todo = m_todoMgr.event( uid ); 657 OTodo old_todo = m_todoMgr.event( uid );
645 658
646 todo = currentEditor()->edit(this, todo ); 659 OTodo todo = currentEditor()->edit(this, old_todo );
647 660
648 /* if completed */ 661 /* if completed */
649 if ( currentEditor()->accepted() ) { 662 if ( currentEditor()->accepted() ) {
650 qWarning("Replacing now" ); 663 qWarning("Replacing now" );
664 handleAlarms( old_todo, todo );
651 m_todoMgr.update( todo.uid(), todo ); 665 m_todoMgr.update( todo.uid(), todo );
652 currentView()->replaceEvent( todo ); 666 currentView()->replaceEvent( todo );
653 /* a Category might have changed */ 667 /* a Category might have changed */
654 populateCategories(); 668 populateCategories();
655 } 669 }
656 670
657 raiseCurrentView(); 671 raiseCurrentView();
658} 672}
659/* 673/*
660void MainWindow::slotUpdate1( int uid, const SmallTodo& ev) { 674void MainWindow::slotUpdate1( int uid, const SmallTodo& ev) {
661 m_todoMgr.update( uid, ev ); 675 m_todoMgr.update( uid, ev );
662} 676}
663*/ 677*/
664void MainWindow::updateTodo( const OTodo& ev) { 678void MainWindow::updateTodo( const OTodo& ev) {
665 m_todoMgr.update( ev.uid() , ev ); 679 m_todoMgr.update( ev.uid() , ev );
666} 680}
667/* The view changed it's configuration 681/* The view changed it's configuration
668 * update the view menu 682 * update the view menu
669 */ 683 */
670void MainWindow::slotUpdate3( QWidget* ) { 684void MainWindow::slotUpdate3( QWidget* ) {
671 685
672} 686}
673void MainWindow::updateList() { 687void MainWindow::updateList() {
674 m_todoMgr.updateList(); 688 m_todoMgr.updateList();
675} 689}
676void MainWindow::setReadAhead( uint count ) { 690void MainWindow::setReadAhead( uint count ) {
677 if (m_todoMgr.todoDB() ) 691 if (m_todoMgr.todoDB() )
678 m_todoMgr.todoDB()->setReadAhead( count ); 692 m_todoMgr.todoDB()->setReadAhead( count );
679} 693}
680void MainWindow::slotQuickEntered() { 694void MainWindow::slotQuickEntered() {
681 qWarning("entered"); 695 qWarning("entered");
682 OTodo todo = quickEditor()->todo(); 696 OTodo todo = quickEditor()->todo();
@@ -737,87 +751,202 @@ void MainWindow::slotComplete( const OTodo& todo ) {
737 to2.setCompletedDate( inval ); 751 to2.setCompletedDate( inval );
738 to2.setCompleted( false ); 752 to2.setCompleted( false );
739 updateTodo( to2 ); 753 updateTodo( to2 );
740 }else 754 }else
741 updateTodo( to ); 755 updateTodo( to );
742 }else 756 }else
743 updateTodo( to ); 757 updateTodo( to );
744 758
745 currentView()->updateView(); 759 currentView()->updateView();
746 raiseCurrentView(); 760 raiseCurrentView();
747} 761}
748void MainWindow::flush() { 762void MainWindow::flush() {
749 slotFlush(); 763 slotFlush();
750} 764}
751void MainWindow::reload() { 765void MainWindow::reload() {
752 slotReload(); 766 slotReload();
753} 767}
754int MainWindow::create() { 768int MainWindow::create() {
755 int uid = 0; 769 int uid = 0;
756 if(m_syncing) { 770 if(m_syncing) {
757 QMessageBox::warning(this, QWidget::tr("Todo"), 771 QMessageBox::warning(this, QWidget::tr("Todo"),
758 QWidget::tr("Can not edit data, currently syncing")); 772 QWidget::tr("Can not edit data, currently syncing"));
759 return uid; 773 return uid;
760 } 774 }
761 775
762 776
763 OTodo todo = currentEditor()->newTodo( currentCatId(), 777 OTodo todo = currentEditor()->newTodo( currentCatId(),
764 this ); 778 this );
765 779
766 if ( currentEditor()->accepted() ) { 780 if ( currentEditor()->accepted() ) {
767 //todo.assignUid(); 781 //todo.assignUid();
768 uid = todo.uid(); 782 uid = todo.uid();
783 handleAlarms( OTodo(), todo );
769 m_todoMgr.add( todo ); 784 m_todoMgr.add( todo );
770 currentView()->addEvent( todo ); 785 currentView()->addEvent( todo );
771 786
772 787
773 // I'm afraid we must call this every time now, otherwise 788 // I'm afraid we must call this every time now, otherwise
774 // spend expensive time comparing all these strings... 789 // spend expensive time comparing all these strings...
775 // but only call if we changed something -zecke 790 // but only call if we changed something -zecke
776 populateCategories(); 791 populateCategories();
777 } 792 }
778 raiseCurrentView( ); 793 raiseCurrentView( );
779 794
780 return uid; 795 return uid;
781} 796}
782/* delete it silently... */ 797/* delete it silently... */
783bool MainWindow::remove( int uid ) { 798bool MainWindow::remove( int uid ) {
784 if (m_syncing) return false; 799 if (m_syncing) return false;
785 800
801 /* argh need to get the whole OEvent... to disable alarms -zecke */
802 handleAlarms( OTodo(), m_todoMgr.event( uid ) );
803
786 return m_todoMgr.remove( uid ); 804 return m_todoMgr.remove( uid );
787} 805}
788void MainWindow::beam( int uid) { 806void MainWindow::beam( int uid) {
789 ::unlink( beamfile ); 807 ::unlink( beamfile );
790 OTodo todo = event( uid ); 808 OTodo todo = event( uid );
791 OTodoAccessVCal* cal = new OTodoAccessVCal(QString::fromLatin1(beamfile) ); 809 OTodoAccessVCal* cal = new OTodoAccessVCal(QString::fromLatin1(beamfile) );
792 OTodoAccess acc( cal ); 810 OTodoAccess acc( cal );
793 acc.load(); 811 acc.load();
794 acc.add( todo ); 812 acc.add( todo );
795 acc.save(); 813 acc.save();
796 Ir* ir = new Ir(this ); 814 Ir* ir = new Ir(this );
797 connect(ir, SIGNAL(done(Ir*) ), 815 connect(ir, SIGNAL(done(Ir*) ),
798 this, SLOT(beamDone(Ir*) ) ); 816 this, SLOT(beamDone(Ir*) ) );
799 ir->send(beamfile, todo.summary(), "text/x-vCalendar" ); 817 ir->send(beamfile, todo.summary(), "text/x-vCalendar" );
800} 818}
801void MainWindow::show( int uid ) { 819void MainWindow::show( int uid ) {
802 slotShow( uid ); 820 slotShow( uid );
803} 821}
804void MainWindow::edit( int uid ) { 822void MainWindow::edit( int uid ) {
805 slotEdit( uid ); 823 slotEdit( uid );
806} 824}
807void MainWindow::add( const OPimRecord& rec) { 825void MainWindow::add( const OPimRecord& rec) {
808 if ( rec.rtti() != OTodo::rtti() ) return; 826 if ( rec.rtti() != OTodo::rtti() ) return;
809 827
810 const OTodo& todo = static_cast<const OTodo&>(rec); 828 const OTodo& todo = static_cast<const OTodo&>(rec);
811 829
812 m_todoMgr.add(todo ); 830 m_todoMgr.add(todo );
813 currentView()->addEvent( todo ); 831 currentView()->addEvent( todo );
814 832
815 833
816 // I'm afraid we must call this every time now, otherwise 834 // I'm afraid we must call this every time now, otherwise
817 // spend expensive time comparing all these strings... 835 // spend expensive time comparing all these strings...
818 // but only call if we changed something -zecke 836 // but only call if we changed something -zecke
819 populateCategories(); 837 populateCategories();
820} 838}
821void MainWindow::slotReturnFromView() { 839void MainWindow::slotReturnFromView() {
822 raiseCurrentView(); 840 raiseCurrentView();
823} 841}
842
843namespace {
844 OPimNotifyManager::Alarms findNonMatching( const OPimNotifyManager::Alarms& oldAls,
845 const OPimNotifyManager::Alarms& newAls ) {
846 OPimNotifyManager::Alarms nonMatching;
847 OPimNotifyManager::Alarms::ConstIterator oldIt = oldAls.begin();
848 OPimNotifyManager::Alarms::ConstIterator newIt;
849 for ( ; oldIt != oldAls.end(); ++oldIt ) {
850 bool found = false;
851 QDateTime oldDt = (*oldIt).dateTime();
852 for (newIt= newAls.begin(); newIt != newAls.end(); ++newIt ) {
853 if ( oldDt == (*newIt).dateTime() ) {
854 found = true;
855 break;
856 }
857 }
858 if (!found)
859 nonMatching.append( (*oldIt) );
860 }
861 return nonMatching;
862 }
863 void addAlarms( const OPimNotifyManager::Alarms& als, int uid ) {
864 OPimNotifyManager::Alarms::ConstIterator it;
865 for ( it = als.begin(); it != als.end(); ++it ) {
866 qWarning("Adding alarm for %s", (*it).dateTime().toString().latin1() );
867 AlarmServer::addAlarm( (*it).dateTime(), "QPE/Application/todolist", "alarm(QDateTime,int)", uid );
868 }
869
870 }
871 void removeAlarms( const OPimNotifyManager::Alarms& als, int uid ) {
872 OPimNotifyManager::Alarms::ConstIterator it;
873 for ( it = als.begin(); it != als.end(); ++it ) {
874 qWarning("Removinf alarm for %s", (*it).dateTime().toString().latin1() );
875 AlarmServer::deleteAlarm( (*it).dateTime(), "QPE/Application/todolist", "alarm(QDateTime,int)", uid );
876 }
877 }
878}
879
880void MainWindow::handleAlarms( const OTodo& oldTodo, const OTodo& newTodo) {
881 /*
882 * if oldTodo is not empty and has notifiers we need to find the deleted ones
883 */
884 if(!oldTodo.isEmpty() && oldTodo.hasNotifiers() ) {
885 OPimNotifyManager::Alarms removed;
886 OPimNotifyManager::Alarms oldAls = oldTodo.notifiers().alarms();
887 if (!newTodo.hasNotifiers() )
888 removed = oldAls;
889 else
890 removed = findNonMatching( oldAls, newTodo.notifiers().alarms() );
891
892 removeAlarms( removed, oldTodo.uid() );
893 }
894 if ( newTodo.hasNotifiers() ) {
895 OPimNotifyManager::Alarms added;
896 if ( oldTodo.isEmpty() || !oldTodo.hasNotifiers() )
897 added = newTodo.notifiers().alarms();
898 else
899 added = findNonMatching( newTodo.notifiers().alarms(), oldTodo.notifiers().alarms() );
900
901 addAlarms( added, newTodo.uid() );
902 }
903}
904/* we might have not loaded the db */
905void MainWindow::doAlarm( const QDateTime& dt, int uid ) {
906 m_todoMgr.load();
907
908 OTodo todo = m_todoMgr.event( uid );
909 if (!todo.hasNotifiers() ) return;
910
911 /*
912 * let's find the right alarm and find out if silent
913 * then show a richtext widget
914 */
915 bool loud = false;
916 OPimNotifyManager::Alarms als = todo.notifiers().alarms();
917 OPimNotifyManager::Alarms::Iterator it;
918 for ( it = als.begin(); it != als.end(); ++it ) {
919 if ( (*it).dateTime() == dt ) {
920 loud = ( (*it).sound() == OPimAlarm::Loud );
921 break;
922 }
923 }
924 if (loud)
925 startAlarm();
926
927 QDialog dlg(this, 0, TRUE );
928 QVBoxLayout* lay = new QVBoxLayout( &dlg );
929 QTextView* view = new QTextView( &dlg );
930 lay->addWidget( view );
931 QPushButton* btnOk = new QPushButton( tr("Ok"), &dlg );
932 connect( btnOk, SIGNAL(clicked() ), &dlg, SLOT(accept() ) );
933 lay->addWidget( btnOk );
934
935 QString text = tr("<h1>Alarm at %0</h1><br>").arg( TimeString::dateString( dt ) );
936 text += todo.toRichText();
937 view->setText( text );
938
939 dlg.showMaximized();
940 bool needToStay = dlg.exec();
941
942 if (loud)
943 killAlarm();
944
945 if (needToStay) {
946 showMaximized();
947 raise();
948 QPEApplication::setKeepRunning();
949 setActiveWindow();
950 }
951
952}
diff --git a/core/pim/todo/mainwindow.h b/core/pim/todo/mainwindow.h
index 434e969..02e2449 100644
--- a/core/pim/todo/mainwindow.h
+++ b/core/pim/todo/mainwindow.h
@@ -75,64 +75,66 @@ namespace Todo {
75 75
76 void updateList(); 76 void updateList();
77 OTodoAccess::List list()const; 77 OTodoAccess::List list()const;
78 OTodoAccess::List sorted( bool asc, int sortOrder ); 78 OTodoAccess::List sorted( bool asc, int sortOrder );
79 OTodoAccess::List sorted( bool asc, int sortOrder, int addFilter ); 79 OTodoAccess::List sorted( bool asc, int sortOrder, int addFilter );
80 80
81 OTodo event(int uid ); 81 OTodo event(int uid );
82 82
83 bool isSyncing()const; 83 bool isSyncing()const;
84 bool showCompleted()const; 84 bool showCompleted()const;
85 bool showDeadline()const; 85 bool showDeadline()const;
86 bool showOverDue()const; 86 bool showOverDue()const;
87 bool showQuickTask()const; 87 bool showQuickTask()const;
88 QString currentCategory()const; 88 QString currentCategory()const;
89 int currentCatId(); 89 int currentCatId();
90 TemplateManager* templateManager(); 90 TemplateManager* templateManager();
91 QuickEditBase* quickEditor(); 91 QuickEditBase* quickEditor();
92 92
93 void updateTodo( const OTodo& ); 93 void updateTodo( const OTodo& );
94 void populateTemplates(); 94 void populateTemplates();
95 Editor* currentEditor(); 95 Editor* currentEditor();
96 void setReadAhead(uint count ); 96 void setReadAhead(uint count );
97private slots: 97private slots:
98 void slotQuickEntered(); 98 void slotQuickEntered();
99 void populateCategories(); 99 void populateCategories();
100 void slotReload(); 100 void slotReload();
101 void slotFlush(); 101 void slotFlush();
102 102
103 protected: 103 protected:
104 void closeEvent( QCloseEvent* e ); 104 void closeEvent( QCloseEvent* e );
105 105
106 private: 106 private:
107 /* handle setting and removing alarms */
108 void handleAlarms( const OTodo& oldTodo, const OTodo& newTodo );
107 void receiveFile( const QString& filename ); 109 void receiveFile( const QString& filename );
108 void connectBase( ViewBase* ); 110 void connectBase( ViewBase* );
109 void initUI(); 111 void initUI();
110 void initActions(); 112 void initActions();
111 void initConfig(); 113 void initConfig();
112 void initViews(); 114 void initViews();
113 void initEditor(); 115 void initEditor();
114 void initShow(); 116 void initShow();
115 void initTemplate(); 117 void initTemplate();
116 void raiseCurrentView(); 118 void raiseCurrentView();
117 ViewBase* currentView(); 119 ViewBase* currentView();
118 ViewBase* m_curView; 120 ViewBase* m_curView;
119 QuickEditBase* m_curQuick; 121 QuickEditBase* m_curQuick;
120 Editor* m_curEdit; 122 Editor* m_curEdit;
121 TodoShow* currentShow(); 123 TodoShow* currentShow();
122 TodoShow* m_curShow; 124 TodoShow* m_curShow;
123 TemplateEditor* currentTemplateEditor(); 125 TemplateEditor* currentTemplateEditor();
124 TemplateEditor* m_curTempEd; 126 TemplateEditor* m_curTempEd;
125 127
126 QMenuBar* m_bar; 128 QMenuBar* m_bar;
127 QToolBar* m_tool; 129 QToolBar* m_tool;
128 QAction* m_editAction, 130 QAction* m_editAction,
129 *m_deleteAction, 131 *m_deleteAction,
130 *m_findAction, 132 *m_findAction,
131 *m_completedAction, 133 *m_completedAction,
132 *m_showDeadLineAction, 134 *m_showDeadLineAction,
133 *m_deleteAllAction, 135 *m_deleteAllAction,
134 *m_deleteCompleteAction, 136 *m_deleteCompleteAction,
135 *m_duplicateAction, 137 *m_duplicateAction,
136 *m_showOverDueAction, 138 *m_showOverDueAction,
137 *m_showQuickTaskAction, 139 *m_showQuickTaskAction,
138 *m_effectiveAction; 140 *m_effectiveAction;
@@ -166,36 +168,37 @@ private slots:
166 168
167 void slotDelete(); 169 void slotDelete();
168 void slotDeleteAll(); 170 void slotDeleteAll();
169 void slotDeleteCompleted(); 171 void slotDeleteCompleted();
170 172
171 void slotEdit(); 173 void slotEdit();
172 void slotFind(); 174 void slotFind();
173 175
174 void setCategory( int ); 176 void setCategory( int );
175 177
176 void slotShowDeadLine( bool ); 178 void slotShowDeadLine( bool );
177 void slotShowCompleted( bool ); 179 void slotShowCompleted( bool );
178 void slotShowQuickTask( bool ); 180 void slotShowQuickTask( bool );
179 181
180 void setDocument( const QString& ); 182 void setDocument( const QString& );
181 183
182 184
183 void slotBeam(); 185 void slotBeam();
184 void beamDone( Ir* ); 186 void beamDone( Ir* );
185 void slotShowDetails(); 187 void slotShowDetails();
186 void slotShowDue( bool ); 188 void slotShowDue( bool );
187 void slotReturnFromView(); // for TodoShow... 189 void slotReturnFromView(); // for TodoShow...
188 /* reimplementation from opimmainwindow */ 190 /* reimplementation from opimmainwindow */
189 protected slots: 191 protected slots:
190 void flush(); 192 void flush();
191 void reload(); 193 void reload();
192 int create(); 194 int create();
193 bool remove( int uid ); 195 bool remove( int uid );
194 void beam(int uid); 196 void beam(int uid);
195 void show( int uid ); 197 void show( int uid );
196 void edit( int uid ); 198 void edit( int uid );
197 void add( const OPimRecord& ); 199 void add( const OPimRecord& );
200 void doAlarm( const QDateTime& dt, int uid );
198 }; 201 };
199}; 202}
200 203
201#endif 204#endif
diff --git a/core/pim/todo/otaskeditor.cpp b/core/pim/todo/otaskeditor.cpp
index e26d5e4..84f854f 100644
--- a/core/pim/todo/otaskeditor.cpp
+++ b/core/pim/todo/otaskeditor.cpp
@@ -13,81 +13,84 @@
13 13
14OTaskEditor::OTaskEditor(int cur) 14OTaskEditor::OTaskEditor(int cur)
15 : QDialog( 0, 0, TRUE, WStyle_ContextHelp ) { 15 : QDialog( 0, 0, TRUE, WStyle_ContextHelp ) {
16 init(); 16 init();
17 init( cur ); 17 init( cur );
18} 18}
19OTaskEditor::OTaskEditor( const OTodo& to) 19OTaskEditor::OTaskEditor( const OTodo& to)
20 : QDialog( 0, 0, TRUE, WStyle_ContextHelp ) { 20 : QDialog( 0, 0, TRUE, WStyle_ContextHelp ) {
21 init(); 21 init();
22 init( to ); 22 init( to );
23} 23}
24OTaskEditor::~OTaskEditor() { 24OTaskEditor::~OTaskEditor() {
25 25
26} 26}
27void OTaskEditor::init( int cur ) { 27void OTaskEditor::init( int cur ) {
28 OTodo to; 28 OTodo to;
29 if ( cur != 0 ) 29 if ( cur != 0 )
30 to.setCategories( cur ); 30 to.setCategories( cur );
31 load(to); 31 load(to);
32 m_uid = 1; // generate a new one 32 m_uid = 1; // generate a new one
33} 33}
34void OTaskEditor::init( const OTodo& to ) { 34void OTaskEditor::init( const OTodo& to ) {
35 load( to ); 35 load( to );
36 m_uid = to.uid(); 36 m_uid = to.uid();
37} 37}
38OTodo OTaskEditor::todo()const{ 38OTodo OTaskEditor::todo()const{
39 qWarning("saving!"); 39 qWarning("saving!");
40 OTodo to; 40 OTodo to;
41 to.setUid(m_uid ); 41 to.setUid(m_uid );
42 m_overView->save( to ); 42 m_overView->save( to );
43 m_stat->save( to ); 43 m_stat->save( to );
44 to.setRecurrence( m_rec->recurrence() ); 44 to.setRecurrence( m_rec->recurrence() );
45 m_alarm->save( to );
45 46
46 return to; 47 return to;
47} 48}
48void OTaskEditor::load(const OTodo& to) { 49void OTaskEditor::load(const OTodo& to) {
49 m_overView->load( to ); 50 m_overView->load( to );
50 m_stat->load( to ); 51 m_stat->load( to );
51 m_rec->setRecurrence( to.recurrence(), to.hasDueDate() ? to.dueDate() : QDate::currentDate() ); 52 m_rec->setRecurrence( to.recurrence(), to.hasDueDate() ? to.dueDate() : QDate::currentDate() );
53 m_alarm->setEnabled( !to.hasRecurrence() );
54 m_alarm->load( to );
52} 55}
53void OTaskEditor::init() { 56void OTaskEditor::init() {
54 setCaption("Task Editor"); 57 setCaption("Task Editor");
55 58
56 QVBoxLayout* layo = new QVBoxLayout( this ); 59 QVBoxLayout* layo = new QVBoxLayout( this );
57 m_tab = new OTabWidget( this ); 60 m_tab = new OTabWidget( this );
58 layo->addWidget( m_tab ); 61 layo->addWidget( m_tab );
59 62
60 /* 63 /*
61 * Add the Widgets 64 * Add the Widgets
62 */ 65 */
63 m_overView = new TaskEditorOverView( m_tab ); 66 m_overView = new TaskEditorOverView( m_tab );
64 m_tab->addTab( m_overView, "todo/info", tr("Information") ); 67 m_tab->addTab( m_overView, "todo/info", tr("Information") );
65 68
66 m_stat = new TaskEditorStatus( m_tab ); 69 m_stat = new TaskEditorStatus( m_tab );
67 m_tab->addTab( m_stat, "todo/TodoList", tr("Status") ); 70 m_tab->addTab( m_stat, "todo/TodoList", tr("Status") );
68 71
69 m_alarm = new TaskEditorAlarms( m_tab ); 72 m_alarm = new TaskEditorAlarms( m_tab );
70 m_tab->addTab( m_alarm, "todo/alarm", tr("Alarms") ); 73 m_tab->addTab( m_alarm, "todo/alarm", tr("Alarms") );
71 74
72 m_remind = new TaskEditorAlarms( m_tab ); 75// m_remind = new TaskEditorAlarms( m_tab );
73 m_tab->addTab( m_remind, "todo/reminder", tr("Reminders") ); 76// m_tab->addTab( m_remind, "todo/reminder", tr("Reminders") );
74 77
75 QLabel* lbl = new QLabel( m_tab ); 78// QLabel* lbl = new QLabel( m_tab );
76 lbl->setText( tr("X-Ref") ); 79// lbl->setText( tr("X-Ref") );
77 m_tab->addTab( lbl, "todo/xref", tr("X-Ref") ); 80// m_tab->addTab( lbl, "todo/xref", tr("X-Ref") );
78 81
79 m_rec = new ORecurranceWidget( true, QDate::currentDate(), this ); 82 m_rec = new ORecurranceWidget( true, QDate::currentDate(), this );
80 m_tab->addTab( m_rec, "repeat", tr("Recurrence") ); 83 m_tab->addTab( m_rec, "repeat", tr("Recurrence") );
81 84
82 85
83 /* signal and slots */ 86 /* signal and slots */
84 connect(m_overView, SIGNAL(recurranceEnabled(bool) ), 87 connect(m_overView, SIGNAL(recurranceEnabled(bool) ),
85 m_rec, SLOT(setEnabled(bool) ) ); 88 m_rec, SLOT(setEnabled(bool) ) );
86 89
87 /* connect due date changed to the recurrence tab */ 90 /* connect due date changed to the recurrence tab */
88 connect(m_stat, SIGNAL(dueDateChanged(const QDate&) ), 91 connect(m_stat, SIGNAL(dueDateChanged(const QDate&) ),
89 m_rec, SLOT(setStartDate(const QDate& ) ) ); 92 m_rec, SLOT(setStartDate(const QDate& ) ) );
90 93
91 94
92 m_tab->setCurrentTab( m_overView ); 95 m_tab->setCurrentTab( m_overView );
93} 96}
diff --git a/core/pim/todo/quickeditimpl.cpp b/core/pim/todo/quickeditimpl.cpp
index 91d3131..f4c7c47 100644
--- a/core/pim/todo/quickeditimpl.cpp
+++ b/core/pim/todo/quickeditimpl.cpp
@@ -1,85 +1,85 @@
1#include <qaction.h> 1#include <qaction.h>
2#include <qlineedit.h> 2#include <qlineedit.h>
3#include <qwhatsthis.h> 3#include <qwhatsthis.h>
4 4
5#include <qpe/resource.h> 5#include <qpe/resource.h>
6 6
7#include <opie/oclickablelabel.h> 7#include <opie/oclickablelabel.h>
8 8
9#include "mainwindow.h" 9#include "mainwindow.h"
10#include "quickeditimpl.h" 10#include "quickeditimpl.h"
11 11
12 12
13QuickEditImpl::QuickEditImpl( QWidget* parent, bool visible ) 13QuickEditImpl::QuickEditImpl( QWidget* parent, bool visible )
14 : QPEToolBar( (QMainWindow *)parent ), Todo::QuickEdit( (Todo::MainWindow *)parent ) { 14 : QPEToolBar( (QMainWindow *)parent ), Todo::QuickEdit( (Todo::MainWindow *)parent ) {
15 setHorizontalStretchable( TRUE ); 15 setHorizontalStretchable( TRUE );
16 16
17 // Load priority icons 17 // Load priority icons
18 // TODO - probably should be done globally somewhere else, 18 // TODO - probably should be done globally somewhere else,
19 // see also tableview.cpp/h, taskeditoroverview.cpp/h 19 // see also tableview.cpp/h, taskeditoroverview.cpp/h
20 priority1 = Resource::loadPixmap( "todo/priority1" ); 20 priority1 = Resource::loadPixmap( "todo/priority1" );
21 priority3 = Resource::loadPixmap( "todo/priority3" ); 21 priority3 = Resource::loadPixmap( "todo/priority3" );
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, 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, 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 QAction *a = new QAction( tr( "More" ), Resource::loadPixmap( "todo/more" ), QString::null, 0, this, 0 ); 34 QAction *a = new QAction( QWidget::tr( "More" ), Resource::loadPixmap( "todo/more" ), QString::null, 0, this, 0 );
35 connect( a, SIGNAL( activated() ), this, SLOT( slotMore() ) ); 35 connect( a, SIGNAL( activated() ), this, SLOT( slotMore() ) );
36 a->addTo( this ); 36 a->addTo( this );
37 a->setWhatsThis( 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." ) ); 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." ) );
38 38
39 a = new QAction( tr( "Enter" ), Resource::loadPixmap( "enter" ), QString::null, 0, this, 0 ); 39 a = new QAction( QWidget::tr( "Enter" ), Resource::loadPixmap( "enter" ), QString::null, 0, this, 0 );
40 connect( a, SIGNAL( activated() ), this, SLOT( slotEnter() ) ); 40 connect( a, SIGNAL( activated() ), this, SLOT( slotEnter() ) );
41 a->addTo( this ); 41 a->addTo( this );
42 a->setWhatsThis( 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." ) ); 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." ) );
43 43
44 a = new QAction( tr( "Cancel" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); 44 a = new QAction( QWidget::tr( "Cancel" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
45 connect( a, SIGNAL( activated() ), this, SLOT( slotCancel() ) ); 45 connect( a, SIGNAL( activated() ), this, SLOT( slotCancel() ) );
46 a->addTo( this ); 46 a->addTo( this );
47 a->setWhatsThis( 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." ) ); 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." ) );
48 48
49 m_visible = visible; 49 m_visible = visible;
50 if ( !m_visible ) { 50 if ( !m_visible ) {
51 hide(); 51 hide();
52 } 52 }
53 53
54 m_menu = 0l; 54 m_menu = 0l;
55 reinit(); 55 reinit();
56} 56}
57QuickEditImpl::~QuickEditImpl() { 57QuickEditImpl::~QuickEditImpl() {
58 58
59} 59}
60OTodo QuickEditImpl::todo()const { 60OTodo QuickEditImpl::todo()const {
61 return m_todo; 61 return m_todo;
62} 62}
63QWidget* QuickEditImpl::widget() { 63QWidget* QuickEditImpl::widget() {
64 return this; 64 return this;
65} 65}
66void QuickEditImpl::slotEnter() { 66void QuickEditImpl::slotEnter() {
67 OTodo todo; 67 OTodo todo;
68 68
69 69
70 if (!m_edit->text().isEmpty() ) { 70 if (!m_edit->text().isEmpty() ) {
71 todo.setUid(1 ); // new uid 71 todo.setUid(1 ); // new uid
72 todo.setPriority( m_state ); 72 todo.setPriority( m_state );
73 todo.setSummary( m_edit->text() ); 73 todo.setSummary( m_edit->text() );
74 if ( ((Todo::MainWindow *)parent())->currentCatId() != 0 ) 74 if ( ((Todo::MainWindow *)parent())->currentCatId() != 0 )
75 todo.setCategories( ((Todo::MainWindow *)parent())->currentCatId() ); 75 todo.setCategories( ((Todo::MainWindow *)parent())->currentCatId() );
76 76
77 m_todo = todo; 77 m_todo = todo;
78 commit(); 78 commit();
79 } 79 }
80 m_todo = todo; 80 m_todo = todo;
81 reinit(); 81 reinit();
82} 82}
83void QuickEditImpl::slotPrio() { 83void QuickEditImpl::slotPrio() {
84 m_state -= 2; 84 m_state -= 2;
85 if ( m_state < 1 ) 85 if ( m_state < 1 )
diff --git a/core/pim/todo/taskeditoralarms.cpp b/core/pim/todo/taskeditoralarms.cpp
index 3cb5576..bff3338 100644
--- a/core/pim/todo/taskeditoralarms.cpp
+++ b/core/pim/todo/taskeditoralarms.cpp
@@ -1,76 +1,238 @@
1/* 1/*
2               =. This file is part of the OPIE Project 2               =. This file is part of the OPIE Project
3             .=l. Copyright (c) 2002 <> 3             .=l. Copyright (c) 2002 <>
4           .>+-= 4           .>+-=
5 _;:,     .>    :=|. This program is free software; you can 5 _;:,     .>    :=|. This program is free software; you can
6.> <`_,   >  .   <= redistribute it and/or modify it under 6.> <`_,   >  .   <= redistribute it and/or modify it under
7:`=1 )Y*s>-.--   : the terms of the GNU General Public 7:`=1 )Y*s>-.--   : the terms of the GNU General Public
8.="- .-=="i,     .._ License as published by the Free Software 8.="- .-=="i,     .._ License as published by the Free Software
9 - .   .-<_>     .<> Foundation; either version 2 of the License, 9 - .   .-<_>     .<> Foundation; either version 2 of the License,
10     ._= =}       : or (at your option) any later version. 10     ._= =}       : or (at your option) any later version.
11    .%`+i>       _;_. 11    .%`+i>       _;_.
12    .i_,=:_.      -<s. This program is distributed in the hope that 12    .i_,=:_.      -<s. This program is distributed in the hope that
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
14    : ..    .:,     . . . without even the implied warranty of 14    : ..    .:,     . . . without even the implied warranty of
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
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  -_. . .   )=.  = General Public License along with 21  -_. . .   )=.  = 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 28
29#include "taskeditoralarms.h" 29#include "taskeditoralarms.h"
30 30
31#include <opie/otodo.h>
32#include <opie/opimnotifymanager.h>
33#include <opie/otimepicker.h>
34
35#include <qpe/datebookmonth.h>
31#include <qpe/resource.h> 36#include <qpe/resource.h>
37#include <qpe/timestring.h>
32 38
39#include <qdatetime.h>
33#include <qlistview.h> 40#include <qlistview.h>
34#include <qpushbutton.h> 41#include <qpushbutton.h>
42#include <qpopupmenu.h>
35#include <qlayout.h> 43#include <qlayout.h>
36#include <qwhatsthis.h> 44#include <qwhatsthis.h>
37 45
38TaskEditorAlarms::TaskEditorAlarms( QWidget* parent, const char* name, WFlags fl ) 46
47class AlarmItem : public QListViewItem {
48public:
49 AlarmItem( QListView*, const OPimAlarm& );
50 ~AlarmItem();
51
52 OPimAlarm alarm()const;
53 void setAlarm( const OPimAlarm& );
54private:
55 QDateTime m_dt;
56 int m_type;
57};
58AlarmItem::AlarmItem( QListView* view, const OPimAlarm& dt)
59 : QListViewItem(view) {
60 setAlarm( dt );
61}
62void AlarmItem::setAlarm( const OPimAlarm& dt ) {
63 m_dt = dt.dateTime();
64 m_type = dt.sound();
65 setText( 0, TimeString::dateString( m_dt.date() ) );
66 setText( 1, TimeString::timeString( m_dt.time() ) );
67 setText( 2, m_type == 0 ? QObject::tr("silent") : QObject::tr("loud") );
68}
69AlarmItem::~AlarmItem() {
70}
71OPimAlarm AlarmItem::alarm()const{
72 OPimAlarm al( m_type, m_dt );
73
74 return al;
75}
76
77TaskEditorAlarms::TaskEditorAlarms( QWidget* parent, int, const char* name, WFlags fl )
39 : QWidget( parent, name, fl ) 78 : QWidget( parent, name, fl )
40{ 79{
41 QGridLayout *layout = new QGridLayout( this, 2, 3, 4, 4 ); 80 m_date = m_type = m_time = 0;
81 QGridLayout *layout = new QGridLayout( this, 2, 2, 4, 4 );
42 82
43 lstAlarms = new QListView( this ); 83 lstAlarms = new QListView( this );
84 lstAlarms->addColumn( tr("Date") );
85 lstAlarms->addColumn( tr("Time") );
86 lstAlarms->addColumn( tr("Type") );
87
88 connect( lstAlarms, SIGNAL(clicked ( QListViewItem *, const QPoint &, int ) ),
89 this, SLOT(inlineEdit(QListViewItem*, const QPoint&, int ) ) );
90
44 layout->addMultiCellWidget( lstAlarms, 0, 0, 0, 2 ); 91 layout->addMultiCellWidget( lstAlarms, 0, 0, 0, 2 );
45 92
46 QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), this ); 93 QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), this );
47 //QWhatsThis::add( btn, tr( "Click here to add a new transaction." ) ); 94 //QWhatsThis::add( btn, tr( "Click here to add a new transaction." ) );
48 //connect( btn, SIGNAL( clicked() ), this, SLOT( slotNew() ) ); 95 connect( btn, SIGNAL( clicked() ), this, SLOT( slotNew() ) );
49 layout->addWidget( btn, 1, 0 ); 96 layout->addWidget( btn, 1, 0 );
50 97/* use when we've reminders too */
98#if 0
51 btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Edit" ), this ); 99 btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Edit" ), this );
52 //QWhatsThis::add( btn, tr( "Select a transaction and then click here to edit it." ) ); 100 //QWhatsThis::add( btn, tr( "Select a transaction and then click here to edit it." ) );
53 //connect( btn, SIGNAL( clicked() ), this, SLOT( slotEdit() ) ); 101 connect( btn, SIGNAL( clicked() ), this, SLOT( slotEdit() ) );
54 layout->addWidget( btn, 1, 1 ); 102 layout->addWidget( btn, 1, 1 );
103#endif
55 104
56 btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), this ); 105 btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), this );
57 //QWhatsThis::add( btn, tr( "Select a checkbook and then click here to delete it." ) ); 106 //QWhatsThis::add( btn, tr( "Select a checkbook and then click here to delete it." ) );
58 //connect( btn, SIGNAL( clicked() ), this, SLOT( slotDelete() ) ); 107 connect( btn, SIGNAL( clicked() ), this, SLOT( slotDelete() ) );
59 layout->addWidget( btn, 1, 2 ); 108 layout->addWidget( btn, 1, 2 );
60} 109}
61 110
62TaskEditorAlarms::~TaskEditorAlarms() 111TaskEditorAlarms::~TaskEditorAlarms(){
63{
64} 112}
65 113
66void TaskEditorAlarms::slotNew() 114void TaskEditorAlarms::slotNew(){
67{ 115 (void)new AlarmItem(lstAlarms, OPimAlarm(0, QDateTime::currentDateTime() ) );
68} 116}
69 117
70void TaskEditorAlarms::slotEdit() 118void TaskEditorAlarms::slotEdit(){
71{
72} 119}
73 120
74void TaskEditorAlarms::slotDelete() 121void TaskEditorAlarms::slotDelete(){
75{ 122 QListViewItem* item = lstAlarms->currentItem();
123 if (!item) return;
124
125 lstAlarms->takeItem( item ); delete item;
126
127
128}
129
130void TaskEditorAlarms::load( const OTodo& todo) {
131 lstAlarms->clear();
132 if (!todo.hasNotifiers() ) return;
133
134 OPimNotifyManager::Alarms als = todo.notifiers().alarms();
135
136 if (als.isEmpty() ) return;
137
138 OPimNotifyManager::Alarms::Iterator it = als.begin();
139 for ( ; it != als.end(); ++it )
140 (void)new AlarmItem( lstAlarms, (*it) );
141
142
143}
144void TaskEditorAlarms::save( OTodo& todo ) {
145 if (lstAlarms->childCount() <= 0 ) return;
146
147 OPimNotifyManager::Alarms alarms;
148
149 for ( QListViewItem* item = lstAlarms->firstChild(); item; item = item->nextSibling() ) {
150 AlarmItem *alItem = static_cast<AlarmItem*>(item);
151 alarms.append( alItem->alarm() );
152 }
153
154 OPimNotifyManager& manager = todo.notifiers();
155 manager.setAlarms( alarms );
156}
157void TaskEditorAlarms::inlineEdit( QListViewItem* alarm, const QPoint& p, int col ) {
158 if (!alarm) return;
159
160 AlarmItem* item = static_cast<AlarmItem*>(alarm);
161 switch( col ) {
162 // date
163 case 0:
164 return inlineSetDate( item, p );
165 // time
166 case 1:
167 return inlineSetTime( item );
168 // type
169 case 2:
170 return inlineSetType( item, p );
171 }
172}
173void TaskEditorAlarms::inlineSetDate( AlarmItem* item, const QPoint& p ) {
174 QPopupMenu* pop = popup( 0 );
175 m_dbMonth->setDate( item->alarm().dateTime().date() );
176 pop->exec(p);
177
178 OPimAlarm al = item->alarm();
179 QDateTime dt = al.dateTime();
180 dt.setDate( m_dbMonth->selectedDate() );
181 al.setDateTime( dt );
182 item->setAlarm( al );
183}
184void TaskEditorAlarms::inlineSetType( AlarmItem* item, const QPoint& p ) {
185 int type;
186 QPopupMenu* pop = popup( 2 );
187 switch( pop->exec(p) ) {
188 case 10:
189 type = 1;
190 break;
191 case 20:
192 default:
193 type = 0;
194 }
195 OPimAlarm al = item->alarm();
196 al.setSound( type );
197 item->setAlarm( al );
198}
199void TaskEditorAlarms::inlineSetTime( AlarmItem* item ) {
200 OPimAlarm al = item->alarm();
201 QDateTime dt = al.dateTime();
202
203 OTimePickerDialog dialog;
204 dialog.setTime( dt.time() );
205 if ( dialog.exec() == QDialog::Accepted ) {
206 dt.setTime( dialog.time() );
207 al.setDateTime( dt );
208 item->setAlarm( al );
209 }
210}
211QPopupMenu* TaskEditorAlarms::popup( int column ) {
212 QPopupMenu* pop = 0;
213 switch( column ) {
214 case 0:{
215 if (!m_date) {
216 m_date = new QPopupMenu(this);
217 m_dbMonth = new DateBookMonth(m_date, 0, TRUE);
218 m_date->insertItem(m_dbMonth);
219 }
220 pop = m_date;
221 }
222 break;
223 case 1:
224 break;
225 case 2:{
226 if (!m_type) {
227 m_type = new QPopupMenu(this);
228 m_type->insertItem( QObject::tr("loud"), 10 );
229 m_type->insertItem( QObject::tr("silent"), 20 );
230 }
231 pop = m_type;
232 }
233 break;
234 default:
235 break;
236 }
237 return pop;
76} 238}
diff --git a/core/pim/todo/taskeditoralarms.h b/core/pim/todo/taskeditoralarms.h
index f77ded5..0aa52cc 100644
--- a/core/pim/todo/taskeditoralarms.h
+++ b/core/pim/todo/taskeditoralarms.h
@@ -1,52 +1,72 @@
1/* 1/*
2               =. This file is part of the OPIE Project 2               =. This file is part of the OPIE Project
3             .=l. Copyright (c) 2002 <> 3             .=l. Copyright (c) 2002,2003 <>
4           .>+-= 4           .>+-=
5 _;:,     .>    :=|. This program is free software; you can 5 _;:,     .>    :=|. This program is free software; you can
6.> <`_,   >  .   <= redistribute it and/or modify it under 6.> <`_,   >  .   <= redistribute it and/or modify it under
7:`=1 )Y*s>-.--   : the terms of the GNU General Public 7:`=1 )Y*s>-.--   : the terms of the GNU General Public
8.="- .-=="i,     .._ License as published by the Free Software 8.="- .-=="i,     .._ License as published by the Free Software
9 - .   .-<_>     .<> Foundation; either version 2 of the License, 9 - .   .-<_>     .<> Foundation; either version 2 of the License,
10     ._= =}       : or (at your option) any later version. 10     ._= =}       : or (at your option) any later version.
11    .%`+i>       _;_. 11    .%`+i>       _;_.
12    .i_,=:_.      -<s. This program is distributed in the hope that 12    .i_,=:_.      -<s. This program is distributed in the hope that
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
14    : ..    .:,     . . . without even the implied warranty of 14    : ..    .:,     . . . without even the implied warranty of
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
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  -_. . .   )=.  = General Public License along with 21  -_. . .   )=.  = 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 28
29#ifndef TASKEDITORALARMS_H 29#ifndef TASKEDITORALARMS_H
30#define TASKEDITORALARMS_H 30#define TASKEDITORALARMS_H
31 31
32#include <qwidget.h> 32#include <qwidget.h>
33 33
34class QListView; 34class QListView;
35class QListViewItem;
36class OTodo;
35 37
38class AlarmItem;
39class DateBookMonth;
36class TaskEditorAlarms : public QWidget 40class TaskEditorAlarms : public QWidget
37{ 41{
38 Q_OBJECT 42 Q_OBJECT
39 43
40public: 44public:
41 TaskEditorAlarms( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); 45 enum Type {
46 Alarm = 0,
47 Reminders
48 };
49 TaskEditorAlarms( QWidget* parent = 0, int type = Alarm, const char* name = 0, WFlags fl = 0 );
42 ~TaskEditorAlarms(); 50 ~TaskEditorAlarms();
51 void load( const OTodo& );
52 void save( OTodo& );
53private:
54 QPopupMenu* popup( int column );
55 void inlineSetDate( AlarmItem*, const QPoint& p );
56 void inlineSetTime( AlarmItem*);
57 void inlineSetType( AlarmItem*, const QPoint& p );
43 58
44 QListView* lstAlarms; 59 QListView* lstAlarms;
60 QPopupMenu* m_date;
61 QPopupMenu* m_time;
62 QPopupMenu* m_type;
63 DateBookMonth* m_dbMonth;
45 64
46protected slots: 65protected slots:
47 void slotNew(); 66 void slotNew();
48 void slotEdit(); 67 void slotEdit();
49 void slotDelete(); 68 void slotDelete();
69 void inlineEdit( QListViewItem*, const QPoint& p, int );
50}; 70};
51 71
52#endif // TASKEDITORALARMS_H 72#endif // TASKEDITORALARMS_H
diff --git a/core/pim/todo/taskeditorstatus.cpp b/core/pim/todo/taskeditorstatus.cpp
index 4331877..0ab4223 100644
--- a/core/pim/todo/taskeditorstatus.cpp
+++ b/core/pim/todo/taskeditorstatus.cpp
@@ -115,185 +115,190 @@ TaskEditorStatus::TaskEditorStatus( QWidget* parent, const char* name, WFlags f
115 connect( ckbDue, SIGNAL( clicked() ), this, SLOT( slotDueChecked() ) ); 115 connect( ckbDue, SIGNAL( clicked() ), this, SLOT( slotDueChecked() ) );
116 btnDue = new QPushButton( curDateStr, container ); 116 btnDue = new QPushButton( curDateStr, container );
117 btnDue->setEnabled( FALSE ); 117 btnDue->setEnabled( FALSE );
118 layout->addMultiCellWidget( btnDue, 3, 3, 1, 2 ); 118 layout->addMultiCellWidget( btnDue, 3, 3, 1, 2 );
119 QWhatsThis::add( btnDue, tr( "Click here to set the date this task needs to be completed by." ) ); 119 QWhatsThis::add( btnDue, tr( "Click here to set the date this task needs to be completed by." ) );
120 popup = new QPopupMenu( this ); 120 popup = new QPopupMenu( this );
121 m_dueBook = new DateBookMonth( popup, 0, TRUE ); 121 m_dueBook = new DateBookMonth( popup, 0, TRUE );
122 popup->insertItem( m_dueBook ); 122 popup->insertItem( m_dueBook );
123 btnDue->setPopup( popup ); 123 btnDue->setPopup( popup );
124 connect( m_dueBook, SIGNAL( dateClicked( int, int, int ) ), 124 connect( m_dueBook, SIGNAL( dateClicked( int, int, int ) ),
125 this, SLOT( slotDueChanged( int, int, int ) ) ); 125 this, SLOT( slotDueChanged( int, int, int ) ) );
126 126
127 // Completed 127 // Completed
128 ckbComp = new QCheckBox( tr( "Completed:" ), container ); 128 ckbComp = new QCheckBox( tr( "Completed:" ), container );
129 layout->addWidget( ckbComp, 4, 0 ); 129 layout->addWidget( ckbComp, 4, 0 );
130 QWhatsThis::add( ckbComp, tr( "Click here to mark this task as completed." ) ); 130 QWhatsThis::add( ckbComp, tr( "Click here to mark this task as completed." ) );
131 connect( ckbComp, SIGNAL( clicked() ), this, SLOT( slotCompChecked() ) ); 131 connect( ckbComp, SIGNAL( clicked() ), this, SLOT( slotCompChecked() ) );
132 btnComp = new QPushButton( curDateStr, container ); 132 btnComp = new QPushButton( curDateStr, container );
133 btnComp->setEnabled( FALSE ); 133 btnComp->setEnabled( FALSE );
134 layout->addMultiCellWidget( btnComp, 4, 4, 1, 2 ); 134 layout->addMultiCellWidget( btnComp, 4, 4, 1, 2 );
135 QWhatsThis::add( btnComp, tr( "Click here to set the date this task was completed." ) ); 135 QWhatsThis::add( btnComp, tr( "Click here to set the date this task was completed." ) );
136 popup = new QPopupMenu( this ); 136 popup = new QPopupMenu( this );
137 m_compBook = new DateBookMonth( popup, 0, TRUE ); 137 m_compBook = new DateBookMonth( popup, 0, TRUE );
138 popup->insertItem( m_compBook ); 138 popup->insertItem( m_compBook );
139 btnComp->setPopup( popup ); 139 btnComp->setPopup( popup );
140 connect( m_compBook, SIGNAL( dateClicked( int, int, int ) ), 140 connect( m_compBook, SIGNAL( dateClicked( int, int, int ) ),
141 this, SLOT( slotCompChanged( int, int, int ) ) ); 141 this, SLOT( slotCompChanged( int, int, int ) ) );
142 142
143 QSpacerItem *spacer = new QSpacerItem( 5, 5, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding ); 143 QSpacerItem *spacer = new QSpacerItem( 5, 5, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding );
144 layout->addItem( spacer, 5, 0 ); 144 layout->addItem( spacer, 5, 0 );
145 145
146 // Maintainer mode 146 // Maintainer mode
147#if 0
147 label = new QLabel( tr( "Maintainer Mode:" ), container ); 148 label = new QLabel( tr( "Maintainer Mode:" ), container );
148 layout->addWidget( label, 6, 0 ); 149 layout->addWidget( label, 6, 0 );
149 QWhatsThis::add( label, tr( "Click here to set the maintainer's role." ) ); 150 QWhatsThis::add( label, tr( "Click here to set the maintainer's role." ) );
150 cmbMaintMode = new QComboBox( FALSE, container ); 151 cmbMaintMode = new QComboBox( FALSE, container );
151 cmbMaintMode->insertItem( tr( "Nothing" ) ); 152 cmbMaintMode->insertItem( tr( "Nothing" ) );
152 cmbMaintMode->insertItem( tr( "Responsible" ) ); 153 cmbMaintMode->insertItem( tr( "Responsible" ) );
153 cmbMaintMode->insertItem( tr( "Done By" ) ); 154 cmbMaintMode->insertItem( tr( "Done By" ) );
154 cmbMaintMode->insertItem( tr( "Coordinating" ) ); 155 cmbMaintMode->insertItem( tr( "Coordinating" ) );
155 layout->addMultiCellWidget( cmbMaintMode, 6, 6, 1, 2 ); 156// layout->addMultiCellWidget( cmbMaintMode, 6, 6, 1, 2 );
156 QWhatsThis::add( cmbMaintMode, tr( "Click here to set the maintainer's role." ) ); 157 QWhatsThis::add( cmbMaintMode, tr( "Click here to set the maintainer's role." ) );
157 158
158 // Maintainer 159 // Maintainer
159 label = new QLabel( tr( "Maintainer:" ), container ); 160 label = new QLabel( tr( "Maintainer:" ), container );
160 layout->addWidget( label, 7, 0 ); 161 layout->addWidget( label, 7, 0 );
161 QWhatsThis::add( label, tr( "This is the name of the current task maintainer." ) ); 162 QWhatsThis::add( label, tr( "This is the name of the current task maintainer." ) );
162 txtMaintainer = new QLabel( tr( "test" ), container ); 163 txtMaintainer = new QLabel( tr( "test" ), container );
163 txtMaintainer->setTextFormat( QLabel::RichText ); 164 txtMaintainer->setTextFormat( QLabel::RichText );
164 layout->addWidget( txtMaintainer, 7, 1 ); 165 layout->addWidget( txtMaintainer, 7, 1 );
165 QWhatsThis::add( txtMaintainer, tr( "This is the name of the current task maintainer." ) ); 166 QWhatsThis::add( txtMaintainer, tr( "This is the name of the current task maintainer." ) );
166 tbtMaintainer = new QToolButton( container ); 167 tbtMaintainer = new QToolButton( container );
167 tbtMaintainer->setPixmap( Resource::loadPixmap( "todo/more" ) ); 168 tbtMaintainer->setPixmap( Resource::loadPixmap( "todo/more" ) );
168 layout->addWidget( tbtMaintainer, 7, 2 ); 169// layout->addWidget( tbtMaintainer, 7, 2 );
169 QWhatsThis::add( tbtMaintainer, tr( "Click here to select the task maintainer." ) ); 170 QWhatsThis::add( tbtMaintainer, tr( "Click here to select the task maintainer." ) );
171#endif
170} 172}
171 173
172TaskEditorStatus::~TaskEditorStatus() 174TaskEditorStatus::~TaskEditorStatus()
173{ 175{
174} 176}
175 177
176void TaskEditorStatus::load( const OTodo &todo ) 178void TaskEditorStatus::load( const OTodo &todo )
177{ 179{
178 QDate date = QDate::currentDate(); 180 QDate date = QDate::currentDate();
179 QString str = TimeString::longDateString( date ); 181 QString str = TimeString::longDateString( date );
180 182
181 // Status 183 // Status
182 int state = todo.hasState()? todo.state().state() : OPimState::NotStarted; 184 int state = todo.hasState()? todo.state().state() : OPimState::NotStarted;
183 if ( state == OPimState::Undefined ) 185 if ( state == OPimState::Undefined )
184 state = OPimState::NotStarted; 186 state = OPimState::NotStarted;
185 cmbStatus->setCurrentItem( state ); 187 cmbStatus->setCurrentItem( state );
186 188
187 // Progress 189 // Progress
188 cmbProgress->setCurrentItem( todo.progress() / 20 ); 190 cmbProgress->setCurrentItem( todo.progress() / 20 );
189 191
190 // Start date 192 // Start date
191 ckbStart->setChecked( todo.hasStartDate() ); 193 ckbStart->setChecked( todo.hasStartDate() );
192 btnStart->setEnabled( todo.hasStartDate() ); 194 btnStart->setEnabled( todo.hasStartDate() );
193 if ( todo.hasStartDate() ) 195 if ( todo.hasStartDate() )
194 { 196 {
195 m_start = todo.startDate(); 197 m_start = todo.startDate();
196 btnStart->setText( TimeString::longDateString( m_start ) ); 198 btnStart->setText( TimeString::longDateString( m_start ) );
197 } 199 }
198 else 200 else
199 btnStart->setText( str ); 201 btnStart->setText( str );
200 202
201 // Due date 203 // Due date
202 ckbDue->setChecked( todo.hasDueDate() ); 204 ckbDue->setChecked( todo.hasDueDate() );
203 btnDue->setText( TimeString::longDateString( todo.dueDate() ) ); 205 btnDue->setText( TimeString::longDateString( todo.dueDate() ) );
204 btnDue->setEnabled( todo.hasDueDate() ); 206 btnDue->setEnabled( todo.hasDueDate() );
205 m_due = todo.dueDate(); 207 m_due = todo.dueDate();
206 208
207 // Completed 209 // Completed
208 ckbComp->setChecked( todo.isCompleted() ); 210 ckbComp->setChecked( todo.isCompleted() );
209 btnComp->setEnabled( todo.hasCompletedDate() ); 211 btnComp->setEnabled( todo.hasCompletedDate() );
210 if ( todo.hasCompletedDate() ) 212 if ( todo.hasCompletedDate() )
211 { 213 {
212 m_comp = todo.completedDate(); 214 m_comp = todo.completedDate();
213 btnComp->setText( TimeString::longDateString( m_comp ) ); 215 btnComp->setText( TimeString::longDateString( m_comp ) );
214 } 216 }
215 else 217 else
216 btnComp->setText( str ); 218 btnComp->setText( str );
217 219
218 // Maintainer Mode 220 // Maintainer Mode
221#if 0
219 state = todo.hasMaintainer() ? todo.maintainer().mode() : OPimMaintainer::Nothing; 222 state = todo.hasMaintainer() ? todo.maintainer().mode() : OPimMaintainer::Nothing;
220 if ( state == OPimMaintainer::Undefined ) 223 if ( state == OPimMaintainer::Undefined )
221 state = OPimMaintainer::Nothing; 224 state = OPimMaintainer::Nothing;
222 cmbMaintMode->setCurrentItem( state ); 225 cmbMaintMode->setCurrentItem( state );
223 226#endif
224 // Maintainer - not implemented yet 227 // Maintainer - not implemented yet
225} 228}
226 229
227void TaskEditorStatus::save( OTodo &todo ) 230void TaskEditorStatus::save( OTodo &todo )
228{ 231{
229 QDate inval; 232 QDate inval;
230 233
231 // Status 234 // Status
232 todo.setState( OPimState( cmbStatus->currentItem() ) ); 235 todo.setState( OPimState( cmbStatus->currentItem() ) );
233 236
234 // Progress 237 // Progress
235 todo.setProgress( cmbProgress->currentItem() * 20 ); 238 todo.setProgress( cmbProgress->currentItem() * 20 );
236 239
237 // Start date 240 // Start date
238 if ( ckbStart->isChecked() ) 241 if ( ckbStart->isChecked() )
239 { 242 {
240 todo.setStartDate( m_start ); 243 todo.setStartDate( m_start );
241 } 244 }
242 else 245 else
243 todo.setStartDate( inval ); 246 todo.setStartDate( inval );
244 247
245 // Due date 248 // Due date
246 if ( ckbDue->isChecked() ) 249 if ( ckbDue->isChecked() )
247 { 250 {
248 todo.setDueDate( m_due ); 251 todo.setDueDate( m_due );
249 todo.setHasDueDate( true ); 252 todo.setHasDueDate( true );
250 } 253 }
251 else 254 else
252 todo.setHasDueDate( false ); 255 todo.setHasDueDate( false );
253 256
254 // Completed 257 // Completed
255 todo.setCompleted( ckbComp->isChecked() ); 258 todo.setCompleted( ckbComp->isChecked() );
256 if ( ckbComp->isChecked() ) 259 if ( ckbComp->isChecked() )
257 { 260 {
258 todo.setCompletedDate( m_comp ); 261 todo.setCompletedDate( m_comp );
259 } 262 }
260 else 263 else
261 todo.setCompletedDate( inval ); 264 todo.setCompletedDate( inval );
262 265
266#if 0
263 // Maintainer mode - not implemented yet 267 // Maintainer mode - not implemented yet
264 268
265 // Maintainer 269 // Maintainer
266 /* TODO - resolve name to uid.....*/ 270 /* TODO - resolve name to uid.....*/
267 todo.setMaintainer( OPimMaintainer( cmbMaintMode->currentItem(), -10 ) ); 271 todo.setMaintainer( OPimMaintainer( cmbMaintMode->currentItem(), -10 ) );
272#endif
268} 273}
269 274
270void TaskEditorStatus::slotStartChecked() 275void TaskEditorStatus::slotStartChecked()
271{ 276{
272 btnStart->setEnabled( ckbStart->isChecked() ); 277 btnStart->setEnabled( ckbStart->isChecked() );
273} 278}
274 279
275void TaskEditorStatus::slotCompChecked() 280void TaskEditorStatus::slotCompChecked()
276{ 281{
277 btnComp->setEnabled( ckbComp->isChecked() ); 282 btnComp->setEnabled( ckbComp->isChecked() );
278} 283}
279 284
280void TaskEditorStatus::slotDueChecked() 285void TaskEditorStatus::slotDueChecked()
281{ 286{
282 btnDue->setEnabled( ckbDue->isChecked() ); 287 btnDue->setEnabled( ckbDue->isChecked() );
283} 288}
284 289
285void TaskEditorStatus::slotStartChanged(int y, int m, int d) 290void TaskEditorStatus::slotStartChanged(int y, int m, int d)
286{ 291{
287 m_start.setYMD( y, m, d ); 292 m_start.setYMD( y, m, d );
288 btnStart->setText( TimeString::longDateString( m_start ) ); 293 btnStart->setText( TimeString::longDateString( m_start ) );
289} 294}
290 295
291void TaskEditorStatus::slotCompChanged(int y, int m, int d) 296void TaskEditorStatus::slotCompChanged(int y, int m, int d)
292{ 297{
293 m_comp.setYMD( y, m, d ); 298 m_comp.setYMD( y, m, d );
294 btnComp->setText( TimeString::longDateString( m_comp ) ); 299 btnComp->setText( TimeString::longDateString( m_comp ) );
295} 300}
296 301
297void TaskEditorStatus::slotDueChanged(int y, int m, int d) 302void TaskEditorStatus::slotDueChanged(int y, int m, int d)
298{ 303{
299 m_due.setYMD( y, m, d ); 304 m_due.setYMD( y, m, d );
diff --git a/core/pim/todo/templatedialog.cpp b/core/pim/todo/templatedialog.cpp
index c94f69c..8dfbd0b 100644
--- a/core/pim/todo/templatedialog.cpp
+++ b/core/pim/todo/templatedialog.cpp
@@ -1,59 +1,61 @@
1#include <qpushbutton.h> 1#include <qpushbutton.h>
2#include <qhbox.h> 2#include <qhbox.h>
3#include <qlayout.h> 3#include <qlayout.h>
4#include <qlistview.h> 4#include <qlistview.h>
5#include <qlineedit.h> 5#include <qlineedit.h>
6 6
7#include "templatedialog.h" 7#include "templatedialog.h"
8 8
9 9
10using namespace Todo; 10using namespace Todo;
11 11
12/* TRANSLATOR Todo::TemplateDialog */
13
12TemplateDialog::TemplateDialog( QWidget* widget ) 14TemplateDialog::TemplateDialog( QWidget* widget )
13 : QDialog( widget, "TemplateDialog", TRUE ) 15 : QDialog( widget, "TemplateDialog", TRUE )
14{ 16{
15 setCaption( tr("Template Editor") ); 17 setCaption( QWidget::tr("Template Editor") );
16 m_main = new QVBoxLayout(this ); 18 m_main = new QVBoxLayout(this );
17 19
18 m_list = new QListView( this ); 20 m_list = new QListView( this );
19 m_main->addWidget( m_list, 100 ); 21 m_main->addWidget( m_list, 100 );
20 22
21 m_lne = new QLineEdit( this ); 23 m_lne = new QLineEdit( this );
22 m_main->addWidget( m_lne ); 24 m_main->addWidget( m_lne );
23 25
24 m_btnBar = new QHBox( this ); 26 m_btnBar = new QHBox( this );
25 m_add = new QPushButton( tr("Add"), m_btnBar ); 27 m_add = new QPushButton( QWidget::tr("Add"), m_btnBar );
26 m_edit = new QPushButton( tr("Edit"), m_btnBar ); 28 m_edit = new QPushButton( QWidget::tr("Edit"), m_btnBar );
27 m_rem = new QPushButton( tr("Remove"), m_btnBar ); 29 m_rem = new QPushButton( QWidget::tr("Remove"), m_btnBar );
28 m_main->addWidget( m_btnBar ); 30 m_main->addWidget( m_btnBar );
29 31
30 connect(m_add, SIGNAL(clicked() ), 32 connect(m_add, SIGNAL(clicked() ),
31 this, SLOT(slotAdd() ) ); 33 this, SLOT(slotAdd() ) );
32 connect(m_edit, SIGNAL(clicked() ), 34 connect(m_edit, SIGNAL(clicked() ),
33 this, SLOT(slotEdit() ) ); 35 this, SLOT(slotEdit() ) );
34 connect(m_rem, SIGNAL(clicked() ), 36 connect(m_rem, SIGNAL(clicked() ),
35 this, SLOT(slotRemove() ) ); 37 this, SLOT(slotRemove() ) );
36 connect(m_lne, SIGNAL(returnPressed() ), 38 connect(m_lne, SIGNAL(returnPressed() ),
37 this, SLOT(slotReturn() ) ); 39 this, SLOT(slotReturn() ) );
38 40
39} 41}
40TemplateDialog::~TemplateDialog() { 42TemplateDialog::~TemplateDialog() {
41 // Qt does delete our widgets 43 // Qt does delete our widgets
42} 44}
43QListView* TemplateDialog::listView() { 45QListView* TemplateDialog::listView() {
44 return m_list; 46 return m_list;
45} 47}
46QLineEdit* TemplateDialog::edit() { 48QLineEdit* TemplateDialog::edit() {
47 return m_lne; 49 return m_lne;
48} 50}
49void TemplateDialog::slotAdd() { 51void TemplateDialog::slotAdd() {
50 qWarning("Not Implemented here"); 52 qWarning("Not Implemented here");
51} 53}
52void TemplateDialog::slotRemove() { 54void TemplateDialog::slotRemove() {
53 qWarning("Not Implemented here"); 55 qWarning("Not Implemented here");
54} 56}
55void TemplateDialog::slotEdit() { 57void TemplateDialog::slotEdit() {
56 qWarning("Not Implemented here"); 58 qWarning("Not Implemented here");
57} 59}
58void TemplateDialog::slotReturn() { 60void TemplateDialog::slotReturn() {
59 qWarning("Not Implemented here"); 61 qWarning("Not Implemented here");
diff --git a/core/pim/todo/templatedialogimpl.cpp b/core/pim/todo/templatedialogimpl.cpp
index 77c5363..fed92f0 100644
--- a/core/pim/todo/templatedialogimpl.cpp
+++ b/core/pim/todo/templatedialogimpl.cpp
@@ -1,119 +1,119 @@
1#include <qlistview.h> 1#include <qlistview.h>
2#include <qlineedit.h> 2#include <qlineedit.h>
3 3
4#include "mainwindow.h" 4#include "mainwindow.h"
5#include "todoeditor.h" 5#include "todoeditor.h"
6#include "todotemplatemanager.h" 6#include "todotemplatemanager.h"
7#include "templatedialogimpl.h" 7#include "templatedialogimpl.h"
8 8
9 9
10using namespace Todo; 10using namespace Todo;
11 11
12/* TRANSLATOR Todo::TemplateDialogImpl */
13
12namespace { 14namespace {
13 class TemplateListItem : public QListViewItem { 15 class TemplateListItem : public QListViewItem {
14 public: 16 public:
15 TemplateListItem( QListView*, 17 TemplateListItem( QListView*,
16 const QString& name, 18 const QString& name,
17 const OTodo& ); 19 const OTodo& );
18 ~TemplateListItem(); 20 ~TemplateListItem();
19 21
20 OTodo event()const; 22 OTodo event()const;
21 QString text()const; 23 QString text()const;
22 void setText(const QString& str ); 24 void setText(const QString& str );
23 void setEvent( const OTodo& ); 25 void setEvent( const OTodo& );
24 private: 26 private:
25 QString m_name; 27 QString m_name;
26 OTodo m_ev; 28 OTodo m_ev;
27 }; 29 };
28 30
29 /* implementation */ 31 /* implementation */
30 TemplateListItem::TemplateListItem( QListView* view, 32 TemplateListItem::TemplateListItem( QListView* view,
31 const QString& text, 33 const QString& text,
32 const OTodo& ev ) 34 const OTodo& ev )
33 : QListViewItem( view ), m_name( text ), m_ev( ev ) 35 : QListViewItem( view ), m_name( text ), m_ev( ev )
34 { 36 {
35 QListViewItem::setText(0, m_name ); 37 QListViewItem::setText(0, m_name );
36 } 38 }
37 TemplateListItem::~TemplateListItem() {} 39 TemplateListItem::~TemplateListItem() {}
38 OTodo TemplateListItem::event() const { 40 OTodo TemplateListItem::event() const {
39 return m_ev; 41 return m_ev;
40 } 42 }
41 QString TemplateListItem::text()const { 43 QString TemplateListItem::text()const {
42 return m_name; 44 return m_name;
43 } 45 }
44 void TemplateListItem::setText( const QString& str ) { 46 void TemplateListItem::setText( const QString& str ) {
45 QListViewItem::setText(0, str ); 47 QListViewItem::setText(0, str );
46 m_name = str; 48 m_name = str;
47 } 49 }
48 void TemplateListItem::setEvent( const OTodo& ev) { 50 void TemplateListItem::setEvent( const OTodo& ev) {
49 m_ev = ev; 51 m_ev = ev;
50 } 52 }
51} 53}
52 54
53TemplateDialogImpl::TemplateDialogImpl( MainWindow* win, 55TemplateDialogImpl::TemplateDialogImpl( MainWindow* win,
54 TemplateManager* man ) 56 TemplateManager* man )
55 : TemplateDialog( win ), m_win( win), m_man( man ) 57 : TemplateDialog( win ), m_win( win), m_man( man )
56{ 58{
57 /* fill the listview */ 59 /* fill the listview */
58 /* not the fastest way.... */ 60 /* not the fastest way.... */
59 QStringList list = man->templates(); 61 QStringList list = man->templates();
60 for (QStringList::Iterator it = list.begin(); 62 for (QStringList::Iterator it = list.begin();
61 it != list.end(); ++it ) { 63 it != list.end(); ++it ) {
62 new TemplateListItem( listView(), (*it), man->templateEvent( (*it) ) ); 64 new TemplateListItem( listView(), (*it), man->templateEvent( (*it) ) );
63 } 65 }
64 listView()->addColumn( tr("Name") ); 66 listView()->addColumn( QWidget::tr("Name") );
65 67
66 connect( listView(), SIGNAL(clicked(QListViewItem*) ), 68 connect( listView(), SIGNAL(clicked(QListViewItem*) ),
67 this, SLOT(slotClicked(QListViewItem*) ) ); 69 this, SLOT(slotClicked(QListViewItem*) ) );
68} 70}
69TemplateDialogImpl::~TemplateDialogImpl() { 71TemplateDialogImpl::~TemplateDialogImpl() {
70 72
71} 73}
72void TemplateDialogImpl::slotAdd() { 74void TemplateDialogImpl::slotAdd() {
73 QString str = tr("New Template %1").arg( listView()->childCount() ); 75 QString str = QWidget::tr("New Template %1").arg( listView()->childCount() );
74 OTodo ev; 76 OTodo ev;
75 m_man->addEvent(str, ev); 77 m_man->addEvent(str, ev);
76 new TemplateListItem( listView(), str, ev ); 78 new TemplateListItem( listView(), str, ev );
77} 79}
78void TemplateDialogImpl::slotRemove() { 80void TemplateDialogImpl::slotRemove() {
79 TemplateListItem* item = (TemplateListItem*) listView()->currentItem(); 81 TemplateListItem* item = (TemplateListItem*) listView()->currentItem();
80 listView()->takeItem( item ); 82 listView()->takeItem( item );
81 83
82 m_man->removeEvent( item->text() ); 84 m_man->removeEvent( item->text() );
83 85
84 delete item; 86 delete item;
85} 87}
86void TemplateDialogImpl::slotEdit() { 88void TemplateDialogImpl::slotEdit() {
87 TemplateListItem* item = (TemplateListItem*)listView()->currentItem(); 89 TemplateListItem* item = (TemplateListItem*)listView()->currentItem();
88 OTodo ev = m_win->currentEditor()->edit( m_win, item->event() ); 90 OTodo ev = m_win->currentEditor()->edit( m_win, item->event() );
89 if ( m_win->currentEditor()->accepted() ) { 91 if ( m_win->currentEditor()->accepted() ) {
90 qWarning("accepted");
91 item->setEvent( ev ); 92 item->setEvent( ev );
92 qWarning("Priority %d", ev.priority() );
93 m_man->removeEvent( item->text() ); 93 m_man->removeEvent( item->text() );
94 m_man->addEvent( item->text(), ev ); 94 m_man->addEvent( item->text(), ev );
95 } 95 }
96} 96}
97/* 97/*
98 * we need to update 98 * we need to update
99 * the text 99 * the text
100 */ 100 */
101 101
102void TemplateDialogImpl::slotReturn() { 102void TemplateDialogImpl::slotReturn() {
103 TemplateListItem* tbl = (TemplateListItem*)listView()->currentItem(); 103 TemplateListItem* tbl = (TemplateListItem*)listView()->currentItem();
104 104
105 if (tbl->text() != edit()->text() ) { 105 if (tbl->text() != edit()->text() ) {
106 m_man->removeEvent( tbl->text() ); 106 m_man->removeEvent( tbl->text() );
107 tbl->setText( edit()->text() ); 107 tbl->setText( edit()->text() );
108 m_man->addEvent( tbl->text(), tbl->event() ); 108 m_man->addEvent( tbl->text(), tbl->event() );
109 } 109 }
110} 110}
111/* update the lineedit when changing */ 111/* update the lineedit when changing */
112void TemplateDialogImpl::slotClicked( QListViewItem* item) { 112void TemplateDialogImpl::slotClicked( QListViewItem* item) {
113 if (!item) 113 if (!item)
114 return; 114 return;
115 115
116 TemplateListItem* tbl = (TemplateListItem*)item; 116 TemplateListItem* tbl = static_cast<TemplateListItem*>(item);
117 edit()->setText( tbl->text() ); 117 edit()->setText( tbl->text() );
118} 118}
119 119
diff --git a/core/pim/todo/templateeditor.cpp b/core/pim/todo/templateeditor.cpp
index 3930428..ca02173 100644
--- a/core/pim/todo/templateeditor.cpp
+++ b/core/pim/todo/templateeditor.cpp
@@ -1,39 +1,38 @@
1#include <qaction.h> 1#include <qaction.h>
2#include <qpopupmenu.h> 2#include <qpopupmenu.h>
3 3
4#include "mainwindow.h" 4#include "mainwindow.h"
5#include "todotemplatemanager.h" 5#include "todotemplatemanager.h"
6 6
7#include "templatedialogimpl.h" 7#include "templatedialogimpl.h"
8#include "templateeditor.h" 8#include "templateeditor.h"
9 9
10using namespace Todo; 10using namespace Todo;
11 11
12TemplateEditor::TemplateEditor( MainWindow* main, 12TemplateEditor::TemplateEditor( MainWindow* main,
13 TemplateManager* manager ) 13 TemplateManager* manager )
14 : QObject( main ), m_main( main ), m_man( manager ) 14 : QObject( main ), m_main( main ), m_man( manager )
15{ 15{
16 init(); 16 init();
17 17
18} 18}
19TemplateEditor::~TemplateEditor() { 19TemplateEditor::~TemplateEditor() {
20 20
21} 21}
22/* ok we add us to the Menubar */ 22/* ok we add us to the Menubar */
23void TemplateEditor::init() { 23void TemplateEditor::init() {
24 QAction* a = new QAction( QString::null, QWidget::tr("Configure Templates"), 24 QAction* a = new QAction( QString::null, QWidget::tr("Configure Templates"),
25 0, this, 0, FALSE ); 25 0, this, 0, FALSE );
26 connect(a, SIGNAL(activated() ), 26 connect(a, SIGNAL(activated() ),
27 this, SLOT(setUp() ) ); 27 this, SLOT(setUp() ) );
28 28
29 a->addTo( m_main->options() ); 29 a->addTo( m_main->options() );
30} 30}
31void TemplateEditor::setUp() { 31void TemplateEditor::setUp() {
32 qWarning("set up");
33 TemplateDialogImpl dlg(m_main, m_man ); 32 TemplateDialogImpl dlg(m_main, m_man );
34 int ret= dlg.exec(); 33 int ret= dlg.exec();
35 if (QDialog::Accepted != ret ) { 34 if (QDialog::Accepted != ret )
36 m_man->load(); 35 m_man->load();
37 }else 36 else
38 m_main->populateTemplates(); 37 m_main->populateTemplates();
39} 38}
diff --git a/core/pim/todo/todomanager.cpp b/core/pim/todo/todomanager.cpp
index b5b87de..df2e711 100644
--- a/core/pim/todo/todomanager.cpp
+++ b/core/pim/todo/todomanager.cpp
@@ -93,37 +93,36 @@ void TodoManager::removeAll() {
93} 93}
94void TodoManager::removeCompleted() { 94void TodoManager::removeCompleted() {
95 m_db->removeAllCompleted(); 95 m_db->removeAllCompleted();
96} 96}
97void TodoManager::save() { 97void TodoManager::save() {
98 m_db->save(); 98 m_db->save();
99} 99}
100bool TodoManager::saveAll() { 100bool TodoManager::saveAll() {
101 return m_db->save(); 101 return m_db->save();
102} 102}
103void TodoManager::reload() { 103void TodoManager::reload() {
104 m_db->reload(); 104 m_db->reload();
105} 105}
106QStringList TodoManager::categories() { 106QStringList TodoManager::categories() {
107 m_cat.load(categoryFileName() ); 107 m_cat.load(categoryFileName() );
108 return m_cat.labels( "Todo List"); 108 return m_cat.labels( "Todo List");
109} 109}
110/* 110/*
111 * we rely on load beeing called from populateCategories 111 * we rely on load beeing called from populateCategories
112 */ 112 */
113int TodoManager::catId( const QString& cats ) { 113int TodoManager::catId( const QString& cats ) {
114 return m_cat.id( "Todo List", cats ); 114 return m_cat.id( "Todo List", cats );
115} 115}
116void TodoManager::remove( const QArray<int>& ids) { 116void TodoManager::remove( const QArray<int>& ids) {
117 for (uint i=0; i < ids.size(); i++ ) 117 for (uint i=0; i < ids.size(); i++ )
118 remove( ids[i] ); 118 remove( ids[i] );
119} 119}
120bool TodoManager::isLoaded()const { 120bool TodoManager::isLoaded()const {
121 return (m_db == 0 ); 121 return (m_db == 0 );
122} 122}
123void TodoManager::load() { 123void TodoManager::load() {
124 if (!m_db) { 124 if (!m_db) {
125 qWarning("loading!");
126 m_db = new OTodoAccess(); 125 m_db = new OTodoAccess();
127 m_db->load(); 126 m_db->load();
128 } 127 }
129} 128}