author | korovkin <korovkin> | 2007-01-03 11:41:01 (UTC) |
---|---|---|
committer | korovkin <korovkin> | 2007-01-03 11:41:01 (UTC) |
commit | c880d9e087019f27f19c80b13fe2c7a5a4b37e3d (patch) (unidiff) | |
tree | ba79fe22adc7ebc062383aae1c49ddcf240b0f71 | |
parent | 188c44c1196c3597a84189c2d148813df16dfe95 (diff) | |
download | opie-c880d9e087019f27f19c80b13fe2c7a5a4b37e3d.zip opie-c880d9e087019f27f19c80b13fe2c7a5a4b37e3d.tar.gz opie-c880d9e087019f27f19c80b13fe2c7a5a4b37e3d.tar.bz2 |
Fix for bug#0001547 provided by Paul Eggleton <bluelightning@bluelightning.org>
If there are no templates, just create the blank task.
-rw-r--r-- | core/pim/todo/mainwindow.cpp | 50 |
1 files changed, 29 insertions, 21 deletions
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp index b6ee16f..19a6675 100644 --- a/core/pim/todo/mainwindow.cpp +++ b/core/pim/todo/mainwindow.cpp | |||
@@ -285,27 +285,35 @@ void MainWindow::closeEvent( QCloseEvent* e ) { | |||
285 | } | 285 | } |
286 | } | 286 | } |
287 | void MainWindow::slotItemNew() { | 287 | void MainWindow::slotItemNew() { |
288 | NewTaskDlg dlg( templateManager()->templates(), this ); | 288 | QStringList templateList = templateManager()->templates(); |
289 | if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) { | 289 | if(templateList.isEmpty()) { |
290 | QString tempName = dlg.tempSelected(); | 290 | // No templates, just create a blank task |
291 | if ( tempName.isNull() ) | 291 | create(); |
292 | // Create new, blank task | 292 | } |
293 | create(); | 293 | else { |
294 | else { | 294 | // There are templates, so allow the user to select one |
295 | // Create new task from the template selected | 295 | NewTaskDlg dlg( templateList, this ); |
296 | OPimTodo event = templateManager()->templateEvent( tempName ); | 296 | if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) { |
297 | event = currentEditor()->edit( this, event ); | 297 | QString tempName = dlg.tempSelected(); |
298 | if ( currentEditor()->accepted() ) { | 298 | if ( tempName.isNull() ) |
299 | event.setUid( 1 ); | 299 | // Create new, blank task |
300 | handleAlarms( OPimTodo(), event ); | 300 | create(); |
301 | m_todoMgr.add( event ); | 301 | else { |
302 | currentView()->addEvent( event ); | 302 | // Create new task from the template selected |
303 | 303 | OPimTodo event = templateManager()->templateEvent( tempName ); | |
304 | reloadCategories(); | 304 | event = currentEditor()->edit( this, event ); |
305 | } | 305 | if ( currentEditor()->accepted() ) { |
306 | raiseCurrentView(); | 306 | event.setUid( 1 ); |
307 | } | 307 | handleAlarms( OPimTodo(), event ); |
308 | } | 308 | m_todoMgr.add( event ); |
309 | currentView()->addEvent( event ); | ||
310 | |||
311 | reloadCategories(); | ||
312 | } | ||
313 | raiseCurrentView(); | ||
314 | } | ||
315 | } | ||
316 | } | ||
309 | } | 317 | } |
310 | void MainWindow::slotItemEdit() { | 318 | void MainWindow::slotItemEdit() { |
311 | slotEdit( currentView()->current() ); | 319 | slotEdit( currentView()->current() ); |