Diffstat (limited to 'core/pim/todo/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/todo/mainwindow.cpp | 106 |
1 files changed, 87 insertions, 19 deletions
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp index b5cace9..883d78c 100644 --- a/core/pim/todo/mainwindow.cpp +++ b/core/pim/todo/mainwindow.cpp | |||
@@ -125,4 +125,6 @@ TodoWindow::TodoWindow( QWidget *parent, const char *name, WFlags f = 0 ) : | |||
125 | catMenu = new QPopupMenu( this ); | 125 | catMenu = new QPopupMenu( this ); |
126 | QPopupMenu *edit = new QPopupMenu( this ); | 126 | QPopupMenu *edit = new QPopupMenu( this ); |
127 | QPopupMenu *options = new QPopupMenu(this ); | ||
128 | |||
127 | contextMenu = new QPopupMenu( this ); | 129 | contextMenu = new QPopupMenu( this ); |
128 | 130 | ||
@@ -136,5 +138,5 @@ TodoWindow::TodoWindow( QWidget *parent, const char *name, WFlags f = 0 ) : | |||
136 | a->addTo( edit ); | 138 | a->addTo( edit ); |
137 | 139 | ||
138 | a = new QAction( tr( "Edit" ), Resource::loadIconSet( "edit" ), | 140 | a = new QAction( tr( "Edit Task" ), Resource::loadIconSet( "edit" ), |
139 | QString::null, 0, this, 0 ); | 141 | QString::null, 0, this, 0 ); |
140 | connect( a, SIGNAL( activated() ), | 142 | connect( a, SIGNAL( activated() ), |
@@ -145,6 +147,7 @@ TodoWindow::TodoWindow( QWidget *parent, const char *name, WFlags f = 0 ) : | |||
145 | a->setEnabled( FALSE ); | 147 | a->setEnabled( FALSE ); |
146 | editAction = a; | 148 | editAction = a; |
149 | edit->insertSeparator(); | ||
147 | 150 | ||
148 | a = new QAction( tr( "Delete" ), Resource::loadIconSet( "trash" ), | 151 | a = new QAction( tr( "Delete..." ), Resource::loadIconSet( "trash" ), |
149 | QString::null, 0, this, 0 ); | 152 | QString::null, 0, this, 0 ); |
150 | connect( a, SIGNAL( activated() ), | 153 | connect( a, SIGNAL( activated() ), |
@@ -156,4 +159,24 @@ TodoWindow::TodoWindow( QWidget *parent, const char *name, WFlags f = 0 ) : | |||
156 | deleteAction = a; | 159 | deleteAction = a; |
157 | 160 | ||
161 | // delete All in category is missing.... | ||
162 | // set All Done | ||
163 | // set All Done in category | ||
164 | |||
165 | a = new QAction( QString::null, tr( "Delete all..."), 0, this, 0 ); | ||
166 | connect(a, SIGNAL( activated() ), | ||
167 | this, SLOT( slotDeleteAll() ) ); | ||
168 | a->addTo(edit ); | ||
169 | a->setEnabled( FALSE ); | ||
170 | deleteAllAction = a; | ||
171 | |||
172 | edit->insertSeparator(); | ||
173 | a = new QAction( QString::null, tr("Duplicate" ), 0, this, 0 ); | ||
174 | connect(a, SIGNAL( activated() ), | ||
175 | this, SLOT( slotDuplicate() ) ); | ||
176 | a->addTo(edit ); | ||
177 | a->setEnabled( FALSE ); | ||
178 | duplicateAction = a; | ||
179 | |||
180 | edit->insertSeparator(); | ||
158 | if ( Ir::supported() ) { | 181 | if ( Ir::supported() ) { |
159 | a = new QAction( tr( "Beam" ), Resource::loadPixmap( "beam" ), | 182 | a = new QAction( tr( "Beam" ), Resource::loadPixmap( "beam" ), |
@@ -170,5 +193,7 @@ TodoWindow::TodoWindow( QWidget *parent, const char *name, WFlags f = 0 ) : | |||
170 | this, SLOT( slotFind() ) ); | 193 | this, SLOT( slotFind() ) ); |
171 | a->addTo( bar ); | 194 | a->addTo( bar ); |
172 | a->addTo( edit ); | 195 | a->addTo( options ); |
196 | options->insertSeparator(); | ||
197 | |||
173 | if ( table->numRows() ) | 198 | if ( table->numRows() ) |
174 | a->setEnabled( TRUE ); | 199 | a->setEnabled( TRUE ); |
@@ -187,7 +212,22 @@ TodoWindow::TodoWindow( QWidget *parent, const char *name, WFlags f = 0 ) : | |||
187 | populateCategories(); | 212 | populateCategories(); |
188 | 213 | ||
189 | mb->insertItem( tr( "Data" ), edit ); | 214 | |
190 | mb->insertItem( tr( "View" ), catMenu ); | 215 | completedAction->addTo( options ); |
216 | completedAction->setOn( table->showCompleted() ); | ||
217 | showdeadlineAction->addTo( options ); | ||
218 | showdeadlineAction->setOn( table->showDeadline() ); | ||
219 | options->insertSeparator( ); | ||
220 | QList<QWidget> list; | ||
221 | list.append(table ); | ||
222 | OFontMenu *menu = new OFontMenu(this, "menu",list ); | ||
223 | menu->forceSize( table->horizontalHeader(), 10 ); | ||
224 | //catMenu->insertItem(tr("Fonts"), menu ); | ||
225 | list.clear(); | ||
226 | options->insertItem( tr("Fonts"), menu ); | ||
227 | |||
191 | 228 | ||
229 | mb->insertItem( tr( "Data" ), edit ); | ||
230 | mb->insertItem( tr( "Category" ), catMenu ); | ||
231 | mb->insertItem( tr( "Options"), options ); | ||
192 | resize( 200, 300 ); | 232 | resize( 200, 300 ); |
193 | if ( table->numRows() > 0 ) | 233 | if ( table->numRows() > 0 ) |
@@ -280,4 +320,28 @@ void TodoWindow::slotDelete() | |||
280 | } | 320 | } |
281 | } | 321 | } |
322 | void TodoWindow::slotDeleteAll() | ||
323 | { | ||
324 | if(syncing) { | ||
325 | QMessageBox::warning(this, tr("Todo"), | ||
326 | tr("Can not edit data, currently syncing")); | ||
327 | return; | ||
328 | } | ||
329 | |||
330 | //QString strName = table->text( table->currentRow(), 2 ).left( 30 ); | ||
331 | |||
332 | if ( !QPEMessageBox::confirmDelete( this, tr( "Todo" ), tr("Should I delete all tasks?") ) ) | ||
333 | return; | ||
334 | |||
335 | |||
336 | |||
337 | table->setPaintingEnabled( false ); | ||
338 | table->removeAllEntries(); | ||
339 | table->setPaintingEnabled( true ); | ||
340 | |||
341 | if ( table->numRows() == 0 ) { | ||
342 | currentEntryChanged( -1, 0 ); | ||
343 | findAction->setEnabled( FALSE ); | ||
344 | } | ||
345 | } | ||
282 | 346 | ||
283 | void TodoWindow::slotEdit() | 347 | void TodoWindow::slotEdit() |
@@ -308,5 +372,17 @@ void TodoWindow::slotEdit() | |||
308 | 372 | ||
309 | } | 373 | } |
310 | 374 | void TodoWindow::slotDuplicate() | |
375 | { | ||
376 | if(syncing) { | ||
377 | QMessageBox::warning(this, tr("Todo"), | ||
378 | tr("Can not edit data, currently syncing")); | ||
379 | return; | ||
380 | } | ||
381 | ToDoEvent ev = table->currentEntry(); | ||
382 | ToDoEvent ev2 = ToDoEvent( ev ); | ||
383 | table->setPaintingEnabled( false ); | ||
384 | table->addEntry( ev2 ); | ||
385 | table->setPaintingEnabled( true ); | ||
386 | } | ||
311 | void TodoWindow::slotShowPopup( const QPoint &p ) | 387 | void TodoWindow::slotShowPopup( const QPoint &p ) |
312 | { | 388 | { |
@@ -328,7 +404,11 @@ void TodoWindow::currentEntryChanged( int r, int ) | |||
328 | editAction->setEnabled( TRUE ); | 404 | editAction->setEnabled( TRUE ); |
329 | deleteAction->setEnabled( TRUE ); | 405 | deleteAction->setEnabled( TRUE ); |
406 | duplicateAction->setEnabled( TRUE ); | ||
407 | deleteAllAction->setEnabled( TRUE ); | ||
330 | } else { | 408 | } else { |
331 | editAction->setEnabled( FALSE ); | 409 | editAction->setEnabled( FALSE ); |
332 | deleteAction->setEnabled( FALSE ); | 410 | deleteAction->setEnabled( FALSE ); |
411 | duplicateAction->setEnabled( FALSE ); | ||
412 | deleteAllAction->setEnabled( FALSE ); | ||
333 | } | 413 | } |
334 | } | 414 | } |
@@ -359,20 +439,8 @@ void TodoWindow::populateCategories() | |||
359 | { | 439 | { |
360 | catMenu->clear(); | 440 | catMenu->clear(); |
361 | |||
362 | QList<QWidget> list; | ||
363 | list.append(table ); | ||
364 | OFontMenu *menu = new OFontMenu(this, "menu",list ); | ||
365 | menu->forceSize( table->horizontalHeader(), 10 ); | ||
366 | catMenu->insertItem(tr("Fonts"), menu ); | ||
367 | |||
368 | completedAction->addTo( catMenu ); | ||
369 | completedAction->setOn( table->showCompleted() ); | ||
370 | showdeadlineAction->addTo( catMenu ); | ||
371 | showdeadlineAction->setOn( table->showDeadline() ); | ||
372 | catMenu->insertSeparator(); | ||
373 | int id, rememberId; | 441 | int id, rememberId; |
374 | id = 1; | 442 | id = 1; |
375 | catMenu->insertItem( tr( "All Categories" ), id++ ); | 443 | catMenu->insertItem( tr( "All Categories" ), id++ ); |
376 | // catMenu->insertSeparator(); | 444 | catMenu->insertSeparator(); |
377 | QStringList categories = table->categories(); | 445 | QStringList categories = table->categories(); |
378 | categories.append( tr( "Unfiled" ) ); | 446 | categories.append( tr( "Unfiled" ) ); |