summaryrefslogtreecommitdiff
authorzecke <zecke>2002-11-30 11:20:47 (UTC)
committer zecke <zecke>2002-11-30 11:20:47 (UTC)
commitfdda15344fdf7f71fd9e1e4db15ecc5e12224ddb (patch) (side-by-side diff)
tree32e68b5b483dd3ce8041542e7d95f0b6d8dbf644
parentbd692f7ebe04e23151cce39baf311b925ccf91b1 (diff)
downloadopie-fdda15344fdf7f71fd9e1e4db15ecc5e12224ddb.zip
opie-fdda15344fdf7f71fd9e1e4db15ecc5e12224ddb.tar.gz
opie-fdda15344fdf7f71fd9e1e4db15ecc5e12224ddb.tar.bz2
Back from hospital with new power
This versions clean up m failure on templates with Qt... in todoview Implements Recurrance( backends to not safe it yet ) OPimState and Maintainer mode in some ways and much more This one also implements the OPimMainWindow specs and has a small Memu replacement to get the toolbar in one line
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/pim/todo/mainwindow.cpp213
-rw-r--r--core/pim/todo/mainwindow.h24
-rw-r--r--core/pim/todo/otaskeditor.cpp33
-rw-r--r--core/pim/todo/otaskeditor.h5
-rw-r--r--core/pim/todo/tableview.cpp25
-rw-r--r--core/pim/todo/taskeditoradvanced.ui8
-rw-r--r--core/pim/todo/taskeditoroverviewimpl.cpp49
-rw-r--r--core/pim/todo/taskeditoroverviewimpl.h1
-rw-r--r--core/pim/todo/todo.pro6
-rw-r--r--core/pim/todo/todomanager.cpp7
-rw-r--r--core/pim/todo/todomanager.h7
-rw-r--r--core/pim/todo/todoview.cpp55
-rw-r--r--core/pim/todo/todoview.h80
13 files changed, 304 insertions, 209 deletions
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp
index 9b2423b..b2b3b8f 100644
--- a/core/pim/todo/mainwindow.cpp
+++ b/core/pim/todo/mainwindow.cpp
@@ -46,2 +46,3 @@
+#include <opie/orecur.h>
#include <opie/otodoaccessvcal.h>
@@ -61,3 +62,5 @@ using namespace Todo;
MainWindow::MainWindow( QWidget* parent,
- const char* name ) {
+ const char* name )
+ : OPimMainWindow("Todolist")
+{
@@ -179,3 +182,3 @@ void MainWindow::initActions() {
0, this, 0, TRUE );
- a->addTo( m_view );
+ a->addTo( m_options );
a->setOn( showOverDue() );
@@ -183,5 +186,2 @@ void MainWindow::initActions() {
this, SLOT(slotShowDue(bool) ) );
- m_view->insertSeparator();
-
- m_bar->insertItem( tr("View"), m_view );
@@ -222,3 +222,2 @@ void MainWindow::initUI() {
m_options = new QPopupMenu( this );
- m_view = new QPopupMenu( this );
m_catMenu = new QPopupMenu( this );
@@ -256,13 +255,5 @@ MainWindow::~MainWindow() {
void MainWindow::connectBase( ViewBase* base) {
- base->connectShow( this, SLOT(slotShow(int) ) );
- base->connectEdit( this, SLOT(slotEdit(int) ) );
- base->connectUpdateSmall( this,
- SLOT(slotUpate1(int, const Todo::SmallTodo&) ));
- base->connectUpdateBig( this,
- SLOT(slotUpate2(int, const OTodo& ) ) );
- base->connectUpdateView( this, SLOT(slotUpdate3( QWidget* ) ) ) ;
- base->connectRemove(&m_todoMgr,
- SLOT(remove(int)) );
-}
-QPopupMenu* MainWindow::contextMenu( int uid ) {
+ // once templates and signals mix we'll use it again
+}
+QPopupMenu* MainWindow::contextMenu( int , bool recur ) {
QPopupMenu* menu = new QPopupMenu();
@@ -272,4 +263,14 @@ QPopupMenu* MainWindow::contextMenu( int uid ) {
m_duplicateAction->addTo( menu );
+
menu->insertSeparator();
+ /*
+ * if this event recurs we allow
+ * to detach it.
+ * remove all
+ */
+ if ( recur ) {
+ ; // FIXME
+ }
+
return menu;
@@ -283,5 +284,2 @@ QPopupMenu* MainWindow::edit() {
}
-QPopupMenu* MainWindow::view() {
- return m_view;
-}
QToolBar* MainWindow::toolbar() {
@@ -415,24 +413,3 @@ void MainWindow::slotNewFromTemplate( int id ) {
void MainWindow::slotNew() {
- if(m_syncing) {
- QMessageBox::warning(this, tr("Todo"),
- tr("Can not edit data, currently syncing"));
- return;
- }
-
-
- OTodo todo = currentEditor()->newTodo( currentCatId(),
- this );
-
- if ( currentEditor()->accepted() ) {
- //todo.assignUid();
- m_todoMgr.add( todo );
- currentView()->addEvent( todo );
-
-
- // I'm afraid we must call this every time now, otherwise
- // spend expensive time comparing all these strings...
- // but only call if we changed something -zecke
- populateCategories();
- }
- raiseCurrentView( );
+ create();
}
@@ -476,3 +453,2 @@ void MainWindow::slotDeleteAll() {
- //QString strName = table->text( table->currentRow(), 2 ).left( 30 );
@@ -496,4 +472,4 @@ void MainWindow::slotDeleteCompleted() {
- // FIXME
- //m_todoMgr.remove( currentView()->completed() );
+
+ m_todoMgr.removeCompleted();
currentView()->updateView( );
@@ -554,14 +530,3 @@ static const char *beamfile = "/tmp/opie-todo.vcs";
void MainWindow::slotBeam() {
- ::unlink( beamfile );
- OTodo todo = event( currentView()->current() );
- OTodoAccessVCal* cal = new OTodoAccessVCal(QString::fromLatin1(beamfile) );
- OTodoAccess acc( cal );
- acc.load();
- acc.add( todo );
- acc.save();
- Ir* ir = new Ir(this );
- connect(ir, SIGNAL(done(Ir*) ),
- this, SLOT(beamDone(Ir*) ) );
- ir->send( beamfile, todo.summary(), "text/x-vCalendar" );
-
+ beam( currentView()->current() );
}
@@ -706 +671,135 @@ QuickEditBase* MainWindow::quickEditor() {
}
+void MainWindow::slotComplete( int uid ) {
+ slotComplete( event(uid) );
+}
+void MainWindow::slotComplete( const OTodo& todo ) {
+ OTodo to = todo;
+ to.setCompleted( !to.isCompleted() );
+ to.setCompletedDate( QDate::currentDate() );
+
+ /*
+ * if the item does recur
+ * we need to spin it off
+ * and update the items duedate to the next
+ * possible recurrance of this item...
+ * the spinned off one will loose the
+ */
+ if ( to.recurrence().doesRecur() && to.isCompleted() ) {
+ OTodo to2( to );
+
+ /* the spinned off one won't recur anymore */
+ to.setRecurrence( ORecur() );
+
+ ORecur rec = to2.recurrence();
+ rec.setStart( to.dueDate() );
+ to2.setRecurrence( rec );
+ /*
+ * if there is a next occurence
+ * from the duedate of the last recurrance
+ */
+ QDate date;
+ if ( to2.recurrence().nextOcurrence( to2.dueDate().addDays(1), date ) ) {
+ QDate inval;
+ /* generate a new uid for the old record */
+ to.setUid( 1 );
+
+ /* add the old one cause it has a new UID here cause it was spin off */
+ m_todoMgr.add( to );
+
+ /*
+ * update the due date
+ * start date
+ * and complete date
+ */
+ to2.setDueDate( date );
+ to2.setStartDate( inval );
+ to2.setCompletedDate( inval );
+ to2.setCompleted( false );
+ updateTodo( to2 );
+ }else
+ updateTodo( to );
+ }else
+ updateTodo( to );
+
+ currentView()->updateView();
+ raiseCurrentView();
+}
+void MainWindow::flush() {
+ slotFlush();
+}
+void MainWindow::reload() {
+ slotReload();
+}
+int MainWindow::create() {
+ int uid = 0;
+ if(m_syncing) {
+ QMessageBox::warning(this, tr("Todo"),
+ tr("Can not edit data, currently syncing"));
+ return uid;
+ }
+
+
+ OTodo todo = currentEditor()->newTodo( currentCatId(),
+ this );
+
+ if ( currentEditor()->accepted() ) {
+ //todo.assignUid();
+ uid = todo.uid();
+ m_todoMgr.add( todo );
+ currentView()->addEvent( todo );
+
+
+ // I'm afraid we must call this every time now, otherwise
+ // spend expensive time comparing all these strings...
+ // but only call if we changed something -zecke
+ populateCategories();
+ }
+ raiseCurrentView( );
+
+ return uid;
+}
+/* delete it silently... */
+bool MainWindow::remove( int uid ) {
+ if (m_syncing) return false;
+
+ return m_todoMgr.remove( uid );
+}
+void MainWindow::beam( int uid, int ) {
+ ::unlink( beamfile );
+ OTodo todo = event( uid );
+ OTodoAccessVCal* cal = new OTodoAccessVCal(QString::fromLatin1(beamfile) );
+ OTodoAccess acc( cal );
+ acc.load();
+ acc.add( todo );
+ acc.save();
+ Ir* ir = new Ir(this );
+ connect(ir, SIGNAL(done(Ir*) ),
+ this, SLOT(beamDone(Ir*) ) );
+ ir->send( beamfile, todo.summary(), "text/x-vCalendar" );
+}
+void MainWindow::show( int uid ) {
+ slotShow( uid );
+}
+void MainWindow::edit( int uid ) {
+ slotEdit( uid );
+}
+void MainWindow::add( const OPimRecord& rec) {
+ if ( rec.rtti() != OTodo::rtti() ) return;
+
+ const OTodo& todo = static_cast<const OTodo&>(rec);
+
+ m_todoMgr.add(todo );
+ currentView()->addEvent( todo );
+
+
+ // I'm afraid we must call this every time now, otherwise
+ // spend expensive time comparing all these strings...
+ // but only call if we changed something -zecke
+ populateCategories();
+}
+/* todo does not have the QDataStream<< and >> operators implemented :(
+ * FIXME
+ */
+OPimRecord* MainWindow::record( int rtti, const QByteArray& ) {
+ return 0l;
+}
diff --git a/core/pim/todo/mainwindow.h b/core/pim/todo/mainwindow.h
index 270cbd1..14cfa82 100644
--- a/core/pim/todo/mainwindow.h
+++ b/core/pim/todo/mainwindow.h
@@ -32,3 +32,2 @@
#include <qlist.h>
-#include <qmainwindow.h>
@@ -36,2 +35,3 @@
#include <opie/otodo.h>
+#include <opie/opimmainwindow.h>
@@ -58,4 +58,5 @@ namespace Todo {
- class MainWindow : public QMainWindow {
+ class MainWindow : public OPimMainWindow {
Q_OBJECT
+ friend class TodoView; // avoid QObject here....
public:
@@ -66,6 +67,5 @@ namespace Todo {
/** return a context menu for an OTodo */
- QPopupMenu* contextMenu(int uid );
+ QPopupMenu* contextMenu(int uid, bool doesRecur = FALSE );
QPopupMenu* options();
QPopupMenu* edit();
- QPopupMenu* view();
QToolBar* toolbar();
@@ -138,3 +138,2 @@ private slots:
*m_options,
- *m_view,
*m_template;
@@ -163,4 +162,5 @@ private slots:
void slotEdit(int);
-private slots:
void slotUpdate3( QWidget* );
+ void slotComplete( int uid );
+ void slotComplete( const OTodo& ev );
void slotNewFromTemplate(int id );
@@ -168,2 +168,3 @@ private slots:
void slotDuplicate();
+
void slotDelete();
@@ -187,2 +188,13 @@ private slots:
void slotShowDue( bool );
+ /* reimplementation from opimmainwindow */
+ protected slots:
+ void flush();
+ void reload();
+ int create();
+ bool remove( int uid );
+ void beam(int uid, int transport = IrDa );
+ void show( int uid );
+ void edit( int uid );
+ void add( const OPimRecord& );
+ OPimRecord* record( int rtti, const QByteArray& );
};
diff --git a/core/pim/todo/otaskeditor.cpp b/core/pim/todo/otaskeditor.cpp
index 8b261de..eeb3c0c 100644
--- a/core/pim/todo/otaskeditor.cpp
+++ b/core/pim/todo/otaskeditor.cpp
@@ -4,2 +4,3 @@
#include <qmultilineedit.h>
+#include <qscrollview.h>
@@ -8,3 +9,3 @@
#include "taskeditoroverviewimpl.h"
-#include "taskeditoradvanced.h"
+#include "taskeditoradvancedimpl.h"
#include "taskeditoralarms.h"
@@ -42,3 +43,4 @@ OTodo OTaskEditor::todo()const{
m_overView->save( to );
- to.setDescription( m_line->text() );
+ m_adv->save( to );
+ to.setRecurrence( m_rec->recurrence() );
@@ -48,3 +50,4 @@ void OTaskEditor::load(const OTodo& to) {
m_overView->load( to );
- m_line->setText( to.description() );
+ m_adv->load( to );
+ m_rec->setRecurrence( to.recurrence(), to.hasDueDate() ? to.dueDate() : QDate::currentDate() );
}
@@ -52,5 +55,13 @@ void OTaskEditor::init() {
QVBoxLayout* lay = new QVBoxLayout(this);
+ QScrollView* view = new QScrollView( this );
+ view->setResizePolicy( QScrollView::AutoOneFit );
+ lay->addWidget( view );
+
setCaption("Task Editor");
- m_tab = new OTabWidget(this);
+ QWidget* container = new QWidget( view->viewport() );
+ view->addChild( container );
+ QVBoxLayout* layo = new QVBoxLayout( container );
+ m_tab = new OTabWidget(container );
+ layo->addWidget( m_tab );
/*
@@ -61,9 +72,3 @@ void OTaskEditor::init() {
- m_adv = new TaskEditorAdvanced( m_tab );
- m_line = new QMultiLineEdit(m_adv );
- m_line->setWordWrap( QMultiLineEdit::WidgetWidth );
- QLabel* label = new QLabel(m_adv );
- label->setText( tr("Description") );
- ((QGridLayout*) m_adv->layout() )->addWidget( label,3, 0 );
- ((QGridLayout*) m_adv->layout())->addWidget( m_line,4,0 );
+ m_adv = new TaskEditorAdvancedImpl( m_tab );
m_tab->addTab( m_adv, QString::null, tr("Advanced") );
@@ -83,3 +88,2 @@ void OTaskEditor::init() {
- lay->addWidget(m_tab );
@@ -89,2 +93,7 @@ void OTaskEditor::init() {
+ /* connect due date changed to the recurrence tab */
+ connect(m_overView, SIGNAL(dueDateChanged(const QDate&) ),
+ m_rec, SLOT(setStartDate(const QDate& ) ) );
+
+
m_tab->setCurrentTab( m_overView );
diff --git a/core/pim/todo/otaskeditor.h b/core/pim/todo/otaskeditor.h
index bcbd543..b43abbf 100644
--- a/core/pim/todo/otaskeditor.h
+++ b/core/pim/todo/otaskeditor.h
@@ -9,3 +9,3 @@
class TaskEditorOverViewImpl;
-class TaskEditorAdvanced;
+class TaskEditorAdvancedImpl;
class TaskEditorAlarms;
@@ -34,3 +34,3 @@ private:
TaskEditorOverViewImpl* m_overView;
- TaskEditorAdvanced *m_adv;
+ TaskEditorAdvancedImpl *m_adv;
TaskEditorAlarms *m_alarm;
@@ -38,3 +38,2 @@ private:
ORecurranceWidget* m_rec;
- QMultiLineEdit* m_line;
int m_uid;
diff --git a/core/pim/todo/tableview.cpp b/core/pim/todo/tableview.cpp
index ded2dbd..0f683c9 100644
--- a/core/pim/todo/tableview.cpp
+++ b/core/pim/todo/tableview.cpp
@@ -37,2 +37,4 @@
+#include <opie/orecur.h>
+
#include "mainwindow.h"
@@ -122,3 +124,3 @@ TableView::~TableView() {
void TableView::slotShowMenu() {
- QPopupMenu *menu = todoWindow()->contextMenu( current() );
+ QPopupMenu *menu = todoWindow()->contextMenu( current(), sorted()[currentRow()].recurrence().doesRecur() );
menu->exec(QCursor::pos() );
@@ -131,3 +133,3 @@ int TableView::current() {
int uid = sorted().uidAt(currentRow() );
- qWarning("uid %d", uid );
+
return uid;
@@ -135,3 +137,4 @@ int TableView::current() {
QString TableView::currentRepresentation() {
- return text( currentRow(), 2);
+ OTodo to = sorted()[currentRow()];
+ return to.summary().isEmpty() ? to.description().left(20) : to.summary() ;
}
@@ -147,3 +150,3 @@ void TableView::updateView( ) {
static int id;
- id = startTimer(2000 );
+ id = startTimer(4000 );
/* FIXME we want one page to be read!
@@ -244,6 +247,3 @@ void TableView::slotClicked(int row, int col, int,
y <= ( h - BoxSize ) / 2 + BoxSize ) {
- OTodo todo = sorted()[row];
- todo.setCompleted( !todo.isCompleted() );
- TodoView::update( todo.uid(), todo );
- updateView();
+ TodoView::complete(sorted()[row] );
}
@@ -371,3 +371,3 @@ void TableView::paintCell(QPainter* p, int row, int col, const QRect& cr, bool
QString text = task.summary().isEmpty() ?
- task.description() :
+ task.description().left(20) :
task.summary();
@@ -464,3 +464,3 @@ void TableView::slotPriority() {
void TableView::timerEvent( QTimerEvent* ev ) {
- qWarning("sorted %d", sorted().count() );
+// qWarning("sorted %d", sorted().count() );
if (sorted().count() == 0 )
@@ -515,6 +515,3 @@ void TableView::contentsMouseReleaseEvent( QMouseEvent* e) {
colOld != colNew ) {
- OTodo todo = sorted()[row];
- todo.setCompleted( !todo.isCompleted() );
- TodoView::update( todo.uid(), todo );
- updateView();
+ TodoView::complete( sorted()[row] );
return;
diff --git a/core/pim/todo/taskeditoradvanced.ui b/core/pim/todo/taskeditoradvanced.ui
index 3ea1346..6160712 100644
--- a/core/pim/todo/taskeditoradvanced.ui
+++ b/core/pim/todo/taskeditoradvanced.ui
@@ -13,3 +13,3 @@
<y>0</y>
- <width>236</width>
+ <width>232</width>
<height>307</height>
@@ -197,2 +197,8 @@
<name>text</name>
+ <string>Nothing</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
<string>Responsible</string>
diff --git a/core/pim/todo/taskeditoroverviewimpl.cpp b/core/pim/todo/taskeditoroverviewimpl.cpp
index 24b3386..aef3b1d 100644
--- a/core/pim/todo/taskeditoroverviewimpl.cpp
+++ b/core/pim/todo/taskeditoroverviewimpl.cpp
@@ -9,2 +9,4 @@
+#include <opie/orecur.h>
+
#include "taskeditoroverviewimpl.h"
@@ -31,3 +33,5 @@ void TaskEditorOverViewImpl::load( const OTodo& todo) {
-
+ /*
+ * get some basic dateinfos for now
+ */
QDate date = QDate::currentDate();
@@ -35,7 +39,20 @@ void TaskEditorOverViewImpl::load( const OTodo& todo) {
- emit recurranceEnabled( FALSE );
- ckbStart->setChecked( FALSE );
+ CheckBox7->setChecked( todo.recurrence().doesRecur() );
+ emit recurranceEnabled( todo.recurrence().doesRecur() );
+
+
+ ckbStart->setChecked( todo.hasStartDate() );
+ btnStart->setEnabled( todo.hasStartDate() );
+ if ( todo.hasStartDate() ) {
+ m_start = todo.startDate();
+ btnStart->setText( TimeString::longDateString( m_start ) );
+ } else
btnStart->setText( str );
- ckbComp->setChecked( FALSE );
+ ckbComp->setChecked( todo.hasCompletedDate() );
+ btnComp->setEnabled( todo.hasCompletedDate() );
+ if ( todo.hasCompletedDate() ) {
+ m_comp = todo.completedDate();
+ btnComp->setText( TimeString::longDateString( m_comp ) );
+ }else
btnComp->setText( str );
@@ -49,2 +66,3 @@ void TaskEditorOverViewImpl::load( const OTodo& todo) {
btnDue->setEnabled( todo.hasDueDate() );
+ m_due = todo.dueDate();
@@ -57,3 +75,7 @@ void TaskEditorOverViewImpl::load( const OTodo& todo) {
void TaskEditorOverViewImpl::save( OTodo& to) {
- qWarning("save it now");
+ /* a invalid date */
+ QDate inval;
+ /* save our info back */
+
+ /* due date */
if ( ckbDue->isChecked() ) {
@@ -63,2 +85,17 @@ void TaskEditorOverViewImpl::save( OTodo& to) {
to.setHasDueDate( false );
+
+ /* start date */
+ if ( ckbStart->isChecked() ) {
+ to.setStartDate( m_start );
+ }else
+ to.setStartDate( inval );
+
+ /* comp date */
+ if ( ckbComp->isChecked() ) {
+ qWarning("completed checked");
+ to.setCompletedDate( m_comp );
+ }else
+ to.setCompletedDate( inval );
+
+
if ( comboCategory->currentCategory() != -1 ) {
@@ -138,2 +175,3 @@ void TaskEditorOverViewImpl::slotDueChecked() {
btnDue->setEnabled( ckbDue->isChecked() );
+ emit dueDateChanged( m_due );
qWarning("slotDueChecked");
@@ -143,2 +181,3 @@ void TaskEditorOverViewImpl::slotDueChanged(int y, int m, int d ) {
btnDue->setText( TimeString::longDateString( m_due ) );
+ emit dueDateChanged( m_due );
}
diff --git a/core/pim/todo/taskeditoroverviewimpl.h b/core/pim/todo/taskeditoroverviewimpl.h
index 4fab381..5ee985e 100644
--- a/core/pim/todo/taskeditoroverviewimpl.h
+++ b/core/pim/todo/taskeditoroverviewimpl.h
@@ -22,2 +22,3 @@ signals:
void recurranceEnabled( bool );
+ void dueDateChanged( const QDate& date );
diff --git a/core/pim/todo/todo.pro b/core/pim/todo/todo.pro
index 8f21416..40a5f28 100644
--- a/core/pim/todo/todo.pro
+++ b/core/pim/todo/todo.pro
@@ -20,3 +20,4 @@ HEADERS = smalltodo.h \
otaskeditor.h \
- taskeditoroverviewimpl.h
+ taskeditoroverviewimpl.h \
+ taskeditoradvancedimpl.h
@@ -39,3 +40,4 @@ SOURCES = smalltodo.cpp \
otaskeditor.cpp \
- taskeditoroverviewimpl.cpp
+ taskeditoroverviewimpl.cpp \
+ taskeditoradvancedimpl.cpp
diff --git a/core/pim/todo/todomanager.cpp b/core/pim/todo/todomanager.cpp
index 1f81539..b5b87de 100644
--- a/core/pim/todo/todomanager.cpp
+++ b/core/pim/todo/todomanager.cpp
@@ -87,4 +87,4 @@ void TodoManager::update( int, const OTodo& ev) {
}
-void TodoManager::remove( int uid ) {
- m_db->remove( uid );
+bool TodoManager::remove( int uid ) {
+ return m_db->remove( uid );
}
@@ -93,2 +93,5 @@ void TodoManager::removeAll() {
}
+void TodoManager::removeCompleted() {
+ m_db->removeAllCompleted();
+}
void TodoManager::save() {
diff --git a/core/pim/todo/todomanager.h b/core/pim/todo/todomanager.h
index b03b598..8544277 100644
--- a/core/pim/todo/todomanager.h
+++ b/core/pim/todo/todomanager.h
@@ -84,4 +84,9 @@ namespace Todo {
void update( int uid, const OTodo& );
- void remove( int uid );
+ bool remove( int uid );
void remove( const QArray<int>& );
+
+ /**
+ * remove all completed
+ */
+ void removeCompleted();
void removeAll();
diff --git a/core/pim/todo/todoview.cpp b/core/pim/todo/todoview.cpp
index 4cf7d30..3e808e7 100644
--- a/core/pim/todo/todoview.cpp
+++ b/core/pim/todo/todoview.cpp
@@ -6,2 +6,5 @@ using namespace Todo;
+
+
+
TodoView::TodoView( MainWindow* win )
@@ -9,3 +12,2 @@ TodoView::TodoView( MainWindow* win )
{
- hack = new InternQtHack;
m_asc = false;
@@ -14,35 +16,3 @@ TodoView::TodoView( MainWindow* win )
TodoView::~TodoView() {
- delete hack;
};
-
-void TodoView::connectShow(QObject* obj,
- const char* slot ) {
- QObject::connect( hack, SIGNAL(showTodo(int) ),
- obj, slot );
-}
-void TodoView::connectEdit( QObject* obj,
- const char* slot ) {
- QObject::connect( hack, SIGNAL(edit(int) ),
- obj, slot );
-}
-void TodoView::connectUpdateSmall( QObject* obj,
- const char* slot ) {
- QObject::connect( hack, SIGNAL(update(int, const Todo::SmallTodo& ) ),
- obj, slot );
-}
-void TodoView::connectUpdateBig( QObject* obj,
- const char* slot ) {
- QObject::connect( hack, SIGNAL(update(int, const OTodo& ) ),
- obj, slot );
-}
-void TodoView::connectUpdateView( QObject* obj,
- const char* slot ) {
- QObject::connect( hack, SIGNAL(update(QWidget*) ),
- obj, slot );
-}
-void TodoView::connectRemove( QObject* obj,
- const char* slot ) {
- QObject::connect( hack, SIGNAL(remove(int) ),
- obj, slot );
-}
MainWindow* TodoView::todoWindow() {
@@ -51,3 +21,5 @@ MainWindow* TodoView::todoWindow() {
-OTodo TodoView::event(int uid ) { return m_main->event( uid ); }
+OTodo TodoView::event(int uid ) {
+ return m_main->event( uid );
+}
OTodoAccess::List TodoView::list(){
@@ -79 +51,16 @@ void TodoView::update(int , const OTodo& ev ) {
}
+void TodoView::showTodo( int uid ) {
+ m_main->slotShow( uid );
+}
+void TodoView::edit( int uid ) {
+ m_main->slotEdit( uid );
+}
+void TodoView::remove( int uid ) {
+ m_main->m_todoMgr.remove( uid );
+}
+void TodoView::complete( int uid ) {
+ m_main->slotComplete( uid );
+}
+void TodoView::complete( const OTodo& ev ) {
+ m_main->slotComplete( ev );
+}
diff --git a/core/pim/todo/todoview.h b/core/pim/todo/todoview.h
index e5c77f9..e73e808 100644
--- a/core/pim/todo/todoview.h
+++ b/core/pim/todo/todoview.h
@@ -42,39 +42,2 @@
namespace Todo {
-
- /**
- * According to tronical it's not possible
- * to have Q_OBJECT in a template at all
- * so this is a hack widget not meant
- * to be public
- */
- class InternQtHack : public QObject {
- Q_OBJECT
- public:
- InternQtHack() : QObject() {};
- void emitShow(int uid) { emit showTodo(uid); }
- void emitEdit(int uid) { emit edit(uid ); }
- void emitUpdate( int uid,
- const SmallTodo& to) {
- emit update(uid, to );
- }
- void emitUpdate( int uid,
- const OTodo& ev ){
- emit update(uid, ev );
- }
- void emitRemove( int uid ) {
- emit remove( uid );
- }
- void emitUpdate( QWidget* wid ) {
- emit update( wid );
- }
- signals:
- void showTodo(int uid );
- void edit(int uid );
- void update( int uid, const Todo::SmallTodo& );
- void update( int uid, const OTodo& );
- /* sorry you need to cast */;
- void update( QWidget* wid );
- void remove( int uid );
-
- };
class MainWindow;
@@ -84,3 +47,3 @@ namespace Todo {
*/
- class ViewBase {
+ struct ViewBase {
public:
@@ -104,12 +67,3 @@ namespace Todo {
virtual void clear() = 0;
-/* virtual QArray<int> completed() = 0; */
virtual void newDay() = 0;
-
- virtual void connectShow( QObject*, const char* ) = 0;
- virtual void connectEdit( QObject*, const char* ) = 0;
- virtual void connectUpdateSmall( QObject*, const char* ) = 0;
- virtual void connectUpdateBig( QObject*, const char* ) = 0;
- virtual void connectUpdateView( QObject*, const char*) = 0;
- virtual void connectRemove( QObject*, const char* ) = 0;
-
};
@@ -140,17 +94,2 @@ namespace Todo {
- /* connect to the show signal */
- void connectShow(QObject* obj,
- const char* slot );
-
- /* connect to edit */
- void connectEdit( QObject* obj,
- const char* slot );
- void connectUpdateSmall( QObject* obj,
- const char* slot );
- void connectUpdateBig( QObject* obj,
- const char* slot ) ;
- void connectUpdateView( QObject* obj,
- const char* slot );
- void connectRemove( QObject* obj,
- const char* slot );
protected:
@@ -166,16 +105,13 @@ namespace Todo {
/*
- These things needs to be implemented
- in a implementation
- signals:
+ * These things needs to be implemented
+ * in a implementation
*/
- protected:
- void showTodo( int uid ) { hack->emitShow(uid); }
- void edit( int uid ) { hack->emitEdit(uid); }
+ void showTodo( int uid );
+ void edit( int uid );
void update(int uid, const SmallTodo& to );
void update(int uid, const OTodo& ev);
- void remove( int uid ) {
- hack->emitRemove( uid );
- }
+ void remove( int uid );
+ void complete( int uid );
+ void complete( const OTodo& ev );
private:
- InternQtHack* hack;
MainWindow *m_main;