Diffstat (limited to 'core/pim/todo/quickeditimpl.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/todo/quickeditimpl.cpp | 56 |
1 files changed, 33 insertions, 23 deletions
diff --git a/core/pim/todo/quickeditimpl.cpp b/core/pim/todo/quickeditimpl.cpp index 2dd5b61..9b54bdc 100644 --- a/core/pim/todo/quickeditimpl.cpp +++ b/core/pim/todo/quickeditimpl.cpp | |||
@@ -1,63 +1,69 @@ | |||
1 | #include <qaction.h> | ||
1 | #include <qlineedit.h> | 2 | #include <qlineedit.h> |
2 | 3 | ||
4 | #include <qpe/resource.h> | ||
5 | |||
3 | #include <opie/oclickablelabel.h> | 6 | #include <opie/oclickablelabel.h> |
4 | 7 | ||
5 | #include "mainwindow.h" | 8 | #include "mainwindow.h" |
6 | #include "quickeditimpl.h" | 9 | #include "quickeditimpl.h" |
7 | 10 | ||
8 | 11 | ||
9 | QuickEditImpl::QuickEditImpl( Todo::MainWindow* win, QWidget* arent ) | 12 | QuickEditImpl::QuickEditImpl( QWidget* parent, bool visible ) |
10 | : QHBox(arent), Todo::QuickEdit(win) { | 13 | : QPEToolBar( (QMainWindow *)parent ), Todo::QuickEdit( (Todo::MainWindow *)parent ) { |
11 | m_lbl = new OClickableLabel(this ); | 14 | setHorizontalStretchable( TRUE ); |
12 | m_lbl->setMinimumWidth(12); | ||
13 | m_lbl->setText("3"); | ||
14 | 15 | ||
15 | m_edit = new QLineEdit(this ); | 16 | // TODO - come up with icons and replace text priority values |
17 | m_lbl = new OClickableLabel( this ); | ||
18 | m_lbl->setMinimumWidth(15); | ||
19 | m_lbl->setText("3"); | ||
20 | connect(m_lbl, SIGNAL(clicked() ), this, SLOT(slotPrio()) ); | ||
16 | 21 | ||
17 | m_enter = new OClickableLabel(this); | 22 | m_edit = new QLineEdit( this ); |
18 | m_enter->setText("Enter"); | 23 | setStretchableWidget( m_edit ); |
19 | 24 | ||
20 | m_more = new OClickableLabel(this); | 25 | QAction *a = new QAction( tr( "More" ), Resource::loadPixmap( "todo/more" ), QString::null, 0, this, 0 ); |
21 | m_more->setText("More"); | 26 | connect( a, SIGNAL( activated() ), this, SLOT( slotMore() ) ); |
27 | a->addTo( this ); | ||
22 | 28 | ||
29 | a = new QAction( tr( "Enter" ), Resource::loadPixmap( "enter" ), QString::null, 0, this, 0 ); | ||
30 | connect( a, SIGNAL( activated() ), this, SLOT( slotEnter() ) ); | ||
31 | a->addTo( this ); | ||
23 | 32 | ||
24 | // connect | 33 | a = new QAction( tr( "Cancel" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
25 | connect(m_lbl, SIGNAL(clicked() ), | 34 | connect( a, SIGNAL( activated() ), this, SLOT( slotCancel() ) ); |
26 | this, SLOT(slotPrio()) ); | 35 | a->addTo( this ); |
27 | connect(m_enter, SIGNAL(clicked() ), | ||
28 | this, SLOT(slotEnter() ) ); | ||
29 | connect(m_more, SIGNAL(clicked() ), | ||
30 | this, SLOT(slotMore() ) ); | ||
31 | 36 | ||
37 | m_visible = visible; | ||
38 | if ( !m_visible ) { | ||
39 | hide(); | ||
40 | } | ||
41 | |||
32 | m_menu = 0l; | 42 | m_menu = 0l; |
33 | reinit(); | 43 | reinit(); |
34 | setMaximumHeight( m_edit->sizeHint().height() ); | ||
35 | } | 44 | } |
36 | QuickEditImpl::~QuickEditImpl() { | 45 | QuickEditImpl::~QuickEditImpl() { |
37 | 46 | ||
38 | } | 47 | } |
39 | OTodo QuickEditImpl::todo()const { | 48 | OTodo QuickEditImpl::todo()const { |
40 | return m_todo; | 49 | return m_todo; |
41 | } | 50 | } |
42 | QWidget* QuickEditImpl::widget() { | 51 | QWidget* QuickEditImpl::widget() { |
43 | return this; | 52 | return this; |
44 | } | 53 | } |
45 | QSize QuickEditImpl::sizeHint()const{ | ||
46 | return m_edit->sizeHint(); | ||
47 | } | ||
48 | void QuickEditImpl::slotEnter() { | 54 | void QuickEditImpl::slotEnter() { |
49 | OTodo todo; | 55 | OTodo todo; |
50 | 56 | ||
51 | 57 | ||
52 | if (!m_edit->text().isEmpty() ) { | 58 | if (!m_edit->text().isEmpty() ) { |
53 | todo.setUid(1 ); // new uid | 59 | todo.setUid(1 ); // new uid |
54 | todo.setPriority( m_lbl->text().toInt() ); | 60 | todo.setPriority( m_lbl->text().toInt() ); |
55 | todo.setSummary( m_edit->text() ); | 61 | todo.setSummary( m_edit->text() ); |
56 | if ( mainWindow()->currentCatId() != 0 ) | 62 | if ( ((Todo::MainWindow *)parent())->currentCatId() != 0 ) |
57 | todo.setCategories( mainWindow()->currentCatId() ); | 63 | todo.setCategories( ((Todo::MainWindow *)parent())->currentCatId() ); |
58 | 64 | ||
59 | m_todo = todo; | 65 | m_todo = todo; |
60 | commit(); | 66 | commit(); |
61 | } | 67 | } |
62 | m_todo = todo; | 68 | m_todo = todo; |
63 | reinit(); | 69 | reinit(); |
@@ -78,12 +84,16 @@ void QuickEditImpl::slotPrio() { | |||
78 | default: | 84 | default: |
79 | m_lbl->setText( "3"); | 85 | m_lbl->setText( "3"); |
80 | break; | 86 | break; |
81 | } | 87 | } |
82 | } | 88 | } |
83 | void QuickEditImpl::slotMore() { | 89 | void QuickEditImpl::slotMore() { |
90 | // TODO - implement | ||
91 | } | ||
92 | void QuickEditImpl::slotCancel() { | ||
93 | reinit(); | ||
84 | } | 94 | } |
85 | void QuickEditImpl::reinit() { | 95 | void QuickEditImpl::reinit() { |
86 | m_state = 1; | 96 | m_state = 1; |
87 | m_lbl->setText("3"); | 97 | m_lbl->setText("3"); |
88 | m_edit->clear(); | 98 | m_edit->clear(); |
89 | } | 99 | } |