From 47ea36b68b6c7f12ae3bb777c89d813b4e1360a3 Mon Sep 17 00:00:00 2001 From: zecke Date: Sat, 19 Oct 2002 02:32:30 +0000 Subject: 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 --- (limited to 'core/pim/todo/quickeditimpl.cpp') 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 + +#include + +#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(); +} -- cgit v0.9.0.2