summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-05-13 21:56:32 (UTC)
committer harlekin <harlekin>2002-05-13 21:56:32 (UTC)
commit654f18b7201655379a515d12e30e06de4ae2e564 (patch) (side-by-side diff)
tree7faec6092629ab4a9387c7d9b9633ae6ea6e6115
parentaddcce2881f07c1f04113e4df2ec7e4186d4cee4 (diff)
downloadopie-654f18b7201655379a515d12e30e06de4ae2e564.zip
opie-654f18b7201655379a515d12e30e06de4ae2e564.tar.gz
opie-654f18b7201655379a515d12e30e06de4ae2e564.tar.bz2
serveral bugfixes regarding todo section
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/pim/today/changelog4
-rw-r--r--core/pim/today/opie-today.control2
-rw-r--r--core/pim/today/today.cpp12
3 files changed, 11 insertions, 7 deletions
diff --git a/core/pim/today/changelog b/core/pim/today/changelog
index c687cea..93bbcac 100644
--- a/core/pim/today/changelog
+++ b/core/pim/today/changelog
@@ -1,48 +1,52 @@
+0.3.4
+
+* Several bugfixes regarding todo section.
+
0.3.3
* Changed the logo so it better scales to bigger display and also
made the "Today" string translatable.
* some am/pm fixes
* clickable labels now in libopie
0.3.2
* Autostart is now more configurable. You can decide how long
the ipaq has to has been suspended, before autostart is triggered.(Opie
only)
* am/pm time optinal (autodetect)
0.3.1
* fixed the wrong color of the buttons
* better translation (thanks carsten and others)
* fixes memory leaks
* bugfixes in calendar part, now location and note are working again.
0.3.0
* today uses now tododb from libopie. So major changes in the todo part:
- overdue items on top
- then sorted by date, then by priority
* some cleanups
* speed optimisations
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
diff --git a/core/pim/today/opie-today.control b/core/pim/today/opie-today.control
index da9d9fa..46c0d71 100644
--- a/core/pim/today/opie-today.control
+++ b/core/pim/today/opie-today.control
@@ -1,16 +1,16 @@
Files: bin/today apps/Applications/today.desktop pics/today/*
Priority: optional
Section: opie/applications
Maintainer: Maximilian Reiß <max.reiss@gmx.de>
Architecture: arm
-Version: 0.3.3-$SUB_VERSION
+Version: 0.3.4-$SUB_VERSION
Depends: opie-base ($QPE_VERSION), libopie ($QPE_VERSION)
License: GPL
Description: today screen
This today screen app gives an overview of appointments
and todos.
It also shows incoming and outgoing mails from opiemail.
When using Opie (opie.handhelds.org) today can be autostarted
on resume.
It is highly configurable.
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp
index 0f4cbdb..4368201 100644
--- a/core/pim/today/today.cpp
+++ b/core/pim/today/today.cpp
@@ -37,169 +37,169 @@
#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 <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;
QString AUTOSTART_TIMER;
/*
* 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 ), 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() ) );
#if defined(Q_WS_QWS)
#if !defined(QT_NO_COP)
QCopChannel *todayChannel = new QCopChannel("QPE/Today" , this );
connect (todayChannel, SIGNAL( received(const QCString &, const QByteArray &)),
this, SLOT ( channelReceived(const QCString &, const QByteArray &)) );
#endif
#endif
db = NULL;
setOwnerField();
todo = new ToDoDB;
- getTodo();
draw();
+ getTodo();
autoStart();
}
/*
* Qcop receive method.
*/
void Today::channelReceived(const QCString &msg, const QByteArray & data) {
QDataStream stream(data, IO_ReadOnly );
if ( msg == "message(QString)" ) {
QString message;
stream >> message;
setOwnerField(message);
}
}
/*
* Initialises the owner field with the default value, the username
*/
void Today::setOwnerField() {
QString file = Global::applicationFileName("addressbook", "businesscard.vcf");
if (QFile::exists(file)) {
Contact cont = Contact::readVCard(file)[0];
QString returnString = cont.fullName();
OwnerField->setText( "<b>" +tr ("Owned by ") + returnString + "</b>");
} else {
OwnerField->setText( "<b>" + tr ("Please fill out the business card")+" </b>");
}
}
/*
* Set the owner field with a given QString, for example per qcop.
*/
void Today::setOwnerField(QString &message) {
if (!message.isEmpty()) {
OwnerField->setText("<b>" + message + "</b>");
}
}
/*
* Autostart, uses the new (opie only) autostart method in the launcher code.
* If registered against that today ist started on each resume.
*/
void Today::autoStart() {
Config cfg("today");
cfg.setGroup("Autostart");
int AUTOSTART = cfg.readNumEntry("autostart",1);
// qDebug(QString("%1").arg(AUTOSTART));
if (AUTOSTART) {
QCopEnvelope e("QPE/System", "autoStart(QString, QString, QString)");
e << QString("add");
e << QString("today");
e << AUTOSTART_TIMER;
} else {
qDebug("Nun in else bei autostart");
QCopEnvelope e("QPE/System", "autoStart(QString, QString)");
e << QString("remove");
e << QString("today");
}
}
/*
* Repaint method. Reread all fields.
*/
void Today::draw() {
init();
getDates();
getMail();
// if the todolist.xml file was not modified in between, do not parse it.
- if (checkIfModified()) {
+ if (checkIfModified() || NEW_START==1) {
if (todo) delete todo;
todo = new ToDoDB;
getTodo();
}
// how often refresh
QTimer::singleShot( 20*1000, this, SLOT(draw() ) );
}
/*
* Check if the todolist.xml was modified (if there are new entries.
* Returns true if it was modified.
*/
bool Today::checkIfModified() {
QDir dir;
QString homedir = dir.homeDirPath ();
QString time;
Config cfg("today");
cfg.setGroup("Files");
time = cfg.readEntry("todolisttimestamp", "");
QFileInfo file = (homedir +"/Applications/todolist/todolist.xml");
QDateTime fileTime = file.lastModified();
if (time.compare(fileTime.toString()) == 0) {
return false;
} else {
cfg.writeEntry("todolisttimestamp", fileTime.toString() );
cfg.write();
return true;
}
}
/*
* Init stuff needed for today. Reads the config file.
*/
void Today::init() {
QDate date = QDate::currentDate();
QString time = (tr( date.toString()) );
TextLabel1->setText(QString("<font color=#FFFFFF>" + time + "</font>"));
// read config
Config cfg("today");
cfg.setGroup("BaseConfig");
@@ -344,100 +344,100 @@ void Today::getDates() {
} else {
QLabel* noEvents = new QLabel(AllDateBookEvents);
noEvents->setText(tr("No appointments today"));
layoutDates->addWidget(noEvents);
}
layoutDates->addItem(new QSpacerItem(1,1, QSizePolicy::Minimum, QSizePolicy::Expanding));
sv1->addChild(AllDateBookEvents);
AllDateBookEvents->show();
}
void Today::getMail() {
Config cfg("opiemail");
cfg.setGroup("today");
// how many lines should be showed in the task section
int NEW_MAILS = cfg.readNumEntry("newmails",0);
int OUTGOING = cfg.readNumEntry("outgoing",0);
QString output = tr("<b>%1</b> new mail(s), <b>%2</b> outgoing").arg(NEW_MAILS).arg(OUTGOING);
MailField->setText(output);
}
/*
* Get the todos
*/
void Today::getTodo() {
QString output;
QString tmpout;
int count = 0;
int ammount = 0;
// get overdue todos first
QValueList<ToDoEvent> overDueList = todo->overDue();
qBubbleSort(overDueList);
for ( QValueList<ToDoEvent>::Iterator it=overDueList.begin();
it!=overDueList.end(); ++it ) {
if (!(*it).isCompleted() && ( ammount < MAX_LINES_TASK) ) {
tmpout += "<font color=#e00000><b>-" +((*it).description()).mid(0, MAX_CHAR_CLIP) + "</b></font><br>";
ammount++;
}
}
// get total number of still open todos
- QValueList<ToDoEvent> open = todo->rawToDos();
- qBubbleSort(open);
- for ( QValueList<ToDoEvent>::Iterator it=open.begin();
- it!=open.end(); ++it ) {
+ QValueList<ToDoEvent> openTodo = todo->rawToDos();
+ qBubbleSort(openTodo);
+ for ( QValueList<ToDoEvent>::Iterator it=openTodo.begin();
+ it!=openTodo.end(); ++it ) {
if (!(*it).isCompleted()){
count +=1;
// not the overdues, we allready got them, and not if we are
// over the maxlines
if (!(*it).isOverdue() && ( ammount < MAX_LINES_TASK) ) {
tmpout += "<b>-</b>" + ((*it).description()).mid(0, MAX_CHAR_CLIP) + "<br>";
ammount++;
}
}
}
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");
}
/*
* starts the edit dialog as known from datebook
*/
extern QPEApplication *todayApp;
void Today::editEvent(const Event &e) {
startDatebook();
while(!QCopChannel::isRegistered("QPE/Datebook")) todayApp->processEvents();
QCopEnvelope env("QPE/Datebook", "editEvent(int)");
env << e.uid();
}