summaryrefslogtreecommitdiff
path: root/core/pim/todo
Unidiff
Diffstat (limited to 'core/pim/todo') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/todo/main.cpp3
-rw-r--r--core/pim/todo/mainwindow.cpp136
-rw-r--r--core/pim/todo/mainwindow.h4
-rw-r--r--core/pim/todo/opie-todo.control6
-rw-r--r--core/pim/todo/otaskeditor.cpp14
-rw-r--r--core/pim/todo/otaskeditor.h3
-rw-r--r--core/pim/todo/quickedit.cpp1
-rw-r--r--core/pim/todo/quickeditimpl.cpp7
-rw-r--r--core/pim/todo/smalltodo.cpp1
-rw-r--r--core/pim/todo/tableview.cpp86
-rw-r--r--core/pim/todo/tableview.h18
-rw-r--r--core/pim/todo/taskeditoralarms.cpp5
-rw-r--r--core/pim/todo/taskeditoroverview.cpp6
-rw-r--r--core/pim/todo/taskeditorstatus.cpp5
-rw-r--r--core/pim/todo/templatedialogimpl.cpp1
-rw-r--r--core/pim/todo/textviewshow.cpp18
-rw-r--r--core/pim/todo/todomanager.cpp1
-rw-r--r--core/pim/todo/todoshow.cpp8
-rw-r--r--core/pim/todo/todoshow.h2
-rw-r--r--core/pim/todo/todoview.cpp3
-rw-r--r--core/pim/todo/todoview.h12
21 files changed, 273 insertions, 67 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
@@ -23,3 +23,2 @@
23 23
24#include <qdatetime.h>
25 24
@@ -41,3 +40,3 @@ int main( int argc, char **argv )
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() ) );
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
@@ -73,2 +73,3 @@ MainWindow::MainWindow( QWidget* parent,
73 m_syncing = false; 73 m_syncing = false;
74 m_showing = false;
74 m_counter = 0; 75 m_counter = 0;
@@ -163,2 +164,3 @@ void MainWindow::initActions() {
163 164
165#if 0
164 // Options menu 166 // Options menu
@@ -170,3 +172,5 @@ void MainWindow::initActions() {
170 172
173
171 m_options->insertSeparator(); 174 m_options->insertSeparator();
175#endif
172 176
@@ -354,2 +358,3 @@ 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();
@@ -411,3 +416,3 @@ void MainWindow::populateTemplates() {
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
@@ -427,5 +432,6 @@ void MainWindow::slotNewFromTemplate( int id ) {
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
@@ -433,2 +439,3 @@ void MainWindow::slotNewFromTemplate( int id ) {
433 } 439 }
440 raiseCurrentView();
434} 441}
@@ -440,3 +447,3 @@ void MainWindow::slotDuplicate() {
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;
@@ -445,3 +452,3 @@ void MainWindow::slotDuplicate() {
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 );
@@ -457,3 +464,3 @@ void MainWindow::slotDelete() {
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;
@@ -464,3 +471,3 @@ void MainWindow::slotDelete() {
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() );
@@ -469,2 +476,18 @@ void MainWindow::slotDelete() {
469} 476}
477void 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}
470void MainWindow::slotDeleteAll() { 493void MainWindow::slotDeleteAll() {
@@ -472,3 +495,3 @@ void MainWindow::slotDeleteAll() {
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;
@@ -488,3 +511,3 @@ void MainWindow::slotDeleteCompleted() {
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;
@@ -568,2 +591,3 @@ 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 );
@@ -572,12 +596,15 @@ void MainWindow::receiveFile( const QString& filename ) {
572 596
573 QString message = QWidget::tr("<P>%1 new tasks arrived.<p>Would you like to add them to your Todolist?").arg(list.count() ); 597 if (list.count()){
574 598
575 if ( QMessageBox::information(this, QWidget::tr("New Tasks"), 599 QString message = QWidget::tr("<P>%1 new tasks arrived.<p>Would you like to add them to your Todolist?").arg(list.count() );
576 message, QMessageBox::Ok,
577 QMessageBox::Cancel ) == QMessageBox::Ok ) {
578 OTodoAccess::List::Iterator it;
579 for ( it = list.begin(); it != list.end(); ++it )
580 m_todoMgr.add( (*it) );
581 600
582 currentView()->updateView(); 601 if ( QMessageBox::information(this, QWidget::tr("New Tasks"),
602 message, QMessageBox::Ok,
603 QMessageBox::Cancel ) == QMessageBox::Ok ) {
604 OTodoAccess::List::Iterator it;
605 for ( it = list.begin(); it != list.end(); ++it )
606 m_todoMgr.add( (*it) );
607
608 currentView()->updateView();
609 }
583 } 610 }
@@ -636,2 +663,9 @@ ViewBase* MainWindow::currentView() {
636void MainWindow::raiseCurrentView() { 663void 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() );
@@ -644,2 +678,3 @@ void MainWindow::slotShowDue(bool ov) {
644void MainWindow::slotShow( int uid ) { 678void MainWindow::slotShow( int uid ) {
679 if ( uid == 0 ) return;
645 qWarning("slotShow"); 680 qWarning("slotShow");
@@ -648,7 +683,17 @@ void MainWindow::slotShow( int uid ) {
648} 683}
684void MainWindow::slotShowNext() {
685 int l = currentView()->next();
686 if (l!=0)
687 slotShow(l);
688}
689void MainWindow::slotShowPrev() {
690 int l = currentView()->prev();
691 if (l!=0)
692 slotShow(l);
693}
649void MainWindow::slotEdit( int uid ) { 694void 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;
@@ -662,3 +707,2 @@ void MainWindow::slotEdit( int uid ) {
662 if ( currentEditor()->accepted() ) { 707 if ( currentEditor()->accepted() ) {
663 qWarning("Replacing now" );
664 handleAlarms( old_todo, todo ); 708 handleAlarms( old_todo, todo );
@@ -720,2 +764,6 @@ void MainWindow::slotComplete( const OTodo& todo ) {
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 */
@@ -736,2 +784,4 @@ void MainWindow::slotComplete( const OTodo& todo ) {
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;
@@ -749,5 +799,26 @@ void MainWindow::slotComplete( const OTodo& todo ) {
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 );
@@ -771,5 +842,6 @@ int MainWindow::create() {
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
@@ -806,3 +878,7 @@ bool MainWindow::remove( int uid ) {
806void MainWindow::beam( int uid) { 878void 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 );
@@ -819,5 +895,10 @@ void MainWindow::beam( int uid) {
819void MainWindow::show( int uid ) { 895void 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}
822void MainWindow::edit( int uid ) { 902void MainWindow::edit( int uid ) {
903 m_todoMgr.load();
823 slotEdit( uid ); 904 slotEdit( uid );
@@ -826,2 +907,3 @@ 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
@@ -839,2 +921,3 @@ void MainWindow::add( const OPimRecord& rec) {
839void MainWindow::slotReturnFromView() { 921void MainWindow::slotReturnFromView() {
922 m_showing = false;
840 raiseCurrentView(); 923 raiseCurrentView();
@@ -934,3 +1017,3 @@ void MainWindow::doAlarm( const QDateTime& dt, int uid ) {
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();
@@ -945,6 +1028,6 @@ void MainWindow::doAlarm( const QDateTime& dt, int uid ) {
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 }
@@ -952 +1035,2 @@ void MainWindow::doAlarm( const QDateTime& dt, int uid ) {
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
@@ -120,2 +120,3 @@ private slots:
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;
@@ -169,2 +170,3 @@ private slots:
169 void slotDelete(); 170 void slotDelete();
171 void slotDelete(int uid );
170 void slotDeleteAll(); 172 void slotDeleteAll();
@@ -187,2 +189,4 @@ private slots:
187 void slotShowDetails(); 189 void slotShowDetails();
190 void slotShowNext();
191 void slotShowPrev();
188 void slotShowDue( bool ); 192 void slotShowDue( bool );
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,3 +1,3 @@
1Package: opie-todo 1Package: opie-todo
2Files: bin/todolist apps/1Pim/todo.desktop pics/todo 2Files: bin/todolist apps/1Pim/todo.desktop
3Priority: optional 3Priority: optional
@@ -6,5 +6,5 @@ Maintainer: Holger 'zecke' Freyther <zecke@handhelds.org>
6Architecture: arm 6Architecture: arm
7Version: $QPE_VERSION-$SUB_VERSION 7Depends: task-opie-minimal, libopie1, opie-pics
8Depends: task-opie-minimal, libopie1
9Description: TODO-list manager 8Description: TODO-list manager
10 A Todo-list manager for the Opie environment. 9 A Todo-list manager for the Opie environment.
10Version: $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,5 +1,2 @@
1#include <qdatetime.h>
2#include <qlabel.h>
3#include <qlayout.h> 1#include <qlayout.h>
4#include <qmultilineedit.h>
5 2
@@ -28,2 +25,3 @@ 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 )
@@ -31,3 +29,2 @@ void OTaskEditor::init( int cur ) {
31 load(to); 29 load(to);
32 m_uid = 1; // generate a new one
33} 30}
@@ -35,3 +32,2 @@ void OTaskEditor::init( const OTodo& to ) {
35 load( to ); 32 load( to );
36 m_uid = to.uid();
37} 33}
@@ -39,4 +35,3 @@ 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 );
@@ -52,7 +47,8 @@ void OTaskEditor::load(const OTodo& 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}
56void OTaskEditor::init() { 52void OTaskEditor::init() {
57 setCaption("Task Editor"); 53 setCaption(tr("Task Editor") );
58 54
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
@@ -39,4 +39,3 @@ private:
39 ORecurranceWidget *m_rec; 39 ORecurranceWidget *m_rec;
40 int m_uid; 40 OTodo m_todo;
41
42}; 41};
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,2 +1 @@
1#include "mainwindow.h"
2#include "quickedit.h" #include "quickedit.h"
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
@@ -33,2 +33,6 @@ QuickEditImpl::QuickEditImpl( QWidget* parent, bool visible )
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 );
@@ -37,4 +41,5 @@ QuickEditImpl::QuickEditImpl( QWidget* parent, bool visible )
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() ) );
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
@@ -27,3 +27,2 @@
27*/ 27*/
28#include <qshared.h>
29 28
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
@@ -29,2 +29,3 @@
29#include <cmath> 29#include <cmath>
30#include <cctype>
30 31
@@ -33,3 +34,2 @@
33#include <qtimer.h> 34#include <qtimer.h>
34#include <qpoint.h>
35#include <qpopupmenu.h> 35#include <qpopupmenu.h>
@@ -52,2 +52,23 @@ namespace {
52 52
53TableView::EditorWidget::EditorWidget() : m_wid(0l), m_row(-1), m_col(-1) {
54}
55void TableView::EditorWidget::setCellWidget(QWidget* wid, int row, int col ) {
56 m_wid = wid;
57 m_row = row;
58 m_col = col;
59}
60void TableView::EditorWidget::releaseCellWidget() {
61 m_wid = 0;
62 m_row = m_col = -1;
63}
64QWidget* TableView::EditorWidget::cellWidget()const {
65 return m_wid;
66}
67int TableView::EditorWidget::cellRow()const {
68 return m_row;
69}
70int TableView::EditorWidget::cellCol()const {
71 return m_col;
72}
73
53 74
@@ -145,3 +166,3 @@ QString TableView::type() const {
145int TableView::current() { 166int 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() );
@@ -150,2 +171,15 @@ int TableView::current() {
150} 171}
172int 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}
178int 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}
151QString TableView::currentRepresentation() { 185QString TableView::currentRepresentation() {
@@ -221,3 +255,3 @@ void TableView::removeEvent( int ) {
221void TableView::setShowCompleted( bool b) { 255void TableView::setShowCompleted( bool b) {
222 qWarning("Show Completed %d" + b ); 256 qWarning("Show Completed %d" , b );
223 updateView(); 257 updateView();
@@ -225,3 +259,3 @@ void TableView::setShowCompleted( bool b) {
225void TableView::setShowDeadline( bool b ) { 259void TableView::setShowDeadline( bool b ) {
226 qWarning( "Show DeadLine %d" + b ); 260 qWarning( "Show DeadLine %d" , b );
227 if ( b ) 261 if ( b )
@@ -261,2 +295,9 @@ 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 ) )
@@ -282,3 +323,7 @@ void TableView::slotClicked(int row, int col, int,
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;
@@ -448,2 +493,3 @@ QWidget* TableView::createEditor(int row, int col, bool )const {
448void TableView::setCellContentFromEditor(int row, int col ) { 493void TableView::setCellContentFromEditor(int row, int col ) {
494 qWarning("set cell content from editor");
449 if ( col == 1 ) { 495 if ( col == 1 ) {
@@ -544,2 +590,18 @@ void TableView::contentsMouseMoveEvent( QMouseEvent* e ) {
544void TableView::keyPressEvent( QKeyEvent* event) { 590void 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() ) {
@@ -548,3 +610,14 @@ void TableView::keyPressEvent( QKeyEvent* event) {
548 case Qt::Key_Return: 610 case Qt::Key_Return:
549 showTodo( sorted().uidAt( currentRow() ) ); 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 ) {
618 showTodo( sorted().uidAt( currentRow() ) );
619 }else if ( col == 3 ) {
620 TodoView::edit( sorted().uidAt(row) );
621 }
622
550 break; 623 break;
@@ -554 +627,2 @@ void TableView::keyPressEvent( QKeyEvent* event) {
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
@@ -52,2 +52,4 @@ namespace Todo {
52 QString currentRepresentation(); 52 QString currentRepresentation();
53 int next();
54 int prev();
53 55
@@ -93,2 +95,18 @@ namespace Todo {
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
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
@@ -36,10 +36,5 @@
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
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
@@ -35,6 +35,4 @@
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>
@@ -70,3 +68,3 @@ TaskEditorOverView::TaskEditorOverView( QWidget* parent, const char* name, WFla
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 );
@@ -118,3 +116,3 @@ TaskEditorOverView::TaskEditorOverView( QWidget* parent, const char* name, WFla
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 );
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
@@ -35,4 +35,2 @@
35#include <qpe/datebookmonth.h> 35#include <qpe/datebookmonth.h>
36#include <qpe/resource.h>
37#include <qpe/timestring.h>
38 36
@@ -42,4 +40,2 @@
42#include <qlayout.h> 40#include <qlayout.h>
43#include <qscrollview.h>
44#include <qtoolbutton.h>
45#include <qwhatsthis.h> 41#include <qwhatsthis.h>
@@ -305,2 +301,3 @@ void TaskEditorStatus::slotDueChanged(int y, int m, int 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,2 +1 @@
1#include <qlistview.h>
2#include <qlineedit.h> #include <qlineedit.h>
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,2 +1 @@
1#include "mainwindow.h"
2#include "textviewshow.h" #include "textviewshow.h"
@@ -22,2 +21,18 @@ 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:
@@ -25,2 +40,3 @@ void TextViewShow::keyPressEvent( QKeyEvent* event ) {
25 case Qt::Key_Return: 40 case Qt::Key_Return:
41 case Qt::Key_Space:
26 escapeView(); 42 escapeView();
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
@@ -27,3 +27,2 @@
27*/ 27*/
28#include <qdatetime.h>
29#include <qpe/categoryselect.h> 28#include <qpe/categoryselect.h>
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
@@ -16 +16,9 @@ void TodoShow::escapeView() {
16 16
17void TodoShow::showNext() {
18 if (m_win)
19 m_win->slotShowNext();
20}
21void 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
@@ -52,2 +52,4 @@ namespace Todo {
52 void escapeView(); 52 void escapeView();
53 void showNext();
54 void showPrev();
53 private: 55 private:
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
@@ -66 +66,4 @@ void TodoView::complete( const OTodo& ev ) {
66} 66}
67void 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
@@ -55,2 +55,12 @@ namespace Todo {
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 /*
@@ -113,2 +123,4 @@ namespace Todo {
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 );