author | drw <drw> | 2004-03-02 16:38:47 (UTC) |
---|---|---|
committer | drw <drw> | 2004-03-02 16:38:47 (UTC) |
commit | 2c00fdd8f3b0c9680ee642a78dfd6587f32e8460 (patch) (unidiff) | |
tree | ba73624ab704354f7c14db80dc4f2322920a7407 | |
parent | c4c97ef4ccf9d379ff59560c3ae3c32f95fc51d1 (diff) | |
download | opie-2c00fdd8f3b0c9680ee642a78dfd6587f32e8460.zip opie-2c00fdd8f3b0c9680ee642a78dfd6587f32e8460.tar.gz opie-2c00fdd8f3b0c9680ee642a78dfd6587f32e8460.tar.bz2 |
Today stock ticker plugin: libopie -> libopie2
11 files changed, 43 insertions, 45 deletions
diff --git a/noncore/todayplugins/stockticker/config.in b/noncore/todayplugins/stockticker/config.in index 83e7fbd..f0fd4aa 100644 --- a/noncore/todayplugins/stockticker/config.in +++ b/noncore/todayplugins/stockticker/config.in | |||
@@ -1,7 +1,7 @@ | |||
1 | config TODAY_STOCKTICKER | 1 | config TODAY_STOCKTICKER |
2 | boolean "opie-today-stocktickerplugin (stock ticker)" | 2 | boolean "opie-today-stocktickerplugin (stock ticker)" |
3 | default "y" | 3 | default "y" |
4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE && TODAY | 4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBOPIE2PIM && LIBOPIE2UI && TODAY |
5 | 5 | ||
6 | source noncore/todayplugins/stockticker/stockticker/config.in | 6 | source noncore/todayplugins/stockticker/stockticker/config.in |
7 | source noncore/todayplugins/stockticker/stocktickerlib/config.in | 7 | source noncore/todayplugins/stockticker/stocktickerlib/config.in |
diff --git a/noncore/todayplugins/stockticker/opie-today-stocktickerplugin.control b/noncore/todayplugins/stockticker/opie-today-stocktickerplugin.control index 3e3bad1..f04ad64 100644 --- a/noncore/todayplugins/stockticker/opie-today-stocktickerplugin.control +++ b/noncore/todayplugins/stockticker/opie-today-stocktickerplugin.control | |||
@@ -1,9 +1,9 @@ | |||
1 | Package: opie-today-stocktickerplugin | 1 | Package: opie-today-stocktickerplugin |
2 | Files: plugins/today/libtodaystocktickerplugin.so* bin/stockticker pics/stockticker/stockticker.png | 2 | Files: plugins/today/libtodaystocktickerplugin.so* bin/stockticker pics/stockticker/stockticker.png |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/plugins | 4 | Section: opie/plugins |
5 | Maintainer: L.J. Potter <lpotter@trolltech.com> | 5 | Maintainer: L.J. Potter <lpotter@trolltech.com> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Depends: libqte2, opie-today | 7 | Depends: libqte2, libopiecore2, libopiepim2, libopieui2, opie-today |
8 | Description: Stock ticker plugin for Today | 8 | Description: Stock ticker plugin for Today |
9 | Version: $QPE_VERSION$EXTRAVERSION | 9 | Version: $QPE_VERSION$EXTRAVERSION |
diff --git a/noncore/todayplugins/stockticker/stockticker/config.in b/noncore/todayplugins/stockticker/stockticker/config.in index d9e0f1f..1252b63 100644 --- a/noncore/todayplugins/stockticker/stockticker/config.in +++ b/noncore/todayplugins/stockticker/stockticker/config.in | |||
@@ -1,5 +1,5 @@ | |||
1 | config TODAY_STOCKTICKERSUB | 1 | config TODAY_STOCKTICKERSUB |
2 | boolean | 2 | boolean |
3 | depends TODAY_STOCKTICKERLIB | 3 | depends TODAY_STOCKTICKERLIB |
4 | default "y" if TODAY_STOCKTICKER | 4 | default "y" if TODAY_STOCKTICKER |
5 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE && TODAY | 5 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && TODAY |
diff --git a/noncore/todayplugins/stockticker/stockticker/inputDialog.cpp b/noncore/todayplugins/stockticker/stockticker/inputDialog.cpp index 64798f4..b3fa708 100644 --- a/noncore/todayplugins/stockticker/stockticker/inputDialog.cpp +++ b/noncore/todayplugins/stockticker/stockticker/inputDialog.cpp | |||
@@ -1,89 +1,86 @@ | |||
1 | #include "inputDialog.h" | 1 | #include "inputDialog.h" |
2 | 2 | ||
3 | #include <qapplication.h> | 3 | #include <qapplication.h> |
4 | |||
5 | #include <qlayout.h> | 4 | #include <qlayout.h> |
6 | #include <qcheckbox.h> | 5 | #include <qcheckbox.h> |
7 | #include <qlineedit.h> | 6 | #include <qlineedit.h> |
8 | #include <qvariant.h> | 7 | #include <qvariant.h> |
9 | #include <qpushbutton.h> | 8 | #include <qpushbutton.h> |
10 | #include <qwhatsthis.h> | 9 | #include <qwhatsthis.h> |
11 | #include <qlabel.h> | 10 | #include <qlabel.h> |
12 | #include <qlayout.h> | 11 | #include <qlayout.h> |
13 | #include <qpe/config.h> | 12 | #include <qpe/config.h> |
14 | #include <qstringlist.h> | 13 | #include <qstringlist.h> |
15 | #include <qmainwindow.h> | 14 | #include <qmainwindow.h> |
16 | #include "helpwindow.h" | 15 | #include "helpwindow.h" |
17 | 16 | ||
18 | #include <opie/oprocess.h> | ||
19 | |||
20 | #include <stdlib.h> | 17 | #include <stdlib.h> |
21 | // #include <sys/stat.h> | 18 | // #include <sys/stat.h> |
22 | // #include <unistd.h> | 19 | // #include <unistd.h> |
23 | 20 | ||
24 | InputDialog::InputDialog( ) | 21 | InputDialog::InputDialog( ) |
25 | : QMainWindow( 0x0, 0x0, WStyle_ContextHelp ) { | 22 | : QMainWindow( 0x0, 0x0, WStyle_ContextHelp ) { |
26 | setCaption( tr("Symbol Lookup")); | 23 | setCaption( tr("Symbol Lookup")); |
27 | 24 | ||
28 | QGridLayout *layout = new QGridLayout( this ); | 25 | QGridLayout *layout = new QGridLayout( this ); |
29 | layout->setSpacing(6); | 26 | layout->setSpacing(6); |
30 | layout->setMargin( 2); | 27 | layout->setMargin( 2); |
31 | 28 | ||
32 | LineEdit1 = new QLineEdit( this, "LineEdit1" ); | 29 | LineEdit1 = new QLineEdit( this, "LineEdit1" ); |
33 | LineEdit1->setFocus(); | 30 | LineEdit1->setFocus(); |
34 | 31 | ||
35 | layout->addMultiCellWidget( LineEdit1, 0, 0, 0, 3); | 32 | layout->addMultiCellWidget( LineEdit1, 0, 0, 0, 3); |
36 | 33 | ||
37 | QLabel *label; | 34 | QLabel *label; |
38 | label = new QLabel(this); | 35 | label = new QLabel(this); |
39 | label->setText( tr("Enter something to lookup / search.")); | 36 | label->setText( tr("Enter something to lookup / search.")); |
40 | label->setMaximumHeight(60); | 37 | label->setMaximumHeight(60); |
41 | layout->addMultiCellWidget( label, 1, 1, 0, 3); | 38 | layout->addMultiCellWidget( label, 1, 1, 0, 3); |
42 | 39 | ||
43 | connect(LineEdit1,SIGNAL(returnPressed()),this,SLOT(doLookup())); | 40 | connect(LineEdit1,SIGNAL(returnPressed()),this,SLOT(doLookup())); |
44 | QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Expanding ); | 41 | QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Expanding ); |
45 | layout->addItem( spacer, 8, 0 ); | 42 | layout->addItem( spacer, 8, 0 ); |
46 | 43 | ||
47 | } | 44 | } |
48 | 45 | ||
49 | InputDialog::~InputDialog() { | 46 | InputDialog::~InputDialog() { |
50 | } | 47 | } |
51 | 48 | ||
52 | void InputDialog::doLookup() { | 49 | void InputDialog::doLookup() { |
53 | // http://finance.yahoo.com/l?m=&s=siemens&t= | 50 | // http://finance.yahoo.com/l?m=&s=siemens&t= |
54 | 51 | ||
55 | QString url = "\"http://finance.yahoo.com/l?m=&s="+LineEdit1->text()+"\""; | 52 | QString url = "\"http://finance.yahoo.com/l?m=&s="+LineEdit1->text()+"\""; |
56 | QString tempHtml = "/tmp/stockticker.html"; | 53 | QString tempHtml = "/tmp/stockticker.html"; |
57 | QString cmd = "wget -O "+tempHtml+" "+url; | 54 | QString cmd = "wget -O "+tempHtml+" "+url; |
58 | qDebug(cmd); | 55 | qDebug(cmd); |
59 | 56 | ||
60 | 57 | ||
61 | /* | 58 | /* |
62 | OProcess proc; | 59 | OProcess proc; |
63 | proc << "/usr/bin/wget"; | 60 | proc << "/usr/bin/wget"; |
64 | proc<<"-O"<< tempHtml<< url; | 61 | proc<<"-O"<< tempHtml<< url; |
65 | 62 | ||
66 | connect( &proc, SIGNAL( processExited(OProcess*)),this, SLOT( showBrowser(OProcess*))); | 63 | connect( &proc, SIGNAL( processExited(OProcess*)),this, SLOT( showBrowser(OProcess*))); |
67 | proc.start( OProcess::NotifyOnExit); | 64 | proc.start( OProcess::NotifyOnExit); |
68 | */ | 65 | */ |
69 | system(cmd.latin1()); | 66 | system(cmd.latin1()); |
70 | HelpWindow *StockLookup = new HelpWindow( tempHtml,".",this, "SymbolLookup"); | 67 | HelpWindow *StockLookup = new HelpWindow( tempHtml,".",this, "SymbolLookup"); |
71 | StockLookup->setCaption("Symbol"); | 68 | StockLookup->setCaption("Symbol"); |
72 | StockLookup->showMaximized(); | 69 | StockLookup->showMaximized(); |
73 | StockLookup->show(); | 70 | StockLookup->show(); |
74 | LineEdit1->text(); | 71 | LineEdit1->text(); |
75 | 72 | ||
76 | 73 | ||
77 | } | 74 | } |
78 | 75 | ||
79 | void InputDialog::showBrowser(OProcess*) { | 76 | void InputDialog::showBrowser(OProcess*) { |
80 | qDebug("BLAH"); | 77 | qDebug("BLAH"); |
81 | QString tempHtml = "/tmp/stockticker.html"; | 78 | QString tempHtml = "/tmp/stockticker.html"; |
82 | 79 | ||
83 | HelpWindow *StockLookup = new HelpWindow( tempHtml,".",this, "SymbolLookup"); | 80 | HelpWindow *StockLookup = new HelpWindow( tempHtml,".",this, "SymbolLookup"); |
84 | StockLookup->setCaption("Symbol"); | 81 | StockLookup->setCaption("Symbol"); |
85 | StockLookup->showMaximized(); | 82 | StockLookup->showMaximized(); |
86 | StockLookup->show(); | 83 | StockLookup->show(); |
87 | LineEdit1->text(); | 84 | LineEdit1->text(); |
88 | 85 | ||
89 | } | 86 | } |
diff --git a/noncore/todayplugins/stockticker/stockticker/inputDialog.h b/noncore/todayplugins/stockticker/stockticker/inputDialog.h index 15c2f22..a1c00bd 100644 --- a/noncore/todayplugins/stockticker/stockticker/inputDialog.h +++ b/noncore/todayplugins/stockticker/stockticker/inputDialog.h | |||
@@ -1,29 +1,30 @@ | |||
1 | 1 | ||
2 | #ifndef INPUTDIALOG_H | 2 | #ifndef INPUTDIALOG_H |
3 | #define INPUTDIALOG_H | 3 | #define INPUTDIALOG_H |
4 | 4 | ||
5 | #include <opie2/oprocess.h> | ||
6 | |||
5 | #include <qvariant.h> | 7 | #include <qvariant.h> |
6 | #include <qdialog.h> | 8 | #include <qdialog.h> |
7 | #include <qmainwindow.h> | 9 | #include <qmainwindow.h> |
8 | #include <opie/oprocess.h> | ||
9 | 10 | ||
10 | class QLineEdit; | 11 | class QLineEdit; |
11 | class QCheckBox; | 12 | class QCheckBox; |
12 | 13 | ||
13 | class InputDialog : public QMainWindow { | 14 | class InputDialog : public QMainWindow { |
14 | Q_OBJECT | 15 | Q_OBJECT |
15 | 16 | ||
16 | public: | 17 | public: |
17 | InputDialog( ); | 18 | InputDialog( ); |
18 | ~InputDialog(); | 19 | ~InputDialog(); |
19 | 20 | ||
20 | private: | 21 | private: |
21 | QLineEdit* LineEdit1; | 22 | QLineEdit* LineEdit1; |
22 | private slots: | 23 | private slots: |
23 | void doLookup(); | 24 | void doLookup(); |
24 | void showBrowser(OProcess*); | 25 | void showBrowser(OProcess*); |
25 | protected slots: | 26 | protected slots: |
26 | 27 | ||
27 | }; | 28 | }; |
28 | 29 | ||
29 | #endif // INPUTDIALOG_H | 30 | #endif // INPUTDIALOG_H |
diff --git a/noncore/todayplugins/stockticker/stockticker/stockticker.pro b/noncore/todayplugins/stockticker/stockticker/stockticker.pro index 38a9425..a33c877 100644 --- a/noncore/todayplugins/stockticker/stockticker/stockticker.pro +++ b/noncore/todayplugins/stockticker/stockticker/stockticker.pro | |||
@@ -1,12 +1,12 @@ | |||
1 | TEMPLATE = app | 1 | TEMPLATE = app |
2 | CONFIG = qt warn_on release | 2 | CONFIG = qt warn_on release |
3 | HEADERS = inputDialog.h helpwindow.h | 3 | HEADERS = inputDialog.h helpwindow.h |
4 | SOURCES = inputDialog.cpp helpwindow.cpp main.cpp | 4 | SOURCES = inputDialog.cpp helpwindow.cpp main.cpp |
5 | INTERFACES = | 5 | INTERFACES = |
6 | TARGET = stockticker | 6 | TARGET = stockticker |
7 | INCLUDEPATH += $(OPIEDIR)/include | 7 | INCLUDEPATH += $(OPIEDIR)/include |
8 | DEPENDPATH += $(OPIEDIR)/include | 8 | DEPENDPATH += $(OPIEDIR)/include |
9 | LIBS+= -lqpe -lopie | 9 | LIBS+= -lqpe -lopiecore2 |
10 | DESTDIR = $(OPIEDIR)/bin | 10 | DESTDIR = $(OPIEDIR)/bin |
11 | 11 | ||
12 | include ( $(OPIEDIR)/include.pro ) | 12 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerconfig.cpp b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerconfig.cpp index 915233a..009d390 100644 --- a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerconfig.cpp +++ b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerconfig.cpp | |||
@@ -1,209 +1,209 @@ | |||
1 | /* | 1 | /* |
2 | * stocktickeRconfig.cpp | 2 | * stocktickeRconfig.cpp |
3 | * | 3 | * |
4 | * copyright : (c) 2002 by ljp | 4 | * copyright : (c) 2002 by ljp |
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 "stocktickerconfig.h" | 17 | #include "stocktickerconfig.h" |
18 | #include <opie/todayconfigwidget.h> | 18 | |
19 | #include <opie2/todayconfigwidget.h> | ||
19 | 20 | ||
20 | #include <qpe/config.h> | 21 | #include <qpe/config.h> |
21 | 22 | ||
22 | #include <qapplication.h> | 23 | #include <qapplication.h> |
23 | |||
24 | #include <qlayout.h> | 24 | #include <qlayout.h> |
25 | #include <qspinbox.h> | 25 | #include <qspinbox.h> |
26 | #include <qcheckbox.h> | 26 | #include <qcheckbox.h> |
27 | #include <qlineedit.h> | 27 | #include <qlineedit.h> |
28 | #include <qvariant.h> | 28 | #include <qvariant.h> |
29 | #include <qpushbutton.h> | 29 | #include <qpushbutton.h> |
30 | #include <qwhatsthis.h> | 30 | #include <qwhatsthis.h> |
31 | #include <qlabel.h> | 31 | #include <qlabel.h> |
32 | #include <qstringlist.h> | 32 | #include <qstringlist.h> |
33 | #include <qmainwindow.h> | 33 | #include <qmainwindow.h> |
34 | 34 | ||
35 | #include <stdlib.h> | 35 | #include <stdlib.h> |
36 | 36 | ||
37 | StocktickerPluginConfig::StocktickerPluginConfig( QWidget *parent, const char* name) | 37 | StocktickerPluginConfig::StocktickerPluginConfig( QWidget *parent, const char* name) |
38 | : TodayConfigWidget(parent, name ) { | 38 | : TodayConfigWidget(parent, name ) { |
39 | 39 | ||
40 | QGridLayout *layout = new QGridLayout( this ); | 40 | QGridLayout *layout = new QGridLayout( this ); |
41 | layout->setSpacing(2); | 41 | layout->setSpacing(2); |
42 | layout->setMargin( 2); | 42 | layout->setMargin( 2); |
43 | 43 | ||
44 | LineEdit1 = new QLineEdit( this, "LineEdit1" ); | 44 | LineEdit1 = new QLineEdit( this, "LineEdit1" ); |
45 | LineEdit1->setFocus(); | 45 | LineEdit1->setFocus(); |
46 | // QWhatsThis::add( LineEdit1, tr("Enter the stock symbols you want to be shown here.")); | 46 | // QWhatsThis::add( LineEdit1, tr("Enter the stock symbols you want to be shown here.")); |
47 | 47 | ||
48 | layout->addMultiCellWidget( LineEdit1, 0, 0, 0, 4); | 48 | layout->addMultiCellWidget( LineEdit1, 0, 0, 0, 4); |
49 | 49 | ||
50 | Config cfg( "stockticker"); | 50 | Config cfg( "stockticker"); |
51 | cfg.setGroup( "Symbols" ); | 51 | cfg.setGroup( "Symbols" ); |
52 | QString symbollist; | 52 | QString symbollist; |
53 | symbollist = cfg.readEntry("Symbols", ""); | 53 | symbollist = cfg.readEntry("Symbols", ""); |
54 | LineEdit1->setText(symbollist); | 54 | LineEdit1->setText(symbollist); |
55 | 55 | ||
56 | QLabel *label; | 56 | QLabel *label; |
57 | label = new QLabel(this); | 57 | label = new QLabel(this); |
58 | label->setText( tr("Enter stock symbols seperated\nby a space.")); | 58 | label->setText( tr("Enter stock symbols seperated\nby a space.")); |
59 | label->setMaximumHeight(60); | 59 | label->setMaximumHeight(60); |
60 | layout->addMultiCellWidget( label, 1, 1, 0, 4); | 60 | layout->addMultiCellWidget( label, 1, 1, 0, 4); |
61 | 61 | ||
62 | cfg.setGroup( "Fields" ); | 62 | cfg.setGroup( "Fields" ); |
63 | 63 | ||
64 | timeCheck= new QCheckBox ( "Time",this ); | 64 | timeCheck= new QCheckBox ( "Time",this ); |
65 | timeCheck->setChecked( cfg.readBoolEntry("timeCheck",1)); | 65 | timeCheck->setChecked( cfg.readBoolEntry("timeCheck",1)); |
66 | layout->addMultiCellWidget(timeCheck, 2, 2, 0, 0 ); | 66 | layout->addMultiCellWidget(timeCheck, 2, 2, 0, 0 ); |
67 | QWhatsThis::add( timeCheck, tr("Toggles Time of current price field")); | 67 | QWhatsThis::add( timeCheck, tr("Toggles Time of current price field")); |
68 | 68 | ||
69 | dateCheck= new QCheckBox ( "Date", this ); | 69 | dateCheck= new QCheckBox ( "Date", this ); |
70 | dateCheck->setChecked( cfg.readBoolEntry("dateCheck",1)); | 70 | dateCheck->setChecked( cfg.readBoolEntry("dateCheck",1)); |
71 | layout->addMultiCellWidget( dateCheck, 2, 2, 1, 1 ); | 71 | layout->addMultiCellWidget( dateCheck, 2, 2, 1, 1 ); |
72 | QWhatsThis::add(dateCheck, tr("Toggles date field")); | 72 | QWhatsThis::add(dateCheck, tr("Toggles date field")); |
73 | 73 | ||
74 | symbolCheck= new QCheckBox ( "Symbol", this ); | 74 | symbolCheck= new QCheckBox ( "Symbol", this ); |
75 | symbolCheck->setChecked( cfg.readBoolEntry("symbolCheck",1)); | 75 | symbolCheck->setChecked( cfg.readBoolEntry("symbolCheck",1)); |
76 | layout->addMultiCellWidget( symbolCheck, 2, 2, 2, 2 ); | 76 | layout->addMultiCellWidget( symbolCheck, 2, 2, 2, 2 ); |
77 | QWhatsThis::add(symbolCheck, tr("Toggles Symbol field")); | 77 | QWhatsThis::add(symbolCheck, tr("Toggles Symbol field")); |
78 | 78 | ||
79 | nameCheck= new QCheckBox ( "Name", this ); | 79 | nameCheck= new QCheckBox ( "Name", this ); |
80 | nameCheck->setChecked( cfg.readBoolEntry("nameCheck",1)); | 80 | nameCheck->setChecked( cfg.readBoolEntry("nameCheck",1)); |
81 | layout->addMultiCellWidget( nameCheck, 3, 3, 0, 0 ); | 81 | layout->addMultiCellWidget( nameCheck, 3, 3, 0, 0 ); |
82 | QWhatsThis::add(nameCheck, tr("Toggles Name of symbols owner field")); | 82 | QWhatsThis::add(nameCheck, tr("Toggles Name of symbols owner field")); |
83 | 83 | ||
84 | currentPriceCheck= new QCheckBox ( "Price", this ); | 84 | currentPriceCheck= new QCheckBox ( "Price", this ); |
85 | currentPriceCheck->setChecked( cfg.readBoolEntry("currentPriceCheck",1)); | 85 | currentPriceCheck->setChecked( cfg.readBoolEntry("currentPriceCheck",1)); |
86 | layout->addMultiCellWidget( currentPriceCheck, 3, 3, 1, 1 ); | 86 | layout->addMultiCellWidget( currentPriceCheck, 3, 3, 1, 1 ); |
87 | QWhatsThis::add(currentPriceCheck, tr("Toggles current Price field")); | 87 | QWhatsThis::add(currentPriceCheck, tr("Toggles current Price field")); |
88 | 88 | ||
89 | lastPriceCheck= new QCheckBox ( "Last Price", this ); | 89 | lastPriceCheck= new QCheckBox ( "Last Price", this ); |
90 | lastPriceCheck->setChecked( cfg.readBoolEntry("lastPriceCheck",1)); | 90 | lastPriceCheck->setChecked( cfg.readBoolEntry("lastPriceCheck",1)); |
91 | layout->addMultiCellWidget(lastPriceCheck, 3, 3, 2, 2); | 91 | layout->addMultiCellWidget(lastPriceCheck, 3, 3, 2, 2); |
92 | QWhatsThis::add(lastPriceCheck, tr("Toggles last price field")); | 92 | QWhatsThis::add(lastPriceCheck, tr("Toggles last price field")); |
93 | 93 | ||
94 | openPriceCheck= new QCheckBox ( "Open Price", this); | 94 | openPriceCheck= new QCheckBox ( "Open Price", this); |
95 | openPriceCheck->setChecked( cfg.readBoolEntry("openPriceCheck",1)); | 95 | openPriceCheck->setChecked( cfg.readBoolEntry("openPriceCheck",1)); |
96 | layout->addMultiCellWidget( openPriceCheck, 4, 4, 0, 0 ); | 96 | layout->addMultiCellWidget( openPriceCheck, 4, 4, 0, 0 ); |
97 | QWhatsThis::add(openPriceCheck, tr("Toggles opening price field")); | 97 | QWhatsThis::add(openPriceCheck, tr("Toggles opening price field")); |
98 | 98 | ||
99 | minPriceCheck= new QCheckBox ( "Min Price", this ); | 99 | minPriceCheck= new QCheckBox ( "Min Price", this ); |
100 | minPriceCheck->setChecked( cfg.readBoolEntry("minPriceCheck",1)); | 100 | minPriceCheck->setChecked( cfg.readBoolEntry("minPriceCheck",1)); |
101 | layout->addMultiCellWidget( minPriceCheck, 4, 4, 1, 1); | 101 | layout->addMultiCellWidget( minPriceCheck, 4, 4, 1, 1); |
102 | QWhatsThis::add(minPriceCheck, tr("Toggles minimum daily price field")); | 102 | QWhatsThis::add(minPriceCheck, tr("Toggles minimum daily price field")); |
103 | 103 | ||
104 | maxPriceCheck= new QCheckBox ( "Max Price", this); | 104 | maxPriceCheck= new QCheckBox ( "Max Price", this); |
105 | maxPriceCheck->setChecked( cfg.readBoolEntry("maxPriceCheck",1)); | 105 | maxPriceCheck->setChecked( cfg.readBoolEntry("maxPriceCheck",1)); |
106 | layout->addMultiCellWidget( maxPriceCheck, 4, 4, 2, 2 ); | 106 | layout->addMultiCellWidget( maxPriceCheck, 4, 4, 2, 2 ); |
107 | QWhatsThis::add(maxPriceCheck, tr("Toggles maximum daily price field")); | 107 | QWhatsThis::add(maxPriceCheck, tr("Toggles maximum daily price field")); |
108 | 108 | ||
109 | variationCheck= new QCheckBox ( "Variation", this ); | 109 | variationCheck= new QCheckBox ( "Variation", this ); |
110 | variationCheck->setChecked( cfg.readBoolEntry("variationCheck",1)); | 110 | variationCheck->setChecked( cfg.readBoolEntry("variationCheck",1)); |
111 | layout->addMultiCellWidget( variationCheck, 5, 5, 0, 0 ); | 111 | layout->addMultiCellWidget( variationCheck, 5, 5, 0, 0 ); |
112 | QWhatsThis::add(variationCheck, tr("Toggles daily variation of price field")); | 112 | QWhatsThis::add(variationCheck, tr("Toggles daily variation of price field")); |
113 | 113 | ||
114 | volumeCheck= new QCheckBox ( "Volume", this ); | 114 | volumeCheck= new QCheckBox ( "Volume", this ); |
115 | volumeCheck->setChecked( cfg.readBoolEntry("volumeCheck",1)); | 115 | volumeCheck->setChecked( cfg.readBoolEntry("volumeCheck",1)); |
116 | layout->addMultiCellWidget( volumeCheck , 5, 5, 1, 1); | 116 | layout->addMultiCellWidget( volumeCheck , 5, 5, 1, 1); |
117 | QWhatsThis::add(volumeCheck, tr("Toggles volume of trading field")); | 117 | QWhatsThis::add(volumeCheck, tr("Toggles volume of trading field")); |
118 | 118 | ||
119 | timerDelaySpin = new QSpinBox( this, "timer spin" ); | 119 | timerDelaySpin = new QSpinBox( this, "timer spin" ); |
120 | QWhatsThis::add( timerDelaySpin , tr( "How often stocks prices should be looked up. In minutes" ) ); | 120 | QWhatsThis::add( timerDelaySpin , tr( "How often stocks prices should be looked up. In minutes" ) ); |
121 | timerDelaySpin->setMaxValue( 60); | 121 | timerDelaySpin->setMaxValue( 60); |
122 | 122 | ||
123 | cfg.setGroup("Timer"); | 123 | cfg.setGroup("Timer"); |
124 | timerDelaySpin->setValue( cfg.readNumEntry("Delay",15)); | 124 | timerDelaySpin->setValue( cfg.readNumEntry("Delay",15)); |
125 | layout->addMultiCellWidget( timerDelaySpin , 6, 6, 0, 0); | 125 | layout->addMultiCellWidget( timerDelaySpin , 6, 6, 0, 0); |
126 | 126 | ||
127 | QLabel *label2; | 127 | QLabel *label2; |
128 | label2 = new QLabel(this); | 128 | label2 = new QLabel(this); |
129 | label2->setText( tr("Minutes between lookups.")); | 129 | label2->setText( tr("Minutes between lookups.")); |
130 | label2->setMaximumHeight(60); | 130 | label2->setMaximumHeight(60); |
131 | layout->addMultiCellWidget( label2, 6, 6, 1, 2); | 131 | layout->addMultiCellWidget( label2, 6, 6, 1, 2); |
132 | 132 | ||
133 | scrollSpeed = new QSpinBox( this, "Scrollspin" ); | 133 | scrollSpeed = new QSpinBox( this, "Scrollspin" ); |
134 | QWhatsThis::add( timerDelaySpin , tr( "Speed of scrolling action, in milliseconds" ) ); | 134 | QWhatsThis::add( timerDelaySpin , tr( "Speed of scrolling action, in milliseconds" ) ); |
135 | scrollSpeed->setMaxValue( 1000); | 135 | scrollSpeed->setMaxValue( 1000); |
136 | scrollSpeed->setSteps(50,50); | 136 | scrollSpeed->setSteps(50,50); |
137 | cfg.setGroup("Timer"); | 137 | cfg.setGroup("Timer"); |
138 | scrollSpeed->setValue( cfg.readNumEntry("ScrollSpeed",50)); | 138 | scrollSpeed->setValue( cfg.readNumEntry("ScrollSpeed",50)); |
139 | layout->addMultiCellWidget( scrollSpeed , 7, 7, 0, 0); | 139 | layout->addMultiCellWidget( scrollSpeed , 7, 7, 0, 0); |
140 | 140 | ||
141 | QLabel *label3; | 141 | QLabel *label3; |
142 | label3 = new QLabel(this); | 142 | label3 = new QLabel(this); |
143 | label3->setText( tr("Scroll Speed, in milliseconds")); | 143 | label3->setText( tr("Scroll Speed, in milliseconds")); |
144 | label3->setMaximumHeight(60); | 144 | label3->setMaximumHeight(60); |
145 | layout->addMultiCellWidget( label3, 7, 7, 1, 2); | 145 | layout->addMultiCellWidget( label3, 7, 7, 1, 2); |
146 | 146 | ||
147 | scrollLength = new QSpinBox( this, "ScrollLength" ); | 147 | scrollLength = new QSpinBox( this, "ScrollLength" ); |
148 | QWhatsThis::add( timerDelaySpin , tr( "Length of scrolling" ) ); | 148 | QWhatsThis::add( timerDelaySpin , tr( "Length of scrolling" ) ); |
149 | scrollLength->setMaxValue( 10); | 149 | scrollLength->setMaxValue( 10); |
150 | // scrollLength->setSteps(5,5); | 150 | // scrollLength->setSteps(5,5); |
151 | cfg.setGroup("Timer"); | 151 | cfg.setGroup("Timer"); |
152 | scrollLength->setValue( cfg.readNumEntry("ScrollLength",1)); | 152 | scrollLength->setValue( cfg.readNumEntry("ScrollLength",1)); |
153 | layout->addMultiCellWidget( scrollLength , 8, 8, 0, 0); | 153 | layout->addMultiCellWidget( scrollLength , 8, 8, 0, 0); |
154 | 154 | ||
155 | QLabel *label4; | 155 | QLabel *label4; |
156 | label4 = new QLabel(this); | 156 | label4 = new QLabel(this); |
157 | label4->setText( tr("Scroll Length")); | 157 | label4->setText( tr("Scroll Length")); |
158 | label4->setMaximumHeight(60); | 158 | label4->setMaximumHeight(60); |
159 | layout->addMultiCellWidget( label4, 8, 8, 1, 2); | 159 | layout->addMultiCellWidget( label4, 8, 8, 1, 2); |
160 | 160 | ||
161 | // lookupButton = new QPushButton(this, "LookupButton"); | 161 | // lookupButton = new QPushButton(this, "LookupButton"); |
162 | // lookupButton->setText(tr("Symbol Lookup")); | 162 | // lookupButton->setText(tr("Symbol Lookup")); |
163 | // connect(lookupButton,SIGNAL(clicked()),SLOT( doLookup())); | 163 | // connect(lookupButton,SIGNAL(clicked()),SLOT( doLookup())); |
164 | // layout->addMultiCellWidget( lookupButton , 9, 9, 0, 0); | 164 | // layout->addMultiCellWidget( lookupButton , 9, 9, 0, 0); |
165 | 165 | ||
166 | QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Expanding ); | 166 | QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Expanding ); |
167 | layout->addItem( spacer, 9, 0 ); | 167 | layout->addItem( spacer, 9, 0 ); |
168 | 168 | ||
169 | } | 169 | } |
170 | 170 | ||
171 | 171 | ||
172 | void StocktickerPluginConfig::writeConfig() { | 172 | void StocktickerPluginConfig::writeConfig() { |
173 | Config cfg( "stockticker"); | 173 | Config cfg( "stockticker"); |
174 | cfg.setGroup( "Symbols" ); | 174 | cfg.setGroup( "Symbols" ); |
175 | QString outText = text().upper(); | 175 | QString outText = text().upper(); |
176 | outText.stripWhiteSpace(); | 176 | outText.stripWhiteSpace(); |
177 | cfg.writeEntry("Symbols", outText ); | 177 | cfg.writeEntry("Symbols", outText ); |
178 | cfg.setGroup( "Fields" ); | 178 | cfg.setGroup( "Fields" ); |
179 | cfg.writeEntry("timeCheck",timeCheck->isChecked()); | 179 | cfg.writeEntry("timeCheck",timeCheck->isChecked()); |
180 | cfg.writeEntry("dateCheck",dateCheck->isChecked()); | 180 | cfg.writeEntry("dateCheck",dateCheck->isChecked()); |
181 | cfg.writeEntry("symbolCheck",symbolCheck->isChecked()); | 181 | cfg.writeEntry("symbolCheck",symbolCheck->isChecked()); |
182 | cfg.writeEntry("nameCheck",nameCheck->isChecked()); | 182 | cfg.writeEntry("nameCheck",nameCheck->isChecked()); |
183 | cfg.writeEntry("currentPriceCheck",currentPriceCheck->isChecked()); | 183 | cfg.writeEntry("currentPriceCheck",currentPriceCheck->isChecked()); |
184 | cfg.writeEntry("lastPriceCheck",lastPriceCheck->isChecked()); | 184 | cfg.writeEntry("lastPriceCheck",lastPriceCheck->isChecked()); |
185 | cfg.writeEntry("openPriceCheck",openPriceCheck->isChecked()); | 185 | cfg.writeEntry("openPriceCheck",openPriceCheck->isChecked()); |
186 | cfg.writeEntry("minPriceCheck",minPriceCheck->isChecked()); | 186 | cfg.writeEntry("minPriceCheck",minPriceCheck->isChecked()); |
187 | cfg.writeEntry("maxPriceCheck",maxPriceCheck->isChecked()); | 187 | cfg.writeEntry("maxPriceCheck",maxPriceCheck->isChecked()); |
188 | cfg.writeEntry("variationCheck",variationCheck->isChecked()); | 188 | cfg.writeEntry("variationCheck",variationCheck->isChecked()); |
189 | cfg.writeEntry("volumeCheck",volumeCheck->isChecked()); | 189 | cfg.writeEntry("volumeCheck",volumeCheck->isChecked()); |
190 | 190 | ||
191 | cfg.setGroup("Timer"); | 191 | cfg.setGroup("Timer"); |
192 | cfg.writeEntry("Delay",timerDelaySpin->value()); | 192 | cfg.writeEntry("Delay",timerDelaySpin->value()); |
193 | cfg.writeEntry("ScrollLength",scrollLength->value()); | 193 | cfg.writeEntry("ScrollLength",scrollLength->value()); |
194 | cfg.writeEntry("ScrollSpeed",scrollSpeed->value()); | 194 | cfg.writeEntry("ScrollSpeed",scrollSpeed->value()); |
195 | 195 | ||
196 | cfg.write(); | 196 | cfg.write(); |
197 | } | 197 | } |
198 | 198 | ||
199 | StocktickerPluginConfig::~StocktickerPluginConfig() { | 199 | StocktickerPluginConfig::~StocktickerPluginConfig() { |
200 | } | 200 | } |
201 | 201 | ||
202 | QString StocktickerPluginConfig::text() const { | 202 | QString StocktickerPluginConfig::text() const { |
203 | return LineEdit1->text(); | 203 | return LineEdit1->text(); |
204 | } | 204 | } |
205 | 205 | ||
206 | void StocktickerPluginConfig::doLookup() { | 206 | void StocktickerPluginConfig::doLookup() { |
207 | 207 | ||
208 | system("stockticker"); | 208 | system("stockticker"); |
209 | } | 209 | } |
diff --git a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerconfig.h b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerconfig.h index 10f9678..3c852ce 100644 --- a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerconfig.h +++ b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerconfig.h | |||
@@ -1,46 +1,47 @@ | |||
1 | /* | 1 | /* |
2 | * stocktickerconfig.h | 2 | * stocktickerconfig.h |
3 | * | 3 | * |
4 | * copyright : (c) 2002 by LJP | 4 | * copyright : (c) 2002 by LJP |
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 | #ifndef STOCKTICKER_PLUGIN_CONFIG_H | 17 | #ifndef STOCKTICKER_PLUGIN_CONFIG_H |
18 | #define STOCKTICKER_PLUGIN_CONFIG_H | 18 | #define STOCKTICKER_PLUGIN_CONFIG_H |
19 | 19 | ||
20 | #include <opie2/todayconfigwidget.h> | ||
21 | |||
20 | #include <qwidget.h> | 22 | #include <qwidget.h> |
21 | #include <opie/todayconfigwidget.h> | ||
22 | #include <qstring.h> | 23 | #include <qstring.h> |
23 | 24 | ||
24 | class QLineEdit; | 25 | class QLineEdit; |
25 | class QCheckBox; | 26 | class QCheckBox; |
26 | class QPushButton; | 27 | class QPushButton; |
27 | class QCheckBox; | 28 | class QCheckBox; |
28 | class QSpinBox; | 29 | class QSpinBox; |
29 | 30 | ||
30 | class StocktickerPluginConfig : public TodayConfigWidget { | 31 | class StocktickerPluginConfig : public TodayConfigWidget { |
31 | Q_OBJECT | 32 | Q_OBJECT |
32 | public: | 33 | public: |
33 | StocktickerPluginConfig( QWidget *parent, const char *name ); | 34 | StocktickerPluginConfig( QWidget *parent, const char *name ); |
34 | ~StocktickerPluginConfig(); | 35 | ~StocktickerPluginConfig(); |
35 | QString text() const; | 36 | QString text() const; |
36 | void writeConfig(); | 37 | void writeConfig(); |
37 | private: | 38 | private: |
38 | QLineEdit* LineEdit1; | 39 | QLineEdit* LineEdit1; |
39 | QCheckBox *timeCheck, *dateCheck, *symbolCheck, *nameCheck, *currentPriceCheck, *lastPriceCheck, *openPriceCheck, *minPriceCheck, *maxPriceCheck, *variationCheck, *volumeCheck; | 40 | QCheckBox *timeCheck, *dateCheck, *symbolCheck, *nameCheck, *currentPriceCheck, *lastPriceCheck, *openPriceCheck, *minPriceCheck, *maxPriceCheck, *variationCheck, *volumeCheck; |
40 | QPushButton *lookupButton; | 41 | QPushButton *lookupButton; |
41 | QSpinBox *timerDelaySpin, *scrollSpeed, *scrollLength; | 42 | QSpinBox *timerDelaySpin, *scrollSpeed, *scrollLength; |
42 | private slots: | 43 | private slots: |
43 | void doLookup(); | 44 | void doLookup(); |
44 | 45 | ||
45 | }; | 46 | }; |
46 | #endif | 47 | #endif |
diff --git a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerlib.pro b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerlib.pro index bb22b4e..baf6430 100644 --- a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerlib.pro +++ b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerlib.pro | |||
@@ -1,29 +1,29 @@ | |||
1 | TEMPLATE = lib | 1 | TEMPLATE = lib |
2 | CONFIG -= moc | 2 | CONFIG -= moc |
3 | CONFIG += qt plugin release | 3 | CONFIG += qt plugin release |
4 | 4 | ||
5 | HEADERS = stocktickerplugin.h stocktickerpluginimpl.h stocktickerpluginwidget.h stocktickerconfig.h \ | 5 | HEADERS = stocktickerplugin.h stocktickerpluginimpl.h stocktickerpluginwidget.h stocktickerconfig.h \ |
6 | ../libstocks/csv.h \ | 6 | ../libstocks/csv.h \ |
7 | ../libstocks/http.h \ | 7 | ../libstocks/http.h \ |
8 | ../libstocks/lists.h \ | 8 | ../libstocks/lists.h \ |
9 | ../libstocks/stocks.h | 9 | ../libstocks/stocks.h |
10 | SOURCES = stocktickerplugin.cpp stocktickerpluginimpl.cpp stocktickerpluginwidget.cpp stocktickerconfig.cpp \ | 10 | SOURCES = stocktickerplugin.cpp stocktickerpluginimpl.cpp stocktickerpluginwidget.cpp stocktickerconfig.cpp \ |
11 | ../libstocks/csv.c \ | 11 | ../libstocks/csv.c \ |
12 | ../libstocks/currency.c \ | 12 | ../libstocks/currency.c \ |
13 | ../libstocks/history.c \ | 13 | ../libstocks/history.c \ |
14 | ../libstocks/http.c \ | 14 | ../libstocks/http.c \ |
15 | ../libstocks/lists.c \ | 15 | ../libstocks/lists.c \ |
16 | ../libstocks/stocks.c | 16 | ../libstocks/stocks.c |
17 | 17 | ||
18 | INCLUDEPATH += $(OPIEDIR)/include \ | 18 | INCLUDEPATH += $(OPIEDIR)/include \ |
19 | ../ ../library | 19 | ../ ../library |
20 | DEPENDPATH += $(OPIEDIR)/include \ | 20 | DEPENDPATH += $(OPIEDIR)/include \ |
21 | ../ ../library | 21 | ../ ../library |
22 | 22 | ||
23 | LIBS+= -lqpe -lopie -lpthread | 23 | LIBS+= -lqpe -lopiecore2 -lopiepim2 -lopieui2 -lpthread |
24 | TMAKE_CFLAGS += -D__UNIX__ | 24 | TMAKE_CFLAGS += -D__UNIX__ |
25 | 25 | ||
26 | DESTDIR = $(OPIEDIR)/plugins/today | 26 | DESTDIR = $(OPIEDIR)/plugins/today |
27 | TARGET = todaystocktickerplugin | 27 | TARGET = todaystocktickerplugin |
28 | 28 | ||
29 | include ( $(OPIEDIR)/include.pro ) | 29 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerplugin.h b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerplugin.h index e88c687..42af821 100644 --- a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerplugin.h +++ b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerplugin.h | |||
@@ -1,46 +1,45 @@ | |||
1 | /* | 1 | /* |
2 | * stocktickerplugin.h | 2 | * stocktickerplugin.h |
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 | 17 | ||
18 | #ifndef STOCKTICKER_PLUGIN_H | 18 | #ifndef STOCKTICKER_PLUGIN_H |
19 | #define STOCKTICKER_PLUGIN_H | 19 | #define STOCKTICKER_PLUGIN_H |
20 | 20 | ||
21 | #include <opie2/oclickablelabel.h> | ||
22 | #include <opie2/todayplugininterface.h> | ||
23 | #include <opie2/todayconfigwidget.h> | ||
24 | |||
21 | #include <qstring.h> | 25 | #include <qstring.h> |
22 | #include <qwidget.h> | 26 | #include <qwidget.h> |
23 | 27 | ||
24 | #include <opie/oclickablelabel.h> | ||
25 | |||
26 | #include <opie/todayplugininterface.h> | ||
27 | #include <opie/todayconfigwidget.h> | ||
28 | |||
29 | class StockTickerPlugin : public TodayPluginObject { | 28 | class StockTickerPlugin : public TodayPluginObject { |
30 | 29 | ||
31 | public: | 30 | public: |
32 | StockTickerPlugin(); | 31 | StockTickerPlugin(); |
33 | ~StockTickerPlugin(); | 32 | ~StockTickerPlugin(); |
34 | 33 | ||
35 | QString pluginName() const; | 34 | QString pluginName() const; |
36 | double versionNumber() const; | 35 | double versionNumber() const; |
37 | QString pixmapNameWidget() const; | 36 | QString pixmapNameWidget() const; |
38 | QWidget* widget(QWidget *); | 37 | QWidget* widget(QWidget *); |
39 | QString pixmapNameConfig() const; | 38 | QString pixmapNameConfig() const; |
40 | TodayConfigWidget* configWidget(QWidget *); | 39 | TodayConfigWidget* configWidget(QWidget *); |
41 | QString appName() const; | 40 | QString appName() const; |
42 | bool excludeFromRefresh() const; | 41 | bool excludeFromRefresh() const; |
43 | 42 | ||
44 | }; | 43 | }; |
45 | 44 | ||
46 | #endif | 45 | #endif |
diff --git a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp index fedc79c..51113ba 100644 --- a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp +++ b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp | |||
@@ -1,71 +1,71 @@ | |||
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 <qlayout.h> | 17 | #include <opie2/oticker.h> |
18 | 18 | ||
19 | #include <qpe/config.h> | 19 | #include <qpe/config.h> |
20 | 20 | ||
21 | #include <opie/oticker.h> | 21 | #include <qlayout.h> |
22 | 22 | ||
23 | extern "C" { | 23 | extern "C" { |
24 | #include "libstocks/stocks.h" | 24 | #include "libstocks/stocks.h" |
25 | } | 25 | } |
26 | 26 | ||
27 | #include <pthread.h> | 27 | #include <pthread.h> |
28 | 28 | ||
29 | #include "stocktickerpluginwidget.h" | 29 | #include "stocktickerpluginwidget.h" |
30 | 30 | ||
31 | QString output; | 31 | QString output; |
32 | OTicker *stocktickerTicker; | 32 | OTicker *stocktickerTicker; |
33 | QCString stock_liste; | 33 | QCString stock_liste; |
34 | bool dotimeCheck, dodateCheck, dosymbolCheck, donameCheck; | 34 | bool dotimeCheck, dodateCheck, dosymbolCheck, donameCheck; |
35 | bool docurrentPriceCheck, dolastPriceCheck, doopenPriceCheck; | 35 | bool docurrentPriceCheck, dolastPriceCheck, doopenPriceCheck; |
36 | bool dominPriceCheck, domaxPriceCheck, dovariationCheck, dovolumeCheck; | 36 | bool dominPriceCheck, domaxPriceCheck, dovariationCheck, dovolumeCheck; |
37 | 37 | ||
38 | void getStocks(char *blah) { | 38 | void getStocks(char *blah) { |
39 | 39 | ||
40 | // stocktickerTicker->setText( "Downloading stock data."); | 40 | // stocktickerTicker->setText( "Downloading stock data."); |
41 | stock *stocks_quotes=NULL; | 41 | stock *stocks_quotes=NULL; |
42 | stock *stocks_tmp; | 42 | stock *stocks_tmp; |
43 | stock_liste = blah; | 43 | stock_liste = blah; |
44 | ::free ( blah ); | 44 | ::free ( blah ); |
45 | // char *stock_liste = (char *)blah->latin1(); | 45 | // char *stock_liste = (char *)blah->latin1(); |
46 | // qDebug("%s", stock_liste.data() ); | 46 | // qDebug("%s", stock_liste.data() ); |
47 | output = ""; | 47 | output = ""; |
48 | QString tempString; | 48 | QString tempString; |
49 | libstocks_return_code error; | 49 | libstocks_return_code error; |
50 | 50 | ||
51 | // Config cfg( "stockticker"); | 51 | // Config cfg( "stockticker"); |
52 | // cfg.setGroup( "Fields" ); | 52 | // cfg.setGroup( "Fields" ); |
53 | // bool dotimeCheck, dodateCheck, dosymbolCheck, donameCheck; | 53 | // bool dotimeCheck, dodateCheck, dosymbolCheck, donameCheck; |
54 | // bool docurrentPriceCheck, dolastPriceCheck, doopenPriceCheck; | 54 | // bool docurrentPriceCheck, dolastPriceCheck, doopenPriceCheck; |
55 | // bool dominPriceCheck, domaxPriceCheck, dovariationCheck, dovolumeCheck; | 55 | // bool dominPriceCheck, domaxPriceCheck, dovariationCheck, dovolumeCheck; |
56 | 56 | ||
57 | dotimeCheck=dodateCheck=dosymbolCheck=donameCheck= docurrentPriceCheck=dolastPriceCheck=doopenPriceCheck=dominPriceCheck=domaxPriceCheck=dovariationCheck=dovolumeCheck=false; | 57 | dotimeCheck=dodateCheck=dosymbolCheck=donameCheck= docurrentPriceCheck=dolastPriceCheck=doopenPriceCheck=dominPriceCheck=domaxPriceCheck=dovariationCheck=dovolumeCheck=false; |
58 | 58 | ||
59 | dotimeCheck=1; | 59 | dotimeCheck=1; |
60 | dodateCheck=1; | 60 | dodateCheck=1; |
61 | dosymbolCheck=1; | 61 | dosymbolCheck=1; |
62 | donameCheck=1; | 62 | donameCheck=1; |
63 | docurrentPriceCheck=1; | 63 | docurrentPriceCheck=1; |
64 | dolastPriceCheck=1; | 64 | dolastPriceCheck=1; |
65 | doopenPriceCheck=1; | 65 | doopenPriceCheck=1; |
66 | dominPriceCheck=1; | 66 | dominPriceCheck=1; |
67 | domaxPriceCheck=1; | 67 | domaxPriceCheck=1; |
68 | dovariationCheck=1; | 68 | dovariationCheck=1; |
69 | dovolumeCheck=1; | 69 | dovolumeCheck=1; |
70 | 70 | ||
71 | // dotimeCheck=cfg.readBoolEntry("timeCheck",1); | 71 | // dotimeCheck=cfg.readBoolEntry("timeCheck",1); |
@@ -165,163 +165,163 @@ void getStocks(char *blah) { | |||
165 | } | 165 | } |
166 | } | 166 | } |
167 | else { | 167 | else { |
168 | // printf("| Name | |\n"); | 168 | // printf("| Name | |\n"); |
169 | tempString.sprintf("| Name | |"); | 169 | tempString.sprintf("| Name | |"); |
170 | if(donameCheck) | 170 | if(donameCheck) |
171 | output +=tempString; | 171 | output +=tempString; |
172 | } | 172 | } |
173 | 173 | ||
174 | // printf("| Price | %-7.2f |\n", stocks_tmp->CurrentPrice); | 174 | // printf("| Price | %-7.2f |\n", stocks_tmp->CurrentPrice); |
175 | tempString.sprintf("| Price %-7.2f ", stocks_tmp->CurrentPrice); | 175 | tempString.sprintf("| Price %-7.2f ", stocks_tmp->CurrentPrice); |
176 | if(docurrentPriceCheck) | 176 | if(docurrentPriceCheck) |
177 | output +=tempString; | 177 | output +=tempString; |
178 | 178 | ||
179 | // printf("| Yesterday | %-7.2f |\n",stocks_tmp->LastPrice); | 179 | // printf("| Yesterday | %-7.2f |\n",stocks_tmp->LastPrice); |
180 | tempString.sprintf("| Yesterday %-7.2f ",stocks_tmp->LastPrice); | 180 | tempString.sprintf("| Yesterday %-7.2f ",stocks_tmp->LastPrice); |
181 | if(dolastPriceCheck) | 181 | if(dolastPriceCheck) |
182 | output +=tempString; | 182 | output +=tempString; |
183 | 183 | ||
184 | // printf("| Open | %-7.2f |\n",stocks_tmp->OpenPrice); | 184 | // printf("| Open | %-7.2f |\n",stocks_tmp->OpenPrice); |
185 | tempString.sprintf("| Open %-7.2f ",stocks_tmp->OpenPrice); | 185 | tempString.sprintf("| Open %-7.2f ",stocks_tmp->OpenPrice); |
186 | if(doopenPriceCheck) | 186 | if(doopenPriceCheck) |
187 | output +=tempString; | 187 | output +=tempString; |
188 | 188 | ||
189 | // printf("| Min | %-7.2f |\n", stocks_tmp->MinPrice); | 189 | // printf("| Min | %-7.2f |\n", stocks_tmp->MinPrice); |
190 | tempString.sprintf("| Min %-7.2f ", stocks_tmp->MinPrice); | 190 | tempString.sprintf("| Min %-7.2f ", stocks_tmp->MinPrice); |
191 | if(dominPriceCheck) | 191 | if(dominPriceCheck) |
192 | output +=tempString; | 192 | output +=tempString; |
193 | 193 | ||
194 | // printf("| Max | %-7.2f |\n",stocks_tmp->MaxPrice); | 194 | // printf("| Max | %-7.2f |\n",stocks_tmp->MaxPrice); |
195 | tempString.sprintf("| Max %-7.2f ",stocks_tmp->MaxPrice); | 195 | tempString.sprintf("| Max %-7.2f ",stocks_tmp->MaxPrice); |
196 | if(domaxPriceCheck) | 196 | if(domaxPriceCheck) |
197 | output +=tempString; | 197 | output +=tempString; |
198 | 198 | ||
199 | // printf("| Var | %-6.2f (%5.2f %%) |\n", stocks_tmp->Variation, stocks_tmp->Pourcentage); | 199 | // printf("| Var | %-6.2f (%5.2f %%) |\n", stocks_tmp->Variation, stocks_tmp->Pourcentage); |
200 | tempString.sprintf("| Var %-6.2f (%5.2f %%) ", stocks_tmp->Variation, stocks_tmp->Pourcentage); | 200 | tempString.sprintf("| Var %-6.2f (%5.2f %%) ", stocks_tmp->Variation, stocks_tmp->Pourcentage); |
201 | if(dovariationCheck) | 201 | if(dovariationCheck) |
202 | output +=tempString; | 202 | output +=tempString; |
203 | 203 | ||
204 | // printf("| Volume | %-9d |\n", stocks_tmp->Volume); | 204 | // printf("| Volume | %-9d |\n", stocks_tmp->Volume); |
205 | tempString.sprintf("| Volume %-9d ", stocks_tmp->Volume); | 205 | tempString.sprintf("| Volume %-9d ", stocks_tmp->Volume); |
206 | if(dovolumeCheck) | 206 | if(dovolumeCheck) |
207 | output +=tempString; | 207 | output +=tempString; |
208 | 208 | ||
209 | // printf("----------------------------------------\n\n"); | 209 | // printf("----------------------------------------\n\n"); |
210 | tempString.sprintf("||==++==|"); | 210 | tempString.sprintf("||==++==|"); |
211 | output +=tempString; | 211 | output +=tempString; |
212 | 212 | ||
213 | /* Simple function which help to browse in the stocks list */ | 213 | /* Simple function which help to browse in the stocks list */ |
214 | stocks_tmp = next_stock(stocks_tmp); | 214 | stocks_tmp = next_stock(stocks_tmp); |
215 | } | 215 | } |
216 | 216 | ||
217 | stocktickerTicker->setText( output.latin1() ); | 217 | stocktickerTicker->setText( output.latin1() ); |
218 | 218 | ||
219 | /* frees stocks */ | 219 | /* frees stocks */ |
220 | free_stocks(stocks_quotes); | 220 | free_stocks(stocks_quotes); |
221 | free_stocks(stocks_tmp); | 221 | free_stocks(stocks_tmp); |
222 | 222 | ||
223 | stock_liste=""; | 223 | stock_liste=""; |
224 | //delete stock_liste; | 224 | //delete stock_liste; |
225 | tempString=""; | 225 | tempString=""; |
226 | output=""; | 226 | output=""; |
227 | } | 227 | } |
228 | 228 | ||
229 | StockTickerPluginWidget::StockTickerPluginWidget( QWidget *parent, const char* name) | 229 | StockTickerPluginWidget::StockTickerPluginWidget( QWidget *parent, const char* name) |
230 | : QWidget(parent, name ) { | 230 | : QWidget(parent, name ) { |
231 | init(); | 231 | init(); |
232 | startTimer(1000); | 232 | startTimer(1000); |
233 | 233 | ||
234 | stocktickerTicker->setTextFormat(Qt::RichText); | 234 | stocktickerTicker->setTextFormat(Qt::RichText); |
235 | // checkConnection(); | 235 | // checkConnection(); |
236 | } | 236 | } |
237 | 237 | ||
238 | StockTickerPluginWidget::~StockTickerPluginWidget() { | 238 | StockTickerPluginWidget::~StockTickerPluginWidget() { |
239 | } | 239 | } |
240 | 240 | ||
241 | void StockTickerPluginWidget::init() { | 241 | void StockTickerPluginWidget::init() { |
242 | 242 | ||
243 | QHBoxLayout* layout = new QHBoxLayout( this ); | 243 | QHBoxLayout* layout = new QHBoxLayout( this ); |
244 | stocktickerTicker = new OTicker(this); | 244 | stocktickerTicker = new OTicker(this); |
245 | // stocktickerTicker->setMinimumHeight(15); | 245 | // stocktickerTicker->setMinimumHeight(15); |
246 | connect( stocktickerTicker, SIGNAL( mousePressed()), this, SLOT( checkConnection() )); | 246 | connect( stocktickerTicker, SIGNAL( mousePressed()), this, SLOT( checkConnection() )); |
247 | layout->addWidget( stocktickerTicker); | 247 | layout->addWidget( stocktickerTicker); |
248 | wasError = true; | 248 | wasError = true; |
249 | } | 249 | } |
250 | 250 | ||
251 | void StockTickerPluginWidget::doStocks() { | 251 | void StockTickerPluginWidget::doStocks() { |
252 | Config cfg( "stockticker"); | 252 | Config cfg( "stockticker"); |
253 | cfg.setGroup( "Symbols" ); | 253 | cfg.setGroup( "Symbols" ); |
254 | symbollist=""; | 254 | symbollist=""; |
255 | symbollist = cfg.readEntry("Symbols", ""); | 255 | symbollist = cfg.readEntry("Symbols", ""); |
256 | symbollist.replace(QRegExp(" "),"+");//seperated by + | 256 | symbollist.replace(QRegExp(" "),"+");//seperated by + |
257 | 257 | ||
258 | cfg.setGroup("Timer"); | 258 | cfg.setGroup("Timer"); |
259 | stocktickerTicker->setUpdateTime( cfg.readNumEntry("ScrollSpeed",50)); | 259 | stocktickerTicker->setUpdateTime( cfg.readNumEntry("ScrollSpeed",50)); |
260 | stocktickerTicker->setScrollLength( cfg.readNumEntry("ScrollLength",10)); | 260 | stocktickerTicker->setScrollLength( cfg.readNumEntry("ScrollLength",10)); |
261 | 261 | ||
262 | if (!symbollist.isEmpty()) { | 262 | if (!symbollist.isEmpty()) { |
263 | pthread_t thread1; | 263 | pthread_t thread1; |
264 | char *blah = ::strdup(symbollist.latin1()); | 264 | char *blah = ::strdup(symbollist.latin1()); |
265 | pthread_create( &thread1, NULL, (void * (*)(void *))getStocks, (void *) blah); | 265 | pthread_create( &thread1, NULL, (void * (*)(void *))getStocks, (void *) blah); |
266 | pthread_detach( thread1); | 266 | pthread_detach( thread1); |
267 | 267 | ||
268 | //::free((void*)thread1); | 268 | //::free((void*)thread1); |
269 | //getStocks(blah); | 269 | //getStocks(blah); |
270 | } | 270 | } |
271 | } | 271 | } |
272 | 272 | ||
273 | void StockTickerPluginWidget::timerEvent( QTimerEvent *e ) { | 273 | void StockTickerPluginWidget::timerEvent( QTimerEvent *e ) { |
274 | killTimer(e->timerId()); | 274 | killTimer(e->timerId()); |
275 | checkConnection(); | 275 | checkConnection(); |
276 | } | 276 | } |
277 | 277 | ||
278 | void StockTickerPluginWidget::checkConnection() { | 278 | void StockTickerPluginWidget::checkConnection() { |
279 | // qDebug("checking connection"); | 279 | // qDebug("checking connection"); |
280 | // Sock = new QSocket( this ); | 280 | // Sock = new QSocket( this ); |
281 | 281 | ||
282 | // if( wasError) | 282 | // if( wasError) |
283 | // stocktickerTicker->setText("Checking connection"); | 283 | // stocktickerTicker->setText("Checking connection"); |
284 | 284 | ||
285 | // if(Sock->state() == QSocket::Idle) { | 285 | // if(Sock->state() == QSocket::Idle) { |
286 | // Sock->connectToHost("finance.yahoo.com", 80); | 286 | // Sock->connectToHost("finance.yahoo.com", 80); |
287 | // connect( Sock, SIGNAL( error(int) ), SLOT(socketError(int)) ); | 287 | // connect( Sock, SIGNAL( error(int) ), SLOT(socketError(int)) ); |
288 | // connect( Sock, SIGNAL( hostFound() ), SLOT(isConnected()) ); | 288 | // connect( Sock, SIGNAL( hostFound() ), SLOT(isConnected()) ); |
289 | // } else { | 289 | // } else { |
290 | // qDebug("State is not Idle"); | 290 | // qDebug("State is not Idle"); |
291 | isConnected(); | 291 | isConnected(); |
292 | // } | 292 | // } |
293 | } | 293 | } |
294 | 294 | ||
295 | void StockTickerPluginWidget::isConnected() { | 295 | void StockTickerPluginWidget::isConnected() { |
296 | // qDebug("We connect, so ok to grab stocks"); | 296 | // qDebug("We connect, so ok to grab stocks"); |
297 | if(this->isVisible()) | 297 | if(this->isVisible()) |
298 | doStocks(); | 298 | doStocks(); |
299 | 299 | ||
300 | Config cfg( "stockticker"); | 300 | Config cfg( "stockticker"); |
301 | cfg.setGroup("Timer"); | 301 | cfg.setGroup("Timer"); |
302 | timerDelay= cfg.readNumEntry("Delay",0); | 302 | timerDelay= cfg.readNumEntry("Delay",0); |
303 | if(timerDelay > 0) | 303 | if(timerDelay > 0) |
304 | startTimer(timerDelay*60000); | 304 | startTimer(timerDelay*60000); |
305 | // qDebug("timer set for %d",(timerDelay*60000)/60000); | 305 | // qDebug("timer set for %d",(timerDelay*60000)/60000); |
306 | wasError = false; | 306 | wasError = false; |
307 | 307 | ||
308 | // Sock->close(); | 308 | // Sock->close(); |
309 | } | 309 | } |
310 | 310 | ||
311 | void StockTickerPluginWidget::socketError(int errcode) { | 311 | void StockTickerPluginWidget::socketError(int errcode) { |
312 | switch(errcode) { | 312 | switch(errcode) { |
313 | case QSocket::ErrConnectionRefused: | 313 | case QSocket::ErrConnectionRefused: |
314 | output = tr("Connection refused."); | 314 | output = tr("Connection refused."); |
315 | break; | 315 | break; |
316 | case QSocket::ErrHostNotFound: | 316 | case QSocket::ErrHostNotFound: |
317 | output = tr("Could not find server."); | 317 | output = tr("Could not find server."); |
318 | break; | 318 | break; |
319 | case QSocket::ErrSocketRead : | 319 | case QSocket::ErrSocketRead : |
320 | output = tr("Socket read error."); | 320 | output = tr("Socket read error."); |
321 | break; | 321 | break; |
322 | }; | 322 | }; |
323 | stocktickerTicker->setText( output ); | 323 | stocktickerTicker->setText( output ); |
324 | wasError = true; | 324 | wasError = true; |
325 | // Sock->close(); | 325 | // Sock->close(); |
326 | 326 | ||
327 | } | 327 | } |