author | harlekin <harlekin> | 2003-02-21 18:19:56 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2003-02-21 18:19:56 (UTC) |
commit | 3b37e71ad7dd41555763d15a16c691b503780de8 (patch) (unidiff) | |
tree | 9fa7d1145a1e4dc30da8c90fef55e1c3b0d1065c | |
parent | 0bb9d0f9e7da80f0ae3b91d4ebbb7aab4d2b9df7 (diff) | |
download | opie-3b37e71ad7dd41555763d15a16c691b503780de8.zip opie-3b37e71ad7dd41555763d15a16c691b503780de8.tar.gz opie-3b37e71ad7dd41555763d15a16c691b503780de8.tar.bz2 |
got rid of some unneeded includes
-rw-r--r-- | core/pim/today/plugins/datebook/datebookpluginwidget.cpp | 4 | ||||
-rw-r--r-- | core/pim/today/plugins/todolist/todoplugin.h | 1 | ||||
-rw-r--r-- | core/pim/today/today.cpp | 8 | ||||
-rw-r--r-- | core/pim/today/today.h | 7 | ||||
-rw-r--r-- | core/pim/today/todaybase.cpp | 1 |
5 files changed, 3 insertions, 18 deletions
diff --git a/core/pim/today/plugins/datebook/datebookpluginwidget.cpp b/core/pim/today/plugins/datebook/datebookpluginwidget.cpp index 3a7360d..97fb77e 100644 --- a/core/pim/today/plugins/datebook/datebookpluginwidget.cpp +++ b/core/pim/today/plugins/datebook/datebookpluginwidget.cpp | |||
@@ -1,118 +1,118 @@ | |||
1 | /* | 1 | /* |
2 | * datebookpluginwidget.cpp | 2 | * datebookpluginwidget.cpp |
3 | * | 3 | * |
4 | * copyright : (c) 2002 by Maximilian Reiß | 4 | * copyright : (c) 2002 by Maximilian Reiß |
5 | * email : harlekin@handhelds.org | 5 | * email : harlekin@handhelds.org |
6 | * | 6 | * |
7 | */ | 7 | */ |
8 | /*************************************************************************** | 8 | /*************************************************************************** |
9 | * * | 9 | * * |
10 | * This program is free software; you can redistribute it and/or modify * | 10 | * This program is free software; you can redistribute it and/or modify * |
11 | * it under the terms of the GNU General Public License as published by * | 11 | * it under the terms of the GNU General Public License as published by * |
12 | * the Free Software Foundation; either version 2 of the License, or * | 12 | * the Free Software Foundation; either version 2 of the License, or * |
13 | * (at your option) any later version. * | 13 | * (at your option) any later version. * |
14 | * * | 14 | * * |
15 | ***************************************************************************/ | 15 | ***************************************************************************/ |
16 | 16 | ||
17 | 17 | ||
18 | #include "datebookpluginwidget.h" | 18 | #include "datebookpluginwidget.h" |
19 | 19 | ||
20 | #include <qpe/timestring.h> | 20 | #include <qpe/timestring.h> |
21 | #include <qpe/config.h> | 21 | #include <qpe/config.h> |
22 | 22 | ||
23 | #include <qdatetime.h> | 23 | #include <qdatetime.h> |
24 | #include <qlabel.h> | 24 | #include <qlabel.h> |
25 | #include <qlayout.h> | 25 | #include <qlayout.h> |
26 | #include <qtl.h> | 26 | #include <qtl.h> |
27 | #include <qscrollview.h> | 27 | #include <qscrollview.h> |
28 | #include <qtimer.h> | 28 | #include <qtimer.h> |
29 | 29 | ||
30 | DatebookPluginWidget::DatebookPluginWidget( QWidget *parent, const char* name) | 30 | DatebookPluginWidget::DatebookPluginWidget( QWidget *parent, const char* name ) |
31 | : QWidget(parent, name ) { | 31 | : QWidget(parent, name ) { |
32 | 32 | ||
33 | db = 0l; | 33 | db = 0l; |
34 | m_layoutDates = 0l; | 34 | m_layoutDates = 0l; |
35 | 35 | ||
36 | if ( db ) { | 36 | if ( db ) { |
37 | delete db; | 37 | delete db; |
38 | } | 38 | } |
39 | db = new DateBookDB; | 39 | db = new DateBookDB; |
40 | 40 | ||
41 | if ( m_layoutDates ) { | 41 | if ( m_layoutDates ) { |
42 | delete m_layoutDates; | 42 | delete m_layoutDates; |
43 | } | 43 | } |
44 | m_layoutDates = new QVBoxLayout( this ); | 44 | m_layoutDates = new QVBoxLayout( this ); |
45 | m_layoutDates->setAutoAdd( true ); | 45 | m_layoutDates->setAutoAdd( true ); |
46 | 46 | ||
47 | m_eventsList.setAutoDelete( true ); | 47 | m_eventsList.setAutoDelete( true ); |
48 | 48 | ||
49 | readConfig(); | 49 | readConfig(); |
50 | getDates(); | 50 | getDates(); |
51 | } | 51 | } |
52 | 52 | ||
53 | DatebookPluginWidget::~DatebookPluginWidget() { | 53 | DatebookPluginWidget::~DatebookPluginWidget() { |
54 | delete db; | 54 | delete db; |
55 | delete m_layoutDates; | 55 | delete m_layoutDates; |
56 | } | 56 | } |
57 | 57 | ||
58 | 58 | ||
59 | void DatebookPluginWidget::readConfig() { | 59 | void DatebookPluginWidget::readConfig() { |
60 | Config cfg( "todaydatebookplugin" ); | 60 | Config cfg( "todaydatebookplugin" ); |
61 | cfg.setGroup( "config" ); | 61 | cfg.setGroup( "config" ); |
62 | m_max_lines_meet = cfg.readNumEntry( "maxlinesmeet", 5 ); | 62 | m_max_lines_meet = cfg.readNumEntry( "maxlinesmeet", 5 ); |
63 | m_show_location = cfg.readNumEntry( "showlocation", 1 ); | 63 | m_show_location = cfg.readNumEntry( "showlocation", 1 ); |
64 | m_show_notes = cfg.readNumEntry( "shownotes", 0 ); | 64 | m_show_notes = cfg.readNumEntry( "shownotes", 0 ); |
65 | m_onlyLater = cfg.readNumEntry( "onlylater", 1 ); | 65 | m_onlyLater = cfg.readNumEntry( "onlylater", 1 ); |
66 | m_moreDays = cfg.readNumEntry( "moredays", 0 ); | 66 | m_moreDays = cfg.readNumEntry( "moredays", 0 ); |
67 | } | 67 | } |
68 | 68 | ||
69 | void DatebookPluginWidget::refresh() { | 69 | void DatebookPluginWidget::refresh() { |
70 | m_eventsList.clear(); | 70 | m_eventsList.clear(); |
71 | getDates(); | 71 | getDates(); |
72 | } | 72 | } |
73 | 73 | ||
74 | /** | 74 | /** |
75 | * Get all events that are in the datebook xml file for today | 75 | * Get all events that are in the datebook xml file for today |
76 | */ | 76 | */ |
77 | void DatebookPluginWidget::getDates() { | 77 | void DatebookPluginWidget::getDates() { |
78 | 78 | ||
79 | QDate date = QDate::currentDate(); | 79 | QDate date = QDate::currentDate(); |
80 | QValueList<EffectiveEvent> list = db->getEffectiveEvents( date, date.addDays( m_moreDays ) ); | 80 | QValueList<EffectiveEvent> list = db->getEffectiveEvents( date, date.addDays( m_moreDays ) ); |
81 | qBubbleSort( list ); | 81 | qBubbleSort( list ); |
82 | int count = 0; | 82 | int count = 0; |
83 | 83 | ||
84 | if ( list.count() > 0 ) { | 84 | if ( list.count() > 0 ) { |
85 | 85 | ||
86 | for ( QValueList<EffectiveEvent>::ConstIterator it = list.begin(); it != list.end(); ++it ) { | 86 | for ( QValueList<EffectiveEvent>::ConstIterator it = list.begin(); it != list.end(); ++it ) { |
87 | 87 | ||
88 | if ( count <= m_max_lines_meet ) { | 88 | if ( count <= m_max_lines_meet ) { |
89 | if ( !m_onlyLater ) { | 89 | if ( !m_onlyLater ) { |
90 | count++; | 90 | count++; |
91 | DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes ); | 91 | DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes ); |
92 | m_eventsList.append( l ); | 92 | m_eventsList.append( l ); |
93 | l->show(); | 93 | l->show(); |
94 | QObject::connect ( l, SIGNAL( editEvent( const Event & ) ), l, SLOT( editEventSlot( const Event & ) ) ); | 94 | QObject::connect ( l, SIGNAL( editEvent( const Event & ) ), l, SLOT( editEventSlot( const Event & ) ) ); |
95 | } else if ( QDateTime::currentDateTime() <= (*it).event().end() ) { | 95 | } else if ( QDateTime::currentDateTime() <= (*it).event().end() ) { |
96 | count++; | 96 | count++; |
97 | // show only later appointments | 97 | // show only later appointments |
98 | DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes ); | 98 | DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes ); |
99 | m_eventsList.append( l ); | 99 | m_eventsList.append( l ); |
100 | l->show(); | 100 | l->show(); |
101 | QObject::connect ( l, SIGNAL( editEvent( const Event & ) ), l, SLOT( editEventSlot( const Event & ) ) ); | 101 | QObject::connect ( l, SIGNAL( editEvent( const Event & ) ), l, SLOT( editEventSlot( const Event & ) ) ); |
102 | } | 102 | } |
103 | } | 103 | } |
104 | } | 104 | } |
105 | if ( m_onlyLater && count == 0 ) { | 105 | if ( m_onlyLater && count == 0 ) { |
106 | QLabel* noMoreEvents = new QLabel( this ); | 106 | QLabel* noMoreEvents = new QLabel( this ); |
107 | m_eventsList.append( noMoreEvents ); | 107 | m_eventsList.append( noMoreEvents ); |
108 | noMoreEvents->show(); | 108 | noMoreEvents->show(); |
109 | noMoreEvents->setText( QObject::tr( "No more appointments today" ) ); | 109 | noMoreEvents->setText( QObject::tr( "No more appointments today" ) ); |
110 | } | 110 | } |
111 | } else { | 111 | } else { |
112 | QLabel* noEvents = new QLabel( this ); | 112 | QLabel* noEvents = new QLabel( this ); |
113 | m_eventsList.append( noEvents ); | 113 | m_eventsList.append( noEvents ); |
114 | noEvents->show(); | 114 | noEvents->show(); |
115 | noEvents->setText( QObject::tr( "No appointments today" ) ); | 115 | noEvents->setText( QObject::tr( "No appointments today" ) ); |
116 | } | 116 | } |
117 | } | 117 | } |
118 | 118 | ||
diff --git a/core/pim/today/plugins/todolist/todoplugin.h b/core/pim/today/plugins/todolist/todoplugin.h index 7a2235c..d7b51b4 100644 --- a/core/pim/today/plugins/todolist/todoplugin.h +++ b/core/pim/today/plugins/todolist/todoplugin.h | |||
@@ -1,50 +1,49 @@ | |||
1 | /* | 1 | /* |
2 | * todoplugin.h | 2 | * todoplugin.h |
3 | * | 3 | * |
4 | * copyright : (c) 2002 by Maximilian Reiß | 4 | * copyright : (c) 2002 by Maximilian Reiß |
5 | * email : harlekin@handhelds.org | 5 | * email : harlekin@handhelds.org |
6 | * | 6 | * |
7 | */ | 7 | */ |
8 | /*************************************************************************** | 8 | /*************************************************************************** |
9 | * * | 9 | * * |
10 | * This program is free software; you can redistribute it and/or modify * | 10 | * This program is free software; you can redistribute it and/or modify * |
11 | * it under the terms of the GNU General Public License as published by * | 11 | * it under the terms of the GNU General Public License as published by * |
12 | * the Free Software Foundation; either version 2 of the License, or * | 12 | * the Free Software Foundation; either version 2 of the License, or * |
13 | * (at your option) any later version. * | 13 | * (at your option) any later version. * |
14 | * * | 14 | * * |
15 | ***************************************************************************/ | 15 | ***************************************************************************/ |
16 | 16 | ||
17 | #ifndef TODOLIST_PLUGIN_H | 17 | #ifndef TODOLIST_PLUGIN_H |
18 | #define TODOLIST_PLUGIN_H | 18 | #define TODOLIST_PLUGIN_H |
19 | 19 | ||
20 | #include <qstring.h> | 20 | #include <qstring.h> |
21 | #include <qguardedptr.h> | 21 | #include <qguardedptr.h> |
22 | #include <qwidget.h> | 22 | #include <qwidget.h> |
23 | 23 | ||
24 | #include <opie/tododb.h> | ||
25 | #include <opie/oclickablelabel.h> | 24 | #include <opie/oclickablelabel.h> |
26 | #include <opie/todayplugininterface.h> | 25 | #include <opie/todayplugininterface.h> |
27 | 26 | ||
28 | #include "todopluginwidget.h" | 27 | #include "todopluginwidget.h" |
29 | 28 | ||
30 | class TodolistPlugin : public TodayPluginObject { | 29 | class TodolistPlugin : public TodayPluginObject { |
31 | 30 | ||
32 | public: | 31 | public: |
33 | TodolistPlugin(); | 32 | TodolistPlugin(); |
34 | ~TodolistPlugin(); | 33 | ~TodolistPlugin(); |
35 | 34 | ||
36 | QString pluginName() const; | 35 | QString pluginName() const; |
37 | double versionNumber() const; | 36 | double versionNumber() const; |
38 | QString pixmapNameWidget() const; | 37 | QString pixmapNameWidget() const; |
39 | QWidget* widget(QWidget *); | 38 | QWidget* widget(QWidget *); |
40 | QString pixmapNameConfig() const; | 39 | QString pixmapNameConfig() const; |
41 | TodayConfigWidget* configWidget(QWidget *); | 40 | TodayConfigWidget* configWidget(QWidget *); |
42 | QString appName() const; | 41 | QString appName() const; |
43 | bool excludeFromRefresh() const; | 42 | bool excludeFromRefresh() const; |
44 | void refresh(); | 43 | void refresh(); |
45 | 44 | ||
46 | private: | 45 | private: |
47 | QGuardedPtr<TodolistPluginWidget> m_widget; | 46 | QGuardedPtr<TodolistPluginWidget> m_widget; |
48 | }; | 47 | }; |
49 | 48 | ||
50 | #endif | 49 | #endif |
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp index 2497ee1..5e5d373 100644 --- a/core/pim/today/today.cpp +++ b/core/pim/today/today.cpp | |||
@@ -1,392 +1,384 @@ | |||
1 | /* | 1 | /* |
2 | * today.cpp | 2 | * today.cpp |
3 | * | 3 | * |
4 | * copyright : (c) 2002,2003 by Maximilian Reiß | 4 | * copyright : (c) 2002,2003 by Maximilian Reiß |
5 | * email : harlekin@handhelds.org | 5 | * email : harlekin@handhelds.org |
6 | * | 6 | * |
7 | */ | 7 | */ |
8 | /*************************************************************************** | 8 | /*************************************************************************** |
9 | * * | 9 | * * |
10 | * This program is free software; you can redistribute it and/or modify * | 10 | * This program is free software; you can redistribute it and/or modify * |
11 | * it under the terms of the GNU General Public License as published by * | 11 | * it under the terms of the GNU General Public License as published by * |
12 | * the Free Software Foundation; either version 2 of the License, or * | 12 | * the Free Software Foundation; either version 2 of the License, or * |
13 | * (at your option) any later version. * | 13 | * (at your option) any later version. * |
14 | * * | 14 | * * |
15 | ***************************************************************************/ | 15 | ***************************************************************************/ |
16 | 16 | ||
17 | 17 | ||
18 | 18 | ||
19 | #define QTOPIA_INTERNAL_LANGLIST | 19 | #define QTOPIA_INTERNAL_LANGLIST |
20 | 20 | ||
21 | #include "today.h" | 21 | #include "today.h" |
22 | #include <opie/todayconfigwidget.h> | ||
23 | 22 | ||
24 | #include <qpe/config.h> | 23 | #include <qpe/config.h> |
25 | #include <qpe/qcopenvelope_qws.h> | 24 | #include <qpe/qcopenvelope_qws.h> |
26 | #include <qpe/resource.h> | 25 | #include <qpe/resource.h> |
27 | #include <qpe/global.h> | 26 | #include <qpe/global.h> |
28 | #include <qpe/qpeapplication.h> | 27 | #include <qpe/qpeapplication.h> |
29 | #include <qpe/contact.h> | 28 | #include <qpe/contact.h> |
30 | 29 | ||
31 | #include <qdir.h> | 30 | #include <qdir.h> |
32 | #include <qfile.h> | 31 | #include <qfile.h> |
33 | #include <qpushbutton.h> | ||
34 | #include <qlabel.h> | ||
35 | #include <qtimer.h> | 32 | #include <qtimer.h> |
36 | #include <qpixmap.h> | ||
37 | #include <qlayout.h> | ||
38 | #include <qhbox.h> | ||
39 | #include <opie/otabwidget.h> | ||
40 | #include <qdialog.h> | ||
41 | #include <qwhatsthis.h> | 33 | #include <qwhatsthis.h> |
42 | #include <qtranslator.h> | 34 | #include <qtranslator.h> |
43 | 35 | ||
44 | struct TodayPlugin { | 36 | struct TodayPlugin { |
45 | TodayPlugin() : library( 0 ), iface( 0 ), guiPart( 0 ), guiBox( 0 ) {} | 37 | TodayPlugin() : library( 0 ), iface( 0 ), guiPart( 0 ), guiBox( 0 ) {} |
46 | QLibrary *library; | 38 | QLibrary *library; |
47 | QInterfacePtr<TodayPluginInterface> iface; | 39 | QInterfacePtr<TodayPluginInterface> iface; |
48 | TodayPluginObject *guiPart; | 40 | TodayPluginObject *guiPart; |
49 | QWidget *guiBox; | 41 | QWidget *guiBox; |
50 | QString name; | 42 | QString name; |
51 | bool active; | 43 | bool active; |
52 | bool excludeRefresh; | 44 | bool excludeRefresh; |
53 | int pos; | 45 | int pos; |
54 | }; | 46 | }; |
55 | 47 | ||
56 | static QValueList<TodayPlugin> pluginList; | 48 | static QValueList<TodayPlugin> pluginList; |
57 | 49 | ||
58 | Today::Today( QWidget* parent, const char* name, WFlags fl ) | 50 | Today::Today( QWidget* parent, const char* name, WFlags fl ) |
59 | : TodayBase( parent, name, fl ) { | 51 | : TodayBase( parent, name, fl ) { |
60 | 52 | ||
61 | QObject::connect( (QObject*)ConfigButton, SIGNAL( clicked() ), this, SLOT( startConfig() ) ); | 53 | QObject::connect( (QObject*)ConfigButton, SIGNAL( clicked() ), this, SLOT( startConfig() ) ); |
62 | QObject::connect( (QObject*)OwnerField, SIGNAL( clicked() ), this, SLOT( editCard() ) ); | 54 | QObject::connect( (QObject*)OwnerField, SIGNAL( clicked() ), this, SLOT( editCard() ) ); |
63 | 55 | ||
64 | #if defined(Q_WS_QWS) | 56 | #if defined(Q_WS_QWS) |
65 | #if !defined(QT_NO_COP) | 57 | #if !defined(QT_NO_COP) |
66 | QCopChannel *todayChannel = new QCopChannel( "QPE/Today" , this ); | 58 | QCopChannel *todayChannel = new QCopChannel( "QPE/Today" , this ); |
67 | connect ( todayChannel, SIGNAL( received( const QCString &, const QByteArray &) ), | 59 | connect ( todayChannel, SIGNAL( received( const QCString &, const QByteArray &) ), |
68 | this, SLOT ( channelReceived( const QCString &, const QByteArray &) ) ); | 60 | this, SLOT ( channelReceived( const QCString &, const QByteArray &) ) ); |
69 | #endif | 61 | #endif |
70 | #endif | 62 | #endif |
71 | 63 | ||
72 | setOwnerField(); | 64 | setOwnerField(); |
73 | m_refreshTimer = new QTimer( this ); | 65 | m_refreshTimer = new QTimer( this ); |
74 | connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); | 66 | connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); |
75 | m_refreshTimer->start( 15000 ); | 67 | m_refreshTimer->start( 15000 ); |
76 | //init(); | 68 | //init(); |
77 | loadPlugins(); | 69 | loadPlugins(); |
78 | showMaximized(); | 70 | showMaximized(); |
79 | } | 71 | } |
80 | 72 | ||
81 | /** | 73 | /** |
82 | * Qcop receive method. | 74 | * Qcop receive method. |
83 | */ | 75 | */ |
84 | void Today::channelReceived( const QCString &msg, const QByteArray & data ) { | 76 | void Today::channelReceived( const QCString &msg, const QByteArray & data ) { |
85 | QDataStream stream( data, IO_ReadOnly ); | 77 | QDataStream stream( data, IO_ReadOnly ); |
86 | if ( msg == "message(QString)" ) { | 78 | if ( msg == "message(QString)" ) { |
87 | QString message; | 79 | QString message; |
88 | stream >> message; | 80 | stream >> message; |
89 | setOwnerField( message ); | 81 | setOwnerField( message ); |
90 | } | 82 | } |
91 | } | 83 | } |
92 | 84 | ||
93 | void Today::setRefreshTimer( int interval ) { | 85 | void Today::setRefreshTimer( int interval ) { |
94 | 86 | ||
95 | disconnect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); | 87 | disconnect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); |
96 | 88 | ||
97 | // 0 is "never" case | 89 | // 0 is "never" case |
98 | if ( !interval == 0 ) { | 90 | if ( !interval == 0 ) { |
99 | connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); | 91 | connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); |
100 | m_refreshTimer->changeInterval( interval ); | 92 | m_refreshTimer->changeInterval( interval ); |
101 | } | 93 | } |
102 | } | 94 | } |
103 | 95 | ||
104 | 96 | ||
105 | /** | 97 | /** |
106 | * Initialises the owner field with the default value, the username | 98 | * Initialises the owner field with the default value, the username |
107 | */ | 99 | */ |
108 | void Today::setOwnerField() { | 100 | void Today::setOwnerField() { |
109 | QString file = Global::applicationFileName( "addressbook", "businesscard.vcf" ); | 101 | QString file = Global::applicationFileName( "addressbook", "businesscard.vcf" ); |
110 | if ( QFile::exists( file ) ) { | 102 | if ( QFile::exists( file ) ) { |
111 | Contact cont = Contact::readVCard( file )[0]; | 103 | Contact cont = Contact::readVCard( file )[0]; |
112 | QString returnString = cont.fullName(); | 104 | QString returnString = cont.fullName(); |
113 | OwnerField->setText( "<b>" + tr ( "Owned by " ) + returnString + "</b>" ); | 105 | OwnerField->setText( "<b>" + tr ( "Owned by " ) + returnString + "</b>" ); |
114 | } else { | 106 | } else { |
115 | OwnerField->setText( "<b>" + tr ( "Please fill out the business card" ) + " </b>" ); | 107 | OwnerField->setText( "<b>" + tr ( "Please fill out the business card" ) + " </b>" ); |
116 | } | 108 | } |
117 | } | 109 | } |
118 | 110 | ||
119 | /** | 111 | /** |
120 | * Set the owner field with a given QString, for example per qcop. | 112 | * Set the owner field with a given QString, for example per qcop. |
121 | */ | 113 | */ |
122 | void Today::setOwnerField( QString &message ) { | 114 | void Today::setOwnerField( QString &message ) { |
123 | if ( !message.isEmpty() ) { | 115 | if ( !message.isEmpty() ) { |
124 | OwnerField->setText( "<b>" + message + "</b>" ); | 116 | OwnerField->setText( "<b>" + message + "</b>" ); |
125 | } | 117 | } |
126 | } | 118 | } |
127 | 119 | ||
128 | /** | 120 | /** |
129 | * Init stuff needed for today. Reads the config file. | 121 | * Init stuff needed for today. Reads the config file. |
130 | */ | 122 | */ |
131 | void Today::init() { | 123 | void Today::init() { |
132 | // read config | 124 | // read config |
133 | Config cfg( "today" ); | 125 | Config cfg( "today" ); |
134 | 126 | ||
135 | cfg.setGroup( "Plugins" ); | 127 | cfg.setGroup( "Plugins" ); |
136 | m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' ); | 128 | m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' ); |
137 | m_allApplets = cfg.readListEntry( "AllApplets", ',' ); | 129 | m_allApplets = cfg.readListEntry( "AllApplets", ',' ); |
138 | 130 | ||
139 | cfg.setGroup( "General" ); | 131 | cfg.setGroup( "General" ); |
140 | m_iconSize = cfg.readNumEntry( "IconSize", 18 ); | 132 | m_iconSize = cfg.readNumEntry( "IconSize", 18 ); |
141 | setRefreshTimer( cfg.readNumEntry( "checkinterval", 15000 ) ); | 133 | setRefreshTimer( cfg.readNumEntry( "checkinterval", 15000 ) ); |
142 | 134 | ||
143 | // set the date in top label | 135 | // set the date in top label |
144 | QDate date = QDate::currentDate(); | 136 | QDate date = QDate::currentDate(); |
145 | QString time = ( tr( date.toString() ) ); | 137 | QString time = ( tr( date.toString() ) ); |
146 | DateLabel->setText( QString( "<font color=#FFFFFF>" + time + "</font>" ) ); | 138 | DateLabel->setText( QString( "<font color=#FFFFFF>" + time + "</font>" ) ); |
147 | 139 | ||
148 | if ( layout ) { | 140 | if ( layout ) { |
149 | delete layout; | 141 | delete layout; |
150 | } | 142 | } |
151 | layout = new QVBoxLayout( this ); | 143 | layout = new QVBoxLayout( this ); |
152 | layout->addWidget( Frame ); | 144 | layout->addWidget( Frame ); |
153 | layout->addWidget( OwnerField ); | 145 | layout->addWidget( OwnerField ); |
154 | } | 146 | } |
155 | 147 | ||
156 | /** | 148 | /** |
157 | * Load the plugins | 149 | * Load the plugins |
158 | */ | 150 | */ |
159 | void Today::loadPlugins() { | 151 | void Today::loadPlugins() { |
160 | 152 | ||
161 | init(); | 153 | init(); |
162 | QValueList<TodayPlugin>::Iterator tit; | 154 | QValueList<TodayPlugin>::Iterator tit; |
163 | if ( !pluginList.isEmpty() ) { | 155 | if ( !pluginList.isEmpty() ) { |
164 | for ( tit = pluginList.begin(); tit != pluginList.end(); ++tit ) { | 156 | for ( tit = pluginList.begin(); tit != pluginList.end(); ++tit ) { |
165 | (*tit).guiBox->hide(); | 157 | (*tit).guiBox->hide(); |
166 | (*tit).guiBox->reparent( 0, QPoint( 0, 0 ) ); | 158 | (*tit).guiBox->reparent( 0, QPoint( 0, 0 ) ); |
167 | delete (*tit).guiBox; | 159 | delete (*tit).guiBox; |
168 | (*tit).library->unload(); | 160 | (*tit).library->unload(); |
169 | delete (*tit).library; | 161 | delete (*tit).library; |
170 | } | 162 | } |
171 | pluginList.clear(); | 163 | pluginList.clear(); |
172 | } | 164 | } |
173 | 165 | ||
174 | QString path = QPEApplication::qpeDir() + "/plugins/today"; | 166 | QString path = QPEApplication::qpeDir() + "/plugins/today"; |
175 | QDir dir( path, "lib*.so" ); | 167 | QDir dir( path, "lib*.so" ); |
176 | 168 | ||
177 | QStringList list = dir.entryList(); | 169 | QStringList list = dir.entryList(); |
178 | QStringList::Iterator it; | 170 | QStringList::Iterator it; |
179 | 171 | ||
180 | QMap<QString, TodayPlugin> tempList; | 172 | QMap<QString, TodayPlugin> tempList; |
181 | 173 | ||
182 | for ( it = list.begin(); it != list.end(); ++it ) { | 174 | for ( it = list.begin(); it != list.end(); ++it ) { |
183 | QInterfacePtr<TodayPluginInterface> iface; | 175 | QInterfacePtr<TodayPluginInterface> iface; |
184 | QLibrary *lib = new QLibrary( path + "/" + *it ); | 176 | QLibrary *lib = new QLibrary( path + "/" + *it ); |
185 | 177 | ||
186 | qDebug( "querying: %s", QString( path + "/" + *it ).latin1() ); | 178 | qDebug( "querying: %s", QString( path + "/" + *it ).latin1() ); |
187 | if ( lib->queryInterface( IID_TodayPluginInterface, (QUnknownInterface**)&iface ) == QS_OK ) { | 179 | if ( lib->queryInterface( IID_TodayPluginInterface, (QUnknownInterface**)&iface ) == QS_OK ) { |
188 | qDebug( "accepted: %s", QString( path + "/" + *it ).latin1() ); | 180 | qDebug( "accepted: %s", QString( path + "/" + *it ).latin1() ); |
189 | qDebug( QString(*it) ); | 181 | qDebug( QString(*it) ); |
190 | 182 | ||
191 | TodayPlugin plugin; | 183 | TodayPlugin plugin; |
192 | plugin.library = lib; | 184 | plugin.library = lib; |
193 | plugin.iface = iface; | 185 | plugin.iface = iface; |
194 | plugin.name = QString(*it); | 186 | plugin.name = QString(*it); |
195 | 187 | ||
196 | QString type = (*it).left( (*it).find(".") ); | 188 | QString type = (*it).left( (*it).find(".") ); |
197 | QStringList langs = Global::languageList(); | 189 | QStringList langs = Global::languageList(); |
198 | for (QStringList::ConstIterator lit = langs.begin(); lit!=langs.end(); ++lit) { | 190 | for (QStringList::ConstIterator lit = langs.begin(); lit!=langs.end(); ++lit) { |
199 | QString lang = *lit; | 191 | QString lang = *lit; |
200 | qDebug( "Languages: " + lang ); | 192 | qDebug( "Languages: " + lang ); |
201 | QTranslator * trans = new QTranslator( qApp ); | 193 | QTranslator * trans = new QTranslator( qApp ); |
202 | QString tfn = QPEApplication::qpeDir()+"/i18n/" + lang + "/" + type + ".qm"; | 194 | QString tfn = QPEApplication::qpeDir()+"/i18n/" + lang + "/" + type + ".qm"; |
203 | if ( trans->load( tfn ) ) { | 195 | if ( trans->load( tfn ) ) { |
204 | qApp->installTranslator( trans ); | 196 | qApp->installTranslator( trans ); |
205 | } else { | 197 | } else { |
206 | delete trans; | 198 | delete trans; |
207 | } | 199 | } |
208 | } | 200 | } |
209 | 201 | ||
210 | // find out if plugins should be shown | 202 | // find out if plugins should be shown |
211 | if ( m_excludeApplets.grep( *it ).isEmpty() ) { | 203 | if ( m_excludeApplets.grep( *it ).isEmpty() ) { |
212 | plugin.active = true; | 204 | plugin.active = true; |
213 | } else { | 205 | } else { |
214 | plugin.active = false; | 206 | plugin.active = false; |
215 | } | 207 | } |
216 | 208 | ||
217 | plugin.guiPart = plugin.iface->guiPart(); | 209 | plugin.guiPart = plugin.iface->guiPart(); |
218 | plugin.excludeRefresh = plugin.guiPart->excludeFromRefresh(); | 210 | plugin.excludeRefresh = plugin.guiPart->excludeFromRefresh(); |
219 | 211 | ||
220 | // package the whole thing into a qwidget so it can be shown and hidden | 212 | // package the whole thing into a qwidget so it can be shown and hidden |
221 | plugin.guiBox = new QWidget( this ); | 213 | plugin.guiBox = new QWidget( this ); |
222 | QHBoxLayout *boxLayout = new QHBoxLayout( plugin.guiBox ); | 214 | QHBoxLayout *boxLayout = new QHBoxLayout( plugin.guiBox ); |
223 | QPixmap plugPix; | 215 | QPixmap plugPix; |
224 | plugPix.convertFromImage( Resource::loadImage( plugin.guiPart->pixmapNameWidget() ).smoothScale( m_iconSize, m_iconSize ), 0 ); | 216 | plugPix.convertFromImage( Resource::loadImage( plugin.guiPart->pixmapNameWidget() ).smoothScale( m_iconSize, m_iconSize ), 0 ); |
225 | OClickableLabel* plugIcon = new OClickableLabel( plugin.guiBox ); | 217 | OClickableLabel* plugIcon = new OClickableLabel( plugin.guiBox ); |
226 | plugIcon->setPixmap( plugPix ); | 218 | plugIcon->setPixmap( plugPix ); |
227 | QWhatsThis::add( plugIcon, tr("Click here to launch the associated app") ); | 219 | QWhatsThis::add( plugIcon, tr("Click here to launch the associated app") ); |
228 | plugIcon->setName( plugin.guiPart->appName() ); | 220 | plugIcon->setName( plugin.guiPart->appName() ); |
229 | connect( plugIcon, SIGNAL( clicked() ), this, SLOT( startApplication() ) ); | 221 | connect( plugIcon, SIGNAL( clicked() ), this, SLOT( startApplication() ) ); |
230 | // a scrollview for each plugin | 222 | // a scrollview for each plugin |
231 | QScrollView* sv = new QScrollView( plugin.guiBox ); | 223 | QScrollView* sv = new QScrollView( plugin.guiBox ); |
232 | QWidget *plugWidget = plugin.guiPart->widget( sv->viewport() ); | 224 | QWidget *plugWidget = plugin.guiPart->widget( sv->viewport() ); |
233 | // not sure if that is good .-) | 225 | // not sure if that is good .-) |
234 | sv->setMinimumHeight( 12 ); | 226 | sv->setMinimumHeight( 12 ); |
235 | sv->setResizePolicy( QScrollView::AutoOneFit ); | 227 | sv->setResizePolicy( QScrollView::AutoOneFit ); |
236 | sv->setHScrollBarMode( QScrollView::AlwaysOff ); | 228 | sv->setHScrollBarMode( QScrollView::AlwaysOff ); |
237 | sv->setFrameShape( QFrame::NoFrame ); | 229 | sv->setFrameShape( QFrame::NoFrame ); |
238 | sv->addChild( plugWidget ); | 230 | sv->addChild( plugWidget ); |
239 | // make sure the icon is on the top alligned | 231 | // make sure the icon is on the top alligned |
240 | boxLayout->addWidget( plugIcon, 0, AlignTop ); | 232 | boxLayout->addWidget( plugIcon, 0, AlignTop ); |
241 | boxLayout->addWidget( sv, 0, AlignTop ); | 233 | boxLayout->addWidget( sv, 0, AlignTop ); |
242 | boxLayout->setStretchFactor( plugIcon, 1 ); | 234 | boxLayout->setStretchFactor( plugIcon, 1 ); |
243 | boxLayout->setStretchFactor( sv, 9 ); | 235 | boxLayout->setStretchFactor( sv, 9 ); |
244 | // "prebuffer" it in one more list, to get the sorting done | 236 | // "prebuffer" it in one more list, to get the sorting done |
245 | tempList.insert( plugin.name, plugin ); | 237 | tempList.insert( plugin.name, plugin ); |
246 | 238 | ||
247 | // on first start the list is off course empty | 239 | // on first start the list is off course empty |
248 | if ( m_allApplets.isEmpty() ) { | 240 | if ( m_allApplets.isEmpty() ) { |
249 | layout->addWidget( plugin.guiBox ); | 241 | layout->addWidget( plugin.guiBox ); |
250 | pluginList.append( plugin ); | 242 | pluginList.append( plugin ); |
251 | } | 243 | } |
252 | 244 | ||
253 | // if plugin is not yet in the list, add it to the layout too | 245 | // if plugin is not yet in the list, add it to the layout too |
254 | else if ( !m_allApplets.contains( plugin.name ) ) { | 246 | else if ( !m_allApplets.contains( plugin.name ) ) { |
255 | layout->addWidget( plugin.guiBox ); | 247 | layout->addWidget( plugin.guiBox ); |
256 | pluginList.append( plugin ); | 248 | pluginList.append( plugin ); |
257 | } | 249 | } |
258 | } else { | 250 | } else { |
259 | qDebug( "could not recognize %s", QString( path + "/" + *it ).latin1() ); | 251 | qDebug( "could not recognize %s", QString( path + "/" + *it ).latin1() ); |
260 | delete lib; | 252 | delete lib; |
261 | } | 253 | } |
262 | } | 254 | } |
263 | 255 | ||
264 | if ( !m_allApplets.isEmpty() ) { | 256 | if ( !m_allApplets.isEmpty() ) { |
265 | TodayPlugin tempPlugin; | 257 | TodayPlugin tempPlugin; |
266 | QStringList::Iterator stringit; | 258 | QStringList::Iterator stringit; |
267 | 259 | ||
268 | for( stringit = m_allApplets.begin(); stringit != m_allApplets.end(); ++stringit ) { | 260 | for( stringit = m_allApplets.begin(); stringit != m_allApplets.end(); ++stringit ) { |
269 | tempPlugin = ( tempList.find( *stringit ) ).data(); | 261 | tempPlugin = ( tempList.find( *stringit ) ).data(); |
270 | if ( !( (tempPlugin.name).isEmpty() ) ) { | 262 | if ( !( (tempPlugin.name).isEmpty() ) ) { |
271 | layout->addWidget( tempPlugin.guiBox ); | 263 | layout->addWidget( tempPlugin.guiBox ); |
272 | pluginList.append( tempPlugin ); | 264 | pluginList.append( tempPlugin ); |
273 | } | 265 | } |
274 | } | 266 | } |
275 | } | 267 | } |
276 | draw(); | 268 | draw(); |
277 | } | 269 | } |
278 | 270 | ||
279 | 271 | ||
280 | /** | 272 | /** |
281 | * Repaint method. Reread all fields. | 273 | * Repaint method. Reread all fields. |
282 | */ | 274 | */ |
283 | void Today::draw() { | 275 | void Today::draw() { |
284 | 276 | ||
285 | if ( pluginList.count() == 0 ) { | 277 | if ( pluginList.count() == 0 ) { |
286 | QLabel *noPlugins = new QLabel( this ); | 278 | QLabel *noPlugins = new QLabel( this ); |
287 | noPlugins->setText( tr( "No plugins found" ) ); | 279 | noPlugins->setText( tr( "No plugins found" ) ); |
288 | layout->addWidget( noPlugins ); | 280 | layout->addWidget( noPlugins ); |
289 | return; | 281 | return; |
290 | } | 282 | } |
291 | 283 | ||
292 | uint count = 0; | 284 | uint count = 0; |
293 | TodayPlugin plugin; | 285 | TodayPlugin plugin; |
294 | for ( uint i = 0; i < pluginList.count(); i++ ) { | 286 | for ( uint i = 0; i < pluginList.count(); i++ ) { |
295 | plugin = pluginList[i]; | 287 | plugin = pluginList[i]; |
296 | 288 | ||
297 | if ( plugin.active ) { | 289 | if ( plugin.active ) { |
298 | // qDebug( plugin.name + " is ACTIVE " ); | 290 | // qDebug( plugin.name + " is ACTIVE " ); |
299 | plugin.guiBox->show(); | 291 | plugin.guiBox->show(); |
300 | } else { | 292 | } else { |
301 | // qDebug( plugin.name + " is INACTIVE" ); | 293 | // qDebug( plugin.name + " is INACTIVE" ); |
302 | plugin.guiBox->hide(); | 294 | plugin.guiBox->hide(); |
303 | } | 295 | } |
304 | count++; | 296 | count++; |
305 | } | 297 | } |
306 | 298 | ||
307 | if ( count == 0 ) { | 299 | if ( count == 0 ) { |
308 | QLabel *noPluginsActive = new QLabel( this ); | 300 | QLabel *noPluginsActive = new QLabel( this ); |
309 | noPluginsActive->setText( tr( "No plugins activated" ) ); | 301 | noPluginsActive->setText( tr( "No plugins activated" ) ); |
310 | layout->addWidget( noPluginsActive ); | 302 | layout->addWidget( noPluginsActive ); |
311 | } | 303 | } |
312 | layout->addStretch(0); | 304 | layout->addStretch(0); |
313 | } | 305 | } |
314 | 306 | ||
315 | 307 | ||
316 | /** | 308 | /** |
317 | * The method for the configuration dialog. | 309 | * The method for the configuration dialog. |
318 | */ | 310 | */ |
319 | void Today::startConfig() { | 311 | void Today::startConfig() { |
320 | 312 | ||
321 | // disconnect timer to prevent problems while being on config dialog | 313 | // disconnect timer to prevent problems while being on config dialog |
322 | disconnect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); | 314 | disconnect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); |
323 | m_refreshTimer->stop( ); | 315 | m_refreshTimer->stop( ); |
324 | 316 | ||
325 | TodayConfig conf( this, "dialog", true ); | 317 | TodayConfig conf( this, "dialog", true ); |
326 | 318 | ||
327 | TodayPlugin plugin; | 319 | TodayPlugin plugin; |
328 | QList<TodayConfigWidget> configWidgetList; | 320 | QList<TodayConfigWidget> configWidgetList; |
329 | 321 | ||
330 | for ( int i = pluginList.count() - 1 ; i >= 0; i-- ) { | 322 | for ( int i = pluginList.count() - 1 ; i >= 0; i-- ) { |
331 | plugin = pluginList[i]; | 323 | plugin = pluginList[i]; |
332 | 324 | ||
333 | // load the config widgets in the tabs | 325 | // load the config widgets in the tabs |
334 | if ( plugin.guiPart->configWidget( this ) != 0l ) { | 326 | if ( plugin.guiPart->configWidget( this ) != 0l ) { |
335 | TodayConfigWidget* widget = plugin.guiPart->configWidget( conf.TabWidget3 ); | 327 | TodayConfigWidget* widget = plugin.guiPart->configWidget( conf.TabWidget3 ); |
336 | configWidgetList.append( widget ); | 328 | configWidgetList.append( widget ); |
337 | conf.TabWidget3->addTab( widget, plugin.guiPart->pixmapNameConfig() | 329 | conf.TabWidget3->addTab( widget, plugin.guiPart->pixmapNameConfig() |
338 | , plugin.guiPart->appName() ); | 330 | , plugin.guiPart->appName() ); |
339 | } | 331 | } |
340 | // set the order/activate tab | 332 | // set the order/activate tab |
341 | conf.pluginManagement( plugin.name, plugin.guiPart->pluginName(), | 333 | conf.pluginManagement( plugin.name, plugin.guiPart->pluginName(), |
342 | Resource::loadPixmap( plugin.guiPart->pixmapNameWidget() ) ); | 334 | Resource::loadPixmap( plugin.guiPart->pixmapNameWidget() ) ); |
343 | } | 335 | } |
344 | 336 | ||
345 | if ( conf.exec() == QDialog::Accepted ) { | 337 | if ( conf.exec() == QDialog::Accepted ) { |
346 | conf.writeConfig(); | 338 | conf.writeConfig(); |
347 | TodayConfigWidget *confWidget; | 339 | TodayConfigWidget *confWidget; |
348 | for ( confWidget = configWidgetList.first(); confWidget != 0; | 340 | for ( confWidget = configWidgetList.first(); confWidget != 0; |
349 | confWidget = configWidgetList.next() ) { | 341 | confWidget = configWidgetList.next() ) { |
350 | confWidget->writeConfig(); | 342 | confWidget->writeConfig(); |
351 | } | 343 | } |
352 | loadPlugins(); | 344 | loadPlugins(); |
353 | } else { | 345 | } else { |
354 | // since refresh is not called in that case , reconnect the signal | 346 | // since refresh is not called in that case , reconnect the signal |
355 | m_refreshTimer->start( 15000 ); // get the config value in here later | 347 | m_refreshTimer->start( 15000 ); // get the config value in here later |
356 | connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); | 348 | connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); |
357 | } | 349 | } |
358 | } | 350 | } |
359 | 351 | ||
360 | 352 | ||
361 | /** | 353 | /** |
362 | * Refresh for the view. Reload all applets | 354 | * Refresh for the view. Reload all applets |
363 | * | 355 | * |
364 | */ | 356 | */ |
365 | void Today::refresh() { | 357 | void Today::refresh() { |
366 | 358 | ||
367 | init(); | 359 | init(); |
368 | 360 | ||
369 | QValueList<TodayPlugin>::Iterator it; | 361 | QValueList<TodayPlugin>::Iterator it; |
370 | for ( it = pluginList.begin(); it != pluginList.end(); ++it ) { | 362 | for ( it = pluginList.begin(); it != pluginList.end(); ++it ) { |
371 | if ( !(*it).excludeRefresh ) { | 363 | if ( !(*it).excludeRefresh ) { |
372 | (*it).guiPart->refresh(); | 364 | (*it).guiPart->refresh(); |
373 | qDebug( "refresh" ); | 365 | qDebug( "refresh" ); |
374 | } | 366 | } |
375 | } | 367 | } |
376 | } | 368 | } |
377 | 369 | ||
378 | void Today::startApplication() { | 370 | void Today::startApplication() { |
379 | QCopEnvelope e( "QPE/System", "execute(QString)" ); | 371 | QCopEnvelope e( "QPE/System", "execute(QString)" ); |
380 | e << QString( sender()->name() ); | 372 | e << QString( sender()->name() ); |
381 | } | 373 | } |
382 | 374 | ||
383 | /** | 375 | /** |
384 | * launch addressbook (personal card) | 376 | * launch addressbook (personal card) |
385 | */ | 377 | */ |
386 | void Today::editCard() { | 378 | void Today::editCard() { |
387 | QCopEnvelope env( "QPE/Application/addressbook", "editPersonalAndClose()" ); | 379 | QCopEnvelope env( "QPE/Application/addressbook", "editPersonalAndClose()" ); |
388 | } | 380 | } |
389 | 381 | ||
390 | Today::~Today() { | 382 | Today::~Today() { |
391 | } | 383 | } |
392 | 384 | ||
diff --git a/core/pim/today/today.h b/core/pim/today/today.h index 24f5611..3802feb 100644 --- a/core/pim/today/today.h +++ b/core/pim/today/today.h | |||
@@ -1,76 +1,71 @@ | |||
1 | /* | 1 | /* |
2 | * today.h | 2 | * today.h |
3 | * | 3 | * |
4 | * copyright : (c) 2002,2003 by Maximilian Reiß | 4 | * copyright : (c) 2002,2003 by Maximilian Reiß |
5 | * email : harlekin@handhelds.org | 5 | * email : harlekin@handhelds.org |
6 | * | 6 | * |
7 | */ | 7 | */ |
8 | /*************************************************************************** | 8 | /*************************************************************************** |
9 | * * | 9 | * * |
10 | * This program is free software; you can redistribute it and/or modify * | 10 | * This program is free software; you can redistribute it and/or modify * |
11 | * it under the terms of the GNU General Public License as published by * | 11 | * it under the terms of the GNU General Public License as published by * |
12 | * the Free Software Foundation; either version 2 of the License, or * | 12 | * the Free Software Foundation; either version 2 of the License, or * |
13 | * (at your option) any later version. * | 13 | * (at your option) any later version. * |
14 | * * | 14 | * * |
15 | ***************************************************************************/ | 15 | ***************************************************************************/ |
16 | 16 | ||
17 | 17 | ||
18 | #ifndef TODAY_H | 18 | #ifndef TODAY_H |
19 | #define TODAY_H | 19 | #define TODAY_H |
20 | 20 | ||
21 | #include <opie/tododb.h> | ||
22 | |||
23 | #include <qdatetime.h> | ||
24 | #include <qlist.h> | ||
25 | #include <qhbox.h> | ||
26 | 21 | ||
27 | #include <qpe/qlibrary.h> | 22 | #include <qpe/qlibrary.h> |
28 | #include <qpe/event.h> | ||
29 | 23 | ||
30 | #include "todayconfig.h" | 24 | #include "todayconfig.h" |
31 | #include "todaybase.h" | 25 | #include "todaybase.h" |
26 | |||
32 | #include <opie/todayplugininterface.h> | 27 | #include <opie/todayplugininterface.h> |
33 | 28 | ||
34 | class QVBoxLayout; | 29 | class QVBoxLayout; |
35 | class OClickableLabel; | 30 | class OClickableLabel; |
36 | 31 | ||
37 | 32 | ||
38 | class Today : public TodayBase { | 33 | class Today : public TodayBase { |
39 | 34 | ||
40 | Q_OBJECT | 35 | Q_OBJECT |
41 | 36 | ||
42 | public: | 37 | public: |
43 | Today( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | 38 | Today( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); |
44 | ~Today(); | 39 | ~Today(); |
45 | 40 | ||
46 | private slots: | 41 | private slots: |
47 | void startConfig(); | 42 | void startConfig(); |
48 | void startApplication(); | 43 | void startApplication(); |
49 | void editCard(); | 44 | void editCard(); |
50 | void refresh(); | 45 | void refresh(); |
51 | 46 | ||
52 | private: | 47 | private: |
53 | void init(); | 48 | void init(); |
54 | void setOwnerField(); | 49 | void setOwnerField(); |
55 | void setOwnerField(QString &string); | 50 | void setOwnerField(QString &string); |
56 | void loadPlugins(); | 51 | void loadPlugins(); |
57 | void draw(); | 52 | void draw(); |
58 | void setRefreshTimer( int ); | 53 | void setRefreshTimer( int ); |
59 | 54 | ||
60 | private slots: | 55 | private slots: |
61 | void channelReceived(const QCString &msg, const QByteArray & data); | 56 | void channelReceived(const QCString &msg, const QByteArray & data); |
62 | 57 | ||
63 | private: | 58 | private: |
64 | TodayConfig *conf; | 59 | TodayConfig *conf; |
65 | QStringList m_excludeApplets; | 60 | QStringList m_excludeApplets; |
66 | QStringList m_allApplets; | 61 | QStringList m_allApplets; |
67 | 62 | ||
68 | QTimer *m_refreshTimer; | 63 | QTimer *m_refreshTimer; |
69 | 64 | ||
70 | bool m_refreshTimerEnabled; | 65 | bool m_refreshTimerEnabled; |
71 | int m_newStart; | 66 | int m_newStart; |
72 | int m_iconSize; | 67 | int m_iconSize; |
73 | int m_maxCharClip; | 68 | int m_maxCharClip; |
74 | }; | 69 | }; |
75 | 70 | ||
76 | #endif | 71 | #endif |
diff --git a/core/pim/today/todaybase.cpp b/core/pim/today/todaybase.cpp index 9a93b56..826e253 100644 --- a/core/pim/today/todaybase.cpp +++ b/core/pim/today/todaybase.cpp | |||
@@ -1,106 +1,105 @@ | |||
1 | /* | 1 | /* |
2 | * todaybase.cpp | 2 | * todaybase.cpp |
3 | * | 3 | * |
4 | * copyright : (c) 2002 by Maximilian Reiß | 4 | * copyright : (c) 2002 by Maximilian Reiß |
5 | * email : harlekin@handhelds.org | 5 | * email : harlekin@handhelds.org |
6 | * | 6 | * |
7 | */ | 7 | */ |
8 | /*************************************************************************** | 8 | /*************************************************************************** |
9 | * * | 9 | * * |
10 | * This program is free software; you can redistribute it and/or modify * | 10 | * This program is free software; you can redistribute it and/or modify * |
11 | * it under the terms of the GNU General Public License as published by * | 11 | * it under the terms of the GNU General Public License as published by * |
12 | * the Free Software Foundation; either version 2 of the License, or * | 12 | * the Free Software Foundation; either version 2 of the License, or * |
13 | * (at your option) any later version. * | 13 | * (at your option) any later version. * |
14 | * * | 14 | * * |
15 | ***************************************************************************/ | 15 | ***************************************************************************/ |
16 | 16 | ||
17 | #include "todaybase.h" | 17 | #include "todaybase.h" |
18 | 18 | ||
19 | #include <qframe.h> | ||
20 | #include <qlabel.h> | 19 | #include <qlabel.h> |
21 | #include <qimage.h> | 20 | #include <qimage.h> |
22 | #include <qpixmap.h> | 21 | #include <qpixmap.h> |
23 | #include <qapplication.h> | 22 | #include <qapplication.h> |
24 | #include <qwhatsthis.h> | 23 | #include <qwhatsthis.h> |
25 | 24 | ||
26 | #include <qpe/resource.h> | 25 | #include <qpe/resource.h> |
27 | 26 | ||
28 | 27 | ||
29 | TodayBase::TodayBase( QWidget* parent, const char* name, WFlags ) | 28 | TodayBase::TodayBase( QWidget* parent, const char* name, WFlags ) |
30 | : QWidget( parent, name, WStyle_ContextHelp ) { | 29 | : QWidget( parent, name, WStyle_ContextHelp ) { |
31 | 30 | ||
32 | QPixmap logo = Resource::loadPixmap( "today/today_logo"); // logo | 31 | QPixmap logo = Resource::loadPixmap( "today/today_logo"); // logo |
33 | QPixmap opiezilla = Resource::loadPixmap("today/opiezilla" ); //the opiezilla | 32 | QPixmap opiezilla = Resource::loadPixmap("today/opiezilla" ); //the opiezilla |
34 | QPixmap config = Resource::loadPixmap( "today/config" ); // config icon | 33 | QPixmap config = Resource::loadPixmap( "today/config" ); // config icon |
35 | 34 | ||
36 | layout = new QVBoxLayout( this ); | 35 | layout = new QVBoxLayout( this ); |
37 | 36 | ||
38 | QPalette pal = this->palette(); | 37 | QPalette pal = this->palette(); |
39 | QColor col = pal.color( QPalette::Active, QColorGroup::Background ); | 38 | QColor col = pal.color( QPalette::Active, QColorGroup::Background ); |
40 | pal.setColor( QPalette::Active, QColorGroup::Button, col ); | 39 | pal.setColor( QPalette::Active, QColorGroup::Button, col ); |
41 | pal.setColor( QPalette::Inactive, QColorGroup::Button, col ); | 40 | pal.setColor( QPalette::Inactive, QColorGroup::Button, col ); |
42 | pal.setColor( QPalette::Normal, QColorGroup::Button, col ); | 41 | pal.setColor( QPalette::Normal, QColorGroup::Button, col ); |
43 | pal.setColor( QPalette::Disabled, QColorGroup::Button, col ); | 42 | pal.setColor( QPalette::Disabled, QColorGroup::Button, col ); |
44 | this->setPalette( pal ); | 43 | this->setPalette( pal ); |
45 | 44 | ||
46 | // --- logo Section --- | 45 | // --- logo Section --- |
47 | QPalette pal2; | 46 | QPalette pal2; |
48 | QColorGroup cg; | 47 | QColorGroup cg; |
49 | cg.setColor( QColorGroup::Text, white ); | 48 | cg.setColor( QColorGroup::Text, white ); |
50 | cg.setBrush( QColorGroup::Background, QBrush( QColor( 238, 238, 230 ), logo ) ); | 49 | cg.setBrush( QColorGroup::Background, QBrush( QColor( 238, 238, 230 ), logo ) ); |
51 | pal2.setActive( cg ); | 50 | pal2.setActive( cg ); |
52 | // today logo | 51 | // today logo |
53 | Frame = new QLabel( this, "Frame" ); | 52 | Frame = new QLabel( this, "Frame" ); |
54 | Frame->setPalette( pal2 ); | 53 | Frame->setPalette( pal2 ); |
55 | Frame->setFrameShape( QFrame::StyledPanel ); | 54 | Frame->setFrameShape( QFrame::StyledPanel ); |
56 | Frame->setFrameShadow( QFrame::Raised ); | 55 | Frame->setFrameShadow( QFrame::Raised ); |
57 | Frame->setLineWidth( 0 ); | 56 | Frame->setLineWidth( 0 ); |
58 | Frame->setMaximumHeight( 50 ); | 57 | Frame->setMaximumHeight( 50 ); |
59 | Frame->setMinimumHeight( 50 ); | 58 | Frame->setMinimumHeight( 50 ); |
60 | 59 | ||
61 | // Today text | 60 | // Today text |
62 | QLabel* TodayLabel = new QLabel( Frame, "TodayText" ); | 61 | QLabel* TodayLabel = new QLabel( Frame, "TodayText" ); |
63 | TodayLabel->setGeometry( QRect( 10, 1, 168, 40 ) ); | 62 | TodayLabel->setGeometry( QRect( 10, 1, 168, 40 ) ); |
64 | QFont TodayLabel_font( TodayLabel->font() ); | 63 | QFont TodayLabel_font( TodayLabel->font() ); |
65 | TodayLabel_font.setBold( TRUE ); | 64 | TodayLabel_font.setBold( TRUE ); |
66 | TodayLabel_font.setPointSize( 40 ); | 65 | TodayLabel_font.setPointSize( 40 ); |
67 | TodayLabel->setFont( TodayLabel_font ); | 66 | TodayLabel->setFont( TodayLabel_font ); |
68 | TodayLabel->setBackgroundOrigin( QLabel::ParentOrigin ); | 67 | TodayLabel->setBackgroundOrigin( QLabel::ParentOrigin ); |
69 | TodayLabel->setText( "<font color=#FFFFFF>" + tr("Today") +"</font>" ); | 68 | TodayLabel->setText( "<font color=#FFFFFF>" + tr("Today") +"</font>" ); |
70 | 69 | ||
71 | // date | 70 | // date |
72 | DateLabel = new QLabel( Frame, "TextLabel1" ); | 71 | DateLabel = new QLabel( Frame, "TextLabel1" ); |
73 | DateLabel->setGeometry( QRect( 10, 35, 168, 12 ) ); | 72 | DateLabel->setGeometry( QRect( 10, 35, 168, 12 ) ); |
74 | QFont DateLabel_font( DateLabel->font() ); | 73 | QFont DateLabel_font( DateLabel->font() ); |
75 | DateLabel_font.setBold( TRUE ); | 74 | DateLabel_font.setBold( TRUE ); |
76 | DateLabel->setFont( DateLabel_font ); | 75 | DateLabel->setFont( DateLabel_font ); |
77 | DateLabel->setBackgroundOrigin( QLabel::ParentOrigin ); | 76 | DateLabel->setBackgroundOrigin( QLabel::ParentOrigin ); |
78 | DateLabel->setTextFormat( RichText ); | 77 | DateLabel->setTextFormat( RichText ); |
79 | 78 | ||
80 | // Opiezilla | 79 | // Opiezilla |
81 | QLabel* Opiezilla = new QLabel( Frame, "OpieZilla" ); | 80 | QLabel* Opiezilla = new QLabel( Frame, "OpieZilla" ); |
82 | Opiezilla->setPixmap( opiezilla ); | 81 | Opiezilla->setPixmap( opiezilla ); |
83 | Opiezilla->setGeometry( QApplication::desktop()->width()-50 ,1, 45, 47 ); | 82 | Opiezilla->setGeometry( QApplication::desktop()->width()-50 ,1, 45, 47 ); |
84 | QWhatsThis::add( Opiezilla , tr( "Today by Maximilian Reiß" ) ); | 83 | QWhatsThis::add( Opiezilla , tr( "Today by Maximilian Reiß" ) ); |
85 | Opiezilla->setBackgroundOrigin( QLabel::ParentOrigin ); | 84 | Opiezilla->setBackgroundOrigin( QLabel::ParentOrigin ); |
86 | 85 | ||
87 | // Ownerfield | 86 | // Ownerfield |
88 | OwnerField = new OClickableLabel( this , "Owner" ); | 87 | OwnerField = new OClickableLabel( this , "Owner" ); |
89 | OwnerField->setGeometry( QRect( 0, 0, this->width(), 12 ) ); | 88 | OwnerField->setGeometry( QRect( 0, 0, this->width(), 12 ) ); |
90 | OwnerField->setAlignment( int (QLabel::AlignTop | QLabel::AlignLeft ) ); | 89 | OwnerField->setAlignment( int (QLabel::AlignTop | QLabel::AlignLeft ) ); |
91 | OwnerField->setMaximumHeight(12); | 90 | OwnerField->setMaximumHeight(12); |
92 | 91 | ||
93 | // config | 92 | // config |
94 | ConfigButton = new OClickableLabel ( Frame, "PushButton1" ); | 93 | ConfigButton = new OClickableLabel ( Frame, "PushButton1" ); |
95 | ConfigButton->setGeometry( QRect( QApplication::desktop()->width()-80, 29, 25, 20 ) ); | 94 | ConfigButton->setGeometry( QRect( QApplication::desktop()->width()-80, 29, 25, 20 ) ); |
96 | ConfigButton->setPixmap( config ); | 95 | ConfigButton->setPixmap( config ); |
97 | QWhatsThis::add( ConfigButton, tr( "Click here to get to the config dialog" ) ); | 96 | QWhatsThis::add( ConfigButton, tr( "Click here to get to the config dialog" ) ); |
98 | ConfigButton->setBackgroundOrigin( QLabel::ParentOrigin ); | 97 | ConfigButton->setBackgroundOrigin( QLabel::ParentOrigin ); |
99 | } | 98 | } |
100 | 99 | ||
101 | /** | 100 | /** |
102 | * D' tor | 101 | * D' tor |
103 | */ | 102 | */ |
104 | TodayBase::~TodayBase() { | 103 | TodayBase::~TodayBase() { |
105 | } | 104 | } |
106 | 105 | ||