author | llornkcor <llornkcor> | 2002-11-01 16:43:34 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-11-01 16:43:34 (UTC) |
commit | 535713ea42d091361f0ac3b14b3f44f3899a7102 (patch) (unidiff) | |
tree | 800414877b9ebca28b2f0b4022156f39dcf1678c /noncore/todayplugins | |
parent | 4c9df59925da5a67d884f8ffb37a263d85948951 (diff) | |
download | opie-535713ea42d091361f0ac3b14b3f44f3899a7102.zip opie-535713ea42d091361f0ac3b14b3f44f3899a7102.tar.gz opie-535713ea42d091361f0ac3b14b3f44f3899a7102.tar.bz2 |
make into symbol lookup
5 files changed, 396 insertions, 102 deletions
diff --git a/noncore/todayplugins/stockticker/stockticker/helpwindow.cpp b/noncore/todayplugins/stockticker/stockticker/helpwindow.cpp new file mode 100644 index 0000000..33dcac0 --- a/dev/null +++ b/noncore/todayplugins/stockticker/stockticker/helpwindow.cpp | |||
@@ -0,0 +1,287 @@ | |||
1 | /**************************************************************************** | ||
2 | ** $Id$ | ||
3 | ** | ||
4 | ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. | ||
5 | ** | ||
6 | ** This file is part of an example program for Qt. This example | ||
7 | ** program may be used, distributed and modified without limitation. | ||
8 | ** | ||
9 | *****************************************************************************/ | ||
10 | |||
11 | #include "helpwindow.h" | ||
12 | #include <qstatusbar.h> | ||
13 | #include <qstringlist.h> | ||
14 | |||
15 | #include <qpixmap.h> | ||
16 | #include <qpopupmenu.h> | ||
17 | #include <qmenubar.h> | ||
18 | #include <qtoolbar.h> | ||
19 | #include <qtoolbutton.h> | ||
20 | #include <qiconset.h> | ||
21 | #include <qfile.h> | ||
22 | #include <qtextstream.h> | ||
23 | #include <qstylesheet.h> | ||
24 | #include <qmessagebox.h> | ||
25 | #include <qfiledialog.h> | ||
26 | #include <qapplication.h> | ||
27 | #include <qcombobox.h> | ||
28 | #include <qevent.h> | ||
29 | #include <qlineedit.h> | ||
30 | #include <qobjectlist.h> | ||
31 | #include <qfileinfo.h> | ||
32 | #include <qfile.h> | ||
33 | #include <qdatastream.h> | ||
34 | #include <qprinter.h> | ||
35 | #include <qsimplerichtext.h> | ||
36 | #include <qpaintdevicemetrics.h> | ||
37 | |||
38 | #include <ctype.h> | ||
39 | |||
40 | HelpWindow::HelpWindow( const QString& home_, const QString& _path, QWidget* parent, const char *name ) | ||
41 | : QMainWindow( parent, name, WDestructiveClose ), pathCombo( 0 ), selectedURL() | ||
42 | { | ||
43 | readHistory(); | ||
44 | readBookmarks(); | ||
45 | |||
46 | browser = new QTextBrowser( this ); | ||
47 | QStringList Strlist; | ||
48 | Strlist.append( home_); | ||
49 | |||
50 | browser->mimeSourceFactory()->setFilePath( Strlist ); | ||
51 | |||
52 | browser->setFrameStyle( QFrame::Panel | QFrame::Sunken ); | ||
53 | |||
54 | connect( browser, SIGNAL( textChanged() ), | ||
55 | |||
56 | this, SLOT( textChanged() ) ); | ||
57 | |||
58 | setCentralWidget( browser ); | ||
59 | |||
60 | if ( !home_.isEmpty() ) | ||
61 | |||
62 | //////////////////////////////// | ||
63 | browser->setSource( home_ ); | ||
64 | |||
65 | //////////////////////////////// | ||
66 | connect( browser, SIGNAL( highlighted( const QString&) ), | ||
67 | statusBar(), SLOT( message( const QString&)) ); | ||
68 | |||
69 | setGeometry( 0,0,236,280); | ||
70 | |||
71 | QPopupMenu* file = new QPopupMenu( this ); | ||
72 | // file->insertItem( tr("&New Window"), this, SLOT( newWindow() ), ALT | Key_N ); | ||
73 | file->insertItem( tr("&Open File"), this, SLOT( openFile() ), ALT | Key_O ); | ||
74 | // file->insertItem( tr("&Print"), this, SLOT( print() ), ALT | Key_P ); | ||
75 | file->insertSeparator(); | ||
76 | file->insertItem( tr("&Close"), this, SLOT( close() ), ALT | Key_Q ); | ||
77 | // file->insertItem( tr("E&xit"), qApp, SLOT( closeAllWindows() ), ALT | Key_X ); | ||
78 | |||
79 | // The same three icons are used twice each. | ||
80 | ////F FIXME | ||
81 | QString pixs=(QDir::homeDirPath ()) +"/Applications/gutenbrowser/pix/"; | ||
82 | QIconSet icon_back( QPixmap(pixs+"back.png") ); | ||
83 | QIconSet icon_forward( QPixmap(pixs+"forward.png") ); | ||
84 | QIconSet icon_home( QPixmap(pixs+"home.png") ); | ||
85 | |||
86 | QPopupMenu* go = new QPopupMenu( this ); | ||
87 | backwardId = go->insertItem( icon_back, tr("&Backward"), browser, SLOT( backward() ), ALT | Key_Left ); | ||
88 | forwardId = go->insertItem( icon_forward, tr("&Forward"), browser, SLOT( forward() ), ALT | Key_Right ); | ||
89 | go->insertItem( icon_home, tr("&Home"), browser, SLOT( home() ) ); | ||
90 | |||
91 | |||
92 | hist = new QPopupMenu( this ); | ||
93 | QStringList::Iterator it = history.begin(); | ||
94 | for ( ; it != history.end(); ++it ) | ||
95 | mHistory[ hist->insertItem( *it ) ] = *it; | ||
96 | connect( hist, SIGNAL( activated( int ) ), this, SLOT( histChosen( int ) ) ); | ||
97 | |||
98 | bookm = new QPopupMenu( this ); | ||
99 | bookm->insertItem( tr( "Add Bookmark" ), this, SLOT( addBookmark() ) ); | ||
100 | bookm->insertSeparator(); | ||
101 | |||
102 | QStringList::Iterator it2 = bookmarks.begin(); | ||
103 | for ( ; it2 != bookmarks.end(); ++it2 ) | ||
104 | mBookmarks[ bookm->insertItem( *it2 ) ] = *it2; | ||
105 | connect( bookm, SIGNAL( activated( int ) ), | ||
106 | this, SLOT( bookmChosen( int ) ) ); | ||
107 | |||
108 | menuBar()->insertItem( tr("&File"), file ); | ||
109 | menuBar()->insertItem( tr("&Go"), go ); | ||
110 | menuBar()->insertItem( tr( "History" ), hist ); | ||
111 | menuBar()->insertItem( tr( "Bookmarks" ), bookm ); | ||
112 | // menuBar()->insertSeparator(); | ||
113 | // menuBar()->insertItem( tr("&Help"), help ); | ||
114 | |||
115 | menuBar()->setItemEnabled( forwardId, FALSE); | ||
116 | menuBar()->setItemEnabled( backwardId, FALSE); | ||
117 | connect( browser, SIGNAL( backwardAvailable( bool ) ), this, SLOT( setBackwardAvailable( bool ) ) ); | ||
118 | connect( browser, SIGNAL( forwardAvailable( bool ) ), this, SLOT( setForwardAvailable( bool ) ) ); | ||
119 | |||
120 | |||
121 | QToolBar* toolbar = new QToolBar( this ); | ||
122 | addToolBar( toolbar, "Toolbar"); | ||
123 | QToolButton* button; | ||
124 | |||
125 | button = new QToolButton( icon_back, tr("Backward"), "", browser, SLOT(backward()), toolbar ); | ||
126 | connect( browser, SIGNAL( backwardAvailable(bool) ), button, SLOT( setEnabled(bool) ) ); | ||
127 | button->setEnabled( FALSE ); | ||
128 | button = new QToolButton( icon_forward, tr("Forward"), "", browser, SLOT(forward()), toolbar ); | ||
129 | connect( browser, SIGNAL( forwardAvailable(bool) ), button, SLOT( setEnabled(bool) ) ); | ||
130 | button->setEnabled( FALSE ); | ||
131 | button = new QToolButton( icon_home, tr("Home"), "", browser, SLOT(home()), toolbar ); | ||
132 | |||
133 | toolbar->addSeparator(); | ||
134 | |||
135 | pathCombo = new QComboBox( TRUE, toolbar ); | ||
136 | connect( pathCombo, SIGNAL( activated( const QString & ) ), this, SLOT( pathSelected( const QString & ) ) ); | ||
137 | toolbar->setStretchableWidget( pathCombo ); | ||
138 | |||
139 | // pathCombo->setMaximumWidth(190); | ||
140 | // setRightJustification( TRUE ); | ||
141 | // setDockEnabled( Left, FALSE ); | ||
142 | // setDockEnabled( Right, FALSE ); | ||
143 | |||
144 | pathCombo->insertItem( home_ ); | ||
145 | |||
146 | browser->setFocus(); | ||
147 | |||
148 | |||
149 | } | ||
150 | |||
151 | |||
152 | void HelpWindow::setBackwardAvailable( bool b) | ||
153 | { | ||
154 | menuBar()->setItemEnabled( backwardId, b); | ||
155 | } | ||
156 | |||
157 | void HelpWindow::setForwardAvailable( bool b) | ||
158 | { | ||
159 | menuBar()->setItemEnabled( forwardId, b); | ||
160 | } | ||
161 | |||
162 | |||
163 | void HelpWindow::textChanged() | ||
164 | { | ||
165 | if ( browser->documentTitle().isNull() ) { | ||
166 | setCaption( "Stockticker Lookup - " + browser->context() ); | ||
167 | selectedURL = browser->context(); | ||
168 | } | ||
169 | else { | ||
170 | setCaption( "Stockticker Lookup - " + browser->documentTitle() ) ; | ||
171 | selectedURL = browser->documentTitle(); | ||
172 | } | ||
173 | |||
174 | if ( !selectedURL.isEmpty() && pathCombo ) { | ||
175 | bool exists = FALSE; | ||
176 | int i; | ||
177 | for ( i = 0; i < pathCombo->count(); ++i ) { | ||
178 | if ( pathCombo->text( i ) == selectedURL ) { | ||
179 | exists = TRUE; | ||
180 | break; | ||
181 | } | ||
182 | } | ||
183 | if ( !exists ) { | ||
184 | pathCombo->insertItem( selectedURL, 0 ); | ||
185 | pathCombo->setCurrentItem( 0 ); | ||
186 | mHistory[ hist->insertItem( selectedURL ) ] = selectedURL; | ||
187 | } else | ||
188 | pathCombo->setCurrentItem( i ); | ||
189 | selectedURL = QString::null; | ||
190 | } | ||
191 | } | ||
192 | |||
193 | HelpWindow::~HelpWindow() | ||
194 | { | ||
195 | history.clear(); | ||
196 | QMap<int, QString>::Iterator it = mHistory.begin(); | ||
197 | for ( ; it != mHistory.end(); ++it ) | ||
198 | history.append( *it ); | ||
199 | |||
200 | QFile f( QDir::currentDirPath() + "/.history" ); | ||
201 | f.open( IO_WriteOnly ); | ||
202 | QDataStream s( &f ); | ||
203 | s << history; | ||
204 | f.close(); | ||
205 | |||
206 | bookmarks.clear(); | ||
207 | QMap<int, QString>::Iterator it2 = mBookmarks.begin(); | ||
208 | for ( ; it2 != mBookmarks.end(); ++it2 ) | ||
209 | bookmarks.append( *it2 ); | ||
210 | |||
211 | QFile f2( QDir::currentDirPath() + "/.bookmarks" ); | ||
212 | f2.open( IO_WriteOnly ); | ||
213 | QDataStream s2( &f2 ); | ||
214 | s2 << bookmarks; | ||
215 | f2.close(); | ||
216 | } | ||
217 | |||
218 | void HelpWindow::openFile() | ||
219 | { | ||
220 | #ifndef QT_NO_FILEDIALOG | ||
221 | QString fn = QFileDialog::getOpenFileName( QString::null, QString::null, this ); | ||
222 | if ( !fn.isEmpty() ) | ||
223 | browser->setSource( fn ); | ||
224 | #endif | ||
225 | } | ||
226 | |||
227 | void HelpWindow::newWindow() | ||
228 | { | ||
229 | ( new HelpWindow(browser->source(), "qbrowser") )->show(); | ||
230 | } | ||
231 | |||
232 | void HelpWindow::pathSelected( const QString &_path ) | ||
233 | { | ||
234 | browser->setSource( _path ); | ||
235 | QMap<int, QString>::Iterator it = mHistory.begin(); | ||
236 | bool exists = FALSE; | ||
237 | for ( ; it != mHistory.end(); ++it ) { | ||
238 | if ( *it == _path ) { | ||
239 | exists = TRUE; | ||
240 | break; | ||
241 | } | ||
242 | } | ||
243 | if ( !exists ) | ||
244 | mHistory[ hist->insertItem( _path ) ] = _path; | ||
245 | } | ||
246 | |||
247 | void HelpWindow::readHistory() | ||
248 | { | ||
249 | if ( QFile::exists( QDir::currentDirPath() + "/.history" ) ) { | ||
250 | QFile f( QDir::currentDirPath() + "/.history" ); | ||
251 | f.open( IO_ReadOnly ); | ||
252 | QDataStream s( &f ); | ||
253 | s >> history; | ||
254 | f.close(); | ||
255 | while ( history.count() > 20 ) | ||
256 | history.remove( history.begin() ); | ||
257 | } | ||
258 | } | ||
259 | |||
260 | void HelpWindow::readBookmarks() | ||
261 | { | ||
262 | if ( QFile::exists( QDir::currentDirPath() + "/.bookmarks" ) ) { | ||
263 | QFile f( QDir::currentDirPath() + "/.bookmarks" ); | ||
264 | f.open( IO_ReadOnly ); | ||
265 | QDataStream s( &f ); | ||
266 | s >> bookmarks; | ||
267 | f.close(); | ||
268 | } | ||
269 | } | ||
270 | |||
271 | void HelpWindow::histChosen( int i ) | ||
272 | { | ||
273 | if ( mHistory.contains( i ) ) | ||
274 | browser->setSource( mHistory[ i ] ); | ||
275 | } | ||
276 | |||
277 | void HelpWindow::bookmChosen( int i ) | ||
278 | { | ||
279 | if ( mBookmarks.contains( i ) ) | ||
280 | browser->setSource( mBookmarks[ i ] ); | ||
281 | } | ||
282 | |||
283 | void HelpWindow::addBookmark() | ||
284 | { | ||
285 | mBookmarks[ bookm->insertItem( caption() ) ] = caption(); | ||
286 | } | ||
287 | |||
diff --git a/noncore/todayplugins/stockticker/stockticker/helpwindow.h b/noncore/todayplugins/stockticker/stockticker/helpwindow.h new file mode 100644 index 0000000..b572edb --- a/dev/null +++ b/noncore/todayplugins/stockticker/stockticker/helpwindow.h | |||
@@ -0,0 +1,62 @@ | |||
1 | /**************************************************************************** | ||
2 | ** $Id$ | ||
3 | ** | ||
4 | ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. | ||
5 | ** | ||
6 | ** This file is part of an example program for Qt. This example | ||
7 | ** program may be used, distributed and modified without limitation. | ||
8 | ** | ||
9 | *****************************************************************************/ | ||
10 | |||
11 | #ifndef HELPWINDOW_H | ||
12 | #define HELPWINDOW_H | ||
13 | |||
14 | #include <qmainwindow.h> | ||
15 | #include <qtextbrowser.h> | ||
16 | #include <qstringlist.h> | ||
17 | #include <qmap.h> | ||
18 | #include <qdir.h> | ||
19 | #include <qevent.h> | ||
20 | |||
21 | class QComboBox; | ||
22 | class QPopupMenu; | ||
23 | |||
24 | class HelpWindow : public QMainWindow | ||
25 | { | ||
26 | Q_OBJECT | ||
27 | public: | ||
28 | HelpWindow( const QString& home_, const QString& path, QWidget* parent = 0, const char *name=0 ); | ||
29 | ~HelpWindow(); | ||
30 | |||
31 | private slots: | ||
32 | void setBackwardAvailable( bool ); | ||
33 | void setForwardAvailable( bool ); | ||
34 | |||
35 | void textChanged(); | ||
36 | void openFile(); | ||
37 | void newWindow(); | ||
38 | |||
39 | void pathSelected( const QString & ); | ||
40 | void histChosen( int ); | ||
41 | void bookmChosen( int ); | ||
42 | void addBookmark(); | ||
43 | private: | ||
44 | void readHistory(); | ||
45 | void readBookmarks(); | ||
46 | |||
47 | QTextBrowser* browser; | ||
48 | QComboBox *pathCombo; | ||
49 | int backwardId, forwardId; | ||
50 | QString selectedURL; | ||
51 | QStringList history, bookmarks; | ||
52 | QMap<int, QString> mHistory, mBookmarks; | ||
53 | QPopupMenu *hist, *bookm; | ||
54 | |||
55 | }; | ||
56 | |||
57 | |||
58 | |||
59 | |||
60 | |||
61 | #endif | ||
62 | |||
diff --git a/noncore/todayplugins/stockticker/stockticker/inputDialog.cpp b/noncore/todayplugins/stockticker/stockticker/inputDialog.cpp index ad841f2..18021c2 100644 --- a/noncore/todayplugins/stockticker/stockticker/inputDialog.cpp +++ b/noncore/todayplugins/stockticker/stockticker/inputDialog.cpp | |||
@@ -14,11 +14,15 @@ | |||
14 | #include <qstringlist.h> | 14 | #include <qstringlist.h> |
15 | #include <qmainwindow.h> | 15 | #include <qmainwindow.h> |
16 | #include "helpwindow.h" | ||
16 | 17 | ||
18 | #include <opie/oprocess.h> | ||
19 | |||
20 | #include <stdlib.h> | ||
21 | // #include <sys/stat.h> | ||
22 | // #include <unistd.h> | ||
17 | 23 | ||
18 | InputDialog::InputDialog( ) | 24 | InputDialog::InputDialog( ) |
19 | : QMainWindow( 0x0, 0x0, WStyle_ContextHelp ) { | 25 | : QMainWindow( 0x0, 0x0, WStyle_ContextHelp ) { |
20 | setCaption( tr("Enter Stock Symbols")); | 26 | setCaption( tr("Symbol Lookup")); |
21 | |||
22 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | ||
23 | 27 | ||
24 | QGridLayout *layout = new QGridLayout( this ); | 28 | QGridLayout *layout = new QGridLayout( this ); |
@@ -28,116 +32,58 @@ InputDialog::InputDialog( ) | |||
28 | LineEdit1 = new QLineEdit( this, "LineEdit1" ); | 32 | LineEdit1 = new QLineEdit( this, "LineEdit1" ); |
29 | LineEdit1->setFocus(); | 33 | LineEdit1->setFocus(); |
30 | QWhatsThis::add( LineEdit1, tr("Enter the stock symbols you want to be shown here.")); | ||
31 | 34 | ||
32 | layout->addMultiCellWidget( LineEdit1, 0, 0, 0, 3); | 35 | layout->addMultiCellWidget( LineEdit1, 0, 0, 0, 3); |
33 | 36 | ||
34 | Config cfg( "stockticker"); | ||
35 | cfg.setGroup( "Symbols" ); | ||
36 | QString symbollist; | ||
37 | symbollist = cfg.readEntry("Symbols", ""); | ||
38 | LineEdit1->setText(symbollist); | ||
39 | |||
40 | QLabel *label; | 37 | QLabel *label; |
41 | label = new QLabel(this); | 38 | label = new QLabel(this); |
42 | label->setText( tr("Enter stock symbols seperated\nby a space.")); | 39 | label->setText( tr("Enter something to lookup / search.")); |
43 | label->setMaximumHeight(60); | 40 | label->setMaximumHeight(60); |
44 | layout->addMultiCellWidget( label, 1, 1, 0, 3); | 41 | layout->addMultiCellWidget( label, 1, 1, 0, 3); |
45 | 42 | ||
46 | cfg.setGroup( "Fields" ); | 43 | connect(LineEdit1,SIGNAL(returnPressed()),this,SLOT(doLookup())); |
47 | 44 | QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Expanding ); | |
48 | timeCheck= new QCheckBox ( "Time",this ); | 45 | layout->addItem( spacer, 8, 0 ); |
49 | timeCheck->setChecked( cfg.readBoolEntry("timeCheck",1)); | ||
50 | layout->addMultiCellWidget(timeCheck, 2, 2, 0, 0 ); | ||
51 | QWhatsThis::add( timeCheck, tr("Toggles Time Field")); | ||
52 | |||
53 | dateCheck= new QCheckBox ( "Date", this ); | ||
54 | dateCheck->setChecked( cfg.readBoolEntry("dateCheck",1)); | ||
55 | layout->addMultiCellWidget( dateCheck, 2, 2, 1, 1 ); | ||
56 | QWhatsThis::add(dateCheck, tr("Toggles date field")); | ||
57 | |||
58 | symbolCheck= new QCheckBox ( "Symbol", this ); | ||
59 | symbolCheck->setChecked( cfg.readBoolEntry("symbolCheck",1)); | ||
60 | layout->addMultiCellWidget( symbolCheck, 3, 3, 0, 0 ); | ||
61 | QWhatsThis::add(symbolCheck, tr("Toggles Symbol field")); | ||
62 | |||
63 | nameCheck= new QCheckBox ( "Name", this ); | ||
64 | nameCheck->setChecked( cfg.readBoolEntry("nameCheck",1)); | ||
65 | layout->addMultiCellWidget( nameCheck, 3, 3, 1, 1 ); | ||
66 | QWhatsThis::add(nameCheck, tr("Toggles Name field")); | ||
67 | |||
68 | currentPriceCheck= new QCheckBox ( "Current Price", this ); | ||
69 | currentPriceCheck->setChecked( cfg.readBoolEntry("currentPriceCheck",1)); | ||
70 | layout->addMultiCellWidget( currentPriceCheck, 4, 4, 0, 0 ); | ||
71 | QWhatsThis::add(currentPriceCheck, tr("Toggles current Price field")); | ||
72 | |||
73 | 46 | ||
74 | lastPriceCheck= new QCheckBox ( "Last Price", this ); | 47 | } |
75 | lastPriceCheck->setChecked( cfg.readBoolEntry("lastPriceCheck",1)); | ||
76 | layout->addMultiCellWidget(lastPriceCheck, 4, 4, 1, 1); | ||
77 | QWhatsThis::add(lastPriceCheck, tr("Toggles last price field")); | ||
78 | 48 | ||
79 | openPriceCheck= new QCheckBox ( "Open Price", this); | 49 | InputDialog::~InputDialog() { |
80 | openPriceCheck->setChecked( cfg.readBoolEntry("openPriceCheck",1)); | 50 | } |
81 | layout->addMultiCellWidget( openPriceCheck, 5, 5, 0, 0 ); | ||
82 | QWhatsThis::add(openPriceCheck, tr("Toggles opening price field")); | ||
83 | 51 | ||
84 | minPriceCheck= new QCheckBox ( "Min Price", this ); | 52 | void InputDialog::doLookup() { |
85 | minPriceCheck->setChecked( cfg.readBoolEntry("minPriceCheck",1)); | 53 | // http://finance.yahoo.com/l?m=&s=siemens&t= |
86 | layout->addMultiCellWidget( minPriceCheck, 5, 5, 1, 1); | ||
87 | QWhatsThis::add(minPriceCheck, tr("Toggles minamum price field")); | ||
88 | 54 | ||
89 | maxPriceCheck= new QCheckBox ( "Max Price", this); | 55 | QString url = "\"http://finance.yahoo.com/l?m=&s="+LineEdit1->text()+"\""; |
90 | maxPriceCheck->setChecked( cfg.readBoolEntry("maxPriceCheck",1)); | 56 | QString tempHtml = "/tmp/stockticker.html"; |
91 | layout->addMultiCellWidget( maxPriceCheck, 6, 6, 0, 0 ); | 57 | QString cmd = "wget -O "+tempHtml+" "+url; |
92 | QWhatsThis::add(maxPriceCheck, tr("Toggles maximum price field")); | 58 | qDebug(cmd); |
93 | 59 | ||
94 | variationCheck= new QCheckBox ( "Variation", this ); | ||
95 | variationCheck->setChecked( cfg.readBoolEntry("variationCheck",1)); | ||
96 | layout->addMultiCellWidget( variationCheck, 6, 6, 1, 1 ); | ||
97 | QWhatsThis::add(variationCheck, tr("Toggles daily variation field")); | ||
98 | 60 | ||
99 | volumeCheck= new QCheckBox ( "Volume", this ); | 61 | /* |
100 | volumeCheck->setChecked( cfg.readBoolEntry("volumeCheck",1)); | 62 | OProcess proc; |
101 | layout->addMultiCellWidget( volumeCheck , 7, 7, 0, 0); | 63 | proc << "/usr/bin/wget"; |
102 | QWhatsThis::add(volumeCheck, tr("Toggles volume field")); | 64 | proc<<"-O"<< tempHtml<< url; |
103 | 65 | ||
66 | connect( &proc, SIGNAL( processExited( OProcess *)),this, SLOT( showBrowser(OProcess *))); | ||
67 | proc.start( OProcess::NotifyOnExit); | ||
68 | */ | ||
69 | system(cmd.latin1()); | ||
70 | HelpWindow *StockLookup = new HelpWindow( tempHtml,".",this, "SymbolLookup"); | ||
71 | StockLookup->setCaption("Symbol"); | ||
72 | StockLookup->showMaximized(); | ||
73 | StockLookup->show(); | ||
74 | LineEdit1->text(); | ||
104 | 75 | ||
105 | QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Expanding ); | ||
106 | layout->addItem( spacer, 8, 0 ); | ||
107 | 76 | ||
108 | } | 77 | } |
109 | 78 | ||
110 | QString InputDialog::text() const { | 79 | void InputDialog::showBrowser(OProcess*) { |
111 | return LineEdit1->text(); | 80 | qDebug("BLAH"); |
112 | } | 81 | QString tempHtml = "/tmp/stockticker.html"; |
113 | 82 | ||
114 | InputDialog::~InputDialog() { | 83 | HelpWindow *StockLookup = new HelpWindow( tempHtml,".",this, "SymbolLookup"); |
115 | } | 84 | StockLookup->setCaption("Symbol"); |
85 | StockLookup->showMaximized(); | ||
86 | StockLookup->show(); | ||
87 | LineEdit1->text(); | ||
116 | 88 | ||
117 | void InputDialog::cleanUp(){ | ||
118 | Config cfg( "stockticker"); | ||
119 | cfg.setGroup( "Symbols" ); | ||
120 | QString outText = text().upper(); | ||
121 | outText.stripWhiteSpace(); | ||
122 | cfg.writeEntry("Symbols", outText ); | ||
123 | qDebug( "<<<<<<<<<<<>>>>>>>>>>>>"+text()); | ||
124 | |||
125 | cfg.setGroup( "Fields" ); | ||
126 | |||
127 | cfg.writeEntry("timeCheck",timeCheck->isChecked()); | ||
128 | cfg.writeEntry("dateCheck",dateCheck->isChecked()); | ||
129 | cfg.writeEntry("symbolCheck",symbolCheck->isChecked()); | ||
130 | cfg.writeEntry("nameCheck",nameCheck->isChecked()); | ||
131 | cfg.writeEntry("currentPriceCheck",currentPriceCheck->isChecked()); | ||
132 | cfg.writeEntry("lastPriceCheck",lastPriceCheck->isChecked()); | ||
133 | cfg.writeEntry("openPriceCheck",openPriceCheck->isChecked()); | ||
134 | cfg.writeEntry("minPriceCheck",minPriceCheck->isChecked()); | ||
135 | cfg.writeEntry("maxPriceCheck",maxPriceCheck->isChecked()); | ||
136 | cfg.writeEntry("variationCheck",variationCheck->isChecked()); | ||
137 | cfg.writeEntry("volumeCheck",volumeCheck->isChecked()); | ||
138 | |||
139 | |||
140 | cfg.write(); | ||
141 | } | 89 | } |
142 | |||
143 | |||
diff --git a/noncore/todayplugins/stockticker/stockticker/inputDialog.h b/noncore/todayplugins/stockticker/stockticker/inputDialog.h index 8fda6ad..15c2f22 100644 --- a/noncore/todayplugins/stockticker/stockticker/inputDialog.h +++ b/noncore/todayplugins/stockticker/stockticker/inputDialog.h | |||
@@ -6,4 +6,5 @@ | |||
6 | #include <qdialog.h> | 6 | #include <qdialog.h> |
7 | #include <qmainwindow.h> | 7 | #include <qmainwindow.h> |
8 | #include <opie/oprocess.h> | ||
8 | 9 | ||
9 | class QLineEdit; | 10 | class QLineEdit; |
@@ -15,13 +16,11 @@ class InputDialog : public QMainWindow { | |||
15 | public: | 16 | public: |
16 | InputDialog( ); | 17 | InputDialog( ); |
17 | // InputDialog( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | ||
18 | ~InputDialog(); | 18 | ~InputDialog(); |
19 | QString text()const; | ||
20 | 19 | ||
21 | private: | 20 | private: |
22 | QLineEdit* LineEdit1; | 21 | QLineEdit* LineEdit1; |
23 | QCheckBox *timeCheck, *dateCheck, *symbolCheck, *nameCheck, *currentPriceCheck, *lastPriceCheck, *openPriceCheck, *minPriceCheck, *maxPriceCheck, *variationCheck, *volumeCheck; | ||
24 | private slots: | 22 | private slots: |
25 | void cleanUp(); | 23 | void doLookup(); |
24 | void showBrowser(OProcess*); | ||
26 | protected slots: | 25 | protected slots: |
27 | 26 | ||
diff --git a/noncore/todayplugins/stockticker/stockticker/stockticker.pro b/noncore/todayplugins/stockticker/stockticker/stockticker.pro index 0e970f1..c5fe885 100644 --- a/noncore/todayplugins/stockticker/stockticker/stockticker.pro +++ b/noncore/todayplugins/stockticker/stockticker/stockticker.pro | |||
@@ -1,10 +1,10 @@ | |||
1 | TEMPLATE = app | 1 | TEMPLATE = app |
2 | CONFIG = qt warn_on release | 2 | CONFIG = qt warn_on release |
3 | HEADERS = inputDialog.h | 3 | HEADERS = inputDialog.h helpwindow.h |
4 | SOURCES = inputDialog.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 | 9 | LIBS+= -lqpe -lopie |
10 | DESTDIR = $(OPIEDIR)/bin | 10 | DESTDIR = $(OPIEDIR)/bin |