summaryrefslogtreecommitdiff
authorharlekin <harlekin>2003-03-23 15:17:55 (UTC)
committer harlekin <harlekin>2003-03-23 15:17:55 (UTC)
commit34d831699c7a7be4bd81cd7d7336b66b53ef78d9 (patch) (side-by-side diff)
treeb38d3e4377bdc47e8a78c070af2ca2ac62e48d70
parentfd1b86e8590b34efb38b82953e5bf897a8de1cdf (diff)
downloadopie-34d831699c7a7be4bd81cd7d7336b66b53ef78d9.zip
opie-34d831699c7a7be4bd81cd7d7336b66b53ef78d9.tar.gz
opie-34d831699c7a7be4bd81cd7d7336b66b53ef78d9.tar.bz2
if multiple days are selected and only later is on still show all events on next days ,)
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/today/plugins/datebook/datebookpluginwidget.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/core/pim/today/plugins/datebook/datebookpluginwidget.cpp b/core/pim/today/plugins/datebook/datebookpluginwidget.cpp
index 896d41d..781e3a4 100644
--- a/core/pim/today/plugins/datebook/datebookpluginwidget.cpp
+++ b/core/pim/today/plugins/datebook/datebookpluginwidget.cpp
@@ -36,80 +36,90 @@ DatebookPluginWidget::DatebookPluginWidget( QWidget *parent, const char* name )
db = new DateBookDB;
if ( m_layoutDates ) {
delete m_layoutDates;
}
m_layoutDates = new QVBoxLayout( this );
m_layoutDates->setAutoAdd( true );
m_eventsList.setAutoDelete( true );
readConfig();
getDates();
+ m_layoutDates->addStretch(5);
}
DatebookPluginWidget::~DatebookPluginWidget() {
delete db;
delete m_layoutDates;
}
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 );
}
void DatebookPluginWidget::refresh() {
m_eventsList.clear();
+
+ if ( m_layoutDates ) {
+ delete m_layoutDates;
+ }
+ m_layoutDates = new QVBoxLayout( this );
+ m_layoutDates->setAutoAdd( true );
+
getDates();
+ m_layoutDates->addStretch(5);
}
/**
* Get all events that are in the datebook xml file for today
*/
void DatebookPluginWidget::getDates() {
QDate date = QDate::currentDate();
QValueList<EffectiveEvent> list = db->getEffectiveEvents( date, date.addDays( m_moreDays ) );
qBubbleSort( list );
int count = 0;
if ( list.count() > 0 ) {
for ( QValueList<EffectiveEvent>::ConstIterator it = list.begin(); it != list.end(); ++it ) {
if ( count <= m_max_lines_meet ) {
if ( !m_onlyLater ) {
count++;
DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes );
m_eventsList.append( l );
l->show();
QObject::connect ( l, SIGNAL( editEvent( const Event & ) ), l, SLOT( editEventSlot( const Event & ) ) );
- } else if ( QDateTime::currentDateTime() <= (*it).event().end() ) {
+ } else if ( QDateTime::currentDateTime() <= (*it).event().end() || (*it).event().start().date() != date ) {
count++;
// show only later appointments
DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes );
m_eventsList.append( l );
l->show();
QObject::connect ( l, SIGNAL( editEvent( const Event & ) ), l, SLOT( editEventSlot( const Event & ) ) );
}
}
}
if ( m_onlyLater && count == 0 ) {
QLabel* noMoreEvents = new QLabel( this );
m_eventsList.append( noMoreEvents );
noMoreEvents->show();
noMoreEvents->setText( QObject::tr( "No more appointments today" ) );
}
} else {
QLabel* noEvents = new QLabel( this );
m_eventsList.append( noEvents );
noEvents->show();
noEvents->setText( QObject::tr( "No appointments today" ) );
}
}
+