summaryrefslogtreecommitdiff
path: root/core
authorharlekin <harlekin>2002-06-11 23:33:52 (UTC)
committer harlekin <harlekin>2002-06-11 23:33:52 (UTC)
commitd7c563f849316c7a742769e88136058afb69a2d9 (patch) (side-by-side diff)
treeac82e68921345a336fba28b9f62050b0a3d6d11c /core
parent37ab41238538d7c89090c083953b794cfdc29c6a (diff)
downloadopie-d7c563f849316c7a742769e88136058afb69a2d9.zip
opie-d7c563f849316c7a742769e88136058afb69a2d9.tar.gz
opie-d7c563f849316c7a742769e88136058afb69a2d9.tar.bz2
click on vcard label launches not the input
Diffstat (limited to 'core') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/today/today.cpp18
-rw-r--r--core/pim/today/today.h1
2 files changed, 12 insertions, 7 deletions
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp
index 9e9d31f..ad1ec90 100644
--- a/core/pim/today/today.cpp
+++ b/core/pim/today/today.cpp
@@ -328,218 +328,222 @@ void Today::getDates() {
connect (l, 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, SHOW_LOCATION, SHOW_NOTES);
layoutDates->addWidget(l);
connect (l, SIGNAL(editEvent(const Event &)),
this, SLOT(editEvent(const Event &)));
}
}
}
if (ONLY_LATER && count==0) {
QLabel* noMoreEvents = new QLabel(AllDateBookEvents);
noMoreEvents->setText(tr("No more appointments today"));
layoutDates->addWidget(noMoreEvents);
}
} 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> 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));
}
+
+void Today::startAddressbook() {
+ QCopEnvelope e("QPE/System", "execute(QString)");
+ e << QString("addressbook");
+}
+
+extern QPEApplication *todayApp;
+
/*
* launch addressbook (personal card)
*/
void Today::editCard() {
- QCopEnvelope w("QPE/System", "execute(QString)");
- w << QString("addressbook");
- // while( !QCopChannel::isRegistered("QPE/Addressbook"))
+ startAddressbook();
+
+ while( !QCopChannel::isRegistered("QPE/Addressbook")) todayApp->processEvents();
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" );
config.setGroup( "Time" );
// if 24 h format
ampm = config.readBoolEntry( "AMPM", TRUE );
if (!ONLY_LATER) {
msg += "<B>" + (ev).description() + "</B>";
if ( (ev).event().hasAlarm() ) {
msg += " <b>[with alarm]</b>";
}
// include location or not
if (SHOW_LOCATION == 1) {
msg += "<BR><i>" + (ev).location() + "</i>";
}
if ( (TimeString::timeString(QTime((ev).event().start().time()) ) == "00:00") && (TimeString::timeString(QTime((ev).event().end().time()) ) == "23:59") ) {
msg += "<br>All day";
} else {
// start time of event
msg += "<br>" + ampmTime(QTime((ev).event().start().time()) )
// end time of event
+ "<b> - </b>" + ampmTime(QTime((ev).event().end().time()) );
}
// include possible note or not
if (SHOW_NOTES == 1) {
msg += "<br> <i>note</i>:" +((ev).notes()).mid(0, MAX_CHAR_CLIP);
}
}
setText(msg);
connect(this, SIGNAL(clicked()), this, SLOT(editMe()));
setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) );
}
QString DateBookEvent::ampmTime(QTime tm) {
QString s;
if( ampm ) {
int hour = tm.hour();
if (hour == 0)
hour = 12;
if (hour > 12)
hour -= 12;
s.sprintf( "%2d:%02d %s", hour, tm.minute(),
(tm.hour() >= 12) ? "PM" : "AM" );
return s;
} else {
s.sprintf( "%2d:%02d", tm.hour(), tm.minute() );
return s;
diff --git a/core/pim/today/today.h b/core/pim/today/today.h
index 54f31cc..f28c029 100644
--- a/core/pim/today/today.h
+++ b/core/pim/today/today.h
@@ -1,117 +1,118 @@
/*
* today.h
*
* ---------------------
*
* begin : Sun 10 17:20:00 CEST 2002
* copyright : (c) 2002 by Maximilian Reiß
* email : max.reiss@gmx.de
*
*/
/***************************************************************************
* *
* 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. *
* *
***************************************************************************/
#ifndef TODAY_H
#define TODAY_H
#include <qpe/datebookdb.h>
#include <qpe/event.h>
#include <opie/tododb.h>
#include <opie/oclickablelabel.h>
#include <qdatetime.h>
#include <qlist.h>
#include "todayconfig.h"
#include "todaybase.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 startAddressbook();
void startMail();
void editCard();
void draw();
void editEvent(const Event &e);
private:
void init();
void getDates();
void getTodo();
void getMail();
void autoStart();
bool checkIfModified();
void setOwnerField();
void setOwnerField(QString &string);
private slots:
void channelReceived(const QCString &msg, const QByteArray & data);
private:
DateBookDB *db;
ToDoDB *todo;
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 OClickableLabel {
Q_OBJECT
public:
DateBookEvent(const EffectiveEvent &ev,
QWidget* parent = 0,
int SHOW_LOCATION = 0,
int SHOW_NOTES = 0,
const char* name = 0,
WFlags fl = 0);
signals:
void editEvent(const Event &e);
private slots:
void editMe();
private:
QString ampmTime(QTime);
const EffectiveEvent event;
bool ampm;
};
class DateBookEventLater: public OClickableLabel {
Q_OBJECT
public:
DateBookEventLater(const EffectiveEvent &ev,
QWidget* parent = 0,
int SHOW_LOCATION = 0,
int SHOW_NOTES = 0,
const char* name = 0,
WFlags fl = 0);
signals:
void editEvent(const Event &e);
private slots:
void editMe();
private:
QString ampmTime(QTime);
const EffectiveEvent event;
bool ampm;
};
#endif // TODAY_H