summaryrefslogtreecommitdiff
authorzecke <zecke>2004-01-05 14:39:29 (UTC)
committer zecke <zecke>2004-01-05 14:39:29 (UTC)
commitc127e5d582b1ae4033eca1c8454bee75d510b9e8 (patch) (side-by-side diff)
treee4f6e610969f35e1e0954f762f317c0e9ccf76b3
parent7fb9bc93eae8007a6eb298fc743bbf70dc50fbc5 (diff)
downloadopie-c127e5d582b1ae4033eca1c8454bee75d510b9e8.zip
opie-c127e5d582b1ae4033eca1c8454bee75d510b9e8.tar.gz
opie-c127e5d582b1ae4033eca1c8454bee75d510b9e8.tar.bz2
Spelling fixes by Michael Opdenacker <zumbi2@netcourrier.com>
Diffstat (more/less context) (show 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
@@ -4160,769 +4160,769 @@ 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
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
@@ -10219,769 +10219,768 @@ 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
@@ -12268,769 +12267,768 @@ 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
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
@@ -374,769 +374,769 @@ void OpieFtp::tabChanged(QWidget *)
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);
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,729 +1,729 @@
/****************************************************************************
** $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")) {
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() );
};
}