From c880d9e087019f27f19c80b13fe2c7a5a4b37e3d Mon Sep 17 00:00:00 2001 From: korovkin Date: Wed, 03 Jan 2007 11:41:01 +0000 Subject: Fix for bug#0001547 provided by Paul Eggleton If there are no templates, just create the blank task. --- (limited to 'core') 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 ) { } } void MainWindow::slotItemNew() { - NewTaskDlg dlg( templateManager()->templates(), this ); - if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) { - QString tempName = dlg.tempSelected(); - if ( tempName.isNull() ) - // Create new, blank task - create(); - else { - // Create new task from the template selected - OPimTodo event = templateManager()->templateEvent( tempName ); - event = currentEditor()->edit( this, event ); - if ( currentEditor()->accepted() ) { - event.setUid( 1 ); - handleAlarms( OPimTodo(), event ); - m_todoMgr.add( event ); - currentView()->addEvent( event ); - - reloadCategories(); - } - raiseCurrentView(); - } - } + QStringList templateList = templateManager()->templates(); + if(templateList.isEmpty()) { + // No templates, just create a blank task + create(); + } + else { + // There are templates, so allow the user to select one + NewTaskDlg dlg( templateList, this ); + if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) { + QString tempName = dlg.tempSelected(); + if ( tempName.isNull() ) + // Create new, blank task + create(); + else { + // Create new task from the template selected + OPimTodo event = templateManager()->templateEvent( tempName ); + event = currentEditor()->edit( this, event ); + if ( currentEditor()->accepted() ) { + event.setUid( 1 ); + handleAlarms( OPimTodo(), event ); + m_todoMgr.add( event ); + currentView()->addEvent( event ); + + reloadCategories(); + } + raiseCurrentView(); + } + } + } } void MainWindow::slotItemEdit() { slotEdit( currentView()->current() ); -- cgit v0.9.0.2