-rw-r--r-- | core/pim/todo/mainwindow.cpp | 10 |
1 files changed, 9 insertions, 1 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 | |||
@@ -276,46 +276,54 @@ void MainWindow::closeEvent( QCloseEvent* e ) { | |||
276 | config.writeEntry( "ShowComplete", showCompleted() ); | 276 | config.writeEntry( "ShowComplete", showCompleted() ); |
277 | config.writeEntry( "Category", currentCategory() ); | 277 | config.writeEntry( "Category", currentCategory() ); |
278 | config.writeEntry( "ShowDeadLine", showDeadline()); | 278 | config.writeEntry( "ShowDeadLine", showDeadline()); |
279 | config.writeEntry( "ShowOverDue", showOverDue() ); | 279 | config.writeEntry( "ShowOverDue", showOverDue() ); |
280 | config.writeEntry( "ShowQuickTask", showQuickTask() ); | 280 | config.writeEntry( "ShowQuickTask", showQuickTask() ); |
281 | /* save templates */ | 281 | /* save templates */ |
282 | templateManager()->save(); | 282 | templateManager()->save(); |
283 | e->accept(); | 283 | e->accept(); |
284 | QTimer::singleShot(0, qApp, SLOT(closeAllWindows()) ); | 284 | QTimer::singleShot(0, qApp, SLOT(closeAllWindows()) ); |
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(templateList.isEmpty()) { | ||
290 | // No templates, just create a blank task | ||
291 | create(); | ||
292 | } | ||
293 | else { | ||
294 | // There are templates, so allow the user to select one | ||
295 | NewTaskDlg dlg( templateList, this ); | ||
289 | if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) { | 296 | if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) { |
290 | QString tempName = dlg.tempSelected(); | 297 | QString tempName = dlg.tempSelected(); |
291 | if ( tempName.isNull() ) | 298 | if ( tempName.isNull() ) |
292 | // Create new, blank task | 299 | // Create new, blank task |
293 | create(); | 300 | create(); |
294 | else { | 301 | else { |
295 | // Create new task from the template selected | 302 | // Create new task from the template selected |
296 | OPimTodo event = templateManager()->templateEvent( tempName ); | 303 | OPimTodo event = templateManager()->templateEvent( tempName ); |
297 | event = currentEditor()->edit( this, event ); | 304 | event = currentEditor()->edit( this, event ); |
298 | if ( currentEditor()->accepted() ) { | 305 | if ( currentEditor()->accepted() ) { |
299 | event.setUid( 1 ); | 306 | event.setUid( 1 ); |
300 | handleAlarms( OPimTodo(), event ); | 307 | handleAlarms( OPimTodo(), event ); |
301 | m_todoMgr.add( event ); | 308 | m_todoMgr.add( event ); |
302 | currentView()->addEvent( event ); | 309 | currentView()->addEvent( event ); |
303 | 310 | ||
304 | reloadCategories(); | 311 | reloadCategories(); |
305 | } | 312 | } |
306 | raiseCurrentView(); | 313 | raiseCurrentView(); |
307 | } | 314 | } |
308 | } | 315 | } |
309 | } | 316 | } |
317 | } | ||
310 | void MainWindow::slotItemEdit() { | 318 | void MainWindow::slotItemEdit() { |
311 | slotEdit( currentView()->current() ); | 319 | slotEdit( currentView()->current() ); |
312 | } | 320 | } |
313 | void MainWindow::slotItemDuplicate() { | 321 | void MainWindow::slotItemDuplicate() { |
314 | if(m_syncing) { | 322 | if(m_syncing) { |
315 | QMessageBox::warning(this, QWidget::tr("Todo"), | 323 | QMessageBox::warning(this, QWidget::tr("Todo"), |
316 | QWidget::tr("Data can not be edited, currently syncing")); | 324 | QWidget::tr("Data can not be edited, currently syncing")); |
317 | return; | 325 | return; |
318 | } | 326 | } |
319 | OPimTodo ev = m_todoMgr.event( currentView()->current() ); | 327 | OPimTodo ev = m_todoMgr.event( currentView()->current() ); |
320 | /* let's generate a new uid */ | 328 | /* let's generate a new uid */ |
321 | ev.setUid(1); | 329 | ev.setUid(1); |