summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-11-27 14:19:09 (UTC)
committer harlekin <harlekin>2002-11-27 14:19:09 (UTC)
commit5f0c90d4b6972c1ad22ba20b45cd1d3f88298099 (patch) (side-by-side diff)
tree0cd24ab2ff259a76e06d7940b9de03a2b067d57a
parenta75b95fd9f89fc80e867c0efb5837178cab56cbb (diff)
downloadopie-5f0c90d4b6972c1ad22ba20b45cd1d3f88298099.zip
opie-5f0c90d4b6972c1ad22ba20b45cd1d3f88298099.tar.gz
opie-5f0c90d4b6972c1ad22ba20b45cd1d3f88298099.tar.bz2
ability to show next days too added
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/today/plugins/datebook/datebookevent.cpp24
-rw-r--r--core/pim/today/plugins/datebook/datebookevent.h21
-rw-r--r--core/pim/today/plugins/datebook/datebookpluginconfig.cpp19
-rw-r--r--core/pim/today/plugins/datebook/datebookpluginconfig.h7
-rw-r--r--core/pim/today/plugins/datebook/datebookpluginwidget.cpp3
-rw-r--r--core/pim/today/plugins/datebook/datebookpluginwidget.h1
6 files changed, 57 insertions, 18 deletions
diff --git a/core/pim/today/plugins/datebook/datebookevent.cpp b/core/pim/today/plugins/datebook/datebookevent.cpp
index 0a0d186..8277529 100644
--- a/core/pim/today/plugins/datebook/datebookevent.cpp
+++ b/core/pim/today/plugins/datebook/datebookevent.cpp
@@ -44,35 +44,38 @@ DateBookEvent::DateBookEvent(const EffectiveEvent &ev,
msg += "<B>" + (ev).description() + "</B>";
if ( (ev).event().hasAlarm() ) {
msg += " <b>[with alarm]</b>";
}
// include location or not
if ( show_location ) {
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() ) )
+ QDate tempDate = (ev).event().start().date();
+ msg += "<br>"
+ + ampmTime( QTime( (ev).event().start().time() ) )
// end time of event
- + "<b> - </b>" + ampmTime(QTime( (ev).event().end().time() ) );
+ + "<b> - </b>" + ampmTime( QTime( (ev).event().end().time() ) )
+ + differDate( tempDate );
}
// include possible note or not
if ( show_notes ) {
msg += "<br> <i>note</i>:" +( (ev).notes() ).mid( 0, maxCharClip );
}
setText( msg );
connect( this, SIGNAL( clicked() ), this, SLOT( editMe() ) );
}
/**
* AM/PM timestring conversion.
* @param tm the timestring
* @return formatted to am/pm is system is set to it
*/
@@ -82,32 +85,49 @@ QString DateBookEvent::ampmTime( QTime tm ) {
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;
}
}
+QString DateBookEvent::differDate( QDate date ) {
+ QDate currentDate = QDate::currentDate();
+ QString returnText = "<font color = #407DD9><b> ";
+ int differDate = currentDate.daysTo( date );
+ if ( currentDate.dayOfWeek() == date.dayOfWeek() ) {
+ returnText += "" ;
+ // not working right for recurring events
+ //} else if ( differDate == 1 ) {
+ //returnText += tr( "tomorrow" );
+ } else {
+ //returnText += tr( "in %1 days" ).arg( differDate );
+ returnText += " [ " + date.dayName( date.dayOfWeek() ) + " ] ";
+ }
+ returnText += "</b></font>";
+ return returnText;
+}
+
/**
* starts the edit dialog as known from datebook
*/
void DateBookEvent::editEventSlot( const Event &e ) {
if ( ODevice::inst()->system() == System_Zaurus ) {
QCopEnvelope env( "QPE/Application/datebook", "raise()" );
} else {
QCopEnvelope env( "QPE/Datebook", "editEvent(int)" );
env << e.uid();
}
}
void DateBookEvent::editMe() {
diff --git a/core/pim/today/plugins/datebook/datebookevent.h b/core/pim/today/plugins/datebook/datebookevent.h
index 7b0371a..f8a9c03 100644
--- a/core/pim/today/plugins/datebook/datebookevent.h
+++ b/core/pim/today/plugins/datebook/datebookevent.h
@@ -13,36 +13,37 @@
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef DATEBOOKEVENT_PLUGIN_H
#define DATEBOOKEVENT_PLUGIN_H
#include <opie/oclickablelabel.h>
#include <qpe/datebookdb.h>
class DateBookEvent: public OClickableLabel {
Q_OBJECT
public:
- DateBookEvent(const EffectiveEvent &ev,
- QWidget* parent = 0,
- bool show_location = 0,
- bool show_notes = 0,
- int maxCharClip = 0,
- const char* name = 0,
- WFlags fl = 0);
+ DateBookEvent( const EffectiveEvent &ev,
+ QWidget* parent = 0,
+ bool show_location = 0,
+ bool show_notes = 0,
+ int maxCharClip = 0,
+ const char* name = 0,
+ WFlags fl = 0 );
signals:
- void editEvent(const Event &e);
+ void editEvent( const Event &e );
private slots:
- void editEventSlot(const Event &e);
+ void editEventSlot( const Event &e );
void editMe();
private:
DateBookDB *db;
- QString ampmTime(QTime);
+ QString ampmTime( QTime );
+ QString differDate( QDate date );
const EffectiveEvent event;
bool ampm;
};
#endif
diff --git a/core/pim/today/plugins/datebook/datebookpluginconfig.cpp b/core/pim/today/plugins/datebook/datebookpluginconfig.cpp
index e93c82c..0fc38de 100644
--- a/core/pim/today/plugins/datebook/datebookpluginconfig.cpp
+++ b/core/pim/today/plugins/datebook/datebookpluginconfig.cpp
@@ -22,65 +22,82 @@ DatebookPluginConfig::DatebookPluginConfig( QWidget* parent, const char* name)
TextLabel4->setText( tr( "Show location" ) );
CheckBox1 = new QCheckBox( box1, "CheckBox1" );
QWhatsThis::add( CheckBox1 , tr( "Check this if the location of an appointment should be shown for each one" ) );
QHBox *box2 = new QHBox( this );
QLabel* TextLabel5 = new QLabel( box2 , "TextLabel5" );
TextLabel5->setText( tr( "Show notes" ) );
CheckBox2 = new QCheckBox( box2, "CheckBox2" );
QWhatsThis::add( CheckBox2 , tr( "Check this if the note attached to an appointment should be shown for each one" ) );
QHBox *box3 = new QHBox( this );
QLabel* TextLabel6 = new QLabel( box3, "All Day");
TextLabel6->setText( tr( "Show only later\n appointments") );
CheckBox3 = new QCheckBox ( box3, "CheckBox3" );
QWhatsThis::add( CheckBox3 , tr( "Check this if only appointments later then current time should be shown" ) );
+
+
QHBox *box4 = new QHBox( this );
QLabel *TextLabel3 = new QLabel( box4, "TextLabel3" );
TextLabel3->setText( tr( "How many \nappointment\n"
"should be \nshown?" ) );
SpinBox1 = new QSpinBox( box4, "SpinBox1" );
QWhatsThis::add( SpinBox1 , tr( "How many appointments should be shown maximal. In chronical order" ) );
SpinBox1->setMaxValue( 10 );
SpinBox1->setValue( 5 );
+
+ QHBox *box5 = new QHBox( this );
+ QLabel *TextLabelDays = new QLabel( box5 );
+ TextLabelDays->setText( tr( "How many more days" ) );
+ SpinBox2 = new QSpinBox( box5, "SpinBox2" );
+ QWhatsThis::add( SpinBox2 , tr( "How many more days should be in the range" ) );
+ SpinBox2->setMaxValue( 7 );
+ SpinBox2->setSuffix( tr( " day(s)" ) );
+ SpinBox2->setSpecialValueText ( tr("only today") );
+
layout->addWidget( box1 );
layout->addWidget( box2 );
layout->addWidget( box3 );
layout->addWidget( box4 );
+ layout->addWidget( box5 );
readConfig();
}
void DatebookPluginConfig::readConfig() {
Config cfg( "todaydatebookplugin" );
cfg.setGroup( "config" );
m_max_lines_meet = cfg.readNumEntry( "maxlinesmeet", 5 );
SpinBox1->setValue( m_max_lines_meet );
m_show_location = cfg.readNumEntry( "showlocation", 1 );
CheckBox1->setChecked( m_show_location );
m_show_notes = cfg.readNumEntry( "shownotes", 0 );
CheckBox2->setChecked( m_show_notes );
m_only_later = cfg.readNumEntry( "onlylater", 1 );
CheckBox3->setChecked( m_only_later );
+ m_more_days = cfg.readNumEntry( "moredays", 0 );
+ SpinBox2->setValue( m_more_days );
}
void DatebookPluginConfig::writeConfig() {
Config cfg( "todaydatebookplugin" );
cfg.setGroup( "config" );
m_max_lines_meet = SpinBox1->value();
cfg.writeEntry( "maxlinesmeet", m_max_lines_meet);
m_show_location = CheckBox1->isChecked();
cfg.writeEntry( "showlocation", m_show_location);
m_show_notes = CheckBox2->isChecked();
cfg.writeEntry( "shownotes", m_show_notes );
- m_only_later = CheckBox3->isChecked();
+ m_only_later = CheckBox3->isChecked();
cfg.writeEntry( "onlylater", m_only_later );
+ m_more_days = SpinBox2->value();
+ cfg.writeEntry( "moredays", m_more_days );
cfg.write();
}
DatebookPluginConfig::~DatebookPluginConfig() {
}
diff --git a/core/pim/today/plugins/datebook/datebookpluginconfig.h b/core/pim/today/plugins/datebook/datebookpluginconfig.h
index feba9ee..6c32ae9 100644
--- a/core/pim/today/plugins/datebook/datebookpluginconfig.h
+++ b/core/pim/today/plugins/datebook/datebookpluginconfig.h
@@ -15,34 +15,33 @@ class DatebookPluginConfig : public TodayConfigWidget {
public:
DatebookPluginConfig( QWidget *parent, const char *name );
~DatebookPluginConfig();
void writeConfig();
private:
/**
* if changed then save
*/
bool changed();
void readConfig();
QCheckBox* CheckBox2;
QCheckBox* CheckBox1;
QCheckBox* CheckBox3;
QSpinBox* SpinBox1;
+ QSpinBox* SpinBox2;
+
// how many lines should be showed in the datebook section
int m_max_lines_meet;
// If location is to be showed too, 1 to activate it.
int m_show_location;
// if notes should be shown
int m_show_notes;
// should only later appointments be shown or all for the current day.
int m_only_later;
-
+ int m_more_days;
};
-
-
-
#endif
diff --git a/core/pim/today/plugins/datebook/datebookpluginwidget.cpp b/core/pim/today/plugins/datebook/datebookpluginwidget.cpp
index a8ce059..c6aa2a6 100644
--- a/core/pim/today/plugins/datebook/datebookpluginwidget.cpp
+++ b/core/pim/today/plugins/datebook/datebookpluginwidget.cpp
@@ -34,54 +34,55 @@ DatebookPluginWidget::DatebookPluginWidget( QWidget *parent, const char* name)
readConfig();
getDates();
}
DatebookPluginWidget::~DatebookPluginWidget() {
delete db;
}
void DatebookPluginWidget::readConfig() {
Config cfg( "todaydatebookplugin" );
cfg.setGroup( "config" );
m_max_lines_meet = cfg.readNumEntry( "maxlinesmeet", 5 );
m_show_location = cfg.readNumEntry( "showlocation", 1 );
m_show_notes = cfg.readNumEntry( "shownotes", 0 );
m_onlyLater = cfg.readNumEntry( "onlylater", 1 );
+ m_moreDays = cfg.readNumEntry( "moredays", 0 );
}
/**
* Get all events that are in the datebook xml file for today
*/
void DatebookPluginWidget::getDates() {
QDate date = QDate::currentDate();
QVBoxLayout* layoutDates = new QVBoxLayout( this );
layoutDates->setSpacing( 1 );
layoutDates->setMargin( 1 );
if ( db ) {
delete db;
}
db = new DateBookDB;
- QValueList<EffectiveEvent> list = db->getEffectiveEvents( date, date );
+ QValueList<EffectiveEvent> list = db->getEffectiveEvents( date, date.addDays( m_moreDays ) );
qBubbleSort( list );
Config config( "qpe" );
int count=0;
if ( list.count() > 0 ) {
for ( QValueList<EffectiveEvent>::ConstIterator it=list.begin(); it!=list.end(); ++it ) {
if ( count <= m_max_lines_meet ) {
QTime time = QTime::currentTime();
if ( !m_onlyLater ) {
count++;
diff --git a/core/pim/today/plugins/datebook/datebookpluginwidget.h b/core/pim/today/plugins/datebook/datebookpluginwidget.h
index 1720bb2..3ebbc3d 100644
--- a/core/pim/today/plugins/datebook/datebookpluginwidget.h
+++ b/core/pim/today/plugins/datebook/datebookpluginwidget.h
@@ -33,20 +33,21 @@ public:
~DatebookPluginWidget();
private:
DateBookDB* db;
void readConfig();
void getDates();
// how many lines should be showed in the datebook section
int m_max_lines_meet;
// If location is to be showed too, 1 to activate it.
bool m_show_location;
// if notes should be shown
bool m_show_notes;
// should only later appointments be shown or all for the current day.
bool m_onlyLater;
+ int m_moreDays;
};
#endif