From 87cd421d72df1d7706925285a48c008007471310 Mon Sep 17 00:00:00 2001 From: harlekin Date: Sun, 15 Sep 2002 21:13:47 +0000 Subject: plugins for the new today --- (limited to 'core/pim/today/plugins') diff --git a/core/pim/today/plugins/datebook/datebook.pro b/core/pim/today/plugins/datebook/datebook.pro new file mode 100644 index 0000000..615059a --- a/dev/null +++ b/core/pim/today/plugins/datebook/datebook.pro @@ -0,0 +1,19 @@ +TEMPLATE = lib +CONFIG -= moc +CONFIG += qt debug + +# Input +HEADERS = datebookplugin.h datebookpluginimpl.h datebookpluginconfig.h \ + datebookevent.h datebookpluginwidget.h +SOURCES = datebookplugin.cpp datebookpluginimpl.cpp datebookpluginconfig.cpp \ + datebookevent.cpp datebookpluginwidget.cpp + +INCLUDEPATH += $(OPIEDIR)/include \ + ../ ../library +DEPENDPATH += $(OPIEDIR)/include \ + ../ ../library + +LIBS+= -lqpe -lopie + +DESTDIR = $(OPIEDIR)/plugins/today +TARGET = todaydatebookplugin \ No newline at end of file diff --git a/core/pim/today/plugins/datebook/datebookevent.cpp b/core/pim/today/plugins/datebook/datebookevent.cpp new file mode 100644 index 0000000..1caf061 --- a/dev/null +++ b/core/pim/today/plugins/datebook/datebookevent.cpp @@ -0,0 +1,118 @@ +/* + * datebookevent.cpp + * + * copyright : (c) 2002 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 +#include +#include +#include + +DateBookEvent::DateBookEvent(const EffectiveEvent &ev, + QWidget* parent, + int show_location, + int show_notes, + // int onlyLater, + int maxCharClip, + const char* name, + WFlags fl) : + OClickableLabel(parent,name,fl), event(ev) { + + QString msg; + + Config config( "qpe" ); + config.setGroup( "Time" ); + // if 24 h format + ampm = config.readBoolEntry( "AMPM", TRUE ); + + msg += "" + (ev).description() + ""; + if ( (ev).event().hasAlarm() ) { + msg += " [with alarm]"; + } + + // include location or not + if ( show_location == 1) { + msg += "
" + (ev).location() + ""; + } + + if ( ( TimeString::timeString( QTime( (ev).event().start().time() ) ) == "00:00" ) + && ( TimeString::timeString( QTime( (ev).event().end().time() ) ) == "23:59") ) { + msg += "
All day"; + } else { + // start time of event + msg += "
" + ampmTime(QTime( (ev).event().start().time() ) ) + // end time of event + + " - " + ampmTime(QTime( (ev).event().end().time() ) ); + } + + // include possible note or not + if ( show_notes == 1) { + msg += "
note:" +( (ev).notes() ).mid( 0, maxCharClip ); + } + + 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; + } + +} + + +//extern QPEApplication *todayApp; + +/* + * starts the edit dialog as known from datebook + */ +void DateBookEvent::editEventSlot( const Event &e ) { + startDatebook(); + + while( !QCopChannel::isRegistered( "QPE/Datebook" ) ) qApp->processEvents(); + QCopEnvelope env( "QPE/Datebook", "editEvent(int)" ); + env << e.uid(); +} + + +/** + * launches datebook + */ +void DateBookEvent::startDatebook() { + QCopEnvelope e("QPE/System", "execute(QString)"); + e << QString("datebook"); +} + +void DateBookEvent::editMe() { + emit editEvent(event.event()); +} + diff --git a/core/pim/today/plugins/datebook/datebookevent.h b/core/pim/today/plugins/datebook/datebookevent.h new file mode 100644 index 0000000..1168f7c --- a/dev/null +++ b/core/pim/today/plugins/datebook/datebookevent.h @@ -0,0 +1,50 @@ +/* + * datebookplugin.h + * + * copyright : (c) 2002 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 DATEBOOKEVENT_PLUGIN_H +#define DATEBOOKEVENT_PLUGIN_H + +#include +#include + + +class DateBookEvent: public OClickableLabel { + + Q_OBJECT + +public: + DateBookEvent(const EffectiveEvent &ev, + QWidget* parent = 0, + int show_location = 0, + int show_notes = 0, + // int onlyLater = 0, + int maxCharClip = 0, + const char* name = 0, + WFlags fl = 0); +signals: + void editEvent(const Event &e); +private slots: + void editEventSlot(const Event &e); + void editMe(); +private: + void startDatebook(); + DateBookDB *db; + QString ampmTime(QTime); + const EffectiveEvent event; + bool ampm; +}; + +#endif diff --git a/core/pim/today/plugins/datebook/datebookplugin.cpp b/core/pim/today/plugins/datebook/datebookplugin.cpp new file mode 100644 index 0000000..d2a73df --- a/dev/null +++ b/core/pim/today/plugins/datebook/datebookplugin.cpp @@ -0,0 +1,73 @@ +/* + * datebookplugin.cpp + * + * copyright : (c) 2002 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 "datebookpluginwidget.h" +#include "datebookpluginconfig.h" + +#include "../../configwidget.h" + +#include +#include + + +DatebookPlugin::DatebookPlugin() { +} + +DatebookPlugin::~DatebookPlugin() { +} + +QString DatebookPlugin::pluginName() const { + return "Datebook plugin"; +} + +double DatebookPlugin::versionNumber() const { + return 0.1; +} + +QString DatebookPlugin::pixmapNameWidget() const { + return "DateBook"; +} + +QWidget* DatebookPlugin::widget( QWidget* wid ) { + return new DatebookPluginWidget( wid, "Datebook" ); +} + +QString DatebookPlugin::pixmapNameConfig() const { + return "DateBook"; +} + +ConfigWidget* DatebookPlugin::configWidget( QWidget* wid ) { + return new DatebookPluginConfig( wid , "Datebook" ); +} + +QString DatebookPlugin::appName() const { + return "datebook"; +} + +int DatebookPlugin::minHeight() const { + return 10; +} + +int DatebookPlugin::maxHeight() const { + return 100; +} + + + diff --git a/core/pim/today/plugins/datebook/datebookplugin.h b/core/pim/today/plugins/datebook/datebookplugin.h new file mode 100644 index 0000000..f2c4446 --- a/dev/null +++ b/core/pim/today/plugins/datebook/datebookplugin.h @@ -0,0 +1,47 @@ +/* + * datebookplugin.h + * + * copyright : (c) 2002 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 +#include + +#include +#include + +#include "../../todayplugininterface.h" + +class DatebookPlugin : public TodayPluginObject { + +public: + DatebookPlugin(); + ~DatebookPlugin(); + + QString pluginName() const; + double versionNumber() const; + QString pixmapNameWidget() const; + QWidget* widget( QWidget *); + QString pixmapNameConfig() const; + ConfigWidget* configWidget( QWidget *); + QString appName() const; + virtual int minHeight() const; + virtual int maxHeight() const; + +}; + + +#endif diff --git a/core/pim/today/plugins/datebook/datebookpluginconfig.cpp b/core/pim/today/plugins/datebook/datebookpluginconfig.cpp new file mode 100644 index 0000000..7482f5e --- a/dev/null +++ b/core/pim/today/plugins/datebook/datebookpluginconfig.cpp @@ -0,0 +1,82 @@ + + +#include "datebookpluginconfig.h" + + +#include + +#include +#include +#include +#include +#include + +DatebookPluginConfig::DatebookPluginConfig( QWidget* parent, const char* name) + : ConfigWidget( parent, name ) { + + QVBoxLayout * layout = new QVBoxLayout( this ); + + QHBox *box1 = new QHBox( this ); + QLabel* TextLabel4 = new QLabel( box1, "TextLabel4" ); + TextLabel4->setText( tr( "Show location" ) ); + CheckBox1 = new QCheckBox( box1, "CheckBox1" ); + + QHBox *box2 = new QHBox( this ); + QLabel* TextLabel5 = new QLabel( box2 , "TextLabel5" ); + TextLabel5->setText( tr( "Show notes" ) ); + CheckBox2 = new QCheckBox( box2, "CheckBox2" ); + + 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" ); + + 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" ); + SpinBox1->setMaxValue( 10 ); + SpinBox1->setValue( 5 ); + + layout->addWidget( box1 ); + layout->addWidget( box2 ); + layout->addWidget( box3 ); + layout->addWidget( box4 ); + + 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 ); +} + + +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 ); + cfg.write(); +} + +DatebookPluginConfig::~DatebookPluginConfig() { +} diff --git a/core/pim/today/plugins/datebook/datebookpluginconfig.h b/core/pim/today/plugins/datebook/datebookpluginconfig.h new file mode 100644 index 0000000..33d3c4e --- a/dev/null +++ b/core/pim/today/plugins/datebook/datebookpluginconfig.h @@ -0,0 +1,48 @@ + +#ifndef DATEBOOK_PLUGIN_CONFIG_H +#define DATEBOOK_PLUGIN_CONFIG_H + +#include +#include +#include + +#include "../../configwidget.h" + +class DatebookPluginConfig : public ConfigWidget { + + Q_OBJECT + +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; + + // 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; + + +}; + + + + + +#endif diff --git a/core/pim/today/plugins/datebook/datebookpluginimpl.cpp b/core/pim/today/plugins/datebook/datebookpluginimpl.cpp new file mode 100644 index 0000000..4159b49 --- a/dev/null +++ b/core/pim/today/plugins/datebook/datebookpluginimpl.cpp @@ -0,0 +1,42 @@ +/* + * datebookpluginimpl.cpp + * + * copyright : (c) 2002 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 "datebookplugin.h" +#include "datebookpluginimpl.h" + +DatebookPluginImpl::DatebookPluginImpl() { + datebookPlugin = new DatebookPlugin(); +} + +DatebookPluginImpl::~DatebookPluginImpl() { +} + +TodayPluginObject* DatebookPluginImpl::guiPart() { + return datebookPlugin; +} + +QRESULT DatebookPluginImpl::queryInterface( const QUuid & uuid, QUnknownInterface **iface ) { + *iface = 0; + if ( ( uuid == IID_QUnknown ) || ( uuid == IID_TodayPluginInterface ) ) { + *iface = this, (*iface)->addRef(); + } + return QS_OK; + +} + +Q_EXPORT_INTERFACE() { + Q_CREATE_INSTANCE( DatebookPluginImpl ); +} diff --git a/core/pim/today/plugins/datebook/datebookpluginimpl.h b/core/pim/today/plugins/datebook/datebookpluginimpl.h new file mode 100644 index 0000000..037dff4 --- a/dev/null +++ b/core/pim/today/plugins/datebook/datebookpluginimpl.h @@ -0,0 +1,42 @@ +/* + * datebookpluginimpl.h + * + * copyright : (c) 2002 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_IMPL_H +#define DATEBOOK_PLUGIN_IMPL_H + +#include "../../todayplugininterface.h" + +class DatebookPlugin; + +class DatebookPluginImpl : public TodayPluginInterface{ + +public: + DatebookPluginImpl(); + virtual ~DatebookPluginImpl(); + + QRESULT queryInterface( const QUuid &, QUnknownInterface** ); + Q_REFCOUNT + + virtual TodayPluginObject *guiPart(); + +private: + DatebookPlugin *datebookPlugin; + ulong ref; + + +}; + +#endif diff --git a/core/pim/today/plugins/datebook/datebookpluginwidget.cpp b/core/pim/today/plugins/datebook/datebookpluginwidget.cpp new file mode 100644 index 0000000..e4667ae --- a/dev/null +++ b/core/pim/today/plugins/datebook/datebookpluginwidget.cpp @@ -0,0 +1,114 @@ +/* + * datebookpluginwidget.cpp + * + * copyright : (c) 2002 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 "datebookevent.h" + +#include +#include + +#include +#include +#include +#include +#include +#include + +DatebookPluginWidget::DatebookPluginWidget( QWidget *parent, const char* name) + : QWidget(parent, name ) { + db = 0l; + 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 ); +} + + +/** + * Get all events that are in the datebook xml file for today + */ +void DatebookPluginWidget::getDates() { + + + QDate date = QDate::currentDate(); + + QVBoxLayout* layoutDates = new QVBoxLayout( this ); + + if ( db ) { + delete db; + } + + db = new DateBookDB; + + QValueList list = db->getEffectiveEvents( date, date ); + + qBubbleSort( list ); + + Config config( "qpe" ); + + int count=0; + + if ( list.count() > 0 ) { + + for ( QValueList::ConstIterator it=list.begin(); it!=list.end(); ++it ) { + + if ( count <= m_max_lines_meet ) { + QTime time = QTime::currentTime(); + + if ( !m_onlyLater ) { + count++; + DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes ); + layoutDates->addWidget( l ); + QObject::connect ( l, SIGNAL( editEvent( const Event &) ), l, SLOT( editEventSlot( const Event &) ) ); + } else if ( ( time.toString() <= TimeString::dateString( (*it).event().end() ) ) ) { + count++; + // show only later appointments + DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes ); + layoutDates->addWidget( l ); + QObject::connect ( l, SIGNAL( editEvent( const Event &) ), l, SLOT( editEventSlot( const Event &) ) ); + } + } + } + if ( m_onlyLater && count == 0 ) { + QLabel* noMoreEvents = new QLabel( this ); + noMoreEvents->setText( QObject::tr( "No more appointments today" ) ); + layoutDates->addWidget( noMoreEvents ); + } + } else { + QLabel* noEvents = new QLabel( this ); + noEvents->setText( QObject::tr( "No appointments today" ) ); + layoutDates->addWidget( noEvents ); + } + + layoutDates->addItem( new QSpacerItem( 1,1, QSizePolicy::Minimum, QSizePolicy::Expanding ) ); + + // how often refresh - later have qcop update calls in *db + //QTimer::singleShot( 20*1000, this , SLOT( getDates() ) ); +} + diff --git a/core/pim/today/plugins/datebook/datebookpluginwidget.h b/core/pim/today/plugins/datebook/datebookpluginwidget.h new file mode 100644 index 0000000..e0213ec --- a/dev/null +++ b/core/pim/today/plugins/datebook/datebookpluginwidget.h @@ -0,0 +1,52 @@ +/* + * datebookpluginwidget.h + * + * copyright : (c) 2002 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 +#include + +#include +#include + + +class DatebookPluginWidget : public QWidget { + + Q_OBJECT + +public: + DatebookPluginWidget( QWidget *parent, const char *name ); + ~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. + 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_onlyLater; + +}; + +#endif diff --git a/core/pim/today/plugins/datebook/opie-today-datebookplugin.control b/core/pim/today/plugins/datebook/opie-today-datebookplugin.control new file mode 100644 index 0000000..3ee523b --- a/dev/null +++ b/core/pim/today/plugins/datebook/opie-today-datebookplugin.control @@ -0,0 +1,8 @@ +Files: $OPIEDIR/lib/today/libtodaydatebookplugin.so* +Priority: optional +Section: opie/applications +Maintainer: Maximilian Reiss +Architecture: arm +Version: $QPE_VERSION-$SUB_VERSION +Depends: qt-embedded (>=$QTE_VERSION) +Description: Datebook plugin for today diff --git a/core/pim/today/plugins/mail/mail.pro b/core/pim/today/plugins/mail/mail.pro new file mode 100644 index 0000000..58bda54 --- a/dev/null +++ b/core/pim/today/plugins/mail/mail.pro @@ -0,0 +1,17 @@ +TEMPLATE = lib +CONFIG -= moc +CONFIG += qt debug + +# Input +HEADERS = mailplugin.h mailpluginimpl.h mailpluginwidget.h +SOURCES = mailplugin.cpp mailpluginimpl.cpp mailpluginwidget.cpp + +INCLUDEPATH += $(OPIEDIR)/include \ + ../ ../library +DEPENDPATH += $(OPIEDIR)/include \ + ../ ../library + +LIBS+= -lqpe -lopie + +DESTDIR = $(OPIEDIR)/plugins/today +TARGET = todaymailplugin \ No newline at end of file diff --git a/core/pim/today/plugins/mail/mailplugin.cpp b/core/pim/today/plugins/mail/mailplugin.cpp new file mode 100644 index 0000000..a594361 --- a/dev/null +++ b/core/pim/today/plugins/mail/mailplugin.cpp @@ -0,0 +1,63 @@ +/* + * mailplugin.cpp + * + * copyright : (c) 2002 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 "mailplugin.h" +#include "mailpluginwidget.h" + + +MailPlugin::MailPlugin() { +} + +MailPlugin::~MailPlugin() { +} + +QString MailPlugin::pluginName() const { + return "Mail plugin"; +} + +double MailPlugin::versionNumber() const { + return 0.1; +} + +QString MailPlugin::pixmapNameWidget() const { + return "mail/desktopicon"; +} + +QWidget* MailPlugin::widget( QWidget * wid ) { + return new MailPluginWidget( wid, "Mail" ); +} + +QString MailPlugin::pixmapNameConfig() const { + return 0l; +} + +QWidget* MailPlugin::configWidget( QWidget* wid ) { + return 0l; +} + +QString MailPlugin::appName() const { + return "Mail"; +} + +int MailPlugin::minHeight() const { + return 10; +} + +int MailPlugin::maxHeight() const { + return 10; +} + diff --git a/core/pim/today/plugins/mail/mailplugin.h b/core/pim/today/plugins/mail/mailplugin.h new file mode 100644 index 0000000..113102e --- a/dev/null +++ b/core/pim/today/plugins/mail/mailplugin.h @@ -0,0 +1,47 @@ +/* + * mailplugin.h + * + * copyright : (c) 2002 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 MAIL_PLUGIN_H +#define MAIL_PLUGIN_H + +#include +#include + +#include +#include + +#include "../../todayplugininterface.h" + +class MailPlugin : public TodayPluginObject { + +public: + MailPlugin(); + ~MailPlugin(); + + QString pluginName() const; + double versionNumber() const; + QString pixmapNameWidget() const; + QWidget* widget(QWidget *); + QString pixmapNameConfig() const; + QWidget* configWidget(QWidget *); + QString appName() const; + virtual int minHeight() const; + virtual int maxHeight() const; + +}; + +#endif diff --git a/core/pim/today/plugins/mail/mailpluginimpl.cpp b/core/pim/today/plugins/mail/mailpluginimpl.cpp new file mode 100644 index 0000000..e5a1e05 --- a/dev/null +++ b/core/pim/today/plugins/mail/mailpluginimpl.cpp @@ -0,0 +1,45 @@ +/* + * mailpluginimpl.cpp + * + * copyright : (c) 2002 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 "mailplugin.h" +#include "mailpluginimpl.h" + +MailPluginImpl::MailPluginImpl() { + mailPlugin = new MailPlugin(); +} + +MailPluginImpl::~MailPluginImpl() { +} + + +TodayPluginObject* MailPluginImpl::guiPart() { + return mailPlugin; +} + +QRESULT MailPluginImpl::queryInterface( const QUuid & uuid, QUnknownInterface **iface ) { + *iface = 0; + if ( ( uuid == IID_QUnknown ) || ( uuid == IID_TodayPluginInterface ) ) { + *iface = this, (*iface)->addRef(); + } + return QS_OK; + +} + +Q_EXPORT_INTERFACE() { + Q_CREATE_INSTANCE( MailPluginImpl ); +} diff --git a/core/pim/today/plugins/mail/mailpluginimpl.h b/core/pim/today/plugins/mail/mailpluginimpl.h new file mode 100644 index 0000000..9930e6e --- a/dev/null +++ b/core/pim/today/plugins/mail/mailpluginimpl.h @@ -0,0 +1,40 @@ +/* + * mailpluginimpl.h + * + * copyright : (c) 2002 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 MAIL_PLUGIN_IMPL_H +#define MAIL_PLUGIN_IMPL_H + +#include "../../todayplugininterface.h" + +class MailPlugin; + +class MailPluginImpl : public TodayPluginInterface{ + +public: + MailPluginImpl(); + virtual ~MailPluginImpl(); + + QRESULT queryInterface( const QUuid &, QUnknownInterface** ); + Q_REFCOUNT + + virtual TodayPluginObject *guiPart(); + +private: + MailPlugin *mailPlugin; + ulong ref; +}; + +#endif diff --git a/core/pim/today/plugins/mail/mailpluginwidget.cpp b/core/pim/today/plugins/mail/mailpluginwidget.cpp new file mode 100644 index 0000000..a6f3562 --- a/dev/null +++ b/core/pim/today/plugins/mail/mailpluginwidget.cpp @@ -0,0 +1,73 @@ +/* + * mailpluginwidget.cpp + * + * copyright : (c) 2002 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 +#include +#include +#include +#include + +#include +#include +#include + +#include "mailpluginwidget.h" + +MailPluginWidget::MailPluginWidget( QWidget *parent, const char* name) + : QWidget(parent, name ) { + + readConfig(); + getInfo(); +} + +MailPluginWidget::~MailPluginWidget() { +} + + +void MailPluginWidget::readConfig() { + Config cfg( "todaymailplugin" ); + cfg.setGroup( "config" ); +} + + +void MailPluginWidget::getInfo() { + + QHBoxLayout* layout = new QHBoxLayout( this ); + + mailLabel = new OClickableLabel( this ); + mailLabel->setMaximumHeight( 15 ); + connect( mailLabel, SIGNAL( clicked() ), this, SLOT( startMail() ) ); + + Config cfg( "opiemail" ); + cfg.setGroup( "today" ); + + int NEW_MAILS = cfg.readNumEntry( "newmails", 0 ); + int OUTGOING = cfg.readNumEntry( "outgoing", 0 ); + + QString output = QObject::tr( "%1 new mail(s), %2 outgoing" ).arg( NEW_MAILS ).arg( OUTGOING ); + + mailLabel->setText( output ); + layout->addWidget( mailLabel ); +} + +/** + * launches datebook + */ +void MailPluginWidget::startMail() { + QCopEnvelope e("QPE/System", "execute(QString)"); + e << QString( "mail" ); +} diff --git a/core/pim/today/plugins/mail/mailpluginwidget.h b/core/pim/today/plugins/mail/mailpluginwidget.h new file mode 100644 index 0000000..2feef80 --- a/dev/null +++ b/core/pim/today/plugins/mail/mailpluginwidget.h @@ -0,0 +1,45 @@ +/* + * mailpluginwidget.h + * + * copyright : (c) 2002 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 MAIL_PLUGIN_WIDGET_H +#define MAIL_PLUGIN_WIDGET_H + +#include +#include + +#include +#include + +class MailPluginWidget : public QWidget { + + Q_OBJECT + + +public: + MailPluginWidget( QWidget *parent, const char *name ); + ~MailPluginWidget(); + +protected slots: + void startMail(); + +private: + OClickableLabel *mailLabel; + void readConfig(); + void getInfo(); +}; + +#endif diff --git a/core/pim/today/plugins/mail/opie-today-todolistplugin.control b/core/pim/today/plugins/mail/opie-today-todolistplugin.control new file mode 100644 index 0000000..7fb8cbf --- a/dev/null +++ b/core/pim/today/plugins/mail/opie-today-todolistplugin.control @@ -0,0 +1,8 @@ +Files: $OPIEDIR/lib/today/libtodaymailplugin.so* +Priority: optional +Section: opie/applications +Maintainer: Maximilian Reiss +Architecture: arm +Version: $QPE_VERSION-$SUB_VERSION +Depends: qt-embedded (>=$QTE_VERSION) +Description: Mail plugin for today diff --git a/core/pim/today/plugins/todolist/moc_todoplugin.cpp b/core/pim/today/plugins/todolist/moc_todoplugin.cpp new file mode 100644 index 0000000..e69de29 --- a/dev/null +++ b/core/pim/today/plugins/todolist/moc_todoplugin.cpp diff --git a/core/pim/today/plugins/todolist/moc_todoplugin.o b/core/pim/today/plugins/todolist/moc_todoplugin.o new file mode 100644 index 0000000..1e6a22f --- a/dev/null +++ b/core/pim/today/plugins/todolist/moc_todoplugin.o Binary files differ diff --git a/core/pim/today/plugins/todolist/opie-today-todolistplugin.control b/core/pim/today/plugins/todolist/opie-today-todolistplugin.control new file mode 100644 index 0000000..91a7202 --- a/dev/null +++ b/core/pim/today/plugins/todolist/opie-today-todolistplugin.control @@ -0,0 +1,8 @@ +Files: $OPIEDIR/lib/today/libtodaytodolistplugin.so* +Priority: optional +Section: opie/applications +Maintainer: Maximilian Reiss +Architecture: arm +Version: $QPE_VERSION-$SUB_VERSION +Depends: qt-embedded (>=$QTE_VERSION) +Description: Todolist plugin for today diff --git a/core/pim/today/plugins/todolist/todolist.pro b/core/pim/today/plugins/todolist/todolist.pro new file mode 100644 index 0000000..1f9c61c --- a/dev/null +++ b/core/pim/today/plugins/todolist/todolist.pro @@ -0,0 +1,20 @@ +TEMPLATE = lib +#TEMPLATE = app +CONFIG -= moc +CONFIG += qt debug + +# Input +HEADERS = todoplugin.h todopluginimpl.h todopluginconfig.h \ + todopluginwidget.h +SOURCES = todoplugin.cpp todopluginimpl.cpp todopluginconfig.cpp \ + todopluginwidget.cpp + +INCLUDEPATH += $(OPIEDIR)/include \ + ../ ../library +DEPENDPATH += $(OPIEDIR)/include \ + ../ ../library + +LIBS+= -lqpe -lopie + +DESTDIR = $(OPIEDIR)/plugins/today +TARGET = todaytodolistplugin \ No newline at end of file diff --git a/core/pim/today/plugins/todolist/todoplugin.cpp b/core/pim/today/plugins/todolist/todoplugin.cpp new file mode 100644 index 0000000..f5f6ed6 --- a/dev/null +++ b/core/pim/today/plugins/todolist/todoplugin.cpp @@ -0,0 +1,71 @@ +/* + * todoplugin.cpp + * + * copyright : (c) 2002 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 "todoplugin.h" +#include "todopluginconfig.h" +#include "todopluginwidget.h" + + +TodolistPlugin::TodolistPlugin() { +} + +TodolistPlugin::~TodolistPlugin() { +} + +QString TodolistPlugin::pluginName() const { + return "Todolist plugin"; +} + +double TodolistPlugin::versionNumber() const { + return 0.1; +} + +QString TodolistPlugin::pixmapNameWidget() const { + return "TodoList"; +} + +QWidget* TodolistPlugin::widget( QWidget *wid ) { + return new TodolistPluginWidget( wid, "Todolist" ); +} + +QString TodolistPlugin::pixmapNameConfig() const { + return "TodoList"; +} + +ConfigWidget* TodolistPlugin::configWidget( QWidget* wid ) { + return new TodolistPluginConfig( wid , "Todolist" ); +} + +QString TodolistPlugin::appName() const { + return "Todolist"; +} + +int TodolistPlugin::minHeight() const { + return 10; +} + +int TodolistPlugin::maxHeight() const { + return 100; +} + + + + + int main() { +} + diff --git a/core/pim/today/plugins/todolist/todoplugin.h b/core/pim/today/plugins/todolist/todoplugin.h new file mode 100644 index 0000000..77889d6 --- a/dev/null +++ b/core/pim/today/plugins/todolist/todoplugin.h @@ -0,0 +1,47 @@ +/* + * todoplugin.h + * + * copyright : (c) 2002 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 TODOLIST_PLUGIN_H +#define TODOLIST_PLUGIN_H + +#include +#include + +#include +#include + +#include "../../todayplugininterface.h" +#include "../../configwidget.h" + +class TodolistPlugin : public TodayPluginObject { + + +public: + TodolistPlugin(); + ~TodolistPlugin(); + + QString pluginName() const; + double versionNumber() const; + QString pixmapNameWidget() const; + QWidget* widget(QWidget *); + QString pixmapNameConfig() const; + ConfigWidget* configWidget(QWidget *); + QString appName() const; + virtual int minHeight() const; + virtual int maxHeight() const; +}; + +#endif diff --git a/core/pim/today/plugins/todolist/todopluginconfig.cpp b/core/pim/today/plugins/todolist/todopluginconfig.cpp new file mode 100644 index 0000000..da81600 --- a/dev/null +++ b/core/pim/today/plugins/todolist/todopluginconfig.cpp @@ -0,0 +1,69 @@ +/* + * todopluginconfig.cpp + * + * copyright : (c) 2002 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 "todopluginconfig.h" + +#include + +#include +#include +#include + + +TodolistPluginConfig::TodolistPluginConfig( QWidget *parent, const char* name) + : ConfigWidget(parent, name ) { + + QVBoxLayout * layout = new QVBoxLayout( this ); + + QFrame* Frame9 = new QFrame( this, "Frame9" ); + Frame9->setGeometry( QRect( -5, 0, 230, 310 ) ); + Frame9->setFrameShape( QFrame::StyledPanel ); + Frame9->setFrameShadow( QFrame::Raised ); + + QLabel* TextLabel6 = new QLabel( Frame9, "TextLabel6" ); + TextLabel6->setGeometry( QRect( 20, 10, 100, 60 ) ); + TextLabel6->setText( tr( "How many\n" + "tasks should \n" + "be shown?" ) ); + + SpinBox2 = new QSpinBox( Frame9, "SpinBox2" ); + SpinBox2->setGeometry( QRect( 115, 20, 58, 25 ) ); + SpinBox2->setMaxValue( 20 ); + SpinBox2->setValue( 5 ); + + layout->addWidget( Frame9 ); + + readConfig(); +} + +void TodolistPluginConfig::readConfig() { + Config cfg( "todaydatebookplugin" ); + cfg.setGroup( "config" ); + m_max_lines_task = cfg.readNumEntry( "maxlinestask", 5 ); + SpinBox2->setValue( m_max_lines_task ); +} + + +void TodolistPluginConfig::writeConfig() { + Config cfg( "todaydatebookplugin" ); + cfg.setGroup( "config" ); + cfg.writeEntry( "maxlinestask", m_max_lines_task ); + cfg.write(); +} + + +TodolistPluginConfig::~TodolistPluginConfig() { +} diff --git a/core/pim/today/plugins/todolist/todopluginconfig.h b/core/pim/today/plugins/todolist/todopluginconfig.h new file mode 100644 index 0000000..a46cc7c --- a/dev/null +++ b/core/pim/today/plugins/todolist/todopluginconfig.h @@ -0,0 +1,55 @@ +/* + * todopluginconfig.h + * + * copyright : (c) 2002 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 TODOLIST_PLUGIN_CONFIG_H +#define TODOLIST_PLUGIN_CONFIG_H + +#include +#include + +#include "../../configwidget.h" + +class TodolistPluginConfig : public ConfigWidget { + + Q_OBJECT + +public: + + TodolistPluginConfig( QWidget *parent, const char *name ); + ~TodolistPluginConfig(); + +private: + /** + * if changed then save + */ + bool changed(); + void readConfig(); + void writeConfig(); + + QSpinBox* SpinBox2; + + // how many lines should be showed in the todolist section + int m_max_lines_task; + + + +}; + + + + + +#endif diff --git a/core/pim/today/plugins/todolist/todopluginimpl.cpp b/core/pim/today/plugins/todolist/todopluginimpl.cpp new file mode 100644 index 0000000..b1849ff --- a/dev/null +++ b/core/pim/today/plugins/todolist/todopluginimpl.cpp @@ -0,0 +1,43 @@ +/* + * todopluginimpl.cpp + * + * copyright : (c) 2002 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 "todoplugin.h" +#include "todopluginimpl.h" + +TodolistPluginImpl::TodolistPluginImpl() { + todolistPlugin = new TodolistPlugin(); +} + +TodolistPluginImpl::~TodolistPluginImpl() { +} + + +TodayPluginObject* TodolistPluginImpl::guiPart() { + return todolistPlugin; +} + +QRESULT TodolistPluginImpl::queryInterface( const QUuid & uuid, QUnknownInterface **iface ) { + *iface = 0; + if ( ( uuid == IID_QUnknown ) || ( uuid == IID_TodayPluginInterface ) ) { + *iface = this, (*iface)->addRef(); + } + return QS_OK; + +} + +Q_EXPORT_INTERFACE() { + Q_CREATE_INSTANCE( TodolistPluginImpl ); +} diff --git a/core/pim/today/plugins/todolist/todopluginimpl.h b/core/pim/today/plugins/todolist/todopluginimpl.h new file mode 100644 index 0000000..29e0294 --- a/dev/null +++ b/core/pim/today/plugins/todolist/todopluginimpl.h @@ -0,0 +1,40 @@ +/* + * todopluginimpl.h + * + * copyright : (c) 2002 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 TODOLIST_PLUGIN_IMPL_H +#define TODOLIST_PLUGIN_IMPL_H + +#include "../../todayplugininterface.h" + +class TodolistPlugin; + +class TodolistPluginImpl : public TodayPluginInterface{ + +public: + TodolistPluginImpl(); + virtual ~TodolistPluginImpl(); + + QRESULT queryInterface( const QUuid &, QUnknownInterface** ); + Q_REFCOUNT + + virtual TodayPluginObject *guiPart(); + +private: + TodolistPlugin *todolistPlugin; + ulong ref; +}; + +#endif diff --git a/core/pim/today/plugins/todolist/todopluginwidget.cpp b/core/pim/today/plugins/todolist/todopluginwidget.cpp new file mode 100644 index 0000000..2a0e5a3 --- a/dev/null +++ b/core/pim/today/plugins/todolist/todopluginwidget.cpp @@ -0,0 +1,132 @@ +/* + * todopluginwidget.cpp + * + * copyright : (c) 2002 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 "todopluginwidget.h" + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +TodolistPluginWidget::TodolistPluginWidget( QWidget *parent, const char* name) + : QWidget(parent, name ) { + + todoLabel= 0l; + + todo = 0l; + if ( todo ) { + delete todo; + } + todo = new ToDoDB(); + + readConfig(); + m_maxCharClip = 36; + getTodo(); +} + +TodolistPluginWidget::~TodolistPluginWidget() { + delete todo; +} + +void TodolistPluginWidget::readConfig() { + Config cfg( "todaytodolistplugin" ); + cfg.setGroup( "config" ); + m_maxLinesTask = cfg.readNumEntry( "maxlinestask", 5 ); +} + + +/** + * Get the todos + */ +void TodolistPluginWidget::getTodo() { + + QVBoxLayout* layoutTodo = new QVBoxLayout( this ); + + if ( todoLabel ) { + delete todoLabel; + } + + todoLabel = new OClickableLabel( this ); + todoLabel->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ) ); + connect( todoLabel, SIGNAL( clicked() ), this, SLOT( startTodolist() ) ); + QString output; + QString tmpout; + int count = 0; + int ammount = 0; + + // get overdue todos first + QValueList overDueList = todo->overDue(); + qBubbleSort(overDueList); + for ( QValueList::Iterator it = overDueList.begin(); + it!=overDueList.end(); ++it ) { + if (!(*it).isCompleted() && ( ammount < m_maxLinesTask ) ) { + QString desc = (*it).summary(); + if( desc.isEmpty() ) { + desc = (*it).description(); + } + tmpout += "-" + desc.mid(0, m_maxCharClip) + "
"; + ammount++; + } + } + + // get total number of still open todos + QValueList openTodo = todo->rawToDos(); + qBubbleSort( openTodo ); + for ( QValueList::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 < m_maxLinesTask ) ) { + QString desc = (*it).summary(); + if( desc.isEmpty() ) { + desc = (*it).description(); + } + tmpout += "-" + desc.mid(0, m_maxCharClip) + "
"; + ammount++; + } + } + } + + + if ( count > 0 ) { + if( count == 1 ) { + output += QObject::tr( "There is 1 active task:
" ); + } else { + output += QObject::tr( "There are %1 active tasks:
" ).arg(count); + } + output += tmpout; + } else { + output = QObject::tr( "No active tasks" ); + } + todoLabel->setText( output ); + layoutTodo->addWidget( todoLabel ); +} + +/** + * start the todolist + */ +void TodolistPluginWidget::startTodolist() { + QCopEnvelope e("QPE/System", "execute(QString)"); + e << QString("todolist"); +} diff --git a/core/pim/today/plugins/todolist/todopluginwidget.h b/core/pim/today/plugins/todolist/todopluginwidget.h new file mode 100644 index 0000000..ccc312a --- a/dev/null +++ b/core/pim/today/plugins/todolist/todopluginwidget.h @@ -0,0 +1,47 @@ +/* + * todopluginwidget.h + * + * copyright : (c) 2002 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 TODOLIST_PLUGIN_WIDGET_H +#define TODOLIST_PLUGIN_WIDGET_H + +#include +#include + +#include +#include + + +class TodolistPluginWidget : public QWidget { + + Q_OBJECT + +public: + TodolistPluginWidget( QWidget *parent, const char *name ); + ~TodolistPluginWidget(); + +protected slots: + void startTodolist(); + +private: + OClickableLabel *todoLabel; + ToDoDB *todo; + void readConfig(); + void getTodo(); + int m_maxLinesTask; + int m_maxCharClip; +}; + +#endif -- cgit v0.9.0.2