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,860 +1,861 @@
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() {
137 Config config( "todo" ); 138 Config config( "todo" );
138 config.setGroup( "View" ); 139 config.setGroup( "View" );
139 m_completed = config.readBoolEntry( "ShowComplete", true ); 140 m_completed = config.readBoolEntry( "ShowComplete", true );
140 m_curCat = config.readEntry( "Category", QString::null ); 141 m_curCat = config.readEntry( "Category", QString::null );
141 m_deadline = config.readBoolEntry( "ShowDeadLine", true); 142 m_deadline = config.readBoolEntry( "ShowDeadLine", true);
142 m_overdue = config.readBoolEntry("ShowOverDue", false ); 143 m_overdue = config.readBoolEntry("ShowOverDue", false );
143 m_quicktask = config.readBoolEntry("ShowQuickTask", true); 144 m_quicktask = config.readBoolEntry("ShowQuickTask", true);
144} 145}
145void MainWindow::initUI() { 146void MainWindow::initUI() {
146 // Create main widget stack 147 // Create main widget stack
147 m_stack = new Opie::Ui::OWidgetStack(this, "main stack"); 148 m_stack = new Opie::Ui::OWidgetStack(this, "main stack");
148 setCentralWidget( m_stack ); 149 setCentralWidget( m_stack );
149 connect( this, SIGNAL(categorySelected(const QString&)), 150 connect( this, SIGNAL(categorySelected(const QString&)),
150 this, SLOT(setCategory(const QString&)) ); 151 this, SLOT(setCategory(const QString&)) );
151 152
152 // Create quick task toolbar 153 // Create quick task toolbar
153 m_curQuick = new QuickEditImpl( this, m_quicktask ); 154 m_curQuick = new QuickEditImpl( this, m_quicktask );
154 addToolBar( (QToolBar *)m_curQuick->widget(), QWidget::tr( "QuickEdit" ), 155 addToolBar( (QToolBar *)m_curQuick->widget(), QWidget::tr( "QuickEdit" ),
155 QMainWindow::Top, true ); 156 QMainWindow::Top, true );
156 m_curQuick->signal()->connect( this, SLOT(slotQuickEntered()) ); 157 m_curQuick->signal()->connect( this, SLOT(slotQuickEntered()) );
157} 158}
158void MainWindow::initViews() { 159void MainWindow::initViews() {
159 160
160 TableView* tableView = new TableView( this, m_stack ); 161 TableView* tableView = new TableView( this, m_stack );
161 QWhatsThis::add( tableView, QWidget::tr( "This is a listing of all current tasks.\n\nThe list displays the following information:\n1. Completed - A green checkmark indicates task is completed. Click here to complete a task.\n2. Priority - a graphical representation of task priority. Double-click here to modify.\n3. Description - description of task. Click here to select the task.\n4. Deadline - shows when task is due. This column can be shown or hidden by selecting Options->'Show task deadlines' from the menu above." ) ); 162 QWhatsThis::add( tableView, QWidget::tr( "This is a listing of all current tasks.\n\nThe list displays the following information:\n1. Completed - A green checkmark indicates task is completed. Click here to complete a task.\n2. Priority - a graphical representation of task priority. Double-click here to modify.\n3. Description - description of task. Click here to select the task.\n4. Deadline - shows when task is due. This column can be shown or hidden by selecting Options->'Show task deadlines' from the menu above." ) );
162 m_stack->addWidget( tableView, m_counter++ ); 163 m_stack->addWidget( tableView, m_counter++ );
163 m_views.append( tableView ); 164 m_views.append( tableView );
164 m_curView = tableView; 165 m_curView = tableView;
165 connectBase( tableView ); 166 connectBase( tableView );
166 /* add QString type + QString configname to 167 /* add QString type + QString configname to
167 * the View menu 168 * the View menu
168 * and subdirs for multiple views 169 * and subdirs for multiple views
169 */ 170 */
170} 171}
171void MainWindow::initEditor() { 172void MainWindow::initEditor() {
172 m_curEdit = new Editor(); 173 m_curEdit = new Editor();
173} 174}
174void MainWindow::initShow() { 175void MainWindow::initShow() {
175 m_curShow = new TextViewShow(this, this); 176 m_curShow = new TextViewShow(this, this);
176 m_stack->addWidget( m_curShow->widget() , m_counter++ ); 177 m_stack->addWidget( m_curShow->widget() , m_counter++ );
177} 178}
178MainWindow::~MainWindow() { 179MainWindow::~MainWindow() {
179 delete templateManager(); 180 delete templateManager();
180} 181}
181void MainWindow::connectBase( ViewBase* ) { 182void MainWindow::connectBase( ViewBase* ) {
182 // once templates and signals mix we'll use it again 183 // once templates and signals mix we'll use it again
183} 184}
184QPopupMenu* MainWindow::contextMenu( int , bool /*recur*/ ) { 185QPopupMenu* MainWindow::contextMenu( int , bool /*recur*/ ) {
185 return itemContextMenu(); 186 return itemContextMenu();
186} 187}
187OPimTodoAccess::List MainWindow::list()const { 188OPimTodoAccess::List MainWindow::list()const {
188 return m_todoMgr.list(); 189 return m_todoMgr.list();
189} 190}
190OPimTodoAccess::List MainWindow::sorted( bool asc, int sortOrder ) { 191OPimTodoAccess::List MainWindow::sorted( bool asc, int sortOrder ) {
191 int cat = 0; 192 int cat = 0;
192 if ( m_curCat != tr( "All" ) ) 193 if ( m_curCat != tr( "All" ) )
193 cat = currentCatId(); 194 cat = currentCatId();
194 if ( m_curCat == tr( "Unfiled" ) ) 195 if ( m_curCat == tr( "Unfiled" ) )
195 cat = -1; 196 cat = -1;
196 197
197 int filter = OPimTodoAccess::FilterCategory; 198 int filter = OPimTodoAccess::FilterCategory;
198 199
199 if (!m_completed ) 200 if (!m_completed )
200 filter |= OPimTodoAccess::DoNotShowCompleted; 201 filter |= OPimTodoAccess::DoNotShowCompleted;
201 if (m_overdue) 202 if (m_overdue)
202 filter |= OPimTodoAccess::OnlyOverDue; 203 filter |= OPimTodoAccess::OnlyOverDue;
203 204
204 return m_todoMgr.sorted( asc, sortOrder, filter, cat ); 205 return m_todoMgr.sorted( asc, sortOrder, filter, cat );
205} 206}
206OPimTodoAccess::List MainWindow::sorted( bool asc, int sortOrder, int addFilter) { 207OPimTodoAccess::List MainWindow::sorted( bool asc, int sortOrder, int addFilter) {
207 int cat = 0; 208 int cat = 0;
208 if ( m_curCat != tr( "All" ) ) 209 if ( m_curCat != tr( "All" ) )
209 cat = currentCatId(); 210 cat = currentCatId();
210 211
211 if ( m_curCat == tr( "Unfiled" ) ) 212 if ( m_curCat == tr( "Unfiled" ) )
212 cat = -1; 213 cat = -1;
213 214
214 return m_todoMgr.sorted(asc, sortOrder, addFilter, cat ); 215 return m_todoMgr.sorted(asc, sortOrder, addFilter, cat );
215} 216}
216OPimTodo MainWindow::event( int uid ) { 217OPimTodo MainWindow::event( int uid ) {
217 return m_todoMgr.event( uid ); 218 return m_todoMgr.event( uid );
218} 219}
219bool MainWindow::isSyncing()const { 220bool MainWindow::isSyncing()const {
220 return m_syncing; 221 return m_syncing;
221} 222}
222TemplateManager* MainWindow::templateManager() { 223TemplateManager* MainWindow::templateManager() {
223 return m_tempManager; 224 return m_tempManager;
224} 225}
225Editor* MainWindow::currentEditor() { 226Editor* MainWindow::currentEditor() {
226 return m_curEdit; 227 return m_curEdit;
227} 228}
228TodoShow* MainWindow::currentShow() { 229TodoShow* MainWindow::currentShow() {
229 return m_curShow; 230 return m_curShow;
230} 231}
231void MainWindow::slotReload() { 232void MainWindow::slotReload() {
232 m_syncing = false; 233 m_syncing = false;
233 m_todoMgr.reload(); 234 m_todoMgr.reload();
234 currentView()->updateView( ); 235 currentView()->updateView( );
235 raiseCurrentView(); 236 raiseCurrentView();
236} 237}
237void MainWindow::closeEvent( QCloseEvent* e ) { 238void MainWindow::closeEvent( QCloseEvent* e ) {
238 if (m_stack->visibleWidget() == currentShow()->widget() ) { 239 if (m_stack->visibleWidget() == currentShow()->widget() ) {
239 m_showing = false; 240 m_showing = false;
240 raiseCurrentView(); 241 raiseCurrentView();
241 e->ignore(); 242 e->ignore();
242 return; 243 return;
243 } 244 }
244 /* 245 /*
245 * we should have flushed and now we're still saving 246 * we should have flushed and now we're still saving
246 * so there is no need to flush 247 * so there is no need to flush
247 */ 248 */
248 if (m_syncing ) { 249 if (m_syncing ) {
249 e->accept(); 250 e->accept();
250 return; 251 return;
251 } 252 }
252 bool quit = false; 253 bool quit = false;
253 if ( m_todoMgr.saveAll() ){ 254 if ( m_todoMgr.saveAll() ){
254 quit = true; 255 quit = true;
255 }else { 256 }else {
256 if ( QMessageBox::critical( this, QWidget::tr("Out of space"), 257 if ( QMessageBox::critical( this, QWidget::tr("Out of space"),
257 QWidget::tr("Todo was unable\n" 258 QWidget::tr("Todo was unable\n"
258 "to save your changes.\n" 259 "to save your changes.\n"
259 "Free up some space\n" 260 "Free up some space\n"
260 "and try again.\n" 261 "and try again.\n"
261 "\nQuit Anyway?"), 262 "\nQuit Anyway?"),
262 QMessageBox::Yes|QMessageBox::Escape, 263 QMessageBox::Yes|QMessageBox::Escape,
263 QMessageBox::No|QMessageBox::Default) 264 QMessageBox::No|QMessageBox::Default)
264 != QMessageBox::No ) { 265 != QMessageBox::No ) {
265 e->accept(); 266 e->accept();
266 quit = true; 267 quit = true;
267 }else 268 }else
268 e->ignore(); 269 e->ignore();
269 270
270 } 271 }
271 272
272 if (quit ) { 273 if (quit ) {
273 Config config( "todo" ); 274 Config config( "todo" );
274 config.setGroup( "View" ); 275 config.setGroup( "View" );
275 config.writeEntry( "ShowComplete", showCompleted() ); 276 config.writeEntry( "ShowComplete", showCompleted() );
276 config.writeEntry( "Category", currentCategory() ); 277 config.writeEntry( "Category", currentCategory() );
277 config.writeEntry( "ShowDeadLine", showDeadline()); 278 config.writeEntry( "ShowDeadLine", showDeadline());
278 config.writeEntry( "ShowOverDue", showOverDue() ); 279 config.writeEntry( "ShowOverDue", showOverDue() );
279 config.writeEntry( "ShowQuickTask", showQuickTask() ); 280 config.writeEntry( "ShowQuickTask", showQuickTask() );
280 /* save templates */ 281 /* save templates */
281 templateManager()->save(); 282 templateManager()->save();
282 e->accept(); 283 e->accept();
283 QTimer::singleShot(0, qApp, SLOT(closeAllWindows()) ); 284 QTimer::singleShot(0, qApp, SLOT(closeAllWindows()) );
284 } 285 }
285} 286}
286void MainWindow::slotItemNew() { 287void MainWindow::slotItemNew() {
287 NewTaskDlg dlg( templateManager()->templates(), this ); 288 NewTaskDlg dlg( templateManager()->templates(), this );
288 if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) { 289 if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) {
289 QString tempName = dlg.tempSelected(); 290 QString tempName = dlg.tempSelected();
290 if ( tempName.isNull() ) 291 if ( tempName.isNull() )
291 // Create new, blank task 292 // Create new, blank task
292 create(); 293 create();
293 else { 294 else {
294 // Create new task from the template selected 295 // Create new task from the template selected
295 OPimTodo event = templateManager()->templateEvent( tempName ); 296 OPimTodo event = templateManager()->templateEvent( tempName );
296 event = currentEditor()->edit( this, event ); 297 event = currentEditor()->edit( this, event );
297 if ( currentEditor()->accepted() ) { 298 if ( currentEditor()->accepted() ) {
298 event.setUid( 1 ); 299 event.setUid( 1 );
299 handleAlarms( OPimTodo(), event ); 300 handleAlarms( OPimTodo(), event );
300 m_todoMgr.add( event ); 301 m_todoMgr.add( event );
301 currentView()->addEvent( event ); 302 currentView()->addEvent( event );
302 303
303 reloadCategories(); 304 reloadCategories();
304 } 305 }
305 raiseCurrentView(); 306 raiseCurrentView();
306 } 307 }
307 } 308 }
308} 309}
309void MainWindow::slotItemEdit() { 310void MainWindow::slotItemEdit() {
310 slotEdit( currentView()->current() ); 311 slotEdit( currentView()->current() );
311} 312}
312void MainWindow::slotItemDuplicate() { 313void MainWindow::slotItemDuplicate() {
313 if(m_syncing) { 314 if(m_syncing) {
314 QMessageBox::warning(this, QWidget::tr("Todo"), 315 QMessageBox::warning(this, QWidget::tr("Todo"),
315 QWidget::tr("Data can not be edited, currently syncing")); 316 QWidget::tr("Data can not be edited, currently syncing"));
316 return; 317 return;
317 } 318 }
318 OPimTodo ev = m_todoMgr.event( currentView()->current() ); 319 OPimTodo ev = m_todoMgr.event( currentView()->current() );
319 /* let's generate a new uid */ 320 /* let's generate a new uid */
320 ev.setUid(1); 321 ev.setUid(1);
321 m_todoMgr.add( ev ); 322 m_todoMgr.add( ev );
322 323
323 currentView()->addEvent( ev ); 324 currentView()->addEvent( ev );
324 raiseCurrentView(); 325 raiseCurrentView();
325} 326}
326void MainWindow::slotItemDelete() { 327void MainWindow::slotItemDelete() {
327 if (!currentView()->current() ) 328 if (!currentView()->current() )
328 return; 329 return;
329 330
330 if(m_syncing) { 331 if(m_syncing) {
331 QMessageBox::warning(this, QWidget::tr("Todo"), 332 QMessageBox::warning(this, QWidget::tr("Todo"),
332 QWidget::tr("Data can not be edited, currently syncing")); 333 QWidget::tr("Data can not be edited, currently syncing"));
333 return; 334 return;
334 } 335 }
335 QString strName = currentView()->currentRepresentation(); 336 QString strName = currentView()->currentRepresentation();
336 if (!QPEMessageBox::confirmDelete(this, QWidget::tr("Todo"), strName ) ) 337 if (!QPEMessageBox::confirmDelete(this, QWidget::tr("Todo"), strName ) )
337 return; 338 return;
338 339
339 handleAlarms( m_todoMgr.event( currentView()->current() ), OPimTodo() ); 340 handleAlarms( m_todoMgr.event( currentView()->current() ), OPimTodo() );
340 m_todoMgr.remove( currentView()->current() ); 341 m_todoMgr.remove( currentView()->current() );
341 currentView()->removeEvent( currentView()->current() ); 342 currentView()->removeEvent( currentView()->current() );
342 raiseCurrentView(); 343 raiseCurrentView();
343} 344}
344 345
345static const char *beamfile = "/tmp/opie-todo.vcs"; 346static const char *beamfile = "/tmp/opie-todo.vcs";
346void MainWindow::slotItemBeam() { 347void MainWindow::slotItemBeam() {
347 beam( currentView()->current() ); 348 beam( currentView()->current() );
348} 349}
349void MainWindow::slotItemFind() { 350void MainWindow::slotItemFind() {
350} 351}
351void MainWindow::slotConfigure() { 352void MainWindow::slotConfigure() {
352 TemplateDialogImpl dlg( this, m_tempManager ); 353 TemplateDialogImpl dlg( this, m_tempManager );
353 if ( QPEApplication::execDialog( &dlg ) != QDialog::Accepted ) 354 if ( QPEApplication::execDialog( &dlg ) != QDialog::Accepted )
354 m_tempManager->load(); 355 m_tempManager->load();
355} 356}
356void MainWindow::slotDelete(int uid ) { 357void MainWindow::slotDelete(int uid ) {
357 if( uid == 0 ) return; 358 if( uid == 0 ) return;
358 if(m_syncing) { 359 if(m_syncing) {
359 QMessageBox::warning(this, QWidget::tr("Todo"), 360 QMessageBox::warning(this, QWidget::tr("Todo"),
360 QWidget::tr("Data can not be edited, currently syncing")); 361 QWidget::tr("Data can not be edited, currently syncing"));
361 return; 362 return;
362 } 363 }
363 OPimTodo to = m_todoMgr.event(uid); 364 OPimTodo to = m_todoMgr.event(uid);
364 if (!QPEMessageBox::confirmDelete(this, QWidget::tr("Todo"), to.toShortText() ) ) 365 if (!QPEMessageBox::confirmDelete(this, QWidget::tr("Todo"), to.toShortText() ) )
365 return; 366 return;
366 367
367 handleAlarms(to, OPimTodo() ); 368 handleAlarms(to, OPimTodo() );
368 m_todoMgr.remove( to.uid() ); 369 m_todoMgr.remove( to.uid() );
369 currentView()->removeEvent( to.uid() ); 370 currentView()->removeEvent( to.uid() );
370 raiseCurrentView(); 371 raiseCurrentView();
371} 372}
372void MainWindow::slotDeleteAll() { 373void MainWindow::slotDeleteAll() {
373 if(m_syncing) { 374 if(m_syncing) {
374 QMessageBox::warning(this, QWidget::tr("Todo"), 375 QMessageBox::warning(this, QWidget::tr("Todo"),
375 QWidget::tr("Data can not be edited, currently syncing")); 376 QWidget::tr("Data can not be edited, currently syncing"));
376 return; 377 return;
377 } 378 }
378 379
379 380
380 if ( !QPEMessageBox::confirmDelete( this, QWidget::tr( "Todo" ), QWidget::tr("all tasks?") ) ) 381 if ( !QPEMessageBox::confirmDelete( this, QWidget::tr( "Todo" ), QWidget::tr("all tasks?") ) )
381 return; 382 return;
382 383
383 m_todoMgr.removeAll(); 384 m_todoMgr.removeAll();
384 currentView()->clear(); 385 currentView()->clear();
385 386
386 raiseCurrentView(); 387 raiseCurrentView();
387} 388}
388void MainWindow::slotDeleteCompleted() { 389void MainWindow::slotDeleteCompleted() {
389 if(m_syncing) { 390 if(m_syncing) {
390 QMessageBox::warning(this, QWidget::tr("Todo"), 391 QMessageBox::warning(this, QWidget::tr("Todo"),
391 QWidget::tr("Data can not be edited, currently syncing")); 392 QWidget::tr("Data can not be edited, currently syncing"));
392 return; 393 return;
393 } 394 }
394 395
395 if ( !QPEMessageBox::confirmDelete( this, QWidget::tr( "Todo" ), QWidget::tr("all completed tasks?") ) ) 396 if ( !QPEMessageBox::confirmDelete( this, QWidget::tr( "Todo" ), QWidget::tr("all completed tasks?") ) )
396 return; 397 return;
397 398
398 399
399 m_todoMgr.removeCompleted(); 400 m_todoMgr.removeCompleted();
400 currentView()->updateView( ); 401 currentView()->updateView( );
401} 402}
402/* 403/*
403 * set the category 404 * set the category
404 */ 405 */
405void MainWindow::setCategory( const QString &category ) { 406void MainWindow::setCategory( const QString &category ) {
406 m_curCat = category; 407 m_curCat = category;
407 if ( m_curCat == tr( "All" ) ) 408 if ( m_curCat == tr( "All" ) )
408 m_curCat = QString::null; 409 m_curCat = QString::null;
409 410
410 currentView()->setShowCategory( m_curCat ); 411 currentView()->setShowCategory( m_curCat );
411 raiseCurrentView(); 412 raiseCurrentView();
412} 413}
413void MainWindow::slotShowDeadLine( bool dead) { 414void MainWindow::slotShowDeadLine( bool dead) {
414 m_deadline = dead; 415 m_deadline = dead;
415 currentView()->setShowDeadline( dead ); 416 currentView()->setShowDeadline( dead );
416} 417}
417void MainWindow::slotShowCompleted( bool show) { 418void MainWindow::slotShowCompleted( bool show) {
418 m_completed = show; 419 m_completed = show;
419 currentView()->setShowCompleted( m_completed ); 420 currentView()->setShowCompleted( m_completed );
420} 421}
421void MainWindow::slotShowQuickTask( bool show ) { 422void MainWindow::slotShowQuickTask( bool show ) {
422 m_quicktask = show; 423 m_quicktask = show;
423 if ( m_quicktask ) 424 if ( m_quicktask )
424 m_curQuick->widget()->show(); 425 m_curQuick->widget()->show();
425 else 426 else
426 m_curQuick->widget()->hide(); 427 m_curQuick->widget()->hide();
427} 428}
428bool MainWindow::showOverDue()const { 429bool MainWindow::showOverDue()const {
429 return m_overdue; 430 return m_overdue;
430} 431}
431void MainWindow::setDocument( const QString& fi) { 432void MainWindow::setDocument( const QString& fi) {
432 DocLnk doc(fi); 433 DocLnk doc(fi);
433 if (doc.isValid() ) 434 if (doc.isValid() )
434 receiveFile(doc.file() ); 435 receiveFile(doc.file() );
435 else 436 else
436 receiveFile(fi ); 437 receiveFile(fi );
437} 438}
438void MainWindow::beamDone( Ir* ir) { 439void MainWindow::beamDone( Ir* ir) {
439 delete ir; 440 delete ir;
440 ::unlink( beamfile ); 441 ::unlink( beamfile );
441} 442}
442void MainWindow::receiveFile( const QString& filename ) { 443void MainWindow::receiveFile( const QString& filename ) {
443 OPimTodoAccessVCal* cal = new OPimTodoAccessVCal(filename ); 444 OPimTodoAccessVCal* cal = new OPimTodoAccessVCal(filename );
444 445
445 OPimTodoAccess acc( cal ); 446 OPimTodoAccess acc( cal );
446 acc.load(); 447 acc.load();
447 OPimTodoAccess::List list = acc.allRecords(); 448 OPimTodoAccess::List list = acc.allRecords();
448 449
449 if (list.count()){ 450 if (list.count()){
450 451
451 QString message = QWidget::tr("<P>%1 new tasks arrived.<p>Would you like to add them to your Todolist?").arg(list.count() ); 452 QString message = QWidget::tr("<P>%1 new tasks arrived.<p>Would you like to add them to your Todolist?").arg(list.count() );
452 453
453 if ( QMessageBox::information(this, QWidget::tr("New Tasks"), 454 if ( QMessageBox::information(this, QWidget::tr("New Tasks"),
454 message, QMessageBox::Ok, 455 message, QMessageBox::Ok,
455 QMessageBox::Cancel ) == QMessageBox::Ok ) { 456 QMessageBox::Cancel ) == QMessageBox::Ok ) {
456 OPimTodoAccess::List::Iterator it; 457 OPimTodoAccess::List::Iterator it;
457 for ( it = list.begin(); it != list.end(); ++it ) 458 for ( it = list.begin(); it != list.end(); ++it )
458 m_todoMgr.add( (*it) ); 459 m_todoMgr.add( (*it) );
459 460
460 currentView()->updateView(); 461 currentView()->updateView();
461 } 462 }
462 } 463 }
463} 464}
464 465
465void MainWindow::slotFlush() { 466void MainWindow::slotFlush() {
466 m_syncing = true; 467 m_syncing = true;
467 m_todoMgr.save(); 468 m_todoMgr.save();
468} 469}
469void MainWindow::slotShowDetails() { 470void MainWindow::slotShowDetails() {
470 slotShow( currentView()->current() ); 471 slotShow( currentView()->current() );
471} 472}
472bool MainWindow::showCompleted()const { 473bool MainWindow::showCompleted()const {
473 return m_completed; 474 return m_completed;
474} 475}
475bool MainWindow::showDeadline()const { 476bool MainWindow::showDeadline()const {
476 return m_deadline; 477 return m_deadline;
477} 478}
478bool MainWindow::showQuickTask()const { 479bool MainWindow::showQuickTask()const {
479 return m_quicktask; 480 return m_quicktask;
480} 481}
481QString MainWindow::currentCategory()const { 482QString MainWindow::currentCategory()const {
482 return m_curCat; 483 return m_curCat;
483} 484}
484int MainWindow::currentCatId() { 485int MainWindow::currentCatId() {
485 return m_todoMgr.catId( m_curCat ); 486 return m_todoMgr.catId( m_curCat );
486} 487}
487ViewBase* MainWindow::currentView() { 488ViewBase* MainWindow::currentView() {
488 return m_curView; 489 return m_curView;
489} 490}
490void MainWindow::raiseCurrentView() { 491void MainWindow::raiseCurrentView() {
491 // due QPE/Application/todolist show(int) 492 // due QPE/Application/todolist show(int)
492 // we might not have the populateCategories slot called once 493 // we might not have the populateCategories slot called once
493 // we would show the otodo but then imediately switch to the currentView 494 // we would show the otodo but then imediately switch to the currentView
494 // if we're initially showing we shouldn't raise the table 495 // if we're initially showing we shouldn't raise the table
495 // in returnFromView we fix up m_showing 496 // in returnFromView we fix up m_showing
496 if (m_showing ) return; 497 if (m_showing ) return;
497 498
498 m_stack->raiseWidget( m_curView->widget() ); 499 m_stack->raiseWidget( m_curView->widget() );
499} 500}
500void MainWindow::slotShowDue(bool ov) { 501void MainWindow::slotShowDue(bool ov) {
501 m_overdue = ov; 502 m_overdue = ov;
502 currentView()->showOverDue( ov ); 503 currentView()->showOverDue( ov );
503 raiseCurrentView(); 504 raiseCurrentView();
504} 505}
505void MainWindow::slotShow( int uid ) { 506void MainWindow::slotShow( int uid ) {
506 if ( uid == 0 ) return; 507 if ( uid == 0 ) return;
507 508
508 509
509 currentShow()->slotShow( event( uid ) ); 510 currentShow()->slotShow( event( uid ) );
510 m_stack->raiseWidget( currentShow()->widget() ); 511 m_stack->raiseWidget( currentShow()->widget() );
511} 512}
512void MainWindow::slotShowNext() { 513void MainWindow::slotShowNext() {
513 int l = currentView()->next(); 514 int l = currentView()->next();
514 if (l!=0) 515 if (l!=0)
515 slotShow(l); 516 slotShow(l);
516} 517}
517void MainWindow::slotShowPrev() { 518void MainWindow::slotShowPrev() {
518 int l = currentView()->prev(); 519 int l = currentView()->prev();
519 if (l!=0) 520 if (l!=0)
520 slotShow(l); 521 slotShow(l);
521} 522}
522void MainWindow::slotEdit( int uid ) { 523void MainWindow::slotEdit( int uid ) {
523 if (uid == 0 ) return; 524 if (uid == 0 ) return;
524 if(m_syncing) { 525 if(m_syncing) {
525 QMessageBox::warning(this, QWidget::tr("Todo"), 526 QMessageBox::warning(this, QWidget::tr("Todo"),
526 QWidget::tr("Data can't be edited, currently syncing")); 527 QWidget::tr("Data can't be edited, currently syncing"));
527 return; 528 return;
528 } 529 }
529 530
530 OPimTodo old_todo = m_todoMgr.event( uid ); 531 OPimTodo old_todo = m_todoMgr.event( uid );
531 532
532 OPimTodo todo = currentEditor()->edit(this, old_todo ); 533 OPimTodo todo = currentEditor()->edit(this, old_todo );
533 534
534 /* if completed */ 535 /* if completed */
535 if ( currentEditor()->accepted() ) { 536 if ( currentEditor()->accepted() ) {
536 handleAlarms( old_todo, todo ); 537 handleAlarms( old_todo, todo );
537 m_todoMgr.update( todo.uid(), todo ); 538 m_todoMgr.update( todo.uid(), todo );
538 currentView()->replaceEvent( todo ); 539 currentView()->replaceEvent( todo );
539 /* a Category might have changed */ 540 /* a Category might have changed */
540 reloadCategories(); 541 reloadCategories();
541 } 542 }
542 543
543 raiseCurrentView(); 544 raiseCurrentView();
544} 545}
545/* 546/*
546void MainWindow::slotUpdate1( int uid, const SmallTodo& ev) { 547void MainWindow::slotUpdate1( int uid, const SmallTodo& ev) {
547 m_todoMgr.update( uid, ev ); 548 m_todoMgr.update( uid, ev );
548} 549}
549*/ 550*/
550void MainWindow::updateTodo( const OPimTodo& ev) { 551void MainWindow::updateTodo( const OPimTodo& ev) {
551 m_todoMgr.update( ev.uid() , ev ); 552 m_todoMgr.update( ev.uid() , ev );
552} 553}
553/* The view changed it's configuration 554/* The view changed it's configuration
554 * update the view menu 555 * update the view menu
555 */ 556 */
556void MainWindow::slotUpdate3( QWidget* ) { 557void MainWindow::slotUpdate3( QWidget* ) {
557 558
558} 559}
559void MainWindow::updateList() { 560void MainWindow::updateList() {
560 m_todoMgr.updateList(); 561 m_todoMgr.updateList();
561} 562}
562void MainWindow::setReadAhead( uint count ) { 563void MainWindow::setReadAhead( uint count ) {
563 if (m_todoMgr.todoDB() ) 564 if (m_todoMgr.todoDB() )
564 m_todoMgr.todoDB()->setReadAhead( count ); 565 m_todoMgr.todoDB()->setReadAhead( count );
565} 566}
566void MainWindow::slotQuickEntered() { 567void MainWindow::slotQuickEntered() {
567 OPimTodo todo = quickEditor()->todo(); 568 OPimTodo todo = quickEditor()->todo();
568 if (todo.isEmpty() ) 569 if (todo.isEmpty() )
569 return; 570 return;
570 571
571 m_todoMgr.add( todo ); 572 m_todoMgr.add( todo );
572 currentView()->addEvent( todo ); 573 currentView()->addEvent( todo );
573 raiseCurrentView(); 574 raiseCurrentView();
574} 575}
575QuickEditBase* MainWindow::quickEditor() { 576QuickEditBase* MainWindow::quickEditor() {
576 return m_curQuick; 577 return m_curQuick;
577} 578}
578void MainWindow::slotComplete( int uid ) { 579void MainWindow::slotComplete( int uid ) {
579 slotComplete( event(uid) ); 580 slotComplete( event(uid) );
580} 581}
581void MainWindow::slotComplete( const OPimTodo& todo ) { 582void MainWindow::slotComplete( const OPimTodo& todo ) {
582 OPimTodo to = todo; 583 OPimTodo to = todo;
583 to.setCompleted( !to.isCompleted() ); 584 to.setCompleted( !to.isCompleted() );
584 to.setCompletedDate( QDate::currentDate() ); 585 to.setCompletedDate( QDate::currentDate() );
585 586
586 /* 587 /*
587 * if the item does recur 588 * if the item does recur
588 * we need to spin it off 589 * we need to spin it off
589 * and update the items duedate to the next 590 * and update the items duedate to the next
590 * possible recurrance of this item... 591 * possible recurrance of this item...
591 * the spinned off one will loose the 592 * the spinned off one will loose the
592 * recurrence. 593 * recurrence.
593 * We calculate the difference between the old due date and the 594 * We calculate the difference between the old due date and the
594 * new one and add this diff to start, completed and alarm dates 595 * new one and add this diff to start, completed and alarm dates
595 * -zecke 596 * -zecke
596 */ 597 */
597 if ( to.hasRecurrence() && to.isCompleted() ) { 598 if ( to.hasRecurrence() && to.isCompleted() ) {
598 OPimTodo to2( to ); 599 OPimTodo to2( to );
599 600
600 /* the spinned off one won't recur anymore */ 601 /* the spinned off one won't recur anymore */
601 to.setRecurrence( OPimRecurrence() ); 602 to.setRecurrence( OPimRecurrence() );
602 603
603 OPimRecurrence rec = to2.recurrence(); 604 OPimRecurrence rec = to2.recurrence();
604 rec.setStart( to.dueDate() ); 605 rec.setStart( to.dueDate() );
605 to2.setRecurrence( rec ); 606 to2.setRecurrence( rec );
606 /* 607 /*
607 * if there is a next occurence 608 * if there is a next occurence
608 * from the duedate of the last recurrance 609 * from the duedate of the last recurrance
609 */ 610 */
610 QDate date; 611 QDate date;
611 if ( to2.recurrence().nextOcurrence( to2.dueDate().addDays(1), date ) ) { 612 if ( to2.recurrence().nextOcurrence( to2.dueDate().addDays(1), date ) ) {
612 int dayDiff = to.dueDate().daysTo( date ); 613 int dayDiff = to.dueDate().daysTo( date );
613 QDate inval; 614 QDate inval;
614 /* generate a new uid for the old record */ 615 /* generate a new uid for the old record */
615 to.setUid( 1 ); 616 to.setUid( 1 );
616 617
617 /* add the old one cause it has a new UID here cause it was spin off */ 618 /* add the old one cause it has a new UID here cause it was spin off */
618 m_todoMgr.add( to ); 619 m_todoMgr.add( to );
619 620
620 /* 621 /*
621 * update the due date 622 * update the due date
622 * start date 623 * start date
623 * and complete date 624 * and complete date
624 */ 625 */
625 to2.setDueDate( date ); 626 to2.setDueDate( date );
626 rec.setStart( date ); 627 rec.setStart( date );
627 to2.setRecurrence( rec ); // could be Monday, TuesDay, Thursday every week 628 to2.setRecurrence( rec ); // could be Monday, TuesDay, Thursday every week
628 629
629 /* move start date */ 630 /* move start date */
630 if (to2.hasStartDate() ) 631 if (to2.hasStartDate() )
631 to2.setStartDate( to2.startDate().addDays( dayDiff ) ); 632 to2.setStartDate( to2.startDate().addDays( dayDiff ) );
632 633
633 /* now the alarms */ 634 /* now the alarms */
634 if (to2.hasNotifiers() ) { 635 if (to2.hasNotifiers() ) {
635 OPimNotifyManager::Alarms _als = to2.notifiers().alarms(); 636 OPimNotifyManager::Alarms _als = to2.notifiers().alarms();
636 OPimNotifyManager::Alarms als; 637 OPimNotifyManager::Alarms als;
637 638
638 /* for every alarm move the day */ 639 /* for every alarm move the day */
639 for ( OPimNotifyManager::Alarms::Iterator it = _als.begin(); it != _als.end(); ++it ) { 640 for ( OPimNotifyManager::Alarms::Iterator it = _als.begin(); it != _als.end(); ++it ) {
640 OPimAlarm al = (*it); 641 OPimAlarm al = (*it);
641 al.setDateTime( al.dateTime().addDays( dayDiff ) ); 642 al.setDateTime( al.dateTime().addDays( dayDiff ) );
642 als.append( al ); 643 als.append( al );
643 } 644 }
644 to2.notifiers().setAlarms( als ); 645 to2.notifiers().setAlarms( als );
645 handleAlarms( OPimTodo(), todo ); 646 handleAlarms( OPimTodo(), todo );
646 } 647 }
647 to2.setCompletedDate( inval ); 648 to2.setCompletedDate( inval );
648 to2.setCompleted( false ); 649 to2.setCompleted( false );
649 650
650 updateTodo( to2 ); 651 updateTodo( to2 );
651 }else 652 }else
652 updateTodo( to ); 653 updateTodo( to );
653 }else 654 }else
654 updateTodo( to ); 655 updateTodo( to );
655 656
656 currentView()->updateView(); 657 currentView()->updateView();
657 raiseCurrentView(); 658 raiseCurrentView();
658} 659}
659void MainWindow::flush() { 660void MainWindow::flush() {
660 slotFlush(); 661 slotFlush();
661} 662}
662void MainWindow::reload() { 663void MainWindow::reload() {
663 slotReload(); 664 slotReload();
664} 665}
665int MainWindow::create() { 666int MainWindow::create() {
666 int uid = 0; 667 int uid = 0;
667 if(m_syncing) { 668 if(m_syncing) {
668 QMessageBox::warning(this, QWidget::tr("Todo"), 669 QMessageBox::warning(this, QWidget::tr("Todo"),
669 QWidget::tr("Data can not be edited, currently syncing")); 670 QWidget::tr("Data can not be edited, currently syncing"));
670 return uid; 671 return uid;
671 } 672 }
672 m_todoMgr.load(); 673 m_todoMgr.load();
673 674
674 675
675 OPimTodo todo = currentEditor()->newTodo( currentCatId(), 676 OPimTodo todo = currentEditor()->newTodo( currentCatId(),
676 this ); 677 this );
677 678
678 if ( currentEditor()->accepted() ) { 679 if ( currentEditor()->accepted() ) {
679 //todo.assignUid(); 680 //todo.assignUid();
680 uid = todo.uid(); 681 uid = todo.uid();
681 handleAlarms( OPimTodo(), todo ); 682 handleAlarms( OPimTodo(), todo );
682 m_todoMgr.add( todo ); 683 m_todoMgr.add( todo );
683 currentView()->addEvent( todo ); 684 currentView()->addEvent( todo );
684 685
685 686
686 // I'm afraid we must call this every time now, otherwise 687 // I'm afraid we must call this every time now, otherwise
687 // spend expensive time comparing all these strings... 688 // spend expensive time comparing all these strings...
688 // but only call if we changed something -zecke 689 // but only call if we changed something -zecke
689 reloadCategories(); 690 reloadCategories();
690 } 691 }
691 raiseCurrentView( ); 692 raiseCurrentView( );
692 693
693 return uid; 694 return uid;
694} 695}
695/* delete it silently... */ 696/* delete it silently... */
696bool MainWindow::remove( int uid ) { 697bool MainWindow::remove( int uid ) {
697 if (m_syncing) return false; 698 if (m_syncing) return false;
698 699
699 /* argh need to get the whole OEvent... to disable alarms -zecke */ 700 /* argh need to get the whole OEvent... to disable alarms -zecke */
700 handleAlarms( OPimTodo(), m_todoMgr.event( uid ) ); 701 handleAlarms( OPimTodo(), m_todoMgr.event( uid ) );
701 702
702 return m_todoMgr.remove( uid ); 703 return m_todoMgr.remove( uid );
703} 704}
704void MainWindow::beam( int uid) { 705void MainWindow::beam( int uid) {
705 if( uid == 0 ) return; 706 if( uid == 0 ) return;
706 707
707 ::unlink( beamfile ); 708 ::unlink( beamfile );
708 m_todoMgr.load(); 709 m_todoMgr.load();
709 710
710 OPimTodo todo = event( uid ); 711 OPimTodo todo = event( uid );
711 OPimTodoAccessVCal* cal = new OPimTodoAccessVCal(QString::fromLatin1(beamfile) ); 712 OPimTodoAccessVCal* cal = new OPimTodoAccessVCal(QString::fromLatin1(beamfile) );
712 OPimTodoAccess acc( cal ); 713 OPimTodoAccess acc( cal );
713 acc.load(); 714 acc.load();
714 acc.add( todo ); 715 acc.add( todo );
715 acc.save(); 716 acc.save();
716 Ir* ir = new Ir(this ); 717 Ir* ir = new Ir(this );
717 connect(ir, SIGNAL(done(Ir*) ), 718 connect(ir, SIGNAL(done(Ir*) ),
718 this, SLOT(beamDone(Ir*) ) ); 719 this, SLOT(beamDone(Ir*) ) );
719 ir->send(beamfile, todo.summary(), "text/x-vCalendar" ); 720 ir->send(beamfile, todo.summary(), "text/x-vCalendar" );
720} 721}
721void MainWindow::show( int uid ) { 722void MainWindow::show( int uid ) {
722 m_todoMgr.load(); // might not be loaded yet 723 m_todoMgr.load(); // might not be loaded yet
723 m_showing = true; 724 m_showing = true;
724 slotShow( uid ); 725 slotShow( uid );
725 raise(); 726 raise();
726 QPEApplication::setKeepRunning(); 727 QPEApplication::setKeepRunning();
727} 728}
728void MainWindow::edit( int uid ) { 729void MainWindow::edit( int uid ) {
729 m_todoMgr.load(); 730 m_todoMgr.load();
730 slotEdit( uid ); 731 slotEdit( uid );
731} 732}
732void MainWindow::add( const OPimRecord& rec) { 733void MainWindow::add( const OPimRecord& rec) {
733 OPimTodo test; 734 OPimTodo test;
734 if ( rec.rtti() != test.rtti() ) return; 735 if ( rec.rtti() != test.rtti() ) return;
735 m_todoMgr.load(); // might not be loaded 736 m_todoMgr.load(); // might not be loaded
736 737
737 const OPimTodo& todo = static_cast<const OPimTodo&>(rec); 738 const OPimTodo& todo = static_cast<const OPimTodo&>(rec);
738 739
739 m_todoMgr.add(todo ); 740 m_todoMgr.add(todo );
740 currentView()->addEvent( todo ); 741 currentView()->addEvent( todo );
741 742
742 743
743 // I'm afraid we must call this every time now, otherwise 744 // I'm afraid we must call this every time now, otherwise
744 // spend expensive time comparing all these strings... 745 // spend expensive time comparing all these strings...
745 // but only call if we changed something -zecke 746 // but only call if we changed something -zecke
746 reloadCategories(); 747 reloadCategories();
747} 748}
748void MainWindow::slotReturnFromView() { 749void MainWindow::slotReturnFromView() {
749 m_showing = false; 750 m_showing = false;
750 raiseCurrentView(); 751 raiseCurrentView();
751} 752}
752 753
753namespace { 754namespace {
754 OPimNotifyManager::Alarms findNonMatching( const OPimNotifyManager::Alarms& oldAls, 755 OPimNotifyManager::Alarms findNonMatching( const OPimNotifyManager::Alarms& oldAls,
755 const OPimNotifyManager::Alarms& newAls ) { 756 const OPimNotifyManager::Alarms& newAls ) {
756 OPimNotifyManager::Alarms nonMatching; 757 OPimNotifyManager::Alarms nonMatching;
757 OPimNotifyManager::Alarms::ConstIterator oldIt = oldAls.begin(); 758 OPimNotifyManager::Alarms::ConstIterator oldIt = oldAls.begin();
758 OPimNotifyManager::Alarms::ConstIterator newIt; 759 OPimNotifyManager::Alarms::ConstIterator newIt;
759 for ( ; oldIt != oldAls.end(); ++oldIt ) { 760 for ( ; oldIt != oldAls.end(); ++oldIt ) {
760 bool found = false; 761 bool found = false;
761 QDateTime oldDt = (*oldIt).dateTime(); 762 QDateTime oldDt = (*oldIt).dateTime();
762 for (newIt= newAls.begin(); newIt != newAls.end(); ++newIt ) { 763 for (newIt= newAls.begin(); newIt != newAls.end(); ++newIt ) {
763 if ( oldDt == (*newIt).dateTime() ) { 764 if ( oldDt == (*newIt).dateTime() ) {
764 found = true; 765 found = true;
765 break; 766 break;
766 } 767 }
767 } 768 }
768 if (!found) 769 if (!found)
769 nonMatching.append( (*oldIt) ); 770 nonMatching.append( (*oldIt) );
770 } 771 }
771 return nonMatching; 772 return nonMatching;
772 } 773 }
773 void addAlarms( const OPimNotifyManager::Alarms& als, int uid ) { 774 void addAlarms( const OPimNotifyManager::Alarms& als, int uid ) {
774 OPimNotifyManager::Alarms::ConstIterator it; 775 OPimNotifyManager::Alarms::ConstIterator it;
775 for ( it = als.begin(); it != als.end(); ++it ) { 776 for ( it = als.begin(); it != als.end(); ++it ) {
776 AlarmServer::addAlarm( (*it).dateTime(), "QPE/Application/todolist", "alarm(QDateTime,int)", uid ); 777 AlarmServer::addAlarm( (*it).dateTime(), "QPE/Application/todolist", "alarm(QDateTime,int)", uid );
777 } 778 }
778 779
779 } 780 }
780 void removeAlarms( const OPimNotifyManager::Alarms& als, int uid ) { 781 void removeAlarms( const OPimNotifyManager::Alarms& als, int uid ) {
781 OPimNotifyManager::Alarms::ConstIterator it; 782 OPimNotifyManager::Alarms::ConstIterator it;
782 for ( it = als.begin(); it != als.end(); ++it ) { 783 for ( it = als.begin(); it != als.end(); ++it ) {
783 AlarmServer::deleteAlarm( (*it).dateTime(), "QPE/Application/todolist", "alarm(QDateTime,int)", uid ); 784 AlarmServer::deleteAlarm( (*it).dateTime(), "QPE/Application/todolist", "alarm(QDateTime,int)", uid );
784 } 785 }
785 } 786 }
786} 787}
787 788
788void MainWindow::handleAlarms( const OPimTodo& oldTodo, const OPimTodo& newTodo) { 789void MainWindow::handleAlarms( const OPimTodo& oldTodo, const OPimTodo& newTodo) {
789 /* 790 /*
790 * if oldTodo is not empty and has notifiers we need to find the deleted ones 791 * if oldTodo is not empty and has notifiers we need to find the deleted ones
791 */ 792 */
792 if(!oldTodo.isEmpty() && oldTodo.hasNotifiers() ) { 793 if(!oldTodo.isEmpty() && oldTodo.hasNotifiers() ) {
793 OPimNotifyManager::Alarms removed; 794 OPimNotifyManager::Alarms removed;
794 OPimNotifyManager::Alarms oldAls = oldTodo.notifiers().alarms(); 795 OPimNotifyManager::Alarms oldAls = oldTodo.notifiers().alarms();
795 if (!newTodo.hasNotifiers() ) 796 if (!newTodo.hasNotifiers() )
796 removed = oldAls; 797 removed = oldAls;
797 else 798 else
798 removed = findNonMatching( oldAls, newTodo.notifiers().alarms() ); 799 removed = findNonMatching( oldAls, newTodo.notifiers().alarms() );
799 800
800 removeAlarms( removed, oldTodo.uid() ); 801 removeAlarms( removed, oldTodo.uid() );
801 } 802 }
802 if ( newTodo.hasNotifiers() ) { 803 if ( newTodo.hasNotifiers() ) {
803 OPimNotifyManager::Alarms added; 804 OPimNotifyManager::Alarms added;
804 if ( oldTodo.isEmpty() || !oldTodo.hasNotifiers() ) 805 if ( oldTodo.isEmpty() || !oldTodo.hasNotifiers() )
805 added = newTodo.notifiers().alarms(); 806 added = newTodo.notifiers().alarms();
806 else 807 else
807 added = findNonMatching( newTodo.notifiers().alarms(), oldTodo.notifiers().alarms() ); 808 added = findNonMatching( newTodo.notifiers().alarms(), oldTodo.notifiers().alarms() );
808 809
809 addAlarms( added, newTodo.uid() ); 810 addAlarms( added, newTodo.uid() );
810 } 811 }
811} 812}
812/* we might have not loaded the db */ 813/* we might have not loaded the db */
813void MainWindow::doAlarm( const QDateTime& dt, int uid ) { 814void MainWindow::doAlarm( const QDateTime& dt, int uid ) {
814 m_todoMgr.load(); 815 m_todoMgr.load();
815 816
816 OPimTodo todo = m_todoMgr.event( uid ); 817 OPimTodo todo = m_todoMgr.event( uid );
817 if (!todo.hasNotifiers() ) return; 818 if (!todo.hasNotifiers() ) return;
818 819
819 /* 820 /*
820 * let's find the right alarm and find out if silent 821 * let's find the right alarm and find out if silent
821 * then show a richtext widget 822 * then show a richtext widget
822 */ 823 */
823 bool loud = false; 824 bool loud = false;
824 OPimNotifyManager::Alarms als = todo.notifiers().alarms(); 825 OPimNotifyManager::Alarms als = todo.notifiers().alarms();
825 OPimNotifyManager::Alarms::Iterator it; 826 OPimNotifyManager::Alarms::Iterator it;
826 for ( it = als.begin(); it != als.end(); ++it ) { 827 for ( it = als.begin(); it != als.end(); ++it ) {
827 if ( (*it).dateTime() == dt ) { 828 if ( (*it).dateTime() == dt ) {
828 loud = ( (*it).sound() == OPimAlarm::Loud ); 829 loud = ( (*it).sound() == OPimAlarm::Loud );
829 break; 830 break;
830 } 831 }
831 } 832 }
832 if (loud) 833 if (loud)
833 startAlarm(); 834 startAlarm();
834 835
835 QDialog dlg(this, 0, true ); 836 QDialog dlg(this, 0, true );
836 QVBoxLayout* lay = new QVBoxLayout( &dlg ); 837 QVBoxLayout* lay = new QVBoxLayout( &dlg );
837 QTextView* view = new QTextView( &dlg ); 838 QTextView* view = new QTextView( &dlg );
838 lay->addWidget( view ); 839 lay->addWidget( view );
839 QPushButton* btnOk = new QPushButton( tr("Ok"), &dlg ); 840 QPushButton* btnOk = new QPushButton( tr("Ok"), &dlg );
840 connect( btnOk, SIGNAL(clicked() ), &dlg, SLOT(accept() ) ); 841 connect( btnOk, SIGNAL(clicked() ), &dlg, SLOT(accept() ) );
841 lay->addWidget( btnOk ); 842 lay->addWidget( btnOk );
842 843
843 QString text = tr("<h1>Alarm at %1</h1><br>").arg( TimeString::dateString( dt ) ); 844 QString text = tr("<h1>Alarm at %1</h1><br>").arg( TimeString::dateString( dt ) );
844 text += todo.toRichText(); 845 text += todo.toRichText();
845 view->setText( text ); 846 view->setText( text );
846 847
847 bool needToStay = QPEApplication::execDialog( &dlg ); 848 bool needToStay = QPEApplication::execDialog( &dlg );
848 849
849 if (loud) 850 if (loud)
850 killAlarm(); 851 killAlarm();
851 852
852 if (needToStay) { 853 if (needToStay) {
853// showMaximized(); 854// showMaximized();
854// raise(); 855// raise();
855 QPEApplication::setKeepRunning(); 856 QPEApplication::setKeepRunning();
856// setActiveWindow(); 857// setActiveWindow();
857 } 858 }
858 859
859} 860}
860 861
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,624 +1,627 @@
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 ) {
370 const QColorGroup &cg = colorGroup(); 373 const QColorGroup &cg = colorGroup();
371 374
372 p->save(); 375 p->save();
373 376
374 OPimTodo task = sorted()[row]; 377 OPimTodo task = sorted()[row];
375 378
376 // TODO - give user option for grid or bars? 379 // TODO - give user option for grid or bars?
377 380
378 // Paint alternating background bars 381 // Paint alternating background bars
379 if ( (row % 2 ) == 0 ) { 382 if ( (row % 2 ) == 0 ) {
380 p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Base ) ); 383 p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Base ) );
381 p->setPen( QPen( cg.text() ) ); 384 p->setPen( QPen( cg.text() ) );
382 } 385 }
383 else { 386 else {
384 p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Background ) ); 387 p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Background ) );
385 p->setPen( QPen( cg.buttonText() ) ); 388 p->setPen( QPen( cg.buttonText() ) );
386 } 389 }
387 390
388 // Paint grid 391 // Paint grid
389 //p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Base ) ); 392 //p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Base ) );
390 //QPen op = p->pen(); 393 //QPen op = p->pen();
391 //p->setPen(cg.mid()); 394 //p->setPen(cg.mid());
392 //p->drawLine( 0, cr.height() - 1, cr.width() - 1, cr.height() - 1 ); 395 //p->drawLine( 0, cr.height() - 1, cr.width() - 1, cr.height() - 1 );
393 //p->drawLine( cr.width() - 1, 0, cr.width() - 1, cr.height() - 1 ); 396 //p->drawLine( cr.width() - 1, 0, cr.width() - 1, cr.height() - 1 );
394 //p->setPen(op); 397 //p->setPen(op);
395 398
396 QFont f = p->font(); 399 QFont f = p->font();
397 QFontMetrics fm(f); 400 QFontMetrics fm(f);
398 401
399 int marg = ( cr.width() - BoxSize ) / 2; 402 int marg = ( cr.width() - BoxSize ) / 2;
400 int x = 0; 403 int x = 0;
401 int y = ( cr.height() - BoxSize ) / 2; 404 int y = ( cr.height() - BoxSize ) / 2;
402 405
403 switch(col) { 406 switch(col) {
404 case 0: // completed field 407 case 0: // completed field
405 { 408 {
406 //p->setPen( QPen( cg.text() ) ); 409 //p->setPen( QPen( cg.text() ) );
407 //p->drawRect( x + marg, y, BoxSize, BoxSize ); 410 //p->drawRect( x + marg, y, BoxSize, BoxSize );
408 //p->drawRect( x + marg+1, y+1, BoxSize-2, BoxSize-2 ); 411 //p->drawRect( x + marg+1, y+1, BoxSize-2, BoxSize-2 );
409 if ( task.isCompleted() ) { 412 if ( task.isCompleted() ) {
410 p->drawPixmap( x + marg, y, m_pic_completed ); 413 p->drawPixmap( x + marg, y, m_pic_completed );
411 } 414 }
412 } 415 }
413 break; 416 break;
414 case 1: // priority field 417 case 1: // priority field
415 { 418 {
416 p->drawPixmap( x + marg, y, m_pic_priority[ task.priority() - 1 ] ); 419 p->drawPixmap( x + marg, y, m_pic_priority[ task.priority() - 1 ] );
417 } 420 }
418 break; 421 break;
419 case 2: // description field 422 case 2: // description field
420 { 423 {
421 QString text = task.summary().isEmpty() ? 424 QString text = task.summary().isEmpty() ?
422 task.description().left(20) : 425 task.description().left(20) :
423 task.summary(); 426 task.summary();
424 p->drawText(2,2 + fm.ascent(), text); 427 p->drawText(2,2 + fm.ascent(), text);
425 } 428 }
426 break; 429 break;
427 case 3: 430 case 3:
428 { 431 {
429 QString text; 432 QString text;
430 if (task.hasDueDate()) { 433 if (task.hasDueDate()) {
431 int off = QDate::currentDate().daysTo( task.dueDate() ); 434 int off = QDate::currentDate().daysTo( task.dueDate() );
432 text = tr( "%1 day(s)").arg(QString::number(off)); 435 text = tr( "%1 day(s)").arg(QString::number(off));
433 /* 436 /*
434 * set color if not completed 437 * set color if not completed
435 */ 438 */
436 if (!task.isCompleted() ) { 439 if (!task.isCompleted() ) {
437 QColor color = Qt::black; 440 QColor color = Qt::black;
438 if ( off < 0 ) 441 if ( off < 0 )
439 color = Qt::red; 442 color = Qt::red;
440 else if ( off == 0 ) 443 else if ( off == 0 )
441 color = Qt::yellow; 444 color = Qt::yellow;
442 else if ( off > 0 ) 445 else if ( off > 0 )
443 color = Qt::green; 446 color = Qt::green;
444 p->setPen(color ); 447 p->setPen(color );
445 } 448 }
446 } else { 449 } else {
447 text = tr("None"); 450 text = tr("None");
448 } 451 }
449 p->drawText(2,2 + fm.ascent(), text); 452 p->drawText(2,2 + fm.ascent(), text);
450 } 453 }
451 break; 454 break;
452 } 455 }
453 p->restore(); 456 p->restore();
454} 457}
455QWidget* TableView::createEditor(int row, int col, bool )const { 458QWidget* TableView::createEditor(int row, int col, bool )const {
456 switch( col ) { 459 switch( col ) {
457 case 1: { 460 case 1: {
458 /* the priority stuff */ 461 /* the priority stuff */
459 QComboBox* combo = new QComboBox( viewport() ); 462 QComboBox* combo = new QComboBox( viewport() );
460 for ( int i = 0; i < 5; i++ ) { 463 for ( int i = 0; i < 5; i++ ) {
461 combo->insertItem( m_pic_priority[ i ] ); 464 combo->insertItem( m_pic_priority[ i ] );
462 } 465 }
463 combo->setCurrentItem( sorted()[row].priority()-1 ); 466 combo->setCurrentItem( sorted()[row].priority()-1 );
464 return combo; 467 return combo;
465 } 468 }
466 /* summary */ 469 /* summary */
467 case 2:{ 470 case 2:{
468 QLineEdit* edit = new QLineEdit( viewport() ); 471 QLineEdit* edit = new QLineEdit( viewport() );
469 edit->setText( sorted()[row].summary() ); 472 edit->setText( sorted()[row].summary() );
470 return edit; 473 return edit;
471 } 474 }
472 case 0: 475 case 0:
473 default: 476 default:
474 return 0l; 477 return 0l;
475 } 478 }
476} 479}
477void TableView::setCellContentFromEditor(int row, int col ) { 480void TableView::setCellContentFromEditor(int row, int col ) {
478 if ( col == 1 ) { 481 if ( col == 1 ) {
479 QWidget* wid = cellWidget(row, 1 ); 482 QWidget* wid = cellWidget(row, 1 );
480 if ( wid->inherits("QComboBox") ) { 483 if ( wid->inherits("QComboBox") ) {
481 int pri = ((QComboBox*)wid)->currentItem() + 1; 484 int pri = ((QComboBox*)wid)->currentItem() + 1;
482 OPimTodo todo = sorted()[row]; 485 OPimTodo todo = sorted()[row];
483 if ( todo.priority() != pri ) { 486 if ( todo.priority() != pri ) {
484 todo.setPriority( pri ); 487 todo.setPriority( pri );
485 TodoView::update( todo.uid(), todo ); 488 TodoView::update( todo.uid(), todo );
486 updateView(); 489 updateView();
487 } 490 }
488 } 491 }
489 }else if ( col == 2) { 492 }else if ( col == 2) {
490 QWidget* wid = cellWidget(row, 2); 493 QWidget* wid = cellWidget(row, 2);
491 if ( wid->inherits("QLineEdit") ) { 494 if ( wid->inherits("QLineEdit") ) {
492 QString text = ((QLineEdit*)wid)->text(); 495 QString text = ((QLineEdit*)wid)->text();
493 OPimTodo todo = sorted()[row]; 496 OPimTodo todo = sorted()[row];
494 if ( todo.summary() != text ) { 497 if ( todo.summary() != text ) {
495 todo.setSummary( text ); 498 todo.setSummary( text );
496 TodoView::update( todo.uid(), todo ); 499 TodoView::update( todo.uid(), todo );
497 updateView(); 500 updateView();
498 } 501 }
499 } 502 }
500 } 503 }
501} 504}
502void TableView::slotPriority() { 505void TableView::slotPriority() {
503 setCellContentFromEditor( currentRow(), currentColumn() ); 506 setCellContentFromEditor( currentRow(), currentColumn() );
504} 507}
505/* 508/*
506 * We'll use the TimerEvent to read ahead or to keep the cahce always 509 * We'll use the TimerEvent to read ahead or to keep the cahce always
507 * filled enough. 510 * filled enough.
508 * We will try to read ahead 4 items in both ways 511 * We will try to read ahead 4 items in both ways
509 * up and down. On odd or even we will currentRow()+-4 or +-9 512 * up and down. On odd or even we will currentRow()+-4 or +-9
510 * 513 *
511 */ 514 */
512void TableView::timerEvent( QTimerEvent* ) { 515void TableView::timerEvent( QTimerEvent* ) {
513 if (sorted().count() == 0 ) 516 if (sorted().count() == 0 )
514 return; 517 return;
515 518
516 int row = currentRow(); 519 int row = currentRow();
517 if ( m_row ) { 520 if ( m_row ) {
518 int ro = row-4; 521 int ro = row-4;
519 if (ro < 0 ) ro = 0; 522 if (ro < 0 ) ro = 0;
520 sorted()[ro]; 523 sorted()[ro];
521 524
522 ro = row+4; 525 ro = row+4;
523 sorted()[ro]; 526 sorted()[ro];
524 } else { 527 } else {
525 int ro = row + 8; 528 int ro = row + 8;
526 sorted()[ro]; 529 sorted()[ro];
527 530
528 ro = row-8; 531 ro = row-8;
529 if (ro < 0 ) ro = 0; 532 if (ro < 0 ) ro = 0;
530 sorted()[ro]; 533 sorted()[ro];
531 } 534 }
532 535
533 m_row = !m_row; 536 m_row = !m_row;
534} 537}
535 538
536// We want a strike through completed ;) 539// We want a strike through completed ;)
537// durchstreichen to complete 540// durchstreichen to complete
538/* 541/*
539 * MouseTracking is off this mean we only receive 542 * MouseTracking is off this mean we only receive
540 * these events if the mouse button is pressed 543 * these events if the mouse button is pressed
541 * We've the previous point saved 544 * We've the previous point saved
542 * We check if the previous and current Point are 545 * We check if the previous and current Point are
543 * in the same row. 546 * in the same row.
544 * Then we check if they're some pixel horizontal away 547 * Then we check if they're some pixel horizontal away
545 * if the distance between the two points is greater than 548 * if the distance between the two points is greater than
546 * 8 we mark the underlying todo as completed and do a repaint 549 * 8 we mark the underlying todo as completed and do a repaint
547 * 550 *
548 * BUG: When clicking on the Due column and it's scrollable 551 * BUG: When clicking on the Due column and it's scrollable
549 * the todo is marked as completed... 552 * the todo is marked as completed...
550 * REASON: QTable is doing auto scrolling which leads to a move 553 * REASON: QTable is doing auto scrolling which leads to a move
551 * in the x coordinate and this way it's able to pass the 554 * in the x coordinate and this way it's able to pass the
552 * m_completeStrokeWidth criteria 555 * m_completeStrokeWidth criteria
553 * WORKAROUND: strike through needs to strike through the same 556 * WORKAROUND: strike through needs to strike through the same
554 * row and two columns! 557 * row and two columns!
555 */ 558 */
556void TableView::contentsMouseReleaseEvent( QMouseEvent *e ) { 559void TableView::contentsMouseReleaseEvent( QMouseEvent *e ) {
557 int row = rowAt(m_prevP.y()); 560 int row = rowAt(m_prevP.y());
558 int colOld = columnAt(m_prevP.x() ); 561 int colOld = columnAt(m_prevP.x() );
559 int colNew = columnAt(e->x() ); 562 int colNew = columnAt(e->x() );
560 if ( row == rowAt( e->y() ) && row != -1 && 563 if ( row == rowAt( e->y() ) && row != -1 &&
561 colOld != colNew ) { 564 colOld != colNew ) {
562 TodoView::complete( sorted()[row] ); 565 TodoView::complete( sorted()[row] );
563 return; 566 return;
564 } 567 }
565 QTable::contentsMouseReleaseEvent( e ); 568 QTable::contentsMouseReleaseEvent( e );
566} 569}
567void TableView::contentsMousePressEvent( QMouseEvent *e ) { 570void TableView::contentsMousePressEvent( QMouseEvent *e ) {
568 if ( e->button() == RightButton ) { 571 if ( e->button() == RightButton ) {
569 QPopupMenu *menu = todoWindow()->contextMenu( current(), sorted()[currentRow()].recurrence().doesRecur() ); 572 QPopupMenu *menu = todoWindow()->contextMenu( current(), sorted()[currentRow()].recurrence().doesRecur() );
570 menu->exec( QCursor::pos() ); 573 menu->exec( QCursor::pos() );
571 } 574 }
572 else { 575 else {
573 m_prevP = e->pos(); 576 m_prevP = e->pos();
574 QTable::contentsMousePressEvent( e ); 577 QTable::contentsMousePressEvent( e );
575 } 578 }
576} 579}
577void TableView::keyPressEvent( QKeyEvent* event) { 580void TableView::keyPressEvent( QKeyEvent* event) {
578 if ( m_editorWidget.cellWidget() ) { 581 if ( m_editorWidget.cellWidget() ) {
579// setCellContentFromEditor(m_editorWidget.cellRow(), m_editorWidget.cellCol() ); 582// setCellContentFromEditor(m_editorWidget.cellRow(), m_editorWidget.cellCol() );
580 endEdit(m_editorWidget.cellRow(), m_editorWidget.cellCol(), 583 endEdit(m_editorWidget.cellRow(), m_editorWidget.cellCol(),
581 true, true ); 584 true, true );
582 m_editorWidget.releaseCellWidget(); 585 m_editorWidget.releaseCellWidget();
583 setFocus(); 586 setFocus();
584 } 587 }
585 588
586 if ( sorted().count() < 1 ) { 589 if ( sorted().count() < 1 ) {
587 QTable::keyPressEvent( event ); 590 QTable::keyPressEvent( event );
588 return; 591 return;
589 } 592 }
590 593
591 int row = currentRow(); 594 int row = currentRow();
592 int col = currentColumn(); 595 int col = currentColumn();
593 596
594 char key = ::toupper( event->ascii() ); 597 char key = ::toupper( event->ascii() );
595 /* let QTable also handle the d letter */ 598 /* let QTable also handle the d letter */
596 if ( key == 'D' ) { 599 if ( key == 'D' ) {
597 event->accept(); 600 event->accept();
598 removeQuery( sorted().uidAt( row ) ); 601 removeQuery( sorted().uidAt( row ) );
599 return; 602 return;
600 } 603 }
601 604
602 605
603 switch( event->key() ) { 606 switch( event->key() ) {
604 case Qt::Key_F33: 607 case Qt::Key_F33:
605 case Qt::Key_Enter: 608 case Qt::Key_Enter:
606 case Qt::Key_Return: 609 case Qt::Key_Return:
607 case Qt::Key_Space: 610 case Qt::Key_Space:
608 if ( col == 0 ) { 611 if ( col == 0 ) {
609 TodoView::complete(sorted()[row]); 612 TodoView::complete(sorted()[row]);
610 }else if ( col == 1 ) { 613 }else if ( col == 1 ) {
611 QWidget* wid = beginEdit(row, col, FALSE ); 614 QWidget* wid = beginEdit(row, col, FALSE );
612 m_editorWidget.setCellWidget( wid, row, col ); 615 m_editorWidget.setCellWidget( wid, row, col );
613 }else if ( col == 2 ) { 616 }else if ( col == 2 ) {
614 showTodo( sorted().uidAt( currentRow() ) ); 617 showTodo( sorted().uidAt( currentRow() ) );
615 }else if ( col == 3 ) { 618 }else if ( col == 3 ) {
616 TodoView::edit( sorted().uidAt(row) ); 619 TodoView::edit( sorted().uidAt(row) );
617 } 620 }
618 event->accept(); 621 event->accept();
619 break; 622 break;
620 default: 623 default:
621 QTable::keyPressEvent( event ); 624 QTable::keyPressEvent( event );
622 } 625 }
623} 626}
624 627
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,124 +1,126 @@
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};
123 125
124#endif 126#endif
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,233 +1,238 @@
1/* 1/*
2               =. This file is part of the OPIE Project 2                 This file is part of the Opie Project
3             .=l. Copyright (c) 2002 <> 3
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();
197 202
198 OTimePickerDialog dialog; 203 OTimePickerDialog dialog;
199 dialog.setTime( dt.time() ); 204 dialog.setTime( dt.time() );
200 if ( dialog.exec() == QDialog::Accepted ) { 205 if ( dialog.exec() == QDialog::Accepted ) {
201 dt.setTime( dialog.time() ); 206 dt.setTime( dialog.time() );
202 al.setDateTime( dt ); 207 al.setDateTime( dt );
203 item->setAlarm( al ); 208 item->setAlarm( al );
204 } 209 }
205} 210}
206QPopupMenu* TaskEditorAlarms::popup( int column ) { 211QPopupMenu* TaskEditorAlarms::popup( int column ) {
207 QPopupMenu* pop = 0; 212 QPopupMenu* pop = 0;
208 switch( column ) { 213 switch( column ) {
209 case 0:{ 214 case 0:{
210 if (!m_date) { 215 if (!m_date) {
211 m_date = new QPopupMenu(this); 216 m_date = new QPopupMenu(this);
212 m_dbMonth = new DateBookMonth(m_date, 0, TRUE); 217 m_dbMonth = new DateBookMonth(m_date, 0, TRUE);
213 m_date->insertItem(m_dbMonth); 218 m_date->insertItem(m_dbMonth);
214 } 219 }
215 pop = m_date; 220 pop = m_date;
216 } 221 }
217 break; 222 break;
218 case 1: 223 case 1:
219 break; 224 break;
220 case 2:{ 225 case 2:{
221 if (!m_type) { 226 if (!m_type) {
222 m_type = new QPopupMenu(this); 227 m_type = new QPopupMenu(this);
223 m_type->insertItem( QObject::tr("loud"), 10 ); 228 m_type->insertItem( QObject::tr("loud"), 10 );
224 m_type->insertItem( QObject::tr("silent"), 20 ); 229 m_type->insertItem( QObject::tr("silent"), 20 );
225 } 230 }
226 pop = m_type; 231 pop = m_type;
227 } 232 }
228 break; 233 break;
229 default: 234 default:
230 break; 235 break;
231 } 236 }
232 return pop; 237 return pop;
233} 238}
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,175 +1,178 @@
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}
150 153
151void TaskEditorOverView::save( OPimTodo &todo ) 154void TaskEditorOverView::save( OPimTodo &todo )
152{ 155{
153 // Description 156 // Description
154 todo.setSummary( cmbDesc->currentText() ); 157 todo.setSummary( cmbDesc->currentText() );
155 158
156 // Priority 159 // Priority
157 todo.setPriority( cmbPriority->currentItem() + 1 ); 160 todo.setPriority( cmbPriority->currentItem() + 1 );
158 161
159 // Category 162 // Category
160 if ( cmbCategory->currentCategory() != -1 ) 163 if ( cmbCategory->currentCategory() != -1 )
161 { 164 {
162 QArray<int> arr = cmbCategory->currentCategories(); 165 QArray<int> arr = cmbCategory->currentCategories();
163 todo.setCategories( arr ); 166 todo.setCategories( arr );
164 } 167 }
165 168
166 // Recurrence - don't need to save here... 169 // Recurrence - don't need to save here...
167 170
168 // Notes 171 // Notes
169 todo.setDescription( mleNotes->text() ); 172 todo.setDescription( mleNotes->text() );
170} 173}
171 174
172void TaskEditorOverView::slotRecClicked() 175void TaskEditorOverView::slotRecClicked()
173{ 176{
174 emit recurranceEnabled( ckbRecurrence->isChecked() ); 177 emit recurranceEnabled( ckbRecurrence->isChecked() );
175} 178}
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,302 +1,304 @@
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
123 ckbComp = new QCheckBox( tr( "Completed:" ), container ); 125 ckbComp = new QCheckBox( tr( "Completed:" ), container );
124 layout->addWidget( ckbComp, 4, 0 ); 126 layout->addWidget( ckbComp, 4, 0 );
125 QWhatsThis::add( ckbComp, tr( "Click here to mark this task as completed." ) ); 127 QWhatsThis::add( ckbComp, tr( "Click here to mark this task as completed." ) );
126 connect( ckbComp, SIGNAL( clicked() ), this, SLOT( slotCompChecked() ) ); 128 connect( ckbComp, SIGNAL( clicked() ), this, SLOT( slotCompChecked() ) );
127 btnComp = new QPushButton( curDateStr, container ); 129 btnComp = new QPushButton( curDateStr, container );
128 btnComp->setEnabled( FALSE ); 130 btnComp->setEnabled( FALSE );
129 layout->addMultiCellWidget( btnComp, 4, 4, 1, 2 ); 131 layout->addMultiCellWidget( btnComp, 4, 4, 1, 2 );
130 QWhatsThis::add( btnComp, tr( "Click here to set the date this task was completed." ) ); 132 QWhatsThis::add( btnComp, tr( "Click here to set the date this task was completed." ) );
131 popup = new QPopupMenu( this ); 133 popup = new QPopupMenu( this );
132 m_compBook = new DateBookMonth( popup, 0, TRUE ); 134 m_compBook = new DateBookMonth( popup, 0, TRUE );
133 popup->insertItem( m_compBook ); 135 popup->insertItem( m_compBook );
134 btnComp->setPopup( popup ); 136 btnComp->setPopup( popup );
135 connect( m_compBook, SIGNAL( dateClicked(int,int,int) ), 137 connect( m_compBook, SIGNAL( dateClicked(int,int,int) ),
136 this, SLOT( slotCompChanged(int,int,int) ) ); 138 this, SLOT( slotCompChanged(int,int,int) ) );
137 139
138 QSpacerItem *spacer = new QSpacerItem( 5, 5, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding ); 140 QSpacerItem *spacer = new QSpacerItem( 5, 5, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding );
139 layout->addItem( spacer, 5, 0 ); 141 layout->addItem( spacer, 5, 0 );
140 142
141 // Maintainer mode 143 // Maintainer mode
142#if 0 144#if 0
143 label = new QLabel( tr( "Maintainer Mode:" ), container ); 145 label = new QLabel( tr( "Maintainer Mode:" ), container );
144 layout->addWidget( label, 6, 0 ); 146 layout->addWidget( label, 6, 0 );
145 QWhatsThis::add( label, tr( "Click here to set the maintainer's role." ) ); 147 QWhatsThis::add( label, tr( "Click here to set the maintainer's role." ) );
146 cmbMaintMode = new QComboBox( FALSE, container ); 148 cmbMaintMode = new QComboBox( FALSE, container );
147 cmbMaintMode->insertItem( tr( "Nothing" ) ); 149 cmbMaintMode->insertItem( tr( "Nothing" ) );
148 cmbMaintMode->insertItem( tr( "Responsible" ) ); 150 cmbMaintMode->insertItem( tr( "Responsible" ) );
149 cmbMaintMode->insertItem( tr( "Done By" ) ); 151 cmbMaintMode->insertItem( tr( "Done By" ) );
150 cmbMaintMode->insertItem( tr( "Coordinating" ) ); 152 cmbMaintMode->insertItem( tr( "Coordinating" ) );
151// layout->addMultiCellWidget( cmbMaintMode, 6, 6, 1, 2 ); 153// layout->addMultiCellWidget( cmbMaintMode, 6, 6, 1, 2 );
152 QWhatsThis::add( cmbMaintMode, tr( "Click here to set the maintainer's role." ) ); 154 QWhatsThis::add( cmbMaintMode, tr( "Click here to set the maintainer's role." ) );
153 155
154 // Maintainer 156 // Maintainer
155 label = new QLabel( tr( "Maintainer:" ), container ); 157 label = new QLabel( tr( "Maintainer:" ), container );
156 layout->addWidget( label, 7, 0 ); 158 layout->addWidget( label, 7, 0 );
157 QWhatsThis::add( label, tr( "This is the name of the current task maintainer." ) ); 159 QWhatsThis::add( label, tr( "This is the name of the current task maintainer." ) );
158 txtMaintainer = new QLabel( tr( "test" ), container ); 160 txtMaintainer = new QLabel( tr( "test" ), container );
159 txtMaintainer->setTextFormat( QLabel::RichText ); 161 txtMaintainer->setTextFormat( QLabel::RichText );
160 layout->addWidget( txtMaintainer, 7, 1 ); 162 layout->addWidget( txtMaintainer, 7, 1 );
161 QWhatsThis::add( txtMaintainer, tr( "This is the name of the current task maintainer." ) ); 163 QWhatsThis::add( txtMaintainer, tr( "This is the name of the current task maintainer." ) );
162 tbtMaintainer = new QToolButton( container ); 164 tbtMaintainer = new QToolButton( container );
163 tbtMaintainer->setPixmap( Resource::loadPixmap( "todo/more" ) ); 165 tbtMaintainer->setPixmap( Resource::loadPixmap( "todo/more" ) );
164// layout->addWidget( tbtMaintainer, 7, 2 ); 166// layout->addWidget( tbtMaintainer, 7, 2 );
165 QWhatsThis::add( tbtMaintainer, tr( "Click here to select the task maintainer." ) ); 167 QWhatsThis::add( tbtMaintainer, tr( "Click here to select the task maintainer." ) );
166#endif 168#endif
167} 169}
168 170
169TaskEditorStatus::~TaskEditorStatus() 171TaskEditorStatus::~TaskEditorStatus()
170{ 172{
171} 173}
172 174
173void TaskEditorStatus::load( const OPimTodo &todo ) 175void TaskEditorStatus::load( const OPimTodo &todo )
174{ 176{
175 QDate date = QDate::currentDate(); 177 QDate date = QDate::currentDate();
176 QString str = TimeString::longDateString( date ); 178 QString str = TimeString::longDateString( date );
177 179
178 // Status 180 // Status
179 int state = todo.hasState()? todo.state().state() : OPimState::NotStarted; 181 int state = todo.hasState()? todo.state().state() : OPimState::NotStarted;
180 if ( state == OPimState::Undefined ) 182 if ( state == OPimState::Undefined )
181 state = OPimState::NotStarted; 183 state = OPimState::NotStarted;
182 cmbStatus->setCurrentItem( state ); 184 cmbStatus->setCurrentItem( state );
183 185
184 // Progress 186 // Progress
185 cmbProgress->setCurrentItem( todo.progress() / 20 ); 187 cmbProgress->setCurrentItem( todo.progress() / 20 );
186 188
187 // Start date 189 // Start date
188 ckbStart->setChecked( todo.hasStartDate() ); 190 ckbStart->setChecked( todo.hasStartDate() );
189 btnStart->setEnabled( todo.hasStartDate() ); 191 btnStart->setEnabled( todo.hasStartDate() );
190 if ( todo.hasStartDate() ) 192 if ( todo.hasStartDate() )
191 { 193 {
192 m_start = todo.startDate(); 194 m_start = todo.startDate();
193 btnStart->setText( TimeString::longDateString( m_start ) ); 195 btnStart->setText( TimeString::longDateString( m_start ) );
194 } 196 }
195 else 197 else
196 btnStart->setText( str ); 198 btnStart->setText( str );
197 199
198 // Due date 200 // Due date
199 ckbDue->setChecked( todo.hasDueDate() ); 201 ckbDue->setChecked( todo.hasDueDate() );
200 btnDue->setText( TimeString::longDateString( todo.dueDate() ) ); 202 btnDue->setText( TimeString::longDateString( todo.dueDate() ) );
201 btnDue->setEnabled( todo.hasDueDate() ); 203 btnDue->setEnabled( todo.hasDueDate() );
202 m_due = todo.dueDate(); 204 m_due = todo.dueDate();
203 205
204 // Completed 206 // Completed
205 ckbComp->setChecked( todo.isCompleted() ); 207 ckbComp->setChecked( todo.isCompleted() );
206 btnComp->setEnabled( todo.hasCompletedDate() ); 208 btnComp->setEnabled( todo.hasCompletedDate() );
207 if ( todo.hasCompletedDate() ) 209 if ( todo.hasCompletedDate() )
208 { 210 {
209 m_comp = todo.completedDate(); 211 m_comp = todo.completedDate();
210 btnComp->setText( TimeString::longDateString( m_comp ) ); 212 btnComp->setText( TimeString::longDateString( m_comp ) );
211 } 213 }
212 else 214 else
213 btnComp->setText( str ); 215 btnComp->setText( str );
214 216
215 // Maintainer Mode 217 // Maintainer Mode
216#if 0 218#if 0
217 state = todo.hasMaintainer() ? todo.maintainer().mode() : OPimMaintainer::Nothing; 219 state = todo.hasMaintainer() ? todo.maintainer().mode() : OPimMaintainer::Nothing;
218 if ( state == OPimMaintainer::Undefined ) 220 if ( state == OPimMaintainer::Undefined )
219 state = OPimMaintainer::Nothing; 221 state = OPimMaintainer::Nothing;
220 cmbMaintMode->setCurrentItem( state ); 222 cmbMaintMode->setCurrentItem( state );
221#endif 223#endif
222 // Maintainer - not implemented yet 224 // Maintainer - not implemented yet
223} 225}
224 226
225void TaskEditorStatus::save( OPimTodo &todo ) 227void TaskEditorStatus::save( OPimTodo &todo )
226{ 228{
227 QDate inval; 229 QDate inval;
228 230
229 // Status 231 // Status
230 todo.setState( OPimState( cmbStatus->currentItem() ) ); 232 todo.setState( OPimState( cmbStatus->currentItem() ) );
231 233
232 // Progress 234 // Progress
233 todo.setProgress( cmbProgress->currentItem() * 20 ); 235 todo.setProgress( cmbProgress->currentItem() * 20 );
234 236
235 // Start date 237 // Start date
236 if ( ckbStart->isChecked() ) 238 if ( ckbStart->isChecked() )
237 { 239 {
238 todo.setStartDate( m_start ); 240 todo.setStartDate( m_start );
239 } 241 }
240 else 242 else
241 todo.setStartDate( inval ); 243 todo.setStartDate( inval );
242 244
243 // Due date 245 // Due date
244 if ( ckbDue->isChecked() ) 246 if ( ckbDue->isChecked() )
245 { 247 {
246 todo.setDueDate( m_due ); 248 todo.setDueDate( m_due );
247 todo.setHasDueDate( true ); 249 todo.setHasDueDate( true );
248 } 250 }
249 else 251 else
250 todo.setHasDueDate( false ); 252 todo.setHasDueDate( false );
251 253
252 // Completed 254 // Completed
253 todo.setCompleted( ckbComp->isChecked() ); 255 todo.setCompleted( ckbComp->isChecked() );
254 if ( ckbComp->isChecked() ) 256 if ( ckbComp->isChecked() )
255 { 257 {
256 todo.setCompletedDate( m_comp ); 258 todo.setCompletedDate( m_comp );
257 } 259 }
258 else 260 else
259 todo.setCompletedDate( inval ); 261 todo.setCompletedDate( inval );
260 262
261#if 0 263#if 0
262 // Maintainer mode - not implemented yet 264 // Maintainer mode - not implemented yet
263 265
264 // Maintainer 266 // Maintainer
265 /* TODO - resolve name to uid.....*/ 267 /* TODO - resolve name to uid.....*/
266 todo.setMaintainer( OPimMaintainer( cmbMaintMode->currentItem(), -10 ) ); 268 todo.setMaintainer( OPimMaintainer( cmbMaintMode->currentItem(), -10 ) );
267#endif 269#endif
268} 270}
269 271
270void TaskEditorStatus::slotStartChecked() 272void TaskEditorStatus::slotStartChecked()
271{ 273{
272 btnStart->setEnabled( ckbStart->isChecked() ); 274 btnStart->setEnabled( ckbStart->isChecked() );
273} 275}
274 276
275void TaskEditorStatus::slotCompChecked() 277void TaskEditorStatus::slotCompChecked()
276{ 278{
277 btnComp->setEnabled( ckbComp->isChecked() ); 279 btnComp->setEnabled( ckbComp->isChecked() );
278} 280}
279 281
280void TaskEditorStatus::slotDueChecked() 282void TaskEditorStatus::slotDueChecked()
281{ 283{
282 btnDue->setEnabled( ckbDue->isChecked() ); 284 btnDue->setEnabled( ckbDue->isChecked() );
283} 285}
284 286
285void TaskEditorStatus::slotStartChanged(int y, int m, int d) 287void TaskEditorStatus::slotStartChanged(int y, int m, int d)
286{ 288{
287 m_start.setYMD( y, m, d ); 289 m_start.setYMD( y, m, d );
288 btnStart->setText( TimeString::longDateString( m_start ) ); 290 btnStart->setText( TimeString::longDateString( m_start ) );
289} 291}
290 292
291void TaskEditorStatus::slotCompChanged(int y, int m, int d) 293void TaskEditorStatus::slotCompChanged(int y, int m, int d)
292{ 294{
293 m_comp.setYMD( y, m, d ); 295 m_comp.setYMD( y, m, d );
294 btnComp->setText( TimeString::longDateString( m_comp ) ); 296 btnComp->setText( TimeString::longDateString( m_comp ) );
295} 297}
296 298
297void TaskEditorStatus::slotDueChanged(int y, int m, int d) 299void TaskEditorStatus::slotDueChanged(int y, int m, int d)
298{ 300{
299 m_due.setYMD( y, m, d ); 301 m_due.setYMD( y, m, d );
300 btnDue->setText( TimeString::longDateString( m_due ) ); 302 btnDue->setText( TimeString::longDateString( m_due ) );
301 emit dueDateChanged( m_due ); 303 emit dueDateChanged( m_due );
302} 304}
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,127 +1,157 @@
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() ) {
97 item->setEvent( ev ); 127 item->setEvent( ev );
98 m_man->removeEvent( item->text() ); 128 m_man->removeEvent( item->text() );
99 m_man->addEvent( item->text(), ev ); 129 m_man->addEvent( item->text(), ev );
100 } 130 }
101} 131}
102/* 132/*
103 * we need to update 133 * we need to update
104 * the text 134 * the text
105 */ 135 */
106 136
107void TemplateDialogImpl::slotReturn() { 137void TemplateDialogImpl::slotReturn() {
108 if ( !listView()->currentItem() ) 138 if ( !listView()->currentItem() )
109 return; 139 return;
110 140
111 TemplateListItem* tbl = static_cast<TemplateListItem*>( listView()->currentItem() ); 141 TemplateListItem* tbl = static_cast<TemplateListItem*>( listView()->currentItem() );
112 142
113 if (tbl->text() != edit()->text() ) { 143 if (tbl->text() != edit()->text() ) {
114 m_man->removeEvent( tbl->text() ); 144 m_man->removeEvent( tbl->text() );
115 tbl->setText( edit()->text() ); 145 tbl->setText( edit()->text() );
116 m_man->addEvent( tbl->text(), tbl->event() ); 146 m_man->addEvent( tbl->text(), tbl->event() );
117 } 147 }
118} 148}
119/* update the lineedit when changing */ 149/* update the lineedit when changing */
120void TemplateDialogImpl::slotClicked( QListViewItem* item) { 150void TemplateDialogImpl::slotClicked( QListViewItem* item) {
121 if (!item) 151 if (!item)
122 return; 152 return;
123 153
124 TemplateListItem* tbl = static_cast<TemplateListItem*>(item); 154 TemplateListItem* tbl = static_cast<TemplateListItem*>(item);
125 edit()->setText( tbl->text() ); 155 edit()->setText( tbl->text() );
126} 156}
127 157
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,126 +1,128 @@
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) {
123 m_db = new OPimTodoAccess(); 125 m_db = new OPimTodoAccess();
124 m_db->load(); 126 m_db->load();
125 } 127 }
126} 128}
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,138 +1,140 @@
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 );
123 void update(int uid, const SmallTodo& to ); 125 void update(int uid, const SmallTodo& to );
124 void update(int uid, const OPimTodo& ev); 126 void update(int uid, const OPimTodo& ev);
125 void remove( int uid ); 127 void remove( int uid );
126 /* will ask the user if the item should be deleted */ 128 /* will ask the user if the item should be deleted */
127 void removeQuery(int uid ); 129 void removeQuery(int uid );
128 void complete( int uid ); 130 void complete( int uid );
129 void complete( const OPimTodo& ev ); 131 void complete( const OPimTodo& ev );
130 private: 132 private:
131 MainWindow *m_main; 133 MainWindow *m_main;
132 OPimTodoAccess::List m_sort; 134 OPimTodoAccess::List m_sort;
133 bool m_asc : 1; 135 bool m_asc : 1;
134 int m_sortOrder; 136 int m_sortOrder;
135 }; 137 };
136}; 138};
137 139
138#endif 140#endif