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,96 +1,102 @@ +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 * changed refresh * fixed one mem leak 0.6 * longer refresh intervals possible * plugins can decide now if they want to take part in refresh cycles 0.5.2 * refresh settings * only launch datebook config when clicked on a date ( opie only ) * less qcop trouble on sharps retail rom 0.5.1 * icons scalable and clickable again 0.5 * now fully plugin based 0.3.4 * "fill our business card now a clickable label" * Several bugfixes regarding todo section. 0.3.3 * Changed the logo so it better scales to bigger display and also made the "Today" string translatable. * some am/pm fixes * clickable labels now in libopie 0.3.2 * Autostart is now more configurable. You can decide how long the ipaq has to has been suspended, before autostart is triggered.(Opie only) * am/pm time optinal (autodetect) 0.3.1 * fixed the wrong color of the buttons * better translation (thanks carsten and others) * fixes memory leaks * bugfixes in calendar part, now location and note are working again. 0.3.0 * today uses now tododb from libopie. So major changes in the todo part: - overdue items on top - then sorted by date, then by priority * some cleanups * speed optimisations 0.2.9 * Many bugfixes. * Today now apparently sorts the dates _allways_ right, i would assume it to be a qt bug 0.2.8 * Appointments are now clickable (connection to datebook still missing) * autostart support (opie only) 0.2.7 * check if todolist.xml was changed before parsing it * check only every 30 sec for changes. * some visual stuff * as usual many little improvements .-) 0.2.6 * added scrollbars to dates and todo * all day detection * some smaller bugfixes 0.2.5 * some other minor fixes regarding autoupdate * fixed segfault with todolist > 7 entries * fixed the "ugly grey border around buttons" issue * fixed the "empty calendar field" "bug" * shown only later appointments as option 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 @@ -1,36 +1,24 @@ /* * main.cpp * * --------------------- * * begin : Sun 10 17:20:00 CEST 2002 * copyright : (c) 2002 by Maximilian Reiß * email : max.reiss@gmx.de * */ /*************************************************************************** * * * 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 "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 @@ -1,21 +1,40 @@ TEMPLATE = lib CONFIG -= moc CONFIG += qt release # Input HEADERS = datebookplugin.h datebookpluginimpl.h datebookpluginconfig.h \ datebookevent.h datebookpluginwidget.h SOURCES = datebookplugin.cpp datebookpluginimpl.cpp datebookpluginconfig.cpp \ datebookevent.cpp datebookpluginwidget.cpp INTERFACES = datebookpluginconfigbase.ui INCLUDEPATH += $(OPIEDIR)/include \ ../ ../library 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,138 +1,148 @@ /* * 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 * * (at your option) any later version. * * * ***************************************************************************/ #include "datebookevent.h" #include <qpe/config.h> #include <qpe/timestring.h> #include <qpe/qcopenvelope_qws.h> #include <qpe/qpeapplication.h> +#include <qpe/calendar.h> #include <opie/odevice.h> using namespace Opie; DateBookEvent::DateBookEvent(const EffectiveEvent &ev, QWidget* parent, bool show_location, bool show_notes, + bool timeExtraLine, int maxCharClip, const char* name, WFlags fl) : OClickableLabel(parent,name,fl), event(ev) { // setAlignment( AlignTop ); QString msg; Config config( "qpe" ); config.setGroup( "Time" ); // if 24 h format ampm = config.readBoolEntry( "AMPM", TRUE ); msg += "<B>" + (ev).description() + "</B>"; if ( (ev).event().hasAlarm() ) { msg += " <b>" + tr("[with alarm]") +"</b>"; } // include location or not if ( show_location ) { msg += "<BR><i>" + (ev).location() + "</i>"; } + QString timeSpacer = " "; + if ( timeExtraLine ) { + timeSpacer = "<br>"; + } + if ( ( TimeString::timeString( QTime( (ev).event().start().time() ) ) == "00:00" ) && ( TimeString::timeString( QTime( (ev).event().end().time() ) ) == "23:59" ) ) { - msg += "<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() ) ); } DateBookEvent::~DateBookEvent() { } /** * AM/PM timestring conversion. * @param tm the timestring * @return formatted to am/pm is system is set to it */ QString DateBookEvent::ampmTime( QTime tm ) { QString s; if( ampm ) { int hour = tm.hour(); if ( hour == 0 ) { hour = 12; } if ( hour > 12 ) { hour -= 12; } s.sprintf( "%2d:%02d %s", hour, tm.minute(), (tm.hour() >= 12) ? "PM" : "AM" ); return s; } else { s.sprintf( "%2d:%02d", tm.hour(), tm.minute() ); return s; } } QString DateBookEvent::differDate( QDate date ) { - QDate currentDate = QDate::currentDate(); +// 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,51 +1,54 @@ /* * 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 DATEBOOKEVENT_PLUGIN_H #define DATEBOOKEVENT_PLUGIN_H #include <opie/oclickablelabel.h> #include <qpe/datebookdb.h> 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; }; #endif 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 @@ -1,71 +1,78 @@ /* * datebookplugin.cpp * * copyright : (c) 2002,2003 by Maximilian Reiß * email : harlekin@handhelds.org * */ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #include "datebookevent.h" #include "datebookplugin.h" #include "datebookpluginconfig.h" DatebookPlugin::DatebookPlugin() { } DatebookPlugin::~DatebookPlugin() { delete (DatebookPluginWidget*)m_widget; } QString DatebookPlugin::pluginName() const { return QObject::tr( "Datebook plugin"); } double DatebookPlugin::versionNumber() const { return 1.0; } QString DatebookPlugin::pixmapNameWidget() const { return "datebook/DateBook"; } QWidget* DatebookPlugin::widget( QWidget* wid ) { if(!m_widget) { m_widget = new DatebookPluginWidget( wid, "Datebook" ); } return m_widget; } QString DatebookPlugin::pixmapNameConfig() const { return "datebook/DateBook"; } TodayConfigWidget* DatebookPlugin::configWidget( QWidget* wid ) { return new DatebookPluginConfig( wid , "Datebook" ); } QString DatebookPlugin::appName() const { return "datebook"; } bool DatebookPlugin::excludeFromRefresh() const { return false; } void DatebookPlugin::refresh() { if ( m_widget ) { m_widget->refresh(); } } + +void DatebookPlugin::reinitialize() { + if ( m_widget ) { + m_widget->reinitialize(); + } +} + diff --git a/core/pim/today/plugins/datebook/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 @@ -1,48 +1,49 @@ /* * datebookplugin.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_H #define DATEBOOK_PLUGIN_H #include <qguardedptr.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(); + 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 @@ -1,125 +1,143 @@ /* * datebookpluginwidget.cpp * * copyright : (c) 2002,2003 by Maximilian Reiß * email : harlekin@handhelds.org * */ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #include "datebookpluginwidget.h" #include <qpe/timestring.h> #include <qpe/config.h> #include <qdatetime.h> #include <qlabel.h> #include <qtl.h> DatebookPluginWidget::DatebookPluginWidget( QWidget *parent, const char* name ) : QWidget(parent, name ) { db = 0l; m_layoutDates = 0l; - if ( 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" ) ); } } 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 35d43cd..8988073 100644 --- a/core/pim/today/plugins/datebook/datebookpluginwidget.h +++ b/core/pim/today/plugins/datebook/datebookpluginwidget.h @@ -1,58 +1,60 @@ /* * datebookpluginwidget.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_WIDGET_H #define DATEBOOK_PLUGIN_WIDGET_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(); + void reinitialize(); 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; - + // 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 @@ -1,69 +1,72 @@ /* * mailplugin.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 "mailplugin.h" MailPlugin::MailPlugin() { m_widget = 0l; } MailPlugin::~MailPlugin() { delete (MailPluginWidget*)m_widget; } QString MailPlugin::pluginName() const { return QObject::tr( "Mail plugin" ); } double MailPlugin::versionNumber() const { return 0.6; } QString MailPlugin::pixmapNameWidget() const { return "mail/desktopicon"; } QWidget* MailPlugin::widget( QWidget * wid ) { if(!m_widget) { m_widget = new MailPluginWidget( wid, "Datebook" ); } return m_widget; } QString MailPlugin::pixmapNameConfig() const { return 0l; } TodayConfigWidget* MailPlugin::configWidget( QWidget* ) { return 0l; } QString MailPlugin::appName() const { return "mail"; } 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 @@ -1,49 +1,50 @@ /* * 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 <qwidget.h> #include <qguardedptr.h> #include <opie/todayplugininterface.h> #include <opie/todayconfigwidget.h> #include "mailpluginwidget.h" class MailPlugin : public TodayPluginObject { public: MailPlugin(); ~MailPlugin(); 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(); + 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 @@ -1,80 +1,80 @@ /* * mailpluginwidget.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 <qpe/config.h> #include <qpe/qcopenvelope_qws.h> #include "mailpluginwidget.h" MailPluginWidget::MailPluginWidget( QWidget *parent, const char* name) : QWidget(parent, 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 ); readConfig(); getInfo(); } MailPluginWidget::~MailPluginWidget() { delete m_mailLabel; delete m_layout; } void MailPluginWidget::readConfig() { Config cfg( "todaymailplugin" ); cfg.setGroup( "config" ); } void MailPluginWidget::refresh() { getInfo(); } void MailPluginWidget::getInfo() { Config cfg( "opiemail" ); cfg.setGroup( "today" ); int NEW_MAILS = cfg.readNumEntry( "newmails", 0 ); int OUTGOING = cfg.readNumEntry( "outgoing", 0 ); //QString output = QObject::tr( "<b>%1</b> new mail(s), <b>%2</b> outgoing" ).arg( NEW_MAILS ).arg( OUTGOING ); m_mailLabel->setText( QObject::tr( "<b>%1</b> new mail(s), <b>%2</b> outgoing" ).arg( NEW_MAILS ).arg( OUTGOING ) ); } /** * launches datebook */ void MailPluginWidget::startMail() { QCopEnvelope e("QPE/System", "execute(QString)"); e << QString( "mail" ); } 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 @@ -1,22 +1,41 @@ TEMPLATE = lib CONFIG -= moc CONFIG += qt release # Input HEADERS = todoplugin.h todopluginimpl.h todopluginconfig.h \ todopluginwidget.h SOURCES = todoplugin.cpp todopluginimpl.cpp todopluginconfig.cpp \ todopluginwidget.cpp INTERFACES= todopluginconfigbase.ui INCLUDEPATH += $(OPIEDIR)/include \ ../ ../library 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,70 +1,76 @@ /* * 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 * * (at your option) any later version. * * * ***************************************************************************/ #include "todoplugin.h" #include "todopluginconfig.h" TodolistPlugin::TodolistPlugin() { } TodolistPlugin::~TodolistPlugin() { delete (TodolistPluginWidget*)m_widget; } QString TodolistPlugin::pluginName() const { return QObject::tr( "Todolist plugin" ); } double TodolistPlugin::versionNumber() const { return 0.9; } QString TodolistPlugin::pixmapNameWidget() const { return "todo/TodoList"; } QWidget* TodolistPlugin::widget( QWidget *wid ) { if(!m_widget) { m_widget = new TodolistPluginWidget( wid, "Todolist" ); } return m_widget; } QString TodolistPlugin::pixmapNameConfig() const { return "todo/TodoList"; } TodayConfigWidget* TodolistPlugin::configWidget( QWidget* wid ) { return new TodolistPluginConfig( wid , "Todolist" ); } QString TodolistPlugin::appName() const { return "todolist"; } 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 @@ -1,49 +1,50 @@ /* * 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 <qstring.h> #include <qguardedptr.h> #include <qwidget.h> #include <opie/oclickablelabel.h> #include <opie/todayplugininterface.h> #include "todopluginwidget.h" class TodolistPlugin : public TodayPluginObject { public: TodolistPlugin(); ~TodolistPlugin(); 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(); + 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 @@ -1,131 +1,138 @@ /* * todopluginwidget.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 "todopluginwidget.h" #include <qpe/config.h> #include <qpe/qcopenvelope_qws.h> TodolistPluginWidget::TodolistPluginWidget( QWidget *parent, const char* name ) : QWidget( parent, name ) { todo = 0l; layoutTodo = 0l; todoLabel = 0l; if ( todo ) { delete todo; } todo = new OTodoAccess(); todo->load(); if ( layoutTodo ) { delete layoutTodo; } layoutTodo = new QVBoxLayout( this ); layoutTodo->setAutoAdd( true ); if ( todoLabel ) { delete todoLabel; } todoLabel = new OClickableLabel( this ); connect( todoLabel, SIGNAL( clicked() ), this, SLOT( startTodolist() ) ); readConfig(); getTodo(); } TodolistPluginWidget::~TodolistPluginWidget() { delete todo; delete todoLabel; delete layoutTodo; } 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 { output += QObject::tr( "There are <b> %1</b> active tasks: <br>" ).arg( count ); } output += tmpout; } else { output = QObject::tr( "No active tasks" ); } todoLabel->setText( output ); } /** * 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 index 0db65c4..9cac43d 100644 --- a/core/pim/today/plugins/todolist/todopluginwidget.h +++ b/core/pim/today/plugins/todolist/todopluginwidget.h @@ -1,53 +1,54 @@ /* * todopluginwidget.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 TODOLIST_PLUGIN_WIDGET_H #define TODOLIST_PLUGIN_WIDGET_H #include <qlayout.h> #include <opie/otodoaccess.h> #include <opie/oclickablelabel.h> 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; OTodoAccess *todo; OTodoAccess::List m_list; OTodoAccess::List::Iterator m_it; void readConfig(); void getTodo(); int m_maxLinesTask; int m_maxCharClip; }; #endif 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 @@ -99,236 +99,227 @@ void Today::channelReceived( const QCString &msg, const QByteArray & data ) { setOwnerField( message ); } } void Today::setRefreshTimer( int interval ) { disconnect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); // 0 is "never" case if ( !interval == 0 ) { connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); m_refreshTimer->changeInterval( interval ); } } /** * Initialises the owner field with the default value, the username */ void Today::setOwnerField() { QString file = Global::applicationFileName( "addressbook", "businesscard.vcf" ); if ( QFile::exists( file ) ) { Contact cont = Contact::readVCard( file )[0]; QString returnString = cont.fullName(); OwnerField->setText( "<b>" + tr ( "Owned by " ) + returnString + "</b>" ); } else { OwnerField->setText( "<b>" + tr ( "Please fill out the business card" ) + " </b>" ); } } /** * Set the owner field with a given QString, for example per qcop. */ void Today::setOwnerField( QString &message ) { if ( !message.isEmpty() ) { OwnerField->setText( "<b>" + message + "</b>" ); } } /** * Init stuff needed for today. Reads the config file. */ void Today::init() { // read config Config cfg( "today" ); cfg.setGroup( "Plugins" ); m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' ); m_allApplets = cfg.readListEntry( "AllApplets", ',' ); cfg.setGroup( "General" ); m_iconSize = cfg.readNumEntry( "IconSize", 18 ); m_hideBanner = cfg.readNumEntry( "HideBanner", 0 ); setRefreshTimer( cfg.readNumEntry( "checkinterval", 15000 ) ); // set the date in top label QDate date = QDate::currentDate(); DateLabel->setText( QString( "<font color=#FFFFFF>" + TimeString::longDateString( date ) + "</font>" ) ); if ( m_hideBanner ) { Opiezilla->hide(); TodayLabel->hide(); } else { Opiezilla->show(); TodayLabel->show(); } if ( m_big_box ) { delete m_big_box; } m_big_box = new QWidget( m_sv->viewport() ); m_sv->addChild( m_big_box ); m_bblayout = new QVBoxLayout ( m_big_box ); } /** * Load the plugins */ void Today::loadPlugins() { init(); QValueList<TodayPlugin>::Iterator tit; if ( !pluginList.isEmpty() ) { for ( tit = pluginList.begin(); tit != pluginList.end(); ++tit ) { (*tit).guiBox->hide(); (*tit).guiBox->reparent( 0, QPoint( 0, 0 ) ); 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; QLibrary *lib = new QLibrary( path + "/" + *it ); qDebug( "querying: %s", QString( path + "/" + *it ).latin1() ); if ( lib->queryInterface( IID_TodayPluginInterface, (QUnknownInterface**)&iface ) == QS_OK ) { qDebug( "accepted: %s", QString( path + "/" + *it ).latin1() ); qDebug( QString(*it) ); 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; } plugin.guiPart = plugin.iface->guiPart(); plugin.excludeRefresh = plugin.guiPart->excludeFromRefresh(); // package the whole thing into a qwidget so it can be shown and hidden plugin.guiBox = new QWidget( m_big_box ); QHBoxLayout *boxLayout = new QHBoxLayout( plugin.guiBox ); QPixmap plugPix; plugPix.convertFromImage( Resource::loadImage( plugin.guiPart->pixmapNameWidget() ).smoothScale( m_iconSize, m_iconSize ), 0 ); OClickableLabel* plugIcon = new OClickableLabel( plugin.guiBox ); plugIcon->setPixmap( plugPix ); QWhatsThis::add( plugIcon, tr("Click here to launch the associated app") ); plugIcon->setName( plugin.guiPart->appName() ); connect( plugIcon, SIGNAL( clicked() ), this, SLOT( startApplication() ) ); QWidget *plugWidget = plugin.guiPart->widget( plugin.guiBox ); boxLayout->addWidget( plugIcon, 0, AlignTop ); boxLayout->addWidget( plugWidget, 0, AlignTop ); boxLayout->setStretchFactor( plugIcon, 1 ); boxLayout->setStretchFactor( plugWidget, 9 ); // "prebuffer" it in one more list, to get the sorting done tempList.insert( plugin.name, plugin ); // on first start the list is off course empty if ( m_allApplets.isEmpty() ) { pluginList.append( plugin ); m_bblayout->addWidget( plugin.guiBox ); } // if plugin is not yet in the list, add it to the layout too else if ( !m_allApplets.contains( plugin.name ) ) { pluginList.append( plugin ); } } else { qDebug( "could not recognize %s", QString( path + "/" + *it ).latin1() ); delete lib; } } if ( !m_allApplets.isEmpty() ) { TodayPlugin tempPlugin; QStringList::Iterator stringit; for( stringit = m_allApplets.begin(); stringit != m_allApplets.end(); ++stringit ) { tempPlugin = ( tempList.find( *stringit ) ).data(); if ( !( (tempPlugin.name).isEmpty() ) ) { pluginList.append( tempPlugin ); m_bblayout->addWidget( tempPlugin.guiBox ); } } } m_bblayout->addStretch( 2 ); draw(); } /** * Repaint method. Reread all fields. */ void Today::draw() { if ( pluginList.count() == 0 ) { QLabel *noPlugins = new QLabel( this ); noPlugins->setText( tr( "No plugins found" ) ); layout->addWidget( noPlugins ); return; } uint count = 0; TodayPlugin plugin; for ( uint i = 0; i < pluginList.count(); i++ ) { plugin = pluginList[i]; if ( plugin.active ) { // qDebug( plugin.name + " is ACTIVE " ); plugin.guiBox->show(); } else { // qDebug( plugin.name + " is INACTIVE" ); plugin.guiBox->hide(); } count++; } 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,273 +1,232 @@ /* * 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 * * (at your option) any later version. * * * ***************************************************************************/ #include "todayconfig.h" #include <qpe/config.h> #include <qpe/resource.h> #include <qpe/qcopenvelope_qws.h> #include <qcheckbox.h> #include <qlabel.h> #include <qspinbox.h> #include <qtabwidget.h> #include <qlayout.h> #include <qheader.h> #include <qhbox.h> #include <qvbox.h> #include <qtoolbutton.h> #include <qtooltip.h> #include <qwhatsthis.h> class ToolButton : public QToolButton { public: ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE ) : QToolButton( parent, name ) { setPixmap( Resource::loadPixmap( icon ) ); setAutoRaise( TRUE ); setFocusPolicy( QWidget::NoFocus ); setToggleButton( t ); connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot ); } }; /** * The class has currently quite some duplicate code. * By that way it would be real easy to have it as seperate app in settings tab * */ TodayConfig::TodayConfig( QWidget* parent, const char* name, bool modal ) : QDialog( parent, name, modal, WStyle_ContextHelp ) { setCaption( tr( "Today Config" ) ); QVBoxLayout *layout = new QVBoxLayout( this ); TabWidget3 = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); layout->addWidget( TabWidget3 ); tab_2 = new QWidget( TabWidget3, "tab_2" ); QVBoxLayout *tab2Layout = new QVBoxLayout( tab_2, 4 ,4 ); QLabel *l = new QLabel( tr( "Load which plugins in what order:" ), tab_2 ); tab2Layout->addWidget( l ); QHBox *hbox1 = new QHBox( tab_2 ); m_appletListView = new QListView( hbox1 ); m_appletListView->addColumn( "PluginList" ); m_appletListView->header()->hide(); 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(); } /** * Autostart, uses the new (opie only) autostart method in the launcher code. * If registered against that today ist started on each resume. */ void TodayConfig::setAutoStart() { Config cfg( "today" ); cfg.setGroup( "Autostart" ); if ( m_autoStart ) { QCopEnvelope e( "QPE/System", "autoStart(QString,QString,QString)" ); e << QString( "add" ); e << QString( "today" ); e << QString( "%1" ).arg( m_autoStartTimer ); } else { QCopEnvelope e( "QPE/System", "autoStart(QString,QString)" ); e << QString( "remove" ); e << QString( "today" ); } } /** * 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 */ void TodayConfig::writeConfig() { Config cfg( "today" ); cfg.setGroup( "Plugins" ); if ( m_applets_changed ) { QStringList exclude; QStringList include; QStringList all_applets; QListViewItemIterator list_it( m_appletListView ); // this makes sure the names get saved in the order selected for ( ; list_it.current(); ++list_it ) { QMap <QString, QCheckListItem *>::Iterator it; for ( it = m_applets.begin(); it != m_applets. end (); ++it ) { if ( list_it.current() == (*it) && !(*it)-> isOn () ) { exclude << it.key(); } else if ( list_it.current() == (*it) && (*it)-> isOn () ){ include << it.key(); } if ( list_it.current() == (*it) ) { all_applets << it.key(); } } } 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(); if ( item && item->itemAbove() ) { item->itemAbove()->moveItem( item ); } } void TodayConfig::moveSelectedDown() { QListViewItem *item = m_appletListView->selectedItem(); if ( item && item->itemBelow() ) { item->moveItem( item->itemBelow() ); } } /** * Set up the icons in the order/active tab */ void TodayConfig::pluginManagement( QString libName, QString name, QPixmap icon ) { QCheckListItem *item; item = new QCheckListItem( m_appletListView, name, QCheckListItem::CheckBox ); if ( !icon.isNull() ) { item->setPixmap( 0, icon ); } if ( m_excludeApplets.find( libName ) == m_excludeApplets.end() ) { item->setOn( TRUE ); } m_applets[libName] = item; // kind of hack to get the first tab as default. TabWidget3->setCurrentTab( tab_2 ); } void TodayConfig::appletChanged() { m_applets_changed = true; } TodayConfig::~TodayConfig() { } 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,74 +1,73 @@ /* * 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 * * (at your option) any later version. * * * ***************************************************************************/ #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 public: TodayConfig( QWidget* parent = 0, const char* name = 0, bool modal = FALSE ); ~TodayConfig(); OTabWidget* TabWidget3; void writeConfig(); void pluginManagement( QString libName, QString name, QPixmap icon ); protected slots: void appletChanged(); void moveSelectedUp(); void moveSelectedDown(); private: void setAutoStart(); void readConfig(); QListView* m_appletListView; 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 |