summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/todo/mainwindow.cpp29
-rw-r--r--core/pim/todo/mainwindow.h16
-rw-r--r--core/pim/todo/quickedit.cpp22
-rw-r--r--core/pim/todo/quickedit.h45
-rw-r--r--core/pim/todo/quickeditimpl.cpp89
-rw-r--r--core/pim/todo/quickeditimpl.h34
-rw-r--r--core/pim/todo/tableview.cpp14
-rw-r--r--core/pim/todo/todo.pro8
8 files changed, 247 insertions, 10 deletions
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp
index a6d657c..8377573 100644
--- a/core/pim/todo/mainwindow.cpp
+++ b/core/pim/todo/mainwindow.cpp
@@ -37,2 +37,4 @@
#include <qtimer.h>
+#include <qvbox.h>
+#include <qlineedit.h>
@@ -46,2 +48,3 @@
+#include "quickeditimpl.h"
#include "todotemplatemanager.h"
@@ -200,4 +203,11 @@ void MainWindow::initConfig() {
void MainWindow::initUI() {
- m_stack = new QWidgetStack(this, "main stack");
- setCentralWidget( m_stack );
+ m_mainBox = new QVBox(this, "main box ");
+ m_curQuick = new QuickEditImpl(this, m_mainBox );
+ m_curQuick->signal()->connect( this, SLOT(slotQuickEntered() ) );
+ m_quickEdit.append( m_curQuick );
+
+
+
+ m_stack = new QWidgetStack(m_mainBox, "main stack");
+ setCentralWidget( m_mainBox );
@@ -226,3 +236,3 @@ void MainWindow::initUI() {
void MainWindow::initViews() {
- TableView* tableView = new TableView( this, this );
+ TableView* tableView = new TableView( this, m_stack );
m_stack->addWidget( tableView, m_counter++ );
@@ -683 +693,14 @@ void MainWindow::setReadAhead( uint count ) {
}
+void MainWindow::slotQuickEntered() {
+ qWarning("entered");
+ OTodo todo = quickEditor()->todo();
+ if (todo.isEmpty() )
+ return;
+
+ m_todoMgr.add( todo );
+ currentView()->addEvent( todo );
+ raiseCurrentView();
+}
+QuickEditBase* MainWindow::quickEditor() {
+ return m_curQuick;
+}
diff --git a/core/pim/todo/mainwindow.h b/core/pim/todo/mainwindow.h
index 5a18e64..270cbd1 100644
--- a/core/pim/todo/mainwindow.h
+++ b/core/pim/todo/mainwindow.h
@@ -39,2 +39,3 @@
#include "todoview.h"
+#include "quickedit.h"
#include "todomanager.h"
@@ -47,3 +48,3 @@ class QWidgetStack;
class Ir;
-
+class QVBox;
@@ -55,2 +56,3 @@ namespace Todo {
class TemplateEditor;
+ struct QuickEditBase;
@@ -85,2 +87,3 @@ namespace Todo {
TemplateManager* templateManager();
+ QuickEditBase* quickEditor();
@@ -91,2 +94,3 @@ namespace Todo {
private slots:
+ void slotQuickEntered();
void populateCategories();
@@ -111,2 +115,3 @@ private slots:
ViewBase* m_curView;
+ QuickEditBase* m_curQuick;
Editor* m_curEdit;
@@ -135,2 +140,9 @@ private slots:
*m_template;
+ /* box with two rows
+ * top will be the quick edit
+ * this will bite my ass once
+ * we want to have all parts
+ * exchangeable
+ */
+ QVBox* m_mainBox;
@@ -143,2 +155,3 @@ private slots:
QList<ViewBase> m_views;
+ QList<QuickEditBase> m_quickEdit;
uint m_counter;
@@ -146,2 +159,3 @@ private slots:
+
private slots:
diff --git a/core/pim/todo/quickedit.cpp b/core/pim/todo/quickedit.cpp
new file mode 100644
index 0000000..edcd48a
--- a/dev/null
+++ b/core/pim/todo/quickedit.cpp
@@ -0,0 +1,22 @@
+#include "mainwindow.h"
+#include "quickedit.h"
+
+using namespace Todo;
+
+// not so interesting part base Implementation
+QuickEdit::QuickEdit(MainWindow* main )
+ : m_main( main ) {
+ m_sig = new QSignal();
+}
+QuickEdit::~QuickEdit() {
+ delete m_sig;
+}
+QSignal* QuickEdit::signal() {
+ return m_sig;
+}
+MainWindow* QuickEdit::mainWindow() {
+ return m_main;
+}
+void QuickEdit::commit() {
+ m_sig->activate();
+}
diff --git a/core/pim/todo/quickedit.h b/core/pim/todo/quickedit.h
new file mode 100644
index 0000000..5fe74fe
--- a/dev/null
+++ b/core/pim/todo/quickedit.h
@@ -0,0 +1,45 @@
+#ifndef OPIE_QUICK_EDIT_H
+#define OPIE_QUICK_EDIT_H
+
+#include <qsignal.h>
+#include <qwidget.h>
+
+#include <opie/otodo.h>
+
+namespace Todo{
+ class MainWindow;
+ struct QuickEditBase {
+ virtual OTodo todo()const = 0l;
+ virtual QSignal* signal() = 0l;
+ virtual QWidget* widget() = 0l;
+ };
+ /*
+ * this is my second try
+ * of signal and slots with namespaces
+ * and templates
+ * I use a different approach now
+ * I give a QSignal away
+ * and have a protected method called emit
+ */
+ /**
+ * Quick edit is meant to quickly enter
+ * OTodos in a fast way
+ */
+ class QuickEdit : public QuickEditBase{
+ public:
+ QuickEdit(MainWindow* main );
+ virtual ~QuickEdit();
+ //OTodo todo()const;
+ QSignal* signal();
+ //QWidget* widget();
+ protected:
+ MainWindow* mainWindow();
+ void commit();
+ private:
+ MainWindow* m_main;
+ QSignal* m_sig;
+ };
+};
+
+
+#endif
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();
+}
diff --git a/core/pim/todo/quickeditimpl.h b/core/pim/todo/quickeditimpl.h
new file mode 100644
index 0000000..d0f6c69
--- a/dev/null
+++ b/core/pim/todo/quickeditimpl.h
@@ -0,0 +1,34 @@
+#ifndef OPIE_QUICK_EDIT_IMPL_H
+#define OPIE_QUICK_EDIT_IMPL_H
+
+#include <qhbox.h>
+
+#include "quickedit.h"
+
+class QLineEdit;
+class QLabel;
+
+class QuickEditImpl : public QHBox, public Todo::QuickEdit {
+ Q_OBJECT
+public:
+ QuickEditImpl( Todo::MainWindow* win , QWidget* parent);
+ ~QuickEditImpl();
+ OTodo todo()const;
+ QWidget* widget();
+ QSize sizeHint()const;
+private slots:
+ void slotEnter();
+ void slotPrio();
+ void slotMore();
+private:
+ void reinit();
+ int m_state;
+ QLabel* m_lbl;
+ QLineEdit* m_edit;
+ QLabel* m_enter;
+ QLabel* m_more;
+ QPopupMenu* m_menu;
+ OTodo m_todo;
+};
+
+#endif
diff --git a/core/pim/todo/tableview.cpp b/core/pim/todo/tableview.cpp
index f4b898f..34b8b3c 100644
--- a/core/pim/todo/tableview.cpp
+++ b/core/pim/todo/tableview.cpp
@@ -128,4 +128,6 @@ void TableView::showOverDue( bool ) {
void TableView::updateView( ) {
+ qWarning("update view");
m_row = false;
- startTimer( 2000 );
+ static int id;
+ id = startTimer(2000 );
/* FIXME we want one page to be read!
@@ -150,2 +152,4 @@ void TableView::updateView( ) {
setNumRows( it.count() );
+ if ( it.count() == 0 )
+ killTimer(id);
int elc = time.elapsed();
@@ -164,9 +168,8 @@ void TableView::setTodo( int, const OTodo&) {
/* repaint */
- QTable::update();
+ repaint();
}
void TableView::addEvent( const OTodo&) {
- sort();
/* fix problems of not showing the 'Haken' */
- QTable::repaint();
+ updateView();
}
@@ -430,2 +433,5 @@ void TableView::slotPriority() {
void TableView::timerEvent( QTimerEvent* ev ) {
+ if (sorted().count() == 0 )
+ return;
+
int row = currentRow();
diff --git a/core/pim/todo/todo.pro b/core/pim/todo/todo.pro
index f26acee..d432e78 100644
--- a/core/pim/todo/todo.pro
+++ b/core/pim/todo/todo.pro
@@ -17,3 +17,5 @@ HEADERS = smalltodo.h \
templatedialog.h \
- templatedialogimpl.h
+ templatedialogimpl.h \
+ quickedit.h \
+ quickeditimpl.h
@@ -33,3 +35,5 @@ SOURCES = smalltodo.cpp \
templatedialog.cpp \
- templatedialogimpl.cpp
+ templatedialogimpl.cpp \
+ quickeditimpl.cpp \
+ quickedit.cpp