summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/pim/today/plugins/datebook/datebookplugin.cpp2
-rw-r--r--core/pim/today/plugins/datebook/datebookplugin.h4
-rw-r--r--core/pim/today/plugins/datebook/datebookpluginconfig.cpp16
-rw-r--r--core/pim/today/plugins/datebook/datebookpluginconfig.h15
-rw-r--r--core/pim/today/plugins/datebook/datebookpluginwidget.cpp5
-rw-r--r--core/pim/today/plugins/datebook/datebookpluginwidget.h4
6 files changed, 34 insertions, 12 deletions
diff --git a/core/pim/today/plugins/datebook/datebookplugin.cpp b/core/pim/today/plugins/datebook/datebookplugin.cpp
index f095478..4e75a13 100644
--- a/core/pim/today/plugins/datebook/datebookplugin.cpp
+++ b/core/pim/today/plugins/datebook/datebookplugin.cpp
@@ -1,71 +1,71 @@
/*
* datebookplugin.cpp
*
- * copyright : (c) 2002 by Maximilian Reiß
+ * 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";
}
QWidget* DatebookPlugin::widget( QWidget* wid ) {
if(!m_widget) {
m_widget = new DatebookPluginWidget( wid, "Datebook" );
}
return m_widget;
}
QString DatebookPlugin::pixmapNameConfig() const {
return "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();
}
}
diff --git a/core/pim/today/plugins/datebook/datebookplugin.h b/core/pim/today/plugins/datebook/datebookplugin.h
index eb7a401..db899e8 100644
--- a/core/pim/today/plugins/datebook/datebookplugin.h
+++ b/core/pim/today/plugins/datebook/datebookplugin.h
@@ -1,50 +1,48 @@
/*
* datebookplugin.h
*
- * copyright : (c) 2002 by Maximilian Reiß
+ * 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. *
* *
***************************************************************************/
#ifndef DATEBOOK_PLUGIN_H
#define DATEBOOK_PLUGIN_H
-#include <qstring.h>
#include <qguardedptr.h>
-#include <qwidget.h>
#include <opie/oclickablelabel.h>
#include <opie/todayplugininterface.h>
#include "datebookpluginwidget.h"
class DatebookPlugin : public TodayPluginObject {
public:
DatebookPlugin();
~DatebookPlugin();
QString pluginName() const;
double versionNumber() const;
QString pixmapNameWidget() const;
QWidget* widget( QWidget *);
QString pixmapNameConfig() const;
TodayConfigWidget* configWidget( QWidget *);
QString appName() const;
bool excludeFromRefresh() const;
void refresh();
private:
QGuardedPtr<DatebookPluginWidget> m_widget;
};
#endif
diff --git a/core/pim/today/plugins/datebook/datebookpluginconfig.cpp b/core/pim/today/plugins/datebook/datebookpluginconfig.cpp
index 0fc38de..dc6dee9 100644
--- a/core/pim/today/plugins/datebook/datebookpluginconfig.cpp
+++ b/core/pim/today/plugins/datebook/datebookpluginconfig.cpp
@@ -1,103 +1,117 @@
+/*
+ * 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 <qtoolbutton.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 );
layout->setMargin( 20 );
QHBox *box1 = new QHBox( this );
QLabel* TextLabel4 = new QLabel( box1, "TextLabel4" );
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();
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 6c32ae9..be00aad 100644
--- a/core/pim/today/plugins/datebook/datebookpluginconfig.h
+++ b/core/pim/today/plugins/datebook/datebookpluginconfig.h
@@ -1,47 +1,62 @@
+/*
+ * datebookpluginconfig.h
+ *
+ * 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. *
+ * *
+ ***************************************************************************/
#ifndef DATEBOOK_PLUGIN_CONFIG_H
#define DATEBOOK_PLUGIN_CONFIG_H
#include <qcheckbox.h>
#include <qspinbox.h>
#include <opie/todayconfigwidget.h>
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 97fb77e..896d41d 100644
--- a/core/pim/today/plugins/datebook/datebookpluginwidget.cpp
+++ b/core/pim/today/plugins/datebook/datebookpluginwidget.cpp
@@ -1,118 +1,115 @@
/*
* datebookpluginwidget.cpp
*
- * copyright : (c) 2002 by Maximilian Reiß
+ * 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 <qlayout.h>
#include <qtl.h>
-#include <qscrollview.h>
-#include <qtimer.h>
DatebookPluginWidget::DatebookPluginWidget( QWidget *parent, const char* name )
: QWidget(parent, name ) {
db = 0l;
m_layoutDates = 0l;
if ( db ) {
delete db;
}
db = new DateBookDB;
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 );
}
void DatebookPluginWidget::refresh() {
m_eventsList.clear();
getDates();
}
/**
* 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() ) {
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" ) );
}
}
diff --git a/core/pim/today/plugins/datebook/datebookpluginwidget.h b/core/pim/today/plugins/datebook/datebookpluginwidget.h
index e10f059..35d43cd 100644
--- a/core/pim/today/plugins/datebook/datebookpluginwidget.h
+++ b/core/pim/today/plugins/datebook/datebookpluginwidget.h
@@ -1,60 +1,58 @@
/*
* datebookpluginwidget.h
*
- * copyright : (c) 2002 by Maximilian Reiß
+ * 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. *
* *
***************************************************************************/
#ifndef DATEBOOK_PLUGIN_WIDGET_H
#define DATEBOOK_PLUGIN_WIDGET_H
-#include <qstring.h>
-#include <qwidget.h>
#include <qlayout.h>
#include <qguardedptr.h>
#include <qlist.h>
#include <qpe/datebookdb.h>
#include <opie/oclickablelabel.h>
#include "datebookevent.h"
class DatebookPluginWidget : public QWidget {
Q_OBJECT
public:
DatebookPluginWidget( QWidget *parent, const char *name );
~DatebookPluginWidget();
void refresh();
private:
DateBookDB* db;
QGuardedPtr<QVBoxLayout> m_layoutDates;
QList<QWidget> m_eventsList;
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