summaryrefslogtreecommitdiff
authordrw <drw>2002-12-20 22:45:16 (UTC)
committer drw <drw>2002-12-20 22:45:16 (UTC)
commit3e67f4998a4957420d7f890268dc5f816e142468 (patch) (unidiff)
tree428a6876c2e42efedb7334c440edc51acad6dacf
parent406e02d26c0925598cbadaead11e3ee7b2c7c51c (diff)
downloadopie-3e67f4998a4957420d7f890268dc5f816e142468.zip
opie-3e67f4998a4957420d7f890268dc5f816e142468.tar.gz
opie-3e67f4998a4957420d7f890268dc5f816e142468.tar.bz2
First part of GUI clean-up. Added icons to 'quick task' entry toolbar and menu choice to show/hide the bar.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/todo/mainwindow.cpp70
-rw-r--r--core/pim/todo/mainwindow.h6
-rw-r--r--core/pim/todo/quickeditimpl.cpp56
-rw-r--r--core/pim/todo/quickeditimpl.h9
4 files changed, 86 insertions, 55 deletions
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp
index 0ab6230..f0aa455 100644
--- a/core/pim/todo/mainwindow.cpp
+++ b/core/pim/todo/mainwindow.cpp
@@ -1,799 +1,815 @@
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> 29#include <unistd.h>
30#include <stdio.h>
30 31
31#include <qmenubar.h> 32#include <qmenubar.h>
32#include <qmessagebox.h> 33#include <qmessagebox.h>
33#include <qtoolbar.h> 34#include <qtoolbar.h>
34#include <qpopupmenu.h> 35#include <qpopupmenu.h>
35#include <qwidgetstack.h> 36#include <qwidgetstack.h>
36#include <qaction.h> 37#include <qaction.h>
37#include <qtimer.h> 38#include <qtimer.h>
38#include <qvbox.h> 39#include <qvbox.h>
39#include <qlineedit.h> 40#include <qlineedit.h>
40 41
41#include <qpe/applnk.h> 42#include <qpe/applnk.h>
42#include <qpe/config.h> 43#include <qpe/config.h>
43#include <qpe/ir.h> 44#include <qpe/ir.h>
44#include <qpe/resource.h> 45#include <qpe/resource.h>
45#include <qpe/qpemessagebox.h> 46#include <qpe/qpemessagebox.h>
47#include <qpe/qpetoolbar.h>
46 48
47#include <opie/orecur.h> 49#include <opie/orecur.h>
48#include <opie/otodoaccessvcal.h> 50#include <opie/otodoaccessvcal.h>
49 51
50#include "quickeditimpl.h" 52#include "quickeditimpl.h"
51#include "todotemplatemanager.h" 53#include "todotemplatemanager.h"
52#include "templateeditor.h" 54#include "templateeditor.h"
53#include "tableview.h" 55#include "tableview.h"
54 56
55#include "textviewshow.h" 57#include "textviewshow.h"
56#include "todoeditor.h" 58#include "todoeditor.h"
57#include "mainwindow.h" 59#include "mainwindow.h"
58 60
59 61
60using namespace Todo; 62using namespace Todo;
61 63
62MainWindow::MainWindow( QWidget* parent, 64MainWindow::MainWindow( QWidget* parent,
63 const char* name ) 65 const char* name )
64 : OPimMainWindow("Todolist", parent, name) 66 : OPimMainWindow("Todolist", parent, name)
65{ 67{
66 68
67 m_syncing = false; 69 m_syncing = false;
68 m_counter = 0; 70 m_counter = 0;
69 m_tempManager = new TemplateManager(); 71 m_tempManager = new TemplateManager();
70 m_tempManager->load(); 72 m_tempManager->load();
71 73
72 initUI(); 74 initUI();
73 initConfig(); 75 initConfig();
74 initViews(); 76 initViews();
75 initActions(); 77 initActions();
76 initEditor(); 78 initEditor();
77 initShow(); 79 initShow();
78 initTemplate(); 80 initTemplate();
79 81
80 populateTemplates(); 82 populateTemplates();
81 raiseCurrentView(); 83 raiseCurrentView();
82 QTimer::singleShot(0, this, SLOT(populateCategories() ) ); 84 QTimer::singleShot(0, this, SLOT(populateCategories() ) );
83} 85}
84void MainWindow::initTemplate() { 86void MainWindow::initTemplate() {
85 m_curTempEd = new TemplateEditor( this, templateManager() ); 87 m_curTempEd = new TemplateEditor( this, templateManager() );
86} 88}
87void MainWindow::initActions() { 89void MainWindow::initActions() {
90
91 // Data menu
92 m_edit->insertItem(tr("New from template"), m_template,
93 -1, 0 );
94
88 QAction* a = new QAction( tr("New Task" ), Resource::loadPixmap( "new" ), 95 QAction* a = new QAction( tr("New Task" ), Resource::loadPixmap( "new" ),
89 QString::null, 0, this, 0 ); 96 QString::null, 0, this, 0 );
90 connect(a, SIGNAL( activated() ), 97 connect(a, SIGNAL( activated() ),
91 this, SLOT( slotNew() ) ); 98 this, SLOT( slotNew() ) );
92 a->addTo(m_tool ); 99 a->addTo(m_tool );
93 a->addTo(m_edit ); 100 a->addTo(m_edit );
94 101
95 a = new QAction( tr("Edit Task"), Resource::loadIconSet( "edit" ), 102 a = new QAction( tr("Edit Task"), Resource::loadIconSet( "edit" ),
96 QString::null, 0, this, 0 ); 103 QString::null, 0, this, 0 );
97 connect(a, SIGNAL(activated() ), 104 connect(a, SIGNAL(activated() ),
98 this, SLOT( slotEdit() ) ); 105 this, SLOT( slotEdit() ) );
99 a->addTo( m_tool ); 106 a->addTo( m_tool );
100 a->addTo( m_edit ); 107 a->addTo( m_edit );
101 m_editAction = a; 108 m_editAction = a;
102 109
103 a = new QAction( QString::null, tr("View Task"), 0, this, 0 ); 110 a = new QAction( QString::null, tr("View Task"), 0, this, 0 );
104 connect(a, SIGNAL( activated() ), 111 connect(a, SIGNAL( activated() ),
105 this, SLOT( slotShowDetails() ) ); 112 this, SLOT( slotShowDetails() ) );
106 a->addTo( m_edit ); 113 a->addTo( m_edit );
107 114
108 m_edit->insertSeparator(); 115 m_edit->insertSeparator();
109 116
110 a = new QAction( tr("Delete..."), Resource::loadIconSet( "trash" ), 117 a = new QAction( tr("Delete..."), Resource::loadIconSet( "trash" ),
111 QString::null, 0, this, 0 ); 118 QString::null, 0, this, 0 );
112 connect(a, SIGNAL(activated() ), 119 connect(a, SIGNAL(activated() ),
113 this, SLOT(slotDelete() ) ); 120 this, SLOT(slotDelete() ) );
114 a->addTo( m_tool ); 121 a->addTo( m_tool );
115 a->addTo( m_edit ); 122 a->addTo( m_edit );
116 m_deleteAction = a; 123 m_deleteAction = a;
117 124
118 a = new QAction( QString::null, tr("Delete all..."), 0, this, 0 ); 125 a = new QAction( QString::null, tr("Delete all..."), 0, this, 0 );
119 connect(a, SIGNAL( activated() ), 126 connect(a, SIGNAL( activated() ),
120 this, SLOT( slotDeleteAll() ) ); 127 this, SLOT( slotDeleteAll() ) );
121 a->addTo(m_edit ); 128 a->addTo(m_edit );
122 m_deleteAllAction = a; 129 m_deleteAllAction = a;
123 130
124 a = new QAction( QString::null, tr("Delete completed"), 131 a = new QAction( QString::null, tr("Delete completed"),
125 0, this, 0 ); 132 0, this, 0 );
126 connect(a, SIGNAL( activated() ), 133 connect(a, SIGNAL( activated() ),
127 this, SLOT( slotDeleteCompleted() ) ); 134 this, SLOT( slotDeleteCompleted() ) );
128 a->addTo(m_edit ); 135 a->addTo(m_edit );
129 a->setEnabled( TRUE ); 136 a->setEnabled( TRUE );
130 m_deleteCompleteAction = a; 137 m_deleteCompleteAction = a;
131 138
132 m_edit->insertSeparator(); 139 m_edit->insertSeparator();
133 140
134 a = new QAction( QString::null, tr("Duplicate"), 0, this, 0 ); 141 a = new QAction( QString::null, tr("Duplicate"), 0, this, 0 );
135 connect(a, SIGNAL( activated() ), 142 connect(a, SIGNAL( activated() ),
136 this, SLOT( slotDuplicate() ) ); 143 this, SLOT( slotDuplicate() ) );
137 a->addTo(m_edit ); 144 a->addTo(m_edit );
138 m_duplicateAction = a; 145 m_duplicateAction = a;
139 146
140 m_edit->insertSeparator(); 147 m_edit->insertSeparator();
141 148
142 if ( Ir::supported() ) { 149 if ( Ir::supported() ) {
143 a = new QAction( tr( "Beam" ), Resource::loadPixmap( "beam" ), 150 a = new QAction( tr( "Beam" ), Resource::loadPixmap( "beam" ),
144 QString::null, 0, this, 0 ); 151 QString::null, 0, this, 0 );
145 connect( a, SIGNAL( activated() ), 152 connect( a, SIGNAL( activated() ),
146 this, SLOT( slotBeam() ) ); 153 this, SLOT( slotBeam() ) );
147 a->addTo( m_edit ); 154 a->addTo( m_edit );
148 a->addTo( m_tool ); 155 a->addTo( m_tool );
149 } 156 }
150 157
158 // Options menu
151 a = new QAction( tr("Find"), Resource::loadIconSet( "mag" ), 159 a = new QAction( tr("Find"), Resource::loadIconSet( "mag" ),
152 QString::null, 0, this, 0 ); 160 QString::null, 0, this, 0 );
153 connect(a, SIGNAL( activated() ), 161 connect(a, SIGNAL( activated() ), this, SLOT( slotFind() ) );
154 this, SLOT( slotFind() ) );
155 a->addTo( m_options ); 162 a->addTo( m_options );
156 m_findAction = a; 163 m_findAction = a;
157 164
158 m_options->insertSeparator(); 165 m_options->insertSeparator();
159 166
160 m_completedAction = new QAction( QString::null, tr("Completed tasks"), 167 m_completedAction = new QAction( QString::null, tr("Show completed tasks"),
161 0, this, 0, TRUE ); 168 0, this, 0, TRUE );
162 m_completedAction->addTo( m_options ); 169 m_completedAction->addTo( m_options );
163 m_completedAction->setOn( showCompleted() ); 170 m_completedAction->setOn( showCompleted() );
164 connect(m_completedAction, SIGNAL( toggled(bool) ), 171 connect(m_completedAction, SIGNAL( toggled(bool) ), this, SLOT(slotShowCompleted(bool) ) );
165 this, SLOT(slotShowCompleted(bool) ) );
166 172
167 m_showDeadLineAction = new QAction( QString::null, tr("Show Deadline"), 173 a = new QAction( QString::null, tr("Show only over-due tasks"),
174 0, this, 0, TRUE );
175 a->addTo( m_options );
176 a->setOn( showOverDue() );
177 connect(a, SIGNAL(toggled(bool)), this, SLOT(slotShowDue(bool) ) );
178
179 m_showDeadLineAction = new QAction( QString::null, tr("Show task deadlines"),
168 0, this, 0, TRUE ); 180 0, this, 0, TRUE );
169 m_showDeadLineAction->addTo( m_options ); 181 m_showDeadLineAction->addTo( m_options );
170 m_showDeadLineAction->setOn( showDeadline() ); 182 m_showDeadLineAction->setOn( showDeadline() );
171 connect(m_showDeadLineAction, SIGNAL(toggled(bool) ), 183 connect(m_showDeadLineAction, SIGNAL(toggled(bool) ), this, SLOT( slotShowDeadLine( bool ) ) );
172 this, SLOT( slotShowDeadLine( bool ) ) ); 184
185 m_showQuickTaskAction = new QAction( QString::null, tr("Show quick task bar"),
186 0, this, 0, TRUE );
187 m_showQuickTaskAction->addTo( m_options );
188 m_showQuickTaskAction->setOn( showQuickTask() );
189 connect(m_showQuickTaskAction, SIGNAL( toggled(bool) ), this, SLOT(slotShowQuickTask(bool) ) );
173 190
174 m_options->insertSeparator(); 191 m_options->insertSeparator();
175 192
176 m_bar->insertItem( tr("Data") ,m_edit ); 193 m_bar->insertItem( tr("Data") ,m_edit );
177 m_bar->insertItem( tr("Category"), m_catMenu ); 194 m_bar->insertItem( tr("Category"), m_catMenu );
178 m_bar->insertItem( tr("Options"), m_options ); 195 m_bar->insertItem( tr("Options"), m_options );
179 196
180 /* initialize the view menu */ 197 m_curQuick = new QuickEditImpl( this, m_quicktask );
181 a = new QAction( QString::null, tr("Show only over due"), 198 addToolBar( (QPEToolBar *)m_curQuick->widget(), tr( "QuickEdit" ), QMainWindow::Top, TRUE );
182 0, this, 0, TRUE ); 199 m_curQuick->signal()->connect( this, SLOT(slotQuickEntered() ) );
183 a->addTo( m_options );
184 a->setOn( showOverDue() );
185 connect(a, SIGNAL(toggled(bool)),
186 this, SLOT(slotShowDue(bool) ) );
187
188 /* templates */
189 m_edit->insertItem(tr("New from template"), m_template,
190 -1, 0 );
191 200
192} 201}
193/* m_curCat from Config */ 202/* m_curCat from Config */
194void MainWindow::initConfig() { 203void MainWindow::initConfig() {
195 Config config( "todo" ); 204 Config config( "todo" );
196 config.setGroup( "View" ); 205 config.setGroup( "View" );
197 m_completed = config.readBoolEntry( "ShowComplete", TRUE ); 206 m_completed = config.readBoolEntry( "ShowComplete", TRUE );
198 m_curCat = config.readEntry( "Category", QString::null ); 207 m_curCat = config.readEntry( "Category", QString::null );
199 m_deadline = config.readBoolEntry( "ShowDeadLine", TRUE); 208 m_deadline = config.readBoolEntry( "ShowDeadLine", TRUE);
200 m_overdue = config.readBoolEntry("ShowOverDue", TRUE ); 209 m_overdue = config.readBoolEntry("ShowOverDue", FALSE );
210 m_quicktask = config.readBoolEntry("ShowQuickTask", TRUE);
201} 211}
202void MainWindow::initUI() { 212void MainWindow::initUI() {
203 m_mainBox = new QVBox(this, "main box "); 213 m_mainBox = new QVBox(this, "main box ");
204 m_curQuick = new QuickEditImpl(this, m_mainBox );
205 m_curQuick->signal()->connect( this, SLOT(slotQuickEntered() ) );
206 m_quickEdit.append( m_curQuick );
207
208
209 214
210 m_stack = new QWidgetStack(m_mainBox, "main stack"); 215 m_stack = new QWidgetStack(m_mainBox, "main stack");
211 setCentralWidget( m_mainBox ); 216 setCentralWidget( m_mainBox );
212 217
213 setToolBarsMovable( FALSE ); 218 setToolBarsMovable( FALSE );
214 219
215 m_tool = new QToolBar( this ); 220 m_tool = new QPEToolBar( this );
216 m_tool->setHorizontalStretchable( TRUE ); 221 m_tool->setHorizontalStretchable( TRUE );
217 222
218 m_bar = new QMenuBar( m_tool ); 223 m_bar = new QMenuBar( m_tool );
219 224
220 /** QPopupMenu */ 225 /** QPopupMenu */
221 m_edit = new QPopupMenu( this ); 226 m_edit = new QPopupMenu( this );
222 m_options = new QPopupMenu( this ); 227 m_options = new QPopupMenu( this );
223 m_catMenu = new QPopupMenu( this ); 228 m_catMenu = new QPopupMenu( this );
224 m_template = new QPopupMenu( this ); 229 m_template = new QPopupMenu( this );
225 230
226 m_catMenu->setCheckable( TRUE ); 231 m_catMenu->setCheckable( TRUE );
227 m_template->setCheckable( TRUE ); 232 m_template->setCheckable( TRUE );
228 233
229 connect(m_catMenu, SIGNAL(activated(int) ), 234 connect(m_catMenu, SIGNAL(activated(int) ),
230 this, SLOT(setCategory(int) ) ); 235 this, SLOT(setCategory(int) ) );
231 connect(m_template, SIGNAL(activated(int) ), 236 connect(m_template, SIGNAL(activated(int) ),
232 this, SLOT(slotNewFromTemplate(int) ) ); 237 this, SLOT(slotNewFromTemplate(int) ) );
233} 238}
234void MainWindow::initViews() { 239void MainWindow::initViews() {
235 TableView* tableView = new TableView( this, m_stack ); 240 TableView* tableView = new TableView( this, m_stack );
236 m_stack->addWidget( tableView, m_counter++ ); 241 m_stack->addWidget( tableView, m_counter++ );
237 m_views.append( tableView ); 242 m_views.append( tableView );
238 m_curView = tableView; 243 m_curView = tableView;
239 connectBase( tableView ); 244 connectBase( tableView );
240 /* add QString type + QString configname to 245 /* add QString type + QString configname to
241 * the View menu 246 * the View menu
242 * and subdirs for multiple views 247 * and subdirs for multiple views
243 */ 248 */
244} 249}
245void MainWindow::initEditor() { 250void MainWindow::initEditor() {
246 m_curEdit = new Editor(); 251 m_curEdit = new Editor();
247} 252}
248void MainWindow::initShow() { 253void MainWindow::initShow() {
249 m_curShow = new TextViewShow(this); 254 m_curShow = new TextViewShow(this);
250 m_stack->addWidget( m_curShow->widget() , m_counter++ ); 255 m_stack->addWidget( m_curShow->widget() , m_counter++ );
251} 256}
252MainWindow::~MainWindow() { 257MainWindow::~MainWindow() {
253 delete templateManager(); 258 delete templateManager();
254} 259}
255void MainWindow::connectBase( ViewBase* ) { 260void MainWindow::connectBase( ViewBase* ) {
256 // once templates and signals mix we'll use it again 261 // once templates and signals mix we'll use it again
257} 262}
258QPopupMenu* MainWindow::contextMenu( int , bool recur ) { 263QPopupMenu* MainWindow::contextMenu( int , bool recur ) {
259 QPopupMenu* menu = new QPopupMenu(); 264 QPopupMenu* menu = new QPopupMenu();
260 265
261 m_editAction->addTo( menu ); 266 m_editAction->addTo( menu );
262 m_deleteAction->addTo( menu ); 267 m_deleteAction->addTo( menu );
263 m_duplicateAction->addTo( menu ); 268 m_duplicateAction->addTo( menu );
264 269
265 menu->insertSeparator(); 270 menu->insertSeparator();
266 271
267 /* 272 /*
268 * if this event recurs we allow 273 * if this event recurs we allow
269 * to detach it. 274 * to detach it.
270 * remove all 275 * remove all
271 */ 276 */
272 if ( recur ) { 277 if ( recur ) {
273 ; // FIXME 278 ; // FIXME
274 } 279 }
275 280
276 return menu; 281 return menu;
277} 282}
278QPopupMenu* MainWindow::options() { 283QPopupMenu* MainWindow::options() {
279 qWarning("Options"); 284 qWarning("Options");
280 return m_options; 285 return m_options;
281} 286}
282QPopupMenu* MainWindow::edit() { 287QPopupMenu* MainWindow::edit() {
283 return m_edit; 288 return m_edit;
284} 289}
285QToolBar* MainWindow::toolbar() { 290QToolBar* MainWindow::toolbar() {
286 return m_tool; 291 return m_tool;
287} 292}
288OTodoAccess::List MainWindow::list()const { 293OTodoAccess::List MainWindow::list()const {
289 return m_todoMgr.list(); 294 return m_todoMgr.list();
290} 295}
291OTodoAccess::List MainWindow::sorted( bool asc, int sortOrder ) { 296OTodoAccess::List MainWindow::sorted( bool asc, int sortOrder ) {
292 int cat = 0; 297 int cat = 0;
293 if ( m_curCat != tr("All Categories") ) 298 if ( m_curCat != tr("All Categories") )
294 cat = currentCatId(); 299 cat = currentCatId();
295 300
296 int filter = 1; 301 int filter = 1;
297 302
298 if (!m_completed ) 303 if (!m_completed )
299 filter |= 4; 304 filter |= 4;
300 if (m_overdue) 305 if (m_overdue)
301 filter |= 2; 306 filter |= 2;
302 307
303 return m_todoMgr.sorted( asc, sortOrder, filter, cat ); 308 return m_todoMgr.sorted( asc, sortOrder, filter, cat );
304} 309}
305OTodoAccess::List MainWindow::sorted( bool asc, int sortOrder, int addFilter) { 310OTodoAccess::List MainWindow::sorted( bool asc, int sortOrder, int addFilter) {
306 int cat = 0; 311 int cat = 0;
307 if ( m_curCat != tr("All Categories") ) 312 if ( m_curCat != tr("All Categories") )
308 cat = currentCatId(); 313 cat = currentCatId();
309 314
310 return m_todoMgr.sorted(asc, sortOrder, addFilter, cat ); 315 return m_todoMgr.sorted(asc, sortOrder, addFilter, cat );
311} 316}
312OTodo MainWindow::event( int uid ) { 317OTodo MainWindow::event( int uid ) {
313 return m_todoMgr.event( uid ); 318 return m_todoMgr.event( uid );
314} 319}
315bool MainWindow::isSyncing()const { 320bool MainWindow::isSyncing()const {
316 return m_syncing; 321 return m_syncing;
317} 322}
318TemplateManager* MainWindow::templateManager() { 323TemplateManager* MainWindow::templateManager() {
319 return m_tempManager; 324 return m_tempManager;
320} 325}
321Editor* MainWindow::currentEditor() { 326Editor* MainWindow::currentEditor() {
322 return m_curEdit; 327 return m_curEdit;
323} 328}
324TodoShow* MainWindow::currentShow() { 329TodoShow* MainWindow::currentShow() {
325 return m_curShow; 330 return m_curShow;
326} 331}
327void MainWindow::slotReload() { 332void MainWindow::slotReload() {
328 m_todoMgr.reload(); 333 m_todoMgr.reload();
329 currentView()->updateView( ); 334 currentView()->updateView( );
330 raiseCurrentView(); 335 raiseCurrentView();
331} 336}
332void MainWindow::closeEvent( QCloseEvent* e ) { 337void MainWindow::closeEvent( QCloseEvent* e ) {
333 if (m_stack->visibleWidget() == currentShow()->widget() ) { 338 if (m_stack->visibleWidget() == currentShow()->widget() ) {
334 raiseCurrentView(); 339 raiseCurrentView();
335 e->ignore(); 340 e->ignore();
336 return; 341 return;
337 } 342 }
338 /* 343 /*
339 * we should have flushed and now we're still saving 344 * we should have flushed and now we're still saving
340 * so there is no need to flush 345 * so there is no need to flush
341 */ 346 */
342 if (m_syncing ) { 347 if (m_syncing ) {
343 e->accept(); 348 e->accept();
344 return; 349 return;
345 } 350 }
346 bool quit = false; 351 bool quit = false;
347 if ( m_todoMgr.saveAll() ){ 352 if ( m_todoMgr.saveAll() ){
348 qWarning("saved"); 353 qWarning("saved");
349 quit = true; 354 quit = true;
350 }else { 355 }else {
351 if ( QMessageBox::critical( this, tr("Out of space"), 356 if ( QMessageBox::critical( this, tr("Out of space"),
352 tr("Todo was unable\n" 357 tr("Todo was unable\n"
353 "to save your changes.\n" 358 "to save your changes.\n"
354 "Free up some space\n" 359 "Free up some space\n"
355 "and try again.\n" 360 "and try again.\n"
356 "\nQuit Anyway?"), 361 "\nQuit Anyway?"),
357 QMessageBox::Yes|QMessageBox::Escape, 362 QMessageBox::Yes|QMessageBox::Escape,
358 QMessageBox::No|QMessageBox::Default) 363 QMessageBox::No|QMessageBox::Default)
359 != QMessageBox::No ) { 364 != QMessageBox::No ) {
360 e->accept(); 365 e->accept();
361 quit = true; 366 quit = true;
362 }else 367 }else
363 e->ignore(); 368 e->ignore();
364 369
365 } 370 }
366 371
367 if (quit ) { 372 if (quit ) {
368 Config config( "todo" ); 373 Config config( "todo" );
369 config.setGroup( "View" ); 374 config.setGroup( "View" );
370 config.writeEntry( "ShowComplete", showCompleted() ); 375 config.writeEntry( "ShowComplete", showCompleted() );
371 config.writeEntry( "Category", currentCategory() ); 376 config.writeEntry( "Category", currentCategory() );
372 config.writeEntry( "ShowDeadLine", showDeadline()); 377 config.writeEntry( "ShowDeadLine", showDeadline());
373 config.writeEntry( "ShowOverDue", showOverDue() ); 378 config.writeEntry( "ShowOverDue", showOverDue() );
374 /* svae templates */ 379 config.writeEntry( "ShowQuickTask", showQuickTask() );
380 /* save templates */
375 templateManager()->save(); 381 templateManager()->save();
376 e->accept(); 382 e->accept();
377 } 383 }
378} 384}
379void MainWindow::populateTemplates() { 385void MainWindow::populateTemplates() {
380 m_template->clear(); 386 m_template->clear();
381 QStringList list = templateManager()->templates(); 387 QStringList list = templateManager()->templates();
382 QStringList::Iterator it; 388 QStringList::Iterator it;
383 for ( it = list.begin(); it != list.end(); ++it ) { 389 for ( it = list.begin(); it != list.end(); ++it ) {
384 m_template->insertItem( (*it) ); 390 m_template->insertItem( (*it) );
385 } 391 }
386} 392}
387/* 393/*
388 * slotNewFromTemplate 394 * slotNewFromTemplate
389 * We use the edit widget to do 395 * We use the edit widget to do
390 * the config but we setUid(-1) 396 * the config but we setUid(-1)
391 * to get a new uid 397 * to get a new uid
392 */ 398 */
393/* 399/*
394 * first we get the name of the template 400 * first we get the name of the template
395 * then we will use the TemplateManager 401 * then we will use the TemplateManager
396 */ 402 */
397void MainWindow::slotNewFromTemplate( int id ) { 403void MainWindow::slotNewFromTemplate( int id ) {
398 QString name = m_template->text( id ); 404 QString name = m_template->text( id );
399 405
400 OTodo event = templateManager()->templateEvent( name ); 406 OTodo event = templateManager()->templateEvent( name );
401 event = currentEditor()->edit(this, 407 event = currentEditor()->edit(this,
402 event ); 408 event );
403 409
404 if ( currentEditor()->accepted() ) { 410 if ( currentEditor()->accepted() ) {
405 /* assign new todo */ 411 /* assign new todo */
406 event.setUid( -1 ); 412 event.setUid( -1 );
407 currentView()->addEvent( event ); 413 currentView()->addEvent( event );
408 m_todoMgr.add( event ); 414 m_todoMgr.add( event );
409 415
410 populateCategories(); 416 populateCategories();
411 } 417 }
412} 418}
413void MainWindow::slotNew() { 419void MainWindow::slotNew() {
414 create(); 420 create();
415} 421}
416void MainWindow::slotDuplicate() { 422void MainWindow::slotDuplicate() {
417 if(m_syncing) { 423 if(m_syncing) {
418 QMessageBox::warning(this, tr("Todo"), 424 QMessageBox::warning(this, tr("Todo"),
419 tr("Can not edit data, currently syncing")); 425 tr("Can not edit data, currently syncing"));
420 return; 426 return;
421 } 427 }
422 OTodo ev = m_todoMgr.event( currentView()->current() ); 428 OTodo ev = m_todoMgr.event( currentView()->current() );
423 /* let's generate a new uid */ 429 /* let's generate a new uid */
424 ev.setUid(-1); 430 ev.setUid(-1);
425 m_todoMgr.add( ev ); 431 m_todoMgr.add( ev );
426 432
427 currentView()->addEvent( ev ); 433 currentView()->addEvent( ev );
428 raiseCurrentView(); 434 raiseCurrentView();
429} 435}
430void MainWindow::slotDelete() { 436void MainWindow::slotDelete() {
431 if (!currentView()->current() ) 437 if (!currentView()->current() )
432 return; 438 return;
433 439
434 if(m_syncing) { 440 if(m_syncing) {
435 QMessageBox::warning(this, tr("Todo"), 441 QMessageBox::warning(this, tr("Todo"),
436 tr("Can not edit data, currently syncing")); 442 tr("Can not edit data, currently syncing"));
437 return; 443 return;
438 } 444 }
439 QString strName = currentView()->currentRepresentation(); 445 QString strName = currentView()->currentRepresentation();
440 if (!QPEMessageBox::confirmDelete(this, tr("Todo"), strName ) ) 446 if (!QPEMessageBox::confirmDelete(this, tr("Todo"), strName ) )
441 return; 447 return;
442 448
443 m_todoMgr.remove( currentView()->current() ); 449 m_todoMgr.remove( currentView()->current() );
444 currentView()->removeEvent( currentView()->current() ); 450 currentView()->removeEvent( currentView()->current() );
445 raiseCurrentView(); 451 raiseCurrentView();
446} 452}
447void MainWindow::slotDeleteAll() { 453void MainWindow::slotDeleteAll() {
448 if(m_syncing) { 454 if(m_syncing) {
449 QMessageBox::warning(this, tr("Todo"), 455 QMessageBox::warning(this, tr("Todo"),
450 tr("Can not edit data, currently syncing")); 456 tr("Can not edit data, currently syncing"));
451 return; 457 return;
452 } 458 }
453 459
454 460
455 if ( !QPEMessageBox::confirmDelete( this, tr( "Todo" ), tr("all tasks?") ) ) 461 if ( !QPEMessageBox::confirmDelete( this, tr( "Todo" ), tr("all tasks?") ) )
456 return; 462 return;
457 463
458 m_todoMgr.removeAll(); 464 m_todoMgr.removeAll();
459 currentView()->clear(); 465 currentView()->clear();
460 466
461 raiseCurrentView(); 467 raiseCurrentView();
462} 468}
463void MainWindow::slotDeleteCompleted() { 469void MainWindow::slotDeleteCompleted() {
464 if(m_syncing) { 470 if(m_syncing) {
465 QMessageBox::warning(this, tr("Todo"), 471 QMessageBox::warning(this, tr("Todo"),
466 tr("Can not edit data, currently syncing")); 472 tr("Can not edit data, currently syncing"));
467 return; 473 return;
468 } 474 }
469 475
470 if ( !QPEMessageBox::confirmDelete( this, tr( "Todo" ), tr("all completed tasks?") ) ) 476 if ( !QPEMessageBox::confirmDelete( this, tr( "Todo" ), tr("all completed tasks?") ) )
471 return; 477 return;
472 478
473 479
474 m_todoMgr.removeCompleted(); 480 m_todoMgr.removeCompleted();
475 currentView()->updateView( ); 481 currentView()->updateView( );
476} 482}
477void MainWindow::slotFind() { 483void MainWindow::slotFind() {
478 484
479} 485}
480void MainWindow::slotEdit() { 486void MainWindow::slotEdit() {
481 slotEdit( currentView()->current() ); 487 slotEdit( currentView()->current() );
482} 488}
483/* 489/*
484 * set the category 490 * set the category
485 */ 491 */
486void MainWindow::setCategory( int c) { 492void MainWindow::setCategory( int c) {
487 if ( c <= 0 ) return; 493 if ( c <= 0 ) return;
488 494
489 495
490 qWarning("Iterating over cats %d", c ); 496 qWarning("Iterating over cats %d", c );
491 for ( unsigned int i = 1; i < m_catMenu->count(); i++ ) 497 for ( unsigned int i = 1; i < m_catMenu->count(); i++ )
492 m_catMenu->setItemChecked(i, c == (int)i ); 498 m_catMenu->setItemChecked(i, c == (int)i );
493 499
494 if (c == 1 ) { 500 if (c == 1 ) {
495 m_curCat = QString::null; 501 m_curCat = QString::null;
496 setCaption( tr("Todo") + " - " + tr("All Categories" ) ); 502 setCaption( tr("Todo") + " - " + tr("All Categories" ) );
497 503
498 }else if ( c == (int)m_catMenu->count() - 1 ) { 504 }else if ( c == (int)m_catMenu->count() - 1 ) {
499 m_curCat = tr("Unfiled"); 505 m_curCat = tr("Unfiled");
500 setCaption( tr("Todo") + " - " + tr("Unfiled") ); 506 setCaption( tr("Todo") + " - " + tr("Unfiled") );
501 }else { 507 }else {
502 m_curCat = m_todoMgr.categories()[c-2]; 508 m_curCat = m_todoMgr.categories()[c-2];
503 setCaption( tr("Todo") + " - " + m_curCat ); 509 setCaption( tr("Todo") + " - " + m_curCat );
504 } 510 }
505 m_catMenu->setItemChecked( c, true ); 511 m_catMenu->setItemChecked( c, true );
506 512
507 currentView()->setShowCategory( m_curCat ); 513 currentView()->setShowCategory( m_curCat );
508 raiseCurrentView(); 514 raiseCurrentView();
509} 515}
510void MainWindow::slotShowDeadLine( bool dead) { 516void MainWindow::slotShowDeadLine( bool dead) {
511 m_deadline = dead; 517 m_deadline = dead;
512 currentView()->setShowDeadline( dead ); 518 currentView()->setShowDeadline( dead );
513} 519}
514void MainWindow::slotShowCompleted( bool show) { 520void MainWindow::slotShowCompleted( bool show) {
515 m_completed = show; 521 m_completed = show;
516 currentView()->setShowCompleted( m_completed ); 522 currentView()->setShowCompleted( m_completed );
517} 523}
524void MainWindow::slotShowQuickTask( bool show ) {
525 m_quicktask = show;
526 if ( m_quicktask )
527 m_curQuick->widget()->show();
528 else
529 m_curQuick->widget()->hide();
530}
518bool MainWindow::showOverDue()const { 531bool MainWindow::showOverDue()const {
519 return m_overdue; 532 return m_overdue;
520} 533}
521void MainWindow::setDocument( const QString& fi) { 534void MainWindow::setDocument( const QString& fi) {
522 DocLnk doc(fi); 535 DocLnk doc(fi);
523 if (doc.isValid() ) 536 if (doc.isValid() )
524 receiveFile(doc.file() ); 537 receiveFile(doc.file() );
525 else 538 else
526 receiveFile(fi ); 539 receiveFile(fi );
527} 540}
528 541
529static const char *beamfile = "/tmp/opie-todo.vcs"; 542static const char *beamfile = "/tmp/opie-todo.vcs";
530void MainWindow::slotBeam() { 543void MainWindow::slotBeam() {
531 beam( currentView()->current() ); 544 beam( currentView()->current() );
532} 545}
533void MainWindow::beamDone( Ir* ir) { 546void MainWindow::beamDone( Ir* ir) {
534 delete ir; 547 delete ir;
535 ::unlink( beamfile ); 548 ::unlink( beamfile );
536} 549}
537void MainWindow::receiveFile( const QString& filename ) { 550void MainWindow::receiveFile( const QString& filename ) {
538 OTodoAccessVCal* cal = new OTodoAccessVCal(filename ); 551 OTodoAccessVCal* cal = new OTodoAccessVCal(filename );
539 OTodoAccess acc( cal ); 552 OTodoAccess acc( cal );
540 acc.load(); 553 acc.load();
541 OTodoAccess::List list = acc.allRecords(); 554 OTodoAccess::List list = acc.allRecords();
542 555
543 QString message = tr("<P>%1 new tasks arrived.<p>Would you like to add them to your Todolist?").arg(list.count() ); 556 QString message = tr("<P>%1 new tasks arrived.<p>Would you like to add them to your Todolist?").arg(list.count() );
544 557
545 if ( QMessageBox::information(this, tr("New Tasks"), 558 if ( QMessageBox::information(this, tr("New Tasks"),
546 message, QMessageBox::Ok, 559 message, QMessageBox::Ok,
547 QMessageBox::Cancel ) == QMessageBox::Ok ) { 560 QMessageBox::Cancel ) == QMessageBox::Ok ) {
548 OTodoAccess::List::Iterator it; 561 OTodoAccess::List::Iterator it;
549 for ( it = list.begin(); it != list.end(); ++it ) 562 for ( it = list.begin(); it != list.end(); ++it )
550 m_todoMgr.add( (*it) ); 563 m_todoMgr.add( (*it) );
551 564
552 currentView()->updateView(); 565 currentView()->updateView();
553 } 566 }
554} 567}
555 568
556void MainWindow::slotFlush() { 569void MainWindow::slotFlush() {
557 m_syncing = FALSE; 570 m_syncing = FALSE;
558 m_todoMgr.save(); 571 m_todoMgr.save();
559} 572}
560void MainWindow::slotShowDetails() { 573void MainWindow::slotShowDetails() {
561 slotShow( currentView()->current() ); 574 slotShow( currentView()->current() );
562} 575}
563/* 576/*
564 * populate the Categories 577 * populate the Categories
565 * Menu 578 * Menu
566 */ 579 */
567void MainWindow::populateCategories() { 580void MainWindow::populateCategories() {
568 m_todoMgr.load(); 581 m_todoMgr.load();
569 582
570 m_catMenu->clear(); 583 m_catMenu->clear();
571 int id, rememberId; 584 int id, rememberId;
572 id = 1; 585 id = 1;
573 rememberId = 1; 586 rememberId = 1;
574 587
575 m_catMenu->insertItem( tr( "All Categories" ), id++ ); 588 m_catMenu->insertItem( tr( "All Categories" ), id++ );
576 m_catMenu->insertSeparator(); 589 m_catMenu->insertSeparator();
577 QStringList categories = m_todoMgr.categories(); 590 QStringList categories = m_todoMgr.categories();
578 categories.append( tr( "Unfiled" ) ); 591 categories.append( tr( "Unfiled" ) );
579 for ( QStringList::Iterator it = categories.begin(); 592 for ( QStringList::Iterator it = categories.begin();
580 it != categories.end(); ++it ) { 593 it != categories.end(); ++it ) {
581 m_catMenu->insertItem( *it, id ); 594 m_catMenu->insertItem( *it, id );
582 if ( *it == currentCategory() ) 595 if ( *it == currentCategory() )
583 rememberId = id; 596 rememberId = id;
584 ++id; 597 ++id;
585 } 598 }
586 setCategory( rememberId ); 599 setCategory( rememberId );
587} 600}
588bool MainWindow::showCompleted()const { 601bool MainWindow::showCompleted()const {
589 return m_completed; 602 return m_completed;
590} 603}
591bool MainWindow::showDeadline()const { 604bool MainWindow::showDeadline()const {
592 return m_deadline; 605 return m_deadline;
593} 606}
607bool MainWindow::showQuickTask()const {
608 return m_quicktask;
609}
594QString MainWindow::currentCategory()const { 610QString MainWindow::currentCategory()const {
595 return m_curCat; 611 return m_curCat;
596} 612}
597int MainWindow::currentCatId() { 613int MainWindow::currentCatId() {
598 return m_todoMgr.catId( m_curCat ); 614 return m_todoMgr.catId( m_curCat );
599} 615}
600ViewBase* MainWindow::currentView() { 616ViewBase* MainWindow::currentView() {
601 return m_curView; 617 return m_curView;
602} 618}
603void MainWindow::raiseCurrentView() { 619void MainWindow::raiseCurrentView() {
604 m_stack->raiseWidget( m_curView->widget() ); 620 m_stack->raiseWidget( m_curView->widget() );
605} 621}
606void MainWindow::slotShowDue(bool ov) { 622void MainWindow::slotShowDue(bool ov) {
607 m_overdue = ov; 623 m_overdue = ov;
608 currentView()->showOverDue( ov ); 624 currentView()->showOverDue( ov );
609 raiseCurrentView(); 625 raiseCurrentView();
610} 626}
611void MainWindow::slotShow( int uid ) { 627void MainWindow::slotShow( int uid ) {
612 qWarning("slotShow"); 628 qWarning("slotShow");
613 currentShow()->slotShow( event( uid ) ); 629 currentShow()->slotShow( event( uid ) );
614 m_stack->raiseWidget( currentShow()->widget() ); 630 m_stack->raiseWidget( currentShow()->widget() );
615} 631}
616void MainWindow::slotEdit( int uid ) { 632void MainWindow::slotEdit( int uid ) {
617 if(m_syncing) { 633 if(m_syncing) {
618 QMessageBox::warning(this, tr("Todo"), 634 QMessageBox::warning(this, tr("Todo"),
619 tr("Can not edit data, currently syncing")); 635 tr("Can not edit data, currently syncing"));
620 return; 636 return;
621 } 637 }
622 638
623 OTodo todo = m_todoMgr.event( uid ); 639 OTodo todo = m_todoMgr.event( uid );
624 640
625 todo = currentEditor()->edit(this, todo ); 641 todo = currentEditor()->edit(this, todo );
626 642
627 /* if completed */ 643 /* if completed */
628 if ( currentEditor()->accepted() ) { 644 if ( currentEditor()->accepted() ) {
629 qWarning("Replacing now" ); 645 qWarning("Replacing now" );
630 m_todoMgr.update( todo.uid(), todo ); 646 m_todoMgr.update( todo.uid(), todo );
631 currentView()->replaceEvent( todo ); 647 currentView()->replaceEvent( todo );
632 /* a Category might have changed */ 648 /* a Category might have changed */
633 populateCategories(); 649 populateCategories();
634 } 650 }
635 651
636 raiseCurrentView(); 652 raiseCurrentView();
637} 653}
638/* 654/*
639void MainWindow::slotUpdate1( int uid, const SmallTodo& ev) { 655void MainWindow::slotUpdate1( int uid, const SmallTodo& ev) {
640 m_todoMgr.update( uid, ev ); 656 m_todoMgr.update( uid, ev );
641} 657}
642*/ 658*/
643void MainWindow::updateTodo( const OTodo& ev) { 659void MainWindow::updateTodo( const OTodo& ev) {
644 m_todoMgr.update( ev.uid() , ev ); 660 m_todoMgr.update( ev.uid() , ev );
645} 661}
646/* The view changed it's configuration 662/* The view changed it's configuration
647 * update the view menu 663 * update the view menu
648 */ 664 */
649void MainWindow::slotUpdate3( QWidget* ) { 665void MainWindow::slotUpdate3( QWidget* ) {
650 666
651} 667}
652void MainWindow::updateList() { 668void MainWindow::updateList() {
653 m_todoMgr.updateList(); 669 m_todoMgr.updateList();
654} 670}
655void MainWindow::setReadAhead( uint count ) { 671void MainWindow::setReadAhead( uint count ) {
656 if (m_todoMgr.todoDB() ) 672 if (m_todoMgr.todoDB() )
657 m_todoMgr.todoDB()->setReadAhead( count ); 673 m_todoMgr.todoDB()->setReadAhead( count );
658} 674}
659void MainWindow::slotQuickEntered() { 675void MainWindow::slotQuickEntered() {
660 qWarning("entered"); 676 qWarning("entered");
661 OTodo todo = quickEditor()->todo(); 677 OTodo todo = quickEditor()->todo();
662 if (todo.isEmpty() ) 678 if (todo.isEmpty() )
663 return; 679 return;
664 680
665 m_todoMgr.add( todo ); 681 m_todoMgr.add( todo );
666 currentView()->addEvent( todo ); 682 currentView()->addEvent( todo );
667 raiseCurrentView(); 683 raiseCurrentView();
668} 684}
669QuickEditBase* MainWindow::quickEditor() { 685QuickEditBase* MainWindow::quickEditor() {
670 return m_curQuick; 686 return m_curQuick;
671} 687}
672void MainWindow::slotComplete( int uid ) { 688void MainWindow::slotComplete( int uid ) {
673 slotComplete( event(uid) ); 689 slotComplete( event(uid) );
674} 690}
675void MainWindow::slotComplete( const OTodo& todo ) { 691void MainWindow::slotComplete( const OTodo& todo ) {
676 OTodo to = todo; 692 OTodo to = todo;
677 to.setCompleted( !to.isCompleted() ); 693 to.setCompleted( !to.isCompleted() );
678 to.setCompletedDate( QDate::currentDate() ); 694 to.setCompletedDate( QDate::currentDate() );
679 695
680 /* 696 /*
681 * if the item does recur 697 * if the item does recur
682 * we need to spin it off 698 * we need to spin it off
683 * and update the items duedate to the next 699 * and update the items duedate to the next
684 * possible recurrance of this item... 700 * possible recurrance of this item...
685 * the spinned off one will loose the 701 * the spinned off one will loose the
686 */ 702 */
687 if ( to.recurrence().doesRecur() && to.isCompleted() ) { 703 if ( to.recurrence().doesRecur() && to.isCompleted() ) {
688 OTodo to2( to ); 704 OTodo to2( to );
689 705
690 /* the spinned off one won't recur anymore */ 706 /* the spinned off one won't recur anymore */
691 to.setRecurrence( ORecur() ); 707 to.setRecurrence( ORecur() );
692 708
693 ORecur rec = to2.recurrence(); 709 ORecur rec = to2.recurrence();
694 rec.setStart( to.dueDate() ); 710 rec.setStart( to.dueDate() );
695 to2.setRecurrence( rec ); 711 to2.setRecurrence( rec );
696 /* 712 /*
697 * if there is a next occurence 713 * if there is a next occurence
698 * from the duedate of the last recurrance 714 * from the duedate of the last recurrance
699 */ 715 */
700 QDate date; 716 QDate date;
701 if ( to2.recurrence().nextOcurrence( to2.dueDate().addDays(1), date ) ) { 717 if ( to2.recurrence().nextOcurrence( to2.dueDate().addDays(1), date ) ) {
702 QDate inval; 718 QDate inval;
703 /* generate a new uid for the old record */ 719 /* generate a new uid for the old record */
704 to.setUid( 1 ); 720 to.setUid( 1 );
705 721
706 /* add the old one cause it has a new UID here cause it was spin off */ 722 /* add the old one cause it has a new UID here cause it was spin off */
707 m_todoMgr.add( to ); 723 m_todoMgr.add( to );
708 724
709 /* 725 /*
710 * update the due date 726 * update the due date
711 * start date 727 * start date
712 * and complete date 728 * and complete date
713 */ 729 */
714 to2.setDueDate( date ); 730 to2.setDueDate( date );
715 to2.setStartDate( inval ); 731 to2.setStartDate( inval );
716 to2.setCompletedDate( inval ); 732 to2.setCompletedDate( inval );
717 to2.setCompleted( false ); 733 to2.setCompleted( false );
718 updateTodo( to2 ); 734 updateTodo( to2 );
719 }else 735 }else
720 updateTodo( to ); 736 updateTodo( to );
721 }else 737 }else
722 updateTodo( to ); 738 updateTodo( to );
723 739
724 currentView()->updateView(); 740 currentView()->updateView();
725 raiseCurrentView(); 741 raiseCurrentView();
726} 742}
727void MainWindow::flush() { 743void MainWindow::flush() {
728 slotFlush(); 744 slotFlush();
729} 745}
730void MainWindow::reload() { 746void MainWindow::reload() {
731 slotReload(); 747 slotReload();
732} 748}
733int MainWindow::create() { 749int MainWindow::create() {
734 int uid = 0; 750 int uid = 0;
735 if(m_syncing) { 751 if(m_syncing) {
736 QMessageBox::warning(this, tr("Todo"), 752 QMessageBox::warning(this, tr("Todo"),
737 tr("Can not edit data, currently syncing")); 753 tr("Can not edit data, currently syncing"));
738 return uid; 754 return uid;
739 } 755 }
740 756
741 757
742 OTodo todo = currentEditor()->newTodo( currentCatId(), 758 OTodo todo = currentEditor()->newTodo( currentCatId(),
743 this ); 759 this );
744 760
745 if ( currentEditor()->accepted() ) { 761 if ( currentEditor()->accepted() ) {
746 //todo.assignUid(); 762 //todo.assignUid();
747 uid = todo.uid(); 763 uid = todo.uid();
748 m_todoMgr.add( todo ); 764 m_todoMgr.add( todo );
749 currentView()->addEvent( todo ); 765 currentView()->addEvent( todo );
750 766
751 767
752 // I'm afraid we must call this every time now, otherwise 768 // I'm afraid we must call this every time now, otherwise
753 // spend expensive time comparing all these strings... 769 // spend expensive time comparing all these strings...
754 // but only call if we changed something -zecke 770 // but only call if we changed something -zecke
755 populateCategories(); 771 populateCategories();
756 } 772 }
757 raiseCurrentView( ); 773 raiseCurrentView( );
758 774
759 return uid; 775 return uid;
760} 776}
761/* delete it silently... */ 777/* delete it silently... */
762bool MainWindow::remove( int uid ) { 778bool MainWindow::remove( int uid ) {
763 if (m_syncing) return false; 779 if (m_syncing) return false;
764 780
765 return m_todoMgr.remove( uid ); 781 return m_todoMgr.remove( uid );
766} 782}
767void MainWindow::beam( int uid, int ) { 783void MainWindow::beam( int uid, int ) {
768 ::unlink( beamfile ); 784 ::unlink( beamfile );
769 OTodo todo = event( uid ); 785 OTodo todo = event( uid );
770 OTodoAccessVCal* cal = new OTodoAccessVCal(QString::fromLatin1(beamfile) ); 786 OTodoAccessVCal* cal = new OTodoAccessVCal(QString::fromLatin1(beamfile) );
771 OTodoAccess acc( cal ); 787 OTodoAccess acc( cal );
772 acc.load(); 788 acc.load();
773 acc.add( todo ); 789 acc.add( todo );
774 acc.save(); 790 acc.save();
775 Ir* ir = new Ir(this ); 791 Ir* ir = new Ir(this );
776 connect(ir, SIGNAL(done(Ir*) ), 792 connect(ir, SIGNAL(done(Ir*) ),
777 this, SLOT(beamDone(Ir*) ) ); 793 this, SLOT(beamDone(Ir*) ) );
778 ir->send( beamfile, todo.summary(), "text/x-vCalendar" ); 794 ir->send( beamfile, todo.summary(), "text/x-vCalendar" );
779} 795}
780void MainWindow::show( int uid ) { 796void MainWindow::show( int uid ) {
781 slotShow( uid ); 797 slotShow( uid );
782} 798}
783void MainWindow::edit( int uid ) { 799void MainWindow::edit( int uid ) {
784 slotEdit( uid ); 800 slotEdit( uid );
785} 801}
786void MainWindow::add( const OPimRecord& rec) { 802void MainWindow::add( const OPimRecord& rec) {
787 if ( rec.rtti() != OTodo::rtti() ) return; 803 if ( rec.rtti() != OTodo::rtti() ) return;
788 804
789 const OTodo& todo = static_cast<const OTodo&>(rec); 805 const OTodo& todo = static_cast<const OTodo&>(rec);
790 806
791 m_todoMgr.add(todo ); 807 m_todoMgr.add(todo );
792 currentView()->addEvent( todo ); 808 currentView()->addEvent( todo );
793 809
794 810
795 // I'm afraid we must call this every time now, otherwise 811 // I'm afraid we must call this every time now, otherwise
796 // spend expensive time comparing all these strings... 812 // spend expensive time comparing all these strings...
797 // but only call if we changed something -zecke 813 // but only call if we changed something -zecke
798 populateCategories(); 814 populateCategories();
799} 815}
diff --git a/core/pim/todo/mainwindow.h b/core/pim/todo/mainwindow.h
index 87a9133..86b9ac2 100644
--- a/core/pim/todo/mainwindow.h
+++ b/core/pim/todo/mainwindow.h
@@ -1,202 +1,206 @@
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 33
34#include <opie/otodoaccess.h> 34#include <opie/otodoaccess.h>
35#include <opie/otodo.h> 35#include <opie/otodo.h>
36#include <opie/opimmainwindow.h> 36#include <opie/opimmainwindow.h>
37 37
38#include "smalltodo.h" 38#include "smalltodo.h"
39#include "todoview.h" 39#include "todoview.h"
40#include "quickedit.h" 40#include "quickedit.h"
41#include "todomanager.h" 41#include "todomanager.h"
42 42
43class QPopupMenu; 43class QPopupMenu;
44class QMenuBar; 44class QMenuBar;
45class QToolBar; 45class QToolBar;
46class QAction; 46class QAction;
47class QWidgetStack; 47class QWidgetStack;
48class Ir; 48class Ir;
49class QVBox; 49class QVBox;
50class QLineEdit;
50 51
51namespace Todo { 52namespace Todo {
52 typedef TodoView View; 53 typedef TodoView View;
53 class TemplateManager; 54 class TemplateManager;
54 class Editor; 55 class Editor;
55 class TodoShow; 56 class TodoShow;
56 class TemplateEditor; 57 class TemplateEditor;
57 struct QuickEditBase; 58 struct QuickEditBase;
58 59
59 class MainWindow : public OPimMainWindow { 60 class MainWindow : public OPimMainWindow {
60 Q_OBJECT 61 Q_OBJECT
61 friend class TodoView; // avoid QObject here.... 62 friend class TodoView; // avoid QObject here....
62 public: 63 public:
63 MainWindow( QWidget *parent = 0, 64 MainWindow( QWidget *parent = 0,
64 const char* name = 0 ); 65 const char* name = 0 );
65 ~MainWindow(); 66 ~MainWindow();
66 67
67 /** return a context menu for an OTodo */ 68 /** return a context menu for an OTodo */
68 QPopupMenu* contextMenu(int uid, bool doesRecur = FALSE ); 69 QPopupMenu* contextMenu(int uid, bool doesRecur = FALSE );
69 QPopupMenu* options(); 70 QPopupMenu* options();
70 QPopupMenu* edit(); 71 QPopupMenu* edit();
71 QToolBar* toolbar(); 72 QToolBar* toolbar();
72 73
73 74
74 void updateList(); 75 void updateList();
75 OTodoAccess::List list()const; 76 OTodoAccess::List list()const;
76 OTodoAccess::List sorted( bool asc, int sortOrder ); 77 OTodoAccess::List sorted( bool asc, int sortOrder );
77 OTodoAccess::List sorted( bool asc, int sortOrder, int addFilter ); 78 OTodoAccess::List sorted( bool asc, int sortOrder, int addFilter );
78 79
79 OTodo event(int uid ); 80 OTodo event(int uid );
80 81
81 bool isSyncing()const; 82 bool isSyncing()const;
82 bool showCompleted()const; 83 bool showCompleted()const;
83 bool showDeadline()const; 84 bool showDeadline()const;
84 bool showOverDue()const; 85 bool showOverDue()const;
86 bool showQuickTask()const;
85 QString currentCategory()const; 87 QString currentCategory()const;
86 int currentCatId(); 88 int currentCatId();
87 TemplateManager* templateManager(); 89 TemplateManager* templateManager();
88 QuickEditBase* quickEditor(); 90 QuickEditBase* quickEditor();
89 91
90 void updateTodo( const OTodo& ); 92 void updateTodo( const OTodo& );
91 void populateTemplates(); 93 void populateTemplates();
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 populateCategories(); 98 void populateCategories();
97 void slotReload(); 99 void slotReload();
98 void slotFlush(); 100 void slotFlush();
99 101
100 protected: 102 protected:
101 void closeEvent( QCloseEvent* e ); 103 void closeEvent( QCloseEvent* e );
102 104
103 private: 105 private:
104 void receiveFile( const QString& filename ); 106 void receiveFile( const QString& filename );
105 void connectBase( ViewBase* ); 107 void connectBase( ViewBase* );
106 void initUI(); 108 void initUI();
107 void initActions(); 109 void initActions();
108 void initConfig(); 110 void initConfig();
109 void initViews(); 111 void initViews();
110 void initEditor(); 112 void initEditor();
111 void initShow(); 113 void initShow();
112 void initTemplate(); 114 void initTemplate();
113 void raiseCurrentView(); 115 void raiseCurrentView();
114 ViewBase* currentView(); 116 ViewBase* currentView();
115 ViewBase* m_curView; 117 ViewBase* m_curView;
116 QuickEditBase* m_curQuick; 118 QuickEditBase* m_curQuick;
117 Editor* m_curEdit; 119 Editor* m_curEdit;
118 TodoShow* currentShow(); 120 TodoShow* currentShow();
119 TodoShow* m_curShow; 121 TodoShow* m_curShow;
120 TemplateEditor* currentTemplateEditor(); 122 TemplateEditor* currentTemplateEditor();
121 TemplateEditor* m_curTempEd; 123 TemplateEditor* m_curTempEd;
122 124
123 QMenuBar* m_bar; 125 QMenuBar* m_bar;
124 QToolBar* m_tool; 126 QToolBar* m_tool;
125 QAction* m_editAction, 127 QAction* m_editAction,
126 *m_deleteAction, 128 *m_deleteAction,
127 *m_findAction, 129 *m_findAction,
128 *m_completedAction, 130 *m_completedAction,
129 *m_showDeadLineAction, 131 *m_showDeadLineAction,
130 *m_deleteAllAction, 132 *m_deleteAllAction,
131 *m_deleteCompleteAction, 133 *m_deleteCompleteAction,
132 *m_duplicateAction, 134 *m_duplicateAction,
133 *m_showOverDueAction, 135 *m_showOverDueAction,
136 *m_showQuickTaskAction,
134 *m_effectiveAction; 137 *m_effectiveAction;
135 QWidgetStack *m_stack; 138 QWidgetStack *m_stack;
136 QPopupMenu* m_catMenu, 139 QPopupMenu* m_catMenu,
137 *m_edit, 140 *m_edit,
138 *m_options, 141 *m_options,
139 *m_template; 142 *m_template;
140 /* box with two rows 143 /* box with two rows
141 * top will be the quick edit 144 * top will be the quick edit
142 * this will bite my ass once 145 * this will bite my ass once
143 * we want to have all parts 146 * we want to have all parts
144 * exchangeable 147 * exchangeable
145 */ 148 */
146 QVBox* m_mainBox; 149 QVBox* m_mainBox;
147 150
148 bool m_syncing:1; 151 bool m_syncing:1;
149 bool m_deadline:1; 152 bool m_deadline:1;
150 bool m_completed:1; 153 bool m_completed:1;
151 bool m_overdue:1; 154 bool m_overdue:1;
155 bool m_quicktask:1;
152 TodoManager m_todoMgr; 156 TodoManager m_todoMgr;
153 QString m_curCat; 157 QString m_curCat;
154 QList<ViewBase> m_views; 158 QList<ViewBase> m_views;
155 QList<QuickEditBase> m_quickEdit;
156 uint m_counter; 159 uint m_counter;
157 TemplateManager* m_tempManager; 160 TemplateManager* m_tempManager;
158 161
159 162
160 private slots: 163 private slots:
161 void slotShow(int); 164 void slotShow(int);
162 void slotEdit(int); 165 void slotEdit(int);
163 void slotUpdate3( QWidget* ); 166 void slotUpdate3( QWidget* );
164 void slotComplete( int uid ); 167 void slotComplete( int uid );
165 void slotComplete( const OTodo& ev ); 168 void slotComplete( const OTodo& ev );
166 void slotNewFromTemplate(int id ); 169 void slotNewFromTemplate(int id );
167 void slotNew(); 170 void slotNew();
168 void slotDuplicate(); 171 void slotDuplicate();
169 172
170 void slotDelete(); 173 void slotDelete();
171 void slotDeleteAll(); 174 void slotDeleteAll();
172 void slotDeleteCompleted(); 175 void slotDeleteCompleted();
173 176
174 void slotEdit(); 177 void slotEdit();
175 void slotFind(); 178 void slotFind();
176 179
177 void setCategory( int ); 180 void setCategory( int );
178 181
179 void slotShowDeadLine( bool ); 182 void slotShowDeadLine( bool );
180 void slotShowCompleted( bool ); 183 void slotShowCompleted( bool );
184 void slotShowQuickTask( bool );
181 185
182 void setDocument( const QString& ); 186 void setDocument( const QString& );
183 187
184 188
185 void slotBeam(); 189 void slotBeam();
186 void beamDone( Ir* ); 190 void beamDone( Ir* );
187 void slotShowDetails(); 191 void slotShowDetails();
188 void slotShowDue( bool ); 192 void slotShowDue( bool );
189 /* reimplementation from opimmainwindow */ 193 /* reimplementation from opimmainwindow */
190 protected slots: 194 protected slots:
191 void flush(); 195 void flush();
192 void reload(); 196 void reload();
193 int create(); 197 int create();
194 bool remove( int uid ); 198 bool remove( int uid );
195 void beam(int uid, int transport = IrDa ); 199 void beam(int uid, int transport = IrDa );
196 void show( int uid ); 200 void show( int uid );
197 void edit( int uid ); 201 void edit( int uid );
198 void add( const OPimRecord& ); 202 void add( const OPimRecord& );
199 }; 203 };
200}; 204};
201 205
202#endif 206#endif
diff --git a/core/pim/todo/quickeditimpl.cpp b/core/pim/todo/quickeditimpl.cpp
index 2dd5b61..9b54bdc 100644
--- a/core/pim/todo/quickeditimpl.cpp
+++ b/core/pim/todo/quickeditimpl.cpp
@@ -1,89 +1,99 @@
1#include <qaction.h>
1#include <qlineedit.h> 2#include <qlineedit.h>
2 3
4#include <qpe/resource.h>
5
3#include <opie/oclickablelabel.h> 6#include <opie/oclickablelabel.h>
4 7
5#include "mainwindow.h" 8#include "mainwindow.h"
6#include "quickeditimpl.h" 9#include "quickeditimpl.h"
7 10
8 11
9QuickEditImpl::QuickEditImpl( Todo::MainWindow* win, QWidget* arent ) 12QuickEditImpl::QuickEditImpl( QWidget* parent, bool visible )
10 : QHBox(arent), Todo::QuickEdit(win) { 13 : QPEToolBar( (QMainWindow *)parent ), Todo::QuickEdit( (Todo::MainWindow *)parent ) {
11 m_lbl = new OClickableLabel(this ); 14 setHorizontalStretchable( TRUE );
12 m_lbl->setMinimumWidth(12);
13 m_lbl->setText("3");
14 15
15 m_edit = new QLineEdit(this ); 16 // TODO - come up with icons and replace text priority values
17 m_lbl = new OClickableLabel( this );
18 m_lbl->setMinimumWidth(15);
19 m_lbl->setText("3");
20 connect(m_lbl, SIGNAL(clicked() ), this, SLOT(slotPrio()) );
16 21
17 m_enter = new OClickableLabel(this); 22 m_edit = new QLineEdit( this );
18 m_enter->setText("Enter"); 23 setStretchableWidget( m_edit );
19 24
20 m_more = new OClickableLabel(this); 25 QAction *a = new QAction( tr( "More" ), Resource::loadPixmap( "todo/more" ), QString::null, 0, this, 0 );
21 m_more->setText("More"); 26 connect( a, SIGNAL( activated() ), this, SLOT( slotMore() ) );
27 a->addTo( this );
22 28
29 a = new QAction( tr( "Enter" ), Resource::loadPixmap( "enter" ), QString::null, 0, this, 0 );
30 connect( a, SIGNAL( activated() ), this, SLOT( slotEnter() ) );
31 a->addTo( this );
23 32
24 // connect 33 a = new QAction( tr( "Cancel" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
25 connect(m_lbl, SIGNAL(clicked() ), 34 connect( a, SIGNAL( activated() ), this, SLOT( slotCancel() ) );
26 this, SLOT(slotPrio()) ); 35 a->addTo( this );
27 connect(m_enter, SIGNAL(clicked() ),
28 this, SLOT(slotEnter() ) );
29 connect(m_more, SIGNAL(clicked() ),
30 this, SLOT(slotMore() ) );
31 36
37 m_visible = visible;
38 if ( !m_visible ) {
39 hide();
40 }
41
32 m_menu = 0l; 42 m_menu = 0l;
33 reinit(); 43 reinit();
34 setMaximumHeight( m_edit->sizeHint().height() );
35} 44}
36QuickEditImpl::~QuickEditImpl() { 45QuickEditImpl::~QuickEditImpl() {
37 46
38} 47}
39OTodo QuickEditImpl::todo()const { 48OTodo QuickEditImpl::todo()const {
40 return m_todo; 49 return m_todo;
41} 50}
42QWidget* QuickEditImpl::widget() { 51QWidget* QuickEditImpl::widget() {
43 return this; 52 return this;
44} 53}
45QSize QuickEditImpl::sizeHint()const{
46 return m_edit->sizeHint();
47}
48void QuickEditImpl::slotEnter() { 54void QuickEditImpl::slotEnter() {
49 OTodo todo; 55 OTodo todo;
50 56
51 57
52 if (!m_edit->text().isEmpty() ) { 58 if (!m_edit->text().isEmpty() ) {
53 todo.setUid(1 ); // new uid 59 todo.setUid(1 ); // new uid
54 todo.setPriority( m_lbl->text().toInt() ); 60 todo.setPriority( m_lbl->text().toInt() );
55 todo.setSummary( m_edit->text() ); 61 todo.setSummary( m_edit->text() );
56 if ( mainWindow()->currentCatId() != 0 ) 62 if ( ((Todo::MainWindow *)parent())->currentCatId() != 0 )
57 todo.setCategories( mainWindow()->currentCatId() ); 63 todo.setCategories( ((Todo::MainWindow *)parent())->currentCatId() );
58 64
59 m_todo = todo; 65 m_todo = todo;
60 commit(); 66 commit();
61 } 67 }
62 m_todo = todo; 68 m_todo = todo;
63 reinit(); 69 reinit();
64} 70}
65void QuickEditImpl::slotPrio() { 71void QuickEditImpl::slotPrio() {
66 m_state++; 72 m_state++;
67 if (m_state > 2 ) 73 if (m_state > 2 )
68 m_state = 0; 74 m_state = 0;
69 75
70 switch(m_state ) { 76 switch(m_state ) {
71 case 0: 77 case 0:
72 m_lbl->setText( "1" ); 78 m_lbl->setText( "1" );
73 break; 79 break;
74 case 2: 80 case 2:
75 m_lbl->setText( "5" ); 81 m_lbl->setText( "5" );
76 break; 82 break;
77 case 1: 83 case 1:
78 default: 84 default:
79 m_lbl->setText( "3"); 85 m_lbl->setText( "3");
80 break; 86 break;
81 } 87 }
82} 88}
83void QuickEditImpl::slotMore() { 89void QuickEditImpl::slotMore() {
90 // TODO - implement
91}
92void QuickEditImpl::slotCancel() {
93 reinit();
84} 94}
85void QuickEditImpl::reinit() { 95void QuickEditImpl::reinit() {
86 m_state = 1; 96 m_state = 1;
87 m_lbl->setText("3"); 97 m_lbl->setText("3");
88 m_edit->clear(); 98 m_edit->clear();
89} 99}
diff --git a/core/pim/todo/quickeditimpl.h b/core/pim/todo/quickeditimpl.h
index d0f6c69..c58275e 100644
--- a/core/pim/todo/quickeditimpl.h
+++ b/core/pim/todo/quickeditimpl.h
@@ -1,34 +1,35 @@
1#ifndef OPIE_QUICK_EDIT_IMPL_H 1#ifndef OPIE_QUICK_EDIT_IMPL_H
2#define OPIE_QUICK_EDIT_IMPL_H 2#define OPIE_QUICK_EDIT_IMPL_H
3 3
4#include <qhbox.h> 4#include <qpe/qpetoolbar.h>
5 5
6#include "quickedit.h" 6#include "quickedit.h"
7 7
8class QLineEdit; 8class QLineEdit;
9class QLabel; 9class QLabel;
10 10
11class QuickEditImpl : public QHBox, public Todo::QuickEdit { 11class QuickEditImpl : public QPEToolBar, public Todo::QuickEdit {
12 Q_OBJECT 12 Q_OBJECT
13public: 13public:
14 QuickEditImpl( Todo::MainWindow* win , QWidget* parent); 14 QuickEditImpl( QWidget* parent, bool visible);
15 ~QuickEditImpl(); 15 ~QuickEditImpl();
16 OTodo todo()const; 16 OTodo todo()const;
17 QWidget* widget(); 17 QWidget* widget();
18 QSize sizeHint()const;
19private slots: 18private slots:
20 void slotEnter(); 19 void slotEnter();
21 void slotPrio(); 20 void slotPrio();
22 void slotMore(); 21 void slotMore();
22 void slotCancel();
23private: 23private:
24 void reinit(); 24 void reinit();
25 int m_state; 25 int m_state;
26 QLabel* m_lbl; 26 QLabel* m_lbl;
27 QLineEdit* m_edit; 27 QLineEdit* m_edit;
28 QLabel* m_enter; 28 QLabel* m_enter;
29 QLabel* m_more; 29 QLabel* m_more;
30 QPopupMenu* m_menu; 30 QPopupMenu* m_menu;
31 OTodo m_todo; 31 OTodo m_todo;
32 bool m_visible;
32}; 33};
33 34
34#endif 35#endif