Diffstat (limited to 'core/pim/todo/quickeditimpl.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/todo/quickeditimpl.cpp | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/core/pim/todo/quickeditimpl.cpp b/core/pim/todo/quickeditimpl.cpp new file mode 100644 index 0000000..2dd5b61 --- a/dev/null +++ b/core/pim/todo/quickeditimpl.cpp | |||
@@ -0,0 +1,89 @@ | |||
1 | #include <qlineedit.h> | ||
2 | |||
3 | #include <opie/oclickablelabel.h> | ||
4 | |||
5 | #include "mainwindow.h" | ||
6 | #include "quickeditimpl.h" | ||
7 | |||
8 | |||
9 | QuickEditImpl::QuickEditImpl( Todo::MainWindow* win, QWidget* arent ) | ||
10 | : QHBox(arent), Todo::QuickEdit(win) { | ||
11 | m_lbl = new OClickableLabel(this ); | ||
12 | m_lbl->setMinimumWidth(12); | ||
13 | m_lbl->setText("3"); | ||
14 | |||
15 | m_edit = new QLineEdit(this ); | ||
16 | |||
17 | m_enter = new OClickableLabel(this); | ||
18 | m_enter->setText("Enter"); | ||
19 | |||
20 | m_more = new OClickableLabel(this); | ||
21 | m_more->setText("More"); | ||
22 | |||
23 | |||
24 | // connect | ||
25 | connect(m_lbl, SIGNAL(clicked() ), | ||
26 | this, SLOT(slotPrio()) ); | ||
27 | connect(m_enter, SIGNAL(clicked() ), | ||
28 | this, SLOT(slotEnter() ) ); | ||
29 | connect(m_more, SIGNAL(clicked() ), | ||
30 | this, SLOT(slotMore() ) ); | ||
31 | |||
32 | m_menu = 0l; | ||
33 | reinit(); | ||
34 | setMaximumHeight( m_edit->sizeHint().height() ); | ||
35 | } | ||
36 | QuickEditImpl::~QuickEditImpl() { | ||
37 | |||
38 | } | ||
39 | OTodo QuickEditImpl::todo()const { | ||
40 | return m_todo; | ||
41 | } | ||
42 | QWidget* QuickEditImpl::widget() { | ||
43 | return this; | ||
44 | } | ||
45 | QSize QuickEditImpl::sizeHint()const{ | ||
46 | return m_edit->sizeHint(); | ||
47 | } | ||
48 | void QuickEditImpl::slotEnter() { | ||
49 | OTodo todo; | ||
50 | |||
51 | |||
52 | if (!m_edit->text().isEmpty() ) { | ||
53 | todo.setUid(1 ); // new uid | ||
54 | todo.setPriority( m_lbl->text().toInt() ); | ||
55 | todo.setSummary( m_edit->text() ); | ||
56 | if ( mainWindow()->currentCatId() != 0 ) | ||
57 | todo.setCategories( mainWindow()->currentCatId() ); | ||
58 | |||
59 | m_todo = todo; | ||
60 | commit(); | ||
61 | } | ||
62 | m_todo = todo; | ||
63 | reinit(); | ||
64 | } | ||
65 | void QuickEditImpl::slotPrio() { | ||
66 | m_state++; | ||
67 | if (m_state > 2 ) | ||
68 | m_state = 0; | ||
69 | |||
70 | switch(m_state ) { | ||
71 | case 0: | ||
72 | m_lbl->setText( "1" ); | ||
73 | break; | ||
74 | case 2: | ||
75 | m_lbl->setText( "5" ); | ||
76 | break; | ||
77 | case 1: | ||
78 | default: | ||
79 | m_lbl->setText( "3"); | ||
80 | break; | ||
81 | } | ||
82 | } | ||
83 | void QuickEditImpl::slotMore() { | ||
84 | } | ||
85 | void QuickEditImpl::reinit() { | ||
86 | m_state = 1; | ||
87 | m_lbl->setText("3"); | ||
88 | m_edit->clear(); | ||
89 | } | ||