summaryrefslogtreecommitdiff
authorzecke <zecke>2002-10-13 19:09:09 (UTC)
committer zecke <zecke>2002-10-13 19:09:09 (UTC)
commit0762b201f248b9eaf3a08601b04484bec9a6d9a1 (patch) (unidiff)
tree5f386485a6b3b3e5c6edeeefdd26ef98ff924a34
parent34c1199becdb2f9b0447553e66c85d8f6770558f (diff)
downloadopie-0762b201f248b9eaf3a08601b04484bec9a6d9a1.zip
opie-0762b201f248b9eaf3a08601b04484bec9a6d9a1.tar.gz
opie-0762b201f248b9eaf3a08601b04484bec9a6d9a1.tar.bz2
Implement beaming and adding of todos. Use the vCal resource for that
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/todo/mainwindow.cpp52
-rw-r--r--core/pim/todo/mainwindow.h1
-rw-r--r--core/pim/todo/todo.pro2
3 files changed, 48 insertions, 7 deletions
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp
index c9c43d4..2994915 100644
--- a/core/pim/todo/mainwindow.cpp
+++ b/core/pim/todo/mainwindow.cpp
@@ -1,639 +1,679 @@
1/* 1/*
2               =. This file is part of the OPIE Project 2               =. This file is part of the OPIE Project
3             .=l. Copyright (c) 2002 <> 3             .=l. Copyright (c) 2002 <>
4           .>+-= 4           .>+-=
5 _;:,     .>    :=|. This program is free software; you can 5 _;:,     .>    :=|. This program is free software; you can
6.> <`_,   >  .   <= redistribute it and/or modify it under 6.> <`_,   >  .   <= redistribute it and/or modify it under
7:`=1 )Y*s>-.--   : the terms of the GNU General Public 7:`=1 )Y*s>-.--   : the terms of the GNU General Public
8.="- .-=="i,     .._ License as published by the Free Software 8.="- .-=="i,     .._ License as published by the Free Software
9 - .   .-<_>     .<> Foundation; either version 2 of the License, 9 - .   .-<_>     .<> Foundation; either version 2 of the License,
10     ._= =}       : or (at your option) any later version. 10     ._= =}       : or (at your option) any later version.
11    .%`+i>       _;_. 11    .%`+i>       _;_.
12    .i_,=:_.      -<s. This program is distributed in the hope that 12    .i_,=:_.      -<s. This program is distributed in the hope that
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
14    : ..    .:,     . . . without even the implied warranty of 14    : ..    .:,     . . . without even the implied warranty of
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
17..}^=.=       =       ; Library General Public License for more 17..}^=.=       =       ; Library General Public License for more
18++=   -.     .`     .: details. 18++=   -.     .`     .: details.
19 :     =  ...= . :.=- 19 :     =  ...= . :.=-
20 -.   .:....=;==+<; You should have received a copy of the GNU 20 -.   .:....=;==+<; You should have received a copy of the GNU
21  -_. . .   )=.  = General Public License along with 21  -_. . .   )=.  = General Public License along with
22    --        :-=` this library; see the file COPYING.LIB. 22    --        :-=` this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation, 23 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330, 24 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28 28
29#include <unistd.h>
30
29#include <qmenubar.h> 31#include <qmenubar.h>
30#include <qmessagebox.h> 32#include <qmessagebox.h>
31#include <qtoolbar.h> 33#include <qtoolbar.h>
32#include <qpopupmenu.h> 34#include <qpopupmenu.h>
33#include <qwidgetstack.h> 35#include <qwidgetstack.h>
34#include <qaction.h> 36#include <qaction.h>
35#include <qtimer.h> 37#include <qtimer.h>
36 38
39#include <qpe/applnk.h>
37#include <qpe/config.h> 40#include <qpe/config.h>
38#include <qpe/ir.h> 41#include <qpe/ir.h>
39#include <qpe/resource.h> 42#include <qpe/resource.h>
40#include <qpe/qpemessagebox.h> 43#include <qpe/qpemessagebox.h>
41 44
45#include <opie/otodoaccessvcal.h>
42 46
43#include "todotemplatemanager.h" 47#include "todotemplatemanager.h"
44#include "templateeditor.h" 48#include "templateeditor.h"
45#include "todoentryimpl.h" 49#include "todoentryimpl.h"
46#include "tableview.h" 50#include "tableview.h"
47 51
48#include "textviewshow.h" 52#include "textviewshow.h"
49#include "todoeditor.h" 53#include "todoeditor.h"
50#include "mainwindow.h" 54#include "mainwindow.h"
51 55
52 56
53using namespace Todo; 57using namespace Todo;
54 58
55MainWindow::MainWindow( QWidget* parent, 59MainWindow::MainWindow( QWidget* parent,
56 const char* name ) { 60 const char* name ) {
57 61
58 m_syncing = false; 62 m_syncing = false;
59 m_counter = 0; 63 m_counter = 0;
60 m_tempManager = new TemplateManager(); 64 m_tempManager = new TemplateManager();
61 m_tempManager->load(); 65 m_tempManager->load();
62 66
63 initUI(); 67 initUI();
64 initConfig(); 68 initConfig();
65 initViews(); 69 initViews();
66 initActions(); 70 initActions();
67 initEditor(); 71 initEditor();
68 initShow(); 72 initShow();
69 initTemplate(); 73 initTemplate();
70 74
71 populateTemplates(); 75 populateTemplates();
72 raiseCurrentView(); 76 raiseCurrentView();
73 QTimer::singleShot(0, this, SLOT(populateCategories() ) ); 77 QTimer::singleShot(0, this, SLOT(populateCategories() ) );
74} 78}
75void MainWindow::initTemplate() { 79void MainWindow::initTemplate() {
76 m_curTempEd = new TemplateEditor( this, templateManager() ); 80 m_curTempEd = new TemplateEditor( this, templateManager() );
77} 81}
78void MainWindow::initActions() { 82void MainWindow::initActions() {
79 QAction* a = new QAction( tr("New Task" ), Resource::loadPixmap( "new" ), 83 QAction* a = new QAction( tr("New Task" ), Resource::loadPixmap( "new" ),
80 QString::null, 0, this, 0 ); 84 QString::null, 0, this, 0 );
81 connect(a, SIGNAL( activated() ), 85 connect(a, SIGNAL( activated() ),
82 this, SLOT( slotNew() ) ); 86 this, SLOT( slotNew() ) );
83 a->addTo(m_tool ); 87 a->addTo(m_tool );
84 a->addTo(m_edit ); 88 a->addTo(m_edit );
85 89
86 a = new QAction( tr("Edit Task"), Resource::loadIconSet( "edit" ), 90 a = new QAction( tr("Edit Task"), Resource::loadIconSet( "edit" ),
87 QString::null, 0, this, 0 ); 91 QString::null, 0, this, 0 );
88 connect(a, SIGNAL(activated() ), 92 connect(a, SIGNAL(activated() ),
89 this, SLOT( slotEdit() ) ); 93 this, SLOT( slotEdit() ) );
90 a->addTo( m_tool ); 94 a->addTo( m_tool );
91 a->addTo( m_edit ); 95 a->addTo( m_edit );
92 m_editAction = a; 96 m_editAction = a;
93 97
94 a = new QAction( QString::null, tr("View Task"), 0, this, 0 ); 98 a = new QAction( QString::null, tr("View Task"), 0, this, 0 );
95 connect(a, SIGNAL( activated() ), 99 connect(a, SIGNAL( activated() ),
96 this, SLOT( slotShowDetails() ) ); 100 this, SLOT( slotShowDetails() ) );
97 a->addTo( m_edit ); 101 a->addTo( m_edit );
98 102
99 m_edit->insertSeparator(); 103 m_edit->insertSeparator();
100 104
101 a = new QAction( tr("Delete..."), Resource::loadIconSet( "trash" ), 105 a = new QAction( tr("Delete..."), Resource::loadIconSet( "trash" ),
102 QString::null, 0, this, 0 ); 106 QString::null, 0, this, 0 );
103 connect(a, SIGNAL(activated() ), 107 connect(a, SIGNAL(activated() ),
104 this, SLOT(slotDelete() ) ); 108 this, SLOT(slotDelete() ) );
105 a->addTo( m_tool ); 109 a->addTo( m_tool );
106 a->addTo( m_edit ); 110 a->addTo( m_edit );
107 m_deleteAction = a; 111 m_deleteAction = a;
108 112
109 a = new QAction( QString::null, tr("Delete all..."), 0, this, 0 ); 113 a = new QAction( QString::null, tr("Delete all..."), 0, this, 0 );
110 connect(a, SIGNAL( activated() ), 114 connect(a, SIGNAL( activated() ),
111 this, SLOT( slotDeleteAll() ) ); 115 this, SLOT( slotDeleteAll() ) );
112 a->addTo(m_edit ); 116 a->addTo(m_edit );
113 m_deleteAllAction = a; 117 m_deleteAllAction = a;
114 118
115 a = new QAction( QString::null, tr("Delete completed"), 119 a = new QAction( QString::null, tr("Delete completed"),
116 0, this, 0 ); 120 0, this, 0 );
117 connect(a, SIGNAL( activated() ), 121 connect(a, SIGNAL( activated() ),
118 this, SLOT( slotDeleteCompleted() ) ); 122 this, SLOT( slotDeleteCompleted() ) );
119 a->addTo(m_edit ); 123 a->addTo(m_edit );
120 a->setEnabled( TRUE ); 124 a->setEnabled( TRUE );
121 m_deleteCompleteAction = a; 125 m_deleteCompleteAction = a;
122 126
123 m_edit->insertSeparator(); 127 m_edit->insertSeparator();
124 128
125 a = new QAction( QString::null, tr("Duplicate"), 0, this, 0 ); 129 a = new QAction( QString::null, tr("Duplicate"), 0, this, 0 );
126 connect(a, SIGNAL( activated() ), 130 connect(a, SIGNAL( activated() ),
127 this, SLOT( slotDuplicate() ) ); 131 this, SLOT( slotDuplicate() ) );
128 a->addTo(m_edit ); 132 a->addTo(m_edit );
129 m_duplicateAction = a; 133 m_duplicateAction = a;
130 134
131 m_edit->insertSeparator(); 135 m_edit->insertSeparator();
132 136
133 if ( Ir::supported() ) { 137 if ( Ir::supported() ) {
134 a = new QAction( tr( "Beam" ), Resource::loadPixmap( "beam" ), 138 a = new QAction( tr( "Beam" ), Resource::loadPixmap( "beam" ),
135 QString::null, 0, this, 0 ); 139 QString::null, 0, this, 0 );
136 connect( a, SIGNAL( activated() ), 140 connect( a, SIGNAL( activated() ),
137 this, SLOT( slotBeam() ) ); 141 this, SLOT( slotBeam() ) );
138 a->addTo( m_edit ); 142 a->addTo( m_edit );
139 a->addTo( m_tool ); 143 a->addTo( m_tool );
140 } 144 }
141 145
142 a = new QAction( tr("Find"), Resource::loadIconSet( "mag" ), 146 a = new QAction( tr("Find"), Resource::loadIconSet( "mag" ),
143 QString::null, 0, this, 0 ); 147 QString::null, 0, this, 0 );
144 connect(a, SIGNAL( activated() ), 148 connect(a, SIGNAL( activated() ),
145 this, SLOT( slotFind() ) ); 149 this, SLOT( slotFind() ) );
146 a->addTo( m_options ); 150 a->addTo( m_options );
147 m_findAction = a; 151 m_findAction = a;
148 152
149 m_options->insertSeparator(); 153 m_options->insertSeparator();
150 154
151 m_completedAction = new QAction( QString::null, tr("Completed tasks"), 155 m_completedAction = new QAction( QString::null, tr("Completed tasks"),
152 0, this, 0, TRUE ); 156 0, this, 0, TRUE );
153 m_completedAction->addTo( m_options ); 157 m_completedAction->addTo( m_options );
154 m_completedAction->setOn( showCompleted() ); 158 m_completedAction->setOn( showCompleted() );
155 connect(m_completedAction, SIGNAL( toggled(bool) ), 159 connect(m_completedAction, SIGNAL( toggled(bool) ),
156 this, SLOT(slotShowCompleted(bool) ) ); 160 this, SLOT(slotShowCompleted(bool) ) );
157 161
158 m_showDeadLineAction = new QAction( QString::null, tr("Show Deadline"), 162 m_showDeadLineAction = new QAction( QString::null, tr("Show Deadline"),
159 0, this, 0, TRUE ); 163 0, this, 0, TRUE );
160 m_showDeadLineAction->addTo( m_options ); 164 m_showDeadLineAction->addTo( m_options );
161 m_showDeadLineAction->setOn( showDeadline() ); 165 m_showDeadLineAction->setOn( showDeadline() );
162 connect(m_showDeadLineAction, SIGNAL(toggled(bool) ), 166 connect(m_showDeadLineAction, SIGNAL(toggled(bool) ),
163 this, SLOT( slotShowDeadLine( bool ) ) ); 167 this, SLOT( slotShowDeadLine( bool ) ) );
164 168
165 m_options->insertSeparator(); 169 m_options->insertSeparator();
166 170
167 m_bar->insertItem( tr("Data") ,m_edit ); 171 m_bar->insertItem( tr("Data") ,m_edit );
168 m_bar->insertItem( tr("Category"), m_catMenu ); 172 m_bar->insertItem( tr("Category"), m_catMenu );
169 m_bar->insertItem( tr("Options"), m_options ); 173 m_bar->insertItem( tr("Options"), m_options );
170 174
171 /* initialize the view menu */ 175 /* initialize the view menu */
172 a = new QAction( QString::null, tr("Show over due"), 176 a = new QAction( QString::null, tr("Show over due"),
173 0, this, 0, TRUE ); 177 0, this, 0, TRUE );
174 a->addTo( m_view ); 178 a->addTo( m_view );
175 a->setOn( showOverDue() ); 179 a->setOn( showOverDue() );
176 connect(a, SIGNAL(toggled(bool)), 180 connect(a, SIGNAL(toggled(bool)),
177 this, SLOT(slotShowDue(bool) ) ); 181 this, SLOT(slotShowDue(bool) ) );
178 m_view->insertSeparator(); 182 m_view->insertSeparator();
179 183
180 m_bar->insertItem( tr("View"), m_view ); 184 m_bar->insertItem( tr("View"), m_view );
181 185
182 /* templates */ 186 /* templates */
183 m_edit->insertItem(tr("New from template"), m_template, 187 m_edit->insertItem(tr("New from template"), m_template,
184 -1, 0 ); 188 -1, 0 );
185 189
186} 190}
187/* m_curCat from Config */ 191/* m_curCat from Config */
188void MainWindow::initConfig() { 192void MainWindow::initConfig() {
189 Config config( "todo" ); 193 Config config( "todo" );
190 config.setGroup( "View" ); 194 config.setGroup( "View" );
191 m_completed = config.readBoolEntry( "ShowComplete", TRUE ); 195 m_completed = config.readBoolEntry( "ShowComplete", TRUE );
192 m_curCat = config.readEntry( "Category", QString::null ); 196 m_curCat = config.readEntry( "Category", QString::null );
193 m_deadline = config.readBoolEntry( "ShowDeadLine", TRUE); 197 m_deadline = config.readBoolEntry( "ShowDeadLine", TRUE);
194 m_overdue = config.readBoolEntry("ShowOverDue", TRUE ); 198 m_overdue = config.readBoolEntry("ShowOverDue", TRUE );
195} 199}
196void MainWindow::initUI() { 200void MainWindow::initUI() {
197 m_stack = new QWidgetStack(this, "main stack"); 201 m_stack = new QWidgetStack(this, "main stack");
198 setCentralWidget( m_stack ); 202 setCentralWidget( m_stack );
199 203
200 setToolBarsMovable( FALSE ); 204 setToolBarsMovable( FALSE );
201 205
202 m_tool = new QToolBar( this ); 206 m_tool = new QToolBar( this );
203 m_tool->setHorizontalStretchable( TRUE ); 207 m_tool->setHorizontalStretchable( TRUE );
204 208
205 m_bar = new QMenuBar( m_tool ); 209 m_bar = new QMenuBar( m_tool );
206 210
207 /** QPopupMenu */ 211 /** QPopupMenu */
208 m_edit = new QPopupMenu( this ); 212 m_edit = new QPopupMenu( this );
209 m_options = new QPopupMenu( this ); 213 m_options = new QPopupMenu( this );
210 m_view = new QPopupMenu( this ); 214 m_view = new QPopupMenu( this );
211 m_catMenu = new QPopupMenu( this ); 215 m_catMenu = new QPopupMenu( this );
212 m_template = new QPopupMenu( this ); 216 m_template = new QPopupMenu( this );
213 217
214 m_catMenu->setCheckable( TRUE ); 218 m_catMenu->setCheckable( TRUE );
215 m_template->setCheckable( TRUE ); 219 m_template->setCheckable( TRUE );
216 220
217 connect(m_catMenu, SIGNAL(activated(int) ), 221 connect(m_catMenu, SIGNAL(activated(int) ),
218 this, SLOT(setCategory(int) ) ); 222 this, SLOT(setCategory(int) ) );
219 connect(m_template, SIGNAL(activated(int) ), 223 connect(m_template, SIGNAL(activated(int) ),
220 this, SLOT(slotNewFromTemplate(int) ) ); 224 this, SLOT(slotNewFromTemplate(int) ) );
221} 225}
222void MainWindow::initViews() { 226void MainWindow::initViews() {
223 TableView* tableView = new TableView( this, this ); 227 TableView* tableView = new TableView( this, this );
224 m_stack->addWidget( tableView, m_counter++ ); 228 m_stack->addWidget( tableView, m_counter++ );
225 m_views.append( tableView ); 229 m_views.append( tableView );
226 m_curView = tableView; 230 m_curView = tableView;
227 connectBase( tableView ); 231 connectBase( tableView );
228 /* add QString type + QString configname to 232 /* add QString type + QString configname to
229 * the View menu 233 * the View menu
230 * and subdirs for multiple views 234 * and subdirs for multiple views
231 */ 235 */
232} 236}
233void MainWindow::initEditor() { 237void MainWindow::initEditor() {
234 m_curEdit = new Editor(); 238 m_curEdit = new Editor();
235} 239}
236void MainWindow::initShow() { 240void MainWindow::initShow() {
237 m_curShow = new TextViewShow(this); 241 m_curShow = new TextViewShow(this);
238 m_stack->addWidget( m_curShow->widget() , m_counter++ ); 242 m_stack->addWidget( m_curShow->widget() , m_counter++ );
239} 243}
240MainWindow::~MainWindow() { 244MainWindow::~MainWindow() {
241 delete templateManager(); 245 delete templateManager();
242} 246}
243void MainWindow::connectBase( ViewBase* base) { 247void MainWindow::connectBase( ViewBase* base) {
244 base->connectShow( this, SLOT(slotShow(int) ) ); 248 base->connectShow( this, SLOT(slotShow(int) ) );
245 base->connectEdit( this, SLOT(slotEdit(int) ) ); 249 base->connectEdit( this, SLOT(slotEdit(int) ) );
246 base->connectUpdateSmall( this, 250 base->connectUpdateSmall( this,
247 SLOT(slotUpate1(int, const Todo::SmallTodo&) )); 251 SLOT(slotUpate1(int, const Todo::SmallTodo&) ));
248 base->connectUpdateBig( this, 252 base->connectUpdateBig( this,
249 SLOT(slotUpate2(int, const OTodo& ) ) ); 253 SLOT(slotUpate2(int, const OTodo& ) ) );
250 base->connectUpdateView( this, SLOT(slotUpdate3( QWidget* ) ) ) ; 254 base->connectUpdateView( this, SLOT(slotUpdate3( QWidget* ) ) ) ;
251 base->connectRemove(&m_todoMgr, 255 base->connectRemove(&m_todoMgr,
252 SLOT(remove(int)) ); 256 SLOT(remove(int)) );
253} 257}
254QPopupMenu* MainWindow::contextMenu( int uid ) { 258QPopupMenu* MainWindow::contextMenu( int uid ) {
255 QPopupMenu* menu = new QPopupMenu(); 259 QPopupMenu* menu = new QPopupMenu();
256 260
257 m_editAction->addTo( menu ); 261 m_editAction->addTo( menu );
258 m_deleteAction->addTo( menu ); 262 m_deleteAction->addTo( menu );
259 m_duplicateAction->addTo( menu ); 263 m_duplicateAction->addTo( menu );
260 menu->insertSeparator(); 264 menu->insertSeparator();
261 265
262 return menu; 266 return menu;
263} 267}
264QPopupMenu* MainWindow::options() { 268QPopupMenu* MainWindow::options() {
265 qWarning("Options"); 269 qWarning("Options");
266 return m_options; 270 return m_options;
267} 271}
268QPopupMenu* MainWindow::edit() { 272QPopupMenu* MainWindow::edit() {
269 return m_edit; 273 return m_edit;
270} 274}
271QPopupMenu* MainWindow::view() { 275QPopupMenu* MainWindow::view() {
272 return m_view; 276 return m_view;
273} 277}
274QToolBar* MainWindow::toolbar() { 278QToolBar* MainWindow::toolbar() {
275 return m_tool; 279 return m_tool;
276} 280}
277OTodoAccess::List MainWindow::list()const { 281OTodoAccess::List MainWindow::list()const {
278 return m_todoMgr.list(); 282 return m_todoMgr.list();
279} 283}
280OTodoAccess::List MainWindow::sorted( bool asc, int sortOrder ) { 284OTodoAccess::List MainWindow::sorted( bool asc, int sortOrder ) {
281 int cat = 0; 285 int cat = 0;
282 if ( m_curCat != tr("All Categories") ) 286 if ( m_curCat != tr("All Categories") )
283 cat = currentCatId(); 287 cat = currentCatId();
284 288
285 int filter = 1; 289 int filter = 1;
286 290
287 if (!m_completed ) 291 if (!m_completed )
288 filter |= 4; 292 filter |= 4;
289 if (m_overdue) 293 if (m_overdue)
290 filter |= 2; 294 filter |= 2;
291 295
292 return m_todoMgr.sorted( asc, sortOrder, filter, cat ); 296 return m_todoMgr.sorted( asc, sortOrder, filter, cat );
293} 297}
294OTodoAccess::List MainWindow::sorted( bool asc, int sortOrder, int addFilter) { 298OTodoAccess::List MainWindow::sorted( bool asc, int sortOrder, int addFilter) {
295 int cat = 0; 299 int cat = 0;
296 if ( m_curCat != tr("All Categories") ) 300 if ( m_curCat != tr("All Categories") )
297 cat = currentCatId(); 301 cat = currentCatId();
298 302
299 return m_todoMgr.sorted(asc, sortOrder, addFilter, cat ); 303 return m_todoMgr.sorted(asc, sortOrder, addFilter, cat );
300} 304}
301OTodo MainWindow::event( int uid ) { 305OTodo MainWindow::event( int uid ) {
302 return m_todoMgr.event( uid ); 306 return m_todoMgr.event( uid );
303} 307}
304bool MainWindow::isSyncing()const { 308bool MainWindow::isSyncing()const {
305 return m_syncing; 309 return m_syncing;
306} 310}
307TemplateManager* MainWindow::templateManager() { 311TemplateManager* MainWindow::templateManager() {
308 return m_tempManager; 312 return m_tempManager;
309} 313}
310Editor* MainWindow::currentEditor() { 314Editor* MainWindow::currentEditor() {
311 return m_curEdit; 315 return m_curEdit;
312} 316}
313TodoShow* MainWindow::currentShow() { 317TodoShow* MainWindow::currentShow() {
314 return m_curShow; 318 return m_curShow;
315} 319}
316void MainWindow::slotReload() { 320void MainWindow::slotReload() {
317 m_todoMgr.reload(); 321 m_todoMgr.reload();
318 currentView()->updateView( ); 322 currentView()->updateView( );
319 raiseCurrentView(); 323 raiseCurrentView();
320} 324}
321void MainWindow::closeEvent( QCloseEvent* e ) { 325void MainWindow::closeEvent( QCloseEvent* e ) {
322 if (m_stack->visibleWidget() == currentShow()->widget() ) { 326 if (m_stack->visibleWidget() == currentShow()->widget() ) {
323 raiseCurrentView(); 327 raiseCurrentView();
324 e->ignore(); 328 e->ignore();
325 return; 329 return;
326 } 330 }
327 /* 331 /*
328 * we should have flushed and now we're still saving 332 * we should have flushed and now we're still saving
329 * so there is no need to flush 333 * so there is no need to flush
330 */ 334 */
331 if (m_syncing ) { 335 if (m_syncing ) {
332 e->accept(); 336 e->accept();
333 return; 337 return;
334 } 338 }
335 bool quit = false; 339 bool quit = false;
336 if ( m_todoMgr.saveAll() ){ 340 if ( m_todoMgr.saveAll() ){
337 qWarning("saved"); 341 qWarning("saved");
338 quit = true; 342 quit = true;
339 }else { 343 }else {
340 if ( QMessageBox::critical( this, tr("Out of space"), 344 if ( QMessageBox::critical( this, tr("Out of space"),
341 tr("Todo was unable\n" 345 tr("Todo was unable\n"
342 "to save your changes.\n" 346 "to save your changes.\n"
343 "Free up some space\n" 347 "Free up some space\n"
344 "and try again.\n" 348 "and try again.\n"
345 "\nQuit Anyway?"), 349 "\nQuit Anyway?"),
346 QMessageBox::Yes|QMessageBox::Escape, 350 QMessageBox::Yes|QMessageBox::Escape,
347 QMessageBox::No|QMessageBox::Default) 351 QMessageBox::No|QMessageBox::Default)
348 != QMessageBox::No ) { 352 != QMessageBox::No ) {
349 e->accept(); 353 e->accept();
350 quit = true; 354 quit = true;
351 }else 355 }else
352 e->ignore(); 356 e->ignore();
353 357
354 } 358 }
355 359
356 if (quit ) { 360 if (quit ) {
357 Config config( "todo" ); 361 Config config( "todo" );
358 config.setGroup( "View" ); 362 config.setGroup( "View" );
359 config.writeEntry( "ShowComplete", showCompleted() ); 363 config.writeEntry( "ShowComplete", showCompleted() );
360 config.writeEntry( "Category", currentCategory() ); 364 config.writeEntry( "Category", currentCategory() );
361 config.writeEntry( "ShowDeadLine", showDeadline()); 365 config.writeEntry( "ShowDeadLine", showDeadline());
362 config.writeEntry( "ShowOverDue", showOverDue() ); 366 config.writeEntry( "ShowOverDue", showOverDue() );
363 /* svae templates */ 367 /* svae templates */
364 templateManager()->save(); 368 templateManager()->save();
365 e->accept(); 369 e->accept();
366 } 370 }
367} 371}
368void MainWindow::populateTemplates() { 372void MainWindow::populateTemplates() {
369 m_template->clear(); 373 m_template->clear();
370 QStringList list = templateManager()->templates(); 374 QStringList list = templateManager()->templates();
371 QStringList::Iterator it; 375 QStringList::Iterator it;
372 for ( it = list.begin(); it != list.end(); ++it ) { 376 for ( it = list.begin(); it != list.end(); ++it ) {
373 m_template->insertItem( (*it) ); 377 m_template->insertItem( (*it) );
374 } 378 }
375} 379}
376/* 380/*
377 * slotNewFromTemplate 381 * slotNewFromTemplate
378 * We use the edit widget to do 382 * We use the edit widget to do
379 * the config but we setUid(-1) 383 * the config but we setUid(-1)
380 * to get a new uid 384 * to get a new uid
381 */ 385 */
382/* 386/*
383 * first we get the name of the template 387 * first we get the name of the template
384 * then we will use the TemplateManager 388 * then we will use the TemplateManager
385 */ 389 */
386void MainWindow::slotNewFromTemplate( int id ) { 390void MainWindow::slotNewFromTemplate( int id ) {
387 QString name = m_template->text( id ); 391 QString name = m_template->text( id );
388 392
389 OTodo event = templateManager()->templateEvent( name ); 393 OTodo event = templateManager()->templateEvent( name );
390 event = currentEditor()->edit(this, 394 event = currentEditor()->edit(this,
391 event ); 395 event );
392 396
393 if ( currentEditor()->accepted() ) { 397 if ( currentEditor()->accepted() ) {
394 /* assign new todo */ 398 /* assign new todo */
395 event.setUid( -1 ); 399 event.setUid( -1 );
396 currentView()->addEvent( event ); 400 currentView()->addEvent( event );
397 m_todoMgr.add( event ); 401 m_todoMgr.add( event );
398 402
399 populateCategories(); 403 populateCategories();
400 } 404 }
401} 405}
402void MainWindow::slotNew() { 406void MainWindow::slotNew() {
403 if(m_syncing) { 407 if(m_syncing) {
404 QMessageBox::warning(this, tr("Todo"), 408 QMessageBox::warning(this, tr("Todo"),
405 tr("Can not edit data, currently syncing")); 409 tr("Can not edit data, currently syncing"));
406 return; 410 return;
407 } 411 }
408 412
409 413
410 OTodo todo = currentEditor()->newTodo( currentCatId(), 414 OTodo todo = currentEditor()->newTodo( currentCatId(),
411 this ); 415 this );
412 416
413 if ( currentEditor()->accepted() ) { 417 if ( currentEditor()->accepted() ) {
414 //todo.assignUid(); 418 //todo.assignUid();
415 currentView()->addEvent( todo ); 419 currentView()->addEvent( todo );
416 m_todoMgr.add( todo ); 420 m_todoMgr.add( todo );
417 421
418 // I'm afraid we must call this every time now, otherwise 422 // I'm afraid we must call this every time now, otherwise
419 // spend expensive time comparing all these strings... 423 // spend expensive time comparing all these strings...
420 // but only call if we changed something -zecke 424 // but only call if we changed something -zecke
421 populateCategories(); 425 populateCategories();
422 } 426 }
423 raiseCurrentView( ); 427 raiseCurrentView( );
424} 428}
425void MainWindow::slotDuplicate() { 429void MainWindow::slotDuplicate() {
426 if(m_syncing) { 430 if(m_syncing) {
427 QMessageBox::warning(this, tr("Todo"), 431 QMessageBox::warning(this, tr("Todo"),
428 tr("Can not edit data, currently syncing")); 432 tr("Can not edit data, currently syncing"));
429 return; 433 return;
430 } 434 }
431 OTodo ev = m_todoMgr.event( currentView()->current() ); 435 OTodo ev = m_todoMgr.event( currentView()->current() );
432 /* let's generate a new uid */ 436 /* let's generate a new uid */
433 ev.setUid(-1); 437 ev.setUid(-1);
434 m_todoMgr.add( ev ); 438 m_todoMgr.add( ev );
435 439
436 currentView()->addEvent( ev ); 440 currentView()->addEvent( ev );
437 raiseCurrentView(); 441 raiseCurrentView();
438} 442}
439void MainWindow::slotDelete() { 443void MainWindow::slotDelete() {
440 if (!currentView()->current() ) 444 if (!currentView()->current() )
441 return; 445 return;
442 446
443 if(m_syncing) { 447 if(m_syncing) {
444 QMessageBox::warning(this, tr("Todo"), 448 QMessageBox::warning(this, tr("Todo"),
445 tr("Can not edit data, currently syncing")); 449 tr("Can not edit data, currently syncing"));
446 return; 450 return;
447 } 451 }
448 QString strName = currentView()->currentRepresentation(); 452 QString strName = currentView()->currentRepresentation();
449 if (!QPEMessageBox::confirmDelete(this, tr("Todo"), strName ) ) 453 if (!QPEMessageBox::confirmDelete(this, tr("Todo"), strName ) )
450 return; 454 return;
451 455
452 m_todoMgr.remove( currentView()->current() ); 456 m_todoMgr.remove( currentView()->current() );
453 currentView()->removeEvent( currentView()->current() ); 457 currentView()->removeEvent( currentView()->current() );
454 raiseCurrentView(); 458 raiseCurrentView();
455} 459}
456void MainWindow::slotDeleteAll() { 460void MainWindow::slotDeleteAll() {
457 if(m_syncing) { 461 if(m_syncing) {
458 QMessageBox::warning(this, tr("Todo"), 462 QMessageBox::warning(this, tr("Todo"),
459 tr("Can not edit data, currently syncing")); 463 tr("Can not edit data, currently syncing"));
460 return; 464 return;
461 } 465 }
462 466
463 //QString strName = table->text( table->currentRow(), 2 ).left( 30 ); 467 //QString strName = table->text( table->currentRow(), 2 ).left( 30 );
464 468
465 if ( !QPEMessageBox::confirmDelete( this, tr( "Todo" ), tr("all tasks?") ) ) 469 if ( !QPEMessageBox::confirmDelete( this, tr( "Todo" ), tr("all tasks?") ) )
466 return; 470 return;
467 471
468 m_todoMgr.removeAll(); 472 m_todoMgr.removeAll();
469 currentView()->clear(); 473 currentView()->clear();
470 474
471 raiseCurrentView(); 475 raiseCurrentView();
472} 476}
473void MainWindow::slotDeleteCompleted() { 477void MainWindow::slotDeleteCompleted() {
474 if(m_syncing) { 478 if(m_syncing) {
475 QMessageBox::warning(this, tr("Todo"), 479 QMessageBox::warning(this, tr("Todo"),
476 tr("Can not edit data, currently syncing")); 480 tr("Can not edit data, currently syncing"));
477 return; 481 return;
478 } 482 }
479 483
480 if ( !QPEMessageBox::confirmDelete( this, tr( "Todo" ), tr("all completed tasks?") ) ) 484 if ( !QPEMessageBox::confirmDelete( this, tr( "Todo" ), tr("all completed tasks?") ) )
481 return; 485 return;
482 486
483 // FIXME 487 // FIXME
484 //m_todoMgr.remove( currentView()->completed() ); 488 //m_todoMgr.remove( currentView()->completed() );
485 currentView()->updateView( ); 489 currentView()->updateView( );
486} 490}
487void MainWindow::slotFind() { 491void MainWindow::slotFind() {
488 492
489} 493}
490void MainWindow::slotEdit() { 494void MainWindow::slotEdit() {
491 slotEdit( currentView()->current() ); 495 slotEdit( currentView()->current() );
492} 496}
493/* 497/*
494 * set the category 498 * set the category
495 */ 499 */
496void MainWindow::setCategory( int c) { 500void MainWindow::setCategory( int c) {
497 if ( c <= 0 ) return; 501 if ( c <= 0 ) return;
498 502
499 503
500 qWarning("Iterating over cats %d", c ); 504 qWarning("Iterating over cats %d", c );
501 for ( unsigned int i = 1; i < m_catMenu->count(); i++ ) 505 for ( unsigned int i = 1; i < m_catMenu->count(); i++ )
502 m_catMenu->setItemChecked(i, c == (int)i ); 506 m_catMenu->setItemChecked(i, c == (int)i );
503 507
504 if (c == 1 ) { 508 if (c == 1 ) {
505 m_curCat = QString::null; 509 m_curCat = QString::null;
506 setCaption( tr("Todo") + " - " + tr("All Categories" ) ); 510 setCaption( tr("Todo") + " - " + tr("All Categories" ) );
507 511
508 }else if ( c == (int)m_catMenu->count() - 1 ) { 512 }else if ( c == (int)m_catMenu->count() - 1 ) {
509 m_curCat = tr("Unfiled"); 513 m_curCat = tr("Unfiled");
510 setCaption( tr("Todo") + " - " + tr("Unfiled") ); 514 setCaption( tr("Todo") + " - " + tr("Unfiled") );
511 }else { 515 }else {
512 m_curCat = m_todoMgr.categories()[c-2]; 516 m_curCat = m_todoMgr.categories()[c-2];
513 setCaption( tr("Todo") + " - " + m_curCat ); 517 setCaption( tr("Todo") + " - " + m_curCat );
514 } 518 }
515 m_catMenu->setItemChecked( c, true ); 519 m_catMenu->setItemChecked( c, true );
516 520
517 currentView()->setShowCategory( m_curCat ); 521 currentView()->setShowCategory( m_curCat );
518 raiseCurrentView(); 522 raiseCurrentView();
519} 523}
520void MainWindow::slotShowDeadLine( bool dead) { 524void MainWindow::slotShowDeadLine( bool dead) {
521 m_deadline = dead; 525 m_deadline = dead;
522 currentView()->setShowDeadline( dead ); 526 currentView()->setShowDeadline( dead );
523} 527}
524void MainWindow::slotShowCompleted( bool show) { 528void MainWindow::slotShowCompleted( bool show) {
525 m_completed = show; 529 m_completed = show;
526 currentView()->setShowCompleted( m_completed ); 530 currentView()->setShowCompleted( m_completed );
527} 531}
528bool MainWindow::showOverDue()const { 532bool MainWindow::showOverDue()const {
529 return m_overdue; 533 return m_overdue;
530} 534}
531void MainWindow::setDocument( const QString& ) { 535void MainWindow::setDocument( const QString& fi) {
532 536 DocLnk doc(fi);
537 if (doc.isValid() )
538 receiveFile(doc.file() );
539 else
540 receiveFile(fi );
533} 541}
534void MainWindow::slotBeam() {
535
536}
537void MainWindow::beamDone( Ir* ) {
538 542
543static const char *beamfile = "/tmp/opie-todo.vcs";
544void MainWindow::slotBeam() {
545 ::unlink( beamfile );
546 OTodo todo = event( currentView()->current() );
547 OTodoAccessVCal* cal = new OTodoAccessVCal(QString::fromLatin1(beamfile) );
548 OTodoAccess acc( cal );
549 acc.load();
550 acc.add( todo );
551 acc.save();
552 Ir* ir = new Ir(this );
553 connect(ir, SIGNAL(done(Ir*) ),
554 this, SLOT(beamDone(Ir*) ) );
555 ir->send( beamfile, todo.summary(), "text/x-vCalendar" );
556
557}
558void MainWindow::beamDone( Ir* ir) {
559 delete ir;
560 ::unlink( beamfile );
561}
562void MainWindow::receiveFile( const QString& filename ) {
563 OTodoAccessVCal* cal = new OTodoAccessVCal(filename );
564 OTodoAccess acc( cal );
565 acc.load();
566 OTodoAccess::List list = acc.allRecords();
567
568 QString message = tr("<P>%1 new tasks arrived.<p>Would you like to add them to your Todolist?").arg(list.count() );
569
570 if ( QMessageBox::information(this, tr("New Tasks"),
571 message, QMessageBox::Ok,
572 QMessageBox::Cancel ) == QMessageBox::Ok ) {
573 OTodoAccess::List::Iterator it;
574 for ( it = list.begin(); it != list.end(); ++it )
575 m_todoMgr.add( (*it) );
576
577 currentView()->updateView();
578 }
539} 579}
540 580
541void MainWindow::slotFlush() { 581void MainWindow::slotFlush() {
542 m_syncing = FALSE; 582 m_syncing = FALSE;
543 m_todoMgr.save(); 583 m_todoMgr.save();
544} 584}
545void MainWindow::slotShowDetails() { 585void MainWindow::slotShowDetails() {
546 slotShow( currentView()->current() ); 586 slotShow( currentView()->current() );
547} 587}
548/* 588/*
549 * populate the Categories 589 * populate the Categories
550 * Menu 590 * Menu
551 */ 591 */
552void MainWindow::populateCategories() { 592void MainWindow::populateCategories() {
553 m_todoMgr.load(); 593 m_todoMgr.load();
554 594
555 m_catMenu->clear(); 595 m_catMenu->clear();
556 int id, rememberId; 596 int id, rememberId;
557 id = 1; 597 id = 1;
558 rememberId = 1; 598 rememberId = 1;
559 599
560 m_catMenu->insertItem( tr( "All Categories" ), id++ ); 600 m_catMenu->insertItem( tr( "All Categories" ), id++ );
561 m_catMenu->insertSeparator(); 601 m_catMenu->insertSeparator();
562 QStringList categories = m_todoMgr.categories(); 602 QStringList categories = m_todoMgr.categories();
563 categories.append( tr( "Unfiled" ) ); 603 categories.append( tr( "Unfiled" ) );
564 for ( QStringList::Iterator it = categories.begin(); 604 for ( QStringList::Iterator it = categories.begin();
565 it != categories.end(); ++it ) { 605 it != categories.end(); ++it ) {
566 m_catMenu->insertItem( *it, id ); 606 m_catMenu->insertItem( *it, id );
567 if ( *it == currentCategory() ) 607 if ( *it == currentCategory() )
568 rememberId = id; 608 rememberId = id;
569 ++id; 609 ++id;
570 } 610 }
571 setCategory( rememberId ); 611 setCategory( rememberId );
572} 612}
573bool MainWindow::showCompleted()const { 613bool MainWindow::showCompleted()const {
574 return m_completed; 614 return m_completed;
575} 615}
576bool MainWindow::showDeadline()const { 616bool MainWindow::showDeadline()const {
577 return m_deadline; 617 return m_deadline;
578} 618}
579QString MainWindow::currentCategory()const { 619QString MainWindow::currentCategory()const {
580 return m_curCat; 620 return m_curCat;
581} 621}
582int MainWindow::currentCatId() { 622int MainWindow::currentCatId() {
583 return m_todoMgr.catId( m_curCat ); 623 return m_todoMgr.catId( m_curCat );
584} 624}
585ViewBase* MainWindow::currentView() { 625ViewBase* MainWindow::currentView() {
586 return m_curView; 626 return m_curView;
587} 627}
588void MainWindow::raiseCurrentView() { 628void MainWindow::raiseCurrentView() {
589 m_stack->raiseWidget( m_curView->widget() ); 629 m_stack->raiseWidget( m_curView->widget() );
590} 630}
591void MainWindow::slotShowDue(bool ov) { 631void MainWindow::slotShowDue(bool ov) {
592 m_overdue = ov; 632 m_overdue = ov;
593 currentView()->showOverDue( ov ); 633 currentView()->showOverDue( ov );
594 raiseCurrentView(); 634 raiseCurrentView();
595} 635}
596void MainWindow::slotShow( int uid ) { 636void MainWindow::slotShow( int uid ) {
597 qWarning("slotShow"); 637 qWarning("slotShow");
598 currentShow()->slotShow( event( uid ) ); 638 currentShow()->slotShow( event( uid ) );
599 m_stack->raiseWidget( currentShow()->widget() ); 639 m_stack->raiseWidget( currentShow()->widget() );
600} 640}
601void MainWindow::slotEdit( int uid ) { 641void MainWindow::slotEdit( int uid ) {
602 if(m_syncing) { 642 if(m_syncing) {
603 QMessageBox::warning(this, tr("Todo"), 643 QMessageBox::warning(this, tr("Todo"),
604 tr("Can not edit data, currently syncing")); 644 tr("Can not edit data, currently syncing"));
605 return; 645 return;
606 } 646 }
607 647
608 OTodo todo = m_todoMgr.event( uid ); 648 OTodo todo = m_todoMgr.event( uid );
609 649
610 todo = currentEditor()->edit(this, todo ); 650 todo = currentEditor()->edit(this, todo );
611 651
612 /* if completed */ 652 /* if completed */
613 if ( currentEditor()->accepted() ) { 653 if ( currentEditor()->accepted() ) {
614 qWarning("Replacing now" ); 654 qWarning("Replacing now" );
615 m_todoMgr.update( todo.uid(), todo ); 655 m_todoMgr.update( todo.uid(), todo );
616 currentView()->replaceEvent( todo ); 656 currentView()->replaceEvent( todo );
617 /* a Category might have changed */ 657 /* a Category might have changed */
618 populateCategories(); 658 populateCategories();
619 } 659 }
620 660
621 raiseCurrentView(); 661 raiseCurrentView();
622} 662}
623/* 663/*
624void MainWindow::slotUpdate1( int uid, const SmallTodo& ev) { 664void MainWindow::slotUpdate1( int uid, const SmallTodo& ev) {
625 m_todoMgr.update( uid, ev ); 665 m_todoMgr.update( uid, ev );
626} 666}
627*/ 667*/
628void MainWindow::updateTodo( const OTodo& ev) { 668void MainWindow::updateTodo( const OTodo& ev) {
629 m_todoMgr.update( ev.uid() , ev ); 669 m_todoMgr.update( ev.uid() , ev );
630} 670}
631/* The view changed it's configuration 671/* The view changed it's configuration
632 * update the view menu 672 * update the view menu
633 */ 673 */
634void MainWindow::slotUpdate3( QWidget* ) { 674void MainWindow::slotUpdate3( QWidget* ) {
635 675
636} 676}
637void MainWindow::updateList() { 677void MainWindow::updateList() {
638 m_todoMgr.updateList(); 678 m_todoMgr.updateList();
639} 679}
diff --git a/core/pim/todo/mainwindow.h b/core/pim/todo/mainwindow.h
index 598c3af..8d0c29f 100644
--- a/core/pim/todo/mainwindow.h
+++ b/core/pim/todo/mainwindow.h
@@ -1,175 +1,176 @@
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             .=l. Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
4           .>+-= 4           .>+-=
5 _;:,     .>    :=|. This program is free software; you can 5 _;:,     .>    :=|. This program is free software; you can
6.> <`_,   >  .   <= redistribute it and/or modify it under 6.> <`_,   >  .   <= redistribute it and/or modify it under
7:`=1 )Y*s>-.--   : the terms of the GNU General Public 7:`=1 )Y*s>-.--   : the terms of the GNU General Public
8.="- .-=="i,     .._ License as published by the Free Software 8.="- .-=="i,     .._ License as published by the Free Software
9 - .   .-<_>     .<> Foundation; either version 2 of the License, 9 - .   .-<_>     .<> Foundation; either version 2 of the License,
10     ._= =}       : or (at your option) any later version. 10     ._= =}       : or (at your option) any later version.
11    .%`+i>       _;_. 11    .%`+i>       _;_.
12    .i_,=:_.      -<s. This program is distributed in the hope that 12    .i_,=:_.      -<s. This program is distributed in the hope that
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
14    : ..    .:,     . . . without even the implied warranty of 14    : ..    .:,     . . . without even the implied warranty of
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
17..}^=.=       =       ; Library General Public License for more 17..}^=.=       =       ; Library General Public License for more
18++=   -.     .`     .: details. 18++=   -.     .`     .: details.
19 :     =  ...= . :.=- 19 :     =  ...= . :.=-
20 -.   .:....=;==+<; You should have received a copy of the GNU 20 -.   .:....=;==+<; You should have received a copy of the GNU
21  -_. . .   )=.  = Library General Public License along with 21  -_. . .   )=.  = Library General Public License along with
22    --        :-=` this library; see the file COPYING.LIB. 22    --        :-=` this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation, 23 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330, 24 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28 28
29#ifndef TODO_MAIN_WINDOW_H 29#ifndef TODO_MAIN_WINDOW_H
30#define TODO_MAIN_WINDOW_H 30#define TODO_MAIN_WINDOW_H
31 31
32#include <qlist.h> 32#include <qlist.h>
33#include <qmainwindow.h> 33#include <qmainwindow.h>
34 34
35#include <opie/otodoaccess.h> 35#include <opie/otodoaccess.h>
36#include <opie/otodo.h> 36#include <opie/otodo.h>
37 37
38#include "smalltodo.h" 38#include "smalltodo.h"
39#include "todoview.h" 39#include "todoview.h"
40#include "todomanager.h" 40#include "todomanager.h"
41 41
42class QPopupMenu; 42class QPopupMenu;
43class QMenuBar; 43class QMenuBar;
44class QToolBar; 44class QToolBar;
45class QAction; 45class QAction;
46class QWidgetStack; 46class QWidgetStack;
47class Ir; 47class Ir;
48 48
49 49
50namespace Todo { 50namespace Todo {
51 typedef TodoView View; 51 typedef TodoView View;
52 class TemplateManager; 52 class TemplateManager;
53 class Editor; 53 class Editor;
54 class TodoShow; 54 class TodoShow;
55 class TemplateEditor; 55 class TemplateEditor;
56 56
57 class MainWindow : public QMainWindow { 57 class MainWindow : public QMainWindow {
58 Q_OBJECT 58 Q_OBJECT
59 public: 59 public:
60 MainWindow( QWidget *parent = 0, 60 MainWindow( QWidget *parent = 0,
61 const char* name = 0 ); 61 const char* name = 0 );
62 ~MainWindow(); 62 ~MainWindow();
63 63
64 /** return a context menu for an OTodo */ 64 /** return a context menu for an OTodo */
65 QPopupMenu* contextMenu(int uid ); 65 QPopupMenu* contextMenu(int uid );
66 QPopupMenu* options(); 66 QPopupMenu* options();
67 QPopupMenu* edit(); 67 QPopupMenu* edit();
68 QPopupMenu* view(); 68 QPopupMenu* view();
69 QToolBar* toolbar(); 69 QToolBar* toolbar();
70 70
71 71
72 void updateList(); 72 void updateList();
73 OTodoAccess::List list()const; 73 OTodoAccess::List list()const;
74 OTodoAccess::List sorted( bool asc, int sortOrder ); 74 OTodoAccess::List sorted( bool asc, int sortOrder );
75 OTodoAccess::List sorted( bool asc, int sortOrder, int addFilter ); 75 OTodoAccess::List sorted( bool asc, int sortOrder, int addFilter );
76 76
77 OTodo event(int uid ); 77 OTodo event(int uid );
78 78
79 bool isSyncing()const; 79 bool isSyncing()const;
80 bool showCompleted()const; 80 bool showCompleted()const;
81 bool showDeadline()const; 81 bool showDeadline()const;
82 bool showOverDue()const; 82 bool showOverDue()const;
83 QString currentCategory()const; 83 QString currentCategory()const;
84 int currentCatId(); 84 int currentCatId();
85 TemplateManager* templateManager(); 85 TemplateManager* templateManager();
86 86
87 void updateTodo( const OTodo& ); 87 void updateTodo( const OTodo& );
88 void populateTemplates(); 88 void populateTemplates();
89 Editor* currentEditor(); 89 Editor* currentEditor();
90private slots: 90private slots:
91 void populateCategories(); 91 void populateCategories();
92 void slotReload(); 92 void slotReload();
93 void slotFlush(); 93 void slotFlush();
94 94
95 protected: 95 protected:
96 void closeEvent( QCloseEvent* e ); 96 void closeEvent( QCloseEvent* e );
97 97
98 private: 98 private:
99 void receiveFile( const QString& filename );
99 void connectBase( ViewBase* ); 100 void connectBase( ViewBase* );
100 void initUI(); 101 void initUI();
101 void initActions(); 102 void initActions();
102 void initConfig(); 103 void initConfig();
103 void initViews(); 104 void initViews();
104 void initEditor(); 105 void initEditor();
105 void initShow(); 106 void initShow();
106 void initTemplate(); 107 void initTemplate();
107 void raiseCurrentView(); 108 void raiseCurrentView();
108 ViewBase* currentView(); 109 ViewBase* currentView();
109 ViewBase* m_curView; 110 ViewBase* m_curView;
110 Editor* m_curEdit; 111 Editor* m_curEdit;
111 TodoShow* currentShow(); 112 TodoShow* currentShow();
112 TodoShow* m_curShow; 113 TodoShow* m_curShow;
113 TemplateEditor* currentTemplateEditor(); 114 TemplateEditor* currentTemplateEditor();
114 TemplateEditor* m_curTempEd; 115 TemplateEditor* m_curTempEd;
115 116
116 QMenuBar* m_bar; 117 QMenuBar* m_bar;
117 QToolBar* m_tool; 118 QToolBar* m_tool;
118 QAction* m_editAction, 119 QAction* m_editAction,
119 *m_deleteAction, 120 *m_deleteAction,
120 *m_findAction, 121 *m_findAction,
121 *m_completedAction, 122 *m_completedAction,
122 *m_showDeadLineAction, 123 *m_showDeadLineAction,
123 *m_deleteAllAction, 124 *m_deleteAllAction,
124 *m_deleteCompleteAction, 125 *m_deleteCompleteAction,
125 *m_duplicateAction, 126 *m_duplicateAction,
126 *m_showOverDueAction, 127 *m_showOverDueAction,
127 *m_effectiveAction; 128 *m_effectiveAction;
128 QWidgetStack *m_stack; 129 QWidgetStack *m_stack;
129 QPopupMenu* m_catMenu, 130 QPopupMenu* m_catMenu,
130 *m_edit, 131 *m_edit,
131 *m_options, 132 *m_options,
132 *m_view, 133 *m_view,
133 *m_template; 134 *m_template;
134 135
135 bool m_syncing:1; 136 bool m_syncing:1;
136 bool m_deadline:1; 137 bool m_deadline:1;
137 bool m_completed:1; 138 bool m_completed:1;
138 bool m_overdue:1; 139 bool m_overdue:1;
139 TodoManager m_todoMgr; 140 TodoManager m_todoMgr;
140 QString m_curCat; 141 QString m_curCat;
141 QList<ViewBase> m_views; 142 QList<ViewBase> m_views;
142 uint m_counter; 143 uint m_counter;
143 TemplateManager* m_tempManager; 144 TemplateManager* m_tempManager;
144 145
145 private slots: 146 private slots:
146 void slotShow(int); 147 void slotShow(int);
147 void slotEdit(int); 148 void slotEdit(int);
148private slots: 149private slots:
149 void slotUpdate3( QWidget* ); 150 void slotUpdate3( QWidget* );
150 void slotNewFromTemplate(int id ); 151 void slotNewFromTemplate(int id );
151 void slotNew(); 152 void slotNew();
152 void slotDuplicate(); 153 void slotDuplicate();
153 void slotDelete(); 154 void slotDelete();
154 void slotDeleteAll(); 155 void slotDeleteAll();
155 void slotDeleteCompleted(); 156 void slotDeleteCompleted();
156 157
157 void slotEdit(); 158 void slotEdit();
158 void slotFind(); 159 void slotFind();
159 160
160 void setCategory( int ); 161 void setCategory( int );
161 162
162 void slotShowDeadLine( bool ); 163 void slotShowDeadLine( bool );
163 void slotShowCompleted( bool ); 164 void slotShowCompleted( bool );
164 165
165 void setDocument( const QString& ); 166 void setDocument( const QString& );
166 167
167 168
168 void slotBeam(); 169 void slotBeam();
169 void beamDone( Ir* ); 170 void beamDone( Ir* );
170 void slotShowDetails(); 171 void slotShowDetails();
171 void slotShowDue( bool ); 172 void slotShowDue( bool );
172 }; 173 };
173}; 174};
174 175
175#endif 176#endif
diff --git a/core/pim/todo/todo.pro b/core/pim/todo/todo.pro
index 3ff78f5..f26acee 100644
--- a/core/pim/todo/todo.pro
+++ b/core/pim/todo/todo.pro
@@ -1,55 +1,55 @@
1 TEMPLATE= app 1 TEMPLATE= app
2 CONFIG = qt warn_on debug 2 CONFIG = qt warn_on release
3 DESTDIR = $(OPIEDIR)/bin 3 DESTDIR = $(OPIEDIR)/bin
4 4
5 HEADERS= smalltodo.h \ 5 HEADERS= smalltodo.h \
6 todomanager.h \ 6 todomanager.h \
7 mainwindow.h \ 7 mainwindow.h \
8 todoview.h \ 8 todoview.h \
9 todoentryimpl.h \ 9 todoentryimpl.h \
10 tableview.h \ 10 tableview.h \
11 tableitems.h \ 11 tableitems.h \
12 todotemplatemanager.h \ 12 todotemplatemanager.h \
13 todoeditor.h \ 13 todoeditor.h \
14 todoshow.h \ 14 todoshow.h \
15 textviewshow.h \ 15 textviewshow.h \
16 templateeditor.h \ 16 templateeditor.h \
17 templatedialog.h \ 17 templatedialog.h \
18 templatedialogimpl.h 18 templatedialogimpl.h
19 19
20 SOURCES= smalltodo.cpp \ 20 SOURCES= smalltodo.cpp \
21 todomanager.cpp \ 21 todomanager.cpp \
22 mainwindow.cpp \ 22 mainwindow.cpp \
23 main.cpp \ 23 main.cpp \
24 todoentryimpl.cpp \ 24 todoentryimpl.cpp \
25 tableview.cpp \ 25 tableview.cpp \
26 tableitems.cpp \ 26 tableitems.cpp \
27 todoview.cpp \ 27 todoview.cpp \
28 todotemplatemanager.cpp \ 28 todotemplatemanager.cpp \
29 todoeditor.cpp \ 29 todoeditor.cpp \
30 todoshow.cpp \ 30 todoshow.cpp \
31 textviewshow.cpp \ 31 textviewshow.cpp \
32 templateeditor.cpp \ 32 templateeditor.cpp \
33 templatedialog.cpp \ 33 templatedialog.cpp \
34 templatedialogimpl.cpp 34 templatedialogimpl.cpp
35 35
36 INTERFACES= todoentry.ui 36 INTERFACES= todoentry.ui
37 TARGET = todolist 37 TARGET = todolist
38INCLUDEPATH += $(OPIEDIR)/include 38INCLUDEPATH += $(OPIEDIR)/include
39 DEPENDPATH+= $(OPIEDIR)/include 39 DEPENDPATH+= $(OPIEDIR)/include
40LIBS += -lqpe -lopie 40LIBS += -lqpe -lopie
41 41
42TRANSLATIONS = ../../../i18n/de/todolist.ts \ 42TRANSLATIONS = ../../../i18n/de/todolist.ts \
43 ../../../i18n/en/todolist.ts \ 43 ../../../i18n/en/todolist.ts \
44 ../../../i18n/es/todolist.ts \ 44 ../../../i18n/es/todolist.ts \
45 ../../../i18n/fr/todolist.ts \ 45 ../../../i18n/fr/todolist.ts \
46 ../../../i18n/hu/todolist.ts \ 46 ../../../i18n/hu/todolist.ts \
47 ../../../i18n/ja/todolist.ts \ 47 ../../../i18n/ja/todolist.ts \
48 ../../../i18n/ko/todolist.ts \ 48 ../../../i18n/ko/todolist.ts \
49 ../../../i18n/no/todolist.ts \ 49 ../../../i18n/no/todolist.ts \
50 ../../../i18n/pl/todolist.ts \ 50 ../../../i18n/pl/todolist.ts \
51 ../../../i18n/pt/todolist.ts \ 51 ../../../i18n/pt/todolist.ts \
52 ../../../i18n/pt_BR/todolist.ts \ 52 ../../../i18n/pt_BR/todolist.ts \
53 ../../../i18n/sl/todolist.ts \ 53 ../../../i18n/sl/todolist.ts \
54 ../../../i18n/zh_CN/todolist.ts \ 54 ../../../i18n/zh_CN/todolist.ts \
55 ../../../i18n/zh_TW/todolist.ts 55 ../../../i18n/zh_TW/todolist.ts