4 files changed, 17 insertions, 7 deletions
diff --git a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerlib.pro b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerlib.pro index 28ef072..5281373 100644 --- a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerlib.pro +++ b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerlib.pro @@ -1,26 +1,26 @@ TEMPLATE = lib CONFIG -= moc CONFIG += qt debug -HEADERS = stocktickerplugin.h stocktickeruginimpl.h stocktickerpluginwidget.h ticker.h \ +HEADERS = stocktickerplugin.h stocktickeruginimpl.h stocktickerpluginwidget.h ticker.h stocktickerconfig.h \ ../libstocks/csv.h \ ../libstocks/http.h \ ../libstocks/lists.h \ ../libstocks/stocks.h -SOURCES = stocktickerplugin.cpp stocktickerpluginimpl.cpp stocktickerpluginwidget.cpp ticker.cpp \ +SOURCES = stocktickerplugin.cpp stocktickerpluginimpl.cpp stocktickerpluginwidget.cpp ticker.cpp stocktickerconfig.cpp \ ../libstocks/csv.c \ ../libstocks/currency.c \ ../libstocks/history.c \ ../libstocks/http.c \ ../libstocks/lists.c \ ../libstocks/stocks.c INCLUDEPATH += $(OPIEDIR)/include \ ../ ../library DEPENDPATH += $(OPIEDIR)/include \ ../ ../library LIBS+= -lqpe -lopie TMAKE_CFLAGS += -D__UNIX__ DESTDIR = $(OPIEDIR)/plugins/today diff --git a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerplugin.cpp b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerplugin.cpp index 24c151b..2eb1697 100644 --- a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerplugin.cpp +++ b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerplugin.cpp @@ -4,56 +4,57 @@ * copyright : (c) 2002 by L.J. Potter * email : llornkcor@handhelds.org * */ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #include "stocktickerplugin.h" #include "stocktickerpluginwidget.h" - +#include "stocktickerconfig.h" StockTickerPlugin::StockTickerPlugin() { } StockTickerPlugin::~StockTickerPlugin() { } QString StockTickerPlugin::pluginName() const { return QObject::tr( "StockTicker plugin" ); } double StockTickerPlugin::versionNumber() const { return 0.6; } QString StockTickerPlugin::pixmapNameWidget() const { return "pass"; } QWidget* StockTickerPlugin::widget( QWidget * wid ) { return new StockTickerPluginWidget( wid, "StockTicker " ); } QString StockTickerPlugin::pixmapNameConfig() const { return 0l; } TodayConfigWidget* StockTickerPlugin::configWidget( QWidget* wid ) { - return 0l; + return new StocktickerPluginConfig( wid , "Stockticker" ); } QString StockTickerPlugin::appName() const { return "stockticker"; } bool StockTickerPlugin::excludeFromRefresh() const { -//return false; + return true; } + diff --git a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp index aabb4d2..e178338 100644 --- a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp +++ b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp @@ -41,32 +41,39 @@ StockTickerPluginWidget::StockTickerPluginWidget( QWidget *parent, const char* init(); startTimer(1000); } StockTickerPluginWidget::~StockTickerPluginWidget() { } void StockTickerPluginWidget::init() { QHBoxLayout* layout = new QHBoxLayout( this ); stocktickerTicker = new Ticker(this); stocktickerTicker->setMinimumHeight(15); connect( stocktickerTicker, SIGNAL( mousePressed()), this, SLOT( doStocks() )); layout->addWidget( stocktickerTicker); + + Config cfg( "stockticker"); + cfg.setGroup("Timer"); + timerDelay= cfg.readNumEntry("Delay",0); + if(timerDelay > 0) + startTimer(timerDelay*60000); + } void StockTickerPluginWidget::doStocks() { Config cfg( "stockticker"); cfg.setGroup( "Symbols" ); QString symbollist; symbollist = cfg.readEntry("Symbols", ""); symbollist.replace(QRegExp(" "),"+");//seperated by + // qDebug(symbollist); getStocks( symbollist.latin1()); stocktickerTicker->setText( output ); } @@ -107,33 +114,33 @@ void StockTickerPluginWidget::getStocks( const char *blah) { if (error) { printf("Error in getting stocks (%d)\n", error); tempString.sprintf("Error in getting stocks (%d)\n", error); output =tempString; return; // exit(1); } stocks_tmp = stocks_quotes; /* Displays the stocks */ while(stocks_tmp!=0){ if (stocks_tmp->Time) { // printf("%s ", stocks_tmp->Time); - tempString.sprintf("|| %s ", stocks_tmp->Time); + tempString.sprintf("| %s ", stocks_tmp->Time); tempString.replace(QRegExp("\""),""); if( dotimeCheck) output +=tempString; } if (stocks_tmp->Date) { // printf("%s ", stocks_tmp->Date); tempString.sprintf("| %s ", stocks_tmp->Date); tempString.replace(QRegExp("\""),""); if(dodateCheck) output +=tempString; } // printf("\n"); // printf("----------------------------------------\n"); if ( strlen(stocks_tmp->Symbol) > 20 ) { @@ -230,17 +237,19 @@ void StockTickerPluginWidget::DefProxy(void) { /* printf("proxy set\n"); */ error = set_proxy(proxy); if (error) { // printf("Proxy error (%d)\n", error); QString tempString; tempString.sprintf("Proxy error (%d)\n", error); output = tempString; return; // exit(1); } } } void StockTickerPluginWidget::timerEvent( QTimerEvent *e ) { killTimer(e->timerId()); doStocks(); + if(timerDelay > 0) + startTimer(timerDelay*1000); } diff --git a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.h b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.h index 6a15f56..8f3441d 100644 --- a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.h +++ b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.h @@ -45,20 +45,20 @@ class StockTickerPluginWidget : public QWidget { Q_OBJECT public: StockTickerPluginWidget( QWidget *parent, const char *name ); ~StockTickerPluginWidget(); QString output; protected slots: void doStocks(); private: Ticker *stocktickerTicker; void timerEvent( QTimerEvent * ); void init(); void getStocks( const char *stock_liste); void DefProxy(void); - + int timerDelay; }; #endif |