-rw-r--r-- | core/pim/today/today.cpp | 45 |
1 files changed, 32 insertions, 13 deletions
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp index 1cdc6b4..81d4d36 100644 --- a/core/pim/today/today.cpp +++ b/core/pim/today/today.cpp @@ -41,11 +41,10 @@ #include <qfileinfo.h> #include <qlayout.h> +#include <qtl.h> //#include <iostream.h> -//#include <unistd.h> +#include <unistd.h> #include <stdlib.h> - - int MAX_LINES_TASK; int MAX_CHAR_CLIP; @@ -63,5 +62,5 @@ int NEW_START=1; */ Today::Today( QWidget* parent, const char* name, WFlags fl ) - : TodayBase( parent, name, fl ) { + : TodayBase( parent, name, fl ), AllDateBookEvents(NULL) { QObject::connect( (QObject*)PushButton1, SIGNAL( clicked() ), this, SLOT(startConfig() ) ); QObject::connect( (QObject*)TodoButton, SIGNAL( clicked() ), this, SLOT(startTodo() ) ); @@ -196,4 +195,5 @@ void Today::startConfig() { // sync it to "disk" cfg.write(); + NEW_START=1; draw(); autoStart(); @@ -206,9 +206,14 @@ void Today::startConfig() { void Today::getDates() { QDate date = QDate::currentDate(); - QWidget* AllDateBookEvents = new QWidget( ); + + if (AllDateBookEvents) delete AllDateBookEvents; + AllDateBookEvents = new QWidget( ); QVBoxLayout* layoutDates = new QVBoxLayout(AllDateBookEvents); QValueList<EffectiveEvent> list = db->getEffectiveEvents(date, date); + qBubbleSort(list); + // printf("Get dates\n"); + Config config( "qpe" ); // if 24 h format @@ -222,5 +227,4 @@ void Today::getDates() { it!=list.end(); ++it ) { - count++; if ( count <= MAX_LINES_MEET ) { @@ -229,20 +233,24 @@ void Today::getDates() { if (!ONLY_LATER) { + count++; DateBookEvent *l=new DateBookEvent(*it, AllDateBookEvents); layoutDates->addWidget(l); connect (l, SIGNAL(editEvent(const Event &)), - this, SIGNAL(editEvent(const Event &))); + this, SLOT(editEvent(const Event &))); } else if ((time.toString() <= TimeString::dateString((*it).event().end())) ) { + count++; + // show only later appointments DateBookEventLater *l=new DateBookEventLater(*it, AllDateBookEvents); layoutDates->addWidget(l); connect (l, SIGNAL(editEvent(const Event &)), - this, SIGNAL(editEvent(const Event &))); - } else { - QLabel* noMoreEvents = new QLabel(AllDateBookEvents); - noMoreEvents->setText("No more appointments today"); - layoutDates->addWidget(noMoreEvents); - } + this, SLOT(editEvent(const Event &))); + } } + } + if (ONLY_LATER && count==0) { + QLabel* noMoreEvents = new QLabel(AllDateBookEvents); + noMoreEvents->setText("No more appointments today"); + layoutDates->addWidget(noMoreEvents); } } else { @@ -254,4 +262,5 @@ void Today::getDates() { layoutDates->addItem(new QSpacerItem(1,1, QSizePolicy::Minimum, QSizePolicy::Expanding)); sv1->addChild(AllDateBookEvents); + AllDateBookEvents->show(); @@ -394,4 +403,14 @@ void Today::startDatebook() { e << QString("datebook"); } +void Today::editEvent(const Event &e) { + startDatebook(); + + //Dissabled for now as uid's not working properly + /* + while(!QCopChannel::isRegistered("QPE/Datebook")) sleep(1); + QCopEnvelope env("QPE/Datebook", "editEvent(int)"); + env << e.uid(); + */ +} /* |