summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--README2
-rw-r--r--core/opiealarm/opiealarm.c2
-rw-r--r--etc/dict/words2
-rw-r--r--help/opie-sh/node3.html2
-rw-r--r--help/opie-sh/node9.html2
-rw-r--r--noncore/apps/odict/eng_ita.dic2
-rw-r--r--noncore/apps/opie-console/filereceive.cpp2
-rw-r--r--noncore/apps/opie-console/filetransfer.cpp2
-rw-r--r--noncore/net/opieftp/opieftp.cpp2
-rw-r--r--noncore/settings/backup/backuprestore.cpp4
-rw-r--r--noncore/settings/networksettings/interfaces/interface.cpp8
-rw-r--r--noncore/settings/networksettings/interfaces/interfaces.cpp44
-rw-r--r--noncore/settings/networksettings/interfaces/interfacesetupimp.cpp2
-rw-r--r--noncore/settings/networksettings/module.h2
-rw-r--r--noncore/settings/networksettings/ppp/pppmodule.cpp2
-rw-r--r--noncore/settings/networksettings/wlan/wextensions.cpp2
-rw-r--r--noncore/settings/networksettings/wlan/wlanmodule.cpp2
-rw-r--r--noncore/settings/tabmanager/tabmanager.cpp12
-rw-r--r--noncore/unsupported/mail2/TODO2
-rw-r--r--noncore/unsupported/mail2/folderwidget.cpp6
-rw-r--r--qmake/generators/mac/pbuilder_pbx.cpp2
-rw-r--r--x11/ipc/server/ocopserver.cpp2
22 files changed, 53 insertions, 55 deletions
diff --git a/README b/README
index 0075bde..cb7d5d4 100644
--- a/README
+++ b/README
@@ -1,86 +1,86 @@
1. How to use the Opie build system
====================================
There's a tutorial document at:
http://www.uv-ac.de/opiedev/opiedev.html
The API reference currently is at:
http://handhelds.org/~zecke/apidocs/index.html
You will need qvfb, uic and
(if you want to develop applications) designer
compiled and linked against qt-x11.
That means you must download and configure/make it.
wget ftp://ftp.trolltech.com/qt/source/qt-x11-2.3.2.tar.gz
(Alternatively, you can get static binaries from http://www.vanille.de/tools)
The recommended version of Qt embedded is qt-embedded-2.3.7
You can get it from:
ftp://ftp.trolltech.com/qt/source/qt-embedded-2.3.7.tar.bz2
Set QTDIR to point to your qt/embedded source tree, such as:
export QTDIR=/opt/qt-2.3.7
You need to do set the OPIEDIR environment variable:
export OPIEDIR=`pwd`
or
export OPIEDIR=~/projects/sources/opie
or whereever you placed the Opie sources.
You need to adjust your runtime library search path,
so that the Qt/Embedded and Opie libraries can be found:
export LD_LIBRARY_PATH=$OPIEDIR/lib:$QTDIR/lib:$LD_LIBRARY_PATH
You have to apply the qte<version>-all.patch to the Qt/Embedded
sources and copy the qconfig-qpe.h file to $QTDIR/src/tools:
cd $QTDIR; cat $OPIEDIR/qt/qte<version>*.patch | patch -p0
cp $OPIEDIR/qt/qpe-config.h $QTDIR/src/tools
You are now ready to configure and build Qt/Embedded
cd $QTDIR
echo 'yes' | ./configure -qconfig qpe -depths 4,16,24,32 -system-jpeg -system-libpng -system-zlib -no-xft -qvfb
make
Once you have these compiled, be sure to set the PATH to ensure your (cross)compiler
is available.
Then do the following in the opie source tree:
make clean
make menuconfig
Now you can move through the menu and select or deselect anything..
Exit and save the configuration and enter "make" to create opie...
Have fun with it !
If you get into trouble there are other makefile targets
make clean-configs
is a useful one.
2. Used Libraries
================
The following Libraries are used in Opie.
-For a successfull build you must install these librarys and headers.
+For a successful build you must install these librarys and headers.
The versions are known-good versions. If you successfully try newer ones,
commit a new README or send a mail to opie-devel@handhelds.org
* libsdl 1.2
http://www.libsdl.org/download-1.2.php
* libxine 1.0 beta 11
http://prdownloads.sourceforge.net/xine/
* libpcap 0.7.2
http://www.tcpdump.org/release/
* libetpan 0.31
http://prdownloads.sourceforge.net/libetpan/ + patch in noncore/net/mail/libetpanstuff
* libsqlite 2.8.6
http://www.sqlite.org/download.html
diff --git a/core/opiealarm/opiealarm.c b/core/opiealarm/opiealarm.c
index 90a743f..422865c 100644
--- a/core/opiealarm/opiealarm.c
+++ b/core/opiealarm/opiealarm.c
@@ -1,384 +1,384 @@
/*
* opiealarm.c
*
* This program is for extracting the event time/date out
* of /var/run/resumeat and setting the RTC alarm to that time/date.
* It is designed to run via a script just before the iPAQ
* is suspended and right after the iPAQ resumes operation.
*
* written and copyrighted by Robert Griebl <sandman@handhelds.org>
*/
#include <stdio.h>
#include <linux/rtc.h>
#include <sys/ioctl.h>
#include <sys/time.h>
#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include <time.h>
#include <stdlib.h>
#include <syslog.h>
#include <signal.h>
#include <errno.h>
#include <string.h>
#define PIDFILE "/var/run/opiealarm.pid"
#define TIMEFILE "/var/run/resumeat"
#define APMFILE "/proc/apm"
int resume ( int resuspend );
int suspend ( int fix_rtc );
int main ( int argc, char **argv );
int fork_with_pidfile ( void );
int kill_with_pidfile ( void );
void remove_pidfile ( void );
void usage ( void );
void sig_handler_child ( int sig );
void sig_handler_parent ( int sig );
int onac ( void );
static int opiealarm_was_running;
static pid_t parent_pid = 0;
void sig_handler_child ( int sig )
{
// child got SIGUSR2 -> cleanup pidfile and exit
remove_pidfile ( );
exit ( 0 );
}
void sig_handler_parent ( int sig )
{
// parent got SIGUSR1 -> safe to exit now
parent_pid = 0;
exit ( 0 );
}
void usage ( void )
{
fprintf ( stderr, "Usage: opiealarm -s [-f] | -r [-a]\n\n" );
fprintf ( stderr, "\t-s\tSuspend mode: set RTC alarm\n" );
fprintf ( stderr, "\t-f \tFix RTC, if RTC and system have more than 5sec difference (suspend mode)\n" );
fprintf ( stderr, "\t-r\tResume mode: kill running opiealarm\n" );
fprintf ( stderr, "\t-a <x>\tResuspend in <x> seconds (resume mode)\n\n" );
exit ( 1 );
}
int fork_with_pidfile ( void )
{
FILE *fp;
pid_t pid;
pid = fork ( );
if ( pid > 0 ) {
// We can not just exit now, because the kernel could suspend
// the iPAQ just before the child process sets the RTC.
// Solution: just wait for SIGUSR1 - the child process will
// signal this when it thinks it is safe to exit.
signal ( SIGUSR1, sig_handler_parent );
while ( 1 )
sleep ( 1000 );
exit ( 0 );
}
else if ( pid < 0 ) {
perror ( "forking failed" );
return 0;
}
// sleep( 60 );
// child process needs to react to SIGUSR2. This is sent when
// a new opiealarm process is started.
signal ( SIGUSR2, sig_handler_child );
// save pid
if (( fp = fopen ( PIDFILE, "w" ))) {
fprintf ( fp, "%d", getpid ( ));
fclose ( fp );
// detach
close ( 0 );
close ( 1 );
close ( 2 );
setpgid ( 0, 0 );
return 1;
}
else {
perror ( PIDFILE );
return 0;
}
}
int kill_with_pidfile ( void )
{
FILE *fp;
pid_t pid;
int res = 0;
// terminate a running opiealarm child process
// return 1 if we really killed one
if (( fp = fopen ( PIDFILE, "r" ))) {
if ( fscanf ( fp, "%d", &pid ) == 1 )
res = ( kill ( pid, SIGUSR2 ) == 0 ) ? 1 : 0;
fclose ( fp );
}
return res;
}
void remove_pidfile ( void )
{
// child is about to exit - cleanup
unlink ( PIDFILE );
signal ( SIGUSR2, SIG_DFL );
}
int main ( int argc, char **argv )
{
int mode = 0;
int ac_resusp = 0;
int fix_rtc = 0;
int opt;
while (( opt = getopt ( argc, argv, "a:frs" )) != EOF ) {
switch ( opt ) {
case 's':
mode = 's';
break;
case 'r':
mode = 'r';
break;
case 'a':
ac_resusp = atoi ( optarg );
if ( ac_resusp < 30 ) {
ac_resusp = 120;
fprintf ( stderr, "Warning: resuspend timeout must be >= 30 sec. -- now set to 120 sec\n" );
}
break;
case 'f':
fix_rtc = 1;
break;
default:
usage ( );
}
}
if ( geteuid ( ) != 0 ) {
fprintf ( stderr, "You need root priviledges to run opiealarm." );
return 2;
}
if ( !mode )
usage ( );
parent_pid = getpid ( );
// kill running opiealarm
opiealarm_was_running = kill_with_pidfile ( );
remove_pidfile ( );
switch ( mode ) {
case 'r': opt = resume ( ac_resusp );
break;
case 's':
default : opt = suspend ( fix_rtc );
break;
}
parent_pid = 0;
return opt;
}
int suspend ( int fix_rtc )
{
FILE *fp = NULL;
char buf [64];
time_t alrt, syst, rtct;
struct tm alr, sys, rtc;
int fd;
int rtc_sys_diff;
if ( !fork_with_pidfile ( ))
return 3;
// we are the child process from here on ...
tzset ( ); // not sure if it is really needed -- it probably doesn't hurt ...
time ( &syst );// get the UNIX system time
sys = *localtime ( &syst );
do {
if (( fd = open ( "/dev/misc/rtc", O_RDWR )) < 0 )
if (( fd = open ( "/dev/rtc", O_RDWR )) < 0 )
break; // ( 1, "rtc" );
memset ( &rtc, 0, sizeof ( struct tm )); // get the RTC time
if ( ioctl ( fd, RTC_RD_TIME, &rtc ) < 0 )
break; // ( 1, "ioctl RTC_RD_TIME" );
rtct = mktime ( &rtc );
rtc_sys_diff = ( syst - rtct ) - sys. tm_gmtoff; // calculate the difference between system and hardware time
if ( fix_rtc && (( rtc_sys_diff < -3 ) || ( rtc_sys_diff > 3 ))) {
struct tm set;
set = *gmtime ( &syst );
// if the difference between system and hardware time is more than 3 seconds,
// we have to set the RTC (hwclock --systohc), or alarms won't work reliably.
if ( ioctl ( fd, RTC_SET_TIME, &set ) < 0 )
break; // ( 1, "ioctl RTC_SET_TIME" );
}
// read the wakeup time from TIMEFILE
if (!( fp = fopen ( TIMEFILE, "r" )))
break; // ( 1, TIMEFILE );
if ( !fgets ( buf, sizeof( buf ) - 1, fp ))
break; // ( 1, TIMEFILE );
fclose ( fp );
fp = NULL;
alrt = atoi ( buf ); // get the alarm time
if ( alrt == 0 )
break; // ( 0, TIMEFILE " contains an invalid time description" );
alrt -= 5; // wake up 5 sec before the specified time
alr = *gmtime ( &alrt );
if ( ioctl ( fd, RTC_ALM_SET, &alr ) < 0 ) // set RTC alarm time
break; // ( 1, "ioctl RTC_ALM_SET" );
if ( ioctl ( fd, RTC_AIE_ON, 0 ) < 0 )
break; // ( 1, "ioctl RTC_AIE_ON" ); // enable RTC alarm irq
// tell the parent it is safe to exit now .. we have set the RTC alarm
kill ( parent_pid, SIGUSR1 );
if ( read ( fd, buf, sizeof( unsigned long )) < 0 ) // wait for the RTC alarm irq
break; // ( 1, "read rtc alarm" );
// iPAQ woke up via RTC irq -- otherwise we would have received a SIGUSR2
// from the "resume instance" of opiealarm.
if ( ioctl ( fd, RTC_AIE_OFF, 0 ) < 0 ) // disable RTC alarm irq
break; // ( 1, "ioctl RTC_AIE_OFF" );
close ( fd );
fd = -1;
remove_pidfile ( );
return 0;
} while ( 0 );
if ( fp != NULL )
fclose ( fp );
if ( fd != -1 )
close ( fd );
kill ( parent_pid, SIGUSR1 );
while ( 1 ) // pretend that we are waiting on RTC, so opiealarm -r can kill us
sleep ( 1000 ); // if we don't do this, the "resuspend on AC" would be triggerd
return 0;
}
int onac ( void )
{
FILE *fp;
int on = 0;
// check the apm proc interface for AC status
if (( fp = fopen ( APMFILE, "r" ))) {
int ac = 0;
if ( fscanf ( fp, "%*[^ ] %*d.%*d 0x%*x 0x%x 0x%*x 0x%*x %*d%% %*i %*c", &ac ) == 1 )
on = ( ac == 0x01 ) ? 1 : 0;
fclose ( fp );
}
return on;
}
int resume ( int resuspend )
{
FILE *fp;
// re-suspend when on AC (optional) when woken up via RTC
if ( !opiealarm_was_running ) {
// if opiealarm -s didn't wake up via RTC, the old process gets killed
// by kill_by_pidfile(), which is recorded in opiealarm_was_running
if ( resuspend && onac ( )) {
time_t start, now;
char *argv [4];
if ( !fork_with_pidfile ( ))
return 4;
// we can't wait for the resuspend timeout in the parent process.
// so we fork and tell the parent it can exit immediatly
kill ( parent_pid, SIGUSR1 );
// sleep <resuspend> seconds - this method is much more precise than sleep() !
time ( &start );
do {
sleep ( 1 );
time ( &now );
} while (( now - start ) < resuspend );
if ( onac ( )) { // still on ac ?
argv[0] = "qcop";
argv[1] = "QPE/Desktop";
argv[2] = "suspend()";
argv[3] = 0;
// hard coded for now ...but needed
// another way would be to simulate a power-button press
setenv ( "LOGNAME", "root", 1 );
setenv ( "HOME", "/root", 1 );
setenv ( "LD_LIBRARY_PATH", "/opt/QtPalmtop/lib", 1 );
setenv ( "QTDIR", "/opt/QtPalmtop", 1 );
remove_pidfile ( );
- // no need for system() since this process is no longer usefull anyway
+ // no need for system() since this process is no longer useful anyway
execv ( "/opt/QtPalmtop/bin/qcop", argv );
perror ( "exec for qcop failed" );
return 5;
}
}
}
return 0;
}
diff --git a/etc/dict/words b/etc/dict/words
index 1568032..0f14205 100644
--- a/etc/dict/words
+++ b/etc/dict/words
@@ -3776,1537 +3776,1537 @@ balk
Balkan
Balkanization
Balkanizations
Balkanize
balkanized
Balkanizes
balkanizing
Balkans
balked
balkiness
balking
balks
balky
ball
ballad
ballads
Ballard
Ballards
ballast
ballasts
balled
baller
ballerina
ballerinas
ballers
ballet
ballets
ballgown
balling
ballistic
ballistics
balloon
ballooned
ballooner
ballooners
ballooning
balloons
ballot
ballots
ballpark
ballparks
ballplayer
ballplayers
ballroom
ballrooms
balls
ballyhoo
balm
balms
balmy
balsa
balsam
Baltic
Baltimore
Baltimorean
balustrade
balustrades
Balzac
Bamako
Bamberger
Bambi
bamboo
ban
Banach
banal
banally
banana
bananas
Banbury
Bancroft
band
bandage
bandaged
bandages
bandaging
banded
bandied
bandies
banding
bandit
bandits
bandpass
bands
bandstand
bandstands
bandwagon
bandwagons
bandwidth
bandwidths
bandy
bandying
bane
baneful
bang
banged
banging
Bangladesh
bangle
bangles
Bangor
bangs
Bangui
banish
banished
banishes
banishing
banishment
banister
banisters
banjo
banjos
bank
banked
banker
bankers
banking
bankrupt
bankruptcies
bankruptcy
bankrupted
bankrupting
bankrupts
Banks
banned
banner
banners
banning
banquet
banqueting
banquetings
banquets
bans
banshee
banshees
bantam
banter
bantered
bantering
banters
Bantu
Bantus
baptism
baptismal
baptisms
Baptist
Baptiste
baptistery
baptistries
baptistry
Baptists
baptize
baptized
baptizes
baptizing
bar
barb
Barbados
Barbara
barbarian
barbarians
barbaric
barbarism
barbarities
barbarity
barbarous
barbarously
barbecue
barbecued
barbecues
barbed
barbell
barbells
barber
barbital
barbiturate
barbiturates
Barbour
barbs
Barcelona
Barclay
bard
bards
bare
bared
barefaced
barefoot
barefooted
barely
bareness
barer
bares
barest
barflies
barfly
bargain
bargained
bargaining
bargains
barge
barges
barging
Barhop
baring
baritone
baritones
barium
bark
barked
barker
barkers
barking
barks
barley
Barlow
barn
Barnabas
Barnard
Barnes
Barnet
Barnett
Barney
Barnhard
barns
barnstorm
barnstormed
barnstorming
barnstorms
Barnum
barnyard
barnyards
barometer
barometers
barometric
baron
baroness
baronial
baronies
barons
barony
baroque
baroqueness
Barr
barrack
barracks
barrage
barrages
barred
barrel
barrelled
barrelling
barrels
barren
barrenness
Barrett
barricade
barricades
barrier
barriers
barring
barringer
Barrington
Barron
barrow
Barry
Barrymore
Barrymores
bars
Barstow
Bart
bartender
bartenders
barter
bartered
bartering
barters
Barth
Bartholomew
Bartlett
Bartok
Barton
basal
basalt
Bascom
base
baseball
baseballs
baseband
baseboard
baseboards
based
Basel
baseless
baseline
baselines
basely
baseman
basement
basements
baseness
baser
bases
bash
bashed
bashes
bashful
bashfulness
bashing
BASIC
Basic
basic
basically
basics
Basie
basil
basin
basing
basins
basis
bask
basked
basket
basketball
basketballs
baskets
basking
Basque
bass
basses
basset
Bassett
bassinet
bassinets
bastard
bastards
baste
basted
bastes
basting
bastion
bastions
bat
Batavia
batch
batched
Batchelder
batches
Bateman
Bates
bath
bathe
bathed
bather
bathers
bathes
bathing
bathos
bathrobe
bathrobes
bathroom
bathrooms
baths
bathtub
bathtubs
Bathurst
Batista
baton
batons
Bator
bats
battalion
battalions
batted
Battelle
batten
battens
batter
battered
batteries
battering
batters
battery
batting
battle
battled
battlefield
battlefields
battlefront
battlefronts
battleground
battlegrounds
battlement
battlements
battler
battlers
battles
battleship
battleships
battling
bauble
baubles
baud
Baudelaire
Bauer
Bauhaus
Bausch
bauxite
Bavaria
Bavarian
bawdy
bawl
bawled
bawling
bawls
Baxter
bay
Bayda
bayed
Bayes
Bayesian
baying
Baylor
bayonet
bayonets
Bayonne
bayou
bayous
Bayport
Bayreuth
bays
bazaar
bazaars
be
beach
beached
beaches
beachhead
beachheads
beaching
beacon
beacons
bead
beaded
beading
beadle
beadles
beads
beady
beagle
beagles
beak
beaked
beaker
beakers
beaks
beam
beamed
beamer
beamers
beaming
beams
bean
beanbag
beaned
beaner
beaners
beaning
beans
bear
bearable
bearably
beard
bearded
beardless
beards
Beardsley
bearer
bearers
bearing
bearings
bearish
bears
beast
beastly
beasts
beat
beatable
beatably
beaten
beater
beaters
beatific
beatification
beatify
beating
beatings
beatitude
beatitudes
beatnik
beatniks
Beatrice
beats
beau
Beauchamps
Beaujolais
Beaumont
Beauregard
beaus
beauteous
beauteously
beauties
beautifications
beautified
beautifier
beautifiers
beautifies
beautiful
beautifully
beautify
beautifying
beauty
beaver
beavers
Beaverton
becalm
becalmed
becalming
becalms
became
because
Bechtel
beck
Becker
Beckman
beckon
beckoned
beckoning
beckons
Becky
become
becomes
becoming
becomingly
bed
bedazzle
bedazzled
bedazzlement
bedazzles
bedazzling
bedbug
bedbugs
bedded
bedder
bedders
bedding
bedevil
bedeviled
bedeviling
bedevils
bedfast
Bedford
bedlam
bedpost
bedposts
bedraggle
bedraggled
bedridden
bedrock
bedroom
bedrooms
beds
bedside
bedspread
bedspreads
bedspring
bedsprings
bedstead
bedsteads
bedtime
bee
Beebe
beech
Beecham
beechen
beecher
beef
beefed
beefer
beefers
beefing
beefs
beefsteak
beefy
beehive
beehives
been
beep
beeps
beer
beers
bees
beet
Beethoven
beetle
beetled
beetles
beetling
beets
befall
befallen
befalling
befalls
befell
befit
befits
befitted
befitting
befog
befogged
befogging
before
beforehand
befoul
befouled
befouling
befouls
befriend
befriended
befriending
befriends
befuddle
befuddled
befuddles
befuddling
beg
began
beget
begets
begetting
beggar
beggarly
beggars
beggary
begged
begging
begin
beginner
beginners
beginning
beginnings
begins
begot
begotten
begrudge
begrudged
begrudges
begrudging
begrudgingly
begs
beguile
beguiled
beguiles
beguiling
begun
behalf
behave
behaved
behaves
behaving
behavior
behavioral
behaviorally
behaviorism
behavioristic
behaviors
behead
beheading
beheld
behemoth
behemoths
behest
behind
behold
beholden
beholder
beholders
beholding
beholds
behoove
behooves
beige
Beijing
being
beings
Beirut
Bela
belabor
belabored
belaboring
belabors
belated
belatedly
belay
belayed
belaying
belays
belch
belched
belches
belching
Belfast
belfries
belfry
Belgian
Belgians
Belgium
Belgrade
belie
belied
belief
beliefs
belies
believable
believably
believe
believed
believer
believers
believes
believing
belittle
belittled
belittles
belittling
Belize
bell
Bella
Bellamy
Bellatrix
bellboy
bellboys
belle
belles
Belleville
bellhop
bellhops
bellicose
bellicosity
bellies
belligerence
belligerent
belligerently
belligerents
Bellingham
Bellini
bellman
bellmen
Bellovin
bellow
bellowed
bellowing
bellows
bells
bellum
bellwether
bellwethers
Bellwood
belly
bellyache
-bellyfull
+bellyful
Belmont
Beloit
belong
belonged
belonging
belongings
belongs
beloved
below
Belshazzar
belt
belted
belting
Belton
belts
Beltsville
Belushi
bely
belying
bemoan
bemoaned
bemoaning
bemoans
Ben
Benares
bench
benched
benches
benchmark
benchmarking
benchmarks
bend
bendable
Bender
benders
bending
Bendix
bends
beneath
Benedict
Benedictine
benediction
benedictions
Benedikt
benefactor
benefactors
beneficence
beneficences
beneficent
beneficial
beneficially
beneficiaries
beneficiary
benefit
benefited
benefiting
benefits
benefitted
benefitting
Benelux
benevolence
benevolent
Bengal
Bengali
benighted
benign
benignly
Benjamin
Bennett
Bennington
Benny
Benson
bent
Bentham
Bentley
Bentleys
Benton
Benz
Benzedrine
benzene
Beograd
Beowulf
bequeath
bequeathal
bequeathed
bequeathing
bequeaths
bequest
bequests
berate
berated
berates
berating
Berea
bereave
bereaved
bereavement
bereavements
bereaves
bereaving
bereft
Berenices
Beresford
beret
berets
Bergen
Bergland
Berglund
Bergman
Bergson
Bergsten
Bergstrom
beribboned
beriberi
Beringer
Berkeley
berkelium
Berkowitz
Berkshire
Berkshires
Berlin
Berliner
Berliners
Berlinize
Berlinizes
Berlioz
Berlitz
Berman
Bermuda
Bern
Bernadine
Bernard
Bernardine
Bernardino
Bernardo
berne
Bernet
Bernhard
Bernice
Bernie
Berniece
Bernini
Bernoulli
Bernstein
Berra
berries
berry
berserk
Bert
berth
Bertha
berths
Bertie
Bertram
Bertrand
Berwick
beryl
beryllium
beseech
beseeches
beseeching
beset
besets
besetting
beside
besides
besiege
besieged
besieger
besiegers
besieging
besmirch
besmirched
besmirches
besmirching
besotted
besotter
besotting
besought
bespeak
bespeaks
bespectacled
bespoke
Bess
Bessel
Bessemer
Bessemerize
Bessemerizes
Bessie
best
bested
bestial
besting
bestir
bestirring
bestow
bestowal
bestowed
bests
bestseller
bestsellers
bestselling
bet
beta
betatron
betel
Betelgeuse
Bethesda
Bethlehem
betide
betray
betrayal
betrayed
betrayer
betraying
betrays
betroth
betrothal
betrothed
bets
Betsey
Betsy
Bette
better
bettered
bettering
betterment
betterments
betters
Betties
betting
Betty
between
betwixt
bevel
beveled
beveling
bevels
beverage
beverages
Beverly
bevy
bewail
bewailed
bewailing
bewails
beware
bewhiskered
bewilder
bewildered
bewildering
bewilderingly
bewilderment
bewilders
bewitch
bewitched
bewitches
bewitching
beyond
Bhagavad-Gita
Bhutan
Bialystok
Bianco
biannual
bias
biased
biases
biasing
bib
bibbed
bibbing
Bible
bibles
biblical
biblically
bibliographic
bibliographical
bibliographies
bibliography
bibliophile
bibs
bicameral
bicarbonate
bicentennial
bicep
biceps
bicker
bickered
bickering
bickers
biconcave
biconnected
biconvex
bicycle
bicycled
bicycler
bicyclers
bicycles
bicycling
bid
biddable
bidden
bidder
bidders
biddies
bidding
Biddle
biddy
bide
bidirectional
bids
Bien
biennial
biennium
Bienville
bier
Bierce
bifocal
bifocals
bifurcate
big
Bigelow
bigger
biggest
Biggs
bight
bights
bigness
bigot
bigoted
bigotry
bigots
biharmonic
bijection
bijections
bijective
bijectively
bike
bikes
biking
bikini
bikinis
bilabial
bilateral
bilaterally
Bilbao
Bilbo
bile
bilge
bilges
bilinear
bilingual
bilk
bilked
bilking
bilks
bill
billboard
billboards
billed
biller
billers
billet
billeted
billeting
billets
billiard
billiards
Billie
Billiken
Billikens
billing
Billings
billion
billions
billionth
billow
billowed
billows
bills
Biltmore
bimetallic
bimetallism
Bimini
bimodal
bimolecular
bimonthlies
bimonthly
bin
binaries
binary
binaural
bind
binder
binders
binding
bindings
binds
bing
binge
binges
Bingham
Binghamton
bingo
Bini
binocular
binoculars
binomial
bins
binuclear
biochemical
biochemist
biochemistry
biofeedback
biographer
biographers
biographic
biographical
biographically
biographies
biography
biological
biologically
biologist
biologists
biology
biomedical
biomedicine
biophysical
biophysicist
biophysics
biopsies
biopsy
bioscience
biosphere
biostatistic
biosynthesize
biota
biotic
bipartisan
bipartite
biped
bipeds
biplane
biplanes
bipolar
biracial
birch
birchen
birches
bird
birdbath
birdbaths
birdie
birdied
birdies
birdlike
birds
birefringence
birefringent
Birgit
Birmingham
Birminghamize
Birminghamizes
birth
birthday
birthdays
birthed
birthplace
birthplaces
birthright
birthrights
births
Biscayne
biscuit
biscuits
bisect
bisected
bisecting
bisection
bisections
bisector
bisectors
bisects
bishop
bishops
Bismarck
Bismark
bismuth
bison
bisons
bisque
bisques
Bissau
bistable
bistate
bit
bitch
bitches
bite
biter
biters
bites
biting
bitingly
bitmap
BITNET
bits
bitten
bitter
bitterer
bitterest
bitterly
bitterness
bitternut
bitterroot
bitters
bittersweet
bitumen
bituminous
bitwise
bivalve
bivalves
bivariate
bivouac
bivouacs
biweekly
bizarre
Bizet
blab
blabbed
blabbermouth
blabbermouths
blabbing
blabs
black
blackberries
blackberry
blackbird
blackbirds
blackboard
blackboards
Blackburn
blacked
blacken
blackened
blackening
blackens
blacker
blackest
Blackfeet
Blackfoot
Blackfoots
blacking
blackjack
blackjacks
blacklist
blacklisted
blacklisting
blacklists
blackly
blackmail
blackmailed
blackmailer
blackmailers
blackmailing
blackmails
Blackman
Blackmer
blackness
blackout
blackouts
blacks
blacksmith
blacksmiths
Blackstone
Blackwell
Blackwells
bladder
bladders
blade
blades
Blaine
Blair
Blake
Blakey
blamable
blame
blamed
blameless
blamelessness
blamer
blamers
blames
blameworthy
blaming
blanch
Blanchard
Blanche
blanched
blanches
blanching
bland
blandly
blandness
blank
blanked
blanker
blankest
blanket
blanketed
blanketer
blanketers
blanketing
blankets
blanking
blankly
blankness
blanks
Blanton
blare
blared
blares
blaring
blase
blaspheme
blasphemed
blasphemes
blasphemies
blaspheming
blasphemous
blasphemously
blasphemousness
blasphemy
blast
blasted
blaster
blasters
blasting
blasts
blatant
blatantly
Blatz
blaze
blazed
blazer
blazers
blazes
blazing
bleach
bleached
bleacher
bleachers
bleaches
bleaching
bleak
bleaker
bleakly
bleakness
blear
bleary
bleat
bleating
bleats
bled
bleed
bleeder
bleeding
bleedings
bleeds
Bleeker
blemish
blemishes
blend
blended
blender
blending
blends
Blenheim
bless
blessed
blessing
blessings
blew
blight
blighted
blimp
blimps
blind
blinded
blinder
blinders
blindfold
blindfolded
blindfolding
blindfolds
blinding
blindingly
blindly
blindness
blinds
blink
blinked
blinker
blinkers
blinking
blinks
Blinn
blip
blips
bliss
blissful
blissfully
blister
blistered
blistering
blisters
blithe
blithely
blitz
blitzes
blitzkrieg
blizzard
blizzards
bloat
bloated
bloater
bloating
bloats
blob
blobs
bloc
Bloch
block
blockade
blockaded
blockades
blockading
blockage
blockages
blocked
blocker
blockers
blockhouse
blockhouses
blocking
blocks
blocs
bloke
blokes
Blomberg
Blomquist
blond
blonde
blondes
blonds
blood
bloodbath
blooded
bloodhound
bloodhounds
bloodied
bloodiest
bloodless
bloods
bloodshed
bloodshot
bloodstain
diff --git a/help/opie-sh/node3.html b/help/opie-sh/node3.html
index 8d16696..f3f1e73 100644
--- a/help/opie-sh/node3.html
+++ b/help/opie-sh/node3.html
@@ -1,71 +1,71 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<!--Converted with LaTeX2HTML 2002-1 (1.68)
original version by: Nikos Drakos, CBLU, University of Leeds
* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan
* with significant contributions from:
Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
<HTML>
<HEAD>
<TITLE>What it is for</TITLE>
<META NAME="description" CONTENT="What it is for">
<META NAME="keywords" CONTENT="opie-sh-howto">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="LaTeX2HTML v2002-1">
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
<LINK REL="STYLESHEET" HREF="opie-sh-howto.css">
<LINK REL="next" HREF="node4.html">
<LINK REL="previous" HREF="node2.html">
<LINK REL="up" HREF="node2.html">
<LINK REL="next" HREF="node4.html">
</HEAD>
<BODY >
<!--Navigation Panel-->
<A NAME="tex2html71"
HREF="node4.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
SRC="file:/usr/local/share/lib/latex2html/icons/next.gif"></A>
<A NAME="tex2html67"
HREF="node2.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
SRC="file:/usr/local/share/lib/latex2html/icons/up.gif"></A>
<A NAME="tex2html61"
HREF="node2.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
SRC="file:/usr/local/share/lib/latex2html/icons/prev.gif"></A>
<A NAME="tex2html69"
HREF="node1.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents"
SRC="file:/usr/local/share/lib/latex2html/icons/contents.gif"></A>
<BR>
<B> Next:</B> <A NAME="tex2html72"
HREF="node4.html">What it can do</A>
<B> Up:</B> <A NAME="tex2html68"
HREF="node2.html">Introduction</A>
<B> Previous:</B> <A NAME="tex2html62"
HREF="node2.html">Introduction</A>
&nbsp <B> <A NAME="tex2html70"
HREF="node1.html">Contents</A></B>
<BR>
<BR>
<!--End of Navigation Panel-->
<H2><A NAME="SECTION00021000000000000000">
What it is for</A>
</H2>
-Opie-sh is designed to be a frontend to Opie that can be used from the console. This is especially usefull for creating interactive shell scripts, as it will use the Opie interface (which is presumably familiar to the user) instead of a text based interface (which can be confusing). It can also be convinient for prototyping an app that you want to write for Opie without actually bothering to break out the cross compiler. Opie-sh does not use an Opie specific libs, so you can just as easily use it with Qtopia.
+Opie-sh is designed to be a frontend to Opie that can be used from the console. This is especially useful for creating interactive shell scripts, as it will use the Opie interface (which is presumably familiar to the user) instead of a text based interface (which can be confusing). It can also be convinient for prototyping an app that you want to write for Opie without actually bothering to break out the cross compiler. Opie-sh does not use an Opie specific libs, so you can just as easily use it with Qtopia.
<P>
<BR><HR>
<ADDRESS>
2002-05-15
</ADDRESS>
</BODY>
</HTML>
diff --git a/help/opie-sh/node9.html b/help/opie-sh/node9.html
index b047cf9..e4358ad 100644
--- a/help/opie-sh/node9.html
+++ b/help/opie-sh/node9.html
@@ -1,121 +1,121 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<!--Converted with LaTeX2HTML 2002-1 (1.68)
original version by: Nikos Drakos, CBLU, University of Leeds
* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan
* with significant contributions from:
Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
<HTML>
<HEAD>
<TITLE>Icons</TITLE>
<META NAME="description" CONTENT="Icons">
<META NAME="keywords" CONTENT="opie-sh-howto">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="LaTeX2HTML v2002-1">
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
<LINK REL="STYLESHEET" HREF="opie-sh-howto.css">
<LINK REL="previous" HREF="node8.html">
<LINK REL="up" HREF="node6.html">
<LINK REL="next" HREF="node10.html">
</HEAD>
<BODY >
<!--Navigation Panel-->
<A NAME="tex2html144"
HREF="node10.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
SRC="file:/usr/local/share/lib/latex2html/icons/next.gif"></A>
<A NAME="tex2html140"
HREF="node6.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
SRC="file:/usr/local/share/lib/latex2html/icons/up.gif"></A>
<A NAME="tex2html136"
HREF="node8.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
SRC="file:/usr/local/share/lib/latex2html/icons/prev.gif"></A>
<A NAME="tex2html142"
HREF="node1.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents"
SRC="file:/usr/local/share/lib/latex2html/icons/contents.gif"></A>
<BR>
<B> Next:</B> <A NAME="tex2html145"
HREF="node10.html">Fileviewer</A>
<B> Up:</B> <A NAME="tex2html141"
HREF="node6.html">Usage</A>
<B> Previous:</B> <A NAME="tex2html137"
HREF="node8.html">Buttons</A>
&nbsp <B> <A NAME="tex2html143"
HREF="node1.html">Contents</A></B>
<BR>
<BR>
<!--End of Navigation Panel-->
<H3><A NAME="SECTION00031300000000000000">
Icons</A>
</H3>
There are three icons that you can display with a message box: information, warning, and error. These are designed to help inform the user what type of message you are giving them.
<P>
An information icon is specified with the ``-I'' flag, and should be used for outputing non-critical information to the user, or asking them a simple question. It is also the default icon, and will be used if you do not specify another one. Example:
<P>
<PRE>
opie-sh -m -I
</PRE>
<P>
-A warning icon is specified with the ``-w'' flag, and should be used for problems that the user should know about, but that will not necessarily cause the program to stop working. For example, if the program cannot find a configureation file, you might pop up a warning, notifying the user that the default configuration will be used. This is also usefull for asking the user if they want to continue doing something that might damage the system (editing rc scripts, for instance). Example:
+A warning icon is specified with the ``-w'' flag, and should be used for problems that the user should know about, but that will not necessarily cause the program to stop working. For example, if the program cannot find a configureation file, you might pop up a warning, notifying the user that the default configuration will be used. This is also useful for asking the user if they want to continue doing something that might damage the system (editing rc scripts, for instance). Example:
<P>
<PRE>
opie-sh -m -w
</PRE>
<P>
An error icon is specified with the ``-e'' flag, and should be used for problems that will cause the program to stop running, or otherwise do the wrong thing. It should be used sparingly, as it signifies that something is seriously wrong. Example:
<P>
<PRE>
opie-sh -m -e
</PRE>
<P>
<HR>
<!--Navigation Panel-->
<A NAME="tex2html144"
HREF="node10.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
SRC="file:/usr/local/share/lib/latex2html/icons/next.gif"></A>
<A NAME="tex2html140"
HREF="node6.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
SRC="file:/usr/local/share/lib/latex2html/icons/up.gif"></A>
<A NAME="tex2html136"
HREF="node8.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
SRC="file:/usr/local/share/lib/latex2html/icons/prev.gif"></A>
<A NAME="tex2html142"
HREF="node1.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents"
SRC="file:/usr/local/share/lib/latex2html/icons/contents.gif"></A>
<BR>
<B> Next:</B> <A NAME="tex2html145"
HREF="node10.html">Fileviewer</A>
<B> Up:</B> <A NAME="tex2html141"
HREF="node6.html">Usage</A>
<B> Previous:</B> <A NAME="tex2html137"
HREF="node8.html">Buttons</A>
&nbsp <B> <A NAME="tex2html143"
HREF="node1.html">Contents</A></B>
<!--End of Navigation Panel-->
<ADDRESS>
2002-05-15
</ADDRESS>
</BODY>
</HTML>
diff --git a/noncore/apps/odict/eng_ita.dic b/noncore/apps/odict/eng_ita.dic
index f338faa..6db2389 100644
--- a/noncore/apps/odict/eng_ita.dic
+++ b/noncore/apps/odict/eng_ita.dic
@@ -9835,1537 +9835,1536 @@ ruination\distruzione
ruined\distrussi
rule\prescrizione, norma, dominio, regnare, criterio
ruler\regolo, regolatore, sovrano
rules\regolare, dominato
rumble\rumoreggiare
ruminative\pensieroso
rumor\vociferare
rumour\fama
rump\torso
rumpus\sommossa
run\esercitare, circolare, affiuenza, fuga, correre
run away\scappare
run over\travolto
runaround\schivare
rundown\decorrere, spiegazione
rung\suonato, gradino
runner\corridore
running\decollare, corro, corre
running start\abbrivo
runt\nano
runts\nani
runty\minuscolo
rupee\rupia
rupture\frantumare, frattura
rupturing\lacerante
rural\villereccio
ruse\pizzicotto
rush\affiuenza, furia, spingere, smaniare, pigiare
rush mat\stuoia
rush order\commissione urgente
rusk\biscotto
Russia\Russia
Russian\Russo
rust\arrugginire, griglia
rusted\arrugginito, arrugginito
rustic\rurale, semplice, villereccio
rustily\rugginoso
rusting\arrugginire
rustle\crepitìo, rubare
rustled\acciaio
rustles\ruba
rustless\inossidabile
rustproof\inossidabile
rusts\arrugginito
rusty\rugginoso
rutabaga\navone
ruth\compassione
rye\segale
sabdwich\pane imburrato
sable\zibellino
sables\zibellino
sabot\zoccolo
sabotage\sabotaggio, sabotare
sabre\sciabola
sac\sacchetto
saccharated\zuccherino
sack\licenziare, buttare fuori, sacco
sackful\sacco
sackfuls\sacco, sacchi
sacred\santo
sacredly\santa
sacredness\santità
sacrifice\sacrificio, sacrificare
sacrilege\sacrilegio
sacrileges\sacrilegio
sacrilegious\scellerato
sacristan\sagrestano
sacs\sacchetto
sad\afflitto, lugubre
saddle\sella
saddle fast\saldo in sella
saddler\sellaio
saddles\sella
sadism\sadismo
sadly\lugubre
sadness\tristezza
safe\sicuramente
safe keeping\preservamento
safeguard\valvola
safeguarded\assicurai
safeguards\assicurato
safekeeping\preservamento
safely\sicuramente
safeness\fidatezza, sicurezza
safety\sicurezza
safety belt\cintura di sicurezza
safety lock\antifurto
saffron\zafferano
sag\depressione
sagacious\saggio
sagaciously\furba
sagaciousness\saggezza
sage\salvia
sageness\saggezza
sagittarius\tiratore
sail\veleggiare
sailer\veliero
sailing\veleggiare
sailing boat\barca a vela
sailing ship\nave a vela
sailor\navigatore, marinaio
sails\veleggiare, vela
saint\santa
sainthood\santuario
saintliness\santità
saints\santificare
salacious\lussurioso
salaciousness\voluttà
salad\insalata
salads\insalate
salary\stipendio
sale\registro, véndita
saleable\esitabile
sales clerk\venditore
sales price\prezzo di vendita
sales terms\condizioni di vendita
salesgirl\venditrice
salesman\venditore
saline\salina
saliva\saliva, raggio
salivary\glàndola salivale
salivary gland\glàndola salivale
sallow\pallido, pallido, scolorato
sallowness\pallore
salmon\salmone
salon\salotto, negozio da parrucchiere
saloon\bètvola
salt\sale
salt water\acqua salsa
saltily\salato
saltpeter\nitro
salts\sali, salare
saltwater\acqua salsa
salty\salato
salubriously\sana
salute\salutare
salvages\salva
salvation\salvataggio
salver\vassoio
salves\unguentare
same\pari
sammy\pasta
sample\prova, esemplare
sanatorium\casa di salute
sanctify\santificare
sanctimonious\ipocrita
sanctity\santità
sanctuary\santuario
sand\sabbia
sand bank\banco di sabbia
sand glass\clessidra
sand paper\carta smeriglio
sand pit\cava di sabbia
sandal\sandalo
sandpaper\carta vetrata
sandstorm\tempesta di sabbia
sandy\arenoso
sane\sano di mente
sanguinary\crudele
sanguineous\insanguinato
sanitarium\luogo climatico
sanitary\igiènico
sanitary towel\fascia assorbente
sanitation\risanamento
sanity\ragione
sap\succo
saphire\zaffiro
sapience\saggezza
sapless\scipito
sapphire\zaffiro
sappy\succoso
sartorial\sarto
sash\ciarpa
sash window\finestra scorrevole
sashayed\scivolai
sashays\scivolo
sassed\inveii
sasses\inveisce
sassiness\impertinenza
sassy\insolente, sfacciato
sat\sedei
sateen\raso
satellite\satellite
satiable\saziante
satiably\saziante
satiate\saziare
satiated\saziato
satiating\saziante
satiation\satollamento
satiety\sazietà
satin\raso
satirize\canzonare
satisfaction\contentezza, soddisfazione
satisfactory\soddisfacente
satisfiable\soddisfacente
satisfied\soddisfatto
satisfies\accontentato
satisfy\accontentare
sattelite\satellite
saturate\saziare
saturating\saziante
saturation\satollamento
Saturday\sabato
saturday\sabato
saturnine\fosco
sauce\guazzetto
saucepan\pentola
saucer\sottocoppa
saucer eyed\occhioni
saucily\insolente
sauciness\esosità
saucy\sfacciato, gioielli, saccente
sauna\sauna
saunter\gironzolare
sausage\salsiccia, salsiccia arrosto
sausages\salsicce
savable\durevole
savage\crudele
savannah\savana
save\salvare, assicurare, serbare, risparmiare
saved\sicuro
saver\risparmiatore
savers\risparmiatore
saving\immagazzinare
savings\libretto di risparmio, risparmio
savings account\conto di risparmio
savings bank\cassa di risparmio
savior\Redentore
savor\degnare, gustare, usufruire
savored\godei
savors\godi
savour\costare, usufruire
savoy\verza
savvied\giudizio
savvier\più furbo
savvies\comprende
saw\segare, sega
sawed\segato
sawn\segato
saws\segare
sax\sassofono
saxon\sassone
saxophone\sassofono
say goodbye\promulgare, licenziarsi
say thank you\ringraziare
sayings\detti
scabies\scabbia
scabiesious\rognoso
scaffold\patibolo
scaffolding\intelaiatura, base
scale\criterio, squama, piatto della bilancia
scales\hangar
scandal\scandalo
scans\esamina
scant\scarso
scantily\scarso
scantiness\spilorceria
scantness\strettezza
scanty\scarso, scarso
scapegoat\espiatorio
scapula\scapola
scapular\spalla
scar\strato erboso
scarce\raro, scarso, raro
scarce goods\scarseggiante
scarcely\paggio, appena
scarcity\strettezza
scare\spaventi
scarf\scialle, fazzoletto da collo
scarify\scalfire
scariness\spavento
scarlet\scarlattina
scarped\dirupato
scary\angoscioso
scathe\affronto
scathing\offensivo
scavenging\lustrale
sceened\riparato
scenario\copione
scene\scena, scena, tribuna, svolgimento
scenery\ornamento
scenic\del paesaggio
scent\sostanza odorosa, odore
scented\subdorato
scepticism\scetticismo
scewed\avvitato
schedele\ordito
schedule\tabella, registro
schema\schema
schematic\schematico
schematically\schematico
scheme\disegno, schema
schist\ardesia
schists\ardesia
schlep\trascinare
schnapps\acquavite
schnooks\idioti
scholarliness\erudizione
scholarly\erudito
scholarship\erudizione, borsa di studio
school\scuola
school day friend\amico della gioventù
school leaving examination\maturità classica
school year\anno scolastico
schoolhouses\istruire
schooling\istruzione
schoolmate\amico scolastico
schools\istruire
sciatic\sciatica
sciatica\sciatica
science\scienza
scientific\scientifico
scientifical\scientifico
scientist\scienziato
scintillate\fiammeggiare
scintillating\lampante
scission\fenditura
scissors\forbice
scoff\scherno
scoffer\beffatore
scold\inveire, sgridare
scoop\mestola, attìngere
scoopful\badile
scoot\mozzare
scooter\motoretta
scope\orbita, portata
scopes\zone
scorch\bruciare
scorched\arsi
scorcher\senzazione
scorches\arde
scorching\cocente
score\sparare, partitura
scorers\proteggere
scorn\disprezzare, vilipendi, scherno
scornful\beffardo, sprezzante
scornfulness\vilipendi
scorns\disprezzato
scorpion\scorpione
scorpios\scorpioni
Scot\Scozzese
scot\paratia
Scotland\Scozia
Scotsman\Scozzese
scoundrel\furfante, mascalzone
scour\vagare
scourge\frustare
scouring\vagabondo
scout\ricognitore
scoutmaster\guida
scow\più leggero
scrabble\strisciare
scragg\scheletro
scram\mozzare
scrambled\uovo strapazzato
scrambling\rampicante
scrap\ferraglia
scrape\raschiare, graffiare
scrape off\grattare
scraper\scarafaggio
scrapers\raschiare
scratch\graffio, verniciare, graffiare, scalfire
scratch oneself\graffiare
scratched\grattato
scrawniest\piccolissimo
scrawny\snello
scream\gridare
screamed\gridai
screaming\urlante
screams\grida
scree\pietrisco
screech\stridere
screeching\stridente
screen\schermo, reticolo, schermo
screened\riparato
screenplay\copione
screw driver\cacciavite
screwball\mattoide
screwdriver\cacciavite
screwiness\pazzia
screws\avvitato
screwy\pazzo
scribal error\errore ortografico
scribe\scalfire
scribed\scrivei
scribing\scalfire
script\copione
scripture\documento
scroll\sfogliare
scrolls\spostare
scrounge\scroccare
scroungers\ladri
scrub\strofinare, strofinare
scrubbed\strofinato
scrubber\spazzola
scruff\sporco
scruffiness\sudiciume
scruple\scupolo
scruples\scupolo
scrupulous\diffidgnte
scruter\esplorare
scrutinize\assaggiare
scrutinized\esaminai
scrutinizes\esamina
scud\volare
scuff\logorio
scuffproof\indistruttibile
sculler\vogatore
scullers\vogatore
sculpt\formare
sculpting\formante
sculptor\scultore
sculptors\scultore
scurf\crosta
scurvier\infame
scurvily\infame
scuttle\rovinare
se\ipotesi
sea\navale, mare
seaboard\riviera
seacoasts\littoraneo
seafarer\navigatore
seagull\gabbiano
seal\siggillare, sigillo, foca, guarnizione
sealing gasket\guarnizione
seals\strisciare, foche
seam\vivagno, scanalatura
seaman\marinaio
seamen\marinai
seamstress\cucitrice
sear\abbronzare
search\cerco, indagare
searcher\cercatore
searches\mania
searchingly\verdastro
sears\arsiccio
seas\mari
seashell\coccia
seasick\malato di mare
seaside\riviera, costa
seaside resort\stazione balneare, località balneare
season\stagione, stagione, aromatizzare
seasonable\stagionale
seasonal surcharge\aumento stagionale
seasoned\maturo
seasoning\condimento
seasonings\aromatizzare
seat\seggio
seaweed\alga
second\secondo
secondary\accidentale, secondario
secret\riservato, segreto, segreto
secretariat\segretariato
secretary\segretaria, segretario
secretion\eliminazione
secrets\segreti
sect\setta
section\taglio
sector\settore, area
security\sicurezza
seduce\sedurre
seduction\seduzione
seductress\seduttrice
sedulous\assiduo
see\vedere, visitare
seed\germe, seme, seme
seek\cercare, cerco
seer\profeta
seize\confiscare, prendere, impaccare, acchiappare
seldom\raramente
select\selezionare
selection\selezione, eletta
self acting\automàtico
self confidence\fiducia in sê
sell out\esaurire
semi\mezzo
semi automatical\semiautomatico
semicolon\punto e virgola
senate\senato, consiglio federale
send\mando, mandare
sender\mittente
senior\superiore
sensation\sensazione
sense\levatura, accezione
senselessly\senza senso
senses\giudizio
sensible\ragionevole, ragionevole
sensitive\sensibile, sensibile
sensitivity\sensibilità
sensual\sensuale
sensuality\sensualità
sensuously\libidine
sentence\punizione, condannare, frase
sentiments\emozioni
sentinels\custodito
separate\separato, separato, separare
separating\singola
September\settembre
sequence\successione
serendipity\scoperta
serene\sereno
serenity\ilarità
serializing\ordinatore
serials\in fila
series\seria
series of reactions\reazione a catena
serious\pesante, serio, grave
seriously\serio, serio
serpent\serpente
serpentine\contorto
servant\domèstica, famulo
serve\servire, servire, servire
service\attèndere, servizio, funzione, manutenzione
service station\distributore di benzina
serviceman\soldato
serving\porzione
session\seduta
set\assortimento, stabilito, mettere, apparecchio
set up\allineare, sè, fondare
setting\naufragio, missione
setting up\succursale
settle\fissare, liquidare
settlement\accordo
seven\sette
seventeen\diciassette, diciasette
seventieth\settantesimo
seventy\settanta
several\alquanti, parecchi
several times\talvolta
severe\severo
sew\cucire
sewage\acqua di scarico
sewing\saldatura
sex\sesso
sexual\storico
shack\capanna
shade\ombra, tinta
shadow\ombrosità, ombra
shadowy\incerto
shake\scuotere
shale\sasso
shall\dovere
shallop\scialuppa
sham\simulare
shame\pudore, disonore
shape\formare, formare, forma
share\partecipazione, spartire, parte
shareholder\azionista
shark\pescecane
sharp\nitido, acuto, stridulo, elevato
sharp witted\perspicace
sharpen\acuire, trascinare
she\lei
sheaf\covone
shears\forbice
sheath\involucro
shed\granaio, hangar
sheep\pecora
sheepherders\pecoraio
sheerly\solamente
sheet\lenzuolo, falda, foglia
sheet metal\latta, lamiera
shelf\scaffale
shell\conchiglia, proiettile
shelter\protezione, riparare, ricovero, riparo, rifugio
shepherd\pecoraio
shift\muovere
shifting\trasferimento
shine\splendere, brillare
shiners\far lume
shining\brillante, fulgente
ship\vascello, spedire, trasportare
shipboy\mozzo
shipes\navi
shipment\spedizione
shirt\camicia
shit\merda
shiver\aver dei brividi
shock\scandalizzare, crollo
shock absorber\ammortizzatore
shoe\scarpa
shoot\sparare
shooting\sparare
shop\impresa
shop-window\vetrina
shop assistant\venditore
shop operation\fase di lavorazione
shopping\comperare, compera
shopping street\via dei negozi
shore\sponda, costa
short\breve
short-sighted\miope
short-term\sollecito
short circuit\corto circuito
shortage\strettezza, difetto
shorten\abbreviare
shortfall\deficit
shortly\prossimamente
shot\sparo
shoulder\spalla
shout\esclamare, gridare, grido
shovel\vanga, badile
show\indicare, espongo, messa
shower\doccia, rovescio
shrill\elevato, stridulo
shrimp\granchiolino
shrink\restringere
shrub\arbusto
shut\chiudere
shutout\esclusivo
shutter\imposta
shy\timido, timido
sick\egro, malato
sick person\malata
sickle\falce
sickness\malattia
side\lato
sideboard\armadio
sides\laterale
sideshow\questione secondaria
sidewards\a lato
siege\assedio
sieve\cola
sieved\settimo
sifter\cola
sigh\sospirare
sight\cosa notevole, aspetto
sightless\cieco
sightlessly\cieca
sightliness\cospicuità
sightseeing\curioso, ispezione
sightseer\escursionista
sign\affisso, scudo, firmare, simbolo
sign over\volturare, volturare
signal\segnale
signaling\denunciante
signalize\segnalare
signatories\firmatario
signature\firma
signed\marcato
signer\firmatario
signets\sigillo
significant\importante
signification\accezione, levatura
signify\volere dire
signifying\importante
signor\signore
signora\signora
signoras\donne
signorina\signorina
signors\signori
signpost\segnavia, scudo
signposts\insegne
signs\simbolo
signs and symbols\leggenda
silence\calma, tacere, ristoro
silencer\silenziatore
silences\tace
silent\sommesso, muto, calma, equilibrato, calmo
silently\calmo
silentness\calma
silicic\ciottolo
silk\seta
silkily\serico
silkiness\dolcezza
silks\di seta
silkworm\baco da seta
sill\soglia
silliness\ocaggine
silly\stolto, sciocco
silt\insabbiare
silver\argènteo, argento
similar\pari, consimile, simile
similarity\omogeneità
similarly\simile
simile\paragone
similitude\assomiglianza
simmer\bollore
simpatico\simpatico
simper\sciocco
simple\semplice
simple minded\ingenuo
simpleminded\semplice
simplemindedness\semplicità
simpleness\semplicità
simpletons\pennellare
simplicity\semplicità
simplification\semplificazione
simplify\semplificare
simply\semplice
simular\simile
simulate\simulare, simulare
simulated\artefatto
simultaneous\simultaneo
simultaneously\simultaneo
sin\peccato
since\da, da allora, perchè
since then\da allora
sincere\sincero
sincerely\umilissimo, sincera
sinful\peccaminoso
sing\cantare
singable\cantàbile
singer\cantante
singing\canto
singings\canti
single\nubile, singolo
single lane\a senso unico
single phase\monofase
single room\càmera sìngola
single ticket\biglietto sémplice
singled\divorziato
singly\singolo
sings\canta
singular\singolare
singularness\stranezza
sinister\nefasto
sink\abbassarsi, catinella, abbassarsi, lavello
sinking\affondamento
sinks\abbassa
sinned\peccato
sinner\peccatore
sins\peccati
sinuous\contorto
sip\sorso
sir\signore
sire\testimoniare
sirloin\lonza
sissy\effeminato
sister\sorella
sister in law\cognata
sit\star seduto
sit down\accomodarsi
site\posto, circostanza
site of crime\luogo del fatto
sits\siede
sitting\seduto
sitting room\salotto
situate\allineare, mettere, mettere
situated\posto
situation\situazione, posizione, circostanza
six\sei
sixfold\sestuplo
sixteen\sedici
sixteenth\sedicesimo, sedicesima
sixth\sesto, sesta
sixty\sessanta
size\grossezza
size of shoe\numero di scarpa
sizzle\grillare
skating\pattinaggio artistico
skating ring\pista di ghiaccio
skating rink\pista di ghiaccio
skein\capestro
skeins\capestri
skeleton\scheletro
skeletons\scheletri
skepticalness\scetticismo
skepticism\scetticismo
sketch\abbozzo, abbozzare
sketchily\volatile, abbozzaticcio, superficiale
sketchiness\poca chiarezza
sketchy\torbido
skews\storto
ski\sci
skid\discesa a valle, avventare
skiful\esperto
skilful\apprèndere, azzeccato
-skilfull\apprèndere
skill\sorte, disinvoltura
skilled\versato
skilled worker\operaio specializzato
skillet\tegame
skillful\lesto, sveglio, esperto
skillfulness\disinvoltura
skimp\lesinare
skimpiest\piccolissimo
skimpily\scarso
skimpiness\strettezza
skimpy\scarso
skin\epidèrmide, epidermide
skinny\scremato, magro, secco
skins\pelli, pelli
skip\saltellare, lancio
skipper\marinaio
skirt\gonna
skirting board\battiscopa
skit\satira
skittle\birillo
skittle alley\gioco dei birilli
skivvy\biancherìa ìntima
skulker\lima sorda
skunk\puzzola
sky\cielo
skylark\lodola
skyrocket\razzo
skyscraper\grattacielo, grattacielo
skyscrapers\grattacielo
slab\frantumare
slack\lasco, floscio
slack joint\contatto lasco
slack period\ristagno
slacken\rilassare, rilassare
slackens\rilassato
slacker\scansafatiche
slacks\pantaloni
slake\allattamento
slam\sbattere
slammed\sbattuto
slander\calunniare
slanderer\calunniatore
slanderous\calunnioso
slanderousness\calunnia
slant\declinazione
slanting\obliquo, obliquo
slantingly\obliqua
slap\picchiare, ceffone
slap in the face\ceffone
slaphappy\avventurato
slaps in the face\schiaffeggiare
slash\taglio
slat\picchiare
slate\ardesia, abusare
slatted\picchiai
slattern\donnaccia
slaughter\macellare
slaughter cattle\bestiame da macello
slaughter house\mattatoio
slaughtered\macellato
slaughterhouse\mattatoio
slave\schiava, schiavo
slave trader\negriere
slavered\sbavato
slavery\schiavitù
slay\uccidere
slayer\strangolatore, uccisore
slays\uccide
sleazily\sciatto
sleazy\untuoso
sleek\netto
sleekly\liscia
sleep\dormire, sonno, dormicchiare
sleeper\vagone letto
sleeping car\vagone letto
sleeping pill\sonnifero
sleepless\insonne
sleeplessness\insonnia
sleeps\dorme
sleeve\manica
sleight\disinvoltura
slender\esile, snello, snello
slice\tagliare, pezzo, fetta
sliced\taglio
slicing\tagliente
slick\brunire
slicker\imbroglione
slickness\disinvoltura
slide\spingere
slides\spinge
sliding roof\tetto scorrevole
sliding window\finestra scorrevole
slight\magro, scarso, oltraggiare, labkle
slightness\esiguità
slim\togliere, snello
slime\muco
sling\avventare
slingshot\fionda
slingshots\avventare
slink\strisciare
slinks\striscia
slip\scivolare, ordito, vizio
slip of paper\ordito
slipcover\involucro protettivo
slipper\pantofola, ciabatta
slippery\lubrico
slippy\agile
slipshod\sciatto
slipup\vizio
slithery\lubrico
slits\fessure
sliver\scheggiare
slob\donnaccia, balordo
slobber\poltiglia
slobbery\sdolcinato
slogs\bastonato
sloop\scialuppa
slope\discesa, pendio, pista
sloped\obliquo
sloping\obliquo
slopingly\obliquo
sloppiness\sciatteria
sloppy\sciatto
slosh\spruzzare
slot\fèndere
sloth\pigrizia
slothful\pigro
slothfulness\pigrizia
slouchily\strascicato
slouchy\strascicato
slow\fiacco, guardingo, lungo
slow down\tardare, allentare
slow match\miccia
slow motion\rallentatore
slow motion apparatur\rallentatore
slow worm\orbettino
slowdown\allentare
slower\più lento
slowly\placido, lungo, lenta
slowness\lentezza
slue\voltare
slug\picchiare, lumaca
sluggard\pigro
slugged\picchiai
sluice\cateratta, emanare
slum\catapecchia
slumber\dormicchiare, sopore
slumbered\pisolato
slumberous\assonnato
slumberously\assonnato
slump\crollo dei prezzi
slunk\strisciato
slur\calunniare
slush\neve bagnata
slut\donnaccia
sluttish\sciatto
sly\furbo
slyness\astuzia
slynesses\astuzia
smack\schioccare un bacio
small\piccolo, minuscolo
small blister\vescicola
small bottle\flacone
small box\cassettino
small car\vetturetta
small crumb\briciola
small house\casetta
small intestine\intestino
small letter\lettera minuscola
small parcel\pacchetto
small piece\pezzettino
small ship\navicella
small wheel\rotellina
smallpox\vaioloso
smart\furbo, stile
smartly\furbo
smartness\scaltrezza
smash\schiacciare
smashed\sfracellato
smashup\fallimento
smear\ingrassare
smeary\untuoso
smell\profumo, odorato, odoro
smelling\odorifero
smells\profuma, odora
smelly\muffaticcio
smelt\fusione
smelting\fondente
smile\sorridere
smile at\sorridere
smirkingly\leccato
smith\fabbro
smithereens\brandello
smithies\forgiare
smithy\fucina
smock\camice
smoke\fumo, fumare
smoked\fumato, affumicato
smoker\fumatore
smokers\fumatore
smokestack\fumaiuolo
smokily\fumoso
smoking\affumicare
smooch\pomiciare
smooth\levigare, netto
smoothed\lisciato
smoothly\equilibrato
smother\affogare
smudge\insudiciare
smudginess\lordura
smudgy\untuoso
smuggle\contrabbandare
smuggled\contrabbandato
smuggler\contrabbandiere
smuggling\contrabbando
smutty\fangoso
snack\spuntino
snag\nocchio
snaggy\nocchieruto
snail\chiocciola
snake\serpente
snake bite\morso di serpe
snake venom\veleno di serpente
snaky\perfido
snap\dipinto, accertare, accettazione
snapping\accertamento
snappish\dentellato
snaps\acchiappa
snare\accalappiare, tranello
snared\acchiappai
snares\acchiappa
snarl\ringhiare
snarling\ringhiante
snatched up\accogliticcio
sneak\strisciare
sneerer\beffatore
sneeze\starnutire
snicker\ridacchiare
snickering\ridacchiante
sniff\sbuffare
sniffy\sdegnoso, muffaticcio
snigger\ridacchiare, ghigno
snipe\beccaccia
sniper\bersagliere
snivel\singhiozzare
snobbish\borioso
snooper\ficcanaso
snoopy\curioso
snoozing\sonnecchiante
snore\russare
snort\sbuffare
snot\moccio
snottily\moccioso
snottiness\vigliaccheria
snotty\moccioso
snout\ceffo
snow\nevicare, neve
snow chains\catene da neve
snow covered\nevoso
snow flake\fiocco di neve
snow flurry\nevischio
snow plough\spazzaneve
snow storm\tempesta di neve
snow white\niveo
snowball\palla di neve
snowballing\accelerativo
snowcap\colibri
snowcapped\nevoso
snowfall\nevata
snowflake\fiocco di neve
snowily\nevoso
snowing\nevicare
snowman\pupazzo di neve
snowstorm\tempesta di neve
snowy\nevoso
snuff\raffreddore
snuffler\ficcanaso
snuggle\accarezzare
snugly\accogliente
so\orbene, cosi, cosiffatto
so far\finora
so long\arrivederci
soak\ammollare
soaker\sbevazzatore
soap\sapone
soap bubble\bolla di sapone
soaps\insaponare
soapstone\lardite
soar\esalare
soaring\ascendente
sob\singhiozzare
sober\digiuno
soberingly\realistico
soberly\digiuno
sobriquet\nomignolo
soccer\pallone
sociable\socievole
sociably\socievole
social\sociale, socievole
society\comitiva
sock\picchiare, calzetta
socked\picchiai
socket\legatura, presa di corrente
sofa\sofà
soft\placido, soffice, dolce
soft boiled\bazzotto
soft parts\parti molli
softies\imbecille
softly\soffice
softness\flessibilità, dolcezza
soggily\umido
sogginess\umidità
soggy\umido
soigne\coltivare
soil\terra, insudiciare, suolo
soils\insudiciato
sojourner\ospite
sojourners\ospiti
solace\consolare
solaces\consola
solar eclipse\eclissi solare
solar energy\energia solare
solar system\sistema solare
sold\vende
solder\ferruminare
solder joint\saldatura
solderable\saldabile
soldering iron\saldatoio
soldier\soldato
sole\solo, suola, sogliola
sole distributors\esclusività di spaccio
solemn\solenne
solemnity\solennità
solemnness\solennità
solenoid\bobina
solicitor\legale
solid\compatto, fisso, solido, attendìbile
solidness\fermezza
solitary\singolo, solo
soloist\solista
soluble\solubile
solution\dissoluzione
solve\sciogliere, chiarire
solvent\solvente
somber\fosco
some\qualche, alquanti, qualcosa, parecchio
somebody\qualcheduno, alcuno
someplace\in qualche luogo
somersault\salto
something\qualcosa, qualcosa
sometimes\talvolta
somewhere\in qualche luogo
son\figlio, figliuolo
son-in-law\gènero
sonata\sonata
song\canzone
soon\prossimamente
soothe\calmare
soothsayer\chiromante
sophomore\allievo
soprano\soprano
sorb\sorbo
sore throat\angina
sorenesses\dolere
sorrow\pena, fastidio
sorrowful\afflitto, disgraziato
sorry\scusa, afflitto, purtroppo
sort\fare, sorta, razza, assortire
sortie\perdita
sorties\perdite
sot\sbevazzatore
sound\sano, solido, suono, secondo, rumore, suono
sound-proof\isolamento acustico
soup\minestra
sour\acido
source\sorgente, origine, fonte
south\ostro, sud
southwester\libeccio
souvenir\ricordo
Soviet Union\unione Sovietica
sow\seminare
sown\seminato
sox\calzetta
spa\località balneare
space\spazio, buca
spaceship\veicolo spaziale
spacious\ampio
spade\vanga, badile
Spain\Spagna
spangle\fronzoli
Spaniard\Spagnuolo
spare\tempo libero
spare part\pezzo di ricambio
spark\trasmettere alla radio
sparkle\sfavillare
sparklers\diamanti
sparkling wine\spumante
sparrow\passero, astore
spasm\spasma
spatula\spatola
speak\discorrere, favellare
speak to\rivolgere la parola
speaker\altoparlante
speaking\parla
spear\lancia
special field\ramo di competenza
special language\linguaggio tecnico
special offer\offerta speciale
specialist\specialista, specialista
specialist shop\negozio specializzato
specialize\specializzare
species\fare
specimen\esemplare
spectacles\occhiali, lente
spectator\spettatore
spectators\spettatore
speech\idioma, orazione
speed\numero dei giri, volare, andatura, velocità
speed limit\limite di velocità
speed up\accelerare
spell\compitare
spend\emettere, passare, largire
sperm\sperma
spice\aromatizzare, spezie
spicule\spilla
spider\ragno
spiders\filare
spill\versamtento
spinach\spinaci, spinacci
spinner\mattoide
spirit\mente
spirit level\livella
spiritlessness\insulsaggine
spirits\acquavite
spit\spiedo, saliva
spite\nonostante, rancore
spitefulness\malignità
splendit\brillante
splendor\magnificenza
split\fèndere
spoil\viziare
spoils\bottino
spoke\raggio
spokeswoman\oratrice
sponge\spugna
spongy\spugnoso
spontaneous\spontaneo
spook\apparizione
spoon\cucchiaio
spoor\traccia
sports\sport
sports car\vettura sportiva
sports ground\campo sportivo
sports shirt\camicia sportiva
sportsman\sportivo
spot\posto, macchia
sprawl\espandersi
spray\raggio, nebulizzare
spread\espandersi, verniciare, spargere
spreads\allarghi
spring\piuma, sorgente, abbrivo, saltare, slancio, fonte
springiness\elasticità
springtime\primavera
spur\sprone
spurt\spruzzare
spy\spia
spying\spionaggio
squabblers\attaccabriche
square\quadrangolo, quadrato, quadro, spigoloso, piazza
square metre\metro quadrato
squash\succo
squeal\tradire
squeeze\premere
squid\calamaro
squint\strabico
squirrel\scoiattolo
squirt\spruzzare
stable\stanla, stalla
stable in value\di valore fisso
stadium\stadio
staff\personale, redazione
staffer\impiegato
stage\fase, tribuna, scena, piedistallo
staggers\oscilla
stain\macchia, insudiciare, imbrattare
staircase\scala
stairs\scala
stake\stanga, missione
stall\posizione, stalla
stamp\bollo, bollare, francobollo
stand\stare, granaio, continuare
standalone\indipendente
standing\in piedi
standing order\incarico permanente
staple\affissare
star\stella, vedette
stardom\vanto
starling\vedette
stars\stelle
start\esordire, decollare, principio, comincio, inizio
start up\decollare
starter\avviamento
state\esporre, posizione, asserzioni
statedly\stabilito
stately\prestante
statement\asserzione, estratto di conto, costatazione
statue\statua
stay\soggiorno
stay here\rimanere
stays\rimane, stà
steady\continuo, proporzionato
steak\bistecca
steal\sotrarre, rubare
steam\vapore
steamer\vapore
steamership\vapore
steel\acciao, acciaio
steelwork\acciaieria
steep\erto
steer\dirigere
steering wheel\volante
stem\tronco, sollevare
stench\lezzo
step\passo, procedere, gradino
step by step\graduale
stern\poppa
stewards\fattore
stewed fruit\composta
stick\incollare, bastone, ficcare
sticky\glutinoso
stiff\rigido
still\pari, però, calmo, ancora
stillborn\nato morto
stimulate\eccitare, esacerbare
sting\colpo, pungere
stingy\avareggiare
stink\puzzare, lezzo
stipulate\fissare
stir\muovere, commuòvere
stock\immagazzinare
Stock Exchange\borsellino
stockfish\baccalà
stocking\calza, calza maglia
stole\acciaio
stomach\ventricolo
stomp\beccheggiare
stone\sasso, pierra
stoniness\durezza
stool\sgabello
stop\ostruire, alt, fermare, fermarsi, fermata, finire
storage\immagazzinaggio, deposito, immagazzinamento
storage battery\accumulatore
store\immagazzinare, campeggio, immagazzinare
storefront\facciata
storing\accampato
stork\cicogna
storm\tempesta, burrasca
story\farsa, rapporto, fiaba, racconto, storia
storybook\libro di fiabe
stove\stufa
strabismus\strabico
straight\pari
straight away\subito
straighten out\drizzare
strain\aggravio, fatica
strait\stretto
strange\strano, caratteristico, straniero, estroso
strangling\strozzare
strap\cinghia
straw\paglia
strawbeery\fràgola
strawberry\fragola, fràgola
stream\corrente, ruscello
streamline\modernizzare
street\via, contrada
streets\strade
strengh\forza, potenza
strenght\forza
strength\forza, vigoria
strengthen\amplificare
stress\accentuare, accento
stretch\estendersi, stirato, espandere, stendere
stretcher\bara
strews\sparge
strict\severo
stride\passo
stridently\tagliente
strike\affìggere, sciopero, picchiare, scioperare
striked\scioperai
string\spago, cordicella
strip\lista, denudare, smontare
striped\zebrato
stroke\accarezzare, riga
stroll\passeggiare
strong\poderoso, benportante
strongest\fortissima
struggle\combattimento
student\studente
study\fare gli studi superiori
stuff\stoffa, materiale
stuffed\farcito
stuffing\otturazione
stuffs\inzeppa
stuffy\muffaticcio
stumble\incespicare
stumps\sbalordito
stun\assordare
stupefy\ottundere
stupefying\assordante
stupid\stupido, idiotico, balordo
stupid thing\ocaggine
stupide\stupido
stupidity\ocaggine
stupor\stupirsi
sturdy\valido
stutter\tartagliare
sty\stalla
style\taglio, eloquio
subject\oggetti, casella, assoggettato, soggetto, tema
subject matter\tema
subjected\assoggetai
subjects\assogetta
subjugating\vincente
sublime\elevato
submarine\sommergibile
submission\soggiogamento
submit\sottoporre, soggiogare
subscribe\abbonarsi
subscriber\partecipante, abbonato
subscription\abbonamento
subsidy\sovvenzione
subsist\esistere
subsribe\firmare
substance\sostanza
substandard\di valore scadente
substitute\facente funzione
substitution\indennizzo
subsume\prendere
subterfuge\scusa
subtle\astuto, perspicace
subtract\falcidiare
suburb\sobborgo
suburbia\borgo
subverts\rovinato
succeed\seguire, riuscire
success\successo
successful\correttamente
successfully\correttamente
successive\consecutivo
successor\seguace
succumb\soccombere
such\cosiffatto
such as\come
suck\succhiare, succhiare
suck in\aspirare, succhiare
suckle\allattare
suddenly\improvvisamente
suffer\soffrire, patire
suffering\soffrire
suffice\bastare
sufficiently\abbastanza
suffix\aggiunta
suffocate\affogare
suffocation\affogare
sugar\zucchero
sugar bowl\zuccheriera
suggestion\appoggiatura
suggestions\proposte
suicide\suicidio
suit\procedimento, vestito
suitable\appropriato
suitcase\valigia
suitor\pretendente
sulfurous\fervoroso
sulk\ammusare
sulkiness\capriccio
sum up\addizionare
summary\raccolta
summation\addizione
summer\estate, estivo
summer holidays\vacanze estive
summerly\estivo
summit\cùlmine
summon\chiamare
summoner\fattorino
sumptuous\fastoso, lussuoso
sun\sole
sunbathing\bagno di sole
sunburned\abbronzito
Sunday\doménica, domenica
sunflower\elianto
sunny\soleggiato
sunstroke\insolazione
super\favolosamente
supercharger\mantice
supercilious\orgoglioso
superficial\superficiale
superior\migliore, più alto, superiore
superlarge\grossissimo
supernal\ultraterreno
supernatural\ultraterreno
supervise\vigilare
supervision\supervisione
supplement\completamento, integrare
supplier\fornitore
supply\fornitura, rifornimento, provvedere, fornire
support\sostenere, appogiare, appoggio, poggiare, sostegno
supporte\fiancheggiare
supposable\supposto
suppose\assùmere, supporre
supposition\supposizione
suppository\ugola
suppression\vuoto di cassa
sure\sicuramente
sureness\certezza
surer\più sicuro
surface\superficie, superficie
surge\frangenti
surgeon\chirurgo
surgery\chirurgìa, pratica
surmount\eccedere, eccedere
surprise\sorprendere, sorprendere
surprised\sorprende, sorprende
surprising\strano, sorprendente
surrender\consegnare
surround\circondare
surroundings\dintorni
survival\sopportare, sopportare
survive\sopravvivere
survives\sopravvive
suspect\dubitare, supporre, presentire
suspence\rinvio
suspended\interrotto
suspension\molleggio
suspicion\sospetto, ombrosità
suspicious\sospetto, diffidgnte
sustain\poggiare, appogiare, sostenere
swabian\svevo
swallow\rondine, ingoio, divorare
swamp\palude
swan\cigno
swarthy\farsi scuro
swatter\ammazzamosche
sweat\sudare, sudore
sweater\maglia, pullover
Swede\Svedese
Sweden\Svezia
sweep\scopare, spazzare, ribaltabile
sweet\caramella, dolce, dessert, abboccato
sweetness\dolciume
sweets\dolci
swell\enfiare, frangenti
swiftly\presto
swill\risciacquare
swim\nuotare, fanno il bagno
swimmer\nuoto
swimming\nuotare, fanno il bagno
swimming-pool\piscina
swimming trunks\calzoncini da bagno
swims\nuota
swindle\capogiro, marioleria
swindler\lestofante
swing\altalena, brandire
swings\dondolare
Swiss\Svizzero
switch\interruttore
switch off\spegnere, posare, estinguere
switch on\accèndere
@@ -11884,1537 +11883,1536 @@ tobacco\tabacco
tobacco pouch\borsa del tabacco
tobacconist's\tabaccheria
today\oggi
toddle\trotterellare
toddy\grog
toes\dita dei piedi
tog\vestire
together\contemporaneamente, unitamente, insieme, comune
together with\velluto
toggle\bavaglio, verificare
toiled\tormentò
toiler\lavorante
toilet\gabinetto, abbigliatura
toilet paper\carta igiènica
toils\tormenta
toilsome\faticoso
tolerance\tolleranza
tolerate\amméttere, tollerare, sopportare
tolerated\ammesso
tolerates\sopporta
tolerating\indulgente
toleration\sopportazione
tollable\soggetto a dogana
tolled\picchiai
tolling\convincente
tomato\pomodoro
tomb\sepolcro
tomboyish\selvaggio
tombstone\lapide
tomfoolery\ocaggine
tomorrow\domani, oriente
tomorrow morning\domattina
tomtit\cincia
tone\suono
toneless\afono
tones\voce, pronuncia
tongue\idioma, lingua
tongues\linguale
tonicity\elasticità
toning bath\viraggio
tonque\lingua
tony\stile
too\anche, a tavola, troppo, oltremodo
too expensive\impagabile
too little\troppo poco
too much\troppo
took\prese
took over\mi incaricai, mi incaricai
toolmaker\attrezzista
tooth\dente
tooth decay\carie
toothbrush\spazzolino da denti
toothless\sdentata, sdentato
toothpaste\dentifricio
toothpick\stuzzicadenti
toothsome\gustoso
top\principio, cùlmine, sù, fermatura, cappotta
top floor\soffitta
topic\volume, tema
topical\conforme al tempo
topmast\severità
topmost\colonello
topples\cade
torch\fiàccola
torches\fiaccole
tormented\inquieto
torn off\stracciato
torn up\stracciato
torpedo boat\lanciasiluri
torpid\assordato
torpidity\anestesia
torpidness\accidia
torridness\ustione
tortoise\tartaruga
torture\tortura, tormento
torture chamber\stanza di tortura
torus\circolo
toss\avventare
total\intero, completo, tutta
total weight\peso complessivo
totaled\contai
totality\complesso
totally\completo
totals\conta
tots\conta
totter\barcollare
touch\affisso, inpugnare, toccare
touchdown\ottenere
touched\afferrato
touchiness\suscettibilità
touching\afferrante
touchy\irritabile, sensibile
tough\ostinato
tougher\più duro
toughing\commovente
toughly\solido
toughs\lestofante
tour\circolazione, giro turistico, giro turìstico
tourism\escursionismo
tourist\escursionista, escursionista
tourist class\classe turìstica
tourist party\gruppo turìstico
tourist traffic\movimento turistico
tournament\competizione, giostra
tourney\giostra
tousles\arruffato
tout\arruolare
tow\trascinare, trascinare, estrassi
tow off\trascinare
tow rope\cavo di rimorchio
toward\arrendevole
towards\in, a tavola, inverso
towel\asciugamano
toweled\asciugato
towels\asciugamani
tower\torre
towering\poderoso
town\città
town-hall\municipio
town-planing\urbanistica
town council\assessore municipale
townplan\piantina
township\congreguari
towrope\cavo di rimorchio
toxic\virulento
toxin\veleno
toxins\veleni
toy\giocàttolo
toyed\giocai
track\binario
track hound\segugio
tracking\inseguire
trackless\senza traccia
tract\territorio
tractive\boccata
trade\impresa, arte, ramo di commercio, commercio
trade union\sindacato
trade unionist\sindacalista
tradeoff\cambio
tradeoffs\scambio
tradesman\omo, signora
tradeunion\sindacato
tradeunionist\sindacalista
tradition\tradizione, tradizione
traduce\calunniare
traffic\traffico
traffic light\semaforo
traffic lights\semaforo, semafori, semaforo
traffic sign\cartello stradale
trafficking\commercio
tragedy\tragedia, tragedia
tragic\tragico
trailer\nudista
train\ammaestrare, educare, allenamento, ferroviario
train of thought\ragionamento
trained\esercitato
trainee\apprendista
trainer\allenatore
trainers\allenatore
training\istruzione, educazione
training ship\nave scuola
trains\treni
traipse\strascicare
tram\tram
tramp\vagabondaggio
transaction\evasione
transcendence\elevatezza
transfer\trasferire, imbarazzato, cessione, trasportare
transform\convertire, commutare, alterare
transient\corruttìbile
transit\tragitto
translate\tradurre, tradurre
translation\traduzione, traduzione
transmarine\oltremarino, oltremarino
transmission\spedizione
transmit\cèdere, cèdere
transmitter\trasmettitore
transparent\vaporoso
transplant\trapiantare
transport\avanzamento, trasporto, trasportare
transubstantiate\commutare
transversal\obliquo
trap\tranello
trascan\secchio delle immondizie
trashcan\cestino
travel\andara
travel agency\ufficio viaggi
travel office\ufficio viaggi
traveler\viaggiatore
traveller\viaggiatore, viaggiatore
travelling bag\borsa da viaggio
travelling expenses\spese di viaggio
tray\vassoio
tread\pedata
treasure\tesoro
treat\coltivare
treatment\elettorale, cura
tree\albero, àlbero
tree-trunk\tronco
tremendous\grandioso, poderoso
tremulously\tremante
trend\declinazione
trial\esperimento, procedimento
triangle\triangolo
tribulation\tormento
trick\trucco, furberia
tricky\intricato
tricolors\tricolore
trifles\quisquilie
trimly\curato
tringing\tinntinnare, sonare il campanello
trip\escursione, tratto, incespicare
tripod\cavalletto
triviality\insulsaggine
troop\truppa
trot\trottare
trouble\fastidio, disturbo, fatica, penuria, problema
troublesome\noioso
trough\per mezzo di ciò
trousers\pantaloni
trout\trota
truck\camion
true\vero
trump\brìscola
trumpet\tromba
trunk\tronco, torso
trust\confidenza
trusted\fidai
truth\verità
try\esperimentare, provare
tube\tubetto, tubo, tubo
Tuesday\martedì, martedí
tug\trascinare
tulip\tulipano
tumour\tumore
tuna\tonno
tuna-fish\tonno
tune\melodia
tunes\esatto
tuning\votazione
tunnel\galleria
tunny\tonno
turbine\turbina
Turk\Turco
turkey\tacchino
Turkey\Turchia
turn\fila, girata, voltarsi, girare
turn around\voltare
turn off\posare
turn on\accèndere
turn round\ritornare
turn screw\cacciavite
turnings\trucioli
turnip\rapa
turnover\movimento degli affari
turret\torretta
turtle\tartaruga
TV\televisione
twain\paio
twelve\dodici
twenty\venti
twenty-three\ventitré
twerps\uomini
twiddled\giocai
twiddles\gioca
twins\gemelli
twirl\girare
twist\storcere, girata
twitch\ticchio
two\due
two hundred\duecento
twofold\dùplice
twoseater\biposto
tympanum\timpano
type\fare, scommettere, tipo, sorta, vergare
typhoon\tifone
typical\tipico
tyran\tiranno
tyrant\tiranno
udder\mammella
ugly\laido
ulcers\ulcere
ultimate\alla fin fine
ultimately\finalmente
ultrared\ultrarosso
umbrageous\ombreggiato
umbrella\parapioggia, ombrello
umpire\arbitro
unabating\incessante
unable\inadatto, incapace
unable to work\inabile al lavoro
unaltered\immutato
unanimous\a una voce
unanimously\a una voce
unattempted\intentato
unauthorized\non autorizzato
unavailable\trasceso
unavoidable\inevitabile
unbeknownst\sconosciuto
unbelievable\incredibile
unboundedly\illimitato
unburdened\licenziato
uncertain\incerto, malsicuro
uncertainty\incertezza
unchallengeable\irrefutabile
uncle\zio
uncloaking\svelante
uncomfortable\scomodo
unconditional\incondizionato
unconscious\inconsapevole
unconstitutional\anticostituzionale
uncork\stappare
unction\unzione
unctious\untuoso
unctuous\cremoso
unctuousness\unzione
uncurable\inguaribile
uncurbed\sbrogliato
undate\ondulato
undazzled\intatto
undecent\indecente
undecided\incerto
undeck\scoprire
undefeated\inbattuto
undefiled\pulito
undefined\vago
undeliberate\senza volere
undelightful\mostruoso
undemanding\senza esigenza
undeniably\incontestabile
under\là sotto, sotto, abbasso
under age\minorenne
under carriage\carrello
under developed\arretrato
under it\là sotto
underage\minorenne
underarm\avambraccio
underbid\offrire sotto costo
undercarriage\carrello
undercover\riservato
undercut\offrire sotto costo
underestimate\sottovalutare
undergo\vissi
undergraduate\studente
underground\sotterraneo, sottosuolo
underground railway\ferrovia sotterranea
undergrowth\sterpaglia
underhand\segreto
underlie\soccombere
underline\sottolineare
undermine\minare
underneath\sotto
underpants\mutande
underrate\sottovalutare
underscore\sottolineare
undersell\offrire sotto costo
undershirt\maglia
underside\parte inferiore
undersigned\firmato
undersized\minuscolo
underskirt\sottana
understand\capire, comprendere
understanded\giudizio, nozione
understanding\comprensione
understands\comprende
undertake\intraprendere
undertaken\intrapreso
undertakes\intraprende
undertaking\intraprendere
undertakings\esercizi
undertook\intrapresi
undervalue\sottovalutare
underwear\biancherìa ìntima
underworld\regno dei morti
underwrite\garantire, firmare
underwrites\garantito
underwriting\assicurazione
underwritten\garantito
undesignated\vago
undesigning\sincero
undetermined\vago
undeveloped\embrionale
undies\biancherìa ìntima
undigested\non digerito
undilated\non diluito
undischarged\non pagato
undisclosed\anònimo
undistinguishable\indistinto
undisturbed\indisturbato
undivorced\sposato
undoable\solubile
undreamt\inaudito
undubbed\anònimo
undue\insufficiente
undulated\ondulatorio
undying\immortale
unearth\disotterrare
unease\inquietudine
uneasily\sconfortevole
uneasy\sconfortevole
uneatable\immangiabile
uneligible\disadatto
unembarrassed\spudorato
unemphatic\indistinto
unemployable\inservibile
unemployed\senza lavoro
unemployment\disoccupazione
unendurable\insopportabile
unenjoyable\immangiabile
unenriched\non annunciato
unenslaved\esente
unequable\sleale
unequably\sleale
unequal\ineguale
unequaled\senza esempio
unequivocal\univoco
unescorted\unico
unessential\accidentale
unestimable\inestimabile
unethical\senza scrupoli
uneven\ineguale
unexcelled\insuperato
unexceptional\senza eccezione
unexpected\inatteso
unexperienced\novizio
unexplicit\indistinto
unfailing\senza errori, attendìbile
unfairly\sleale
unfaithful\infedele, infedele
unfaltering\inflessibile
unfathomable\inpenetrabile
unfatiguing\instancabile
unfavorable\sfavorevole
unfavourable\sfavorevole
unfeeling\insensibile
unfeigned\vero
unfeminine\maschile
unfertile\sterile
unfetter\esimere
unfinished\incompiuta
unfirm\malfermo
unfit\inadatto, inabile al lavoro, disadatto
unfit for work\incapace al lavoro
unfitness\inattitudine
unfitted\disadatto
unfitting\sconveniente
unfix\sciogliere
unflagging\instancabile
unflavored\senza gusto
unflinching\deciso
unflustered\equilibrato
unfold\esplicare
unforced\spontaneo
unforeseen\imprevisto
unforgettable\indimenticabile
unforgivable\inperdonabile
unforgivably\inperdonabile
unforgotten\indimenticato
unformal\poco stretto
unfortunately\per disgrazia, purtroppo
unfrank\disonesto
unfrequent\raro
unfrequently\rara
unfriendly\scortese
unfruitful\infecondo
ungainliness\zoticaggine
ungentlemanly\sconveniente
ungirt\poco stretto
ungiving\insensibile
ungraceful\grossolano
ungracefully\goffa
ungraciousness\sfavore
ungrateful\ingrato
ungratefully\ingrato
ungratefulness\ingratitudine, ingratitudine
ungrudging\senza invidia
unhalted\sbrogliato
unhappily\per disgrazia
unhappiness\miserabile
unhappy\disgraziato, afflitto
unharbored\scoperto
unharmed\illeso
unharmfully\sicura
unheated\inosservato
unhesitant\volonteroso
unhesitating\immediato
unhomogeneous\ineguale
unhuman\disumano
unicellular\unicellulare
unicoloured\unicolore
unicorn\liocorno
unidentified\sconosciuto
unidimensional\lineare
unification\unificazione
unified\uniti
unifies\unito
uniform\unito
uniformity\uniformità
unilateral\unilaterale
unillumined\ignorante
unimaginable\inimmaginabile
unimaginative\senza immagginazione
unimagined\imprevisto
unimpeachable\intoccabile
unimpeded\indisturbato
unimportance\cosa di nessuna importanza
unimportant\senza importanza
unimportntant\senza importanza
uninformed\ignorante
uninhabited\disabitato
unintelligently\insulso
unintended\senza volere
unintentional\senza volere
uninterrupted\durabile, incessante
unintimate\scomodo
union\unione, unione, sindacato, lega
unique\singolo, unico, straordinario, eccezzionale
unison\unisono
unisonous\congruente
unit\meccanismo, elemento, semplice
unitary\unito
unite\unificare, unirsi
united\uniti, in comune
unites\unito
unity\elemento, concordia
universalize\generalizzare
universally\notorio
universally known\notorio
universe\universo
university\università, accademia
university graduate\accadèmico
unkind\scortese, insensibile
unkindly\insensibile
unkindness\insensibilità
unknowable\ignorante
unknown\sconosciuto
unlabored\facilmente
unlade\scaricare
unlawful\illegale
unleaded\senza piombo
unlearn\disimparare
unless\tranne che
unlettered\incolto
unlevel\dìspari
unlicensed\non permesso
unlifelike\imitato
unlimited\illimitato
unlink\separare
unlinked\sciolto
unliquidated\non pagato
unliteral\figurato
unload\scaricare, scaricare
unloaded\scaricato
unloading\scaricare
unloading point\deposito
unlock\disserrare
unloving\frigido
unluckily\per disgrazia
unlucky\disgraziato, infelice
unlucky fellow\corvo del malaugurio
unmagical\insipido
unmake\levatura
unmannerly\screanzato
unmarried\nubile
unmasculine\femminino
unmask\comprométtere
unmasking\smascherante
unmerciful\spietato
unmindful\sconsiderato
unmistakably\inconfondibile
unmistaken\sicuramente
unmodified\immutato
unmovable\immobile
unmoved\impassibile
unnecessary\inutile
unneighborly\scortese
unnoted\inosservato
unnoticeable\inosservato
unnoticed\inosservato
unobjectionable\legittimo
unobscured\sereno
unobservant\disattento
unobtainable\irraggiungibile
unoccupied\vacante
unoffending\innocuo
unofficial\ufficioso
unostentatious\senza esigenza
unpaid\non pagato
unpalatably\cattiva
unparallel\eccezzionale
unpassable\sconveniente
unperceived\inosservato
unpitying\spietato
unpleasant\laido, dispiacévole
unpleasantness\spiacevolezza
unpleasing\dispiacévole
unpredictable\imprevedibile
unpremeditated\estemporàneo
unpretentious\senza esigenza
unpreventable\inevitabile, estemporàneo
unprimitive\colto
unprincipled\incostante
unprofessional\incompetente
unpromising\fallito
unpromisingly\fallito
unpropitious\sfavorevole
unprotected\indifeso
unprotected game\libera cacciagione
unquestionable\indiscutibile
unquiet\secondo
unquietly\liuto
unreachable\irraggiungibile
unreadably\illeggìbile
unreal\fantomatico, spettrale
unrealistic\irrealistico
unreasonable\irragionevole
unreasonableness\insensatezza
unreckonable\imprevedibile
unrecognized\non riconosciuto
unreflecting\sbadato
unregulated\non regolato
unrelenting\inflessibile
unremitting\incessante
unremorseful\spietato
unrepentant\impenitente
unresting\incessante
unrestrained\sbrogliato
unrestricted\illimitato
unright\sleale
unrighteous\abietto
unripe\acerbo
unrude\educato
unruffled\netto
unruly\disattento
unsalaried\non pagato
unsatisfied\insoddisfatto
unschooled\incolto
unscrew\avvitare
unscrupulous\senza scrupoli, scoscenziato
unseat\esonerare
unseeable\invisibile
unseeing\cieco
unselfish\altruista
unselfishness\altruismo
unsettle\inquietare
unsettles\inquieto
unsettling\inquietante
unshackle\esimere
unshackles\liberato
unshackling\liberante
unshapely\deforme
unsheltered\senza tetto
unshrinking\intrepido
unskimmed milk\latte integrale
unsmiling\grave
unsoiled\lindo
unsolicited\non richiesto
unsolicitous\volontario
unsophisticatedly\ingenua
unsounded\fasullo
unstable\labile, volubile
unstableness\incertezza
unstably\malsicuro
unsteadily\malfermo
unsteadiness\incertezza
unsteady\volubile
unstopping\aprente
unstudied\natura secondo
unsubstantiated\infondato
unsubtle\rozzo, zotico
unsuitable\disadatto
unsuited\disadatto
unsure\malsicuro
unsureness\incertezza
unsurpassed\insuperato
unsympathetic\antipàtico
untainted\senza macchia
untarnished\immacolato
unthankful\ingrato
unthankfulness\ingratitudine
unthinkable\impensabile
unthought\sconsiderato
untimeliness\tempo inopportuno
untimely\prematuro
untirable\instancabile
unto\a tavola
untrapped\esente
untried\intentato
untroubled\indisturbato
untruth\menzogna
untwine\lievitazione
unusable\inservibile
unusual\strano, inconsueto
unusually\raro
unusualness\stranezza
unutterable\indicibile
unvaried\immutato
unveil\svelare
unveiling\svelante
unventilated\muffaticcio
unversed\novizio
unwarily\incauto
unwarped\spassionato
unwarranted\non autorizzato
unwary\incauto
unwavering\incrollabile
unwearable\intollerabile
unweary\instancabile
unwed\nubile
unwell\indisposto
unwillingly\malvolentieri
unwillingness\disgusto
unwind\dipanare
unwinds\rilassato
unwise\imprudente
unwitting\senza volere
unwontedly\inconsueto
unworried\spensierato
unworthy\indegno
unwounded\illeso
unwrought\grezzo
up\sù, a, sù, sù
up above\sù
up there\lassù
upbraiding\rimprovero
upbringing\creanza
upchuck\vòmito
upcoming\prossimamente
upgrade\estensione, ampliare
upgrades\trasportato
upgrading\estensione
upheaval\elevamento
uphold\durare
upholster\imbottire
upholsterer\tappezziere
upkeep\manutenzione
uplift\esaltare
uplifting\alzante
upon\a
upper arm\braccio superiore
upper case character\lettera maiuscola
uppish\impettito
uppity\baldanzoso
upraise\esaltare
upraising\alzante
upright\pari, verticale
uprise\levarsi
uproar\eccitazione
uproariously\liuto
upshot\risultato
upstage\arrivista
upstairs\in alto, sù
upturn\incremento
upwards\sù
uranium\uranio
urban\urbano
urge\premura, incoraggiare
urgency\urgenza
urgent\urgente, legante
urine\orina, uroscopia
urn\urna
us\noi, a noi
usable\usabile
usage\uso
use\uso, adoperare
use up\esaurire
used\usato
useful\utile
-usefull\utile
useless\inutile, disùtile, inservibile
user\utente
uses\usato
usual\usuale, ordinario
usually\ordinario
usuries\usura
usury\usura
Utopian\utopico
utter\estrinsecare
vacant\vacante
vacation\vacanze, ferie
vaccinate\vaccinare
vaccination\vaccinazione
vaccine\vaccino
vacuum\vuotaggine
vacuum cleaner\aspirapòlvere
vagabond\vagabondaggio
vagina\fòdero
vailable\disponìbile
vain\vano
valerian\valeriana
valid\valevole
validity\validità
validness\validità
valley\valle
valorize\valorizzare
valse\valzer
valuable\pregiato
valuables\valori
value\valutare, valore
valuejudgment\valutazione
valve\valvola, valvola
vanguard\avanguardia
vanilla\vainiglia
vanish\scomparire
vanity\fatuità
vaporizer\vaporizzatore
vapors\evaporazione
vapour\vapore
variable\variàbile
variance\contrarietà
variation\aberrazione
varicosity\varice
various\differente
variousness\varietà
varnish\vernice
vary\variare
vascular\recipiente
vase\vaso, vaso da fiori
vast\vasto
vault\volta
vaulted\volta
veal\carne di vitello
veda\sapere
vegetable\pianta
vegetable soup\zuppa di verdura
vegetables\legume
vegetatively\vegetativo
vehicle\carro, veicolo
veil\veletta
vein\vena, vena
veined\venato
velocity\velocità
velvet\velluto
vending machine\autòma
vendue\licitazione
vengeance\vendetta
vengeful\vendicativo
venom\veleno
ventilate\ventilare, arieggiare, aerare
ventilating\ventilazione
venturous\rischioso
veraciousness\veridicità
verbal\orale
verdict\giudizio
verifield\giustezza
verify\verificare, esaminare
verity\verità
vermicide\vermifugo
vermilion\cinabro
verminous\impidocchiato
versatile\multilaterale
version\versione, emissione
vertical\verticale
vessel\recipiente, vascello
vest\maglia
vet\veterinario
vetoed\divieto
vex\molestare
vexation\rancore, nonostante
via\sopra
viaduct\viadotto
viand\vettovaglia
vice\vizio
vicious\vizioso
victim\sacrificio
victor\vincitore
victorious\vittorioso
victory\vincita
victualer\fornitore
victuals\commestìbili
videotaping\nota
vie\gareggiare
viennese\viennese
view\parere, concezione, vista, veduta, visuale
viewer\negli, spettatore
viewpoint\belvedere
views\vedute
vigorous\benportante, energico
vile\infame
villa\villa
village\villaggio
villain\pezzente
vine\vite, vigna
vintage\annata
vintner\vinaio
violation\infrazione
violator\violatore
violence\balìa
violent\violento, veemente
violent temper\irascibilità
violet\viola
violin\violino
viper\biscia
viral\virus
virgin\intatto, nuovo di fabbrica
virginity\verginità
viril\maschile
virtual\virtuale
virtue\virtù
virtuoso\campione
virtuous\virtuoso
virtuousness\virtù
visa\visto
visible\visibile
visibleness\visibilità
visionary\visionario
visit\ispezionare, visitare, visita, vìsita
visitor\visitatore
visors\ombrelli
vital\importante
vitality\vitalità
vitamin\vitamina
vitiation\depravazione
viticulture\enofilo
vituperation\vituperio
vividly\chiara
vocabulary\dizionario
vocalists\cantante
vocation\appello
vocational\per lavoro
vodka\vodka
voice\voce
voiceclerk\fatturista
void\vuotaggine
volcano\vulano
volitive\essere disposto
voltage\voltaggio
volume\volume, volume
voluntary\volontario
volunteer\volontario, volontario
volution\voluta
vomit\vòmito
voracious\vorace, àvido
vote\voce, eleggere, votazione, votare, elezione
vouch\obbligarsi
voucher\biglietto di garanzia
vulcanize\vulcanizzare
vulnerability\vulnerabilità
vulnerable\vulnerabile
vulture\avvoltoio
wadding\incluso
wade\sguazzare
wads\fardello
wage\stipendio
wages\stipendio
waist\vita
waistband\lega
waiter\cameriere
wake\destare
wake up\svegliarsi
walk\camminare, corro, giro
walked\andai
wall\parete, muro
wallet\portamonete
wallpaper\tappezzeria
walnut-tree\noce
waltz\valzer
want\vuole, volere
wants\desiderare
war\guerra, guerre
wardens\guardiana
wardrobe\vestiario
warehouse\campeggio
warm up\riscaldare
warmth\calore
warn\dissuadere
warn out\stanco
warning\ammonizione
warrant\mandato di cattura
warrantirs\facoltà
warranty\garanzia
warship\nave da guerra
was absent\mancai
was allowed\potei
was astonished\mi stupii
was called\mi chiamavo
was cold\gelai
was valid\valsi
wash\lavare
washbasin\catinella
washer\lavatore
washing\lavabiancheria
washing machine\lavabiancheria
wasp\vespa
waste\sperperare, eremo
waste of time\perdita di tempo
waste water\acqua di scarico
wastes\sperperato
watch\orologio, sorvegliare
watch dog\cane da guardia
watch television\televisione
watchdog\cane da guardia
watcher\guardia
watchful\vigile
watchfulness\vigilanza
watchmaker\orologiaio
water\diluviare, annaffiare, acqua, bagnare
water colour\acquerello
water for rinsing\lavatura
water gun\autopompa
water melon\anguria
water rat\lupo di mare
water sports\sport acquatico
watercolor\acquerello
waterfall\cascata
watergate\cateratta
watering can\annaffiatoio
watermark\filigrana
watermarks\filigrana
watermelon\anguria
waterproof\impermabile
watertight\impermabile
watery\acquoso
wattle\ostacolo
watts\bassofondo
wave\flutto, sventolare, soffiare, svolazzare, onda
wave about\brandire
wave to\accennare
wavelike\ondulatorio
waver\svolazzare, barcollare, ondeggiamento, vertere
wavered\oscillai
wavering\vacilncnve
wavers\oscilla
wavily\ondulato
wavy\ondulato
wax\cera, créscere
wax candle\candela di cera
wax figure\figura di cera
waxwork\figura di cera
waxy\cèreo
way\cammino, strada, strada, direzione
way bill\lettera di porto
way out\esito, passaggio
wayfarer\viaggiatore
waylay\appostare
wayward\bisbètico
waywardness\cocciutaggine
WC\abbigliatura
we\noi altri, noi
weak\gràcile, debole, labkle
weaken\indebolire, debilitare
weakening\indebolimento
weakling\codardo
weakly\gràcile
weakness\mancare, debolezza, debolezza
weakness of character\debolezza di carattere
weaknesses\indebolire
wealth\opulenza
wealthier\ricco
wealthily\ricco
wealthiness\opulenza
wealthy\ricco, benestante, facoltoso
wean\divezzare
weans\divezzo
weapon\armi, arma, arme
weapond\armato
weaponless\disarmato
weaponries\armi
weapons\nucleare
wear\abbigliare
wear and tear\logorio
wear out\logorare
wearer\vettore
weariness\sfinitezza
wearout\logorio
weary\stracco
weather chart\carta meteorologica
weather forecast\bollettino meteorològico
weather observation\meteorologia
weather vane\voltagabbana
weave\tessere
weaver\tessitore
weavers\tessitrice
wedding\nozze, sposalizio
wedding dress\abito da sposa
wedding ring\anello matrimoniale
wedge\mania, cùneo
wedge shaped\cuneiforme
wedges\cunei
Wednesday\mercoledí
wednesday\mercoledì
wee\minuscolo
weed\erbaccia
weeding\sarchiare
week\settimana
weekend\fine settimana
weekly\ebdomadario, settimanalmente
weekly paper\ebdomadario
weeks\settimane
ween\sperare
weep\lacrimare
weeps\piange, piansi
weigh\pesare
weighable\pesabile
weightily\pesante
weights\pesi
weighty\pesante
welcome\salutare, gradito, desiderato, benvenuto
weld\saldare
welding\sudore, saldare
welfare\benessere, assistenza pubblica
well\bene, benessere, pozzo, sano, interamente, ebbene
well behaved\educato
well built\benfatto
well deserved\benemèrito
well fed\ben nutrito
well meant\con buone intenzioni
well off\benestante
well read\erudito
well thought out\ponderato
well tried\esperimentato
well understood\beninteso
well well\così così
wellfare\benessere
welling\scaturente
wells\pozzo
welter weight\welter
welters\ondeggiamento
wench\prostituta
wenches\fornicare
wend\dirìgersi
went up\salii
wept\piansi
were\sua
werewolf\lupo mannaro
west\ovest
West\ovest
western\occidentale
westwards\verso ovest
wet\umido, inumidire, bagnato
wether\montone
wetly\bagnato
wetness\fradicezza
whack\legnare
whacked\picchiai
whacking\convincente
whale\balena
whaler\baleniere
whalers\baleniere
wham\battuta
whammy\assalto
whams\colpi
wharf\molo
what\che, che cosa
whatever\checché
wheat\frumento, grano
wheel\ruota
wheel barrow\carriola
wheel chair\sedia a rotelle
wheel suspension\sospensione delle ruote
wheelbarrows\carriola
wheelchair\sedia a rotelle
wheeled\carreggiabile
wheeler\veicolo
wheels\arruotare, ruote
wheeze\anelare
wheezy\affannoso
whelp\cucciolo
when\laddove, appena che, quando, allorché
whence\donde
whenever\ogni qual volta
whensoever\qualvolta
where\ove, presso al quale, dove
whereabout\rimanenza, luogo di soggiorno
whereas\presso al quale
whereby\per cui, presso al quale
wherefore\per quale scopo
wherefrom\donde
whereof\a che cosa
whereon\onde
wheresoever\dovunque
whereto\ove
wherry\yole
whether\come se
whetstone\cote
whey\siero
which\che
whichever\che
whiffed\soffiai
whiffing\soffiante
whiffs\soffia
while\finchè, laddove, durante, tratto di tempo
whilst\laddove, durante
whim\capriccio
whimper\mugolare
whimsical\bizzaro
whimsy\capriccio
whine\mugolare
whinny\nitrire
whip\frusta
whipped cream\panna montata
whips\frustare
whirlpool\vortice
whirlpools\vortice
whirlwind\turbine
whisper\sussurrare
whisper to\sussurrare
whistle\fischio, fischietto, zufolare
whistled\fischio
whistles\zufolare, fischia
whit\un pochino
white\bianco
white cabbage\cavolo bianco
white haired\canuto
white hot\incandescente
white wine\vernaccia
whitely\biancastro
whiteness\bianca
whiter\uomo bianco
whites\sai
whitethorn\biancospino
whitish\biancastro
whitlow\circolazione
Whitsun\pentecoste
whitsuntide\pentecoste
whittle\intagliare
whiz\grillare
who\che, chi
whoever\chiunque
whole\tutta
wholehearted\serio
wholeness\interezza
wholesale dealer\grossista
wholesaler\grossista
wholesome\sano
wholesomely\sana
wholly\interamente
whom\chi
whooping cough\tosse canina
whoopingcough\tosse canina
whopping\colossale
whore\prostituta
whores\fornicare
whorl\voluta
whose\di questo, di che
whoseever\che
why\per quale ragione
wick\stoppino
wicked\malizioso, cattivo
wickedness\nequizia
wide\largo, vasto, latitudine
widely\vasto
widely ramified\molto ramificato
wideness\vastità
widespread\molto diffuso
widget\fatto giuochi di prestigio
widow\védova
widowed\védovo
widower\védovo
width\latitudine, vastità
wielding\esercente
wife\moglie, femmina, signora
wig\parrucca
wihtout\senza
wild\licenzioso
wild boar\verro
wilderness\luogo selvaggio
wilful\intenzionale
will\volli, favore, testamento, volere, diventa
will less\abulico
will power\volitivo
willed\voglioso
willful\intenzionale
willing\disposto, volonteroso, essere disposto, vuole
willingly\volontieri, volontiere
willow\salcio
wimble\trapano
win\guadagnare, vincere
wind\avvoltare, avvolgere, soffiare, vento
wind force\velocità del vento
wind gauge\anemometro
wind mill\mulino a vento
wind tunnel\canale aerodinamico
wind up\avvoltare
windcheater\giacca a vento
window\fetta, finestra, finestrino, oblo
window pane\lastra
window seat\posto alla finestra
window sill\davanzale
windows\finestrino
windscreen\parabrezzo
windshield\parabrezzo
windy\ventoso
wine\vino
wine cask\botte di vino
wine cellars\casa vinicola
wine glas\bicchiere da vino
wine growing\enofilo
wine list\lista dei vini
wine merchant\vinaio
wine store\bottiglierìa
wine tavern\fiaschetteria
winegrower\viticoltore
wines\vini
wing of a door\battente
winner\vincitore
winning\vittorioso
wins\vince
winter\verno
winter sleep\letargo
winter sports\sport invernale
winterly\invernale
wintertime\verno
wipes out\estingue
wire\cavo, fil di ferro
wire brush\spazzola metallica
wire fencing\traliccio
wires\fili
wisdom\saggezza, saggezza, freccia
wisdom tooth\dente del giudizio
wise\saggio, ragionevole
wiseacre\saputello
wish\voto
wished\desiderato
wishes\desidero
wishing\volitivo
wisp\strofinaccio
wistful\malinconico
wistfully\malinconico
wit\giudizio
witch\maga, fattucchiera
witchcraft\stregoneria
witcheries\forza magica
witches\stregare
with\con
with it\onde
with pleasure\volontiere
with what\con che cosa
withal\presso
withdraw\levare
withdrawn\ritirato
wither\appassire, sfiorire
withers\sfiorito
withhold\ritenere
within\dentro, frà
within the company\aziendale
without\senza
without contradiction\non contradditorio
without engagement\non impegnativo
without exception\senza eccezione
without fail\immancabile
without holding on\a mano libera
without notice\senza avviso
without permission\non permesso
without result\senza esito
without using cash\senza denaro in contanti
witness\testimonio
witnesses\testimoniare
witnessing\testimoniante
wits\giudizio
witted\sensato
witticism\lazzo
wittily\faceto
wizard\fattucchiera
wobbliness\incertezza
wobbly\malfermo
woes\soffrire
woken\svegliato
wolf\lupo
wolfish\lupino
wolfish appetite\fame da lupo
wolves\lupi
woman\donna, signora, morta
woman hairdresser\parrucchiera
womanliness\femminilità
women\donne
women folk\donne
womenfolk\donne
won\vinsi, vinto
wonder\miracolo, stupore, chièdere
wonder of the world\prodigio
wondered\sorpreso
wonderful\favolosamente, grandioso, magnifico
wonderfulness\splendore
wondering\stupefatto
wonderingly\attònito
wonderment\stupore
wondrous\meraviglioso
wondrousness\stupirsi
woo\arruolare
wood\legno, selva, boschetto, legna
wood grouse\urogallo
woodpecker\picchio
woods\bosco, selve
woodsman\guardiaboschi
woodstrawberry\fragola dei boschi
woodworker\legnaiolo
woody\legnoso
wool\lana
wool spinning mill\lanificio
woollen\volere, laneria
woolly\lanuto
wools\lana
woozily\farraginoso
word\formulare, parola, vocàbolo
wording\lettera
wordlessness\mutezza
words\parole
wore\portai
work\lavorare, funzionare, lavorare, opera, occupazione
work in a factory\lavoro in fabbrica
work out\calcolare
worked up\irritato, nervoso, emozionato
working hours\orario di lavoro
working time\orario di lavoro
workman\artéfice
workmanship\equipaggio
works council\consiglio aziendale
workshop\corso avanzato, officina
workshops\officine
world\mondo
world domination\dominio del mondo
world economy\economia mondiale
world history\storia universale
world outlook\concezione del mondo
world record\primato mondiale
world war\guerra mondiale
worldliness\mondanità
worldly\laico
worldly innocent\estraneo al mondo
worm\baco, verme
wormwood\vermut
worn\portato
worn out\liso
worried\pieno di timore, affannoso
worries\stare in pensiero
worriment\seccatura
worrisome\noioso
worry\fastidio, stare in pensiero, disturba, arrabiare
worryingly\inquietante
worse\più cattivo, peggiore
worship\venerare, adorare, venerazione
worshiper\veneratore
worships\venerato
worst\cattivissima
worth\valore
worth seeing\da vedere
worthily\equo
worthiness\valore
worthless\senza valore
worthwhile\redditizio
worthy\meritevole
would\volei, decoro
would like\vuole
would like to\vuole
wound\fegriva, ferire
woven\tessuto
wow\successone
wraith\fantasma
wraiths\lemuri
wrangle\questione
wrangled\litigai
wrangles\litiga
wrap\infagottare, involgere, avvolgere, avvòlgere
wrap up\avvòlgere
wrapper\involucro
wrappers\involgere
wrath\furia
wrathful\adirato
wreak\spingere
wreaks\esercita
wreath\ghirlanda
wreck\naufragio, disfare, guaio
wrecked\distrussi
wrecking service\servizio recupero automezzi
wrecks\distrutto, sporcato
wren\scricciolo
wrench\chiave
wrest\arraffare
wrestle\lottare
wrestled\rango
wrestler\lottatore, lottatore
wretchedness\miserabile
wrinkle\trucco, grinza, suggerimento, pizzicotto
wrinkled\increspato
wrinkles\corrugare
wrist\polso
wristband\braccialetto
writ\documento
writ of execution\esecutorio
write\vergare, scrivere
write down\appuntare
write error\errore ortografico
write fault error\errore ortografico
write out\appuntare, emettere
write poetry\comporre versi
writer\quattrocentista, autore
writes\scrive
writing\vergare, scrittura
writing paper\carta da scrivere
written\scritto
wrong\fasullo, inverso, non giusto, colpevole
wrong conclusion\argomentazione sbagliata
wrongdoer\malfattore
wrongly\erroneamente
wrongous\illegale
wrongously\illegale
wrote\scrivei
wrought\lavorato
wroughtiron\ferro battuto
wry\obliquo
wryly\storto
wryness\obliqua
xenophobia\xenofobia
xenophobic\xenofobo
yacht\yacht
yachting\velismo
yachtsman\veliero
yachtswoman\veleggiatrice
yahoo\mascalzone
yank\estrarre
yankeedoodle\canto popolare
yap\muso
yaps\bocche
yard\ulna, cortile
yards\cortili
yardstick\criterio
yarn\filo
yarns\fili
yarrow\achillea
yawn\sbadigliare
yawns\sbadiglia
yclept\nominato
ye\il
yea\si
yeah\sereno
year\anno
year of birth\anno di nascita
year of construction\anno di costruzione
yearbook\effemeride
yearbooks\annali
yearlong\di un anno
yearly\ànnuo, annualmente
yearning\ansia
yeast\fondaccio
yegg\vagabondaggio
yell\gridare, stridere
diff --git a/noncore/apps/opie-console/filereceive.cpp b/noncore/apps/opie-console/filereceive.cpp
index e387273..452be60 100644
--- a/noncore/apps/opie-console/filereceive.cpp
+++ b/noncore/apps/opie-console/filereceive.cpp
@@ -1,162 +1,162 @@
#include <unistd.h>
#include <fcntl.h>
#include <signal.h>
#include <errno.h>
#include <qsocketnotifier.h>
#include "io_layer.h"
#include "procctl.h"
#include "filereceive.h"
FileReceive::FileReceive( Type t, IOLayer* lay, const QString& dir )
: ReceiveLayer(lay, dir ), m_type( t )
{
m_fd = -1;
m_not = 0l;
m_proc = 0l;
}
FileReceive::~FileReceive() {
}
void FileReceive::receive() {
receive( currentDir() );
}
void FileReceive::receive( const QString& dir ) {
m_prog = -1;
m_fd = layer()->rawIO();
m_curDir = dir;
if (pipe( m_comm ) < 0 )
m_comm[0] = m_comm[1] = 0;
if (pipe( m_info ) < 0 )
m_info[0] = m_info[1] = 0;
m_pid = fork();
switch( m_pid ) {
case -1:
//emit error
slotExec();
break;
/* child */
case 0: {
setupChild();
char* typus = NULL;
switch(m_type ) {
case SZ:
break;
case SX:
typus = "-X";
break;
case SY:
typus = "--ymodem";
break;
}
/* we should never return from here */
if( m_type == SX )
// FIXME: file name should be configurable - currently we ensure it
// doesn't get overwritten by -E (--rename)
execlp("rz", "rz", typus, "--overwrite", QObject::tr("SynchronizedFile").latin1(), NULL );
else
execlp("rz", "rz", typus, "--overwrite", NULL );
char resultByte = 1;
if (m_info[1] )
::write(m_info[1], &resultByte, 1 );
_exit( -1 );
break;
}
default: {
if ( m_info[1] )
close( m_info[1] );
if ( m_info[0] ) for (;;) {
char resultByte; int len;
len = read(m_info[0], &resultByte, 1 );
/* len == 1 start up failed */
if ( len == 1 ) {
emit error( StartError, tr("Could not start") );
return;
}
if ( len == -1 )
if ( (errno == ECHILD ) || (errno == EINTR ) )
continue;
// len == 0 or something like this
break;
}
if ( m_info[0] )
close( m_info[0] );
m_not = new QSocketNotifier(m_comm[0], QSocketNotifier::Read );
connect(m_not, SIGNAL(activated(int) ),
this, SLOT(slotRead() ) );
if ( pipe(m_term) < 0 )
m_term[0] = m_term[1] = 0;
ProcCtl::self()->add(m_pid, m_term[1] );
m_proc = new QSocketNotifier(m_term[0], QSocketNotifier::Read );
connect(m_proc, SIGNAL(activated(int) ),
this, SLOT(slotExec() ) );
}
break;
}
}
void FileReceive::cancel() {
::kill(m_pid, 9 );
}
void FileReceive::setupChild() {
changeDir( currentDir() );
/*
* we do not want to read from our
* information channel
*/
if (m_info[0] )
close(m_info[0] );
/*
* FD_CLOEXEC will close the
- * fd on successfull exec
+ * fd on successful exec
*/
if (m_info[1] )
fcntl(m_info[1], F_SETFD, FD_CLOEXEC );
if (m_comm[0] )
close( m_comm[0] );
/*
* now set the communication
* m_fd STDIN_FILENO
* STDOUT_FILENO
* STDERR_FILENO
*/
dup2( m_fd, STDIN_FILENO );
dup2( m_fd, STDOUT_FILENO );
dup2( m_comm[1], STDERR_FILENO );
}
void FileReceive::slotRead() {
QByteArray ar(4096);
int len = read(m_comm[0], ar.data(), 4096 );
for (int i = 0; i < len; i++ ) {
// printf("%c", ar[i] );
}
ar.resize( len );
QString str( ar );
}
void FileReceive::slotExec() {
char buf[2];
::read(m_term[0], buf, 1 );
delete m_proc;
delete m_not;
m_not = m_proc = 0l;
close( m_term[0] );
close( m_term[1] );
close( m_comm[0] );
close( m_comm[1] );
layer()->closeRawIO(m_fd);
emit received(QString::null);
}
diff --git a/noncore/apps/opie-console/filetransfer.cpp b/noncore/apps/opie-console/filetransfer.cpp
index 221838c..5144941 100644
--- a/noncore/apps/opie-console/filetransfer.cpp
+++ b/noncore/apps/opie-console/filetransfer.cpp
@@ -1,251 +1,251 @@
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
#include <qcstring.h>
#include <qsocketnotifier.h>
#include <opie/oprocess.h>
#include "procctl.h"
#include "filetransfer.h"
FileTransfer::FileTransfer( Type t, IOLayer* lay )
: FileTransferLayer( lay ), m_type( t ), m_pid ( 0 ) {
signal(SIGPIPE, SIG_IGN );
m_pid = 0;
m_not = 0l;
m_proc = 0l;
}
FileTransfer::~FileTransfer() {
}
/**
* now we will send the file.
*
* we request an fd. The IOLayer should be closed
* then we will setup a pipe for progress communication
* then we will dup2 the m_fd in the forked process
* to do direct IO from and to the fd
*/
void FileTransfer::sendFile( const QString& file ) {
m_prog =-1;
m_fd = layer()->rawIO();
//
// m_fd = ::open("/dev/ttyS0", O_RDWR);
m_file = file;
if ( pipe( m_comm ) < 0 )
m_comm[0] = m_comm[1] = 0;
if ( pipe( m_info ) < 0 )
m_info[0] = m_info[1] = 0;
m_pid = fork();
switch( m_pid ) {
case -1:
emit error( StartError, tr("Was not able to fork") );
slotExec();
break;
case 0:{
setupChild();
/* exec */
char* verbose = "-vv";
char* binray = "-b";
char* typus;
switch(m_type ) {
default:
case SZ:
typus = "";
break;
case SX:
typus = "-X";
break;
case SY:
typus = "--ymodem";
break;
}
/* we should never return from here */
execlp("sz", "sz", verbose, binray, file.latin1(), typus, NULL );
/* communication for error!*/
char resultByte =1;
if (m_info[1] )
write(m_info[1], &resultByte, 1 );
_exit( -1 );
break;
}
default:{
if ( m_info[1] )
close( m_info[1] );
if ( m_info[0] ) for (;;) {
char resultByte; int len;
len = read(m_info[0], &resultByte, 1 );
/* len == 1 start up failed */
if ( len == 1 ) {
emit error( StartError, tr("Could not start") );
return;
}
if ( len == -1 )
if ( (errno == ECHILD ) || (errno == EINTR ) )
continue;
// len == 0 or something like this
break;
}
if ( m_info[0] )
close( m_info[0] );
/* replace by QSocketNotifier!!! */
m_not = new QSocketNotifier(m_comm[0], QSocketNotifier::Read );
connect(m_not, SIGNAL(activated(int) ),
this, SLOT(slotRead() ) );
if ( pipe(m_term) < 0 )
m_term[0] = m_term[1] = 0;
ProcCtl::self()->add(m_pid, m_term[1] );
m_proc = new QSocketNotifier(m_term[0], QSocketNotifier::Read );
connect(m_proc, SIGNAL(activated(int) ),
this, SLOT(slotExec() ) );
}
break;
}
}
/*
* let's call the one with the filename
*/
void FileTransfer::sendFile( const QFile& file ) {
sendFile( file.name() );
}
/*
* setting up communication
* between parent child and ioLayer
*/
void FileTransfer::setupChild() {
/*
* we do not want to read from our
* information channel
*/
if (m_info[0] )
close(m_info[0] );
/*
* FD_CLOEXEC will close the
- * fd on successfull exec
+ * fd on successful exec
*/
if (m_info[1] )
fcntl(m_info[1], F_SETFD, FD_CLOEXEC );
if (m_comm[0] )
close( m_comm[0] );
/*
* now set the communication
* m_fd STDIN_FILENO
* STDOUT_FILENO
* STDERR_FILENO
*/
dup2( m_fd, STDIN_FILENO );
dup2( m_fd, STDOUT_FILENO );
dup2( m_comm[1], STDERR_FILENO );
}
/*
* read from the stderr of the child
* process
*/
void FileTransfer::slotRead() {
QByteArray ar(4096);
int len = read(m_comm[0], ar.data(), 4096 );
for (int i = 0; i < len; i++ ) {
// printf("%c", ar[i] );
}
ar.resize( len );
QString str( ar );
QStringList lis = QStringList::split(' ', str );
/*
* Transfer finished.. either complete or incomplete
*/
if ( lis[0].simplifyWhiteSpace() == "Transfer" ) {
return;
}
/*
* do progress reading
*/
slotProgress( lis );
}
/*
* find the progress
*/
void FileTransfer::slotProgress( const QStringList& list ) {
if ( m_type != SZ )
return;
bool complete = true;
int min, sec;
int bps;
unsigned long sent, total;
min = sec = bps = -1;
sent = total = 0;
// Data looks like this
// 0 1 2 3 4 5
// Bytes Sent 65536/11534336 BPS:7784 ETA 24:33
QStringList progi = QStringList::split('/', list[2].simplifyWhiteSpace() );
sent = progi[0].toULong(&complete );
if (!complete ) return;
total = progi[1].toULong(&complete );
if (!complete || total == 0) {
return;
}
double pro = (double)sent/total;
int prog = pro * 100;
// speed
progi = QStringList::split(':', list[3].simplifyWhiteSpace() );
bps = progi[1].toInt();
// time
progi = QStringList::split(':', list[5].simplifyWhiteSpace() );
min = progi[0].toInt();
sec = progi[1].toInt();
if ( prog > m_prog ) {
m_prog = prog;
emit progress(m_file, m_prog, bps, -1, min , sec );
}
}
void FileTransfer::cancel() {
if(m_pid > 0) ::kill(m_pid,9 );
}
void FileTransfer::slotExec() {
char buf[2];
::read(m_term[0], buf, 1 );
delete m_proc;
delete m_not;
m_proc = m_not = 0l;
close( m_term[0] );
close( m_term[1] );
close( m_comm[0] );
close( m_comm[1] );
layer()->closeRawIO( m_fd );
emit sent();
m_pid = 0;
}
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp
index 3250627..2b29d83 100644
--- a/noncore/net/opieftp/opieftp.cpp
+++ b/noncore/net/opieftp/opieftp.cpp
@@ -1,1515 +1,1515 @@
/***************************************************************************
opieftp.cpp
-------------------
** Created: Sat Mar 9 23:33:09 2002
copyright : (C) 2002 by ljp
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. *
***************************************************************************/
//#define DEVELOPERS_VERSION
#include "opieftp.h"
extern "C" {
#include "../ftplib/ftplib.h"
}
#include "inputDialog.h"
#include <qmenubar.h>
#include <qpe/qpeapplication.h>
#include <qpe/resource.h>
#include <qpe/config.h>
#include <qpe/mimetype.h>
#include <qtextstream.h>
#include <qpushbutton.h>
#include <qtoolbutton.h>
#include <qcombobox.h>
#include <qlistview.h>
#include <qlabel.h>
#include <qprogressbar.h>
#include <qspinbox.h>
#include <qtabwidget.h>
#include <qlayout.h>
#include <qmessagebox.h>
#include <qlineedit.h>
#include <qlistbox.h>
#include <unistd.h>
#include <stdlib.h>
QProgressBar *ProgressBar;
static netbuf *conn=NULL;
static int log_progress(netbuf *, int xfered, void *)
{
// int fsz = *(int *)arg;
// int pct = (xfered * 100) / fsz;
// printf("%3d%%\r", pct);
// fflush(stdout);
ProgressBar->setProgress(xfered);
qApp->processEvents();
return 1;
}
OpieFtp::OpieFtp( QWidget* parent, const char* name, WFlags fl)
: QMainWindow( parent, name, fl )
{
setCaption( tr( "OpieFtp" ) );
fuckeduphack=FALSE;
QGridLayout *layout = new QGridLayout( this );
layout->setSpacing( 2);
layout->setMargin( 2);
connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
QMenuBar *menuBar = new QMenuBar(this);
// QToolBar *menuBar = new QToolBar(this);
// menuBar->setHorizontalStretchable( TRUE );
QWMatrix matrix;
QPixmap pix(Resource::loadPixmap( "UnknownDocument" ));
matrix.scale( .4, .4);
unknownXpm = pix.xForm(matrix);
connectionMenu = new QPopupMenu( this );
localMenu = new QPopupMenu( this );
remoteMenu = new QPopupMenu( this );
tabMenu = new QPopupMenu( this );
layout->addMultiCellWidget( menuBar, 0, 0, 0, 2 );
menuBar->insertItem( tr( "Connection" ), connectionMenu);
// menuBar->insertItem( tr( "Local" ), localMenu);
// menuBar->insertItem( tr( "Remote" ), remoteMenu);
menuBar->insertItem( tr( "View" ), tabMenu);
tabMenu->insertItem( tr( "Local" ), localMenu);
tabMenu->insertItem( tr( "Remote" ), remoteMenu);
connectionMenu->insertItem( tr( "New" ), this, SLOT( newConnection() ));
connectionMenu->insertItem( tr( "Connect" ), this, SLOT( connector() ));
connectionMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() ));
localMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() ));
localMenu->insertSeparator();
localMenu->insertItem( tr( "Upload" ), this, SLOT( localUpload() ));
localMenu->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() ));
localMenu->insertItem( tr( "Rename" ), this, SLOT( localRename() ));
localMenu->insertSeparator();
localMenu->insertItem( tr( "Delete" ), this, SLOT( localDelete() ));
localMenu->setCheckable(TRUE);
remoteMenu->insertItem( tr( "Download" ), this, SLOT( remoteDownload() ));
remoteMenu->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() ));
remoteMenu->insertItem( tr( "Rename" ), this, SLOT( remoteRename() ));
remoteMenu->insertSeparator();
remoteMenu->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() ));
tabMenu->insertSeparator();
tabMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() ));
tabMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() ));
tabMenu->insertItem( tr( "Switch to Config" ), this, SLOT( switchToConfigTab() ));
tabMenu->insertSeparator();
// tabMenu->insertItem( tr( "About" ), this, SLOT( doAbout() ));
tabMenu->setCheckable(TRUE);
cdUpButton = new QToolButton( this,"cdUpButton");
cdUpButton->setPixmap(Resource::loadPixmap("up"));
cdUpButton ->setFixedSize( QSize( 20, 20 ) );
connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) );
layout->addMultiCellWidget( cdUpButton, 0, 0, 3, 3 );
cdUpButton->hide();
// docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton");
// docButton->setFixedSize( QSize( 20, 20 ) );
// connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) );
// docButton->setFlat(TRUE);
// layout->addMultiCellWidget( docButton, 0, 0, 6, 6 );
homeButton = new QToolButton(this,"homeButton");
homeButton->setPixmap( Resource::loadPixmap("home"));
homeButton->setFixedSize( QSize( 20, 20 ) );
connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) );
layout->addMultiCellWidget( homeButton, 0, 0, 4, 4);
homeButton->hide();
TabWidget = new QTabWidget( this, "TabWidget" );
layout->addMultiCellWidget( TabWidget, 1, 1, 0, 4 );
// TabWidget->setTabShape(QTabWidget::Triangular);
tab = new QWidget( TabWidget, "tab" );
tabLayout = new QGridLayout( tab );
tabLayout->setSpacing( 2);
tabLayout->setMargin( 2);
Local_View = new QListView( tab, "Local_View" );
// Local_View->setResizePolicy( QListView::AutoOneFit );
Local_View->addColumn( tr("File"),150);
Local_View->addColumn( tr("Date"),-1);
Local_View->setColumnAlignment(1,QListView::AlignRight);
Local_View->addColumn( tr("Size"),-1);
Local_View->setColumnAlignment(2,QListView::AlignRight);
Local_View->setAllColumnsShowFocus(TRUE);
Local_View->setMultiSelection( TRUE);
Local_View->setSelectionMode(QListView::Extended);
Local_View->setFocusPolicy(QWidget::ClickFocus);
QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold);
tabLayout->addWidget( Local_View, 0, 0 );
connect( Local_View, SIGNAL( clicked( QListViewItem*)),
this,SLOT( localListClicked(QListViewItem *)) );
// connect( Local_View, SIGNAL( doubleClicked( QListViewItem*)),
// this,SLOT( localListClicked(QListViewItem *)) );
connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) );
TabWidget->insertTab( tab, tr( "Local" ) );
tab_2 = new QWidget( TabWidget, "tab_2" );
tabLayout_2 = new QGridLayout( tab_2 );
tabLayout_2->setSpacing( 2);
tabLayout_2->setMargin( 2);
Remote_View = new QListView( tab_2, "Remote_View" );
Remote_View->addColumn( tr("File"),150);
Remote_View->addColumn( tr("Date"),-1);
// Remote_View->setColumnAlignment(1,QListView::AlignRight);
Remote_View->addColumn( tr("Size"),-1);
Remote_View->setColumnAlignment(2,QListView::AlignRight);
Remote_View->setColumnAlignment(3,QListView::AlignCenter);
Remote_View->addColumn( tr("Dir"),-1);
Remote_View->setColumnAlignment(4,QListView::AlignRight);
Remote_View->setAllColumnsShowFocus(TRUE);
Remote_View->setMultiSelection( FALSE);
Remote_View->setSelectionMode(QListView::Extended);
Remote_View->setFocusPolicy(QWidget::ClickFocus);
QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold);
connect( Remote_View, SIGNAL( clicked( QListViewItem*)),
this,SLOT( remoteListClicked(QListViewItem *)) );
connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
this,SLOT( RemoteListPressed(int, QListViewItem *, const QPoint&, int)) );
tabLayout_2->addWidget( Remote_View, 0, 0 );
TabWidget->insertTab( tab_2, tr( "Remote" ) );
tab_3 = new QWidget( TabWidget, "tab_3" );
tabLayout_3 = new QGridLayout( tab_3 );
tabLayout_3->setSpacing( 2);
tabLayout_3->setMargin( 2);
TextLabel1 = new QLabel( tab_3, "TextLabel1" );
TextLabel1->setText( tr( "Username" ) );
tabLayout_3->addMultiCellWidget( TextLabel1, 0, 0, 0, 1 );
UsernameComboBox = new QComboBox( FALSE, tab_3, "UsernameComboBox" );
UsernameComboBox->setEditable(TRUE);
tabLayout_3->addMultiCellWidget( UsernameComboBox, 1, 1, 0, 1 );
connect( UsernameComboBox,SIGNAL(textChanged(const QString &)),this,
SLOT( UsernameComboBoxEdited(const QString & ) ));
TextLabel2 = new QLabel( tab_3, "TextLabel2" );
TextLabel2->setText( tr( "Password" ) );
tabLayout_3->addMultiCellWidget( TextLabel2, 0, 0, 2, 3 );
PasswordEdit = new QLineEdit( "", tab_3, "PasswordComboBox" );
PasswordEdit->setEchoMode(QLineEdit::Password);
tabLayout_3->addMultiCellWidget( PasswordEdit, 1, 1, 2, 3 );
connect( PasswordEdit,SIGNAL(textChanged(const QString &)),this,
SLOT( PasswordEditEdited(const QString & ) ));
//PasswordEdit->setFixedWidth(85);
TextLabel3 = new QLabel( tab_3, "TextLabel3" );
TextLabel3->setText( tr( "Remote server" ) );
tabLayout_3->addMultiCellWidget( TextLabel3, 2, 2, 0, 1 );
ServerComboBox = new QComboBox( FALSE, tab_3, "ServerComboBox" );
ServerComboBox->setEditable(TRUE);
tabLayout_3->addMultiCellWidget( ServerComboBox, 3, 3, 0, 1 );
connect(ServerComboBox,SIGNAL(activated(int)),this,SLOT(serverComboSelected(int ) ));
connect(ServerComboBox,SIGNAL(textChanged(const QString &)),this,
SLOT(serverComboEdited(const QString & ) ));
QLabel *TextLabel5 = new QLabel( tab_3, "TextLabel5" );
TextLabel5->setText( tr( "Remote path" ) );
tabLayout_3->addMultiCellWidget( TextLabel5, 2, 2, 2, 3 );
remotePath = new QLineEdit( "/", tab_3, "remotePath" );
tabLayout_3->addMultiCellWidget( remotePath, 3, 3, 2, 3 );
TextLabel4 = new QLabel( tab_3, "TextLabel4" );
TextLabel4->setText( tr( "Port" ) );
tabLayout_3->addMultiCellWidget( TextLabel4, 4, 4, 0, 1 );
PortSpinBox = new QSpinBox( tab_3, "PortSpinBox" );
PortSpinBox->setButtonSymbols( QSpinBox::UpDownArrows );
PortSpinBox->setMaxValue(32786);
tabLayout_3->addMultiCellWidget( PortSpinBox, 4, 4, 1, 1);
serverListView = new QListBox( tab_3, "ServerListView" );
tabLayout_3->addMultiCellWidget( serverListView , 5, 5, 0, 5);
connect( serverListView, SIGNAL( highlighted( const QString &)),
this,SLOT( serverListClicked( const QString &) ) );
connectServerBtn = new QPushButton( tr("Connect"), tab_3 , "ConnectButton" );
tabLayout_3->addMultiCellWidget( connectServerBtn, 6, 6, 0, 1);
connectServerBtn->setToggleButton(TRUE);
connect(connectServerBtn,SIGNAL( toggled( bool)),SLOT( connectorBtnToggled(bool) ));
newServerButton= new QPushButton( tr("Add"), tab_3 , "NewServerButton" );
tabLayout_3->addMultiCellWidget( newServerButton, 6, 6, 2, 2);
connect( newServerButton,SIGNAL( clicked()),SLOT( NewServer() ));
QPushButton *deleteServerBtn;
deleteServerBtn = new QPushButton( tr("Delete"), tab_3 , "OpenButton" );
tabLayout_3->addMultiCellWidget( deleteServerBtn, 6, 6, 3, 3);
connect(deleteServerBtn,SIGNAL(clicked()),SLOT(deleteServer()));
QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
tabLayout_3->addItem( spacer, 5, 0 );
TabWidget->insertTab( tab_3, tr( "Config" ) );
connect(TabWidget,SIGNAL(currentChanged(QWidget *)),
this,SLOT(tabChanged(QWidget*)));
currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
currentDir.setPath( QDir::currentDirPath());
// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" );
layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 4);
currentPathCombo ->setFixedWidth(220);
currentPathCombo->setEditable(TRUE);
currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
connect( currentPathCombo, SIGNAL( activated( const QString & ) ),
this, SLOT( currentPathComboActivated( const QString & ) ) );
connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()),
this,SLOT(currentPathComboChanged()));
ProgressBar = new QProgressBar( this, "ProgressBar" );
layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 4);
ProgressBar->setMaximumHeight(10);
filterStr="*";
b=FALSE;
populateLocalView();
readConfig();
// ServerComboBox->setCurrentItem(currentServerConfig);
TabWidget->setCurrentPage(2);
}
OpieFtp::~OpieFtp()
{
}
void OpieFtp::cleanUp()
{
if(conn)
FtpQuit(conn);
QString sfile=QDir::homeDirPath();
if(sfile.right(1) != "/")
sfile+="/._temp";
else
sfile+="._temp";
QFile file( sfile);
if(file.exists())
file.remove();
Config cfg("opieftp");
cfg.setGroup("Server");
cfg.writeEntry("currentServer", currentServerConfig);
exit(0);
}
void OpieFtp::tabChanged(QWidget *)
{
if (TabWidget->currentPageIndex() == 0) {
currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
tabMenu->setItemChecked(tabMenu->idAt(0),TRUE);
tabMenu->setItemChecked(tabMenu->idAt(1),FALSE);
tabMenu->setItemChecked(tabMenu->idAt(2),FALSE);
if(cdUpButton->isHidden())
cdUpButton->show();
if(homeButton->isHidden())
homeButton->show();
}
if (TabWidget->currentPageIndex() == 1) {
currentPathCombo->lineEdit()->setText( currentRemoteDir );
tabMenu->setItemChecked(tabMenu->idAt(1),TRUE);
tabMenu->setItemChecked(tabMenu->idAt(0),FALSE);
tabMenu->setItemChecked(tabMenu->idAt(2),FALSE);
if(cdUpButton->isHidden())
cdUpButton->show();
homeButton->hide();
}
if (TabWidget->currentPageIndex() == 2) {
tabMenu->setItemChecked(tabMenu->idAt(2),TRUE);
tabMenu->setItemChecked(tabMenu->idAt(0),FALSE);
tabMenu->setItemChecked(tabMenu->idAt(1),FALSE);
cdUpButton->hide();
homeButton->hide();
}
}
void OpieFtp::newConnection()
{
UsernameComboBox->lineEdit()->setText("");
PasswordEdit->setText( "" );
ServerComboBox->lineEdit()->setText( "");
remotePath->setText( currentRemoteDir = "/");
PortSpinBox->setValue( 21);
TabWidget->setCurrentPage(2);
}
void OpieFtp::serverComboEdited(const QString & )
{
// if( ServerComboBox->text(currentServerConfig) != edit /*edit.isEmpty() */) {
// qDebug("ServerComboEdited");
// // currentServerConfig = -1;
// }
}
void OpieFtp::UsernameComboBoxEdited(const QString &) {
// currentServerConfig = -1;
}
void OpieFtp::PasswordEditEdited(const QString & ) {
// currentServerConfig = -1;
}
void OpieFtp::connectorBtnToggled(bool On)
{
if(On) {
connector();
} else {
disConnector();
}
}
void OpieFtp::connector()
{
// QCopEnvelope ( "QPE/System", "busy()" );
// qApp->processEvents();
currentRemoteDir=remotePath->text();
if( ServerComboBox->currentText().isEmpty()) {
QMessageBox::warning(this,tr("Ftp"),tr("Please set the server info"),tr("Ok"),0,0);
TabWidget->setCurrentPage(2);
ServerComboBox->setFocus();
connectServerBtn->setOn(FALSE);
connectServerBtn->setText( tr("Connect"));
return;
}
FtpInit();
TabWidget->setCurrentPage(1);
QString ftp_host = ServerComboBox->currentText();
QString ftp_user = UsernameComboBox->currentText();
QString ftp_pass = PasswordEdit->text();
QString port=PortSpinBox->cleanText();
port.stripWhiteSpace();
Config cfg("opieftp");
cfg.setGroup("Server");
// int current=cfg.readNumEntry("currentServer", 1);
// if(ftp_host!= cfg.readEntry(QString::number( current)))
// currentServerConfig=-1;
// cfg.setGroup(QString::number(current));
// if( ftp_user != cfg.readEntry("Username"))
// currentServerConfig=-1;
// if(ftp_pass != cfg.readEntry(cfg.readEntry("Username")))
// currentServerConfig=-1;
if(ftp_host.find("ftp://",0, TRUE) != -1 )
ftp_host=ftp_host.right(ftp_host.length()-6);
ftp_host+=":"+port;
if (!FtpConnect( ftp_host.latin1(), &conn)) {
QMessageBox::message(tr("Note"),tr("Unable to connect to\n")+ftp_host);
connectServerBtn->setOn(FALSE);
connectServerBtn->setText( tr("Connect"));
return ;
}
if (!FtpLogin( ftp_user.latin1(), ftp_pass.latin1(),conn )) {
QString msg;
msg.sprintf(tr("Unable to log in\n")+"%s",FtpLastResponse(conn));
msg.replace(QRegExp(":"),"\n");
QMessageBox::message(tr("Note"),msg);
if(conn)
FtpQuit(conn);
connectServerBtn->setOn(FALSE);
connectServerBtn->setText( tr("Connect"));
return ;
}
remoteDirList("/") ;
setCaption(ftp_host);
if( currentServerConfig == -1)
writeConfig();
connectServerBtn->setText( tr("Disconnect"));
// QCopEnvelope ( "QPE/System", "notBusy()" );
}
void OpieFtp::disConnector()
{
if(conn)
FtpQuit(conn);
setCaption("OpieFtp");
currentRemoteDir="/";
Remote_View->clear();
connectServerBtn->setText( tr("Connect"));
connectServerBtn->setOn(FALSE);
setCaption("OpieFtp");
}
void OpieFtp::localUpload()
{
int fsz;
// QCopEnvelope ( "QPE/System", "busy()" );
// qApp->processEvents();
QList<QListViewItem> * getSelectedItems( QListView * Local_View );
QListViewItemIterator it( Local_View );
for ( ; it.current(); ++it ) {
if ( it.current()->isSelected() ) {
QString strItem = it.current()->text(0);
QString localFile = currentDir.canonicalPath()+"/"+strItem;
QString remoteFile= currentRemoteDir+strItem;
QFileInfo fi(localFile);
if( !fi.isDir()) {
fsz=fi.size();
ProgressBar->setTotalSteps(fsz);
FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn);
FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn);
FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn);
FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn);
qDebug("Put: %s, %s",localFile.latin1(),remoteFile.latin1());
if( !FtpPut( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) {
QString msg;
msg.sprintf(tr("Unable to upload\n")+"%s",FtpLastResponse(conn));
msg.replace(QRegExp(":"),"\n");
QMessageBox::message(tr("Note"),msg);
}
} else {
QMessageBox::message(tr("Note"),tr("Cannot upload directories"));
}
ProgressBar->reset();
nullifyCallBack();
it.current()->setSelected(FALSE);
} //end currentSelected
}
for ( ; it.current(); ++it ) {
Local_View->clearSelection();
}
Local_View->clearFocus();
TabWidget->setCurrentPage(1);
remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
// QCopEnvelope ( "QPE/System", "notBusy()" );
}
void OpieFtp::nullifyCallBack()
{
FtpOptions(FTPLIB_CALLBACK, 0, conn);
FtpOptions(FTPLIB_IDLETIME, 0, conn);
FtpOptions(FTPLIB_CALLBACKARG, 0, conn);
FtpOptions(FTPLIB_CALLBACKBYTES, 0, conn);
}
void OpieFtp::remoteDownload()
{
// qApp->processEvents();
int fsz;
// QCopEnvelope ( "QPE/System", "busy()" );
QList<QListViewItem> * getSelectedItems( QListView * Remote_View );
QListViewItemIterator it( Remote_View );
for ( ; it.current(); ++it ) {
if ( it.current()->isSelected() ) {
QString strItem = it.current()->text(0);
// strItem=strItem.right(strItem.length()-1);
QString localFile = currentDir.canonicalPath();
if(localFile.right(1).find("/",0,TRUE) == -1)
localFile += "/";
localFile += strItem;
// QString localFile = currentDir.canonicalPath()+"/"+strItem;
QString remoteFile= currentRemoteDir+strItem;
if (!FtpSize( remoteFile.latin1(), &fsz, FTPLIB_ASCII, conn))
fsz = 0;
QString temp;
temp.sprintf( remoteFile+" "+" %dkb", fsz);
ProgressBar->setTotalSteps(fsz);
FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn);
FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn);
FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn);
FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn);
qDebug("Get: %s, %s",localFile.latin1(),remoteFile.latin1());
if(!FtpGet( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) {
QString msg;
msg.sprintf(tr("Unable to download \n")+"%s",FtpLastResponse(conn));
msg.replace(QRegExp(":"),"\n");
QMessageBox::message(tr("Note"),msg);
}
ProgressBar->reset();
nullifyCallBack();
it.current()->setSelected(FALSE);
}
}
for ( ; it.current(); ++it ) {
Remote_View->clearSelection();
}
Remote_View->setFocus();
TabWidget->setCurrentPage(0);
populateLocalView();
// QCopEnvelope ( "QPE/System", "notBusy()" );
}
bool OpieFtp::remoteDirList(const QString &dir)
{
QString tmp = QDir::homeDirPath();
if(tmp.right(1) != "/")
tmp+="/._temp";
else
tmp+="._temp";
// qDebug("Listing remote dir "+tmp);
// QCopEnvelope ( "QPE/System", "busy()" );
if (!FtpDir( tmp.latin1(), dir.latin1(), conn) ) {
QString msg;
msg.sprintf(tr("Unable to list the directory\n")+dir+"\n%s",FtpLastResponse(conn) );
msg.replace(QRegExp(":"),"\n");
QMessageBox::message(tr("Note"),msg);
return false;
}
populateRemoteView() ;
// QCopEnvelope ( "QPE/System", "notBusy()" );
return true;
}
bool OpieFtp::remoteChDir(const QString &dir)
{
// QCopEnvelope ( "QPE/System", "busy()" );
if (!FtpChdir( dir.latin1(), conn )) {
QString msg;
msg.sprintf(tr("Unable to change directories\n")+dir+"\n%s",FtpLastResponse(conn));
msg.replace(QRegExp(":"),"\n");
QMessageBox::message(tr("Note"),msg);
// qDebug(msg);
// QCopEnvelope ( "QPE/System", "notBusy()" );
return FALSE;
}
// QCopEnvelope ( "QPE/System", "notBusy()" );
return TRUE;
}
void OpieFtp::populateLocalView()
{
Local_View->clear();
currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
currentDir.setMatchAllDirs(TRUE);
currentDir.setNameFilter(filterStr);
QString fileL, fileS, fileDate;
bool isDir=FALSE;
const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/);
QFileInfoListIterator it(*list);
QFileInfo *fi;
while ( (fi=it.current()) ) {
if (fi->isSymLink() ){
QString symLink=fi->readLink();
// qDebug("Symlink detected "+symLink);
QFileInfo sym( symLink);
fileS.sprintf( "%10i", sym.size() );
fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() );
fileDate = sym.lastModified().toString();
} else {
// qDebug("Not a dir: "+currentDir.canonicalPath()+fileL);
fileS.sprintf( "%10i", fi->size() );
fileL.sprintf( "%s",fi->fileName().data() );
fileDate= fi->lastModified().toString();
if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) {
fileL+="/";
isDir=TRUE;
// qDebug( fileL);
}
}
if(fileL !="./" && fi->exists()) {
item = new QListViewItem( Local_View,fileL, fileDate, fileS );
QPixmap pm;
if(isDir || fileL.find("/",0,TRUE) != -1) {
if( !QDir( fi->filePath() ).isReadable())
pm = Resource::loadPixmap( "lockedfolder" );
else
pm= Resource::loadPixmap( "folder" );
item->setPixmap( 0,pm );
} else {
if( !fi->isReadable() )
pm = Resource::loadPixmap( "locked" );
else {
MimeType mt(fi->filePath());
pm=mt.pixmap(); //sets the correct pixmap for mimetype
if(pm.isNull())
pm = unknownXpm;
}
}
if( fileL.find("->",0,TRUE) != -1) {
// overlay link image
pm= Resource::loadPixmap( "folder" );
QPixmap lnk = Resource::loadPixmap( "opie/symlink" );
QPainter painter( &pm );
painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk );
pm.setMask( pm.createHeuristicMask( FALSE ) );
}
item->setPixmap( 0,pm);
}
isDir=FALSE;
++it;
}
Local_View->setSorting( 3,FALSE);
currentPathCombo->lineEdit()->setText( currentDir.canonicalPath() );
fillCombo( (const QString &)currentDir);
}
bool OpieFtp::populateRemoteView( )
{
// qDebug("populate remoteview");
QString sfile=QDir::homeDirPath();
if(sfile.right(1) != "/")
sfile+="/._temp";
else
sfile+="._temp";
QFile file( sfile);
Remote_View->clear();
QString s, File_Name;
QListViewItem *itemDir=NULL, *itemFile=NULL;
QRegExp monthRe(" [JFMASOND][eapuecoe][brynlgptvc] [ 0-9][0-9] [ 0-9][0-9][:0-9][0-9][0-9] ");
QString fileL, fileS, fileDate;
if ( file.open(IO_ReadOnly)) {
QTextStream t( &file ); // use a text stream
while ( !t.eof()) {
s = t.readLine();
if(s.find("total",0,TRUE) == 0)
continue;
int len, month = monthRe.match(s, 0, &len);
fileDate = s.mid(month + 1, len - 2); // minus spaces
fileL = s.right(s.length() - month - len);
if(s.left(1) == "d")
fileL = fileL+"/";
fileS = s.mid(month - 8, 8); // FIXME
fileS = fileS.stripWhiteSpace();
if(s.left(1) == "d" || fileL.find("/",0,TRUE) != -1) {
QListViewItem * item = new QListViewItem( Remote_View, fileL, fileDate, fileS,"d");
item->setPixmap( 0, Resource::loadPixmap( "folder" ));
// if(itemDir)
item->moveItem(itemDir);
itemDir=item;
} else {
QListViewItem * item = new QListViewItem( Remote_View, fileL, fileDate, fileS,"f");
item->setPixmap( 0, Resource::loadPixmap( "fileopen" ));
// if(itemFile)
item->moveItem(itemDir);
item->moveItem(itemFile);
itemFile=item;
}
}
QListViewItem * item1 = new QListViewItem( Remote_View, "../");
item1->setPixmap( 0, Resource::loadPixmap( "folder" ));
file.close();
if( file.exists())
file. remove();
} else
- qDebug("temp file not opened successfullly "+sfile);
+ qDebug("temp file not opened successfully "+sfile);
Remote_View->setSorting( 4,TRUE);
return true;
}
void OpieFtp::remoteListClicked(QListViewItem *selectedItem)
{
if( selectedItem) {
// if(selectedItem!= NULL) {
// QCopEnvelope ( "QPE/System", "busy()" );
QString oldRemoteCurrentDir = currentRemoteDir;
QString strItem=selectedItem->text(0);
strItem=strItem.simplifyWhiteSpace();
if(strItem == "../") { // the user wants to go ^
if( FtpCDUp( conn) == 0) {
QString msg;
msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn));
msg.replace(QRegExp(":"),"\n");
QMessageBox::message(tr("Note"),msg);
// qDebug(msg);
}
char path[256];
if( FtpPwd( path,sizeof(path),conn) == 0) { //this is easier than fudging the string
QString msg;
msg.sprintf(tr("Unable to get working dir\n")+"%s",FtpLastResponse(conn));
msg.replace(QRegExp(":"),"\n");
QMessageBox::message(tr("Note"),msg);
// qDebug(msg);
}
currentRemoteDir=path;
} else {
if(strItem.find("->",0,TRUE) != -1) { //symlink on some servers
strItem=strItem.right( strItem.length() - strItem.find("->",0,TRUE) - 2 );
strItem = strItem.stripWhiteSpace();
currentRemoteDir = strItem;
if( !remoteChDir( (const QString &)strItem)) {
currentRemoteDir = oldRemoteCurrentDir;
strItem="";
// qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir);
}
} else if(strItem.find("/",0,TRUE) != -1) { // this is a directory
if( !remoteChDir( (const QString &)currentRemoteDir + strItem)) {
currentRemoteDir = oldRemoteCurrentDir;
strItem="";
// qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir);
} else {
currentRemoteDir = currentRemoteDir+strItem;
}
} else {
// QCopEnvelope ( "QPE/System", "notBusy()" );
return;
}
}
remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
if(currentRemoteDir.right(1) !="/")
currentRemoteDir +="/";
currentPathCombo->lineEdit()->setText( currentRemoteDir);
fillRemoteCombo( (const QString &)currentRemoteDir);
// QCopEnvelope ( "QPE/System", "notBusy()" );
Remote_View->ensureItemVisible(Remote_View->firstChild());
}
}
void OpieFtp::localListClicked(QListViewItem *selectedItem)
{
if(selectedItem!= NULL) {
QString strItem=selectedItem->text(0);
QString strSize=selectedItem->text(1);
strSize=strSize.stripWhiteSpace();
if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink
// is symlink
QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4);
if(QDir(strItem2).exists() ) {
currentDir.cd(strItem2, TRUE);
populateLocalView();
}
} else { // not a symlink
if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) {
if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) {
strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem);
currentDir.cd(strItem,FALSE);
populateLocalView();
} else {
currentDir.cdUp();
populateLocalView();
}
if(QDir(strItem).exists()){
currentDir.cd(strItem, TRUE);
populateLocalView();
}
} else {
strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem);
if( QFile::exists(strItem ) ) {
// qDebug("upload "+strItem);
return;
}
} //end not symlink
chdir(strItem.latin1());
}
Local_View->ensureItemVisible(Local_View->firstChild());
}
}
void OpieFtp::doLocalCd()
{
localListClicked( Local_View->currentItem());
}
void OpieFtp:: doRemoteCd()
{
remoteListClicked( Remote_View->currentItem());
}
void OpieFtp::showHidden()
{
if (!b) {
currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
localMenu->setItemChecked(localMenu->idAt(0),TRUE);
// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
b=TRUE;
} else {
currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
localMenu->setItemChecked(localMenu->idAt(0),FALSE);
// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
b=FALSE;
}
populateLocalView();
}
void OpieFtp::ListPressed( int mouse, QListViewItem *item, const QPoint &, int)
{
// if(item)
if (mouse == 2) {
showLocalMenu(item);
}
}
void OpieFtp::RemoteListPressed( int mouse, QListViewItem *item, const QPoint &, int )
{
if(mouse == 2) {
showRemoteMenu(item);
}
}
void OpieFtp::showRemoteMenu(QListViewItem * item)
{
QPopupMenu * m;// = new QPopupMenu( Local_View );
m = new QPopupMenu(this);
if(item != NULL ) {
if( item->text(0).find("/",0,TRUE) != -1)
m->insertItem( tr( "Change Directory" ), this, SLOT( doRemoteCd() ));
else
m->insertItem( tr( "Download" ), this, SLOT( remoteDownload() ));
}
m->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() ));
m->insertItem( tr("Rescan"), this, SLOT( populateLocalView() ));
m->insertItem( tr( "Rename" ), this, SLOT( remoteRename() ));
m->insertSeparator();
m->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() ));
m->exec( QCursor::pos() );
delete m;
}
void OpieFtp::showLocalMenu(QListViewItem * item)
{
QPopupMenu *m;
m = new QPopupMenu( this);
m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() ));
m->insertSeparator();
if(item != NULL ) {
if( item->text(0).find("/",0,TRUE) !=-1)
m->insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() ));
else
m->insertItem( tr( "Upload" ), this, SLOT( localUpload() ));
}
m->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() ));
m->insertItem( tr("Rescan"), this, SLOT( populateRemoteView() ));
m->insertItem( tr( "Rename" ), this, SLOT( localRename() ));
m->insertSeparator();
m->insertItem( tr( "Delete" ), this, SLOT( localDelete() ));
m->setCheckable(TRUE);
if (b)
m->setItemChecked(m->idAt(0),TRUE);
else
m->setItemChecked(m->idAt(0),FALSE);
m->exec( QCursor::pos() );
delete m;
}
void OpieFtp::localMakDir()
{
InputDialog *fileDlg;
fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0);
fileDlg->exec();
if( fileDlg->result() == 1 ) {
QString filename = fileDlg->LineEdit1->text();
currentDir.mkdir( currentDir.canonicalPath()+"/"+filename);
}
populateLocalView();
}
void OpieFtp::localDelete()
{
QList<QListViewItem> * getSelectedItems( QListView * Local_View );
QListViewItemIterator it( Local_View );
for ( ; it.current(); ++it ) {
if ( it.current()->isSelected() ) {
QString f = it.current()->text(0);
it.current()->setSelected(FALSE);
// QString f = Local_View->currentItem()->text(0);
if(QDir(f).exists() ) {
switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+
tr(" ?\nIt must be empty"),tr("Yes"),tr("No"),0,0,1) ) {
case 0: {
f=currentDir.canonicalPath()+"/"+f;
QString cmd="rmdir "+f;
system( cmd.latin1());
}
break;
case 1:
// exit
break;
};
} else {
switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f
+" ?",tr("Yes"),tr("No"),0,0,1) ) {
case 0: {
f=currentDir.canonicalPath()+"/"+f;
QString cmd="rm "+f;
system( cmd.latin1());
}
break;
case 1:
// exit
break;
};
}
}
}
populateLocalView();
}
void OpieFtp::remoteMakDir()
{
InputDialog *fileDlg;
fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0);
fileDlg->exec();
if( fileDlg->result() == 1 ) {
QString filename = fileDlg->LineEdit1->text();//+".playlist";
QString tmp=currentRemoteDir+filename;
// QCopEnvelope ( "QPE/System", "busy()" );
if(FtpMkdir( tmp.latin1(), conn) == 0) {
QString msg;
msg.sprintf(tr("Unable to make directory\n")+"%s",FtpLastResponse(conn));
msg.replace(QRegExp(":"),"\n");
QMessageBox::message(tr("Note"),msg);
}
// QCopEnvelope ( "QPE/System", "notBusy()" );
remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
}
}
void OpieFtp::remoteDelete()
{
QList<QListViewItem> * getSelectedItems( QListView * Remote_View );
QListViewItemIterator it( Remote_View );
for ( ; it.current(); ++it ) {
if ( it.current()->isSelected() ) {
QString f = it.current()->text(0);
// QString f = Remote_View->currentItem()->text(0);
// QCopEnvelope ( "QPE/System", "busy()" );
if( f.right(1) =="/") {
QString path= currentRemoteDir+f;
switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+"?"
,tr("Yes"),tr("No"),0,0,1) ) {
case 0: {
f=currentDir.canonicalPath()+"/"+f;
if(FtpRmdir( path.latin1(), conn) ==0) {
QString msg;
msg.sprintf(tr("Unable to remove directory\n")+"%s",FtpLastResponse(conn));
msg.replace(QRegExp(":"),"\n");
QMessageBox::message(tr("Note"),msg);
}
remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
}
break;
};
} else {
switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+"?"
,tr("Yes"),tr("No"),0,0,1) ) {
case 0: {
QString path= currentRemoteDir+f;
if(FtpDelete( path.latin1(), conn)==0) {
QString msg;
msg.sprintf(tr("Unable to delete file\n")+"%s",FtpLastResponse(conn));
msg.replace(QRegExp(":"),"\n");
QMessageBox::message(tr("Note"),msg);
}
remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
}
break;
};
}
}
}
// QCopEnvelope ( "QPE/System", "notBusy()" );
}
void OpieFtp::remoteRename()
{
QString curFile = Remote_View->currentItem()->text(0);
InputDialog *fileDlg;
fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0);
fileDlg->setTextEdit((const QString &)curFile);
fileDlg->exec();
if( fileDlg->result() == 1 ) {
QString oldName = currentRemoteDir +"/"+ curFile;
QString newName = currentRemoteDir +"/"+ fileDlg->LineEdit1->text();//+".playlist";
// QCopEnvelope ( "QPE/System", "busy()" );
if(FtpRename( oldName.latin1(), newName.latin1(),conn) == 0) {
QString msg;
msg.sprintf(tr("Unable to rename file\n")+"%s",FtpLastResponse(conn));
msg.replace(QRegExp(":"),"\n");
QMessageBox::message(tr("Note"),msg);
}
// QCopEnvelope ( "QPE/System", "notBusy()" );
remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
}
}
void OpieFtp::localRename()
{
QString curFile = Local_View->currentItem()->text(0);
InputDialog *fileDlg;
fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0);
fileDlg->setTextEdit((const QString &)curFile);
fileDlg->exec();
if( fileDlg->result() == 1 ) {
QString oldname = currentDir.canonicalPath() + "/" + curFile;
QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist";
if( rename(oldname.latin1(), newName.latin1())== -1)
QMessageBox::message(tr("Note"),tr("Could not rename"));
}
populateLocalView();
}
void OpieFtp::currentPathComboActivated(const QString & currentPath) {
if (TabWidget->currentPageIndex() == 0) {
chdir( currentPath.latin1() );
currentDir.cd( currentPath, TRUE);
populateLocalView();
update();
} else {
// chdir( currentPath.latin1() );
// currentDir.cd( currentPath, TRUE);
// populateList();
// update();
}
}
void OpieFtp::fillCombo(const QString &currentPath) {
currentPathCombo->lineEdit()->setText(currentPath);
if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) {
currentPathCombo->clear();
localDirPathStringList.prepend(currentPath );
currentPathCombo->insertStringList( localDirPathStringList,-1);
}
currentPathCombo->lineEdit()->setText(currentPath);
if( remoteDirPathStringList.grep(currentPath,TRUE).isEmpty() ) {
currentPathCombo->clear();
remoteDirPathStringList.prepend(currentPath );
currentPathCombo->insertStringList( remoteDirPathStringList,-1);
}
}
void OpieFtp::fillRemoteCombo(const QString &currentPath) {
currentPathCombo->lineEdit()->setText(currentPath);
if( remoteDirPathStringList.grep(currentPath,TRUE).isEmpty() ) {
currentPathCombo->clear();
remoteDirPathStringList.prepend(currentPath );
currentPathCombo->insertStringList( remoteDirPathStringList,-1);
}
}
void OpieFtp::currentPathComboChanged()
{
QString oldRemoteCurrentDir = currentRemoteDir;
// qDebug("oldRemoteCurrentDir "+oldRemoteCurrentDir);
if (TabWidget->currentPageIndex() == 0) {
if(QDir( currentPathCombo->lineEdit()->text()).exists()) {
currentDir.setPath( currentPathCombo->lineEdit()->text() );
populateLocalView();
} else {
QMessageBox::message(tr("Note"),tr("That directory does not exist"));
}
}
if (TabWidget->currentPageIndex() == 1) {
currentRemoteDir = currentPathCombo->lineEdit()->text();
if(currentRemoteDir.right(1) !="/") {
currentRemoteDir = currentRemoteDir +"/";
currentPathCombo->lineEdit()->setText( currentRemoteDir );
}
if( !remoteChDir( (const QString &)currentRemoteDir) ) {
currentRemoteDir = oldRemoteCurrentDir;
currentPathCombo->lineEdit()->setText( currentRemoteDir );
}
remoteDirList( (const QString &)currentRemoteDir);
}
}
void OpieFtp::switchToLocalTab()
{
TabWidget->setCurrentPage(0);
}
void OpieFtp::switchToRemoteTab()
{
TabWidget->setCurrentPage(1);
}
void OpieFtp::switchToConfigTab()
{
TabWidget->setCurrentPage(2);
}
void OpieFtp::readConfig()
{
fillCombos();
Config cfg("opieftp");
cfg.setGroup("Server");
currentServerConfig = cfg.readNumEntry("currentServer", -1);
// qDebug("Reading %d", currentServerConfig);
serverComboSelected( currentServerConfig-1);
}
void OpieFtp::writeConfig()
{
qDebug("write config");
Config cfg("opieftp");
cfg.setGroup("Server");
QString username, remoteServerStr, remotePathStr, password, port, temp;
int numberOfEntries = cfg.readNumEntry("numberOfEntries",0);
if( currentServerConfig == -1) {
for (int i = 1; i <= numberOfEntries; i++) {
temp.setNum(i);
cfg.setGroup("Server");
QString tempStr = cfg.readEntry( temp,"");
}
temp.setNum( numberOfEntries + 1);
cfg.setGroup("Server");
remoteServerStr = cfg.readEntry( temp,"");
int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE);
remoteServerStr = remoteServerStr.left(remoteServerStr.length()-divider);
temp.setNum(numberOfEntries+1);
cfg.setGroup("Server");
cfg.writeEntry( temp, ServerComboBox->currentText() +":"+PortSpinBox->cleanText() );
cfg.writeEntry("currentServer", numberOfEntries+1);
currentServerConfig = numberOfEntries+1;
qDebug("setting currentserverconfig to %d", currentServerConfig);
cfg.setGroup(temp);
if(!newServerName.isEmpty())
cfg.writeEntry("ServerName", newServerName);
cfg.writeEntry("RemotePath", remotePath->text());
cfg.writeEntry("Username", UsernameComboBox->currentText());
cfg.writeEntryCrypt( UsernameComboBox->currentText(), PasswordEdit->text());
cfg.setGroup("Server");
cfg.writeEntry("numberOfEntries", QString::number(numberOfEntries + 1 ));
}
}
void OpieFtp::clearCombos() {
qDebug("clearing");
ServerComboBox->clear();
UsernameComboBox->clear();
PasswordEdit->clear();
serverListView->clear();
}
void OpieFtp::fillCombos()
{
clearCombos();
Config cfg("opieftp");
cfg.setGroup("Server");
QString username, remoteServerStr, remotePathStr, password, port, temp;
int numberOfEntries = cfg.readNumEntry("numberOfEntries",0);
for (int i = 1; i <= numberOfEntries; i++) {
temp.setNum(i);
qDebug(temp);
cfg.setGroup("Server");
remoteServerStr = cfg.readEntry( temp,"");
qDebug( remoteServerStr);
int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE);
port = remoteServerStr.right( divider - 1);
bool ok;
PortSpinBox->setValue( port.toInt(&ok,10));
remoteServerStr = remoteServerStr.left(remoteServerStr.length()-divider);
qDebug( "remote server string "+remoteServerStr);
ServerComboBox->insertItem( remoteServerStr );
cfg.setGroup(temp);
username = cfg.readEntry(temp);
UsernameComboBox->insertItem(username);
password = cfg.readEntryCrypt(username,"");
PasswordEdit->setText(password);
serverListView->insertItem( cfg.readEntry("ServerName"));
}
}
void OpieFtp::serverComboSelected(int index)
{
currentServerConfig = index+1;
qDebug("server combo selected %d", index+1);
QString username, remoteServerStr, remotePathStr, password, port, temp;
// remoteServerStr = ServerComboBox->text(index);
Config cfg("opieftp");
cfg.setGroup("Server");
// int numberOfEntries = cfg.readNumEntry("numberOfEntries",0);
temp.setNum(index+1);
remoteServerStr = cfg.readEntry( temp,"");
qDebug("Group" +temp);
cfg.setGroup(temp);
// qDebug(temp);
int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE);
port = remoteServerStr.right( divider - 1);
bool ok;
int portInt = port.toInt(&ok,10);
if( portInt == 0) portInt = 21;
ServerComboBox->lineEdit()->setText(remoteServerStr.left( remoteServerStr.find(":",0,TRUE)));
PortSpinBox->setValue( portInt);
remotePath->setText(cfg.readEntry("RemotePath", "/"));
username = cfg.readEntry("Username", "anonymous");
UsernameComboBox->lineEdit()->setText(username);
qDebug(username);
// qDebug("Password is "+cfg.readEntryCrypt(username, "me@opieftp.org"));
PasswordEdit->setText(cfg.readEntryCrypt(username, "me@opieftp.org"));
// UsernameComboBox
// PasswordEdit
cfg.setGroup("Server");
temp.sprintf("%d",currentServerConfig);
cfg.writeEntry("currentServer", temp);
fuckeduphack = TRUE;
serverListView->setCurrentItem( index);
fuckeduphack=FALSE;
qDebug("server list set selected %d",index);
update();
}
void OpieFtp::deleteServer()
{
QString username, remoteServerStr, remotePathStr, password, port, temp, servername;
remoteServerStr = ServerComboBox->currentText( );
username = UsernameComboBox->currentText();
servername=serverListView->currentText();
Config cfg("opieftp");
cfg.setGroup("Server");
QString tempname;
int numberOfEntries = cfg.readNumEntry("numberOfEntries",0);
for (int i = 1; i <= numberOfEntries; i++) {
temp.setNum(i);
// cfg.setGroup("Server");
cfg.setGroup(QString::number(i));
tempname=cfg.readEntry( "ServerName","");
if( tempname.find( servername,0,TRUE) != -1 ) {
// servername.find( cfg.readEntry("ServerName")) != -1 &&
// remoteServerStr.find( cfg.readEntry("RemotePath")) != -1 &&
// username.find( cfg.readEntry("Username")) != -1) {
serverListView->removeItem(i);
qDebug("OK DELETE "+tempname);
cfg.removeEntry(QString::number(i));
for ( ; i <= numberOfEntries; i++) {
cfg.setGroup("Server");
cfg.writeEntry("Server", QString::number(numberOfEntries + 1 ));
cfg.setGroup(QString::number(i+1)); //get next server config
servername=cfg.readEntry("ServerName");
remoteServerStr=cfg.readEntry("RemotePath");
username=cfg.readEntry("Username");
password=cfg.readEntryCrypt( username);
cfg.setGroup(QString::number(i));
cfg.writeEntry("RemotePath", remoteServerStr);
cfg.writeEntry("ServerName", servername);
cfg.writeEntry("Username", username);
cfg.writeEntryCrypt( username, password);
}
cfg.setGroup("Server");
cfg.writeEntry("numberOfEntries", QString::number(numberOfEntries - 1 ));
}
}
cfg.setGroup(QString::number(numberOfEntries));
cfg.removeEntry("Server");
cfg.removeEntry("RemotePath");
cfg.removeEntry("ServerName");
username=cfg.readEntry("Username");
cfg.removeEntry("Username");
cfg.removeEntry(username);
currentServerConfig=currentServerConfig-1;
fillCombos();
update();
}
void OpieFtp::upDir()
{
if (TabWidget->currentPageIndex() == 0) {
QString current = currentDir.canonicalPath();
QDir dir(current);
dir.cdUp();
current = dir.canonicalPath();
chdir( current.latin1() );
currentDir.cd( current, TRUE);
populateLocalView();
update();
} else {
if( FtpCDUp( conn) == 0) {
QString msg;
msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn));
msg.replace(QRegExp(":"),"\n");
QMessageBox::message(tr("Note"),msg);
// qDebug(msg);
}
char path[256];
if( FtpPwd( path,sizeof(path),conn) == 0) { //this is easier than fudging the string
QString msg;
msg.sprintf(tr("Unable to get working dir\n")+"%s",FtpLastResponse(conn));
msg.replace(QRegExp(":"),"\n");
QMessageBox::message(tr("Note"),msg);
// qDebug(msg);
}
currentRemoteDir=path;
remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
if(currentRemoteDir.right(1) !="/")
currentRemoteDir +="/";
currentPathCombo->lineEdit()->setText( currentRemoteDir);
fillRemoteCombo( (const QString &)currentRemoteDir);
}
}
void OpieFtp::docButtonPushed() {
QString current = QPEApplication::documentDir();
chdir( current.latin1() );
currentDir.cd( current, TRUE);
populateLocalView();
update();
}
void OpieFtp::homeButtonPushed() {
QString current = QDir::homeDirPath();
chdir( current.latin1() );
currentDir.cd( current, TRUE);
populateLocalView();
update();
}
void OpieFtp::doAbout() {
QMessageBox::message("OpieFtp","Opie ftp client is copyright 2002 by\n"
"L.J.Potter<llornkcor@handhelds.org>\n"
"and uses ftplib copyright 1996-2000\n"
"by Thomas Pfau, pfau@cnj.digex.net\n\n"
"and is licensed by the GPL");
}
void OpieFtp::NewServer() {
InputDialog *fileDlg;
fileDlg = new InputDialog(this,tr("New Server name"),TRUE, 0);
fileDlg->exec();
Config cfg("opieftp");
if( fileDlg->result() == 1 ) {
newServerName = fileDlg->LineEdit1->text();
for(int i=1;i<serverListView->count();i++) {
cfg.setGroup( QString::number(i));
if(cfg.readEntry("ServerName").find(newServerName,0,TRUE) != -1) {
QMessageBox::message(tr("OpieFtp"),tr("Sorry name already taken"));
return;
}
}
currentServerConfig =-1;
writeConfig();
serverListView->insertItem( newServerName );
serverListView->setCurrentItem( serverListView->count());
}
}
void OpieFtp::serverListClicked( const QString &item) {
if(item.isEmpty()) return;
Config cfg("opieftp");
qDebug("highltined "+item);
int numberOfEntries = cfg.readNumEntry("numberOfEntries",0);
for (int i = 1; i <= numberOfEntries; i++) {
cfg.setGroup(QString::number(i));
if(cfg.readEntry( "ServerName").find(item) != -1 && !fuckeduphack)
serverComboSelected(i-1);
}
}
void OpieFtp::timerOut() {
}
diff --git a/noncore/settings/backup/backuprestore.cpp b/noncore/settings/backup/backuprestore.cpp
index 477e24d..93bedf6 100644
--- a/noncore/settings/backup/backuprestore.cpp
+++ b/noncore/settings/backup/backuprestore.cpp
@@ -1,471 +1,471 @@
#include "backuprestore.h"
//#include "output.h"
#include "errordialog.h"
#include <qapplication.h>
#include <qmultilineedit.h>
#include <qdir.h>
#include <qfile.h>
#include <qfileinfo.h>
#include <qlistview.h>
#include <qpushbutton.h>
#include <qheader.h>
#include <qpe/resource.h>
#include <qpe/config.h>
#include <qmessagebox.h>
#include <qcombobox.h>
#include <qlist.h>
#include <stdlib.h>
#include <qregexp.h>
#include <qtextstream.h>
#include <qtextview.h>
#include <qpe/storage.h>
#include <errno.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/stat.h>
#include <dirent.h>
#define HEADER_NAME 0
#define HEADER_BACKUP 1
#define BACKUP_LOCATION 2
#define EXTENSION ".bck"
const QString tempFileName = "/tmp/backup.err";
BackupAndRestore::BackupAndRestore( QWidget* parent, const char* name, WFlags fl)
: BackupAndRestoreBase(parent, name, fl)
{
this->showMaximized();
backupList->header()->hide();
restoreList->header()->hide();
connect(backupButton, SIGNAL(clicked()),
this, SLOT(backup()));
connect(restoreButton, SIGNAL(clicked()),
this, SLOT(restore()));
connect(backupList, SIGNAL(clicked( QListViewItem * )),
this, SLOT(selectItem(QListViewItem*)));
connect(restoreSource, SIGNAL(activated( int )),
this, SLOT(sourceDirChanged(int)));
connect(updateList, SIGNAL(clicked()),
this, SLOT( fileListUpdate()));
//add directorys for backing up
applicationSettings = new QListViewItem(backupList, "Application Settings", "", "Settings/");
selectItem(applicationSettings);
applicationSettings = new QListViewItem(backupList, "Application Data", "", "Applications/");
selectItem(applicationSettings);
documents= new QListViewItem(backupList, "Documents", "", "Documents/");
selectItem(documents);
scanForApplicationSettings();
backupLocations.insert( "Documents", QDir::homeDirPath() + "/Documents" );
if (StorageInfo::hasCf())
{
backupLocations.insert("CF", "/mnt/cf");
}
if (StorageInfo::hasSd() || StorageInfo::hasMmc())
{
backupLocations.insert("SD", "/mnt/card");
}
Config config("BackupAndRestore");
//read last locations
config.setGroup("LastLocation");
QString lastStoreLocation = config.readEntry( "LastStoreLocation", "" );
QString lastRestoreLocation = config.readEntry( "LastRestoreLocation", "" );
int locationIndex = 0;
QMap<QString, QString>::Iterator it;
for( it = backupLocations.begin(); it != backupLocations.end(); ++it )
{
storeToLocation->insertItem(it.key());
restoreSource->insertItem(it.key());
//check for last locations
if ( it.key() == lastStoreLocation )
storeToLocation->setCurrentItem( locationIndex );
if ( it.key() == lastRestoreLocation )
restoreSource->setCurrentItem( locationIndex );
locationIndex++;
}
// Read the list of items to ignore.
QList<QString> dontBackupList;
dontBackupList.setAutoDelete(true);
config.setGroup("DontBackup");
int total = config.readNumEntry("Total", 0);
for(int i = 0; i < total; i++)
{
dontBackupList.append(new QString(config.readEntry(QString("%1").arg(i), "")));
}
QList<QListViewItem> list;
getAllItems(backupList->firstChild(), list);
for(uint i = 0; i < list.count(); i++)
{
QString text = list.at(i)->text(HEADER_NAME);
for(uint i2 = 0; i2 < dontBackupList.count(); i2++)
{
if(*dontBackupList.at(i2) == text)
{
selectItem(list.at(i));
break;
}
}
}
}
BackupAndRestore::~BackupAndRestore()
{
QList<QListViewItem> list;
getAllItems(backupList->firstChild(), list);
Config config("BackupAndRestore");
config.setGroup("DontBackup");
config.clearGroup();
int count = 0;
for(uint i = 0; i < list.count(); i++)
{
if(list.at(i)->text(HEADER_BACKUP) == "")
{
config.writeEntry(QString("%1").arg(count), list.at(i)->text(HEADER_NAME));
count++;
}
}
config.writeEntry("Total", count);
// Remove Temp File
if ( QFile::exists( tempFileName ) )
QFile::remove( tempFileName );
}
QList<QListViewItem> BackupAndRestore::getAllItems(QListViewItem *item, QList<QListViewItem> &list)
{
while(item)
{
if(item->childCount() > 0)
getAllItems(item->firstChild(), list);
list.append(item);
item = item->nextSibling();
}
return list;
}
/**
* Selects and unselects the item by setting the HEADER_BACKUP to B or !.
* and changing the icon to match
* @param currentItem the item to swich the selection choice.
*/
void BackupAndRestore::selectItem(QListViewItem *currentItem)
{
if(!currentItem)
return;
if(currentItem->text(HEADER_BACKUP) == "B")
{
currentItem->setPixmap(HEADER_NAME, Resource::loadPixmap("backup/null"));
currentItem->setText(HEADER_BACKUP, "");
}
else
{
currentItem->setPixmap(HEADER_NAME, Resource::loadPixmap("backup/check"));
currentItem->setText(HEADER_BACKUP, "B");
}
}
void BackupAndRestore::scanForApplicationSettings()
{
QDir d( QDir::homeDirPath() + "/" + QString( applicationSettings->text(BACKUP_LOCATION) ) );
d.setFilter( QDir::Dirs | QDir::Files | QDir::NoSymLinks );
const QFileInfoList *list = d.entryInfoList();
QFileInfoListIterator it( *list );
QFileInfo *fi;
while ( (fi=it.current()) )
{
//qDebug((d.path()+"/"+fi->fileName()).latin1());
if ( ( fi->fileName() != "." ) && ( fi->fileName() != ".." ) )
{
QListViewItem *newItem = new QListViewItem(applicationSettings, fi->fileName());
selectItem(newItem);
}
++it;
}
}
/**
* The "Backup" button has been pressed. Get a list of all of the files that
* should be backed up. If there are no files, emit and error and exit.
* Determine the file name to store the backup in. Backup the file(s) using
* tar and gzip --best. Report failure or success
*/
void BackupAndRestore::backup()
{
QString backupFiles;
if(getBackupFiles(backupFiles, NULL) == 0)
{
QMessageBox::critical(this, "Message",
"No items selected.",QString("Ok") );
return;
}
setCaption(tr("Backup and Restore... working..."));
QString outputFile = backupLocations[storeToLocation->currentText()];
QDateTime datetime = QDateTime::currentDateTime();
QString dateString = QString::number( datetime.date().year() ) + QString::number( datetime.date().month() ).rightJustify(2, '0') +
QString::number( datetime.date().day() ).rightJustify(2, '0');
outputFile += "/" + dateString;
QString t = outputFile;
int c = 1;
while(QFile::exists(outputFile + EXTENSION))
{
outputFile = t + QString("%1").arg(c);
c++;
}
// We execute tar and compressing its output with gzip..
// The error output will be written into a temp-file which could be provided
// for debugging..
qDebug( "Storing file: %s", outputFile.latin1() );
outputFile += EXTENSION;
QString commandLine = QString( "(tar -C %1 -c %2 | gzip > %3 ) 2> %4" ).arg( QDir::homeDirPath() )
.arg( backupFiles )
.arg( outputFile.latin1() )
.arg( tempFileName.latin1() );
qDebug( commandLine );
int r = system( commandLine );
if(r != 0)
{
perror("Error: ");
QString errorMsg= tr( "Error from System:\n" ) + (QString)strerror( errno );
switch( QMessageBox::critical(this, tr( "Message" ), tr( "Backup Failed!" ) + "\n"
+ errorMsg, QString( tr( "Ok" ) ), QString( tr( "Details" ) ) ) )
{
case 1:
qWarning("Details pressed !");
ErrorDialog* pErrDialog = new ErrorDialog( this, NULL, true );
QFile errorFile( tempFileName );
if ( errorFile.open(IO_ReadOnly) )
{
QTextStream t( &errorFile );
QString s;
while ( !t.eof() )
{ // until end of file...
s += t.readLine(); // line of text excluding '\n'
}
errorFile.close();
pErrDialog->m_textarea->setText( s );
}
else
{
pErrDialog->m_textarea->setText( "Unable to open File: /tmp/backup.er" );
}
pErrDialog->showMaximized();
pErrDialog->exec();
delete pErrDialog;
break;
}
setCaption(tr("Backup and Restore.. Failed !!"));
return;
}
else
{
- QMessageBox::information(this, tr( "Message" ), tr( "Backup Successfull." ), QString(tr( "Ok" ) ) );
+ QMessageBox::information(this, tr( "Message" ), tr( "Backup Successful." ), QString(tr( "Ok" ) ) );
}
//write store-location
Config config( "BackupAndRestore" );
config.setGroup( "LastLocation" );
config.writeEntry( "LastStoreLocation", storeToLocation->currentText() );
setCaption(tr("Backup and Restore"));
}
/***
* Get a list of all of the files to backup.
*/
int BackupAndRestore::getBackupFiles(QString &backupFiles, QListViewItem *parent)
{
QListViewItem * currentItem;
QString currentHome;
if(!parent)
currentItem = backupList->firstChild();
else
{
currentItem = parent->firstChild();
currentHome = parent->text(BACKUP_LOCATION);
}
uint count = 0;
while( currentItem != 0 )
{
if(currentItem->text(HEADER_BACKUP) == "B" )
{
if(currentItem->childCount() == 0 )
{
if(parent == NULL)
backupFiles += currentItem->text(BACKUP_LOCATION);
else
backupFiles += currentHome + currentItem->text(HEADER_NAME);
backupFiles += " ";
count++;
}
else
{
count += getBackupFiles(backupFiles, currentItem);
}
}
currentItem = currentItem->nextSibling();
}
return count;
}
void BackupAndRestore::sourceDirChanged(int selection)
{
restoreList->clear();
rescanFolder(backupLocations[restoreSource->text(selection)]);
}
void BackupAndRestore::fileListUpdate()
{
qWarning("void BackupAndRestore::fileListUpdate()");
restoreList->clear();
rescanFolder( backupLocations[restoreSource->currentText()] );
}
/**
* Scans directory for any backup files. Will recursivly go down,
* but will not follow symlinks.
* @param directory - the directory to look in.
*/
void BackupAndRestore::rescanFolder(QString directory)
{
//qDebug(QString("rescanFolder: ") + directory.latin1());
QDir d(directory);
if(!d.exists())
return;
d.setFilter( QDir::Files | QDir::Hidden | QDir::Dirs);
const QFileInfoList *list = d.entryInfoList();
QFileInfoListIterator it( *list );
QFileInfo *file;
while ( (file=it.current()) )
{ // for each file...
// If it is a dir and not .. or . then add it as a tab and go down.
if(file->isDir())
{
if(file->fileName() != ".." && file->fileName() != ".")
{
rescanFolder(directory + "/" + file->fileName());
}
}
else
{
// If it is a backup file add to list.
if(file->fileName().contains(EXTENSION))
(void)new QListViewItem(restoreList, file->fileName());
}
++it;
}
}
/**
* Restore a backup file.
* Report errors or success
*/
void BackupAndRestore::restore()
{
QListViewItem *restoreItem = restoreList->currentItem();
if(!restoreItem)
{
QMessageBox::critical(this, tr( "Message" ),
tr( "Please select something to restore." ),QString( tr( "Ok") ) );
return;
}
setCaption(tr("Backup and Restore... working..."));
QString restoreFile = backupLocations[restoreSource->currentText()];
restoreFile += "/" + restoreItem->text(0);
qDebug( restoreFile );
QString commandLine = QString( "tar -C %1 -zxf %2 2> %3" ).arg( QDir::homeDirPath() )
.arg( restoreFile.latin1() )
.arg( tempFileName.latin1() );
qDebug( commandLine );
int r = system( commandLine );
if(r != 0)
{
QString errorMsg= tr( "Error from System:\n" ) + (QString)strerror( errno );
switch( QMessageBox::critical(this, tr( "Message" ), tr( "Restore Failed." ) + "\n"
+ errorMsg, QString( tr( "Ok") ), QString( tr( "Details" ) ) ) )
{
case 1:
qWarning("Details pressed !");
ErrorDialog* pErrDialog = new ErrorDialog( this, NULL, true );
QFile errorFile( tempFileName );
if ( errorFile.open(IO_ReadOnly) )
{
QTextStream t( &errorFile );
QString s;
while ( !t.eof() )
{ // until end of file...
s += t.readLine(); // line of text excluding '\n'
}
errorFile.close();
pErrDialog->m_textarea->setText( s );
}
else
{
pErrDialog->m_textarea->setText( tr( "Unable to open File: %1" ).arg( "/tmp/backup.er" ) );
}
pErrDialog->showMaximized();
pErrDialog->exec();
delete pErrDialog;
setCaption(tr("Backup and Restore.. Failed !!"));
return;
break;
}
}
else
{
- QMessageBox::information(this, tr( "Message" ), tr( "Restore Successfull." ), QString( tr( "Ok") ) );
+ QMessageBox::information(this, tr( "Message" ), tr( "Restore Successful." ), QString( tr( "Ok") ) );
}
//write restore-location
Config config( "BackupAndRestore" );
config.setGroup( "LastLocation" );
config.writeEntry( "LastRestoreLocation", restoreSource->currentText() );
setCaption(tr("Backup and Restore"));
}
// backuprestore.cpp
diff --git a/noncore/settings/networksettings/interfaces/interface.cpp b/noncore/settings/networksettings/interfaces/interface.cpp
index 69b55d1..b00b899 100644
--- a/noncore/settings/networksettings/interfaces/interface.cpp
+++ b/noncore/settings/networksettings/interfaces/interface.cpp
@@ -1,302 +1,302 @@
/**
* $Author$
* $Date$
*/
#include "interface.h"
#include <qdatetime.h>
#include <qfile.h>
#include <qdir.h>
#include <qfileinfo.h>
#include <qtextstream.h>
#define IFCONFIG "/sbin/ifconfig"
#define DHCP_INFO_DIR "/etc/dhcpc"
#include <stdio.h>
#include <stdlib.h>
Interface::Interface(QObject * parent, const char * name, bool newSatus): QObject(parent, name), hardwareName("Unknown"), moduleOwner(NULL), status(newSatus), attached(false), dhcp(false), macAddress(""), ip("0.0.0.0"), broadcast(""), subnetMask("0.0.0.0"){
refresh();
}
/**
* Set status
* @param newStatus - the new status
* emit updateInterface
*/
void Interface::setStatus(bool newStatus){
if(status != newStatus){
status = newStatus;
refresh();
}
};
/**
* Set if attached or not (802.11 card pulled out for example)
* @param isAttached - if attached
* emit updateInterface
*/
void Interface::setAttached(bool isAttached){
attached = isAttached;
emit(updateInterface(this));
};
/**
* Set Hardware name
* @param name - the new name
* emit updateInterface
*/
void Interface::setHardwareName(const QString &name){
hardwareName = name;
emit(updateInterface(this));
};
/**
* Set Module owner
* @param owner - the new owner
* emit updateInterface
*/
void Interface::setModuleOwner(Module *owner){
moduleOwner = owner;
emit(updateInterface(this));
};
/**
* Try to start the interface.
*/
void Interface::start(){
// check to see if we are already running.
if(true == status){
emit (updateMessage("Unable to start interface,\n already started"));
return;
}
int ret = system(QString("%1 %2 up").arg(IFCONFIG).arg(this->name()).latin1());
- // See if it was successfull...
+ // See if it was successful...
if(ret != 0){
emit (updateMessage("Starting interface failed"));
return;
}
status = true;
refresh();
- emit (updateMessage("Start successfull"));
+ emit (updateMessage("Start successful"));
}
/**
* Try to stop the interface.
*/
void Interface::stop(){
// check to see if we are already stopped.
if(false == status){
emit (updateMessage("Unable to stop interface,\n already stopped"));
return;
}
int ret = system(QString("%1 %2 down").arg(IFCONFIG).arg(this->name()).latin1());
if(ret != 0){
emit (updateMessage("Stopping interface failed"));
return;
}
status = false;
refresh();
- emit (updateMessage("Stop successfull"));
+ emit (updateMessage("Stop successful"));
}
/**
* Try to restart the interface.
*/
void Interface::restart(){
stop();
start();
}
/**
* Try to refresh the information about the interface.
* First call ifconfig, then check the dhcp-info file
- * @return bool true if successfull.
+ * @return bool true if successful.
*/
bool Interface::refresh(){
// See if we are up.
if(status == false){
macAddress = "";
ip = "0.0.0.0";
subnetMask = "0.0.0.0";
broadcast = "";
dhcp = false;
dhcpServerIp = "";
leaseObtained = "";
leaseExpires = "";
emit(updateInterface(this));
return true;
}
QString fileName = QString("/tmp/%1_ifconfig_info").arg(this->name());
int ret = system(QString("LANG=C %1 %2 > %3").arg(IFCONFIG).arg(this->name()).arg(fileName).latin1());
if(ret != 0){
qDebug(QString("Interface: Ifconfig return value: %1, is not 0").arg(ret).latin1());
return false;
}
QFile file(fileName);
if (!file.open(IO_ReadOnly)){
qDebug(QString("Interface: Can't open file: %1").arg(fileName).latin1());
return false;
}
// Set to the defaults
macAddress = "";
ip = "0.0.0.0";
subnetMask = "0.0.0.0";
broadcast = "";
QTextStream stream( &file );
QString line;
while ( !stream.eof() ) {
line = stream.readLine();
if(line.contains("HWaddr")){
int mac = line.find("HWaddr");
macAddress = line.mid(mac+7, line.length());
}
if(line.contains("inet addr")){
int ipl = line.find("inet addr");
int space = line.find(" ", ipl+10);
ip = line.mid(ipl+10, space-ipl-10);
}
if(line.contains("Mask")){
int mask = line.find("Mask");
subnetMask = line.mid(mask+5, line.length());
}
if(line.contains("Bcast")){
int mask = line.find("Bcast");
int space = line.find(" ", mask+6);
broadcast = line.mid(mask+6, space-mask-6);
}
}
file.close();
QFile::remove(fileName);
// DHCP TESTING
// reset DHCP info
dhcpServerIp = "";
leaseObtained = "";
leaseExpires = "";
dhcp = false;
QString dhcpDirectory(DHCP_INFO_DIR);
QDir d(dhcpDirectory);
if(!d.exists(dhcpDirectory))
dhcpDirectory = "/var/run";
// See if we have
QString dhcpFile(QString(dhcpDirectory+"/dhcpcd-%1.info").arg(this->name()));
// If there is no DHCP information then exit now with no errors.
if(!QFile::exists(dhcpFile)){
emit(updateInterface(this));
return true;
}
file.setName(dhcpFile);
if (!file.open(IO_ReadOnly)){
qDebug(QString("Interface: Can't open file: %1").arg(dhcpFile).latin1());
return false;
}
// leaseTime and renewalTime and used if pid and deamon exe can be accessed.
int leaseTime = 0;
int renewalTime = 0;
stream.setDevice( &file );
while ( !stream.eof() ) {
line = stream.readLine();
if(line.contains("DHCPSIADDR="))
dhcpServerIp = line.mid(11, line.length());
if(line.contains("LEASETIME="))
leaseTime = line.mid(10, line.length()).toInt();
if(line.contains("RENEWALTIME="))
renewalTime = line.mid(12, line.length()).toInt();
}
file.close();
//qDebug(QString("Interface: leaseTime: %1").arg(leaseTime).latin1());
//qDebug(QString("Interface: renewalTime: %1").arg(renewalTime).latin1());
// Get the pid of the deamond
dhcpFile = (QString(dhcpDirectory+"/dhcpcd-%1.pid").arg(this->name()));
file.setName(dhcpFile);
if (!file.open(IO_ReadOnly)){
qDebug(QString("Interface: Can't open file: %1").arg(dhcpFile).latin1());
return false;
}
int pid = -1;
stream.setDevice( &file );
while ( !stream.eof() ) {
line = stream.readLine();
pid = line.toInt();
}
file.close();
if( pid == -1){
qDebug("Interface: Could not get pid of dhcpc deamon.");
return false;
}
// Get the start running time of the deamon
fileName = (QString("/proc/%1/stat").arg(pid));
file.setName(fileName);
stream.setDevice( &file );
if (!file.open(IO_ReadOnly)){
qDebug(QString("Interface: Can't open file: %1").arg(fileName).latin1());
return false;
}
while ( !stream.eof() ) {
line = stream.readLine();
}
file.close();
long time = 0;
// Grab the start time
// pid com state ppid pgrp session tty_nr tpgid flags
sscanf(line.latin1(), "%*d %*s %*c %*d %*d %*d %*d %*d %*u "
// minflt cminflt majflt cmajflt utime stime cutime cstime priority
"%*u %*u %*u %*u %*u %*u %*d %*d %*d "
// nice 0 itrealvalue starttime
"%*d %*d %*d %lu", (long*) &time);
time = time/100;
QDateTime datetime(QDateTime::currentDateTime());
// Get the uptime of the computer.
QFile f("/proc/uptime");
if ( f.open(IO_ReadOnly) ) { // file opened successfully
QTextStream t( &f ); // use a text stream
int sec = 0;
t >> sec;
datetime = datetime.addSecs((-1*sec));
f.close();
}
else{
qDebug("Interface: Can't open /proc/uptime to retrive uptime.");
return false;
}
datetime = datetime.addSecs(time);
//qDebug(QString("Interface: %1 %2").arg(datetime.toString()).arg(pid).latin1());
// Calculate the start and renew times
leaseObtained = datetime.toString();
// Calculate the start and renew times
datetime = datetime.addSecs(leaseTime);
leaseExpires = datetime.toString();
dhcp = true;
emit(updateInterface(this));
return true;
}
// interface.cpp
diff --git a/noncore/settings/networksettings/interfaces/interfaces.cpp b/noncore/settings/networksettings/interfaces/interfaces.cpp
index 436e449..6b161ae 100644
--- a/noncore/settings/networksettings/interfaces/interfaces.cpp
+++ b/noncore/settings/networksettings/interfaces/interfaces.cpp
@@ -1,712 +1,712 @@
#include "interfaces.h"
#include <qcheckbox.h>
#include <qfile.h>
#include <qtextstream.h>
#include <qregexp.h>
// The three stanza's
#define AUTO "auto"
#define IFACE "iface"
#define MAPPING "mapping"
/**
* Constructor. Reads in the interfaces file and then split the file up by
* the \n for interfaces variable.
* @param useInterfacesFile if an interface file other then the default is
* desired to be used it should be passed in.
*/
Interfaces::Interfaces(QString useInterfacesFile){
acceptedFamily.append(INTERFACES_FAMILY_INET);
acceptedFamily.append(INTERFACES_FAMILY_IPX);
acceptedFamily.append(INTERFACES_FAMILY_INET6);
interfacesFile = useInterfacesFile;
QFile file(interfacesFile);
if (!file.open(IO_ReadOnly)){
qDebug("Interfaces: Can't open file: %s for reading.", interfacesFile.latin1() );
currentIface = interfaces.end();
currentMapping = interfaces.end();
return;
}
QTextStream stream( &file );
QString line;
while ( !stream.eof() ) {
line += stream.readLine();
line += "\n";
}
file.close();
interfaces = QStringList::split("\n", line, true);
currentIface = interfaces.end();
currentMapping = interfaces.end();
}
/**
- * Get a list of all interfaces in the interface file. Usefull for
+ * Get a list of all interfaces in the interface file. Useful for
* hardware that is not currently connected such as an 802.11b card
* not plugged in, but configured for when it is plugged in.
* @return Return string list of interfaces.
**/
QStringList Interfaces::getInterfaceList(){
QStringList list;
for ( QStringList::Iterator it = interfaces.begin(); it != interfaces.end(); ++it ) {
QString line = (*it).simplifyWhiteSpace();
if(line.contains(IFACE) && line.at(0) != '#'){
line = line.mid(QString(IFACE).length() +1, line.length());
line = line.simplifyWhiteSpace();
int findSpace = line.find(" ");
if( findSpace >= 0){
line = line.mid(0, findSpace);
list.append(line);
}
}
}
return list;
}
/**
* Find out if interface is in an "auto" group or not.
* Report any duplicates such as eth0 being in two differnt auto's
* @param interface interface to check to see if it is on or not.
* @return true is interface is in auto
*/
bool Interfaces::isAuto(const QString &interface) const {
QStringList autoLines = interfaces.grep(QRegExp(AUTO));
QStringList awi = autoLines.grep(QRegExp(interface));
if(awi.count() > 1)
qDebug(QString("Interfaces: Found more then auto group with interface: %1.").arg(interface).latin1());
return awi.count() > 0;
}
/**
* Attempt to set the auto option for interface to setAuto.
* @param interface the interface to set
* @param setAuto the value to set interface to.
* @return false if already set to setAuto.
* */
bool Interfaces::setAuto(const QString &interface, bool setAuto){
// Don't need to set it if it is already set.
if(isAuto(interface) == setAuto)
return false;
bool changed = false;
for ( QStringList::Iterator it = interfaces.begin(); it != interfaces.end(); ++it ) {
if((*it).contains(AUTO)){
//We know that they are not in any group so let add to this auto.
if(setAuto){
(*it) = (*it) += " " + interface;
// Don't care to have such thins as: auto eth0 lo usb0
(*it) = (*it).simplifyWhiteSpace();
changed = true;
break;
}
// else see if we need to remove from this one
else{
if((*it).contains(interface)){
(*it) = (*it).replace(QRegExp(interface), "");
// if AUTO is the only thing left clear the line
if(((*it).simplifyWhiteSpace()).replace(QRegExp(" "),"") == AUTO)
(*it) = "";
changed = true;
// Don't break because we want to make sure we remove all cases.
}
}
}
}
// In the case where there is no AUTO field add one.
if(!changed && setAuto)
interfaces.append(QString(AUTO" %1").arg(interface));
return true;
}
/**
* Set the current interface to interface. This needs to be done before you
* can call getFamily(), getMethod, and get/setOption().
* @param interface the name of the interface to set. All whitespace is
* removed from the interface name.
- * @return bool true if it is successfull.
+ * @return bool true if it is successful.
*/
bool Interfaces::setInterface(QString interface){
interface = interface.simplifyWhiteSpace();
interface = interface.replace(QRegExp(" "), "");
return setStanza(IFACE, interface, currentIface);
}
/**
* A quick helper funtion to see if the current interface is set.
* @return bool true if set, false otherwise.
*/
bool Interfaces::isInterfaceSet() const {
return (interfaces.end() != currentIface);
}
/**
* Add a new interface of with the settings - family and method
* @param interface the name of the interface to set. All whitespace is
* removed from the interface name.
* @param family the family of this interface inet or inet, ipx or inet6
* Must of one of the families defined in interfaces.h
* @param method for the family. see interfaces man page for family methods.
- * @return true if successfull.
+ * @return true if successful.
*/
bool Interfaces::addInterface(const QString &interface, const QString &family, const QString &method){
qDebug("Interfaces::addInterface(%s)",interface.latin1());
if(0 == acceptedFamily.contains(family))
return false;
QString newInterface = interface.simplifyWhiteSpace();
newInterface = newInterface.replace(QRegExp(" "), "");
interfaces.append("");
interfaces.append(QString(IFACE " %1 %2 %3").arg(newInterface).arg(family).arg(method));
return true;
}
/**
* Copies interface with name interface to name newInterface
* @param newInterface name of the new interface.
- * @return bool true if successfull
+ * @return bool true if successful
*/
bool Interfaces::copyInterface(const QString &interface, const QString &newInterface){
qDebug("copy interface %s to %s", interface.latin1(), newInterface.latin1());
if(!setInterface(interface))
return false;
// Store the old interface and bump past the stanza line.
QStringList::Iterator it = currentIface;
it++;
// Add the new interface
bool error;
addInterface(newInterface, getInterfaceFamily(error), getInterfaceMethod(error));
if(!setInterface(newInterface))
return false;
QStringList::Iterator newIface = currentIface;
newIface++;
// Copy all of the lines
for ( ; it != interfaces.end(); ++it ){
if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)))
break;
newIface = interfaces.insert(newIface, *it);
}
return true;
}
/**
* Remove the currently selected interface and all of its options.
- * @return bool if successfull or not.
+ * @return bool if successful or not.
*/
bool Interfaces::removeInterface(){
return removeStanza(currentIface);
}
/**
* Gets the hardware name of the interface that is currently selected.
* @return QString name of the hardware interface (eth0, usb2, wlan1...).
* @param error set to true if any error occurs, false otherwise.
*/
QString Interfaces::getInterfaceName(bool &error){
if(currentIface == interfaces.end()){
error = true;
return QString();
}
QString line = (*currentIface);
line = line.mid(QString(IFACE).length() +1, line.length());
line = line.simplifyWhiteSpace();
int findSpace = line.find(" ");
if( findSpace < 0){
error = true;
return QString();
}
error = false;
return line.mid(0, findSpace);
}
/**
* Gets the family name of the interface that is currently selected.
* @return QString name of the family (inet, inet6, ipx).
* @param error set to true if any error occurs, false otherwise.
*/
QString Interfaces::getInterfaceFamily(bool &error){
QString name = getInterfaceName(error);
if(error)
return QString();
QString line = (*currentIface);
line = line.mid(QString(IFACE).length() +1, line.length());
line = line.mid(name.length()+1, line.length());
line = line.simplifyWhiteSpace();
int findSpace = line.find(" ");
if( findSpace < 0){
error = true;
return QString();
}
error = false;
return line.mid(0, findSpace);
}
/**
* Gets the method of the interface that is currently selected.
* @return QString name of the method such as staic or dhcp.
* See the man page of interfaces for possible methods depending on the family.
* @param error set to true if any error occurs, false otherwise.
*/
QString Interfaces::getInterfaceMethod(bool &error){
QString name = getInterfaceName(error);
if(error)
return QString();
QString family = getInterfaceFamily(error);
if(error)
return QString();
QString line = (*currentIface);
line = line.mid(QString(IFACE).length()+1, line.length());
line = line.mid(name.length()+1, line.length());
line = line.mid(family.length()+1, line.length());
line = line.simplifyWhiteSpace();
error = false;
return line;
}
/**
* Sets the interface name to newName.
* @param newName the new name of the interface. All whitespace is removed.
- * @return bool true if successfull.
+ * @return bool true if successful.
*/
bool Interfaces::setInterfaceName(const QString &newName){
qDebug("setInterfaceName %s", newName.latin1());
if(currentIface == interfaces.end())
return false;
QString name = newName.simplifyWhiteSpace();
name = name.replace(QRegExp(" "), "");
bool returnValue = false;
QString tmp = QString("iface %1 %2 %3").arg(name).arg(getInterfaceFamily(returnValue)).arg(getInterfaceMethod(returnValue));
qDebug("setting %s",tmp.latin1());
(*currentIface) = tmp;
return !returnValue;
}
/**
* Sets the interface family to newName.
* @param newName the new name of the interface. Must be one of the families
* defined in the interfaces.h file.
- * @return bool true if successfull.
+ * @return bool true if successful.
*/
bool Interfaces::setInterfaceFamily(const QString &newName){
if(currentIface == interfaces.end())
return false;
if(acceptedFamily.contains(newName)==0)
return false;
bool returnValue = false;
(*currentIface) = QString("iface %1 %2 %3").arg(getInterfaceName(returnValue)).arg(newName).arg(getInterfaceMethod(returnValue));
return !returnValue;
}
/**
* Sets the interface method to newName
* @param newName the new name of the interface
- * @return bool true if successfull.
+ * @return bool true if successful.
*/
bool Interfaces::setInterfaceMethod(const QString &newName){
if(currentIface == interfaces.end())
return false;
bool returnValue = false;
(*currentIface) = QString("iface %1 %2 %3").arg(getInterfaceName(returnValue)).arg(getInterfaceFamily(returnValue)).arg(newName);
return !returnValue;
}
/**
* Get a value for an option in the currently selected interface. For example
* calling getInterfaceOption("address") on the following stanza would
* return 192.168.1.1.
* iface eth0 static
* address 192.168.1.1
* @param option the options to get the value.
* @param error set to true if any error occurs, false otherwise.
* @return QString the options value. QString::null if error == true
*/
QString Interfaces::getInterfaceOption(const QString &option, bool &error){
return getOption(currentIface, option, error);
}
/**
* Set a value for an option in the currently selected interface. If option
* doesn't exist then it is added along with the value.
* If value isEmpty() then we will remove the option
*
* @param option the options to set the value.
* @param value the value that option should be set to.
* @param error set to true if any error occurs, false otherwise.
* @return QString the options value. QString::null if error == true
*/
bool Interfaces::setInterfaceOption(const QString &option, const QString &value){
if( value.stripWhiteSpace().isEmpty() )
return removeInterfaceOption( option );
qDebug("iface >%s< option >%s< value >%s<", (*currentIface).latin1(), option.latin1(),value.latin1());
return setOption(currentIface, option, value);
}
/**
* Removes a value for an option in the currently selected interface.
* @param option the options to set the value.
* @param error set to true if any error occurs, false otherwise.
* @return QString the options value. QString::null if error == true
*/
bool Interfaces::removeInterfaceOption(const QString &option){
return removeOption(currentIface, option);
}
/**
* Removes a value for an option in the currently selected interface.
* @param option the options to set the value.
* @param value the value that option should be set to.
* @param error set to true if any error occurs, false otherwise.
* @return QString the options value. QString::null if error == true
*/
bool Interfaces::removeInterfaceOption(const QString &option, const QString &value){
return removeOption(currentIface, option, value);
}
/**
* Removes all of the options from the currently selected interface.
- * @return bool error if if successfull
+ * @return bool error if if successful
*/
bool Interfaces::removeAllInterfaceOptions(){
return removeAllOptions(currentIface);
}
/**
* Set the current map to interface's map. This needs to be done before you
* can call addMapping(), set/getMap(), and get/setScript().
* @param interface the name of the interface to set. All whitespace is
* removed from the interface name.
- * @return bool true if it is successfull.
+ * @return bool true if it is successful.
*/
bool Interfaces::setMapping(const QString &interface){
QString interfaceName = interface.simplifyWhiteSpace();
interfaceName = interfaceName.replace(QRegExp(" "), "");
return setStanza(MAPPING, interfaceName, currentMapping);
}
/**
* Adds a new Mapping to the interfaces file with interfaces.
* @param interface the name(s) of the interfaces to set to this mapping
*/
void Interfaces::addMapping(const QString &option){
interfaces.append("");
interfaces.append(QString(MAPPING " %1").arg(option));
}
/**
* Remove the currently selected map and all of its options.
- * @return bool if successfull or not.
+ * @return bool if successful or not.
*/
bool Interfaces::removeMapping(){
return removeStanza(currentMapping);
}
/**
* Set a map option within a mapping.
* @param map map to use
* @param value value to go with map
- * @return bool true if it is successfull.
+ * @return bool true if it is successful.
*/
bool Interfaces::setMap(const QString &map, const QString &value){
return setOption(currentMapping, map, value);
}
/**
* Removes a map option within a mapping.
* @param map map to use
* @param value value to go with map
- * @return bool true if it is successfull.
+ * @return bool true if it is successful.
*/
bool Interfaces::removeMap(const QString &map, const QString &value){
return removeOption(currentMapping, map, value);
}
/**
* Get a map value within a mapping.
* @param map map to get value of
- * @param bool true if it is successfull.
+ * @param bool true if it is successful.
* @return value that goes to the map
*/
QString Interfaces::getMap(const QString &map, bool &error){
return getOption(currentMapping, map, error);
}
/**
* Sets a script value of the current mapping to argument.
* @param argument the script name.
- * @return true if successfull.
+ * @return true if successful.
*/
bool Interfaces::setScript(const QString &argument){
return setOption(currentMapping, "script", argument);
}
/**
* @param error true if could not retrieve the current script argument.
* @return QString the argument of the script for the current mapping.
*/
QString Interfaces::getScript(bool &error){
return getOption(currentMapping, "script", error);
}
/**
* Helper function used to parse through the QStringList and put pointers in
* the correct place.
* @param stanza The stanza (auto, iface, mapping) to look for.
* @param option string that must be in the stanza's main line.
- * @param interator interator to place at location of stanza if successfull.
+ * @param interator interator to place at location of stanza if successful.
* @return bool true if the stanza is found.
*/
bool Interfaces::setStanza(const QString &stanza, const QString &option, QStringList::Iterator &iterator){
bool found = false;
iterator = interfaces.end();
for ( QStringList::Iterator it = interfaces.begin(); it != interfaces.end(); ++it ) {
QString line = (*it).simplifyWhiteSpace();
if(line.contains(stanza) && line.contains(option) && line.at(0) != '#'){
uint point = line.find(option);
bool valid = true;
if(point > 0){
// There are more chars in the line. check +1
if(line.at(point-1) != ' ')
valid = false;
}
point += option.length();
if(point < line.length()-1){
// There are more chars in the line. check -1
if(line.at(point) != ' ')
valid = false;
}
if(valid){
if(found == true){
qDebug(QString("Interfaces: Found multiple stanza's for search: %1 %2").arg(stanza).arg(option).latin1());
}
found = true;
iterator = it;
}
}
}
return found;
}
/**
* Sets a value of an option in a stanza
* @param start the start of the stanza
* @param option the option to use when setting value.
- * @return bool true if successfull, false otherwise.
+ * @return bool true if successful, false otherwise.
*/
bool Interfaces::setOption(const QStringList::Iterator &start, const QString &option, const QString &value){
if(start == interfaces.end())
return false;
qDebug("setting option");
bool found = false;
bool replaced = false;
QStringList::Iterator insertAt = NULL;
for ( QStringList::Iterator it = start; it != interfaces.end(); ++it ) {
qDebug(" Interfaces::setOption got line >%s<",(*it).latin1());
// FIXME: was not completly stupid just wrong sice all options got inserted bevore the iface line
// but since it works with an empty interfaces file I (tille) will not do anything more
if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)) ){
if (found) break;
// && it != start){
// if(!found && value != ""){
// // Got to the end of the stanza without finding it, so append it.
// qDebug(" Got to the end of the stanza without finding it, so append it.");
// interfaces.insert(--it, QString("\t%1 %2").arg(option).arg(value));
// }
qDebug("found 1");
// interfaces.insert(++it, QString("\t%1 %2").arg(option).arg(value));
found = true;
insertAt = it;
}
if((*it).contains(option) && it != start && (*it).at(0) != '#'){
// Found it in stanza so replace it.
qDebug("found 2");
if(found)
qDebug(QString("Interfaces: Set Options found more then one value for option: %1 in stanza: %1").arg(option).arg((*start)).latin1());
found = true;
replaced = true;
(*it) = QString("\t%1 %2").arg(option).arg(value);
}
}
if(!found){
qDebug("! found insert anyway");
QStringList::Iterator p = start;
interfaces.insert(++p, QString("\t%1 %2").arg(option).arg(value));
found = true;
}
if(found && !replaced){
qDebug("found iface but not the option so insert it here...");
interfaces.insert(++insertAt, QString("\t%1 %2").arg(option).arg(value));
}
return found;
}
/**
* Removes a stanza and all of its options
* @param stanza the stanza to remove
- * @return bool true if successfull.
+ * @return bool true if successful.
*/
bool Interfaces::removeStanza(QStringList::Iterator &stanza){
if(stanza == interfaces.end())
return false;
(*stanza) = "";
return removeAllOptions(stanza);
}
/**
* Removes a option in a stanza
* @param start the start of the stanza
* @param option the option to remove
- * @return bool true if successfull, false otherwise.
+ * @return bool true if successful, false otherwise.
*/
bool Interfaces::removeOption(const QStringList::Iterator &start, const QString &option){
if(start == interfaces.end())
return false;
bool found = false;
for ( QStringList::Iterator it = start; it != interfaces.end(); ++it ) {
if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)) && it != start){
// got to the end without finding it
break;
}
if((*it).contains(option) && it != start && (*it).at(0) != '#'){
// Found it in stanza so replace it.
if(found)
qDebug(QString("Interfaces: Set Options found more then one value for option: %1 in stanza: %1").arg(option).arg((*start)).latin1());
found = true;
it = interfaces.remove( it ); // we really want to remove the line
--it; // we do ++it later in the head of the for loop
}
}
return found;
}
/**
* Removes a option in a stanza
* @param start the start of the stanza
* @param option the option to use when setting value.
- * @return bool true if successfull, false otherwise.
+ * @return bool true if successful, false otherwise.
*/
bool Interfaces::removeOption(const QStringList::Iterator &start, const QString &option, const QString &value){
if(start == interfaces.end())
return false;
bool found = false;
for ( QStringList::Iterator it = start; it != interfaces.end(); ++it ) {
if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)) && it != start){
// got to the end without finding it
break;
}
if((*it).contains(option) && (*it).contains(value) && it != start && (*it).at(0) != '#'){
// Found it in stanza so replace it.
if(found)
qDebug(QString("Interfaces: Set Options found more then one value for option: %1 in stanza: %1").arg(option).arg((*start)).latin1());
found = true;
it = interfaces.remove( it ); // we really want to remove the line
--it; // we do ++it later in the head of the for loop
}
}
return found;
}
/**
* Removes all options in a stanza
* @param start the start of the stanza
- * @return bool true if successfull, false otherwise.
+ * @return bool true if successful, false otherwise.
*/
bool Interfaces::removeAllOptions(const QStringList::Iterator &start){
if(start == interfaces.end())
return false;
QStringList::Iterator it = start;
it = ++it;
for (; it != interfaces.end(); ++it ) {
if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)) && it != start){
break;
}
it = interfaces.remove(it);
it = --it;
}
// Leave a space between this interface and the next.
interfaces.insert(it, QString(""));
return true;
}
/**
* Gets a value of an option in a stanza
* @param start the start of the stanza
* @param option the option to use when getting the value.
* @param bool true if errors false otherwise.
* @return QString the value of option QString::null() if error == true.
*/
QString Interfaces::getOption(const QStringList::Iterator &start, const QString &option, bool &error){
if(start == interfaces.end()){
error = false;
return QString();
}
QString value;
bool found = false;
for ( QStringList::Iterator it = start; it != interfaces.end(); ++it ) {
if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)) && it != start){
break;
}
if((*it).contains(option) && (*it).at(0) != '#'){
if(found)
qDebug(QString("Interfaces: getOption found more then one value: %1 for option: %2 in stanza %3").arg((*it)).arg(option).arg((*start)).latin1());
found = true;
QString line = (*it).simplifyWhiteSpace();
int space = line.find(" ", option.length());
if(space != -1){
value = line.mid(space+1, line.length());
break;
}
}
}
error = !found;
return value;
}
/**
* Write out the interfaces file to the file passed into the constructor.
* Removes any excess blank lines over 1 line long.
- * @return bool true if successfull, false if not.
+ * @return bool true if successful, false if not.
*/
bool Interfaces::write(){
QFile::remove(interfacesFile);
QFile file(interfacesFile);
if (!file.open(IO_ReadWrite)){
qDebug(QString("Interfaces: Can't open file: %1 for writing.").arg(interfacesFile).latin1());
return false;
}
QTextStream stream( &file );
int whiteSpaceCount = 0;
for ( QStringList::Iterator it = interfaces.begin(); it != interfaces.end(); ++it ) {
QString line = (*it).simplifyWhiteSpace();
line = line.replace(QRegExp(" "),"");
if(line.length() == 0)
whiteSpaceCount++;
else
whiteSpaceCount = 0;
if(whiteSpaceCount < 2){
qDebug((*it).latin1());
stream << (*it) << '\n';
}
}
file.close();
return true;
}
// interfaces.cpp
diff --git a/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp b/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp
index e844d8a..78466d0 100644
--- a/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp
+++ b/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp
@@ -1,206 +1,206 @@
#include "interfacesetupimp.h"
#include "interface.h"
#include <qcheckbox.h>
#include <qlineedit.h>
#include <qspinbox.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qmessagebox.h>
#include <opie/oprocess.h>
#ifdef QWS
#include <opie/owait.h>
#include <qpe/global.h>
#include <qapplication.h>
#endif
#define DNSSCRIPT "changedns"
/**
* Constuctor. Set up the connection. A profile must be set.
*/
InterfaceSetupImp::InterfaceSetupImp(QWidget* parent, const char* name, Interface *i, Interfaces *j, WFlags fl) : InterfaceSetup(parent, name, fl), interface(i), interfaces(j), delInterfaces(false){
if (j == 0) {
delInterfaces = true;
interfaces = new Interfaces;
}
}
/**
* Destructor
*/
InterfaceSetupImp::~InterfaceSetupImp(){
if(delInterfaces) {
delete interfaces;
}
}
/**
* Save the current settings, then write out the interfaces file and close.
*/
bool InterfaceSetupImp::saveChanges(){
bool error;
QString iface = interfaces->getInterfaceName(error);
qDebug("InterfaceSetupImp::saveChanges saves interface %s", iface.latin1() );
if(!saveSettings())
return false;
interfaces->write();
if (interface->getStatus()) {
QString ifup;
ifup += "ifdown ";
ifup += iface;
ifup += "; ifup ";
ifup += iface;
ifup += ";";
OProcess restart;
restart << "sh";
restart << "-c";
restart << ifup;
OWait *owait = new OWait();
Global::statusMessage( tr( "Restarting interface" ) );
owait->show();
qApp->processEvents();
if (!restart.start(OProcess::Block, OProcess::NoCommunication) ) {
qWarning("unstable to spawn ifdown/ifup");
}
owait->hide();
delete owait;
interface->refresh();
}
return true;
}
/**
* Save the settings for the current Interface.
- * @return bool true if successfull, false otherwise
+ * @return bool true if successful, false otherwise
*/
bool InterfaceSetupImp::saveSettings(){
// eh can't really do anything about it other then return. :-D
if(!interfaces->isInterfaceSet())
return true;
bool error = false;
// Loopback case
if(interfaces->getInterfaceMethod(error) == INTERFACES_LOOPBACK){
interfaces->setAuto(interface->getInterfaceName(), autoStart->isChecked());
return true;
}
if(!dhcpCheckBox->isChecked() && (ipAddressEdit->text().isEmpty() || subnetMaskEdit->text().isEmpty())){
QMessageBox::information(this, "Not Saved.", "Please fill in the IP address and\n subnet entries.", QMessageBox::Ok);
return false;
}
// DHCP
if(dhcpCheckBox->isChecked()) {
interfaces->setInterfaceMethod(INTERFACES_METHOD_DHCP);
interfaces->removeInterfaceOption("address");
interfaces->removeInterfaceOption("netmask");
interfaces->removeInterfaceOption("gateway");
interfaces->removeInterfaceOption("up "DNSSCRIPT" -a ");
interfaces->removeInterfaceOption("down "DNSSCRIPT" -r ");
} else{
interfaces->setInterfaceMethod("static");
interfaces->setInterfaceOption("address", ipAddressEdit->text());
interfaces->setInterfaceOption("netmask", subnetMaskEdit->text());
interfaces->setInterfaceOption("gateway", gatewayEdit->text());
if(!firstDNSLineEdit->text().isEmpty() || !secondDNSLineEdit->text().isEmpty()){
QString dns = firstDNSLineEdit->text() + " " + secondDNSLineEdit->text();
interfaces->setInterfaceOption("up "DNSSCRIPT" -a ", dns);
interfaces->setInterfaceOption("down "DNSSCRIPT" -r ", dns);
}else{
interfaces->removeInterfaceOption("up "DNSSCRIPT" -a ");
interfaces->removeInterfaceOption("down "DNSSCRIPT" -r");
}
}
// IP Information
interfaces->setAuto(interface->getInterfaceName(), autoStart->isChecked());
return true;
}
/**
* The Profile has changed.
* @param QString profile the new profile.
*/
void InterfaceSetupImp::setProfile(const QString &profile){
/*
bool error = false;
if(interfaces->getInterfaceMethod(error) == INTERFACES_LOOPBACK){
staticGroupBox->hide();
dhcpCheckBox->hide();
leaseTime->hide();
leaseHoursLabel->hide();
}
*/
QString newInterfaceName = interface->getInterfaceName();
if(profile.length() > 0)
newInterfaceName += "_" + profile;
// See if we have to make a interface.
if(!interfaces->setInterface(newInterfaceName)){
// Add making for this new interface if need too
if(profile != ""){
interfaces->copyInterface(interface->getInterfaceName(), newInterfaceName);
if(!interfaces->setMapping(interface->getInterfaceName())){
interfaces->addMapping(interface->getInterfaceName());
if(!interfaces->setMapping(interface->getInterfaceName())){
qDebug("InterfaceSetupImp: Added Mapping, but still can't setInterface.");
return;
}
}
interfaces->setMap("map", newInterfaceName);
interfaces->setScript("getprofile.sh");
}
else{
interfaces->addInterface(newInterfaceName, INTERFACES_FAMILY_INET, INTERFACES_METHOD_DHCP);
if(!interfaces->setInterface(newInterfaceName)){
qDebug("InterfaceSetupImp: Added interface, but still can't setInterface.");
return;
}
}
}
// We must have a valid interface to get this far so read some settings.
// DHCP
bool error = false;
if(interfaces->getInterfaceMethod(error) == INTERFACES_METHOD_DHCP)
dhcpCheckBox->setChecked(true);
else
dhcpCheckBox->setChecked(false);
// IP Information
autoStart->setChecked(interfaces->isAuto(interface->getInterfaceName()));
QString dns = interfaces->getInterfaceOption("up "DNSSCRIPT" -a", error);
qDebug("dns >%s<",dns.latin1());
if(dns.contains(" ")){
firstDNSLineEdit->setText(dns.mid(0, dns.find(" ")));
secondDNSLineEdit->setText(dns.mid(dns.find(" ")+1, dns.length()));
}else firstDNSLineEdit->setText(dns);
ipAddressEdit->setText(interfaces->getInterfaceOption("address", error));
subnetMaskEdit->setText(interfaces->getInterfaceOption("netmask", error));
if (subnetMaskEdit->text().isEmpty())
subnetMaskEdit->setText( "255.255.255.0" );
gatewayEdit->setText(interfaces->getInterfaceOption("gateway", error));
qWarning("InterfaceSetupImp::setProfile(%s)\n", profile.latin1());
qWarning("InterfaceSetupImp::setProfile: iface is %s\n", interfaces->getInterfaceName(error).latin1());
}
// interfacesetup.cpp
diff --git a/noncore/settings/networksettings/module.h b/noncore/settings/networksettings/module.h
index f7d8046..5cc82cd 100644
--- a/noncore/settings/networksettings/module.h
+++ b/noncore/settings/networksettings/module.h
@@ -1,113 +1,113 @@
#ifndef NETCONF_MODULE_H
#define NETCONF_MODULE_H
#include <qobject.h>
#if QT_VERSION < 300
#include <qlist.h>
#else
#include <qptrlist.h>
#endif
#include <qmap.h>
#include "interface.h"
class QWidget;
class QTabWidget;
class Module : QObject{
signals:
void updateInterface(Interface *i);
public:
Module(){};
/**
* The type of the plugin
* and the name of the dcop call
*/
virtual const QString type() = 0;
/**
* The current profile has been changed and the module should do any
* neccesary changes also.
* @param newProfile what the profile should be changed to.
*/
virtual void setProfile(const QString &newProfile) = 0;
/**
* get the icon name for this device.
* @param Interface* can be used in determining the icon.
* @return QString the icon name (minus .png, .gif etc)
*/
virtual QString getPixmapName(Interface *) = 0;
/**
* Check to see if the interface i is owned by this module.
* @param Interface* interface to check against
* @return bool true if i is owned by this module, false otherwise.
*/
virtual bool isOwner(Interface *){ return false; };
/**
* Create and return the WLANConfigure Module
* @param Interface *i the interface to configure.
* @return QWidget* pointer to this modules configure.
*/
virtual QWidget *configure(Interface *){ return NULL; } ;
/**
* Create, and return the Information Module
* @param Interface *i the interface to get info on.
* @return QWidget* pointer to this modules info.
*/
virtual QWidget *information(Interface *){ return NULL; };
/**
* Get all active (up or down) interfaces
* @return QList<Interface> A list of interfaces that exsist that havn't
* been called by isOwner()
*/
virtual QList<Interface> getInterfaces() = 0;
/**
* Adds possible new interfaces to the list (Example: usb(ppp), ir(ppp),
* modem ppp)
*/
virtual void possibleNewInterfaces(QMap<QString, QString> &list) = 0;
/**
* Attempts to create a new interface from name
* @return Interface* NULL if it was unable to be created.
* @param name the type of interface to create
*/
virtual Interface *addNewInterface(const QString &name) = 0;
/**
* Attempts to remove the interface, doesn't delete i
- * @return bool true if successfull, false otherwise.
+ * @return bool true if successful, false otherwise.
*/
virtual bool remove(Interface* i) = 0;
/**
* get dcop calls
*/
virtual void receive(const QCString &msg, const QByteArray &arg) = 0;
QStringList handledInterfaceNames()const { return m_inter; }
protected:
/**
* set which interfaceNames should not be shown cause they're handled
* internally of this module.. An already running ppp link or
* a tunnel...
*/
void setHandledInterfaceNames( const QStringList& in) { m_inter = in; }
private:
QStringList m_inter;
};
#endif
// module.h
diff --git a/noncore/settings/networksettings/ppp/pppmodule.cpp b/noncore/settings/networksettings/ppp/pppmodule.cpp
index af05eb7..2462fa4 100644
--- a/noncore/settings/networksettings/ppp/pppmodule.cpp
+++ b/noncore/settings/networksettings/ppp/pppmodule.cpp
@@ -1,250 +1,250 @@
#include <errno.h>
#include <signal.h>
#include <qpe/config.h>
#include "modem.h"
#include "pppconfig.h"
#include "pppmodule.h"
#include "pppdata.h"
#include "interfaceinformationppp.h"
#include "interfaceppp.h"
// don't polute global namespace
namespace {
/*
* If network settings is qutting and we've ppp
* devices open we need to save the pid_t the PPData
* and the interface number
*/
struct Connection {
pid_t pid;
QString device;
QString name;
};
class InterfaceKeeper {
public:
InterfaceKeeper();
~InterfaceKeeper();
void addInterface( pid_t, const QString& pppDev, const QString& name );
QMap<QString, Connection> interfaces()const; // will check if still available
private:
bool isAvailable( pid_t )const;
QMap<QString, Connection> m_interfaces;
};
}
/**
* Constructor, find all of the possible interfaces
* We also need to restore the state.. it could be that
* an interface was up while closing the application
* we need to be able to shut it down...
*/
PPPModule::PPPModule() : Module()
{
InterfaceKeeper inFace;
QMap<QString,Connection> running = inFace.interfaces();
QStringList handledInterfaceNames;
QMap<QString,QString> ifaces = PPPData::getConfiguredInterfaces();
QMap<QString,QString>::Iterator it;
InterfacePPP *iface;
qDebug("getting interfaces");
for( it = ifaces.begin(); it != ifaces.end(); ++it ){
qDebug("ifaces %s %s", it.key().latin1(), it.data().latin1() );
iface = new InterfacePPP( 0, it.key() );
iface->setHardwareName( it.data() );
list.append( (Interface*)iface );
// check if (*it) is one of the running ifaces
if ( running.contains( it.data() ) ) {
qDebug("iface is running %s", it.key().latin1() );
handledInterfaceNames << running[it.data()].device;
iface->setStatus( true );
iface->setPPPDpid( running[it.data()].pid );
iface->modem()->setPPPDevice( running[it.data()].device );
iface->refresh();
}
}
setHandledInterfaceNames( handledInterfaceNames );
}
/**
* Delete any interfaces that we own.
*/
PPPModule::~PPPModule(){
qDebug("PPPModule::~PPPModule() " );
QMap<QString,QString> ifaces;
InterfaceKeeper keeper;
Interface *i;
for ( i=list.first(); i != 0; i=list.next() ){
/* if online save the state */
if ( i->getStatus() ) {
qDebug("Iface %s is still up", i->getHardwareName().latin1() );
InterfacePPP* ppp = static_cast<InterfacePPP*>(i);
keeper.addInterface( ppp->pppPID(), ppp->pppDev(), ppp->getHardwareName() );
}
ifaces.insert( i->getInterfaceName(), i->getHardwareName() );
delete i;
}
PPPData::setConfiguredInterfaces( ifaces );
}
/**
* Change the current profile
*/
void PPPModule::setProfile(const QString &newProfile){
profile = newProfile;
}
/**
* get the icon name for this device.
* @param Interface* can be used in determining the icon.
* @return QString the icon name (minus .png, .gif etc)
*/
QString PPPModule::getPixmapName(Interface* ){
return "ppp";
}
/**
* Check to see if the interface i is owned by this module.
* @param Interface* interface to check against
* @return bool true if i is owned by this module, false otherwise.
*/
bool PPPModule::isOwner(Interface *i){
return list.find( i ) != -1;
}
/**
* Create, and return the WLANConfigure Module
* @return QWidget* pointer to this modules configure.
*/
QWidget *PPPModule::configure(Interface *i){
qDebug("return ModemWidget");
PPPConfigWidget *pppconfig = new PPPConfigWidget( (InterfacePPP*)i,
0, "PPPConfig", false,
Qt::WDestructiveClose | Qt::WStyle_ContextHelp);
return pppconfig;
}
/**
* Create, and return the Information Module
* @return QWidget* pointer to this modules info.
*/
QWidget *PPPModule::information(Interface *i){
// We don't have any advanced pppd information widget yet :-D
// TODO ^
return new InterfaceInformationPPP( 0, "InterfaceInformationPPP", i );
}
/**
* Get all active (up or down) interfaces
* @return QList<Interface> A list of interfaces that exsist that havn't
* been called by isOwner()
*/
QList<Interface> PPPModule::getInterfaces(){
// List all of the files in the peer directory
qDebug("PPPModule::getInterfaces");
return list;
}
/**
* Attempt to add a new interface as defined by name
* @param name the name of the type of interface that should be created given
* by possibleNewInterfaces();
* @return Interface* NULL if it was unable to be created.
*/
Interface *PPPModule::addNewInterface(const QString &newInterface){
InterfacePPP *ifaceppp;
Interface *iface;
ifaceppp = new InterfacePPP();
PPPConfigWidget imp(ifaceppp, 0, "PPPConfigImp", true);
imp.showMaximized();
if(imp.exec() == QDialog::Accepted ){
iface = (InterfacePPP*) ifaceppp;
iface->setModuleOwner( this );
list.append( iface );
return iface;
}else {
delete ifaceppp;
iface = NULL;
}
return iface;
}
/**
* Attempts to remove the interface, doesn't delete i
- * @return bool true if successfull, false otherwise.
+ * @return bool true if successful, false otherwise.
*/
bool PPPModule::remove(Interface *i){
return list.remove(i);
}
void PPPModule::possibleNewInterfaces(QMap<QString, QString> &newIfaces)
{
newIfaces.insert(QObject::tr("PPP") ,
QObject::tr("generic ppp device"));
}
namespace {
InterfaceKeeper::InterfaceKeeper( ) {
}
InterfaceKeeper::~InterfaceKeeper() {
Config cfg("ppp_plugin_keeper");
QStringList lst = cfg.groupList();
for (QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) {
Connection con;
cfg.setGroup( (*it) );
cfg.clearGroup();
}
for (QMap<QString, Connection>::Iterator it = m_interfaces.begin(); it != m_interfaces.end(); ++it ) {
Connection con = it.data();
cfg.setGroup( con.name );
cfg.writeEntry( "pid", con.pid );
cfg.writeEntry( "device", con.device );
}
}
void InterfaceKeeper::addInterface(pid_t pid, const QString& dev, const QString& name ) {
Connection con;
con.pid = pid;
con.device = dev;
con.name = name;
m_interfaces.insert( name, con );
}
QMap<QString, Connection> InterfaceKeeper::interfaces()const {
Config cfg("ppp_plugin_keeper");
QMap<QString, Connection> ifaces;
QStringList lst = cfg.groupList();
for (QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) {
Connection con;
cfg.setGroup( (*it) );
con.name = (*it);
con.pid = cfg.readNumEntry("pid");
con.device = cfg.readEntry("device");
qDebug(" %s %s %d", con.name.latin1(), con.device.latin1(), con.pid );
if ( con.pid != -1 && isAvailable( con.pid ) )
ifaces.insert( con.name, con );
}
return ifaces;
}
bool InterfaceKeeper::isAvailable( pid_t p)const {
if (::kill(p, 0 ) == 0 || errno != ESRCH ) {
qDebug("isAvailable %d", p);
return true;
}
qDebug("notAvailable %d", p);
return false;
}
}
diff --git a/noncore/settings/networksettings/wlan/wextensions.cpp b/noncore/settings/networksettings/wlan/wextensions.cpp
index bd7cf93..d1fff88 100644
--- a/noncore/settings/networksettings/wlan/wextensions.cpp
+++ b/noncore/settings/networksettings/wlan/wextensions.cpp
@@ -1,200 +1,200 @@
#include "wextensions.h"
#include <qfile.h>
#include <qtextstream.h>
#include <arpa/inet.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <math.h>
#define PROCNETWIRELESS "/proc/net/wireless"
#define IW_LOWER 0
#define IW_UPPER 256
/**
* Constructor. Sets hasWirelessExtensions
*/
WExtensions::WExtensions(QString interfaceName): hasWirelessExtensions(false), interface(interfaceName) {
fd = socket( AF_INET, SOCK_DGRAM, 0 );
if(fd == -1)
return;
const char* buffer[200];
memset( &iwr, 0, sizeof( iwr ) );
iwr.u.essid.pointer = (caddr_t) buffer;
iwr.u.essid.length = IW_ESSID_MAX_SIZE;
iwr.u.essid.flags = 0;
// check if it is an IEEE 802.11 standard conform
// wireless device by sending SIOCGIWESSID
// which also gives back the Extended Service Set ID
// (see IEEE 802.11 for more information)
const char* iname = interface.latin1();
strcpy( iwr.ifr_ifrn.ifrn_name, (const char *)iname );
if ( 0 == ioctl( fd, SIOCGIWESSID, &iwr ) )
hasWirelessExtensions = true;
}
/**
* @return QString the station name of the access point.
*/
QString WExtensions::station(){
if(!hasWirelessExtensions)
return QString();
const char* buffer[200];
iwr.u.data.pointer = (caddr_t) buffer;
iwr.u.data.length = IW_ESSID_MAX_SIZE;
iwr.u.data.flags = 0;
if ( 0 == ioctl( fd, SIOCGIWNICKN, &iwr )){
iwr.u.data.pointer[(unsigned int) iwr.u.data.length-1] = '\0';
return QString(iwr.u.data.pointer);
}
return QString();
}
/**
* @return QString the essid of the host 802.11 access point.
*/
QString WExtensions::essid(){
if(!hasWirelessExtensions)
return QString();
if ( 0 == ioctl( fd, SIOCGIWESSID, &iwr )){
iwr.u.essid.pointer[(unsigned int) iwr.u.essid.length] = '\0';
return QString(iwr.u.essid.pointer);
}
return QString();
}
/**
* @return QString the mode of interface
*/
QString WExtensions::mode(){
if(!hasWirelessExtensions)
return QString();
if ( 0 == ioctl( fd, SIOCGIWMODE, &iwr ) )
return QString("%1").arg(iwr.u.mode == IW_MODE_ADHOC ? "Ad-Hoc" : "Managed");
return QString();
}
/**
* Get the frequency that the interface is running at.
* @return int the frequency that the interfacae is running at.
*/
double WExtensions::frequency(){
if(!hasWirelessExtensions)
return 0;
if ( 0 == ioctl( fd, SIOCGIWFREQ, &iwr ))
return (double( iwr.u.freq.m ) * pow( 10, iwr.u.freq.e ) / 1000000000);
return 0;
}
/**
* Get the channel that the interface is running at.
* @return int the channel that the interfacae is running at.
*/
int WExtensions::channel(){
if(!hasWirelessExtensions)
return 0;
if ( 0 != ioctl( fd, SIOCGIWFREQ, &iwr ))
return 0;
// http://www.elanix.com/pdf/an137e.pdf
double num = (double( iwr.u.freq.m ) * pow( 10, iwr.u.freq.e ) / 1000000000);
double left = 2.401;
double right = 2.416;
for(int channel = 1; channel<= 15; channel++){
if( num >= left && num <= right )
return channel;
left += 0.005;
right += 0.005;
}
qDebug(QString("Unknown frequency: %1, returning -1 for the channel.").arg(num).latin1());
return -1;
}
/***
* Get the current rate that the card is transmiting at.
* @return double the rate, 0 if error.
*/
double WExtensions::rate(){
if(!hasWirelessExtensions)
return 0;
if(0 == ioctl(fd, SIOCGIWRATE, &iwr)){
return ((double)iwr.u.bitrate.value)/1000000;
}
return 0;
}
/**
* @return QString the AccessPoint that the interface is connected to.
*/
QString WExtensions::ap(){
if(!hasWirelessExtensions)
return QString();
if ( 0 == ioctl( fd, SIOCGIWAP, &iwr )){
QString ap;
ap = ap.sprintf( "%.2X:%.2X:%.2X:%.2X:%.2X:%.2X",
iwr.u.ap_addr.sa_data[0]&0xff,
iwr.u.ap_addr.sa_data[1]&0xff,
iwr.u.ap_addr.sa_data[2]&0xff,
iwr.u.ap_addr.sa_data[3]&0xff,
iwr.u.ap_addr.sa_data[4]&0xff,
iwr.u.ap_addr.sa_data[5]&0xff );
return ap;
}
else return QString();
}
/**
* Get the stats for interfaces
* @param signal the signal strength of interface
* @param noise the noise level of the interface
* @param quality the quality level of the interface
- * @return bool true if successfull
+ * @return bool true if successful
*/
bool WExtensions::stats(int &signal, int &noise, int &quality){
// gather link quality from /proc/net/wireless
if(!QFile::exists(PROCNETWIRELESS))
return false;
char c;
QString status;
QString name;
QFile wfile( PROCNETWIRELESS );
if(!wfile.open( IO_ReadOnly ))
return false;
QTextStream wstream( &wfile );
wstream.readLine(); // skip the first two lines
wstream.readLine(); // because they only contain headers
while(!wstream.atEnd()){
wstream >> name >> status >> quality >> c >> signal >> c >> noise;
if(name == QString("%1:").arg(interface)){
if ( quality > 92 )
qDebug( "WIFIAPPLET: D'oh! Quality %d > estimated max!\n", quality );
if ( ( signal > IW_UPPER ) || ( signal < IW_LOWER ) )
qDebug( "WIFIAPPLET: Doh! Strength %d > estimated max!\n", signal );
if ( ( noise > IW_UPPER ) || ( noise < IW_LOWER ) )
qDebug( "WIFIAPPLET: Doh! Noise %d > estimated max!\n", noise );
//qDebug(QString("q:%1, s:%2, n:%3").arg(quality).arg(signal).arg(noise).latin1());
signal = ( ( signal-IW_LOWER ) * 100 ) / IW_UPPER;
noise = ( ( noise-IW_LOWER ) * 100 ) / IW_UPPER;
quality = ( quality*100 ) / 92;
return true;
}
}
qDebug("WExtensions::statsCard no longer present.");
quality = -1;
signal = IW_LOWER;
noise = IW_LOWER;
return false;
}
// wextensions.cpp
diff --git a/noncore/settings/networksettings/wlan/wlanmodule.cpp b/noncore/settings/networksettings/wlan/wlanmodule.cpp
index b4c3509..07bf73f 100644
--- a/noncore/settings/networksettings/wlan/wlanmodule.cpp
+++ b/noncore/settings/networksettings/wlan/wlanmodule.cpp
@@ -1,252 +1,252 @@
#include "wlanmodule.h"
#include "wlanimp2.h"
#include "infoimp.h"
#include "wextensions.h"
#include "interfaceinformationimp.h"
#include <qcheckbox.h>
#include <qcombobox.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qprogressbar.h>
#include <qspinbox.h>
#include <qtabwidget.h>
/**
* Constructor, find all of the possible interfaces
*/
WLANModule::WLANModule()
: Module(),
wlanconfigWiget(0)
{
}
/**
* Delete any interfaces that we own.
*/
WLANModule::~WLANModule(){
Interface *i;
for ( i=list.first(); i != 0; i=list.next() )
delete i;
}
/**
* Change the current profile
*/
void WLANModule::setProfile(const QString &newProfile){
profile = newProfile;
}
/**
* get the icon name for this device.
* @param Interface* can be used in determining the icon.
* @return QString the icon name (minus .png, .gif etc)
*/
QString WLANModule::getPixmapName(Interface* ){
return "wlan";
}
/**
* Check to see if the interface i is owned by this module.
* @param Interface* interface to check against
* @return bool true if i is owned by this module, false otherwise.
*/
bool WLANModule::isOwner(Interface *i){
WExtensions we(i->getInterfaceName());
if(!we.doesHaveWirelessExtensions())
return false;
i->setHardwareName("802.11b");
list.append(i);
return true;
}
/**
* Create, and return the WLANConfigure Module
* @return QWidget* pointer to this modules configure.
*/
QWidget *WLANModule::configure(Interface *i){
WLANImp *wlanconfig = new WLANImp(0, "WlanConfig", i, true, Qt::WDestructiveClose);
wlanconfig->setProfile(profile);
return wlanconfig;
}
/**
* Create, and return the Information Module
* @return QWidget* pointer to this modules info.
*/
QWidget *WLANModule::information(Interface *i){
WExtensions we(i->getInterfaceName());
if(!we.doesHaveWirelessExtensions())
return NULL;
return getInfo( i );
}
/**
* Get all active (up or down) interfaces
* @return QList<Interface> A list of interfaces that exsist that havn't
* been called by isOwner()
*/
QList<Interface> WLANModule::getInterfaces(){
return list;
}
/**
* Attempt to add a new interface as defined by name
* @param name the name of the type of interface that should be created given
* by possibleNewInterfaces();
* @return Interface* NULL if it was unable to be created.
*/
Interface *WLANModule::addNewInterface(const QString &){
// We can't add a 802.11 interface, either the hardware will be there
// or it wont.
return NULL;
}
/**
* Attempts to remove the interface, doesn't delete i
- * @return bool true if successfull, false otherwise.
+ * @return bool true if successful, false otherwise.
*/
bool WLANModule::remove(Interface*){
// Can't remove a hardware device, you can stop it though.
return false;
}
void WLANModule::receive(const QCString &param, const QByteArray &arg)
{
qDebug("WLANModule::receive "+param);
QStringList params = QStringList::split(",",param);
int count = params.count();
qDebug("WLANModule got %i params", count );
if (count < 2){
qDebug("Erorr less than 2 parameter");
qDebug("RETURNING");
return;
}
QDataStream stream(arg,IO_ReadOnly);
QString interface;
QString action;
int countMsgs = 0;
stream >> interface;
qDebug("got count? >%s<",interface.latin1());
if (interface == "count"){
qDebug("got count");
stream >> action;
qDebug("Got count num >%s<", action.latin1());
countMsgs = action.toInt();
}
QDialog *toShow;
//while (! stream.atEnd() ){
for (int i = 0; i < countMsgs; i++){
qDebug("start stream %d/%d",i,countMsgs);
if (stream.atEnd()){
qDebug("end of stream");
return;
}
stream >> interface;
qDebug("got iface");
stream >> action;
qDebug("WLANModule got interface %s and acion %s", interface.latin1(), action.latin1());
// find interfaces
Interface *ifa=0;
for ( Interface *i=list.first(); i != 0; i=list.next() ){
if (i->getInterfaceName() == interface){
qDebug("WLANModule found interface %s",interface.latin1());
ifa = i;
}
}
if (ifa == 0){
qDebug("WLANModule Did not find %s",interface.latin1());
qDebug("skipping");
count = 0;
}
if (count == 2){
// those should call the interface directly
QWidget *info = getInfo( ifa );
info->showMaximized();
if ( action.contains("start" ) ){
ifa->start();
} else if ( action.contains("restart" ) ){
ifa->restart();
} else if ( action.contains("stop" ) ){
ifa->stop();
}else if ( action.contains("refresh" ) ){
ifa->refresh();
}
}else if (count == 3){
QString value;
if (!wlanconfigWiget){
//FIXME: what if it got closed meanwhile?
wlanconfigWiget = (WLANImp*) configure(ifa);
toShow = (QDialog*) wlanconfigWiget;
}
wlanconfigWiget->showMaximized();
stream >> value;
qDebug("WLANModule (build 4) is setting %s of %s to %s", action.latin1(), interface.latin1(), value.latin1() );
if (value.isEmpty()){
qDebug("value is empty!!!\nreturning");
return;
}
if ( action.contains("ESSID") ){
QComboBox *combo = wlanconfigWiget->essid;
bool found = false;
for ( int i = 0; i < combo->count(); i++)
if ( combo->text( i ) == value ){
combo->setCurrentItem( i );
found = true;
}
if (!found) combo->insertItem( value, 0 );
}else if ( action.contains("Mode") ){
QComboBox *combo = wlanconfigWiget->mode;
for ( int i = 0; i < combo->count(); i++)
if ( combo->text( i ) == value ){
combo->setCurrentItem( i );
}
}else if (action.contains("Channel")){
bool ok;
qDebug("converting channel");
int chan = value.toInt( &ok );
if (ok){
qDebug("ok setting channel");
wlanconfigWiget->specifyChan->setChecked( true );
wlanconfigWiget->networkChannel->setValue( chan );
}
}else if (action.contains("MacAddr")){
wlanconfigWiget->specifyAp->setChecked( true );
wlanconfigWiget->macEdit->setText( value );
}else
qDebug("wlan plugin has no clue");
}
qDebug("next stream");
}// while stream
qDebug("end of stream");
if (toShow) toShow->exec();
qDebug("returning");
}
QWidget *WLANModule::getInfo( Interface *i)
{
qDebug("WLANModule::getInfo start");
WlanInfoImp *info = new WlanInfoImp(0, i->getInterfaceName(), Qt::WDestructiveClose);
InterfaceInformationImp *information = new InterfaceInformationImp(info->tabWidget, "InterfaceSetupImp", i);
info->tabWidget->insertTab(information, "TCP/IP", 0);
info->tabWidget->setCurrentPage( 0 );
info->tabWidget->showPage( information );
if (info->tabWidget->currentPage() == information ) qDebug("infotab OK");
else qDebug("infotab NOT OK");
qDebug("current idx %d", info->tabWidget->currentPageIndex());
qDebug("WLANModule::getInfo return");
return info;
}
diff --git a/noncore/settings/tabmanager/tabmanager.cpp b/noncore/settings/tabmanager/tabmanager.cpp
index c9d7aed..ff5957c 100644
--- a/noncore/settings/tabmanager/tabmanager.cpp
+++ b/noncore/settings/tabmanager/tabmanager.cpp
@@ -1,508 +1,508 @@
#include "tabmanager.h"
#include "app.h"
#include "wait.h"
#include "tabapplnk.h"
#include <qpe/applnk.h>
#include <qdir.h>
#include <qfile.h>
#include <qtextstream.h>
#include <qlistview.h>
#include <qheader.h>
#include <qcombobox.h>
#include <qlineedit.h>
#include <qlabel.h>
#include <qmessagebox.h>
#include <stdlib.h>
#include <qpe/qcopenvelope_qws.h>
#include <qpe/qpeapplication.h>
#include <qpe/resource.h>
#define HOME_APP_DIR QPEApplication::qpeDir()+"/apps"
#define HOME_APP_INSTALL_DIR "/usr/lib/ipkg/info"
#define NEW_FOLDER "EmptyTab"
#define NEW_APPLICATION "NewApp"
#define APPLICATION_EXTENSION ".desktop"
#define APPLICATION_EXTENSION_LENGTH 8
/**
* Constructor. Sets up signals. Performs initial scan of applications
* and tabs
*/
TabManager::TabManager( QWidget* parent, const char* name):TabManagerBase(parent, name), changed(false), application(NULL){
rescanFolder(HOME_APP_DIR);
// Connect the signals and slots
connect(tabList, SIGNAL(doubleClicked(QListViewItem *)), this, SLOT(editItem(QListViewItem*)));
(tabList->header())->hide();
connect(tabList, SIGNAL(moveItem(QListViewItem *, QListViewItem *)), this, SLOT(moveApplication(QListViewItem *, QListViewItem *)));
}
/**
* If anything in the tab's have been changed then update the system or alert
* the user.
*/
TabManager::~TabManager(){
if(changed){
// Prompt.
//int answer = QMessageBox::warning(this, "Message", "Should your desktop be","Yes", "Cancel", 0, 1 );
//if (answer)
// return;
QCopEnvelope e("QPE/System", "linkChanged(QString)");
QString link; //we'll just send an empty string
e << link;
}
}
/**
* Scans root directory for any tabs or applications. Will recursivly go down,
* but will not follow symlinks.
* @param directory - the directory to look in.
* @param parent - the parent to place any new tabs or apps into. If parent is
* NULL then the item is a tab and should be placed as a child of the window.
*/
void TabManager::rescanFolder(QString directory, QListViewItem* parent){
//qDebug(QString("rescanFolder: ") + directory.latin1());
QDir d;
d.setPath(directory);
// Show hidden files for .directories
d.setFilter( QDir::Files | QDir::Hidden | QDir::Dirs);
const QFileInfoList *list = d.entryInfoList();
QFileInfoListIterator it( *list ); // create list iterator
QFileInfo *fi; // pointer for traversing
while ( (fi=it.current()) ) { // for each file...
// If it is a dir and not .. or . then add it as a tab and go down.
if(fi->isDir()){
if(fi->fileName() != ".." && fi->fileName() != ".") {
QListViewItem* newItem;
if(!parent)
newItem = new QListViewItem(tabList, fi->fileName());
else
newItem = new QListViewItem(parent, fi->fileName());
itemList.insert(newItem, directory + "/" + fi->fileName() + "/.directory" );
rescanFolder(directory + "/" + fi->fileName(), newItem);
}
}
else{
// it is a file, if not a .directory add to parent.
// Change parents name and icon to reflect icon.
if(fi->fileName() == ".directory"){
AppLnk app(directory + "/" + fi->fileName());
if(parent){
parent->setPixmap(0,app.pixmap());
parent->setText(0, app.name());
}
}
else{
// Add any desktop files found.
QListViewItem* newItem;
if(directory != HOME_APP_DIR){
if(!parent)
newItem = new QListViewItem(tabList, fi->fileName());
else
newItem = new QListViewItem(parent, fi->fileName());
if(fi->fileName().right(APPLICATION_EXTENSION_LENGTH) == APPLICATION_EXTENSION){
AppLnk app(directory + "/" + fi->fileName());
newItem->setPixmap(0,app.pixmap());
newItem->setText(0, app.name());
itemList.insert(newItem, directory + "/" + fi->fileName());
}
}
}
}
++it; // goto next list element
}
}
/**
* Create a new blank Tab.
* Create a physical folder with .directory file
* Create a item on the list
*/
void TabManager::newFolder(){
QDir r;
r.mkdir(QString(HOME_APP_DIR) + "/" + NEW_FOLDER);
system((QString("echo [Desktop Entry] | cat >> ") + HOME_APP_DIR + "/" + NEW_FOLDER "/.directory").latin1());
system((QString("echo Name=" NEW_FOLDER " | cat >> ") + HOME_APP_DIR + "/" + NEW_FOLDER "/.directory").latin1());
QString homeLocation = QString(HOME_APP_DIR) + "/" + NEW_FOLDER + "/.directory";
QListViewItem *newItem = new QListViewItem(tabList, NEW_FOLDER);
itemList.insert(newItem, homeLocation );
// We have changed something.
changed = true;
}
/**
* Create a new blank application
* Make sure a tab is selected
* create physical file
* fill file with default information (entry, name, type).
*/
void TabManager::newApplication(){
QListViewItem *item = tabList->currentItem();
if(!item || item->parent())
return;
QString parentDir = itemList[item].mid(0,itemList[item].length()-11);
QString homeLocation = parentDir + "/" NEW_APPLICATION APPLICATION_EXTENSION;
system((QString("echo [Desktop Entry] | cat >> ") + homeLocation).latin1());
system((QString("echo Name=" NEW_APPLICATION " | cat >> ") + homeLocation).latin1());
int slash = parentDir.findRev('/', -1);
QString folderName = parentDir.mid(slash+1, parentDir.length());
system((QString("echo Type=") + folderName + " | cat >> " + homeLocation).latin1());
// Insert into the tree
QListViewItem *newItem = new QListViewItem(item, NEW_APPLICATION);
itemList.insert(newItem, homeLocation );
// We have changed something.
changed = true;
}
/**
* Remove the item.
* Check if we can
* Prompt user
* Delete physical file (Dir, remove .dir, then dir. File, remove file)
* Remove from installer if need too.
*/
void TabManager::removeItem(){
// Make sure we can delete
QListViewItem *item = tabList->currentItem();
if(!item)
return;
if(item->childCount() > 0){
QMessageBox::critical(this, tr("Message"), tr("Can't remove with applications\nstill in the group."), tr("Ok") );
return;
}
// Prompt.
int answer = QMessageBox::warning(this, tr("Message"), tr("Are you sure you want to delete?"), tr("Yes"), tr("Cancel"), 0, 1 );
if (answer)
return;
- bool removeSuccessfull = true;
+ bool removeSuccessful = true;
QString location = itemList[item];
// Remove file (.directory in a Directory case)
if(!QFile::remove(location))
- removeSuccessfull = false;
+ removeSuccessful = false;
// Remove directory
if(item->parent() == NULL){
// Remove .directory file string
location = location.mid(0,location.length()-10);
QDir dir;
if(!dir.rmdir(location))
- removeSuccessfull = false;
+ removeSuccessful = false;
else
- removeSuccessfull = true;
+ removeSuccessful = true;
}
// If removing failed.
- if(!removeSuccessfull){
+ if(!removeSuccessful){
qDebug((QString("removeItem: ") + location).latin1());
QMessageBox::critical(this, tr("Message"), tr("Can't remove."), tr("Ok") );
return;
}
// Remove from the installer so it wont fail.
// Don't need to do this sense the current install uses rm -f so no error
// Remove from the gui list.
itemList.remove(item);
if(item->parent())
item->parent()->takeItem(item);
delete item;
// We have changed something.
changed = true;
}
/**
* Helper function. Edits the current item.
* calls editItem with the currently selected item.
*/
void TabManager::editCurrentItem(){
editItem(tabList->currentItem());
}
/**
* Edit the item that is passed in.
* Show application dialog and if anything changed
* @param item the item to edit.
*/
void TabManager::editItem( QListViewItem * item){
if(!item)
return;
TabAppLnk app(itemList[item]);
if(!app.isValid()){
qDebug(QString("editItem: Not a valid applnk file: ") + itemList[item].latin1());
return;
}
// Fill with all of the icons
if(!application){
Wait waitDialog(this, "Wait dialog");
waitDialog.waitLabel->setText(tr("Gathering icons..."));
waitDialog.show();
qApp->processEvents();
application = new AppEdit(this, "Application edit", true);
QDir d(QPEApplication::qpeDir() + "/pics/");
d.setFilter( QDir::Files);
const QFileInfoList *list = d.entryInfoList();
QFileInfoListIterator it( *list ); // create list iterator
QFileInfo *fi; // pointer for traversing
while ( (fi=it.current()) ) { // for each file...
QString fileName = fi->fileName();
if(fileName.right(4) == ".png"){
fileName = fileName.mid(0,fileName.length()-4);
QPixmap imageOfFile(Resource::loadPixmap(fileName));
QImage foo = imageOfFile.convertToImage();
foo = foo.smoothScale(16,16);
imageOfFile.convertFromImage(foo);
application->iconLineEdit->insertItem(imageOfFile,fileName);
}
//qDebug(fi->fileName().latin1());
++it;
}
waitDialog.hide();
}
int pixmap = -1;
QString pixmapText = app.pixmapString();
QComboBox *f = application->iconLineEdit;
for(int i = 0; i < application->iconLineEdit->count(); i++){
if(f->text(i) == pixmapText){
pixmap = i;
break;
}
}
if(pixmap != -1)
application->iconLineEdit->setCurrentItem(pixmap);
else if(pixmapText.isEmpty()){
application->iconLineEdit->setCurrentItem(0);
}
else{
QPixmap imageOfFile(Resource::loadPixmap(pixmapText));
QImage foo = imageOfFile.convertToImage();
foo = foo.smoothScale(16,16);
imageOfFile.convertFromImage(foo);
application->iconLineEdit->insertItem(imageOfFile,pixmapText,0);
application->iconLineEdit->setCurrentItem(0);
}
application->nameLineEdit->setText(app.name());
application->execLineEdit->setText(app.exec());
application->commentLineEdit->setText(app.comment());
if(item->parent() == NULL){
application->execLineEdit->setEnabled(false);
application->TextLabel3->setEnabled(false);
application->setCaption(tr("Tab"));
}
else{
application->execLineEdit->setEnabled(true);
application->TextLabel3->setEnabled(true);
application->setCaption(tr("Application"));
}
// Only do somthing if they hit OK
application->showMaximized();
if(application->exec() == 0)
return;
// If nothing has changed exit (hmmm why did they hit ok?)
if(app.name() == application->nameLineEdit->text() &&
app.pixmapString() == application->iconLineEdit->currentText() &&
app.comment() == application->commentLineEdit->text() &&
app.exec() == application->execLineEdit->text())
return;
// Change the applnk file
QString oldName = app.name();
app.setName(application->nameLineEdit->text());
app.setIcon(application->iconLineEdit->currentText());
app.setComment(application->commentLineEdit->text());
app.setExec(application->execLineEdit->text());
if(!app.writeLink()){
QMessageBox::critical(this, tr("Message"), "Can't save.", tr("Ok") );
return;
}
// Update the gui icon and name
item->setText(0,app.name());
item->setPixmap(0,app.pixmap());
// We have changed something.
changed = true;
// If we were dealing with a new folder or new application change
// the file names. Also change the item location in itemList
if(oldName == NEW_FOLDER){
QDir r;
QString oldName = itemList[item];
oldName = oldName.mid(0,oldName.length()-11);
QString newName = oldName.mid(0,oldName.length()-9);
newName = newName + "/" + app.name();
r.rename(oldName, newName);
itemList.remove(item);
itemList.insert(item, newName + "/.directory" );
}
else if(oldName == NEW_APPLICATION){
if(!item->parent())
return;
QString parentDir = itemList[item->parent()];
QDir r;
QString oldName = itemList[item];
QString newName = oldName.mid(0, parentDir.length()-10);
newName = newName + app.name() + APPLICATION_EXTENSION;
r.rename(oldName, newName);
itemList.remove(item);
itemList.insert(item, newName);
}
}
/**
* Move an application from one directory to another.
* Move in the gui, move in the applnk file, move in the installer.
* @param item the application to move
* @pearam newGroup the new parent of this application
*/
void TabManager::moveApplication(QListViewItem *item, QListViewItem *newGroup){
// Can we even move it?
if(!item || !item->parent() || newGroup->parent())
return;
if(item->parent() == newGroup)
return;
// Get the new folder, new file name,
QString newFolder = itemList[newGroup];
newFolder = newFolder.mid(0,newFolder.length()-11);
int slash = newFolder.findRev('/', -1);
QString folderName = newFolder.mid(slash+1, newFolder.length());
QString desktopFile = itemList[item];
slash = desktopFile.findRev('/', -1);
desktopFile = desktopFile.mid(slash, desktopFile.length());
newFolder = newFolder + desktopFile;
// Move file
QDir r;
if(!r.rename(itemList[item], newFolder)){
QMessageBox::critical(this, tr("Message"), "Can't move application.", tr("Ok") );
return;
}
//qDebug((QString("moveApplication: ") + itemList[item]).latin1());
//qDebug((QString("moveApplication: ") + newFolder).latin1());
// Move in the gui
item->parent()->takeItem(item);
newGroup->insertItem(item);
newGroup->setOpen(true);
// Move file in the installer
QString installedAppFile;
if(findInstalledApplication(desktopFile, installedAppFile))
swapInstalledLocation(installedAppFile, desktopFile, newFolder);
else
qDebug("moveApplication: No installed app found for dekstop file");
// Move application type
AppLnk app(newFolder);
app.setType(folderName);
app.writeLink();
// Move in our internal list
itemList.remove(item);
itemList.insert(item, newFolder);
// We have changed something.
changed = true;
}
/**
* File the installed application that has this desktop file.
* Go through each file in HOME_APP_INSTALL_DIR and see if it contains desktop
* file
* @param desktopFile - the .desktop file to search for [foo.desktop]
* @param installedAppFile - location of the app install list
- * @return true if successfull, false if file not found.
+ * @return true if successful, false if file not found.
*/
bool TabManager::findInstalledApplication(QString desktopFile, QString &installedAppFile){
QDir d;
d.setPath(HOME_APP_INSTALL_DIR);
d.setFilter( QDir::Files );
const QFileInfoList *list = d.entryInfoList();
QFileInfoListIterator it( *list ); // create list iterator
QFileInfo *fi; // pointer for traversing
while ( (fi=it.current()) ) { // for each file...
QFile file(QString(HOME_APP_INSTALL_DIR) + "/" + fi->fileName());
if ( file.open(IO_ReadOnly) ) { // file opened successfully
QTextStream stream( &file ); // use a text stream
QString line;
while ( !stream.eof() ) { // until end of file...
line = stream.readLine(); // line of text excluding '\n'
if(line.contains(desktopFile)){
installedAppFile = QString(HOME_APP_INSTALL_DIR) + "/" + fi->fileName();
file.close();
return true;
}
}
file.close();
}
else
qDebug((QString("findInstalledApplication: Can't open file") + HOME_APP_INSTALL_DIR + "/" + fi->fileName()).latin1());
++it; // goto next list element
}
return false;
}
/**
* Open a file and replace a file containing the old desktop file with the new.
* @param installedAppFile application installed list
* @param desktopFile old .desktop file
* @param newLocation new .desktop file
*/
void TabManager::swapInstalledLocation( QString installedAppFile, QString desktopFile, QString newLocation ){
QFile file(installedAppFile);
if ( !file.open(IO_ReadOnly) ){
qDebug(QString("swapInstalledLocation: Can't edit file: %1").arg(installedAppFile).latin1());
return;
}
QTextStream stream( &file ); // use a text stream
QString allLines;
while ( !stream.eof() ) { // until end of file...
QString line = stream.readLine(); // line of text excluding '\n'
if(line.contains(desktopFile))
allLines += newLocation;
else
allLines += line;
allLines += '\n';
}
file.close();
if ( !file.open(IO_ReadWrite) ){
qDebug(QString("swapInstalledLocation: Can't edit file: %1").arg(installedAppFile).latin1());
return;
}
QTextStream streamOut( &file );
streamOut << allLines;
file.close();
}
// tabmanager.cpp
diff --git a/noncore/unsupported/mail2/TODO b/noncore/unsupported/mail2/TODO
index 4bc434f..3c83fdd 100644
--- a/noncore/unsupported/mail2/TODO
+++ b/noncore/unsupported/mail2/TODO
@@ -1,34 +1,34 @@
Mail TODO
-----------------------------------------------------------------------------
General stuff:
- This program needs a name!
- If password is empty, ask for it during fetch.
- Check if all necessary fields in AccoundEditor are filled.
- Seperate Sending and Recieving in configuration.
Protocol related:
- The IMAP implentation is kinda strange and slow.
- The SMTP implentation is goddamn strange.
- POP3 support would be nice.
- NNTP would be kinda neat, too.
- Implent a plugin system.
Security related:
- GnuPG support. This will require a seperate gpg managing utility in
the settings tab.
- sMIME? maybe in the distant future.
- Integrated SSH tunneling.
Mail management:
- Header caching
- Sieve filtering support?
- Enqueueing/Draft support both on the IMAP server and local.
Testing:
I'm using the courier-imap server at my developement site. I didn't have
much opportunity to test on other servers. Giving me test-accounts on other
- servers would be helpfull.
+ servers would be helpful.
If you want something added, drop a mail. Comments are always welcome.
diff --git a/noncore/unsupported/mail2/folderwidget.cpp b/noncore/unsupported/mail2/folderwidget.cpp
index 6c36e92..d27968b 100644
--- a/noncore/unsupported/mail2/folderwidget.cpp
+++ b/noncore/unsupported/mail2/folderwidget.cpp
@@ -1,314 +1,314 @@
#include <qmessagebox.h>
#include <qtextstream.h>
#include <qpopupmenu.h>
#include <qheader.h>
#include <qfile.h>
#include <qdir.h>
#include <qpe/resource.h>
#include <stdlib.h>
#include "folderwidget.h"
#include "imaphandler.h"
#include "imapbase.h"
#include "rename.h"
FolderWidgetItem::FolderWidgetItem(Folder &folder, QListView *parent)
: QListViewItem(parent), _folder(folder)
{
setPixmap(0, QPixmap(Resource::loadPixmap("mail/inbox")));
setText(0, _folder.topFolder().account().user() + " (" + _folder.topFolder().account().imapServer() + ")");
setOpen(true);
}
FolderWidgetItem::FolderWidgetItem(Folder &folder, FolderWidgetItem *parent)
: QListViewItem(parent), _folder(folder)
{
if (_folder.noCache()) {
setText(0, QObject::tr("<Foldertree not known.>"));
} else {
if (folder.fullName().upper() == "INBOX") {
setPixmap(0, QPixmap(Resource::loadPixmap("mail/inbox")));
setText(0, QObject::tr("Inbox"));
} else {
setPixmap(0, QPixmap(Resource::loadPixmap("mail/folder")));
setText(0, folder.fullName());
}
setOpen(true);
}
}
FolderWidget::FolderWidget(QWidget *parent, const char *name, WFlags fl)
: ListViewPlus(parent, name, fl)
{
header()->hide();
addColumn("");
setSorting(-1);
QPopupMenu *menu = new QPopupMenu();
menu->insertItem(tr("Rename"), MENU_RENAME);
menu->insertItem(tr("Delete"), MENU_DELETE);
menu->insertItem(tr("Move"), MENU_MOVE);
menu->insertItem(tr("Copy"), MENU_COPY);
menu->insertSeparator();
menu->insertItem(tr("Create folder"), MENU_CREATE);
menu->insertSeparator();
menu->insertItem(tr("Rescan folder list"), MENU_RESCAN);
setPopup(menu);
getAccounts();
connect(menu, SIGNAL(activated(int)), SLOT(slotMenuActivated(int)));
connect(this, SIGNAL(clicked(QListViewItem *)), SLOT(slotItemClicked(QListViewItem *)));
}
FolderWidget::~FolderWidget()
{
// TODO: Save folder tree.
}
void FolderWidget::update()
{
getAccounts();
}
void FolderWidget::getAccounts()
{
clear();
QValueList<Account> accounts = ConfigFile::getAccounts();
QValueList<Account>::Iterator it;
for (it = accounts.begin(); it != accounts.end(); it++) {
FolderWidgetItem *item = addAccount(*it);
QFile f((QString) getenv("HOME") + "/Applications/mail/foldercache/foldercache-" + (*it).accountName());
if (!f.open(IO_ReadOnly)) {
Folder folder;
folder.setNoCache(true);
addFolder(folder, item);
} else {
QTextStream t(&f);
while (!t.atEnd()) {
QString separator = t.readLine();
QString fullname = t.readLine();
Folder folder;
folder.setSeparator(separator);
folder.setFullName(fullname);
folder.setTopFolder(item->folder().topFolder());
addFolder(folder, item);
}
f.close();
}
}
}
FolderWidgetItem *FolderWidget::addAccount(Account &account)
{
TopFolder tf;
tf.setAccount(account);
// XXX This has to change!!! The folderwidget may not create an
// XXX IMAPHandler!!!! Do this in IMAPHandler!
tf.setIMAPHandler(new IMAPHandler(account));
Folder folder;
folder.setTopFolder(tf);
connect(tf.handler(), SIGNAL(IMAPLookingUpHost()), SLOT(slotIMAPLookingUpHost()));
connect(tf.handler(), SIGNAL(IMAPHostFound()), SLOT(slotIMAPHostFound()));
connect(tf.handler(), SIGNAL(IMAPConnected()), SLOT(slotIMAPConnected()));
connect(tf.handler(), SIGNAL(IMAPDisconnected()), SLOT(slotIMAPDisconnected()));
connect(tf.handler(), SIGNAL(IMAPError(int)), SLOT(slotIMAPError(int)));
return new FolderWidgetItem(folder, this);
}
FolderWidgetItem *FolderWidget::addFolder(Folder &folder, FolderWidgetItem *folderWidgetItem)
{
return new FolderWidgetItem(folder, folderWidgetItem);
}
void FolderWidget::slotMenuActivated(int itemid)
{
if (currentItem() == NULL) {
QMessageBox::information(this, tr("Error"), tr("<p>Please select an item first.</p>"), tr("Ok"));
return;
}
if (itemid == MENU_RENAME) {
if (((FolderWidgetItem *)currentItem())->folder().fullName().isEmpty()) return;
Folder folder = ((FolderWidgetItem *)currentItem())->folder();
QString newName = Rename::rename(folder.fullName(), this);
if (newName.isNull()) return;
folder.topFolder().handler()->iRename(folder.fullName(), newName);
connect(folder.topFolder().handler(), SIGNAL(gotResponse(IMAPResponse &)), SLOT(slotIMAPRename(IMAPResponse &)));
} else if (itemid == MENU_DELETE) {
if (((FolderWidgetItem *)currentItem())->folder().fullName().isEmpty()) return;
Folder folder = ((FolderWidgetItem *)currentItem())->folder();
int ret = QMessageBox::information(this, tr("Question"), tr("<p>Do you really want to delete <pre>%1</pre>?").arg(folder.fullName()), tr("Yes"), tr("No"));
if (ret == 1) return;
_createFolder = folder;
folder.topFolder().handler()->iDelete(folder.fullName());
connect(folder.topFolder().handler(), SIGNAL(gotResponse(IMAPResponse &)), SLOT(slotIMAPDelete(IMAPResponse &)));
} else if (itemid == MENU_MOVE) {
} else if (itemid == MENU_COPY) {
} else if (itemid == MENU_CREATE) {
Folder folder = (((FolderWidgetItem *)currentItem())->folder());
_createFolder = folder;
QString folderName = Rename::getText(tr("Foldername"), tr("<p>Please enter the name of the new folder.</p>"), this);
if (folderName.isNull()) return;
folder.topFolder().handler()->iCreate(folder.fullName() + folder.separator() + folderName);
connect(folder.topFolder().handler(), SIGNAL(gotResponse(IMAPResponse &)), SLOT(slotIMAPCreate(IMAPResponse &)));
} else if (itemid == MENU_RESCAN) {
Folder folder = (((FolderWidgetItem *)currentItem())->folder());
_rescanAccount = folder.topFolder().account();
folder.topFolder().handler()->iList("", "*");
connect(folder.topFolder().handler(), SIGNAL(gotResponse(IMAPResponse &)), SLOT(slotIMAPList(IMAPResponse &)));
}
}
void FolderWidget::slotItemClicked(QListViewItem *item)
{
if (item == NULL) return;
Folder folder = ((FolderWidgetItem *)item)->folder();
if (folder.fullName().isEmpty()) return;
emit folderSelected(folder);
}
void FolderWidget::slotIMAPLookingUpHost()
{
emit status(tr("Looking up host..."));
emit connecting();
}
void FolderWidget::slotIMAPHostFound()
{
emit status(tr("Host found."));
}
void FolderWidget::slotIMAPConnected()
{
emit status(tr("Connected to host."));
emit connected();
}
void FolderWidget::slotIMAPError(int error)
{
if (error == IMAPBase::IMAPErrConnectionRefused) {
QMessageBox::warning(this, tr("Error"), tr("<p>The IMAP connection was refused.</p>"), tr("Ok"));
} else if (error == IMAPBase::IMAPErrHostNotFound) {
QMessageBox::warning(this, tr("Error"), tr("<p>The host was not found.</p>"), tr("Ok"));
} else if (error == IMAPBase::IMAPErrSocketRead) {
QMessageBox::warning(this, tr("Error"), tr("<p>There was an error while reading from the socket.</p>"), tr("Ok"));
} else if (error == IMAPBase::IMAPErrLoginFailed) {
QMessageBox::warning(this, tr("Error"), tr("<p>Login failed. Check your password/username.</p>"), tr("Ok"));
} else {
QMessageBox::warning(this, tr("Error"), tr("<p>An unknown error was encountered.</p>"), tr("Ok"));
}
}
void FolderWidget::slotIMAPDisconnected()
{
emit status(tr("Disconnected."));
emit disconnected();
}
void FolderWidget::slotIMAPLogin(IMAPResponse &response)
{
disconnect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse &)), this, SLOT(slotIMAPLogin(IMAPResponse &)));
if (response.statusResponse().status() == IMAPResponseEnums::OK) {
- emit status(tr("Login successfull!"));
+ emit status(tr("Login successful!"));
} else {
QMessageBox::warning(this, tr("Error"), tr("<p>Login failed. Go away.</p>"), tr("Ok"));
}
}
void FolderWidget::slotIMAPRename(IMAPResponse &response)
{
disconnect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse &)), this, SLOT(slotIMAPRename(IMAPResponse &)));
if (response.statusResponse().status() == IMAPResponseEnums::OK) {
- emit status(tr("Renaming successfull!"));
+ emit status(tr("Renaming successful!"));
} else {
QMessageBox::warning(this, tr("Error"), tr("<p>Renaming failed. (Server said: %1)</p>").arg(response.statusResponse().comment()), tr("Ok"));
}
}
void FolderWidget::slotIMAPDelete(IMAPResponse &response)
{
disconnect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse &)), this, SLOT(slotIMAPDelete(IMAPResponse &)));
if (response.statusResponse().status() == IMAPResponseEnums::OK) {
- emit status(tr("Deletion successfull!"));
+ emit status(tr("Deletion successful!"));
_rescanAccount = _createFolder.topFolder().account();
_createFolder.topFolder().handler()->iList(".", "*");
connect(_createFolder.topFolder().handler(), SIGNAL(gotResponse(IMAPResponse &)), SLOT(slotIMAPList(IMAPResponse &)));
} else {
QMessageBox::warning(this, tr("Error"), tr("<p>Delete failed. (Server said: %1)</p>").arg(response.statusResponse().comment()), tr("Ok"));
}
}
void FolderWidget::slotIMAPCreate(IMAPResponse &response)
{
disconnect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse &)), this, SLOT(slotIMAPCreate(IMAPResponse &)));
if (response.statusResponse().status() == IMAPResponseEnums::OK) {
emit status(tr("Folder created. Rescanning..."));
_rescanAccount = _createFolder.topFolder().account();
_createFolder.topFolder().handler()->iList(".", "*");
connect(_createFolder.topFolder().handler(), SIGNAL(gotResponse(IMAPResponse &)), SLOT(slotIMAPList(IMAPResponse &)));
} else {
QMessageBox::warning(this, tr("Error"), tr("<p>The folder could not be created. (Server said: %1)</p>").arg(response.statusResponse().comment()), tr("Ok"));
}
}
void FolderWidget::slotIMAPList(IMAPResponse &response)
{
disconnect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse &)), this, SLOT(slotIMAPList(IMAPResponse &)));
if (response.statusResponse().status() == IMAPResponseEnums::OK) {
QDir d((QString) getenv("HOME") + "/Applications/mail/foldercache");
if (!d.exists()) {
system("mkdir -p $HOME/Applications/mail/foldercache");
qWarning("Created $HOME/Applications/mail/foldercache.");
}
QFile f((QString) getenv("HOME") + "/Applications/mail/foldercache/foldercache-" + _rescanAccount.accountName());
if (!f.open(IO_WriteOnly)) {
QMessageBox::critical(this, tr("Error"), tr("<p>Couldn't open folder cache file for writing!</p>"), tr("Ok"));
return;
}
QTextStream t(&f);
QValueList<IMAPResponseLIST>::Iterator it;
QValueList<IMAPResponseLIST> lists = response.LIST();
for (it = lists.begin(); it != lists.end(); it++) {
t << (*it).folderSeparator() << "\n";
t << (*it).folder() << "\n";
}
f.close();
emit status(tr("Got folder list."));
getAccounts();
} else {
QMessageBox::warning(this, tr("Error"), tr("<p>Couldn't retrieve the folder list. (Server said: %1)</p>").arg(response.statusResponse().comment()), tr("Ok"));
}
}
diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp
index 8525058..b46005b 100644
--- a/qmake/generators/mac/pbuilder_pbx.cpp
+++ b/qmake/generators/mac/pbuilder_pbx.cpp
@@ -1,983 +1,983 @@
/****************************************************************************
** $Id$
**
** Definition of ________ class.
**
** Created : 970521
**
** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
**
** This file is part of the network module of the Qt GUI Toolkit.
**
** This file may be distributed under the terms of the Q Public License
** as defined by Trolltech AS of Norway and appearing in the file
** LICENSE.QPL included in the packaging of this file.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** Licensees holding valid Qt Enterprise Edition licenses may use this
** file in accordance with the Qt Commercial License Agreement provided
** with the Software.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
** information about Qt Commercial License Agreements.
** See http://www.trolltech.com/qpl/ for QPL licensing information.
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include "pbuilder_pbx.h"
#include "option.h"
#include <qdir.h>
#include <qdict.h>
#include <qregexp.h>
#include <stdlib.h>
#include <time.h>
#ifdef Q_OS_UNIX
# include <sys/types.h>
# include <sys/stat.h>
#endif
// Note: this is fairly hacky, but it does the job...
ProjectBuilderMakefileGenerator::ProjectBuilderMakefileGenerator(QMakeProject *p) : UnixMakefileGenerator(p)
{
}
bool
ProjectBuilderMakefileGenerator::writeMakefile(QTextStream &t)
{
if(!project->variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty()) {
/* for now just dump, I need to generated an empty xml or something.. */
fprintf(stderr, "Project file not generated because all requirements not met:\n\t%s\n",
var("QMAKE_FAILED_REQUIREMENTS").latin1());
return TRUE;
}
project->variables()["MAKEFILE"].clear();
project->variables()["MAKEFILE"].append("Makefile");
if(project->first("TEMPLATE") == "app" || project->first("TEMPLATE") == "lib") {
return writeMakeParts(t);
} else if(project->first("TEMPLATE") == "subdirs") {
writeSubdirs(t, FALSE);
return TRUE;
}
return FALSE;
}
bool
ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
{
int i;
QStringList tmp;
bool did_preprocess = FALSE;
//HEADER
t << "// !$*UTF8*$!" << "\n"
<< "{" << "\n"
<< "\t" << "archiveVersion = 1;" << "\n"
<< "\t" << "classes = {" << "\n" << "\t" << "};" << "\n"
<< "\t" << "objectVersion = " << pbuilderVersion() << ";" << "\n"
<< "\t" << "objects = {" << endl;
//MAKE QMAKE equivlant
if(!project->isActiveConfig("no_autoqmake") && project->projectFile() != "(stdin)") {
QString mkfile = pbx_dir + Option::dir_sep + "qt_makeqmake.mak";
QFile mkf(mkfile);
if(mkf.open(IO_WriteOnly | IO_Translate)) {
debug_msg(1, "pbuilder: Creating file: %s", mkfile.latin1());
QTextStream mkt(&mkf);
writeHeader(mkt);
mkt << "QMAKE = " <<
(project->isEmpty("QMAKE_QMAKE") ? QString("$(QTDIR)/bin/qmake") :
var("QMAKE_QMAKE")) << endl;
writeMakeQmake(mkt);
mkf.close();
}
QString phase_key = keyFor("QMAKE_PBX_MAKEQMAKE_BUILDPHASE");
mkfile = fileFixify(mkfile, QDir::currentDirPath());
project->variables()["QMAKE_PBX_BUILDPHASES"].append(phase_key);
t << "\t\t" << phase_key << " = {" << "\n"
<< "\t\t\t" << "buildActionMask = 2147483647;" << "\n"
<< "\t\t\t" << "files = (" << "\n"
<< "\t\t\t" << ");" << "\n"
<< "\t\t\t" << "generatedFileNames = (" << "\n"
<< "\t\t\t" << ");" << "\n"
<< "\t\t\t" << "isa = PBXShellScriptBuildPhase;" << "\n"
<< "\t\t\t" << "name = \"Qt Qmake\";" << "\n"
<< "\t\t\t" << "neededFileNames = (" << "\n"
<< "\t\t\t" << ");" << "\n"
<< "\t\t\t" << "shellPath = /bin/sh;" << "\n"
<< "\t\t\t" << "shellScript = \"make -C " << QDir::currentDirPath() <<
" -f " << mkfile << "\";" << "\n"
<< "\t\t" << "};" << "\n";
}
//DUMP SOURCES
QMap<QString, QStringList> groups;
QString srcs[] = { "SOURCES", "SRCMOC", "UICIMPLS", QString::null };
for(i = 0; !srcs[i].isNull(); i++) {
tmp = project->variables()[srcs[i]];
QStringList &src_list = project->variables()["QMAKE_PBX_" + srcs[i]];
for(QStringList::Iterator it = tmp.begin(); it != tmp.end(); ++it) {
QString file = fileFixify((*it));
if(file.endsWith(Option::moc_ext))
continue;
bool in_root = TRUE;
QString src_key = keyFor(file);
if(!project->isActiveConfig("flat")) {
QString flat_file = fileFixify(file, QDir::currentDirPath(), Option::output_dir, TRUE);
if(QDir::isRelativePath(flat_file) && flat_file.find(Option::dir_sep) != -1) {
QString last_grp("QMAKE_PBX_" + srcs[i] + "_HEIR_GROUP");
QStringList dirs = QStringList::split(Option::dir_sep, flat_file);
dirs.pop_back(); //remove the file portion as it will be added via src_key
for(QStringList::Iterator dir_it = dirs.begin(); dir_it != dirs.end(); ++dir_it) {
QString new_grp(last_grp + Option::dir_sep + (*dir_it)),
new_grp_key(keyFor(new_grp)), last_grp_key(keyFor(last_grp));
if(dir_it == dirs.begin()) {
if(!groups.contains(new_grp))
project->variables()["QMAKE_PBX_" + srcs[i]].append(new_grp_key);
} else {
groups[last_grp] += new_grp_key;
}
last_grp = new_grp;
}
groups[last_grp] += src_key;
in_root = FALSE;
}
}
if(in_root)
src_list.append(src_key);
//source reference
t << "\t\t" << src_key << " = {" << "\n"
<< "\t\t\t" << "isa = PBXFileReference;" << "\n"
<< "\t\t\t" << "path = \"" << file << "\";" << "\n"
<< "\t\t\t" << "refType = " << reftypeForFile(file) << ";" << "\n"
<< "\t\t" << "};" << "\n";
//build reference
QString obj_key = file + ".o";
obj_key = keyFor(obj_key);
t << "\t\t" << obj_key << " = {" << "\n"
<< "\t\t\t" << "fileRef = " << src_key << ";" << "\n"
<< "\t\t\t" << "isa = PBXBuildFile;" << "\n"
<< "\t\t\t" << "settings = {" << "\n"
<< "\t\t\t\t" << "ATTRIBUTES = (" << "\n"
<< "\t\t\t\t" << ");" << "\n"
<< "\t\t\t" << "};" << "\n"
<< "\t\t" << "};" << "\n";
project->variables()["QMAKE_PBX_OBJ"].append(obj_key);
}
if(!src_list.isEmpty()) {
QString grp;
if(srcs[i] == "SOURCES") {
if(project->first("TEMPLATE") == "app" && !project->isEmpty("RC_FILE")) { //Icon
QString icns_file = keyFor("ICNS_FILE");
src_list.append(icns_file);
t << "\t\t" << icns_file << " = {" << "\n"
<< "\t\t\t" << "isa = PBXFileReference;" << "\n"
<< "\t\t\t" << "path = \"" << project->first("RC_FILE") << "\";" << "\n"
<< "\t\t\t" << "refType = " << reftypeForFile(project->first("RC_FILE")) << ";" << "\n"
<< "\t\t" << "};" << "\n";
t << "\t\t" << keyFor("ICNS_FILE_REFERENCE") << " = {" << "\n"
<< "\t\t\t" << "fileRef = " << icns_file << ";" << "\n"
<< "\t\t\t" << "isa = PBXBuildFile;" << "\n"
<< "\t\t\t" << "settings = {" << "\n"
<< "\t\t\t" << "};" << "\n"
<< "\t\t" << "};" << "\n";
}
grp = "Sources";
} else if(srcs[i] == "SRCMOC") {
grp = "Mocables";
} else if(srcs[i] == "UICIMPLS") {
grp = "UICables";
}
QString grp_key = keyFor(grp);
project->variables()["QMAKE_PBX_GROUPS"].append(grp_key);
t << "\t\t" << grp_key << " = {" << "\n"
<< "\t\t\t" << "children = (" << "\n"
<< varGlue("QMAKE_PBX_" + srcs[i], "\t\t\t\t", ",\n\t\t\t\t", "\n")
<< "\t\t\t" << ");" << "\n"
<< "\t\t\t" << "isa = PBXGroup;" << "\n"
<< "\t\t\t" << "name = " << grp << ";" << "\n"
<< "\t\t\t" << "refType = 4;" << "\n"
<< "\t\t" << "};" << "\n";
}
}
for(QMap<QString, QStringList>::Iterator grp_it = groups.begin();
grp_it != groups.end(); ++grp_it) {
t << "\t\t" << keyFor(grp_it.key()) << " = {" << "\n"
<< "\t\t\t" << "isa = PBXGroup;" << "\n"
<< "\t\t\t" << "children = (" << "\n"
<< valGlue(grp_it.data(), "\t\t\t\t", ",\n\t\t\t\t", "\n")
<< "\t\t\t" << ");" << "\n"
<< "\t\t\t" << "name = \"" << grp_it.key().section(Option::dir_sep, -1) << "\";" << "\n"
<< "\t\t\t" << "refType = 4;" << "\n"
<< "\t\t" << "};" << "\n";
}
//PREPROCESS BUILDPHASE (just a makefile)
if(!project->isEmpty("UICIMPLS") || !project->isEmpty("SRCMOC") ||
!project->isEmpty("YACCSOURCES") || !project->isEmpty("LEXSOURCES")) {
QString mkfile = pbx_dir + Option::dir_sep + "qt_preprocess.mak";
QFile mkf(mkfile);
if(mkf.open(IO_WriteOnly | IO_Translate)) {
did_preprocess = TRUE;
debug_msg(1, "pbuilder: Creating file: %s", mkfile.latin1());
QTextStream mkt(&mkf);
writeHeader(mkt);
mkt << "MOC = " << var("QMAKE_MOC") << endl;
mkt << "UIC = " << var("QMAKE_UIC") << endl;
mkt << "LEX = " << var("QMAKE_LEX") << endl;
mkt << "LEXFLAGS = " << var("QMAKE_LEXFLAGS") << endl;
mkt << "YACC = " << var("QMAKE_YACC") << endl;
mkt << "YACCFLAGS = " << var("QMAKE_YACCFLAGS") << endl;
mkt << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl;
mkt << "MOVE = " << var("QMAKE_MOVE") << endl << endl;
mkt << "FORMS = " << varList("UICIMPLS") << endl;
mkt << "MOCS = " << varList("SRCMOC") << endl;
mkt << "PARSERS =";
if(!project->isEmpty("YACCSOURCES")) {
QStringList &yaccs = project->variables()["YACCSOURCES"];
for(QStringList::Iterator yit = yaccs.begin(); yit != yaccs.end(); ++yit) {
QFileInfo fi((*yit));
mkt << " " << fi.dirPath() << Option::dir_sep << fi.baseName(TRUE)
<< Option::yacc_mod << Option::cpp_ext.first();
}
}
if(!project->isEmpty("LEXSOURCES")) {
QStringList &lexs = project->variables()["LEXSOURCES"];
for(QStringList::Iterator lit = lexs.begin(); lit != lexs.end(); ++lit) {
QFileInfo fi((*lit));
mkt << " " << fi.dirPath() << Option::dir_sep << fi.baseName(TRUE)
<< Option::lex_mod << Option::cpp_ext.first();
}
}
mkt << "\n";
mkt << "preprocess: $(FORMS) $(MOCS) $(PARSERS)" << endl;
mkt << "preprocess_clean: mocclean uiclean parser_clean" << endl << endl;
mkt << "mocclean:" << "\n";
if(!project->isEmpty("SRCMOC"))
mkt << "\t-rm -f $(MOCS)" << "\n";
mkt << "uiclean:" << "\n";
if(!project->isEmpty("UICIMPLS"))
mkt << "\t-rm -f $(FORMS)" << "\n";
mkt << "parser_clean:" << "\n";
if(!project->isEmpty("YACCSOURCES") || !project->isEmpty("LEXSOURCES"))
mkt << "\t-rm -f $(PARSERS)" << "\n";
writeUicSrc(mkt, "FORMS");
writeMocSrc(mkt, "HEADERS");
writeMocSrc(mkt, "SOURCES");
writeMocSrc(mkt, "UICDECLS");
writeYaccSrc(mkt, "YACCSOURCES");
writeLexSrc(mkt, "LEXSOURCES");
mkf.close();
}
QString target_key = keyFor("QMAKE_PBX_PREPROCESS_TARGET");
mkfile = fileFixify(mkfile, QDir::currentDirPath());
t << "\t\t" << target_key << " = {" << "\n"
<< "\t\t\t" << "buildArgumentsString = \"-f " << mkfile << "\";" << "\n"
<< "\t\t\t" << "buildPhases = (" << "\n"
<< "\t\t\t" << ");" << "\n"
<< "\t\t\t" << "buildSettings = {" << "\n"
<< "\t\t\t" << "};" << "\n"
<< "\t\t\t" << "buildToolPath = \"/usr/bin/gnumake\";"<< "\n"
<< "\t\t\t" << "buildWorkingDirectory = \"" << QDir::currentDirPath() << "\";" << "\n"
<< "\t\t\t" << "dependencies = (" << "\n"
<< "\t\t\t" << ");" << "\n"
<< "\t\t\t" << "isa = PBXLegacyTarget;" << "\n"
<< "\t\t\t" << "name = QtPreprocessors;" << "\n"
<< "\t\t\t" << "productName = QtPreprocessors;" << "\n"
<< "\t\t\t" << "settingsToExpand = 6;" << "\n"
<< "\t\t\t" << "settingsToPassInEnvironment = 287;" << "\n"
<< "\t\t\t" << "settingsToPassOnCommandLine = 280;" << "\n"
<< "\t\t\t" << "shouldsUseHeadermap = 0;" << "\n"
<< "\t\t" << "};" << "\n";
QString target_depend_key = keyFor("QMAKE_PBX_PREPROCESS_TARGET_DEPEND");
project->variables()["QMAKE_PBX_TARGETDEPENDS"].append(target_depend_key);
t << "\t\t" << target_depend_key << " = {" << "\n"
<< "\t\t\t" << "isa = PBXTargetDependency;" << "\n"
<< "\t\t\t" << "target = " << target_key << ";" << "\n"
<< "\t\t" << "};" << "\n";
}
//SOURCE BUILDPHASE
if(!project->isEmpty("QMAKE_PBX_OBJ")) {
QString grp = "Build Sources", key = keyFor(grp);
project->variables()["QMAKE_PBX_BUILDPHASES"].append(key);
t << "\t\t" << key << " = {" << "\n"
<< "\t\t\t" << "buildActionMask = 2147483647;" << "\n"
<< "\t\t\t" << "files = (" << "\n"
<< varGlue("QMAKE_PBX_OBJ", "\t\t\t\t", ",\n\t\t\t\t", "\n")
<< "\t\t\t" << ");" << "\n"
<< "\t\t\t" << "isa = PBXSourcesBuildPhase;" << "\n"
<< "\t\t\t" << "name = \"" << grp << "\";" << "\n"
<< "\t\t" << "};" << "\n";
}
if(!project->isActiveConfig("staticlib")) { //DUMP LIBRARIES
QStringList &libdirs = project->variables()["QMAKE_PBX_LIBPATHS"];
QString libs[] = { "QMAKE_LIBDIR_FLAGS", "QMAKE_LIBS", QString::null };
for(i = 0; !libs[i].isNull(); i++) {
tmp = project->variables()[libs[i]];
for(QStringList::Iterator it = tmp.begin(); it != tmp.end();) {
bool remove = FALSE;
QString library, name, opt = (*it).stripWhiteSpace();
if(opt.startsWith("-L")) {
QString r = opt.right(opt.length() - 2);
fixEnvVariables(r);
libdirs.append(r);
} else if(opt.startsWith("-l")) {
name = opt.right(opt.length() - 2);
QString lib("lib" + name);
for(QStringList::Iterator lit = libdirs.begin(); lit != libdirs.end(); ++lit) {
if(project->isActiveConfig("link_prl")) {
- /* This isn't real nice, but it is real usefull. This looks in a prl
+ /* This isn't real nice, but it is real useful. This looks in a prl
for what the library will ultimately be called so we can stick it
in the ProjectFile. If the prl format ever changes (not likely) then
this will not really work. However, more concerning is that it will
encode the version number in the Project file which might be a bad
things in days to come? --Sam
*/
QString prl_file = (*lit) + Option::dir_sep + lib + Option::prl_ext;
if(QFile::exists(prl_file)) {
QMakeProject proj;
if(proj.read(prl_file, QDir::currentDirPath())) {
if(!proj.isEmpty("QMAKE_PRL_TARGET")) {
library = (*lit) + Option::dir_sep + proj.first("QMAKE_PRL_TARGET");
debug_msg(1, "pbuilder: Found library (%s) via PRL %s (%s)",
opt.latin1(), prl_file.latin1(), library.latin1());
remove = TRUE;
}
}
}
}
if(!remove) {
QString extns[] = { ".dylib", ".so", ".a", QString::null };
for(int n = 0; !remove && !extns[n].isNull(); n++) {
QString tmp = (*lit) + Option::dir_sep + lib + extns[n];
if(QFile::exists(tmp)) {
library = tmp;
debug_msg(1, "pbuilder: Found library (%s) via %s",
opt.latin1(), library.latin1());
remove = TRUE;
}
}
}
}
} else if(opt == "-framework") {
++it;
if(it == tmp.end())
break;
QStringList &fdirs = project->variables()["QMAKE_FRAMEWORKDIR"];
if(fdirs.isEmpty())
fdirs.append("/System/Library/Frameworks/");
for(QStringList::Iterator fit = fdirs.begin(); fit != fdirs.end(); ++fit) {
if(QFile::exists((*fit) + QDir::separator() + (*it) + ".framework")) {
--it;
it = tmp.remove(it);
remove = TRUE;
library = (*fit) + Option::dir_sep + (*it) + ".framework";
break;
}
}
} else if(opt.left(1) != "-") {
remove = TRUE;
library = opt;
}
if(!library.isEmpty()) {
if(name.isEmpty()) {
int slsh = library.findRev(Option::dir_sep);
if(slsh != -1)
name = library.right(library.length() - slsh - 1);
}
library = fileFixify(library);
QString key = keyFor(library);
bool is_frmwrk = (library.endsWith(".framework"));
t << "\t\t" << key << " = {" << "\n"
<< "\t\t\t" << "isa = " << (is_frmwrk ? "PBXFrameworkReference" : "PBXFileReference") << ";" << "\n"
<< "\t\t\t" << "name = \"" << name << "\";" << "\n"
<< "\t\t\t" << "path = \"" << library << "\";" << "\n"
<< "\t\t\t" << "refType = " << reftypeForFile(library) << ";" << "\n"
<< "\t\t" << "};" << "\n";
project->variables()["QMAKE_PBX_LIBRARIES"].append(key);
QString obj_key = library + ".o";
obj_key = keyFor(obj_key);
t << "\t\t" << obj_key << " = {" << "\n"
<< "\t\t\t" << "fileRef = " << key << ";" << "\n"
<< "\t\t\t" << "isa = PBXBuildFile;" << "\n"
<< "\t\t\t" << "settings = {" << "\n"
<< "\t\t\t" << "};" << "\n"
<< "\t\t" << "};" << "\n";
project->variables()["QMAKE_PBX_BUILD_LIBRARIES"].append(obj_key);
}
if(remove)
it = tmp.remove(it);
else
++it;
}
project->variables()[libs[i]] = tmp;
}
}
//SUBLIBS BUILDPHASE (just another makefile)
if(!project->isEmpty("SUBLIBS")) {
QString mkfile = pbx_dir + Option::dir_sep + "qt_sublibs.mak";
QFile mkf(mkfile);
if(mkf.open(IO_WriteOnly | IO_Translate)) {
debug_msg(1, "pbuilder: Creating file: %s", mkfile.latin1());
QTextStream mkt(&mkf);
writeHeader(mkt);
mkt << "SUBLIBS= ";
tmp = project->variables()["SUBLIBS"];
QStringList::Iterator it;
for(it = tmp.begin(); it != tmp.end(); ++it)
t << "tmp/lib" << (*it) << ".a ";
t << endl << endl;
mkt << "sublibs: $(SUBLIBS)" << endl << endl;
tmp = project->variables()["SUBLIBS"];
for(it = tmp.begin(); it != tmp.end(); ++it)
t << "tmp/lib" << (*it) << ".a" << ":\n\t"
<< var(QString("MAKELIB") + (*it)) << endl << endl;
mkf.close();
}
QString phase_key = keyFor("QMAKE_PBX_SUBLIBS_BUILDPHASE");
mkfile = fileFixify(mkfile, QDir::currentDirPath());
project->variables()["QMAKE_PBX_BUILDPHASES"].append(phase_key);
t << "\t\t" << phase_key << " = {" << "\n"
<< "\t\t\t" << "buildActionMask = 2147483647;" << "\n"
<< "\t\t\t" << "files = (" << "\n"
<< "\t\t\t" << ");" << "\n"
<< "\t\t\t" << "generatedFileNames = (" << "\n"
<< "\t\t\t" << ");" << "\n"
<< "\t\t\t" << "isa = PBXShellScriptBuildPhase;" << "\n"
<< "\t\t\t" << "name = \"Qt Sublibs\";" << "\n"
<< "\t\t\t" << "neededFileNames = (" << "\n"
<< "\t\t\t" << ");" << "\n"
<< "\t\t\t" << "shellPath = /bin/sh;" << "\n"
<< "\t\t\t" << "shellScript = \"make -C " << QDir::currentDirPath() <<
" -f " << mkfile << "\";" << "\n"
<< "\t\t" << "};" << "\n";
}
//LIBRARY BUILDPHASE
if(!project->isEmpty("QMAKE_PBX_LIBRARIES")) {
tmp = project->variables()["QMAKE_PBX_LIBRARIES"];
if(!tmp.isEmpty()) {
QString grp("External Frameworks and Libraries"), key = keyFor(grp);
project->variables()["QMAKE_PBX_GROUPS"].append(key);
t << "\t\t" << key << " = {" << "\n"
<< "\t\t\t" << "children = (" << "\n"
<< varGlue("QMAKE_PBX_LIBRARIES", "\t\t\t\t", ",\n\t\t\t\t", "\n")
<< "\t\t\t" << ");" << "\n"
<< "\t\t\t" << "isa = PBXGroup;" << "\n"
<< "\t\t\t" << "name = \"" << grp << "\"" << ";" << "\n"
<< "\t\t\t" << "path = \"\";" << "\n"
<< "\t\t\t" << "refType = 4;" << "\n"
<< "\t\t" << "};" << "\n";
}
}
{
QString grp("Frameworks & Libraries"), key = keyFor(grp);
project->variables()["QMAKE_PBX_BUILDPHASES"].append(key);
t << "\t\t" << key << " = {" << "\n"
<< "\t\t\t" << "buildActionMask = 2147483647;" << "\n"
<< "\t\t\t" << "files = (" << "\n"
<< varGlue("QMAKE_PBX_BUILD_LIBRARIES", "\t\t\t\t", ",\n\t\t\t\t", "\n")
<< "\t\t\t" << ");" << "\n"
<< "\t\t\t" << "isa = PBXFrameworksBuildPhase;" << "\n"
<< "\t\t\t" << "name = \"" << grp << "\";" << "\n"
<< "\t\t" << "};" << "\n";
}
if(project->isActiveConfig("resource_fork") && !project->isActiveConfig("console") &&
project->first("TEMPLATE") == "app") { //BUNDLE RESOURCES
QString grp("Bundle Resources"), key = keyFor(grp);
project->variables()["QMAKE_PBX_BUILDPHASES"].append(key);
t << "\t\t" << key << " = {" << "\n"
<< "\t\t\t" << "buildActionMask = 2147483647;" << "\n"
<< "\t\t\t" << "files = (" << "\n"
<< (!project->isEmpty("RC_FILE") ? keyFor("ICNS_FILE_REFERENCE") : QString(""))
<< "\t\t\t" << ");" << "\n"
<< "\t\t\t" << "isa = PBXResourcesBuildPhase;" << "\n"
<< "\t\t\t" << "name = \"" << grp << "\";" << "\n"
<< "\t\t" << "};" << "\n";
}
//DUMP EVERYTHING THAT TIES THE ABOVE TOGETHER
//PRODUCTS
{
QString grp("Products"), key = keyFor(grp);
project->variables()["QMAKE_PBX_GROUPS"].append(key);
t << "\t\t" << key << " = {" << "\n"
<< "\t\t\t" << "children = (" << "\n"
<< "\t\t\t\t" << keyFor("QMAKE_PBX_REFERENCE") << "\n"
<< "\t\t\t" << ");" << "\n"
<< "\t\t\t" << "isa = PBXGroup;" << "\n"
<< "\t\t\t" << "name = Products;" << "\n"
<< "\t\t\t" << "refType = 4;" << "\n"
<< "\t\t" << "};" << "\n";
}
{ //INSTALL BUILDPHASE (sh script)
QString targ = project->first("TARGET");
if(project->first("TEMPLATE") == "app" ||
(project->first("TEMPLATE") == "lib" && !project->isActiveConfig("staticlib") &&
project->isActiveConfig("frameworklib")))
targ = project->first("QMAKE_ORIG_TARGET");
int slsh = targ.findRev(Option::dir_sep);
if(slsh != -1)
targ = targ.right(targ.length() - slsh - 1);
fixEnvVariables(targ);
QStringList links;
if(project->first("TEMPLATE") == "app") {
if(project->isActiveConfig("resource_fork") && !project->isActiveConfig("console"))
targ += ".app";
} else if(!project->isActiveConfig("staticlib") &&
!project->isActiveConfig("frameworklib")) {
QString li[] = { "TARGET_", "TARGET_x", "TARGET_x.y", QString::null };
for(int n = 0; !li[n].isNull(); n++) {
QString t = project->first(li[n]);
slsh = t.findRev(Option::dir_sep);
if(slsh != -1)
t = t.right(t.length() - slsh);
fixEnvVariables(t);
links << t;
}
}
QString script = pbx_dir + Option::dir_sep + "qt_install.sh";
QFile shf(script);
if(shf.open(IO_WriteOnly | IO_Translate)) {
debug_msg(1, "pbuilder: Creating file: %s", script.latin1());
QString targ = project->first("QMAKE_ORIG_TARGET"), cpflags;
if(project->first("TEMPLATE") == "app") {
targ = project->first("TARGET");
if(project->isActiveConfig("resource_fork") && !project->isActiveConfig("console")) {
targ += ".app";
cpflags += "-r ";
}
} else if(!project->isActiveConfig("frameworklib")) {
if(project->isActiveConfig("staticlib"))
targ = project->first("TARGET");
else
targ = project->first("TARGET_");
int slsh = targ.findRev(Option::dir_sep);
if(slsh != -1)
targ = targ.right(targ.length() - slsh - 1);
}
QTextStream sht(&shf);
QString dstdir = project->first("DESTDIR");
fixEnvVariables(dstdir);
sht << "#!/bin/sh" << endl;
//copy the actual target
sht << "OUT_TARG=\"" << targ << "\"\n"
<< "[ -z \"$BUILD_ROOT\" ] || OUT_TARG=\"${BUILD_ROOT}/${OUT_TARG}\"" << endl;
sht << "[ \"$OUT_TARG\" = \""
<< (dstdir.isEmpty() ? QDir::currentDirPath() + QDir::separator(): dstdir) << targ << "\" ] || "
<< "[ \"$OUT_TARG\" = \"" << targ << "\" ] || "
<< "cp -r \"$OUT_TARG\" " << "\"" << dstdir << targ << "\"" << endl;
//rename as a framework
if(project->first("TEMPLATE") == "lib" && project->isActiveConfig("frameworklib"))
sht << "ln -sf \"" << targ << "\" " << "\"" << dstdir << targ << "\"" << endl;
//create all the version symlinks (just to be like unixmake)
for(QStringList::Iterator it = links.begin(); it != links.end(); ++it) {
if(targ != (*it))
sht << "ln -sf \"" << targ << "\" " << "\"" << dstdir << (*it) << "\"" << endl;
}
shf.close();
#ifdef Q_OS_UNIX
chmod(script.latin1(), S_IRWXU | S_IRWXG);
#endif
QString phase_key = keyFor("QMAKE_PBX_INSTALL_BUILDPHASE");
script = fileFixify(script, QDir::currentDirPath());
project->variables()["QMAKE_PBX_BUILDPHASES"].append(phase_key);
t << "\t\t" << phase_key << " = {" << "\n"
<< "\t\t\t" << "buildActionMask = 8;" << "\n" //only on install!
<< "\t\t\t" << "files = (" << "\n"
<< "\t\t\t" << ");" << "\n"
<< "\t\t\t" << "generatedFileNames = (" << "\n"
<< "\t\t\t" << ");" << "\n"
<< "\t\t\t" << "isa = PBXShellScriptBuildPhase;" << "\n"
<< "\t\t\t" << "name = \"Qt Install\";" << "\n"
<< "\t\t\t" << "neededFileNames = (" << "\n"
<< "\t\t\t" << ");" << "\n"
<< "\t\t\t" << "shellPath = /bin/sh;" << "\n"
<< "\t\t\t" << "shellScript = \"" << script << "\";" << "\n"
<< "\t\t" << "};" << "\n";
}
}
//ROOT_GROUP
t << "\t\t" << keyFor("QMAKE_PBX_ROOT_GROUP") << " = {" << "\n"
<< "\t\t\t" << "children = (" << "\n"
<< varGlue("QMAKE_PBX_GROUPS", "\t\t\t\t", ",\n\t\t\t\t", "\n")
<< "\t\t\t" << ");" << "\n"
<< "\t\t\t" << "isa = PBXGroup;" << "\n"
<< "\t\t\t" << "name = " << project->first("QMAKE_ORIG_TARGET") << ";" << "\n"
<< "\t\t\t" << "path = \"\";" << "\n"
<< "\t\t\t" << "refType = 4;" << "\n"
<< "\t\t" << "};" << "\n";
//REFERENCE
t << "\t\t" << keyFor("QMAKE_PBX_REFERENCE") << " = {" << "\n";
if(project->first("TEMPLATE") == "app") {
QString targ = project->first("QMAKE_ORIG_TARGET");
if(project->isActiveConfig("resource_fork") && !project->isActiveConfig("console")) {
targ += ".app";
t << "\t\t\t" << "isa = PBXApplicationReference;" << "\n";
} else {
t << "\t\t\t" << "isa = PBXExecutableFileReference;" << "\n";
}
QString app = (!project->isEmpty("DESTDIR") ? project->first("DESTDIR") + project->first("QMAKE_ORIG_TARGET") :
QDir::currentDirPath()) + Option::dir_sep + targ;
t << "\t\t\t" << "name = " << targ << ";" << "\n"
<< "\t\t\t" << "path = \"" << targ << "\";" << "\n"
<< "\t\t\t" << "refType = " << reftypeForFile(app) << ";" << "\n";
} else {
QString lib = project->first("QMAKE_ORIG_TARGET");
if(project->isActiveConfig("staticlib")) {
lib = project->first("TARGET");
} else if(!project->isActiveConfig("frameworklib")) {
if(project->isActiveConfig("plugin"))
lib = project->first("TARGET");
else
lib = project->first("TARGET_");
}
int slsh = lib.findRev(Option::dir_sep);
if(slsh != -1)
lib = lib.right(lib.length() - slsh - 1);
t << "\t\t\t" << "isa = PBXLibraryReference;" << "\n"
<< "\t\t\t" << "path = " << lib << ";\n"
<< "\t\t\t" << "refType = " << reftypeForFile(lib) << ";" << "\n";
}
t << "\t\t" << "};" << "\n";
//TARGET
t << "\t\t" << keyFor("QMAKE_PBX_TARGET") << " = {" << "\n"
<< "\t\t\t" << "buildPhases = (" << "\n"
<< varGlue("QMAKE_PBX_BUILDPHASES", "\t\t\t\t", ",\n\t\t\t\t", "\n")
<< "\t\t\t" << ");" << "\n"
<< "\t\t\t" << "buildSettings = {" << "\n"
<< "\t\t\t\t" << "FRAMEWORK_SEARCH_PATHS = \"\";" << "\n"
<< "\t\t\t\t" << "HEADER_SEARCH_PATHS = \"" << fixEnvsList("INCLUDEPATH") << " " << fixEnvs(specdir()) << "\";" << "\n"
<< "\t\t\t\t" << "LIBRARY_SEARCH_PATHS = \"" << var("QMAKE_PBX_LIBPATHS") << "\";" << "\n"
<< "\t\t\t\t" << "OPTIMIZATION_CFLAGS = \"\";" << "\n"
<< "\t\t\t\t" << "OTHER_CFLAGS = \"" <<
fixEnvsList("QMAKE_CFLAGS") << varGlue("PRL_EXPORT_DEFINES"," -D"," -D","") <<
varGlue("DEFINES"," -D"," -D","") << "\";" << "\n"
<< "\t\t\t\t" << "LEXFLAGS = \"" << var("QMAKE_LEXFLAGS") << "\";" << "\n"
<< "\t\t\t\t" << "YACCFLAGS = \"" << var("QMAKE_YACCFLAGS") << "\";" << "\n"
<< "\t\t\t\t" << "OTHER_CPLUSPLUSFLAGS = \"" <<
fixEnvsList("QMAKE_CXXFLAGS") << varGlue("PRL_EXPORT_DEFINES"," -D"," -D","") <<
varGlue("DEFINES"," -D"," -D","") << "\";" << "\n"
<< "\t\t\t\t" << "OTHER_REZFLAGS = \"\";" << "\n"
<< "\t\t\t\t" << "SECTORDER_FLAGS = \"\";" << "\n"
<< "\t\t\t\t" << "WARNING_CFLAGS = \"\";" << "\n";
#if 1
t << "\t\t\t\t" << "BUILD_ROOT = \"" << QDir::currentDirPath() << "\";" << "\n";
#endif
if(!project->isActiveConfig("staticlib"))
t << "\t\t\t\t" << "OTHER_LDFLAGS = \"" << fixEnvsList("SUBLIBS") << " " <<
fixEnvsList("QMAKE_LFLAGS") << " " << fixEnvsList("QMAKE_LIBDIR_FLAGS") <<
" " << fixEnvsList("QMAKE_LIBS") << "\";" << "\n";
if(!project->isEmpty("DESTDIR"))
t << "\t\t\t\t" << "INSTALL_PATH = \"" << project->first("DESTDIR") << "\";" << "\n";
if(!project->isEmpty("VERSION") && project->first("VERSION") != "0.0.0")
t << "\t\t\t\t" << "DYLIB_CURRENT_VERSION = \"" << project->first("VERSION") << "\";" << "\n";
if(!project->isEmpty("OBJECTS_DIR"))
t << "\t\t\t\t" << "OBJECT_FILE_DIR = \"" << project->first("OBJECTS_DIR") << "\";" << "\n";
if(project->first("TEMPLATE") == "app") {
if(project->isActiveConfig("resource_fork") && !project->isActiveConfig("console"))
t << "\t\t\t\t" << "WRAPPER_EXTENSION = app;" << "\n";
t << "\t\t\t\t" << "PRODUCT_NAME = " << project->first("QMAKE_ORIG_TARGET") << ";" << "\n";
} else {
QString lib = project->first("QMAKE_ORIG_TARGET");
if(!project->isActiveConfig("plugin") && project->isActiveConfig("staticlib")) {
t << "\t\t\t\t" << "LIBRARY_STYLE = STATIC;" << "\n";
lib = project->first("TARGET");
} else {
t << "\t\t\t\t" << "LIBRARY_STYLE = DYNAMIC;" << "\n";
if(!project->isActiveConfig("frameworklib")) {
if(project->isActiveConfig("plugin"))
lib = project->first("TARGET");
else
lib = project->first("TARGET_");
}
}
int slsh = lib.findRev(Option::dir_sep);
if(slsh != -1)
lib = lib.right(lib.length() - slsh - 1);
t << "\t\t\t\t" << "PRODUCT_NAME = " << lib << ";" << "\n";
}
tmp = project->variables()["QMAKE_PBX_VARS"];
for(QStringList::Iterator it = tmp.begin(); it != tmp.end(); ++it)
t << "\t\t\t\t" << (*it) << " = \"" << getenv((*it)) << "\";" << "\n";
t << "\t\t\t" << "};" << "\n"
<< "\t\t\t" << "conditionalBuildSettings = {" << "\n"
<< "\t\t\t" << "};" << "\n"
<< "\t\t\t" << "dependencies = (" << "\n"
<< varGlue("QMAKE_PBX_TARGETDEPENDS", "\t\t\t\t", ",\n\t\t\t\t", "\n")
<< "\t\t\t" << ");" << "\n"
<< "\t\t\t" << "productReference = " << keyFor("QMAKE_PBX_REFERENCE") << ";" << "\n"
<< "\t\t\t" << "shouldUseHeadermap = 1;" << "\n";
if(project->first("TEMPLATE") == "app") {
if(project->isActiveConfig("resource_fork") && !project->isActiveConfig("console")) {
t << "\t\t\t" << "isa = PBXApplicationTarget;" << "\n"
<< "\t\t\t" << "productSettingsXML = " << "\"" << "<?xml version="
<< "\\\"1.0\\\" encoding=" << "\\\"UTF-8\\\"" << "?>" << "\n"
<< "\t\t\t\t" << "<!DOCTYPE plist SYSTEM \\\"file://localhost/System/"
<< "Library/DTDs/PropertyList.dtd\\\">" << "\n"
<< "\t\t\t\t" << "<plist version=\\\"0.9\\\">" << "\n"
<< "\t\t\t\t" << "<dict>" << "\n"
<< "\t\t\t\t\t" << "<key>CFBundleDevelopmentRegion</key>" << "\n"
<< "\t\t\t\t\t" << "<string>English</string>" << "\n"
<< "\t\t\t\t\t" << "<key>CFBundleExecutable</key>" << "\n"
<< "\t\t\t\t\t" << "<string>" << project->first("QMAKE_ORIG_TARGET") << "</string>" << "\n"
<< "\t\t\t\t\t" << "<key>CFBundleIconFile</key>" << "\n"
<< "\t\t\t\t\t" << "<string>" << var("RC_FILE").section(Option::dir_sep, -1) << "</string>" << "\n"
<< "\t\t\t\t\t" << "<key>CFBundleInfoDictionaryVersion</key>" << "\n"
<< "\t\t\t\t\t" << "<string>6.0</string>" << "\n"
<< "\t\t\t\t\t" << "<key>CFBundlePackageType</key>" << "\n"
<< "\t\t\t\t\t" << "<string>APPL</string>" << "\n"
<< "\t\t\t\t\t" << "<key>CFBundleSignature</key>" << "\n"
<< "\t\t\t\t\t" << "<string>????</string>" << "\n"
<< "\t\t\t\t\t" << "<key>CFBundleVersion</key>" << "\n"
<< "\t\t\t\t\t" << "<string>0.1</string>" << "\n"
<< "\t\t\t\t\t" << "<key>CSResourcesFileMapped</key>" << "\n"
<< "\t\t\t\t\t" << "<true/>" << "\n"
<< "\t\t\t\t" << "</dict>" << "\n"
<< "\t\t\t\t" << "</plist>" << "\";" << "\n";
} else {
t << "\t\t\t" << "isa = PBXToolTarget;" << "\n";
}
t << "\t\t\t" << "name = \"" << project->first("QMAKE_ORIG_TARGET") << "\";" << "\n"
<< "\t\t\t" << "productName = " << project->first("QMAKE_ORIG_TARGET") << ";" << "\n";
} else {
QString lib = project->first("QMAKE_ORIG_TARGET");
if(!project->isActiveConfig("frameworklib"))
lib.prepend("lib");
t << "\t\t\t" << "isa = PBXLibraryTarget;" << "\n"
<< "\t\t\t" << "name = \"" << lib << "\";" << "\n"
<< "\t\t\t" << "productName = " << lib << ";" << "\n";
}
if(!project->isEmpty("DESTDIR"))
t << "\t\t\t" << "productInstallPath = \"" << project->first("DESTDIR") << "\";" << "\n";
t << "\t\t" << "};" << "\n";
//DEBUG/RELEASE
for(i = 0; i < 2; i++) {
bool as_release = !i;
if(project->isActiveConfig("debug"))
as_release = i;
QString key = "QMAKE_PBX_" + QString(as_release ? "RELEASE" : "DEBUG");
key = keyFor(key);
project->variables()["QMAKE_PBX_BUILDSTYLES"].append(key);
t << "\t\t" << key << " = {" << "\n"
<< "\t\t\t" << "buildRules = (" << "\n"
<< "\t\t\t" << ");" << "\n"
<< "\t\t\t" << "buildSettings = {" << "\n"
<< "\t\t\t\t" << "COPY_PHASE_STRIP = " << (as_release ? "YES" : "NO") << ";" << "\n";
if(as_release)
t << "\t\t\t\t" << "DEBUGGING_SYMBOLS = NO;" << "\n";
t << "\t\t\t" << "};" << "\n"
<< "\t\t\t" << "isa = PBXBuildStyle;" << "\n"
<< "\t\t\t" << "name = " << (as_release ? "Deployment" : "Development") << ";" << "\n"
<< "\t\t" << "};" << "\n";
}
//ROOT
t << "\t\t" << keyFor("QMAKE_PBX_ROOT") << " = {" << "\n"
<< "\t\t\t" << "buildStyles = (" << "\n"
<< varGlue("QMAKE_PBX_BUILDSTYLES", "\t\t\t\t", ",\n\t\t\t\t", "\n")
<< "\t\t\t" << ");" << "\n"
<< "\t\t\t" << "isa = PBXProject;" << "\n"
<< "\t\t\t" << "mainGroup = " << keyFor("QMAKE_PBX_ROOT_GROUP") << ";" << "\n"
<< "\t\t\t" << "targets = (" << "\n"
<< "\t\t\t\t" << keyFor("QMAKE_PBX_TARGET") << "\n"
<< "\t\t\t" << ");" << "\n"
<< "\t\t" << "};" << "\n";
//FOOTER
t << "\t" << "};" << "\n"
<< "\t" << "rootObject = " << keyFor("QMAKE_PBX_ROOT") << ";" << "\n"
<< "}" << endl;
QString mkwrap = fileFixify(pbx_dir + Option::dir_sep + ".." + Option::dir_sep + project->first("MAKEFILE"),
QDir::currentDirPath());
QFile mkwrapf(mkwrap);
if(mkwrapf.open(IO_WriteOnly | IO_Translate)) {
debug_msg(1, "pbuilder: Creating file: %s", mkwrap.latin1());
QTextStream mkwrapt(&mkwrapf);
writeHeader(mkwrapt);
const char *cleans = "uiclean mocclean preprocess_clean ";
mkwrapt << "#This is a makefile wrapper for PROJECT BUILDER\n"
<< "all:" << "\n\t"
<< "cd " << (project->first("QMAKE_ORIG_TARGET") + ".pbproj/ && pbxbuild") << "\n"
<< "install: all" << "\n\t"
<< "cd " << (project->first("QMAKE_ORIG_TARGET") + ".pbproj/ && pbxbuild install") << "\n"
<< "distclean clean: preprocess_clean" << "\n\t"
<< "cd " << (project->first("QMAKE_ORIG_TARGET") + ".pbproj/ && pbxbuild clean") << "\n"
<< (!did_preprocess ? cleans : "") << ":" << "\n";
if(did_preprocess)
mkwrapt << cleans << ":" << "\n\t"
<< "make -f "
<< pbx_dir << Option::dir_sep << "qt_preprocess.mak $@" << endl;
}
return TRUE;
}
QString
ProjectBuilderMakefileGenerator::fixEnvs(QString file)
{
QRegExp reg_var("\\$\\((.*)\\)");
for(int rep = 0; (rep = reg_var.search(file, rep)) != -1; ) {
if(project->variables()["QMAKE_PBX_VARS"].findIndex(reg_var.cap(1)) == -1)
project->variables()["QMAKE_PBX_VARS"].append(reg_var.cap(1));
rep += reg_var.matchedLength();
}
return file;
}
QString
ProjectBuilderMakefileGenerator::fixEnvsList(QString where)
{
QString ret;
const QStringList &l = project->variables()[where];
for(QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) {
fixEnvs((*it));
if(!ret.isEmpty())
ret += " ";
ret += (*it);
}
return ret;
}
QString
ProjectBuilderMakefileGenerator::keyFor(QString block)
{
#if 0 //This make this code much easier to debug..
return block;
#endif
QString ret;
if(!keys.contains(block)) {
#if 0
static unsigned int r = 0;
ret.sprintf("%024x", ++r);
#else //not really necesary, but makes it look more interesting..
static struct { unsigned int a1, a2, a3; } r = { 0, 0, 0 };
if(!r.a1 && !r.a2 && !r.a3) {
r.a1 = rand();
r.a2 = rand();
r.a3 = rand();
}
switch(rand() % 3) {
case 0: ++r.a1; break;
case 1: ++r.a2; break;
case 2: ++r.a3; break;
}
ret.sprintf("%08x%08x%08x", r.a1, r.a2, r.a3);
#endif
ret = ret.upper();
keys.insert(block, ret);
} else {
ret = keys[block];
}
return ret;
}
bool
ProjectBuilderMakefileGenerator::openOutput(QFile &file) const
{
if(project->first("TEMPLATE") != "subdirs") {
QFileInfo fi(file);
if(fi.extension() != "pbxproj" || file.name().isEmpty()) {
QString output = file.name();
if(fi.isDir())
output += QDir::separator();
if(fi.extension() != "pbproj") {
if(file.name().isEmpty() || fi.isDir())
output += project->first("TARGET");
output += QString(".pbproj") + QDir::separator();
} else if(output[(int)output.length() - 1] != QDir::separator()) {
output += QDir::separator();
}
output += QString("project.pbxproj");
file.setName(output);
}
bool ret = UnixMakefileGenerator::openOutput(file);
((ProjectBuilderMakefileGenerator*)this)->pbx_dir = Option::output_dir.section(Option::dir_sep, 0, -1);
Option::output_dir = pbx_dir.section(Option::dir_sep, 0, -2);
return ret;
}
return UnixMakefileGenerator::openOutput(file);
}
/* This function is such a hack it is almost pointless, but it
eliminates the warning message from ProjectBuilder that the project
file is for an older version. I guess this could be used someday if
the format of the output is dependant upon the version of
ProjectBuilder as well.
*/
int
ProjectBuilderMakefileGenerator::pbuilderVersion() const
{
QString ret;
if(project->isEmpty("QMAKE_PBUILDER_VERSION")) {
QString version, version_plist = project->first("QMAKE_PBUILDER_VERSION_PLIST");
if(version_plist.isEmpty())
version_plist = "/Developer/Applications/Project Builder.app/Contents/version.plist";
else
version_plist = version_plist.replace(QRegExp("\""), "");
QFile version_file(version_plist);
if(version_file.open(IO_ReadOnly)) {
debug_msg(1, "pbuilder: version.plist: Reading file: %s", version_plist.latin1());
QTextStream plist(&version_file);
bool in_dict = FALSE;
QString current_key;
QRegExp keyreg("^<key>(.*)</key>$"), stringreg("^<string>(.*)</string>$");
while(!plist.eof()) {
QString line = plist.readLine().stripWhiteSpace();
if(line == "<dict>")
in_dict = TRUE;
else if(line == "</dict>")
in_dict = FALSE;
else if(in_dict) {
if(keyreg.exactMatch(line))
current_key = keyreg.cap(1);
else if(current_key == "CFBundleShortVersionString" && stringreg.exactMatch(line))
version = stringreg.cap(1);
}
}
version_file.close();
} else debug_msg(1, "pbuilder: version.plist: Failure to open %s", version_plist.latin1());
if(version.startsWith("2.0"))
ret = "38";
else if(version == "1.1")
ret = "34";
} else {
ret = project->first("QMAKE_PBUILDER_VERSION");
}
if(!ret.isEmpty()) {
bool ok;
int int_ret = ret.toInt(&ok);
if(ok) {
debug_msg(1, "pbuilder: version.plist: Got version: %d", int_ret);
return int_ret;
}
}
debug_msg(1, "pbuilder: version.plist: Fallback to default version");
return 34; //my fallback
}
QString
ProjectBuilderMakefileGenerator::reftypeForFile(QString where)
{
if(QDir::isRelativePath(where))
return "4"; //relative
return "0"; //absolute
}
diff --git a/x11/ipc/server/ocopserver.cpp b/x11/ipc/server/ocopserver.cpp
index 992cb8c..3ee38e9 100644
--- a/x11/ipc/server/ocopserver.cpp
+++ b/x11/ipc/server/ocopserver.cpp
@@ -1,413 +1,413 @@
#include <errno.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <qcstring.h>
#include <qtimer.h>
#include "ocopserver.h"
OCopServer::OCopServer()
: QObject()
{
setName( "ocopserver");
/*
* init the server
*/
init();
initSocket();
}
OCopServer::~OCopServer() {
// socket notifiers should be deleted
close(m_serverfd );
}
void OCopServer::init() {
/*
* we set SIGPIPE to SIG_IGN
* to get EPIPE on reads ;)
*/
// qWarning("SIGPIPE to be ignored");
signal(SIGPIPE, SIG_IGN );
/*
* initialize some variables
*/
m_server = 0l;
m_serverError = 0l;
}
/**
* here we will init our server
* socket and bind and do the listen
*/
void OCopServer::initSocket() {
/* get the home dir */
QCString home( getenv("HOME") );
QCString path( home + "/.opie.cop");
if ( ( m_serverfd = socket( PF_UNIX, SOCK_STREAM, 0 ) ) == -1 ) {
qWarning("failed to create server socket");
/* try again later */
QTimer::singleShot( 400, this, SLOT(initSocket() ) );
return;
}
qWarning( "unlinking file %s", path.data() );
/* unlink previous sockets */
unlink( path.data() );
struct sockaddr_un m_address;
memset(&m_address, 0, sizeof(m_address ) );
m_address.sun_family = AF_UNIX; /* unix domain socket */
strcpy(m_address.sun_path, path.data() );
m_adrlaenge = sizeof(m_address.sun_family) + strlen(m_address.sun_path );
/* cast to make it a (sockadr*) */
if (bind(m_serverfd, (struct sockaddr*)&m_address, m_adrlaenge ) == -1 ) {
qWarning("Server could not bind try again");
close(m_serverfd);
QTimer::singleShot(400, this, SLOT(initSocket() ) );
return;
}
/* tell the kernel that we're listening and accepting
* 5 pending connections */
if (listen(m_serverfd, 5) == -1 ) {
qWarning("could not listen");
close(m_serverfd );
QTimer::singleShot(400, this, SLOT(initSocket() ) );
return;
}
/*
* now we will create two QSocketNotifier
* which will us notify on reads
* and errors
* we do this because they integrate
* nicely into the QApplication eventloop
*/
m_server = new QSocketNotifier(m_serverfd, QSocketNotifier::Read, this );
connect( m_server, SIGNAL(activated(int) ),
this, SLOT(newOnServer() ) );
m_serverError = new QSocketNotifier( m_serverfd, QSocketNotifier::Exception, this);
connect(m_serverError, SIGNAL(activated(int) ),
this, SLOT(errorOnServer() ) );
qWarning("done with registering");
}
/**
* we got the possibility to read
* on the server
* this is mostly due a connect
* on a client side
* we will accept it
* add it to our list
*/
void OCopServer::newOnServer() {
int fd = accept();
if ( fd < 0 )
return;
/*
- * we got a successfull new connection
+ * we got a successful new connection
* be happy
* set SocketNotifier
* connect it
* and a OCOPClient
*/
// qWarning("Heureka new connection %d", fd );
registerClient( fd );
}
int OCopServer::accept() {
/*
* accept it
* the socket is currently blocking IIRC
*/
return ::accept( m_serverfd, (struct sockaddr*)&m_address, &m_adrlaenge );
}
void OCopServer::newOnClient( int fd ) {
errno = 0;
OCOPHead head;
memset(&head, 0, sizeof(head) );
int rea = ::read(fd, &head, sizeof(head) );
//qWarning("read %d %d", rea, errno);
/*
* I should get EPIPE but nothing like this happens
* so if rea == 0 and we were signaled by the notifier
* we close it and drop the clients...
*/
if ( rea <= 0 ) {
deregisterClient( fd );
return;
}
/*
* OCOPHead
*/
//qWarning("data %s %d", &bug, rea );
/*
* Check the magic
* if chcked read till EOF if magic does not match
* otherwise do read
* channel
* func
* data into mem
* and then send the OCOPPacket
*
*/
if (head.magic == 47 ) {
// qWarning("magic match");
QCString channel( head.chlen+1 );
QCString func( head.funclen+1 );
QByteArray data ( head.datalen+1 );
/*
* we do not check for errors
*/
// qWarning("read ");
int s = read(fd, channel.data(), head.chlen );
s = read(fd, func.data(), head.funclen );
s = read(fd, data.data(), head.datalen );
// qWarning("read");
/* debug output */
// qWarning("channel %s %d", channel.data(), head.chlen );
// qWarning("func %s %d", func.data(), head.funclen );
/* debug end */
/*
* now that we got the complete body
* we need to make a package
* and then we need to send it to clients
* making a package is done here
* dispatching it not
*/
OCOPPacket packet( head.type, channel, func, data );
dispatch( packet, fd );
}else{
// qWarning("magic does not match");
// qWarning("magic %d", head.magic );
}
}
void OCopServer::registerClient( int fd ) {
if (m_clients.contains(fd) )
return;
QSocketNotifier* notify = new QSocketNotifier(fd, QSocketNotifier::Read, this );
connect(notify, SIGNAL(activated(int) ),
this, SLOT(newOnClient(int) ) );
OCOPClient client;
client.fd = fd;
client.notify = notify;
m_clients.insert( client.fd, client );
// qWarning("clients are up to %d", m_clients.count() );
};
void OCopServer::deregisterClient(int fd ) {
QMap<int, OCOPClient>::Iterator it = m_clients.find( fd );
if (it != m_clients.end() ) {
/*
* TIME_ME
*
* now delete from all channels
* go through all channels
* remove the fd from the list
* if count becomes 0 remove the channel
* otherwise replace QArray<int>
*/
QMap<QCString, QValueList<int> >::Iterator it2;
repeatIt:
for ( it2 = m_channels.begin(); it2 != m_channels.end(); ++it2 ) {
/*
* The channel contains this fd
*/
// qWarning("Channel %s %d", it2.key().data(), it2.data().count() );
if ( it2.data().contains( fd ) ) {
qWarning("contains");
QValueList<int> array = it2.data();
/*
* remove channel or just replace
*/
if ( array.count() == 1 || array.count() == 0) {
// qWarning("Invalidate!");
/* is the list now invalidatet? */
m_channels.remove( it2 );
/* That is the first go to of my life
* but Iterator remove( Iterator )
* does not exist
* it2 = --it2;
* does not work reliable too
* so the only way is to reiterate :(
*/
goto repeatIt;
}else{
// qWarning("removing count %d %d",fd, array.count() );
QValueList<int>::Iterator it3 = array.find( fd );
it3 = array.remove( it3 );
QCString key = it2.key().copy();
it2 = m_channels.replace( key, array );
}
}
} // off all channels
OCOPClient client = it.data();
delete client.notify;
m_clients.remove(fd );
close(fd );
}
// qWarning("clients are now at %d", m_clients.count() );
}
/**
* this function will evaluate
* the package and then do the appropriate thins
*/
void OCopServer::dispatch( const OCOPPacket& packet, int sourceFD ) {
// qWarning("packet.type() == %d", packet.type() );
switch( packet.type() ) {
case OCOPPacket::Register:
registerClient(sourceFD );
break;
case OCOPPacket::Unregister:
deregisterClient(sourceFD );
break;
case OCOPPacket::Call:
call( packet, sourceFD );
break;
/* not implemented */
case OCOPPacket::Method:
break;
/* nit implemented */
case OCOPPacket::Reply:
break;
case OCOPPacket::RegisterChannel:
addChannel( packet.channel() , sourceFD );
break;
case OCOPPacket::UnregisterChannel:
delChannel( packet.channel(), sourceFD );
break;
/* not implemented */
case OCOPPacket::Return:
break;
/* not implemented :( */
case OCOPPacket::Signal:
break;
case OCOPPacket::IsRegistered:
// qWarning("Server:IsRegistered %s", packet.channel().data() );
isRegistered( packet.channel(), sourceFD );
break;
};
}
void OCopServer::errorOnServer() {
/*
* something is wrong on the server socket?
* what should we do?
* FIXME
*/
}
QStringList OCopServer::channels() {
QStringList list;
{
QMap<QCString, QValueList<int> >::Iterator it;
for (it = m_channels.begin(); it != m_channels.end(); ++it ) {
list << it.key();
};
}
return list;
}
bool OCopServer::isChannelRegistered( const QCString& chan ) const{
return m_channels.contains( chan );
}
void OCopServer::addChannel( const QCString& channel,
int fd ) {
QMap<QCString, QValueList<int> >::Iterator it;
it = m_channels.find( channel );
if ( it != m_channels.end() ) {
/* could be empty */
QValueList<int> list = it.data();
list.append( fd );
qWarning("Server:count is now in addChannel %d %s", list.count(), channel.data() );
it = m_channels.replace( channel, list );
}else {
QValueList<int> ints;
ints.append( fd );
m_channels.insert( channel, ints );
}
};
void OCopServer::delChannel( const QCString& channel,
int fd ) {
// qWarning("remove %s, %d", channel.data(), fd );
if (!m_channels.contains( channel ) )
return;
QMap<QCString, QValueList<int> >::Iterator it;
it = m_channels.find( channel );
if ( it.data().contains(fd) ) {
QValueList<int> ints = it.data();
if ( ints.count() == 1 )
m_channels.remove( channel );
else{
QValueList<int> ints = it.data();
QValueList<int>::Iterator rem = ints.find( fd );
rem = ints.remove( rem );
QCString str = it.key().copy();
m_channels.replace( str, ints );
}
// qWarning(" channel count is now %d", ints.count() );
}
}
void OCopServer::isRegistered( const QCString& channel, int fd) {
// qWarning("Server:isRegistered %s", channel.data() );
OCOPHead head;
QCString func(2);
memset(&head, 0, sizeof(head ) );
head.magic = 47;
head.type = OCOPPacket::IsRegistered;
head.chlen = channel.size();
head.funclen = func.size();
head.datalen = 0;
if ( isChannelRegistered( channel ) ) {
//is registered
func[0] = 1;
// qWarning("Server:Channel is Registered %d", head.chlen);
}else{
func[0] = 0;
// qWarning("Server:Channel is NotRegistered");
}
/**
* write the head
* and then channel
* success/failure inside func
*/
write(fd, &head, sizeof(head) );
write(fd, channel.data(), channel.size() );
write(fd, func.data(), func.size() );
}
QValueList<int> OCopServer::clients( const QCString& channel ) {
return m_channels[channel];
}
void OCopServer::call( const OCOPPacket& p, int ) {
QValueList<int> cli = clients( p.channel() );
QValueList<int>::Iterator it;
OCOPHead head = p.head();
for (it = cli.begin(); it != cli.end(); ++it ) {
// qWarning("Server:calling %d %s %s", (*it), p.channel().data(), p.header().data() );
write( (*it), &head, sizeof(head ) );
/* expl. shared! */
write( (*it), p.channel().data(), p.channel().size() );
write( (*it), p.header().data(), p.header().size() );
write( (*it), p.content().data(), p.content().size() );
};
}