author | mickeyl <mickeyl> | 2003-10-29 16:51:56 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-10-29 16:51:56 (UTC) |
commit | f254437deda45d7cccf2ba3c27c5fe934af1fca7 (patch) (unidiff) | |
tree | 0442cbcf4c32353d76a03f932706343b402229a9 | |
parent | e8697a4281f7a265b69e6bf5253383c73a38626b (diff) | |
download | opie-f254437deda45d7cccf2ba3c27c5fe934af1fca7.zip opie-f254437deda45d7cccf2ba3c27c5fe934af1fca7.tar.gz opie-f254437deda45d7cccf2ba3c27c5fe934af1fca7.tar.bz2 |
merge noncore/todayplugins/*
-rw-r--r-- | noncore/todayplugins/stockticker/stockticker/helpwindow.cpp | 1 | ||||
-rw-r--r-- | noncore/todayplugins/weather/weatherpluginwidget.cpp | 2 |
2 files changed, 1 insertions, 2 deletions
diff --git a/noncore/todayplugins/stockticker/stockticker/helpwindow.cpp b/noncore/todayplugins/stockticker/stockticker/helpwindow.cpp index 23e78f2..2274402 100644 --- a/noncore/todayplugins/stockticker/stockticker/helpwindow.cpp +++ b/noncore/todayplugins/stockticker/stockticker/helpwindow.cpp | |||
@@ -1,268 +1,267 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | ||
3 | ** | 2 | ** |
4 | ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. | 3 | ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. |
5 | ** | 4 | ** |
6 | ** 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 |
7 | ** program may be used, distributed and modified without limitation. | 6 | ** program may be used, distributed and modified without limitation. |
8 | ** | 7 | ** |
9 | *****************************************************************************/ | 8 | *****************************************************************************/ |
10 | 9 | ||
11 | #include "helpwindow.h" | 10 | #include "helpwindow.h" |
12 | #include <qstatusbar.h> | 11 | #include <qstatusbar.h> |
13 | 12 | ||
14 | #include <qmenubar.h> | 13 | #include <qmenubar.h> |
15 | #include <qtoolbar.h> | 14 | #include <qtoolbar.h> |
16 | #include <qtoolbutton.h> | 15 | #include <qtoolbutton.h> |
17 | #include <qcombobox.h> | 16 | #include <qcombobox.h> |
18 | 17 | ||
19 | #include <ctype.h> | 18 | #include <ctype.h> |
20 | 19 | ||
21 | 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 ) |
22 | : QMainWindow( parent, name, WDestructiveClose ), pathCombo( 0 ), selectedURL() | 21 | : QMainWindow( parent, name, WDestructiveClose ), pathCombo( 0 ), selectedURL() |
23 | { | 22 | { |
24 | readHistory(); | 23 | readHistory(); |
25 | readBookmarks(); | 24 | readBookmarks(); |
26 | 25 | ||
27 | browser = new QTextBrowser( this ); | 26 | browser = new QTextBrowser( this ); |
28 | QStringList Strlist; | 27 | QStringList Strlist; |
29 | Strlist.append( home_); | 28 | Strlist.append( home_); |
30 | 29 | ||
31 | browser->mimeSourceFactory()->setFilePath( Strlist ); | 30 | browser->mimeSourceFactory()->setFilePath( Strlist ); |
32 | 31 | ||
33 | browser->setFrameStyle( QFrame::Panel | QFrame::Sunken ); | 32 | browser->setFrameStyle( QFrame::Panel | QFrame::Sunken ); |
34 | 33 | ||
35 | connect( browser, SIGNAL( textChanged() ), | 34 | connect( browser, SIGNAL( textChanged() ), |
36 | 35 | ||
37 | this, SLOT( textChanged() ) ); | 36 | this, SLOT( textChanged() ) ); |
38 | 37 | ||
39 | setCentralWidget( browser ); | 38 | setCentralWidget( browser ); |
40 | 39 | ||
41 | if ( !home_.isEmpty() ) | 40 | if ( !home_.isEmpty() ) |
42 | 41 | ||
43 | //////////////////////////////// | 42 | //////////////////////////////// |
44 | browser->setSource( home_ ); | 43 | browser->setSource( home_ ); |
45 | 44 | ||
46 | //////////////////////////////// | 45 | //////////////////////////////// |
47 | connect( browser, SIGNAL( highlighted( const QString&) ), | 46 | connect( browser, SIGNAL( highlighted( const QString&) ), |
48 | statusBar(), SLOT( message( const QString&)) ); | 47 | statusBar(), SLOT( message( const QString&)) ); |
49 | 48 | ||
50 | setGeometry( 0,0,236,280); | 49 | setGeometry( 0,0,236,280); |
51 | 50 | ||
52 | QPopupMenu* file = new QPopupMenu( this ); | 51 | QPopupMenu* file = new QPopupMenu( this ); |
53 | // file->insertItem( tr("&New Window"), this, SLOT( newWindow() ), ALT | Key_N ); | 52 | // file->insertItem( tr("&New Window"), this, SLOT( newWindow() ), ALT | Key_N ); |
54 | file->insertItem( tr("&Open File"), this, SLOT( openFile() ), ALT | Key_O ); | 53 | file->insertItem( tr("&Open File"), this, SLOT( openFile() ), ALT | Key_O ); |
55 | // file->insertItem( tr("&Print"), this, SLOT( print() ), ALT | Key_P ); | 54 | // file->insertItem( tr("&Print"), this, SLOT( print() ), ALT | Key_P ); |
56 | file->insertSeparator(); | 55 | file->insertSeparator(); |
57 | file->insertItem( tr("&Close"), this, SLOT( close() ), ALT | Key_Q ); | 56 | file->insertItem( tr("&Close"), this, SLOT( close() ), ALT | Key_Q ); |
58 | // file->insertItem( tr("E&xit"), qApp, SLOT( closeAllWindows() ), ALT | Key_X ); | 57 | // file->insertItem( tr("E&xit"), qApp, SLOT( closeAllWindows() ), ALT | Key_X ); |
59 | 58 | ||
60 | // The same three icons are used twice each. | 59 | // The same three icons are used twice each. |
61 | ////F FIXME | 60 | ////F FIXME |
62 | QString pixs=(QDir::homeDirPath ()) +"/Applications/gutenbrowser/pix/"; | 61 | QString pixs=(QDir::homeDirPath ()) +"/Applications/gutenbrowser/pix/"; |
63 | QIconSet icon_back( QPixmap(pixs+"back.png") ); | 62 | QIconSet icon_back( QPixmap(pixs+"back.png") ); |
64 | QIconSet icon_forward( QPixmap(pixs+"forward.png") ); | 63 | QIconSet icon_forward( QPixmap(pixs+"forward.png") ); |
65 | QIconSet icon_home( QPixmap(pixs+"home.png") ); | 64 | QIconSet icon_home( QPixmap(pixs+"home.png") ); |
66 | 65 | ||
67 | QPopupMenu* go = new QPopupMenu( this ); | 66 | QPopupMenu* go = new QPopupMenu( this ); |
68 | 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 ); |
69 | 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 ); |
70 | go->insertItem( icon_home, tr("&Home"), browser, SLOT( home() ) ); | 69 | go->insertItem( icon_home, tr("&Home"), browser, SLOT( home() ) ); |
71 | 70 | ||
72 | 71 | ||
73 | hist = new QPopupMenu( this ); | 72 | hist = new QPopupMenu( this ); |
74 | QStringList::Iterator it = history.begin(); | 73 | QStringList::Iterator it = history.begin(); |
75 | for ( ; it != history.end(); ++it ) | 74 | for ( ; it != history.end(); ++it ) |
76 | mHistory[ hist->insertItem( *it ) ] = *it; | 75 | mHistory[ hist->insertItem( *it ) ] = *it; |
77 | connect( hist, SIGNAL( activated( int ) ), this, SLOT( histChosen( int ) ) ); | 76 | connect( hist, SIGNAL( activated( int ) ), this, SLOT( histChosen( int ) ) ); |
78 | 77 | ||
79 | bookm = new QPopupMenu( this ); | 78 | bookm = new QPopupMenu( this ); |
80 | bookm->insertItem( tr( "Add Bookmark" ), this, SLOT( addBookmark() ) ); | 79 | bookm->insertItem( tr( "Add Bookmark" ), this, SLOT( addBookmark() ) ); |
81 | bookm->insertSeparator(); | 80 | bookm->insertSeparator(); |
82 | 81 | ||
83 | QStringList::Iterator it2 = bookmarks.begin(); | 82 | QStringList::Iterator it2 = bookmarks.begin(); |
84 | for ( ; it2 != bookmarks.end(); ++it2 ) | 83 | for ( ; it2 != bookmarks.end(); ++it2 ) |
85 | mBookmarks[ bookm->insertItem( *it2 ) ] = *it2; | 84 | mBookmarks[ bookm->insertItem( *it2 ) ] = *it2; |
86 | connect( bookm, SIGNAL( activated( int ) ), | 85 | connect( bookm, SIGNAL( activated( int ) ), |
87 | this, SLOT( bookmChosen( int ) ) ); | 86 | this, SLOT( bookmChosen( int ) ) ); |
88 | 87 | ||
89 | menuBar()->insertItem( tr("&File"), file ); | 88 | menuBar()->insertItem( tr("&File"), file ); |
90 | menuBar()->insertItem( tr("&Go"), go ); | 89 | menuBar()->insertItem( tr("&Go"), go ); |
91 | menuBar()->insertItem( tr( "History" ), hist ); | 90 | menuBar()->insertItem( tr( "History" ), hist ); |
92 | menuBar()->insertItem( tr( "Bookmarks" ), bookm ); | 91 | menuBar()->insertItem( tr( "Bookmarks" ), bookm ); |
93 | // menuBar()->insertSeparator(); | 92 | // menuBar()->insertSeparator(); |
94 | // menuBar()->insertItem( tr("&Help"), help ); | 93 | // menuBar()->insertItem( tr("&Help"), help ); |
95 | 94 | ||
96 | menuBar()->setItemEnabled( forwardId, FALSE); | 95 | menuBar()->setItemEnabled( forwardId, FALSE); |
97 | menuBar()->setItemEnabled( backwardId, FALSE); | 96 | menuBar()->setItemEnabled( backwardId, FALSE); |
98 | connect( browser, SIGNAL( backwardAvailable( bool ) ), this, SLOT( setBackwardAvailable( bool ) ) ); | 97 | connect( browser, SIGNAL( backwardAvailable( bool ) ), this, SLOT( setBackwardAvailable( bool ) ) ); |
99 | connect( browser, SIGNAL( forwardAvailable( bool ) ), this, SLOT( setForwardAvailable( bool ) ) ); | 98 | connect( browser, SIGNAL( forwardAvailable( bool ) ), this, SLOT( setForwardAvailable( bool ) ) ); |
100 | 99 | ||
101 | 100 | ||
102 | QToolBar* toolbar = new QToolBar( this ); | 101 | QToolBar* toolbar = new QToolBar( this ); |
103 | addToolBar( toolbar, "Toolbar"); | 102 | addToolBar( toolbar, "Toolbar"); |
104 | QToolButton* button; | 103 | QToolButton* button; |
105 | 104 | ||
106 | button = new QToolButton( icon_back, tr("Backward"), "", browser, SLOT(backward()), toolbar ); | 105 | button = new QToolButton( icon_back, tr("Backward"), "", browser, SLOT(backward()), toolbar ); |
107 | connect( browser, SIGNAL( backwardAvailable(bool) ), button, SLOT( setEnabled(bool) ) ); | 106 | connect( browser, SIGNAL( backwardAvailable(bool) ), button, SLOT( setEnabled(bool) ) ); |
108 | button->setEnabled( FALSE ); | 107 | button->setEnabled( FALSE ); |
109 | button = new QToolButton( icon_forward, tr("Forward"), "", browser, SLOT(forward()), toolbar ); | 108 | button = new QToolButton( icon_forward, tr("Forward"), "", browser, SLOT(forward()), toolbar ); |
110 | connect( browser, SIGNAL( forwardAvailable(bool) ), button, SLOT( setEnabled(bool) ) ); | 109 | connect( browser, SIGNAL( forwardAvailable(bool) ), button, SLOT( setEnabled(bool) ) ); |
111 | button->setEnabled( FALSE ); | 110 | button->setEnabled( FALSE ); |
112 | button = new QToolButton( icon_home, tr("Home"), "", browser, SLOT(home()), toolbar ); | 111 | button = new QToolButton( icon_home, tr("Home"), "", browser, SLOT(home()), toolbar ); |
113 | 112 | ||
114 | toolbar->addSeparator(); | 113 | toolbar->addSeparator(); |
115 | 114 | ||
116 | pathCombo = new QComboBox( TRUE, toolbar ); | 115 | pathCombo = new QComboBox( TRUE, toolbar ); |
117 | connect( pathCombo, SIGNAL( activated( const QString & ) ), this, SLOT( pathSelected( const QString & ) ) ); | 116 | connect( pathCombo, SIGNAL( activated( const QString & ) ), this, SLOT( pathSelected( const QString & ) ) ); |
118 | toolbar->setStretchableWidget( pathCombo ); | 117 | toolbar->setStretchableWidget( pathCombo ); |
119 | 118 | ||
120 | // pathCombo->setMaximumWidth(190); | 119 | // pathCombo->setMaximumWidth(190); |
121 | // setRightJustification( TRUE ); | 120 | // setRightJustification( TRUE ); |
122 | // setDockEnabled( Left, FALSE ); | 121 | // setDockEnabled( Left, FALSE ); |
123 | // setDockEnabled( Right, FALSE ); | 122 | // setDockEnabled( Right, FALSE ); |
124 | 123 | ||
125 | pathCombo->insertItem( home_ ); | 124 | pathCombo->insertItem( home_ ); |
126 | 125 | ||
127 | browser->setFocus(); | 126 | browser->setFocus(); |
128 | 127 | ||
129 | 128 | ||
130 | } | 129 | } |
131 | 130 | ||
132 | 131 | ||
133 | void HelpWindow::setBackwardAvailable( bool b) | 132 | void HelpWindow::setBackwardAvailable( bool b) |
134 | { | 133 | { |
135 | menuBar()->setItemEnabled( backwardId, b); | 134 | menuBar()->setItemEnabled( backwardId, b); |
136 | } | 135 | } |
137 | 136 | ||
138 | void HelpWindow::setForwardAvailable( bool b) | 137 | void HelpWindow::setForwardAvailable( bool b) |
139 | { | 138 | { |
140 | menuBar()->setItemEnabled( forwardId, b); | 139 | menuBar()->setItemEnabled( forwardId, b); |
141 | } | 140 | } |
142 | 141 | ||
143 | 142 | ||
144 | void HelpWindow::textChanged() | 143 | void HelpWindow::textChanged() |
145 | { | 144 | { |
146 | if ( browser->documentTitle().isNull() ) { | 145 | if ( browser->documentTitle().isNull() ) { |
147 | setCaption( "Stockticker Lookup - " + browser->context() ); | 146 | setCaption( "Stockticker Lookup - " + browser->context() ); |
148 | selectedURL = browser->context(); | 147 | selectedURL = browser->context(); |
149 | } | 148 | } |
150 | else { | 149 | else { |
151 | setCaption( "Stockticker Lookup - " + browser->documentTitle() ) ; | 150 | setCaption( "Stockticker Lookup - " + browser->documentTitle() ) ; |
152 | selectedURL = browser->documentTitle(); | 151 | selectedURL = browser->documentTitle(); |
153 | } | 152 | } |
154 | 153 | ||
155 | if ( !selectedURL.isEmpty() && pathCombo ) { | 154 | if ( !selectedURL.isEmpty() && pathCombo ) { |
156 | bool exists = FALSE; | 155 | bool exists = FALSE; |
157 | int i; | 156 | int i; |
158 | for ( i = 0; i < pathCombo->count(); ++i ) { | 157 | for ( i = 0; i < pathCombo->count(); ++i ) { |
159 | if ( pathCombo->text( i ) == selectedURL ) { | 158 | if ( pathCombo->text( i ) == selectedURL ) { |
160 | exists = TRUE; | 159 | exists = TRUE; |
161 | break; | 160 | break; |
162 | } | 161 | } |
163 | } | 162 | } |
164 | if ( !exists ) { | 163 | if ( !exists ) { |
165 | pathCombo->insertItem( selectedURL, 0 ); | 164 | pathCombo->insertItem( selectedURL, 0 ); |
166 | pathCombo->setCurrentItem( 0 ); | 165 | pathCombo->setCurrentItem( 0 ); |
167 | mHistory[ hist->insertItem( selectedURL ) ] = selectedURL; | 166 | mHistory[ hist->insertItem( selectedURL ) ] = selectedURL; |
168 | } else | 167 | } else |
169 | pathCombo->setCurrentItem( i ); | 168 | pathCombo->setCurrentItem( i ); |
170 | selectedURL = QString::null; | 169 | selectedURL = QString::null; |
171 | } | 170 | } |
172 | } | 171 | } |
173 | 172 | ||
174 | HelpWindow::~HelpWindow() | 173 | HelpWindow::~HelpWindow() |
175 | { | 174 | { |
176 | history.clear(); | 175 | history.clear(); |
177 | QMap<int, QString>::Iterator it = mHistory.begin(); | 176 | QMap<int, QString>::Iterator it = mHistory.begin(); |
178 | for ( ; it != mHistory.end(); ++it ) | 177 | for ( ; it != mHistory.end(); ++it ) |
179 | history.append( *it ); | 178 | history.append( *it ); |
180 | 179 | ||
181 | QFile f( QDir::currentDirPath() + "/.history" ); | 180 | QFile f( QDir::currentDirPath() + "/.history" ); |
182 | f.open( IO_WriteOnly ); | 181 | f.open( IO_WriteOnly ); |
183 | QDataStream s( &f ); | 182 | QDataStream s( &f ); |
184 | s << history; | 183 | s << history; |
185 | f.close(); | 184 | f.close(); |
186 | 185 | ||
187 | bookmarks.clear(); | 186 | bookmarks.clear(); |
188 | QMap<int, QString>::Iterator it2 = mBookmarks.begin(); | 187 | QMap<int, QString>::Iterator it2 = mBookmarks.begin(); |
189 | for ( ; it2 != mBookmarks.end(); ++it2 ) | 188 | for ( ; it2 != mBookmarks.end(); ++it2 ) |
190 | bookmarks.append( *it2 ); | 189 | bookmarks.append( *it2 ); |
191 | 190 | ||
192 | QFile f2( QDir::currentDirPath() + "/.bookmarks" ); | 191 | QFile f2( QDir::currentDirPath() + "/.bookmarks" ); |
193 | f2.open( IO_WriteOnly ); | 192 | f2.open( IO_WriteOnly ); |
194 | QDataStream s2( &f2 ); | 193 | QDataStream s2( &f2 ); |
195 | s2 << bookmarks; | 194 | s2 << bookmarks; |
196 | f2.close(); | 195 | f2.close(); |
197 | } | 196 | } |
198 | 197 | ||
199 | void HelpWindow::openFile() | 198 | void HelpWindow::openFile() |
200 | { | 199 | { |
201 | #ifndef QT_NO_FILEDIALOG | 200 | #ifndef QT_NO_FILEDIALOG |
202 | QString fn = QFileDialog::getOpenFileName( QString::null, QString::null, this ); | 201 | QString fn = QFileDialog::getOpenFileName( QString::null, QString::null, this ); |
203 | if ( !fn.isEmpty() ) | 202 | if ( !fn.isEmpty() ) |
204 | browser->setSource( fn ); | 203 | browser->setSource( fn ); |
205 | #endif | 204 | #endif |
206 | } | 205 | } |
207 | 206 | ||
208 | void HelpWindow::newWindow() | 207 | void HelpWindow::newWindow() |
209 | { | 208 | { |
210 | ( new HelpWindow(browser->source(), "qbrowser") )->show(); | 209 | ( new HelpWindow(browser->source(), "qbrowser") )->show(); |
211 | } | 210 | } |
212 | 211 | ||
213 | void HelpWindow::pathSelected( const QString &_path ) | 212 | void HelpWindow::pathSelected( const QString &_path ) |
214 | { | 213 | { |
215 | browser->setSource( _path ); | 214 | browser->setSource( _path ); |
216 | QMap<int, QString>::Iterator it = mHistory.begin(); | 215 | QMap<int, QString>::Iterator it = mHistory.begin(); |
217 | bool exists = FALSE; | 216 | bool exists = FALSE; |
218 | for ( ; it != mHistory.end(); ++it ) { | 217 | for ( ; it != mHistory.end(); ++it ) { |
219 | if ( *it == _path ) { | 218 | if ( *it == _path ) { |
220 | exists = TRUE; | 219 | exists = TRUE; |
221 | break; | 220 | break; |
222 | } | 221 | } |
223 | } | 222 | } |
224 | if ( !exists ) | 223 | if ( !exists ) |
225 | mHistory[ hist->insertItem( _path ) ] = _path; | 224 | mHistory[ hist->insertItem( _path ) ] = _path; |
226 | } | 225 | } |
227 | 226 | ||
228 | void HelpWindow::readHistory() | 227 | void HelpWindow::readHistory() |
229 | { | 228 | { |
230 | if ( QFile::exists( QDir::currentDirPath() + "/.history" ) ) { | 229 | if ( QFile::exists( QDir::currentDirPath() + "/.history" ) ) { |
231 | QFile f( QDir::currentDirPath() + "/.history" ); | 230 | QFile f( QDir::currentDirPath() + "/.history" ); |
232 | f.open( IO_ReadOnly ); | 231 | f.open( IO_ReadOnly ); |
233 | QDataStream s( &f ); | 232 | QDataStream s( &f ); |
234 | s >> history; | 233 | s >> history; |
235 | f.close(); | 234 | f.close(); |
236 | while ( history.count() > 20 ) | 235 | while ( history.count() > 20 ) |
237 | history.remove( history.begin() ); | 236 | history.remove( history.begin() ); |
238 | } | 237 | } |
239 | } | 238 | } |
240 | 239 | ||
241 | void HelpWindow::readBookmarks() | 240 | void HelpWindow::readBookmarks() |
242 | { | 241 | { |
243 | if ( QFile::exists( QDir::currentDirPath() + "/.bookmarks" ) ) { | 242 | if ( QFile::exists( QDir::currentDirPath() + "/.bookmarks" ) ) { |
244 | QFile f( QDir::currentDirPath() + "/.bookmarks" ); | 243 | QFile f( QDir::currentDirPath() + "/.bookmarks" ); |
245 | f.open( IO_ReadOnly ); | 244 | f.open( IO_ReadOnly ); |
246 | QDataStream s( &f ); | 245 | QDataStream s( &f ); |
247 | s >> bookmarks; | 246 | s >> bookmarks; |
248 | f.close(); | 247 | f.close(); |
249 | } | 248 | } |
250 | } | 249 | } |
251 | 250 | ||
252 | void HelpWindow::histChosen( int i ) | 251 | void HelpWindow::histChosen( int i ) |
253 | { | 252 | { |
254 | if ( mHistory.contains( i ) ) | 253 | if ( mHistory.contains( i ) ) |
255 | browser->setSource( mHistory[ i ] ); | 254 | browser->setSource( mHistory[ i ] ); |
256 | } | 255 | } |
257 | 256 | ||
258 | void HelpWindow::bookmChosen( int i ) | 257 | void HelpWindow::bookmChosen( int i ) |
259 | { | 258 | { |
260 | if ( mBookmarks.contains( i ) ) | 259 | if ( mBookmarks.contains( i ) ) |
261 | browser->setSource( mBookmarks[ i ] ); | 260 | browser->setSource( mBookmarks[ i ] ); |
262 | } | 261 | } |
263 | 262 | ||
264 | void HelpWindow::addBookmark() | 263 | void HelpWindow::addBookmark() |
265 | { | 264 | { |
266 | mBookmarks[ bookm->insertItem( caption() ) ] = caption(); | 265 | mBookmarks[ bookm->insertItem( caption() ) ] = caption(); |
267 | } | 266 | } |
268 | 267 | ||
diff --git a/noncore/todayplugins/weather/weatherpluginwidget.cpp b/noncore/todayplugins/weather/weatherpluginwidget.cpp index 800fdcb..8440f20 100644 --- a/noncore/todayplugins/weather/weatherpluginwidget.cpp +++ b/noncore/todayplugins/weather/weatherpluginwidget.cpp | |||
@@ -1,325 +1,325 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the OPIE Project | 2 | This file is part of the OPIE Project |
3 | =. | 3 | =. |
4 | .=l. Copyright (c) 2002 Dan Williams <williamsdr@acm.org> | 4 | .=l. Copyright (c) 2002 Dan Williams <williamsdr@acm.org> |
5 | .>+-= | 5 | .>+-= |
6 | _;:, .> :=|. This file is free software; you can | 6 | _;:, .> :=|. This file is free software; you can |
7 | .> <`_, > . <= redistribute it and/or modify it under | 7 | .> <`_, > . <= redistribute it and/or modify it under |
8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
9 | .="- .-=="i, .._ License as published by the Free Software | 9 | .="- .-=="i, .._ License as published by the Free Software |
10 | - . .-<_> .<> Foundation; either version 2 of the License, | 10 | - . .-<_> .<> Foundation; either version 2 of the License, |
11 | ._= =} : or (at your option) any later version. | 11 | ._= =} : or (at your option) any later version. |
12 | .%`+i> _;_. | 12 | .%`+i> _;_. |
13 | .i_,=:_. -<s. This file is distributed in the hope that | 13 | .i_,=:_. -<s. This file is distributed in the hope that |
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
15 | : .. .:, . . . without even the implied warranty of | 15 | : .. .:, . . . without even the implied warranty of |
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | 17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
18 | ..}^=.= = ; Public License for more details. | 18 | ..}^=.= = ; Public License for more details. |
19 | ++= -. .` .: | 19 | ++= -. .` .: |
20 | : = ...= . :.=- You should have received a copy of the GNU | 20 | : = ...= . :.=- You should have received a copy of the GNU |
21 | -. .:....=;==+<; General Public License along with this file; | 21 | -. .:....=;==+<; General Public License along with this file; |
22 | -_. . . )=. = see the file COPYING. If not, write to the | 22 | -_. . . )=. = see the file COPYING. If not, write to the |
23 | -- :-=` Free Software Foundation, Inc., | 23 | -- :-=` Free Software Foundation, Inc., |
24 | 59 Temple Place - Suite 330, | 24 | 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include <qfile.h> | 29 | #include <qfile.h> |
30 | #include <qimage.h> | 30 | #include <qimage.h> |
31 | #include <qlabel.h> | 31 | #include <qlabel.h> |
32 | #include <qlayout.h> | 32 | #include <qlayout.h> |
33 | #include <qpixmap.h> | 33 | #include <qpixmap.h> |
34 | #include <qtextstream.h> | 34 | #include <qtextstream.h> |
35 | 35 | ||
36 | #include <opie/oprocess.h> | 36 | #include <opie/oprocess.h> |
37 | 37 | ||
38 | #include <qpe/config.h> | 38 | #include <qpe/config.h> |
39 | #include <qpe/resource.h> | 39 | #include <qpe/resource.h> |
40 | 40 | ||
41 | #include "weatherpluginwidget.h" | 41 | #include "weatherpluginwidget.h" |
42 | 42 | ||
43 | WeatherPluginWidget::WeatherPluginWidget( QWidget *parent, const char* name ) | 43 | WeatherPluginWidget::WeatherPluginWidget( QWidget *parent, const char* name ) |
44 | : QWidget( parent, name ) | 44 | : QWidget( parent, name ) |
45 | { | 45 | { |
46 | QHBoxLayout *layout = new QHBoxLayout( this ); | 46 | QHBoxLayout *layout = new QHBoxLayout( this ); |
47 | layout->setAutoAdd( TRUE ); | 47 | layout->setAutoAdd( TRUE ); |
48 | layout->setSpacing( 2 ); | 48 | layout->setSpacing( 2 ); |
49 | 49 | ||
50 | weatherIcon = new QLabel( this ); | 50 | weatherIcon = new QLabel( this ); |
51 | weatherIcon->setMaximumWidth( 32 ); | 51 | weatherIcon->setMaximumWidth( 32 ); |
52 | QImage logo1 = Resource::loadImage( "todayweatherplugin/wait" ); | 52 | QImage logo1 = Resource::loadImage( "Clock" ); |
53 | QPixmap pic; | 53 | QPixmap pic; |
54 | pic.convertFromImage( logo1 ); | 54 | pic.convertFromImage( logo1 ); |
55 | weatherIcon->setPixmap( pic ); | 55 | weatherIcon->setPixmap( pic ); |
56 | 56 | ||
57 | weatherLabel = new QLabel( tr( "Retreiving current weather information." ), this ); | 57 | weatherLabel = new QLabel( tr( "Retreiving current weather information." ), this ); |
58 | weatherLabel->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred ) ); | 58 | weatherLabel->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred ) ); |
59 | 59 | ||
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 | } |
157 | 157 | ||
158 | void WeatherPluginWidget::getTemp( const QString &data ) | 158 | void WeatherPluginWidget::getTemp( const QString &data ) |
159 | { | 159 | { |
160 | int value; | 160 | int value; |
161 | bool ok; | 161 | bool ok; |
162 | 162 | ||
163 | int pos = data.find( QRegExp( "M?[0-9]+/M?[0-9]+" ), 20 ); | 163 | int pos = data.find( QRegExp( "M?[0-9]+/M?[0-9]+" ), 20 ); |
164 | if ( pos > -1 ) | 164 | if ( pos > -1 ) |
165 | { | 165 | { |
166 | if ( data.at( pos ) == 'M' ) | 166 | if ( data.at( pos ) == 'M' ) |
167 | { | 167 | { |
168 | value = -1 * data.mid( pos + 1, 2 ).toInt( &ok ); | 168 | value = -1 * data.mid( pos + 1, 2 ).toInt( &ok ); |
169 | } | 169 | } |
170 | else | 170 | else |
171 | { | 171 | { |
172 | value = data.mid( pos, 2 ).toInt( &ok ); | 172 | value = data.mid( pos, 2 ).toInt( &ok ); |
173 | } | 173 | } |
174 | if ( useMetric ) | 174 | if ( useMetric ) |
175 | { | 175 | { |
176 | dataStr = QString::number( value ); | 176 | dataStr = QString::number( value ); |
177 | dataStr.append( 'C' ); | 177 | dataStr.append( 'C' ); |
178 | } | 178 | } |
179 | else | 179 | else |
180 | { | 180 | { |
181 | dataStr = QString::number( ( value * 9 / 5 ) + 32 ); | 181 | dataStr = QString::number( ( value * 9 / 5 ) + 32 ); |
182 | dataStr.append( 'F' ); | 182 | dataStr.append( 'F' ); |
183 | } | 183 | } |
184 | } | 184 | } |
185 | else | 185 | else |
186 | { | 186 | { |
187 | dataStr = tr( "n/a" ); | 187 | dataStr = tr( "n/a" ); |
188 | } | 188 | } |
189 | } | 189 | } |
190 | 190 | ||
191 | void WeatherPluginWidget::getWind( const QString &data ) | 191 | void WeatherPluginWidget::getWind( const QString &data ) |
192 | { | 192 | { |
193 | int value; | 193 | int value; |
194 | bool ok; | 194 | bool ok; |
195 | 195 | ||
196 | int pos = data.find( QRegExp( "[0-9]*G*[0-9]*KT" ), 20 ); | 196 | int pos = data.find( QRegExp( "[0-9]*G*[0-9]*KT" ), 20 ); |
197 | if ( pos > -1 ) | 197 | if ( pos > -1 ) |
198 | { | 198 | { |
199 | if ( data.mid( pos, 3 ) != "VRB" ) | 199 | if ( data.mid( pos, 3 ) != "VRB" ) |
200 | { | 200 | { |
201 | value = data.mid( pos, 3 ).toInt( &ok ); | 201 | value = data.mid( pos, 3 ).toInt( &ok ); |
202 | if ( ( value >= 0 && value < 23 ) || ( value >= 239 && value <= 360 ) ) | 202 | if ( ( value >= 0 && value < 23 ) || ( value >= 239 && value <= 360 ) ) |
203 | dataStr = tr("E " ); | 203 | dataStr = tr("E " ); |
204 | else if ( value >= 23 && value < 69 ) | 204 | else if ( value >= 23 && value < 69 ) |
205 | dataStr = tr( "NE " ); | 205 | dataStr = tr( "NE " ); |
206 | else if ( value >= 69 && value < 113 ) | 206 | else if ( value >= 69 && value < 113 ) |
207 | dataStr = tr( "N " ); | 207 | dataStr = tr( "N " ); |
208 | else if ( value >= 113 && value < 157 ) | 208 | else if ( value >= 113 && value < 157 ) |
209 | dataStr = tr( "NW " ); | 209 | dataStr = tr( "NW " ); |
210 | else if ( value >= 157 && value < 203 ) | 210 | else if ( value >= 157 && value < 203 ) |
211 | dataStr = tr( "W " ); | 211 | dataStr = tr( "W " ); |
212 | else if ( value >= 203 && value < 248 ) | 212 | else if ( value >= 203 && value < 248 ) |
213 | dataStr = tr( "SW " ); | 213 | dataStr = tr( "SW " ); |
214 | else if ( value >= 248 && value < 294 ) | 214 | else if ( value >= 248 && value < 294 ) |
215 | dataStr = tr( "S " ); | 215 | dataStr = tr( "S " ); |
216 | else if ( value >= 294 && value < 238 ) | 216 | else if ( value >= 294 && value < 238 ) |
217 | dataStr = tr( "SE " ); | 217 | dataStr = tr( "SE " ); |
218 | } | 218 | } |
219 | if ( data.mid( pos + 5, 1) == "G" || | 219 | if ( data.mid( pos + 5, 1) == "G" || |
220 | data.mid( pos + 5, 1) == "K" ) | 220 | data.mid( pos + 5, 1) == "K" ) |
221 | { | 221 | { |
222 | value = data.mid( pos + 3, 2 ).toInt( &ok ); | 222 | value = data.mid( pos + 3, 2 ).toInt( &ok ); |
223 | } | 223 | } |
224 | else | 224 | else |
225 | { | 225 | { |
226 | value = data.mid( pos + 3, 3 ).toInt( &ok ); | 226 | value = data.mid( pos + 3, 3 ).toInt( &ok ); |
227 | } | 227 | } |
228 | if ( useMetric ) | 228 | if ( useMetric ) |
229 | { | 229 | { |
230 | value = value * 3.6 / 1.94; | 230 | value = value * 3.6 / 1.94; |
231 | dataStr.append( QString::number( value ) ); | 231 | dataStr.append( QString::number( value ) ); |
232 | dataStr.append( tr( " KPH" ) ); | 232 | dataStr.append( tr( " KPH" ) ); |
233 | } | 233 | } |
234 | else | 234 | else |
235 | { | 235 | { |
236 | value = value * 2.24 / 1.94; | 236 | value = value * 2.24 / 1.94; |
237 | dataStr.append( QString::number( value ) ); | 237 | dataStr.append( QString::number( value ) ); |
238 | dataStr.append( tr( " MPH" ) ); | 238 | dataStr.append( tr( " MPH" ) ); |
239 | } | 239 | } |
240 | } | 240 | } |
241 | else | 241 | else |
242 | { | 242 | { |
243 | dataStr = tr( "n/a" ); | 243 | dataStr = tr( "n/a" ); |
244 | } | 244 | } |
245 | } | 245 | } |
246 | 246 | ||
247 | void WeatherPluginWidget::getPressure( const QString &data ) | 247 | void WeatherPluginWidget::getPressure( const QString &data ) |
248 | { | 248 | { |
249 | float value; | 249 | float value; |
250 | bool ok; | 250 | bool ok; |
251 | 251 | ||
252 | int pos = data.find( QRegExp( "[AQ][0-9]+" ), 20 ); | 252 | int pos = data.find( QRegExp( "[AQ][0-9]+" ), 20 ); |
253 | if ( pos > -1 ) | 253 | if ( pos > -1 ) |
254 | { | 254 | { |
255 | value = data.mid( pos + 1, 4 ).toFloat( &ok ); | 255 | value = data.mid( pos + 1, 4 ).toFloat( &ok ); |
256 | if ( useMetric ) | 256 | if ( useMetric ) |
257 | { | 257 | { |
258 | if ( data.mid( pos, 1 ) == "A" ) | 258 | if ( data.mid( pos, 1 ) == "A" ) |
259 | value *= 33.8639 / 100; | 259 | value *= 33.8639 / 100; |
260 | dataStr = QString::number( value, 'f', 2 ); | 260 | dataStr = QString::number( value, 'f', 2 ); |
261 | dataStr.append( tr( " hPa" ) ); | 261 | dataStr.append( tr( " hPa" ) ); |
262 | } | 262 | } |
263 | else | 263 | else |
264 | { | 264 | { |
265 | if ( data.mid( pos, 1 ) == "Q" ) | 265 | if ( data.mid( pos, 1 ) == "Q" ) |
266 | value /= 33.8639; | 266 | value /= 33.8639; |
267 | else | 267 | else |
268 | value /= 100; | 268 | value /= 100; |
269 | dataStr = QString::number( value, 'f', 2 ); | 269 | dataStr = QString::number( value, 'f', 2 ); |
270 | dataStr.append( tr( " Hg" ) ); | 270 | dataStr.append( tr( " Hg" ) ); |
271 | } | 271 | } |
272 | } | 272 | } |
273 | else | 273 | else |
274 | { | 274 | { |
275 | dataStr = tr( "n/a" ); | 275 | dataStr = tr( "n/a" ); |
276 | } | 276 | } |
277 | } | 277 | } |
278 | 278 | ||
279 | void WeatherPluginWidget::getIcon(const QString &data ) | 279 | void WeatherPluginWidget::getIcon(const QString &data ) |
280 | { | 280 | { |
281 | dataStr = "psunny"; | 281 | dataStr = "psunny"; |
282 | if ( data.find( "CLR ", 20 ) > -1 || | 282 | if ( data.find( "CLR ", 20 ) > -1 || |
283 | data.find( "SKC ", 20 ) > -1 || | 283 | data.find( "SKC ", 20 ) > -1 || |
284 | data.find( "CAVOK ", 20 ) > -1 ) | 284 | data.find( "CAVOK ", 20 ) > -1 ) |
285 | { | 285 | { |
286 | dataStr = "sunny"; | 286 | dataStr = "sunny"; |
287 | } | 287 | } |
288 | else if ( data.find( "SH ", 20 ) > -1 || | 288 | else if ( data.find( "SH ", 20 ) > -1 || |
289 | data.find( "DZ ", 20 ) > -1 || | 289 | data.find( "DZ ", 20 ) > -1 || |
290 | data.find( "RA ", 20 ) > -1 || | 290 | data.find( "RA ", 20 ) > -1 || |
291 | data.find( "UP ", 20 ) > -1 || | 291 | data.find( "UP ", 20 ) > -1 || |
292 | data.find( "BR ", 20 ) > -1 ) | 292 | data.find( "BR ", 20 ) > -1 ) |
293 | { | 293 | { |
294 | dataStr = "shower"; | 294 | dataStr = "shower"; |
295 | } | 295 | } |
296 | else if ( data.find( "TS ", 20 ) > -1 ) | 296 | else if ( data.find( "TS ", 20 ) > -1 ) |
297 | { | 297 | { |
298 | dataStr = "tstorm"; | 298 | dataStr = "tstorm"; |
299 | } | 299 | } |
300 | else if ( data.find( "SN ", 20 ) > -1 || | 300 | else if ( data.find( "SN ", 20 ) > -1 || |
301 | data.find( "SG ", 20 ) > -1 ) | 301 | data.find( "SG ", 20 ) > -1 ) |
302 | { | 302 | { |
303 | dataStr = "snow"; | 303 | dataStr = "snow"; |
304 | } | 304 | } |
305 | else if ( data.find( "FZ ", 20 ) > -1 || | 305 | else if ( data.find( "FZ ", 20 ) > -1 || |
306 | data.find( "GR ", 20 ) > -1 || | 306 | data.find( "GR ", 20 ) > -1 || |
307 | data.find( "GS ", 20 ) > -1 || | 307 | data.find( "GS ", 20 ) > -1 || |
308 | data.find( "PE ", 20 ) > -1 || | 308 | data.find( "PE ", 20 ) > -1 || |
309 | data.find( "IC ", 20 ) > -1 ) | 309 | data.find( "IC ", 20 ) > -1 ) |
310 | { | 310 | { |
311 | dataStr = "sleet"; | 311 | dataStr = "sleet"; |
312 | } | 312 | } |
313 | } | 313 | } |
314 | 314 | ||
315 | void WeatherPluginWidget::dataRetrieved( OProcess *process ) | 315 | void WeatherPluginWidget::dataRetrieved( OProcess *process ) |
316 | { | 316 | { |
317 | if ( process->normalExit() ) | 317 | if ( process->normalExit() ) |
318 | { | 318 | { |
319 | displayWeather(); | 319 | displayWeather(); |
320 | } | 320 | } |
321 | else | 321 | else |
322 | { | 322 | { |
323 | weatherLabel->setText( tr( "Current weather data not available." ) ); | 323 | weatherLabel->setText( tr( "Current weather data not available." ) ); |
324 | } | 324 | } |
325 | } | 325 | } |