summaryrefslogtreecommitdiff
authordrw <drw>2002-12-20 23:35:07 (UTC)
committer drw <drw>2002-12-20 23:35:07 (UTC)
commitde31929f800eb2aebe2fcb71a0c165f0f318e220 (patch) (unidiff)
tree9645e3042359be0f2957584b5aa1723f99e92458
parent24972a13cfadcb004936b548fccf87cbb7b15de2 (diff)
downloadopie-de31929f800eb2aebe2fcb71a0c165f0f318e220.zip
opie-de31929f800eb2aebe2fcb71a0c165f0f318e220.tar.gz
opie-de31929f800eb2aebe2fcb71a0c165f0f318e220.tar.bz2
Use icons for task priority on quick task toolbar
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/todo/quickeditimpl.cpp35
-rw-r--r--core/pim/todo/quickeditimpl.h6
2 files changed, 27 insertions, 14 deletions
diff --git a/core/pim/todo/quickeditimpl.cpp b/core/pim/todo/quickeditimpl.cpp
index 9b54bdc..8d0a9fd 100644
--- a/core/pim/todo/quickeditimpl.cpp
+++ b/core/pim/todo/quickeditimpl.cpp
@@ -1,99 +1,106 @@
1#include <qaction.h> 1#include <qaction.h>
2#include <qlineedit.h> 2#include <qlineedit.h>
3 3
4#include <qpe/resource.h> 4#include <qpe/resource.h>
5 5
6#include <opie/oclickablelabel.h> 6#include <opie/oclickablelabel.h>
7 7
8#include "mainwindow.h" 8#include "mainwindow.h"
9#include "quickeditimpl.h" 9#include "quickeditimpl.h"
10 10
11 11
12QuickEditImpl::QuickEditImpl( QWidget* parent, bool visible ) 12QuickEditImpl::QuickEditImpl( QWidget* parent, bool visible )
13 : QPEToolBar( (QMainWindow *)parent ), Todo::QuickEdit( (Todo::MainWindow *)parent ) { 13 : QPEToolBar( (QMainWindow *)parent ), Todo::QuickEdit( (Todo::MainWindow *)parent ) {
14 setHorizontalStretchable( TRUE ); 14 setHorizontalStretchable( TRUE );
15 15
16 // Load priority icons
17 // TODO - probably should be done globally somewhere else
18 priority1 = Resource::loadPixmap( "todo/priority1" );
19 priority3 = Resource::loadPixmap( "todo/priority3" );
20 priority5 = Resource::loadPixmap( "todo/priority5" );
21
22
16 // TODO - come up with icons and replace text priority values 23 // TODO - come up with icons and replace text priority values
17 m_lbl = new OClickableLabel( this ); 24 m_lbl = new OClickableLabel( this );
18 m_lbl->setMinimumWidth(15); 25 m_lbl->setMinimumWidth(15);
19 m_lbl->setText("3"); 26 m_lbl->setPixmap( priority3 );
20 connect(m_lbl, SIGNAL(clicked() ), this, SLOT(slotPrio()) ); 27 connect(m_lbl, SIGNAL(clicked() ), this, SLOT(slotPrio()) );
21 28
22 m_edit = new QLineEdit( this ); 29 m_edit = new QLineEdit( this );
23 setStretchableWidget( m_edit ); 30 setStretchableWidget( m_edit );
24 31
25 QAction *a = new QAction( tr( "More" ), Resource::loadPixmap( "todo/more" ), QString::null, 0, this, 0 ); 32 QAction *a = new QAction( tr( "More" ), Resource::loadPixmap( "todo/more" ), QString::null, 0, this, 0 );
26 connect( a, SIGNAL( activated() ), this, SLOT( slotMore() ) ); 33 connect( a, SIGNAL( activated() ), this, SLOT( slotMore() ) );
27 a->addTo( this ); 34 a->addTo( this );
28 35
29 a = new QAction( tr( "Enter" ), Resource::loadPixmap( "enter" ), QString::null, 0, this, 0 ); 36 a = new QAction( tr( "Enter" ), Resource::loadPixmap( "enter" ), QString::null, 0, this, 0 );
30 connect( a, SIGNAL( activated() ), this, SLOT( slotEnter() ) ); 37 connect( a, SIGNAL( activated() ), this, SLOT( slotEnter() ) );
31 a->addTo( this ); 38 a->addTo( this );
32 39
33 a = new QAction( tr( "Cancel" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); 40 a = new QAction( tr( "Cancel" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
34 connect( a, SIGNAL( activated() ), this, SLOT( slotCancel() ) ); 41 connect( a, SIGNAL( activated() ), this, SLOT( slotCancel() ) );
35 a->addTo( this ); 42 a->addTo( this );
36 43
37 m_visible = visible; 44 m_visible = visible;
38 if ( !m_visible ) { 45 if ( !m_visible ) {
39 hide(); 46 hide();
40 } 47 }
41 48
42 m_menu = 0l; 49 m_menu = 0l;
43 reinit(); 50 reinit();
44} 51}
45QuickEditImpl::~QuickEditImpl() { 52QuickEditImpl::~QuickEditImpl() {
46 53
47} 54}
48OTodo QuickEditImpl::todo()const { 55OTodo QuickEditImpl::todo()const {
49 return m_todo; 56 return m_todo;
50} 57}
51QWidget* QuickEditImpl::widget() { 58QWidget* QuickEditImpl::widget() {
52 return this; 59 return this;
53} 60}
54void QuickEditImpl::slotEnter() { 61void QuickEditImpl::slotEnter() {
55 OTodo todo; 62 OTodo todo;
56 63
57 64
58 if (!m_edit->text().isEmpty() ) { 65 if (!m_edit->text().isEmpty() ) {
59 todo.setUid(1 ); // new uid 66 todo.setUid(1 ); // new uid
60 todo.setPriority( m_lbl->text().toInt() ); 67 todo.setPriority( m_state );
61 todo.setSummary( m_edit->text() ); 68 todo.setSummary( m_edit->text() );
62 if ( ((Todo::MainWindow *)parent())->currentCatId() != 0 ) 69 if ( ((Todo::MainWindow *)parent())->currentCatId() != 0 )
63 todo.setCategories( ((Todo::MainWindow *)parent())->currentCatId() ); 70 todo.setCategories( ((Todo::MainWindow *)parent())->currentCatId() );
64 71
65 m_todo = todo; 72 m_todo = todo;
66 commit(); 73 commit();
67 } 74 }
68 m_todo = todo; 75 m_todo = todo;
69 reinit(); 76 reinit();
70} 77}
71void QuickEditImpl::slotPrio() { 78void QuickEditImpl::slotPrio() {
72 m_state++; 79 m_state -= 2;
73 if (m_state > 2 ) 80 if ( m_state < 1 )
74 m_state = 0; 81 m_state = 5;
75 82
76 switch(m_state ) { 83 switch( m_state ) {
77 case 0: 84 case 1:
78 m_lbl->setText( "1" ); 85 m_lbl->setPixmap( priority1 );
79 break; 86 break;
80 case 2: 87 case 5:
81 m_lbl->setText( "5" ); 88 m_lbl->setPixmap( priority5 );
82 break; 89 break;
83 case 1: 90 case 3:
84 default: 91 default:
85 m_lbl->setText( "3"); 92 m_lbl->setPixmap( priority3 );
86 break; 93 break;
87 } 94 }
88} 95}
89void QuickEditImpl::slotMore() { 96void QuickEditImpl::slotMore() {
90 // TODO - implement 97 // TODO - implement
91} 98}
92void QuickEditImpl::slotCancel() { 99void QuickEditImpl::slotCancel() {
93 reinit(); 100 reinit();
94} 101}
95void QuickEditImpl::reinit() { 102void QuickEditImpl::reinit() {
96 m_state = 1; 103 m_state = 3;
97 m_lbl->setText("3"); 104 m_lbl->setPixmap( priority3 );
98 m_edit->clear(); 105 m_edit->clear();
99} 106}
diff --git a/core/pim/todo/quickeditimpl.h b/core/pim/todo/quickeditimpl.h
index c58275e..1253f3d 100644
--- a/core/pim/todo/quickeditimpl.h
+++ b/core/pim/todo/quickeditimpl.h
@@ -1,35 +1,41 @@
1#ifndef OPIE_QUICK_EDIT_IMPL_H 1#ifndef OPIE_QUICK_EDIT_IMPL_H
2#define OPIE_QUICK_EDIT_IMPL_H 2#define OPIE_QUICK_EDIT_IMPL_H
3 3
4#include <qpixmap.h>
5
4#include <qpe/qpetoolbar.h> 6#include <qpe/qpetoolbar.h>
5 7
6#include "quickedit.h" 8#include "quickedit.h"
7 9
8class QLineEdit; 10class QLineEdit;
9class QLabel; 11class QLabel;
10 12
11class QuickEditImpl : public QPEToolBar, public Todo::QuickEdit { 13class QuickEditImpl : public QPEToolBar, public Todo::QuickEdit {
12 Q_OBJECT 14 Q_OBJECT
13public: 15public:
14 QuickEditImpl( QWidget* parent, bool visible); 16 QuickEditImpl( QWidget* parent, bool visible);
15 ~QuickEditImpl(); 17 ~QuickEditImpl();
16 OTodo todo()const; 18 OTodo todo()const;
17 QWidget* widget(); 19 QWidget* widget();
18private slots: 20private slots:
19 void slotEnter(); 21 void slotEnter();
20 void slotPrio(); 22 void slotPrio();
21 void slotMore(); 23 void slotMore();
22 void slotCancel(); 24 void slotCancel();
23private: 25private:
24 void reinit(); 26 void reinit();
25 int m_state; 27 int m_state;
26 QLabel* m_lbl; 28 QLabel* m_lbl;
27 QLineEdit* m_edit; 29 QLineEdit* m_edit;
28 QLabel* m_enter; 30 QLabel* m_enter;
29 QLabel* m_more; 31 QLabel* m_more;
30 QPopupMenu* m_menu; 32 QPopupMenu* m_menu;
31 OTodo m_todo; 33 OTodo m_todo;
32 bool m_visible; 34 bool m_visible;
35
36 QPixmap priority1;
37 QPixmap priority3;
38 QPixmap priority5;
33}; 39};
34 40
35#endif 41#endif