summaryrefslogtreecommitdiff
authorzecke <zecke>2004-09-10 11:11:23 (UTC)
committer zecke <zecke>2004-09-10 11:11:23 (UTC)
commit532d65f8a45850bfda3c3344a7b165af91e48440 (patch) (side-by-side diff)
treecbda2467001ed9a5be304fa52cabbb797b56ecfe
parente64d9e9682e0afefc4fbebe7ba9737e0f86e3ed7 (diff)
downloadopie-532d65f8a45850bfda3c3344a7b165af91e48440.zip
opie-532d65f8a45850bfda3c3344a7b165af91e48440.tar.gz
opie-532d65f8a45850bfda3c3344a7b165af91e48440.tar.bz2
Add newlines, remove unused local variables, remove unused parameters,
add newlines at the end of file...
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/checkbook/traninfo.cpp2
-rw-r--r--noncore/apps/confedit/listviewconfdir.cpp4
-rw-r--r--noncore/apps/confedit/listviewitemconfigentry.cpp8
-rw-r--r--noncore/apps/opie-bartender/bac.cpp1
-rw-r--r--noncore/apps/opie-gutenbrowser/LibraryDialog.cpp2
-rw-r--r--noncore/apps/opie-gutenbrowser/NetworkDialog.cpp2
-rw-r--r--noncore/apps/opie-gutenbrowser/fontDialog.cpp40
-rw-r--r--noncore/apps/opie-gutenbrowser/helpwindow.cpp2
-rw-r--r--noncore/apps/oxygen/kmolelements.cpp36
9 files changed, 48 insertions, 49 deletions
diff --git a/noncore/apps/checkbook/traninfo.cpp b/noncore/apps/checkbook/traninfo.cpp
index 506f567..4833af9 100644
--- a/noncore/apps/checkbook/traninfo.cpp
+++ b/noncore/apps/checkbook/traninfo.cpp
@@ -131,97 +131,97 @@ const QString &TranInfo::datestr(bool bDisplayDate)
tempstr=TimeString::numberDateString( td );
} else {
tempstr.sprintf( "%04d-%02d-%02d", td.year() ,td.month(), td.day() );
}
return(tempstr);
}
// --- getIdStr ---------------------------------------------------------------
const QString &TranInfo::getIdStr()
{
tempstr.sprintf("%04d", i);
return( tempstr );
}
// --- write ------------------------------------------------------------------
void TranInfo::write( Config *config )
{
config->setGroup( QString::number( id() ) );
config->writeEntry( "Description", d );
tempstr = QString::number( td.month() );
tempstr.append( '/' );
tempstr.append( QString::number( td.day() ) );
tempstr.append( '/' );
tempstr.append( QString::number( td.year() ) );
config->writeEntry( "Date", tempstr );
w ? tempstr = "true"
: tempstr = "false";
config->writeEntry( "Payment", tempstr );
if ( t == "Debit Charge" || t == "Written Check" )
tempstr = "0";
else if ( t == "Written Check" || t == "Automatic Payment" )
tempstr = "1";
else if ( t == "Transfer" )
tempstr = "2";
else if ( t == "Credit Card" || t == "Cash" )
tempstr = "3";
config->writeEntry( "Type", tempstr );
config->writeEntry( "Category", c );
tempstr.setNum( a, 'f', 2 );
config->writeEntry( "Amount", tempstr );
tempstr.setNum( f, 'f', 2 );
config->writeEntry( "TransactionFee", tempstr );
config->writeEntry( "CheckNumber", cn );
config->writeEntry( "Comments", n );
config->writeEntry( "Next", _next );
}
int TranInfoList::compareItems( QCollection::Item item1, QCollection::Item item2 )
{
QDate d1 = ((TranInfo *)item1)->date();
QDate d2 = ((TranInfo *)item2)->date();
int r = -1;
if ( d1 < d2 )
r = -1;
else if ( d1 == d2 )
r = 0;
else if ( d1 > d2 )
r = 1;
return( r );
}
// --- toString ---------------------------------------------------------------
QString TranInfo::toString()
{
QString ret;
ret.sprintf("(%4d) %10s %4s %-10s %5.2f %5.2f",
id(),
(const char *)datestr(),
(const char *)number(),
(const char *)desc(),
(withdrawal() ? -1 : 1) * amount(),
fee()
);
return(ret);
}
// --- findMostRecentByDesc ---------------------------------------------------
TranInfo *TranInfoList::findMostRecentByDesc( const QString &desc )
{
for(TranInfo *cur=last(); cur; cur=prev()) {
if( cur->desc()==desc )
return( cur );
}
return(NULL);
-} \ No newline at end of file
+}
diff --git a/noncore/apps/confedit/listviewconfdir.cpp b/noncore/apps/confedit/listviewconfdir.cpp
index 33bffe1..73eaae3 100644
--- a/noncore/apps/confedit/listviewconfdir.cpp
+++ b/noncore/apps/confedit/listviewconfdir.cpp
@@ -1,65 +1,65 @@
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
// (c) 2002 Patrick S. Vogtp <tille@handhelds.org>
#include "listviewconfdir.h"
#include "listviewitemconffile.h"
/* OPIE */
#include <opie2/odebug.h>
using namespace Opie::Core;
/* QT */
#include <qmessagebox.h>
ListViewConfDir::ListViewConfDir(QString settingsPath, QWidget *parent, const char *name )
: QListView(parent,name), confDir(settingsPath)
{
setRootIsDecorated( true );
addColumn(tr("Files"));
if (!confDir.isReadable())
QMessageBox::critical(this,tr("Could not open"),tr("The directory ")+settingsPath+tr(" could not be opened."),1,0);
readConfFiles();
connect( this, SIGNAL(expanded(QListViewItem*)), SLOT(expand(QListViewItem*)));
}
ListViewConfDir::~ListViewConfDir()
{
}
void ListViewConfDir::readConfFiles()
{
confDir.setFilter( QDir::Files | QDir::NoSymLinks );
confDir.setSorting( QDir::Name );
confDir.setNameFilter("*.conf");
const QFileInfoList *list = confDir.entryInfoList();
QFileInfoListIterator it( *list );
QFileInfo *fi;
ListViewItemConfFile *fileEntry;
while ( (fi=it.current()) )
{
- odebug << "opening: >" << fi->fileName().data() << "<" << oendl;
+ odebug << "opening: >" << fi->fileName().data() << "<" << oendl;
fileEntry = new ListViewItemConfFile( fi, this );
- QListViewItem *dummy = new QListViewItem(fileEntry, "dummy");
+ (void)new QListViewItem(fileEntry, "dummy");
++it;
}
}
void ListViewConfDir::expand(QListViewItem *item)
{
((ListViewItemConf*)item)->expand();
}
diff --git a/noncore/apps/confedit/listviewitemconfigentry.cpp b/noncore/apps/confedit/listviewitemconfigentry.cpp
index 0970125..714a154 100644
--- a/noncore/apps/confedit/listviewitemconfigentry.cpp
+++ b/noncore/apps/confedit/listviewitemconfigentry.cpp
@@ -43,108 +43,108 @@ QString ListViewItemConfigEntry::getFile()
}
void ListViewItemConfigEntry::setGroup(QString g)
{
if (g==_group) return;
_group = g;
changed();
}
QString ListViewItemConfigEntry::getGroup()
{
return _group;
}
void ListViewItemConfigEntry::setKey(QString key)
{
int pos = key.find("=");
_key = key.left(pos).stripWhiteSpace();
_value = key.right(key.length() - pos - 1).stripWhiteSpace();
displayText();
}
QString ListViewItemConfigEntry::getKey()
{
return _key;
}
QString ListViewItemConfigEntry::getValue()
{
return _value;
}
void ListViewItemConfigEntry::keyChanged(QString k)
{
if (k==_key) return;
_key = k;
changed();
}
void ListViewItemConfigEntry::valueChanged(QString v)
{
if (v==_value) return;
_value = v;
changed();
}
void ListViewItemConfigEntry::displayText()
{
QString s;
if (_changed) s="*";
if (isGroup())
{
s += "["+_group+"]";
_type = Group;
}else{
s += _key+" = "+_value;
_type = Key;
}
setText(0,s);
}
void ListViewItemConfigEntry::changed()
{
_changed=true;
displayText();
_fileItem->changed();
}
void ListViewItemConfigEntry::remove()
{
delete this;
}
void ListViewItemConfigEntry::save(QTextStream *t)
{
QString s;
if (isGroup())
{
s += "["+_group+"]";
_type = Group;
}else{
s += _key+" = "+_value;
_type = Key;
}
s += "\n";
(*t) << s;
_changed = false;
for (QListViewItem *it = firstChild(); it!=0;it = it->nextSibling())
{
((ListViewItemConfigEntry*)it)->save(t);
}
}
void ListViewItemConfigEntry::revert()
{
- _group = _groupOrig;
- _key = _keyOrig;
- _value = _valueOrig;
+ _group = _groupOrig;
+ _key = _keyOrig;
+ _value = _valueOrig;
_changed=false;
displayText();
}
void ListViewItemConfigEntry::expand()
{
-} \ No newline at end of file
+}
diff --git a/noncore/apps/opie-bartender/bac.cpp b/noncore/apps/opie-bartender/bac.cpp
index 2e74029..8dc7e88 100644
--- a/noncore/apps/opie-bartender/bac.cpp
+++ b/noncore/apps/opie-bartender/bac.cpp
@@ -41,144 +41,143 @@ BacDialog::BacDialog( QWidget* parent, const char* name, bool modal, WFlags fl
Layout7->addLayout( Layout1 );
Layout2 = new QHBoxLayout;
Layout2->setSpacing( 6 );
Layout2->setMargin( 0 );
WeightSpinBox = new QSpinBox( this, "WeightSpinBox" );
Layout2->addWidget( WeightSpinBox );
WeightSpinBox->setMaxValue(500);
TextLabel2 = new QLabel( this, "TextLabel2" );
TextLabel2->setText( tr( "Weight" ) );
Layout2->addWidget( TextLabel2 );
Layout7->addLayout( Layout2 );
weightUnitsCombo =new QComboBox( FALSE, this, "unitComboBox" );
weightUnitsCombo->insertItem( tr( "Kilos" ) );
weightUnitsCombo->insertItem( tr( "Pounds" ) );
Layout2->addWidget( weightUnitsCombo );
weightUnitsLabel = new QLabel(this, "unitsTextLabel" );
weightUnitsLabel->setText( tr( "Units" ) );
Layout2->addWidget( weightUnitsLabel );
Layout3 = new QHBoxLayout;
Layout3->setSpacing( 6 );
Layout3->setMargin( 0 );
TimeSpinBox = new QSpinBox( this, "TimeSpinBox" );
Layout3->addWidget( TimeSpinBox );
TimeSpinBox->setMaxValue(24);
TextLabel3 = new QLabel( this, "TextLabel3" );
TextLabel3->setText( tr( "Period of Time (hours)" ) );
Layout3->addWidget( TextLabel3 );
Layout7->addLayout( Layout3 );
Layout4 = new QHBoxLayout;
Layout4->setSpacing( 6 );
Layout4->setMargin( 0 );
GenderComboBox = new QComboBox( FALSE, this, "GenderComboBox" );
GenderComboBox->insertItem( tr( "Male" ) );
GenderComboBox->insertItem( tr( "Female" ) );
GenderComboBox->insertItem( tr( "Unknown" ) );
Layout4->addWidget( GenderComboBox );
TextLabel4 = new QLabel( this, "TextLabel4" );
TextLabel4->setText( tr( "Gender" ) );
Layout4->addWidget( TextLabel4 );
Layout7->addLayout( Layout4 );
Layout6 = new QHBoxLayout;
Layout6->setSpacing( 6 );
Layout6->setMargin( 0 );
TypeDrinkComboBox = new QComboBox( FALSE,this, "TypeDrinkComboBox" );
TypeDrinkComboBox->insertItem( tr( "Beer" ) );
TypeDrinkComboBox->insertItem( tr( "Wine" ) );
TypeDrinkComboBox->insertItem( tr( "Shot" ) );
Layout6->addWidget( TypeDrinkComboBox );
TextLabel1_2 = new QLabel( this, "TextLabel1_2" );
TextLabel1_2->setText( tr( "Type of drink" ) );
Layout6->addWidget( TextLabel1_2 );
Layout7->addLayout( Layout6 );
PushButton1 = new QPushButton( this, "PushButton1" );
PushButton1->setText( tr( "Calculate" ) );
Layout7->addWidget( PushButton1 );
connect(PushButton1,SIGNAL( clicked()), this, SLOT( calculate()));
LCDNumber1 = new QLCDNumber( this, "LCDNumber1" );
LCDNumber1->setMaximumHeight( 50);
LCDNumber1->setNumDigits(6);
LCDNumber1->setSmallDecimalPoint(TRUE);
LCDNumber1->setFrameStyle(QFrame::Box);
LCDNumber1->setLineWidth(2);
LCDNumber1->setSegmentStyle( QLCDNumber::Filled);
QPalette palette = LCDNumber1->palette();
palette.setColor(QPalette::Normal, QColorGroup::Foreground, Qt::red);
palette.setColor(QPalette::Normal, QColorGroup::Light, Qt::black);
palette.setColor(QPalette::Normal, QColorGroup::Dark, Qt::darkGreen);
LCDNumber1->setPalette(palette);
Layout7->addWidget( LCDNumber1 );
NumberSpinBox->setFocus();
}
BacDialog::~BacDialog()
{}
void BacDialog::calculate()
{
float weight,genderDiff, bac, typeDrink=0, drinkOz=0, bodyWater, milliliters, oz, gram, gramsMil, alc, metab, bac1;
- float weightunitDifference, massunitdiff;
QString estBac;
if( GenderComboBox->currentItem()==0)
genderDiff = .58;
else
genderDiff = .49;
switch(TypeDrinkComboBox->currentItem()) {
case 0: { //beer
typeDrink = .045;
drinkOz = 12;
}
break;
case 1: {
typeDrink = .2;
drinkOz = 4;
}
break;
case 2: {
typeDrink = .5;
drinkOz = 1.5;
}
break;
};
if( weightUnitsCombo->currentItem() == 0 ) {
weight = WeightSpinBox->value(); // kilos
} else {
weight = WeightSpinBox->value() / 2.2046; // convert to kilograms
}
bodyWater = weight * genderDiff;
milliliters = bodyWater * 1000;
oz = 23.36/milliliters;
gram = oz * .806;
gramsMil = gram * 100;
alc = drinkOz*NumberSpinBox->value() * typeDrink;
metab = TimeSpinBox->value() * .012;
bac1 = gramsMil * alc;
bac = bac1 - metab;
// weightDrink= (nDrinks * .79) / (weight * genderDiff*1000);
// (ounces * percent * 0.075 / weight) - (hours * 0.015);
// bac = (((weightDrink * .806) * 100) * .54);// - (time * .012); // assuming beer of 4.5%
estBac.sprintf("%f",bac);
LCDNumber1->display(bac);
// BACTextLabel->setText(estBac );
}
diff --git a/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp b/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp
index 124b6f3..020a116 100644
--- a/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp
+++ b/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp
@@ -1,134 +1,134 @@
/***************************************************************************
// LibraryDialog.cpp - description
// -------------------
// begin : Sat Aug 19 2000
// copyright : (C) 2000 - 2004 by llornkcor
// email : ljp@llornkcor.com
// ***************************************************/
// /***************************************************************************
// * This program is free software; you can redistribute it and/or modify *
// * it under the terms of the GNU General Public License as published by *
// * the Free Software Foundation; either version 2 of the License, or *
// * (at your option) any later version. *
// ***************************************************************************/
//ftp://ibiblio.org/pub/docs/books/gutenberg/GUTINDEX.ALL
#include "LibraryDialog.h"
#include "output.h"
/* OPIE */
#include <qpe/applnk.h>
#include <qpe/qpeapplication.h>
#include <qpe/qpedialog.h>
#include <opie2/odebug.h>
/* QT */
#include <qpushbutton.h>
#include <qmultilineedit.h>
//#include <qlayout.h>
/* STD */
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
/*
* The dialog will by default be modeless, unless you set 'modal' to
* TRUE to construct a modal dialog. */
-LibraryDialog::LibraryDialog( QWidget* parent, const char* name , bool modal, WFlags fl )
+LibraryDialog::LibraryDialog( QWidget* parent, const char* name , bool /*modal*/, WFlags fl )
: QDialog( parent, name, true/* modal*/, fl )
{
if ( !name )
setName( "LibraryDialog" );
indexLoaded=false;
initDialog();
// this->setMaximumWidth(240);
index = "GUTINDEX.ALL";
local_library = (QDir::homeDirPath ()) +"/Applications/gutenbrowser/";
local_index = local_library + index;
QString iniFile ;
iniFile = QPEApplication::qpeDir()+"/etc/gutenbrowser/gutenbrowserrc";
new_index =QPEApplication::qpeDir()+"/etc/gutenbrowser/PGWHOLE.TXT";
old_index = QPEApplication::qpeDir()+"/etc/gutenbrowser/GUTINDEX.ALL";
// old_index = QPEApplication::qpeDir()+"etc/gutenbrowser/GUTINDEX.ALL";
// iniFile = local_library+"gutenbrowserrc";
// new_index = local_library + "PGWHOLE.TXT";
// old_index = local_library + "GUTINDEX.ALL";
Config config("Gutenbrowser");
config.setGroup( "HttpServer" );
proxy_http = config.readEntry("Preferred", "http://sailor.gutenbook.org");
config.setGroup( "FTPsite" );
ftp_host=config.readEntry("SiteName", "sailor.gutenberg.org");
odebug << "Library Dialog: ftp_host is "+ftp_host << oendl;
// ftp_host=ftp_host.right(ftp_host.length()-(ftp_host.find(") ",0,TRUE)+1) );
// ftp_host=ftp_host.stripWhiteSpace();
ftp_base_dir= config.readEntry("base", "/pub/gutenberg");
i_binary = 0;
config.setGroup("SortAuth");
if( config.readEntry("authSort", "FALSE") == "TRUE")
authBox->setChecked(TRUE);
config.setGroup("General");
downDir =config.readEntry( "DownloadDirectory",local_library);
odebug << "downDir is "+downDir << oendl;
newindexLib.setName( old_index);
indexLib.setName( old_index);
new QPEDialogListener(this);
QTimer::singleShot( 1000, this, SLOT( FindLibrary()) );
}
LibraryDialog::~LibraryDialog()
{
// delete QList_Item2;
// delete QList_Item1;
// delete QList_Item3;
// delete QList_Item4;
// delete QList_Item5;
// saveConfig();
}
/*This groks using PGWHOLE.TXT */
void LibraryDialog::Newlibrary()
{
#ifndef Q_WS_QWS //sorry embedded gutenbrowser cant use zip files
//odebug << "Opening new library index " << newindexLib << "" << oendl;
if ( newindexLib.open( IO_ReadOnly) ) {
setCaption( tr( "Library Index - using master pg index." ) );// file opened successfully
QTextStream indexStream( &newindexLib );
QString indexLine;
while ( !indexStream.atEnd() ) { // until end of file..
indexLine = indexStream.readLine();
if ( ( indexLine.mid(4,4)).toInt() && !( indexLine.left(3)).toInt()) {
year = indexLine.mid(4,4);
year = year.stripWhiteSpace();
file = indexLine.mid( indexLine.find( "[", 0, TRUE )+1, 12 );
file = file.stripWhiteSpace();
number = indexLine.mid( indexLine.find( "]", 0, TRUE ) +1, indexLine.find( " ", 0, TRUE )+1 );
if( year.toInt() < 1984)
number = number.left( number.length() -1 );
number = number.stripWhiteSpace();
title = indexLine.mid( indexLine.find(" ", 26, TRUE), indexLine.length() );
title = title.stripWhiteSpace();
getAuthor(); // groks author
author = author.stripWhiteSpace();
if (authBox->isChecked()) { // this reverses the first name and last name of the author
// odebug << "Sorting last name first" << oendl;
QString lastName, firstName="";
int finder=author.findRev( ' ', -1, TRUE);
lastName=author.right( author.length()-finder);
firstName=author.left(finder);
diff --git a/noncore/apps/opie-gutenbrowser/NetworkDialog.cpp b/noncore/apps/opie-gutenbrowser/NetworkDialog.cpp
index af14aac..a321952 100644
--- a/noncore/apps/opie-gutenbrowser/NetworkDialog.cpp
+++ b/noncore/apps/opie-gutenbrowser/NetworkDialog.cpp
@@ -1,139 +1,139 @@
// /***************************************************************************
// NetworkDialog.cpp - description
// begin : Sun Aug 27 2000
// copyright : (C) 2000 - 2004 by L.J. Potter
// email : ljp@llornkcor.com
// * This program is free software; you can redistribute it and/or modify *
// * it under the terms of the GNU General Public License as published by *
// * the Free Software Foundation; either version 2 of the License, or *
// * (at your option) any later version. *
// ***************************************************************************/
// // half-assed attempt at providing a network dialog.
// /* Created: Sun Aug 27 15:24:52 2000*/
#include "NetworkDialog.h"
#include "gutenbrowser.h"
/* OPIE */
#include <opie2/odebug.h>
/* QT */
#include <qprogressbar.h>
#include <qstringlist.h>
#include <qpe/config.h>
#include <qvaluelist.h>
#include <qapplication.h>
#include <qfile.h>
#include <qstringlist.h>
#include <qlabel.h>
#include <qpushbutton.h>
#include <qlayout.h>
/* STD */
#include <unistd.h>
extern "C" {
#include <ftplib.h>
}
QProgressBar* ProgressBar1;
QPushButton* buttonCancel;
static netbuf *conn = NULL;
-static int log_progress(netbuf *ctl, int xfered, void *arg) {
+static int log_progress(netbuf *, int xfered, void *arg) {
int fsz = *(int *)arg;
int pct = (xfered * 100) / fsz;
printf("%3d%%\r", pct);
fflush(stdout);
ProgressBar1->setProgress(xfered);
qApp->processEvents();
return 1;
}
NetworkDialog::NetworkDialog( QWidget* parent, const char* name, bool modal, WFlags fl, const QStringList netL)
: QDialog( parent, name, modal, fl )
{
ftp_host = netL[0];
networkUrl = strUrl = netL[0];
dir = ftp_base_dir = netL[1];
localFileName = netL[2];
s_partialFileName = netL[3];
resize(240,120);
local_library = (QDir::homeDirPath ()) +"/Applications/gutenbrowser/";
// autoOk = autoDownload;
// if( networkUrl.find("ftp",0,false)== -1 ) {
// if ( !name )
// setName( "HTTP NetworkDialog" );
// setCaption( tr( "HTTP Download ) );
// qInitNetworkProtocols(); // registers ftp protocol // for now
// QNetworkProtocol::registerNetworkProtocol( "http", new QNetworkProtocolFactory<Http> );
// } else {
if ( !name )
setName( "FTP NetworkDialog" );
setCaption(tr("FTP Download"));
// }
initDialog(); //opens file to be written
}
NetworkDialog::~NetworkDialog() {
}
void NetworkDialog::initDialog() {
QGridLayout *layout = new QGridLayout( this );
totalBytesDownloaded=0;
warnLabel = new QLabel( this, "TextLabel" );
warnLabel ->setText( tr( "Download should start shortly" ) );
TextLabel3 = new QLabel( this, "TextLabel3" );
TextLabel3->setText( "");
layout->addMultiCellWidget( warnLabel, 0, 0, 0, 5 );
layout->addMultiCellWidget( TextLabel3, 1, 1, 0, 5 );
ProgressBar1 = new QProgressBar( this, "ProgressBar1" );
ProgressBar1->setProgress(0);
layout->addMultiCellWidget( ProgressBar1, 3, 3, 0, 4 );
// hbox->addStretch(1);
buttonCancel = new QPushButton( this, "buttonCancel" );
buttonCancel->setText( tr( "&Cancel" ) );
buttonCancel->setAutoDefault( TRUE );
buttonCancel->setDefault( TRUE );
layout->addMultiCellWidget( buttonCancel, 3, 3, 5, 5 );
connect(buttonCancel,SIGNAL(clicked()),this,SLOT(reject()));
QTimer::singleShot( 1000, this, SLOT( doOk() ));
}
/*
downloads the file networkUrl */
bool NetworkDialog::downloadFile( QString networkUrl )
{
int fsz;
warnLabel ->setText( "");
qApp->processEvents();
odebug << "Downloading: " << networkUrl << "" << oendl;
odebug << "Into: " << localFileName << "" << oendl;
if( networkUrl.length() > 5) {
QString ftp_user = "anonymous";
QString ftp_pass = "zaurus@gutenbrowser.com";
// ftp_host= networkUrl.mid(networkUrl.find("ftp://",0, TRUE),
if(ftp_host.length() < 2) {
odebug << "Please select an ftp host" << oendl;
successDownload=false;
QMessageBox::message("Note","You need to select an ftp host");
return false;
}
QString msg;
odebug << ftp_host << oendl;
odebug << "Opening ftp connection." << oendl;
warnLabel->setText("connecting to: "+ftp_host );
qApp->processEvents();
/////////// Open FTP connection
if (!FtpConnect( ftp_host.latin1(), &conn)) {
i=0;
diff --git a/noncore/apps/opie-gutenbrowser/fontDialog.cpp b/noncore/apps/opie-gutenbrowser/fontDialog.cpp
index fa964a6..c6d0fe6 100644
--- a/noncore/apps/opie-gutenbrowser/fontDialog.cpp
+++ b/noncore/apps/opie-gutenbrowser/fontDialog.cpp
@@ -1,260 +1,260 @@
/****************************************************************************
** Created: Sun Jan 27 11:03:24 2002
copyright 2002 by L.J. Potter ljp@llornkcor.com
copyright : (C) 2000 -2004 by llornkcor
email : ljp@llornkcor.com
****************************************************************************/
#include "fontDialog.h"
#include "optionsDialog.h"
#include <qpe/fontdatabase.h>
#include <qpe/config.h>
#include <qstringlist.h>
#include <qfontinfo.h>
#include <qvaluelist.h>
#include <qpe/qpeapplication.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qlistbox.h>
#include <qmultilineedit.h>
#include <qpushbutton.h>
#include <qlayout.h>
#include <qvariant.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include <qcombobox.h>
//#define BUGGY_SHARP_ZAURUS 0
static const int nfontsizes = 9;
static const int fontsize[nfontsizes] = {8,9,10,11,12,13,14,18,24};
FontDialog::FontDialog( QWidget * parent, const char* name /*, bool modal, WFlags fl */)
:/* QDialog*/ QWidget( parent, name /*, modal, fl */)
{
if ( !name )
setName( "FontDialog" );
setCaption( tr( "Font Dialog" ) );
QGridLayout *layout = new QGridLayout( this );
layout->setSpacing(2);
layout->setMargin(2);
familyListBox = new QListBox( this, "familyListBox" );
layout->addMultiCellWidget( familyListBox, 0, 2, 0, 0);
QBoxLayout * hbox = new QHBoxLayout(this);
QBoxLayout * vbox = new QVBoxLayout(this);
styleListBox = new QListBox( this, "styleListBox" );
vbox->addWidget( styleListBox, 0);
FontTextLabel4 = new QLabel( this, "TextLabel4" );
FontTextLabel4->setText( tr( "Size" ) );
hbox->addWidget( FontTextLabel4,0);
-
+
sizeComboBox = new QComboBox( FALSE, this, "SizeCombo");
// sizeComboBox->setMaximumWidth(60);
hbox->addWidget( sizeComboBox, 0);
vbox->addLayout(hbox,0);
layout->addLayout( vbox,0,3);
-
+
MultiLineEdit1 = new QMultiLineEdit( this, "MultiLineEdit1" );
MultiLineEdit1->setText( tr( "The Quick Brown Fox Jumps Over The Lazy Dog" ) );
MultiLineEdit1->setWordWrap( QMultiLineEdit::WidgetWidth);
layout->addMultiCellWidget( MultiLineEdit1, 4, 4, 0, 3);
connect(familyListBox,SIGNAL(highlighted(const QString &)),SLOT(familyListBoxSlot(const QString &)));
connect(styleListBox,SIGNAL(highlighted(const QString &)),SLOT(styleListBoxSlot(const QString &)));
connect(sizeComboBox,SIGNAL(activated(const QString &)),SLOT(sizeComboBoxSlot(const QString &)));
populateLists();
}
FontDialog::~FontDialog()
{
}
void FontDialog::familyListBoxSlot(const QString & text)
{
int styleInt = styleListBox->currentItem();
int sizeInt = sizeComboBox->currentText().toInt();
sizeComboBox->clear();
styleListBox->clear();
// clearListBoxes();
family = text;
-// odebug << family << oendl;
+// odebug << family << oendl;
QStringList styles = fdb.styles( family ); // string list of styles of our current font family
styleListBox->insertStringList( styles);
QString dstyle;// = "\t" + style + " (";
-#ifdef BUGGY_SHARP_ZAURUS
+#ifdef BUGGY_SHARP_ZAURUS
QValueList<int> smoothies = fdb.smoothSizes( family, styleListBox->text(0) );
for ( QValueList<int>::Iterator points = smoothies.begin(); points != smoothies.end(); ++points ) {
dstyle = QString::number( *points );
- odebug << dstyle << oendl;
+ odebug << dstyle << oendl;
sizeComboBox->insertItem( dstyle.left( dstyle.length() - 1 ));
}
#else
for (int i=0; i<nfontsizes; i++) {
sizeComboBox->insertItem( QString::number(fontsize[i]));
if(fontsize[i] == sizeInt) {
sizeComboBox->setCurrentItem(i);
}
}
#endif
- if(styleInt == -1 || styleInt > styleListBox->count() )
+ if(styleInt == -1 || styleInt > static_cast<int>(styleListBox->count()) )
styleListBox->setCurrentItem(0);
else
styleListBox->setCurrentItem(styleInt);
changeText();
}
-void FontDialog::styleListBoxSlot(const QString &text)
+void FontDialog::styleListBoxSlot(const QString &)
{
changeText();
}
-void FontDialog::sizeComboBoxSlot(const QString & text)
+void FontDialog::sizeComboBoxSlot(const QString &)
{
changeText();
}
void FontDialog::populateLists()
{
// QFont defaultFont=MultiLineEdit1->font();
// QFont defaultFont=Lview->font();
// QFontInfo fontInfo(defaultFont);
Config config("Gutenbrowser");
config.setGroup("Font");
QString familyStr = config.readEntry("Family", "fixed");
QString styleStr = config.readEntry("Style", "Regular");
QString sizeStr = config.readEntry("Size", "10");
QString charSetStr = config.readEntry("CharSet", "iso10646-1" );
bool ok;
int i_size = sizeStr.toInt(&ok,10);
selectedFont = fdb.font(familyStr,styleStr,i_size,charSetStr);
// defaultFont.setItalic(TRUE);
families = fdb.families();
for ( QStringList::Iterator f = families.begin(); f != families.end();++f ) {
QString family = *f;
// if(family == defaultFont.family())
-// odebug << family << oendl;
+// odebug << family << oendl;
familyListBox->insertItem( family);
if( familyListBox->text(0) == family) {
QStringList styles = fdb.styles( family );
// string list of styles of our current font family
styleListBox->insertStringList( styles);
for ( QStringList::Iterator s = styles.begin(); s != styles.end();++s ) { // for each font style
style = *s;
QString dstyle;// = "\t" + style + " (";
if(styleListBox->text(0) == style) {
QValueList<int> smoothies = fdb.smoothSizes( family, style );
for ( QValueList<int>::Iterator points = smoothies.begin(); points != smoothies.end(); ++points ) {
dstyle = QString::number( *points ) + " ";
sizeComboBox ->insertItem( dstyle.left( dstyle.length() - 1 ));
}
dstyle = dstyle.left( dstyle.length() - 1 ) + ")";
}
} // styles
}
}
- for(int i=0;i < familyListBox->count();i++) {
+ for(uint i=0;i < familyListBox->count();i++) {
if( familyListBox->text(i) == familyStr)
familyListBox->setSelected( i, TRUE);
}
- for(int i=0;i < styleListBox->count();i++) {
+ for(uint i=0;i < styleListBox->count();i++) {
if( styleListBox->text(i) == styleStr)
styleListBox->setSelected( i, TRUE);
}
for (int i=0; i<sizeComboBox->count(); i++) {
#ifdef BUGGY_SHARP_ZAURUS
if(sizeComboBox->text(i) == sizeStr)
#else
- if(fontsize[i] == i_size)
+ if(fontsize[i] == i_size)
#endif
sizeComboBox->setCurrentItem(i);
}
changeText();
}
void FontDialog::clearListBoxes() {
familyListBox->clear();
sizeComboBox->clear();
styleListBox->clear();
}
void FontDialog::changeText()
{
if( familyListBox->currentItem() == -1)
family= familyListBox->text(0);
else {
family = familyListBox->currentText();
}
-// odebug << "Font family is "+family << oendl;
+// odebug << "Font family is "+family << oendl;
if( styleListBox->currentItem() == -1)
style=styleListBox->text(0);
else {
style = styleListBox->currentText();
}
-// odebug << "font style is "+style << oendl;
+// odebug << "font style is "+style << oendl;
if( sizeComboBox->currentItem() == -1 )
size = sizeComboBox->text(0);
else {
size = sizeComboBox->currentText();
}
-// odebug << "Font size is "+size << oendl;
+// odebug << "Font size is "+size << oendl;
bool ok;
int i_size = size.toInt(&ok,10);
QStringList charSetList = fdb.charSets(family);
// QStringList styles = fdb.styles( family ); // string list of styles of our current font family
QString charSet;
for ( QStringList::Iterator s = charSetList.begin(); s != charSetList.end();++s ) { // for each font style
charSet = *s;
-// odebug << charSet << oendl;
+// odebug << charSet << oendl;
}
selectedFont = fdb.font(family,style,i_size,charSet);
QFontInfo fontInfo( selectedFont);
-// if(fontInfo.italic() ) odebug << "italic" << oendl;
- selectedFont.setWeight(fontInfo.weight() );
-// odebug << "Style are "+style+" " << fontInfo.weight() << " " << oendl;
+// if(fontInfo.italic() ) odebug << "italic" << oendl;
+ selectedFont.setWeight(fontInfo.weight() );
+// odebug << "Style are "+style+" " << fontInfo.weight() << " " << oendl;
Config cfg("Gutenbrowser");
cfg.setGroup("Font");
cfg.writeEntry("Family",family);
cfg.writeEntry("Style",style);
cfg.writeEntry("Size",size);
cfg.writeEntry("CharSet",charSet);
if(style.find("Italic",0,TRUE) != -1) {
selectedFont = fdb.font(family,"Regular",i_size,charSet);
selectedFont.setItalic(TRUE); //ya right
cfg.writeEntry("Italic","TRUE");
-// odebug << "Style is "+styleListBox->currentText() << oendl;
+// odebug << "Style is "+styleListBox->currentText() << oendl;
} else
cfg.writeEntry("Italic","FALSE");
MultiLineEdit1->setFont( selectedFont);
MultiLineEdit1->update();
changedFonts=TRUE;
}
diff --git a/noncore/apps/opie-gutenbrowser/helpwindow.cpp b/noncore/apps/opie-gutenbrowser/helpwindow.cpp
index e86ca49..ffdc9f0 100644
--- a/noncore/apps/opie-gutenbrowser/helpwindow.cpp
+++ b/noncore/apps/opie-gutenbrowser/helpwindow.cpp
@@ -1,119 +1,119 @@
/****************************************************************************
** $Id$
**
** 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.
**
copyright : (C) 2000 -2004 by llornkcor
email : ljp@llornkcor.com
*****************************************************************************/
#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 )
+HelpWindow::HelpWindow( const QString& home_, const QString&, QWidget* parent, const char *name )
: QMainWindow( parent, name, WDestructiveClose ), pathCombo( 0 ), selectedURL()
{
QString local_library = (QDir::homeDirPath ()) +"/Applications/gutenbrowser/";
// 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&)) );
// resize( 640,600 );
#ifdef Q_WS_QWS
setGeometry( 0,0,236,280);
#else
setGeometry( 10,30,520,420 );
// resize(520,420);
#endif
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() ) );
// QPopupMenu* help = new QPopupMenu( this );
// help->insertItem( tr("&About ..."), this, SLOT( about() ) );
// help->insertItem( tr("About &Qt ..."), this, SLOT( aboutQt() ) );
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 ) ) );
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 ) ) );
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 ) ) );
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 );
diff --git a/noncore/apps/oxygen/kmolelements.cpp b/noncore/apps/oxygen/kmolelements.cpp
index ce8f9c1..e76461b 100644
--- a/noncore/apps/oxygen/kmolelements.cpp
+++ b/noncore/apps/oxygen/kmolelements.cpp
@@ -1,238 +1,238 @@
/*
* kmolelements.cpp
*
* Copyright (C) 2000 Tomislav Gountchev <tomi@idiom.com>
*/
// classes that store and manipulate chemical formulas represented as
// lists of elements
#include <stdio.h>
-#include "kmolelements.h"
+#include "kmolelements.h"
/**
- * A generic chemical entity. Can be an element or a group.
+ * A generic chemical entity. Can be an element or a group.
*/
SubUnit::SubUnit () {}
SubUnit::~SubUnit () {}
/**
- * Construct a subunit and return a pointer to it. The syntax of LINE is
+ * Construct a subunit and return a pointer to it. The syntax of LINE is
* the one used in the element definition file.
*/
SubUnit* SubUnit::makeSubUnit(QString line) {
QString name, grpname, weight, coef;
QTextStream str (line, IO_ReadOnly);
str >> name;
if (name != "-group") { // not a group - must be represented as Element
str >> weight >> ws;
return new Element(name, weight.toDouble());
- }
+ }
else {
str >> grpname;
ElementList* els = new ElementList(grpname); // group - make an ElementList
while (!str.eof()) {
str >> name >> ws;
str >> coef >> ws;
els->addElement(name, coef.toDouble());
}
return els;
}
}
QString SubUnit::getName() const {
return QString("None");
}
/**
* Get the molecular weight of THIS, based on the data from ELSTABLE.
*/
-double SubUnit::getWeight(QDict<SubUnit>* elstable) const {
+double SubUnit::getWeight(QDict<SubUnit>* ) const {
return -1;
}
/**
- * A group of elements.
+ * A group of elements.
*/
ElementList::ElementList () {
elements = new QList<ElementCoef>;
}
ElementList::~ElementList () {
delete elements;
}
/**
- * A group of elements.
+ * A group of elements.
*/
ElementList::ElementList (QString name) {
this->name = name;
elements = new QList<ElementCoef>;
}
/**
* Write THIS to LINE, in a format suitable for the element definition file.
*/
void ElementList::writeOut(QString& line) {
QString coef;
line = "-group " + name;
ElementCoef* current = elements->first();
while (current != 0) {
- line += " " + current->name + " " + coef.setNum(current->coef, 'g', 10);
+ line += " " + current->name + " " + coef.setNum(current->coef, 'g', 10);
// precision set to 10 digits
current = elements->next();
}
}
/**
* Get the molecular weight of THIS, based on the data from ELSTABLE.
*/
double ElementList::getWeight(QDict<SubUnit>* elstable) const {
double weight = 0;
ElementCoef* current = elements->first();
while (current != 0) {
SubUnit* e = elstable->find(current->name);
if (e != 0) {
weight += (current->coef) * (e->getWeight(elstable));
} else return -1; //ERROR
current = elements->next();
}
return weight;
}
/**
- * Return a string representing the elemental composition of THIS, as
+ * Return a string representing the elemental composition of THIS, as
* a tab-separated element - percentage pairs, separated by newlines.
*/
QString ElementList::getEA(QDict<SubUnit>* elstable, double mw) const {
if (mw == 0) mw = getWeight(elstable);
QString ea;
QString temp;
ElementCoef* current = elements->first();
while (current != 0) {
SubUnit* e = elstable->find(current->name);
if (e != 0) {
- double current_percent = 100 * (current->coef) *
- (e->getWeight(elstable))
+ double current_percent = 100 * (current->coef) *
+ (e->getWeight(elstable))
/ mw;
- ea += current->name + "\t" +
+ ea += current->name + "\t" +
temp.setNum(current_percent) + "\n";
} else return QString("ERROR!\n"); //ERROR
current = elements->next();
}
return ea;
}
-
+
/**
* Return a string representing THIS as an empirical chemical formula.
*/
QString ElementList::getEmpFormula() const {
QString ef;
QString temp;
ElementCoef* current = elements->first();
while (current != 0) {
ef += current->name + temp.setNum(current->coef);
current = elements->next();
}
return ef;
}
/**
* Multiply THIS (i.e. the coefficient of each element) by coef.
*/
void ElementList::multiplyBy(double coef) {
ElementCoef* current = elements->first();
while (current != 0) {
(current->coef) *= coef;
current = elements->next();
}
}
/**
* Add THIS to ELS. THIS is not modified; ELS is.
*/
void ElementList::addTo(ElementList& els, double coef) {
ElementCoef* current = elements->first();
while (current != 0) {
els.addElement(current->name, (current->coef) * coef);
current = elements->next();
}
}
/**
- * Add an element to THIS, with a coefficient COEF. If THIS already contains
+ * Add an element to THIS, with a coefficient COEF. If THIS already contains
* an element with the same name, adjust its coefficient only; if not, create
* a new ElementCoef pair and add to THIS.
*/
void ElementList::addElement(const QString& name, double coef) {
ElementCoef* current = elements->first();
while (current != 0) {
if (current->name == name) {
current->coef += coef;
return;
}
current = elements->next();
}
elements->append(new ElementCoef(name, coef));
}
/**
* True iff THIS contains element named NAME.
*/
bool ElementList::contains(const QString& name) {
ElementCoef* current = elements->first();
while (current != 0) {
- if (current->name == name)
+ if (current->name == name)
return true;
current = elements->next();
}
return false;
}
bool ElementList::isEmpty() {
return elements->isEmpty();
}
QString ElementList::getName() const {
return name;
}
/**
* A chemical element.
*/
-Element::Element(const QString& n, double w)
+Element::Element(const QString& n, double w)
: weight(w), name(n) { }
Element::~Element() {
}
/**
* Write THIS to LINE, in a format suitable for the element definition file.
*/
void Element::writeOut(QString& line) {
line.setNum(weight);
line = name + " " + line;
}
-double Element::getWeight(QDict<SubUnit>* elstable) const {
+double Element::getWeight(QDict<SubUnit>* ) const {
return weight;
}
void Element::addTo(ElementList& els, double coef) {
els.addElement(name, coef);
}
QString Element::getName() const {
return name;
}
/**
- * An element - coefficient pair. Used to represent elements within an
+ * An element - coefficient pair. Used to represent elements within an
* element list.
*/
ElementCoef::ElementCoef(const QString& n, double c) : name(n), coef(c) {}