-rw-r--r-- | core/pim/today/changelog | 6 | ||||
-rw-r--r-- | core/pim/today/opie-today.control | 2 | ||||
-rw-r--r-- | core/pim/today/today.cpp | 45 | ||||
-rw-r--r-- | core/pim/today/today.h | 2 |
4 files changed, 41 insertions, 14 deletions
diff --git a/core/pim/today/changelog b/core/pim/today/changelog index ded4458..d0dd966 100644 --- a/core/pim/today/changelog +++ b/core/pim/today/changelog @@ -1,24 +1,30 @@ +0.2.9 + +* Many bugfixes. +* Today now apparently sorts the dates _allways_ right, i would assume it +to be a qt bug + 0.2.8 * Appointments are now clickable (connection to datebook still missing) * autostart support (opie only) 0.2.7 * check if todolist.xml was changed before parsing it * check only every 30 sec for changes. * some visual stuff * as usual many little improvements .-) 0.2.6 * added scrollbars to dates and todo * all day detection * some smaller bugfixes 0.2.5 * some other minor fixes regarding autoupdate * fixed segfault with todolist > 7 entries * fixed the "ugly grey border around buttons" issue * fixed the "empty calendar field" "bug" diff --git a/core/pim/today/opie-today.control b/core/pim/today/opie-today.control index 5ad8f01..f875624 100644 --- a/core/pim/today/opie-today.control +++ b/core/pim/today/opie-today.control @@ -1,10 +1,10 @@ Files: bin/today apps/Applications/today.desktop pics/today_icon.png pics/today/today_logo.png pics/today/config.png pics/today/mail.png Priority: optional Section: opie/applications Maintainer: Maximilian Reiß <max.reiss@gmx.de> Architecture: arm -Version: 0.2.8-$SUB_VERSION +Version: 0.2.9-$SUB_VERSION Depends: opie-base ($QPE_VERSION) License: GPL Description: today screen A short overview over current appointments and tasks. 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 @@ -19,71 +19,70 @@ #include "today.h" #include "minidom.h" #include "TodoItem.h" #include <qpe/datebookdb.h> #include <qpe/timestring.h> #include <qpe/config.h> #include <qpe/qcopenvelope_qws.h> #include <qpe/qprocess.h> #include <qpe/resource.h> #include <qdir.h> #include <qfile.h> #include <qdatetime.h> #include <qtextstream.h> #include <qcheckbox.h> #include <qspinbox.h> #include <qpushbutton.h> #include <qlabel.h> #include <qtimer.h> #include <qpixmap.h> #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; int MAX_LINES_MEET; int SHOW_LOCATION; int SHOW_NOTES; // show only later dates int ONLY_LATER; int AUTOSTART; int NEW_START=1; /* * Constructs a Example which is a child of 'parent', with the * name 'name' and widget flags set to 'f' */ 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() ) ); QObject::connect( (QObject*)DatesButton, SIGNAL( clicked() ), this, SLOT(startDatebook() ) ); QObject::connect( (QObject*)MailButton, SIGNAL( clicked() ), this, SLOT(startMail() ) ); draw(); autoStart(); } void Today::autoStart() { Config cfg("today"); cfg.setGroup("Autostart"); AUTOSTART = cfg.readNumEntry("autostart",1); if (AUTOSTART) { QCopEnvelope e("QPE/System", "autoStart(QString,QString)"); e << QString("add"); e << QString("today"); } else { QCopEnvelope e("QPE/System", "autoStart(QString,QString)"); e << QString("remove"); e << QString("today"); } } @@ -174,106 +173,116 @@ void Today::startConfig() { conf->CheckBox3->setChecked(ONLY_LATER); conf->CheckBoxAuto->setChecked(AUTOSTART); conf->exec(); int maxlinestask = conf->SpinBox2->value(); int maxmeet = conf->SpinBox1->value(); int location = conf->CheckBox1->isChecked(); int notes = conf->CheckBox2->isChecked(); int maxcharclip = conf->SpinBox7->value(); int onlylater = conf->CheckBox3->isChecked(); int autostart =conf->CheckBoxAuto->isChecked(); cfg.writeEntry("maxlinestask",maxlinestask); cfg.writeEntry("maxcharclip", maxcharclip); cfg.writeEntry("maxlinesmeet",maxmeet); cfg.writeEntry("showlocation",location); cfg.writeEntry("shownotes", notes); cfg.writeEntry("onlylater", onlylater); cfg.setGroup("Autostart"); cfg.writeEntry("autostart", autostart); // sync it to "disk" cfg.write(); + NEW_START=1; draw(); autoStart(); } /* * Get all events that are in the datebook xml file for today */ 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 //bool ampm = config.readBoolEntry( "AMPM", TRUE ); int count=0; if ( list.count() > 0 ) { for ( QValueList<EffectiveEvent>::ConstIterator it=list.begin(); it!=list.end(); ++it ) { - count++; if ( count <= MAX_LINES_MEET ) { QTime time = QTime::currentTime(); 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 { QLabel* noEvents = new QLabel(AllDateBookEvents); noEvents->setText("No appointments today"); layoutDates->addWidget(noEvents); } layoutDates->addItem(new QSpacerItem(1,1, QSizePolicy::Minimum, QSizePolicy::Expanding)); sv1->addChild(AllDateBookEvents); + AllDateBookEvents->show(); } /* * Parse in the todolist.xml */ QList<TodoItem> Today::loadTodo(const char *filename) { DOM *todo; ELE *tasks; ELE **tasklist; ATT **attlist; int i, j; char *description; int completed; int priority; TodoItem *tmp; QList<TodoItem> loadtodolist; todo = minidom_load(filename); tasks = todo->el; tasks = tasks->el[0]; /*!DOCTYPE-quickhack*/ if(tasks) { @@ -372,48 +381,58 @@ void Today::getTodo() { } } if (count > 0) { if( count == 1 ) { output = tr("There is <b> 1</b> active task: <br>" ); } else { output = tr("There are <b> %1</b> active tasks: <br>").arg(count); } output += tmpout; } else { output = tr("No active tasks"); } TodoField->setText(tr(output)); } /* * launches datebook */ void Today::startDatebook() { QCopEnvelope e("QPE/System", "execute(QString)"); 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(); + */ +} /* * launches todolist */ void Today::startTodo() { QCopEnvelope e("QPE/System", "execute(QString)"); e << QString("todolist"); } /* * launch opiemail */ void Today::startMail() { QCopEnvelope e("QPE/System", "execute(QString)"); e << QString("opiemail"); } /* * Destroys the object and frees any allocated resources */ Today::~Today() { // no need to delete child widgets, Qt does it all for us } diff --git a/core/pim/today/today.h b/core/pim/today/today.h index b3f0654..0b4356c 100644 --- a/core/pim/today/today.h +++ b/core/pim/today/today.h @@ -26,59 +26,61 @@ #include <qdatetime.h> #include <qlist.h> #include "TodoItem.h" #include "todayconfig.h" #include "todaybase.h" #include "clickablelabel.h" class QVBoxLayout; class Today : public TodayBase { Q_OBJECT public: Today( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); ~Today(); private slots: void startConfig(); void startTodo(); void startDatebook(); void startMail(); void draw(); + void editEvent(const Event &e); private: void init(); void getDates(); void getTodo(); void getMail(); void autoStart(); bool checkIfModified(); QList<TodoItem> loadTodo(const char *filename); private: DateBookDB *db; todayconfig *conf; + QWidget* AllDateBookEvents; //Config cfg; int MAX_LINES_TASK; int MAX_CHAR_CLIP; int MAX_LINES_MEET; int SHOW_LOCATION; int SHOW_NOTES; }; class DateBookEvent: public ClickableLabel { Q_OBJECT public: DateBookEvent(const EffectiveEvent &ev, QWidget* parent = 0, const char* name = 0, WFlags fl = 0); signals: void editEvent(const Event &e); private slots: void editMe(); private: const EffectiveEvent event; }; class DateBookEventLater: public ClickableLabel { Q_OBJECT |