summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/todo/main.cpp48
-rw-r--r--core/pim/todo/mainwindow.cpp47
-rw-r--r--core/pim/todo/mainwindow.h48
-rw-r--r--core/pim/todo/newtaskdlg.cpp56
-rw-r--r--core/pim/todo/newtaskdlg.h46
-rw-r--r--core/pim/todo/otaskeditor.cpp30
-rw-r--r--core/pim/todo/otaskeditor.h30
-rw-r--r--core/pim/todo/quickedit.cpp30
-rw-r--r--core/pim/todo/quickedit.h30
-rw-r--r--core/pim/todo/quickeditimpl.cpp48
-rw-r--r--core/pim/todo/quickeditimpl.h30
-rw-r--r--core/pim/todo/smalltodo.cpp46
-rw-r--r--core/pim/todo/smalltodo.h46
-rw-r--r--core/pim/todo/tableview.cpp55
-rw-r--r--core/pim/todo/tableview.h46
-rw-r--r--core/pim/todo/taskeditoralarms.cpp57
-rw-r--r--core/pim/todo/taskeditoralarms.h46
-rw-r--r--core/pim/todo/taskeditoroverview.cpp51
-rw-r--r--core/pim/todo/taskeditoroverview.h46
-rw-r--r--core/pim/todo/taskeditorstatus.cpp46
-rw-r--r--core/pim/todo/taskeditorstatus.h46
-rw-r--r--core/pim/todo/templatedialog.cpp30
-rw-r--r--core/pim/todo/templatedialog.h30
-rw-r--r--core/pim/todo/templatedialogimpl.cpp30
-rw-r--r--core/pim/todo/templatedialogimpl.h30
-rw-r--r--core/pim/todo/textviewshow.cpp30
-rw-r--r--core/pim/todo/textviewshow.h30
-rw-r--r--core/pim/todo/todoedit.h30
-rw-r--r--core/pim/todo/todoeditor.cpp30
-rw-r--r--core/pim/todo/todoeditor.h30
-rw-r--r--core/pim/todo/todomanager.cpp46
-rw-r--r--core/pim/todo/todomanager.h46
-rw-r--r--core/pim/todo/todoshow.cpp29
-rw-r--r--core/pim/todo/todoshow.h47
-rw-r--r--core/pim/todo/todotemplate.h31
-rw-r--r--core/pim/todo/todotemplatemanager.cpp30
-rw-r--r--core/pim/todo/todotemplatemanager.h30
-rw-r--r--core/pim/todo/todoview.cpp30
-rw-r--r--core/pim/todo/todoview.h46
39 files changed, 1092 insertions, 441 deletions
diff --git a/core/pim/todo/main.cpp b/core/pim/todo/main.cpp
index a336ba3..e12326e 100644
--- a/core/pim/todo/main.cpp
+++ b/core/pim/todo/main.cpp
@@ -1,47 +1,57 @@
1/********************************************************************** 1/*
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2                 This file is part of the Opie Project
3** 3
4** This file is part of Qtopia Environment. 4 Copyright (C) Opie Team <opie-devel@handhelds.org>
5** 5 =.
6** This file may be distributed and/or modified under the terms of the 6 .=l.
7** GNU General Public License version 2 as published by the Free Software 7           .>+-=
8** Foundation and appearing in the file LICENSE.GPL included in the 8 _;:,     .>    :=|. This program is free software; you can
9** packaging of this file. 9.> <`_,   >  .   <= redistribute it and/or modify it under
10** 10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11.="- .-=="i,     .._ License as published by the Free Software
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13** 13     ._= =}       : or (at your option) any later version.
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14    .%`+i>       _;_.
15** 15    .i_,=:_.      -<s. This program is distributed in the hope that
16** Contact info@trolltech.com if any conditions of this licensing are 16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17** not clear to you. 17 : ..    .:,     . . . without even the implied warranty of
18** 18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19**********************************************************************/ 19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20..}^=.=       =       ; Library General Public License for more
21++=   -.     .`     .: details.
22:     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA.
29*/
20 30
21#include "mainwindow.h" 31#include "mainwindow.h"
22 32
23#include <opie2/odebug.h> 33#include <opie2/odebug.h>
24 34
25#include <qpe/qpeapplication.h> 35#include <qpe/qpeapplication.h>
26 36
27void myMessages( QtMsgType, const char* ) { 37void myMessages( QtMsgType, const char* ) {
28 38
29} 39}
30 40
31int main( int argc, char **argv ) 41int main( int argc, char **argv )
32{ 42{
33 qInstallMsgHandler( myMessages ); 43 qInstallMsgHandler( myMessages );
34 QPEApplication a( argc, argv ); 44 QPEApplication a( argc, argv );
35 45
36 QTime time; 46 QTime time;
37 time.start(); 47 time.start();
38 Todo::MainWindow mw; 48 Todo::MainWindow mw;
39 int t = time.elapsed(); 49 int t = time.elapsed();
40 mw.setCaption( QObject::tr("Opie Todolist")); 50 mw.setCaption( QObject::tr("Opie Todolist"));
41 QObject::connect( &a, SIGNAL( flush() ), &mw, SLOT( slotFlush() ) ); 51 QObject::connect( &a, SIGNAL( flush() ), &mw, SLOT( slotFlush() ) );
42 QObject::connect( &a, SIGNAL( reload() ), &mw, SLOT( slotReload() ) ); 52 QObject::connect( &a, SIGNAL( reload() ), &mw, SLOT( slotReload() ) );
43 53
44 a.showMainWidget(&mw); 54 a.showMainWidget(&mw);
45 55
46 return a.exec(); 56 return a.exec();
47} 57}
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp
index 9013522..b6ee16f 100644
--- a/core/pim/todo/mainwindow.cpp
+++ b/core/pim/todo/mainwindow.cpp
@@ -1,136 +1,137 @@
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
4 .>+-= 4 Copyright (C) Opie Team <opie-devel@handhelds.org>
5_;:, .> :=|. This program is free software; you can 5 =.
6.> <`_, > . <= redistribute it and/or modify it under 6 .=l.
7:`=1 )Y*s>-.-- : the terms of the GNU General Public 7           .>+-=
8.="- .-=="i, .._ License as published by the Free Software 8 _;:,     .>    :=|. This program is free software; you can
9- . .-<_> .<> Foundation; either version 2 of the License, 9.> <`_,   >  .   <= redistribute it and/or modify it under
10 ._= =} : or (at your option) any later version. 10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11 .%`+i> _;_. 11.="- .-=="i,     .._ License as published by the Free Software
12 .i_,=:_. -<s. This program is distributed in the hope that 12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13 + . -:. = it will be useful, but WITHOUT ANY WARRANTY; 13     ._= =}       : or (at your option) any later version.
14 : .. .:, . . . without even the implied warranty of 14    .%`+i>       _;_.
15 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A 15    .i_,=:_.      -<s. This program is distributed in the hope that
16 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU 16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17..}^=.= = ; Library General Public License for more 17 : ..    .:,     . . . without even the implied warranty of
18++= -. .` .: details. 18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19: = ...= . :.=- 19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20-. .:....=;==+<; You should have received a copy of the GNU 20..}^=.=       =       ; Library General Public License for more
21 -_. . . )=. = General Public License along with 21++=   -.     .`     .: details.
22 -- :-=` this library; see the file COPYING.LIB. 22:     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation, 26 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330, 27 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
26
27*/ 29*/
28 30
29#include <unistd.h> 31#include <unistd.h>
30 32
31#include <opie2/odebug.h> 33#include <opie2/odebug.h>
32#include <opie2/opimrecurrence.h> 34#include <opie2/opimrecurrence.h>
33#include <opie2/opimnotifymanager.h> 35#include <opie2/opimnotifymanager.h>
34#include <opie2/otodoaccessvcal.h> 36#include <opie2/otodoaccessvcal.h>
35#include <opie2/oapplicationfactory.h> 37#include <opie2/oapplicationfactory.h>
36 38
37#include <qpe/applnk.h> 39#include <qpe/applnk.h>
38#include <qpe/config.h> 40#include <qpe/config.h>
39#include <qpe/ir.h> 41#include <qpe/ir.h>
40#include <qpe/resource.h>
41#include <qpe/qpemessagebox.h> 42#include <qpe/qpemessagebox.h>
42#include <qpe/alarmserver.h> 43#include <qpe/alarmserver.h>
43#include <qpe/qpeapplication.h> 44#include <qpe/qpeapplication.h>
44 45
45#include <qaction.h> 46#include <qaction.h>
46#include <qlayout.h> 47#include <qlayout.h>
47#include <qmenubar.h> 48#include <qmenubar.h>
48#include <qmessagebox.h> 49#include <qmessagebox.h>
49#include <qpushbutton.h> 50#include <qpushbutton.h>
50#include <qstringlist.h> 51#include <qstringlist.h>
51#include <qtimer.h> 52#include <qtimer.h>
52#include <qwhatsthis.h> 53#include <qwhatsthis.h>
53 54
54#include "quickeditimpl.h" 55#include "quickeditimpl.h"
55#include "todotemplatemanager.h" 56#include "todotemplatemanager.h"
56#include "templatedialogimpl.h" 57#include "templatedialogimpl.h"
57#include "tableview.h" 58#include "tableview.h"
58 59
59#include "textviewshow.h" 60#include "textviewshow.h"
60#include "todoeditor.h" 61#include "todoeditor.h"
61#include "newtaskdlg.h" 62#include "newtaskdlg.h"
62#include "mainwindow.h" 63#include "mainwindow.h"
63 64
64using Opie::Core::OApplicationFactory; 65using Opie::Core::OApplicationFactory;
65OPIE_EXPORT_APP( OApplicationFactory<Todo::MainWindow> ) 66OPIE_EXPORT_APP( OApplicationFactory<Todo::MainWindow> )
66 67
67using namespace Opie; 68using namespace Opie;
68using namespace Todo; 69using namespace Todo;
69 70
70MainWindow::MainWindow( QWidget* parent, 71MainWindow::MainWindow( QWidget* parent,
71 const char* name, WFlags ) 72 const char* name, WFlags )
72 : Opie::OPimMainWindow( "Todolist", "Todo List", tr( "Task" ), "todo", 73 : Opie::OPimMainWindow( "Todolist", "Todo List", tr( "Task" ), "todo",
73 parent, name, WType_TopLevel | WStyle_ContextHelp ) 74 parent, name, WType_TopLevel | WStyle_ContextHelp )
74{ 75{
75 setCaption( tr( "Todo List" ) ); 76 setCaption( tr( "Todo List" ) );
76 if (!name) 77 if (!name)
77 setName("todo window"); 78 setName("todo window");
78 79
79 m_syncing = false; 80 m_syncing = false;
80 m_showing = false; 81 m_showing = false;
81 m_counter = 0; 82 m_counter = 0;
82 m_tempManager = new TemplateManager(); 83 m_tempManager = new TemplateManager();
83 m_tempManager->load(); 84 m_tempManager->load();
84 85
85 initConfig(); 86 initConfig();
86 initUI(); 87 initUI();
87 initViews(); 88 initViews();
88 initActions(); 89 initActions();
89 initEditor(); 90 initEditor();
90 initShow(); 91 initShow();
91 92
92 raiseCurrentView(); 93 raiseCurrentView();
93 QTimer::singleShot( 0, this, SLOT(initStuff()) ); 94 QTimer::singleShot( 0, this, SLOT(initStuff()) );
94} 95}
95void MainWindow::initStuff() { 96void MainWindow::initStuff() {
96 m_todoMgr.load(); 97 m_todoMgr.load();
97 setViewCategory( m_curCat ); 98 setViewCategory( m_curCat );
98 setCategory( m_curCat ); 99 setCategory( m_curCat );
99} 100}
100void MainWindow::initActions() { 101void MainWindow::initActions() {
101 // Insert Task menu items 102 // Insert Task menu items
102 QActionGroup *items = new QActionGroup( this, QString::null, false ); 103 QActionGroup *items = new QActionGroup( this, QString::null, false );
103 104
104 m_deleteCompleteAction = new QAction( QString::null, QWidget::tr( "Delete completed" ), 105 m_deleteCompleteAction = new QAction( QString::null, QWidget::tr( "Delete completed" ),
105 0, items, 0 ); 106 0, items, 0 );
106 connect( m_deleteCompleteAction, SIGNAL(activated()), this, SLOT(slotDeleteCompleted()) ); 107 connect( m_deleteCompleteAction, SIGNAL(activated()), this, SLOT(slotDeleteCompleted()) );
107 108
108 insertItemMenuItems( items ); 109 insertItemMenuItems( items );
109 110
110 // Insert View menu items 111 // Insert View menu items
111 items = new QActionGroup( this, QString::null, false ); 112 items = new QActionGroup( this, QString::null, false );
112 113
113 m_completedAction = new QAction( QString::null, QWidget::tr("Show completed tasks"), 114 m_completedAction = new QAction( QString::null, QWidget::tr("Show completed tasks"),
114 0, items, 0, true ); 115 0, items, 0, true );
115 m_completedAction->setOn( showCompleted() ); 116 m_completedAction->setOn( showCompleted() );
116 connect( m_completedAction, SIGNAL(toggled(bool)), this, SLOT(slotShowCompleted(bool)) ); 117 connect( m_completedAction, SIGNAL(toggled(bool)), this, SLOT(slotShowCompleted(bool)) );
117 118
118 QAction *a = new QAction( QString::null, QWidget::tr("Show only over-due tasks"), 119 QAction *a = new QAction( QString::null, QWidget::tr("Show only over-due tasks"),
119 0, items, 0, true ); 120 0, items, 0, true );
120 a->setOn( showOverDue() ); 121 a->setOn( showOverDue() );
121 connect( a, SIGNAL(toggled(bool)), this, SLOT(slotShowDue(bool)) ); 122 connect( a, SIGNAL(toggled(bool)), this, SLOT(slotShowDue(bool)) );
122 123
123 m_showDeadLineAction = new QAction( QString::null, QWidget::tr("Show task deadlines"), 124 m_showDeadLineAction = new QAction( QString::null, QWidget::tr("Show task deadlines"),
124 0, items, 0, true ); 125 0, items, 0, true );
125 m_showDeadLineAction->setOn( showDeadline() ); 126 m_showDeadLineAction->setOn( showDeadline() );
126 connect( m_showDeadLineAction, SIGNAL(toggled(bool)), this, SLOT(slotShowDeadLine(bool)) ); 127 connect( m_showDeadLineAction, SIGNAL(toggled(bool)), this, SLOT(slotShowDeadLine(bool)) );
127 128
128 m_showQuickTaskAction = new QAction( QString::null, QWidget::tr("Show quick task bar"), 129 m_showQuickTaskAction = new QAction( QString::null, QWidget::tr("Show quick task bar"),
129 0, items, 0, true ); 130 0, items, 0, true );
130 m_showQuickTaskAction->setOn( showQuickTask() ); 131 m_showQuickTaskAction->setOn( showQuickTask() );
131 connect( m_showQuickTaskAction, SIGNAL(toggled(bool)), this, SLOT(slotShowQuickTask(bool)) ); 132 connect( m_showQuickTaskAction, SIGNAL(toggled(bool)), this, SLOT(slotShowQuickTask(bool)) );
132 133
133 insertViewMenuItems( items ); 134 insertViewMenuItems( items );
134} 135}
135/* m_curCat from Config */ 136/* m_curCat from Config */
136void MainWindow::initConfig() { 137void MainWindow::initConfig() {
diff --git a/core/pim/todo/mainwindow.h b/core/pim/todo/mainwindow.h
index c0fe805..b96795f 100644
--- a/core/pim/todo/mainwindow.h
+++ b/core/pim/todo/mainwindow.h
@@ -1,198 +1,200 @@
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 Holger Freyther <zecke@handhelds.org> 3
4 .>+-= 4 Copyright (C) Opie Team <opie-devel@handhelds.org>
5_;:, .> :=|. This program is free software; you can 5 =.
6.> <`_, > . <= redistribute it and/or modify it under 6 .=l.
7:`=1 )Y*s>-.-- : the terms of the GNU General Public 7           .>+-=
8.="- .-=="i, .._ License as published by the Free Software 8 _;:,     .>    :=|. This program is free software; you can
9- . .-<_> .<> Foundation; either version 2 of the License, 9.> <`_,   >  .   <= redistribute it and/or modify it under
10 ._= =} : or (at your option) any later version. 10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11 .%`+i> _;_. 11.="- .-=="i,     .._ License as published by the Free Software
12 .i_,=:_. -<s. This program is distributed in the hope that 12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13 + . -:. = it will be useful, but WITHOUT ANY WARRANTY; 13     ._= =}       : or (at your option) any later version.
14 : .. .:, . . . without even the implied warranty of 14    .%`+i>       _;_.
15 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A 15    .i_,=:_.      -<s. This program is distributed in the hope that
16 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU 16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17..}^=.= = ; Library General Public License for more 17 : ..    .:,     . . . without even the implied warranty of
18++= -. .` .: details. 18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19: = ...= . :.=- 19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20-. .:....=;==+<; You should have received a copy of the GNU 20..}^=.=       =       ; Library General Public License for more
21 -_. . . )=. = Library General Public License along with 21++=   -.     .`     .: details.
22 -- :-=` this library; see the file COPYING.LIB. 22:     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation, 26 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330, 27 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
26
27*/ 29*/
28 30
29#ifndef TODO_MAIN_WINDOW_H 31#ifndef TODO_MAIN_WINDOW_H
30#define TODO_MAIN_WINDOW_H 32#define TODO_MAIN_WINDOW_H
31 33
32#include <qlist.h> 34#include <qlist.h>
33 35
34#include <opie2/otodoaccess.h> 36#include <opie2/otodoaccess.h>
35#include <opie2/opimtodo.h> 37#include <opie2/opimtodo.h>
36#include <opie2/opimmainwindow.h> 38#include <opie2/opimmainwindow.h>
37#include <opie2/owidgetstack.h> 39#include <opie2/owidgetstack.h>
38 40
39#include "smalltodo.h" 41#include "smalltodo.h"
40#include "todoview.h" 42#include "todoview.h"
41#include "quickedit.h" 43#include "quickedit.h"
42#include "todomanager.h" 44#include "todomanager.h"
43 45
44class QPopupMenu; 46class QPopupMenu;
45class QMenuBar; 47class QMenuBar;
46class QToolBar; 48class QToolBar;
47class QAction; 49class QAction;
48class Ir; 50class Ir;
49class QVBox; 51class QVBox;
50class QLineEdit; 52class QLineEdit;
51 53
52namespace Todo { 54namespace Todo {
53 typedef TodoView View; 55 typedef TodoView View;
54 class TemplateManager; 56 class TemplateManager;
55 class Editor; 57 class Editor;
56 class TodoShow; 58 class TodoShow;
57 struct QuickEditBase; 59 struct QuickEditBase;
58 60
59 class MainWindow : public Opie::OPimMainWindow { 61 class MainWindow : public Opie::OPimMainWindow {
60 Q_OBJECT 62 Q_OBJECT
61 friend class TodoView; // avoid QObject here.... 63 friend class TodoView; // avoid QObject here....
62 friend class TodoShow; // avoid QObject 64 friend class TodoShow; // avoid QObject
63 public: 65 public:
64 /* Opie::Core::OApplicationFactory application Name */ 66 /* Opie::Core::OApplicationFactory application Name */
65 static QString appName() { return QString::fromLatin1("todolist"); } 67 static QString appName() { return QString::fromLatin1("todolist"); }
66 68
67 MainWindow( QWidget *parent = 0, 69 MainWindow( QWidget *parent = 0,
68 const char* name = 0, WFlags fl = 0 ); 70 const char* name = 0, WFlags fl = 0 );
69 ~MainWindow(); 71 ~MainWindow();
70 72
71 /** return a context menu for an OPimTodo */ 73 /** return a context menu for an OPimTodo */
72 QPopupMenu* contextMenu(int uid, bool doesRecur = FALSE ); 74 QPopupMenu* contextMenu(int uid, bool doesRecur = FALSE );
73 75
74 void updateList(); 76 void updateList();
75 OPimTodoAccess::List list()const; 77 OPimTodoAccess::List list()const;
76 OPimTodoAccess::List sorted( bool asc, int sortOrder ); 78 OPimTodoAccess::List sorted( bool asc, int sortOrder );
77 OPimTodoAccess::List sorted( bool asc, int sortOrder, int addFilter ); 79 OPimTodoAccess::List sorted( bool asc, int sortOrder, int addFilter );
78 80
79 OPimTodo event(int uid ); 81 OPimTodo event(int uid );
80 82
81 bool isSyncing()const; 83 bool isSyncing()const;
82 bool showCompleted()const; 84 bool showCompleted()const;
83 bool showDeadline()const; 85 bool showDeadline()const;
84 bool showOverDue()const; 86 bool showOverDue()const;
85 bool showQuickTask()const; 87 bool showQuickTask()const;
86 QString currentCategory()const; 88 QString currentCategory()const;
87 int currentCatId(); 89 int currentCatId();
88 TemplateManager* templateManager(); 90 TemplateManager* templateManager();
89 QuickEditBase* quickEditor(); 91 QuickEditBase* quickEditor();
90 92
91 void updateTodo( const OPimTodo& ); 93 void updateTodo( const OPimTodo& );
92 Editor* currentEditor(); 94 Editor* currentEditor();
93 void setReadAhead(uint count ); 95 void setReadAhead(uint count );
94private slots: 96private slots:
95 void slotQuickEntered(); 97 void slotQuickEntered();
96 void slotReload(); 98 void slotReload();
97 void slotFlush(); 99 void slotFlush();
98 100
99 protected: 101 protected:
100 void closeEvent( QCloseEvent* e ); 102 void closeEvent( QCloseEvent* e );
101 103
102 private: 104 private:
103 /* handle setting and removing alarms */ 105 /* handle setting and removing alarms */
104 void handleAlarms( const OPimTodo& oldTodo, const OPimTodo& newTodo ); 106 void handleAlarms( const OPimTodo& oldTodo, const OPimTodo& newTodo );
105 void receiveFile( const QString& filename ); 107 void receiveFile( const QString& filename );
106 void connectBase( ViewBase* ); 108 void connectBase( ViewBase* );
107 void initUI(); 109 void initUI();
108 void initActions(); 110 void initActions();
109 void initConfig(); 111 void initConfig();
110 void initViews(); 112 void initViews();
111 void initEditor(); 113 void initEditor();
112 void initShow(); 114 void initShow();
113 void raiseCurrentView(); 115 void raiseCurrentView();
114 ViewBase* currentView(); 116 ViewBase* currentView();
115 ViewBase* m_curView; 117 ViewBase* m_curView;
116 bool m_showing : 1; // used to see if we show a todo in the cases we shouldn't change the table 118 bool m_showing : 1; // used to see if we show a todo in the cases we shouldn't change the table
117 QuickEditBase* m_curQuick; 119 QuickEditBase* m_curQuick;
118 Editor* m_curEdit; 120 Editor* m_curEdit;
119 TodoShow* currentShow(); 121 TodoShow* currentShow();
120 TodoShow* m_curShow; 122 TodoShow* m_curShow;
121 123
122 QAction* m_editAction, 124 QAction* m_editAction,
123 *m_deleteAction, 125 *m_deleteAction,
124 *m_findAction, 126 *m_findAction,
125 *m_completedAction, 127 *m_completedAction,
126 *m_showDeadLineAction, 128 *m_showDeadLineAction,
127 *m_deleteAllAction, 129 *m_deleteAllAction,
128 *m_deleteCompleteAction, 130 *m_deleteCompleteAction,
129 *m_duplicateAction, 131 *m_duplicateAction,
130 *m_showOverDueAction, 132 *m_showOverDueAction,
131 *m_showQuickTaskAction, 133 *m_showQuickTaskAction,
132 *m_effectiveAction; 134 *m_effectiveAction;
133 Opie::Ui::OWidgetStack *m_stack; 135 Opie::Ui::OWidgetStack *m_stack;
134 136
135 bool m_syncing:1; 137 bool m_syncing:1;
136 bool m_deadline:1; 138 bool m_deadline:1;
137 bool m_completed:1; 139 bool m_completed:1;
138 bool m_overdue:1; 140 bool m_overdue:1;
139 bool m_quicktask:1; 141 bool m_quicktask:1;
140 TodoManager m_todoMgr; 142 TodoManager m_todoMgr;
141 QString m_curCat; 143 QString m_curCat;
142 QList<ViewBase> m_views; 144 QList<ViewBase> m_views;
143 uint m_counter; 145 uint m_counter;
144 TemplateManager* m_tempManager; 146 TemplateManager* m_tempManager;
145 147
146 148
147 private slots: 149 private slots:
148 void initStuff(); 150 void initStuff();
149 151
150 void slotItemNew(); 152 void slotItemNew();
151 void slotItemEdit(); 153 void slotItemEdit();
152 void slotItemDuplicate(); 154 void slotItemDuplicate();
153 void slotItemDelete(); 155 void slotItemDelete();
154 void slotItemBeam(); 156 void slotItemBeam();
155 void slotItemFind(); 157 void slotItemFind();
156 void slotConfigure(); 158 void slotConfigure();
157 159
158 void slotShow(int); 160 void slotShow(int);
159 void slotEdit(int); 161 void slotEdit(int);
160 void slotUpdate3( QWidget* ); 162 void slotUpdate3( QWidget* );
161 void slotComplete( int uid ); 163 void slotComplete( int uid );
162 void slotComplete( const OPimTodo& ev ); 164 void slotComplete( const OPimTodo& ev );
163 165
164 void slotDelete(int uid ); 166 void slotDelete(int uid );
165 void slotDeleteAll(); 167 void slotDeleteAll();
166 void slotDeleteCompleted(); 168 void slotDeleteCompleted();
167 169
168 170
169 void setCategory( const QString &category ); 171 void setCategory( const QString &category );
170 172
171 void slotShowDeadLine( bool ); 173 void slotShowDeadLine( bool );
172 void slotShowCompleted( bool ); 174 void slotShowCompleted( bool );
173 void slotShowQuickTask( bool ); 175 void slotShowQuickTask( bool );
174 176
175 void setDocument( const QString& ); 177 void setDocument( const QString& );
176 178
177 179
178 void beamDone( Ir* ); 180 void beamDone( Ir* );
179 void slotShowDetails(); 181 void slotShowDetails();
180 void slotShowNext(); 182 void slotShowNext();
181 void slotShowPrev(); 183 void slotShowPrev();
182 void slotShowDue( bool ); 184 void slotShowDue( bool );
183 void slotReturnFromView(); // for TodoShow... 185 void slotReturnFromView(); // for TodoShow...
184 /* reimplementation from opimmainwindow */ 186 /* reimplementation from opimmainwindow */
185 protected slots: 187 protected slots:
186 void flush(); 188 void flush();
187 void reload(); 189 void reload();
188 int create(); 190 int create();
189 bool remove( int uid ); 191 bool remove( int uid );
190 void beam(int uid); 192 void beam(int uid);
191 void show( int uid ); 193 void show( int uid );
192 void edit( int uid ); 194 void edit( int uid );
193 void add( const Opie::OPimRecord& ); 195 void add( const Opie::OPimRecord& );
194 void doAlarm( const QDateTime& dt, int uid ); 196 void doAlarm( const QDateTime& dt, int uid );
195 }; 197 };
196} 198}
197 199
198#endif 200#endif
diff --git a/core/pim/todo/newtaskdlg.cpp b/core/pim/todo/newtaskdlg.cpp
index 0b5a29d..68a0d24 100644
--- a/core/pim/todo/newtaskdlg.cpp
+++ b/core/pim/todo/newtaskdlg.cpp
@@ -1,78 +1,80 @@
1/* 1/*
2 =. This file is part of the OPIE Project 2                 This file is part of the Opie Project
3 .=l. Copyright (c) 2005 Dan Williams <drw@handhelds.org> 3
4 .>+-= 4 Copyright (C) Opie Team <opie-devel@handhelds.org>
5_;:, .> :=|. This program is free software; you can 5 =.
6.> <`_, > . <= redistribute it and/or modify it under 6 .=l.
7:`=1 )Y*s>-.-- : the terms of the GNU General Public 7           .>+-=
8.="- .-=="i, .._ License as published by the Free Software 8 _;:,     .>    :=|. This program is free software; you can
9- . .-<_> .<> Foundation; either version 2 of the License, 9.> <`_,   >  .   <= redistribute it and/or modify it under
10 ._= =} : or (at your option) any later version. 10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11 .%`+i> _;_. 11.="- .-=="i,     .._ License as published by the Free Software
12 .i_,=:_. -<s. This program is distributed in the hope that 12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13 + . -:. = it will be useful, but WITHOUT ANY WARRANTY; 13     ._= =}       : or (at your option) any later version.
14 : .. .:, . . . without even the implied warranty of 14    .%`+i>       _;_.
15 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A 15    .i_,=:_.      -<s. This program is distributed in the hope that
16 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU 16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17..}^=.= = ; Library General Public License for more 17 : ..    .:,     . . . without even the implied warranty of
18++= -. .` .: details. 18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19: = ...= . :.=- 19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20-. .:....=;==+<; You should have received a copy of the GNU 20..}^=.=       =       ; Library General Public License for more
21 -_. . . )=. = General Public License along with 21++=   -.     .`     .: details.
22 -- :-=` this library; see the file COPYING.LIB. 22:     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation, 26 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330, 27 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
26
27*/ 29*/
28 30
29#include "newtaskdlg.h" 31#include "newtaskdlg.h"
30 32
31#include <qbuttongroup.h> 33#include <qbuttongroup.h>
32#include <qcombobox.h> 34#include <qcombobox.h>
33#include <qlayout.h> 35#include <qlayout.h>
34#include <qradiobutton.h> 36#include <qradiobutton.h>
35 37
36NewTaskDlg::NewTaskDlg( const QStringList &templates, QWidget *parent ) 38NewTaskDlg::NewTaskDlg( const QStringList &templates, QWidget *parent )
37 : QDialog( parent, QString::null, true, WStyle_ContextHelp ) 39 : QDialog( parent, QString::null, true, WStyle_ContextHelp )
38{ 40{
39 setCaption( tr( "New Task" ) ); 41 setCaption( tr( "New Task" ) );
40 42
41 QButtonGroup *bg = new QButtonGroup( this ); 43 QButtonGroup *bg = new QButtonGroup( this );
42 bg->hide(); 44 bg->hide();
43 45
44 QVBoxLayout *layout = new QVBoxLayout( this, 10, 3 ); 46 QVBoxLayout *layout = new QVBoxLayout( this, 10, 3 );
45 47
46 QRadioButton *btn = new QRadioButton( tr( "Blank task" ), this ); 48 QRadioButton *btn = new QRadioButton( tr( "Blank task" ), this );
47 btn->setChecked( true ); 49 btn->setChecked( true );
48 bg->insert( btn ); 50 bg->insert( btn );
49 layout->addWidget( btn ); 51 layout->addWidget( btn );
50 52
51 layout->addStretch(); 53 layout->addStretch();
52 54
53 m_useTemplate = new QRadioButton( tr( "Using template:" ), this ); 55 m_useTemplate = new QRadioButton( tr( "Using template:" ), this );
54 connect( m_useTemplate, SIGNAL(toggled(bool)), this, SLOT(slotUseTemplate(bool)) ); 56 connect( m_useTemplate, SIGNAL(toggled(bool)), this, SLOT(slotUseTemplate(bool)) );
55 bg->insert( m_useTemplate ); 57 bg->insert( m_useTemplate );
56 layout->addWidget( m_useTemplate ); 58 layout->addWidget( m_useTemplate );
57 59
58 m_templateList = new QComboBox( this ); 60 m_templateList = new QComboBox( this );
59 m_templateList->insertStringList( templates ); 61 m_templateList->insertStringList( templates );
60 m_templateList->setEnabled( false ); 62 m_templateList->setEnabled( false );
61 layout->addWidget( m_templateList ); 63 layout->addWidget( m_templateList );
62 64
63 layout->addStretch(); 65 layout->addStretch();
64} 66}
65 67
66QString NewTaskDlg::tempSelected() { 68QString NewTaskDlg::tempSelected() {
67 QString tempStr; 69 QString tempStr;
68 if ( m_useTemplate->isChecked() ) 70 if ( m_useTemplate->isChecked() )
69 tempStr = m_templateList->currentText(); 71 tempStr = m_templateList->currentText();
70 72
71 return tempStr; 73 return tempStr;
72} 74}
73 75
74void NewTaskDlg::slotUseTemplate( bool on ) { 76void NewTaskDlg::slotUseTemplate( bool on ) {
75 m_templateList->setEnabled( on ); 77 m_templateList->setEnabled( on );
76 if ( on ) 78 if ( on )
77 m_templateList->setFocus(); 79 m_templateList->setFocus();
78} 80}
diff --git a/core/pim/todo/newtaskdlg.h b/core/pim/todo/newtaskdlg.h
index 31398b3..235c7a0 100644
--- a/core/pim/todo/newtaskdlg.h
+++ b/core/pim/todo/newtaskdlg.h
@@ -1,56 +1,58 @@
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
4 .>+-= 4 Copyright (C) Opie Team <opie-devel@handhelds.org>
5_;:, .> :=|. This program is free software; you can 5 =.
6.> <`_, > . <= redistribute it and/or modify it under 6 .=l.
7:`=1 )Y*s>-.-- : the terms of the GNU General Public 7           .>+-=
8.="- .-=="i, .._ License as published by the Free Software 8 _;:,     .>    :=|. This program is free software; you can
9- . .-<_> .<> Foundation; either version 2 of the License, 9.> <`_,   >  .   <= redistribute it and/or modify it under
10 ._= =} : or (at your option) any later version. 10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11 .%`+i> _;_. 11.="- .-=="i,     .._ License as published by the Free Software
12 .i_,=:_. -<s. This program is distributed in the hope that 12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13 + . -:. = it will be useful, but WITHOUT ANY WARRANTY; 13     ._= =}       : or (at your option) any later version.
14 : .. .:, . . . without even the implied warranty of 14    .%`+i>       _;_.
15 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A 15    .i_,=:_.      -<s. This program is distributed in the hope that
16 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU 16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17..}^=.= = ; Library General Public License for more 17 : ..    .:,     . . . without even the implied warranty of
18++= -. .` .: details. 18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19: = ...= . :.=- 19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20-. .:....=;==+<; You should have received a copy of the GNU 20..}^=.=       =       ; Library General Public License for more
21 -_. . . )=. = General Public License along with 21++=   -.     .`     .: details.
22 -- :-=` this library; see the file COPYING.LIB. 22:     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation, 26 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330, 27 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
26
27*/ 29*/
28 30
29#ifndef NEWTASKDLG_H 31#ifndef NEWTASKDLG_H
30#define NEWTASKDLG_H 32#define NEWTASKDLG_H
31 33
32#include <qdialog.h> 34#include <qdialog.h>
33 35
34#include <qstringlist.h> 36#include <qstringlist.h>
35 37
36class QComboBox; 38class QComboBox;
37class QRadioButton; 39class QRadioButton;
38 40
39class NewTaskDlg : public QDialog 41class NewTaskDlg : public QDialog
40{ 42{
41 Q_OBJECT 43 Q_OBJECT
42 44
43public: 45public:
44 NewTaskDlg( const QStringList &templates, QWidget *parent = 0l ); 46 NewTaskDlg( const QStringList &templates, QWidget *parent = 0l );
45 47
46 QString tempSelected(); 48 QString tempSelected();
47 49
48private: 50private:
49 QRadioButton *m_useTemplate; 51 QRadioButton *m_useTemplate;
50 QComboBox *m_templateList; 52 QComboBox *m_templateList;
51 53
52private slots: 54private slots:
53 void slotUseTemplate( bool on ); 55 void slotUseTemplate( bool on );
54}; 56};
55 57
56#endif 58#endif
diff --git a/core/pim/todo/otaskeditor.cpp b/core/pim/todo/otaskeditor.cpp
index bbc177d..8cce9ed 100644
--- a/core/pim/todo/otaskeditor.cpp
+++ b/core/pim/todo/otaskeditor.cpp
@@ -1,94 +1,124 @@
1/*
2                 This file is part of the Opie Project
3
4 Copyright (C) Opie Team <opie-devel@handhelds.org>
5 =.
6 .=l.
7           .>+-=
8 _;:,     .>    :=|. This program is free software; you can
9.> <`_,   >  .   <= redistribute it and/or modify it under
10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11.="- .-=="i,     .._ License as published by the Free Software
12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13     ._= =}       : or (at your option) any later version.
14    .%`+i>       _;_.
15    .i_,=:_.      -<s. This program is distributed in the hope that
16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17 : ..    .:,     . . . without even the implied warranty of
18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20..}^=.=       =       ; Library General Public License for more
21++=   -.     .`     .: details.
22:     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA.
29*/
30
1#include <qlayout.h> 31#include <qlayout.h>
2 32
3#include <opie2/odebug.h> 33#include <opie2/odebug.h>
4 34
5#include "taskeditoroverview.h" 35#include "taskeditoroverview.h"
6#include "taskeditorstatus.h" 36#include "taskeditorstatus.h"
7#include "taskeditoralarms.h" 37#include "taskeditoralarms.h"
8 38
9#include "otaskeditor.h" 39#include "otaskeditor.h"
10 40
11using namespace Opie::Ui; 41using namespace Opie::Ui;
12using namespace Opie; 42using namespace Opie;
13 43
14OTaskEditor::OTaskEditor(int cur) 44OTaskEditor::OTaskEditor(int cur)
15 : QDialog( 0, 0, TRUE, WStyle_ContextHelp ) { 45 : QDialog( 0, 0, TRUE, WStyle_ContextHelp ) {
16 init(); 46 init();
17 init( cur ); 47 init( cur );
18} 48}
19OTaskEditor::OTaskEditor( const OPimTodo& to) 49OTaskEditor::OTaskEditor( const OPimTodo& to)
20 : QDialog( 0, 0, TRUE, WStyle_ContextHelp ) { 50 : QDialog( 0, 0, TRUE, WStyle_ContextHelp ) {
21 init(); 51 init();
22 init( to ); 52 init( to );
23} 53}
24OTaskEditor::~OTaskEditor() { 54OTaskEditor::~OTaskEditor() {
25 55
26} 56}
27void OTaskEditor::init( int cur ) { 57void OTaskEditor::init( int cur ) {
28 OPimTodo to; 58 OPimTodo to;
29 to.setUid( 1 ); // generate a new uid 59 to.setUid( 1 ); // generate a new uid
30 if ( cur != 0 ) 60 if ( cur != 0 )
31 to.setCategories( cur ); 61 to.setCategories( cur );
32 load(to); 62 load(to);
33} 63}
34void OTaskEditor::init( const OPimTodo& to ) { 64void OTaskEditor::init( const OPimTodo& to ) {
35 load( to ); 65 load( to );
36} 66}
37OPimTodo OTaskEditor::todo()const{ 67OPimTodo OTaskEditor::todo()const{
38 OPimTodo to ( m_todo ); 68 OPimTodo to ( m_todo );
39 m_overView->save( to ); 69 m_overView->save( to );
40 m_stat->save( to ); 70 m_stat->save( to );
41 to.setRecurrence( m_rec->recurrence() ); 71 to.setRecurrence( m_rec->recurrence() );
42 m_alarm->save( to ); 72 m_alarm->save( to );
43 73
44 return to; 74 return to;
45} 75}
46void OTaskEditor::load(const OPimTodo& to) { 76void OTaskEditor::load(const OPimTodo& to) {
47 m_overView->load( to ); 77 m_overView->load( to );
48 m_stat->load( to ); 78 m_stat->load( to );
49 m_rec->setRecurrence( to.recurrence(), to.hasDueDate() ? to.dueDate() : QDate::currentDate() ); 79 m_rec->setRecurrence( to.recurrence(), to.hasDueDate() ? to.dueDate() : QDate::currentDate() );
50 m_alarm->load( to ); 80 m_alarm->load( to );
51 81
52 m_todo = to; 82 m_todo = to;
53} 83}
54void OTaskEditor::init() { 84void OTaskEditor::init() {
55 setCaption(tr("Task Editor") ); 85 setCaption(tr("Task Editor") );
56 86
57 QVBoxLayout* layo = new QVBoxLayout( this ); 87 QVBoxLayout* layo = new QVBoxLayout( this );
58 m_tab = new OTabWidget( this ); 88 m_tab = new OTabWidget( this );
59 layo->addWidget( m_tab ); 89 layo->addWidget( m_tab );
60 90
61 /* 91 /*
62 * Add the Widgets 92 * Add the Widgets
63 */ 93 */
64 m_overView = new TaskEditorOverView( m_tab ); 94 m_overView = new TaskEditorOverView( m_tab );
65 m_tab->addTab( m_overView, "todo/info", tr("Information") ); 95 m_tab->addTab( m_overView, "todo/info", tr("Information") );
66 96
67 m_stat = new TaskEditorStatus( m_tab ); 97 m_stat = new TaskEditorStatus( m_tab );
68 m_tab->addTab( m_stat, "todo/TodoList", tr("Status") ); 98 m_tab->addTab( m_stat, "todo/TodoList", tr("Status") );
69 99
70 m_alarm = new TaskEditorAlarms( m_tab ); 100 m_alarm = new TaskEditorAlarms( m_tab );
71 m_tab->addTab( m_alarm, "todo/alarm", tr("Alarms") ); 101 m_tab->addTab( m_alarm, "todo/alarm", tr("Alarms") );
72 102
73// m_remind = new TaskEditorAlarms( m_tab ); 103// m_remind = new TaskEditorAlarms( m_tab );
74// m_tab->addTab( m_remind, "todo/reminder", tr("Reminders") ); 104// m_tab->addTab( m_remind, "todo/reminder", tr("Reminders") );
75 105
76// QLabel* lbl = new QLabel( m_tab ); 106// QLabel* lbl = new QLabel( m_tab );
77// lbl->setText( tr("X-Ref") ); 107// lbl->setText( tr("X-Ref") );
78// m_tab->addTab( lbl, "todo/xref", tr("X-Ref") ); 108// m_tab->addTab( lbl, "todo/xref", tr("X-Ref") );
79 109
80 m_rec = new OPimRecurrenceWidget( true, QDate::currentDate(), this ); 110 m_rec = new OPimRecurrenceWidget( true, QDate::currentDate(), this );
81 m_tab->addTab( m_rec, "repeat", tr("Recurrence") ); 111 m_tab->addTab( m_rec, "repeat", tr("Recurrence") );
82 112
83 113
84 /* signal and slots */ 114 /* signal and slots */
85 connect(m_overView, SIGNAL(recurranceEnabled(bool) ), 115 connect(m_overView, SIGNAL(recurranceEnabled(bool) ),
86 m_rec, SLOT(setEnabled(bool) ) ); 116 m_rec, SLOT(setEnabled(bool) ) );
87 117
88 /* connect due date changed to the recurrence tab */ 118 /* connect due date changed to the recurrence tab */
89 connect(m_stat, SIGNAL(dueDateChanged(const QDate&) ), 119 connect(m_stat, SIGNAL(dueDateChanged(const QDate&) ),
90 m_rec, SLOT(setStartDate(const QDate&) ) ); 120 m_rec, SLOT(setStartDate(const QDate&) ) );
91 121
92 122
93 m_tab->setCurrentTab( m_overView ); 123 m_tab->setCurrentTab( m_overView );
94} 124}
diff --git a/core/pim/todo/otaskeditor.h b/core/pim/todo/otaskeditor.h
index 65e7bda..1715d02 100644
--- a/core/pim/todo/otaskeditor.h
+++ b/core/pim/todo/otaskeditor.h
@@ -1,44 +1,74 @@
1/*
2                 This file is part of the Opie Project
3
4 Copyright (C) Opie Team <opie-devel@handhelds.org>
5 =.
6 .=l.
7           .>+-=
8 _;:,     .>    :=|. This program is free software; you can
9.> <`_,   >  .   <= redistribute it and/or modify it under
10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11.="- .-=="i,     .._ License as published by the Free Software
12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13     ._= =}       : or (at your option) any later version.
14    .%`+i>       _;_.
15    .i_,=:_.      -<s. This program is distributed in the hope that
16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17 : ..    .:,     . . . without even the implied warranty of
18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20..}^=.=       =       ; Library General Public License for more
21++=   -.     .`     .: details.
22:     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA.
29*/
30
1#ifndef OPIE_TASK_EDITOR_H 31#ifndef OPIE_TASK_EDITOR_H
2#define OPIE_TASK_EDITOR_H 32#define OPIE_TASK_EDITOR_H
3 33
4#include <qdialog.h> 34#include <qdialog.h>
5 35
6#include <opie2/opimtodo.h> 36#include <opie2/opimtodo.h>
7#include <opie2/otabwidget.h> 37#include <opie2/otabwidget.h>
8#include <opie2/opimrecurrencewidget.h> 38#include <opie2/opimrecurrencewidget.h>
9#include <opie2/opimrecurrencewidget.h> 39#include <opie2/opimrecurrencewidget.h>
10 40
11class TaskEditorOverView; 41class TaskEditorOverView;
12class TaskEditorStatus; 42class TaskEditorStatus;
13class TaskEditorAlarms; 43class TaskEditorAlarms;
14class QMultiLineEdit; 44class QMultiLineEdit;
15 45
16class OTaskEditor : public QDialog { 46class OTaskEditor : public QDialog {
17 Q_OBJECT 47 Q_OBJECT
18public: 48public:
19 OTaskEditor(int cur); 49 OTaskEditor(int cur);
20 OTaskEditor( const Opie::OPimTodo& todo ); 50 OTaskEditor( const Opie::OPimTodo& todo );
21 ~OTaskEditor(); 51 ~OTaskEditor();
22 52
23 /* 53 /*
24 * same as the c'tor but this gives us the 54 * same as the c'tor but this gives us the
25 * power to 'preload' the dialog 55 * power to 'preload' the dialog
26 */ 56 */
27 void init( int cur ); 57 void init( int cur );
28 void init( const Opie::OPimTodo& todo ); 58 void init( const Opie::OPimTodo& todo );
29 59
30 Opie::OPimTodo todo()const; 60 Opie::OPimTodo todo()const;
31private: 61private:
32 void load( const Opie::OPimTodo& ); 62 void load( const Opie::OPimTodo& );
33 void init(); 63 void init();
34 64
35 Opie::Ui::OTabWidget *m_tab; 65 Opie::Ui::OTabWidget *m_tab;
36 TaskEditorOverView *m_overView; 66 TaskEditorOverView *m_overView;
37 TaskEditorStatus *m_stat; 67 TaskEditorStatus *m_stat;
38 TaskEditorAlarms *m_alarm; 68 TaskEditorAlarms *m_alarm;
39 TaskEditorAlarms *m_remind; 69 TaskEditorAlarms *m_remind;
40 OPimRecurrenceWidget *m_rec; 70 OPimRecurrenceWidget *m_rec;
41 Opie::OPimTodo m_todo; 71 Opie::OPimTodo m_todo;
42}; 72};
43 73
44#endif 74#endif
diff --git a/core/pim/todo/quickedit.cpp b/core/pim/todo/quickedit.cpp
index 16fc53a..eb26c45 100644
--- a/core/pim/todo/quickedit.cpp
+++ b/core/pim/todo/quickedit.cpp
@@ -1,21 +1,51 @@
1/*
2                 This file is part of the Opie Project
3
4 Copyright (C) Opie Team <opie-devel@handhelds.org>
5 =.
6 .=l.
7           .>+-=
8 _;:,     .>    :=|. This program is free software; you can
9.> <`_,   >  .   <= redistribute it and/or modify it under
10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11.="- .-=="i,     .._ License as published by the Free Software
12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13     ._= =}       : or (at your option) any later version.
14    .%`+i>       _;_.
15    .i_,=:_.      -<s. This program is distributed in the hope that
16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17 : ..    .:,     . . . without even the implied warranty of
18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20..}^=.=       =       ; Library General Public License for more
21++=   -.     .`     .: details.
22:     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA.
29*/
30
1#include "quickedit.h" 31#include "quickedit.h"
2 32
3using namespace Todo; 33using namespace Todo;
4 34
5// not so interesting part base Implementation 35// not so interesting part base Implementation
6QuickEdit::QuickEdit(MainWindow* main ) 36QuickEdit::QuickEdit(MainWindow* main )
7 : m_main( main ) { 37 : m_main( main ) {
8 m_sig = new QSignal(); 38 m_sig = new QSignal();
9} 39}
10QuickEdit::~QuickEdit() { 40QuickEdit::~QuickEdit() {
11 delete m_sig; 41 delete m_sig;
12} 42}
13QSignal* QuickEdit::signal() { 43QSignal* QuickEdit::signal() {
14 return m_sig; 44 return m_sig;
15} 45}
16MainWindow* QuickEdit::mainWindow() { 46MainWindow* QuickEdit::mainWindow() {
17 return m_main; 47 return m_main;
18} 48}
19void QuickEdit::commit() { 49void QuickEdit::commit() {
20 m_sig->activate(); 50 m_sig->activate();
21} 51}
diff --git a/core/pim/todo/quickedit.h b/core/pim/todo/quickedit.h
index 0c0c204..a479d9e 100644
--- a/core/pim/todo/quickedit.h
+++ b/core/pim/todo/quickedit.h
@@ -1,47 +1,77 @@
1/*
2                 This file is part of the Opie Project
3
4 Copyright (C) Opie Team <opie-devel@handhelds.org>
5 =.
6 .=l.
7           .>+-=
8 _;:,     .>    :=|. This program is free software; you can
9.> <`_,   >  .   <= redistribute it and/or modify it under
10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11.="- .-=="i,     .._ License as published by the Free Software
12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13     ._= =}       : or (at your option) any later version.
14    .%`+i>       _;_.
15    .i_,=:_.      -<s. This program is distributed in the hope that
16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17 : ..    .:,     . . . without even the implied warranty of
18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20..}^=.=       =       ; Library General Public License for more
21++=   -.     .`     .: details.
22:     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA.
29*/
30
1#ifndef OPIE_QUICK_EDIT_H 31#ifndef OPIE_QUICK_EDIT_H
2#define OPIE_QUICK_EDIT_H 32#define OPIE_QUICK_EDIT_H
3 33
4#include <qsignal.h> 34#include <qsignal.h>
5#include <qwidget.h> 35#include <qwidget.h>
6 36
7#include <opie2/opimtodo.h> 37#include <opie2/opimtodo.h>
8 38
9using Opie::OPimTodo; 39using Opie::OPimTodo;
10 40
11namespace Todo{ 41namespace Todo{
12 class MainWindow; 42 class MainWindow;
13 struct QuickEditBase { 43 struct QuickEditBase {
14 virtual OPimTodo todo()const = 0l; 44 virtual OPimTodo todo()const = 0l;
15 virtual QSignal* signal() = 0l; 45 virtual QSignal* signal() = 0l;
16 virtual QWidget* widget() = 0l; 46 virtual QWidget* widget() = 0l;
17 }; 47 };
18 /* 48 /*
19 * this is my second try 49 * this is my second try
20 * of signal and slots with namespaces 50 * of signal and slots with namespaces
21 * and templates 51 * and templates
22 * I use a different approach now 52 * I use a different approach now
23 * I give a QSignal away 53 * I give a QSignal away
24 * and have a protected method called emit 54 * and have a protected method called emit
25 */ 55 */
26 /** 56 /**
27 * Quick edit is meant to quickly enter 57 * Quick edit is meant to quickly enter
28 * OPimTodos in a fast way 58 * OPimTodos in a fast way
29 */ 59 */
30 class QuickEdit : public QuickEditBase{ 60 class QuickEdit : public QuickEditBase{
31 public: 61 public:
32 QuickEdit(MainWindow* main ); 62 QuickEdit(MainWindow* main );
33 virtual ~QuickEdit(); 63 virtual ~QuickEdit();
34 //OPimTodo todo()const; 64 //OPimTodo todo()const;
35 QSignal* signal(); 65 QSignal* signal();
36 //QWidget* widget(); 66 //QWidget* widget();
37 protected: 67 protected:
38 MainWindow* mainWindow(); 68 MainWindow* mainWindow();
39 void commit(); 69 void commit();
40 private: 70 private:
41 MainWindow* m_main; 71 MainWindow* m_main;
42 QSignal* m_sig; 72 QSignal* m_sig;
43 }; 73 };
44}; 74};
45 75
46 76
47#endif 77#endif
diff --git a/core/pim/todo/quickeditimpl.cpp b/core/pim/todo/quickeditimpl.cpp
index 90ad19e..f700716 100644
--- a/core/pim/todo/quickeditimpl.cpp
+++ b/core/pim/todo/quickeditimpl.cpp
@@ -1,117 +1,149 @@
1/*
2                 This file is part of the Opie Project
3
4 Copyright (C) Opie Team <opie-devel@handhelds.org>
5 =.
6 .=l.
7           .>+-=
8 _;:,     .>    :=|. This program is free software; you can
9.> <`_,   >  .   <= redistribute it and/or modify it under
10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11.="- .-=="i,     .._ License as published by the Free Software
12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13     ._= =}       : or (at your option) any later version.
14    .%`+i>       _;_.
15    .i_,=:_.      -<s. This program is distributed in the hope that
16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17 : ..    .:,     . . . without even the implied warranty of
18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20..}^=.=       =       ; Library General Public License for more
21++=   -.     .`     .: details.
22:     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA.
29*/
30
1#include <qaction.h> 31#include <qaction.h>
2#include <qlineedit.h> 32#include <qlineedit.h>
3#include <qwhatsthis.h> 33#include <qwhatsthis.h>
4 34
5#include <qpe/resource.h>
6
7#include <opie2/oclickablelabel.h> 35#include <opie2/oclickablelabel.h>
36#include <opie2/oresource.h>
8 37
9#include "mainwindow.h" 38#include "mainwindow.h"
10#include "quickeditimpl.h" 39#include "quickeditimpl.h"
11 40
12 41
13 42
14QuickEditImpl::QuickEditImpl( QWidget* parent, bool visible ) 43QuickEditImpl::QuickEditImpl( QWidget* parent, bool visible )
15 : QToolBar( (QMainWindow *)parent ), Todo::QuickEdit( (Todo::MainWindow *)parent ) { 44 : QToolBar( (QMainWindow *)parent ), Todo::QuickEdit( (Todo::MainWindow *)parent ) {
16 setHorizontalStretchable( TRUE ); 45 setHorizontalStretchable( TRUE );
17 46
18 // Load priority icons 47 // Load priority icons
19 // TODO - probably should be done globally somewhere else, 48 // TODO - probably should be done globally somewhere else,
20 // see also tableview.cpp/h, taskeditoroverview.cpp/h 49 // see also tableview.cpp/h, taskeditoroverview.cpp/h
21 priority1 = Resource::loadPixmap( "todo/priority1" ); 50 priority1 = Opie::Core::OResource::loadPixmap( "todo/priority1" );
22 priority3 = Resource::loadPixmap( "todo/priority3" ); 51 priority3 = Opie::Core::OResource::loadPixmap( "todo/priority3" );
23 priority5 = Resource::loadPixmap( "todo/priority5" ); 52 priority5 = Opie::Core::OResource::loadPixmap( "todo/priority5" );
24 53
25 m_lbl = new Opie::Ui::OClickableLabel( this ); 54 m_lbl = new Opie::Ui::OClickableLabel( this );
26 m_lbl->setMinimumWidth( 15 ); 55 m_lbl->setMinimumWidth( 15 );
27 m_lbl->setPixmap( priority3 ); 56 m_lbl->setPixmap( priority3 );
28 connect(m_lbl, SIGNAL(clicked() ), this, SLOT(slotPrio()) ); 57 connect(m_lbl, SIGNAL(clicked() ), this, SLOT(slotPrio()) );
29 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." ) ); 58 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." ) );
30 59
31 m_edit = new QLineEdit( this ); 60 m_edit = new QLineEdit( this );
32 setStretchableWidget( m_edit ); 61 setStretchableWidget( m_edit );
33 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." ) ); 62 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." ) );
34 63
35 /* 64 /*
36 * it's not implemented and won't be implemented for 1.0 65 * it's not implemented and won't be implemented for 1.0
37 */ 66 */
38#if 0 67#if 0
39 QAction *a = new QAction( QWidget::tr( "More" ), Resource::loadPixmap( "todo/more" ), QString::null, 0, this, 0 ); 68 QAction *a = new QAction( QWidget::tr( "More" ), Opie::Core::OResource::loadPixmap( "todo/more", Opie::Core::OResource::SmallIcon ),
69 QString::null, 0, this, 0 );
40 connect( a, SIGNAL( activated() ), this, SLOT( slotMore() ) ); 70 connect( a, SIGNAL( activated() ), this, SLOT( slotMore() ) );
41 a->addTo( this ); 71 a->addTo( this );
42 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." ) ); 72 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." ) );
43#endif 73#endif
44 74
45 QAction *a = new QAction( QWidget::tr( "Enter" ), Resource::loadPixmap( "enter" ), QString::null, 0, this, 0 ); 75 QAction *a = new QAction( QWidget::tr( "Enter" ), Opie::Core::OResource::loadPixmap( "enter", Opie::Core::OResource::SmallIcon ),
76 QString::null, 0, this, 0 );
46 connect( a, SIGNAL( activated() ), this, SLOT( slotEnter() ) ); 77 connect( a, SIGNAL( activated() ), this, SLOT( slotEnter() ) );
47 a->addTo( this ); 78 a->addTo( this );
48 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." ) ); 79 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." ) );
49 80
50 a = new QAction( QWidget::tr( "Cancel" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); 81 a = new QAction( QWidget::tr( "Cancel" ), Opie::Core::OResource::loadPixmap( "close", Opie::Core::OResource::SmallIcon ),
82 QString::null, 0, this, 0 );
51 connect( a, SIGNAL( activated() ), this, SLOT( slotCancel() ) ); 83 connect( a, SIGNAL( activated() ), this, SLOT( slotCancel() ) );
52 a->addTo( this ); 84 a->addTo( this );
53 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." ) ); 85 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." ) );
54 86
55 m_visible = visible; 87 m_visible = visible;
56 if ( !m_visible ) { 88 if ( !m_visible ) {
57 hide(); 89 hide();
58 } 90 }
59 91
60 m_menu = 0l; 92 m_menu = 0l;
61 reinit(); 93 reinit();
62} 94}
63QuickEditImpl::~QuickEditImpl() { 95QuickEditImpl::~QuickEditImpl() {
64 96
65} 97}
66OPimTodo QuickEditImpl::todo()const { 98OPimTodo QuickEditImpl::todo()const {
67 return m_todo; 99 return m_todo;
68} 100}
69QWidget* QuickEditImpl::widget() { 101QWidget* QuickEditImpl::widget() {
70 return this; 102 return this;
71} 103}
72void QuickEditImpl::slotEnter() { 104void QuickEditImpl::slotEnter() {
73 OPimTodo todo; 105 OPimTodo todo;
74 106
75 107
76 if (!m_edit->text().isEmpty() ) { 108 if (!m_edit->text().isEmpty() ) {
77 todo.setUid(1 ); // new uid 109 todo.setUid(1 ); // new uid
78 todo.setPriority( m_state ); 110 todo.setPriority( m_state );
79 todo.setSummary( m_edit->text() ); 111 todo.setSummary( m_edit->text() );
80 if ( ((Todo::MainWindow *)parent())->currentCatId() != 0 ) 112 if ( ((Todo::MainWindow *)parent())->currentCatId() != 0 )
81 todo.setCategories( ((Todo::MainWindow *)parent())->currentCatId() ); 113 todo.setCategories( ((Todo::MainWindow *)parent())->currentCatId() );
82 114
83 m_todo = todo; 115 m_todo = todo;
84 commit(); 116 commit();
85 } 117 }
86 m_todo = todo; 118 m_todo = todo;
87 reinit(); 119 reinit();
88} 120}
89void QuickEditImpl::slotPrio() { 121void QuickEditImpl::slotPrio() {
90 m_state -= 2; 122 m_state -= 2;
91 if ( m_state < 1 ) 123 if ( m_state < 1 )
92 m_state = 5; 124 m_state = 5;
93 125
94 switch( m_state ) { 126 switch( m_state ) {
95 case 1: 127 case 1:
96 m_lbl->setPixmap( priority1 ); 128 m_lbl->setPixmap( priority1 );
97 break; 129 break;
98 case 5: 130 case 5:
99 m_lbl->setPixmap( priority5 ); 131 m_lbl->setPixmap( priority5 );
100 break; 132 break;
101 case 3: 133 case 3:
102 default: 134 default:
103 m_lbl->setPixmap( priority3 ); 135 m_lbl->setPixmap( priority3 );
104 break; 136 break;
105 } 137 }
106} 138}
107void QuickEditImpl::slotMore() { 139void QuickEditImpl::slotMore() {
108 // TODO - implement 140 // TODO - implement
109} 141}
110void QuickEditImpl::slotCancel() { 142void QuickEditImpl::slotCancel() {
111 reinit(); 143 reinit();
112} 144}
113void QuickEditImpl::reinit() { 145void QuickEditImpl::reinit() {
114 m_state = 3; 146 m_state = 3;
115 m_lbl->setPixmap( priority3 ); 147 m_lbl->setPixmap( priority3 );
116 m_edit->clear(); 148 m_edit->clear();
117} 149}
diff --git a/core/pim/todo/quickeditimpl.h b/core/pim/todo/quickeditimpl.h
index d465dba..cfb33a9 100644
--- a/core/pim/todo/quickeditimpl.h
+++ b/core/pim/todo/quickeditimpl.h
@@ -1,41 +1,71 @@
1/*
2                 This file is part of the Opie Project
3
4 Copyright (C) Opie Team <opie-devel@handhelds.org>
5 =.
6 .=l.
7           .>+-=
8 _;:,     .>    :=|. This program is free software; you can
9.> <`_,   >  .   <= redistribute it and/or modify it under
10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11.="- .-=="i,     .._ License as published by the Free Software
12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13     ._= =}       : or (at your option) any later version.
14    .%`+i>       _;_.
15    .i_,=:_.      -<s. This program is distributed in the hope that
16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17 : ..    .:,     . . . without even the implied warranty of
18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20..}^=.=       =       ; Library General Public License for more
21++=   -.     .`     .: details.
22:     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA.
29*/
30
1#ifndef OPIE_QUICK_EDIT_IMPL_H 31#ifndef OPIE_QUICK_EDIT_IMPL_H
2#define OPIE_QUICK_EDIT_IMPL_H 32#define OPIE_QUICK_EDIT_IMPL_H
3 33
4#include <qpixmap.h> 34#include <qpixmap.h>
5 35
6#include <qtoolbar.h> 36#include <qtoolbar.h>
7 37
8#include "quickedit.h" 38#include "quickedit.h"
9 39
10class QLineEdit; 40class QLineEdit;
11class QLabel; 41class QLabel;
12 42
13class QuickEditImpl : public QToolBar, public Todo::QuickEdit { 43class QuickEditImpl : public QToolBar, public Todo::QuickEdit {
14 Q_OBJECT 44 Q_OBJECT
15public: 45public:
16 QuickEditImpl( QWidget* parent, bool visible); 46 QuickEditImpl( QWidget* parent, bool visible);
17 ~QuickEditImpl(); 47 ~QuickEditImpl();
18 OPimTodo todo()const; 48 OPimTodo todo()const;
19 QWidget* widget(); 49 QWidget* widget();
20private slots: 50private slots:
21 void slotEnter(); 51 void slotEnter();
22 void slotPrio(); 52 void slotPrio();
23 void slotMore(); 53 void slotMore();
24 void slotCancel(); 54 void slotCancel();
25private: 55private:
26 void reinit(); 56 void reinit();
27 int m_state; 57 int m_state;
28 QLabel* m_lbl; 58 QLabel* m_lbl;
29 QLineEdit* m_edit; 59 QLineEdit* m_edit;
30 QLabel* m_enter; 60 QLabel* m_enter;
31 QLabel* m_more; 61 QLabel* m_more;
32 QPopupMenu* m_menu; 62 QPopupMenu* m_menu;
33 OPimTodo m_todo; 63 OPimTodo m_todo;
34 bool m_visible; 64 bool m_visible;
35 65
36 QPixmap priority1; 66 QPixmap priority1;
37 QPixmap priority3; 67 QPixmap priority3;
38 QPixmap priority5; 68 QPixmap priority5;
39}; 69};
40 70
41#endif 71#endif
diff --git a/core/pim/todo/smalltodo.cpp b/core/pim/todo/smalltodo.cpp
index 504256d..c5e1201 100644
--- a/core/pim/todo/smalltodo.cpp
+++ b/core/pim/todo/smalltodo.cpp
@@ -1,113 +1,115 @@
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 <zecke@handhelds.org> 3
4           .>+-= 4 Copyright (C) Opie Team <opie-devel@handhelds.org>
5 _;:,     .>    :=|. This program is free software; you can 5 =.
6.> <`_,   >  .   <= redistribute it and/or modify it under 6 .=l.
7:`=1 )Y*s>-.--   : the terms of the GNU General Public 7           .>+-=
8.="- .-=="i,     .._ License as published by the Free Software 8 _;:,     .>    :=|. This program is free software; you can
9 - .   .-<_>     .<> Foundation; either version 2 of the License, 9.> <`_,   >  .   <= redistribute it and/or modify it under
10     ._= =}       : or (at your option) any later version. 10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11    .%`+i>       _;_. 11.="- .-=="i,     .._ License as published by the Free Software
12    .i_,=:_.      -<s. This program is distributed in the hope that 12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 13     ._= =}       : or (at your option) any later version.
14    : ..    .:,     . . . without even the implied warranty of 14    .%`+i>       _;_.
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 15    .i_,=:_.      -<s. This program is distributed in the hope that
16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17..}^=.=       =       ; Library General Public License for more 17 : ..    .:,     . . . without even the implied warranty of
18++=   -.     .`     .: details. 18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19 :     =  ...= . :.=- 19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20 -.   .:....=;==+<; You should have received a copy of the GNU 20..}^=.=       =       ; Library General Public License for more
21  -_. . .   )=.  = Library General Public License along with 21++=   -.     .`     .: details.
22    --        :-=` this library; see the file COPYING.LIB. 22:     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation, 26 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330, 27 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
26
27*/ 29*/
28 30
29#include "smalltodo.h" 31#include "smalltodo.h"
30 32
31using namespace Todo; 33using namespace Todo;
32 34
33struct SmallTodo::SmallTodoPrivate : public QShared{ 35struct SmallTodo::SmallTodoPrivate : public QShared{
34 36
35 SmallTodoPrivate() : QShared(), uid(-1) {}; 37 SmallTodoPrivate() : QShared(), uid(-1) {};
36 QString name; 38 QString name;
37 QStringList categories; // as real Names 39 QStringList categories; // as real Names
38 int uid; 40 int uid;
39 bool complete:1; 41 bool complete:1;
40 QDate date; 42 QDate date;
41 43
42 44
43 void deleteSelf() { delete this; }; 45 void deleteSelf() { delete this; };
44}; 46};
45 47
46SmallTodo::SmallTodo(int uid, 48SmallTodo::SmallTodo(int uid,
47 bool comp, 49 bool comp,
48 const QDate& date, 50 const QDate& date,
49 const QString& name, 51 const QString& name,
50 const QStringList& cats) { 52 const QStringList& cats) {
51 d = new SmallTodoPrivate(); 53 d = new SmallTodoPrivate();
52 d->name = name; 54 d->name = name;
53 d->uid = uid; 55 d->uid = uid;
54 d->categories = cats; 56 d->categories = cats;
55 d->complete = comp; 57 d->complete = comp;
56 d->date = date; 58 d->date = date;
57} 59}
58SmallTodo::SmallTodo( const SmallTodo& s ) : d(s.d) { 60SmallTodo::SmallTodo( const SmallTodo& s ) : d(s.d) {
59 d->ref(); 61 d->ref();
60} 62}
61SmallTodo::~SmallTodo() { 63SmallTodo::~SmallTodo() {
62 /* deref and if last one delete */ 64 /* deref and if last one delete */
63 if ( d->deref() ) { 65 if ( d->deref() ) {
64 d->deleteSelf(); 66 d->deleteSelf();
65 } 67 }
66} 68}
67bool SmallTodo::operator==( const SmallTodo& todo ) { 69bool SmallTodo::operator==( const SmallTodo& todo ) {
68 if ( d->complete != todo.d->complete ) return false; 70 if ( d->complete != todo.d->complete ) return false;
69 if ( d->name != todo.d->name ) return false; 71 if ( d->name != todo.d->name ) return false;
70 if ( d->uid != todo.d->uid ) return false; 72 if ( d->uid != todo.d->uid ) return false;
71 if ( d->categories != todo.d->categories ) return false; 73 if ( d->categories != todo.d->categories ) return false;
72 if ( d->date != todo.d->date ) return false; 74 if ( d->date != todo.d->date ) return false;
73 75
74 return true; 76 return true;
75} 77}
76bool SmallTodo::operator==( const SmallTodo& todo ) const{ 78bool SmallTodo::operator==( const SmallTodo& todo ) const{
77 if ( d->complete != todo.d->complete ) return false; 79 if ( d->complete != todo.d->complete ) return false;
78 if ( d->uid != todo.d->uid ) return false; 80 if ( d->uid != todo.d->uid ) return false;
79 if ( d->name != todo.d->name ) return false; 81 if ( d->name != todo.d->name ) return false;
80 if ( d->categories != todo.d->categories ) return false; 82 if ( d->categories != todo.d->categories ) return false;
81 if ( d->date != todo.d->date ) return false; 83 if ( d->date != todo.d->date ) return false;
82 84
83 return true; 85 return true;
84} 86}
85SmallTodo &SmallTodo::operator=( const SmallTodo& todo ) { 87SmallTodo &SmallTodo::operator=( const SmallTodo& todo ) {
86 todo.d->ref(); 88 todo.d->ref();
87 deref(); 89 deref();
88 90
89 d = todo.d; 91 d = todo.d;
90 92
91 return *this; 93 return *this;
92} 94}
93void SmallTodo::deref() { 95void SmallTodo::deref() {
94 if ( d->deref() ) { 96 if ( d->deref() ) {
95 delete d; 97 delete d;
96 d = 0; 98 d = 0;
97 } 99 }
98} 100}
99QString SmallTodo::name() const { 101QString SmallTodo::name() const {
100 return d->name; 102 return d->name;
101} 103}
102QStringList SmallTodo::categories()const { 104QStringList SmallTodo::categories()const {
103 return d->categories; 105 return d->categories;
104} 106}
105int SmallTodo::uid()const { 107int SmallTodo::uid()const {
106 return d->uid; 108 return d->uid;
107} 109}
108bool SmallTodo::isCompleted()const { 110bool SmallTodo::isCompleted()const {
109 return d->complete; 111 return d->complete;
110} 112}
111QDate SmallTodo::date()const { 113QDate SmallTodo::date()const {
112 return d->date; 114 return d->date;
113} 115}
diff --git a/core/pim/todo/smalltodo.h b/core/pim/todo/smalltodo.h
index 963218e..d6db0e6 100644
--- a/core/pim/todo/smalltodo.h
+++ b/core/pim/todo/smalltodo.h
@@ -1,70 +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 <zecke@handhelds.org> 3
4           .>+-= 4 Copyright (C) Opie Team <opie-devel@handhelds.org>
5 _;:,     .>    :=|. This program is free software; you can 5 =.
6.> <`_,   >  .   <= redistribute it and/or modify it under 6 .=l.
7:`=1 )Y*s>-.--   : the terms of the GNU General Public 7           .>+-=
8.="- .-=="i,     .._ License as published by the Free Software 8 _;:,     .>    :=|. This program is free software; you can
9 - .   .-<_>     .<> Foundation; either version 2 of the License, 9.> <`_,   >  .   <= redistribute it and/or modify it under
10     ._= =}       : or (at your option) any later version. 10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11    .%`+i>       _;_. 11.="- .-=="i,     .._ License as published by the Free Software
12    .i_,=:_.      -<s. This program is distributed in the hope that 12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 13     ._= =}       : or (at your option) any later version.
14    : ..    .:,     . . . without even the implied warranty of 14    .%`+i>       _;_.
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 15    .i_,=:_.      -<s. This program is distributed in the hope that
16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17..}^=.=       =       ; Library General Public License for more 17 : ..    .:,     . . . without even the implied warranty of
18++=   -.     .`     .: details. 18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19 :     =  ...= . :.=- 19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20 -.   .:....=;==+<; You should have received a copy of the GNU 20..}^=.=       =       ; Library General Public License for more
21  -_. . .   )=.  = Library General Public License along with 21++=   -.     .`     .: details.
22    --        :-=` this library; see the file COPYING.LIB. 22:     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation, 26 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330, 27 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
26
27*/ 29*/
28 30
29#ifndef TODO_SMALL_TODO_H 31#ifndef TODO_SMALL_TODO_H
30#define TODO_SMALL_TODO_H 32#define TODO_SMALL_TODO_H
31 33
32#include <qdatetime.h> 34#include <qdatetime.h>
33#include <qstring.h> 35#include <qstring.h>
34#include <qstringlist.h> 36#include <qstringlist.h>
35 37
36 38
37namespace Todo { 39namespace Todo {
38 /** 40 /**
39 * SmallTodo holds everything necessary 41 * SmallTodo holds everything necessary
40 * to represent a OPimTodo without holding 42 * to represent a OPimTodo without holding
41 * everything from a OPimTodo 43 * everything from a OPimTodo
42 */ 44 */
43 class SmallTodo { 45 class SmallTodo {
44 public: 46 public:
45 SmallTodo(int uid = 0, 47 SmallTodo(int uid = 0,
46 bool comp = false, 48 bool comp = false,
47 const QDate& date = QDate::currentDate(), 49 const QDate& date = QDate::currentDate(),
48 const QString& = QString::null, 50 const QString& = QString::null,
49 const QStringList& = QStringList() ); 51 const QStringList& = QStringList() );
50 SmallTodo( const SmallTodo& ); 52 SmallTodo( const SmallTodo& );
51 ~SmallTodo(); 53 ~SmallTodo();
52 54
53 bool operator==( const SmallTodo& ); 55 bool operator==( const SmallTodo& );
54 bool operator==( const SmallTodo& ) const; 56 bool operator==( const SmallTodo& ) const;
55 57
56 SmallTodo &operator=( const SmallTodo& ); 58 SmallTodo &operator=( const SmallTodo& );
57 QString name()const; 59 QString name()const;
58 QStringList categories()const; 60 QStringList categories()const;
59 int uid()const; 61 int uid()const;
60 bool isCompleted()const; 62 bool isCompleted()const;
61 QDate date()const; 63 QDate date()const;
62 64
63 private: 65 private:
64 struct SmallTodoPrivate; 66 struct SmallTodoPrivate;
65 SmallTodoPrivate* d; 67 SmallTodoPrivate* d;
66 void deref(); 68 void deref();
67 }; 69 };
68}; 70};
69 71
70#endif 72#endif
diff --git a/core/pim/todo/tableview.cpp b/core/pim/todo/tableview.cpp
index c64ad46..3e88974 100644
--- a/core/pim/todo/tableview.cpp
+++ b/core/pim/todo/tableview.cpp
@@ -1,369 +1,372 @@
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 <zecke> 3
4 .>+-= 4 Copyright (C) Opie Team <opie-devel@handhelds.org>
5_;:, .> :=|. This program is free software; you can 5 =.
6.> <`_, > . <= redistribute it and/or modify it under 6 .=l.
7:`=1 )Y*s>-.-- : the terms of the GNU General Public 7           .>+-=
8.="- .-=="i, .._ License as published by the Free Software 8 _;:,     .>    :=|. This program is free software; you can
9- . .-<_> .<> Foundation; either version 2 of the License, 9.> <`_,   >  .   <= redistribute it and/or modify it under
10 ._= =} : or (at your option) any later version. 10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11 .%`+i> _;_. 11.="- .-=="i,     .._ License as published by the Free Software
12 .i_,=:_. -<s. This program is distributed in the hope that 12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13 + . -:. = it will be useful, but WITHOUT ANY WARRANTY; 13     ._= =}       : or (at your option) any later version.
14 : .. .:, . . . without even the implied warranty of 14    .%`+i>       _;_.
15 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A 15    .i_,=:_.      -<s. This program is distributed in the hope that
16 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU 16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17..}^=.= = ; Library General Public License for more 17 : ..    .:,     . . . without even the implied warranty of
18++= -. .` .: details. 18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19: = ...= . :.=- 19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20-. .:....=;==+<; You should have received a copy of the GNU 20..}^=.=       =       ; Library General Public License for more
21 -_. . . )=. = Library General Public License along with 21++=   -.     .`     .: details.
22 -- :-=` this library; see the file COPYING.LIB. 22:     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation, 26 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330, 27 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
26
27*/ 29*/
30
28#include <stdlib.h> 31#include <stdlib.h>
29#include <cmath> 32#include <cmath>
30#include <cctype> 33#include <cctype>
31 34
32#include <opie2/odebug.h> 35#include <opie2/odebug.h>
33#include <opie2/opimrecurrence.h> 36#include <opie2/opimrecurrence.h>
37#include <opie2/oresource.h>
34 38
35#include <qpe/config.h> 39#include <qpe/config.h>
36#include <qpe/qpeapplication.h> 40#include <qpe/qpeapplication.h>
37#include <qpe/resource.h>
38 41
39#include <qcombobox.h> 42#include <qcombobox.h>
40#include <qlineedit.h> 43#include <qlineedit.h>
41#include <qpopupmenu.h> 44#include <qpopupmenu.h>
42 45
43#include "mainwindow.h" 46#include "mainwindow.h"
44//#include "tableitems.h" 47//#include "tableitems.h"
45#include "tableview.h" 48#include "tableview.h"
46 49
47using namespace Todo; 50using namespace Todo;
48 51
49namespace { 52namespace {
50 static const int BoxSize = 14; 53 static const int BoxSize = 14;
51 static const int RowHeight = 20; 54 static const int RowHeight = 20;
52} 55}
53 56
54TableView::EditorWidget::EditorWidget() : m_wid(0l), m_row(-1), m_col(-1) { 57TableView::EditorWidget::EditorWidget() : m_wid(0l), m_row(-1), m_col(-1) {
55} 58}
56void TableView::EditorWidget::setCellWidget(QWidget* wid, int row, int col ) { 59void TableView::EditorWidget::setCellWidget(QWidget* wid, int row, int col ) {
57 m_wid = wid; 60 m_wid = wid;
58 m_row = row; 61 m_row = row;
59 m_col = col; 62 m_col = col;
60} 63}
61void TableView::EditorWidget::releaseCellWidget() { 64void TableView::EditorWidget::releaseCellWidget() {
62 m_wid = 0; 65 m_wid = 0;
63 m_row = m_col = -1; 66 m_row = m_col = -1;
64} 67}
65QWidget* TableView::EditorWidget::cellWidget()const { 68QWidget* TableView::EditorWidget::cellWidget()const {
66 return m_wid; 69 return m_wid;
67} 70}
68int TableView::EditorWidget::cellRow()const { 71int TableView::EditorWidget::cellRow()const {
69 return m_row; 72 return m_row;
70} 73}
71int TableView::EditorWidget::cellCol()const { 74int TableView::EditorWidget::cellCol()const {
72 return m_col; 75 return m_col;
73} 76}
74 77
75 78
76void TableView::initConfig() { 79void TableView::initConfig() {
77 Config config( "todo" ); 80 Config config( "todo" );
78 config.setGroup( "Options" ); 81 config.setGroup( "Options" );
79 m_completeStrokeWidth = config.readNumEntry( "CompleteStrokeWidth", 8 ); 82 m_completeStrokeWidth = config.readNumEntry( "CompleteStrokeWidth", 8 );
80 for (int i = 0; i < numCols(); i++ ) { 83 for (int i = 0; i < numCols(); i++ ) {
81 int width = config.readNumEntry("Width"+QString::number(i), -1 ); 84 int width = config.readNumEntry("Width"+QString::number(i), -1 );
82 setColumnWidth(i, width == -1 ? columnWidth(i) : width ); 85 setColumnWidth(i, width == -1 ? columnWidth(i) : width );
83 } 86 }
84} 87}
85 88
86TableView::TableView( MainWindow* window, QWidget* wid ) 89TableView::TableView( MainWindow* window, QWidget* wid )
87 : QTable( wid ), TodoView( window ) { 90 : QTable( wid ), TodoView( window ) {
88 91
89 setName("TableView"); 92 setName("TableView");
90 // Load icons 93 // Load icons
91 // TODO - probably should be done globally somewhere else, 94 // TODO - probably should be done globally somewhere else,
92 // see also quickeditimpl.cpp/h, taskeditoroverview.cpp/h 95 // see also quickeditimpl.cpp/h, taskeditoroverview.cpp/h
93 m_pic_completed = Resource::loadPixmap( "todo/completed" ); 96 m_pic_completed = Opie::Core::OResource::loadPixmap( "todo/completed" );
94 QString namestr; 97 QString namestr;
95 for ( unsigned int i = 1; i < 6; i++ ) { 98 for ( unsigned int i = 1; i < 6; i++ ) {
96 namestr = "todo/priority"; 99 namestr = "todo/priority";
97 namestr.append( QString::number( i ) ); 100 namestr.append( QString::number( i ) );
98 m_pic_priority[ i - 1 ] = Resource::loadPixmap( namestr ); 101 m_pic_priority[ i - 1 ] = Opie::Core::OResource::loadPixmap( namestr );
99 } 102 }
100 103
101 setUpdatesEnabled( false ); 104 setUpdatesEnabled( false );
102 viewport()->setUpdatesEnabled( false ); 105 viewport()->setUpdatesEnabled( false );
103 m_enablePaint = false; 106 m_enablePaint = false;
104 setNumRows(0); 107 setNumRows(0);
105 setNumCols(4); 108 setNumCols(4);
106 109
107 horizontalHeader()->setLabel( 0, QWidget::tr("C.") ); 110 horizontalHeader()->setLabel( 0, QWidget::tr("C.") );
108 horizontalHeader()->setLabel( 1, QWidget::tr("Priority") ); 111 horizontalHeader()->setLabel( 1, QWidget::tr("Priority") );
109 horizontalHeader()->setLabel( 2, QWidget::tr("Summary" ) ); 112 horizontalHeader()->setLabel( 2, QWidget::tr("Summary" ) );
110 horizontalHeader()->setLabel( 3, QWidget::tr("Deadline") ); 113 horizontalHeader()->setLabel( 3, QWidget::tr("Deadline") );
111 114
112 setShowDeadline( todoWindow()->showDeadline() ); 115 setShowDeadline( todoWindow()->showDeadline() );
113 116
114 setSorting( TRUE ); 117 setSorting( TRUE );
115 setSelectionMode( NoSelection ); 118 setSelectionMode( NoSelection );
116 119
117 setLeftMargin( 0 ); 120 setLeftMargin( 0 );
118 verticalHeader()->hide(); 121 verticalHeader()->hide();
119 122
120 QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); 123 QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold );
121 connect((QTable*)this, SIGNAL( clicked(int,int,int,const QPoint&) ), 124 connect((QTable*)this, SIGNAL( clicked(int,int,int,const QPoint&) ),
122 this, SLOT( slotClicked(int,int,int,const QPoint&) ) ); 125 this, SLOT( slotClicked(int,int,int,const QPoint&) ) );
123 connect((QTable*)this, SIGNAL(valueChanged(int,int) ), 126 connect((QTable*)this, SIGNAL(valueChanged(int,int) ),
124 this, SLOT( slotValueChanged(int,int) ) ); 127 this, SLOT( slotValueChanged(int,int) ) );
125 connect((QTable*)this, SIGNAL(currentChanged(int,int) ), 128 connect((QTable*)this, SIGNAL(currentChanged(int,int) ),
126 this, SLOT( slotCurrentChanged(int,int) ) ); 129 this, SLOT( slotCurrentChanged(int,int) ) );
127 130
128 /* now let's init the config */ 131 /* now let's init the config */
129 initConfig(); 132 initConfig();
130 133
131 134
132 m_enablePaint = true; 135 m_enablePaint = true;
133 setUpdatesEnabled( true ); 136 setUpdatesEnabled( true );
134 viewport()->setUpdatesEnabled( true ); 137 viewport()->setUpdatesEnabled( true );
135 viewport()->update(); 138 viewport()->update();
136 setSortOrder( Opie::OPimTodoAccess::Completed ); 139 setSortOrder( Opie::OPimTodoAccess::Completed );
137 setAscending( TRUE ); 140 setAscending( TRUE );
138 m_first = true; 141 m_first = true;
139 142
140 143
141} 144}
142/* a new day has started 145/* a new day has started
143 * update the day 146 * update the day
144 */ 147 */
145void TableView::newDay() { 148void TableView::newDay() {
146 clear(); 149 clear();
147 updateView(); 150 updateView();
148} 151}
149TableView::~TableView() { 152TableView::~TableView() {
150 Config config( "todo" ); 153 Config config( "todo" );
151 config.setGroup( "Options" ); 154 config.setGroup( "Options" );
152 for (int i = 0; i < numCols(); i++ ) 155 for (int i = 0; i < numCols(); i++ )
153 config.writeEntry("Width"+QString::number(i), columnWidth(i) ); 156 config.writeEntry("Width"+QString::number(i), columnWidth(i) );
154} 157}
155QString TableView::type() const { 158QString TableView::type() const {
156 return QString::fromLatin1( tr("Table View") ); 159 return QString::fromLatin1( tr("Table View") );
157} 160}
158int TableView::current() { 161int TableView::current() {
159 if (numRows() == 0 ) return 0; 162 if (numRows() == 0 ) return 0;
160 int uid = sorted().uidAt(currentRow() ); 163 int uid = sorted().uidAt(currentRow() );
161 164
162 return uid; 165 return uid;
163} 166}
164int TableView::next() { 167int TableView::next() {
165 if ( numRows() == 0 ) return 0; 168 if ( numRows() == 0 ) return 0;
166 if ( currentRow() + 1 >= numRows() ) return 0; 169 if ( currentRow() + 1 >= numRows() ) return 0;
167 setCurrentCell( currentRow() +1, currentColumn() ); 170 setCurrentCell( currentRow() +1, currentColumn() );
168 return sorted().uidAt( currentRow() ); 171 return sorted().uidAt( currentRow() );
169} 172}
170int TableView::prev() { 173int TableView::prev() {
171 if ( numRows() == 0 ) return 0; 174 if ( numRows() == 0 ) return 0;
172 if ( currentRow() - 1 < 0 ) return 0; 175 if ( currentRow() - 1 < 0 ) return 0;
173 setCurrentCell( currentRow() -1, currentColumn() ); 176 setCurrentCell( currentRow() -1, currentColumn() );
174 return sorted().uidAt( currentRow() ); 177 return sorted().uidAt( currentRow() );
175 178
176} 179}
177QString TableView::currentRepresentation() { 180QString TableView::currentRepresentation() {
178 OPimTodo to = sorted()[currentRow()]; 181 OPimTodo to = sorted()[currentRow()];
179 return to.summary().isEmpty() ? to.description().left(20) : to.summary() ; 182 return to.summary().isEmpty() ? to.description().left(20) : to.summary() ;
180} 183}
181/* show overdue */ 184/* show overdue */
182void TableView::showOverDue( bool ) { 185void TableView::showOverDue( bool ) {
183 clear(); 186 clear();
184 updateView(); 187 updateView();
185} 188}
186 189
187void TableView::updateView( ) { 190void TableView::updateView( ) {
188 m_row = false; 191 m_row = false;
189 static int id; 192 static int id;
190 id = startTimer(4000 ); 193 id = startTimer(4000 );
191 /* FIXME we want one page to be read! 194 /* FIXME we want one page to be read!
192 * 195 *
193 * Calculate that screensize 196 * Calculate that screensize
194 */ 197 */
195 todoWindow()->setReadAhead( 4 ); 198 todoWindow()->setReadAhead( 4 );
196 sort(); 199 sort();
197 OPimTodoAccess::List::Iterator it, end; 200 OPimTodoAccess::List::Iterator it, end;
198 it = sorted().begin(); 201 it = sorted().begin();
199 end = sorted().end(); 202 end = sorted().end();
200 203
201 QTime time; 204 QTime time;
202 time.start(); 205 time.start();
203 m_enablePaint = false; 206 m_enablePaint = false;
204 setUpdatesEnabled( false ); 207 setUpdatesEnabled( false );
205 viewport()->setUpdatesEnabled( false ); 208 viewport()->setUpdatesEnabled( false );
206 209
207 setNumRows( it.count() ); 210 setNumRows( it.count() );
208 if ( it.count() == 0 ) 211 if ( it.count() == 0 )
209 killTimer(id); 212 killTimer(id);
210 213
211// int elc = time.elapsed(); 214// int elc = time.elapsed();
212 setUpdatesEnabled( true ); 215 setUpdatesEnabled( true );
213 viewport()->setUpdatesEnabled( true ); 216 viewport()->setUpdatesEnabled( true );
214 viewport()->update(); 217 viewport()->update();
215 218
216 m_enablePaint = true; 219 m_enablePaint = true;
217// int el = time.elapsed(); 220// int el = time.elapsed();
218} 221}
219void TableView::setTodo( int, const OPimTodo&) { 222void TableView::setTodo( int, const OPimTodo&) {
220 sort(); 223 sort();
221 224
222 /* repaint */ 225 /* repaint */
223 repaint(); 226 repaint();
224} 227}
225void TableView::addEvent( const OPimTodo&) { 228void TableView::addEvent( const OPimTodo&) {
226 229
227 /* fix problems of not showing the 'Haken' */ 230 /* fix problems of not showing the 'Haken' */
228 updateView(); 231 updateView();
229} 232}
230/* 233/*
231 * find the event 234 * find the event
232 * and then replace the complete row 235 * and then replace the complete row
233 */ 236 */
234void TableView::replaceEvent( const OPimTodo& ev) { 237void TableView::replaceEvent( const OPimTodo& ev) {
235 addEvent( ev ); 238 addEvent( ev );
236} 239}
237/* 240/*
238 * re aligning table can be slow too 241 * re aligning table can be slow too
239 * FIXME: look what performs better 242 * FIXME: look what performs better
240 * either this or the old align table 243 * either this or the old align table
241 */ 244 */
242void TableView::removeEvent( int ) { 245void TableView::removeEvent( int ) {
243 updateView(); 246 updateView();
244} 247}
245void TableView::setShowCompleted( bool ) { 248void TableView::setShowCompleted( bool ) {
246 updateView(); 249 updateView();
247} 250}
248void TableView::setShowDeadline( bool b ) { 251void TableView::setShowDeadline( bool b ) {
249 if ( b ) 252 if ( b )
250 showColumn( 3 ); 253 showColumn( 3 );
251 else 254 else
252 hideColumn( 3 ); 255 hideColumn( 3 );
253 256
254 // Try to intelligently size columns 257 // Try to intelligently size columns
255 // TODO - would use width() below, but doesn't have valid value at time of c'tor 258 // TODO - would use width() below, but doesn't have valid value at time of c'tor
256 int col2width = 238; 259 int col2width = 238;
257 int width = m_pic_completed.width(); 260 int width = m_pic_completed.width();
258 setColumnWidth( 0, width ); 261 setColumnWidth( 0, width );
259 col2width -= width; 262 col2width -= width;
260 width = fontMetrics().boundingRect( horizontalHeader()->label( 1 ) ).width() + 8; 263 width = fontMetrics().boundingRect( horizontalHeader()->label( 1 ) ).width() + 8;
261 setColumnWidth( 1, width ); 264 setColumnWidth( 1, width );
262 col2width -= width; 265 col2width -= width;
263 if ( b ) { 266 if ( b ) {
264 width = fontMetrics().boundingRect( horizontalHeader()->label( 3 ) ).width() + 8; 267 width = fontMetrics().boundingRect( horizontalHeader()->label( 3 ) ).width() + 8;
265 setColumnWidth( 3, width ); 268 setColumnWidth( 3, width );
266 col2width -= width; 269 col2width -= width;
267 } 270 }
268 setColumnWidth( 2, col2width ); 271 setColumnWidth( 2, col2width );
269} 272}
270void TableView::setShowCategory( const QString& str) { 273void TableView::setShowCategory( const QString& str) {
271 if ( str != m_oleCat || m_first ) 274 if ( str != m_oleCat || m_first )
272 updateView(); 275 updateView();
273 276
274 m_oleCat = str; 277 m_oleCat = str;
275 m_first = false; 278 m_first = false;
276} 279}
277void TableView::clear() { 280void TableView::clear() {
278 setNumRows(0); 281 setNumRows(0);
279} 282}
280void TableView::slotClicked(int row, int col, int, 283void TableView::slotClicked(int row, int col, int,
281 const QPoint& point) { 284 const QPoint& point) {
282 if ( m_editorWidget.cellWidget() ) { 285 if ( m_editorWidget.cellWidget() ) {
283 //setCellContentFromEditor(m_editorWidget.cellRow(), m_editorWidget.cellCol() ); 286 //setCellContentFromEditor(m_editorWidget.cellRow(), m_editorWidget.cellCol() );
284 endEdit(m_editorWidget.cellRow(), m_editorWidget.cellCol(), 287 endEdit(m_editorWidget.cellRow(), m_editorWidget.cellCol(),
285 true, true ); 288 true, true );
286 m_editorWidget.releaseCellWidget(); 289 m_editorWidget.releaseCellWidget();
287 } 290 }
288 291
289 if ( !cellGeometry(row, col ).contains(point ) ) 292 if ( !cellGeometry(row, col ).contains(point ) )
290 return; 293 return;
291 294
292 int ui= sorted().uidAt( row ); 295 int ui= sorted().uidAt( row );
293 296
294 297
295 switch( col ) { 298 switch( col ) {
296 case 0:{ 299 case 0:{
297 int x = point.x() -columnPos( col ); 300 int x = point.x() -columnPos( col );
298 int y = point.y() -rowPos( row ); 301 int y = point.y() -rowPos( row );
299 int w = columnWidth( col ); 302 int w = columnWidth( col );
300 int h = rowHeight( row ); 303 int h = rowHeight( row );
301 if ( x >= ( w - BoxSize ) / 2 && 304 if ( x >= ( w - BoxSize ) / 2 &&
302 x <= ( w - BoxSize ) / 2 + BoxSize && 305 x <= ( w - BoxSize ) / 2 + BoxSize &&
303 y >= ( h - BoxSize ) / 2 && 306 y >= ( h - BoxSize ) / 2 &&
304 y <= ( h - BoxSize ) / 2 + BoxSize ) { 307 y <= ( h - BoxSize ) / 2 + BoxSize ) {
305 TodoView::complete(sorted()[row] ); 308 TodoView::complete(sorted()[row] );
306 } 309 }
307 } 310 }
308 break; 311 break;
309 312
310 // Priority emit a double click... 313 // Priority emit a double click...
311 case 1:{ 314 case 1:{
312 QWidget* wid = beginEdit( row, col, FALSE ); 315 QWidget* wid = beginEdit( row, col, FALSE );
313 m_editorWidget.setCellWidget( wid, row, col ); 316 m_editorWidget.setCellWidget( wid, row, col );
314 } 317 }
315 break; 318 break;
316 319
317 case 2: { 320 case 2: {
318 showTodo( ui ); 321 showTodo( ui );
319 break; 322 break;
320 } 323 }
321 case 3: { 324 case 3: {
322 TodoView::edit( ui ); 325 TodoView::edit( ui );
323 break; 326 break;
324 } 327 }
325 } 328 }
326 329
327 330
328} 331}
329QWidget* TableView::widget() { 332QWidget* TableView::widget() {
330 return this; 333 return this;
331} 334}
332/* 335/*
333 * We need to overwrite sortColumn 336 * We need to overwrite sortColumn
334 * because we want to sort whole row 337 * because we want to sort whole row
335 * based 338 * based
336 * We event want to set the setOrder 339 * We event want to set the setOrder
337 * to a sort() and update() 340 * to a sort() and update()
338 */ 341 */
339void TableView::sortColumn( int col, bool asc, bool ) { 342void TableView::sortColumn( int col, bool asc, bool ) {
340 switch(col) { 343 switch(col) {
341 case 1: 344 case 1:
342 col = Opie::OPimTodoAccess::Priority; 345 col = Opie::OPimTodoAccess::Priority;
343 break; 346 break;
344 case 2: 347 case 2:
345 col = Opie::OPimTodoAccess::SortSummary; 348 col = Opie::OPimTodoAccess::SortSummary;
346 break; 349 break;
347 case 3: 350 case 3:
348 col = Opie::OPimTodoAccess::Deadline; 351 col = Opie::OPimTodoAccess::Deadline;
349 break; 352 break;
350 case 0: 353 case 0:
351 default: 354 default:
352 col = Opie::OPimTodoAccess::Completed; 355 col = Opie::OPimTodoAccess::Completed;
353 break; 356 break;
354 } 357 }
355 358
356 setSortOrder( col ); 359 setSortOrder( col );
357 setAscending( asc ); 360 setAscending( asc );
358 updateView(); 361 updateView();
359} 362}
360void TableView::viewportPaintEvent( QPaintEvent* e) { 363void TableView::viewportPaintEvent( QPaintEvent* e) {
361 if (m_enablePaint ) 364 if (m_enablePaint )
362 QTable::viewportPaintEvent( e ); 365 QTable::viewportPaintEvent( e );
363} 366}
364/* 367/*
365 * This segment is copyrighted by TT 368 * This segment is copyrighted by TT
366 * it was taken from their todolist 369 * it was taken from their todolist
367 * application this code is GPL 370 * application this code is GPL
368 */ 371 */
369void TableView::paintCell(QPainter* p, int row, int col, const QRect& cr, bool ) { 372void TableView::paintCell(QPainter* p, int row, int col, const QRect& cr, bool ) {
diff --git a/core/pim/todo/tableview.h b/core/pim/todo/tableview.h
index 46c16e1..6693d86 100644
--- a/core/pim/todo/tableview.h
+++ b/core/pim/todo/tableview.h
@@ -1,122 +1,124 @@
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
4 .>+-= 4 Copyright (C) Opie Team <opie-devel@handhelds.org>
5_;:, .> :=|. This program is free software; you can 5 =.
6.> <`_, > . <= redistribute it and/or modify it under 6 .=l.
7:`=1 )Y*s>-.-- : the terms of the GNU General Public 7           .>+-=
8.="- .-=="i, .._ License as published by the Free Software 8 _;:,     .>    :=|. This program is free software; you can
9- . .-<_> .<> Foundation; either version 2 of the License, 9.> <`_,   >  .   <= redistribute it and/or modify it under
10 ._= =} : or (at your option) any later version. 10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11 .%`+i> _;_. 11.="- .-=="i,     .._ License as published by the Free Software
12 .i_,=:_. -<s. This program is distributed in the hope that 12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13 + . -:. = it will be useful, but WITHOUT ANY WARRANTY; 13     ._= =}       : or (at your option) any later version.
14 : .. .:, . . . without even the implied warranty of 14    .%`+i>       _;_.
15 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A 15    .i_,=:_.      -<s. This program is distributed in the hope that
16 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU 16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17..}^=.= = ; Library General Public License for more 17 : ..    .:,     . . . without even the implied warranty of
18++= -. .` .: details. 18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19: = ...= . :.=- 19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20-. .:....=;==+<; You should have received a copy of the GNU 20..}^=.=       =       ; Library General Public License for more
21 -_. . . )=. = Library General Public License along with 21++=   -.     .`     .: details.
22 -- :-=` this library; see the file COPYING.LIB. 22:     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation, 26 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330, 27 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
26
27*/ 29*/
28 30
29#ifndef OPIE_TABLE_VIEW_H 31#ifndef OPIE_TABLE_VIEW_H
30#define OPIE_TABLE_VIEW_H 32#define OPIE_TABLE_VIEW_H
31 33
32#include <qtable.h> 34#include <qtable.h>
33#include <qmap.h> 35#include <qmap.h>
34#include <qpixmap.h> 36#include <qpixmap.h>
35 37
36#include "todoview.h" 38#include "todoview.h"
37 39
38class QTimer; 40class QTimer;
39 41
40namespace Todo { 42namespace Todo {
41 class CheckItem; 43 class CheckItem;
42 class DueTextItem; 44 class DueTextItem;
43 class TableView : public QTable, public TodoView { 45 class TableView : public QTable, public TodoView {
44 Q_OBJECT 46 Q_OBJECT
45 public: 47 public:
46 TableView( MainWindow*, QWidget* parent ); 48 TableView( MainWindow*, QWidget* parent );
47 ~TableView(); 49 ~TableView();
48 50
49 51
50 QString type()const; 52 QString type()const;
51 int current(); 53 int current();
52 QString currentRepresentation(); 54 QString currentRepresentation();
53 int next(); 55 int next();
54 int prev(); 56 int prev();
55 57
56 void clear(); 58 void clear();
57 void showOverDue( bool ); 59 void showOverDue( bool );
58 void updateView(); 60 void updateView();
59 void setTodo( int uid, const OPimTodo& ); 61 void setTodo( int uid, const OPimTodo& );
60 void addEvent( const OPimTodo& event ); 62 void addEvent( const OPimTodo& event );
61 void replaceEvent( const OPimTodo& ); 63 void replaceEvent( const OPimTodo& );
62 void removeEvent( int uid ); 64 void removeEvent( int uid );
63 void setShowCompleted( bool ); 65 void setShowCompleted( bool );
64 void setShowDeadline( bool ); 66 void setShowDeadline( bool );
65 67
66 void setShowCategory(const QString& =QString::null ); 68 void setShowCategory(const QString& =QString::null );
67 void newDay(); 69 void newDay();
68 QWidget* widget(); 70 QWidget* widget();
69 void sortColumn(int, bool, bool ); 71 void sortColumn(int, bool, bool );
70 72
71 /* 73 /*
72 * we do our drawing ourselves 74 * we do our drawing ourselves
73 * because we don't want to have 75 * because we don't want to have
74 * 40.000 QTableItems for 10.000 76 * 40.000 QTableItems for 10.000
75 * OPimTodos where we only show 10 at a time! 77 * OPimTodos where we only show 10 at a time!
76 */ 78 */
77 void paintCell(QPainter* p, int row, int col, const QRect&, bool ); 79 void paintCell(QPainter* p, int row, int col, const QRect&, bool );
78 private: 80 private:
79 /* reimplented for internal reasons */ 81 /* reimplented for internal reasons */
80 void viewportPaintEvent( QPaintEvent* ); 82 void viewportPaintEvent( QPaintEvent* );
81 bool m_enablePaint:1; 83 bool m_enablePaint:1;
82 QString m_oleCat; 84 QString m_oleCat;
83 bool m_first : 1; 85 bool m_first : 1;
84 86
85 QPixmap m_pic_completed; 87 QPixmap m_pic_completed;
86 QPixmap m_pic_priority[ 5 ]; 88 QPixmap m_pic_priority[ 5 ];
87 89
88 protected: 90 protected:
89 void keyPressEvent( QKeyEvent* ); 91 void keyPressEvent( QKeyEvent* );
90 void contentsMouseReleaseEvent( QMouseEvent *e ); 92 void contentsMouseReleaseEvent( QMouseEvent *e );
91 void contentsMousePressEvent( QMouseEvent *e ); 93 void contentsMousePressEvent( QMouseEvent *e );
92 void timerEvent( QTimerEvent* e ); 94 void timerEvent( QTimerEvent* e );
93 QWidget* createEditor(int row, int col, bool initFromCell )const; 95 QWidget* createEditor(int row, int col, bool initFromCell )const;
94 void setCellContentFromEditor( int row, int col ); 96 void setCellContentFromEditor( int row, int col );
95 /** 97 /**
96 * for inline editing on single click and to work around some 98 * for inline editing on single click and to work around some
97 * bug in qt2.3.5 99 * bug in qt2.3.5
98 */ 100 */
99 struct EditorWidget { 101 struct EditorWidget {
100 EditorWidget(); 102 EditorWidget();
101 void setCellWidget(QWidget*, int row, int col ); 103 void setCellWidget(QWidget*, int row, int col );
102 void releaseCellWidget(); 104 void releaseCellWidget();
103 QWidget* cellWidget()const; 105 QWidget* cellWidget()const;
104 int cellRow()const; 106 int cellRow()const;
105 int cellCol()const; 107 int cellCol()const;
106 private: 108 private:
107 QWidget* m_wid; 109 QWidget* m_wid;
108 int m_row, m_col; 110 int m_row, m_col;
109 }; 111 };
110 EditorWidget m_editorWidget; 112 EditorWidget m_editorWidget;
111 113
112private slots: 114private slots:
113 void slotClicked(int, int, int, 115 void slotClicked(int, int, int,
114 const QPoint& ); 116 const QPoint& );
115 void slotPriority(); 117 void slotPriority();
116 private: 118 private:
117 void initConfig(); 119 void initConfig();
118 int m_completeStrokeWidth; 120 int m_completeStrokeWidth;
119 bool m_row : 1; 121 bool m_row : 1;
120 QPoint m_prevP; 122 QPoint m_prevP;
121 }; 123 };
122}; 124};
diff --git a/core/pim/todo/taskeditoralarms.cpp b/core/pim/todo/taskeditoralarms.cpp
index 62fc600..054984d 100644
--- a/core/pim/todo/taskeditoralarms.cpp
+++ b/core/pim/todo/taskeditoralarms.cpp
@@ -1,196 +1,201 @@
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
4           .>+-= 4 Copyright (C) Opie Team <opie-devel@handhelds.org>
5 _;:,     .>    :=|. This program is free software; you can 5 =.
6.> <`_,   >  .   <= redistribute it and/or modify it under 6 .=l.
7:`=1 )Y*s>-.--   : the terms of the GNU General Public 7           .>+-=
8.="- .-=="i,     .._ License as published by the Free Software 8 _;:,     .>    :=|. This program is free software; you can
9 - .   .-<_>     .<> Foundation; either version 2 of the License, 9.> <`_,   >  .   <= redistribute it and/or modify it under
10     ._= =}       : or (at your option) any later version. 10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11    .%`+i>       _;_. 11.="- .-=="i,     .._ License as published by the Free Software
12    .i_,=:_.      -<s. This program is distributed in the hope that 12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 13     ._= =}       : or (at your option) any later version.
14    : ..    .:,     . . . without even the implied warranty of 14    .%`+i>       _;_.
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 15    .i_,=:_.      -<s. This program is distributed in the hope that
16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17..}^=.=       =       ; Library General Public License for more 17 : ..    .:,     . . . without even the implied warranty of
18++=   -.     .`     .: details. 18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19 :     =  ...= . :.=- 19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20 -.   .:....=;==+<; You should have received a copy of the GNU 20..}^=.=       =       ; Library General Public License for more
21  -_. . .   )=.  = General Public License along with 21++=   -.     .`     .: details.
22    --        :-=` this library; see the file COPYING.LIB. 22:     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation, 26 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330, 27 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
26
27*/ 29*/
28 30
29#include "taskeditoralarms.h" 31#include "taskeditoralarms.h"
30 32
31#include <opie2/opimnotifymanager.h> 33#include <opie2/opimnotifymanager.h>
34#include <opie2/oresource.h>
32#include <opie2/otimepicker.h> 35#include <opie2/otimepicker.h>
33 36
34#include <qpe/datebookmonth.h> 37#include <qpe/datebookmonth.h>
35#include <qpe/resource.h>
36 38
37#include <qlistview.h> 39#include <qlistview.h>
38#include <qlayout.h> 40#include <qlayout.h>
39 41
40 42
41using namespace Opie::Ui; 43using namespace Opie::Ui;
42class AlarmItem : public QListViewItem { 44class AlarmItem : public QListViewItem {
43public: 45public:
44 AlarmItem( QListView*, const OPimAlarm& ); 46 AlarmItem( QListView*, const OPimAlarm& );
45 ~AlarmItem(); 47 ~AlarmItem();
46 48
47 OPimAlarm alarm()const; 49 OPimAlarm alarm()const;
48 void setAlarm( const OPimAlarm& ); 50 void setAlarm( const OPimAlarm& );
49private: 51private:
50 QDateTime m_dt; 52 QDateTime m_dt;
51 int m_type; 53 int m_type;
52}; 54};
53AlarmItem::AlarmItem( QListView* view, const OPimAlarm& dt) 55AlarmItem::AlarmItem( QListView* view, const OPimAlarm& dt)
54 : QListViewItem(view) { 56 : QListViewItem(view) {
55 setAlarm( dt ); 57 setAlarm( dt );
56} 58}
57void AlarmItem::setAlarm( const OPimAlarm& dt ) { 59void AlarmItem::setAlarm( const OPimAlarm& dt ) {
58 m_dt = dt.dateTime(); 60 m_dt = dt.dateTime();
59 m_type = dt.sound(); 61 m_type = dt.sound();
60 setText( 0, TimeString::dateString( m_dt.date() ) ); 62 setText( 0, TimeString::dateString( m_dt.date() ) );
61 setText( 1, TimeString::timeString( m_dt.time() ) ); 63 setText( 1, TimeString::timeString( m_dt.time() ) );
62 setText( 2, m_type == 0 ? QObject::tr("silent") : QObject::tr("loud") ); 64 setText( 2, m_type == 0 ? QObject::tr("silent") : QObject::tr("loud") );
63} 65}
64AlarmItem::~AlarmItem() { 66AlarmItem::~AlarmItem() {
65} 67}
66OPimAlarm AlarmItem::alarm()const{ 68OPimAlarm AlarmItem::alarm()const{
67 OPimAlarm al( m_type, m_dt ); 69 OPimAlarm al( m_type, m_dt );
68 70
69 return al; 71 return al;
70} 72}
71 73
72TaskEditorAlarms::TaskEditorAlarms( QWidget* parent, int, const char* name, WFlags fl ) 74TaskEditorAlarms::TaskEditorAlarms( QWidget* parent, int, const char* name, WFlags fl )
73 : QWidget( parent, name, fl ) 75 : QWidget( parent, name, fl )
74{ 76{
75 m_date = m_type = m_time = 0; 77 m_date = m_type = m_time = 0;
76 QGridLayout *layout = new QGridLayout( this, 2, 2, 4, 4 ); 78 QGridLayout *layout = new QGridLayout( this, 2, 2, 4, 4 );
77 79
78 lstAlarms = new QListView( this ); 80 lstAlarms = new QListView( this );
79 lstAlarms->addColumn( tr("Date") ); 81 lstAlarms->addColumn( tr("Date") );
80 lstAlarms->addColumn( tr("Time") ); 82 lstAlarms->addColumn( tr("Time") );
81 lstAlarms->addColumn( tr("Type") ); 83 lstAlarms->addColumn( tr("Type") );
82 84
83 connect( lstAlarms, SIGNAL(clicked(QListViewItem*,const QPoint&,int) ), 85 connect( lstAlarms, SIGNAL(clicked(QListViewItem*,const QPoint&,int) ),
84 this, SLOT(inlineEdit(QListViewItem*,const QPoint&,int) ) ); 86 this, SLOT(inlineEdit(QListViewItem*,const QPoint&,int) ) );
85 87
86 layout->addMultiCellWidget( lstAlarms, 0, 0, 0, 2 ); 88 layout->addMultiCellWidget( lstAlarms, 0, 0, 0, 2 );
87 89
88 QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), this ); 90 QPushButton *btn = new QPushButton( Opie::Core::OResource::loadPixmap( "new", Opie::Core::OResource::SmallIcon ),
91 tr( "New" ), this );
89 //QWhatsThis::add( btn, tr( "Click here to add a new transaction." ) ); 92 //QWhatsThis::add( btn, tr( "Click here to add a new transaction." ) );
90 connect( btn, SIGNAL( clicked() ), this, SLOT( slotNew() ) ); 93 connect( btn, SIGNAL( clicked() ), this, SLOT( slotNew() ) );
91 layout->addWidget( btn, 1, 0 ); 94 layout->addWidget( btn, 1, 0 );
92/* use when we've reminders too */ 95/* use when we've reminders too */
93#if 0 96#if 0
94 btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Edit" ), this ); 97 btn = new QPushButton( Opie::Core::OResource::loadPixmap( "edit", Opie::Core::OResource::SmallIcon ),
98 tr( "Edit" ), this );
95 //QWhatsThis::add( btn, tr( "Select a transaction and then click here to edit it." ) ); 99 //QWhatsThis::add( btn, tr( "Select a transaction and then click here to edit it." ) );
96 connect( btn, SIGNAL( clicked() ), this, SLOT( slotEdit() ) ); 100 connect( btn, SIGNAL( clicked() ), this, SLOT( slotEdit() ) );
97 layout->addWidget( btn, 1, 1 ); 101 layout->addWidget( btn, 1, 1 );
98#endif 102#endif
99 103
100 btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), this ); 104 btn = new QPushButton( Opie::Core::OResource::loadPixmap( "trash", Opie::Core::OResource::SmallIcon ),
105 tr( "Delete" ), this );
101 //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." ) );
102 connect( btn, SIGNAL( clicked() ), this, SLOT( slotDelete() ) ); 107 connect( btn, SIGNAL( clicked() ), this, SLOT( slotDelete() ) );
103 layout->addWidget( btn, 1, 2 ); 108 layout->addWidget( btn, 1, 2 );
104} 109}
105 110
106TaskEditorAlarms::~TaskEditorAlarms(){ 111TaskEditorAlarms::~TaskEditorAlarms(){
107} 112}
108 113
109void TaskEditorAlarms::slotNew(){ 114void TaskEditorAlarms::slotNew(){
110 (void)new AlarmItem(lstAlarms, OPimAlarm(0, QDateTime::currentDateTime() ) ); 115 (void)new AlarmItem(lstAlarms, OPimAlarm(0, QDateTime::currentDateTime() ) );
111} 116}
112 117
113void TaskEditorAlarms::slotEdit(){ 118void TaskEditorAlarms::slotEdit(){
114} 119}
115 120
116void TaskEditorAlarms::slotDelete(){ 121void TaskEditorAlarms::slotDelete(){
117 QListViewItem* item = lstAlarms->currentItem(); 122 QListViewItem* item = lstAlarms->currentItem();
118 if (!item) return; 123 if (!item) return;
119 124
120 lstAlarms->takeItem( item ); delete item; 125 lstAlarms->takeItem( item ); delete item;
121 126
122 127
123} 128}
124 129
125void TaskEditorAlarms::load( const OPimTodo& todo) { 130void TaskEditorAlarms::load( const OPimTodo& todo) {
126 lstAlarms->clear(); 131 lstAlarms->clear();
127 if (!todo.hasNotifiers() ) return; 132 if (!todo.hasNotifiers() ) return;
128 133
129 OPimNotifyManager::Alarms als = todo.notifiers().alarms(); 134 OPimNotifyManager::Alarms als = todo.notifiers().alarms();
130 135
131 if (als.isEmpty() ) return; 136 if (als.isEmpty() ) return;
132 137
133 OPimNotifyManager::Alarms::Iterator it = als.begin(); 138 OPimNotifyManager::Alarms::Iterator it = als.begin();
134 for ( ; it != als.end(); ++it ) 139 for ( ; it != als.end(); ++it )
135 (void)new AlarmItem( lstAlarms, (*it) ); 140 (void)new AlarmItem( lstAlarms, (*it) );
136 141
137 142
138} 143}
139void TaskEditorAlarms::save( OPimTodo& todo ) { 144void TaskEditorAlarms::save( OPimTodo& todo ) {
140 if (lstAlarms->childCount() <= 0 ) return; 145 if (lstAlarms->childCount() <= 0 ) return;
141 146
142 OPimNotifyManager::Alarms alarms; 147 OPimNotifyManager::Alarms alarms;
143 148
144 for ( QListViewItem* item = lstAlarms->firstChild(); item; item = item->nextSibling() ) { 149 for ( QListViewItem* item = lstAlarms->firstChild(); item; item = item->nextSibling() ) {
145 AlarmItem *alItem = static_cast<AlarmItem*>(item); 150 AlarmItem *alItem = static_cast<AlarmItem*>(item);
146 alarms.append( alItem->alarm() ); 151 alarms.append( alItem->alarm() );
147 } 152 }
148 153
149 OPimNotifyManager& manager = todo.notifiers(); 154 OPimNotifyManager& manager = todo.notifiers();
150 manager.setAlarms( alarms ); 155 manager.setAlarms( alarms );
151} 156}
152void TaskEditorAlarms::inlineEdit( QListViewItem* alarm, const QPoint& p, int col ) { 157void TaskEditorAlarms::inlineEdit( QListViewItem* alarm, const QPoint& p, int col ) {
153 if (!alarm) return; 158 if (!alarm) return;
154 159
155 AlarmItem* item = static_cast<AlarmItem*>(alarm); 160 AlarmItem* item = static_cast<AlarmItem*>(alarm);
156 switch( col ) { 161 switch( col ) {
157 // date 162 // date
158 case 0: 163 case 0:
159 return inlineSetDate( item, p ); 164 return inlineSetDate( item, p );
160 // time 165 // time
161 case 1: 166 case 1:
162 return inlineSetTime( item ); 167 return inlineSetTime( item );
163 // type 168 // type
164 case 2: 169 case 2:
165 return inlineSetType( item, p ); 170 return inlineSetType( item, p );
166 } 171 }
167} 172}
168void TaskEditorAlarms::inlineSetDate( AlarmItem* item, const QPoint& p ) { 173void TaskEditorAlarms::inlineSetDate( AlarmItem* item, const QPoint& p ) {
169 QPopupMenu* pop = popup( 0 ); 174 QPopupMenu* pop = popup( 0 );
170 m_dbMonth->setDate( item->alarm().dateTime().date() ); 175 m_dbMonth->setDate( item->alarm().dateTime().date() );
171 pop->exec(p); 176 pop->exec(p);
172 177
173 OPimAlarm al = item->alarm(); 178 OPimAlarm al = item->alarm();
174 QDateTime dt = al.dateTime(); 179 QDateTime dt = al.dateTime();
175 dt.setDate( m_dbMonth->selectedDate() ); 180 dt.setDate( m_dbMonth->selectedDate() );
176 al.setDateTime( dt ); 181 al.setDateTime( dt );
177 item->setAlarm( al ); 182 item->setAlarm( al );
178} 183}
179void TaskEditorAlarms::inlineSetType( AlarmItem* item, const QPoint& p ) { 184void TaskEditorAlarms::inlineSetType( AlarmItem* item, const QPoint& p ) {
180 int type; 185 int type;
181 QPopupMenu* pop = popup( 2 ); 186 QPopupMenu* pop = popup( 2 );
182 switch( pop->exec(p) ) { 187 switch( pop->exec(p) ) {
183 case 10: 188 case 10:
184 type = 1; 189 type = 1;
185 break; 190 break;
186 case 20: 191 case 20:
187 default: 192 default:
188 type = 0; 193 type = 0;
189 } 194 }
190 OPimAlarm al = item->alarm(); 195 OPimAlarm al = item->alarm();
191 al.setSound( type ); 196 al.setSound( type );
192 item->setAlarm( al ); 197 item->setAlarm( al );
193} 198}
194void TaskEditorAlarms::inlineSetTime( AlarmItem* item ) { 199void TaskEditorAlarms::inlineSetTime( AlarmItem* item ) {
195 OPimAlarm al = item->alarm(); 200 OPimAlarm al = item->alarm();
196 QDateTime dt = al.dateTime(); 201 QDateTime dt = al.dateTime();
diff --git a/core/pim/todo/taskeditoralarms.h b/core/pim/todo/taskeditoralarms.h
index 2379b0c..5cff352 100644
--- a/core/pim/todo/taskeditoralarms.h
+++ b/core/pim/todo/taskeditoralarms.h
@@ -1,75 +1,77 @@
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,2003 <> 3
4           .>+-= 4 Copyright (C) Opie Team <opie-devel@handhelds.org>
5 _;:,     .>    :=|. This program is free software; you can 5 =.
6.> <`_,   >  .   <= redistribute it and/or modify it under 6 .=l.
7:`=1 )Y*s>-.--   : the terms of the GNU General Public 7           .>+-=
8.="- .-=="i,     .._ License as published by the Free Software 8 _;:,     .>    :=|. This program is free software; you can
9 - .   .-<_>     .<> Foundation; either version 2 of the License, 9.> <`_,   >  .   <= redistribute it and/or modify it under
10     ._= =}       : or (at your option) any later version. 10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11    .%`+i>       _;_. 11.="- .-=="i,     .._ License as published by the Free Software
12    .i_,=:_.      -<s. This program is distributed in the hope that 12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 13     ._= =}       : or (at your option) any later version.
14    : ..    .:,     . . . without even the implied warranty of 14    .%`+i>       _;_.
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 15    .i_,=:_.      -<s. This program is distributed in the hope that
16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17..}^=.=       =       ; Library General Public License for more 17 : ..    .:,     . . . without even the implied warranty of
18++=   -.     .`     .: details. 18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19 :     =  ...= . :.=- 19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20 -.   .:....=;==+<; You should have received a copy of the GNU 20..}^=.=       =       ; Library General Public License for more
21  -_. . .   )=.  = General Public License along with 21++=   -.     .`     .: details.
22    --        :-=` this library; see the file COPYING.LIB. 22:     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation, 26 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330, 27 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
26
27*/ 29*/
28 30
29#ifndef TASKEDITORALARMS_H 31#ifndef TASKEDITORALARMS_H
30#define TASKEDITORALARMS_H 32#define TASKEDITORALARMS_H
31 33
32#include <opie2/opimtodo.h> 34#include <opie2/opimtodo.h>
33 35
34#include <qwidget.h> 36#include <qwidget.h>
35 37
36class QListView; 38class QListView;
37class QListViewItem; 39class QListViewItem;
38 40
39using namespace Opie; 41using namespace Opie;
40 42
41class AlarmItem; 43class AlarmItem;
42class DateBookMonth; 44class DateBookMonth;
43class TaskEditorAlarms : public QWidget 45class TaskEditorAlarms : public QWidget
44{ 46{
45 Q_OBJECT 47 Q_OBJECT
46 48
47public: 49public:
48 enum Type { 50 enum Type {
49 Alarm = 0, 51 Alarm = 0,
50 Reminders 52 Reminders
51 }; 53 };
52 TaskEditorAlarms( QWidget* parent = 0, int type = Alarm, const char* name = 0, WFlags fl = 0 ); 54 TaskEditorAlarms( QWidget* parent = 0, int type = Alarm, const char* name = 0, WFlags fl = 0 );
53 ~TaskEditorAlarms(); 55 ~TaskEditorAlarms();
54 void load( const OPimTodo& ); 56 void load( const OPimTodo& );
55 void save( OPimTodo& ); 57 void save( OPimTodo& );
56private: 58private:
57 QPopupMenu* popup( int column ); 59 QPopupMenu* popup( int column );
58 void inlineSetDate( AlarmItem*, const QPoint& p ); 60 void inlineSetDate( AlarmItem*, const QPoint& p );
59 void inlineSetTime( AlarmItem*); 61 void inlineSetTime( AlarmItem*);
60 void inlineSetType( AlarmItem*, const QPoint& p ); 62 void inlineSetType( AlarmItem*, const QPoint& p );
61 63
62 QListView* lstAlarms; 64 QListView* lstAlarms;
63 QPopupMenu* m_date; 65 QPopupMenu* m_date;
64 QPopupMenu* m_time; 66 QPopupMenu* m_time;
65 QPopupMenu* m_type; 67 QPopupMenu* m_type;
66 DateBookMonth* m_dbMonth; 68 DateBookMonth* m_dbMonth;
67 69
68protected slots: 70protected slots:
69 void slotNew(); 71 void slotNew();
70 void slotEdit(); 72 void slotEdit();
71 void slotDelete(); 73 void slotDelete();
72 void inlineEdit( QListViewItem*, const QPoint& p, int ); 74 void inlineEdit( QListViewItem*, const QPoint& p, int );
73}; 75};
74 76
75#endif // TASKEDITORALARMS_H 77#endif // TASKEDITORALARMS_H
diff --git a/core/pim/todo/taskeditoroverview.cpp b/core/pim/todo/taskeditoroverview.cpp
index 294acb9..1e43883 100644
--- a/core/pim/todo/taskeditoroverview.cpp
+++ b/core/pim/todo/taskeditoroverview.cpp
@@ -1,149 +1,152 @@
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
4           .>+-= 4 Copyright (C) Opie Team <opie-devel@handhelds.org>
5 _;:,     .>    :=|. This program is free software; you can 5 =.
6.> <`_,   >  .   <= redistribute it and/or modify it under 6 .=l.
7:`=1 )Y*s>-.--   : the terms of the GNU General Public 7           .>+-=
8.="- .-=="i,     .._ License as published by the Free Software 8 _;:,     .>    :=|. This program is free software; you can
9 - .   .-<_>     .<> Foundation; either version 2 of the License, 9.> <`_,   >  .   <= redistribute it and/or modify it under
10     ._= =}       : or (at your option) any later version. 10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11    .%`+i>       _;_. 11.="- .-=="i,     .._ License as published by the Free Software
12    .i_,=:_.      -<s. This program is distributed in the hope that 12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 13     ._= =}       : or (at your option) any later version.
14    : ..    .:,     . . . without even the implied warranty of 14    .%`+i>       _;_.
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 15    .i_,=:_.      -<s. This program is distributed in the hope that
16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17..}^=.=       =       ; Library General Public License for more 17 : ..    .:,     . . . without even the implied warranty of
18++=   -.     .`     .: details. 18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19 :     =  ...= . :.=- 19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20 -.   .:....=;==+<; You should have received a copy of the GNU 20..}^=.=       =       ; Library General Public License for more
21  -_. . .   )=.  = General Public License along with 21++=   -.     .`     .: details.
22    --        :-=` this library; see the file COPYING.LIB. 22:     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation, 26 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330, 27 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
26
27*/ 29*/
28 30
29#include "taskeditoroverview.h" 31#include "taskeditoroverview.h"
30 32
31//#include <opie2/opimrecurrence.h> 33//#include <opie2/opimrecurrence.h>
32 34
35#include <opie2/oresource.h>
36
33#include <qpe/categoryselect.h> 37#include <qpe/categoryselect.h>
34#include <qpe/datebookmonth.h> 38#include <qpe/datebookmonth.h>
35#include <qpe/resource.h>
36 39
37#include <qcheckbox.h> 40#include <qcheckbox.h>
38#include <qlabel.h> 41#include <qlabel.h>
39#include <qlayout.h> 42#include <qlayout.h>
40#include <qmultilineedit.h> 43#include <qmultilineedit.h>
41#include <qwhatsthis.h> 44#include <qwhatsthis.h>
42 45
43TaskEditorOverView::TaskEditorOverView( QWidget* parent, const char* name, WFlags fl ) 46TaskEditorOverView::TaskEditorOverView( QWidget* parent, const char* name, WFlags fl )
44 : QWidget( parent, name, fl ) 47 : QWidget( parent, name, fl )
45{ 48{
46 // Load icons 49 // Load icons
47 // TODO - probably should be done globally somewhere else, 50 // TODO - probably should be done globally somewhere else,
48 // see also quickeditimpl.cpp/h, tableview.cpp/h 51 // see also quickeditimpl.cpp/h, tableview.cpp/h
49 QString namestr; 52 QString namestr;
50 for ( unsigned int i = 1; i < 6; i++ ) { 53 for ( unsigned int i = 1; i < 6; i++ ) {
51 namestr = "todo/priority"; 54 namestr = "todo/priority";
52 namestr.append( QString::number( i ) ); 55 namestr.append( QString::number( i ) );
53 m_pic_priority[ i - 1 ] = Resource::loadPixmap( namestr ); 56 m_pic_priority[ i - 1 ] = Opie::Core::OResource::loadPixmap( namestr );
54 } 57 }
55 58
56 QVBoxLayout *vb = new QVBoxLayout( this ); 59 QVBoxLayout *vb = new QVBoxLayout( this );
57 60
58 QScrollView *sv = new QScrollView( this ); 61 QScrollView *sv = new QScrollView( this );
59 vb->addWidget( sv ); 62 vb->addWidget( sv );
60 sv->setResizePolicy( QScrollView::AutoOneFit ); 63 sv->setResizePolicy( QScrollView::AutoOneFit );
61 sv->setFrameStyle( QFrame::NoFrame ); 64 sv->setFrameStyle( QFrame::NoFrame );
62 65
63 QWidget *container = new QWidget( sv->viewport() ); 66 QWidget *container = new QWidget( sv->viewport() );
64 sv->addChild( container ); 67 sv->addChild( container );
65 68
66 QGridLayout *layout = new QGridLayout( container, 7, 2, 4, 4 ); 69 QGridLayout *layout = new QGridLayout( container, 7, 2, 4, 4 );
67 70
68 // Description 71 // Description
69 QLabel *label = new QLabel( tr( "Summary:" ), container ); 72 QLabel *label = new QLabel( tr( "Summary:" ), container );
70 layout->addWidget( label, 0, 0 ); 73 layout->addWidget( label, 0, 0 );
71 QWhatsThis::add( label, tr( "Enter brief description of the task here." ) ); 74 QWhatsThis::add( label, tr( "Enter brief description of the task here." ) );
72 cmbDesc = new QComboBox( TRUE, container ); 75 cmbDesc = new QComboBox( TRUE, container );
73 cmbDesc->insertItem( tr( "Complete " ) ); 76 cmbDesc->insertItem( tr( "Complete " ) );
74 cmbDesc->insertItem( tr( "Work on " ) ); 77 cmbDesc->insertItem( tr( "Work on " ) );
75 cmbDesc->insertItem( tr( "Buy " ) ); 78 cmbDesc->insertItem( tr( "Buy " ) );
76 cmbDesc->insertItem( tr( "Organize " ) ); 79 cmbDesc->insertItem( tr( "Organize " ) );
77 cmbDesc->insertItem( tr( "Get " ) ); 80 cmbDesc->insertItem( tr( "Get " ) );
78 cmbDesc->insertItem( tr( "Update " ) ); 81 cmbDesc->insertItem( tr( "Update " ) );
79 cmbDesc->insertItem( tr( "Create " ) ); 82 cmbDesc->insertItem( tr( "Create " ) );
80 cmbDesc->insertItem( tr( "Plan " ) ); 83 cmbDesc->insertItem( tr( "Plan " ) );
81 cmbDesc->insertItem( tr( "Call " ) ); 84 cmbDesc->insertItem( tr( "Call " ) );
82 cmbDesc->insertItem( tr( "Mail " ) ); 85 cmbDesc->insertItem( tr( "Mail " ) );
83 cmbDesc->clearEdit(); 86 cmbDesc->clearEdit();
84 layout->addMultiCellWidget( cmbDesc, 1, 1, 0, 1 ); 87 layout->addMultiCellWidget( cmbDesc, 1, 1, 0, 1 );
85 QWhatsThis::add( cmbDesc, tr( "Enter brief description of the task here." ) ); 88 QWhatsThis::add( cmbDesc, tr( "Enter brief description of the task here." ) );
86 89
87 // Priority 90 // Priority
88 label = new QLabel( QWidget::tr( "Priority:" ), container ); 91 label = new QLabel( QWidget::tr( "Priority:" ), container );
89 layout->addWidget( label, 2, 0 ); 92 layout->addWidget( label, 2, 0 );
90 QWhatsThis::add( label, tr( "Select priority of task here." ) ); 93 QWhatsThis::add( label, tr( "Select priority of task here." ) );
91 cmbPriority = new QComboBox( FALSE, container ); 94 cmbPriority = new QComboBox( FALSE, container );
92 cmbPriority->setMinimumHeight( 26 ); 95 cmbPriority->setMinimumHeight( 26 );
93 cmbPriority->insertItem( m_pic_priority[ 0 ], tr( "Very High" ) ); 96 cmbPriority->insertItem( m_pic_priority[ 0 ], tr( "Very High" ) );
94 cmbPriority->insertItem( m_pic_priority[ 1 ], tr( "High" ) ); 97 cmbPriority->insertItem( m_pic_priority[ 1 ], tr( "High" ) );
95 cmbPriority->insertItem( m_pic_priority[ 2 ], tr( "Normal" ) ); 98 cmbPriority->insertItem( m_pic_priority[ 2 ], tr( "Normal" ) );
96 cmbPriority->insertItem( m_pic_priority[ 3 ], tr( "Low" ) ); 99 cmbPriority->insertItem( m_pic_priority[ 3 ], tr( "Low" ) );
97 cmbPriority->insertItem( m_pic_priority[ 4 ], tr( "Very Low" ) ); 100 cmbPriority->insertItem( m_pic_priority[ 4 ], tr( "Very Low" ) );
98 cmbPriority->setCurrentItem( 2 ); 101 cmbPriority->setCurrentItem( 2 );
99 layout->addWidget( cmbPriority, 2, 1 ); 102 layout->addWidget( cmbPriority, 2, 1 );
100 QWhatsThis::add( cmbPriority, tr( "Select priority of task here." ) ); 103 QWhatsThis::add( cmbPriority, tr( "Select priority of task here." ) );
101 104
102 // Category 105 // Category
103 label = new QLabel( tr( "Category:" ), container ); 106 label = new QLabel( tr( "Category:" ), container );
104 layout->addWidget( label, 3, 0 ); 107 layout->addWidget( label, 3, 0 );
105 QWhatsThis::add( label, tr( "Select category to organize this task with." ) ); 108 QWhatsThis::add( label, tr( "Select category to organize this task with." ) );
106 cmbCategory = new CategorySelect( container ); 109 cmbCategory = new CategorySelect( container );
107 layout->addWidget( cmbCategory, 3, 1 ); 110 layout->addWidget( cmbCategory, 3, 1 );
108 QWhatsThis::add( cmbCategory, tr( "Select category to organize this task with." ) ); 111 QWhatsThis::add( cmbCategory, tr( "Select category to organize this task with." ) );
109 112
110 // Recurrence 113 // Recurrence
111 ckbRecurrence = new QCheckBox( tr( "Recurring task" ), container ); 114 ckbRecurrence = new QCheckBox( tr( "Recurring task" ), container );
112 layout->addMultiCellWidget( ckbRecurrence, 4, 4, 0, 1 ); 115 layout->addMultiCellWidget( ckbRecurrence, 4, 4, 0, 1 );
113 QWhatsThis::add( ckbRecurrence, tr( "Click here if task happens on a regular basis. If selected, frequency can be set on the Recurrence tab." ) ); 116 QWhatsThis::add( ckbRecurrence, tr( "Click here if task happens on a regular basis. If selected, frequency can be set on the Recurrence tab." ) );
114 connect( ckbRecurrence, SIGNAL(clicked() ), this, SLOT( slotRecClicked() ) ); 117 connect( ckbRecurrence, SIGNAL(clicked() ), this, SLOT( slotRecClicked() ) );
115 118
116 // Notes 119 // Notes
117 label = new QLabel( tr( "Description:" ), container ); 120 label = new QLabel( tr( "Description:" ), container );
118 layout->addWidget( label, 5, 0 ); 121 layout->addWidget( label, 5, 0 );
119 QWhatsThis::add( label, tr( "Enter any additional information about this task here." ) ); 122 QWhatsThis::add( label, tr( "Enter any additional information about this task here." ) );
120 mleNotes = new QMultiLineEdit( container ); 123 mleNotes = new QMultiLineEdit( container );
121 mleNotes->setWordWrap( QMultiLineEdit::WidgetWidth ); 124 mleNotes->setWordWrap( QMultiLineEdit::WidgetWidth );
122 layout->addMultiCellWidget( mleNotes, 6, 6, 0, 1 ); 125 layout->addMultiCellWidget( mleNotes, 6, 6, 0, 1 );
123 QWhatsThis::add( mleNotes, tr( "Enter any additional information about this task here." ) ); 126 QWhatsThis::add( mleNotes, tr( "Enter any additional information about this task here." ) );
124} 127}
125 128
126TaskEditorOverView::~TaskEditorOverView() 129TaskEditorOverView::~TaskEditorOverView()
127{ 130{
128} 131}
129 132
130void TaskEditorOverView::load( const OPimTodo& todo ) 133void TaskEditorOverView::load( const OPimTodo& todo )
131{ 134{
132 // Description 135 // Description
133 cmbDesc->insertItem( todo.summary(), 0 ); 136 cmbDesc->insertItem( todo.summary(), 0 );
134 cmbDesc->setCurrentItem( 0 ); 137 cmbDesc->setCurrentItem( 0 );
135 138
136 // Priority 139 // Priority
137 cmbPriority->setCurrentItem( todo.priority() - 1 ); 140 cmbPriority->setCurrentItem( todo.priority() - 1 );
138 141
139 // Category 142 // Category
140 cmbCategory->setCategories( todo.categories(), "Todo List", tr( "Todo List" ) ); 143 cmbCategory->setCategories( todo.categories(), "Todo List", tr( "Todo List" ) );
141 144
142 // Recurrence 145 // Recurrence
143 ckbRecurrence->setChecked( todo.hasRecurrence() ); 146 ckbRecurrence->setChecked( todo.hasRecurrence() );
144 emit recurranceEnabled( todo.hasRecurrence() ); 147 emit recurranceEnabled( todo.hasRecurrence() );
145 148
146 // Notes 149 // Notes
147 mleNotes->setText( todo.description() ); 150 mleNotes->setText( todo.description() );
148 151
149} 152}
diff --git a/core/pim/todo/taskeditoroverview.h b/core/pim/todo/taskeditoroverview.h
index 89679f1..db85041 100644
--- a/core/pim/todo/taskeditoroverview.h
+++ b/core/pim/todo/taskeditoroverview.h
@@ -1,71 +1,73 @@
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
4           .>+-= 4 Copyright (C) Opie Team <opie-devel@handhelds.org>
5 _;:,     .>    :=|. This program is free software; you can 5 =.
6.> <`_,   >  .   <= redistribute it and/or modify it under 6 .=l.
7:`=1 )Y*s>-.--   : the terms of the GNU General Public 7           .>+-=
8.="- .-=="i,     .._ License as published by the Free Software 8 _;:,     .>    :=|. This program is free software; you can
9 - .   .-<_>     .<> Foundation; either version 2 of the License, 9.> <`_,   >  .   <= redistribute it and/or modify it under
10     ._= =}       : or (at your option) any later version. 10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11    .%`+i>       _;_. 11.="- .-=="i,     .._ License as published by the Free Software
12    .i_,=:_.      -<s. This program is distributed in the hope that 12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 13     ._= =}       : or (at your option) any later version.
14    : ..    .:,     . . . without even the implied warranty of 14    .%`+i>       _;_.
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 15    .i_,=:_.      -<s. This program is distributed in the hope that
16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17..}^=.=       =       ; Library General Public License for more 17 : ..    .:,     . . . without even the implied warranty of
18++=   -.     .`     .: details. 18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19 :     =  ...= . :.=- 19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20 -.   .:....=;==+<; You should have received a copy of the GNU 20..}^=.=       =       ; Library General Public License for more
21  -_. . .   )=.  = General Public License along with 21++=   -.     .`     .: details.
22    --        :-=` this library; see the file COPYING.LIB. 22:     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation, 26 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330, 27 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
26
27*/ 29*/
28 30
29#ifndef TASKEDITOROVERVIEW_H 31#ifndef TASKEDITOROVERVIEW_H
30#define TASKEDITOROVERVIEW_H 32#define TASKEDITOROVERVIEW_H
31 33
32#include <opie2/opimtodo.h> 34#include <opie2/opimtodo.h>
33 35
34#include <qpixmap.h> 36#include <qpixmap.h>
35#include <qwidget.h> 37#include <qwidget.h>
36 38
37class CategorySelect; 39class CategorySelect;
38class QCheckBox; 40class QCheckBox;
39class QComboBox; 41class QComboBox;
40class QMultiLineEdit; 42class QMultiLineEdit;
41 43
42using namespace Opie; 44using namespace Opie;
43 45
44class TaskEditorOverView : public QWidget 46class TaskEditorOverView : public QWidget
45{ 47{
46 Q_OBJECT 48 Q_OBJECT
47 49
48public: 50public:
49 TaskEditorOverView( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); 51 TaskEditorOverView( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
50 ~TaskEditorOverView(); 52 ~TaskEditorOverView();
51 53
52 QComboBox *cmbDesc; 54 QComboBox *cmbDesc;
53 QComboBox *cmbPriority; 55 QComboBox *cmbPriority;
54 CategorySelect *cmbCategory; 56 CategorySelect *cmbCategory;
55 QCheckBox *ckbRecurrence; 57 QCheckBox *ckbRecurrence;
56 QMultiLineEdit *mleNotes; 58 QMultiLineEdit *mleNotes;
57 59
58 void load( const OPimTodo & ); 60 void load( const OPimTodo & );
59 void save( OPimTodo & ); 61 void save( OPimTodo & );
60 62
61signals: 63signals:
62 void recurranceEnabled( bool ); 64 void recurranceEnabled( bool );
63 65
64protected: 66protected:
65 QPixmap m_pic_priority[ 5 ]; 67 QPixmap m_pic_priority[ 5 ];
66 68
67protected slots: 69protected slots:
68 void slotRecClicked(); 70 void slotRecClicked();
69}; 71};
70 72
71#endif // TASKEDITOROVERVIEW_H 73#endif // TASKEDITOROVERVIEW_H
diff --git a/core/pim/todo/taskeditorstatus.cpp b/core/pim/todo/taskeditorstatus.cpp
index 16351e0..17495a4 100644
--- a/core/pim/todo/taskeditorstatus.cpp
+++ b/core/pim/todo/taskeditorstatus.cpp
@@ -1,122 +1,124 @@
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
4           .>+-= 4 Copyright (C) Opie Team <opie-devel@handhelds.org>
5 _;:,     .>    :=|. This program is free software; you can 5 =.
6.> <`_,   >  .   <= redistribute it and/or modify it under 6 .=l.
7:`=1 )Y*s>-.--   : the terms of the GNU General Public 7           .>+-=
8.="- .-=="i,     .._ License as published by the Free Software 8 _;:,     .>    :=|. This program is free software; you can
9 - .   .-<_>     .<> Foundation; either version 2 of the License, 9.> <`_,   >  .   <= redistribute it and/or modify it under
10     ._= =}       : or (at your option) any later version. 10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11    .%`+i>       _;_. 11.="- .-=="i,     .._ License as published by the Free Software
12    .i_,=:_.      -<s. This program is distributed in the hope that 12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 13     ._= =}       : or (at your option) any later version.
14    : ..    .:,     . . . without even the implied warranty of 14    .%`+i>       _;_.
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 15    .i_,=:_.      -<s. This program is distributed in the hope that
16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17..}^=.=       =       ; Library General Public License for more 17 : ..    .:,     . . . without even the implied warranty of
18++=   -.     .`     .: details. 18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19 :     =  ...= . :.=- 19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20 -.   .:....=;==+<; You should have received a copy of the GNU 20..}^=.=       =       ; Library General Public License for more
21  -_. . .   )=.  = General Public License along with 21++=   -.     .`     .: details.
22    --        :-=` this library; see the file COPYING.LIB. 22:     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation, 26 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330, 27 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
26
27*/ 29*/
28 30
29#include "taskeditorstatus.h" 31#include "taskeditorstatus.h"
30 32
31#include <opie2/opimmaintainer.h> 33#include <opie2/opimmaintainer.h>
32#include <opie2/opimstate.h> 34#include <opie2/opimstate.h>
33 35
34#include <qpe/datebookmonth.h> 36#include <qpe/datebookmonth.h>
35 37
36#include <qcheckbox.h> 38#include <qcheckbox.h>
37#include <qcombobox.h> 39#include <qcombobox.h>
38#include <qlabel.h> 40#include <qlabel.h>
39#include <qlayout.h> 41#include <qlayout.h>
40#include <qwhatsthis.h> 42#include <qwhatsthis.h>
41 43
42// FIXME add the hack slots instead of setPopup!!!! 44// FIXME add the hack slots instead of setPopup!!!!
43// drw you shouldn't have removed them 45// drw you shouldn't have removed them
44 46
45TaskEditorStatus::TaskEditorStatus( QWidget* parent, const char* name, WFlags fl ) 47TaskEditorStatus::TaskEditorStatus( QWidget* parent, const char* name, WFlags fl )
46 : QWidget( parent, name, fl ) 48 : QWidget( parent, name, fl )
47{ 49{
48 QDate curDate = QDate::currentDate(); 50 QDate curDate = QDate::currentDate();
49 m_start = m_comp = m_due = curDate; 51 m_start = m_comp = m_due = curDate;
50 QString curDateStr = TimeString::longDateString( curDate ); 52 QString curDateStr = TimeString::longDateString( curDate );
51 53
52 QVBoxLayout *vb = new QVBoxLayout( this ); 54 QVBoxLayout *vb = new QVBoxLayout( this );
53 55
54 QScrollView *sv = new QScrollView( this ); 56 QScrollView *sv = new QScrollView( this );
55 vb->addWidget( sv ); 57 vb->addWidget( sv );
56 sv->setResizePolicy( QScrollView::AutoOneFit ); 58 sv->setResizePolicy( QScrollView::AutoOneFit );
57 sv->setFrameStyle( QFrame::NoFrame ); 59 sv->setFrameStyle( QFrame::NoFrame );
58 60
59 QWidget *container = new QWidget( sv->viewport() ); 61 QWidget *container = new QWidget( sv->viewport() );
60 sv->addChild( container ); 62 sv->addChild( container );
61 63
62 QGridLayout *layout = new QGridLayout( container, 7, 3, 4, 4 ); 64 QGridLayout *layout = new QGridLayout( container, 7, 3, 4, 4 );
63 65
64 // Status 66 // Status
65 QLabel *label = new QLabel( tr( "Status:" ), container ); 67 QLabel *label = new QLabel( tr( "Status:" ), container );
66 layout->addWidget( label, 0, 0 ); 68 layout->addWidget( label, 0, 0 );
67 QWhatsThis::add( label, tr( "Click here to set the current status of this task." ) ); 69 QWhatsThis::add( label, tr( "Click here to set the current status of this task." ) );
68 cmbStatus = new QComboBox( FALSE, container ); 70 cmbStatus = new QComboBox( FALSE, container );
69 cmbStatus->insertItem( tr( "Started" ) ); 71 cmbStatus->insertItem( tr( "Started" ) );
70 cmbStatus->insertItem( tr( "Postponed" ) ); 72 cmbStatus->insertItem( tr( "Postponed" ) );
71 cmbStatus->insertItem( tr( "Finished" ) ); 73 cmbStatus->insertItem( tr( "Finished" ) );
72 cmbStatus->insertItem( tr( "Not started" ) ); 74 cmbStatus->insertItem( tr( "Not started" ) );
73 layout->addMultiCellWidget( cmbStatus, 0, 0, 1, 2 ); 75 layout->addMultiCellWidget( cmbStatus, 0, 0, 1, 2 );
74 QWhatsThis::add( cmbStatus, tr( "Click here to set the current status of this task." ) ); 76 QWhatsThis::add( cmbStatus, tr( "Click here to set the current status of this task." ) );
75 77
76 // Progress 78 // Progress
77 label = new QLabel( tr( "Progress:" ), container ); 79 label = new QLabel( tr( "Progress:" ), container );
78 layout->addWidget( label, 1, 0 ); 80 layout->addWidget( label, 1, 0 );
79 QWhatsThis::add( label, tr( "Select progress made on this task here." ) ); 81 QWhatsThis::add( label, tr( "Select progress made on this task here." ) );
80 cmbProgress = new QComboBox( FALSE, container ); 82 cmbProgress = new QComboBox( FALSE, container );
81 cmbProgress->insertItem( tr( "0 %" ) ); 83 cmbProgress->insertItem( tr( "0 %" ) );
82 cmbProgress->insertItem( tr( "20 %" ) ); 84 cmbProgress->insertItem( tr( "20 %" ) );
83 cmbProgress->insertItem( tr( "40 %" ) ); 85 cmbProgress->insertItem( tr( "40 %" ) );
84 cmbProgress->insertItem( tr( "60 %" ) ); 86 cmbProgress->insertItem( tr( "60 %" ) );
85 cmbProgress->insertItem( tr( "80 %" ) ); 87 cmbProgress->insertItem( tr( "80 %" ) );
86 cmbProgress->insertItem( tr( "100 %" ) ); 88 cmbProgress->insertItem( tr( "100 %" ) );
87 layout->addMultiCellWidget( cmbProgress, 1, 1, 1, 2 ); 89 layout->addMultiCellWidget( cmbProgress, 1, 1, 1, 2 );
88 QWhatsThis::add( cmbProgress, tr( "Select progress made on this task here." ) ); 90 QWhatsThis::add( cmbProgress, tr( "Select progress made on this task here." ) );
89 91
90 // Start date 92 // Start date
91 ckbStart = new QCheckBox( tr( "Start Date:" ), container ); 93 ckbStart = new QCheckBox( tr( "Start Date:" ), container );
92 layout->addWidget( ckbStart, 2, 0 ); 94 layout->addWidget( ckbStart, 2, 0 );
93 QWhatsThis::add( ckbStart, tr( "Click here to set the date this task was started." ) ); 95 QWhatsThis::add( ckbStart, tr( "Click here to set the date this task was started." ) );
94 connect( ckbStart, SIGNAL( clicked() ), this, SLOT( slotStartChecked() ) ); 96 connect( ckbStart, SIGNAL( clicked() ), this, SLOT( slotStartChecked() ) );
95 btnStart = new QPushButton( curDateStr, container ); 97 btnStart = new QPushButton( curDateStr, container );
96 btnStart->setEnabled( FALSE ); 98 btnStart->setEnabled( FALSE );
97 layout->addMultiCellWidget( btnStart, 2, 2, 1, 2 ); 99 layout->addMultiCellWidget( btnStart, 2, 2, 1, 2 );
98 QWhatsThis::add( btnStart, tr( "Click here to set the date this task was started." ) ); 100 QWhatsThis::add( btnStart, tr( "Click here to set the date this task was started." ) );
99 QPopupMenu *popup = new QPopupMenu( this ); 101 QPopupMenu *popup = new QPopupMenu( this );
100 m_startBook = new DateBookMonth( popup, 0, TRUE ); 102 m_startBook = new DateBookMonth( popup, 0, TRUE );
101 popup->insertItem( m_startBook ); 103 popup->insertItem( m_startBook );
102 btnStart->setPopup( popup ); 104 btnStart->setPopup( popup );
103 connect( m_startBook, SIGNAL( dateClicked(int,int,int) ), 105 connect( m_startBook, SIGNAL( dateClicked(int,int,int) ),
104 this, SLOT( slotStartChanged(int,int,int) ) ); 106 this, SLOT( slotStartChanged(int,int,int) ) );
105 107
106 // Due date 108 // Due date
107 ckbDue = new QCheckBox( tr( "Due Date:" ), container ); 109 ckbDue = new QCheckBox( tr( "Due Date:" ), container );
108 layout->addWidget( ckbDue, 3, 0 ); 110 layout->addWidget( ckbDue, 3, 0 );
109 QWhatsThis::add( ckbDue, tr( "Click here to set the date this task needs to be completed by." ) ); 111 QWhatsThis::add( ckbDue, tr( "Click here to set the date this task needs to be completed by." ) );
110 connect( ckbDue, SIGNAL( clicked() ), this, SLOT( slotDueChecked() ) ); 112 connect( ckbDue, SIGNAL( clicked() ), this, SLOT( slotDueChecked() ) );
111 btnDue = new QPushButton( curDateStr, container ); 113 btnDue = new QPushButton( curDateStr, container );
112 btnDue->setEnabled( FALSE ); 114 btnDue->setEnabled( FALSE );
113 layout->addMultiCellWidget( btnDue, 3, 3, 1, 2 ); 115 layout->addMultiCellWidget( btnDue, 3, 3, 1, 2 );
114 QWhatsThis::add( btnDue, tr( "Click here to set the date this task needs to be completed by." ) ); 116 QWhatsThis::add( btnDue, tr( "Click here to set the date this task needs to be completed by." ) );
115 popup = new QPopupMenu( this ); 117 popup = new QPopupMenu( this );
116 m_dueBook = new DateBookMonth( popup, 0, TRUE ); 118 m_dueBook = new DateBookMonth( popup, 0, TRUE );
117 popup->insertItem( m_dueBook ); 119 popup->insertItem( m_dueBook );
118 btnDue->setPopup( popup ); 120 btnDue->setPopup( popup );
119 connect( m_dueBook, SIGNAL( dateClicked(int,int,int) ), 121 connect( m_dueBook, SIGNAL( dateClicked(int,int,int) ),
120 this, SLOT( slotDueChanged(int,int,int) ) ); 122 this, SLOT( slotDueChanged(int,int,int) ) );
121 123
122 // Completed 124 // Completed
diff --git a/core/pim/todo/taskeditorstatus.h b/core/pim/todo/taskeditorstatus.h
index 97129f0..427eaf4 100644
--- a/core/pim/todo/taskeditorstatus.h
+++ b/core/pim/todo/taskeditorstatus.h
@@ -1,103 +1,105 @@
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
4           .>+-= 4 Copyright (C) Opie Team <opie-devel@handhelds.org>
5 _;:,     .>    :=|. This program is free software; you can 5 =.
6.> <`_,   >  .   <= redistribute it and/or modify it under 6 .=l.
7:`=1 )Y*s>-.--   : the terms of the GNU General Public 7           .>+-=
8.="- .-=="i,     .._ License as published by the Free Software 8 _;:,     .>    :=|. This program is free software; you can
9 - .   .-<_>     .<> Foundation; either version 2 of the License, 9.> <`_,   >  .   <= redistribute it and/or modify it under
10     ._= =}       : or (at your option) any later version. 10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11    .%`+i>       _;_. 11.="- .-=="i,     .._ License as published by the Free Software
12    .i_,=:_.      -<s. This program is distributed in the hope that 12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 13     ._= =}       : or (at your option) any later version.
14    : ..    .:,     . . . without even the implied warranty of 14    .%`+i>       _;_.
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 15    .i_,=:_.      -<s. This program is distributed in the hope that
16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17..}^=.=       =       ; Library General Public License for more 17 : ..    .:,     . . . without even the implied warranty of
18++=   -.     .`     .: details. 18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19 :     =  ...= . :.=- 19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20 -.   .:....=;==+<; You should have received a copy of the GNU 20..}^=.=       =       ; Library General Public License for more
21  -_. . .   )=.  = General Public License along with 21++=   -.     .`     .: details.
22    --        :-=` this library; see the file COPYING.LIB. 22:     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation, 26 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330, 27 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
26
27*/ 29*/
28 30
29#ifndef TASKEDITORSTATUS_H 31#ifndef TASKEDITORSTATUS_H
30#define TASKEDITORSTATUS_H 32#define TASKEDITORSTATUS_H
31 33
32#include <opie2/opimtodo.h> 34#include <opie2/opimtodo.h>
33 35
34#include <qdatetime.h> 36#include <qdatetime.h>
35#include <qwidget.h> 37#include <qwidget.h>
36 38
37class DateBookMonth; 39class DateBookMonth;
38class QCheckBox; 40class QCheckBox;
39class QComboBox; 41class QComboBox;
40class QLabel; 42class QLabel;
41class QPushButton; 43class QPushButton;
42class QToolButton; 44class QToolButton;
43 45
44using namespace Opie; 46using namespace Opie;
45 47
46/** 48/**
47 * This is the implementation of the Opie Task Editor Advanced tab 49 * This is the implementation of the Opie Task Editor Advanced tab
48 * it features the State! 50 * it features the State!
49 * MaintainerMode 51 * MaintainerMode
50 * Description 52 * Description
51 */ 53 */
52class TaskEditorStatus : public QWidget 54class TaskEditorStatus : public QWidget
53{ 55{
54 Q_OBJECT 56 Q_OBJECT
55 57
56public: 58public:
57 TaskEditorStatus( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); 59 TaskEditorStatus( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
58 ~TaskEditorStatus(); 60 ~TaskEditorStatus();
59 61
60 QComboBox *cmbStatus; 62 QComboBox *cmbStatus;
61 QLabel *txtMaintainer; 63 QLabel *txtMaintainer;
62 QToolButton *tbtMaintainer; 64 QToolButton *tbtMaintainer;
63 QComboBox *cmbMaintMode; 65 QComboBox *cmbMaintMode;
64 QCheckBox *ckbDue; 66 QCheckBox *ckbDue;
65 QPushButton *btnDue; 67 QPushButton *btnDue;
66 QCheckBox *ckbStart; 68 QCheckBox *ckbStart;
67 QPushButton *btnStart; 69 QPushButton *btnStart;
68 QCheckBox *ckbComp; 70 QCheckBox *ckbComp;
69 QPushButton *btnComp; 71 QPushButton *btnComp;
70 QComboBox *cmbProgress; 72 QComboBox *cmbProgress;
71 73
72 /* 74 /*
73 * I could have a struct which returns a QWidget* 75 * I could have a struct which returns a QWidget*
74 * load and save to a OPimTodo 76 * load and save to a OPimTodo
75 * and use multiple inheretence with all other widgets 77 * and use multiple inheretence with all other widgets
76 * and then simply iterate over the list of structs 78 * and then simply iterate over the list of structs
77 * this way I could easily have plugins for the whole editor.... 79 * this way I could easily have plugins for the whole editor....
78 * but I do not do it -zecke 80 * but I do not do it -zecke
79 */ 81 */
80 void load( const OPimTodo & ); 82 void load( const OPimTodo & );
81 void save( OPimTodo & ); 83 void save( OPimTodo & );
82 84
83private: 85private:
84 QDate m_start; 86 QDate m_start;
85 QDate m_comp; 87 QDate m_comp;
86 QDate m_due; 88 QDate m_due;
87 DateBookMonth *m_startBook; 89 DateBookMonth *m_startBook;
88 DateBookMonth *m_compBook; 90 DateBookMonth *m_compBook;
89 DateBookMonth *m_dueBook; 91 DateBookMonth *m_dueBook;
90 92
91private slots: 93private slots:
92 void slotStartChecked(); 94 void slotStartChecked();
93 void slotCompChecked(); 95 void slotCompChecked();
94 void slotDueChecked(); 96 void slotDueChecked();
95 void slotStartChanged( int, int, int ); 97 void slotStartChanged( int, int, int );
96 void slotCompChanged( int, int, int ); 98 void slotCompChanged( int, int, int );
97 void slotDueChanged( int, int, int ); 99 void slotDueChanged( int, int, int );
98 100
99signals: 101signals:
100 void dueDateChanged( const QDate& date ); 102 void dueDateChanged( const QDate& date );
101}; 103};
102 104
103#endif // TASKEDITORSTATUS_H 105#endif // TASKEDITORSTATUS_H
diff --git a/core/pim/todo/templatedialog.cpp b/core/pim/todo/templatedialog.cpp
index 8d72297..9821667 100644
--- a/core/pim/todo/templatedialog.cpp
+++ b/core/pim/todo/templatedialog.cpp
@@ -1,60 +1,90 @@
1/*
2                 This file is part of the Opie Project
3
4 Copyright (C) Opie Team <opie-devel@handhelds.org>
5 =.
6 .=l.
7           .>+-=
8 _;:,     .>    :=|. This program is free software; you can
9.> <`_,   >  .   <= redistribute it and/or modify it under
10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11.="- .-=="i,     .._ License as published by the Free Software
12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13     ._= =}       : or (at your option) any later version.
14    .%`+i>       _;_.
15    .i_,=:_.      -<s. This program is distributed in the hope that
16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17 : ..    .:,     . . . without even the implied warranty of
18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20..}^=.=       =       ; Library General Public License for more
21++=   -.     .`     .: details.
22:     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA.
29*/
30
1#include <opie2/odebug.h> 31#include <opie2/odebug.h>
2 32
3#include <qpushbutton.h> 33#include <qpushbutton.h>
4#include <qhbox.h> 34#include <qhbox.h>
5#include <qlayout.h> 35#include <qlayout.h>
6#include <qlistview.h> 36#include <qlistview.h>
7#include <qlineedit.h> 37#include <qlineedit.h>
8 38
9#include "templatedialog.h" 39#include "templatedialog.h"
10 40
11 41
12using namespace Todo; 42using namespace Todo;
13 43
14/* TRANSLATOR Todo::TemplateDialog */ 44/* TRANSLATOR Todo::TemplateDialog */
15 45
16TemplateDialog::TemplateDialog( QWidget* widget ) 46TemplateDialog::TemplateDialog( QWidget* widget )
17 : QDialog( widget, "TemplateDialog", TRUE ) 47 : QDialog( widget, "TemplateDialog", TRUE )
18{ 48{
19 setCaption( QWidget::tr("Template Editor") ); 49 setCaption( QWidget::tr("Template Editor") );
20 m_main = new QVBoxLayout(this ); 50 m_main = new QVBoxLayout(this );
21 51
22 m_list = new QListView( this ); 52 m_list = new QListView( this );
23 m_main->addWidget( m_list, 100 ); 53 m_main->addWidget( m_list, 100 );
24 54
25 m_lne = new QLineEdit( this ); 55 m_lne = new QLineEdit( this );
26 m_main->addWidget( m_lne ); 56 m_main->addWidget( m_lne );
27 57
28 m_btnBar = new QHBox( this ); 58 m_btnBar = new QHBox( this );
29 m_add = new QPushButton( QWidget::tr("Add"), m_btnBar ); 59 m_add = new QPushButton( QWidget::tr("Add"), m_btnBar );
30 m_edit = new QPushButton( QWidget::tr("Edit"), m_btnBar ); 60 m_edit = new QPushButton( QWidget::tr("Edit"), m_btnBar );
31 m_rem = new QPushButton( QWidget::tr("Remove"), m_btnBar ); 61 m_rem = new QPushButton( QWidget::tr("Remove"), m_btnBar );
32 m_main->addWidget( m_btnBar ); 62 m_main->addWidget( m_btnBar );
33 63
34 connect(m_add, SIGNAL(clicked() ), 64 connect(m_add, SIGNAL(clicked() ),
35 this, SLOT(slotAdd() ) ); 65 this, SLOT(slotAdd() ) );
36 connect(m_edit, SIGNAL(clicked() ), 66 connect(m_edit, SIGNAL(clicked() ),
37 this, SLOT(slotEdit() ) ); 67 this, SLOT(slotEdit() ) );
38 connect(m_rem, SIGNAL(clicked() ), 68 connect(m_rem, SIGNAL(clicked() ),
39 this, SLOT(slotRemove() ) ); 69 this, SLOT(slotRemove() ) );
40 connect(m_lne, SIGNAL(returnPressed() ), 70 connect(m_lne, SIGNAL(returnPressed() ),
41 this, SLOT(slotReturn() ) ); 71 this, SLOT(slotReturn() ) );
42 72
43} 73}
44TemplateDialog::~TemplateDialog() { 74TemplateDialog::~TemplateDialog() {
45 // Qt does delete our widgets 75 // Qt does delete our widgets
46} 76}
47QListView* TemplateDialog::listView() { 77QListView* TemplateDialog::listView() {
48 return m_list; 78 return m_list;
49} 79}
50QLineEdit* TemplateDialog::edit() { 80QLineEdit* TemplateDialog::edit() {
51 return m_lne; 81 return m_lne;
52} 82}
53void TemplateDialog::slotAdd() { 83void TemplateDialog::slotAdd() {
54} 84}
55void TemplateDialog::slotRemove() { 85void TemplateDialog::slotRemove() {
56} 86}
57void TemplateDialog::slotEdit() { 87void TemplateDialog::slotEdit() {
58} 88}
59void TemplateDialog::slotReturn() { 89void TemplateDialog::slotReturn() {
60} 90}
diff --git a/core/pim/todo/templatedialog.h b/core/pim/todo/templatedialog.h
index 5886c34..8ed915b 100644
--- a/core/pim/todo/templatedialog.h
+++ b/core/pim/todo/templatedialog.h
@@ -1,44 +1,74 @@
1/*
2                 This file is part of the Opie Project
3
4 Copyright (C) Opie Team <opie-devel@handhelds.org>
5 =.
6 .=l.
7           .>+-=
8 _;:,     .>    :=|. This program is free software; you can
9.> <`_,   >  .   <= redistribute it and/or modify it under
10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11.="- .-=="i,     .._ License as published by the Free Software
12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13     ._= =}       : or (at your option) any later version.
14    .%`+i>       _;_.
15    .i_,=:_.      -<s. This program is distributed in the hope that
16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17 : ..    .:,     . . . without even the implied warranty of
18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20..}^=.=       =       ; Library General Public License for more
21++=   -.     .`     .: details.
22:     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA.
29*/
30
1#ifndef OPIE_TEMPLATE_DIALOG_H 31#ifndef OPIE_TEMPLATE_DIALOG_H
2#define OPIE_TEMPLATE_DIALOG_H 32#define OPIE_TEMPLATE_DIALOG_H
3 33
4#include <qdialog.h> 34#include <qdialog.h>
5#include <qstring.h> 35#include <qstring.h>
6 36
7class QListView; 37class QListView;
8class QPushButton; 38class QPushButton;
9class QLabel; 39class QLabel;
10class QHBox; 40class QHBox;
11class QVBoxLayout; 41class QVBoxLayout;
12class QLineEdit; 42class QLineEdit;
13 43
14 44
15namespace Todo { 45namespace Todo {
16 class TemplateDialog : public QDialog { 46 class TemplateDialog : public QDialog {
17 Q_OBJECT 47 Q_OBJECT
18 public: 48 public:
19 /* it'll be modal */ 49 /* it'll be modal */
20 TemplateDialog( QWidget* parent ); 50 TemplateDialog( QWidget* parent );
21 virtual ~TemplateDialog(); 51 virtual ~TemplateDialog();
22 52
23 protected: 53 protected:
24 QListView* listView(); 54 QListView* listView();
25 QLineEdit* edit(); 55 QLineEdit* edit();
26private slots: 56private slots:
27 virtual void slotAdd(); 57 virtual void slotAdd();
28 virtual void slotRemove(); 58 virtual void slotRemove();
29 virtual void slotEdit(); 59 virtual void slotEdit();
30 virtual void slotReturn(); 60 virtual void slotReturn();
31 61
32 private: 62 private:
33 QVBoxLayout* m_main; 63 QVBoxLayout* m_main;
34 QHBox* m_btnBar; 64 QHBox* m_btnBar;
35 QListView* m_list; 65 QListView* m_list;
36 QLineEdit *m_lne; 66 QLineEdit *m_lne;
37 QPushButton* m_add; 67 QPushButton* m_add;
38 QPushButton* m_rem; 68 QPushButton* m_rem;
39 QPushButton* m_edit; 69 QPushButton* m_edit;
40 70
41 }; 71 };
42} 72}
43 73
44#endif 74#endif
diff --git a/core/pim/todo/templatedialogimpl.cpp b/core/pim/todo/templatedialogimpl.cpp
index c9ad3d0..0d4090e 100644
--- a/core/pim/todo/templatedialogimpl.cpp
+++ b/core/pim/todo/templatedialogimpl.cpp
@@ -1,96 +1,126 @@
1/*
2                 This file is part of the Opie Project
3
4 Copyright (C) Opie Team <opie-devel@handhelds.org>
5 =.
6 .=l.
7           .>+-=
8 _;:,     .>    :=|. This program is free software; you can
9.> <`_,   >  .   <= redistribute it and/or modify it under
10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11.="- .-=="i,     .._ License as published by the Free Software
12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13     ._= =}       : or (at your option) any later version.
14    .%`+i>       _;_.
15    .i_,=:_.      -<s. This program is distributed in the hope that
16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17 : ..    .:,     . . . without even the implied warranty of
18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20..}^=.=       =       ; Library General Public License for more
21++=   -.     .`     .: details.
22:     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA.
29*/
30
1#include <qlineedit.h> 31#include <qlineedit.h>
2 32
3#include "mainwindow.h" 33#include "mainwindow.h"
4#include "todoeditor.h" 34#include "todoeditor.h"
5#include "todotemplatemanager.h" 35#include "todotemplatemanager.h"
6#include "templatedialogimpl.h" 36#include "templatedialogimpl.h"
7 37
8 38
9using namespace Todo; 39using namespace Todo;
10 40
11/* TRANSLATOR Todo::TemplateDialogImpl */ 41/* TRANSLATOR Todo::TemplateDialogImpl */
12 42
13namespace { 43namespace {
14 class TemplateListItem : public QListViewItem { 44 class TemplateListItem : public QListViewItem {
15 public: 45 public:
16 TemplateListItem( QListView*, 46 TemplateListItem( QListView*,
17 const QString& name, 47 const QString& name,
18 const OPimTodo& ); 48 const OPimTodo& );
19 ~TemplateListItem(); 49 ~TemplateListItem();
20 50
21 OPimTodo event()const; 51 OPimTodo event()const;
22 QString text()const; 52 QString text()const;
23 void setText(const QString& str ); 53 void setText(const QString& str );
24 void setEvent( const OPimTodo& ); 54 void setEvent( const OPimTodo& );
25 private: 55 private:
26 QString m_name; 56 QString m_name;
27 OPimTodo m_ev; 57 OPimTodo m_ev;
28 }; 58 };
29 59
30 /* implementation */ 60 /* implementation */
31 TemplateListItem::TemplateListItem( QListView* view, 61 TemplateListItem::TemplateListItem( QListView* view,
32 const QString& text, 62 const QString& text,
33 const OPimTodo& ev ) 63 const OPimTodo& ev )
34 : QListViewItem( view ), m_name( text ), m_ev( ev ) 64 : QListViewItem( view ), m_name( text ), m_ev( ev )
35 { 65 {
36 QListViewItem::setText(0, m_name ); 66 QListViewItem::setText(0, m_name );
37 } 67 }
38 TemplateListItem::~TemplateListItem() {} 68 TemplateListItem::~TemplateListItem() {}
39 OPimTodo TemplateListItem::event() const { 69 OPimTodo TemplateListItem::event() const {
40 return m_ev; 70 return m_ev;
41 } 71 }
42 QString TemplateListItem::text()const { 72 QString TemplateListItem::text()const {
43 return m_name; 73 return m_name;
44 } 74 }
45 void TemplateListItem::setText( const QString& str ) { 75 void TemplateListItem::setText( const QString& str ) {
46 QListViewItem::setText(0, str ); 76 QListViewItem::setText(0, str );
47 m_name = str; 77 m_name = str;
48 } 78 }
49 void TemplateListItem::setEvent( const OPimTodo& ev) { 79 void TemplateListItem::setEvent( const OPimTodo& ev) {
50 m_ev = ev; 80 m_ev = ev;
51 } 81 }
52} 82}
53 83
54TemplateDialogImpl::TemplateDialogImpl( MainWindow* win, 84TemplateDialogImpl::TemplateDialogImpl( MainWindow* win,
55 TemplateManager* man ) 85 TemplateManager* man )
56 : TemplateDialog( win ), m_win( win), m_man( man ) 86 : TemplateDialog( win ), m_win( win), m_man( man )
57{ 87{
58 /* fill the listview */ 88 /* fill the listview */
59 /* not the fastest way.... */ 89 /* not the fastest way.... */
60 QStringList list = man->templates(); 90 QStringList list = man->templates();
61 for (QStringList::Iterator it = list.begin(); 91 for (QStringList::Iterator it = list.begin();
62 it != list.end(); ++it ) { 92 it != list.end(); ++it ) {
63 new TemplateListItem( listView(), (*it), man->templateEvent( (*it) ) ); 93 new TemplateListItem( listView(), (*it), man->templateEvent( (*it) ) );
64 } 94 }
65 listView()->addColumn( QWidget::tr("Name") ); 95 listView()->addColumn( QWidget::tr("Name") );
66 96
67 connect( listView(), SIGNAL(clicked(QListViewItem*) ), 97 connect( listView(), SIGNAL(clicked(QListViewItem*) ),
68 this, SLOT(slotClicked(QListViewItem*) ) ); 98 this, SLOT(slotClicked(QListViewItem*) ) );
69} 99}
70TemplateDialogImpl::~TemplateDialogImpl() { 100TemplateDialogImpl::~TemplateDialogImpl() {
71 101
72} 102}
73void TemplateDialogImpl::slotAdd() { 103void TemplateDialogImpl::slotAdd() {
74 QString str = QWidget::tr("New Template %1").arg( listView()->childCount() ); 104 QString str = QWidget::tr("New Template %1").arg( listView()->childCount() );
75 OPimTodo ev; 105 OPimTodo ev;
76 m_man->addEvent(str, ev); 106 m_man->addEvent(str, ev);
77 new TemplateListItem( listView(), str, ev ); 107 new TemplateListItem( listView(), str, ev );
78} 108}
79void TemplateDialogImpl::slotRemove() { 109void TemplateDialogImpl::slotRemove() {
80 if (!listView()->currentItem() ) 110 if (!listView()->currentItem() )
81 return; 111 return;
82 112
83 TemplateListItem* item = static_cast<TemplateListItem*>( listView()->currentItem() ); 113 TemplateListItem* item = static_cast<TemplateListItem*>( listView()->currentItem() );
84 listView()->takeItem( item ); 114 listView()->takeItem( item );
85 115
86 m_man->removeEvent( item->text() ); 116 m_man->removeEvent( item->text() );
87 117
88 delete item; 118 delete item;
89} 119}
90void TemplateDialogImpl::slotEdit() { 120void TemplateDialogImpl::slotEdit() {
91 if ( !listView()->currentItem() ) 121 if ( !listView()->currentItem() )
92 return; 122 return;
93 123
94 TemplateListItem* item = static_cast<TemplateListItem*>( listView()->currentItem() ); 124 TemplateListItem* item = static_cast<TemplateListItem*>( listView()->currentItem() );
95 OPimTodo ev = m_win->currentEditor()->edit( m_win, item->event() ); 125 OPimTodo ev = m_win->currentEditor()->edit( m_win, item->event() );
96 if ( m_win->currentEditor()->accepted() ) { 126 if ( m_win->currentEditor()->accepted() ) {
diff --git a/core/pim/todo/templatedialogimpl.h b/core/pim/todo/templatedialogimpl.h
index cc78521..6affb7d 100644
--- a/core/pim/todo/templatedialogimpl.h
+++ b/core/pim/todo/templatedialogimpl.h
@@ -1,33 +1,63 @@
1/*
2                 This file is part of the Opie Project
3
4 Copyright (C) Opie Team <opie-devel@handhelds.org>
5 =.
6 .=l.
7           .>+-=
8 _;:,     .>    :=|. This program is free software; you can
9.> <`_,   >  .   <= redistribute it and/or modify it under
10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11.="- .-=="i,     .._ License as published by the Free Software
12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13     ._= =}       : or (at your option) any later version.
14    .%`+i>       _;_.
15    .i_,=:_.      -<s. This program is distributed in the hope that
16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17 : ..    .:,     . . . without even the implied warranty of
18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20..}^=.=       =       ; Library General Public License for more
21++=   -.     .`     .: details.
22:     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA.
29*/
30
1#ifndef OPIE_TEMPLATE_DIALOG_IMPL_H 31#ifndef OPIE_TEMPLATE_DIALOG_IMPL_H
2#define OPIE_TEMPLATE_DIALOG_IMPL_H 32#define OPIE_TEMPLATE_DIALOG_IMPL_H
3 33
4#include <qlistview.h> 34#include <qlistview.h>
5 35
6#include <opie2/opimtodo.h> 36#include <opie2/opimtodo.h>
7 37
8#include "templatedialog.h" 38#include "templatedialog.h"
9 39
10 40
11namespace Todo { 41namespace Todo {
12 42
13 class MainWindow; 43 class MainWindow;
14 class TemplateManager; 44 class TemplateManager;
15 class TemplateDialogImpl : public Todo::TemplateDialog { 45 class TemplateDialogImpl : public Todo::TemplateDialog {
16 Q_OBJECT 46 Q_OBJECT
17 public: 47 public:
18 TemplateDialogImpl( MainWindow* win, TemplateManager* ); 48 TemplateDialogImpl( MainWindow* win, TemplateManager* );
19 ~TemplateDialogImpl(); 49 ~TemplateDialogImpl();
20 50
21 private: 51 private:
22 MainWindow* m_win; 52 MainWindow* m_win;
23 TemplateManager* m_man; 53 TemplateManager* m_man;
24private slots: 54private slots:
25 void slotAdd(); 55 void slotAdd();
26 void slotRemove(); 56 void slotRemove();
27 void slotEdit(); 57 void slotEdit();
28 void slotReturn(); 58 void slotReturn();
29 void slotClicked(QListViewItem*); 59 void slotClicked(QListViewItem*);
30 }; 60 };
31}; 61};
32 62
33#endif 63#endif
diff --git a/core/pim/todo/textviewshow.cpp b/core/pim/todo/textviewshow.cpp
index 01e5810..7d93efc 100644
--- a/core/pim/todo/textviewshow.cpp
+++ b/core/pim/todo/textviewshow.cpp
@@ -1,48 +1,78 @@
1/*
2                 This file is part of the Opie Project
3
4 Copyright (C) Opie Team <opie-devel@handhelds.org>
5 =.
6 .=l.
7           .>+-=
8 _;:,     .>    :=|. This program is free software; you can
9.> <`_,   >  .   <= redistribute it and/or modify it under
10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11.="- .-=="i,     .._ License as published by the Free Software
12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13     ._= =}       : or (at your option) any later version.
14    .%`+i>       _;_.
15    .i_,=:_.      -<s. This program is distributed in the hope that
16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17 : ..    .:,     . . . without even the implied warranty of
18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20..}^=.=       =       ; Library General Public License for more
21++=   -.     .`     .: details.
22:     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA.
29*/
30
1#include "textviewshow.h" 31#include "textviewshow.h"
2 32
3using namespace Todo; 33using namespace Todo;
4 34
5TextViewShow::TextViewShow( QWidget* parent, MainWindow* win) 35TextViewShow::TextViewShow( QWidget* parent, MainWindow* win)
6 : QTextView( parent ), TodoShow(win) { 36 : QTextView( parent ), TodoShow(win) {
7 37
8} 38}
9TextViewShow::~TextViewShow() { 39TextViewShow::~TextViewShow() {
10} 40}
11QString TextViewShow::type()const { 41QString TextViewShow::type()const {
12 return QString::fromLatin1("TextViewShow"); 42 return QString::fromLatin1("TextViewShow");
13} 43}
14void TextViewShow::slotShow( const OPimTodo& ev ) { 44void TextViewShow::slotShow( const OPimTodo& ev ) {
15 setText( ev.toRichText() ); 45 setText( ev.toRichText() );
16} 46}
17QWidget* TextViewShow::widget() { 47QWidget* TextViewShow::widget() {
18 return this; 48 return this;
19} 49}
20void TextViewShow::keyPressEvent( QKeyEvent* event ) { 50void TextViewShow::keyPressEvent( QKeyEvent* event ) {
21 switch( event->key() ) { 51 switch( event->key() ) {
22 case Qt::Key_Up: 52 case Qt::Key_Up:
23 if ( ( visibleHeight() < contentsHeight() ) && 53 if ( ( visibleHeight() < contentsHeight() ) &&
24 ( verticalScrollBar()->value() > verticalScrollBar()->minValue() ) ) 54 ( verticalScrollBar()->value() > verticalScrollBar()->minValue() ) )
25 scrollBy( 0, -(visibleHeight()-20) ); 55 scrollBy( 0, -(visibleHeight()-20) );
26 else 56 else
27 showPrev(); 57 showPrev();
28 break; 58 break;
29 case Qt::Key_Down: 59 case Qt::Key_Down:
30 if ( ( visibleHeight() < contentsHeight() ) && 60 if ( ( visibleHeight() < contentsHeight() ) &&
31 ( verticalScrollBar()->value() < verticalScrollBar()->maxValue() ) ) 61 ( verticalScrollBar()->value() < verticalScrollBar()->maxValue() ) )
32 scrollBy( 0, visibleHeight()-20 ); 62 scrollBy( 0, visibleHeight()-20 );
33 else 63 else
34 showNext(); 64 showNext();
35 break; 65 break;
36 case Qt::Key_Left: 66 case Qt::Key_Left:
37 case Qt::Key_Right: 67 case Qt::Key_Right:
38 case Qt::Key_F33: 68 case Qt::Key_F33:
39 case Qt::Key_Enter: 69 case Qt::Key_Enter:
40 case Qt::Key_Return: 70 case Qt::Key_Return:
41 case Qt::Key_Space: 71 case Qt::Key_Space:
42 escapeView(); 72 escapeView();
43 break; 73 break;
44 default: 74 default:
45 QTextView::keyPressEvent( event ); 75 QTextView::keyPressEvent( event );
46 break; 76 break;
47 } 77 }
48} 78}
diff --git a/core/pim/todo/textviewshow.h b/core/pim/todo/textviewshow.h
index cc31522..8278ef6 100644
--- a/core/pim/todo/textviewshow.h
+++ b/core/pim/todo/textviewshow.h
@@ -1,20 +1,50 @@
1/*
2                 This file is part of the Opie Project
3
4 Copyright (C) Opie Team <opie-devel@handhelds.org>
5 =.
6 .=l.
7           .>+-=
8 _;:,     .>    :=|. This program is free software; you can
9.> <`_,   >  .   <= redistribute it and/or modify it under
10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11.="- .-=="i,     .._ License as published by the Free Software
12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13     ._= =}       : or (at your option) any later version.
14    .%`+i>       _;_.
15    .i_,=:_.      -<s. This program is distributed in the hope that
16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17 : ..    .:,     . . . without even the implied warranty of
18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20..}^=.=       =       ; Library General Public License for more
21++=   -.     .`     .: details.
22:     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA.
29*/
30
1#include <qtextview.h> 31#include <qtextview.h>
2 32
3#include "todoshow.h" 33#include "todoshow.h"
4 34
5namespace Todo { 35namespace Todo {
6 36
7 class TextViewShow : public QTextView, public TodoShow { 37 class TextViewShow : public QTextView, public TodoShow {
8 public: 38 public:
9 TextViewShow( QWidget* parent, MainWindow* ); 39 TextViewShow( QWidget* parent, MainWindow* );
10 ~TextViewShow(); 40 ~TextViewShow();
11 41
12 QString type()const; 42 QString type()const;
13 void slotShow( const OPimTodo& ev ); 43 void slotShow( const OPimTodo& ev );
14 QWidget* widget(); 44 QWidget* widget();
15 45
16 protected: 46 protected:
17 void keyPressEvent( QKeyEvent* ); 47 void keyPressEvent( QKeyEvent* );
18 48
19 }; 49 };
20}; 50};
diff --git a/core/pim/todo/todoedit.h b/core/pim/todo/todoedit.h
index 4e89e93..a607eb2 100644
--- a/core/pim/todo/todoedit.h
+++ b/core/pim/todo/todoedit.h
@@ -1,17 +1,47 @@
1/*
2                 This file is part of the Opie Project
3
4 Copyright (C) Opie Team <opie-devel@handhelds.org>
5 =.
6 .=l.
7           .>+-=
8 _;:,     .>    :=|. This program is free software; you can
9.> <`_,   >  .   <= redistribute it and/or modify it under
10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11.="- .-=="i,     .._ License as published by the Free Software
12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13     ._= =}       : or (at your option) any later version.
14    .%`+i>       _;_.
15    .i_,=:_.      -<s. This program is distributed in the hope that
16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17 : ..    .:,     . . . without even the implied warranty of
18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20..}^=.=       =       ; Library General Public License for more
21++=   -.     .`     .: details.
22:     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA.
29*/
30
1#ifndef OPIE_TODO_EDIT_H 31#ifndef OPIE_TODO_EDIT_H
2#define OPIE_TODO_EDIT_H 32#define OPIE_TODO_EDIT_H
3 33
4#include <opie2/opimtodo.h> 34#include <opie2/opimtodo.h>
5 35
6namespace Todo { 36namespace Todo {
7 class Edit { 37 class Edit {
8 public: 38 public:
9 Edit(); 39 Edit();
10 virtual ~Edit(); 40 virtual ~Edit();
11 41
12 ToDoEvent newEvent( const OPimTodo& ) = 0; 42 ToDoEvent newEvent( const OPimTodo& ) = 0;
13 ToDoEvent editEvent( const OPimTodo& ) = 0; 43 ToDoEvent editEvent( const OPimTodo& ) = 0;
14 }; 44 };
15}; 45};
16 46
17#endif 47#endif
diff --git a/core/pim/todo/todoeditor.cpp b/core/pim/todo/todoeditor.cpp
index a1c559d..d4693a2 100644
--- a/core/pim/todo/todoeditor.cpp
+++ b/core/pim/todo/todoeditor.cpp
@@ -1,62 +1,92 @@
1/*
2                 This file is part of the Opie Project
3
4 Copyright (C) Opie Team <opie-devel@handhelds.org>
5 =.
6 .=l.
7           .>+-=
8 _;:,     .>    :=|. This program is free software; you can
9.> <`_,   >  .   <= redistribute it and/or modify it under
10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11.="- .-=="i,     .._ License as published by the Free Software
12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13     ._= =}       : or (at your option) any later version.
14    .%`+i>       _;_.
15    .i_,=:_.      -<s. This program is distributed in the hope that
16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17 : ..    .:,     . . . without even the implied warranty of
18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20..}^=.=       =       ; Library General Public License for more
21++=   -.     .`     .: details.
22:     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA.
29*/
30
1#include <opie2/odebug.h> 31#include <opie2/odebug.h>
2 32
3#include <qpe/qpeapplication.h> 33#include <qpe/qpeapplication.h>
4 34
5#include "otaskeditor.h" 35#include "otaskeditor.h"
6#include "todoeditor.h" 36#include "todoeditor.h"
7 37
8using namespace Opie; 38using namespace Opie;
9using namespace Todo; 39using namespace Todo;
10 40
11Editor::Editor() { 41Editor::Editor() {
12 m_accepted = false; 42 m_accepted = false;
13 m_self = 0l; 43 m_self = 0l;
14} 44}
15Editor::~Editor() { 45Editor::~Editor() {
16 delete m_self; 46 delete m_self;
17 m_self = 0; 47 m_self = 0;
18} 48}
19OPimTodo Editor::newTodo( int cur, 49OPimTodo Editor::newTodo( int cur,
20 QWidget*) { 50 QWidget*) {
21 51
22 OTaskEditor *e = self(); 52 OTaskEditor *e = self();
23 e->setCaption( QObject::tr("Enter Task") ); 53 e->setCaption( QObject::tr("Enter Task") );
24 e->init( cur ); 54 e->init( cur );
25 55
26 int ret = QPEApplication::execDialog( e ); 56 int ret = QPEApplication::execDialog( e );
27 57
28 if ( QDialog::Accepted == ret ) { 58 if ( QDialog::Accepted == ret ) {
29 m_accepted = true; 59 m_accepted = true;
30 }else 60 }else
31 m_accepted = false; 61 m_accepted = false;
32 62
33 OPimTodo ev = e->todo(); 63 OPimTodo ev = e->todo();
34 ev.setUid(1); 64 ev.setUid(1);
35 65
36 return ev; 66 return ev;
37} 67}
38OPimTodo Editor::edit( QWidget *, 68OPimTodo Editor::edit( QWidget *,
39 const OPimTodo& todo ) { 69 const OPimTodo& todo ) {
40 OTaskEditor *e = self(); 70 OTaskEditor *e = self();
41 e->init( todo ); 71 e->init( todo );
42 e->setCaption( QObject::tr( "Edit Task" ) ); 72 e->setCaption( QObject::tr( "Edit Task" ) );
43 73
44 int ret = QPEApplication::execDialog( e ); 74 int ret = QPEApplication::execDialog( e );
45 75
46 OPimTodo ev = e->todo(); 76 OPimTodo ev = e->todo();
47 if ( ret == QDialog::Accepted ) 77 if ( ret == QDialog::Accepted )
48 m_accepted = true; 78 m_accepted = true;
49 else 79 else
50 m_accepted = false; 80 m_accepted = false;
51 81
52 return ev; 82 return ev;
53} 83}
54bool Editor::accepted()const { 84bool Editor::accepted()const {
55 return m_accepted; 85 return m_accepted;
56} 86}
57OTaskEditor* Editor::self() { 87OTaskEditor* Editor::self() {
58 if (!m_self ) 88 if (!m_self )
59 m_self = new OTaskEditor(0); 89 m_self = new OTaskEditor(0);
60 90
61 return m_self; 91 return m_self;
62} 92}
diff --git a/core/pim/todo/todoeditor.h b/core/pim/todo/todoeditor.h
index 1ac7f8a..c12824c 100644
--- a/core/pim/todo/todoeditor.h
+++ b/core/pim/todo/todoeditor.h
@@ -1,29 +1,59 @@
1/*
2                 This file is part of the Opie Project
3
4 Copyright (C) Opie Team <opie-devel@handhelds.org>
5 =.
6 .=l.
7           .>+-=
8 _;:,     .>    :=|. This program is free software; you can
9.> <`_,   >  .   <= redistribute it and/or modify it under
10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11.="- .-=="i,     .._ License as published by the Free Software
12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13     ._= =}       : or (at your option) any later version.
14    .%`+i>       _;_.
15    .i_,=:_.      -<s. This program is distributed in the hope that
16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17 : ..    .:,     . . . without even the implied warranty of
18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20..}^=.=       =       ; Library General Public License for more
21++=   -.     .`     .: details.
22:     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA.
29*/
30
1#ifndef OPIE_TODO_EDITOR_H 31#ifndef OPIE_TODO_EDITOR_H
2#define OPIE_TODO_EDITOR_H 32#define OPIE_TODO_EDITOR_H
3 33
4#include <opie2/opimtodo.h> 34#include <opie2/opimtodo.h>
5 35
6 36
7class OTaskEditor; 37class OTaskEditor;
8namespace Todo { 38namespace Todo {
9 class Editor { 39 class Editor {
10 public: 40 public:
11 Editor(); 41 Editor();
12 ~Editor(); 42 ~Editor();
13 43
14 Opie::OPimTodo newTodo( int currentCatId, 44 Opie::OPimTodo newTodo( int currentCatId,
15 QWidget* par ); 45 QWidget* par );
16 Opie::OPimTodo edit( QWidget* par, 46 Opie::OPimTodo edit( QWidget* par,
17 const Opie::OPimTodo& ev = Opie::OPimTodo() ); 47 const Opie::OPimTodo& ev = Opie::OPimTodo() );
18 48
19 49
20 bool accepted()const; 50 bool accepted()const;
21 protected: 51 protected:
22 OTaskEditor* self(); 52 OTaskEditor* self();
23 private: 53 private:
24 bool m_accepted: 1; 54 bool m_accepted: 1;
25 OTaskEditor* m_self; 55 OTaskEditor* m_self;
26 }; 56 };
27}; 57};
28 58
29#endif 59#endif
diff --git a/core/pim/todo/todomanager.cpp b/core/pim/todo/todomanager.cpp
index fcd5f0e..2a9945d 100644
--- a/core/pim/todo/todomanager.cpp
+++ b/core/pim/todo/todomanager.cpp
@@ -1,122 +1,124 @@
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
4 .>+-= 4 Copyright (C) Opie Team <opie-devel@handhelds.org>
5_;:, .> :=|. This program is free software; you can 5 =.
6.> <`_, > . <= redistribute it and/or modify it under 6 .=l.
7:`=1 )Y*s>-.-- : the terms of the GNU General Public 7           .>+-=
8.="- .-=="i, .._ License as published by the Free Software 8 _;:,     .>    :=|. This program is free software; you can
9- . .-<_> .<> Foundation; either version 2 of the License, 9.> <`_,   >  .   <= redistribute it and/or modify it under
10 ._= =} : or (at your option) any later version. 10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11 .%`+i> _;_. 11.="- .-=="i,     .._ License as published by the Free Software
12 .i_,=:_. -<s. This program is distributed in the hope that 12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13 + . -:. = it will be useful, but WITHOUT ANY WARRANTY; 13     ._= =}       : or (at your option) any later version.
14 : .. .:, . . . without even the implied warranty of 14    .%`+i>       _;_.
15 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A 15    .i_,=:_.      -<s. This program is distributed in the hope that
16 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU 16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17..}^=.= = ; Library General Public License for more 17 : ..    .:,     . . . without even the implied warranty of
18++= -. .` .: details. 18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19: = ...= . :.=- 19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20-. .:....=;==+<; You should have received a copy of the GNU 20..}^=.=       =       ; Library General Public License for more
21 -_. . . )=. = Library General Public License along with 21++=   -.     .`     .: details.
22 -- :-=` this library; see the file COPYING.LIB. 22:     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation, 26 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330, 27 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
26
27*/ 29*/
28 30
29#include <opie2/odebug.h> 31#include <opie2/odebug.h>
30 32
31#include <qpe/categoryselect.h> 33#include <qpe/categoryselect.h>
32 34
33#include "todomanager.h" 35#include "todomanager.h"
34 36
35using namespace Todo; 37using namespace Todo;
36 38
37TodoManager::TodoManager( QObject *obj ) 39TodoManager::TodoManager( QObject *obj )
38 : QObject( obj ) { 40 : QObject( obj ) {
39 m_db = 0l; 41 m_db = 0l;
40 m_cat.load( categoryFileName() ); 42 m_cat.load( categoryFileName() );
41} 43}
42TodoManager::~TodoManager() { 44TodoManager::~TodoManager() {
43 delete m_db; 45 delete m_db;
44} 46}
45OPimTodo TodoManager::event(int uid ) { 47OPimTodo TodoManager::event(int uid ) {
46 return m_db->find( uid ); 48 return m_db->find( uid );
47} 49}
48void TodoManager::updateList() { 50void TodoManager::updateList() {
49 m_list = m_db->allRecords(); 51 m_list = m_db->allRecords();
50} 52}
51OPimTodoAccess::List TodoManager::list() const{ 53OPimTodoAccess::List TodoManager::list() const{
52 return m_list; 54 return m_list;
53} 55}
54OPimTodoAccess::List TodoManager::sorted( bool asc, int so, int f, int cat ) { 56OPimTodoAccess::List TodoManager::sorted( bool asc, int so, int f, int cat ) {
55 return m_db->sorted( asc, so, f, cat ); 57 return m_db->sorted( asc, so, f, cat );
56} 58}
57OPimTodoAccess::List::Iterator TodoManager::overDue() { 59OPimTodoAccess::List::Iterator TodoManager::overDue() {
58 int filter = Opie::OPimTodoAccess::FilterCategory | Opie::OPimTodoAccess::OnlyOverDue; 60 int filter = Opie::OPimTodoAccess::FilterCategory | Opie::OPimTodoAccess::OnlyOverDue;
59 m_list = m_db->sorted(m_asc, m_sortOrder, filter, m_ca ); 61 m_list = m_db->sorted(m_asc, m_sortOrder, filter, m_ca );
60 m_it = m_list.begin(); 62 m_it = m_list.begin();
61 return m_it; 63 return m_it;
62} 64}
63OPimTodoAccess::List::Iterator TodoManager::fromTo( const QDate& start, 65OPimTodoAccess::List::Iterator TodoManager::fromTo( const QDate& start,
64 const QDate& end ) { 66 const QDate& end ) {
65 m_list = m_db->effectiveToDos( start, end ); 67 m_list = m_db->effectiveToDos( start, end );
66 m_it = m_list.begin(); 68 m_it = m_list.begin();
67 return m_it; 69 return m_it;
68} 70}
69OPimTodoAccess::List::Iterator TodoManager::query( const OPimTodo& ev, int query ) { 71OPimTodoAccess::List::Iterator TodoManager::query( const OPimTodo& ev, int query ) {
70 m_list = m_db->queryByExample( ev, query ); 72 m_list = m_db->queryByExample( ev, query );
71 m_it = m_list.begin(); 73 m_it = m_list.begin();
72 return m_it; 74 return m_it;
73} 75}
74OPimTodoAccess* TodoManager::todoDB() { 76OPimTodoAccess* TodoManager::todoDB() {
75 return m_db; 77 return m_db;
76} 78}
77void TodoManager::add( const OPimTodo& ev ) { 79void TodoManager::add( const OPimTodo& ev ) {
78 m_db->add( ev ); 80 m_db->add( ev );
79} 81}
80void TodoManager::update( int, const SmallTodo& ) { 82void TodoManager::update( int, const SmallTodo& ) {
81 83
82} 84}
83void TodoManager::update( int, const OPimTodo& ev) { 85void TodoManager::update( int, const OPimTodo& ev) {
84 m_db->replace( ev ); 86 m_db->replace( ev );
85} 87}
86bool TodoManager::remove( int uid ) { 88bool TodoManager::remove( int uid ) {
87 return m_db->remove( uid ); 89 return m_db->remove( uid );
88} 90}
89void TodoManager::removeAll() { 91void TodoManager::removeAll() {
90 m_db->clear(); 92 m_db->clear();
91} 93}
92void TodoManager::removeCompleted() { 94void TodoManager::removeCompleted() {
93 m_db->removeAllCompleted(); 95 m_db->removeAllCompleted();
94} 96}
95void TodoManager::save() { 97void TodoManager::save() {
96 m_db->save(); 98 m_db->save();
97} 99}
98bool TodoManager::saveAll() { 100bool TodoManager::saveAll() {
99 return m_db->save(); 101 return m_db->save();
100} 102}
101void TodoManager::reload() { 103void TodoManager::reload() {
102 m_db->reload(); 104 m_db->reload();
103} 105}
104QStringList TodoManager::categories() { 106QStringList TodoManager::categories() {
105 m_cat.load(categoryFileName() ); 107 m_cat.load(categoryFileName() );
106 return m_cat.labels( "Todo List"); 108 return m_cat.labels( "Todo List");
107} 109}
108/* 110/*
109 * we rely on load beeing called from populateCategories 111 * we rely on load beeing called from populateCategories
110 */ 112 */
111int TodoManager::catId( const QString& cats ) { 113int TodoManager::catId( const QString& cats ) {
112 return m_cat.id( "Todo List", cats ); 114 return m_cat.id( "Todo List", cats );
113} 115}
114void TodoManager::remove( const QArray<int>& ids) { 116void TodoManager::remove( const QArray<int>& ids) {
115 for (uint i=0; i < ids.size(); i++ ) 117 for (uint i=0; i < ids.size(); i++ )
116 remove( ids[i] ); 118 remove( ids[i] );
117} 119}
118bool TodoManager::isLoaded()const { 120bool TodoManager::isLoaded()const {
119 return (m_db == 0 ); 121 return (m_db == 0 );
120} 122}
121void TodoManager::load() { 123void TodoManager::load() {
122 if (!m_db) { 124 if (!m_db) {
diff --git a/core/pim/todo/todomanager.h b/core/pim/todo/todomanager.h
index 865b47b..37c3a62 100644
--- a/core/pim/todo/todomanager.h
+++ b/core/pim/todo/todomanager.h
@@ -1,113 +1,115 @@
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
4           .>+-= 4 Copyright (C) Opie Team <opie-devel@handhelds.org>
5 _;:,     .>    :=|. This program is free software; you can 5 =.
6.> <`_,   >  .   <= redistribute it and/or modify it under 6 .=l.
7:`=1 )Y*s>-.--   : the terms of the GNU General Public 7           .>+-=
8.="- .-=="i,     .._ License as published by the Free Software 8 _;:,     .>    :=|. This program is free software; you can
9 - .   .-<_>     .<> Foundation; either version 2 of the License, 9.> <`_,   >  .   <= redistribute it and/or modify it under
10     ._= =}       : or (at your option) any later version. 10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11    .%`+i>       _;_. 11.="- .-=="i,     .._ License as published by the Free Software
12    .i_,=:_.      -<s. This program is distributed in the hope that 12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 13     ._= =}       : or (at your option) any later version.
14    : ..    .:,     . . . without even the implied warranty of 14    .%`+i>       _;_.
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 15    .i_,=:_.      -<s. This program is distributed in the hope that
16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17..}^=.=       =       ; Library General Public License for more 17 : ..    .:,     . . . without even the implied warranty of
18++=   -.     .`     .: details. 18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19 :     =  ...= . :.=- 19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20 -.   .:....=;==+<; You should have received a copy of the GNU 20..}^=.=       =       ; Library General Public License for more
21  -_. . .   )=.  = Library General Public License along with 21++=   -.     .`     .: details.
22    --        :-=` this library; see the file COPYING.LIB. 22:     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation, 26 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330, 27 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
26
27*/ 29*/
28 30
29#ifndef OPIE_TODO_MANAGER_H 31#ifndef OPIE_TODO_MANAGER_H
30#define OPIE_TODO_MANAGER_H 32#define OPIE_TODO_MANAGER_H
31 33
32#include <opie2/opimtodo.h> 34#include <opie2/opimtodo.h>
33#include <opie2/otodoaccess.h> 35#include <opie2/otodoaccess.h>
34 36
35#include <qpe/categories.h> 37#include <qpe/categories.h>
36 38
37#include <qarray.h> 39#include <qarray.h>
38#include <qobject.h> 40#include <qobject.h>
39#include <qstring.h> 41#include <qstring.h>
40 42
41#include "smalltodo.h" 43#include "smalltodo.h"
42 44
43using Opie::OPimTodo; 45using Opie::OPimTodo;
44using Opie::OPimTodoAccess; 46using Opie::OPimTodoAccess;
45 47
46namespace Todo { 48namespace Todo {
47 class TodoManager : public QObject{ 49 class TodoManager : public QObject{
48 Q_OBJECT 50 Q_OBJECT
49 public: 51 public:
50 bool isLoaded()const; 52 bool isLoaded()const;
51 void load(); 53 void load();
52 TodoManager(QObject* obj = 0); 54 TodoManager(QObject* obj = 0);
53 ~TodoManager(); 55 ~TodoManager();
54 56
55 QStringList categories()/*const*/; 57 QStringList categories()/*const*/;
56 int catId(const QString&); 58 int catId(const QString&);
57 OPimTodo event(int uid ); 59 OPimTodo event(int uid );
58 60
59 void updateList(); 61 void updateList();
60 /** returns the iterator sorted if set sorted*/ 62 /** returns the iterator sorted if set sorted*/
61 OPimTodoAccess::List list()const; 63 OPimTodoAccess::List list()const;
62 OPimTodoAccess::List sorted( bool asc, int so, int f, int cat ); 64 OPimTodoAccess::List sorted( bool asc, int so, int f, int cat );
63 65
64 OPimTodoAccess::List::Iterator overDue(); 66 OPimTodoAccess::List::Iterator overDue();
65 OPimTodoAccess::List::Iterator fromTo( const QDate& start, 67 OPimTodoAccess::List::Iterator fromTo( const QDate& start,
66 const QDate& end ); 68 const QDate& end );
67 OPimTodoAccess::List::Iterator query( const OPimTodo& ev, int query ); 69 OPimTodoAccess::List::Iterator query( const OPimTodo& ev, int query );
68 70
69 void setCategory( bool sort, int category = -1); 71 void setCategory( bool sort, int category = -1);
70 void setShowOverDue( bool show ); 72 void setShowOverDue( bool show );
71 void setSortOrder( int sortOrder ); 73 void setSortOrder( int sortOrder );
72 void setSortASC( bool ); 74 void setSortASC( bool );
73 void sort(); 75 void sort();
74 76
75 OPimTodoAccess* todoDB(); 77 OPimTodoAccess* todoDB();
76 bool saveAll(); 78 bool saveAll();
77 79
78 80
79 signals: 81 signals:
80 void update(); 82 void update();
81 void updateCategories(); 83 void updateCategories();
82 84
83 public slots: 85 public slots:
84 void add( const OPimTodo& ); 86 void add( const OPimTodo& );
85 void update( int uid, const SmallTodo& ); 87 void update( int uid, const SmallTodo& );
86 void update( int uid, const OPimTodo& ); 88 void update( int uid, const OPimTodo& );
87 bool remove( int uid ); 89 bool remove( int uid );
88 void remove( const QArray<int>& ); 90 void remove( const QArray<int>& );
89 91
90 /** 92 /**
91 * remove all completed 93 * remove all completed
92 */ 94 */
93 void removeCompleted(); 95 void removeCompleted();
94 void removeAll(); 96 void removeAll();
95 void reload(); 97 void reload();
96 void save(); 98 void save();
97 99
98 private: 100 private:
99 OPimTodoAccess* m_db; 101 OPimTodoAccess* m_db;
100 OPimTodoAccess::List m_list; 102 OPimTodoAccess::List m_list;
101 OPimTodoAccess::List::Iterator m_it; 103 OPimTodoAccess::List::Iterator m_it;
102 OPimTodoAccess::List m_sorted; 104 OPimTodoAccess::List m_sorted;
103 Categories m_cat; 105 Categories m_cat;
104 int m_ca; 106 int m_ca;
105 /* sort cat */ 107 /* sort cat */
106 bool m_shCat; 108 bool m_shCat;
107 int m_sortOrder; 109 int m_sortOrder;
108 bool m_asc; 110 bool m_asc;
109 111
110 }; 112 };
111}; 113};
112 114
113#endif 115#endif
diff --git a/core/pim/todo/todoshow.cpp b/core/pim/todo/todoshow.cpp
index 5962028..268eb60 100644
--- a/core/pim/todo/todoshow.cpp
+++ b/core/pim/todo/todoshow.cpp
@@ -1,24 +1,53 @@
1/*
2                 This file is part of the Opie Project
3
4 Copyright (C) Opie Team <opie-devel@handhelds.org>
5 =.
6 .=l.
7           .>+-=
8 _;:,     .>    :=|. This program is free software; you can
9.> <`_,   >  .   <= redistribute it and/or modify it under
10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11.="- .-=="i,     .._ License as published by the Free Software
12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13     ._= =}       : or (at your option) any later version.
14    .%`+i>       _;_.
15    .i_,=:_.      -<s. This program is distributed in the hope that
16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17 : ..    .:,     . . . without even the implied warranty of
18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20..}^=.=       =       ; Library General Public License for more
21++=   -.     .`     .: details.
22:     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA.
29*/
1 30
2#include "mainwindow.h" 31#include "mainwindow.h"
3#include "todoshow.h" 32#include "todoshow.h"
4 33
5using namespace Todo; 34using namespace Todo;
6 35
7TodoShow::TodoShow(MainWindow* win) { 36TodoShow::TodoShow(MainWindow* win) {
8 m_win = win; 37 m_win = win;
9} 38}
10TodoShow::~TodoShow() { 39TodoShow::~TodoShow() {
11} 40}
12void TodoShow::escapeView() { 41void TodoShow::escapeView() {
13 if (m_win ) 42 if (m_win )
14 m_win->slotReturnFromView(); 43 m_win->slotReturnFromView();
15} 44}
16 45
17void TodoShow::showNext() { 46void TodoShow::showNext() {
18 if (m_win) 47 if (m_win)
19 m_win->slotShowNext(); 48 m_win->slotShowNext();
20} 49}
21void TodoShow::showPrev() { 50void TodoShow::showPrev() {
22 if (m_win) 51 if (m_win)
23 m_win->slotShowPrev(); 52 m_win->slotShowPrev();
24} 53}
diff --git a/core/pim/todo/todoshow.h b/core/pim/todo/todoshow.h
index 1eeadf8..b3e0a1f 100644
--- a/core/pim/todo/todoshow.h
+++ b/core/pim/todo/todoshow.h
@@ -1,62 +1,65 @@
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
4           .>+-= 4 Copyright (C) Opie Team <opie-devel@handhelds.org>
5 _;:,     .>    :=|. This program is free software; you can 5 =.
6.> <`_,   >  .   <= redistribute it and/or modify it under 6 .=l.
7:`=1 )Y*s>-.--   : the terms of the GNU General Public 7           .>+-=
8.="- .-=="i,     .._ License as published by the Free Software 8 _;:,     .>    :=|. This program is free software; you can
9 - .   .-<_>     .<> Foundation; either version 2 of the License, 9.> <`_,   >  .   <= redistribute it and/or modify it under
10     ._= =}       : or (at your option) any later version. 10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11    .%`+i>       _;_. 11.="- .-=="i,     .._ License as published by the Free Software
12    .i_,=:_.      -<s. This program is distributed in the hope that 12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 13     ._= =}       : or (at your option) any later version.
14    : ..    .:,     . . . without even the implied warranty of 14    .%`+i>       _;_.
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 15    .i_,=:_.      -<s. This program is distributed in the hope that
16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17..}^=.=       =       ; Library General Public License for more 17 : ..    .:,     . . . without even the implied warranty of
18++=   -.     .`     .: details. 18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19 :     =  ...= . :.=- 19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20 -.   .:....=;==+<; You should have received a copy of the GNU 20..}^=.=       =       ; Library General Public License for more
21  -_. . .   )=.  = Library General Public License along with 21++=   -.     .`     .: details.
22    --        :-=` this library; see the file COPYING.LIB. 22:     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation, 26 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330, 27 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
26
27*/ 29*/
30
28#ifndef TODO_TODO_SHOW_H 31#ifndef TODO_TODO_SHOW_H
29#define TODO_TODO_SHOW_H 32#define TODO_TODO_SHOW_H
30 33
31#include <qstring.h> 34#include <qstring.h>
32#include <qwidget.h> 35#include <qwidget.h>
33 36
34#include <opie2/opimtodo.h> 37#include <opie2/opimtodo.h>
35 38
36using Opie::OPimTodo; 39using Opie::OPimTodo;
37 40
38namespace Todo { 41namespace Todo {
39 class MainWindow; 42 class MainWindow;
40 /** 43 /**
41 * TodoShow is the baseclass of 44 * TodoShow is the baseclass of
42 * of all TodoShows. 45 * of all TodoShows.
43 * The first implementation is a QTextView 46 * The first implementation is a QTextView
44 * implementation showing the Todo as richtext 47 * implementation showing the Todo as richtext
45 */ 48 */
46 class TodoShow { 49 class TodoShow {
47 public: 50 public:
48 TodoShow( MainWindow* win); 51 TodoShow( MainWindow* win);
49 virtual ~TodoShow(); 52 virtual ~TodoShow();
50 virtual QString type()const = 0; 53 virtual QString type()const = 0;
51 virtual void slotShow( const OPimTodo& ev ) = 0; 54 virtual void slotShow( const OPimTodo& ev ) = 0;
52 virtual QWidget* widget() = 0; 55 virtual QWidget* widget() = 0;
53 protected: 56 protected:
54 void escapeView(); 57 void escapeView();
55 void showNext(); 58 void showNext();
56 void showPrev(); 59 void showPrev();
57 private: 60 private:
58 MainWindow *m_win; 61 MainWindow *m_win;
59 }; 62 };
60}; 63};
61 64
62#endif 65#endif
diff --git a/core/pim/todo/todotemplate.h b/core/pim/todo/todotemplate.h
index 9575737..69ec6dd 100644
--- a/core/pim/todo/todotemplate.h
+++ b/core/pim/todo/todotemplate.h
@@ -1,11 +1,40 @@
1/*
2                 This file is part of the Opie Project
3
4 Copyright (C) Opie Team <opie-devel@handhelds.org>
5 =.
6 .=l.
7           .>+-=
8 _;:,     .>    :=|. This program is free software; you can
9.> <`_,   >  .   <= redistribute it and/or modify it under
10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11.="- .-=="i,     .._ License as published by the Free Software
12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13     ._= =}       : or (at your option) any later version.
14    .%`+i>       _;_.
15    .i_,=:_.      -<s. This program is distributed in the hope that
16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17 : ..    .:,     . . . without even the implied warranty of
18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20..}^=.=       =       ; Library General Public License for more
21++=   -.     .`     .: details.
22:     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA.
29*/
30
1#ifndef OPIE_TODO_TEMPLATE_H 31#ifndef OPIE_TODO_TEMPLATE_H
2#define OPIE_TODO_TEMPLATE_H 32#define OPIE_TODO_TEMPLATE_H
3 33
4 34
5 35
6namespace Todo { 36namespace Todo {
7 37
8
9}; 38};
10 39
11#endif 40#endif
diff --git a/core/pim/todo/todotemplatemanager.cpp b/core/pim/todo/todotemplatemanager.cpp
index 7690d37..892ad0d 100644
--- a/core/pim/todo/todotemplatemanager.cpp
+++ b/core/pim/todo/todotemplatemanager.cpp
@@ -1,79 +1,109 @@
1/*
2                 This file is part of the Opie Project
3
4 Copyright (C) Opie Team <opie-devel@handhelds.org>
5 =.
6 .=l.
7           .>+-=
8 _;:,     .>    :=|. This program is free software; you can
9.> <`_,   >  .   <= redistribute it and/or modify it under
10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11.="- .-=="i,     .._ License as published by the Free Software
12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13     ._= =}       : or (at your option) any later version.
14    .%`+i>       _;_.
15    .i_,=:_.      -<s. This program is distributed in the hope that
16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17 : ..    .:,     . . . without even the implied warranty of
18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20..}^=.=       =       ; Library General Public License for more
21++=   -.     .`     .: details.
22:     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA.
29*/
30
1#include <opie2/odebug.h> 31#include <opie2/odebug.h>
2#include <opie2/otodoaccess.h> 32#include <opie2/otodoaccess.h>
3#include <opie2/otodoaccessxml.h> 33#include <opie2/otodoaccessxml.h>
4 34
5#include <qpe/config.h> 35#include <qpe/config.h>
6#include <qpe/global.h> 36#include <qpe/global.h>
7 37
8#include "todotemplatemanager.h" 38#include "todotemplatemanager.h"
9 39
10 40
11using namespace Todo; 41using namespace Todo;
12 42
13TemplateManager::TemplateManager() { 43TemplateManager::TemplateManager() {
14 m_path = Global::applicationFileName("todolist", "templates.xml"); 44 m_path = Global::applicationFileName("todolist", "templates.xml");
15} 45}
16TemplateManager::~TemplateManager() { 46TemplateManager::~TemplateManager() {
17 save(); 47 save();
18} 48}
19void TemplateManager::load() { 49void TemplateManager::load() {
20 Config conf("todolist_templates"); 50 Config conf("todolist_templates");
21 OPimTodoAccessXML *xml = new OPimTodoAccessXML( QString::fromLatin1("template"), 51 OPimTodoAccessXML *xml = new OPimTodoAccessXML( QString::fromLatin1("template"),
22 m_path ); 52 m_path );
23 OPimTodoAccess todoDB(xml ); 53 OPimTodoAccess todoDB(xml );
24 todoDB.load(); 54 todoDB.load();
25 55
26 OPimTodoAccess::List::Iterator it; 56 OPimTodoAccess::List::Iterator it;
27 OPimTodoAccess::List list = todoDB.allRecords(); 57 OPimTodoAccess::List list = todoDB.allRecords();
28 for ( it = list.begin(); it != list.end(); ++it ) { 58 for ( it = list.begin(); it != list.end(); ++it ) {
29 OPimTodo ev = (*it); 59 OPimTodo ev = (*it);
30 conf.setGroup( QString::number( ev.uid() ) ); 60 conf.setGroup( QString::number( ev.uid() ) );
31 QString str = conf.readEntry("Name", QString::null ); 61 QString str = conf.readEntry("Name", QString::null );
32 if (str.isEmpty() ) 62 if (str.isEmpty() )
33 continue; 63 continue;
34 64
35 m_templates.insert( str, ev ); 65 m_templates.insert( str, ev );
36 } 66 }
37} 67}
38void TemplateManager::save() { 68void TemplateManager::save() {
39 Config conf("todolist_templates"); 69 Config conf("todolist_templates");
40 70
41 OPimTodoAccessXML *res = new OPimTodoAccessXML( "template", 71 OPimTodoAccessXML *res = new OPimTodoAccessXML( "template",
42 m_path ); 72 m_path );
43 OPimTodoAccess db(res); 73 OPimTodoAccess db(res);
44 db.load(); 74 db.load();
45 db.clear(); 75 db.clear();
46 76
47 77
48 QMap<QString, OPimTodo>::Iterator it; 78 QMap<QString, OPimTodo>::Iterator it;
49 for ( it = m_templates.begin(); it != m_templates.end(); ++it ) { 79 for ( it = m_templates.begin(); it != m_templates.end(); ++it ) {
50 OPimTodo ev = it.data(); 80 OPimTodo ev = it.data();
51 conf.setGroup( QString::number( ev.uid() ) ); 81 conf.setGroup( QString::number( ev.uid() ) );
52 conf.writeEntry("Name", it.key() ); 82 conf.writeEntry("Name", it.key() );
53 db.add( ev ); 83 db.add( ev );
54 } 84 }
55 db.save(); 85 db.save();
56} 86}
57void TemplateManager::addEvent( const QString& str, 87void TemplateManager::addEvent( const QString& str,
58 const OPimTodo& ev) { 88 const OPimTodo& ev) {
59 OPimTodo todo = ev; 89 OPimTodo todo = ev;
60 if( ev.uid() == 0 ) 90 if( ev.uid() == 0 )
61 todo.setUid(1); // generate a new uid 91 todo.setUid(1); // generate a new uid
62 92
63 m_templates.replace( str, todo ); 93 m_templates.replace( str, todo );
64} 94}
65void TemplateManager::removeEvent( const QString& str ) { 95void TemplateManager::removeEvent( const QString& str ) {
66 m_templates.remove( str ); 96 m_templates.remove( str );
67} 97}
68QStringList TemplateManager::templates() const { 98QStringList TemplateManager::templates() const {
69 QStringList list; 99 QStringList list;
70 QMap<QString, OPimTodo>::ConstIterator it; 100 QMap<QString, OPimTodo>::ConstIterator it;
71 for (it = m_templates.begin(); it != m_templates.end(); ++it ) { 101 for (it = m_templates.begin(); it != m_templates.end(); ++it ) {
72 list << it.key(); 102 list << it.key();
73 } 103 }
74 104
75 return list; 105 return list;
76} 106}
77OPimTodo TemplateManager::templateEvent( const QString& templateName ) { 107OPimTodo TemplateManager::templateEvent( const QString& templateName ) {
78 return m_templates[templateName]; 108 return m_templates[templateName];
79} 109}
diff --git a/core/pim/todo/todotemplatemanager.h b/core/pim/todo/todotemplatemanager.h
index ee8aaaf..8601ee8 100644
--- a/core/pim/todo/todotemplatemanager.h
+++ b/core/pim/todo/todotemplatemanager.h
@@ -1,33 +1,63 @@
1/*
2                 This file is part of the Opie Project
3
4 Copyright (C) Opie Team <opie-devel@handhelds.org>
5 =.
6 .=l.
7           .>+-=
8 _;:,     .>    :=|. This program is free software; you can
9.> <`_,   >  .   <= redistribute it and/or modify it under
10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11.="- .-=="i,     .._ License as published by the Free Software
12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13     ._= =}       : or (at your option) any later version.
14    .%`+i>       _;_.
15    .i_,=:_.      -<s. This program is distributed in the hope that
16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17 : ..    .:,     . . . without even the implied warranty of
18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20..}^=.=       =       ; Library General Public License for more
21++=   -.     .`     .: details.
22:     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA.
29*/
30
1#ifndef OPIE_TODO_TEMPLATE_H 31#ifndef OPIE_TODO_TEMPLATE_H
2#define OPIE_TODO_TEMPLATE_H 32#define OPIE_TODO_TEMPLATE_H
3 33
4#include <opie2/opimtodo.h> 34#include <opie2/opimtodo.h>
5 35
6#include <qstring.h> 36#include <qstring.h>
7#include <qmap.h> 37#include <qmap.h>
8 38
9using namespace Opie; 39using namespace Opie;
10 40
11namespace Todo { 41namespace Todo {
12 class TemplateManager { 42 class TemplateManager {
13 public: 43 public:
14 TemplateManager(); 44 TemplateManager();
15 ~TemplateManager(); 45 ~TemplateManager();
16 void load(); 46 void load();
17 void save(); 47 void save();
18 QStringList templates()const; 48 QStringList templates()const;
19 OPimTodo templateEvent( const QString& templateName ); 49 OPimTodo templateEvent( const QString& templateName );
20 50
21 /* also replaces one */ 51 /* also replaces one */
22 void addEvent( const QString&, const OPimTodo& ); 52 void addEvent( const QString&, const OPimTodo& );
23 void removeEvent( const QString& ); 53 void removeEvent( const QString& );
24 private: 54 private:
25 QString m_path; 55 QString m_path;
26 QMap<QString, OPimTodo> m_templates; 56 QMap<QString, OPimTodo> m_templates;
27 57
28 58
29 59
30 }; 60 };
31}; 61};
32 62
33#endif 63#endif
diff --git a/core/pim/todo/todoview.cpp b/core/pim/todo/todoview.cpp
index 3d2c982..937fbd1 100644
--- a/core/pim/todo/todoview.cpp
+++ b/core/pim/todo/todoview.cpp
@@ -1,71 +1,101 @@
1/*
2                 This file is part of the Opie Project
3
4 Copyright (C) Opie Team <opie-devel@handhelds.org>
5 =.
6 .=l.
7           .>+-=
8 _;:,     .>    :=|. This program is free software; you can
9.> <`_,   >  .   <= redistribute it and/or modify it under
10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11.="- .-=="i,     .._ License as published by the Free Software
12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13     ._= =}       : or (at your option) any later version.
14    .%`+i>       _;_.
15    .i_,=:_.      -<s. This program is distributed in the hope that
16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17 : ..    .:,     . . . without even the implied warranty of
18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20..}^=.=       =       ; Library General Public License for more
21++=   -.     .`     .: details.
22:     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA.
29*/
30
1#include "mainwindow.h" 31#include "mainwindow.h"
2 32
3#include <opie2/odebug.h> 33#include <opie2/odebug.h>
4 34
5#include "todoview.h" 35#include "todoview.h"
6 36
7using namespace Todo; 37using namespace Todo;
8 38
9 39
10 40
11 41
12TodoView::TodoView( MainWindow* win ) 42TodoView::TodoView( MainWindow* win )
13 : m_main( win ) 43 : m_main( win )
14{ 44{
15 m_asc = false; 45 m_asc = false;
16 m_sortOrder = -1; 46 m_sortOrder = -1;
17} 47}
18TodoView::~TodoView() { 48TodoView::~TodoView() {
19}; 49};
20MainWindow* TodoView::todoWindow() { 50MainWindow* TodoView::todoWindow() {
21 return m_main; 51 return m_main;
22} 52}
23 53
24OPimTodo TodoView::event(int uid ) { 54OPimTodo TodoView::event(int uid ) {
25 return m_main->event( uid ); 55 return m_main->event( uid );
26} 56}
27OPimTodoAccess::List TodoView::list(){ 57OPimTodoAccess::List TodoView::list(){
28 todoWindow()->updateList(); 58 todoWindow()->updateList();
29 return todoWindow()->list(); 59 return todoWindow()->list();
30} 60}
31OPimTodoAccess::List TodoView::sorted()const{ 61OPimTodoAccess::List TodoView::sorted()const{
32 return m_sort; 62 return m_sort;
33} 63}
34void TodoView::sort() { 64void TodoView::sort() {
35 m_sort = todoWindow()->sorted(m_asc,m_sortOrder ); 65 m_sort = todoWindow()->sorted(m_asc,m_sortOrder );
36 owarn << "m_sort.count() = " << m_sort.count() << oendl; 66 owarn << "m_sort.count() = " << m_sort.count() << oendl;
37} 67}
38void TodoView::sort(int sort) { 68void TodoView::sort(int sort) {
39 m_sort = todoWindow()->sorted(m_asc, m_sortOrder, sort ); 69 m_sort = todoWindow()->sorted(m_asc, m_sortOrder, sort );
40} 70}
41void TodoView::setSortOrder( int order ) { 71void TodoView::setSortOrder( int order ) {
42 m_sortOrder = order; 72 m_sortOrder = order;
43} 73}
44void TodoView::setAscending( bool b ) { 74void TodoView::setAscending( bool b ) {
45 owarn << "setAscending " << b << oendl; 75 owarn << "setAscending " << b << oendl;
46 m_asc = b; 76 m_asc = b;
47} 77}
48void TodoView::update(int, const SmallTodo& ) { 78void TodoView::update(int, const SmallTodo& ) {
49 //m_main->slotUpate1( uid, to ); 79 //m_main->slotUpate1( uid, to );
50} 80}
51void TodoView::update(int , const OPimTodo& ev ) { 81void TodoView::update(int , const OPimTodo& ev ) {
52 m_main->updateTodo( ev ); 82 m_main->updateTodo( ev );
53} 83}
54void TodoView::showTodo( int uid ) { 84void TodoView::showTodo( int uid ) {
55 m_main->slotShow( uid ); 85 m_main->slotShow( uid );
56} 86}
57void TodoView::edit( int uid ) { 87void TodoView::edit( int uid ) {
58 m_main->slotEdit( uid ); 88 m_main->slotEdit( uid );
59} 89}
60void TodoView::remove( int uid ) { 90void TodoView::remove( int uid ) {
61 m_main->m_todoMgr.remove( uid ); 91 m_main->m_todoMgr.remove( uid );
62} 92}
63void TodoView::complete( int uid ) { 93void TodoView::complete( int uid ) {
64 m_main->slotComplete( uid ); 94 m_main->slotComplete( uid );
65} 95}
66void TodoView::complete( const OPimTodo& ev ) { 96void TodoView::complete( const OPimTodo& ev ) {
67 m_main->slotComplete( ev ); 97 m_main->slotComplete( ev );
68} 98}
69void TodoView::removeQuery( int uid ) { 99void TodoView::removeQuery( int uid ) {
70 m_main->slotDelete( uid ); 100 m_main->slotDelete( uid );
71} 101}
diff --git a/core/pim/todo/todoview.h b/core/pim/todo/todoview.h
index a5ea9f5..6e840e1 100644
--- a/core/pim/todo/todoview.h
+++ b/core/pim/todo/todoview.h
@@ -1,122 +1,124 @@
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
4           .>+-= 4 Copyright (C) Opie Team <opie-devel@handhelds.org>
5 _;:,     .>    :=|. This program is free software; you can 5 =.
6.> <`_,   >  .   <= redistribute it and/or modify it under 6 .=l.
7:`=1 )Y*s>-.--   : the terms of the GNU General Public 7           .>+-=
8.="- .-=="i,     .._ License as published by the Free Software 8 _;:,     .>    :=|. This program is free software; you can
9 - .   .-<_>     .<> Foundation; either version 2 of the License, 9.> <`_,   >  .   <= redistribute it and/or modify it under
10     ._= =}       : or (at your option) any later version. 10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11    .%`+i>       _;_. 11.="- .-=="i,     .._ License as published by the Free Software
12    .i_,=:_.      -<s. This program is distributed in the hope that 12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 13     ._= =}       : or (at your option) any later version.
14    : ..    .:,     . . . without even the implied warranty of 14    .%`+i>       _;_.
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 15    .i_,=:_.      -<s. This program is distributed in the hope that
16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17..}^=.=       =       ; Library General Public License for more 17 : ..    .:,     . . . without even the implied warranty of
18++=   -.     .`     .: details. 18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19 :     =  ...= . :.=- 19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20 -.   .:....=;==+<; You should have received a copy of the GNU 20..}^=.=       =       ; Library General Public License for more
21  -_. . .   )=.  = Library General Public License along with 21++=   -.     .`     .: details.
22    --        :-=` this library; see the file COPYING.LIB. 22:     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation, 26 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330, 27 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
26
27*/ 29*/
28 30
29#ifndef TODO_VIEW_H 31#ifndef TODO_VIEW_H
30#define TODO_VIEW_H 32#define TODO_VIEW_H
31 33
32#include <qarray.h> 34#include <qarray.h>
33#include <qstring.h> 35#include <qstring.h>
34#include <qvaluelist.h> 36#include <qvaluelist.h>
35#include <qwidget.h> 37#include <qwidget.h>
36 38
37#include <opie2/otodoaccess.h> 39#include <opie2/otodoaccess.h>
38 40
39#include "smalltodo.h" 41#include "smalltodo.h"
40 42
41using Opie::OPimTodo; 43using Opie::OPimTodo;
42using Opie::OPimTodoAccess; 44using Opie::OPimTodoAccess;
43 45
44namespace Todo { 46namespace Todo {
45 class MainWindow; 47 class MainWindow;
46 48
47 /** 49 /**
48 * due to inheretince problems we need this base class 50 * due to inheretince problems we need this base class
49 */ 51 */
50 struct ViewBase { 52 struct ViewBase {
51 public: 53 public:
52 virtual QWidget* widget() = 0; 54 virtual QWidget* widget() = 0;
53 virtual QString type()const = 0; 55 virtual QString type()const = 0;
54 virtual int current() = 0; 56 virtual int current() = 0;
55 virtual QString currentRepresentation() = 0; 57 virtual QString currentRepresentation() = 0;
56 virtual void showOverDue( bool ) = 0; 58 virtual void showOverDue( bool ) = 0;
57 59
58 /** 60 /**
59 * the next record in the view or 0 if none is there 61 * the next record in the view or 0 if none is there
60 */ 62 */
61 virtual int next() = 0; 63 virtual int next() = 0;
62 64
63 /** 65 /**
64 * the previous record or 0 if none is there.. 66 * the previous record or 0 if none is there..
65 */ 67 */
66 virtual int prev() = 0; 68 virtual int prev() = 0;
67 69
68 /* 70 /*
69 * update the view 71 * update the view
70 */ 72 */
71 virtual void updateView() = 0; 73 virtual void updateView() = 0;
72 74
73 virtual void addEvent( const OPimTodo& ) = 0; 75 virtual void addEvent( const OPimTodo& ) = 0;
74 virtual void replaceEvent( const OPimTodo& ) = 0; 76 virtual void replaceEvent( const OPimTodo& ) = 0;
75 virtual void removeEvent( int uid ) = 0; 77 virtual void removeEvent( int uid ) = 0;
76 virtual void setShowCompleted( bool ) = 0; 78 virtual void setShowCompleted( bool ) = 0;
77 virtual void setShowDeadline( bool ) = 0; 79 virtual void setShowDeadline( bool ) = 0;
78 virtual void setShowCategory( const QString& = QString::null ) = 0; 80 virtual void setShowCategory( const QString& = QString::null ) = 0;
79 virtual void clear() = 0; 81 virtual void clear() = 0;
80 virtual void newDay() = 0; 82 virtual void newDay() = 0;
81 }; 83 };
82 84
83 /** 85 /**
84 * A base class for all TodoView which are showing 86 * A base class for all TodoView which are showing
85 * a list of todos. 87 * a list of todos.
86 * Either in a QTable, QListView or any other QWidget 88 * Either in a QTable, QListView or any other QWidget
87 * derived class 89 * derived class
88 * Through the MainWindow( dispatcher ) one can access 90 * Through the MainWindow( dispatcher ) one can access
89 * the relevant informations 91 * the relevant informations
90 * 92 *
91 * It's not possible to have signal and slots from within 93 * It's not possible to have signal and slots from within
92 * templates this way you've to register for a signal 94 * templates this way you've to register for a signal
93 */ 95 */
94 class TodoView : public ViewBase{ 96 class TodoView : public ViewBase{
95 97
96 public: 98 public:
97 /** 99 /**
98 * c'tor 100 * c'tor
99 */ 101 */
100 TodoView( MainWindow* win ); 102 TodoView( MainWindow* win );
101 103
102 /** 104 /**
103 *d'tor 105 *d'tor
104 */ 106 */
105 virtual ~TodoView(); 107 virtual ~TodoView();
106 108
107 protected: 109 protected:
108 MainWindow* todoWindow(); 110 MainWindow* todoWindow();
109 OPimTodo event(int uid ); 111 OPimTodo event(int uid );
110 OPimTodoAccess::List list(); 112 OPimTodoAccess::List list();
111 OPimTodoAccess::List sorted()const; 113 OPimTodoAccess::List sorted()const;
112 void sort(); 114 void sort();
113 void sort(int sort ); 115 void sort(int sort );
114 void setSortOrder( int order ); 116 void setSortOrder( int order );
115 void setAscending( bool ); 117 void setAscending( bool );
116 118
117 /* 119 /*
118 * These things needs to be implemented 120 * These things needs to be implemented
119 * in a implementation 121 * in a implementation
120 */ 122 */
121 void showTodo( int uid ); 123 void showTodo( int uid );
122 void edit( int uid ); 124 void edit( int uid );