summaryrefslogtreecommitdiff
path: root/core
authorharlekin <harlekin>2002-06-11 17:05:46 (UTC)
committer harlekin <harlekin>2002-06-11 17:05:46 (UTC)
commit53cbd5404cea16ec1ddbd2e264fcc42acfb453c8 (patch) (side-by-side diff)
tree2daf9f13660755c1dca9594375d19184888c6338 /core
parent5cff977f8b96077e7d6664d965be75d437a07e42 (diff)
downloadopie-53cbd5404cea16ec1ddbd2e264fcc42acfb453c8.zip
opie-53cbd5404cea16ec1ddbd2e264fcc42acfb453c8.tar.gz
opie-53cbd5404cea16ec1ddbd2e264fcc42acfb453c8.tar.bz2
update
Diffstat (limited to 'core') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/today/today.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp
index 69a0f75..06cfa01 100644
--- a/core/pim/today/today.cpp
+++ b/core/pim/today/today.cpp
@@ -12,99 +12,100 @@
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "today.h"
#include <qpe/timestring.h>
#include <qpe/config.h>
#include <qpe/qcopenvelope_qws.h>
//#include <qpe/qprocess.h>
#include <qpe/resource.h>
#include <qpe/contact.h>
#include <qpe/global.h>
#include <qpe/qpeapplication.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 <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;
+int NEXTDAYS=1;
-/*
- * Constructs a Example which is a child of 'parent', with the
+
+/* 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() ) );
QObject::connect( (QObject*)OwnerField, SIGNAL( clicked() ), this, SLOT(editCard() ) );
#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;
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];
@@ -377,115 +378,118 @@ void Today::getTodo() {
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> 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));
}
/*
- * launch addressbook
+ * launch addressbook (personal card)
*/
void Today::editCard() {
- QCopEnvelope e("QPE/System", "execute(QString)");
- e << QString("addressbook");
+ QCopEnvelope w("QPE/System", "execute(QString)");
+ w << QString("addressbook");
+
+ QCopEnvelope v("QPE/Addressbook", "editPersonalAndClose()");
}
/*
* 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();
}
/*
* 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");
//Right now start both, maybe decide which to rum via config file ..
QCopEnvelope f("QPE/System", "execute(QString)");
f << QString("qtmail");
}
Today::~Today() {
}
/*
* Gets the events for the current day, if it should get all dates
*/
DateBookEvent::DateBookEvent(const EffectiveEvent &ev,
QWidget* parent,
int SHOW_LOCATION,
int SHOW_NOTES,
const char* name,
WFlags fl) :
OClickableLabel(parent,name,fl), event(ev) {
QString msg;
//QTime time = QTime::currentTime();
Config config( "qpe" );