-rw-r--r-- | core/pim/todo/quickeditimpl.cpp | 35 | ||||
-rw-r--r-- | core/pim/todo/quickeditimpl.h | 6 |
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 @@ -4,28 +4,35 @@ #include <qpe/resource.h> #include <opie/oclickablelabel.h> #include "mainwindow.h" #include "quickeditimpl.h" QuickEditImpl::QuickEditImpl( QWidget* parent, bool visible ) : QPEToolBar( (QMainWindow *)parent ), Todo::QuickEdit( (Todo::MainWindow *)parent ) { setHorizontalStretchable( TRUE ); + // Load priority icons + // TODO - probably should be done globally somewhere else + priority1 = Resource::loadPixmap( "todo/priority1" ); + priority3 = Resource::loadPixmap( "todo/priority3" ); + priority5 = Resource::loadPixmap( "todo/priority5" ); + + // TODO - come up with icons and replace text priority values m_lbl = new OClickableLabel( this ); m_lbl->setMinimumWidth(15); - m_lbl->setText("3"); + m_lbl->setPixmap( priority3 ); connect(m_lbl, SIGNAL(clicked() ), this, SLOT(slotPrio()) ); m_edit = new QLineEdit( this ); setStretchableWidget( m_edit ); QAction *a = new QAction( tr( "More" ), Resource::loadPixmap( "todo/more" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( slotMore() ) ); a->addTo( this ); a = new QAction( tr( "Enter" ), Resource::loadPixmap( "enter" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( slotEnter() ) ); a->addTo( this ); @@ -48,52 +55,52 @@ QuickEditImpl::~QuickEditImpl() { OTodo QuickEditImpl::todo()const { return m_todo; } QWidget* QuickEditImpl::widget() { return this; } void QuickEditImpl::slotEnter() { OTodo todo; if (!m_edit->text().isEmpty() ) { todo.setUid(1 ); // new uid - todo.setPriority( m_lbl->text().toInt() ); + todo.setPriority( m_state ); todo.setSummary( m_edit->text() ); if ( ((Todo::MainWindow *)parent())->currentCatId() != 0 ) todo.setCategories( ((Todo::MainWindow *)parent())->currentCatId() ); m_todo = todo; commit(); } m_todo = todo; reinit(); } void QuickEditImpl::slotPrio() { - m_state++; - if (m_state > 2 ) - m_state = 0; + m_state -= 2; + if ( m_state < 1 ) + m_state = 5; - switch(m_state ) { - case 0: - m_lbl->setText( "1" ); + switch( m_state ) { + case 1: + m_lbl->setPixmap( priority1 ); break; - case 2: - m_lbl->setText( "5" ); + case 5: + m_lbl->setPixmap( priority5 ); break; - case 1: + case 3: default: - m_lbl->setText( "3"); + m_lbl->setPixmap( priority3 ); break; } } void QuickEditImpl::slotMore() { // TODO - implement } void QuickEditImpl::slotCancel() { reinit(); } void QuickEditImpl::reinit() { - m_state = 1; - m_lbl->setText("3"); + m_state = 3; + m_lbl->setPixmap( priority3 ); m_edit->clear(); } 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,15 +1,17 @@ #ifndef OPIE_QUICK_EDIT_IMPL_H #define OPIE_QUICK_EDIT_IMPL_H +#include <qpixmap.h> + #include <qpe/qpetoolbar.h> #include "quickedit.h" class QLineEdit; class QLabel; class QuickEditImpl : public QPEToolBar, public Todo::QuickEdit { Q_OBJECT public: QuickEditImpl( QWidget* parent, bool visible); ~QuickEditImpl(); @@ -21,15 +23,19 @@ private slots: void slotMore(); void slotCancel(); private: void reinit(); int m_state; QLabel* m_lbl; QLineEdit* m_edit; QLabel* m_enter; QLabel* m_more; QPopupMenu* m_menu; OTodo m_todo; bool m_visible; + + QPixmap priority1; + QPixmap priority3; + QPixmap priority5; }; #endif |