summaryrefslogtreecommitdiff
authorzecke <zecke>2002-06-17 15:41:06 (UTC)
committer zecke <zecke>2002-06-17 15:41:06 (UTC)
commit02e724757f13f40d85136c3a14e0a3788d28236e (patch) (unidiff)
treee927455a1b5f0b5e6739f180106dbc98b60628c0
parentdcba3fed4f2abf001ced72b573f6e50f6b37e1e6 (diff)
downloadopie-02e724757f13f40d85136c3a14e0a3788d28236e.zip
opie-02e724757f13f40d85136c3a14e0a3788d28236e.tar.gz
opie-02e724757f13f40d85136c3a14e0a3788d28236e.tar.bz2
Fool Qt and fool QtDesigner to unfuck the designer .ui *evilgrin*
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/todo/mainwindow.cpp2
-rw-r--r--core/pim/todo/todoentry.ui630
-rw-r--r--core/pim/todo/todoentryimpl.cpp4
3 files changed, 340 insertions, 296 deletions
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp
index fa9c221..d419166 100644
--- a/core/pim/todo/mainwindow.cpp
+++ b/core/pim/todo/mainwindow.cpp
@@ -1,628 +1,628 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** Copyright (C) 2002 zecke 3** Copyright (C) 2002 zecke
4** Copyright (C) 2002 Stefan Eilers (se, eilers.stefan@epost.de) 4** Copyright (C) 2002 Stefan Eilers (se, eilers.stefan@epost.de)
5** 5**
6** This file is part of Qtopia Environment. 6** This file is part of Qtopia Environment.
7** 7**
8** This file may be distributed and/or modified under the terms of the 8** This file may be distributed and/or modified under the terms of the
9** GNU General Public License version 2 as published by the Free Software 9** GNU General Public License version 2 as published by the Free Software
10** Foundation and appearing in the file LICENSE.GPL included in the 10** Foundation and appearing in the file LICENSE.GPL included in the
11** packaging of this file. 11** packaging of this file.
12** 12**
13** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 13** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
14** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 14** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
15** 15**
16** See http://www.trolltech.com/gpl/ for GPL licensing information. 16** See http://www.trolltech.com/gpl/ for GPL licensing information.
17** 17**
18** Contact info@trolltech.com if any conditions of this licensing are 18** Contact info@trolltech.com if any conditions of this licensing are
19** not clear to you. 19** not clear to you.
20** 20**
21**********************************************************************/ 21**********************************************************************/
22 22
23#define QTOPIA_INTERNAL_FD 23#define QTOPIA_INTERNAL_FD
24 24
25#include "mainwindow.h" 25#include "mainwindow.h"
26#include "todoentryimpl.h" 26#include "todoentryimpl.h"
27#include "todotable.h" 27#include "todotable.h"
28#include "todolabel.h" 28#include "todolabel.h"
29 29
30#include <opie/tododb.h> 30#include <opie/tododb.h>
31#include <opie/todovcalresource.h> 31#include <opie/todovcalresource.h>
32#include <opie/ofontmenu.h> 32#include <opie/ofontmenu.h>
33 33
34#include <qpe/qpeapplication.h> 34#include <qpe/qpeapplication.h>
35#include <qpe/config.h> 35#include <qpe/config.h>
36#include <qpe/finddialog.h> 36#include <qpe/finddialog.h>
37#include <qpe/global.h> 37#include <qpe/global.h>
38#include <qpe/ir.h> 38#include <qpe/ir.h>
39#include <qpe/qpemenubar.h> 39#include <qpe/qpemenubar.h>
40#include <qpe/qpemessagebox.h> 40#include <qpe/qpemessagebox.h>
41#include <qpe/resource.h> 41#include <qpe/resource.h>
42//#include <qpe/task.h> 42//#include <qpe/task.h>
43#include <qpe/qpetoolbar.h> 43#include <qpe/qpetoolbar.h>
44 44
45#include <qaction.h> 45#include <qaction.h>
46#include <qarray.h> 46#include <qarray.h>
47#include <qdatastream.h> 47#include <qdatastream.h>
48#include <qdatetime.h> 48#include <qdatetime.h>
49#include <qfile.h> 49#include <qfile.h>
50#include <qmessagebox.h> 50#include <qmessagebox.h>
51#include <qpopupmenu.h> 51#include <qpopupmenu.h>
52#include <qwidgetstack.h> 52#include <qwidgetstack.h>
53 53
54#include <sys/stat.h> 54#include <sys/stat.h>
55#include <sys/types.h> 55#include <sys/types.h>
56#include <fcntl.h> 56#include <fcntl.h>
57#include <unistd.h> 57#include <unistd.h>
58 58
59#include <stdlib.h> 59#include <stdlib.h>
60 60
61static QString todolistXMLFilename() 61static QString todolistXMLFilename()
62{ 62{
63 return Global::applicationFileName("todolist","todolist.xml"); 63 return Global::applicationFileName("todolist","todolist.xml");
64} 64}
65 65
66static QString categoriesXMLFilename() 66static QString categoriesXMLFilename()
67{ 67{
68 return Global::applicationFileName("todolist","categories.xml"); 68 return Global::applicationFileName("todolist","categories.xml");
69} 69}
70 70
71TodoWindow::TodoWindow( QWidget *parent, const char *name, WFlags f ) : 71TodoWindow::TodoWindow( QWidget *parent, const char *name, WFlags f ) :
72 QMainWindow( parent, name, f ), syncing(FALSE) 72 QMainWindow( parent, name, f ), syncing(FALSE)
73{ 73{
74// QTime t; 74// QTime t;
75// t.start(); 75// t.start();
76 mView = 0l; 76 mView = 0l;
77 mStack = new QWidgetStack(this, "main stack"); 77 mStack = new QWidgetStack(this, "main stack");
78 setCentralWidget( mStack ); 78 setCentralWidget( mStack );
79 setCaption( tr("Todo") ); 79 setCaption( tr("Todo") );
80 QString str; 80 QString str;
81 table = new TodoTable( this ); 81 table = new TodoTable( this );
82 table->setColumnWidth( 2, 10 ); 82 table->setColumnWidth( 2, 10 );
83 table->setPaintingEnabled( FALSE ); 83 table->setPaintingEnabled( FALSE );
84 table->setUpdatesEnabled( FALSE ); 84 table->setUpdatesEnabled( FALSE );
85 table->viewport()->setUpdatesEnabled( FALSE ); 85 table->viewport()->setUpdatesEnabled( FALSE );
86 86
87 { 87 {
88 str = todolistXMLFilename(); 88 str = todolistXMLFilename();
89 if ( str.isNull() ) 89 if ( str.isNull() )
90 QMessageBox::critical( this, 90 QMessageBox::critical( this,
91 tr("Out of Space"), 91 tr("Out of Space"),
92 tr("Unable to create startup files\n" 92 tr("Unable to create startup files\n"
93 "Free up some space\n" 93 "Free up some space\n"
94 "before you enter any data") ); 94 "before you enter any data") );
95 else 95 else
96 table->load( str ); 96 table->load( str );
97 } 97 }
98 98
99 // repeat for categories... 99 // repeat for categories...
100 str = categoriesXMLFilename(); 100 str = categoriesXMLFilename();
101 if ( str.isNull() ) 101 if ( str.isNull() )
102 QMessageBox::critical( this, 102 QMessageBox::critical( this,
103 tr( "Out of Space" ), 103 tr( "Out of Space" ),
104 tr( "Unable to create startup files\n" 104 tr( "Unable to create startup files\n"
105 "Free up some space\n" 105 "Free up some space\n"
106 "before you enter any data") ); 106 "before you enter any data") );
107 107
108 mStack->addWidget(table, 1 ); 108 mStack->addWidget(table, 1 );
109 mStack->raiseWidget( 1 ); 109 mStack->raiseWidget( 1 );
110 setCentralWidget( mStack ); 110 setCentralWidget( mStack );
111 setToolBarsMovable( FALSE ); 111 setToolBarsMovable( FALSE );
112 112
113// qDebug("after load: t=%d", t.elapsed() ); 113// qDebug("after load: t=%d", t.elapsed() );
114 114
115 Config config( "todo" ); 115 Config config( "todo" );
116 config.setGroup( "View" ); 116 config.setGroup( "View" );
117 bool complete = config.readBoolEntry( "ShowComplete", true ); 117 bool complete = config.readBoolEntry( "ShowComplete", true );
118 table->setShowCompleted( complete ); 118 table->setShowCompleted( complete );
119 119
120 bool showdeadline = config.readBoolEntry("ShowDeadLine", true); 120 bool showdeadline = config.readBoolEntry("ShowDeadLine", true);
121 table->setShowDeadline (showdeadline); 121 table->setShowDeadline (showdeadline);
122 122
123 QString category = config.readEntry( "Category", QString::null ); 123 QString category = config.readEntry( "Category", QString::null );
124 table->setShowCategory( category ); 124 table->setShowCategory( category );
125 125
126 QPEToolBar *bar = new QPEToolBar( this ); 126 QPEToolBar *bar = new QPEToolBar( this );
127 bar->setHorizontalStretchable( TRUE ); 127 bar->setHorizontalStretchable( TRUE );
128 128
129 QPEMenuBar *mb = new QPEMenuBar( bar ); 129 QPEMenuBar *mb = new QPEMenuBar( bar );
130 130
131 catMenu = new QPopupMenu( this ); 131 catMenu = new QPopupMenu( this );
132 QPopupMenu *edit = new QPopupMenu( this ); 132 QPopupMenu *edit = new QPopupMenu( this );
133 QPopupMenu *options = new QPopupMenu(this ); 133 QPopupMenu *options = new QPopupMenu(this );
134 134
135 contextMenu = new QPopupMenu( this ); 135 contextMenu = new QPopupMenu( this );
136 136
137 bar = new QPEToolBar( this ); 137 bar = new QPEToolBar( this );
138 138
139 QAction *a = new QAction( tr( "New Task" ), Resource::loadPixmap( "new" ), 139 QAction *a = new QAction( tr( "New Task" ), Resource::loadPixmap( "new" ),
140 QString::null, 0, this, 0 ); 140 QString::null, 0, this, 0 );
141 connect( a, SIGNAL( activated() ), 141 connect( a, SIGNAL( activated() ),
142 this, SLOT( slotNew() ) ); 142 this, SLOT( slotNew() ) );
143 a->addTo( bar ); 143 a->addTo( bar );
144 a->addTo( edit ); 144 a->addTo( edit );
145 145
146 a = new QAction( tr( "Edit Task" ), Resource::loadIconSet( "edit" ), 146 a = new QAction( tr( "Edit Task" ), Resource::loadIconSet( "edit" ),
147 QString::null, 0, this, 0 ); 147 QString::null, 0, this, 0 );
148 connect( a, SIGNAL( activated() ), 148 connect( a, SIGNAL( activated() ),
149 this, SLOT( slotEdit() ) ); 149 this, SLOT( slotEdit() ) );
150 a->addTo( bar ); 150 a->addTo( bar );
151 a->addTo( edit ); 151 a->addTo( edit );
152 a->addTo( contextMenu ); 152 a->addTo( contextMenu );
153 a->setEnabled( FALSE ); 153 a->setEnabled( FALSE );
154 editAction = a; 154 editAction = a;
155 155
156 a = new QAction( QString::null, tr("View Task"), 0, this, 0 ); 156 a = new QAction( QString::null, tr("View Task"), 0, this, 0 );
157 a->addTo( edit ); 157 a->addTo( edit );
158 a->addTo( contextMenu ); 158 a->addTo( contextMenu );
159 connect( a, SIGNAL( activated() ), 159 connect( a, SIGNAL( activated() ),
160 this, SLOT(slotShowDetails() ) ); 160 this, SLOT(slotShowDetails() ) );
161 161
162 edit->insertSeparator(); 162 edit->insertSeparator();
163 163
164 a = new QAction( tr( "Delete..." ), Resource::loadIconSet( "trash" ), 164 a = new QAction( tr( "Delete..." ), Resource::loadIconSet( "trash" ),
165 QString::null, 0, this, 0 ); 165 QString::null, 0, this, 0 );
166 connect( a, SIGNAL( activated() ), 166 connect( a, SIGNAL( activated() ),
167 this, SLOT( slotDelete() ) ); 167 this, SLOT( slotDelete() ) );
168 a->addTo( bar ); 168 a->addTo( bar );
169 a->addTo( edit ); 169 a->addTo( edit );
170 a->addTo( contextMenu ); 170 a->addTo( contextMenu );
171 a->setEnabled( FALSE ); 171 a->setEnabled( FALSE );
172 deleteAction = a; 172 deleteAction = a;
173 173
174 // delete All in category is missing.... 174 // delete All in category is missing....
175 // set All Done 175 // set All Done
176 // set All Done in category 176 // set All Done in category
177 177
178 a = new QAction( QString::null, tr( "Delete all..."), 0, this, 0 ); 178 a = new QAction( QString::null, tr( "Delete all..."), 0, this, 0 );
179 connect(a, SIGNAL( activated() ), 179 connect(a, SIGNAL( activated() ),
180 this, SLOT( slotDeleteAll() ) ); 180 this, SLOT( slotDeleteAll() ) );
181 a->addTo(edit ); 181 a->addTo(edit );
182 a->setEnabled( FALSE ); 182 a->setEnabled( FALSE );
183 deleteAllAction = a; 183 deleteAllAction = a;
184 184
185 edit->insertSeparator(); 185 edit->insertSeparator();
186 a = new QAction( QString::null, tr("Duplicate" ), 0, this, 0 ); 186 a = new QAction( QString::null, tr("Duplicate" ), 0, this, 0 );
187 connect(a, SIGNAL( activated() ), 187 connect(a, SIGNAL( activated() ),
188 this, SLOT( slotDuplicate() ) ); 188 this, SLOT( slotDuplicate() ) );
189 a->addTo(edit ); 189 a->addTo(edit );
190 a->setEnabled( FALSE ); 190 a->setEnabled( FALSE );
191 duplicateAction = a; 191 duplicateAction = a;
192 edit->insertSeparator(); 192 edit->insertSeparator();
193 193
194 194
195 195
196 if ( Ir::supported() ) { 196 if ( Ir::supported() ) {
197 a = new QAction( tr( "Beam" ), Resource::loadPixmap( "beam" ), 197 a = new QAction( tr( "Beam" ), Resource::loadPixmap( "beam" ),
198 QString::null, 0, this, 0 ); 198 QString::null, 0, this, 0 );
199 connect( a, SIGNAL( activated() ), 199 connect( a, SIGNAL( activated() ),
200 this, SLOT( slotBeam() ) ); 200 this, SLOT( slotBeam() ) );
201 a->addTo( edit ); 201 a->addTo( edit );
202 a->addTo( bar ); 202 a->addTo( bar );
203 } 203 }
204 204
205 a = new QAction( tr( "Find" ), Resource::loadIconSet( "mag" ), 205 a = new QAction( tr( "Find" ), Resource::loadIconSet( "mag" ),
206 QString::null, 0, this, 0 ); 206 QString::null, 0, this, 0 );
207 connect( a, SIGNAL( activated() ), 207 connect( a, SIGNAL( activated() ),
208 this, SLOT( slotFind() ) ); 208 this, SLOT( slotFind() ) );
209 a->addTo( bar ); 209// a->addTo( bar );
210 a->addTo( options ); 210 a->addTo( options );
211 options->insertSeparator(); 211 options->insertSeparator();
212 212
213 if ( table->numRows() ) 213 if ( table->numRows() )
214 a->setEnabled( TRUE ); 214 a->setEnabled( TRUE );
215 else 215 else
216 a->setEnabled( FALSE ); 216 a->setEnabled( FALSE );
217 217
218 //a->setEnabled( FALSE ); 218 //a->setEnabled( FALSE );
219 findAction = a; 219 findAction = a;
220// qDebug("mainwindow #2: t=%d", t.elapsed() ); 220// qDebug("mainwindow #2: t=%d", t.elapsed() );
221 221
222 completedAction = new QAction( QString::null, tr("Completed tasks"), 0, this, 0, TRUE ); 222 completedAction = new QAction( QString::null, tr("Completed tasks"), 0, this, 0, TRUE );
223 223
224 showdeadlineAction = new QAction( QString::null, tr( "Show Deadline" ), 0, this, 0, TRUE ); 224 showdeadlineAction = new QAction( QString::null, tr( "Show Deadline" ), 0, this, 0, TRUE );
225 225
226 catMenu->setCheckable( true ); 226 catMenu->setCheckable( true );
227 populateCategories(); 227 populateCategories();
228 228
229 229
230 completedAction->addTo( options ); 230 completedAction->addTo( options );
231 completedAction->setOn( table->showCompleted() ); 231 completedAction->setOn( table->showCompleted() );
232 showdeadlineAction->addTo( options ); 232 showdeadlineAction->addTo( options );
233 showdeadlineAction->setOn( table->showDeadline() ); 233 showdeadlineAction->setOn( table->showDeadline() );
234 options->insertSeparator( ); 234 options->insertSeparator( );
235 QList<QWidget> list; 235 QList<QWidget> list;
236 list.append(table ); 236 list.append(table );
237 OFontMenu *menu = new OFontMenu(this, "menu",list ); 237 OFontMenu *menu = new OFontMenu(this, "menu",list );
238 menu->forceSize( table->horizontalHeader(), 10 ); 238 menu->forceSize( table->horizontalHeader(), 10 );
239 //catMenu->insertItem(tr("Fonts"), menu ); 239 //catMenu->insertItem(tr("Fonts"), menu );
240 list.clear(); 240 list.clear();
241 options->insertItem( tr("Fonts"), menu ); 241 options->insertItem( tr("Fonts"), menu );
242 242
243 243
244 mb->insertItem( tr( "Data" ), edit ); 244 mb->insertItem( tr( "Data" ), edit );
245 mb->insertItem( tr( "Category" ), catMenu ); 245 mb->insertItem( tr( "Category" ), catMenu );
246 mb->insertItem( tr( "Options"), options ); 246 mb->insertItem( tr( "Options"), options );
247 resize( 200, 300 ); 247 resize( 200, 300 );
248 if ( table->numRows() > 0 ) 248 if ( table->numRows() > 0 )
249 currentEntryChanged( 0, 0 ); 249 currentEntryChanged( 0, 0 );
250 connect( table, SIGNAL( signalEdit() ), 250 connect( table, SIGNAL( signalEdit() ),
251 this, SLOT( slotEdit() ) ); 251 this, SLOT( slotEdit() ) );
252 connect( table, SIGNAL(signalShowMenu(const QPoint &)), 252 connect( table, SIGNAL(signalShowMenu(const QPoint &)),
253 this, SLOT( slotShowPopup(const QPoint &)) ); 253 this, SLOT( slotShowPopup(const QPoint &)) );
254 254
255// qDebug("mainwindow #3: t=%d", t.elapsed() ); 255// qDebug("mainwindow #3: t=%d", t.elapsed() );
256 table->updateVisible(); 256 table->updateVisible();
257 table->setUpdatesEnabled( TRUE ); 257 table->setUpdatesEnabled( TRUE );
258 table->setPaintingEnabled( TRUE ); 258 table->setPaintingEnabled( TRUE );
259 table->viewport()->setUpdatesEnabled( TRUE ); 259 table->viewport()->setUpdatesEnabled( TRUE );
260 260
261 // Initialize the table 261 // Initialize the table
262 table->updateVisible(); 262 table->updateVisible();
263 263
264 connect( completedAction, SIGNAL( toggled(bool) ), this, SLOT( showCompleted(bool) ) ); 264 connect( completedAction, SIGNAL( toggled(bool) ), this, SLOT( showCompleted(bool) ) );
265 connect( showdeadlineAction, SIGNAL( toggled(bool) ), this, SLOT( showDeadline(bool) ) ); 265 connect( showdeadlineAction, SIGNAL( toggled(bool) ), this, SLOT( showDeadline(bool) ) );
266 connect( catMenu, SIGNAL(activated(int)), this, SLOT(setCategory(int)) ); 266 connect( catMenu, SIGNAL(activated(int)), this, SLOT(setCategory(int)) );
267 connect( table, SIGNAL( currentChanged( int, int ) ), 267 connect( table, SIGNAL( currentChanged( int, int ) ),
268 this, SLOT( currentEntryChanged( int, int ) ) ); 268 this, SLOT( currentEntryChanged( int, int ) ) );
269 269
270 connect( table, SIGNAL(showDetails(const ToDoEvent &) ), 270 connect( table, SIGNAL(showDetails(const ToDoEvent &) ),
271 this, SLOT(slotShowDetails(const ToDoEvent & ) ) ); 271 this, SLOT(slotShowDetails(const ToDoEvent & ) ) );
272// qDebug("done: t=%d", t.elapsed() ); 272// qDebug("done: t=%d", t.elapsed() );
273} 273}
274 274
275void TodoWindow::slotNew() 275void TodoWindow::slotNew()
276{ 276{
277 if(syncing) { 277 if(syncing) {
278 QMessageBox::warning(this, tr("Todo"), 278 QMessageBox::warning(this, tr("Todo"),
279 tr("Can not edit data, currently syncing")); 279 tr("Can not edit data, currently syncing"));
280 return; 280 return;
281 } 281 }
282 282
283 int id; 283 int id;
284 id = -1; 284 id = -1;
285 QArray<int> ids; 285 QArray<int> ids;
286 ids = table->currentEntry().categories(); 286 ids = table->currentEntry().categories();
287 if ( ids.count() ) 287 if ( ids.count() )
288 id = ids[0]; 288 id = ids[0];
289 NewTaskDialog e( id, this, 0, TRUE ); 289 NewTaskDialog e( id, this, 0, TRUE );
290 290
291 ToDoEvent todo; 291 ToDoEvent todo;
292 292
293#if defined(Q_WS_QWS) || defined(_WS_QWS_) 293#if defined(Q_WS_QWS) || defined(_WS_QWS_)
294 e.showMaximized(); 294 e.showMaximized();
295#endif 295#endif
296 int ret = e.exec(); 296 int ret = e.exec();
297// qWarning("finished" ); 297// qWarning("finished" );
298 if ( ret == QDialog::Accepted ) { 298 if ( ret == QDialog::Accepted ) {
299 table->setPaintingEnabled( false ); 299 table->setPaintingEnabled( false );
300 todo = e.todoEntry(); 300 todo = e.todoEntry();
301 //todo.assignUid(); 301 //todo.assignUid();
302 table->addEntry( todo ); 302 table->addEntry( todo );
303 table->setPaintingEnabled( true ); 303 table->setPaintingEnabled( true );
304 findAction->setEnabled( TRUE ); 304 findAction->setEnabled( TRUE );
305 } 305 }
306 // I'm afraid we must call this every time now, otherwise 306 // I'm afraid we must call this every time now, otherwise
307 // spend expensive time comparing all these strings... 307 // spend expensive time comparing all these strings...
308 populateCategories(); 308 populateCategories();
309 mStack->raiseWidget(1 ); 309 mStack->raiseWidget(1 );
310} 310}
311 311
312TodoWindow::~TodoWindow() 312TodoWindow::~TodoWindow()
313{ 313{
314} 314}
315 315
316void TodoWindow::slotDelete() 316void TodoWindow::slotDelete()
317{ 317{
318 if(syncing) { 318 if(syncing) {
319 QMessageBox::warning(this, tr("Todo"), 319 QMessageBox::warning(this, tr("Todo"),
320 tr("Can not edit data, currently syncing")); 320 tr("Can not edit data, currently syncing"));
321 return; 321 return;
322 } 322 }
323 323
324 if ( table->currentRow() == -1 ) 324 if ( table->currentRow() == -1 )
325 return; 325 return;
326 326
327 QString strName = table->text( table->currentRow(), 2 ).left( 30 ); 327 QString strName = table->text( table->currentRow(), 2 ).left( 30 );
328 328
329 if ( !QPEMessageBox::confirmDelete( this, tr( "Todo" ), strName ) ) 329 if ( !QPEMessageBox::confirmDelete( this, tr( "Todo" ), strName ) )
330 return; 330 return;
331 331
332 332
333 333
334 table->setPaintingEnabled( false ); 334 table->setPaintingEnabled( false );
335 table->removeCurrentEntry(); 335 table->removeCurrentEntry();
336 table->setPaintingEnabled( true ); 336 table->setPaintingEnabled( true );
337 337
338 if ( table->numRows() == 0 ) { 338 if ( table->numRows() == 0 ) {
339 currentEntryChanged( -1, 0 ); 339 currentEntryChanged( -1, 0 );
340 findAction->setEnabled( FALSE ); 340 findAction->setEnabled( FALSE );
341 } 341 }
342 mStack->raiseWidget(1); 342 mStack->raiseWidget(1);
343} 343}
344void TodoWindow::slotDeleteAll() 344void TodoWindow::slotDeleteAll()
345{ 345{
346 if(syncing) { 346 if(syncing) {
347 QMessageBox::warning(this, tr("Todo"), 347 QMessageBox::warning(this, tr("Todo"),
348 tr("Can not edit data, currently syncing")); 348 tr("Can not edit data, currently syncing"));
349 return; 349 return;
350 } 350 }
351 351
352 //QString strName = table->text( table->currentRow(), 2 ).left( 30 ); 352 //QString strName = table->text( table->currentRow(), 2 ).left( 30 );
353 353
354 if ( !QPEMessageBox::confirmDelete( this, tr( "Todo" ), tr("Delete all tasks?") ) ) 354 if ( !QPEMessageBox::confirmDelete( this, tr( "Todo" ), tr("Delete all tasks?") ) )
355 return; 355 return;
356 356
357 357
358 358
359 table->setPaintingEnabled( false ); 359 table->setPaintingEnabled( false );
360 table->removeAllEntries(); 360 table->removeAllEntries();
361 table->setPaintingEnabled( true ); 361 table->setPaintingEnabled( true );
362 362
363 if ( table->numRows() == 0 ) { 363 if ( table->numRows() == 0 ) {
364 currentEntryChanged( -1, 0 ); 364 currentEntryChanged( -1, 0 );
365 findAction->setEnabled( FALSE ); 365 findAction->setEnabled( FALSE );
366 } 366 }
367 mStack->raiseWidget(1 ); 367 mStack->raiseWidget(1 );
368} 368}
369 369
370void TodoWindow::slotEdit() 370void TodoWindow::slotEdit()
371{ 371{
372 if(syncing) { 372 if(syncing) {
373 QMessageBox::warning(this, tr("Todo"), 373 QMessageBox::warning(this, tr("Todo"),
374 tr("Can not edit data, currently syncing")); 374 tr("Can not edit data, currently syncing"));
375 return; 375 return;
376 } 376 }
377 377
378 ToDoEvent todo = table->currentEntry(); 378 ToDoEvent todo = table->currentEntry();
379 qWarning("slotEdit" ); 379 qWarning("slotEdit" );
380 NewTaskDialog e( todo, this, 0, TRUE ); 380 NewTaskDialog e( todo, this, 0, TRUE );
381 e.setCaption( tr( "Edit Task" ) ); 381 e.setCaption( tr( "Edit Task" ) );
382 382
383#if defined(Q_WS_QWS) || defined(_WS_QWS_) 383#if defined(Q_WS_QWS) || defined(_WS_QWS_)
384 e.showMaximized(); 384 e.showMaximized();
385#endif 385#endif
386 int ret = e.exec(); 386 int ret = e.exec();
387 387
388 if ( ret == QDialog::Accepted ) { 388 if ( ret == QDialog::Accepted ) {
389 qWarning("Replacing now" ); 389 qWarning("Replacing now" );
390 table->setPaintingEnabled( false ); 390 table->setPaintingEnabled( false );
391 todo = e.todoEntry(); 391 todo = e.todoEntry();
392 table->replaceCurrentEntry( todo ); 392 table->replaceCurrentEntry( todo );
393 table->setPaintingEnabled( true ); 393 table->setPaintingEnabled( true );
394 } 394 }
395 populateCategories(); 395 populateCategories();
396 mStack->raiseWidget( 1 ); 396 mStack->raiseWidget( 1 );
397} 397}
398void TodoWindow::slotDuplicate() 398void TodoWindow::slotDuplicate()
399{ 399{
400 if(syncing) { 400 if(syncing) {
401 QMessageBox::warning(this, tr("Todo"), 401 QMessageBox::warning(this, tr("Todo"),
402 tr("Can not edit data, currently syncing")); 402 tr("Can not edit data, currently syncing"));
403 return; 403 return;
404 } 404 }
405 ToDoEvent ev = table->currentEntry(); 405 ToDoEvent ev = table->currentEntry();
406 ToDoEvent ev2 = ToDoEvent( ev ); // what about the uid 406 ToDoEvent ev2 = ToDoEvent( ev ); // what about the uid
407 int uid; 407 int uid;
408 { // uid 408 { // uid
409 Qtopia::UidGen *uidgen = new Qtopia::UidGen(); 409 Qtopia::UidGen *uidgen = new Qtopia::UidGen();
410 uid = uidgen->generate(); 410 uid = uidgen->generate();
411 delete uidgen; 411 delete uidgen;
412 } 412 }
413 ev2.setUid( uid ); 413 ev2.setUid( uid );
414 table->setPaintingEnabled( false ); 414 table->setPaintingEnabled( false );
415 table->addEntry( ev2 ); 415 table->addEntry( ev2 );
416 table->setPaintingEnabled( true ); 416 table->setPaintingEnabled( true );
417 417
418 mStack->raiseWidget( 1 ); 418 mStack->raiseWidget( 1 );
419} 419}
420void TodoWindow::slotShowPopup( const QPoint &p ) 420void TodoWindow::slotShowPopup( const QPoint &p )
421{ 421{
422 contextMenu->popup( p ); 422 contextMenu->popup( p );
423} 423}
424 424
425void TodoWindow::showCompleted( bool s ) 425void TodoWindow::showCompleted( bool s )
426{ 426{
427 if ( !table->isUpdatesEnabled() ) 427 if ( !table->isUpdatesEnabled() )
428 return; 428 return;
429 table->setPaintingEnabled( false ); 429 table->setPaintingEnabled( false );
430 table->setShowCompleted( s ); 430 table->setShowCompleted( s );
431 table->setPaintingEnabled( true ); 431 table->setPaintingEnabled( true );
432 mStack->raiseWidget( 1 ); 432 mStack->raiseWidget( 1 );
433} 433}
434 434
435void TodoWindow::currentEntryChanged( int r, int ) 435void TodoWindow::currentEntryChanged( int r, int )
436{ 436{
437 if ( r != -1 && table->rowHeight( r ) > 0 ) { 437 if ( r != -1 && table->rowHeight( r ) > 0 ) {
438 editAction->setEnabled( TRUE ); 438 editAction->setEnabled( TRUE );
439 deleteAction->setEnabled( TRUE ); 439 deleteAction->setEnabled( TRUE );
440 duplicateAction->setEnabled( TRUE ); 440 duplicateAction->setEnabled( TRUE );
441 deleteAllAction->setEnabled( TRUE ); 441 deleteAllAction->setEnabled( TRUE );
442 } else { 442 } else {
443 editAction->setEnabled( FALSE ); 443 editAction->setEnabled( FALSE );
444 deleteAction->setEnabled( FALSE ); 444 deleteAction->setEnabled( FALSE );
445 duplicateAction->setEnabled( FALSE ); 445 duplicateAction->setEnabled( FALSE );
446 deleteAllAction->setEnabled( FALSE ); 446 deleteAllAction->setEnabled( FALSE );
447 } 447 }
448} 448}
449 449
450void TodoWindow::setCategory( int c ) 450void TodoWindow::setCategory( int c )
451{ 451{
452 if ( c <= 0 ) return; 452 if ( c <= 0 ) return;
453 if ( !table->isUpdatesEnabled() ) 453 if ( !table->isUpdatesEnabled() )
454 return; 454 return;
455 table->setPaintingEnabled( false ); 455 table->setPaintingEnabled( false );
456 for ( unsigned int i = 1; i < catMenu->count(); i++ ) 456 for ( unsigned int i = 1; i < catMenu->count(); i++ )
457 catMenu->setItemChecked( i, c == (int)i ); 457 catMenu->setItemChecked( i, c == (int)i );
458 if ( c == 1 ) { 458 if ( c == 1 ) {
459 table->setShowCategory( QString::null ); 459 table->setShowCategory( QString::null );
460 setCaption( tr("Todo") + " - " + tr( "All Categories" ) ); 460 setCaption( tr("Todo") + " - " + tr( "All Categories" ) );
461 } else if ( c == (int)catMenu->count() - 1 ) { 461 } else if ( c == (int)catMenu->count() - 1 ) {
462 table->setShowCategory( tr( "Unfiled" ) ); 462 table->setShowCategory( tr( "Unfiled" ) );
463 setCaption( tr("Todo") + " - " + tr( "Unfiled" ) ); 463 setCaption( tr("Todo") + " - " + tr( "Unfiled" ) );
464 } else { 464 } else {
465 QString cat = table->categories()[c - 2]; 465 QString cat = table->categories()[c - 2];
466 table->setShowCategory( cat ); 466 table->setShowCategory( cat );
467 setCaption( tr("Todo") + " - " + cat ); 467 setCaption( tr("Todo") + " - " + cat );
468 } 468 }
469 table->setPaintingEnabled( true ); 469 table->setPaintingEnabled( true );
470 470
471 mStack->raiseWidget( 1 ); 471 mStack->raiseWidget( 1 );
472} 472}
473 473
474void TodoWindow::populateCategories() 474void TodoWindow::populateCategories()
475{ 475{
476 catMenu->clear(); 476 catMenu->clear();
477 int id, rememberId; 477 int id, rememberId;
478 id = 1; 478 id = 1;
479 rememberId = 0; 479 rememberId = 0;
480 catMenu->insertItem( tr( "All Categories" ), id++ ); 480 catMenu->insertItem( tr( "All Categories" ), id++ );
481 catMenu->insertSeparator(); 481 catMenu->insertSeparator();
482 QStringList categories = table->categories(); 482 QStringList categories = table->categories();
483 categories.append( tr( "Unfiled" ) ); 483 categories.append( tr( "Unfiled" ) );
484 for ( QStringList::Iterator it = categories.begin(); 484 for ( QStringList::Iterator it = categories.begin();
485 it != categories.end(); ++it ) { 485 it != categories.end(); ++it ) {
486 catMenu->insertItem( *it, id ); 486 catMenu->insertItem( *it, id );
487 if ( *it == table->showCategory() ) 487 if ( *it == table->showCategory() )
488 rememberId = id; 488 rememberId = id;
489 ++id; 489 ++id;
490 } 490 }
491 if ( table->showCategory().isEmpty() ) 491 if ( table->showCategory().isEmpty() )
492 setCategory( 1 ); 492 setCategory( 1 );
493 else 493 else
494 setCategory( rememberId ); 494 setCategory( rememberId );
495} 495}
496 496
497void TodoWindow::reload() 497void TodoWindow::reload()
498{ 498{
499 table->clear(); 499 table->clear();
500 table->load( todolistXMLFilename() ); 500 table->load( todolistXMLFilename() );
501 syncing = FALSE; 501 syncing = FALSE;
502} 502}
503 503
504void TodoWindow::flush() 504void TodoWindow::flush()
505{ 505{
506 syncing = TRUE; 506 syncing = TRUE;
507 table->save( todolistXMLFilename() ); 507 table->save( todolistXMLFilename() );
508} 508}
509 509
510void TodoWindow::closeEvent( QCloseEvent *e ) 510void TodoWindow::closeEvent( QCloseEvent *e )
511{ 511{
512 if( mStack->visibleWidget() != table ){ 512 if( mStack->visibleWidget() != table ){
513 mStack->raiseWidget( 1 ); 513 mStack->raiseWidget( 1 );
514 e->ignore(); 514 e->ignore();
515 return; 515 return;
516 } 516 }
517 if(syncing) { 517 if(syncing) {
518 /* no need to save if in the middle of syncing */ 518 /* no need to save if in the middle of syncing */
519 e->accept(); 519 e->accept();
520 return; 520 return;
521 } 521 }
522 522
523 if ( table->save( todolistXMLFilename() ) ) { 523 if ( table->save( todolistXMLFilename() ) ) {
524 e->accept(); 524 e->accept();
525 // repeat for categories... 525 // repeat for categories...
526 // if writing configs fail, it will emit an 526 // if writing configs fail, it will emit an
527 // error, but I feel that it is "ok" for us to exit 527 // error, but I feel that it is "ok" for us to exit
528 // espically since we aren't told if the write succeeded... 528 // espically since we aren't told if the write succeeded...
529 Config config( "todo" ); 529 Config config( "todo" );
530 config.setGroup( "View" ); 530 config.setGroup( "View" );
531 config.writeEntry( "ShowComplete", table->showCompleted() ); 531 config.writeEntry( "ShowComplete", table->showCompleted() );
532 config.writeEntry( "Category", table->showCategory() ); 532 config.writeEntry( "Category", table->showCategory() );
533 /* added 20.01.2k2 by se */ 533 /* added 20.01.2k2 by se */
534 config.writeEntry( "ShowDeadLine", table->showDeadline()); 534 config.writeEntry( "ShowDeadLine", table->showDeadline());
535 } else { 535 } else {
536 if ( QMessageBox::critical( this, tr("Out of space"), 536 if ( QMessageBox::critical( this, tr("Out of space"),
537 tr("Todo was unable\n" 537 tr("Todo was unable\n"
538 "to save your changes.\n" 538 "to save your changes.\n"
539 "Free up some space\n" 539 "Free up some space\n"
540 "and try again.\n" 540 "and try again.\n"
541 "\nQuit Anyway?"), 541 "\nQuit Anyway?"),
542 QMessageBox::Yes|QMessageBox::Escape, 542 QMessageBox::Yes|QMessageBox::Escape,
543 QMessageBox::No|QMessageBox::Default) 543 QMessageBox::No|QMessageBox::Default)
544 != QMessageBox::No ) 544 != QMessageBox::No )
545 e->accept(); 545 e->accept();
546 else 546 else
547 e->ignore(); 547 e->ignore();
548 } 548 }
549} 549}
550 550
551void TodoWindow::slotFind() 551void TodoWindow::slotFind()
552{ 552{
553 // put everything back to view all for searching... 553 // put everything back to view all for searching...
554 mStack->raiseWidget( 1 ); 554 mStack->raiseWidget( 1 );
555 if ( !catMenu->isItemChecked( 0 ) ) 555 if ( !catMenu->isItemChecked( 0 ) )
556 setCategory( 0 ); 556 setCategory( 0 );
557 557
558 FindDialog dlg( "Todo List", this ); 558 FindDialog dlg( "Todo List", this );
559 QObject::connect( &dlg, 559 QObject::connect( &dlg,
560 SIGNAL(signalFindClicked(const QString &, 560 SIGNAL(signalFindClicked(const QString &,
561 bool, bool, int)), 561 bool, bool, int)),
562 table, 562 table,
563 SLOT(slotDoFind(const QString&, bool, bool, int)) ); 563 SLOT(slotDoFind(const QString&, bool, bool, int)) );
564 QObject::connect( table, SIGNAL(signalNotFound()), &dlg, 564 QObject::connect( table, SIGNAL(signalNotFound()), &dlg,
565 SLOT(slotNotFound()) ); 565 SLOT(slotNotFound()) );
566 QObject::connect( table, SIGNAL(signalWrapAround()), &dlg, 566 QObject::connect( table, SIGNAL(signalWrapAround()), &dlg,
567 SLOT(slotWrapAround()) ); 567 SLOT(slotWrapAround()) );
568 dlg.exec(); 568 dlg.exec();
569 if ( table->numSelections() ) 569 if ( table->numSelections() )
570 table->clearSelection(); 570 table->clearSelection();
571 table->clearFindRow(); 571 table->clearFindRow();
572} 572}
573 573
574 574
575void TodoWindow::setDocument( const QString &filename ) 575void TodoWindow::setDocument( const QString &filename )
576{ 576{
577 if ( filename.find(".vcs") != int(filename.length()) - 4 ) return; 577 if ( filename.find(".vcs") != int(filename.length()) - 4 ) return;
578 578
579 ToDoDB todoDB(filename, new ToDoVCalResource() ); 579 ToDoDB todoDB(filename, new ToDoVCalResource() );
580 QValueList<ToDoEvent> tl = todoDB.rawToDos(); 580 QValueList<ToDoEvent> tl = todoDB.rawToDos();
581 for( QValueList<ToDoEvent>::Iterator it = tl.begin(); it != tl.end(); ++it ) { 581 for( QValueList<ToDoEvent>::Iterator it = tl.begin(); it != tl.end(); ++it ) {
582 table->addEntry( *it ); 582 table->addEntry( *it );
583 } 583 }
584} 584}
585 585
586static const char * beamfile = "/tmp/obex/todo.vcs"; 586static const char * beamfile = "/tmp/obex/todo.vcs";
587 587
588void TodoWindow::slotBeam() 588void TodoWindow::slotBeam()
589{ 589{
590 unlink( beamfile ); // delete if exists 590 unlink( beamfile ); // delete if exists
591 ToDoEvent c = table->currentEntry(); 591 ToDoEvent c = table->currentEntry();
592 mkdir("/tmp/obex/", 0755); 592 mkdir("/tmp/obex/", 0755);
593 ToDoDB todoDB( beamfile, new ToDoVCalResource() ); 593 ToDoDB todoDB( beamfile, new ToDoVCalResource() );
594 todoDB.addEvent( c ); 594 todoDB.addEvent( c );
595 todoDB.save(); 595 todoDB.save();
596 Ir *ir = new Ir( this ); 596 Ir *ir = new Ir( this );
597 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); 597 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) );
598 QString description = c.summary(); 598 QString description = c.summary();
599 ir->send( beamfile, description, "text/x-vCalendar" ); 599 ir->send( beamfile, description, "text/x-vCalendar" );
600} 600}
601 601
602void TodoWindow::beamDone( Ir *ir ) 602void TodoWindow::beamDone( Ir *ir )
603{ 603{
604 delete ir; 604 delete ir;
605 unlink( beamfile ); 605 unlink( beamfile );
606} 606}
607 607
608void TodoWindow::showDeadline( bool s ) 608void TodoWindow::showDeadline( bool s )
609{ 609{
610 table->setPaintingEnabled( false ); 610 table->setPaintingEnabled( false );
611 table->setShowDeadline( s ); 611 table->setShowDeadline( s );
612 table->setPaintingEnabled( true ); 612 table->setPaintingEnabled( true );
613} 613}
614void TodoWindow::slotShowDetails() 614void TodoWindow::slotShowDetails()
615{ 615{
616 ToDoEvent event = table->currentEntry(); 616 ToDoEvent event = table->currentEntry();
617 slotShowDetails( event ); 617 slotShowDetails( event );
618} 618}
619void TodoWindow::slotShowDetails( const ToDoEvent &event ) 619void TodoWindow::slotShowDetails( const ToDoEvent &event )
620{ 620{
621 if( mView == 0l ){ 621 if( mView == 0l ){
622 mView = new TodoLabel(mStack); 622 mView = new TodoLabel(mStack);
623 mStack->addWidget( mView, 2 ); 623 mStack->addWidget( mView, 2 );
624 } 624 }
625 mView->init( event ); 625 mView->init( event );
626 mView->sync(); 626 mView->sync();
627 mStack->raiseWidget( 2); 627 mStack->raiseWidget( 2);
628} 628}
diff --git a/core/pim/todo/todoentry.ui b/core/pim/todo/todoentry.ui
index 9ffa89b..1091852 100644
--- a/core/pim/todo/todoentry.ui
+++ b/core/pim/todo/todoentry.ui
@@ -1,447 +1,487 @@
1<!DOCTYPE UI><UI> 1<!DOCTYPE UI><UI>
2<class>NewTaskDialogBase</class> 2<class>NewTaskDialogBase</class>
3<comment>********************************************************************* 3<comment>*********************************************************************
4** Copyright (C) 2000 Trolltech AS. All rights reserved. 4** Copyright (C) 2000 Trolltech AS. All rights reserved.
5** 5**
6** This file is part of Qtopia Environment. 6** This file is part of Qtopia Environment.
7** 7**
8** This file may be distributed and/or modified under the terms of the 8** This file may be distributed and/or modified under the terms of the
9** GNU General Public License version 2 as published by the Free Software 9** GNU General Public License version 2 as published by the Free Software
10** Foundation and appearing in the file LICENSE.GPL included in the 10** Foundation and appearing in the file LICENSE.GPL included in the
11** packaging of this file. 11** packaging of this file.
12** 12**
13** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 13** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
14** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 14** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
15** 15**
16** See http://www.trolltech.com/gpl/ for GPL licensing information. 16** See http://www.trolltech.com/gpl/ for GPL licensing information.
17** 17**
18** Contact info@trolltech.com if any conditions of this licensing are 18** Contact info@trolltech.com if any conditions of this licensing are
19** not clear to you. 19** not clear to you.
20** 20**
21*********************************************************************</comment> 21*********************************************************************</comment>
22<widget> 22<widget>
23 <class>QDialog</class> 23 <class>QDialog</class>
24 <property stdset="1"> 24 <property stdset="1">
25 <name>name</name> 25 <name>name</name>
26 <cstring>NewTaskDialogBase</cstring> 26 <cstring>NewTaskDialogBase</cstring>
27 </property> 27 </property>
28 <property stdset="1"> 28 <property stdset="1">
29 <name>geometry</name> 29 <name>geometry</name>
30 <rect> 30 <rect>
31 <x>0</x> 31 <x>0</x>
32 <y>0</y> 32 <y>0</y>
33 <width>425</width> 33 <width>262</width>
34 <height>321</height> 34 <height>321</height>
35 </rect> 35 </rect>
36 </property> 36 </property>
37 <property stdset="1"> 37 <property stdset="1">
38 <name>caption</name> 38 <name>caption</name>
39 <string>New Task</string> 39 <string>New Task</string>
40 </property> 40 </property>
41 <property> 41 <property>
42 <name>layoutMargin</name> 42 <name>layoutMargin</name>
43 </property> 43 </property>
44 <property> 44 <property>
45 <name>layoutSpacing</name> 45 <name>layoutSpacing</name>
46 </property> 46 </property>
47 <widget> 47 <grid>
48 <class>QLayoutWidget</class>
49 <property stdset="1"> 48 <property stdset="1">
50 <name>name</name> 49 <name>margin</name>
51 <cstring>Layout31</cstring> 50 <number>11</number>
52 </property> 51 </property>
53 <property stdset="1"> 52 <property stdset="1">
54 <name>geometry</name> 53 <name>spacing</name>
55 <rect> 54 <number>6</number>
56 <x>1</x>
57 <y>6</y>
58 <width>240</width>
59 <height>310</height>
60 </rect>
61 </property> 55 </property>
62 <grid> 56 <widget row="2" column="0" >
57 <class>QLayoutWidget</class>
63 <property stdset="1"> 58 <property stdset="1">
64 <name>margin</name> 59 <name>name</name>
65 <number>0</number> 60 <cstring>Layout19</cstring>
66 </property> 61 </property>
67 <property stdset="1"> 62 <hbox>
68 <name>spacing</name> 63 <property stdset="1">
69 <number>6</number> 64 <name>margin</name>
70 </property> 65 <number>0</number>
71 <widget row="2" column="0" > 66 </property>
72 <class>QLayoutWidget</class>
73 <property stdset="1"> 67 <property stdset="1">
74 <name>name</name> 68 <name>spacing</name>
75 <cstring>Layout19</cstring> 69 <number>6</number>
76 </property> 70 </property>
77 <hbox> 71 <widget>
72 <class>QLabel</class>
78 <property stdset="1"> 73 <property stdset="1">
79 <name>margin</name> 74 <name>name</name>
80 <number>0</number> 75 <cstring>txtProg</cstring>
81 </property> 76 </property>
82 <property stdset="1"> 77 <property stdset="1">
83 <name>spacing</name> 78 <name>sizePolicy</name>
84 <number>6</number> 79 <sizepolicy>
80 <hsizetype>1</hsizetype>
81 <vsizetype>0</vsizetype>
82 </sizepolicy>
85 </property> 83 </property>
86 <widget> 84 <property stdset="1">
87 <class>QLabel</class> 85 <name>text</name>
88 <property stdset="1"> 86 <string>Progress:</string>
89 <name>name</name> 87 </property>
90 <cstring>txtProg</cstring> 88 </widget>
89 <widget>
90 <class>QComboBox</class>
91 <item>
92 <property>
93 <name>text</name>
94 <string>0%</string>
91 </property> 95 </property>
92 <property stdset="1"> 96 </item>
97 <item>
98 <property>
93 <name>text</name> 99 <name>text</name>
94 <string>Progress:</string> 100 <string>20%</string>
95 </property> 101 </property>
96 </widget> 102 </item>
97 <widget> 103 <item>
98 <class>QComboBox</class> 104 <property>
99 <item> 105 <name>text</name>
100 <property> 106 <string>40%</string>
101 <name>text</name> 107 </property>
102 <string>0%</string> 108 </item>
103 </property> 109 <item>
104 </item> 110 <property>
105 <item> 111 <name>text</name>
106 <property> 112 <string>60%</string>
107 <name>text</name>
108 <string>20%</string>
109 </property>
110 </item>
111 <item>
112 <property>
113 <name>text</name>
114 <string>40%</string>
115 </property>
116 </item>
117 <item>
118 <property>
119 <name>text</name>
120 <string>60%</string>
121 </property>
122 </item>
123 <item>
124 <property>
125 <name>text</name>
126 <string>80%</string>
127 </property>
128 </item>
129 <item>
130 <property>
131 <name>text</name>
132 <string>100%</string>
133 </property>
134 </item>
135 <property stdset="1">
136 <name>name</name>
137 <cstring>cmbProg</cstring>
138 </property> 113 </property>
139 <property stdset="1"> 114 </item>
140 <name>maximumSize</name> 115 <item>
141 <size> 116 <property>
142 <width>45</width> 117 <name>text</name>
143 <height>32767</height> 118 <string>80%</string>
144 </size> 119 </property>
120 </item>
121 <item>
122 <property>
123 <name>text</name>
124 <string>100%</string>
145 </property> 125 </property>
146 </widget> 126 </item>
147 </hbox> 127 <property stdset="1">
148 </widget> 128 <name>name</name>
149 <widget row="3" column="0" > 129 <cstring>cmbProg</cstring>
150 <class>QLayoutWidget</class> 130 </property>
131 <property stdset="1">
132 <name>sizePolicy</name>
133 <sizepolicy>
134 <hsizetype>0</hsizetype>
135 <vsizetype>0</vsizetype>
136 </sizepolicy>
137 </property>
138 <property stdset="1">
139 <name>maximumSize</name>
140 <size>
141 <width>45</width>
142 <height>32767</height>
143 </size>
144 </property>
145 </widget>
146 </hbox>
147 </widget>
148 <widget row="0" column="0" >
149 <class>QLayoutWidget</class>
150 <property stdset="1">
151 <name>name</name>
152 <cstring>Layout20</cstring>
153 </property>
154 <hbox>
155 <property stdset="1">
156 <name>margin</name>
157 <number>0</number>
158 </property>
151 <property stdset="1"> 159 <property stdset="1">
152 <name>name</name> 160 <name>spacing</name>
153 <cstring>Layout18</cstring> 161 <number>6</number>
154 </property> 162 </property>
155 <hbox> 163 <widget>
164 <class>QLabel</class>
156 <property stdset="1"> 165 <property stdset="1">
157 <name>margin</name> 166 <name>name</name>
158 <number>0</number> 167 <cstring>TextLabel2</cstring>
159 </property> 168 </property>
160 <property stdset="1"> 169 <property stdset="1">
161 <name>spacing</name> 170 <name>sizePolicy</name>
162 <number>6</number> 171 <sizepolicy>
172 <hsizetype>1</hsizetype>
173 <vsizetype>0</vsizetype>
174 </sizepolicy>
163 </property> 175 </property>
164 <widget> 176 <property stdset="1">
165 <class>QLabel</class> 177 <name>text</name>
166 <property stdset="1"> 178 <string>Priority:</string>
167 <name>name</name> 179 </property>
168 <cstring>TextLabel3</cstring> 180 </widget>
181 <widget>
182 <class>QComboBox</class>
183 <item>
184 <property>
185 <name>text</name>
186 <string>1 - Very High</string>
169 </property> 187 </property>
170 <property stdset="1"> 188 </item>
171 <name>frameShape</name> 189 <item>
172 <enum>NoFrame</enum> 190 <property>
191 <name>text</name>
192 <string>2 - High</string>
173 </property> 193 </property>
174 <property stdset="1"> 194 </item>
195 <item>
196 <property>
175 <name>text</name> 197 <name>text</name>
176 <string>Category:</string> 198 <string>3 - Normal</string>
177 </property> 199 </property>
178 </widget> 200 </item>
179 <widget> 201 <item>
180 <class>CategorySelect</class> 202 <property>
181 <property stdset="1"> 203 <name>text</name>
182 <name>name</name> 204 <string>4 - Low</string>
183 <cstring>comboCategory</cstring>
184 </property> 205 </property>
185 <property stdset="1"> 206 </item>
186 <name>minimumSize</name> 207 <item>
187 <size> 208 <property>
188 <width>60</width> 209 <name>text</name>
189 <height>0</height> 210 <string>5 - Very Low</string>
190 </size>
191 </property> 211 </property>
192 </widget> 212 </item>
193 </hbox> 213 <property stdset="1">
194 </widget> 214 <name>name</name>
195 <widget row="0" column="0" > 215 <cstring>comboPriority</cstring>
196 <class>QLayoutWidget</class> 216 </property>
217 <property stdset="1">
218 <name>sizePolicy</name>
219 <sizepolicy>
220 <hsizetype>0</hsizetype>
221 <vsizetype>0</vsizetype>
222 </sizepolicy>
223 </property>
224 <property stdset="1">
225 <name>currentItem</name>
226 <number>2</number>
227 </property>
228 </widget>
229 </hbox>
230 </widget>
231 <widget row="4" column="0" >
232 <class>QLayoutWidget</class>
233 <property stdset="1">
234 <name>name</name>
235 <cstring>Layout30</cstring>
236 </property>
237 <hbox>
238 <property stdset="1">
239 <name>margin</name>
240 <number>0</number>
241 </property>
197 <property stdset="1"> 242 <property stdset="1">
198 <name>name</name> 243 <name>spacing</name>
199 <cstring>Layout20</cstring> 244 <number>6</number>
200 </property> 245 </property>
201 <hbox> 246 <widget>
247 <class>QLabel</class>
202 <property stdset="1"> 248 <property stdset="1">
203 <name>margin</name> 249 <name>name</name>
204 <number>0</number> 250 <cstring>TextLabel1</cstring>
205 </property> 251 </property>
206 <property stdset="1"> 252 <property stdset="1">
207 <name>spacing</name> 253 <name>sizePolicy</name>
208 <number>6</number> 254 <sizepolicy>
255 <hsizetype>1</hsizetype>
256 <vsizetype>0</vsizetype>
257 </sizepolicy>
209 </property> 258 </property>
210 <widget> 259 <property stdset="1">
211 <class>QLabel</class> 260 <name>text</name>
212 <property stdset="1"> 261 <string>Summary:</string>
213 <name>name</name> 262 </property>
214 <cstring>TextLabel2</cstring> 263 </widget>
215 </property> 264 <widget>
216 <property stdset="1"> 265 <class>QLineEdit</class>
217 <name>text</name> 266 <property stdset="1">
218 <string>Priority:</string> 267 <name>name</name>
219 </property> 268 <cstring>lneSum</cstring>
220 </widget> 269 </property>
221 <widget> 270 </widget>
222 <class>QComboBox</class> 271 <widget>
223 <item> 272 <class>OClickableLabel</class>
224 <property> 273 <property stdset="1">
225 <name>text</name> 274 <name>name</name>
226 <string>1 - Very High</string> 275 <cstring>lblDown</cstring>
227 </property> 276 </property>
228 </item> 277 <property stdset="1">
229 <item> 278 <name>sizePolicy</name>
230 <property> 279 <sizepolicy>
231 <name>text</name> 280 <hsizetype>0</hsizetype>
232 <string>2 - High</string> 281 <vsizetype>0</vsizetype>
233 </property> 282 </sizepolicy>
234 </item> 283 </property>
235 <item> 284 <property stdset="1">
236 <property> 285 <name>minimumSize</name>
237 <name>text</name> 286 <size>
238 <string>3 - Normal</string> 287 <width>20</width>
239 </property> 288 <height>20</height>
240 </item> 289 </size>
241 <item> 290 </property>
242 <property> 291 <property stdset="1">
243 <name>text</name> 292 <name>maximumSize</name>
244 <string>4 - Low</string> 293 <size>
245 </property> 294 <width>20</width>
246 </item> 295 <height>20</height>
247 <item> 296 </size>
248 <property> 297 </property>
249 <name>text</name> 298 </widget>
250 <string>5 - Very Low</string> 299 </hbox>
251 </property> 300 </widget>
252 </item> 301 <widget row="1" column="0" >
253 <property stdset="1"> 302 <class>QLayoutWidget</class>
254 <name>name</name> 303 <property stdset="1">
255 <cstring>comboPriority</cstring> 304 <name>name</name>
256 </property> 305 <cstring>Layout21</cstring>
257 <property stdset="1"> 306 </property>
258 <name>sizePolicy</name> 307 <hbox>
259 <sizepolicy>
260 <hsizetype>7</hsizetype>
261 <vsizetype>0</vsizetype>
262 </sizepolicy>
263 </property>
264 <property stdset="1">
265 <name>currentItem</name>
266 <number>2</number>
267 </property>
268 </widget>
269 </hbox>
270 </widget>
271 <widget row="5" column="0" >
272 <class>QMultiLineEdit</class>
273 <property stdset="1"> 308 <property stdset="1">
274 <name>name</name> 309 <name>margin</name>
275 <cstring>txtTodo</cstring> 310 <number>0</number>
276 </property> 311 </property>
277 </widget>
278 <widget row="1" column="0" >
279 <class>QLayoutWidget</class>
280 <property stdset="1"> 312 <property stdset="1">
281 <name>name</name> 313 <name>spacing</name>
282 <cstring>Layout21</cstring> 314 <number>6</number>
283 </property> 315 </property>
284 <hbox> 316 <widget>
317 <class>QCheckBox</class>
285 <property stdset="1"> 318 <property stdset="1">
286 <name>margin</name> 319 <name>name</name>
287 <number>0</number> 320 <cstring>checkCompleted</cstring>
288 </property> 321 </property>
289 <property stdset="1"> 322 <property stdset="1">
290 <name>spacing</name> 323 <name>text</name>
291 <number>6</number> 324 <string>&amp;Completed</string>
292 </property> 325 </property>
293 <widget> 326 </widget>
294 <class>QCheckBox</class> 327 <widget>
295 <property stdset="1"> 328 <class>QCheckBox</class>
296 <name>name</name> 329 <property stdset="1">
297 <cstring>checkCompleted</cstring> 330 <name>name</name>
298 </property> 331 <cstring>checkDate</cstring>
299 <property stdset="1"> 332 </property>
300 <name>text</name> 333 <property stdset="1">
301 <string>&amp;Completed</string> 334 <name>text</name>
302 </property> 335 <string>D&amp;ue</string>
303 </widget> 336 </property>
304 <widget> 337 </widget>
305 <class>QCheckBox</class> 338 <widget>
306 <property stdset="1"> 339 <class>QPushButton</class>
307 <name>name</name> 340 <property stdset="1">
308 <cstring>checkDate</cstring> 341 <name>name</name>
309 </property> 342 <cstring>buttonDate</cstring>
310 <property stdset="1"> 343 </property>
311 <name>text</name> 344 <property stdset="1">
312 <string>D&amp;ue</string> 345 <name>enabled</name>
313 </property> 346 <bool>false</bool>
314 </widget> 347 </property>
315 <widget> 348 <property stdset="1">
316 <class>QPushButton</class> 349 <name>text</name>
317 <property stdset="1"> 350 <string>1 Jan 2001</string>
318 <name>name</name> 351 </property>
319 <cstring>buttonDate</cstring> 352 </widget>
320 </property> 353 </hbox>
321 <property stdset="1"> 354 </widget>
322 <name>enabled</name> 355 <widget row="5" column="0" >
323 <bool>false</bool> 356 <class>QMultiLineEdit</class>
324 </property> 357 <property stdset="1">
325 <property stdset="1"> 358 <name>name</name>
326 <name>text</name> 359 <cstring>txtTodo</cstring>
327 <string>1 Jan 2001</string> 360 </property>
328 </property> 361 <property stdset="1">
329 </widget> 362 <name>sizePolicy</name>
330 </hbox> 363 <sizepolicy>
331 </widget> 364 <hsizetype>7</hsizetype>
332 <widget row="4" column="0" > 365 <vsizetype>7</vsizetype>
333 <class>QLayoutWidget</class> 366 </sizepolicy>
367 </property>
368 </widget>
369 <widget row="3" column="0" >
370 <class>QLayoutWidget</class>
371 <property stdset="1">
372 <name>name</name>
373 <cstring>Layout33</cstring>
374 </property>
375 <hbox>
334 <property stdset="1"> 376 <property stdset="1">
335 <name>name</name> 377 <name>margin</name>
336 <cstring>Layout30</cstring> 378 <number>0</number>
337 </property> 379 </property>
338 <hbox> 380 <property stdset="1">
381 <name>spacing</name>
382 <number>6</number>
383 </property>
384 <widget>
385 <class>QLabel</class>
339 <property stdset="1"> 386 <property stdset="1">
340 <name>margin</name> 387 <name>name</name>
341 <number>0</number> 388 <cstring>TextLabel3</cstring>
342 </property> 389 </property>
343 <property stdset="1"> 390 <property stdset="1">
344 <name>spacing</name> 391 <name>sizePolicy</name>
345 <number>6</number> 392 <sizepolicy>
393 <hsizetype>1</hsizetype>
394 <vsizetype>0</vsizetype>
395 </sizepolicy>
346 </property> 396 </property>
347 <widget> 397 <property stdset="1">
348 <class>QLabel</class> 398 <name>frameShape</name>
349 <property stdset="1"> 399 <enum>NoFrame</enum>
350 <name>name</name> 400 </property>
351 <cstring>TextLabel1</cstring> 401 <property stdset="1">
352 </property> 402 <name>text</name>
353 <property stdset="1"> 403 <string>Category:</string>
354 <name>text</name> 404 </property>
355 <string>Summary:</string> 405 </widget>
356 </property> 406 <widget>
357 </widget> 407 <class>CategorySelect</class>
358 <widget> 408 <property stdset="1">
359 <class>QLineEdit</class> 409 <name>name</name>
360 <property stdset="1"> 410 <cstring>comboCategory</cstring>
361 <name>name</name> 411 </property>
362 <cstring>lneSum</cstring> 412 <property stdset="1">
363 </property> 413 <name>sizePolicy</name>
364 </widget> 414 <sizepolicy>
365 <widget> 415 <hsizetype>7</hsizetype>
366 <class>OClickableLabel</class> 416 <vsizetype>0</vsizetype>
367 <property stdset="1"> 417 </sizepolicy>
368 <name>name</name> 418 </property>
369 <cstring>lblDown</cstring> 419 <property stdset="1">
370 </property> 420 <name>minimumSize</name>
371 <property stdset="1"> 421 <size>
372 <name>minimumSize</name> 422 <width>60</width>
373 <size> 423 <height>20</height>
374 <width>20</width> 424 </size>
375 <height>20</height> 425 </property>
376 </size> 426 </widget>
377 </property> 427 </hbox>
378 <property stdset="1"> 428 </widget>
379 <name>maximumSize</name> 429 </grid>
380 <size>
381 <width>20</width>
382 <height>20</height>
383 </size>
384 </property>
385 </widget>
386 </hbox>
387 </widget>
388 </grid>
389 </widget>
390</widget> 430</widget>
391<customwidgets> 431<customwidgets>
392 <customwidget> 432 <customwidget>
393 <class>CategorySelect</class> 433 <class>CategorySelect</class>
394 <header location="global">qpe/categoryselect.h</header> 434 <header location="global">qpe/categoryselect.h</header>
395 <sizehint> 435 <sizehint>
396 <width>-1</width> 436 <width>-1</width>
397 <height>-1</height> 437 <height>-1</height>
398 </sizehint> 438 </sizehint>
399 <container>0</container> 439 <container>0</container>
400 <sizepolicy> 440 <sizepolicy>
401 <hordata>7</hordata> 441 <hordata>7</hordata>
402 <verdata>1</verdata> 442 <verdata>1</verdata>
403 </sizepolicy> 443 </sizepolicy>
404 <pixmap>image0</pixmap> 444 <pixmap>image0</pixmap>
405 </customwidget> 445 </customwidget>
406 <customwidget> 446 <customwidget>
407 <class>OClickableLabel</class> 447 <class>OClickableLabel</class>
408 <header location="global">opie/oclickablelabel.h</header> 448 <header location="global">opie/oclickablelabel.h</header>
409 <sizehint> 449 <sizehint>
410 <width>-1</width> 450 <width>-1</width>
411 <height>-1</height> 451 <height>-1</height>
412 </sizehint> 452 </sizehint>
413 <container>0</container> 453 <container>0</container>
414 <sizepolicy> 454 <sizepolicy>
415 <hordata>5</hordata> 455 <hordata>5</hordata>
416 <verdata>5</verdata> 456 <verdata>5</verdata>
417 </sizepolicy> 457 </sizepolicy>
418 <pixmap>image0</pixmap> 458 <pixmap>image0</pixmap>
419 <signal>clicked()</signal> 459 <signal>clicked()</signal>
420 <signal>toggled(bool)</signal> 460 <signal>toggled(bool)</signal>
421 <slot access="public">slotOn(bool)</slot> 461 <slot access="public">slotOn(bool)</slot>
422 </customwidget> 462 </customwidget>
423</customwidgets> 463</customwidgets>
424<images> 464<images>
425 <image> 465 <image>
426 <name>image0</name> 466 <name>image0</name>
427 <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data> 467 <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data>
428 </image> 468 </image>
429</images> 469</images>
430<connections> 470<connections>
431 <connection> 471 <connection>
432 <sender>checkDate</sender> 472 <sender>checkDate</sender>
433 <signal>toggled(bool)</signal> 473 <signal>toggled(bool)</signal>
434 <receiver>buttonDate</receiver> 474 <receiver>buttonDate</receiver>
435 <slot>setEnabled(bool)</slot> 475 <slot>setEnabled(bool)</slot>
436 </connection> 476 </connection>
437 <connection> 477 <connection>
438 <sender>lblDown</sender> 478 <sender>lblDown</sender>
439 <signal>clicked()</signal> 479 <signal>clicked()</signal>
440 <receiver>NewTaskDialogBase</receiver> 480 <receiver>NewTaskDialogBase</receiver>
441 <slot>slotCopy()</slot> 481 <slot>slotCopy()</slot>
442 </connection> 482 </connection>
443 <slot access="protected">dateChanged( const QString &amp; )</slot> 483 <slot access="protected">dateChanged( const QString &amp; )</slot>
444 <slot access="protected">dateChanged( int, int, int )</slot> 484 <slot access="protected">dateChanged( int, int, int )</slot>
445 <slot access="protected">slotCopy()</slot> 485 <slot access="protected">slotCopy()</slot>
446</connections> 486</connections>
447</UI> 487</UI>
diff --git a/core/pim/todo/todoentryimpl.cpp b/core/pim/todo/todoentryimpl.cpp
index dd01130..6af229c 100644
--- a/core/pim/todo/todoentryimpl.cpp
+++ b/core/pim/todo/todoentryimpl.cpp
@@ -1,165 +1,169 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** Copyright (C) 2002 zecke 3** Copyright (C) 2002 zecke
4** 4**
5** This file is part of Qtopia Environment. 5** This file is part of Qtopia Environment.
6** 6**
7** This file may be distributed and/or modified under the terms of the 7** This file may be distributed and/or modified under the terms of the
8** GNU General Public License version 2 as published by the Free Software 8** GNU General Public License version 2 as published by the Free Software
9** Foundation and appearing in the file LICENSE.GPL included in the 9** Foundation and appearing in the file LICENSE.GPL included in the
10** packaging of this file. 10** packaging of this file.
11** 11**
12** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 12** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
13** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 13** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
14** 14**
15** See http://www.trolltech.com/gpl/ for GPL licensing information. 15** See http://www.trolltech.com/gpl/ for GPL licensing information.
16** 16**
17** Contact info@trolltech.com if any conditions of this licensing are 17** Contact info@trolltech.com if any conditions of this licensing are
18** not clear to you. 18** not clear to you.
19** 19**
20**********************************************************************/ 20**********************************************************************/
21 21
22#include "todoentryimpl.h" 22#include "todoentryimpl.h"
23 23
24#include <opie/oclickablelabel.h> 24#include <opie/oclickablelabel.h>
25#include <opie/todoevent.h> 25#include <opie/todoevent.h>
26#include <opie/tododb.h> 26#include <opie/tododb.h>
27 27
28#include <qpe/categoryselect.h> 28#include <qpe/categoryselect.h>
29#include <qpe/datebookmonth.h> 29#include <qpe/datebookmonth.h>
30#include <qpe/global.h> 30#include <qpe/global.h>
31#include <qpe/resource.h> 31#include <qpe/resource.h>
32#include <qpe/imageedit.h> 32#include <qpe/imageedit.h>
33#include <qpe/timestring.h> 33#include <qpe/timestring.h>
34#include <qpe/palmtoprecord.h> 34#include <qpe/palmtoprecord.h>
35 35
36#include <qlayout.h>
36#include <qmessagebox.h> 37#include <qmessagebox.h>
37#include <qpopupmenu.h> 38#include <qpopupmenu.h>
38#include <qtoolbutton.h> 39#include <qtoolbutton.h>
39#include <qcombobox.h> 40#include <qcombobox.h>
40#include <qcheckbox.h> 41#include <qcheckbox.h>
41#include <qlineedit.h> 42#include <qlineedit.h>
42#include <qmultilineedit.h> 43#include <qmultilineedit.h>
43#include <qlabel.h> 44#include <qlabel.h>
44#include <qtimer.h> 45#include <qtimer.h>
45#include <qapplication.h> 46#include <qapplication.h>
46 47
47 48
48NewTaskDialog::NewTaskDialog( const ToDoEvent& task, QWidget *parent, 49NewTaskDialog::NewTaskDialog( const ToDoEvent& task, QWidget *parent,
49 const char *name, bool modal, WFlags fl ) 50 const char *name, bool modal, WFlags fl )
50 : NewTaskDialogBase( parent, name, modal, fl ), 51 : NewTaskDialogBase( parent, name, modal, fl ),
51 todo( task ) 52 todo( task )
52{ 53{
53 todo.setCategories( task.allCategories() ); 54 todo.setCategories( task.allCategories() );
54 if ( todo.hasDate() ) 55 if ( todo.hasDate() )
55 date = todo.date(); 56 date = todo.date();
56 else 57 else
57 date = QDate::currentDate(); 58 date = QDate::currentDate();
58 59
59 init(); 60 init();
60 comboPriority->setCurrentItem( task.priority() - 1 ); 61 comboPriority->setCurrentItem( task.priority() - 1 );
61 62
62 checkCompleted->setChecked( task.isCompleted() ); 63 checkCompleted->setChecked( task.isCompleted() );
63 checkDate->setChecked( task.hasDate() ); 64 checkDate->setChecked( task.hasDate() );
64 buttonDate->setText( TimeString::longDateString( date ) ); 65 buttonDate->setText( TimeString::longDateString( date ) );
65 66
66 txtTodo->setText( task.description() ); 67 txtTodo->setText( task.description() );
67 lneSum->setText( task.summary() ); 68 lneSum->setText( task.summary() );
68 cmbProg->setCurrentItem( task.progress()/20 ); 69 cmbProg->setCurrentItem( task.progress()/20 );
69} 70}
70 71
71/* 72/*
72 * Constructs a NewTaskDialog which is a child of 'parent', with the 73 * Constructs a NewTaskDialog which is a child of 'parent', with the
73 * name 'name' and widget flags set to 'f' 74 * name 'name' and widget flags set to 'f'
74 * 75 *
75 * The dialog will by default be modeless, unless you set 'modal' to 76 * The dialog will by default be modeless, unless you set 'modal' to
76 * TRUE to construct a modal dialog. 77 * TRUE to construct a modal dialog.
77 */ 78 */
78NewTaskDialog::NewTaskDialog( int id, QWidget* parent, const char* name, bool modal, 79NewTaskDialog::NewTaskDialog( int id, QWidget* parent, const char* name, bool modal,
79 WFlags fl ) 80 WFlags fl )
80 : NewTaskDialogBase( parent, name, modal, fl ), 81 : NewTaskDialogBase( parent, name, modal, fl ),
81 date( QDate::currentDate() ) 82 date( QDate::currentDate() )
82{ 83{
83 if ( id != -1 ) { 84 if ( id != -1 ) {
84 QArray<int> ids( 1 ); 85 QArray<int> ids( 1 );
85 ids[0] = id; 86 ids[0] = id;
86 todo.setCategory( Qtopia::Record::idsToString( ids ) ); 87 todo.setCategory( Qtopia::Record::idsToString( ids ) );
87 } 88 }
88 init(); 89 init();
89} 90}
90 91
91void NewTaskDialog::init() 92void NewTaskDialog::init()
92{ 93{
94 if( layout() != 0 ){
95 layout()->setMargin( 0 );
96 }
93 QPopupMenu *m1 = new QPopupMenu( this ); 97 QPopupMenu *m1 = new QPopupMenu( this );
94 picker = new DateBookMonth( m1, 0, TRUE ); 98 picker = new DateBookMonth( m1, 0, TRUE );
95 m1->insertItem( picker ); 99 m1->insertItem( picker );
96 buttonDate->setPopup( m1 ); 100 buttonDate->setPopup( m1 );
97 comboCategory->setCategories( todo.categories(), "Todo List", tr("Todo List") ); 101 comboCategory->setCategories( todo.categories(), "Todo List", tr("Todo List") );
98 102
99 connect( picker, SIGNAL( dateClicked( int, int, int ) ), 103 connect( picker, SIGNAL( dateClicked( int, int, int ) ),
100 this, SLOT( dateChanged( int, int, int ) ) ); 104 this, SLOT( dateChanged( int, int, int ) ) );
101 105
102 buttonDate->setText( TimeString::longDateString( date ) ); 106 buttonDate->setText( TimeString::longDateString( date ) );
103 picker->setDate( date.year(), date.month(), date.day() ); 107 picker->setDate( date.year(), date.month(), date.day() );
104 lblDown->setPixmap(Resource::loadPixmap("down") ); 108 lblDown->setPixmap(Resource::loadPixmap("down") );
105} 109}
106 110
107/* 111/*
108 * Destroys the object and frees any allocated resources 112 * Destroys the object and frees any allocated resources
109 */ 113 */
110NewTaskDialog::~NewTaskDialog() 114NewTaskDialog::~NewTaskDialog()
111{ 115{
112 // no need to delete child widgets, Qt does it all for us 116 // no need to delete child widgets, Qt does it all for us
113} 117}
114void NewTaskDialog::dateChanged( int y, int m, int d ) 118void NewTaskDialog::dateChanged( int y, int m, int d )
115{ 119{
116 date = QDate( y, m, d ); 120 date = QDate( y, m, d );
117 buttonDate->setText( TimeString::longDateString( date ) ); 121 buttonDate->setText( TimeString::longDateString( date ) );
118} 122}
119 123
120/*! 124/*!
121*/ 125*/
122 126
123ToDoEvent NewTaskDialog::todoEntry() 127ToDoEvent NewTaskDialog::todoEntry()
124{ 128{
125 if( checkDate->isChecked() ){ 129 if( checkDate->isChecked() ){
126 todo.setDate( date ); 130 todo.setDate( date );
127 todo.setHasDate( true ); 131 todo.setHasDate( true );
128 }else{ 132 }else{
129 todo.setHasDate( false ); 133 todo.setHasDate( false );
130 } 134 }
131 if ( comboCategory->currentCategory() != -1 ) { 135 if ( comboCategory->currentCategory() != -1 ) {
132 QArray<int> arr = comboCategory->currentCategories(); 136 QArray<int> arr = comboCategory->currentCategories();
133 QStringList list; 137 QStringList list;
134 list = QStringList::split(";", Qtopia::Record::idsToString( arr )) ; 138 list = QStringList::split(";", Qtopia::Record::idsToString( arr )) ;
135 todo.setCategories( list ); 139 todo.setCategories( list );
136 } 140 }
137 todo.setPriority( comboPriority->currentItem() + 1 ); 141 todo.setPriority( comboPriority->currentItem() + 1 );
138 todo.setCompleted( checkCompleted->isChecked() ); 142 todo.setCompleted( checkCompleted->isChecked() );
139 143
140 todo.setDescription( txtTodo->text() ); 144 todo.setDescription( txtTodo->text() );
141 todo.setSummary( lneSum->text() ); 145 todo.setSummary( lneSum->text() );
142 QString text = cmbProg->currentText(); 146 QString text = cmbProg->currentText();
143 todo.setProgress( text.remove( text.length()-1, 1 ).toUShort() ); 147 todo.setProgress( text.remove( text.length()-1, 1 ).toUShort() );
144 return todo; 148 return todo;
145} 149}
146void NewTaskDialog::slotCopy() 150void NewTaskDialog::slotCopy()
147{ 151{
148 txtTodo->clear(); 152 txtTodo->clear();
149 txtTodo->setText( lneSum->text() ); 153 txtTodo->setText( lneSum->text() );
150} 154}
151 155
152/*! 156/*!
153 157
154*/ 158*/
155 159
156void NewTaskDialog::accept() 160void NewTaskDialog::accept()
157{ 161{
158 QString strText = txtTodo->text(); 162 QString strText = txtTodo->text();
159 if ( strText.isEmpty() ) { 163 if ( strText.isEmpty() ) {
160 // hmm... just decline it then, the user obviously didn't care about it 164 // hmm... just decline it then, the user obviously didn't care about it
161 QDialog::reject(); 165 QDialog::reject();
162 return; 166 return;
163 } 167 }
164 QDialog::accept(); 168 QDialog::accept();
165} 169}