summaryrefslogtreecommitdiff
path: root/core/pim/todo/templatedialogimpl.cpp
Unidiff
Diffstat (limited to 'core/pim/todo/templatedialogimpl.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/todo/templatedialogimpl.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/core/pim/todo/templatedialogimpl.cpp b/core/pim/todo/templatedialogimpl.cpp
index 63d8107..c9ad3d0 100644
--- a/core/pim/todo/templatedialogimpl.cpp
+++ b/core/pim/todo/templatedialogimpl.cpp
@@ -6,56 +6,56 @@
6#include "templatedialogimpl.h" 6#include "templatedialogimpl.h"
7 7
8 8
9using namespace Todo; 9using namespace Todo;
10 10
11/* TRANSLATOR Todo::TemplateDialogImpl */ 11/* TRANSLATOR Todo::TemplateDialogImpl */
12 12
13namespace { 13namespace {
14 class TemplateListItem : public QListViewItem { 14 class TemplateListItem : public QListViewItem {
15 public: 15 public:
16 TemplateListItem( QListView*, 16 TemplateListItem( QListView*,
17 const QString& name, 17 const QString& name,
18 const OTodo& ); 18 const OPimTodo& );
19 ~TemplateListItem(); 19 ~TemplateListItem();
20 20
21 OTodo event()const; 21 OPimTodo event()const;
22 QString text()const; 22 QString text()const;
23 void setText(const QString& str ); 23 void setText(const QString& str );
24 void setEvent( const OTodo& ); 24 void setEvent( const OPimTodo& );
25 private: 25 private:
26 QString m_name; 26 QString m_name;
27 OTodo m_ev; 27 OPimTodo m_ev;
28 }; 28 };
29 29
30 /* implementation */ 30 /* implementation */
31 TemplateListItem::TemplateListItem( QListView* view, 31 TemplateListItem::TemplateListItem( QListView* view,
32 const QString& text, 32 const QString& text,
33 const OTodo& ev ) 33 const OPimTodo& ev )
34 : QListViewItem( view ), m_name( text ), m_ev( ev ) 34 : QListViewItem( view ), m_name( text ), m_ev( ev )
35 { 35 {
36 QListViewItem::setText(0, m_name ); 36 QListViewItem::setText(0, m_name );
37 } 37 }
38 TemplateListItem::~TemplateListItem() {} 38 TemplateListItem::~TemplateListItem() {}
39 OTodo TemplateListItem::event() const { 39 OPimTodo TemplateListItem::event() const {
40 return m_ev; 40 return m_ev;
41 } 41 }
42 QString TemplateListItem::text()const { 42 QString TemplateListItem::text()const {
43 return m_name; 43 return m_name;
44 } 44 }
45 void TemplateListItem::setText( const QString& str ) { 45 void TemplateListItem::setText( const QString& str ) {
46 QListViewItem::setText(0, str ); 46 QListViewItem::setText(0, str );
47 m_name = str; 47 m_name = str;
48 } 48 }
49 void TemplateListItem::setEvent( const OTodo& ev) { 49 void TemplateListItem::setEvent( const OPimTodo& ev) {
50 m_ev = ev; 50 m_ev = ev;
51 } 51 }
52} 52}
53 53
54TemplateDialogImpl::TemplateDialogImpl( MainWindow* win, 54TemplateDialogImpl::TemplateDialogImpl( MainWindow* win,
55 TemplateManager* man ) 55 TemplateManager* man )
56 : TemplateDialog( win ), m_win( win), m_man( man ) 56 : TemplateDialog( win ), m_win( win), m_man( man )
57{ 57{
58 /* fill the listview */ 58 /* fill the listview */
59 /* not the fastest way.... */ 59 /* not the fastest way.... */
60 QStringList list = man->templates(); 60 QStringList list = man->templates();
61 for (QStringList::Iterator it = list.begin(); 61 for (QStringList::Iterator it = list.begin();
@@ -63,45 +63,45 @@ TemplateDialogImpl::TemplateDialogImpl( MainWindow* win,
63 new TemplateListItem( listView(), (*it), man->templateEvent( (*it) ) ); 63 new TemplateListItem( listView(), (*it), man->templateEvent( (*it) ) );
64 } 64 }
65 listView()->addColumn( QWidget::tr("Name") ); 65 listView()->addColumn( QWidget::tr("Name") );
66 66
67 connect( listView(), SIGNAL(clicked(QListViewItem*) ), 67 connect( listView(), SIGNAL(clicked(QListViewItem*) ),
68 this, SLOT(slotClicked(QListViewItem*) ) ); 68 this, SLOT(slotClicked(QListViewItem*) ) );
69} 69}
70TemplateDialogImpl::~TemplateDialogImpl() { 70TemplateDialogImpl::~TemplateDialogImpl() {
71 71
72} 72}
73void TemplateDialogImpl::slotAdd() { 73void TemplateDialogImpl::slotAdd() {
74 QString str = QWidget::tr("New Template %1").arg( listView()->childCount() ); 74 QString str = QWidget::tr("New Template %1").arg( listView()->childCount() );
75 OTodo ev; 75 OPimTodo ev;
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}
79void TemplateDialogImpl::slotRemove() { 79void TemplateDialogImpl::slotRemove() {
80 if (!listView()->currentItem() ) 80 if (!listView()->currentItem() )
81 return; 81 return;
82 82
83 TemplateListItem* item = static_cast<TemplateListItem*>( listView()->currentItem() ); 83 TemplateListItem* item = static_cast<TemplateListItem*>( listView()->currentItem() );
84 listView()->takeItem( item ); 84 listView()->takeItem( item );
85 85
86 m_man->removeEvent( item->text() ); 86 m_man->removeEvent( item->text() );
87 87
88 delete item; 88 delete item;
89} 89}
90void TemplateDialogImpl::slotEdit() { 90void TemplateDialogImpl::slotEdit() {
91 if ( !listView()->currentItem() ) 91 if ( !listView()->currentItem() )
92 return; 92 return;
93 93
94 TemplateListItem* item = static_cast<TemplateListItem*>( listView()->currentItem() ); 94 TemplateListItem* item = static_cast<TemplateListItem*>( listView()->currentItem() );
95 OTodo ev = m_win->currentEditor()->edit( m_win, item->event() ); 95 OPimTodo ev = m_win->currentEditor()->edit( m_win, item->event() );
96 if ( m_win->currentEditor()->accepted() ) { 96 if ( m_win->currentEditor()->accepted() ) {
97 item->setEvent( ev ); 97 item->setEvent( ev );
98 m_man->removeEvent( item->text() ); 98 m_man->removeEvent( item->text() );
99 m_man->addEvent( item->text(), ev ); 99 m_man->addEvent( item->text(), ev );
100 } 100 }
101} 101}
102/* 102/*
103 * we need to update 103 * we need to update
104 * the text 104 * the text
105 */ 105 */
106 106
107void TemplateDialogImpl::slotReturn() { 107void TemplateDialogImpl::slotReturn() {