author | zecke <zecke> | 2002-04-23 12:45:20 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-04-23 12:45:20 (UTC) |
commit | e25c5384f3f3025be64ed26d244c59afc5862711 (patch) (unidiff) | |
tree | 603f32b0550ecda9cbe95a93807a2a89b32cabcd /core/pim | |
parent | 367304a610dd618ad45ddce8256ba4d7d8ded442 (diff) | |
download | opie-e25c5384f3f3025be64ed26d244c59afc5862711.zip opie-e25c5384f3f3025be64ed26d244c59afc5862711.tar.gz opie-e25c5384f3f3025be64ed26d244c59afc5862711.tar.bz2 |
Patch from Stefan Eilers for overview
merged by hand
-rw-r--r-- | core/pim/todo/TODO | 3 | ||||
-rw-r--r-- | core/pim/todo/mainwindow.cpp | 68 | ||||
-rw-r--r-- | core/pim/todo/mainwindow.h | 16 | ||||
-rw-r--r-- | core/pim/todo/opie-todo.control | 2 | ||||
-rw-r--r-- | core/pim/todo/todo.pro | 6 | ||||
-rw-r--r-- | core/pim/todo/todolabel.cc | 58 | ||||
-rw-r--r-- | core/pim/todo/todolabel.h | 51 | ||||
-rw-r--r-- | core/pim/todo/todotable.cpp | 24 | ||||
-rw-r--r-- | core/pim/todo/todotable.h | 2 |
9 files changed, 202 insertions, 28 deletions
diff --git a/core/pim/todo/TODO b/core/pim/todo/TODO index 7601dd2..b00450c 100644 --- a/core/pim/todo/TODO +++ b/core/pim/todo/TODO | |||
@@ -1,4 +1 @@ | |||
1 | -fix the journal (wip ) | ||
2 | -fix day wrapping update all DueDateItems | ||
3 | -when checking the C. box update the deadline | -when checking the C. box update the deadline | |
4 | -TodoLabel : public TextView | ||
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp index fc17c5f..d3f4cb4 100644 --- a/core/pim/todo/mainwindow.cpp +++ b/core/pim/todo/mainwindow.cpp | |||
@@ -1,8 +1,8 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | Copyright (C) 2002 zecke | 3 | ** Copyright (C) 2002 zecke |
4 | Copyright (C) 2002 Stefan Eilers | 4 | ** Copyright (C) 2002 Stefan Eilers (se, eilers.stefan@epost.de) |
5 | ** | 5 | ** |
6 | ** This file is part of Qtopia Environment. | 6 | ** This file is part of Qtopia Environment. |
7 | ** | 7 | ** |
8 | ** This file may be distributed and/or modified under the terms of the | 8 | ** This file may be distributed and/or modified under the terms of the |
@@ -24,8 +24,9 @@ | |||
24 | 24 | ||
25 | #include "mainwindow.h" | 25 | #include "mainwindow.h" |
26 | #include "todoentryimpl.h" | 26 | #include "todoentryimpl.h" |
27 | #include "todotable.h" | 27 | #include "todotable.h" |
28 | #include "todolabel.h" | ||
28 | 29 | ||
29 | #include <opie/tododb.h> | 30 | #include <opie/tododb.h> |
30 | #include <opie/todovcalresource.h> | 31 | #include <opie/todovcalresource.h> |
31 | #include <opie/ofontmenu.h> | 32 | #include <opie/ofontmenu.h> |
@@ -47,8 +48,9 @@ | |||
47 | #include <qdatetime.h> | 48 | #include <qdatetime.h> |
48 | #include <qfile.h> | 49 | #include <qfile.h> |
49 | #include <qmessagebox.h> | 50 | #include <qmessagebox.h> |
50 | #include <qpopupmenu.h> | 51 | #include <qpopupmenu.h> |
52 | #include <qwidgetstack.h> | ||
51 | 53 | ||
52 | #include <sys/stat.h> | 54 | #include <sys/stat.h> |
53 | #include <sys/types.h> | 55 | #include <sys/types.h> |
54 | #include <fcntl.h> | 56 | #include <fcntl.h> |
@@ -70,9 +72,10 @@ TodoWindow::TodoWindow( QWidget *parent, const char *name, WFlags f = 0 ) : | |||
70 | QMainWindow( parent, name, f ), syncing(FALSE) | 72 | QMainWindow( parent, name, f ), syncing(FALSE) |
71 | { | 73 | { |
72 | // QTime t; | 74 | // QTime t; |
73 | // t.start(); | 75 | // t.start(); |
74 | 76 | mView = 0l; | |
77 | mStack = new QWidgetStack(this, "main stack"); | ||
75 | setCaption( tr("Todo") ); | 78 | setCaption( tr("Todo") ); |
76 | QString str; | 79 | QString str; |
77 | table = new TodoTable( this ); | 80 | table = new TodoTable( this ); |
78 | table->setColumnWidth( 2, 10 ); | 81 | table->setColumnWidth( 2, 10 ); |
@@ -100,9 +103,11 @@ TodoWindow::TodoWindow( QWidget *parent, const char *name, WFlags f = 0 ) : | |||
100 | tr( "Unable to create startup files\n" | 103 | tr( "Unable to create startup files\n" |
101 | "Free up some space\n" | 104 | "Free up some space\n" |
102 | "before you enter any data") ); | 105 | "before you enter any data") ); |
103 | 106 | ||
104 | setCentralWidget( table ); | 107 | mStack->addWidget(table, 1 ); |
108 | mStack->raiseWidget( 1 ); | ||
109 | setCentralWidget( mStack ); | ||
105 | setToolBarsMovable( FALSE ); | 110 | setToolBarsMovable( FALSE ); |
106 | 111 | ||
107 | // qDebug("after load: t=%d", t.elapsed() ); | 112 | // qDebug("after load: t=%d", t.elapsed() ); |
108 | 113 | ||
@@ -145,8 +150,15 @@ TodoWindow::TodoWindow( QWidget *parent, const char *name, WFlags f = 0 ) : | |||
145 | a->addTo( edit ); | 150 | a->addTo( edit ); |
146 | a->addTo( contextMenu ); | 151 | a->addTo( contextMenu ); |
147 | a->setEnabled( FALSE ); | 152 | a->setEnabled( FALSE ); |
148 | editAction = a; | 153 | editAction = a; |
154 | |||
155 | a = new QAction( QString::null, tr("View Task"), 0, this, 0 ); | ||
156 | a->addTo( edit ); | ||
157 | a->addTo( contextMenu ); | ||
158 | connect( a, SIGNAL( activated() ), | ||
159 | this, SLOT(slotShowDetails() ) ); | ||
160 | |||
149 | edit->insertSeparator(); | 161 | edit->insertSeparator(); |
150 | 162 | ||
151 | a = new QAction( tr( "Delete..." ), Resource::loadIconSet( "trash" ), | 163 | a = new QAction( tr( "Delete..." ), Resource::loadIconSet( "trash" ), |
152 | QString::null, 0, this, 0 ); | 164 | QString::null, 0, this, 0 ); |
@@ -175,10 +187,12 @@ TodoWindow::TodoWindow( QWidget *parent, const char *name, WFlags f = 0 ) : | |||
175 | this, SLOT( slotDuplicate() ) ); | 187 | this, SLOT( slotDuplicate() ) ); |
176 | a->addTo(edit ); | 188 | a->addTo(edit ); |
177 | a->setEnabled( FALSE ); | 189 | a->setEnabled( FALSE ); |
178 | duplicateAction = a; | 190 | duplicateAction = a; |
179 | |||
180 | edit->insertSeparator(); | 191 | edit->insertSeparator(); |
192 | |||
193 | |||
194 | |||
181 | if ( Ir::supported() ) { | 195 | if ( Ir::supported() ) { |
182 | a = new QAction( tr( "Beam" ), Resource::loadPixmap( "beam" ), | 196 | a = new QAction( tr( "Beam" ), Resource::loadPixmap( "beam" ), |
183 | QString::null, 0, this, 0 ); | 197 | QString::null, 0, this, 0 ); |
184 | connect( a, SIGNAL( activated() ), | 198 | connect( a, SIGNAL( activated() ), |
@@ -248,8 +262,10 @@ TodoWindow::TodoWindow( QWidget *parent, const char *name, WFlags f = 0 ) : | |||
248 | connect( catMenu, SIGNAL(activated(int)), this, SLOT(setCategory(int)) ); | 262 | connect( catMenu, SIGNAL(activated(int)), this, SLOT(setCategory(int)) ); |
249 | connect( table, SIGNAL( currentChanged( int, int ) ), | 263 | connect( table, SIGNAL( currentChanged( int, int ) ), |
250 | this, SLOT( currentEntryChanged( int, int ) ) ); | 264 | this, SLOT( currentEntryChanged( int, int ) ) ); |
251 | 265 | ||
266 | connect( table, SIGNAL(showDetails(const ToDoEvent &) ), | ||
267 | this, SLOT(slotShowDetails(const ToDoEvent & ) ) ); | ||
252 | // qDebug("done: t=%d", t.elapsed() ); | 268 | // qDebug("done: t=%d", t.elapsed() ); |
253 | } | 269 | } |
254 | 270 | ||
255 | void TodoWindow::slotNew() | 271 | void TodoWindow::slotNew() |
@@ -285,8 +301,9 @@ void TodoWindow::slotNew() | |||
285 | } | 301 | } |
286 | // I'm afraid we must call this every time now, otherwise | 302 | // I'm afraid we must call this every time now, otherwise |
287 | // spend expensive time comparing all these strings... | 303 | // spend expensive time comparing all these strings... |
288 | populateCategories(); | 304 | populateCategories(); |
305 | mStack->raiseWidget(1 ); | ||
289 | } | 306 | } |
290 | 307 | ||
291 | TodoWindow::~TodoWindow() | 308 | TodoWindow::~TodoWindow() |
292 | { | 309 | { |
@@ -317,8 +334,9 @@ void TodoWindow::slotDelete() | |||
317 | if ( table->numRows() == 0 ) { | 334 | if ( table->numRows() == 0 ) { |
318 | currentEntryChanged( -1, 0 ); | 335 | currentEntryChanged( -1, 0 ); |
319 | findAction->setEnabled( FALSE ); | 336 | findAction->setEnabled( FALSE ); |
320 | } | 337 | } |
338 | mStack->raiseWidget(1); | ||
321 | } | 339 | } |
322 | void TodoWindow::slotDeleteAll() | 340 | void TodoWindow::slotDeleteAll() |
323 | { | 341 | { |
324 | if(syncing) { | 342 | if(syncing) { |
@@ -328,9 +346,9 @@ void TodoWindow::slotDeleteAll() | |||
328 | } | 346 | } |
329 | 347 | ||
330 | //QString strName = table->text( table->currentRow(), 2 ).left( 30 ); | 348 | //QString strName = table->text( table->currentRow(), 2 ).left( 30 ); |
331 | 349 | ||
332 | if ( !QPEMessageBox::confirmDelete( this, tr( "Todo" ), tr("Should I delete all tasks?") ) ) | 350 | if ( !QPEMessageBox::confirmDelete( this, tr( "Todo" ), tr("Delete all tasks?") ) ) |
333 | return; | 351 | return; |
334 | 352 | ||
335 | 353 | ||
336 | 354 | ||
@@ -341,8 +359,9 @@ void TodoWindow::slotDeleteAll() | |||
341 | if ( table->numRows() == 0 ) { | 359 | if ( table->numRows() == 0 ) { |
342 | currentEntryChanged( -1, 0 ); | 360 | currentEntryChanged( -1, 0 ); |
343 | findAction->setEnabled( FALSE ); | 361 | findAction->setEnabled( FALSE ); |
344 | } | 362 | } |
363 | mStack->raiseWidget(1 ); | ||
345 | } | 364 | } |
346 | 365 | ||
347 | void TodoWindow::slotEdit() | 366 | void TodoWindow::slotEdit() |
348 | { | 367 | { |
@@ -368,9 +387,9 @@ void TodoWindow::slotEdit() | |||
368 | table->replaceCurrentEntry( todo ); | 387 | table->replaceCurrentEntry( todo ); |
369 | table->setPaintingEnabled( true ); | 388 | table->setPaintingEnabled( true ); |
370 | } | 389 | } |
371 | populateCategories(); | 390 | populateCategories(); |
372 | 391 | mStack->raiseWidget( 1 ); | |
373 | } | 392 | } |
374 | void TodoWindow::slotDuplicate() | 393 | void TodoWindow::slotDuplicate() |
375 | { | 394 | { |
376 | if(syncing) { | 395 | if(syncing) { |
@@ -378,12 +397,21 @@ void TodoWindow::slotDuplicate() | |||
378 | tr("Can not edit data, currently syncing")); | 397 | tr("Can not edit data, currently syncing")); |
379 | return; | 398 | return; |
380 | } | 399 | } |
381 | ToDoEvent ev = table->currentEntry(); | 400 | ToDoEvent ev = table->currentEntry(); |
382 | ToDoEvent ev2 = ToDoEvent( ev ); | 401 | ToDoEvent ev2 = ToDoEvent( ev ); // what about the uid |
402 | int uid; | ||
403 | { // uid | ||
404 | Qtopia::UidGen *uidgen = new Qtopia::UidGen(); | ||
405 | uid = uidgen->generate(); | ||
406 | delete uidgen; | ||
407 | } | ||
408 | ev2.setUid( uid ); | ||
383 | table->setPaintingEnabled( false ); | 409 | table->setPaintingEnabled( false ); |
384 | table->addEntry( ev2 ); | 410 | table->addEntry( ev2 ); |
385 | table->setPaintingEnabled( true ); | 411 | table->setPaintingEnabled( true ); |
412 | |||
413 | mStack->raiseWidget( 1 ); | ||
386 | } | 414 | } |
387 | void TodoWindow::slotShowPopup( const QPoint &p ) | 415 | void TodoWindow::slotShowPopup( const QPoint &p ) |
388 | { | 416 | { |
389 | contextMenu->popup( p ); | 417 | contextMenu->popup( p ); |
@@ -432,15 +460,18 @@ void TodoWindow::setCategory( int c ) | |||
432 | table->setShowCategory( cat ); | 460 | table->setShowCategory( cat ); |
433 | setCaption( tr("Todo") + " - " + cat ); | 461 | setCaption( tr("Todo") + " - " + cat ); |
434 | } | 462 | } |
435 | table->setPaintingEnabled( true ); | 463 | table->setPaintingEnabled( true ); |
464 | |||
465 | mStack->raiseWidget( 1 ); | ||
436 | } | 466 | } |
437 | 467 | ||
438 | void TodoWindow::populateCategories() | 468 | void TodoWindow::populateCategories() |
439 | { | 469 | { |
440 | catMenu->clear(); | 470 | catMenu->clear(); |
441 | int id, rememberId; | 471 | int id, rememberId; |
442 | id = 1; | 472 | id = 1; |
473 | rememberId = 0; | ||
443 | catMenu->insertItem( tr( "All Categories" ), id++ ); | 474 | catMenu->insertItem( tr( "All Categories" ), id++ ); |
444 | catMenu->insertSeparator(); | 475 | catMenu->insertSeparator(); |
445 | QStringList categories = table->categories(); | 476 | QStringList categories = table->categories(); |
446 | categories.append( tr( "Unfiled" ) ); | 477 | categories.append( tr( "Unfiled" ) ); |
@@ -471,8 +502,13 @@ void TodoWindow::flush() | |||
471 | } | 502 | } |
472 | 503 | ||
473 | void TodoWindow::closeEvent( QCloseEvent *e ) | 504 | void TodoWindow::closeEvent( QCloseEvent *e ) |
474 | { | 505 | { |
506 | if( mStack->visibleWidget() != table ){ | ||
507 | mStack->raiseWidget( 1 ); | ||
508 | e->ignore(); | ||
509 | return; | ||
510 | } | ||
475 | if(syncing) { | 511 | if(syncing) { |
476 | /* no need to save if in the middle of syncing */ | 512 | /* no need to save if in the middle of syncing */ |
477 | e->accept(); | 513 | e->accept(); |
478 | return; | 514 | return; |
@@ -561,11 +597,25 @@ void TodoWindow::beamDone( Ir *ir ) | |||
561 | delete ir; | 597 | delete ir; |
562 | unlink( beamfile ); | 598 | unlink( beamfile ); |
563 | } | 599 | } |
564 | 600 | ||
565 | /* added 20.01.2k2 by se */ | ||
566 | void TodoWindow::showDeadline( bool s ) | 601 | void TodoWindow::showDeadline( bool s ) |
567 | { | 602 | { |
568 | table->setPaintingEnabled( false ); | 603 | table->setPaintingEnabled( false ); |
569 | table->setShowDeadline( s ); | 604 | table->setShowDeadline( s ); |
570 | table->setPaintingEnabled( true ); | 605 | table->setPaintingEnabled( true ); |
571 | } | 606 | } |
607 | void TodoWindow::slotShowDetails() | ||
608 | { | ||
609 | ToDoEvent event = table->currentEntry(); | ||
610 | slotShowDetails( event ); | ||
611 | } | ||
612 | void TodoWindow::slotShowDetails( const ToDoEvent &event ) | ||
613 | { | ||
614 | if( mView == 0l ){ | ||
615 | mView = new TodoLabel(mStack); | ||
616 | mStack->addWidget( mView, 2 ); | ||
617 | } | ||
618 | mView->init( event ); | ||
619 | mView->sync(); | ||
620 | mStack->raiseWidget( 2); | ||
621 | } | ||
diff --git a/core/pim/todo/mainwindow.h b/core/pim/todo/mainwindow.h index b9172e1..f62ec6e 100644 --- a/core/pim/todo/mainwindow.h +++ b/core/pim/todo/mainwindow.h | |||
@@ -1,6 +1,7 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | Copyright (C) 2002 Holger 'zecke' Freyther <freyther@kde.org> | 2 | ** Copyright (C) 2002 Holger 'zecke' Freyther <freyther@kde.org> |
3 | ** Copyright (C) 2002 by Stefan Eilers (se, eilers.stefan@epost.de) | ||
3 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 4 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
4 | ** | 5 | ** |
5 | ** This file is part of Qtopia and Opi Environment. | 6 | ** This file is part of Qtopia and Opi Environment. |
6 | ** | 7 | ** |
@@ -28,8 +29,12 @@ class TodoTable; | |||
28 | class QAction; | 29 | class QAction; |
29 | class QPopupMenu; | 30 | class QPopupMenu; |
30 | class Ir; | 31 | class Ir; |
31 | class OFontMenu; | 32 | class OFontMenu; |
33 | class TodoLabel; | ||
34 | class ToDoDB; | ||
35 | class QWidgetStack; | ||
36 | class ToDoEvent; | ||
32 | 37 | ||
33 | class TodoWindow : public QMainWindow | 38 | class TodoWindow : public QMainWindow |
34 | { | 39 | { |
35 | Q_OBJECT | 40 | Q_OBJECT |
@@ -48,11 +53,13 @@ protected slots: | |||
48 | void slotEdit(); | 53 | void slotEdit(); |
49 | void slotShowPopup( const QPoint & ); | 54 | void slotShowPopup( const QPoint & ); |
50 | void showCompleted( bool ); | 55 | void showCompleted( bool ); |
51 | 56 | ||
52 | /* added 20.01.2k2 by se */ | ||
53 | void showDeadline( bool ); | 57 | void showDeadline( bool ); |
54 | 58 | ||
59 | void slotShowDetails(const ToDoEvent &event ); | ||
60 | void slotShowDetails(); | ||
61 | |||
55 | void currentEntryChanged( int r, int c ); | 62 | void currentEntryChanged( int r, int c ); |
56 | void setCategory( int ); | 63 | void setCategory( int ); |
57 | void slotFind(); | 64 | void slotFind(); |
58 | void setDocument( const QString & ); | 65 | void setDocument( const QString & ); |
@@ -65,19 +72,22 @@ protected: | |||
65 | void closeEvent( QCloseEvent *e ); | 72 | void closeEvent( QCloseEvent *e ); |
66 | 73 | ||
67 | private: | 74 | private: |
68 | void populateCategories(); | 75 | void populateCategories(); |
76 | //inline void switchToTable(); // move back to the normal view | ||
69 | 77 | ||
70 | private: | 78 | private: |
71 | TodoTable *table; | 79 | TodoTable *table; |
80 | TodoLabel *mView; | ||
72 | QAction *editAction, | 81 | QAction *editAction, |
73 | *deleteAction, | 82 | *deleteAction, |
74 | *findAction, | 83 | *findAction, |
75 | *completedAction, | 84 | *completedAction, |
76 | *showdeadlineAction, | 85 | *showdeadlineAction, |
77 | *deleteAllAction, | 86 | *deleteAllAction, |
78 | *duplicateAction; | 87 | *duplicateAction; |
79 | QPopupMenu *contextMenu, *catMenu; | 88 | QPopupMenu *contextMenu, *catMenu; |
89 | QWidgetStack *mStack; | ||
80 | 90 | ||
81 | bool syncing; | 91 | bool syncing; |
82 | }; | 92 | }; |
83 | 93 | ||
diff --git a/core/pim/todo/opie-todo.control b/core/pim/todo/opie-todo.control index cb9b110..71929af 100644 --- a/core/pim/todo/opie-todo.control +++ b/core/pim/todo/opie-todo.control | |||
@@ -1,8 +1,8 @@ | |||
1 | Files: bin/todolist apps/Applications/todo.desktop | 1 | Files: bin/todolist apps/Applications/todo.desktop |
2 | Priority: optional | 2 | Priority: optional |
3 | Section: opie/applications | 3 | Section: opie/applications |
4 | Maintainer: Warwick Allison <warwick@trolltech.com> | 4 | Maintainer: Holger 'zecke' Freyther <zecke@handhelds.org> |
5 | Architecture: arm | 5 | Architecture: arm |
6 | Version: $QPE_VERSION-$SUB_VERSION | 6 | Version: $QPE_VERSION-$SUB_VERSION |
7 | Depends: opie-base ($QPE_VERSION) | 7 | Depends: opie-base ($QPE_VERSION) |
8 | Description: TODO-list manager | 8 | Description: TODO-list manager |
diff --git a/core/pim/todo/todo.pro b/core/pim/todo/todo.pro index a46fb47..a365081 100644 --- a/core/pim/todo/todo.pro +++ b/core/pim/todo/todo.pro | |||
@@ -2,13 +2,15 @@ TEMPLATE = app | |||
2 | CONFIG = qt warn_on release | 2 | CONFIG = qt warn_on release |
3 | DESTDIR = $(OPIEDIR)/bin | 3 | DESTDIR = $(OPIEDIR)/bin |
4 | HEADERS= mainwindow.h \ | 4 | HEADERS= mainwindow.h \ |
5 | todotable.h \ | 5 | todotable.h \ |
6 | todoentryimpl.h | 6 | todoentryimpl.h \ |
7 | todolabel.h | ||
7 | SOURCES= main.cpp \ | 8 | SOURCES= main.cpp \ |
8 | mainwindow.cpp \ | 9 | mainwindow.cpp \ |
9 | todotable.cpp \ | 10 | todotable.cpp \ |
10 | todoentryimpl.cpp | 11 | todoentryimpl.cpp \ |
12 | todolabel.cc | ||
11 | 13 | ||
12 | INTERFACES= todoentry.ui | 14 | INTERFACES= todoentry.ui |
13 | 15 | ||
14 | TARGET = todolist | 16 | TARGET = todolist |
diff --git a/core/pim/todo/todolabel.cc b/core/pim/todo/todolabel.cc new file mode 100644 index 0000000..4ce3499 --- a/dev/null +++ b/core/pim/todo/todolabel.cc | |||
@@ -0,0 +1,58 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2002 by Stefan Eilers (se, eilers.stefan@epost.de) | ||
3 | ** Copyright (C) 2002 Holger 'zecke' Freyther <freyther@kde.org> | ||
4 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | ||
5 | ** | ||
6 | ** This file is part of the Qtopia Environment. | ||
7 | ** | ||
8 | ** This file may be distributed and/or modified under the terms of the | ||
9 | ** GNU General Public License version 2 as published by the Free Software | ||
10 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
11 | ** packaging of this file. | ||
12 | ** | ||
13 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | ||
14 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
15 | ** | ||
16 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
17 | ** | ||
18 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
19 | ** not clear to you. | ||
20 | ** | ||
21 | **********************************************************************/ | ||
22 | |||
23 | |||
24 | |||
25 | #include <qpe/stringutil.h> | ||
26 | |||
27 | #include <qregexp.h> | ||
28 | #include <qstylesheet.h> | ||
29 | |||
30 | |||
31 | #include "todolabel.h" | ||
32 | |||
33 | TodoLabel::TodoLabel( QWidget *parent, const char *name ) | ||
34 | : QTextView( parent, name ) | ||
35 | { | ||
36 | } | ||
37 | |||
38 | TodoLabel::~TodoLabel() | ||
39 | { | ||
40 | } | ||
41 | |||
42 | void TodoLabel::init( const ToDoEvent &item ) | ||
43 | { | ||
44 | m_item = item; | ||
45 | } | ||
46 | |||
47 | void TodoLabel::sync() | ||
48 | { | ||
49 | QString text = m_item.richText(); | ||
50 | setText( text ); | ||
51 | } | ||
52 | |||
53 | void TodoLabel::keyPressEvent( QKeyEvent *e ) | ||
54 | { | ||
55 | if ( e->key() == Qt::Key_F33 ) { | ||
56 | emit okPressed(); | ||
57 | } | ||
58 | } | ||
diff --git a/core/pim/todo/todolabel.h b/core/pim/todo/todolabel.h new file mode 100644 index 0000000..b6d67af --- a/dev/null +++ b/core/pim/todo/todolabel.h | |||
@@ -0,0 +1,51 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2002 by Stefan Eilers (se, eilers.stefan@epost.de) | ||
3 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | ||
4 | ** | ||
5 | ** This file is part of the Qtopia Environment. | ||
6 | ** | ||
7 | ** This file may be distributed and/or modified under the terms of the | ||
8 | ** GNU General Public License version 2 as published by the Free Software | ||
9 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
10 | ** packaging of this file. | ||
11 | ** | ||
12 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | ||
13 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
14 | ** | ||
15 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
16 | ** | ||
17 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
18 | ** not clear to you. | ||
19 | ** | ||
20 | **********************************************************************/ | ||
21 | #ifndef TODOLABEL_H | ||
22 | #define TODOLABEL_H | ||
23 | |||
24 | #include <opie/todoevent.h> | ||
25 | |||
26 | #include <qtextview.h> | ||
27 | |||
28 | class TodoLabel : public QTextView | ||
29 | { | ||
30 | Q_OBJECT | ||
31 | |||
32 | public: | ||
33 | TodoLabel( QWidget *parent, const char *name = 0 ); | ||
34 | ~TodoLabel(); | ||
35 | |||
36 | public slots: | ||
37 | void init( const ToDoEvent &item); | ||
38 | void sync(); | ||
39 | |||
40 | signals: | ||
41 | void okPressed(); | ||
42 | |||
43 | protected: | ||
44 | void keyPressEvent( QKeyEvent * ); | ||
45 | |||
46 | private: | ||
47 | ToDoEvent m_item; | ||
48 | |||
49 | }; | ||
50 | |||
51 | #endif | ||
diff --git a/core/pim/todo/todotable.cpp b/core/pim/todo/todotable.cpp index d0bc61c..753c036 100644 --- a/core/pim/todo/todotable.cpp +++ b/core/pim/todo/todotable.cpp | |||
@@ -304,17 +304,23 @@ void TodoTable::slotClicked( int row, int col, int, const QPoint &pos ) | |||
304 | break; | 304 | break; |
305 | case 1: | 305 | case 1: |
306 | break; | 306 | break; |
307 | case 2: | 307 | case 2: |
308 | // may as well edit it... | 308 | // may as well edit it... |
309 | // menuTimer->stop(); | 309 | // menuTimer->stop(); |
310 | // emit signalEdit(); | 310 | // emit signalEdit(); |
311 | // fall through | 311 | // Show detailed view of the selected entry |
312 | case 3: | 312 | { |
313 | // may as well edit it... | ||
314 | menuTimer->stop(); | 313 | menuTimer->stop(); |
315 | // emit signalEdit(); | 314 | ToDoEvent *todo = todoList[static_cast<CheckItem*>(item(row, 0))]; |
316 | break; | 315 | emit showDetails( *todo ); |
316 | } | ||
317 | break; | ||
318 | case 3: | ||
319 | // may as well edit it... | ||
320 | menuTimer->stop(); | ||
321 | // emit signalEdit(); | ||
322 | break; | ||
317 | } | 323 | } |
318 | } | 324 | } |
319 | 325 | ||
320 | void TodoTable::slotPressed( int row, int col, int, const QPoint &pos ) | 326 | void TodoTable::slotPressed( int row, int col, int, const QPoint &pos ) |
@@ -344,9 +350,9 @@ void TodoTable::internalAddEntries( QList<ToDoEvent> &list ) | |||
344 | 350 | ||
345 | 351 | ||
346 | ToDoEvent TodoTable::currentEntry() const | 352 | ToDoEvent TodoTable::currentEntry() const |
347 | { | 353 | { |
348 | printf ("in currentEntry\n"); | 354 | //qWarning ("in currentEntry\n"); |
349 | 355 | ||
350 | QTableItem *i = item( currentRow(), 0 ); | 356 | QTableItem *i = item( currentRow(), 0 ); |
351 | if ( !i || rowHeight( currentRow() ) <= 0 ) | 357 | if ( !i || rowHeight( currentRow() ) <= 0 ) |
352 | return ToDoEvent(); | 358 | return ToDoEvent(); |
diff --git a/core/pim/todo/todotable.h b/core/pim/todo/todotable.h index 458e07a..2f6e635 100644 --- a/core/pim/todo/todotable.h +++ b/core/pim/todo/todotable.h | |||
@@ -141,9 +141,9 @@ signals: | |||
141 | void signalPriorityChanged( int i ); | 141 | void signalPriorityChanged( int i ); |
142 | void signalShowMenu( const QPoint & ); | 142 | void signalShowMenu( const QPoint & ); |
143 | void signalNotFound(); | 143 | void signalNotFound(); |
144 | void signalWrapAround(); | 144 | void signalWrapAround(); |
145 | 145 | void showDetails( const ToDoEvent & ); | |
146 | protected: | 146 | protected: |
147 | void keyPressEvent( QKeyEvent *e ); | 147 | void keyPressEvent( QKeyEvent *e ); |
148 | 148 | ||
149 | private: | 149 | private: |