summaryrefslogtreecommitdiff
path: root/noncore/todayplugins
Side-by-side diff
Diffstat (limited to 'noncore/todayplugins') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/todayplugins/fortune/fortunepluginwidget.cpp4
-rw-r--r--noncore/todayplugins/stockticker/stockticker/helpwindow.cpp16
-rw-r--r--noncore/todayplugins/stockticker/stockticker/inputDialog.cpp2
-rw-r--r--noncore/todayplugins/weather/weatherpluginwidget.cpp2
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 @@
#include <qvaluelist.h>
#include <qtl.h>
#include <qstring.h>
#include <qscrollview.h>
#include <qobject.h>
#include <qlayout.h>
#include <qpe/config.h>
#include <qpe/qcopenvelope_qws.h>
#include <opie/oprocess.h>
#include <opie/oticker.h>
FortunePluginWidget::FortunePluginWidget( QWidget *parent, const char* name )
: QWidget( parent, name )
{
fortune = NULL;
getFortune();
}
FortunePluginWidget::~FortunePluginWidget() {
if( fortuneProcess ){
delete fortuneProcess;
}
}
/**
* Get the fortunes
*/
void FortunePluginWidget::getFortune() {
QVBoxLayout* layoutFortune = new QVBoxLayout( this );
if ( fortune ) {
delete fortune;
}
fortune = new OTicker( this );
// fortune->setReadOnly( TRUE );
// fortune->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ) );
fortune->setText( QString("Obtaining fortune...") );
layoutFortune->addWidget( fortune );
fortuneProcess = new OProcess();
*fortuneProcess << "fortune";
- connect(fortuneProcess, SIGNAL(receivedStdout(OProcess*, char*, int ) ),
- this, SLOT(slotStdOut(OProcess*, char*, int) ) );
+ connect(fortuneProcess, SIGNAL(receivedStdout(OProcess*,char*,int) ),
+ this, SLOT(slotStdOut(OProcess*,char*,int) ) );
if(!fortuneProcess->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) {
qWarning("could not start :(");
fortune->setText( QString("Failed to obtain fortune.") );
delete fortuneProcess;
fortuneProcess = 0;
}
}
void FortunePluginWidget::slotStdOut( OProcess* proc, char* buf, int len )
{
QCString s( buf, len );
s.replace( QRegExp("\n"), "" );
fortune->setText( s );
}
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 @@
/****************************************************************************
**
** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
**
** This file is part of an example program for Qt. This example
** program may be used, distributed and modified without limitation.
**
*****************************************************************************/
#include "helpwindow.h"
#include <qstatusbar.h>
#include <qmenubar.h>
#include <qtoolbar.h>
#include <qtoolbutton.h>
#include <qcombobox.h>
#include <ctype.h>
HelpWindow::HelpWindow( const QString& home_, const QString& _path, QWidget* parent, const char *name )
: QMainWindow( parent, name, WDestructiveClose ), pathCombo( 0 ), selectedURL()
{
readHistory();
readBookmarks();
browser = new QTextBrowser( this );
QStringList Strlist;
Strlist.append( home_);
browser->mimeSourceFactory()->setFilePath( Strlist );
browser->setFrameStyle( QFrame::Panel | QFrame::Sunken );
connect( browser, SIGNAL( textChanged() ),
this, SLOT( textChanged() ) );
setCentralWidget( browser );
if ( !home_.isEmpty() )
////////////////////////////////
browser->setSource( home_ );
////////////////////////////////
- connect( browser, SIGNAL( highlighted( const QString&) ),
- statusBar(), SLOT( message( const QString&)) );
+ connect( browser, SIGNAL( highlighted(const QString&) ),
+ statusBar(), SLOT( message(const QString&)) );
setGeometry( 0,0,236,280);
QPopupMenu* file = new QPopupMenu( this );
// file->insertItem( tr("&New Window"), this, SLOT( newWindow() ), ALT | Key_N );
file->insertItem( tr("&Open File"), this, SLOT( openFile() ), ALT | Key_O );
// file->insertItem( tr("&Print"), this, SLOT( print() ), ALT | Key_P );
file->insertSeparator();
file->insertItem( tr("&Close"), this, SLOT( close() ), ALT | Key_Q );
// file->insertItem( tr("E&xit"), qApp, SLOT( closeAllWindows() ), ALT | Key_X );
// The same three icons are used twice each.
////F FIXME
QString pixs=(QDir::homeDirPath ()) +"/Applications/gutenbrowser/pix/";
QIconSet icon_back( QPixmap(pixs+"back.png") );
QIconSet icon_forward( QPixmap(pixs+"forward.png") );
QIconSet icon_home( QPixmap(pixs+"home.png") );
QPopupMenu* go = new QPopupMenu( this );
backwardId = go->insertItem( icon_back, tr("&Backward"), browser, SLOT( backward() ), ALT | Key_Left );
forwardId = go->insertItem( icon_forward, tr("&Forward"), browser, SLOT( forward() ), ALT | Key_Right );
go->insertItem( icon_home, tr("&Home"), browser, SLOT( home() ) );
hist = new QPopupMenu( this );
QStringList::Iterator it = history.begin();
for ( ; it != history.end(); ++it )
mHistory[ hist->insertItem( *it ) ] = *it;
- connect( hist, SIGNAL( activated( int ) ), this, SLOT( histChosen( int ) ) );
+ connect( hist, SIGNAL( activated(int) ), this, SLOT( histChosen(int) ) );
bookm = new QPopupMenu( this );
bookm->insertItem( tr( "Add Bookmark" ), this, SLOT( addBookmark() ) );
bookm->insertSeparator();
QStringList::Iterator it2 = bookmarks.begin();
for ( ; it2 != bookmarks.end(); ++it2 )
mBookmarks[ bookm->insertItem( *it2 ) ] = *it2;
- connect( bookm, SIGNAL( activated( int ) ),
- this, SLOT( bookmChosen( int ) ) );
+ connect( bookm, SIGNAL( activated(int) ),
+ this, SLOT( bookmChosen(int) ) );
menuBar()->insertItem( tr("&File"), file );
menuBar()->insertItem( tr("&Go"), go );
menuBar()->insertItem( tr( "History" ), hist );
menuBar()->insertItem( tr( "Bookmarks" ), bookm );
// menuBar()->insertSeparator();
// menuBar()->insertItem( tr("&Help"), help );
menuBar()->setItemEnabled( forwardId, FALSE);
menuBar()->setItemEnabled( backwardId, FALSE);
- connect( browser, SIGNAL( backwardAvailable( bool ) ), this, SLOT( setBackwardAvailable( bool ) ) );
- connect( browser, SIGNAL( forwardAvailable( bool ) ), this, SLOT( setForwardAvailable( bool ) ) );
+ connect( browser, SIGNAL( backwardAvailable(bool) ), this, SLOT( setBackwardAvailable(bool) ) );
+ connect( browser, SIGNAL( forwardAvailable(bool) ), this, SLOT( setForwardAvailable(bool) ) );
QToolBar* toolbar = new QToolBar( this );
addToolBar( toolbar, "Toolbar");
QToolButton* button;
button = new QToolButton( icon_back, tr("Backward"), "", browser, SLOT(backward()), toolbar );
connect( browser, SIGNAL( backwardAvailable(bool) ), button, SLOT( setEnabled(bool) ) );
button->setEnabled( FALSE );
button = new QToolButton( icon_forward, tr("Forward"), "", browser, SLOT(forward()), toolbar );
connect( browser, SIGNAL( forwardAvailable(bool) ), button, SLOT( setEnabled(bool) ) );
button->setEnabled( FALSE );
button = new QToolButton( icon_home, tr("Home"), "", browser, SLOT(home()), toolbar );
toolbar->addSeparator();
pathCombo = new QComboBox( TRUE, toolbar );
- connect( pathCombo, SIGNAL( activated( const QString & ) ), this, SLOT( pathSelected( const QString & ) ) );
+ connect( pathCombo, SIGNAL( activated(const QString&) ), this, SLOT( pathSelected(const QString&) ) );
toolbar->setStretchableWidget( pathCombo );
// pathCombo->setMaximumWidth(190);
// setRightJustification( TRUE );
// setDockEnabled( Left, FALSE );
// setDockEnabled( Right, FALSE );
pathCombo->insertItem( home_ );
browser->setFocus();
}
void HelpWindow::setBackwardAvailable( bool b)
{
menuBar()->setItemEnabled( backwardId, b);
}
void HelpWindow::setForwardAvailable( bool b)
{
menuBar()->setItemEnabled( forwardId, b);
}
void HelpWindow::textChanged()
{
if ( browser->documentTitle().isNull() ) {
setCaption( "Stockticker Lookup - " + browser->context() );
selectedURL = browser->context();
}
else {
setCaption( "Stockticker Lookup - " + browser->documentTitle() ) ;
selectedURL = browser->documentTitle();
}
if ( !selectedURL.isEmpty() && pathCombo ) {
bool exists = FALSE;
int i;
for ( i = 0; i < pathCombo->count(); ++i ) {
if ( pathCombo->text( i ) == selectedURL ) {
exists = TRUE;
break;
}
}
if ( !exists ) {
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 @@
#include <opie/oprocess.h>
#include <stdlib.h>
// #include <sys/stat.h>
// #include <unistd.h>
InputDialog::InputDialog( )
: QMainWindow( 0x0, 0x0, WStyle_ContextHelp ) {
setCaption( tr("Symbol Lookup"));
QGridLayout *layout = new QGridLayout( this );
layout->setSpacing(6);
layout->setMargin( 2);
LineEdit1 = new QLineEdit( this, "LineEdit1" );
LineEdit1->setFocus();
layout->addMultiCellWidget( LineEdit1, 0, 0, 0, 3);
QLabel *label;
label = new QLabel(this);
label->setText( tr("Enter something to lookup / search."));
label->setMaximumHeight(60);
layout->addMultiCellWidget( label, 1, 1, 0, 3);
connect(LineEdit1,SIGNAL(returnPressed()),this,SLOT(doLookup()));
QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Expanding );
layout->addItem( spacer, 8, 0 );
}
InputDialog::~InputDialog() {
}
void InputDialog::doLookup() {
// http://finance.yahoo.com/l?m=&s=siemens&t=
QString url = "\"http://finance.yahoo.com/l?m=&s="+LineEdit1->text()+"\"";
QString tempHtml = "/tmp/stockticker.html";
QString cmd = "wget -O "+tempHtml+" "+url;
qDebug(cmd);
/*
OProcess proc;
proc << "/usr/bin/wget";
proc<<"-O"<< tempHtml<< url;
- connect( &proc, SIGNAL( processExited( OProcess *)),this, SLOT( showBrowser(OProcess *)));
+ connect( &proc, SIGNAL( processExited(OProcess*)),this, SLOT( showBrowser(OProcess*)));
proc.start( OProcess::NotifyOnExit);
*/
system(cmd.latin1());
HelpWindow *StockLookup = new HelpWindow( tempHtml,".",this, "SymbolLookup");
StockLookup->setCaption("Symbol");
StockLookup->showMaximized();
StockLookup->show();
LineEdit1->text();
}
void InputDialog::showBrowser(OProcess*) {
qDebug("BLAH");
QString tempHtml = "/tmp/stockticker.html";
HelpWindow *StockLookup = new HelpWindow( tempHtml,".",this, "SymbolLookup");
StockLookup->setCaption("Symbol");
StockLookup->showMaximized();
StockLookup->show();
LineEdit1->text();
}
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 )
startTimer(1000);
}
WeatherPluginWidget::~WeatherPluginWidget()
{
QFile file( localFile );
if ( file.exists() )
{
file.remove();
}
}
void WeatherPluginWidget::timerEvent( QTimerEvent *e )
{
killTimer( e->timerId() );
retreiveData();
}
void WeatherPluginWidget::retreiveData()
{
Config config( "todayweatherplugin");
config.setGroup( "Config" );
location = config.readEntry( "Location", "" );
useMetric = config.readBoolEntry( "Metric", TRUE );
frequency = config.readNumEntry( "Frequency", 5 );
startTimer( frequency * 60000 );
localFile = "/tmp/";
localFile.append( location );
localFile.append( ".TXT" );
remoteFile = "http://weather.noaa.gov/pub/data/observations/metar/stations/";
remoteFile.append( location );
remoteFile.append( ".TXT" );
QFile file( localFile );
if ( file.exists() )
{
file.remove();
}
OProcess *proc = new OProcess;
*proc << "wget" << "-q" << remoteFile << "-O" << localFile;
- connect( proc, SIGNAL( processExited( OProcess * ) ), this, SLOT( dataRetrieved( OProcess * ) ) );
+ connect( proc, SIGNAL( processExited(OProcess*) ), this, SLOT( dataRetrieved(OProcess*) ) );
proc->start();
}
void WeatherPluginWidget::displayWeather()
{
weatherData = QString::null;
QFile file( localFile );
if ( file.size() > 0 && file.open( IO_ReadOnly ) )
{
QTextStream data( &file );
while ( !data.eof() )
{
weatherData.append( data.readLine() );
}
file.close();
weatherData = weatherData.simplifyWhiteSpace();
QString tmpstr;
tmpstr.append( tr( "Temp: " ) );
getTemp( weatherData );
tmpstr.append( dataStr );
tmpstr.append( tr( " Wind: " ) );
getWind( weatherData );
tmpstr.append( dataStr );
tmpstr.append( tr( "\nPres: " ) );
getPressure( weatherData );
tmpstr.append( dataStr );
weatherLabel->setText( tmpstr );
tmpstr = "todayweatherplugin/";
getIcon( weatherData );
tmpstr.append( dataStr );
QImage logo1 = Resource::loadImage( tmpstr );
QPixmap pic;
pic.convertFromImage( logo1 );
weatherIcon->setPixmap( pic );
}
else
{
weatherLabel->setText( tr( "Current weather data not available." ) );
}
}