summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/todayplugins/weather/config.in2
-rw-r--r--noncore/todayplugins/weather/opie-today-weatherplugin.control2
-rw-r--r--noncore/todayplugins/weather/weather.pro2
-rw-r--r--noncore/todayplugins/weather/weatherconfig.cpp13
-rw-r--r--noncore/todayplugins/weather/weatherconfig.h2
-rw-r--r--noncore/todayplugins/weather/weatherplugin.h6
-rw-r--r--noncore/todayplugins/weather/weatherpluginimpl.h2
-rw-r--r--noncore/todayplugins/weather/weatherpluginwidget.cpp6
8 files changed, 17 insertions, 18 deletions
diff --git a/noncore/todayplugins/weather/config.in b/noncore/todayplugins/weather/config.in
index 7202983..ae35a59 100644
--- a/noncore/todayplugins/weather/config.in
+++ b/noncore/todayplugins/weather/config.in
@@ -1,4 +1,4 @@
1 config TODAY_WEATHER 1 config TODAY_WEATHER
2 boolean "opie-today-weatherplugin (current weather report)" 2 boolean "opie-today-weatherplugin (current weather report)"
3 default "y" 3 default "y"
4 depends (LIBQPE || LIBQPE-X11) && LIBOPIE 4 depends (LIBQPE || LIBQPE-X11) && LIBOPIE2CORE && LIBOPIE2PIM
diff --git a/noncore/todayplugins/weather/opie-today-weatherplugin.control b/noncore/todayplugins/weather/opie-today-weatherplugin.control
index 80b7d2b..7dbd315 100644
--- a/noncore/todayplugins/weather/opie-today-weatherplugin.control
+++ b/noncore/todayplugins/weather/opie-today-weatherplugin.control
@@ -1,10 +1,10 @@
1Package: opie-today-weatherplugin 1Package: opie-today-weatherplugin
2Files: plugins/today/libtodayweatherplugin.so* pics/todayweatherplugin 2Files: plugins/today/libtodayweatherplugin.so* pics/todayweatherplugin
3Priority: optional 3Priority: optional
4Section: opie/applications 4Section: opie/applications
5Maintainer: Dan Williams <drw@handhelds.org> 5Maintainer: Dan Williams <drw@handhelds.org>
6Architecture: arm 6Architecture: arm
7Depends: libqte2, opie-today 7Depends: libqte2, libopiecore2, libopiepim2, opie-today
8Description: Weather plugin for Today 8Description: Weather plugin for Today
9 Displays current weather conditions. 9 Displays current weather conditions.
10Version: $QPE_VERSION$EXTRAVERSION 10Version: $QPE_VERSION$EXTRAVERSION
diff --git a/noncore/todayplugins/weather/weather.pro b/noncore/todayplugins/weather/weather.pro
index 5ad14e1..d1f8edd 100644
--- a/noncore/todayplugins/weather/weather.pro
+++ b/noncore/todayplugins/weather/weather.pro
@@ -4,22 +4,22 @@ CONFIG += qt plugin release
4 4
5HEADERS = weatherplugin.h \ 5HEADERS = weatherplugin.h \
6 weatherpluginimpl.h \ 6 weatherpluginimpl.h \
7 weatherpluginwidget.h \ 7 weatherpluginwidget.h \
8 weatherconfig.h 8 weatherconfig.h
9 9
10SOURCES = weatherplugin.cpp \ 10SOURCES = weatherplugin.cpp \
11 weatherpluginimpl.cpp \ 11 weatherpluginimpl.cpp \
12 weatherpluginwidget.cpp \ 12 weatherpluginwidget.cpp \
13 weatherconfig.cpp 13 weatherconfig.cpp
14 14
15INCLUDEPATH += $(OPIEDIR)/include \ 15INCLUDEPATH += $(OPIEDIR)/include \
16 ../ ../library 16 ../ ../library
17DEPENDPATH += $(OPIEDIR)/include \ 17DEPENDPATH += $(OPIEDIR)/include \
18 ../ ../library 18 ../ ../library
19 19
20LIBS+= -lqpe -lopie 20LIBS+= -lqpe -lopiecore2 -lopiepim2
21 21
22DESTDIR = $(OPIEDIR)/plugins/today 22DESTDIR = $(OPIEDIR)/plugins/today
23TARGET = todayweatherplugin 23TARGET = todayweatherplugin
24 24
25include ( $(OPIEDIR)/include.pro ) 25include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/todayplugins/weather/weatherconfig.cpp b/noncore/todayplugins/weather/weatherconfig.cpp
index 99ee2a0..4663549 100644
--- a/noncore/todayplugins/weather/weatherconfig.cpp
+++ b/noncore/todayplugins/weather/weatherconfig.cpp
@@ -13,51 +13,50 @@
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 <stdlib.h> 29#include "weatherconfig.h"
30
31#include <qpe/config.h>
32#include <qpe/qpeapplication.h>
33#include <qpe/resource.h>
30 34
31#include <qcheckbox.h> 35#include <qcheckbox.h>
32#include <qclipboard.h> 36#include <qclipboard.h>
33#include <qfontmetrics.h> 37#include <qfontmetrics.h>
34#include <qlabel.h> 38#include <qlabel.h>
35#include <qlayout.h> 39#include <qlayout.h>
36#include <qlineedit.h> 40#include <qlineedit.h>
37#include <qlayout.h> 41#include <qlayout.h>
38#include <qpushbutton.h> 42#include <qpushbutton.h>
39#include <qspinbox.h> 43#include <qspinbox.h>
40#include <qwhatsthis.h> 44#include <qwhatsthis.h>
41 45
42#include <qpe/config.h> 46#include <stdlib.h>
43#include <qpe/qpeapplication.h>
44#include <qpe/resource.h>
45#include <opie/todayconfigwidget.h>
46
47#include "weatherconfig.h"
48 47
49WeatherPluginConfig::WeatherPluginConfig( QWidget *parent, const char* name) 48WeatherPluginConfig::WeatherPluginConfig( QWidget *parent, const char* name)
50 : TodayConfigWidget(parent, name ) 49 : TodayConfigWidget(parent, name )
51{ 50{
52 Config config( "todayweatherplugin"); 51 Config config( "todayweatherplugin");
53 config.setGroup( "Config" ); 52 config.setGroup( "Config" );
54 53
55 QFontMetrics fm = fontMetrics(); 54 QFontMetrics fm = fontMetrics();
56 int fh = fm.height(); 55 int fh = fm.height();
57 56
58 QGridLayout *layout = new QGridLayout( this ); 57 QGridLayout *layout = new QGridLayout( this );
59 layout->setSpacing( 4 ); 58 layout->setSpacing( 4 );
60 layout->setMargin( 4 ); 59 layout->setMargin( 4 );
61 60
62 QLabel *label = new QLabel( tr( "Enter ICAO location identifier:" ), this ); 61 QLabel *label = new QLabel( tr( "Enter ICAO location identifier:" ), this );
63 label->setMaximumHeight( fh + 3 ); 62 label->setMaximumHeight( fh + 3 );
diff --git a/noncore/todayplugins/weather/weatherconfig.h b/noncore/todayplugins/weather/weatherconfig.h
index d9ffec2..1780c7f 100644
--- a/noncore/todayplugins/weather/weatherconfig.h
+++ b/noncore/todayplugins/weather/weatherconfig.h
@@ -19,33 +19,33 @@
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#ifndef WEATHER_PLUGIN_CONFIG_H 29#ifndef WEATHER_PLUGIN_CONFIG_H
30#define WEATHER_PLUGIN_CONFIG_H 30#define WEATHER_PLUGIN_CONFIG_H
31 31
32#include <qstring.h> 32#include <qstring.h>
33#include <qwidget.h> 33#include <qwidget.h>
34 34
35#include <opie/todayconfigwidget.h> 35#include <opie2/todayconfigwidget.h>
36 36
37class QCheckBox; 37class QCheckBox;
38class QLineEdit; 38class QLineEdit;
39class QPushButton; 39class QPushButton;
40class QSpinBox; 40class QSpinBox;
41 41
42class WeatherPluginConfig : public TodayConfigWidget 42class WeatherPluginConfig : public TodayConfigWidget
43{ 43{
44 Q_OBJECT 44 Q_OBJECT
45 public: 45 public:
46 WeatherPluginConfig( QWidget *parent, const char *name ); 46 WeatherPluginConfig( QWidget *parent, const char *name );
47 ~WeatherPluginConfig(); 47 ~WeatherPluginConfig();
48 void writeConfig(); 48 void writeConfig();
49 49
50 private: 50 private:
51 QLineEdit *locationEdit; 51 QLineEdit *locationEdit;
diff --git a/noncore/todayplugins/weather/weatherplugin.h b/noncore/todayplugins/weather/weatherplugin.h
index 480d220..73e7104 100644
--- a/noncore/todayplugins/weather/weatherplugin.h
+++ b/noncore/todayplugins/weather/weatherplugin.h
@@ -16,38 +16,38 @@
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#ifndef WEATHER_PLUGIN_H 29#ifndef WEATHER_PLUGIN_H
30#define WEATHER_PLUGIN_H 30#define WEATHER_PLUGIN_H
31 31
32#include <opie2/todayplugininterface.h>
33#include <opie2/todayconfigwidget.h>
34
32#include <qstring.h> 35#include <qstring.h>
33#include <qwidget.h> 36#include <qwidget.h>
34 37
35#include <opie/todayplugininterface.h>
36#include <opie/todayconfigwidget.h>
37
38class WeatherPlugin : public TodayPluginObject 38class WeatherPlugin : public TodayPluginObject
39{ 39{
40 public: 40 public:
41 WeatherPlugin(); 41 WeatherPlugin();
42 ~WeatherPlugin(); 42 ~WeatherPlugin();
43 43
44 QString pluginName() const; 44 QString pluginName() const;
45 double versionNumber() const; 45 double versionNumber() const;
46 QString pixmapNameWidget() const; 46 QString pixmapNameWidget() const;
47 QWidget *widget(QWidget *); 47 QWidget *widget(QWidget *);
48 QString pixmapNameConfig() const; 48 QString pixmapNameConfig() const;
49 QString appName() const; 49 QString appName() const;
50 bool excludeFromRefresh() const; 50 bool excludeFromRefresh() const;
51 TodayConfigWidget *configWidget(QWidget *); 51 TodayConfigWidget *configWidget(QWidget *);
52}; 52};
53 53
diff --git a/noncore/todayplugins/weather/weatherpluginimpl.h b/noncore/todayplugins/weather/weatherpluginimpl.h
index eaaae1d..d1a7400 100644
--- a/noncore/todayplugins/weather/weatherpluginimpl.h
+++ b/noncore/todayplugins/weather/weatherpluginimpl.h
@@ -16,33 +16,33 @@
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#ifndef WEATHER_PLUGIN_IMPL_H 29#ifndef WEATHER_PLUGIN_IMPL_H
30#define WEATHER_PLUGIN_IMPL_H 30#define WEATHER_PLUGIN_IMPL_H
31 31
32#include <opie/todayplugininterface.h> 32#include <opie2/todayplugininterface.h>
33 33
34class WeatherPlugin; 34class WeatherPlugin;
35 35
36class WeatherPluginImpl : public TodayPluginInterface 36class WeatherPluginImpl : public TodayPluginInterface
37{ 37{
38 public: 38 public:
39 WeatherPluginImpl(); 39 WeatherPluginImpl();
40 virtual ~WeatherPluginImpl(); 40 virtual ~WeatherPluginImpl();
41 41
42 QRESULT queryInterface( const QUuid &, QUnknownInterface ** ); 42 QRESULT queryInterface( const QUuid &, QUnknownInterface ** );
43 Q_REFCOUNT 43 Q_REFCOUNT
44 44
45 virtual TodayPluginObject *guiPart(); 45 virtual TodayPluginObject *guiPart();
46 46
47 private: 47 private:
48 WeatherPlugin *weatherPlugin; 48 WeatherPlugin *weatherPlugin;
diff --git a/noncore/todayplugins/weather/weatherpluginwidget.cpp b/noncore/todayplugins/weather/weatherpluginwidget.cpp
index 15d1c6e..ad99a43 100644
--- a/noncore/todayplugins/weather/weatherpluginwidget.cpp
+++ b/noncore/todayplugins/weather/weatherpluginwidget.cpp
@@ -20,33 +20,33 @@
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 <opie2/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
43WeatherPluginWidget::WeatherPluginWidget( QWidget *parent, const char* name ) 43WeatherPluginWidget::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( "Clock" ); 52 QImage logo1 = Resource::loadImage( "Clock" );
@@ -72,62 +72,62 @@ WeatherPluginWidget::~WeatherPluginWidget()
72void WeatherPluginWidget::timerEvent( QTimerEvent *e ) 72void 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
80void WeatherPluginWidget::retreiveData() 80void 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
112void WeatherPluginWidget::displayWeather() 112void 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