Diffstat (limited to 'core/pim/today/plugins/datebook') (more/less context) (show whitespace changes)
4 files changed, 0 insertions, 10 deletions
diff --git a/core/pim/today/plugins/datebook/datebookevent.cpp b/core/pim/today/plugins/datebook/datebookevent.cpp index e595047..e19a690 100644 --- a/core/pim/today/plugins/datebook/datebookevent.cpp +++ b/core/pim/today/plugins/datebook/datebookevent.cpp @@ -1,117 +1,115 @@ /* * datebookevent.cpp * * copyright : (c) 2002, 2003 by Maximilian Reiß * email : harlekin@handhelds.org * */ /*************************************************************************** * * * 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 "datebookevent.h" #include <qpe/config.h> -#include <qpe/timestring.h> #include <qpe/qcopenvelope_qws.h> -#include <qpe/qpeapplication.h> #include <qpe/calendar.h> #include <opie/odevice.h> using namespace Opie; DateBookEvent::DateBookEvent(const EffectiveEvent &ev, QWidget* parent, bool show_location, bool show_notes, bool timeExtraLine, int maxCharClip, const char* name, WFlags fl) : OClickableLabel(parent,name,fl), event(ev) { // setAlignment( AlignTop ); QString msg; Config config( "qpe" ); config.setGroup( "Time" ); // if 24 h format ampm = config.readBoolEntry( "AMPM", TRUE ); msg += "<B>" + (ev).description() + "</B>"; if ( (ev).event().hasAlarm() ) { msg += " <b>" + tr("[with alarm]") +"</b>"; } // include location or not if ( show_location ) { msg += "<BR><i>" + (ev).location() + "</i>"; } QString timeSpacer = " "; if ( timeExtraLine ) { timeSpacer = "<br>"; } if ( ( TimeString::timeString( QTime( (ev).event().start().time() ) ) == "00:00" ) && ( TimeString::timeString( QTime( (ev).event().end().time() ) ) == "23:59" ) ) { msg += tr ( "All day" ); } else { // start time of event // QDate tempDate = (ev).event().start().date(); msg += timeSpacer; msg += ampmTime( QTime( (ev).event().start().time() ) ) // end time of event + "<b> - </b>" + ampmTime( QTime( (ev).event().end().time() ) ); } if ( (ev).date() != QDate::currentDate() ) { msg += differDate( (ev).date() /* tempDate*/ ); } // include possible note or not if ( show_notes ) { msg += "<br> <i>" + tr("note") + "</i>:" +( (ev).notes() ).mid( 0, maxCharClip ); } setText( msg ); connect( this, SIGNAL( clicked() ), this, SLOT( editMe() ) ); } DateBookEvent::~DateBookEvent() { } /** * AM/PM timestring conversion. * @param tm the timestring * @return formatted to am/pm is system is set to it */ 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; } } 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() ) { diff --git a/core/pim/today/plugins/datebook/datebookplugin.cpp b/core/pim/today/plugins/datebook/datebookplugin.cpp index f77e440..8dfa52f 100644 --- a/core/pim/today/plugins/datebook/datebookplugin.cpp +++ b/core/pim/today/plugins/datebook/datebookplugin.cpp @@ -1,78 +1,77 @@ /* * datebookplugin.cpp * * copyright : (c) 2002,2003 by Maximilian Reiß * email : harlekin@handhelds.org * */ /*************************************************************************** * * * 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 "datebookevent.h" #include "datebookplugin.h" #include "datebookpluginconfig.h" DatebookPlugin::DatebookPlugin() { } DatebookPlugin::~DatebookPlugin() { delete (DatebookPluginWidget*)m_widget; } QString DatebookPlugin::pluginName() const { return QObject::tr( "Datebook plugin"); } double DatebookPlugin::versionNumber() const { return 1.0; } QString DatebookPlugin::pixmapNameWidget() const { return "datebook/DateBook"; } QWidget* DatebookPlugin::widget( QWidget* wid ) { if(!m_widget) { m_widget = new DatebookPluginWidget( wid, "Datebook" ); } return m_widget; } QString DatebookPlugin::pixmapNameConfig() const { return "datebook/DateBook"; } TodayConfigWidget* DatebookPlugin::configWidget( QWidget* wid ) { return new DatebookPluginConfig( wid , "Datebook" ); } QString DatebookPlugin::appName() const { return "datebook"; } bool DatebookPlugin::excludeFromRefresh() const { return false; } void DatebookPlugin::refresh() { if ( m_widget ) { m_widget->refresh(); } } void DatebookPlugin::reinitialize() { if ( m_widget ) { m_widget->reinitialize(); } } diff --git a/core/pim/today/plugins/datebook/datebookpluginconfig.cpp b/core/pim/today/plugins/datebook/datebookpluginconfig.cpp index 54f820b..8ead40d 100644 --- a/core/pim/today/plugins/datebook/datebookpluginconfig.cpp +++ b/core/pim/today/plugins/datebook/datebookpluginconfig.cpp @@ -1,77 +1,73 @@ /* * datebookpluginconfig.cpp * * copyright : (c) 2002,2003 by Maximilian Reiß * email : harlekin@handhelds.org * */ /*************************************************************************** * * * 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 "datebookpluginconfig.h" #include <qpe/config.h> #include <qlayout.h> -#include <qlabel.h> -#include <qhbox.h> -#include <qwhatsthis.h> -#include <qvbox.h> DatebookPluginConfig::DatebookPluginConfig( QWidget* parent, const char* name) : TodayConfigWidget( parent, name ) { QVBoxLayout *layout = new QVBoxLayout( this ); m_gui = new DatebookPluginConfigBase( this ); layout->addWidget( m_gui ); readConfig(); } void DatebookPluginConfig::readConfig() { Config cfg( "todaydatebookplugin" ); cfg.setGroup( "config" ); m_max_lines_meet = cfg.readNumEntry( "maxlinesmeet", 5 ); m_gui->SpinBox1->setValue( m_max_lines_meet ); m_show_location = cfg.readNumEntry( "showlocation", 1 ); m_gui->CheckBox1->setChecked( m_show_location ); m_show_notes = cfg.readNumEntry( "shownotes", 0 ); m_gui->CheckBox2->setChecked( m_show_notes ); m_only_later = cfg.readNumEntry( "onlylater", 1 ); m_gui->CheckBox4->setChecked( cfg.readNumEntry( "timeextraline", 1 ) ); m_gui->CheckBox3->setChecked( m_only_later ); m_more_days = cfg.readNumEntry( "moredays", 0 ); m_gui->SpinBox2->setValue( m_more_days ); } void DatebookPluginConfig::writeConfig() { Config cfg( "todaydatebookplugin" ); cfg.setGroup( "config" ); m_max_lines_meet = m_gui->SpinBox1->value(); cfg.writeEntry( "maxlinesmeet", m_max_lines_meet); m_show_location = m_gui->CheckBox1->isChecked(); cfg.writeEntry( "showlocation", m_show_location); m_show_notes = m_gui->CheckBox2->isChecked(); cfg.writeEntry( "shownotes", m_show_notes ); m_only_later = m_gui->CheckBox3->isChecked(); cfg.writeEntry( "timeextraline", m_gui->CheckBox4->isChecked() ); cfg.writeEntry( "onlylater", m_only_later ); m_more_days = m_gui->SpinBox2->value(); cfg.writeEntry( "moredays", m_more_days ); cfg.write(); } DatebookPluginConfig::~DatebookPluginConfig() { } diff --git a/core/pim/today/plugins/datebook/datebookpluginwidget.cpp b/core/pim/today/plugins/datebook/datebookpluginwidget.cpp index 9e95bcd..1b11d1b 100644 --- a/core/pim/today/plugins/datebook/datebookpluginwidget.cpp +++ b/core/pim/today/plugins/datebook/datebookpluginwidget.cpp @@ -1,120 +1,117 @@ /* * datebookpluginwidget.cpp * * copyright : (c) 2002,2003 by Maximilian Reiß * email : harlekin@handhelds.org * */ /*************************************************************************** * * * 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 "datebookpluginwidget.h" -#include <qpe/timestring.h> #include <qpe/config.h> -#include <qdatetime.h> -#include <qlabel.h> #include <qtl.h> DatebookPluginWidget::DatebookPluginWidget( QWidget *parent, const char* name ) : QWidget(parent, name ) { db = 0l; m_layoutDates = 0l; if ( m_layoutDates ) { delete m_layoutDates; } m_layoutDates = new QVBoxLayout( this ); m_layoutDates->setAutoAdd( true ); m_eventsList.setAutoDelete( true ); readConfig(); getDates(); } 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 ); m_timeExtraLine = cfg.readNumEntry( "timeextraline", 1 ); } void DatebookPluginWidget::reinitialize() { readConfig(); refresh(); } void DatebookPluginWidget::refresh() { m_eventsList.clear(); if ( m_layoutDates ) { delete m_layoutDates; } m_layoutDates = new QVBoxLayout( this ); m_layoutDates->setAutoAdd( true ); getDates(); } /** * Get all events that are in the datebook xml file for today */ void DatebookPluginWidget::getDates() { if ( db ) { delete db; } db = new DateBookDB; 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_timeExtraLine ); 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() ) // Show events which span over many days and are not elapsed. || ( ( (*it).event().start().date() != date ) && ( QDateTime::currentDateTime() <= (*it).event().end() ) ) // Show repeated event for today that is not elapsed. || ( ( (*it).event().repeatType() != Event::NoRepeat ) && ( ( date.dayOfWeek() == (*it).date().dayOfWeek() ) && ( QTime::currentTime() < (*it).event().start().time() ) ) ) // Show repeated event for next days. || ( ( (*it).event().repeatType() != Event::NoRepeat ) && ( date.dayOfWeek() != (*it).date().dayOfWeek() ) ) ) { count++; // show only later appointments |