summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/todayplugins/stockticker/stockticker/helpwindow.cpp1
-rw-r--r--noncore/todayplugins/weather/weatherpluginwidget.cpp2
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,98 +1,97 @@
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
21HelpWindow::HelpWindow( const QString& home_, const QString& _path, QWidget* parent, const char *name ) 20HelpWindow::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 ) ) );
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,148 +1,148 @@
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
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( "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
63WeatherPluginWidget::~WeatherPluginWidget() 63WeatherPluginWidget::~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
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
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;