author | harlekin <harlekin> | 2002-09-15 21:03:47 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-09-15 21:03:47 (UTC) |
commit | 251fd5b1687994c30e8bea1091e893468086223f (patch) (unidiff) | |
tree | 3df0ba1775f2c0e7862e9995324d4869ef4b936f /core/pim | |
parent | f79126f5ba0b1d1520e5fb07716ffe9e2479aedf (diff) | |
download | opie-251fd5b1687994c30e8bea1091e893468086223f.zip opie-251fd5b1687994c30e8bea1091e893468086223f.tar.gz opie-251fd5b1687994c30e8bea1091e893468086223f.tar.bz2 |
new today version, now plugin bases
-rw-r--r-- | core/pim/today/TODO | 2 | ||||
-rw-r--r-- | core/pim/today/changelog | 4 | ||||
-rw-r--r-- | core/pim/today/configwidget.h | 17 | ||||
-rw-r--r-- | core/pim/today/opie-today.control | 7 | ||||
-rw-r--r-- | core/pim/today/today.cpp | 642 | ||||
-rw-r--r-- | core/pim/today/today.h | 93 | ||||
-rw-r--r-- | core/pim/today/today.pro | 4 | ||||
-rw-r--r-- | core/pim/today/todaybase.cpp | 158 | ||||
-rw-r--r-- | core/pim/today/todaybase.h | 44 | ||||
-rw-r--r-- | core/pim/today/todayconfig.cpp | 273 | ||||
-rw-r--r-- | core/pim/today/todayconfig.h | 55 | ||||
-rw-r--r-- | core/pim/today/todayplugininterface.h | 82 |
12 files changed, 540 insertions, 841 deletions
diff --git a/core/pim/today/TODO b/core/pim/today/TODO index 30a8bab..1326f88 100644 --- a/core/pim/today/TODO +++ b/core/pim/today/TODO | |||
@@ -6,6 +6,4 @@ TODO for today: | |||
6 | 6 | ||
7 | * qcop integration for updating events? | 7 | * qcop integration for updating events? |
8 | 8 | ||
9 | * make Opiezilla a clickable label wich is allway on the far right side of | ||
10 | the screen , klick will open credits ,) | ||
11 | 9 | ||
diff --git a/core/pim/today/changelog b/core/pim/today/changelog index 73de50d..5fd3284 100644 --- a/core/pim/today/changelog +++ b/core/pim/today/changelog | |||
@@ -1,3 +1,7 @@ | |||
1 | 0.5 | ||
2 | |||
3 | * now fully plugin based | ||
4 | |||
1 | 0.3.4 | 5 | 0.3.4 |
2 | 6 | ||
3 | * "fill our business card now a clickable label" | 7 | * "fill our business card now a clickable label" |
diff --git a/core/pim/today/configwidget.h b/core/pim/today/configwidget.h new file mode 100644 index 0000000..f449db4 --- a/dev/null +++ b/core/pim/today/configwidget.h | |||
@@ -0,0 +1,17 @@ | |||
1 | |||
2 | #ifndef CONFIG_WIDGET_H | ||
3 | #define CONFIG_WIDGET_H | ||
4 | |||
5 | |||
6 | |||
7 | class ConfigWidget : public QWidget { | ||
8 | |||
9 | public: | ||
10 | |||
11 | ConfigWidget( QWidget *parent, const char *name ) : QWidget( parent, name ) {}; | ||
12 | virtual ~ConfigWidget() {}; | ||
13 | |||
14 | virtual void writeConfig() = 0; | ||
15 | }; | ||
16 | |||
17 | #endif | ||
diff --git a/core/pim/today/opie-today.control b/core/pim/today/opie-today.control index b8e2e02..bcac439 100644 --- a/core/pim/today/opie-today.control +++ b/core/pim/today/opie-today.control | |||
@@ -1,10 +1,11 @@ | |||
1 | Files: bin/today apps/1Pim/today.desktop pics/today/* | 1 | Files: bin/today apps/1Pim/today.desktop pics/today/* |
2 | Priority: optional | 2 | Priority: optional |
3 | Section: opie/applications | 3 | Section: opie/applications |
4 | Maintainer: Maximilian Reiß <max.reiss@gmx.de> | 4 | Maintainer: Maximilian Reiß <harlekin@handhelds.org> |
5 | Architecture: arm | 5 | Architecture: arm |
6 | Version: 0.3.4-$SUB_VERSION | 6 | Version: 0.5-$SUB_VERSION |
7 | Depends: opie-base ($QPE_VERSION), libopie ($QPE_VERSION) | 7 | Depends: opie-base ($QPE_VERSION), libopie ($QPE_VERSION), |
8 | opie-today-datebookplugin, opie-today-todolistplugin | ||
8 | License: GPL | 9 | License: GPL |
9 | Description: today screen | 10 | Description: today screen |
10 | This today screen app gives an overview of appointments | 11 | This today screen app gives an overview of appointments |
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp index 62becb0..09540bd 100644 --- a/core/pim/today/today.cpp +++ b/core/pim/today/today.cpp | |||
@@ -1,11 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * today.cpp : main class | 2 | * today.cpp |
3 | * | 3 | * |
4 | * --------------------- | ||
5 | * | ||
6 | * begin : Sun 10 17:20:00 CEST 2002 | ||
7 | * copyright : (c) 2002 by Maximilian Reiß | 4 | * copyright : (c) 2002 by Maximilian Reiß |
8 | * email : max.reiss@gmx.de | 5 | * email : harlekin@handhelds.org |
9 | * | 6 | * |
10 | */ | 7 | */ |
11 | /*************************************************************************** | 8 | /*************************************************************************** |
@@ -17,55 +14,34 @@ | |||
17 | * * | 14 | * * |
18 | ***************************************************************************/ | 15 | ***************************************************************************/ |
19 | 16 | ||
17 | |||
20 | #include "today.h" | 18 | #include "today.h" |
19 | #include "configwidget.h" | ||
21 | 20 | ||
22 | #include <qpe/timestring.h> | ||
23 | #include <qpe/config.h> | 21 | #include <qpe/config.h> |
24 | #include <qpe/qcopenvelope_qws.h> | 22 | #include <qpe/qcopenvelope_qws.h> |
25 | #include <qpe/resource.h> | 23 | #include <qpe/resource.h> |
26 | #include <qpe/contact.h> | ||
27 | #include <qpe/global.h> | 24 | #include <qpe/global.h> |
28 | #include <qpe/qpeapplication.h> | 25 | #include <qpe/qpeapplication.h> |
26 | #include <qpe/contact.h> | ||
29 | 27 | ||
30 | #include <qdir.h> | 28 | #include <qdir.h> |
31 | #include <qfile.h> | 29 | #include <qfile.h> |
32 | #include <qdatetime.h> | ||
33 | #include <qtextstream.h> | ||
34 | #include <qcheckbox.h> | ||
35 | #include <qspinbox.h> | ||
36 | #include <qpushbutton.h> | 30 | #include <qpushbutton.h> |
37 | #include <qlabel.h> | 31 | #include <qlabel.h> |
38 | #include <qtimer.h> | 32 | #include <qtimer.h> |
39 | #include <qpixmap.h> | 33 | #include <qpixmap.h> |
40 | #include <qlayout.h> | 34 | #include <qlayout.h> |
41 | #include <qtl.h> | 35 | #include <qtabwidget.h> |
42 | 36 | #include <qdialog.h> | |
43 | 37 | ||
44 | #include <unistd.h> | ||
45 | #include <stdlib.h> | ||
46 | 38 | ||
47 | int MAX_LINES_TASK; | 39 | static QValueList<TodayPlugin> pluginList; |
48 | int MAX_CHAR_CLIP; | ||
49 | int MAX_LINES_MEET; | ||
50 | int SHOW_LOCATION; | ||
51 | int SHOW_NOTES; | ||
52 | // show only later dates | ||
53 | int ONLY_LATER; | ||
54 | int AUTOSTART; | ||
55 | int NEW_START=1; | ||
56 | QString AUTOSTART_TIMER; | ||
57 | int NEXTDAYS=1; | ||
58 | 40 | ||
59 | |||
60 | /* Constructs a Example which is a child of 'parent', with the | ||
61 | * name 'name' and widget flags set to 'f' | ||
62 | */ | ||
63 | Today::Today( QWidget* parent, const char* name, WFlags fl ) | 41 | Today::Today( QWidget* parent, const char* name, WFlags fl ) |
64 | : TodayBase( parent, name, fl ), AllDateBookEvents(NULL) { | 42 | : TodayBase( parent, name, fl ) { |
65 | QObject::connect( (QObject*)PushButton1, SIGNAL( clicked() ), this, SLOT(startConfig() ) ); | 43 | |
66 | QObject::connect( (QObject*)TodoButton, SIGNAL( clicked() ), this, SLOT(startTodo() ) ); | 44 | QObject::connect( (QObject*)ConfigButton, SIGNAL( clicked() ), this, SLOT( startConfig() ) ); |
67 | QObject::connect( (QObject*)DatesButton, SIGNAL( clicked() ), this, SLOT(startDatebook() ) ); | ||
68 | QObject::connect( (QObject*)MailButton, SIGNAL( clicked() ), this, SLOT(startMail() ) ); | ||
69 | QObject::connect( (QObject*)OwnerField, SIGNAL( clicked() ), this, SLOT(editCard() ) ); | 45 | QObject::connect( (QObject*)OwnerField, SIGNAL( clicked() ), this, SLOT(editCard() ) ); |
70 | 46 | ||
71 | #if defined(Q_WS_QWS) | 47 | #if defined(Q_WS_QWS) |
@@ -76,17 +52,15 @@ Today::Today( QWidget* parent, const char* name, WFlags fl ) | |||
76 | #endif | 52 | #endif |
77 | #endif | 53 | #endif |
78 | 54 | ||
55 | pluginLayout = 0l; | ||
79 | 56 | ||
80 | |||
81 | db = NULL; | ||
82 | setOwnerField(); | 57 | setOwnerField(); |
83 | todo = new ToDoDB; | 58 | init(); |
84 | draw(); | 59 | refresh(); |
85 | getTodo(); | 60 | showMaximized(); |
86 | autoStart(); | ||
87 | } | 61 | } |
88 | 62 | ||
89 | /* | 63 | /** |
90 | * Qcop receive method. | 64 | * Qcop receive method. |
91 | */ | 65 | */ |
92 | void Today::channelReceived(const QCString &msg, const QByteArray & data) { | 66 | void Today::channelReceived(const QCString &msg, const QByteArray & data) { |
@@ -96,10 +70,9 @@ void Today::channelReceived(const QCString &msg, const QByteArray & data) { | |||
96 | stream >> message; | 70 | stream >> message; |
97 | setOwnerField(message); | 71 | setOwnerField(message); |
98 | } | 72 | } |
99 | |||
100 | } | 73 | } |
101 | 74 | ||
102 | /* | 75 | /** |
103 | * Initialises the owner field with the default value, the username | 76 | * Initialises the owner field with the default value, the username |
104 | */ | 77 | */ |
105 | void Today::setOwnerField() { | 78 | void Today::setOwnerField() { |
@@ -113,7 +86,7 @@ void Today::setOwnerField() { | |||
113 | } | 86 | } |
114 | } | 87 | } |
115 | 88 | ||
116 | /* | 89 | /** |
117 | * Set the owner field with a given QString, for example per qcop. | 90 | * Set the owner field with a given QString, for example per qcop. |
118 | */ | 91 | */ |
119 | void Today::setOwnerField(QString &message) { | 92 | void Today::setOwnerField(QString &message) { |
@@ -122,309 +95,183 @@ void Today::setOwnerField(QString &message) { | |||
122 | } | 95 | } |
123 | } | 96 | } |
124 | 97 | ||
125 | /* | ||
126 | * Autostart, uses the new (opie only) autostart method in the launcher code. | ||
127 | * If registered against that today ist started on each resume. | ||
128 | */ | ||
129 | void Today::autoStart() { | ||
130 | Config cfg("today"); | ||
131 | cfg.setGroup("Autostart"); | ||
132 | int AUTOSTART = cfg.readNumEntry("autostart",1); | ||
133 | // qDebug(QString("%1").arg(AUTOSTART)); | ||
134 | if (AUTOSTART) { | ||
135 | QCopEnvelope e("QPE/System", "autoStart(QString,QString,QString)"); | ||
136 | e << QString("add"); | ||
137 | e << QString("today"); | ||
138 | e << AUTOSTART_TIMER; | ||
139 | } else { | ||
140 | qDebug("Nun in else bei autostart"); | ||
141 | QCopEnvelope e("QPE/System", "autoStart(QString,QString)"); | ||
142 | e << QString("remove"); | ||
143 | e << QString("today"); | ||
144 | } | ||
145 | } | ||
146 | |||
147 | /* | ||
148 | * Repaint method. Reread all fields. | ||
149 | */ | ||
150 | void Today::draw() { | ||
151 | init(); | ||
152 | getDates(); | ||
153 | getMail(); | ||
154 | |||
155 | // if the todolist.xml file was not modified in between, do not parse it. | ||
156 | if (checkIfModified() || NEW_START==1) { | ||
157 | if (todo) delete todo; | ||
158 | todo = new ToDoDB; | ||
159 | getTodo(); | ||
160 | } | ||
161 | |||
162 | // how often refresh | ||
163 | QTimer::singleShot( 20*1000, this, SLOT(draw() ) ); | ||
164 | } | ||
165 | |||
166 | /* | ||
167 | * Check if the todolist.xml was modified (if there are new entries. | ||
168 | * Returns true if it was modified. | ||
169 | */ | ||
170 | bool Today::checkIfModified() { | ||
171 | |||
172 | QDir dir; | ||
173 | QString homedir = dir.homeDirPath (); | ||
174 | QString time; | ||
175 | |||
176 | Config cfg("today"); | ||
177 | cfg.setGroup("Files"); | ||
178 | time = cfg.readEntry("todolisttimestamp", ""); | ||
179 | |||
180 | QFileInfo file = (homedir +"/Applications/todolist/todolist.xml"); | ||
181 | QDateTime fileTime = file.lastModified(); | ||
182 | if (time.compare(fileTime.toString()) == 0) { | ||
183 | return false; | ||
184 | } else { | ||
185 | cfg.writeEntry("todolisttimestamp", fileTime.toString() ); | ||
186 | cfg.write(); | ||
187 | return true; | ||
188 | } | ||
189 | } | ||
190 | 98 | ||
191 | 99 | /** | |
192 | /* | ||
193 | * Init stuff needed for today. Reads the config file. | 100 | * Init stuff needed for today. Reads the config file. |
194 | */ | 101 | */ |
195 | void Today::init() { | 102 | void Today::init() { |
103 | |||
196 | QDate date = QDate::currentDate(); | 104 | QDate date = QDate::currentDate(); |
197 | QString time = (tr( date.toString()) ); | 105 | QString time = (tr( date.toString()) ); |
198 | 106 | ||
199 | TextLabel1->setText(QString("<font color=#FFFFFF>" + time + "</font>")); | 107 | DateLabel->setText( QString( "<font color=#FFFFFF>" + time + "</font>" ) ); |
200 | 108 | ||
201 | // read config | 109 | // read config |
202 | Config cfg("today"); | 110 | Config cfg("today"); |
203 | cfg.setGroup("BaseConfig"); | ||
204 | |||
205 | // -- config file section -- | ||
206 | // how many lines should be showed in the task section | ||
207 | MAX_LINES_TASK = cfg.readNumEntry("maxlinestask",5); | ||
208 | // after how many chars should the be cut off on tasks and notes | ||
209 | MAX_CHAR_CLIP = cfg.readNumEntry("maxcharclip",40); | ||
210 | // how many lines should be showed in the datebook section | ||
211 | MAX_LINES_MEET = cfg.readNumEntry("maxlinesmeet",5); | ||
212 | // If location is to be showed too, 1 to activate it. | ||
213 | SHOW_LOCATION = cfg.readNumEntry("showlocation",1); | ||
214 | // if notes should be shown | ||
215 | SHOW_NOTES = cfg.readNumEntry("shownotes",0); | ||
216 | // should only later appointments be shown or all for the current day. | ||
217 | ONLY_LATER = cfg.readNumEntry("onlylater",1); | ||
218 | |||
219 | cfg.setGroup("Autostart"); | ||
220 | AUTOSTART = cfg.readNumEntry("autostart",1); | ||
221 | AUTOSTART_TIMER = cfg.readEntry("autostartdelay", "0"); | ||
222 | |||
223 | //db = new DateBookDB; | ||
224 | } | ||
225 | |||
226 | /* | ||
227 | * The method for the configuration dialog. | ||
228 | */ | ||
229 | void Today::startConfig() { | ||
230 | 111 | ||
231 | conf = new todayconfig ( this, "", true ); | 112 | cfg.setGroup( "Applets" ); |
232 | // read the config | 113 | m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' ); |
233 | Config cfg("today"); | ||
234 | cfg.setGroup("BaseConfig"); | ||
235 | |||
236 | //init(); | ||
237 | |||
238 | conf->SpinBox1->setValue(MAX_LINES_MEET); | ||
239 | // location show box | ||
240 | conf->CheckBox1->setChecked(SHOW_LOCATION); | ||
241 | // notes show box | ||
242 | conf->CheckBox2->setChecked(SHOW_NOTES); | ||
243 | // task lines | ||
244 | conf->SpinBox2->setValue(MAX_LINES_TASK); | ||
245 | // clip when? | ||
246 | conf->SpinBox7->setValue(MAX_CHAR_CLIP); | ||
247 | // only later | ||
248 | conf->CheckBox3->setChecked(ONLY_LATER); | ||
249 | // if today should be autostarted | ||
250 | conf->CheckBoxAuto->setChecked(AUTOSTART); | ||
251 | // autostart only if device has been suspended for X minutes | ||
252 | conf->SpinBoxTime->setValue( AUTOSTART_TIMER.toInt() ); | ||
253 | |||
254 | conf->exec(); | ||
255 | |||
256 | int maxlinestask = conf->SpinBox2->value(); | ||
257 | int maxmeet = conf->SpinBox1->value(); | ||
258 | int location = conf->CheckBox1->isChecked(); | ||
259 | int notes = conf->CheckBox2->isChecked(); | ||
260 | int maxcharclip = conf->SpinBox7->value(); | ||
261 | int onlylater = conf->CheckBox3->isChecked(); | ||
262 | int autostart = conf->CheckBoxAuto->isChecked(); | ||
263 | int autostartdelay = conf->SpinBoxTime->value(); | ||
264 | |||
265 | |||
266 | cfg.writeEntry("maxlinestask",maxlinestask); | ||
267 | cfg.writeEntry("maxcharclip", maxcharclip); | ||
268 | cfg.writeEntry("maxlinesmeet",maxmeet); | ||
269 | cfg.writeEntry("showlocation",location); | ||
270 | cfg.writeEntry("shownotes", notes); | ||
271 | cfg.writeEntry("onlylater", onlylater); | ||
272 | cfg.setGroup("Autostart"); | ||
273 | cfg.writeEntry("autostart", autostart); | ||
274 | cfg.writeEntry("autostartdelay", autostartdelay); | ||
275 | |||
276 | // sync it to "disk" | ||
277 | cfg.write(); | ||
278 | NEW_START=1; | ||
279 | draw(); | ||
280 | AUTOSTART=autostart; | ||
281 | autoStart(); | ||
282 | } | 114 | } |
283 | 115 | ||
284 | 116 | ||
285 | /* | 117 | /** |
286 | * Get all events that are in the datebook xml file for today | 118 | * Load the plugins |
287 | */ | 119 | */ |
288 | void Today::getDates() { | 120 | void Today::loadPlugins() { |
289 | QDate date = QDate::currentDate(); | ||
290 | 121 | ||
291 | if (AllDateBookEvents) delete AllDateBookEvents; | 122 | QValueList<TodayPlugin>::Iterator tit; |
292 | AllDateBookEvents = new QWidget( ); | 123 | for ( tit = pluginList.begin(); tit != pluginList.end(); ++tit ) { |
293 | QVBoxLayout* layoutDates = new QVBoxLayout(AllDateBookEvents); | 124 | (*tit).library->unload(); |
294 | 125 | delete (*tit).library; | |
295 | if (db) { | ||
296 | delete db; | ||
297 | } | 126 | } |
298 | db = new DateBookDB; | ||
299 | |||
300 | QValueList<EffectiveEvent> list = db->getEffectiveEvents(date, date); | ||
301 | 127 | ||
302 | qBubbleSort(list); | 128 | QString path = QPEApplication::qpeDir() + "/plugins/today"; |
303 | // printf("Get dates\n"); | 129 | QDir dir( path, "lib*.so" ); |
304 | 130 | ||
305 | Config config( "qpe" ); | 131 | QStringList list = dir.entryList(); |
306 | // if 24 h format | 132 | QStringList::Iterator it; |
307 | //bool ampm = config.readBoolEntry( "AMPM", TRUE ); | ||
308 | 133 | ||
309 | int count=0; | 134 | uint count = 0; |
135 | for ( it = list.begin(); it != list.end(); ++it ) { | ||
136 | TodayPluginInterface *iface = 0; | ||
137 | QLibrary *lib = new QLibrary( path + "/" + *it ); | ||
310 | 138 | ||
311 | if ( list.count() > 0 ) { | 139 | qDebug( "querying: %s", QString( path + "/" + *it ).latin1() ); |
140 | if ( lib->queryInterface( IID_TodayPluginInterface, (QUnknownInterface**)&iface ) == QS_OK ) { | ||
141 | qDebug( "loading: %s", QString( path + "/" + *it ).latin1() ); | ||
142 | qDebug( QString(*it).latin1() ); | ||
143 | TodayPlugin plugin; | ||
144 | plugin.library = lib; | ||
145 | plugin.iface = iface; | ||
146 | plugin.name = QString(*it).latin1(); | ||
312 | 147 | ||
313 | for ( QValueList<EffectiveEvent>::ConstIterator it=list.begin(); | 148 | if ( m_excludeApplets.grep( *it ).isEmpty() ) { |
314 | it!=list.end(); ++it ) { | 149 | plugin.active = true; |
315 | 150 | } else { | |
316 | 151 | plugin.active = false; | |
317 | if ( count <= MAX_LINES_MEET ) { | 152 | } |
318 | 153 | plugin.guiPart = plugin.iface->guiPart(); | |
319 | QTime time = QTime::currentTime(); | 154 | pluginList.append( plugin ); |
320 | |||
321 | if (!ONLY_LATER) { | ||
322 | count++; | ||
323 | DateBookEvent *l=new DateBookEvent(*it, AllDateBookEvents, SHOW_LOCATION, SHOW_NOTES); | ||
324 | layoutDates->addWidget(l); | ||
325 | connect (l, SIGNAL(editEvent(const Event &)), | ||
326 | this, SLOT(editEvent(const Event &))); | ||
327 | } else if ((time.toString() <= TimeString::dateString((*it).event().end())) ) { | ||
328 | count++; | 155 | count++; |
329 | 156 | } else { | |
330 | // show only later appointments | 157 | qDebug( "could not recognize %s", QString( path + "/" + *it ).latin1() ); |
331 | DateBookEventLater *l=new DateBookEventLater(*it, AllDateBookEvents, SHOW_LOCATION, SHOW_NOTES); | 158 | delete lib; |
332 | layoutDates->addWidget(l); | ||
333 | connect (l, SIGNAL(editEvent(const Event &)), | ||
334 | this, SLOT(editEvent(const Event &))); | ||
335 | } | 159 | } |
336 | } | 160 | } |
337 | } | 161 | } |
338 | if (ONLY_LATER && count==0) { | 162 | |
339 | QLabel* noMoreEvents = new QLabel(AllDateBookEvents); | 163 | |
340 | noMoreEvents->setText(tr("No more appointments today")); | 164 | /** |
341 | layoutDates->addWidget(noMoreEvents); | 165 | * Repaint method. Reread all fields. |
166 | */ | ||
167 | void Today::draw() { | ||
168 | |||
169 | if ( pluginLayout ) { | ||
170 | delete pluginLayout; | ||
171 | } | ||
172 | pluginLayout = new QVBoxLayout( layout ); | ||
173 | |||
174 | if ( pluginList.count() == 0 ) { | ||
175 | QLabel *noPlugins = new QLabel( this ); | ||
176 | noPlugins->setText( tr( "No plugins found" ) ); | ||
177 | layout->addWidget( noPlugins ); | ||
178 | return; | ||
179 | } | ||
180 | |||
181 | uint count = 0; | ||
182 | TodayPlugin plugin; | ||
183 | for ( uint i = 0; i < pluginList.count(); i++ ) { | ||
184 | plugin = pluginList[i]; | ||
185 | |||
186 | if ( plugin.active ) { | ||
187 | QHBoxLayout* plugLayout = new QHBoxLayout( this ); | ||
188 | QPixmap plugPix; | ||
189 | plugPix.convertFromImage( Resource::loadImage( plugin.guiPart->pixmapNameWidget() ).smoothScale( 18, 18 ), 0 ); | ||
190 | OClickableLabel* plugIcon = new OClickableLabel( this ); | ||
191 | plugIcon->setPixmap( plugPix ); | ||
192 | QScrollView* sv = new QScrollView( this ); | ||
193 | QWidget* plugWidget = plugin.guiPart->widget( sv->viewport() ); | ||
194 | // plugWidget->reparent( sv->viewport(), QPoint( 0, 0 ) ); | ||
195 | sv->setMinimumHeight( plugin.guiPart->minHeight() ); | ||
196 | //sv->setMaximumHeight( plugin.guiPart->maxHeight() ); | ||
197 | |||
198 | sv->setResizePolicy( QScrollView::AutoOneFit ); | ||
199 | sv->setHScrollBarMode( QScrollView::AlwaysOff ); | ||
200 | sv->setFrameShape( QFrame::NoFrame ); | ||
201 | sv->addChild( plugWidget ); | ||
202 | |||
203 | plugLayout->addWidget( plugIcon, 0, AlignTop ); | ||
204 | plugLayout->addWidget( sv, 0, AlignTop ); | ||
205 | plugLayout->setStretchFactor( plugIcon, 1 ); | ||
206 | plugLayout->setStretchFactor( sv, 9 ); | ||
207 | pluginLayout->addLayout( plugLayout ); | ||
208 | count++; | ||
342 | } | 209 | } |
343 | } else { | ||
344 | QLabel* noEvents = new QLabel(AllDateBookEvents); | ||
345 | noEvents->setText(tr("No appointments today")); | ||
346 | layoutDates->addWidget(noEvents); | ||
347 | } | 210 | } |
348 | 211 | ||
349 | layoutDates->addItem(new QSpacerItem(1,1, QSizePolicy::Minimum, QSizePolicy::Expanding)); | 212 | if ( count == 0 ) { |
350 | sv1->addChild(AllDateBookEvents); | 213 | QLabel *noPluginsActive = new QLabel( this ); |
351 | AllDateBookEvents->show(); | 214 | noPluginsActive->setText( tr( "No plugins activated" ) ); |
215 | layout->addWidget( noPluginsActive ); | ||
352 | } | 216 | } |
353 | 217 | ||
218 | layout->addItem( new QSpacerItem( 1,1, QSizePolicy::Minimum, QSizePolicy::Expanding ) ); | ||
354 | 219 | ||
355 | void Today::getMail() { | ||
356 | Config cfg("opiemail"); | ||
357 | cfg.setGroup("today"); | ||
358 | 220 | ||
359 | // how many lines should be showed in the task section | 221 | // how often refresh - later have qcop update calls in *db |
360 | int NEW_MAILS = cfg.readNumEntry("newmails",0); | 222 | // QTimer::singleShot( 20*1000, this, SLOT( draw() ) ); |
361 | int OUTGOING = cfg.readNumEntry("outgoing",0); | 223 | } |
362 | 224 | ||
363 | QString output = tr("<b>%1</b> new mail(s), <b>%2</b> outgoing").arg(NEW_MAILS).arg(OUTGOING); | ||
364 | 225 | ||
365 | MailField->setText(output); | 226 | void Today::refresh() { |
227 | loadPlugins(); | ||
228 | draw(); | ||
229 | qDebug( "redraw" ); | ||
230 | // QTimer::singleShot( 30*1000, this, SLOT( refresh() ) ); | ||
366 | } | 231 | } |
367 | 232 | ||
368 | 233 | ||
369 | /* | 234 | /** |
370 | * Get the todos | 235 | * The method for the configuration dialog. |
371 | */ | 236 | */ |
372 | void Today::getTodo() { | 237 | void Today::startConfig() { |
373 | 238 | conf = new TodayConfig ( this, "", true ); | |
374 | QString output; | ||
375 | QString tmpout; | ||
376 | int count = 0; | ||
377 | int ammount = 0; | ||
378 | |||
379 | // get overdue todos first | ||
380 | QValueList<ToDoEvent> overDueList = todo->overDue(); | ||
381 | qBubbleSort(overDueList); | ||
382 | for ( QValueList<ToDoEvent>::Iterator it=overDueList.begin(); | ||
383 | it!=overDueList.end(); ++it ) { | ||
384 | if (!(*it).isCompleted() && ( ammount < MAX_LINES_TASK) ) { | ||
385 | QString desc = (*it).summary(); | ||
386 | if( desc.isEmpty() ) { | ||
387 | desc = (*it).description(); | ||
388 | } | ||
389 | tmpout += "<font color=#e00000><b>-" + desc.mid(0, MAX_CHAR_CLIP) + "</b></font><br>"; | ||
390 | 239 | ||
391 | ammount++; | 240 | uint count = 0; |
392 | } | 241 | TodayPlugin plugin; |
393 | } | ||
394 | 242 | ||
395 | // get total number of still open todos | 243 | QList<ConfigWidget> configWidgetList; |
396 | QValueList<ToDoEvent> openTodo = todo->rawToDos(); | 244 | for ( uint i = 0; i < pluginList.count(); i++ ) { |
397 | qBubbleSort(openTodo); | 245 | plugin = pluginList[i]; |
398 | for ( QValueList<ToDoEvent>::Iterator it=openTodo.begin(); | 246 | |
399 | it!=openTodo.end(); ++it ) { | 247 | // load the config widgets in the tabs |
400 | if (!(*it).isCompleted()){ | 248 | if ( plugin.guiPart->configWidget( this ) != 0l ) { |
401 | count +=1; | 249 | ConfigWidget* widget = plugin.guiPart->configWidget( this ); |
402 | // not the overdues, we allready got them, and not if we are | 250 | widget->reparent( conf , QPoint( 0,0 ) ); |
403 | // over the maxlines | 251 | configWidgetList.append( widget ); |
404 | if (!(*it).isOverdue() && ( ammount < MAX_LINES_TASK) ) { | 252 | conf->TabWidget3->insertTab( widget, plugin.guiPart->appName() ); |
405 | QString desc = (*it).summary(); | ||
406 | if( desc.isEmpty() ) { | ||
407 | desc = (*it).description(); | ||
408 | } | ||
409 | tmpout += "<b>-</b>" + desc.mid(0, MAX_CHAR_CLIP) + "<br>"; | ||
410 | ammount++; | ||
411 | } | ||
412 | } | 253 | } |
254 | // set the order/activate tab | ||
255 | conf->pluginManagement( plugin.name, plugin.guiPart->pluginName(), | ||
256 | Resource::loadPixmap( plugin.guiPart->pixmapNameWidget() ) ); | ||
257 | count++; | ||
413 | } | 258 | } |
414 | 259 | ||
260 | conf->showMaximized(); | ||
415 | 261 | ||
416 | if (count > 0) { | 262 | if ( conf->exec() == QDialog::Accepted ) { |
417 | if( count == 1 ) { | 263 | ConfigWidget *confWidget; |
418 | output = tr("There is <b> 1</b> active task: <br>" ); | 264 | for ( confWidget=configWidgetList.first(); confWidget != 0; |
419 | } else { | 265 | confWidget = configWidgetList.next() ) { |
420 | output = tr("There are <b> %1</b> active tasks: <br>").arg(count); | 266 | confWidget->writeConfig(); |
421 | } | ||
422 | output += tmpout; | ||
423 | } else { | ||
424 | output = tr("No active tasks"); | ||
425 | } | 267 | } |
268 | conf->writeConfig(); | ||
426 | 269 | ||
427 | TodoField->setText(tr(output)); | 270 | init(); |
271 | loadPlugins(); | ||
272 | draw(); | ||
273 | } | ||
274 | delete conf; | ||
428 | } | 275 | } |
429 | 276 | ||
430 | 277 | ||
@@ -433,205 +280,26 @@ void Today::startAddressbook() { | |||
433 | e << QString("addressbook"); | 280 | e << QString("addressbook"); |
434 | } | 281 | } |
435 | 282 | ||
436 | extern QPEApplication *todayApp; | ||
437 | 283 | ||
438 | /* | 284 | /** |
439 | * launch addressbook (personal card) | 285 | * launch addressbook (personal card) |
440 | */ | 286 | */ |
441 | void Today::editCard() { | 287 | void Today::editCard() { |
442 | |||
443 | startAddressbook(); | 288 | startAddressbook(); |
444 | 289 | while( !QCopChannel::isRegistered( "QPE/Addressbook" ) ) { | |
445 | while( !QCopChannel::isRegistered("QPE/Addressbook")) todayApp->processEvents(); | 290 | qApp->processEvents(); |
446 | QCopEnvelope v("QPE/Addressbook", "editPersonalAndClose()"); | ||
447 | } | ||
448 | |||
449 | /* | ||
450 | * launches datebook | ||
451 | */ | ||
452 | void Today::startDatebook() { | ||
453 | QCopEnvelope e("QPE/System", "execute(QString)"); | ||
454 | e << QString("datebook"); | ||
455 | } | 291 | } |
456 | 292 | QCopEnvelope v( "QPE/Addressbook", "editPersonalAndClose()" ); | |
457 | /* | ||
458 | * starts the edit dialog as known from datebook | ||
459 | */ | ||
460 | void Today::editEvent(const Event &e) { | ||
461 | startDatebook(); | ||
462 | |||
463 | while(!QCopChannel::isRegistered("QPE/Datebook")) todayApp->processEvents(); | ||
464 | QCopEnvelope env("QPE/Datebook", "editEvent(int)"); | ||
465 | env << e.uid(); | ||
466 | } | ||
467 | |||
468 | /* | ||
469 | * launches todolist | ||
470 | */ | ||
471 | void Today::startTodo() { | ||
472 | QCopEnvelope e("QPE/System", "execute(QString)"); | ||
473 | e << QString("todolist"); | ||
474 | } | 293 | } |
475 | 294 | ||
476 | /* | 295 | /* |
477 | * launch opiemail | 296 | * launches an App |
478 | */ | 297 | */ |
479 | void Today::startMail() { | 298 | void Today::launchApp( QString appName ) { |
480 | QCopEnvelope e("QPE/System", "execute(QString)"); | 299 | QCopEnvelope e("QPE/System", "execute(QString)"); |
481 | e << QString("opiemail"); | 300 | e << QString( appName ); |
482 | //Right now start both, maybe decide which to rum via config file .. | ||
483 | QCopEnvelope f("QPE/System", "execute(QString)"); | ||
484 | f << QString("qtmail"); | ||
485 | } | 301 | } |
486 | 302 | ||
487 | |||
488 | Today::~Today() { | 303 | Today::~Today() { |
489 | } | 304 | } |
490 | 305 | ||
491 | /* | ||
492 | * Gets the events for the current day, if it should get all dates | ||
493 | */ | ||
494 | DateBookEvent::DateBookEvent(const EffectiveEvent &ev, | ||
495 | QWidget* parent, | ||
496 | int SHOW_LOCATION, | ||
497 | int SHOW_NOTES, | ||
498 | const char* name, | ||
499 | WFlags fl) : | ||
500 | OClickableLabel(parent,name,fl), event(ev) { | ||
501 | |||
502 | QString msg; | ||
503 | //QTime time = QTime::currentTime(); | ||
504 | |||
505 | Config config( "qpe" ); | ||
506 | config.setGroup( "Time" ); | ||
507 | // if 24 h format | ||
508 | ampm = config.readBoolEntry( "AMPM", TRUE ); | ||
509 | |||
510 | |||
511 | if (!ONLY_LATER) { | ||
512 | msg += "<B>" + (ev).description() + "</B>"; | ||
513 | if ( (ev).event().hasAlarm() ) { | ||
514 | msg += " <b>[with alarm]</b>"; | ||
515 | } | ||
516 | // include location or not | ||
517 | if (SHOW_LOCATION == 1) { | ||
518 | msg += "<BR><i>" + (ev).location() + "</i>"; | ||
519 | } | ||
520 | |||
521 | if ( (TimeString::timeString(QTime((ev).event().start().time()) ) == "00:00") && (TimeString::timeString(QTime((ev).event().end().time()) ) == "23:59") ) { | ||
522 | msg += "<br>All day"; | ||
523 | } else { | ||
524 | // start time of event | ||
525 | msg += "<br>" + ampmTime(QTime((ev).event().start().time()) ) | ||
526 | // end time of event | ||
527 | + "<b> - </b>" + ampmTime(QTime((ev).event().end().time()) ); | ||
528 | } | ||
529 | |||
530 | // include possible note or not | ||
531 | if (SHOW_NOTES == 1) { | ||
532 | msg += "<br> <i>note</i>:" +((ev).notes()).mid(0, MAX_CHAR_CLIP); | ||
533 | } | ||
534 | } | ||
535 | setText(msg); | ||
536 | connect(this, SIGNAL(clicked()), this, SLOT(editMe())); | ||
537 | setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) ); | ||
538 | } | ||
539 | |||
540 | |||
541 | QString DateBookEvent::ampmTime(QTime tm) { | ||
542 | |||
543 | QString s; | ||
544 | if( ampm ) { | ||
545 | int hour = tm.hour(); | ||
546 | if (hour == 0) | ||
547 | hour = 12; | ||
548 | if (hour > 12) | ||
549 | hour -= 12; | ||
550 | s.sprintf( "%2d:%02d %s", hour, tm.minute(), | ||
551 | (tm.hour() >= 12) ? "PM" : "AM" ); | ||
552 | return s; | ||
553 | } else { | ||
554 | s.sprintf( "%2d:%02d", tm.hour(), tm.minute() ); | ||
555 | return s; | ||
556 | } | ||
557 | |||
558 | } | ||
559 | |||
560 | |||
561 | DateBookEventLater::DateBookEventLater(const EffectiveEvent &ev, | ||
562 | QWidget* parent, | ||
563 | int SHOW_LOCATION, | ||
564 | int SHOW_NOTES, | ||
565 | const char* name, | ||
566 | WFlags fl) : | ||
567 | OClickableLabel(parent,name,fl), event(ev) { | ||
568 | |||
569 | QString msg; | ||
570 | QTime time = QTime::currentTime(); | ||
571 | |||
572 | Config config( "qpe" ); | ||
573 | config.setGroup( "Time" ); | ||
574 | // if 24 h format | ||
575 | ampm = config.readBoolEntry( "AMPM", TRUE ); | ||
576 | |||
577 | |||
578 | if ((time.toString() <= TimeString::dateString((ev).event().end())) ) { | ||
579 | // show only later appointments | ||
580 | msg += "<B>" + (ev).description() + "</B>"; | ||
581 | if ( (ev).event().hasAlarm() ) { | ||
582 | msg += " <b>[with alarm]</b>"; | ||
583 | } | ||
584 | // include location or not | ||
585 | if (SHOW_LOCATION == 1) { | ||
586 | msg += "<BR><i>" + (ev).location() + "</i>"; | ||
587 | } | ||
588 | |||
589 | if ( (TimeString::timeString(QTime((ev).event().start().time()) ) == "00:00") && (TimeString::timeString(QTime((ev).event().end().time()) ) == "23:59") ) { | ||
590 | msg += "<br>All day"; | ||
591 | } else { | ||
592 | // start time of event | ||
593 | msg += "<br>" + ampmTime(QTime((ev).event().start().time()) ) | ||
594 | // end time of event | ||
595 | + "<b> - </b>" + ampmTime(QTime((ev).event().end().time()) ); | ||
596 | } | ||
597 | // include possible note or not | ||
598 | if (SHOW_NOTES == 1) { | ||
599 | msg += "<br> <i>note</i>:" +((ev).notes()).mid(0, MAX_CHAR_CLIP); | ||
600 | } | ||
601 | } | ||
602 | |||
603 | setText(msg); | ||
604 | connect(this, SIGNAL(clicked()), this, SLOT(editMe())); | ||
605 | setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) ); | ||
606 | } | ||
607 | |||
608 | |||
609 | QString DateBookEventLater::ampmTime(QTime tm) { | ||
610 | |||
611 | QString s; | ||
612 | if( ampm ) { | ||
613 | int hour = tm.hour(); | ||
614 | if (hour == 0) | ||
615 | hour = 12; | ||
616 | if (hour > 12) | ||
617 | hour -= 12; | ||
618 | s.sprintf( "%2d:%02d %s", hour, tm.minute(), | ||
619 | (tm.hour() >= 12) ? "PM" : "AM" ); | ||
620 | return s; | ||
621 | } else { | ||
622 | s.sprintf( "%2d:%02d", tm.hour(), tm.minute() ); | ||
623 | return s; | ||
624 | } | ||
625 | |||
626 | } | ||
627 | |||
628 | |||
629 | void DateBookEvent::editMe() { | ||
630 | emit editEvent(event.event()); | ||
631 | } | ||
632 | |||
633 | void DateBookEventLater::editMe() { | ||
634 | emit editEvent(event.event()); | ||
635 | } | ||
636 | |||
637 | |||
diff --git a/core/pim/today/today.h b/core/pim/today/today.h index f28c029..ca17020 100644 --- a/core/pim/today/today.h +++ b/core/pim/today/today.h | |||
@@ -1,11 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * today.h | 2 | * today.h |
3 | * | 3 | * |
4 | * --------------------- | ||
5 | * | ||
6 | * begin : Sun 10 17:20:00 CEST 2002 | ||
7 | * copyright : (c) 2002 by Maximilian Reiß | 4 | * copyright : (c) 2002 by Maximilian Reiß |
8 | * email : max.reiss@gmx.de | 5 | * email : harlekin@handhelds.org |
9 | * | 6 | * |
10 | */ | 7 | */ |
11 | /*************************************************************************** | 8 | /*************************************************************************** |
@@ -21,21 +18,31 @@ | |||
21 | #ifndef TODAY_H | 18 | #ifndef TODAY_H |
22 | #define TODAY_H | 19 | #define TODAY_H |
23 | 20 | ||
24 | #include <qpe/datebookdb.h> | ||
25 | #include <qpe/event.h> | ||
26 | |||
27 | #include <opie/tododb.h> | 21 | #include <opie/tododb.h> |
28 | #include <opie/oclickablelabel.h> | ||
29 | 22 | ||
30 | #include <qdatetime.h> | 23 | #include <qdatetime.h> |
31 | #include <qlist.h> | 24 | #include <qlist.h> |
32 | 25 | ||
26 | #include <qpe/qlibrary.h> | ||
27 | #include <qpe/event.h> | ||
28 | |||
33 | #include "todayconfig.h" | 29 | #include "todayconfig.h" |
34 | #include "todaybase.h" | 30 | #include "todaybase.h" |
31 | #include "todayplugininterface.h" | ||
35 | 32 | ||
36 | class QVBoxLayout; | 33 | class QVBoxLayout; |
37 | 34 | ||
35 | struct TodayPlugin { | ||
36 | QLibrary *library; | ||
37 | TodayPluginInterface *iface; | ||
38 | TodayPluginObject *guiPart; | ||
39 | QString name; | ||
40 | bool active; | ||
41 | int pos; | ||
42 | }; | ||
43 | |||
38 | class Today : public TodayBase { | 44 | class Today : public TodayBase { |
45 | |||
39 | Q_OBJECT | 46 | Q_OBJECT |
40 | 47 | ||
41 | public: | 48 | public: |
@@ -44,75 +51,31 @@ class Today : public TodayBase { | |||
44 | 51 | ||
45 | private slots: | 52 | private slots: |
46 | void startConfig(); | 53 | void startConfig(); |
47 | void startTodo(); | ||
48 | void startDatebook(); | ||
49 | void startAddressbook(); | 54 | void startAddressbook(); |
50 | void startMail(); | 55 | void launchApp( QString appName ); |
51 | void editCard(); | 56 | void editCard(); |
52 | void draw(); | 57 | void draw(); |
53 | void editEvent(const Event &e); | 58 | void refresh(); |
59 | |||
54 | private: | 60 | private: |
55 | void init(); | 61 | void init(); |
56 | void getDates(); | ||
57 | void getTodo(); | ||
58 | void getMail(); | ||
59 | void autoStart(); | ||
60 | bool checkIfModified(); | ||
61 | void setOwnerField(); | 62 | void setOwnerField(); |
62 | void setOwnerField(QString &string); | 63 | void setOwnerField(QString &string); |
64 | void loadPlugins(); | ||
65 | |||
63 | private slots: | 66 | private slots: |
64 | void channelReceived(const QCString &msg, const QByteArray & data); | 67 | void channelReceived(const QCString &msg, const QByteArray & data); |
65 | 68 | ||
66 | private: | 69 | private: |
67 | DateBookDB *db; | 70 | TodayConfig *conf; |
68 | ToDoDB *todo; | 71 | QStringList m_excludeApplets; |
69 | todayconfig *conf; | ||
70 | QWidget* AllDateBookEvents; | ||
71 | //Config cfg; | ||
72 | int MAX_LINES_TASK; | ||
73 | int MAX_CHAR_CLIP; | ||
74 | int MAX_LINES_MEET; | ||
75 | int SHOW_LOCATION; | ||
76 | int SHOW_NOTES; | ||
77 | }; | ||
78 | 72 | ||
79 | class DateBookEvent: public OClickableLabel { | 73 | QVBoxLayout *pluginLayout; |
80 | Q_OBJECT | ||
81 | public: | ||
82 | DateBookEvent(const EffectiveEvent &ev, | ||
83 | QWidget* parent = 0, | ||
84 | int SHOW_LOCATION = 0, | ||
85 | int SHOW_NOTES = 0, | ||
86 | const char* name = 0, | ||
87 | WFlags fl = 0); | ||
88 | signals: | ||
89 | void editEvent(const Event &e); | ||
90 | private slots: | ||
91 | void editMe(); | ||
92 | private: | ||
93 | QString ampmTime(QTime); | ||
94 | const EffectiveEvent event; | ||
95 | bool ampm; | ||
96 | }; | ||
97 | 74 | ||
98 | class DateBookEventLater: public OClickableLabel { | 75 | // QString m_autoStartTimer; |
99 | Q_OBJECT | 76 | int m_newStart; |
100 | public: | 77 | // int m_autoStart; |
101 | DateBookEventLater(const EffectiveEvent &ev, | 78 | int m_maxCharClip; |
102 | QWidget* parent = 0, | ||
103 | int SHOW_LOCATION = 0, | ||
104 | int SHOW_NOTES = 0, | ||
105 | const char* name = 0, | ||
106 | WFlags fl = 0); | ||
107 | signals: | ||
108 | void editEvent(const Event &e); | ||
109 | private slots: | ||
110 | void editMe(); | ||
111 | private: | ||
112 | QString ampmTime(QTime); | ||
113 | const EffectiveEvent event; | ||
114 | bool ampm; | ||
115 | }; | 79 | }; |
116 | 80 | ||
117 | #endif // TODAY_H | 81 | #endif |
118 | |||
diff --git a/core/pim/today/today.pro b/core/pim/today/today.pro index 46e5d2a..8596da3 100644 --- a/core/pim/today/today.pro +++ b/core/pim/today/today.pro | |||
@@ -1,6 +1,6 @@ | |||
1 | TEMPLATE= app | 1 | TEMPLATE= app |
2 | #CONFIG = qt warn_on debug | 2 | CONFIG = qt warn_on debug |
3 | CONFIG = qt warn_on release | 3 | #CONFIG = qt warn_on release |
4 | HEADERS = today.h todaybase.h todayconfig.h | 4 | HEADERS = today.h todaybase.h todayconfig.h |
5 | SOURCES = main.cpp today.cpp todaybase.cpp todayconfig.cpp | 5 | SOURCES = main.cpp today.cpp todaybase.cpp todayconfig.cpp |
6 | INCLUDEPATH+= $(OPIEDIR)/include | 6 | INCLUDEPATH+= $(OPIEDIR)/include |
diff --git a/core/pim/today/todaybase.cpp b/core/pim/today/todaybase.cpp index bc1651d..74f4fa0 100644 --- a/core/pim/today/todaybase.cpp +++ b/core/pim/today/todaybase.cpp | |||
@@ -1,10 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * todaybase.cpp * | 2 | * todaybase.cpp |
3 | * --------------------- | ||
4 | * | 3 | * |
5 | * begin : Sun 10 17:20:00 CEST 2002 | ||
6 | * copyright : (c) 2002 by Maximilian Reiß | 4 | * copyright : (c) 2002 by Maximilian Reiß |
7 | * email : max.reiss@gmx.de | 5 | * email : harlekin@handhelds.org |
8 | * | 6 | * |
9 | */ | 7 | */ |
10 | /*************************************************************************** | 8 | /*************************************************************************** |
@@ -20,42 +18,21 @@ | |||
20 | 18 | ||
21 | #include <qframe.h> | 19 | #include <qframe.h> |
22 | #include <qlabel.h> | 20 | #include <qlabel.h> |
23 | #include <qpushbutton.h> | ||
24 | #include <qlayout.h> | ||
25 | #include <qvariant.h> | ||
26 | #include <qwhatsthis.h> | ||
27 | #include <qimage.h> | 21 | #include <qimage.h> |
28 | #include <qpixmap.h> | 22 | #include <qpixmap.h> |
29 | #include <qscrollview.h> | ||
30 | #include <qvbox.h> | ||
31 | #include <qapplication.h> | 23 | #include <qapplication.h> |
32 | 24 | ||
33 | #include <qpe/resource.h> | 25 | #include <qpe/resource.h> |
34 | 26 | ||
35 | /* | 27 | |
36 | * Constructs a TodayBase which is a child of 'parent', with the | ||
37 | * name 'name' and widget flags set to 'f' | ||
38 | */ | ||
39 | TodayBase::TodayBase( QWidget* parent, const char* name, WFlags fl ) | 28 | TodayBase::TodayBase( QWidget* parent, const char* name, WFlags fl ) |
40 | : QWidget( parent, name, fl ) | 29 | : QWidget( parent, name, fl ) { |
41 | { | 30 | |
42 | QPixmap logo = Resource::loadPixmap( "today/today_logo"); // logo | 31 | QPixmap logo = Resource::loadPixmap( "today/today_logo"); // logo |
43 | QPixmap datebook = Resource::loadPixmap("DateBook"); // datebook | ||
44 | QPixmap todo = Resource::loadPixmap( "TodoList" ); // todo | ||
45 | QPixmap config = Resource::loadPixmap( "today/config" ); // config icon | ||
46 | QPixmap mail = Resource::loadPixmap( "today/mail" ); // mail icon | ||
47 | QPixmap opiezilla = Resource::loadPixmap("today/opiezilla" ); //the opiezilla | 32 | QPixmap opiezilla = Resource::loadPixmap("today/opiezilla" ); //the opiezilla |
33 | QPixmap config = Resource::loadPixmap( "today/config" ); // config icon | ||
48 | 34 | ||
49 | QWidget *d = QApplication::desktop(); | 35 | layout = new QVBoxLayout( this ); |
50 | int w=d->width(); | ||
51 | int h=d->height(); | ||
52 | resize( w , h ); | ||
53 | |||
54 | // hehe, qt is ... | ||
55 | getridoffuckingstrippeldlinesbutton = new QPushButton (this, "asdfsad" ); | ||
56 | getridoffuckingstrippeldlinesbutton->setGeometry( QRect( -5, 10, 0, 0 ) ); | ||
57 | |||
58 | QVBoxLayout * layout = new QVBoxLayout(this); | ||
59 | 36 | ||
60 | QPalette pal = this->palette(); | 37 | QPalette pal = this->palette(); |
61 | QColor col = pal.color(QPalette::Active, QColorGroup::Background); | 38 | QColor col = pal.color(QPalette::Active, QColorGroup::Background); |
@@ -88,124 +65,43 @@ TodayBase::TodayBase( QWidget* parent, const char* name, WFlags fl ) | |||
88 | TodayLabel_font.setPointSize(40); | 65 | TodayLabel_font.setPointSize(40); |
89 | TodayLabel->setFont( TodayLabel_font ); | 66 | TodayLabel->setFont( TodayLabel_font ); |
90 | TodayLabel->setBackgroundOrigin( QLabel::ParentOrigin ); | 67 | TodayLabel->setBackgroundOrigin( QLabel::ParentOrigin ); |
91 | TodayLabel->setText("<font color=#FFFFFF>" + tr("Today") +"</font>"); | 68 | TodayLabel->setText( "<font color=#FFFFFF>" + tr("Today²") +"</font>" ); |
69 | |||
70 | // date | ||
71 | DateLabel = new QLabel( Frame, "TextLabel1" ); | ||
72 | DateLabel->setGeometry( QRect( 10, 35, 168, 12 ) ); | ||
73 | QFont DateLabel_font( DateLabel->font() ); | ||
74 | DateLabel_font.setBold( TRUE ); | ||
75 | DateLabel->setFont( DateLabel_font ); | ||
76 | DateLabel->setBackgroundOrigin( QLabel::ParentOrigin ); | ||
77 | DateLabel->setTextFormat( RichText ); | ||
92 | 78 | ||
93 | // Opiezilla | 79 | // Opiezilla |
94 | QLabel* Opiezilla = new QLabel( Frame, "OpieZilla"); | 80 | QLabel* Opiezilla = new QLabel( Frame, "OpieZilla"); |
95 | Opiezilla->setPixmap( opiezilla ); | 81 | Opiezilla->setPixmap( opiezilla ); |
96 | Opiezilla->setGeometry( this->width()-50 ,1, 45, 47); | 82 | Opiezilla->setGeometry( QApplication::desktop()->width()-50 ,1, 45, 47); |
97 | Opiezilla->setBackgroundOrigin( QLabel::ParentOrigin ); | 83 | Opiezilla->setBackgroundOrigin( QLabel::ParentOrigin ); |
98 | 84 | ||
99 | // date | 85 | // Ownerfield |
100 | TextLabel1 = new QLabel( Frame, "TextLabel1" ); | ||
101 | TextLabel1->setGeometry( QRect( 10, 35, 168, 12 ) ); | ||
102 | QFont TextLabel1_font( TextLabel1->font() ); | ||
103 | TextLabel1_font.setBold( TRUE ); | ||
104 | TextLabel1->setFont( TextLabel1_font ); | ||
105 | TextLabel1->setBackgroundOrigin( QLabel::ParentOrigin ); | ||
106 | TextLabel1->setTextFormat( RichText ); | ||
107 | |||
108 | OwnerField = new OClickableLabel(this , "Owner" ); | 86 | OwnerField = new OClickableLabel(this , "Owner" ); |
109 | OwnerField->setGeometry(QRect(0,0, this->width(), 12 )); | 87 | OwnerField->setGeometry(QRect(0,0, this->width(), 12 )); |
110 | OwnerField->setAlignment(int (QLabel::AlignTop | QLabel::AlignLeft ) ); | 88 | OwnerField->setAlignment(int (QLabel::AlignTop | QLabel::AlignLeft ) ); |
111 | OwnerField->setMaximumHeight(12); | 89 | OwnerField->setMaximumHeight(12); |
112 | 90 | ||
113 | // --- dates section --- | 91 | // config |
114 | Frame4 = new QFrame( this, "Frame4" ); | 92 | ConfigButton = new OClickableLabel ( Frame, "PushButton1" ); |
115 | // Frame4->setPalette( pal ); | 93 | ConfigButton->setGeometry( QRect( QApplication::desktop()->width()-80, 30, 25, 21 ) ); |
116 | Frame4->setFrameShape( QScrollView::StyledPanel ); | 94 | ConfigButton->setPixmap( config ); |
117 | Frame4->setFrameShadow( QScrollView::Sunken ); | 95 | ConfigButton->setBackgroundOrigin( QLabel::ParentOrigin ); |
118 | Frame4->setBackgroundOrigin( QScrollView::ParentOrigin ); | ||
119 | Frame4->setFrameStyle( QFrame::NoFrame ); | ||
120 | Frame4->setGeometry (QRect( 0, 8, this->width() , this->height()) ); | ||
121 | |||
122 | sv1 = new QScrollView( Frame4 ); | ||
123 | sv1->setResizePolicy(QScrollView::AutoOneFit); | ||
124 | sv1->setHScrollBarMode( QScrollView::AlwaysOff ); | ||
125 | // need to find a better way!!! | ||
126 | sv1->setGeometry (QRect( 40, 2, Frame4->width()-40 , (Frame4->height()/3)+20 ) ); | ||
127 | sv1->setFrameShape(QFrame::NoFrame); | ||
128 | |||
129 | DatesButton = new QPushButton (Frame4, "DatesButton" ); | ||
130 | DatesButton->setGeometry( QRect( 2, 4, 36, 32 ) ); | ||
131 | DatesButton->setBackgroundOrigin( QPushButton::WidgetOrigin ); | ||
132 | DatesButton->setPalette( pal ); | ||
133 | DatesButton->setPixmap( datebook ); | ||
134 | DatesButton->setFlat( TRUE ); | ||
135 | |||
136 | // --- mail section ---) | ||
137 | MailFrame = new QFrame( this ,"MailFrame" ); | ||
138 | MailFrame->setBackgroundOrigin( QScrollView::ParentOrigin ); | ||
139 | MailFrame->setGeometry (QRect( 0, 0, this->width() , 15) ); | ||
140 | MailFrame->setFrameStyle( QFrame::NoFrame ); | ||
141 | |||
142 | QFrame* Line1 = new QFrame( MailFrame); | ||
143 | Line1->setGeometry( QRect( -5, 0, MailFrame->width()+5, 5 ) ); | ||
144 | Line1->setFrameStyle( QFrame::HLine | QFrame::Sunken ); | ||
145 | |||
146 | MailButton = new QPushButton (MailFrame, "MailButton" ); | ||
147 | MailButton->setGeometry( QRect( 2, 3, 36, 19 ) ); | ||
148 | MailButton->setPalette( pal ); | ||
149 | MailButton->setPixmap( mail ); | ||
150 | MailButton->setFlat( TRUE ); | ||
151 | |||
152 | MailField = new QLabel( MailFrame, "MailField" ); | ||
153 | MailField->setGeometry( QRect( 40, 4, MailFrame->width(), 12) ); | ||
154 | MailField->setText( tr( "Opiemail not installed" ) ); | ||
155 | MailField->setAlignment( int( QLabel::AlignTop | QLabel::AlignLeft ) ); | ||
156 | MailField->setMaximumHeight(40); | ||
157 | MailField->setMinimumHeight(15); | ||
158 | |||
159 | // --- todo section -- | ||
160 | Frame15 = new QFrame( this, "Frame15" ); | ||
161 | Frame15->setFrameStyle( QFrame::NoFrame ); | ||
162 | Frame15->setGeometry (QRect( 40, 3, this->width() , this->height()) ); | ||
163 | |||
164 | QFrame* Line2 = new QFrame( Frame15); | ||
165 | Line2->setGeometry( QRect( -5, 0, MailFrame->width()+5, 5 ) ); | ||
166 | Line2->setFrameStyle( QFrame::HLine | QFrame::Sunken ); | ||
167 | |||
168 | TodoButton = new QPushButton (Frame15, "TodoButton" ); | ||
169 | TodoButton->setGeometry( QRect( 2, 4, 36, 32 ) ); | ||
170 | TodoButton->setPalette( pal ); | ||
171 | TodoButton->setPixmap( todo ); | ||
172 | TodoButton->setFlat( TRUE ); | ||
173 | |||
174 | QScrollView* sv2 = new QScrollView( Frame15 ); | ||
175 | sv2->setResizePolicy(QScrollView::AutoOneFit); | ||
176 | sv2->setHScrollBarMode( QScrollView::AlwaysOff ); | ||
177 | sv2->setGeometry (QRect( 40, 3, Frame15->width()-40 , (Frame15->height()/3) ) ); | ||
178 | sv2->setFrameShape(QFrame::NoFrame); | ||
179 | |||
180 | TodoField = new QLabel( sv2->viewport(), "TodoField" ); | ||
181 | sv2->addChild(TodoField); | ||
182 | TodoField->setFrameShadow( QLabel::Plain ); | ||
183 | //TodoField->setText( tr( "No current todos" ) ); | ||
184 | TodoField->setAlignment( int( QLabel::AlignTop | QLabel::AlignLeft ) ); | ||
185 | |||
186 | PushButton1 = new QPushButton (Frame15, "PushButton1" ); | ||
187 | PushButton1->setGeometry( QRect( 2, 68, 25, 21 ) ); | ||
188 | PushButton1->setPixmap( config ); | ||
189 | PushButton1->setPalette( pal ); | ||
190 | PushButton1->setAutoDefault( TRUE ); | ||
191 | PushButton1->setFlat( TRUE ); | ||
192 | 96 | ||
193 | // -- layout -- | 97 | // -- layout -- |
194 | layout->addWidget(Frame); | 98 | layout->addWidget(Frame); |
195 | layout->addWidget(OwnerField); | 99 | layout->addWidget(OwnerField); |
196 | layout->addWidget(Frame4); | ||
197 | layout->addWidget(MailFrame); | ||
198 | layout->addWidget(Frame15); | ||
199 | |||
200 | layout->setStretchFactor(Frame4,5); | ||
201 | layout->setStretchFactor(MailFrame,1); | ||
202 | layout->setStretchFactor(Frame15,4); | ||
203 | } | 100 | } |
204 | 101 | ||
205 | /* | 102 | /** |
206 | * Destroys the object and frees any allocated resources | 103 | * D' tor |
207 | */ | 104 | */ |
208 | TodayBase::~TodayBase() | 105 | TodayBase::~TodayBase() { |
209 | { | ||
210 | } | 106 | } |
211 | 107 | ||
diff --git a/core/pim/today/todaybase.h b/core/pim/today/todaybase.h index ec06281..7c50f32 100644 --- a/core/pim/today/todaybase.h +++ b/core/pim/today/todaybase.h | |||
@@ -1,26 +1,32 @@ | |||
1 | /**************************************************************************** | 1 | /* |
2 | ** Form interface generated from reading ui file 'todaybase.ui' | 2 | * todaybase.h |
3 | * | ||
4 | * copyright : (c) 2002 by Maximilian Reiß | ||
5 | * email : harlekin@handhelds.org | ||
6 | * | ||
7 | */ | ||
8 | /*************************************************************************** | ||
3 | ** | 9 | ** |
4 | ** Created: Wed Feb 13 19:36:45 2002 | 10 | * This program is free software; you can redistribute it and/or modify * |
5 | ** by: The User Interface Compiler (uic) | 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 * | ||
13 | * (at your option) any later version. * | ||
6 | ** | 14 | ** |
7 | ** WARNING! All changes made in this file will be lost! | 15 | ***************************************************************************/ |
8 | ****************************************************************************/ | 16 | |
9 | #ifndef TODAYBASE_H | 17 | #ifndef TODAYBASE_H |
10 | #define TODAYBASE_H | 18 | #define TODAYBASE_H |
11 | 19 | ||
12 | #include <qvariant.h> | 20 | #include <qlayout.h> |
13 | #include <qwidget.h> | ||
14 | #include <qscrollview.h> | ||
15 | #include <qsplitter.h> | ||
16 | #include <opie/oclickablelabel.h> | 21 | #include <opie/oclickablelabel.h> |
17 | 22 | ||
18 | class QVBox; | 23 | class QVBox; |
19 | class QHBoxLayout; | ||
20 | class QGridLayout; | 24 | class QGridLayout; |
21 | class QFrame; | 25 | class QFrame; |
22 | class QLabel; | 26 | class QLabel; |
23 | class QPushButton; | 27 | class QPushButton; |
28 | class QBoxLayout; | ||
29 | |||
24 | 30 | ||
25 | class TodayBase : public QWidget | 31 | class TodayBase : public QWidget |
26 | { | 32 | { |
@@ -30,26 +36,18 @@ public: | |||
30 | TodayBase( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | 36 | TodayBase( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); |
31 | ~TodayBase(); | 37 | ~TodayBase(); |
32 | 38 | ||
33 | //QScrollView* Frame4; | ||
34 | QFrame* Frame4; | 39 | QFrame* Frame4; |
35 | QPushButton* DatesButton; | 40 | QPushButton* DatesButton; |
41 | QVBoxLayout* layout; | ||
36 | OClickableLabel* OwnerField; | 42 | OClickableLabel* OwnerField; |
37 | QLabel* Frame; | 43 | QLabel* Frame; |
38 | QFrame* MailFrame; | 44 | QLabel* DateLabel; |
39 | QLabel* TextLabel1; | ||
40 | QScrollView* sv1; | ||
41 | QVBox* DatesField; | ||
42 | QFrame* Frame15; | 45 | QFrame* Frame15; |
43 | QLabel* TodoField; | 46 | OClickableLabel* ConfigButton; |
44 | QLabel* MailField; | ||
45 | QPushButton* PushButton1; | ||
46 | QPushButton* TodoButton; | ||
47 | QPushButton* MailButton; | ||
48 | QPushButton* getridoffuckingstrippeldlinesbutton; | ||
49 | 47 | ||
50 | protected: | 48 | protected: |
51 | 49 | ||
52 | 50 | ||
53 | }; | 51 | }; |
54 | 52 | ||
55 | #endif // TODAYBASE_H | 53 | #endif |
diff --git a/core/pim/today/todayconfig.cpp b/core/pim/today/todayconfig.cpp index 905ec4b..08e59c0 100644 --- a/core/pim/today/todayconfig.cpp +++ b/core/pim/today/todayconfig.cpp | |||
@@ -1,11 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * todayconfig.cpp | 2 | * todayconfig.cpp |
3 | * | 3 | * |
4 | * --------------------- | ||
5 | * | ||
6 | * begin : Sun 10 17:20:00 CEST 2002 | ||
7 | * copyright : (c) 2002 by Maximilian Reiß | 4 | * copyright : (c) 2002 by Maximilian Reiß |
8 | * email : max.reiss@gmx.de | 5 | * email : harlekin@handhelds.org |
9 | * | 6 | * |
10 | */ | 7 | */ |
11 | /*************************************************************************** | 8 | /*************************************************************************** |
@@ -19,133 +16,205 @@ | |||
19 | 16 | ||
20 | #include "todayconfig.h" | 17 | #include "todayconfig.h" |
21 | 18 | ||
19 | #include <qpe/config.h> | ||
20 | #include <qpe/resource.h> | ||
21 | #include <qpe/qcopenvelope_qws.h> | ||
22 | |||
22 | #include <qcheckbox.h> | 23 | #include <qcheckbox.h> |
23 | #include <qframe.h> | ||
24 | #include <qlabel.h> | 24 | #include <qlabel.h> |
25 | #include <qspinbox.h> | 25 | #include <qspinbox.h> |
26 | #include <qtabwidget.h> | 26 | #include <qtabwidget.h> |
27 | #include <qwidget.h> | ||
28 | #include <qlayout.h> | 27 | #include <qlayout.h> |
29 | #include <qvariant.h> | 28 | #include <qheader.h> |
30 | //#include <qwhatsthis.h> | 29 | #include <qhbox.h> |
30 | #include <qvbox.h> | ||
31 | #include <qtoolbutton.h> | ||
32 | |||
33 | // for getenv | ||
34 | #include <stdlib.h> | ||
35 | |||
36 | class ToolButton : public QToolButton { | ||
37 | public: | ||
38 | ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE ) | ||
39 | : QToolButton( parent, name ) { | ||
40 | setTextLabel( name ); | ||
41 | setPixmap( Resource::loadPixmap( icon ) ); | ||
42 | setAutoRaise( TRUE ); | ||
43 | setFocusPolicy( QWidget::NoFocus ); | ||
44 | setToggleButton( t ); | ||
45 | connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot ); | ||
46 | } | ||
47 | }; | ||
31 | 48 | ||
32 | todayconfig::todayconfig( QWidget* parent, const char* name, bool modal, WFlags fl ) | 49 | |
50 | /** | ||
51 | * The class has currently quite some duplicate code. | ||
52 | * By that way it would be real easy to have it as seperate app in settings tab | ||
53 | * | ||
54 | */ | ||
55 | TodayConfig::TodayConfig( QWidget* parent, const char* name, bool modal, WFlags fl ) | ||
33 | : QDialog( parent, name, modal, fl ) { | 56 | : QDialog( parent, name, modal, fl ) { |
34 | if ( !name ) | 57 | |
58 | if ( !name ) { | ||
35 | setName( "todayconfig" ); | 59 | setName( "todayconfig" ); |
36 | resize( 175, 232 ); | 60 | } |
37 | setCaption( tr( "Today config" ) ); | 61 | setCaption( tr( "Today config" ) ); |
38 | 62 | ||
63 | QVBoxLayout *layout = new QVBoxLayout( this ); | ||
39 | TabWidget3 = new QTabWidget( this, "TabWidget3" ); | 64 | TabWidget3 = new QTabWidget( this, "TabWidget3" ); |
40 | TabWidget3->setGeometry( QRect( 0, 0, 220, 320 ) ); | ||
41 | TabWidget3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, TabWidget3->sizePolicy().hasHeightForWidth() ) ); | 65 | TabWidget3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, TabWidget3->sizePolicy().hasHeightForWidth() ) ); |
42 | TabWidget3->setAutoMask( FALSE ); | 66 | TabWidget3->setAutoMask( FALSE ); |
43 | TabWidget3->setTabShape( QTabWidget::Rounded ); | 67 | TabWidget3->setTabShape( QTabWidget::Rounded ); |
44 | 68 | layout->addWidget( TabWidget3 ); | |
45 | tab = new QWidget( TabWidget3, "tab" ); | ||
46 | |||
47 | Frame8 = new QFrame( tab, "Frame8" ); | ||
48 | Frame8->setGeometry( QRect( -5, 0, 200, 300 ) ); | ||
49 | Frame8->setFrameShape( QFrame::StyledPanel ); | ||
50 | Frame8->setFrameShadow( QFrame::Raised ); | ||
51 | |||
52 | TextLabel4 = new QLabel( Frame8, "TextLabel4" ); | ||
53 | TextLabel4->setGeometry( QRect( 20, 65, 100, 60 ) ); | ||
54 | TextLabel4->setText( tr( "Should the \n" | ||
55 | "location \n" | ||
56 | "be shown?" ) ); | ||
57 | |||
58 | TextLabel5 = new QLabel( Frame8, "TextLabel5" ); | ||
59 | TextLabel5->setGeometry( QRect( 20, 160, 120, 40 ) ); | ||
60 | TextLabel5->setText( tr( "Should the notes \n" | ||
61 | "be shown?" ) ); | ||
62 | |||
63 | CheckBox2 = new QCheckBox( Frame8, "CheckBox2" ); | ||
64 | CheckBox2->setGeometry( QRect( 158, 170, 27, 21 ) ); | ||
65 | //CheckBox2->setText( tr( "" ) ); | ||
66 | |||
67 | CheckBox1 = new QCheckBox( Frame8, "CheckBox1" ); | ||
68 | CheckBox1->setGeometry( QRect( 158, 65, 27, 50 ) ); | ||
69 | //CheckBox1->setText( tr( "" ) ); | ||
70 | |||
71 | CheckBox3 = new QCheckBox (Frame8, "CheckBox3" ); | ||
72 | CheckBox3->setGeometry( QRect( 158, 125, 27, 21 ) ); | ||
73 | |||
74 | TextLabel6 = new QLabel( Frame8, "All Day"); | ||
75 | TextLabel6->setGeometry( QRect( 20, 120, 100, 30 ) ); | ||
76 | TextLabel6->setText( tr( "Show only later\n" | ||
77 | "appointments") ); | ||
78 | |||
79 | SpinBox1 = new QSpinBox( Frame8, "SpinBox1" ); | ||
80 | SpinBox1->setGeometry( QRect( 115, 20, 58, 25 ) ); | ||
81 | SpinBox1->setMaxValue( 10 ); | ||
82 | SpinBox1->setValue( 5 ); | ||
83 | |||
84 | TextLabel3 = new QLabel( Frame8, "TextLabel3" ); | ||
85 | TextLabel3->setGeometry( QRect( 20, 10, 90, 60 ) ); | ||
86 | TextLabel3->setText( tr( "How many \n" | ||
87 | "appointment\n" | ||
88 | "should\n" | ||
89 | "be shown?" ) ); | ||
90 | TabWidget3->insertTab( tab, tr( "Calendar" ) ); | ||
91 | 69 | ||
92 | tab_2 = new QWidget( TabWidget3, "tab_2" ); | 70 | tab_2 = new QWidget( TabWidget3, "tab_2" ); |
71 | QVBoxLayout *tab2Layout = new QVBoxLayout( tab_2, 4 ,4 ); | ||
72 | QLabel *l = new QLabel( tr( "Load which plugins in what order:" ), tab_2 ); | ||
73 | tab2Layout->addWidget( l ); | ||
74 | QHBox *hbox1 = new QHBox( tab_2 ); | ||
75 | m_appletListView = new QListView( hbox1 ); | ||
76 | m_appletListView->addColumn( "PluginList" ); | ||
77 | m_appletListView->header()->hide(); | ||
78 | QVBox *vbox1 = new QVBox( hbox1 ); | ||
79 | new ToolButton( vbox1, tr( "Move Up" ), "opieplayer/up", this , SLOT( moveSelectedUp() ) ); | ||
80 | new ToolButton( vbox1, tr( "Move Down" ),"opieplayer/down", this , SLOT( moveSelectedDown() ) ); | ||
81 | tab2Layout->addWidget( hbox1 ); | ||
82 | |||
83 | TabWidget3->insertTab( tab_2, tr( "active/order" ) ); | ||
84 | tab_3 = new QWidget( TabWidget3, "tab_3" ); | ||
85 | QVBoxLayout *tab3Layout = new QVBoxLayout( tab_3 ); | ||
86 | QHBox *hbox_clip = new QHBox( tab_3 ); | ||
87 | TextLabel1 = new QLabel( hbox_clip, "TextLabel1" ); | ||
88 | TextLabel1->setText( tr( "Clip after how\n" | ||
89 | "many letters" ) ); | ||
90 | SpinBox7 = new QSpinBox( hbox_clip, "SpinBox7" ); | ||
91 | SpinBox7->setMaxValue( 80 ); | ||
92 | QHBox *hbox_auto = new QHBox( tab_3 ); | ||
93 | TextLabel2 = new QLabel( hbox_auto, "AutoStart" ); | ||
94 | TextLabel2->setText( tr( "autostart on \nresume? (Opie only)" ) ); | ||
95 | CheckBoxAuto = new QCheckBox( hbox_auto, "CheckBoxAuto" ); | ||
96 | QHBox *hbox_inactive = new QHBox( tab_3 ); | ||
97 | TimeLabel = new QLabel( hbox_inactive , "TimeLabel" ); | ||
98 | TimeLabel->setText( tr( "minutes inactive" ) ); | ||
99 | SpinBoxTime = new QSpinBox( hbox_inactive, "TimeSpinner"); | ||
100 | tab3Layout->addWidget( hbox_clip ); | ||
101 | tab3Layout->addWidget( hbox_auto ); | ||
102 | tab3Layout->addWidget( hbox_inactive ); | ||
103 | TabWidget3->insertTab( tab_3, tr( "Misc" ) ); | ||
93 | 104 | ||
94 | Frame9 = new QFrame( tab_2, "Frame9" ); | 105 | m_applets_changed = false; |
95 | Frame9->setGeometry( QRect( -5, 0, 230, 310 ) ); | ||
96 | Frame9->setFrameShape( QFrame::StyledPanel ); | ||
97 | Frame9->setFrameShadow( QFrame::Raised ); | ||
98 | 106 | ||
99 | TextLabel6 = new QLabel( Frame9, "TextLabel6" ); | 107 | connect ( m_appletListView , SIGNAL( clicked ( QListViewItem * ) ), this, SLOT( appletChanged ( ) ) ); |
100 | TextLabel6->setGeometry( QRect( 20, 10, 100, 60 ) ); | ||
101 | TextLabel6->setText( tr( "How many\n" | ||
102 | "tasks should \n" | ||
103 | "be shown?" ) ); | ||
104 | 108 | ||
105 | SpinBox2 = new QSpinBox( Frame9, "SpinBox2" ); | 109 | readConfig(); |
106 | SpinBox2->setGeometry( QRect( 115, 20, 58, 25 ) ); | 110 | } |
107 | SpinBox2->setMaxValue( 20 ); | ||
108 | SpinBox2->setValue( 5 ); | ||
109 | TabWidget3->insertTab( tab_2, tr( "Tasks" ) ); | ||
110 | 111 | ||
111 | tab_3 = new QWidget( TabWidget3, "tab_3" ); | ||
112 | 112 | ||
113 | Frame14 = new QFrame( tab_3, "Frame14" ); | 113 | /** |
114 | Frame14->setGeometry( QRect( -5, 0, 200, 220 ) ); | 114 | * Autostart, uses the new (opie only) autostart method in the launcher code. |
115 | Frame14->setFrameShape( QFrame::StyledPanel ); | 115 | * If registered against that today ist started on each resume. |
116 | Frame14->setFrameShadow( QFrame::Raised ); | 116 | */ |
117 | void TodayConfig::setAutoStart() { | ||
118 | Config cfg( "today" ); | ||
119 | cfg.setGroup( "Autostart" ); | ||
120 | int autostart = cfg.readNumEntry( "autostart", 1); | ||
121 | if ( autostart ) { | ||
122 | QCopEnvelope e( "QPE/System", "autoStart(QString,QString,QString)" ); | ||
123 | e << QString( "add" ); | ||
124 | e << QString( "today" ); | ||
125 | e << m_autoStartTimer; | ||
126 | } else { | ||
127 | QCopEnvelope e( "QPE/System", "autoStart(QString,QString)" ); | ||
128 | e << QString( "remove"); | ||
129 | e << QString( "today" ); | ||
130 | } | ||
131 | } | ||
117 | 132 | ||
118 | TextLabel1 = new QLabel( Frame14, "TextLabel1" ); | 133 | /** |
119 | TextLabel1->setGeometry( QRect( 20, 20, 100, 30 ) ); | 134 | * Read the config part |
120 | TextLabel1->setText( tr( "Clip after how\n" | 135 | */ |
121 | "many letters" ) ); | 136 | void TodayConfig::readConfig() { |
137 | Config cfg( "today" ); | ||
138 | cfg.setGroup( "Autostart" ); | ||
139 | m_autoStart = cfg.readNumEntry( "autostart", 1 ); | ||
140 | CheckBoxAuto->setChecked( m_autoStart ); | ||
141 | m_autoStartTimer = cfg.readEntry( "autostartdelay", "0" ); | ||
142 | SpinBoxTime->setValue( m_autoStartTimer.toInt() ); | ||
143 | |||
144 | cfg.setGroup( "Applets" ); | ||
145 | m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' ); | ||
146 | } | ||
122 | 147 | ||
123 | SpinBox7 = new QSpinBox( Frame14, "SpinBox7" ); | 148 | /** |
124 | SpinBox7->setGeometry( QRect( 115, 20, 58, 25 ) ); | 149 | * Write the config part |
125 | SpinBox7->setMaxValue( 80 ); | 150 | */ |
151 | void TodayConfig::writeConfig() { | ||
152 | Config cfg( "today" ); | ||
153 | cfg. setGroup ( "Applets" ); | ||
154 | if ( m_applets_changed ) { | ||
155 | QStringList exclude; | ||
156 | QStringList include; | ||
157 | QMap <QString, QCheckListItem *>::Iterator it; | ||
158 | for ( it = m_applets.begin(); it != m_applets. end (); ++it ) { | ||
159 | if ( !(*it)-> isOn () ) { | ||
160 | exclude << it.key(); | ||
161 | } else { | ||
162 | include << it.key(); | ||
163 | } | ||
164 | } | ||
165 | cfg.writeEntry( "ExcludeApplets", exclude, ',' ); | ||
166 | cfg.writeEntry( "IncludeApplets", include, ',' ); | ||
167 | } | ||
126 | 168 | ||
127 | TextLabel2 = new QLabel( Frame14, "AutoStart" ); | 169 | cfg.setGroup( "Autostart" ); |
128 | TextLabel2->setGeometry( QRect( 20, 60, 100, 45 ) ); | 170 | m_autoStart = CheckBoxAuto->isChecked(); |
129 | TextLabel2->setText( tr( "Should today be\n" | 171 | cfg.writeEntry( "autostart", m_autoStart ); |
130 | "autostarted on\n" | 172 | m_autoStartTimer = SpinBoxTime->value(); |
131 | "resume?" | 173 | cfg.readEntry( "autostartdelay", m_autoStartTimer ); |
132 | " (Opie only)" ) ); | 174 | } |
133 | 175 | ||
134 | CheckBoxAuto = new QCheckBox (Frame14, "CheckBoxAuto" ); | ||
135 | CheckBoxAuto->setGeometry( QRect( 158, 60, 27, 21 ) ); | ||
136 | 176 | ||
137 | TimeLabel = new QLabel( Frame14, "TimeLabel" ); | 177 | void TodayConfig::moveSelectedUp() { |
138 | TimeLabel->setGeometry( QRect ( 20, 120, 120, 45 ) ); | 178 | QListViewItem *item = m_appletListView->selectedItem(); |
139 | TimeLabel->setText( tr( "Activate the \n" | 179 | if ( item && item->itemAbove() ) { |
140 | "autostart after how\n" | 180 | item->itemAbove()->moveItem( item ); |
141 | "many minutes?" ) ); | 181 | } |
142 | SpinBoxTime = new QSpinBox( Frame14, "TimeSpinner"); | 182 | } |
143 | SpinBoxTime->setGeometry( QRect( 115, 120, 58, 25 ) ); | ||
144 | 183 | ||
145 | TabWidget3->insertTab( tab_3, tr( "Misc" ) ); | ||
146 | 184 | ||
185 | void TodayConfig::moveSelectedDown() { | ||
186 | QListViewItem *item = m_appletListView->selectedItem(); | ||
187 | if ( item && item->itemBelow() ) { | ||
188 | item->moveItem( item->itemBelow() ); | ||
147 | } | 189 | } |
190 | } | ||
191 | |||
192 | |||
193 | /** | ||
194 | * Set up the | ||
195 | */ | ||
196 | void TodayConfig::pluginManagement( QString libName, QString name, QPixmap icon ) { | ||
197 | |||
198 | QCheckListItem *item; | ||
199 | item = new QCheckListItem( m_appletListView, name, QCheckListItem::CheckBox ); | ||
200 | |||
201 | if ( !icon.isNull() ) { | ||
202 | item->setPixmap( 0, icon ); | ||
203 | } | ||
204 | |||
205 | qDebug (" SUCHNAME: " + name ); | ||
206 | if ( m_excludeApplets.find( libName ) == m_excludeApplets.end() ) { | ||
207 | item->setOn( TRUE ); | ||
208 | } | ||
209 | m_applets[libName] = item; | ||
210 | } | ||
211 | |||
212 | |||
213 | void TodayConfig::appletChanged() { | ||
214 | m_applets_changed = true; | ||
215 | } | ||
216 | |||
148 | 217 | ||
149 | todayconfig::~todayconfig() { | 218 | TodayConfig::~TodayConfig() { |
150 | } | 219 | } |
151 | 220 | ||
diff --git a/core/pim/today/todayconfig.h b/core/pim/today/todayconfig.h index 2986c4c..d5bdb4b 100644 --- a/core/pim/today/todayconfig.h +++ b/core/pim/today/todayconfig.h | |||
@@ -1,11 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * todayconfig.h | 2 | * todayconfig.h |
3 | * | 3 | * |
4 | * --------------------- | ||
5 | * | ||
6 | * begin : Sun 10 17:20:00 CEST 2002 | ||
7 | * copyright : (c) 2002 by Maximilian Reiß | 4 | * copyright : (c) 2002 by Maximilian Reiß |
8 | * email : max.reiss@gmx.de | 5 | * email : harlekin@handhelds.org |
9 | * | 6 | * |
10 | */ | 7 | */ |
11 | /*************************************************************************** | 8 | /*************************************************************************** |
@@ -16,51 +13,57 @@ | |||
16 | * (at your option) any later version. * | 13 | * (at your option) any later version. * |
17 | * * | 14 | * * |
18 | ***************************************************************************/ | 15 | ***************************************************************************/ |
16 | |||
19 | #ifndef TODAYCONFIG_H | 17 | #ifndef TODAYCONFIG_H |
20 | #define TODAYCONFIG_H | 18 | #define TODAYCONFIG_H |
21 | 19 | ||
22 | #include <qvariant.h> | 20 | #include <qvariant.h> |
23 | #include <qdialog.h> | 21 | #include <qdialog.h> |
24 | //class QVBoxLayout; | 22 | #include <qlistview.h> |
25 | class QHBoxLayout; | 23 | |
26 | class QGridLayout; | ||
27 | class QCheckBox; | 24 | class QCheckBox; |
28 | class QFrame; | ||
29 | class QLabel; | 25 | class QLabel; |
30 | class QSpinBox; | 26 | class QSpinBox; |
31 | class QTabWidget; | 27 | class QTabWidget; |
32 | class QWidget; | ||
33 | 28 | ||
34 | class todayconfig : public QDialog { | 29 | class TodayConfig : public QDialog { |
30 | |||
35 | Q_OBJECT | 31 | Q_OBJECT |
36 | 32 | ||
37 | public: | 33 | public: |
38 | todayconfig( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); | 34 | TodayConfig( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); |
39 | ~todayconfig(); | 35 | ~TodayConfig(); |
40 | 36 | ||
41 | QTabWidget* TabWidget3; | 37 | QTabWidget* TabWidget3; |
42 | QWidget* tab; | 38 | |
43 | QFrame* Frame8; | 39 | void writeConfig(); |
44 | QLabel* TextLabel4; | 40 | void pluginManagement( QString libName, QString name, QPixmap icon ); |
45 | QLabel* TextLabel5; | 41 | |
42 | protected slots: | ||
43 | void appletChanged(); | ||
44 | void moveSelectedUp(); | ||
45 | void moveSelectedDown(); | ||
46 | |||
47 | private: | ||
48 | void setAutoStart(); | ||
49 | void readConfig(); | ||
50 | |||
51 | QListView* m_appletListView; | ||
52 | QMap<QString,QCheckListItem*> m_applets; | ||
53 | |||
54 | int m_autoStart; | ||
55 | QString m_autoStartTimer; | ||
56 | QStringList m_excludeApplets; | ||
57 | bool m_applets_changed; | ||
58 | |||
46 | QLabel* TextLabel2; | 59 | QLabel* TextLabel2; |
47 | QCheckBox* CheckBox3; | ||
48 | QCheckBox* CheckBox2; | ||
49 | QCheckBox* CheckBox1; | ||
50 | QCheckBox* CheckBoxAuto; | 60 | QCheckBox* CheckBoxAuto; |
51 | QSpinBox* SpinBox1; | ||
52 | QLabel* TextLabel3; | ||
53 | QWidget* tab_2; | 61 | QWidget* tab_2; |
54 | QFrame* Frame9; | ||
55 | QLabel* TextLabel6; | ||
56 | QSpinBox* SpinBox2; | ||
57 | QWidget* tab_3; | 62 | QWidget* tab_3; |
58 | QFrame* Frame14; | ||
59 | QLabel* TextLabel1; | 63 | QLabel* TextLabel1; |
60 | QSpinBox* SpinBox7; | 64 | QSpinBox* SpinBox7; |
61 | QLabel* TimeLabel; | 65 | QLabel* TimeLabel; |
62 | QSpinBox* SpinBoxTime; | 66 | QSpinBox* SpinBoxTime; |
63 | |||
64 | }; | 67 | }; |
65 | 68 | ||
66 | #endif | 69 | #endif |
diff --git a/core/pim/today/todayplugininterface.h b/core/pim/today/todayplugininterface.h new file mode 100644 index 0000000..01e7d58 --- a/dev/null +++ b/core/pim/today/todayplugininterface.h | |||
@@ -0,0 +1,82 @@ | |||
1 | |||
2 | #ifndef TODAY_PLUGIN_INTERFACE | ||
3 | #define TODAY_PLUGIN_INTERFACE | ||
4 | |||
5 | #include <qpe/qcom.h> | ||
6 | #include "configwidget.h" | ||
7 | |||
8 | class QString; | ||
9 | class QWidget; | ||
10 | |||
11 | #ifndef IID_TodayPluginInterface | ||
12 | #define IID_TodayPluginInterface QUuid( 0x70481804, 0x2b50, 0x4fba, 0x80, 0xbb, 0x0b, 0xf8, 0xdc, 0x72, 0x04, 0x14) | ||
13 | #endif | ||
14 | |||
15 | /** | ||
16 | * | ||
17 | * | ||
18 | * | ||
19 | */ | ||
20 | class TodayPluginObject { | ||
21 | |||
22 | Q_OBJECT | ||
23 | |||
24 | public: | ||
25 | |||
26 | virtual ~TodayPluginObject() {}; | ||
27 | |||
28 | /** | ||
29 | * The name if the plugin | ||
30 | */ | ||
31 | virtual QString pluginName() const = 0; | ||
32 | |||
33 | /** | ||
34 | * Version numbering | ||
35 | */ | ||
36 | virtual double versionNumber() const = 0; | ||
37 | |||
38 | /** | ||
39 | * the path and name of the identifer icon that should be shown | ||
40 | * in "Resource" notation, that means only subdir/picname form $QPEDIR/pics | ||
41 | */ | ||
42 | virtual QString pixmapNameWidget() const = 0; | ||
43 | |||
44 | /** widget for the today view | ||
45 | * It _needs_ a parent here. | ||
46 | */ | ||
47 | virtual QWidget* widget( QWidget * ) = 0; | ||
48 | |||
49 | /** | ||
50 | * Pixmap used in the config widget | ||
51 | */ | ||
52 | virtual QString pixmapNameConfig() const = 0; | ||
53 | |||
54 | /** | ||
55 | * Config plugin widget - optional | ||
56 | * If the plugin has a config widget, it _needs_ a parent here. | ||
57 | */ | ||
58 | virtual ConfigWidget* configWidget( QWidget * ) = 0; | ||
59 | |||
60 | /** | ||
61 | * The application that should be assigned to the button (pixmap) | ||
62 | */ | ||
63 | virtual QString appName() const = 0; | ||
64 | |||
65 | /** | ||
66 | * minimum height the plugin at least should have | ||
67 | */ | ||
68 | virtual int minHeight() const = 0; | ||
69 | |||
70 | /** | ||
71 | * maximum height that should be used before starting scrolling | ||
72 | */ | ||
73 | virtual int maxHeight() const = 0; | ||
74 | |||
75 | }; | ||
76 | |||
77 | |||
78 | struct TodayPluginInterface : public QUnknownInterface { | ||
79 | virtual TodayPluginObject *guiPart() = 0; | ||
80 | }; | ||
81 | |||
82 | #endif | ||