summaryrefslogtreecommitdiff
path: root/core/pim/todo/quickeditimpl.cpp
authorzecke <zecke>2002-10-19 02:32:30 (UTC)
committer zecke <zecke>2002-10-19 02:32:30 (UTC)
commit47ea36b68b6c7f12ae3bb777c89d813b4e1360a3 (patch) (side-by-side diff)
treed25ec05f1ccf0db36194d5f2879fe543a34620c2 /core/pim/todo/quickeditimpl.cpp
parent7871e87fbd796c57374b23ec91890962b2ef1fe9 (diff)
downloadopie-47ea36b68b6c7f12ae3bb777c89d813b4e1360a3.zip
opie-47ea36b68b6c7f12ae3bb777c89d813b4e1360a3.tar.gz
opie-47ea36b68b6c7f12ae3bb777c89d813b4e1360a3.tar.bz2
Fix crash if todolist is empty
Fix paint update bugs.. knewly created items did not show up. an sort() QTable::update() is and was not enough A new feature. It's a quick entering method. It lacks icons and some more stuff but I like it Now redoing the Editor Dialog
Diffstat (limited to 'core/pim/todo/quickeditimpl.cpp') (more/less context) (show whitespace changes)
-rw-r--r--core/pim/todo/quickeditimpl.cpp89
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 @@
+#include <qlineedit.h>
+
+#include <opie/oclickablelabel.h>
+
+#include "mainwindow.h"
+#include "quickeditimpl.h"
+
+
+QuickEditImpl::QuickEditImpl( Todo::MainWindow* win, QWidget* arent )
+ : QHBox(arent), Todo::QuickEdit(win) {
+ m_lbl = new OClickableLabel(this );
+ m_lbl->setMinimumWidth(12);
+ m_lbl->setText("3");
+
+ m_edit = new QLineEdit(this );
+
+ m_enter = new OClickableLabel(this);
+ m_enter->setText("Enter");
+
+ m_more = new OClickableLabel(this);
+ m_more->setText("More");
+
+
+ // connect
+ connect(m_lbl, SIGNAL(clicked() ),
+ this, SLOT(slotPrio()) );
+ connect(m_enter, SIGNAL(clicked() ),
+ this, SLOT(slotEnter() ) );
+ connect(m_more, SIGNAL(clicked() ),
+ this, SLOT(slotMore() ) );
+
+ m_menu = 0l;
+ reinit();
+ setMaximumHeight( m_edit->sizeHint().height() );
+}
+QuickEditImpl::~QuickEditImpl() {
+
+}
+OTodo QuickEditImpl::todo()const {
+ return m_todo;
+}
+QWidget* QuickEditImpl::widget() {
+ return this;
+}
+QSize QuickEditImpl::sizeHint()const{
+ return m_edit->sizeHint();
+}
+void QuickEditImpl::slotEnter() {
+ OTodo todo;
+
+
+ if (!m_edit->text().isEmpty() ) {
+ todo.setUid(1 ); // new uid
+ todo.setPriority( m_lbl->text().toInt() );
+ todo.setSummary( m_edit->text() );
+ if ( mainWindow()->currentCatId() != 0 )
+ todo.setCategories( mainWindow()->currentCatId() );
+
+ m_todo = todo;
+ commit();
+ }
+ m_todo = todo;
+ reinit();
+}
+void QuickEditImpl::slotPrio() {
+ m_state++;
+ if (m_state > 2 )
+ m_state = 0;
+
+ switch(m_state ) {
+ case 0:
+ m_lbl->setText( "1" );
+ break;
+ case 2:
+ m_lbl->setText( "5" );
+ break;
+ case 1:
+ default:
+ m_lbl->setText( "3");
+ break;
+ }
+}
+void QuickEditImpl::slotMore() {
+}
+void QuickEditImpl::reinit() {
+ m_state = 1;
+ m_lbl->setText("3");
+ m_edit->clear();
+}