summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-11-01 16:11:54 (UTC)
committer llornkcor <llornkcor>2002-11-01 16:11:54 (UTC)
commitf351da898f4dce9ad3fd8ee76d84912365dcb5ac (patch) (unidiff)
treecf131772846e5a3408a513f6432e83897b738328
parent9e4d914ade0af86707531a80e93a870e52738ce6 (diff)
downloadopie-f351da898f4dce9ad3fd8ee76d84912365dcb5ac.zip
opie-f351da898f4dce9ad3fd8ee76d84912365dcb5ac.tar.gz
opie-f351da898f4dce9ad3fd8ee76d84912365dcb5ac.tar.bz2
added timer delay
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/todayplugins/stockticker/stocktickerlib/stocktickerplugin.cpp1
-rw-r--r--noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp7
-rw-r--r--noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.h4
3 files changed, 11 insertions, 1 deletions
diff --git a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerplugin.cpp b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerplugin.cpp
index baf8198..24c151b 100644
--- a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerplugin.cpp
+++ b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerplugin.cpp
@@ -33,26 +33,27 @@ double StockTickerPlugin::versionNumber() const {
33 return 0.6; 33 return 0.6;
34} 34}
35 35
36QString StockTickerPlugin::pixmapNameWidget() const { 36QString StockTickerPlugin::pixmapNameWidget() const {
37 return "pass"; 37 return "pass";
38} 38}
39 39
40QWidget* StockTickerPlugin::widget( QWidget * wid ) { 40QWidget* StockTickerPlugin::widget( QWidget * wid ) {
41 return new StockTickerPluginWidget( wid, "StockTicker " ); 41 return new StockTickerPluginWidget( wid, "StockTicker " );
42} 42}
43 43
44QString StockTickerPlugin::pixmapNameConfig() const { 44QString StockTickerPlugin::pixmapNameConfig() const {
45 return 0l; 45 return 0l;
46} 46}
47 47
48TodayConfigWidget* StockTickerPlugin::configWidget( QWidget* wid ) { 48TodayConfigWidget* StockTickerPlugin::configWidget( QWidget* wid ) {
49 return 0l; 49 return 0l;
50} 50}
51 51
52QString StockTickerPlugin::appName() const { 52QString StockTickerPlugin::appName() const {
53 return "stockticker"; 53 return "stockticker";
54} 54}
55 55
56bool StockTickerPlugin::excludeFromRefresh() const { 56bool StockTickerPlugin::excludeFromRefresh() const {
57//return false;
57return true; 58return true;
58} 59}
diff --git a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp
index 3eaade4..6d53a91 100644
--- a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp
+++ b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp
@@ -1,64 +1,66 @@
1/* 1/*
2 * stocktickerpluginwidget.cpp 2 * stocktickerpluginwidget.cpp
3 * 3 *
4 * copyright : (c) 2002 by L.J. Potter 4 * copyright : (c) 2002 by L.J. Potter
5 * email : llornkcor@handhelds.org 5 * email : llornkcor@handhelds.org
6 * 6 *
7 */ 7 */
8/*************************************************************************** 8/***************************************************************************
9 * * 9 * *
10 * This program is free software; you can redistribute it and/or modify * 10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by * 11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or * 12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. * 13 * (at your option) any later version. *
14 * * 14 * *
15 ***************************************************************************/ 15 ***************************************************************************/
16 16
17#include <qvaluelist.h> 17#include <qvaluelist.h>
18#include <qtl.h> 18#include <qtl.h>
19#include <qstring.h> 19#include <qstring.h>
20#include <qstringlist.h> 20#include <qstringlist.h>
21#include <qobject.h> 21#include <qobject.h>
22#include <qlayout.h> 22#include <qlayout.h>
23#include <qlineedit.h> 23#include <qlineedit.h>
24#include <qregexp.h> 24#include <qregexp.h>
25#include <qtimer.h>
25 26
26#include <qpe/config.h> 27#include <qpe/config.h>
27#include <qpe/timestring.h> 28#include <qpe/timestring.h>
28#include <qpe/qcopenvelope_qws.h> 29#include <qpe/qcopenvelope_qws.h>
29 30
30#include "ticker.h" 31#include "ticker.h"
31 32
32extern "C" { 33extern "C" {
33#include "libstocks/stocks.h" 34#include "libstocks/stocks.h"
34} 35}
35 36
36#include "stocktickerpluginwidget.h" 37#include "stocktickerpluginwidget.h"
37 38
38StockTickerPluginWidget::StockTickerPluginWidget( QWidget *parent, const char* name) 39StockTickerPluginWidget::StockTickerPluginWidget( QWidget *parent, const char* name)
39 : QWidget(parent, name ) { 40 : QWidget(parent, name ) {
40 init(); 41 init();
42 startTimer(1000);
41} 43}
42 44
43StockTickerPluginWidget::~StockTickerPluginWidget() { 45StockTickerPluginWidget::~StockTickerPluginWidget() {
44} 46}
45 47
46void StockTickerPluginWidget::init() { 48void StockTickerPluginWidget::init() {
47 49
48 QHBoxLayout* layout = new QHBoxLayout( this ); 50 QHBoxLayout* layout = new QHBoxLayout( this );
49 51
50 stocktickerTicker = new Ticker(this); 52 stocktickerTicker = new Ticker(this);
51 stocktickerTicker->setMinimumHeight(15); 53 stocktickerTicker->setMinimumHeight(15);
52 connect( stocktickerTicker, SIGNAL( mousePressed()), this, SLOT( doStocks() )); 54 connect( stocktickerTicker, SIGNAL( mousePressed()), this, SLOT( doStocks() ));
53 55
54 layout->addWidget( stocktickerTicker); 56 layout->addWidget( stocktickerTicker);
55} 57}
56 58
57void StockTickerPluginWidget::doStocks() { 59void StockTickerPluginWidget::doStocks() {
58 60
59 Config cfg( "stockticker"); 61 Config cfg( "stockticker");
60 cfg.setGroup( "Symbols" ); 62 cfg.setGroup( "Symbols" );
61 QString symbollist; 63 QString symbollist;
62 symbollist = cfg.readEntry("Symbols", ""); 64 symbollist = cfg.readEntry("Symbols", "");
63 symbollist.replace(QRegExp(" "),"+");//seperated by + 65 symbollist.replace(QRegExp(" "),"+");//seperated by +
64// qDebug(symbollist); 66// qDebug(symbollist);
@@ -216,24 +218,29 @@ void StockTickerPluginWidget::getStocks( const char *blah) {
216 free_stocks(stocks_quotes); 218 free_stocks(stocks_quotes);
217 219
218} 220}
219 221
220void StockTickerPluginWidget::DefProxy(void) { 222void StockTickerPluginWidget::DefProxy(void) {
221 char *proxy; 223 char *proxy;
222 libstocks_return_code error; 224 libstocks_return_code error;
223 225
224 /* Proxy support */ 226 /* Proxy support */
225 /* Checks for "http_proxy" environment variable */ 227 /* Checks for "http_proxy" environment variable */
226 proxy = getenv("http_proxy"); 228 proxy = getenv("http_proxy");
227 if(proxy) { 229 if(proxy) {
228 /* printf("proxy set\n"); */ 230 /* printf("proxy set\n"); */
229 error = set_proxy(proxy); 231 error = set_proxy(proxy);
230 if (error) { 232 if (error) {
231// printf("Proxy error (%d)\n", error); 233// printf("Proxy error (%d)\n", error);
232 QString tempString; 234 QString tempString;
233 tempString.sprintf("Proxy error (%d)\n", error); 235 tempString.sprintf("Proxy error (%d)\n", error);
234 output = tempString; 236 output = tempString;
235 return; 237 return;
236// exit(1); 238// exit(1);
237 } 239 }
238 } 240 }
239} 241}
242
243void StockTickerPluginWidget::timerEvent( QTimerEvent *e ) {
244 killTimer(e->timerId());
245 doStocks();
246}
diff --git a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.h b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.h
index 6524ae4..6a15f56 100644
--- a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.h
+++ b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.h
@@ -17,46 +17,48 @@
17 17
18#ifndef STOCKTICKERL_PLUGIN_WIDGET_H 18#ifndef STOCKTICKERL_PLUGIN_WIDGET_H
19#define STOCKTICKERL_PLUGIN_WIDGET_H 19#define STOCKTICKERL_PLUGIN_WIDGET_H
20 20
21#include <qstring.h> 21#include <qstring.h>
22#include <qwidget.h> 22#include <qwidget.h>
23#include <qlineedit.h> 23#include <qlineedit.h>
24 24
25#include <opie/tododb.h> 25#include <opie/tododb.h>
26#include <opie/oclickablelabel.h> 26#include <opie/oclickablelabel.h>
27 27
28#include <sys/types.h> 28#include <sys/types.h>
29#include <sys/uio.h> 29#include <sys/uio.h>
30#include <unistd.h> 30#include <unistd.h>
31#include <stdio.h> 31#include <stdio.h>
32#include <stdlib.h> 32#include <stdlib.h>
33#include <string.h> 33#include <string.h>
34 34
35#include "ticker.h" 35#include "ticker.h"
36 36
37/* extern "C" { */ 37/* extern "C" { */
38/* #include "stocks.h" */ 38/* #include "stocks.h" */
39/* } */ 39/* } */
40 40
41class QTimer;
42
41class StockTickerPluginWidget : public QWidget { 43class StockTickerPluginWidget : public QWidget {
42 44
43 Q_OBJECT 45 Q_OBJECT
44 46
45public: 47public:
46 StockTickerPluginWidget( QWidget *parent, const char *name ); 48 StockTickerPluginWidget( QWidget *parent, const char *name );
47 ~StockTickerPluginWidget(); 49 ~StockTickerPluginWidget();
48 QString output; 50 QString output;
49 51
50protected slots: 52protected slots:
51 void doStocks(); 53 void doStocks();
52 54
53private: 55private:
54 Ticker *stocktickerTicker; 56 Ticker *stocktickerTicker;
55 57 void timerEvent( QTimerEvent * );
56 void init(); 58 void init();
57 void getStocks( const char *stock_liste); 59 void getStocks( const char *stock_liste);
58 void DefProxy(void); 60 void DefProxy(void);
59 61
60}; 62};
61 63
62#endif 64#endif