-rw-r--r-- | core/pim/todo/templatedialogimpl.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/core/pim/todo/templatedialogimpl.cpp b/core/pim/todo/templatedialogimpl.cpp index c2306ac..63d8107 100644 --- a/core/pim/todo/templatedialogimpl.cpp +++ b/core/pim/todo/templatedialogimpl.cpp | |||
@@ -76,17 +76,23 @@ void TemplateDialogImpl::slotAdd() { | |||
76 | m_man->addEvent(str, ev); | 76 | m_man->addEvent(str, ev); |
77 | new TemplateListItem( listView(), str, ev ); | 77 | new TemplateListItem( listView(), str, ev ); |
78 | } | 78 | } |
79 | void TemplateDialogImpl::slotRemove() { | 79 | void TemplateDialogImpl::slotRemove() { |
80 | TemplateListItem* item = (TemplateListItem*) listView()->currentItem(); | 80 | if (!listView()->currentItem() ) |
81 | return; | ||
82 | |||
83 | TemplateListItem* item = static_cast<TemplateListItem*>( listView()->currentItem() ); | ||
81 | listView()->takeItem( item ); | 84 | listView()->takeItem( item ); |
82 | 85 | ||
83 | m_man->removeEvent( item->text() ); | 86 | m_man->removeEvent( item->text() ); |
84 | 87 | ||
85 | delete item; | 88 | delete item; |
86 | } | 89 | } |
87 | void TemplateDialogImpl::slotEdit() { | 90 | void TemplateDialogImpl::slotEdit() { |
88 | TemplateListItem* item = (TemplateListItem*)listView()->currentItem(); | 91 | if ( !listView()->currentItem() ) |
92 | return; | ||
93 | |||
94 | TemplateListItem* item = static_cast<TemplateListItem*>( listView()->currentItem() ); | ||
89 | OTodo ev = m_win->currentEditor()->edit( m_win, item->event() ); | 95 | OTodo ev = m_win->currentEditor()->edit( m_win, item->event() ); |
90 | if ( m_win->currentEditor()->accepted() ) { | 96 | if ( m_win->currentEditor()->accepted() ) { |
91 | item->setEvent( ev ); | 97 | item->setEvent( ev ); |
92 | m_man->removeEvent( item->text() ); | 98 | m_man->removeEvent( item->text() ); |
@@ -98,9 +104,12 @@ void TemplateDialogImpl::slotEdit() { | |||
98 | * the text | 104 | * the text |
99 | */ | 105 | */ |
100 | 106 | ||
101 | void TemplateDialogImpl::slotReturn() { | 107 | void TemplateDialogImpl::slotReturn() { |
102 | TemplateListItem* tbl = (TemplateListItem*)listView()->currentItem(); | 108 | if ( !listView()->currentItem() ) |
109 | return; | ||
110 | |||
111 | TemplateListItem* tbl = static_cast<TemplateListItem*>( listView()->currentItem() ); | ||
103 | 112 | ||
104 | if (tbl->text() != edit()->text() ) { | 113 | if (tbl->text() != edit()->text() ) { |
105 | m_man->removeEvent( tbl->text() ); | 114 | m_man->removeEvent( tbl->text() ); |
106 | tbl->setText( edit()->text() ); | 115 | tbl->setText( edit()->text() ); |