4 files changed, 12 insertions, 12 deletions
diff --git a/noncore/todayplugins/fortune/fortunepluginwidget.cpp b/noncore/todayplugins/fortune/fortunepluginwidget.cpp index b210fa9..e6a0d09 100644 --- a/noncore/todayplugins/fortune/fortunepluginwidget.cpp +++ b/noncore/todayplugins/fortune/fortunepluginwidget.cpp | |||
@@ -19,66 +19,66 @@ | |||
19 | #include <qvaluelist.h> | 19 | #include <qvaluelist.h> |
20 | #include <qtl.h> | 20 | #include <qtl.h> |
21 | #include <qstring.h> | 21 | #include <qstring.h> |
22 | #include <qscrollview.h> | 22 | #include <qscrollview.h> |
23 | #include <qobject.h> | 23 | #include <qobject.h> |
24 | #include <qlayout.h> | 24 | #include <qlayout.h> |
25 | 25 | ||
26 | #include <qpe/config.h> | 26 | #include <qpe/config.h> |
27 | #include <qpe/qcopenvelope_qws.h> | 27 | #include <qpe/qcopenvelope_qws.h> |
28 | 28 | ||
29 | #include <opie/oprocess.h> | 29 | #include <opie/oprocess.h> |
30 | #include <opie/oticker.h> | 30 | #include <opie/oticker.h> |
31 | 31 | ||
32 | FortunePluginWidget::FortunePluginWidget( QWidget *parent, const char* name ) | 32 | FortunePluginWidget::FortunePluginWidget( QWidget *parent, const char* name ) |
33 | : QWidget( parent, name ) | 33 | : QWidget( parent, name ) |
34 | { | 34 | { |
35 | 35 | ||
36 | fortune = NULL; | 36 | fortune = NULL; |
37 | getFortune(); | 37 | getFortune(); |
38 | } | 38 | } |
39 | 39 | ||
40 | FortunePluginWidget::~FortunePluginWidget() { | 40 | FortunePluginWidget::~FortunePluginWidget() { |
41 | if( fortuneProcess ){ | 41 | if( fortuneProcess ){ |
42 | delete fortuneProcess; | 42 | delete fortuneProcess; |
43 | } | 43 | } |
44 | } | 44 | } |
45 | 45 | ||
46 | /** | 46 | /** |
47 | * Get the fortunes | 47 | * Get the fortunes |
48 | */ | 48 | */ |
49 | void FortunePluginWidget::getFortune() { | 49 | void FortunePluginWidget::getFortune() { |
50 | 50 | ||
51 | QVBoxLayout* layoutFortune = new QVBoxLayout( this ); | 51 | QVBoxLayout* layoutFortune = new QVBoxLayout( this ); |
52 | 52 | ||
53 | if ( fortune ) { | 53 | if ( fortune ) { |
54 | delete fortune; | 54 | delete fortune; |
55 | } | 55 | } |
56 | 56 | ||
57 | fortune = new OTicker( this ); | 57 | fortune = new OTicker( this ); |
58 | //fortune->setReadOnly( TRUE ); | 58 | //fortune->setReadOnly( TRUE ); |
59 | //fortune->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ) ); | 59 | //fortune->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ) ); |
60 | 60 | ||
61 | fortune->setText( QString("Obtaining fortune...") ); | 61 | fortune->setText( QString("Obtaining fortune...") ); |
62 | layoutFortune->addWidget( fortune ); | 62 | layoutFortune->addWidget( fortune ); |
63 | 63 | ||
64 | fortuneProcess = new OProcess(); | 64 | fortuneProcess = new OProcess(); |
65 | *fortuneProcess << "fortune"; | 65 | *fortuneProcess << "fortune"; |
66 | 66 | ||
67 | connect(fortuneProcess, SIGNAL(receivedStdout(OProcess*, char*, int ) ), | 67 | connect(fortuneProcess, SIGNAL(receivedStdout(OProcess*,char*,int) ), |
68 | this, SLOT(slotStdOut(OProcess*, char*, int) ) ); | 68 | this, SLOT(slotStdOut(OProcess*,char*,int) ) ); |
69 | 69 | ||
70 | if(!fortuneProcess->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) { | 70 | if(!fortuneProcess->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) { |
71 | qWarning("could not start :("); | 71 | qWarning("could not start :("); |
72 | fortune->setText( QString("Failed to obtain fortune.") ); | 72 | fortune->setText( QString("Failed to obtain fortune.") ); |
73 | delete fortuneProcess; | 73 | delete fortuneProcess; |
74 | fortuneProcess = 0; | 74 | fortuneProcess = 0; |
75 | } | 75 | } |
76 | 76 | ||
77 | } | 77 | } |
78 | 78 | ||
79 | void FortunePluginWidget::slotStdOut( OProcess* proc, char* buf, int len ) | 79 | void FortunePluginWidget::slotStdOut( OProcess* proc, char* buf, int len ) |
80 | { | 80 | { |
81 | QCString s( buf, len ); | 81 | QCString s( buf, len ); |
82 | s.replace( QRegExp("\n"), "" ); | 82 | s.replace( QRegExp("\n"), "" ); |
83 | fortune->setText( s ); | 83 | fortune->setText( s ); |
84 | } | 84 | } |
diff --git a/noncore/todayplugins/stockticker/stockticker/helpwindow.cpp b/noncore/todayplugins/stockticker/stockticker/helpwindow.cpp index 2274402..db662e8 100644 --- a/noncore/todayplugins/stockticker/stockticker/helpwindow.cpp +++ b/noncore/todayplugins/stockticker/stockticker/helpwindow.cpp | |||
@@ -1,164 +1,164 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** | 2 | ** |
3 | ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. | 3 | ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. |
4 | ** | 4 | ** |
5 | ** This file is part of an example program for Qt. This example | 5 | ** This file is part of an example program for Qt. This example |
6 | ** program may be used, distributed and modified without limitation. | 6 | ** program may be used, distributed and modified without limitation. |
7 | ** | 7 | ** |
8 | *****************************************************************************/ | 8 | *****************************************************************************/ |
9 | 9 | ||
10 | #include "helpwindow.h" | 10 | #include "helpwindow.h" |
11 | #include <qstatusbar.h> | 11 | #include <qstatusbar.h> |
12 | 12 | ||
13 | #include <qmenubar.h> | 13 | #include <qmenubar.h> |
14 | #include <qtoolbar.h> | 14 | #include <qtoolbar.h> |
15 | #include <qtoolbutton.h> | 15 | #include <qtoolbutton.h> |
16 | #include <qcombobox.h> | 16 | #include <qcombobox.h> |
17 | 17 | ||
18 | #include <ctype.h> | 18 | #include <ctype.h> |
19 | 19 | ||
20 | HelpWindow::HelpWindow( const QString& home_, const QString& _path, QWidget* parent, const char *name ) | 20 | HelpWindow::HelpWindow( const QString& home_, const QString& _path, QWidget* parent, const char *name ) |
21 | : QMainWindow( parent, name, WDestructiveClose ), pathCombo( 0 ), selectedURL() | 21 | : QMainWindow( parent, name, WDestructiveClose ), pathCombo( 0 ), selectedURL() |
22 | { | 22 | { |
23 | readHistory(); | 23 | readHistory(); |
24 | readBookmarks(); | 24 | readBookmarks(); |
25 | 25 | ||
26 | browser = new QTextBrowser( this ); | 26 | browser = new QTextBrowser( this ); |
27 | QStringList Strlist; | 27 | QStringList Strlist; |
28 | Strlist.append( home_); | 28 | Strlist.append( home_); |
29 | 29 | ||
30 | browser->mimeSourceFactory()->setFilePath( Strlist ); | 30 | browser->mimeSourceFactory()->setFilePath( Strlist ); |
31 | 31 | ||
32 | browser->setFrameStyle( QFrame::Panel | QFrame::Sunken ); | 32 | browser->setFrameStyle( QFrame::Panel | QFrame::Sunken ); |
33 | 33 | ||
34 | connect( browser, SIGNAL( textChanged() ), | 34 | connect( browser, SIGNAL( textChanged() ), |
35 | 35 | ||
36 | this, SLOT( textChanged() ) ); | 36 | this, SLOT( textChanged() ) ); |
37 | 37 | ||
38 | setCentralWidget( browser ); | 38 | setCentralWidget( browser ); |
39 | 39 | ||
40 | if ( !home_.isEmpty() ) | 40 | if ( !home_.isEmpty() ) |
41 | 41 | ||
42 | //////////////////////////////// | 42 | //////////////////////////////// |
43 | browser->setSource( home_ ); | 43 | browser->setSource( home_ ); |
44 | 44 | ||
45 | //////////////////////////////// | 45 | //////////////////////////////// |
46 | connect( browser, SIGNAL( highlighted( const QString&) ), | 46 | connect( browser, SIGNAL( highlighted(const QString&) ), |
47 | statusBar(), SLOT( message( const QString&)) ); | 47 | statusBar(), SLOT( message(const QString&)) ); |
48 | 48 | ||
49 | setGeometry( 0,0,236,280); | 49 | setGeometry( 0,0,236,280); |
50 | 50 | ||
51 | QPopupMenu* file = new QPopupMenu( this ); | 51 | QPopupMenu* file = new QPopupMenu( this ); |
52 | // file->insertItem( tr("&New Window"), this, SLOT( newWindow() ), ALT | Key_N ); | 52 | // file->insertItem( tr("&New Window"), this, SLOT( newWindow() ), ALT | Key_N ); |
53 | file->insertItem( tr("&Open File"), this, SLOT( openFile() ), ALT | Key_O ); | 53 | file->insertItem( tr("&Open File"), this, SLOT( openFile() ), ALT | Key_O ); |
54 | // file->insertItem( tr("&Print"), this, SLOT( print() ), ALT | Key_P ); | 54 | // file->insertItem( tr("&Print"), this, SLOT( print() ), ALT | Key_P ); |
55 | file->insertSeparator(); | 55 | file->insertSeparator(); |
56 | file->insertItem( tr("&Close"), this, SLOT( close() ), ALT | Key_Q ); | 56 | file->insertItem( tr("&Close"), this, SLOT( close() ), ALT | Key_Q ); |
57 | // file->insertItem( tr("E&xit"), qApp, SLOT( closeAllWindows() ), ALT | Key_X ); | 57 | // file->insertItem( tr("E&xit"), qApp, SLOT( closeAllWindows() ), ALT | Key_X ); |
58 | 58 | ||
59 | // The same three icons are used twice each. | 59 | // The same three icons are used twice each. |
60 | ////F FIXME | 60 | ////F FIXME |
61 | QString pixs=(QDir::homeDirPath ()) +"/Applications/gutenbrowser/pix/"; | 61 | QString pixs=(QDir::homeDirPath ()) +"/Applications/gutenbrowser/pix/"; |
62 | QIconSet icon_back( QPixmap(pixs+"back.png") ); | 62 | QIconSet icon_back( QPixmap(pixs+"back.png") ); |
63 | QIconSet icon_forward( QPixmap(pixs+"forward.png") ); | 63 | QIconSet icon_forward( QPixmap(pixs+"forward.png") ); |
64 | QIconSet icon_home( QPixmap(pixs+"home.png") ); | 64 | QIconSet icon_home( QPixmap(pixs+"home.png") ); |
65 | 65 | ||
66 | QPopupMenu* go = new QPopupMenu( this ); | 66 | QPopupMenu* go = new QPopupMenu( this ); |
67 | backwardId = go->insertItem( icon_back, tr("&Backward"), browser, SLOT( backward() ), ALT | Key_Left ); | 67 | backwardId = go->insertItem( icon_back, tr("&Backward"), browser, SLOT( backward() ), ALT | Key_Left ); |
68 | forwardId = go->insertItem( icon_forward, tr("&Forward"), browser, SLOT( forward() ), ALT | Key_Right ); | 68 | forwardId = go->insertItem( icon_forward, tr("&Forward"), browser, SLOT( forward() ), ALT | Key_Right ); |
69 | go->insertItem( icon_home, tr("&Home"), browser, SLOT( home() ) ); | 69 | go->insertItem( icon_home, tr("&Home"), browser, SLOT( home() ) ); |
70 | 70 | ||
71 | 71 | ||
72 | hist = new QPopupMenu( this ); | 72 | hist = new QPopupMenu( this ); |
73 | QStringList::Iterator it = history.begin(); | 73 | QStringList::Iterator it = history.begin(); |
74 | for ( ; it != history.end(); ++it ) | 74 | for ( ; it != history.end(); ++it ) |
75 | mHistory[ hist->insertItem( *it ) ] = *it; | 75 | mHistory[ hist->insertItem( *it ) ] = *it; |
76 | connect( hist, SIGNAL( activated( int ) ), this, SLOT( histChosen( int ) ) ); | 76 | connect( hist, SIGNAL( activated(int) ), this, SLOT( histChosen(int) ) ); |
77 | 77 | ||
78 | bookm = new QPopupMenu( this ); | 78 | bookm = new QPopupMenu( this ); |
79 | bookm->insertItem( tr( "Add Bookmark" ), this, SLOT( addBookmark() ) ); | 79 | bookm->insertItem( tr( "Add Bookmark" ), this, SLOT( addBookmark() ) ); |
80 | bookm->insertSeparator(); | 80 | bookm->insertSeparator(); |
81 | 81 | ||
82 | QStringList::Iterator it2 = bookmarks.begin(); | 82 | QStringList::Iterator it2 = bookmarks.begin(); |
83 | for ( ; it2 != bookmarks.end(); ++it2 ) | 83 | for ( ; it2 != bookmarks.end(); ++it2 ) |
84 | mBookmarks[ bookm->insertItem( *it2 ) ] = *it2; | 84 | mBookmarks[ bookm->insertItem( *it2 ) ] = *it2; |
85 | connect( bookm, SIGNAL( activated( int ) ), | 85 | connect( bookm, SIGNAL( activated(int) ), |
86 | this, SLOT( bookmChosen( int ) ) ); | 86 | this, SLOT( bookmChosen(int) ) ); |
87 | 87 | ||
88 | menuBar()->insertItem( tr("&File"), file ); | 88 | menuBar()->insertItem( tr("&File"), file ); |
89 | menuBar()->insertItem( tr("&Go"), go ); | 89 | menuBar()->insertItem( tr("&Go"), go ); |
90 | menuBar()->insertItem( tr( "History" ), hist ); | 90 | menuBar()->insertItem( tr( "History" ), hist ); |
91 | menuBar()->insertItem( tr( "Bookmarks" ), bookm ); | 91 | menuBar()->insertItem( tr( "Bookmarks" ), bookm ); |
92 | // menuBar()->insertSeparator(); | 92 | // menuBar()->insertSeparator(); |
93 | // menuBar()->insertItem( tr("&Help"), help ); | 93 | // menuBar()->insertItem( tr("&Help"), help ); |
94 | 94 | ||
95 | menuBar()->setItemEnabled( forwardId, FALSE); | 95 | menuBar()->setItemEnabled( forwardId, FALSE); |
96 | menuBar()->setItemEnabled( backwardId, FALSE); | 96 | menuBar()->setItemEnabled( backwardId, FALSE); |
97 | connect( browser, SIGNAL( backwardAvailable( bool ) ), this, SLOT( setBackwardAvailable( bool ) ) ); | 97 | connect( browser, SIGNAL( backwardAvailable(bool) ), this, SLOT( setBackwardAvailable(bool) ) ); |
98 | connect( browser, SIGNAL( forwardAvailable( bool ) ), this, SLOT( setForwardAvailable( bool ) ) ); | 98 | connect( browser, SIGNAL( forwardAvailable(bool) ), this, SLOT( setForwardAvailable(bool) ) ); |
99 | 99 | ||
100 | 100 | ||
101 | QToolBar* toolbar = new QToolBar( this ); | 101 | QToolBar* toolbar = new QToolBar( this ); |
102 | addToolBar( toolbar, "Toolbar"); | 102 | addToolBar( toolbar, "Toolbar"); |
103 | QToolButton* button; | 103 | QToolButton* button; |
104 | 104 | ||
105 | button = new QToolButton( icon_back, tr("Backward"), "", browser, SLOT(backward()), toolbar ); | 105 | button = new QToolButton( icon_back, tr("Backward"), "", browser, SLOT(backward()), toolbar ); |
106 | connect( browser, SIGNAL( backwardAvailable(bool) ), button, SLOT( setEnabled(bool) ) ); | 106 | connect( browser, SIGNAL( backwardAvailable(bool) ), button, SLOT( setEnabled(bool) ) ); |
107 | button->setEnabled( FALSE ); | 107 | button->setEnabled( FALSE ); |
108 | button = new QToolButton( icon_forward, tr("Forward"), "", browser, SLOT(forward()), toolbar ); | 108 | button = new QToolButton( icon_forward, tr("Forward"), "", browser, SLOT(forward()), toolbar ); |
109 | connect( browser, SIGNAL( forwardAvailable(bool) ), button, SLOT( setEnabled(bool) ) ); | 109 | connect( browser, SIGNAL( forwardAvailable(bool) ), button, SLOT( setEnabled(bool) ) ); |
110 | button->setEnabled( FALSE ); | 110 | button->setEnabled( FALSE ); |
111 | button = new QToolButton( icon_home, tr("Home"), "", browser, SLOT(home()), toolbar ); | 111 | button = new QToolButton( icon_home, tr("Home"), "", browser, SLOT(home()), toolbar ); |
112 | 112 | ||
113 | toolbar->addSeparator(); | 113 | toolbar->addSeparator(); |
114 | 114 | ||
115 | pathCombo = new QComboBox( TRUE, toolbar ); | 115 | pathCombo = new QComboBox( TRUE, toolbar ); |
116 | connect( pathCombo, SIGNAL( activated( const QString & ) ), this, SLOT( pathSelected( const QString & ) ) ); | 116 | connect( pathCombo, SIGNAL( activated(const QString&) ), this, SLOT( pathSelected(const QString&) ) ); |
117 | toolbar->setStretchableWidget( pathCombo ); | 117 | toolbar->setStretchableWidget( pathCombo ); |
118 | 118 | ||
119 | // pathCombo->setMaximumWidth(190); | 119 | // pathCombo->setMaximumWidth(190); |
120 | // setRightJustification( TRUE ); | 120 | // setRightJustification( TRUE ); |
121 | // setDockEnabled( Left, FALSE ); | 121 | // setDockEnabled( Left, FALSE ); |
122 | // setDockEnabled( Right, FALSE ); | 122 | // setDockEnabled( Right, FALSE ); |
123 | 123 | ||
124 | pathCombo->insertItem( home_ ); | 124 | pathCombo->insertItem( home_ ); |
125 | 125 | ||
126 | browser->setFocus(); | 126 | browser->setFocus(); |
127 | 127 | ||
128 | 128 | ||
129 | } | 129 | } |
130 | 130 | ||
131 | 131 | ||
132 | void HelpWindow::setBackwardAvailable( bool b) | 132 | void HelpWindow::setBackwardAvailable( bool b) |
133 | { | 133 | { |
134 | menuBar()->setItemEnabled( backwardId, b); | 134 | menuBar()->setItemEnabled( backwardId, b); |
135 | } | 135 | } |
136 | 136 | ||
137 | void HelpWindow::setForwardAvailable( bool b) | 137 | void HelpWindow::setForwardAvailable( bool b) |
138 | { | 138 | { |
139 | menuBar()->setItemEnabled( forwardId, b); | 139 | menuBar()->setItemEnabled( forwardId, b); |
140 | } | 140 | } |
141 | 141 | ||
142 | 142 | ||
143 | void HelpWindow::textChanged() | 143 | void HelpWindow::textChanged() |
144 | { | 144 | { |
145 | if ( browser->documentTitle().isNull() ) { | 145 | if ( browser->documentTitle().isNull() ) { |
146 | setCaption( "Stockticker Lookup - " + browser->context() ); | 146 | setCaption( "Stockticker Lookup - " + browser->context() ); |
147 | selectedURL = browser->context(); | 147 | selectedURL = browser->context(); |
148 | } | 148 | } |
149 | else { | 149 | else { |
150 | setCaption( "Stockticker Lookup - " + browser->documentTitle() ) ; | 150 | setCaption( "Stockticker Lookup - " + browser->documentTitle() ) ; |
151 | selectedURL = browser->documentTitle(); | 151 | selectedURL = browser->documentTitle(); |
152 | } | 152 | } |
153 | 153 | ||
154 | if ( !selectedURL.isEmpty() && pathCombo ) { | 154 | if ( !selectedURL.isEmpty() && pathCombo ) { |
155 | bool exists = FALSE; | 155 | bool exists = FALSE; |
156 | int i; | 156 | int i; |
157 | for ( i = 0; i < pathCombo->count(); ++i ) { | 157 | for ( i = 0; i < pathCombo->count(); ++i ) { |
158 | if ( pathCombo->text( i ) == selectedURL ) { | 158 | if ( pathCombo->text( i ) == selectedURL ) { |
159 | exists = TRUE; | 159 | exists = TRUE; |
160 | break; | 160 | break; |
161 | } | 161 | } |
162 | } | 162 | } |
163 | if ( !exists ) { | 163 | if ( !exists ) { |
164 | pathCombo->insertItem( selectedURL, 0 ); | 164 | pathCombo->insertItem( selectedURL, 0 ); |
diff --git a/noncore/todayplugins/stockticker/stockticker/inputDialog.cpp b/noncore/todayplugins/stockticker/stockticker/inputDialog.cpp index 73f8bb3..64798f4 100644 --- a/noncore/todayplugins/stockticker/stockticker/inputDialog.cpp +++ b/noncore/todayplugins/stockticker/stockticker/inputDialog.cpp | |||
@@ -18,72 +18,72 @@ | |||
18 | #include <opie/oprocess.h> | 18 | #include <opie/oprocess.h> |
19 | 19 | ||
20 | #include <stdlib.h> | 20 | #include <stdlib.h> |
21 | // #include <sys/stat.h> | 21 | // #include <sys/stat.h> |
22 | // #include <unistd.h> | 22 | // #include <unistd.h> |
23 | 23 | ||
24 | InputDialog::InputDialog( ) | 24 | InputDialog::InputDialog( ) |
25 | : QMainWindow( 0x0, 0x0, WStyle_ContextHelp ) { | 25 | : QMainWindow( 0x0, 0x0, WStyle_ContextHelp ) { |
26 | setCaption( tr("Symbol Lookup")); | 26 | setCaption( tr("Symbol Lookup")); |
27 | 27 | ||
28 | QGridLayout *layout = new QGridLayout( this ); | 28 | QGridLayout *layout = new QGridLayout( this ); |
29 | layout->setSpacing(6); | 29 | layout->setSpacing(6); |
30 | layout->setMargin( 2); | 30 | layout->setMargin( 2); |
31 | 31 | ||
32 | LineEdit1 = new QLineEdit( this, "LineEdit1" ); | 32 | LineEdit1 = new QLineEdit( this, "LineEdit1" ); |
33 | LineEdit1->setFocus(); | 33 | LineEdit1->setFocus(); |
34 | 34 | ||
35 | layout->addMultiCellWidget( LineEdit1, 0, 0, 0, 3); | 35 | layout->addMultiCellWidget( LineEdit1, 0, 0, 0, 3); |
36 | 36 | ||
37 | QLabel *label; | 37 | QLabel *label; |
38 | label = new QLabel(this); | 38 | label = new QLabel(this); |
39 | label->setText( tr("Enter something to lookup / search.")); | 39 | label->setText( tr("Enter something to lookup / search.")); |
40 | label->setMaximumHeight(60); | 40 | label->setMaximumHeight(60); |
41 | layout->addMultiCellWidget( label, 1, 1, 0, 3); | 41 | layout->addMultiCellWidget( label, 1, 1, 0, 3); |
42 | 42 | ||
43 | connect(LineEdit1,SIGNAL(returnPressed()),this,SLOT(doLookup())); | 43 | connect(LineEdit1,SIGNAL(returnPressed()),this,SLOT(doLookup())); |
44 | QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Expanding ); | 44 | QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Expanding ); |
45 | layout->addItem( spacer, 8, 0 ); | 45 | layout->addItem( spacer, 8, 0 ); |
46 | 46 | ||
47 | } | 47 | } |
48 | 48 | ||
49 | InputDialog::~InputDialog() { | 49 | InputDialog::~InputDialog() { |
50 | } | 50 | } |
51 | 51 | ||
52 | void InputDialog::doLookup() { | 52 | void InputDialog::doLookup() { |
53 | // http://finance.yahoo.com/l?m=&s=siemens&t= | 53 | // http://finance.yahoo.com/l?m=&s=siemens&t= |
54 | 54 | ||
55 | QString url = "\"http://finance.yahoo.com/l?m=&s="+LineEdit1->text()+"\""; | 55 | QString url = "\"http://finance.yahoo.com/l?m=&s="+LineEdit1->text()+"\""; |
56 | QString tempHtml = "/tmp/stockticker.html"; | 56 | QString tempHtml = "/tmp/stockticker.html"; |
57 | QString cmd = "wget -O "+tempHtml+" "+url; | 57 | QString cmd = "wget -O "+tempHtml+" "+url; |
58 | qDebug(cmd); | 58 | qDebug(cmd); |
59 | 59 | ||
60 | 60 | ||
61 | /* | 61 | /* |
62 | OProcess proc; | 62 | OProcess proc; |
63 | proc << "/usr/bin/wget"; | 63 | proc << "/usr/bin/wget"; |
64 | proc<<"-O"<< tempHtml<< url; | 64 | proc<<"-O"<< tempHtml<< url; |
65 | 65 | ||
66 | connect( &proc, SIGNAL( processExited( OProcess *)),this, SLOT( showBrowser(OProcess *))); | 66 | connect( &proc, SIGNAL( processExited(OProcess*)),this, SLOT( showBrowser(OProcess*))); |
67 | proc.start( OProcess::NotifyOnExit); | 67 | proc.start( OProcess::NotifyOnExit); |
68 | */ | 68 | */ |
69 | system(cmd.latin1()); | 69 | system(cmd.latin1()); |
70 | HelpWindow *StockLookup = new HelpWindow( tempHtml,".",this, "SymbolLookup"); | 70 | HelpWindow *StockLookup = new HelpWindow( tempHtml,".",this, "SymbolLookup"); |
71 | StockLookup->setCaption("Symbol"); | 71 | StockLookup->setCaption("Symbol"); |
72 | StockLookup->showMaximized(); | 72 | StockLookup->showMaximized(); |
73 | StockLookup->show(); | 73 | StockLookup->show(); |
74 | LineEdit1->text(); | 74 | LineEdit1->text(); |
75 | 75 | ||
76 | 76 | ||
77 | } | 77 | } |
78 | 78 | ||
79 | void InputDialog::showBrowser(OProcess*) { | 79 | void InputDialog::showBrowser(OProcess*) { |
80 | qDebug("BLAH"); | 80 | qDebug("BLAH"); |
81 | QString tempHtml = "/tmp/stockticker.html"; | 81 | QString tempHtml = "/tmp/stockticker.html"; |
82 | 82 | ||
83 | HelpWindow *StockLookup = new HelpWindow( tempHtml,".",this, "SymbolLookup"); | 83 | HelpWindow *StockLookup = new HelpWindow( tempHtml,".",this, "SymbolLookup"); |
84 | StockLookup->setCaption("Symbol"); | 84 | StockLookup->setCaption("Symbol"); |
85 | StockLookup->showMaximized(); | 85 | StockLookup->showMaximized(); |
86 | StockLookup->show(); | 86 | StockLookup->show(); |
87 | LineEdit1->text(); | 87 | LineEdit1->text(); |
88 | 88 | ||
89 | } | 89 | } |
diff --git a/noncore/todayplugins/weather/weatherpluginwidget.cpp b/noncore/todayplugins/weather/weatherpluginwidget.cpp index 4491b91..15d1c6e 100644 --- a/noncore/todayplugins/weather/weatherpluginwidget.cpp +++ b/noncore/todayplugins/weather/weatherpluginwidget.cpp | |||
@@ -60,97 +60,97 @@ WeatherPluginWidget::WeatherPluginWidget( QWidget *parent, const char* name ) | |||
60 | startTimer(1000); | 60 | startTimer(1000); |
61 | } | 61 | } |
62 | 62 | ||
63 | WeatherPluginWidget::~WeatherPluginWidget() | 63 | WeatherPluginWidget::~WeatherPluginWidget() |
64 | { | 64 | { |
65 | QFile file( localFile ); | 65 | QFile file( localFile ); |
66 | if ( file.exists() ) | 66 | if ( file.exists() ) |
67 | { | 67 | { |
68 | file.remove(); | 68 | file.remove(); |
69 | } | 69 | } |
70 | } | 70 | } |
71 | 71 | ||
72 | void WeatherPluginWidget::timerEvent( QTimerEvent *e ) | 72 | void WeatherPluginWidget::timerEvent( QTimerEvent *e ) |
73 | { | 73 | { |
74 | killTimer( e->timerId() ); | 74 | killTimer( e->timerId() ); |
75 | retreiveData(); | 75 | retreiveData(); |
76 | } | 76 | } |
77 | 77 | ||
78 | 78 | ||
79 | 79 | ||
80 | void WeatherPluginWidget::retreiveData() | 80 | void WeatherPluginWidget::retreiveData() |
81 | { | 81 | { |
82 | Config config( "todayweatherplugin"); | 82 | Config config( "todayweatherplugin"); |
83 | config.setGroup( "Config" ); | 83 | config.setGroup( "Config" ); |
84 | 84 | ||
85 | location = config.readEntry( "Location", "" ); | 85 | location = config.readEntry( "Location", "" ); |
86 | useMetric = config.readBoolEntry( "Metric", TRUE ); | 86 | useMetric = config.readBoolEntry( "Metric", TRUE ); |
87 | frequency = config.readNumEntry( "Frequency", 5 ); | 87 | frequency = config.readNumEntry( "Frequency", 5 ); |
88 | 88 | ||
89 | startTimer( frequency * 60000 ); | 89 | startTimer( frequency * 60000 ); |
90 | 90 | ||
91 | localFile = "/tmp/"; | 91 | localFile = "/tmp/"; |
92 | localFile.append( location ); | 92 | localFile.append( location ); |
93 | localFile.append( ".TXT" ); | 93 | localFile.append( ".TXT" ); |
94 | 94 | ||
95 | remoteFile = "http://weather.noaa.gov/pub/data/observations/metar/stations/"; | 95 | remoteFile = "http://weather.noaa.gov/pub/data/observations/metar/stations/"; |
96 | remoteFile.append( location ); | 96 | remoteFile.append( location ); |
97 | remoteFile.append( ".TXT" ); | 97 | remoteFile.append( ".TXT" ); |
98 | 98 | ||
99 | QFile file( localFile ); | 99 | QFile file( localFile ); |
100 | if ( file.exists() ) | 100 | if ( file.exists() ) |
101 | { | 101 | { |
102 | file.remove(); | 102 | file.remove(); |
103 | } | 103 | } |
104 | 104 | ||
105 | OProcess *proc = new OProcess; | 105 | OProcess *proc = new OProcess; |
106 | 106 | ||
107 | *proc << "wget" << "-q" << remoteFile << "-O" << localFile; | 107 | *proc << "wget" << "-q" << remoteFile << "-O" << localFile; |
108 | connect( proc, SIGNAL( processExited( OProcess * ) ), this, SLOT( dataRetrieved( OProcess * ) ) ); | 108 | connect( proc, SIGNAL( processExited(OProcess*) ), this, SLOT( dataRetrieved(OProcess*) ) ); |
109 | proc->start(); | 109 | proc->start(); |
110 | } | 110 | } |
111 | 111 | ||
112 | void WeatherPluginWidget::displayWeather() | 112 | void WeatherPluginWidget::displayWeather() |
113 | { | 113 | { |
114 | weatherData = QString::null; | 114 | weatherData = QString::null; |
115 | 115 | ||
116 | QFile file( localFile ); | 116 | QFile file( localFile ); |
117 | 117 | ||
118 | if ( file.size() > 0 && file.open( IO_ReadOnly ) ) | 118 | if ( file.size() > 0 && file.open( IO_ReadOnly ) ) |
119 | { | 119 | { |
120 | QTextStream data( &file ); | 120 | QTextStream data( &file ); |
121 | while ( !data.eof() ) | 121 | while ( !data.eof() ) |
122 | { | 122 | { |
123 | weatherData.append( data.readLine() ); | 123 | weatherData.append( data.readLine() ); |
124 | } | 124 | } |
125 | file.close(); | 125 | file.close(); |
126 | weatherData = weatherData.simplifyWhiteSpace(); | 126 | weatherData = weatherData.simplifyWhiteSpace(); |
127 | 127 | ||
128 | QString tmpstr; | 128 | QString tmpstr; |
129 | 129 | ||
130 | tmpstr.append( tr( "Temp: " ) ); | 130 | tmpstr.append( tr( "Temp: " ) ); |
131 | getTemp( weatherData ); | 131 | getTemp( weatherData ); |
132 | tmpstr.append( dataStr ); | 132 | tmpstr.append( dataStr ); |
133 | 133 | ||
134 | tmpstr.append( tr( " Wind: " ) ); | 134 | tmpstr.append( tr( " Wind: " ) ); |
135 | getWind( weatherData ); | 135 | getWind( weatherData ); |
136 | tmpstr.append( dataStr ); | 136 | tmpstr.append( dataStr ); |
137 | 137 | ||
138 | tmpstr.append( tr( "\nPres: " ) ); | 138 | tmpstr.append( tr( "\nPres: " ) ); |
139 | getPressure( weatherData ); | 139 | getPressure( weatherData ); |
140 | tmpstr.append( dataStr ); | 140 | tmpstr.append( dataStr ); |
141 | 141 | ||
142 | weatherLabel->setText( tmpstr ); | 142 | weatherLabel->setText( tmpstr ); |
143 | 143 | ||
144 | tmpstr = "todayweatherplugin/"; | 144 | tmpstr = "todayweatherplugin/"; |
145 | getIcon( weatherData ); | 145 | getIcon( weatherData ); |
146 | tmpstr.append( dataStr ); | 146 | tmpstr.append( dataStr ); |
147 | QImage logo1 = Resource::loadImage( tmpstr ); | 147 | QImage logo1 = Resource::loadImage( tmpstr ); |
148 | QPixmap pic; | 148 | QPixmap pic; |
149 | pic.convertFromImage( logo1 ); | 149 | pic.convertFromImage( logo1 ); |
150 | weatherIcon->setPixmap( pic ); | 150 | weatherIcon->setPixmap( pic ); |
151 | } | 151 | } |
152 | else | 152 | else |
153 | { | 153 | { |
154 | weatherLabel->setText( tr( "Current weather data not available." ) ); | 154 | weatherLabel->setText( tr( "Current weather data not available." ) ); |
155 | } | 155 | } |
156 | } | 156 | } |