-rw-r--r-- | core/pim/today/changelog | 5 | ||||
-rw-r--r-- | core/pim/today/today.cpp | 7 |
2 files changed, 10 insertions, 2 deletions
diff --git a/core/pim/today/changelog b/core/pim/today/changelog index ba3cdbc..ea618c8 100644 --- a/core/pim/today/changelog +++ b/core/pim/today/changelog | |||
@@ -1,116 +1,121 @@ | |||
1 | 0.6.1 | ||
2 | |||
3 | * datebook plugin now can now also show following days | ||
4 | * fixed one mem leak | ||
5 | |||
1 | 0.6 | 6 | 0.6 |
2 | 7 | ||
3 | * longer refresh intervals possible | 8 | * longer refresh intervals possible |
4 | * plugins can decide now if they want to take part in refresh cycles | 9 | * plugins can decide now if they want to take part in refresh cycles |
5 | 10 | ||
6 | 0.5.2 | 11 | 0.5.2 |
7 | 12 | ||
8 | * refresh settings | 13 | * refresh settings |
9 | * only launch datebook config when clicked on a date ( opie only ) | 14 | * only launch datebook config when clicked on a date ( opie only ) |
10 | * less qcop trouble on sharps retail rom | 15 | * less qcop trouble on sharps retail rom |
11 | 16 | ||
12 | 0.5.1 | 17 | 0.5.1 |
13 | 18 | ||
14 | * icons scalable and clickable again | 19 | * icons scalable and clickable again |
15 | 20 | ||
16 | 0.5 | 21 | 0.5 |
17 | 22 | ||
18 | * now fully plugin based | 23 | * now fully plugin based |
19 | 24 | ||
20 | 0.3.4 | 25 | 0.3.4 |
21 | 26 | ||
22 | * "fill our business card now a clickable label" | 27 | * "fill our business card now a clickable label" |
23 | * Several bugfixes regarding todo section. | 28 | * Several bugfixes regarding todo section. |
24 | 29 | ||
25 | 0.3.3 | 30 | 0.3.3 |
26 | 31 | ||
27 | * Changed the logo so it better scales to bigger display and also | 32 | * Changed the logo so it better scales to bigger display and also |
28 | made the "Today" string translatable. | 33 | made the "Today" string translatable. |
29 | * some am/pm fixes | 34 | * some am/pm fixes |
30 | * clickable labels now in libopie | 35 | * clickable labels now in libopie |
31 | 36 | ||
32 | 0.3.2 | 37 | 0.3.2 |
33 | 38 | ||
34 | * Autostart is now more configurable. You can decide how long | 39 | * Autostart is now more configurable. You can decide how long |
35 | the ipaq has to has been suspended, before autostart is triggered.(Opie | 40 | the ipaq has to has been suspended, before autostart is triggered.(Opie |
36 | only) | 41 | only) |
37 | * am/pm time optinal (autodetect) | 42 | * am/pm time optinal (autodetect) |
38 | 43 | ||
39 | 0.3.1 | 44 | 0.3.1 |
40 | 45 | ||
41 | * fixed the wrong color of the buttons | 46 | * fixed the wrong color of the buttons |
42 | * better translation (thanks carsten and others) | 47 | * better translation (thanks carsten and others) |
43 | * fixes memory leaks | 48 | * fixes memory leaks |
44 | * bugfixes in calendar part, now location and note are working again. | 49 | * bugfixes in calendar part, now location and note are working again. |
45 | 50 | ||
46 | 0.3.0 | 51 | 0.3.0 |
47 | 52 | ||
48 | * today uses now tododb from libopie. So major changes in the todo part: | 53 | * today uses now tododb from libopie. So major changes in the todo part: |
49 | - overdue items on top | 54 | - overdue items on top |
50 | - then sorted by date, then by priority | 55 | - then sorted by date, then by priority |
51 | * some cleanups | 56 | * some cleanups |
52 | * speed optimisations | 57 | * speed optimisations |
53 | 58 | ||
54 | 0.2.9 | 59 | 0.2.9 |
55 | 60 | ||
56 | * Many bugfixes. | 61 | * Many bugfixes. |
57 | * Today now apparently sorts the dates _allways_ right, i would assume it | 62 | * Today now apparently sorts the dates _allways_ right, i would assume it |
58 | to be a qt bug | 63 | to be a qt bug |
59 | 64 | ||
60 | 0.2.8 | 65 | 0.2.8 |
61 | 66 | ||
62 | * Appointments are now clickable (connection to datebook still missing) | 67 | * Appointments are now clickable (connection to datebook still missing) |
63 | * autostart support (opie only) | 68 | * autostart support (opie only) |
64 | 69 | ||
65 | 0.2.7 | 70 | 0.2.7 |
66 | 71 | ||
67 | * check if todolist.xml was changed before parsing it | 72 | * check if todolist.xml was changed before parsing it |
68 | * check only every 30 sec for changes. | 73 | * check only every 30 sec for changes. |
69 | * some visual stuff | 74 | * some visual stuff |
70 | * as usual many little improvements .-) | 75 | * as usual many little improvements .-) |
71 | 76 | ||
72 | 0.2.6 | 77 | 0.2.6 |
73 | 78 | ||
74 | * added scrollbars to dates and todo | 79 | * added scrollbars to dates and todo |
75 | * all day detection | 80 | * all day detection |
76 | * some smaller bugfixes | 81 | * some smaller bugfixes |
77 | 82 | ||
78 | 0.2.5 | 83 | 0.2.5 |
79 | 84 | ||
80 | * some other minor fixes regarding autoupdate | 85 | * some other minor fixes regarding autoupdate |
81 | * fixed segfault with todolist > 7 entries | 86 | * fixed segfault with todolist > 7 entries |
82 | * fixed the "ugly grey border around buttons" issue | 87 | * fixed the "ugly grey border around buttons" issue |
83 | * fixed the "empty calendar field" "bug" | 88 | * fixed the "empty calendar field" "bug" |
84 | * shown only later appointments as option | 89 | * shown only later appointments as option |
85 | 90 | ||
86 | 91 | ||
87 | 0.2.4 | 92 | 0.2.4 |
88 | 93 | ||
89 | * added support for email | 94 | * added support for email |
90 | * autoupdates after 1 min | 95 | * autoupdates after 1 min |
91 | * QCopEnvelope instead of system() | 96 | * QCopEnvelope instead of system() |
92 | * starting to use qvbox in gui | 97 | * starting to use qvbox in gui |
93 | 98 | ||
94 | 99 | ||
95 | 0.2.3 | 100 | 0.2.3 |
96 | 101 | ||
97 | * the 4 am release | 102 | * the 4 am release |
98 | * several bugfixes | 103 | * several bugfixes |
99 | 104 | ||
100 | 105 | ||
101 | 0.2.2 | 106 | 0.2.2 |
102 | 107 | ||
103 | * started working on calling other apps | 108 | * started working on calling other apps |
104 | * and finished it | 109 | * and finished it |
105 | 110 | ||
106 | 0.2.1 | 111 | 0.2.1 |
107 | 112 | ||
108 | * images no more inline | 113 | * images no more inline |
109 | * config dialog | 114 | * config dialog |
110 | 115 | ||
111 | 0.1.1 | 116 | 0.1.1 |
112 | 117 | ||
113 | * started changelog. | 118 | * started changelog. |
114 | * fixed segfault on empty/nonexistant todolist.xml | 119 | * fixed segfault on empty/nonexistant todolist.xml |
115 | * better handling for file location | 120 | * better handling for file location |
116 | 121 | ||
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp index 76bd6de..91028c8 100644 --- a/core/pim/today/today.cpp +++ b/core/pim/today/today.cpp | |||
@@ -1,371 +1,374 @@ | |||
1 | /* | 1 | /* |
2 | * today.cpp | 2 | * today.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 "today.h" | 18 | #include "today.h" |
19 | #include <opie/todayconfigwidget.h> | 19 | #include <opie/todayconfigwidget.h> |
20 | 20 | ||
21 | #include <qpe/config.h> | 21 | #include <qpe/config.h> |
22 | #include <qpe/qcopenvelope_qws.h> | 22 | #include <qpe/qcopenvelope_qws.h> |
23 | #include <qpe/resource.h> | 23 | #include <qpe/resource.h> |
24 | #include <qpe/global.h> | 24 | #include <qpe/global.h> |
25 | #include <qpe/qpeapplication.h> | 25 | #include <qpe/qpeapplication.h> |
26 | #include <qpe/contact.h> | 26 | #include <qpe/contact.h> |
27 | 27 | ||
28 | #include <qdir.h> | 28 | #include <qdir.h> |
29 | #include <qfile.h> | 29 | #include <qfile.h> |
30 | #include <qpushbutton.h> | 30 | #include <qpushbutton.h> |
31 | #include <qlabel.h> | 31 | #include <qlabel.h> |
32 | #include <qtimer.h> | 32 | #include <qtimer.h> |
33 | #include <qpixmap.h> | 33 | #include <qpixmap.h> |
34 | #include <qlayout.h> | 34 | #include <qlayout.h> |
35 | #include <qhbox.h> | 35 | #include <qhbox.h> |
36 | #include <opie/otabwidget.h> | 36 | #include <opie/otabwidget.h> |
37 | #include <qdialog.h> | 37 | #include <qdialog.h> |
38 | #include <qwhatsthis.h> | 38 | #include <qwhatsthis.h> |
39 | 39 | ||
40 | 40 | ||
41 | struct TodayPlugin { | 41 | struct TodayPlugin { |
42 | TodayPlugin() : library( 0 ), iface( 0 ), guiPart( 0 ), guiBox( 0 ) {} | 42 | TodayPlugin() : library( 0 ), iface( 0 ), guiPart( 0 ), guiBox( 0 ) {} |
43 | QLibrary *library; | 43 | QLibrary *library; |
44 | QInterfacePtr<TodayPluginInterface> iface; | 44 | QInterfacePtr<TodayPluginInterface> iface; |
45 | TodayPluginObject *guiPart; | 45 | TodayPluginObject *guiPart; |
46 | QWidget *guiBox; | 46 | QWidget *guiBox; |
47 | QString name; | 47 | QString name; |
48 | bool active; | 48 | bool active; |
49 | bool excludeRefresh; | 49 | bool excludeRefresh; |
50 | int pos; | 50 | int pos; |
51 | }; | 51 | }; |
52 | 52 | ||
53 | static QValueList<TodayPlugin> pluginList; | 53 | static QValueList<TodayPlugin> pluginList; |
54 | 54 | ||
55 | Today::Today( QWidget* parent, const char* name, WFlags fl ) | 55 | Today::Today( QWidget* parent, const char* name, WFlags fl ) |
56 | : TodayBase( parent, name, fl ) { | 56 | : TodayBase( parent, name, fl ) { |
57 | 57 | ||
58 | QObject::connect( (QObject*)ConfigButton, SIGNAL( clicked() ), this, SLOT( startConfig() ) ); | 58 | QObject::connect( (QObject*)ConfigButton, SIGNAL( clicked() ), this, SLOT( startConfig() ) ); |
59 | QObject::connect( (QObject*)OwnerField, SIGNAL( clicked() ), this, SLOT( editCard() ) ); | 59 | QObject::connect( (QObject*)OwnerField, SIGNAL( clicked() ), this, SLOT( editCard() ) ); |
60 | 60 | ||
61 | #if defined(Q_WS_QWS) | 61 | #if defined(Q_WS_QWS) |
62 | #if !defined(QT_NO_COP) | 62 | #if !defined(QT_NO_COP) |
63 | QCopChannel *todayChannel = new QCopChannel( "QPE/Today" , this ); | 63 | QCopChannel *todayChannel = new QCopChannel( "QPE/Today" , this ); |
64 | connect ( todayChannel, SIGNAL( received( const QCString &, const QByteArray &) ), | 64 | connect ( todayChannel, SIGNAL( received( const QCString &, const QByteArray &) ), |
65 | this, SLOT ( channelReceived( const QCString &, const QByteArray &) ) ); | 65 | this, SLOT ( channelReceived( const QCString &, const QByteArray &) ) ); |
66 | #endif | 66 | #endif |
67 | #endif | 67 | #endif |
68 | 68 | ||
69 | setOwnerField(); | 69 | setOwnerField(); |
70 | m_refreshTimer = new QTimer( this ); | 70 | m_refreshTimer = new QTimer( this ); |
71 | connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); | 71 | connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); |
72 | m_refreshTimer->start( 15000 ); | 72 | m_refreshTimer->start( 15000 ); |
73 | refresh(); | 73 | refresh(); |
74 | showMaximized(); | 74 | showMaximized(); |
75 | } | 75 | } |
76 | 76 | ||
77 | /** | 77 | /** |
78 | * Qcop receive method. | 78 | * Qcop receive method. |
79 | */ | 79 | */ |
80 | void Today::channelReceived( const QCString &msg, const QByteArray & data ) { | 80 | void Today::channelReceived( const QCString &msg, const QByteArray & data ) { |
81 | QDataStream stream( data, IO_ReadOnly ); | 81 | QDataStream stream( data, IO_ReadOnly ); |
82 | if ( msg == "message(QString)" ) { | 82 | if ( msg == "message(QString)" ) { |
83 | QString message; | 83 | QString message; |
84 | stream >> message; | 84 | stream >> message; |
85 | setOwnerField( message ); | 85 | setOwnerField( message ); |
86 | } | 86 | } |
87 | } | 87 | } |
88 | 88 | ||
89 | void Today::setRefreshTimer( int interval ) { | 89 | void Today::setRefreshTimer( int interval ) { |
90 | 90 | ||
91 | disconnect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); | 91 | disconnect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); |
92 | 92 | ||
93 | // 0 is "never" case | 93 | // 0 is "never" case |
94 | if ( !interval == 0 ) { | 94 | if ( !interval == 0 ) { |
95 | connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); | 95 | connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); |
96 | m_refreshTimer->changeInterval( interval ); | 96 | m_refreshTimer->changeInterval( interval ); |
97 | } | 97 | } |
98 | } | 98 | } |
99 | 99 | ||
100 | 100 | ||
101 | /** | 101 | /** |
102 | * Initialises the owner field with the default value, the username | 102 | * Initialises the owner field with the default value, the username |
103 | */ | 103 | */ |
104 | void Today::setOwnerField() { | 104 | void Today::setOwnerField() { |
105 | QString file = Global::applicationFileName( "addressbook", "businesscard.vcf" ); | 105 | QString file = Global::applicationFileName( "addressbook", "businesscard.vcf" ); |
106 | if ( QFile::exists( file ) ) { | 106 | if ( QFile::exists( file ) ) { |
107 | Contact cont = Contact::readVCard( file )[0]; | 107 | Contact cont = Contact::readVCard( file )[0]; |
108 | QString returnString = cont.fullName(); | 108 | QString returnString = cont.fullName(); |
109 | OwnerField->setText( "<b>" + tr ( "Owned by " ) + returnString + "</b>" ); | 109 | OwnerField->setText( "<b>" + tr ( "Owned by " ) + returnString + "</b>" ); |
110 | } else { | 110 | } else { |
111 | OwnerField->setText( "<b>" + tr ( "Please fill out the business card" ) + " </b>" ); | 111 | OwnerField->setText( "<b>" + tr ( "Please fill out the business card" ) + " </b>" ); |
112 | } | 112 | } |
113 | } | 113 | } |
114 | 114 | ||
115 | /** | 115 | /** |
116 | * Set the owner field with a given QString, for example per qcop. | 116 | * Set the owner field with a given QString, for example per qcop. |
117 | */ | 117 | */ |
118 | void Today::setOwnerField( QString &message ) { | 118 | void Today::setOwnerField( QString &message ) { |
119 | if ( !message.isEmpty() ) { | 119 | if ( !message.isEmpty() ) { |
120 | OwnerField->setText( "<b>" + message + "</b>" ); | 120 | OwnerField->setText( "<b>" + message + "</b>" ); |
121 | } | 121 | } |
122 | } | 122 | } |
123 | 123 | ||
124 | 124 | ||
125 | /** | 125 | /** |
126 | * Init stuff needed for today. Reads the config file. | 126 | * Init stuff needed for today. Reads the config file. |
127 | */ | 127 | */ |
128 | void Today::init() { | 128 | void Today::init() { |
129 | // read config | 129 | // read config |
130 | Config cfg( "today" ); | 130 | Config cfg( "today" ); |
131 | 131 | ||
132 | cfg.setGroup( "Plugins" ); | 132 | cfg.setGroup( "Plugins" ); |
133 | m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' ); | 133 | m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' ); |
134 | m_allApplets = cfg.readListEntry( "AllApplets", ',' ); | 134 | m_allApplets = cfg.readListEntry( "AllApplets", ',' ); |
135 | 135 | ||
136 | cfg.setGroup( "General" ); | 136 | cfg.setGroup( "General" ); |
137 | m_iconSize = cfg.readNumEntry( "IconSize", 18 ); | 137 | m_iconSize = cfg.readNumEntry( "IconSize", 18 ); |
138 | setRefreshTimer( cfg.readNumEntry( "checkinterval", 15000 ) ); | 138 | setRefreshTimer( cfg.readNumEntry( "checkinterval", 15000 ) ); |
139 | } | 139 | } |
140 | 140 | ||
141 | 141 | ||
142 | /** | 142 | /** |
143 | * Load the plugins | 143 | * Load the plugins |
144 | */ | 144 | */ |
145 | void Today::loadPlugins() { | 145 | void Today::loadPlugins() { |
146 | 146 | ||
147 | // extra list for plugins that exclude themself from periodic refresh | 147 | // extra list for plugins that exclude themself from periodic refresh |
148 | QMap<QString, TodayPlugin> pluginListRefreshExclude; | 148 | QMap<QString, TodayPlugin> pluginListRefreshExclude; |
149 | 149 | ||
150 | QValueList<TodayPlugin>::Iterator tit; | 150 | QValueList<TodayPlugin>::Iterator tit; |
151 | if ( !pluginList.isEmpty() ) { | 151 | if ( !pluginList.isEmpty() ) { |
152 | for ( tit = pluginList.begin(); tit != pluginList.end(); ++tit ) { | 152 | for ( tit = pluginList.begin(); tit != pluginList.end(); ++tit ) { |
153 | if ( (*tit).excludeRefresh ) { | 153 | if ( (*tit).excludeRefresh ) { |
154 | pluginListRefreshExclude.insert( (*tit).name , (*tit) ); | 154 | pluginListRefreshExclude.insert( (*tit).name , (*tit) ); |
155 | qDebug( "Found an plugin that does not want refresh feature" ); | 155 | qDebug( "Found a plugin that does not want refresh feature" ); |
156 | } else { | 156 | } else { |
157 | (*tit).guiBox->hide(); | ||
158 | (*tit).guiBox->reparent( 0, QPoint( 0, 0 ) ); | ||
157 | (*tit).library->unload(); | 159 | (*tit).library->unload(); |
160 | delete (*tit).guiBox; | ||
158 | delete (*tit).library; | 161 | delete (*tit).library; |
159 | } | 162 | } |
160 | } | 163 | } |
161 | pluginList.clear(); | 164 | pluginList.clear(); |
162 | } | 165 | } |
163 | 166 | ||
164 | QString path = QPEApplication::qpeDir() + "/plugins/today"; | 167 | QString path = QPEApplication::qpeDir() + "/plugins/today"; |
165 | QDir dir( path, "lib*.so" ); | 168 | QDir dir( path, "lib*.so" ); |
166 | 169 | ||
167 | QStringList list = dir.entryList(); | 170 | QStringList list = dir.entryList(); |
168 | QStringList::Iterator it; | 171 | QStringList::Iterator it; |
169 | 172 | ||
170 | QMap<QString, TodayPlugin> tempList; | 173 | QMap<QString, TodayPlugin> tempList; |
171 | 174 | ||
172 | for ( it = list.begin(); it != list.end(); ++it ) { | 175 | for ( it = list.begin(); it != list.end(); ++it ) { |
173 | //TodayPluginInterface *iface = 0; | 176 | //TodayPluginInterface *iface = 0; |
174 | QInterfacePtr<TodayPluginInterface> iface; | 177 | QInterfacePtr<TodayPluginInterface> iface; |
175 | QLibrary *lib = new QLibrary( path + "/" + *it ); | 178 | QLibrary *lib = new QLibrary( path + "/" + *it ); |
176 | 179 | ||
177 | qDebug( "querying: %s", QString( path + "/" + *it ).latin1() ); | 180 | qDebug( "querying: %s", QString( path + "/" + *it ).latin1() ); |
178 | if ( lib->queryInterface( IID_TodayPluginInterface, (QUnknownInterface**)&iface ) == QS_OK ) { | 181 | if ( lib->queryInterface( IID_TodayPluginInterface, (QUnknownInterface**)&iface ) == QS_OK ) { |
179 | qDebug( "loading: %s", QString( path + "/" + *it ).latin1() ); | 182 | qDebug( "accepted: %s", QString( path + "/" + *it ).latin1() ); |
180 | qDebug( QString(*it) ); | 183 | qDebug( QString(*it) ); |
181 | 184 | ||
182 | // If plugin is exludes from refresh, get it in the list again here. | 185 | // If plugin is exludes from refresh, get it in the list again here. |
183 | 186 | ||
184 | if ( pluginListRefreshExclude.contains( (*it) ) ) { | 187 | if ( pluginListRefreshExclude.contains( (*it) ) ) { |
185 | // if its not in allApplets list, add it to a layout | 188 | // if its not in allApplets list, add it to a layout |
186 | if ( !m_allApplets.contains( pluginListRefreshExclude[(*it)].name ) ) { | 189 | if ( !m_allApplets.contains( pluginListRefreshExclude[(*it)].name ) ) { |
187 | layout->addWidget( pluginListRefreshExclude[(*it)].guiBox ); | 190 | layout->addWidget( pluginListRefreshExclude[(*it)].guiBox ); |
188 | pluginList.append( pluginListRefreshExclude[(*it)] ); | 191 | pluginList.append( pluginListRefreshExclude[(*it)] ); |
189 | } else { | 192 | } else { |
190 | tempList.insert( pluginListRefreshExclude[(*it)].name, pluginListRefreshExclude[(*it)] ); | 193 | tempList.insert( pluginListRefreshExclude[(*it)].name, pluginListRefreshExclude[(*it)] ); |
191 | } | 194 | } |
192 | } else { | 195 | } else { |
193 | 196 | ||
194 | TodayPlugin plugin; | 197 | TodayPlugin plugin; |
195 | plugin.library = lib; | 198 | plugin.library = lib; |
196 | plugin.iface = iface; | 199 | plugin.iface = iface; |
197 | plugin.name = QString(*it); | 200 | plugin.name = QString(*it); |
198 | 201 | ||
199 | // find out if plugins should be shown | 202 | // find out if plugins should be shown |
200 | if ( m_excludeApplets.grep( *it ).isEmpty() ) { | 203 | if ( m_excludeApplets.grep( *it ).isEmpty() ) { |
201 | plugin.active = true; | 204 | plugin.active = true; |
202 | } else { | 205 | } else { |
203 | plugin.active = false; | 206 | plugin.active = false; |
204 | } | 207 | } |
205 | 208 | ||
206 | plugin.guiPart = plugin.iface->guiPart(); | 209 | plugin.guiPart = plugin.iface->guiPart(); |
207 | plugin.excludeRefresh = plugin.guiPart->excludeFromRefresh(); | 210 | plugin.excludeRefresh = plugin.guiPart->excludeFromRefresh(); |
208 | 211 | ||
209 | // 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 |
210 | plugin.guiBox = new QWidget( this ); | 213 | plugin.guiBox = new QWidget( this ); |
211 | QHBoxLayout *boxLayout = new QHBoxLayout( plugin.guiBox ); | 214 | QHBoxLayout *boxLayout = new QHBoxLayout( plugin.guiBox ); |
212 | QPixmap plugPix; | 215 | QPixmap plugPix; |
213 | 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 ); |
214 | OClickableLabel* plugIcon = new OClickableLabel( plugin.guiBox ); | 217 | OClickableLabel* plugIcon = new OClickableLabel( plugin.guiBox ); |
215 | plugIcon->setPixmap( plugPix ); | 218 | plugIcon->setPixmap( plugPix ); |
216 | QWhatsThis::add( plugIcon, tr("Click here to launch the associated app") ); | 219 | QWhatsThis::add( plugIcon, tr("Click here to launch the associated app") ); |
217 | plugIcon->setName( plugin.guiPart->appName() ); | 220 | plugIcon->setName( plugin.guiPart->appName() ); |
218 | connect( plugIcon, SIGNAL( clicked() ), this, SLOT( startApplication() ) ); | 221 | connect( plugIcon, SIGNAL( clicked() ), this, SLOT( startApplication() ) ); |
219 | // a scrollview for each plugin | 222 | // a scrollview for each plugin |
220 | QScrollView* sv = new QScrollView( plugin.guiBox ); | 223 | QScrollView* sv = new QScrollView( plugin.guiBox ); |
221 | QWidget *plugWidget = plugin.guiPart->widget( sv->viewport() ); | 224 | QWidget *plugWidget = plugin.guiPart->widget( sv->viewport() ); |
222 | // not sure if that is good .-) | 225 | // not sure if that is good .-) |
223 | sv->setMinimumHeight( 10 ); | 226 | sv->setMinimumHeight( 10 ); |
224 | sv->setResizePolicy( QScrollView::AutoOneFit ); | 227 | sv->setResizePolicy( QScrollView::AutoOneFit ); |
225 | sv->setHScrollBarMode( QScrollView::AlwaysOff ); | 228 | sv->setHScrollBarMode( QScrollView::AlwaysOff ); |
226 | sv->setFrameShape( QFrame::NoFrame ); | 229 | sv->setFrameShape( QFrame::NoFrame ); |
227 | sv->addChild( plugWidget ); | 230 | sv->addChild( plugWidget ); |
228 | // make sure the icon is on the top alligned | 231 | // make sure the icon is on the top alligned |
229 | boxLayout->addWidget( plugIcon, 0, AlignTop ); | 232 | boxLayout->addWidget( plugIcon, 0, AlignTop ); |
230 | boxLayout->addWidget( sv, 0, AlignTop ); | 233 | boxLayout->addWidget( sv, 0, AlignTop ); |
231 | boxLayout->setStretchFactor( plugIcon, 1 ); | 234 | boxLayout->setStretchFactor( plugIcon, 1 ); |
232 | boxLayout->setStretchFactor( sv, 9 ); | 235 | boxLayout->setStretchFactor( sv, 9 ); |
233 | // "prebuffer" it in one more list, to get the sorting done | 236 | // "prebuffer" it in one more list, to get the sorting done |
234 | tempList.insert( plugin.name, plugin ); | 237 | tempList.insert( plugin.name, plugin ); |
235 | 238 | ||
236 | // on first start the list is off course empty | 239 | // on first start the list is off course empty |
237 | if ( m_allApplets.isEmpty() ) { | 240 | if ( m_allApplets.isEmpty() ) { |
238 | layout->addWidget( plugin.guiBox ); | 241 | layout->addWidget( plugin.guiBox ); |
239 | pluginList.append( plugin ); | 242 | pluginList.append( plugin ); |
240 | } | 243 | } |
241 | 244 | ||
242 | // 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 |
243 | else if ( !m_allApplets.contains( plugin.name ) ) { | 246 | else if ( !m_allApplets.contains( plugin.name ) ) { |
244 | layout->addWidget( plugin.guiBox ); | 247 | layout->addWidget( plugin.guiBox ); |
245 | pluginList.append( plugin ); | 248 | pluginList.append( plugin ); |
246 | } | 249 | } |
247 | } | 250 | } |
248 | } else { | 251 | } else { |
249 | qDebug( "could not recognize %s", QString( path + "/" + *it ).latin1() ); | 252 | qDebug( "could not recognize %s", QString( path + "/" + *it ).latin1() ); |
250 | delete lib; | 253 | delete lib; |
251 | } | 254 | } |
252 | } | 255 | } |
253 | 256 | ||
254 | if ( !m_allApplets.isEmpty() ) { | 257 | if ( !m_allApplets.isEmpty() ) { |
255 | TodayPlugin tempPlugin; | 258 | TodayPlugin tempPlugin; |
256 | QStringList::Iterator stringit; | 259 | QStringList::Iterator stringit; |
257 | 260 | ||
258 | for( stringit = m_allApplets.begin(); stringit != m_allApplets.end(); ++stringit ) { | 261 | for( stringit = m_allApplets.begin(); stringit != m_allApplets.end(); ++stringit ) { |
259 | tempPlugin = ( tempList.find( *stringit ) ).data(); | 262 | tempPlugin = ( tempList.find( *stringit ) ).data(); |
260 | if ( !( (tempPlugin.name).isEmpty() ) ) { | 263 | if ( !( (tempPlugin.name).isEmpty() ) ) { |
261 | layout->addWidget( tempPlugin.guiBox ); | 264 | layout->addWidget( tempPlugin.guiBox ); |
262 | pluginList.append( tempPlugin ); | 265 | pluginList.append( tempPlugin ); |
263 | } | 266 | } |
264 | } | 267 | } |
265 | } | 268 | } |
266 | } | 269 | } |
267 | 270 | ||
268 | 271 | ||
269 | /** | 272 | /** |
270 | * Repaint method. Reread all fields. | 273 | * Repaint method. Reread all fields. |
271 | */ | 274 | */ |
272 | void Today::draw() { | 275 | void Today::draw() { |
273 | 276 | ||
274 | if ( pluginList.count() == 0 ) { | 277 | if ( pluginList.count() == 0 ) { |
275 | QLabel *noPlugins = new QLabel( this ); | 278 | QLabel *noPlugins = new QLabel( this ); |
276 | noPlugins->setText( tr( "No plugins found" ) ); | 279 | noPlugins->setText( tr( "No plugins found" ) ); |
277 | layout->addWidget( noPlugins ); | 280 | layout->addWidget( noPlugins ); |
278 | return; | 281 | return; |
279 | } | 282 | } |
280 | 283 | ||
281 | uint count = 0; | 284 | uint count = 0; |
282 | TodayPlugin plugin; | 285 | TodayPlugin plugin; |
283 | for ( uint i = 0; i < pluginList.count(); i++ ) { | 286 | for ( uint i = 0; i < pluginList.count(); i++ ) { |
284 | plugin = pluginList[i]; | 287 | plugin = pluginList[i]; |
285 | 288 | ||
286 | if ( plugin.active ) { | 289 | if ( plugin.active ) { |
287 | // qDebug( plugin.name + " is ACTIVE " ); | 290 | // qDebug( plugin.name + " is ACTIVE " ); |
288 | plugin.guiBox->show(); | 291 | plugin.guiBox->show(); |
289 | } else { | 292 | } else { |
290 | // qDebug( plugin.name + " is INACTIVE" ); | 293 | // qDebug( plugin.name + " is INACTIVE" ); |
291 | plugin.guiBox->hide(); | 294 | plugin.guiBox->hide(); |
292 | } | 295 | } |
293 | count++; | 296 | count++; |
294 | } | 297 | } |
295 | 298 | ||
296 | if ( count == 0 ) { | 299 | if ( count == 0 ) { |
297 | QLabel *noPluginsActive = new QLabel( this ); | 300 | QLabel *noPluginsActive = new QLabel( this ); |
298 | noPluginsActive->setText( tr( "No plugins activated" ) ); | 301 | noPluginsActive->setText( tr( "No plugins activated" ) ); |
299 | layout->addWidget( noPluginsActive ); | 302 | layout->addWidget( noPluginsActive ); |
300 | } | 303 | } |
301 | layout->addStretch(0); | 304 | layout->addStretch(0); |
302 | } | 305 | } |
303 | 306 | ||
304 | 307 | ||
305 | /** | 308 | /** |
306 | * The method for the configuration dialog. | 309 | * The method for the configuration dialog. |
307 | */ | 310 | */ |
308 | void Today::startConfig() { | 311 | void Today::startConfig() { |
309 | 312 | ||
310 | // disconnect timer to prevent problems while being on config dialog | 313 | // disconnect timer to prevent problems while being on config dialog |
311 | disconnect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); | 314 | disconnect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); |
312 | 315 | ||
313 | TodayConfig conf( this, "dialog", true ); | 316 | TodayConfig conf( this, "dialog", true ); |
314 | 317 | ||
315 | TodayPlugin plugin; | 318 | TodayPlugin plugin; |
316 | QList<TodayConfigWidget> configWidgetList; | 319 | QList<TodayConfigWidget> configWidgetList; |
317 | 320 | ||
318 | for ( int i = pluginList.count() - 1 ; i >= 0; i-- ) { | 321 | for ( int i = pluginList.count() - 1 ; i >= 0; i-- ) { |
319 | plugin = pluginList[i]; | 322 | plugin = pluginList[i]; |
320 | 323 | ||
321 | // load the config widgets in the tabs | 324 | // load the config widgets in the tabs |
322 | if ( plugin.guiPart->configWidget( this ) != 0l ) { | 325 | if ( plugin.guiPart->configWidget( this ) != 0l ) { |
323 | TodayConfigWidget* widget = plugin.guiPart->configWidget( conf.TabWidget3 ); | 326 | TodayConfigWidget* widget = plugin.guiPart->configWidget( conf.TabWidget3 ); |
324 | configWidgetList.append( widget ); | 327 | configWidgetList.append( widget ); |
325 | conf.TabWidget3->addTab( widget, plugin.guiPart->pixmapNameConfig() | 328 | conf.TabWidget3->addTab( widget, plugin.guiPart->pixmapNameConfig() |
326 | , plugin.guiPart->appName() ); | 329 | , plugin.guiPart->appName() ); |
327 | } | 330 | } |
328 | // set the order/activate tab | 331 | // set the order/activate tab |
329 | conf.pluginManagement( plugin.name, plugin.guiPart->pluginName(), | 332 | conf.pluginManagement( plugin.name, plugin.guiPart->pluginName(), |
330 | Resource::loadPixmap( plugin.guiPart->pixmapNameWidget() ) ); | 333 | Resource::loadPixmap( plugin.guiPart->pixmapNameWidget() ) ); |
331 | } | 334 | } |
332 | 335 | ||
333 | if ( conf.exec() == QDialog::Accepted ) { | 336 | if ( conf.exec() == QDialog::Accepted ) { |
334 | conf.writeConfig(); | 337 | conf.writeConfig(); |
335 | TodayConfigWidget *confWidget; | 338 | TodayConfigWidget *confWidget; |
336 | for ( confWidget = configWidgetList.first(); confWidget != 0; | 339 | for ( confWidget = configWidgetList.first(); confWidget != 0; |
337 | confWidget = configWidgetList.next() ) { | 340 | confWidget = configWidgetList.next() ) { |
338 | confWidget->writeConfig(); | 341 | confWidget->writeConfig(); |
339 | } | 342 | } |
340 | refresh(); | 343 | refresh(); |
341 | } else { | 344 | } else { |
342 | // since refresh is not called in that case , reconnect the signal | 345 | // since refresh is not called in that case , reconnect the signal |
343 | connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); | 346 | connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); |
344 | } | 347 | } |
345 | } | 348 | } |
346 | 349 | ||
347 | 350 | ||
348 | /** | 351 | /** |
349 | * Refresh for the view. Reload all applets | 352 | * Refresh for the view. Reload all applets |
350 | * | 353 | * |
351 | */ | 354 | */ |
352 | void Today::refresh() { | 355 | void Today::refresh() { |
353 | init(); | 356 | init(); |
354 | 357 | ||
355 | // qDebug(" refresh "); | 358 | // qDebug(" refresh "); |
356 | // set the date in top label | 359 | // set the date in top label |
357 | QDate date = QDate::currentDate(); | 360 | QDate date = QDate::currentDate(); |
358 | QString time = ( tr( date.toString() ) ); | 361 | QString time = ( tr( date.toString() ) ); |
359 | 362 | ||
360 | DateLabel->setText( QString( "<font color=#FFFFFF>" + time + "</font>" ) ); | 363 | DateLabel->setText( QString( "<font color=#FFFFFF>" + time + "</font>" ) ); |
361 | 364 | ||
362 | if ( layout ) { | 365 | if ( layout ) { |
363 | delete layout; | 366 | delete layout; |
364 | } | 367 | } |
365 | layout = new QVBoxLayout( this ); | 368 | layout = new QVBoxLayout( this ); |
366 | layout->addWidget( Frame ); | 369 | layout->addWidget( Frame ); |
367 | layout->addWidget( OwnerField ); | 370 | layout->addWidget( OwnerField ); |
368 | 371 | ||
369 | loadPlugins(); | 372 | loadPlugins(); |
370 | draw(); | 373 | draw(); |
371 | } | 374 | } |