30 files changed, 214 insertions, 174 deletions
diff --git a/core/pim/today/.cvsignore b/core/pim/today/.cvsignore index 1ee9a27..11e7045 100644 --- a/core/pim/today/.cvsignore +++ b/core/pim/today/.cvsignore @@ -1,3 +1,5 @@ *.moc Makefile* moc_* +todayconfigmiscbase.cpp +todayconfigmiscbase.h diff --git a/core/pim/today/changelog b/core/pim/today/changelog index a77e581..b492435 100644 --- a/core/pim/today/changelog +++ b/core/pim/today/changelog @@ -1,8 +1,14 @@ +0.7 + +* now all plugins in a big scrollview +* config dialogs guis are ui files now +* plugin interface has one new virtual method - reinitialize ( used when coming back from config dialog ) + 0.6.2 * header can now be made smaller * changed header to different layout mode to play nicer with life rotation 0.6.1 * datebook plugin now can now also show following days diff --git a/core/pim/today/main.cpp b/core/pim/today/main.cpp index 72c0a2e..156cd0f 100644 --- a/core/pim/today/main.cpp +++ b/core/pim/today/main.cpp @@ -14,23 +14,11 @@ * 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 "today.h" #include <qpe/qpeapplication.h> +#include <opie/oapplicationfactory.h> -QPEApplication *todayApp; - -int main( int argc, char ** argv ) -{ - QPEApplication a(argc, argv); - todayApp=&a; - - Today t; - - t.setCaption( Today::tr("Today") ); - a.showMainWidget(&t); - - return a.exec(); -} +OPIE_EXPORT_APP( OApplicationFactory<Today> ) diff --git a/core/pim/today/plugin.cpp b/core/pim/today/plugin.cpp deleted file mode 100644 index 349413b..0000000 --- a/core/pim/today/plugin.cpp +++ b/dev/null @@ -1,17 +0,0 @@ -#include "today.h" -#include <qwidget.h> -#include <qcombobox.h> -#include <oappplugin.h> - -#define Q_BASEINSTANCE( i ) \ - QUnknownInterface* iface = 0; \ - i->queryInterface( IID_QUnknown, &iface ); \ - return iface - -Q_EXPORT_INTERFACE() -{ - Today *t = new Today; - t->setCaption( Today::tr("Today") ); - OAppPlugin *comp = new OAppPlugin(t); - Q_BASEINSTANCE( comp ); -} diff --git a/core/pim/today/plugins/datebook/.cvsignore b/core/pim/today/plugins/datebook/.cvsignore index 2888d4a..10cf625 100644 --- a/core/pim/today/plugins/datebook/.cvsignore +++ b/core/pim/today/plugins/datebook/.cvsignore @@ -1,2 +1,3 @@ Makefile* +datebookpluginconfigbase* moc* diff --git a/core/pim/today/plugins/datebook/config.in b/core/pim/today/plugins/datebook/config.in index 621510f..7a14438 100644 --- a/core/pim/today/plugins/datebook/config.in +++ b/core/pim/today/plugins/datebook/config.in @@ -1,4 +1,4 @@ config TODAY_DATEBOOK - boolean "opie-today-datebookplugin (datebook plugin)" + boolean "datebook" default "y" depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE diff --git a/core/pim/today/plugins/datebook/datebook.pro b/core/pim/today/plugins/datebook/datebook.pro index bd45f71..1f75964 100644 --- a/core/pim/today/plugins/datebook/datebook.pro +++ b/core/pim/today/plugins/datebook/datebook.pro @@ -13,9 +13,28 @@ INCLUDEPATH += $(OPIEDIR)/include \ DEPENDPATH += $(OPIEDIR)/include \ ../ ../library LIBS+= -lqpe -lopie DESTDIR = $(OPIEDIR)/plugins/today TARGET = todaydatebookplugin +TRANSLATIONS = ../../../../../i18n/de/libtodaydatebookplugin.ts \ + ../../../../../i18n/nl/libtodaydatebookplugin.ts \ + ../../../../../i18n/xx/libtodaydatebookplugin.ts \ + ../../../../../i18n/en/libtodaydatebookplugin.ts \ + ../../../../../i18n/es/libtodaydatebookplugin.ts \ + ../../../../../i18n/fr/libtodaydatebookplugin.ts \ + ../../../../../i18n/hu/libtodaydatebookplugin.ts \ + ../../../../../i18n/ja/libtodaydatebookplugin.ts \ + ../../../../../i18n/ko/libtodaydatebookplugin.ts \ + ../../../../../i18n/no/libtodaydatebookplugin.ts \ + ../../../../../i18n/pl/libtodaydatebookplugin.ts \ + ../../../../../i18n/pt/libtodaydatebookplugin.ts \ + ../../../../../i18n/pt_BR/libtodaydatebookplugin.ts \ + ../../../../../i18n/sl/libtodaydatebookplugin.ts \ + ../../../../../i18n/zh_CN/libtodaydatebookplugin.ts \ + ../../../../../i18n/zh_TW/libtodaydatebookplugin.ts \ + ../../../../../i18n/it/libtodaydatebookplugin.ts \ + ../../../../../i18n/da/libtodaydatebookplugin.ts + include ( $(OPIEDIR)/include.pro ) diff --git a/core/pim/today/plugins/datebook/datebookevent.cpp b/core/pim/today/plugins/datebook/datebookevent.cpp index 3c1e97a..e595047 100644 --- a/core/pim/today/plugins/datebook/datebookevent.cpp +++ b/core/pim/today/plugins/datebook/datebookevent.cpp @@ -1,12 +1,12 @@ /* * datebookevent.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 * @@ -14,25 +14,27 @@ * * ***************************************************************************/ #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; @@ -47,27 +49,35 @@ DateBookEvent::DateBookEvent(const EffectiveEvent &ev, 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 += "<br>All day"; + msg += tr ( "All day" ); } else { // start time of event - QDate tempDate = (ev).event().start().date(); - msg += "<br>" - + ampmTime( QTime( (ev).event().start().time() ) ) +// 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() ) ) - + differDate( tempDate ); + + "<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() ) ); @@ -96,42 +106,42 @@ QString DateBookEvent::ampmTime( QTime tm ) { return s; } else { s.sprintf( "%2d:%02d", tm.hour(), tm.minute() ); return s; } } QString DateBookEvent::differDate( QDate date ) { - QDate currentDate = QDate::currentDate(); +// 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() ) + " ] "; - } +// 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 += " [ " + Calendar::nameOfDay( date.dayOfWeek() ) + " ] "; +// } + returnText += " [ " + Calendar::nameOfDay( 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)" ); + QCopEnvelope env( "QPE/Application/datebook", "editEvent(int)" ); env << e.uid(); } } 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 index 8027809..1a090e3 100644 --- a/core/pim/today/plugins/datebook/datebookevent.h +++ b/core/pim/today/plugins/datebook/datebookevent.h @@ -1,12 +1,12 @@ /* * 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 * @@ -25,26 +25,29 @@ class DateBookEvent: public OClickableLabel { Q_OBJECT public: DateBookEvent( const EffectiveEvent &ev, QWidget* parent = 0, bool show_location = 0, bool show_notes = 0, + bool timeExtraLine = 0, int maxCharClip = 0, const char* name = 0, WFlags fl = 0 ); ~DateBookEvent(); + signals: void editEvent( const Event &e ); private slots: void editEventSlot( const Event &e ); void editMe(); + private: QString ampmTime( QTime ); QString differDate( QDate date ); const EffectiveEvent event; bool ampm; }; diff --git a/core/pim/today/plugins/datebook/datebookplugin.cpp b/core/pim/today/plugins/datebook/datebookplugin.cpp index 4e650ee..f77e440 100644 --- a/core/pim/today/plugins/datebook/datebookplugin.cpp +++ b/core/pim/today/plugins/datebook/datebookplugin.cpp @@ -64,8 +64,15 @@ 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/datebookplugin.h b/core/pim/today/plugins/datebook/datebookplugin.h index db899e8..890c59b 100644 --- a/core/pim/today/plugins/datebook/datebookplugin.h +++ b/core/pim/today/plugins/datebook/datebookplugin.h @@ -34,15 +34,16 @@ public: double versionNumber() const; QString pixmapNameWidget() const; QWidget* widget( QWidget *); QString pixmapNameConfig() const; TodayConfigWidget* configWidget( QWidget *); QString appName() const; bool excludeFromRefresh() const; void refresh(); + void reinitialize(); private: QGuardedPtr<DatebookPluginWidget> m_widget; }; #endif diff --git a/core/pim/today/plugins/datebook/datebookpluginwidget.cpp b/core/pim/today/plugins/datebook/datebookpluginwidget.cpp index 1970654..9e95bcd 100644 --- a/core/pim/today/plugins/datebook/datebookpluginwidget.cpp +++ b/core/pim/today/plugins/datebook/datebookpluginwidget.cpp @@ -25,92 +25,110 @@ #include <qtl.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(); - 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 ); + 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(); - m_layoutDates->addStretch(5); } /** * 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_eventsList.append( l ); - l->show(); - QObject::connect ( l, SIGNAL( editEvent( const Event & ) ), l, SLOT( editEventSlot( const Event & ) ) ); - } 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 ); + 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 + 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 & ) ) ); + } + } } } if ( m_onlyLater && count == 0 ) { QLabel* noMoreEvents = new QLabel( this ); m_eventsList.append( noMoreEvents ); noMoreEvents->show(); noMoreEvents->setText( QObject::tr( "No more appointments today" ) ); } diff --git a/core/pim/today/plugins/datebook/datebookpluginwidget.h b/core/pim/today/plugins/datebook/datebookpluginwidget.h index 35d43cd..8988073 100644 --- a/core/pim/today/plugins/datebook/datebookpluginwidget.h +++ b/core/pim/today/plugins/datebook/datebookpluginwidget.h @@ -29,16 +29,17 @@ class DatebookPluginWidget : public QWidget { Q_OBJECT public: DatebookPluginWidget( QWidget *parent, const char *name ); ~DatebookPluginWidget(); void refresh(); + void reinitialize(); private: DateBookDB* db; QGuardedPtr<QVBoxLayout> m_layoutDates; QList<QWidget> m_eventsList; void readConfig(); void getDates(); @@ -47,12 +48,13 @@ private: 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; - + // true if time of an appointment should be an extra line + bool m_timeExtraLine; }; #endif diff --git a/core/pim/today/plugins/mail/config.in b/core/pim/today/plugins/mail/config.in index 6f3e06d..6f4450f 100644 --- a/core/pim/today/plugins/mail/config.in +++ b/core/pim/today/plugins/mail/config.in @@ -1,4 +1,4 @@ config TODAY_MAIL - boolean "opie-today-mailplugin (mail plugin)" + boolean "mail" default "y" depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE diff --git a/core/pim/today/plugins/mail/mail.pro b/core/pim/today/plugins/mail/mail.pro index 60ed87d..70c484d 100644 --- a/core/pim/today/plugins/mail/mail.pro +++ b/core/pim/today/plugins/mail/mail.pro @@ -1,19 +1,37 @@ TEMPLATE = lib CONFIG -= moc -CONFIG += qt plugin release +CONFIG += qt release # 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 +TRANSLATIONS = ../../../../../i18n/de/libtodaymailplugin.ts \ + ../../../../../i18n/nl/libtodaymailplugin.ts \ + ../../../../../i18n/xx/libtodaymailplugin.ts \ + ../../../../../i18n/en/libtodaymailplugin.ts \ + ../../../../../i18n/es/libtodaymailplugin.ts \ + ../../../../../i18n/fr/libtodaymailplugin.ts \ + ../../../../../i18n/hu/libtodaymailplugin.ts \ + ../../../../../i18n/ja/libtodaymailplugin.ts \ + ../../../../../i18n/ko/libtodaymailplugin.ts \ + ../../../../../i18n/no/libtodaymailplugin.ts \ + ../../../../../i18n/pl/libtodaymailplugin.ts \ + ../../../../../i18n/pt/libtodaymailplugin.ts \ + ../../../../../i18n/pt_BR/libtodaymailplugin.ts \ + ../../../../../i18n/sl/libtodaymailplugin.ts \ + ../../../../../i18n/zh_CN/libtodaymailplugin.ts \ + ../../../../../i18n/zh_TW/libtodaymailplugin.ts \ + ../../../../../i18n/it/libtodaymailplugin.ts \ + ../../../../../i18n/da/libtodaymailplugin.ts include ( $(OPIEDIR)/include.pro ) diff --git a/core/pim/today/plugins/mail/mailplugin.cpp b/core/pim/today/plugins/mail/mailplugin.cpp index 9430c30..bf30538 100644 --- a/core/pim/today/plugins/mail/mailplugin.cpp +++ b/core/pim/today/plugins/mail/mailplugin.cpp @@ -62,8 +62,11 @@ bool MailPlugin::excludeFromRefresh() const { return false; } void MailPlugin::refresh() { if ( m_widget ) { m_widget->refresh(); } } + +void MailPlugin::reinitialize() { +} diff --git a/core/pim/today/plugins/mail/mailplugin.h b/core/pim/today/plugins/mail/mailplugin.h index 295a88c..5b93314 100644 --- a/core/pim/today/plugins/mail/mailplugin.h +++ b/core/pim/today/plugins/mail/mailplugin.h @@ -36,14 +36,15 @@ public: double versionNumber() const; QString pixmapNameWidget() const; QWidget* widget(QWidget *); QString pixmapNameConfig() const; TodayConfigWidget* configWidget(QWidget *); QString appName() const; bool excludeFromRefresh() const; void refresh(); + void reinitialize(); private: QGuardedPtr<MailPluginWidget> m_widget; }; #endif diff --git a/core/pim/today/plugins/mail/mailpluginwidget.cpp b/core/pim/today/plugins/mail/mailpluginwidget.cpp index 3c1d908..646996a 100644 --- a/core/pim/today/plugins/mail/mailpluginwidget.cpp +++ b/core/pim/today/plugins/mail/mailpluginwidget.cpp @@ -24,17 +24,17 @@ MailPluginWidget::MailPluginWidget( QWidget *parent, const char* name) m_mailLabel = 0l; m_layout = 0l; if ( m_mailLabel ) { delete m_mailLabel; } m_mailLabel = new OClickableLabel( this ); - m_mailLabel->setMaximumHeight( 15 ); + //m_mailLabel->setMaximumHeight( 15 ); connect( m_mailLabel, SIGNAL( clicked() ), this, SLOT( startMail() ) ); if ( m_layout ) { delete m_layout; } m_layout = new QHBoxLayout( this ); m_layout->setAutoAdd( true ); diff --git a/core/pim/today/plugins/mail/opie-today-mailplugin.control b/core/pim/today/plugins/mail/opie-today-mailplugin.control index 1419557..e69de29 100644 --- a/core/pim/today/plugins/mail/opie-today-mailplugin.control +++ b/core/pim/today/plugins/mail/opie-today-mailplugin.control @@ -1,9 +0,0 @@ -Package: opie-today-mailplugin -Files: plugins/today/libtodaymailplugin.so* -Priority: optional -Section: opie/applications -Maintainer: Maximilian Reiss <harlekin@handhelds.org> -Architecture: arm -Version: $QPE_VERSION-$SUB_VERSION -Depends: libqte2, opie-today -Description: Mail plugin for today diff --git a/core/pim/today/plugins/todolist/.cvsignore b/core/pim/today/plugins/todolist/.cvsignore index 2888d4a..b9284b8 100644 --- a/core/pim/today/plugins/todolist/.cvsignore +++ b/core/pim/today/plugins/todolist/.cvsignore @@ -1,2 +1,3 @@ Makefile* +todopluginconfigbase* moc* diff --git a/core/pim/today/plugins/todolist/config.in b/core/pim/today/plugins/todolist/config.in index c862f37..48ba226 100644 --- a/core/pim/today/plugins/todolist/config.in +++ b/core/pim/today/plugins/todolist/config.in @@ -1,4 +1,4 @@ config TODAY_TODOLIST - boolean "opie-today-todolistplugin (shows the next todo entries)" + boolean "todolist" default "y" depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE diff --git a/core/pim/today/plugins/todolist/todolist.pro b/core/pim/today/plugins/todolist/todolist.pro index 0343223..6a63f4e 100644 --- a/core/pim/today/plugins/todolist/todolist.pro +++ b/core/pim/today/plugins/todolist/todolist.pro @@ -14,9 +14,28 @@ INCLUDEPATH += $(OPIEDIR)/include \ DEPENDPATH += $(OPIEDIR)/include \ ../ ../library LIBS+= -lqpe -lopie DESTDIR = $(OPIEDIR)/plugins/today TARGET = todaytodolistplugin +TRANSLATIONS = ../../../../../i18n/de/libtodaytodolistplugin.ts \ + ../../../../../i18n/nl/libtodaytodolistplugin.ts \ + ../../../../../i18n/xx/libtodaytodolistplugin.ts \ + ../../../../../i18n/en/libtodaytodolistplugin.ts \ + ../../../../../i18n/es/libtodaytodolistplugin.ts \ + ../../../../../i18n/fr/libtodaytodolistplugin.ts \ + ../../../../../i18n/hu/libtodaytodolistplugin.ts \ + ../../../../../i18n/ja/libtodaytodolistplugin.ts \ + ../../../../../i18n/ko/libtodaytodolistplugin.ts \ + ../../../../../i18n/no/libtodaytodolistplugin.ts \ + ../../../../../i18n/pl/libtodaytodolistplugin.ts \ + ../../../../../i18n/pt/libtodaytodolistplugin.ts \ + ../../../../../i18n/pt_BR/libtodaytodolistplugin.ts \ + ../../../../../i18n/sl/libtodaytodolistplugin.ts \ + ../../../../../i18n/zh_CN/libtodaytodolistplugin.ts \ + ../../../../../i18n/zh_TW/libtodaytodolistplugin.ts \ + ../../../../../i18n/it/libtodaytodolistplugin.ts \ + ../../../../../i18n/da/libtodaytodolistplugin.ts + include ( $(OPIEDIR)/include.pro ) diff --git a/core/pim/today/plugins/todolist/todoplugin.cpp b/core/pim/today/plugins/todolist/todoplugin.cpp index 7eeb8f1..801de9d 100644 --- a/core/pim/today/plugins/todolist/todoplugin.cpp +++ b/core/pim/today/plugins/todolist/todoplugin.cpp @@ -1,12 +1,12 @@ /* * todoplugin.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 * @@ -63,8 +63,14 @@ bool TodolistPlugin::excludeFromRefresh() const { return false; } void TodolistPlugin::refresh() { if ( m_widget ) { m_widget->refresh(); } } + +void TodolistPlugin::reinitialize() { + if ( m_widget ) { + m_widget->reinitialize(); + } +} diff --git a/core/pim/today/plugins/todolist/todoplugin.h b/core/pim/today/plugins/todolist/todoplugin.h index d7b51b4..f68162f 100644 --- a/core/pim/today/plugins/todolist/todoplugin.h +++ b/core/pim/today/plugins/todolist/todoplugin.h @@ -36,14 +36,15 @@ public: double versionNumber() const; QString pixmapNameWidget() const; QWidget* widget(QWidget *); QString pixmapNameConfig() const; TodayConfigWidget* configWidget(QWidget *); QString appName() const; bool excludeFromRefresh() const; void refresh(); + void reinitialize(); private: QGuardedPtr<TodolistPluginWidget> m_widget; }; #endif diff --git a/core/pim/today/plugins/todolist/todopluginwidget.cpp b/core/pim/today/plugins/todolist/todopluginwidget.cpp index 15081ec..0364f94 100644 --- a/core/pim/today/plugins/todolist/todopluginwidget.cpp +++ b/core/pim/today/plugins/todolist/todopluginwidget.cpp @@ -58,58 +58,65 @@ TodolistPluginWidget::~TodolistPluginWidget() { void TodolistPluginWidget::readConfig() { Config cfg( "todaytodoplugin" ); cfg.setGroup( "config" ); m_maxLinesTask = cfg.readNumEntry( "maxlinestask", 5 ); m_maxCharClip = cfg.readNumEntry( "maxcharclip", 38 ); } -void TodolistPluginWidget:: refresh() { +void TodolistPluginWidget:: refresh() { + todo->reload(); + getTodo(); +} + +void TodolistPluginWidget::reinitialize() { + readConfig(); + todo->reload(); getTodo(); } /** * Get the todos */ void TodolistPluginWidget::getTodo() { QString output; QString tmpout; int count = 0; int ammount = 0; // get overdue todos first - m_list = todo->overDue(); + m_list = todo->sorted( true, 3, 2, 1); for ( m_it = m_list.begin(); m_it != m_list.end(); ++m_it ) { if (!(*m_it).isCompleted() && ( ammount < m_maxLinesTask ) ) { QString desc = (*m_it).summary(); if( desc.isEmpty() ) { desc = (*m_it).description(); } - tmpout += "<font color=#e00000><b>-" + desc.mid( 0, m_maxCharClip ) + "</b></font><br>"; + tmpout += "<font color=#e00000><b>[" + QString("%1").arg((*m_it).priority() ) + "]" + desc.mid( 0, m_maxCharClip ) + "</b></font><br>"; ammount++ ; } } // get total number of still open todos m_list = todo->sorted( true, 1, 4, 1); for ( m_it = m_list.begin(); m_it != m_list.end(); ++m_it ) { count +=1; // not the overdues, we allready got them, and not if we are // over the maxlines if ( !(*m_it).isOverdue() && ( ammount < m_maxLinesTask ) ) { QString desc = (*m_it).summary(); if( desc.isEmpty() ) { desc = (*m_it).description(); } - tmpout += "<b>-</b>" + desc.mid( 0, m_maxCharClip ) + "<br>"; + tmpout += "<b> [" + QString("%1").arg((*m_it).priority() ) + "] </b>" + desc.mid( 0, m_maxCharClip ) + "<br>"; ammount++; } } if ( count > 0 ) { if( count == 1 ) { output += QObject::tr( "There is <b> 1</b> active task: <br>" ); } else { diff --git a/core/pim/today/plugins/todolist/todopluginwidget.h b/core/pim/today/plugins/todolist/todopluginwidget.h index 0db65c4..9cac43d 100644 --- a/core/pim/today/plugins/todolist/todopluginwidget.h +++ b/core/pim/today/plugins/todolist/todopluginwidget.h @@ -27,16 +27,17 @@ class TodolistPluginWidget : public QWidget { Q_OBJECT public: TodolistPluginWidget( QWidget *parent, const char *name ); ~TodolistPluginWidget(); void refresh(); + void reinitialize(); protected slots: void startTodolist(); private: OClickableLabel *todoLabel; QVBoxLayout* layoutTodo; diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp index dd8d59b..d4a0ae6 100644 --- a/core/pim/today/today.cpp +++ b/core/pim/today/today.cpp @@ -187,22 +187,17 @@ void Today::loadPlugins() { delete (*tit).guiBox; (*tit).library->unload(); delete (*tit).library; } pluginList.clear(); } QString path = QPEApplication::qpeDir() + "/plugins/today"; - qWarning("Searching for Plugins in: %s", path.latin1()); -#ifdef Q_OS_MACX - QDir dir( path, "lib*.dylib" ); -#else QDir dir( path, "lib*.so" ); -#endif QStringList list = dir.entryList(); QStringList::Iterator it; // QMap<QString, TodayPlugin> tempList; for ( it = list.begin(); it != list.end(); ++it ) { QInterfacePtr<TodayPluginInterface> iface; @@ -215,32 +210,28 @@ void Today::loadPlugins() { TodayPlugin plugin; plugin.library = lib; plugin.iface = iface; plugin.name = QString(*it); QString type = (*it).left( (*it).find(".") ); - // grr, sharp rom does not know Global::languageList(); - // QStringList langs = Global::languageList(); - QString tfn = QPEApplication::qpeDir() + "/i18n/"; - QDir langDir = tfn; - QStringList langs = langDir.entryList("*", QDir::Dirs ); - - for (QStringList::ConstIterator lit = langs.begin(); lit!=langs.end(); ++lit) { - QString lang = *lit; - qDebug( "Languages: " + lang ); - QTranslator * trans = new QTranslator( qApp ); - QString tfn = QPEApplication::qpeDir()+"/i18n/" + lang + "/" + type + ".qm"; - if ( trans->load( tfn ) ) { - qApp->installTranslator( trans ); - } else { - delete trans; - } + QString lang; + Config config("locale"); + config.setGroup("Language"); + lang = config.readEntry( "Language", "en" ); + + qDebug( "Languages: " + lang ); + QTranslator * trans = new QTranslator( qApp ); + QString tfn = QPEApplication::qpeDir()+"/i18n/" + lang + "/" + type + ".qm"; + if ( trans->load( tfn ) ) { + qApp->installTranslator( trans ); + } else { + delete trans; } // find out if plugins should be shown if ( m_excludeApplets.grep( *it ).isEmpty() ) { plugin.active = true; } else { plugin.active = false; diff --git a/core/pim/today/today.pro b/core/pim/today/today.pro index 03ee795..2968e6a 100644 --- a/core/pim/today/today.pro +++ b/core/pim/today/today.pro @@ -1,11 +1,14 @@ CONFIG += qt warn on release quick-app HEADERS = today.h todaybase.h todayconfig.h -SOURCES = today.cpp todaybase.cpp todayconfig.cpp +SOURCES = today.cpp todaybase.cpp todayconfig.cpp main.cpp +INTERFACES = todayconfigmiscbase.ui + INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe -lopie -INTERFACES = + TARGET = today include ( $(OPIEDIR)/include.pro ) +} diff --git a/core/pim/today/todayconfig.cpp b/core/pim/today/todayconfig.cpp index a60f1d2..bfb5ec6 100644 --- a/core/pim/today/todayconfig.cpp +++ b/core/pim/today/todayconfig.cpp @@ -1,12 +1,12 @@ /* * todayconfig.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 * @@ -71,64 +71,23 @@ TodayConfig::TodayConfig( QWidget* parent, const char* name, bool modal ) m_appletListView->setSorting( -1 ); QWhatsThis::add( m_appletListView, tr( "Check a checkbox to activate/deactivate a plugin or use the arrow buttons on the right to change the appearance order" ) ); QVBox *vbox1 = new QVBox( hbox1 ); new ToolButton( vbox1, tr( "Move Up" ), "up", this , SLOT( moveSelectedUp() ) ); new ToolButton( vbox1, tr( "Move Down" ), "down", this , SLOT( moveSelectedDown() ) ); tab2Layout->addWidget( hbox1 ); TabWidget3->addTab( tab_2, "pass", tr( "active/order" ) ); + // Misc tab tab_3 = new QWidget( TabWidget3, "tab_3" ); QVBoxLayout *tab3Layout = new QVBoxLayout( tab_3 ); - tab3Layout->setMargin( 20 ); - QHBox *hbox_auto = new QHBox( tab_3 ); - TextLabel2 = new QLabel( hbox_auto, "AutoStart" ); - TextLabel2->setText( tr( "autostart on \nresume?\n (Opie only)" ) ); - QWhatsThis::add( TextLabel2 , tr( "Check this if today should be autostarted on resume." ) ); - CheckBoxAuto = new QCheckBox( hbox_auto, "CheckBoxAuto" ); - QWhatsThis::add( CheckBoxAuto, tr( "Check this if today should be autostarted on resume." ) ); - - QHBox *hbox_hide = new QHBox( tab_3 ); - TextLabel4 = new QLabel( hbox_hide, "HideBanner" ); - TextLabel4->setText( tr( "Tiny Banner" ) ); - //QWhatsThis::add( TextLabel2 , tr( "Check this if today should be autostarted on resume." ) ); - CheckBoxHide = new QCheckBox( hbox_hide, "CheckBoxHide" ); - // QWhatsThis::add( CheckBoxAuto, tr( "Check this if today should be autostarted on resume." ) ); - - QHBox *hbox_inactive = new QHBox( tab_3 ); - TimeLabel = new QLabel( hbox_inactive, "TimeLabel" ); - TimeLabel->setText( tr( "minutes inactive" ) ); - QWhatsThis::add( TimeLabel , tr( "How many minutes has the PDA been suspended before the autostart feature kicks in on resume" ) ); - SpinBoxTime = new QSpinBox( hbox_inactive, "TimeSpinner" ); - SpinBoxTime->setMaxValue ( 1440 ); - QWhatsThis::add( SpinBoxTime , tr( "How many minutes has the PDA been suspended before the autostart feature kicks in on resume" ) ); - QHBox *hbox_iconSize = new QHBox( tab_3 ); - QLabel *iconSizeLabel = new QLabel( hbox_iconSize, "iconSizeLabel" ); - iconSizeLabel->setText( tr( "Icon size" ) ); - QWhatsThis::add( iconSizeLabel, tr( "Set the icon size in pixel" ) ); - SpinBoxIconSize = new QSpinBox( hbox_iconSize, "TimeSpinner" ); - SpinBoxIconSize->setMaxValue( 32 ); - QWhatsThis::add( SpinBoxIconSize, tr( "Set the icon size in pixel" ) ); - - QHBox *hbox_refresh = new QHBox( tab_3 ); - QLabel *refreshLabel = new QLabel( hbox_refresh ); - refreshLabel->setText( tr( "Refresh" ) ); - QWhatsThis::add( refreshLabel, tr( "How often should Today refresh itself" ) ); - SpinRefresh = new QSpinBox( hbox_refresh ); - SpinRefresh->setMinValue( 0 ); - SpinRefresh->setSuffix( tr( " sec" ) ); - SpinRefresh->setMaxValue ( 7200 ); - SpinRefresh->setSpecialValueText ( tr("never") ); - QWhatsThis::add( SpinRefresh, tr( "How often should Today refresh itself" ) ); - - tab3Layout->addWidget( hbox_auto ); - tab3Layout->addWidget( hbox_hide ); - tab3Layout->addWidget( hbox_inactive ); - tab3Layout->addWidget( hbox_iconSize ); - tab3Layout->addWidget( hbox_refresh ); + + m_guiMisc = new TodayConfigMiscBase( tab_3 ); + + tab3Layout->addWidget( m_guiMisc ); TabWidget3->addTab( tab_3, "SettingsIcon", tr( "Misc" ) ); m_applets_changed = false; connect ( m_appletListView , SIGNAL( clicked ( QListViewItem * ) ), this, SLOT( appletChanged ( ) ) ); readConfig(); showMaximized(); @@ -156,25 +115,25 @@ void TodayConfig::setAutoStart() { /** * Read the config part */ void TodayConfig::readConfig() { Config cfg( "today" ); cfg.setGroup( "Autostart" ); m_autoStart = cfg.readNumEntry( "autostart", 1 ); - CheckBoxAuto->setChecked( m_autoStart ); + m_guiMisc->CheckBoxAuto->setChecked( m_autoStart ); m_autoStartTimer = cfg.readNumEntry( "autostartdelay", 0 ); - SpinBoxTime->setValue( m_autoStartTimer ); + m_guiMisc->SpinBoxTime->setValue( m_autoStartTimer ); cfg.setGroup( "General" ); m_iconSize = cfg.readNumEntry( "IconSize", 18 ); - SpinBoxIconSize->setValue( m_iconSize ); - SpinRefresh->setValue( cfg.readNumEntry( "checkinterval", 15000 ) / 1000 ); - CheckBoxHide->setChecked( cfg.readNumEntry( "HideBanner", 0 ) ); + m_guiMisc->SpinBoxIconSize->setValue( m_iconSize ); + m_guiMisc->SpinRefresh->setValue( cfg.readNumEntry( "checkinterval", 15000 ) / 1000 ); + m_guiMisc->CheckBoxHide->setChecked( cfg.readNumEntry( "HideBanner", 0 ) ); cfg.setGroup( "Plugins" ); m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' ); } /** * Write the config part @@ -204,26 +163,26 @@ void TodayConfig::writeConfig() { } } cfg.writeEntry( "ExcludeApplets", exclude, ',' ); cfg.writeEntry( "IncludeApplets", include, ',' ); cfg.writeEntry( "AllApplets", all_applets, ',' ); } cfg.setGroup( "Autostart" ); - m_autoStart = CheckBoxAuto->isChecked(); + m_autoStart = m_guiMisc->CheckBoxAuto->isChecked(); cfg.writeEntry( "autostart", m_autoStart ); - m_autoStartTimer = SpinBoxTime->value(); + m_autoStartTimer = m_guiMisc->SpinBoxTime->value(); cfg.writeEntry( "autostartdelay", m_autoStartTimer ); - m_iconSize = SpinBoxIconSize->value(); + m_iconSize = m_guiMisc->SpinBoxIconSize->value(); cfg.setGroup( "General" ); cfg.writeEntry( "IconSize", m_iconSize ); - cfg.writeEntry( "HideBanner", CheckBoxHide->isChecked() ); - cfg.writeEntry( "checkinterval", SpinRefresh->value()*1000 ); + cfg.writeEntry( "HideBanner", m_guiMisc->CheckBoxHide->isChecked() ); + cfg.writeEntry( "checkinterval", m_guiMisc->SpinRefresh->value()*1000 ); // set autostart settings setAutoStart(); } void TodayConfig::moveSelectedUp() { QListViewItem *item = m_appletListView->selectedItem(); diff --git a/core/pim/today/todayconfig.h b/core/pim/today/todayconfig.h index 41bd44b..0a7687c 100644 --- a/core/pim/today/todayconfig.h +++ b/core/pim/today/todayconfig.h @@ -1,12 +1,12 @@ /* * todayconfig.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 * @@ -17,16 +17,19 @@ #ifndef TODAYCONFIG_H #define TODAYCONFIG_H #include <qvariant.h> #include <qdialog.h> #include <qlistview.h> #include <opie/otabwidget.h> + +#include "todayconfigmiscbase.h" + class QCheckBox; class QLabel; class QSpinBox; class QTabWidget; class TodayConfig : public QDialog { Q_OBJECT @@ -54,21 +57,17 @@ private: QMap<QString,QCheckListItem*> m_applets; int m_autoStart; int m_autoStartTimer; int m_iconSize; QStringList m_excludeApplets; bool m_applets_changed; - QLabel* TextLabel2; - QCheckBox* CheckBoxAuto, *CheckBoxHide; QWidget* tab_2; QWidget* tab_3; QLabel* TextLabel1, *TextLabel4; QSpinBox* SpinBox7; - QLabel* TimeLabel; - QSpinBox* SpinBoxTime; - QSpinBox* SpinRefresh; - QSpinBox* SpinBoxIconSize; + + TodayConfigMiscBase *m_guiMisc; }; #endif |