summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--README2
-rw-r--r--core/opiealarm/opiealarm.c2
-rw-r--r--etc/dict/words2
-rw-r--r--help/opie-sh/node3.html2
-rw-r--r--help/opie-sh/node9.html2
-rw-r--r--noncore/apps/odict/eng_ita.dic2
-rw-r--r--noncore/apps/opie-console/filereceive.cpp2
-rw-r--r--noncore/apps/opie-console/filetransfer.cpp2
-rw-r--r--noncore/net/opieftp/opieftp.cpp2
-rw-r--r--noncore/settings/backup/backuprestore.cpp4
-rw-r--r--noncore/settings/networksettings/interfaces/interface.cpp8
-rw-r--r--noncore/settings/networksettings/interfaces/interfaces.cpp44
-rw-r--r--noncore/settings/networksettings/interfaces/interfacesetupimp.cpp2
-rw-r--r--noncore/settings/networksettings/module.h2
-rw-r--r--noncore/settings/networksettings/ppp/pppmodule.cpp2
-rw-r--r--noncore/settings/networksettings/wlan/wextensions.cpp2
-rw-r--r--noncore/settings/networksettings/wlan/wlanmodule.cpp2
-rw-r--r--noncore/settings/tabmanager/tabmanager.cpp12
-rw-r--r--noncore/unsupported/mail2/TODO2
-rw-r--r--noncore/unsupported/mail2/folderwidget.cpp6
-rw-r--r--qmake/generators/mac/pbuilder_pbx.cpp2
-rw-r--r--x11/ipc/server/ocopserver.cpp2
22 files changed, 53 insertions, 55 deletions
diff --git a/README b/README
index 0075bde..cb7d5d4 100644
--- a/README
+++ b/README
@@ -1,86 +1,86 @@
11. How to use the Opie build system 11. How to use the Opie build system
2==================================== 2====================================
3There's a tutorial document at: 3There's a tutorial document at:
4http://www.uv-ac.de/opiedev/opiedev.html 4http://www.uv-ac.de/opiedev/opiedev.html
5 5
6The API reference currently is at: 6The API reference currently is at:
7http://handhelds.org/~zecke/apidocs/index.html 7http://handhelds.org/~zecke/apidocs/index.html
8 8
9You will need qvfb, uic and 9You will need qvfb, uic and
10(if you want to develop applications) designer 10(if you want to develop applications) designer
11compiled and linked against qt-x11. 11compiled and linked against qt-x11.
12That means you must download and configure/make it. 12That means you must download and configure/make it.
13wget ftp://ftp.trolltech.com/qt/source/qt-x11-2.3.2.tar.gz 13wget ftp://ftp.trolltech.com/qt/source/qt-x11-2.3.2.tar.gz
14(Alternatively, you can get static binaries from http://www.vanille.de/tools) 14(Alternatively, you can get static binaries from http://www.vanille.de/tools)
15 15
16The recommended version of Qt embedded is qt-embedded-2.3.7 16The recommended version of Qt embedded is qt-embedded-2.3.7
17 17
18You can get it from: 18You can get it from:
19ftp://ftp.trolltech.com/qt/source/qt-embedded-2.3.7.tar.bz2 19ftp://ftp.trolltech.com/qt/source/qt-embedded-2.3.7.tar.bz2
20 20
21Set QTDIR to point to your qt/embedded source tree, such as: 21Set QTDIR to point to your qt/embedded source tree, such as:
22export QTDIR=/opt/qt-2.3.7 22export QTDIR=/opt/qt-2.3.7
23 23
24You need to do set the OPIEDIR environment variable: 24You need to do set the OPIEDIR environment variable:
25export OPIEDIR=`pwd` 25export OPIEDIR=`pwd`
26or 26or
27export OPIEDIR=~/projects/sources/opie 27export OPIEDIR=~/projects/sources/opie
28or whereever you placed the Opie sources. 28or whereever you placed the Opie sources.
29 29
30You need to adjust your runtime library search path, 30You need to adjust your runtime library search path,
31so that the Qt/Embedded and Opie libraries can be found: 31so that the Qt/Embedded and Opie libraries can be found:
32export LD_LIBRARY_PATH=$OPIEDIR/lib:$QTDIR/lib:$LD_LIBRARY_PATH 32export LD_LIBRARY_PATH=$OPIEDIR/lib:$QTDIR/lib:$LD_LIBRARY_PATH
33 33
34You have to apply the qte<version>-all.patch to the Qt/Embedded 34You have to apply the qte<version>-all.patch to the Qt/Embedded
35sources and copy the qconfig-qpe.h file to $QTDIR/src/tools: 35sources and copy the qconfig-qpe.h file to $QTDIR/src/tools:
36cd $QTDIR; cat $OPIEDIR/qt/qte<version>*.patch | patch -p0 36cd $QTDIR; cat $OPIEDIR/qt/qte<version>*.patch | patch -p0
37cp $OPIEDIR/qt/qpe-config.h $QTDIR/src/tools 37cp $OPIEDIR/qt/qpe-config.h $QTDIR/src/tools
38 38
39You are now ready to configure and build Qt/Embedded 39You are now ready to configure and build Qt/Embedded
40 40
41cd $QTDIR 41cd $QTDIR
42echo 'yes' | ./configure -qconfig qpe -depths 4,16,24,32 -system-jpeg -system-libpng -system-zlib -no-xft -qvfb 42echo 'yes' | ./configure -qconfig qpe -depths 4,16,24,32 -system-jpeg -system-libpng -system-zlib -no-xft -qvfb
43make 43make
44 44
45Once you have these compiled, be sure to set the PATH to ensure your (cross)compiler 45Once you have these compiled, be sure to set the PATH to ensure your (cross)compiler
46is available. 46is available.
47 47
48Then do the following in the opie source tree: 48Then do the following in the opie source tree:
49 49
50make clean 50make clean
51make menuconfig 51make menuconfig
52 52
53Now you can move through the menu and select or deselect anything.. 53Now you can move through the menu and select or deselect anything..
54Exit and save the configuration and enter "make" to create opie... 54Exit and save the configuration and enter "make" to create opie...
55 55
56Have fun with it ! 56Have fun with it !
57 57
58If you get into trouble there are other makefile targets 58If you get into trouble there are other makefile targets
59 59
60make clean-configs 60make clean-configs
61is a useful one. 61is a useful one.
62 62
632. Used Libraries 632. Used Libraries
64================ 64================
65 65
66The following Libraries are used in Opie. 66The following Libraries are used in Opie.
67For a successfull build you must install these librarys and headers. 67For a successful build you must install these librarys and headers.
68The versions are known-good versions. If you successfully try newer ones, 68The versions are known-good versions. If you successfully try newer ones,
69commit a new README or send a mail to opie-devel@handhelds.org 69commit a new README or send a mail to opie-devel@handhelds.org
70 70
71* libsdl 1.2 71* libsdl 1.2
72 http://www.libsdl.org/download-1.2.php 72 http://www.libsdl.org/download-1.2.php
73 73
74* libxine 1.0 beta 11 74* libxine 1.0 beta 11
75 http://prdownloads.sourceforge.net/xine/ 75 http://prdownloads.sourceforge.net/xine/
76 76
77* libpcap 0.7.2 77* libpcap 0.7.2
78 http://www.tcpdump.org/release/ 78 http://www.tcpdump.org/release/
79 79
80* libetpan 0.31 80* libetpan 0.31
81 http://prdownloads.sourceforge.net/libetpan/ + patch in noncore/net/mail/libetpanstuff 81 http://prdownloads.sourceforge.net/libetpan/ + patch in noncore/net/mail/libetpanstuff
82 82
83* libsqlite 2.8.6 83* libsqlite 2.8.6
84 http://www.sqlite.org/download.html 84 http://www.sqlite.org/download.html
85 85
86 86
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
@@ -279,106 +279,106 @@ int suspend ( int fix_rtc )
279 kill ( parent_pid, SIGUSR1 ); 279 kill ( parent_pid, SIGUSR1 );
280 280
281 if ( read ( fd, buf, sizeof( unsigned long )) < 0 ) // wait for the RTC alarm irq 281 if ( read ( fd, buf, sizeof( unsigned long )) < 0 ) // wait for the RTC alarm irq
282 break; // ( 1, "read rtc alarm" ); 282 break; // ( 1, "read rtc alarm" );
283 283
284 // iPAQ woke up via RTC irq -- otherwise we would have received a SIGUSR2 284 // iPAQ woke up via RTC irq -- otherwise we would have received a SIGUSR2
285 // from the "resume instance" of opiealarm. 285 // from the "resume instance" of opiealarm.
286 286
287 if ( ioctl ( fd, RTC_AIE_OFF, 0 ) < 0 ) // disable RTC alarm irq 287 if ( ioctl ( fd, RTC_AIE_OFF, 0 ) < 0 ) // disable RTC alarm irq
288 break; // ( 1, "ioctl RTC_AIE_OFF" ); 288 break; // ( 1, "ioctl RTC_AIE_OFF" );
289 289
290 close ( fd ); 290 close ( fd );
291 fd = -1; 291 fd = -1;
292 292
293 remove_pidfile ( ); 293 remove_pidfile ( );
294 294
295 return 0; 295 return 0;
296 296
297 } while ( 0 ); 297 } while ( 0 );
298 298
299 if ( fp != NULL ) 299 if ( fp != NULL )
300 fclose ( fp ); 300 fclose ( fp );
301 301
302 if ( fd != -1 ) 302 if ( fd != -1 )
303 close ( fd ); 303 close ( fd );
304 304
305 kill ( parent_pid, SIGUSR1 ); 305 kill ( parent_pid, SIGUSR1 );
306 306
307 while ( 1 ) // pretend that we are waiting on RTC, so opiealarm -r can kill us 307 while ( 1 ) // pretend that we are waiting on RTC, so opiealarm -r can kill us
308 sleep ( 1000 ); // if we don't do this, the "resuspend on AC" would be triggerd 308 sleep ( 1000 ); // if we don't do this, the "resuspend on AC" would be triggerd
309 return 0; 309 return 0;
310} 310}
311 311
312int onac ( void ) 312int onac ( void )
313{ 313{
314 FILE *fp; 314 FILE *fp;
315 int on = 0; 315 int on = 0;
316 316
317 // check the apm proc interface for AC status 317 // check the apm proc interface for AC status
318 318
319 if (( fp = fopen ( APMFILE, "r" ))) { 319 if (( fp = fopen ( APMFILE, "r" ))) {
320 int ac = 0; 320 int ac = 0;
321 321
322 if ( fscanf ( fp, "%*[^ ] %*d.%*d 0x%*x 0x%x 0x%*x 0x%*x %*d%% %*i %*c", &ac ) == 1 ) 322 if ( fscanf ( fp, "%*[^ ] %*d.%*d 0x%*x 0x%x 0x%*x 0x%*x %*d%% %*i %*c", &ac ) == 1 )
323 on = ( ac == 0x01 ) ? 1 : 0; 323 on = ( ac == 0x01 ) ? 1 : 0;
324 324
325 fclose ( fp ); 325 fclose ( fp );
326 } 326 }
327 return on; 327 return on;
328} 328}
329 329
330int resume ( int resuspend ) 330int resume ( int resuspend )
331{ 331{
332 FILE *fp; 332 FILE *fp;
333 333
334 // re-suspend when on AC (optional) when woken up via RTC 334 // re-suspend when on AC (optional) when woken up via RTC
335 335
336 if ( !opiealarm_was_running ) { 336 if ( !opiealarm_was_running ) {
337 // if opiealarm -s didn't wake up via RTC, the old process gets killed 337 // if opiealarm -s didn't wake up via RTC, the old process gets killed
338 // by kill_by_pidfile(), which is recorded in opiealarm_was_running 338 // by kill_by_pidfile(), which is recorded in opiealarm_was_running
339 339
340 if ( resuspend && onac ( )) { 340 if ( resuspend && onac ( )) {
341 time_t start, now; 341 time_t start, now;
342 char *argv [4]; 342 char *argv [4];
343 343
344 if ( !fork_with_pidfile ( )) 344 if ( !fork_with_pidfile ( ))
345 return 4; 345 return 4;
346 346
347 // we can't wait for the resuspend timeout in the parent process. 347 // we can't wait for the resuspend timeout in the parent process.
348 // so we fork and tell the parent it can exit immediatly 348 // so we fork and tell the parent it can exit immediatly
349 349
350 kill ( parent_pid, SIGUSR1 ); 350 kill ( parent_pid, SIGUSR1 );
351 351
352 // sleep <resuspend> seconds - this method is much more precise than sleep() ! 352 // sleep <resuspend> seconds - this method is much more precise than sleep() !
353 time ( &start ); 353 time ( &start );
354 do { 354 do {
355 sleep ( 1 ); 355 sleep ( 1 );
356 time ( &now ); 356 time ( &now );
357 } while (( now - start ) < resuspend ); 357 } while (( now - start ) < resuspend );
358 358
359 if ( onac ( )) { // still on ac ? 359 if ( onac ( )) { // still on ac ?
360 argv[0] = "qcop"; 360 argv[0] = "qcop";
361 argv[1] = "QPE/Desktop"; 361 argv[1] = "QPE/Desktop";
362 argv[2] = "suspend()"; 362 argv[2] = "suspend()";
363 argv[3] = 0; 363 argv[3] = 0;
364 364
365 // hard coded for now ...but needed 365 // hard coded for now ...but needed
366 // another way would be to simulate a power-button press 366 // another way would be to simulate a power-button press
367 367
368 setenv ( "LOGNAME", "root", 1 ); 368 setenv ( "LOGNAME", "root", 1 );
369 setenv ( "HOME", "/root", 1 ); 369 setenv ( "HOME", "/root", 1 );
370 setenv ( "LD_LIBRARY_PATH", "/opt/QtPalmtop/lib", 1 ); 370 setenv ( "LD_LIBRARY_PATH", "/opt/QtPalmtop/lib", 1 );
371 setenv ( "QTDIR", "/opt/QtPalmtop", 1 ); 371 setenv ( "QTDIR", "/opt/QtPalmtop", 1 );
372 372
373 remove_pidfile ( ); 373 remove_pidfile ( );
374 374
375 // no need for system() since this process is no longer usefull anyway 375 // no need for system() since this process is no longer useful anyway
376 execv ( "/opt/QtPalmtop/bin/qcop", argv ); 376 execv ( "/opt/QtPalmtop/bin/qcop", argv );
377 377
378 perror ( "exec for qcop failed" ); 378 perror ( "exec for qcop failed" );
379 return 5; 379 return 5;
380 } 380 }
381 } 381 }
382 } 382 }
383 return 0; 383 return 0;
384} 384}
diff --git a/etc/dict/words b/etc/dict/words
index 1568032..0f14205 100644
--- a/etc/dict/words
+++ b/etc/dict/words
@@ -4448,193 +4448,193 @@ behaviorism
4448behavioristic 4448behavioristic
4449behaviors 4449behaviors
4450behead 4450behead
4451beheading 4451beheading
4452beheld 4452beheld
4453behemoth 4453behemoth
4454behemoths 4454behemoths
4455behest 4455behest
4456behind 4456behind
4457behold 4457behold
4458beholden 4458beholden
4459beholder 4459beholder
4460beholders 4460beholders
4461beholding 4461beholding
4462beholds 4462beholds
4463behoove 4463behoove
4464behooves 4464behooves
4465beige 4465beige
4466Beijing 4466Beijing
4467being 4467being
4468beings 4468beings
4469Beirut 4469Beirut
4470Bela 4470Bela
4471belabor 4471belabor
4472belabored 4472belabored
4473belaboring 4473belaboring
4474belabors 4474belabors
4475belated 4475belated
4476belatedly 4476belatedly
4477belay 4477belay
4478belayed 4478belayed
4479belaying 4479belaying
4480belays 4480belays
4481belch 4481belch
4482belched 4482belched
4483belches 4483belches
4484belching 4484belching
4485Belfast 4485Belfast
4486belfries 4486belfries
4487belfry 4487belfry
4488Belgian 4488Belgian
4489Belgians 4489Belgians
4490Belgium 4490Belgium
4491Belgrade 4491Belgrade
4492belie 4492belie
4493belied 4493belied
4494belief 4494belief
4495beliefs 4495beliefs
4496belies 4496belies
4497believable 4497believable
4498believably 4498believably
4499believe 4499believe
4500believed 4500believed
4501believer 4501believer
4502believers 4502believers
4503believes 4503believes
4504believing 4504believing
4505belittle 4505belittle
4506belittled 4506belittled
4507belittles 4507belittles
4508belittling 4508belittling
4509Belize 4509Belize
4510bell 4510bell
4511Bella 4511Bella
4512Bellamy 4512Bellamy
4513Bellatrix 4513Bellatrix
4514bellboy 4514bellboy
4515bellboys 4515bellboys
4516belle 4516belle
4517belles 4517belles
4518Belleville 4518Belleville
4519bellhop 4519bellhop
4520bellhops 4520bellhops
4521bellicose 4521bellicose
4522bellicosity 4522bellicosity
4523bellies 4523bellies
4524belligerence 4524belligerence
4525belligerent 4525belligerent
4526belligerently 4526belligerently
4527belligerents 4527belligerents
4528Bellingham 4528Bellingham
4529Bellini 4529Bellini
4530bellman 4530bellman
4531bellmen 4531bellmen
4532Bellovin 4532Bellovin
4533bellow 4533bellow
4534bellowed 4534bellowed
4535bellowing 4535bellowing
4536bellows 4536bellows
4537bells 4537bells
4538bellum 4538bellum
4539bellwether 4539bellwether
4540bellwethers 4540bellwethers
4541Bellwood 4541Bellwood
4542belly 4542belly
4543bellyache 4543bellyache
4544bellyfull 4544bellyful
4545Belmont 4545Belmont
4546Beloit 4546Beloit
4547belong 4547belong
4548belonged 4548belonged
4549belonging 4549belonging
4550belongings 4550belongings
4551belongs 4551belongs
4552beloved 4552beloved
4553below 4553below
4554Belshazzar 4554Belshazzar
4555belt 4555belt
4556belted 4556belted
4557belting 4557belting
4558Belton 4558Belton
4559belts 4559belts
4560Beltsville 4560Beltsville
4561Belushi 4561Belushi
4562bely 4562bely
4563belying 4563belying
4564bemoan 4564bemoan
4565bemoaned 4565bemoaned
4566bemoaning 4566bemoaning
4567bemoans 4567bemoans
4568Ben 4568Ben
4569Benares 4569Benares
4570bench 4570bench
4571benched 4571benched
4572benches 4572benches
4573benchmark 4573benchmark
4574benchmarking 4574benchmarking
4575benchmarks 4575benchmarks
4576bend 4576bend
4577bendable 4577bendable
4578Bender 4578Bender
4579benders 4579benders
4580bending 4580bending
4581Bendix 4581Bendix
4582bends 4582bends
4583beneath 4583beneath
4584Benedict 4584Benedict
4585Benedictine 4585Benedictine
4586benediction 4586benediction
4587benedictions 4587benedictions
4588Benedikt 4588Benedikt
4589benefactor 4589benefactor
4590benefactors 4590benefactors
4591beneficence 4591beneficence
4592beneficences 4592beneficences
4593beneficent 4593beneficent
4594beneficial 4594beneficial
4595beneficially 4595beneficially
4596beneficiaries 4596beneficiaries
4597beneficiary 4597beneficiary
4598benefit 4598benefit
4599benefited 4599benefited
4600benefiting 4600benefiting
4601benefits 4601benefits
4602benefitted 4602benefitted
4603benefitting 4603benefitting
4604Benelux 4604Benelux
4605benevolence 4605benevolence
4606benevolent 4606benevolent
4607Bengal 4607Bengal
4608Bengali 4608Bengali
4609benighted 4609benighted
4610benign 4610benign
4611benignly 4611benignly
4612Benjamin 4612Benjamin
4613Bennett 4613Bennett
4614Bennington 4614Bennington
4615Benny 4615Benny
4616Benson 4616Benson
4617bent 4617bent
4618Bentham 4618Bentham
4619Bentley 4619Bentley
4620Bentleys 4620Bentleys
4621Benton 4621Benton
4622Benz 4622Benz
4623Benzedrine 4623Benzedrine
4624benzene 4624benzene
4625Beograd 4625Beograd
4626Beowulf 4626Beowulf
4627bequeath 4627bequeath
4628bequeathal 4628bequeathal
4629bequeathed 4629bequeathed
4630bequeathing 4630bequeathing
4631bequeaths 4631bequeaths
4632bequest 4632bequest
4633bequests 4633bequests
4634berate 4634berate
4635berated 4635berated
4636berates 4636berates
4637berating 4637berating
4638Berea 4638Berea
4639bereave 4639bereave
4640bereaved 4640bereaved
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 @@
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> 1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
2 2
3<!--Converted with LaTeX2HTML 2002-1 (1.68) 3<!--Converted with LaTeX2HTML 2002-1 (1.68)
4original version by: Nikos Drakos, CBLU, University of Leeds 4original version by: Nikos Drakos, CBLU, University of Leeds
5* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan 5* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan
6* with significant contributions from: 6* with significant contributions from:
7 Jens Lippmann, Marek Rouchal, Martin Wilck and others --> 7 Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
8<HTML> 8<HTML>
9<HEAD> 9<HEAD>
10<TITLE>What it is for</TITLE> 10<TITLE>What it is for</TITLE>
11<META NAME="description" CONTENT="What it is for"> 11<META NAME="description" CONTENT="What it is for">
12<META NAME="keywords" CONTENT="opie-sh-howto"> 12<META NAME="keywords" CONTENT="opie-sh-howto">
13<META NAME="resource-type" CONTENT="document"> 13<META NAME="resource-type" CONTENT="document">
14<META NAME="distribution" CONTENT="global"> 14<META NAME="distribution" CONTENT="global">
15 15
16<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> 16<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
17<META NAME="Generator" CONTENT="LaTeX2HTML v2002-1"> 17<META NAME="Generator" CONTENT="LaTeX2HTML v2002-1">
18<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css"> 18<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
19 19
20<LINK REL="STYLESHEET" HREF="opie-sh-howto.css"> 20<LINK REL="STYLESHEET" HREF="opie-sh-howto.css">
21 21
22<LINK REL="next" HREF="node4.html"> 22<LINK REL="next" HREF="node4.html">
23<LINK REL="previous" HREF="node2.html"> 23<LINK REL="previous" HREF="node2.html">
24<LINK REL="up" HREF="node2.html"> 24<LINK REL="up" HREF="node2.html">
25<LINK REL="next" HREF="node4.html"> 25<LINK REL="next" HREF="node4.html">
26</HEAD> 26</HEAD>
27 27
28<BODY > 28<BODY >
29<!--Navigation Panel--> 29<!--Navigation Panel-->
30<A NAME="tex2html71" 30<A NAME="tex2html71"
31 HREF="node4.html"> 31 HREF="node4.html">
32<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" 32<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
33 SRC="file:/usr/local/share/lib/latex2html/icons/next.gif"></A> 33 SRC="file:/usr/local/share/lib/latex2html/icons/next.gif"></A>
34<A NAME="tex2html67" 34<A NAME="tex2html67"
35 HREF="node2.html"> 35 HREF="node2.html">
36<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" 36<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
37 SRC="file:/usr/local/share/lib/latex2html/icons/up.gif"></A> 37 SRC="file:/usr/local/share/lib/latex2html/icons/up.gif"></A>
38<A NAME="tex2html61" 38<A NAME="tex2html61"
39 HREF="node2.html"> 39 HREF="node2.html">
40<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" 40<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
41 SRC="file:/usr/local/share/lib/latex2html/icons/prev.gif"></A> 41 SRC="file:/usr/local/share/lib/latex2html/icons/prev.gif"></A>
42<A NAME="tex2html69" 42<A NAME="tex2html69"
43 HREF="node1.html"> 43 HREF="node1.html">
44<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" 44<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents"
45 SRC="file:/usr/local/share/lib/latex2html/icons/contents.gif"></A> 45 SRC="file:/usr/local/share/lib/latex2html/icons/contents.gif"></A>
46<BR> 46<BR>
47<B> Next:</B> <A NAME="tex2html72" 47<B> Next:</B> <A NAME="tex2html72"
48 HREF="node4.html">What it can do</A> 48 HREF="node4.html">What it can do</A>
49<B> Up:</B> <A NAME="tex2html68" 49<B> Up:</B> <A NAME="tex2html68"
50 HREF="node2.html">Introduction</A> 50 HREF="node2.html">Introduction</A>
51<B> Previous:</B> <A NAME="tex2html62" 51<B> Previous:</B> <A NAME="tex2html62"
52 HREF="node2.html">Introduction</A> 52 HREF="node2.html">Introduction</A>
53 &nbsp <B> <A NAME="tex2html70" 53 &nbsp <B> <A NAME="tex2html70"
54 HREF="node1.html">Contents</A></B> 54 HREF="node1.html">Contents</A></B>
55<BR> 55<BR>
56<BR> 56<BR>
57<!--End of Navigation Panel--> 57<!--End of Navigation Panel-->
58 58
59<H2><A NAME="SECTION00021000000000000000"> 59<H2><A NAME="SECTION00021000000000000000">
60What it is for</A> 60What it is for</A>
61</H2> 61</H2>
62Opie-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. 62Opie-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.
63 63
64<P> 64<P>
65<BR><HR> 65<BR><HR>
66<ADDRESS> 66<ADDRESS>
67 67
682002-05-15 682002-05-15
69</ADDRESS> 69</ADDRESS>
70</BODY> 70</BODY>
71</HTML> 71</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 @@
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> 1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
2 2
3<!--Converted with LaTeX2HTML 2002-1 (1.68) 3<!--Converted with LaTeX2HTML 2002-1 (1.68)
4original version by: Nikos Drakos, CBLU, University of Leeds 4original version by: Nikos Drakos, CBLU, University of Leeds
5* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan 5* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan
6* with significant contributions from: 6* with significant contributions from:
7 Jens Lippmann, Marek Rouchal, Martin Wilck and others --> 7 Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
8<HTML> 8<HTML>
9<HEAD> 9<HEAD>
10<TITLE>Icons</TITLE> 10<TITLE>Icons</TITLE>
11<META NAME="description" CONTENT="Icons"> 11<META NAME="description" CONTENT="Icons">
12<META NAME="keywords" CONTENT="opie-sh-howto"> 12<META NAME="keywords" CONTENT="opie-sh-howto">
13<META NAME="resource-type" CONTENT="document"> 13<META NAME="resource-type" CONTENT="document">
14<META NAME="distribution" CONTENT="global"> 14<META NAME="distribution" CONTENT="global">
15 15
16<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> 16<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
17<META NAME="Generator" CONTENT="LaTeX2HTML v2002-1"> 17<META NAME="Generator" CONTENT="LaTeX2HTML v2002-1">
18<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css"> 18<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
19 19
20<LINK REL="STYLESHEET" HREF="opie-sh-howto.css"> 20<LINK REL="STYLESHEET" HREF="opie-sh-howto.css">
21 21
22<LINK REL="previous" HREF="node8.html"> 22<LINK REL="previous" HREF="node8.html">
23<LINK REL="up" HREF="node6.html"> 23<LINK REL="up" HREF="node6.html">
24<LINK REL="next" HREF="node10.html"> 24<LINK REL="next" HREF="node10.html">
25</HEAD> 25</HEAD>
26 26
27<BODY > 27<BODY >
28<!--Navigation Panel--> 28<!--Navigation Panel-->
29<A NAME="tex2html144" 29<A NAME="tex2html144"
30 HREF="node10.html"> 30 HREF="node10.html">
31<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" 31<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
32 SRC="file:/usr/local/share/lib/latex2html/icons/next.gif"></A> 32 SRC="file:/usr/local/share/lib/latex2html/icons/next.gif"></A>
33<A NAME="tex2html140" 33<A NAME="tex2html140"
34 HREF="node6.html"> 34 HREF="node6.html">
35<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" 35<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
36 SRC="file:/usr/local/share/lib/latex2html/icons/up.gif"></A> 36 SRC="file:/usr/local/share/lib/latex2html/icons/up.gif"></A>
37<A NAME="tex2html136" 37<A NAME="tex2html136"
38 HREF="node8.html"> 38 HREF="node8.html">
39<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" 39<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
40 SRC="file:/usr/local/share/lib/latex2html/icons/prev.gif"></A> 40 SRC="file:/usr/local/share/lib/latex2html/icons/prev.gif"></A>
41<A NAME="tex2html142" 41<A NAME="tex2html142"
42 HREF="node1.html"> 42 HREF="node1.html">
43<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" 43<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents"
44 SRC="file:/usr/local/share/lib/latex2html/icons/contents.gif"></A> 44 SRC="file:/usr/local/share/lib/latex2html/icons/contents.gif"></A>
45<BR> 45<BR>
46<B> Next:</B> <A NAME="tex2html145" 46<B> Next:</B> <A NAME="tex2html145"
47 HREF="node10.html">Fileviewer</A> 47 HREF="node10.html">Fileviewer</A>
48<B> Up:</B> <A NAME="tex2html141" 48<B> Up:</B> <A NAME="tex2html141"
49 HREF="node6.html">Usage</A> 49 HREF="node6.html">Usage</A>
50<B> Previous:</B> <A NAME="tex2html137" 50<B> Previous:</B> <A NAME="tex2html137"
51 HREF="node8.html">Buttons</A> 51 HREF="node8.html">Buttons</A>
52 &nbsp <B> <A NAME="tex2html143" 52 &nbsp <B> <A NAME="tex2html143"
53 HREF="node1.html">Contents</A></B> 53 HREF="node1.html">Contents</A></B>
54<BR> 54<BR>
55<BR> 55<BR>
56<!--End of Navigation Panel--> 56<!--End of Navigation Panel-->
57 57
58<H3><A NAME="SECTION00031300000000000000"> 58<H3><A NAME="SECTION00031300000000000000">
59Icons</A> 59Icons</A>
60</H3> 60</H3>
61There 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. 61There 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.
62 62
63<P> 63<P>
64An 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: 64An 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:
65 65
66<P> 66<P>
67<PRE> 67<PRE>
68opie-sh -m -I 68opie-sh -m -I
69</PRE> 69</PRE>
70 70
71<P> 71<P>
72A 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: 72A 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:
73 73
74<P> 74<P>
75<PRE> 75<PRE>
76opie-sh -m -w 76opie-sh -m -w
77</PRE> 77</PRE>
78 78
79<P> 79<P>
80An 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: 80An 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:
81 81
82<P> 82<P>
83<PRE> 83<PRE>
84opie-sh -m -e 84opie-sh -m -e
85</PRE> 85</PRE>
86 86
87<P> 87<P>
88<HR> 88<HR>
89<!--Navigation Panel--> 89<!--Navigation Panel-->
90<A NAME="tex2html144" 90<A NAME="tex2html144"
91 HREF="node10.html"> 91 HREF="node10.html">
92<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" 92<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
93 SRC="file:/usr/local/share/lib/latex2html/icons/next.gif"></A> 93 SRC="file:/usr/local/share/lib/latex2html/icons/next.gif"></A>
94<A NAME="tex2html140" 94<A NAME="tex2html140"
95 HREF="node6.html"> 95 HREF="node6.html">
96<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" 96<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
97 SRC="file:/usr/local/share/lib/latex2html/icons/up.gif"></A> 97 SRC="file:/usr/local/share/lib/latex2html/icons/up.gif"></A>
98<A NAME="tex2html136" 98<A NAME="tex2html136"
99 HREF="node8.html"> 99 HREF="node8.html">
100<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" 100<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
101 SRC="file:/usr/local/share/lib/latex2html/icons/prev.gif"></A> 101 SRC="file:/usr/local/share/lib/latex2html/icons/prev.gif"></A>
102<A NAME="tex2html142" 102<A NAME="tex2html142"
103 HREF="node1.html"> 103 HREF="node1.html">
104<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" 104<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents"
105 SRC="file:/usr/local/share/lib/latex2html/icons/contents.gif"></A> 105 SRC="file:/usr/local/share/lib/latex2html/icons/contents.gif"></A>
106<BR> 106<BR>
107<B> Next:</B> <A NAME="tex2html145" 107<B> Next:</B> <A NAME="tex2html145"
108 HREF="node10.html">Fileviewer</A> 108 HREF="node10.html">Fileviewer</A>
109<B> Up:</B> <A NAME="tex2html141" 109<B> Up:</B> <A NAME="tex2html141"
110 HREF="node6.html">Usage</A> 110 HREF="node6.html">Usage</A>
111<B> Previous:</B> <A NAME="tex2html137" 111<B> Previous:</B> <A NAME="tex2html137"
112 HREF="node8.html">Buttons</A> 112 HREF="node8.html">Buttons</A>
113 &nbsp <B> <A NAME="tex2html143" 113 &nbsp <B> <A NAME="tex2html143"
114 HREF="node1.html">Contents</A></B> 114 HREF="node1.html">Contents</A></B>
115<!--End of Navigation Panel--> 115<!--End of Navigation Panel-->
116<ADDRESS> 116<ADDRESS>
117 117
1182002-05-15 1182002-05-15
119</ADDRESS> 119</ADDRESS>
120</BODY> 120</BODY>
121</HTML> 121</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
@@ -10507,193 +10507,192 @@ silver\argènteo, argento
10507similar\pari, consimile, simile 10507similar\pari, consimile, simile
10508similarity\omogeneità 10508similarity\omogeneità
10509similarly\simile 10509similarly\simile
10510simile\paragone 10510simile\paragone
10511similitude\assomiglianza 10511similitude\assomiglianza
10512simmer\bollore 10512simmer\bollore
10513simpatico\simpatico 10513simpatico\simpatico
10514simper\sciocco 10514simper\sciocco
10515simple\semplice 10515simple\semplice
10516simple minded\ingenuo 10516simple minded\ingenuo
10517simpleminded\semplice 10517simpleminded\semplice
10518simplemindedness\semplicità 10518simplemindedness\semplicità
10519simpleness\semplicità 10519simpleness\semplicità
10520simpletons\pennellare 10520simpletons\pennellare
10521simplicity\semplicità 10521simplicity\semplicità
10522simplification\semplificazione 10522simplification\semplificazione
10523simplify\semplificare 10523simplify\semplificare
10524simply\semplice 10524simply\semplice
10525simular\simile 10525simular\simile
10526simulate\simulare, simulare 10526simulate\simulare, simulare
10527simulated\artefatto 10527simulated\artefatto
10528simultaneous\simultaneo 10528simultaneous\simultaneo
10529simultaneously\simultaneo 10529simultaneously\simultaneo
10530sin\peccato 10530sin\peccato
10531since\da, da allora, perchè 10531since\da, da allora, perchè
10532since then\da allora 10532since then\da allora
10533sincere\sincero 10533sincere\sincero
10534sincerely\umilissimo, sincera 10534sincerely\umilissimo, sincera
10535sinful\peccaminoso 10535sinful\peccaminoso
10536sing\cantare 10536sing\cantare
10537singable\cantàbile 10537singable\cantàbile
10538singer\cantante 10538singer\cantante
10539singing\canto 10539singing\canto
10540singings\canti 10540singings\canti
10541single\nubile, singolo 10541single\nubile, singolo
10542single lane\a senso unico 10542single lane\a senso unico
10543single phase\monofase 10543single phase\monofase
10544single room\càmera sìngola 10544single room\càmera sìngola
10545single ticket\biglietto sémplice 10545single ticket\biglietto sémplice
10546singled\divorziato 10546singled\divorziato
10547singly\singolo 10547singly\singolo
10548sings\canta 10548sings\canta
10549singular\singolare 10549singular\singolare
10550singularness\stranezza 10550singularness\stranezza
10551sinister\nefasto 10551sinister\nefasto
10552sink\abbassarsi, catinella, abbassarsi, lavello 10552sink\abbassarsi, catinella, abbassarsi, lavello
10553sinking\affondamento 10553sinking\affondamento
10554sinks\abbassa 10554sinks\abbassa
10555sinned\peccato 10555sinned\peccato
10556sinner\peccatore 10556sinner\peccatore
10557sins\peccati 10557sins\peccati
10558sinuous\contorto 10558sinuous\contorto
10559sip\sorso 10559sip\sorso
10560sir\signore 10560sir\signore
10561sire\testimoniare 10561sire\testimoniare
10562sirloin\lonza 10562sirloin\lonza
10563sissy\effeminato 10563sissy\effeminato
10564sister\sorella 10564sister\sorella
10565sister in law\cognata 10565sister in law\cognata
10566sit\star seduto 10566sit\star seduto
10567sit down\accomodarsi 10567sit down\accomodarsi
10568site\posto, circostanza 10568site\posto, circostanza
10569site of crime\luogo del fatto 10569site of crime\luogo del fatto
10570sits\siede 10570sits\siede
10571sitting\seduto 10571sitting\seduto
10572sitting room\salotto 10572sitting room\salotto
10573situate\allineare, mettere, mettere 10573situate\allineare, mettere, mettere
10574situated\posto 10574situated\posto
10575situation\situazione, posizione, circostanza 10575situation\situazione, posizione, circostanza
10576six\sei 10576six\sei
10577sixfold\sestuplo 10577sixfold\sestuplo
10578sixteen\sedici 10578sixteen\sedici
10579sixteenth\sedicesimo, sedicesima 10579sixteenth\sedicesimo, sedicesima
10580sixth\sesto, sesta 10580sixth\sesto, sesta
10581sixty\sessanta 10581sixty\sessanta
10582size\grossezza 10582size\grossezza
10583size of shoe\numero di scarpa 10583size of shoe\numero di scarpa
10584sizzle\grillare 10584sizzle\grillare
10585skating\pattinaggio artistico 10585skating\pattinaggio artistico
10586skating ring\pista di ghiaccio 10586skating ring\pista di ghiaccio
10587skating rink\pista di ghiaccio 10587skating rink\pista di ghiaccio
10588skein\capestro 10588skein\capestro
10589skeins\capestri 10589skeins\capestri
10590skeleton\scheletro 10590skeleton\scheletro
10591skeletons\scheletri 10591skeletons\scheletri
10592skepticalness\scetticismo 10592skepticalness\scetticismo
10593skepticism\scetticismo 10593skepticism\scetticismo
10594sketch\abbozzo, abbozzare 10594sketch\abbozzo, abbozzare
10595sketchily\volatile, abbozzaticcio, superficiale 10595sketchily\volatile, abbozzaticcio, superficiale
10596sketchiness\poca chiarezza 10596sketchiness\poca chiarezza
10597sketchy\torbido 10597sketchy\torbido
10598skews\storto 10598skews\storto
10599ski\sci 10599ski\sci
10600skid\discesa a valle, avventare 10600skid\discesa a valle, avventare
10601skiful\esperto 10601skiful\esperto
10602skilful\apprèndere, azzeccato 10602skilful\apprèndere, azzeccato
10603skilfull\apprèndere
10604skill\sorte, disinvoltura 10603skill\sorte, disinvoltura
10605skilled\versato 10604skilled\versato
10606skilled worker\operaio specializzato 10605skilled worker\operaio specializzato
10607skillet\tegame 10606skillet\tegame
10608skillful\lesto, sveglio, esperto 10607skillful\lesto, sveglio, esperto
10609skillfulness\disinvoltura 10608skillfulness\disinvoltura
10610skimp\lesinare 10609skimp\lesinare
10611skimpiest\piccolissimo 10610skimpiest\piccolissimo
10612skimpily\scarso 10611skimpily\scarso
10613skimpiness\strettezza 10612skimpiness\strettezza
10614skimpy\scarso 10613skimpy\scarso
10615skin\epidèrmide, epidermide 10614skin\epidèrmide, epidermide
10616skinny\scremato, magro, secco 10615skinny\scremato, magro, secco
10617skins\pelli, pelli 10616skins\pelli, pelli
10618skip\saltellare, lancio 10617skip\saltellare, lancio
10619skipper\marinaio 10618skipper\marinaio
10620skirt\gonna 10619skirt\gonna
10621skirting board\battiscopa 10620skirting board\battiscopa
10622skit\satira 10621skit\satira
10623skittle\birillo 10622skittle\birillo
10624skittle alley\gioco dei birilli 10623skittle alley\gioco dei birilli
10625skivvy\biancherìa ìntima 10624skivvy\biancherìa ìntima
10626skulker\lima sorda 10625skulker\lima sorda
10627skunk\puzzola 10626skunk\puzzola
10628sky\cielo 10627sky\cielo
10629skylark\lodola 10628skylark\lodola
10630skyrocket\razzo 10629skyrocket\razzo
10631skyscraper\grattacielo, grattacielo 10630skyscraper\grattacielo, grattacielo
10632skyscrapers\grattacielo 10631skyscrapers\grattacielo
10633slab\frantumare 10632slab\frantumare
10634slack\lasco, floscio 10633slack\lasco, floscio
10635slack joint\contatto lasco 10634slack joint\contatto lasco
10636slack period\ristagno 10635slack period\ristagno
10637slacken\rilassare, rilassare 10636slacken\rilassare, rilassare
10638slackens\rilassato 10637slackens\rilassato
10639slacker\scansafatiche 10638slacker\scansafatiche
10640slacks\pantaloni 10639slacks\pantaloni
10641slake\allattamento 10640slake\allattamento
10642slam\sbattere 10641slam\sbattere
10643slammed\sbattuto 10642slammed\sbattuto
10644slander\calunniare 10643slander\calunniare
10645slanderer\calunniatore 10644slanderer\calunniatore
10646slanderous\calunnioso 10645slanderous\calunnioso
10647slanderousness\calunnia 10646slanderousness\calunnia
10648slant\declinazione 10647slant\declinazione
10649slanting\obliquo, obliquo 10648slanting\obliquo, obliquo
10650slantingly\obliqua 10649slantingly\obliqua
10651slap\picchiare, ceffone 10650slap\picchiare, ceffone
10652slap in the face\ceffone 10651slap in the face\ceffone
10653slaphappy\avventurato 10652slaphappy\avventurato
10654slaps in the face\schiaffeggiare 10653slaps in the face\schiaffeggiare
10655slash\taglio 10654slash\taglio
10656slat\picchiare 10655slat\picchiare
10657slate\ardesia, abusare 10656slate\ardesia, abusare
10658slatted\picchiai 10657slatted\picchiai
10659slattern\donnaccia 10658slattern\donnaccia
10660slaughter\macellare 10659slaughter\macellare
10661slaughter cattle\bestiame da macello 10660slaughter cattle\bestiame da macello
10662slaughter house\mattatoio 10661slaughter house\mattatoio
10663slaughtered\macellato 10662slaughtered\macellato
10664slaughterhouse\mattatoio 10663slaughterhouse\mattatoio
10665slave\schiava, schiavo 10664slave\schiava, schiavo
10666slave trader\negriere 10665slave trader\negriere
10667slavered\sbavato 10666slavered\sbavato
10668slavery\schiavitù 10667slavery\schiavitù
10669slay\uccidere 10668slay\uccidere
10670slayer\strangolatore, uccisore 10669slayer\strangolatore, uccisore
10671slays\uccide 10670slays\uccide
10672sleazily\sciatto 10671sleazily\sciatto
10673sleazy\untuoso 10672sleazy\untuoso
10674sleek\netto 10673sleek\netto
10675sleekly\liscia 10674sleekly\liscia
10676sleep\dormire, sonno, dormicchiare 10675sleep\dormire, sonno, dormicchiare
10677sleeper\vagone letto 10676sleeper\vagone letto
10678sleeping car\vagone letto 10677sleeping car\vagone letto
10679sleeping pill\sonnifero 10678sleeping pill\sonnifero
10680sleepless\insonne 10679sleepless\insonne
10681sleeplessness\insonnia 10680sleeplessness\insonnia
10682sleeps\dorme 10681sleeps\dorme
10683sleeve\manica 10682sleeve\manica
10684sleight\disinvoltura 10683sleight\disinvoltura
10685slender\esile, snello, snello 10684slender\esile, snello, snello
10686slice\tagliare, pezzo, fetta 10685slice\tagliare, pezzo, fetta
10687sliced\taglio 10686sliced\taglio
10688slicing\tagliente 10687slicing\tagliente
10689slick\brunire 10688slick\brunire
10690slicker\imbroglione 10689slicker\imbroglione
10691slickness\disinvoltura 10690slickness\disinvoltura
10692slide\spingere 10691slide\spingere
10693slides\spinge 10692slides\spinge
10694sliding roof\tetto scorrevole 10693sliding roof\tetto scorrevole
10695sliding window\finestra scorrevole 10694sliding window\finestra scorrevole
10696slight\magro, scarso, oltraggiare, labkle 10695slight\magro, scarso, oltraggiare, labkle
10697slightness\esiguità 10696slightness\esiguità
10698slim\togliere, snello 10697slim\togliere, snello
10699slime\muco 10698slime\muco
@@ -12556,193 +12555,192 @@ unsuited\disadatto
12556unsure\malsicuro 12555unsure\malsicuro
12557unsureness\incertezza 12556unsureness\incertezza
12558unsurpassed\insuperato 12557unsurpassed\insuperato
12559unsympathetic\antipàtico 12558unsympathetic\antipàtico
12560untainted\senza macchia 12559untainted\senza macchia
12561untarnished\immacolato 12560untarnished\immacolato
12562unthankful\ingrato 12561unthankful\ingrato
12563unthankfulness\ingratitudine 12562unthankfulness\ingratitudine
12564unthinkable\impensabile 12563unthinkable\impensabile
12565unthought\sconsiderato 12564unthought\sconsiderato
12566untimeliness\tempo inopportuno 12565untimeliness\tempo inopportuno
12567untimely\prematuro 12566untimely\prematuro
12568untirable\instancabile 12567untirable\instancabile
12569unto\a tavola 12568unto\a tavola
12570untrapped\esente 12569untrapped\esente
12571untried\intentato 12570untried\intentato
12572untroubled\indisturbato 12571untroubled\indisturbato
12573untruth\menzogna 12572untruth\menzogna
12574untwine\lievitazione 12573untwine\lievitazione
12575unusable\inservibile 12574unusable\inservibile
12576unusual\strano, inconsueto 12575unusual\strano, inconsueto
12577unusually\raro 12576unusually\raro
12578unusualness\stranezza 12577unusualness\stranezza
12579unutterable\indicibile 12578unutterable\indicibile
12580unvaried\immutato 12579unvaried\immutato
12581unveil\svelare 12580unveil\svelare
12582unveiling\svelante 12581unveiling\svelante
12583unventilated\muffaticcio 12582unventilated\muffaticcio
12584unversed\novizio 12583unversed\novizio
12585unwarily\incauto 12584unwarily\incauto
12586unwarped\spassionato 12585unwarped\spassionato
12587unwarranted\non autorizzato 12586unwarranted\non autorizzato
12588unwary\incauto 12587unwary\incauto
12589unwavering\incrollabile 12588unwavering\incrollabile
12590unwearable\intollerabile 12589unwearable\intollerabile
12591unweary\instancabile 12590unweary\instancabile
12592unwed\nubile 12591unwed\nubile
12593unwell\indisposto 12592unwell\indisposto
12594unwillingly\malvolentieri 12593unwillingly\malvolentieri
12595unwillingness\disgusto 12594unwillingness\disgusto
12596unwind\dipanare 12595unwind\dipanare
12597unwinds\rilassato 12596unwinds\rilassato
12598unwise\imprudente 12597unwise\imprudente
12599unwitting\senza volere 12598unwitting\senza volere
12600unwontedly\inconsueto 12599unwontedly\inconsueto
12601unworried\spensierato 12600unworried\spensierato
12602unworthy\indegno 12601unworthy\indegno
12603unwounded\illeso 12602unwounded\illeso
12604unwrought\grezzo 12603unwrought\grezzo
12605up\sù, a, sù, sù 12604up\sù, a, sù, sù
12606up above\sù 12605up above\sù
12607up there\lassù 12606up there\lassù
12608upbraiding\rimprovero 12607upbraiding\rimprovero
12609upbringing\creanza 12608upbringing\creanza
12610upchuck\vòmito 12609upchuck\vòmito
12611upcoming\prossimamente 12610upcoming\prossimamente
12612upgrade\estensione, ampliare 12611upgrade\estensione, ampliare
12613upgrades\trasportato 12612upgrades\trasportato
12614upgrading\estensione 12613upgrading\estensione
12615upheaval\elevamento 12614upheaval\elevamento
12616uphold\durare 12615uphold\durare
12617upholster\imbottire 12616upholster\imbottire
12618upholsterer\tappezziere 12617upholsterer\tappezziere
12619upkeep\manutenzione 12618upkeep\manutenzione
12620uplift\esaltare 12619uplift\esaltare
12621uplifting\alzante 12620uplifting\alzante
12622upon\a 12621upon\a
12623upper arm\braccio superiore 12622upper arm\braccio superiore
12624upper case character\lettera maiuscola 12623upper case character\lettera maiuscola
12625uppish\impettito 12624uppish\impettito
12626uppity\baldanzoso 12625uppity\baldanzoso
12627upraise\esaltare 12626upraise\esaltare
12628upraising\alzante 12627upraising\alzante
12629upright\pari, verticale 12628upright\pari, verticale
12630uprise\levarsi 12629uprise\levarsi
12631uproar\eccitazione 12630uproar\eccitazione
12632uproariously\liuto 12631uproariously\liuto
12633upshot\risultato 12632upshot\risultato
12634upstage\arrivista 12633upstage\arrivista
12635upstairs\in alto, sù 12634upstairs\in alto, sù
12636upturn\incremento 12635upturn\incremento
12637upwards\sù 12636upwards\sù
12638uranium\uranio 12637uranium\uranio
12639urban\urbano 12638urban\urbano
12640urge\premura, incoraggiare 12639urge\premura, incoraggiare
12641urgency\urgenza 12640urgency\urgenza
12642urgent\urgente, legante 12641urgent\urgente, legante
12643urine\orina, uroscopia 12642urine\orina, uroscopia
12644urn\urna 12643urn\urna
12645us\noi, a noi 12644us\noi, a noi
12646usable\usabile 12645usable\usabile
12647usage\uso 12646usage\uso
12648use\uso, adoperare 12647use\uso, adoperare
12649use up\esaurire 12648use up\esaurire
12650used\usato 12649used\usato
12651useful\utile 12650useful\utile
12652usefull\utile
12653useless\inutile, disùtile, inservibile 12651useless\inutile, disùtile, inservibile
12654user\utente 12652user\utente
12655uses\usato 12653uses\usato
12656usual\usuale, ordinario 12654usual\usuale, ordinario
12657usually\ordinario 12655usually\ordinario
12658usuries\usura 12656usuries\usura
12659usury\usura 12657usury\usura
12660Utopian\utopico 12658Utopian\utopico
12661utter\estrinsecare 12659utter\estrinsecare
12662vacant\vacante 12660vacant\vacante
12663vacation\vacanze, ferie 12661vacation\vacanze, ferie
12664vaccinate\vaccinare 12662vaccinate\vaccinare
12665vaccination\vaccinazione 12663vaccination\vaccinazione
12666vaccine\vaccino 12664vaccine\vaccino
12667vacuum\vuotaggine 12665vacuum\vuotaggine
12668vacuum cleaner\aspirapòlvere 12666vacuum cleaner\aspirapòlvere
12669vagabond\vagabondaggio 12667vagabond\vagabondaggio
12670vagina\fòdero 12668vagina\fòdero
12671vailable\disponìbile 12669vailable\disponìbile
12672vain\vano 12670vain\vano
12673valerian\valeriana 12671valerian\valeriana
12674valid\valevole 12672valid\valevole
12675validity\validità 12673validity\validità
12676validness\validità 12674validness\validità
12677valley\valle 12675valley\valle
12678valorize\valorizzare 12676valorize\valorizzare
12679valse\valzer 12677valse\valzer
12680valuable\pregiato 12678valuable\pregiato
12681valuables\valori 12679valuables\valori
12682value\valutare, valore 12680value\valutare, valore
12683valuejudgment\valutazione 12681valuejudgment\valutazione
12684valve\valvola, valvola 12682valve\valvola, valvola
12685vanguard\avanguardia 12683vanguard\avanguardia
12686vanilla\vainiglia 12684vanilla\vainiglia
12687vanish\scomparire 12685vanish\scomparire
12688vanity\fatuità 12686vanity\fatuità
12689vaporizer\vaporizzatore 12687vaporizer\vaporizzatore
12690vapors\evaporazione 12688vapors\evaporazione
12691vapour\vapore 12689vapour\vapore
12692variable\variàbile 12690variable\variàbile
12693variance\contrarietà 12691variance\contrarietà
12694variation\aberrazione 12692variation\aberrazione
12695varicosity\varice 12693varicosity\varice
12696various\differente 12694various\differente
12697variousness\varietà 12695variousness\varietà
12698varnish\vernice 12696varnish\vernice
12699vary\variare 12697vary\variare
12700vascular\recipiente 12698vascular\recipiente
12701vase\vaso, vaso da fiori 12699vase\vaso, vaso da fiori
12702vast\vasto 12700vast\vasto
12703vault\volta 12701vault\volta
12704vaulted\volta 12702vaulted\volta
12705veal\carne di vitello 12703veal\carne di vitello
12706veda\sapere 12704veda\sapere
12707vegetable\pianta 12705vegetable\pianta
12708vegetable soup\zuppa di verdura 12706vegetable soup\zuppa di verdura
12709vegetables\legume 12707vegetables\legume
12710vegetatively\vegetativo 12708vegetatively\vegetativo
12711vehicle\carro, veicolo 12709vehicle\carro, veicolo
12712veil\veletta 12710veil\veletta
12713vein\vena, vena 12711vein\vena, vena
12714veined\venato 12712veined\venato
12715velocity\velocità 12713velocity\velocità
12716velvet\velluto 12714velvet\velluto
12717vending machine\autòma 12715vending machine\autòma
12718vendue\licitazione 12716vendue\licitazione
12719vengeance\vendetta 12717vengeance\vendetta
12720vengeful\vendicativo 12718vengeful\vendicativo
12721venom\veleno 12719venom\veleno
12722ventilate\ventilare, arieggiare, aerare 12720ventilate\ventilare, arieggiare, aerare
12723ventilating\ventilazione 12721ventilating\ventilazione
12724venturous\rischioso 12722venturous\rischioso
12725veraciousness\veridicità 12723veraciousness\veridicità
12726verbal\orale 12724verbal\orale
12727verdict\giudizio 12725verdict\giudizio
12728verifield\giustezza 12726verifield\giustezza
12729verify\verificare, esaminare 12727verify\verificare, esaminare
12730verity\verità 12728verity\verità
12731vermicide\vermifugo 12729vermicide\vermifugo
12732vermilion\cinabro 12730vermilion\cinabro
12733verminous\impidocchiato 12731verminous\impidocchiato
12734versatile\multilaterale 12732versatile\multilaterale
12735version\versione, emissione 12733version\versione, emissione
12736vertical\verticale 12734vertical\verticale
12737vessel\recipiente, vascello 12735vessel\recipiente, vascello
12738vest\maglia 12736vest\maglia
12739vet\veterinario 12737vet\veterinario
12740vetoed\divieto 12738vetoed\divieto
12741vex\molestare 12739vex\molestare
12742vexation\rancore, nonostante 12740vexation\rancore, nonostante
12743via\sopra 12741via\sopra
12744viaduct\viadotto 12742viaduct\viadotto
12745viand\vettovaglia 12743viand\vettovaglia
12746vice\vizio 12744vice\vizio
12747vicious\vizioso 12745vicious\vizioso
12748victim\sacrificio 12746victim\sacrificio
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
@@ -27,136 +27,136 @@ void FileReceive::receive( const QString& dir ) {
27 m_curDir = dir; 27 m_curDir = dir;
28 28
29 if (pipe( m_comm ) < 0 ) 29 if (pipe( m_comm ) < 0 )
30 m_comm[0] = m_comm[1] = 0; 30 m_comm[0] = m_comm[1] = 0;
31 if (pipe( m_info ) < 0 ) 31 if (pipe( m_info ) < 0 )
32 m_info[0] = m_info[1] = 0; 32 m_info[0] = m_info[1] = 0;
33 33
34 m_pid = fork(); 34 m_pid = fork();
35 switch( m_pid ) { 35 switch( m_pid ) {
36 case -1: 36 case -1:
37 //emit error 37 //emit error
38 slotExec(); 38 slotExec();
39 break; 39 break;
40 /* child */ 40 /* child */
41 case 0: { 41 case 0: {
42 setupChild(); 42 setupChild();
43 char* typus = NULL; 43 char* typus = NULL;
44 switch(m_type ) { 44 switch(m_type ) {
45 case SZ: 45 case SZ:
46 break; 46 break;
47 case SX: 47 case SX:
48 typus = "-X"; 48 typus = "-X";
49 break; 49 break;
50 case SY: 50 case SY:
51 typus = "--ymodem"; 51 typus = "--ymodem";
52 break; 52 break;
53 } 53 }
54 54
55 /* we should never return from here */ 55 /* we should never return from here */
56 if( m_type == SX ) 56 if( m_type == SX )
57 // FIXME: file name should be configurable - currently we ensure it 57 // FIXME: file name should be configurable - currently we ensure it
58 // doesn't get overwritten by -E (--rename) 58 // doesn't get overwritten by -E (--rename)
59 execlp("rz", "rz", typus, "--overwrite", QObject::tr("SynchronizedFile").latin1(), NULL ); 59 execlp("rz", "rz", typus, "--overwrite", QObject::tr("SynchronizedFile").latin1(), NULL );
60 else 60 else
61 execlp("rz", "rz", typus, "--overwrite", NULL ); 61 execlp("rz", "rz", typus, "--overwrite", NULL );
62 62
63 char resultByte = 1; 63 char resultByte = 1;
64 if (m_info[1] ) 64 if (m_info[1] )
65 ::write(m_info[1], &resultByte, 1 ); 65 ::write(m_info[1], &resultByte, 1 );
66 66
67 _exit( -1 ); 67 _exit( -1 );
68 break; 68 break;
69 } 69 }
70 default: { 70 default: {
71 if ( m_info[1] ) 71 if ( m_info[1] )
72 close( m_info[1] ); 72 close( m_info[1] );
73 73
74 if ( m_info[0] ) for (;;) { 74 if ( m_info[0] ) for (;;) {
75 char resultByte; int len; 75 char resultByte; int len;
76 len = read(m_info[0], &resultByte, 1 ); 76 len = read(m_info[0], &resultByte, 1 );
77 /* len == 1 start up failed */ 77 /* len == 1 start up failed */
78 if ( len == 1 ) { 78 if ( len == 1 ) {
79 emit error( StartError, tr("Could not start") ); 79 emit error( StartError, tr("Could not start") );
80 return; 80 return;
81 } 81 }
82 if ( len == -1 ) 82 if ( len == -1 )
83 if ( (errno == ECHILD ) || (errno == EINTR ) ) 83 if ( (errno == ECHILD ) || (errno == EINTR ) )
84 continue; 84 continue;
85 85
86 // len == 0 or something like this 86 // len == 0 or something like this
87 break; 87 break;
88 } 88 }
89 89
90 if ( m_info[0] ) 90 if ( m_info[0] )
91 close( m_info[0] ); 91 close( m_info[0] );
92 92
93 m_not = new QSocketNotifier(m_comm[0], QSocketNotifier::Read ); 93 m_not = new QSocketNotifier(m_comm[0], QSocketNotifier::Read );
94 connect(m_not, SIGNAL(activated(int) ), 94 connect(m_not, SIGNAL(activated(int) ),
95 this, SLOT(slotRead() ) ); 95 this, SLOT(slotRead() ) );
96 if ( pipe(m_term) < 0 ) 96 if ( pipe(m_term) < 0 )
97 m_term[0] = m_term[1] = 0; 97 m_term[0] = m_term[1] = 0;
98 98
99 ProcCtl::self()->add(m_pid, m_term[1] ); 99 ProcCtl::self()->add(m_pid, m_term[1] );
100 m_proc = new QSocketNotifier(m_term[0], QSocketNotifier::Read ); 100 m_proc = new QSocketNotifier(m_term[0], QSocketNotifier::Read );
101 connect(m_proc, SIGNAL(activated(int) ), 101 connect(m_proc, SIGNAL(activated(int) ),
102 this, SLOT(slotExec() ) ); 102 this, SLOT(slotExec() ) );
103 103
104 } 104 }
105 break; 105 break;
106 106
107 } 107 }
108 108
109} 109}
110void FileReceive::cancel() { 110void FileReceive::cancel() {
111 ::kill(m_pid, 9 ); 111 ::kill(m_pid, 9 );
112} 112}
113void FileReceive::setupChild() { 113void FileReceive::setupChild() {
114 changeDir( currentDir() ); 114 changeDir( currentDir() );
115 /* 115 /*
116 * we do not want to read from our 116 * we do not want to read from our
117 * information channel 117 * information channel
118 */ 118 */
119 if (m_info[0] ) 119 if (m_info[0] )
120 close(m_info[0] ); 120 close(m_info[0] );
121 /* 121 /*
122 * FD_CLOEXEC will close the 122 * FD_CLOEXEC will close the
123 * fd on successfull exec 123 * fd on successful exec
124 */ 124 */
125 if (m_info[1] ) 125 if (m_info[1] )
126 fcntl(m_info[1], F_SETFD, FD_CLOEXEC ); 126 fcntl(m_info[1], F_SETFD, FD_CLOEXEC );
127 127
128 if (m_comm[0] ) 128 if (m_comm[0] )
129 close( m_comm[0] ); 129 close( m_comm[0] );
130 /* 130 /*
131 * now set the communication 131 * now set the communication
132 * m_fd STDIN_FILENO 132 * m_fd STDIN_FILENO
133 * STDOUT_FILENO 133 * STDOUT_FILENO
134 * STDERR_FILENO 134 * STDERR_FILENO
135 */ 135 */
136 dup2( m_fd, STDIN_FILENO ); 136 dup2( m_fd, STDIN_FILENO );
137 dup2( m_fd, STDOUT_FILENO ); 137 dup2( m_fd, STDOUT_FILENO );
138 dup2( m_comm[1], STDERR_FILENO ); 138 dup2( m_comm[1], STDERR_FILENO );
139} 139}
140void FileReceive::slotRead() { 140void FileReceive::slotRead() {
141 QByteArray ar(4096); 141 QByteArray ar(4096);
142 int len = read(m_comm[0], ar.data(), 4096 ); 142 int len = read(m_comm[0], ar.data(), 4096 );
143 for (int i = 0; i < len; i++ ) { 143 for (int i = 0; i < len; i++ ) {
144 // printf("%c", ar[i] ); 144 // printf("%c", ar[i] );
145 } 145 }
146 ar.resize( len ); 146 ar.resize( len );
147 QString str( ar ); 147 QString str( ar );
148} 148}
149void FileReceive::slotExec() { 149void FileReceive::slotExec() {
150 char buf[2]; 150 char buf[2];
151 ::read(m_term[0], buf, 1 ); 151 ::read(m_term[0], buf, 1 );
152 delete m_proc; 152 delete m_proc;
153 delete m_not; 153 delete m_not;
154 m_not = m_proc = 0l; 154 m_not = m_proc = 0l;
155 close( m_term[0] ); 155 close( m_term[0] );
156 close( m_term[1] ); 156 close( m_term[1] );
157 close( m_comm[0] ); 157 close( m_comm[0] );
158 close( m_comm[1] ); 158 close( m_comm[1] );
159 layer()->closeRawIO(m_fd); 159 layer()->closeRawIO(m_fd);
160 emit received(QString::null); 160 emit received(QString::null);
161 161
162} 162}
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
@@ -48,193 +48,193 @@ void FileTransfer::sendFile( const QString& file ) {
48 m_pid = fork(); 48 m_pid = fork();
49 switch( m_pid ) { 49 switch( m_pid ) {
50 case -1: 50 case -1:
51 emit error( StartError, tr("Was not able to fork") ); 51 emit error( StartError, tr("Was not able to fork") );
52 slotExec(); 52 slotExec();
53 break; 53 break;
54 case 0:{ 54 case 0:{
55 setupChild(); 55 setupChild();
56 /* exec */ 56 /* exec */
57 char* verbose = "-vv"; 57 char* verbose = "-vv";
58 char* binray = "-b"; 58 char* binray = "-b";
59 59
60 60
61 char* typus; 61 char* typus;
62 switch(m_type ) { 62 switch(m_type ) {
63 default: 63 default:
64 case SZ: 64 case SZ:
65 typus = ""; 65 typus = "";
66 break; 66 break;
67 case SX: 67 case SX:
68 typus = "-X"; 68 typus = "-X";
69 break; 69 break;
70 case SY: 70 case SY:
71 typus = "--ymodem"; 71 typus = "--ymodem";
72 break; 72 break;
73 } 73 }
74 74
75 /* we should never return from here */ 75 /* we should never return from here */
76 execlp("sz", "sz", verbose, binray, file.latin1(), typus, NULL ); 76 execlp("sz", "sz", verbose, binray, file.latin1(), typus, NULL );
77 77
78 /* communication for error!*/ 78 /* communication for error!*/
79 char resultByte =1; 79 char resultByte =1;
80 if (m_info[1] ) 80 if (m_info[1] )
81 write(m_info[1], &resultByte, 1 ); 81 write(m_info[1], &resultByte, 1 );
82 _exit( -1 ); 82 _exit( -1 );
83 break; 83 break;
84 } 84 }
85 default:{ 85 default:{
86 if ( m_info[1] ) 86 if ( m_info[1] )
87 close( m_info[1] ); 87 close( m_info[1] );
88 if ( m_info[0] ) for (;;) { 88 if ( m_info[0] ) for (;;) {
89 char resultByte; int len; 89 char resultByte; int len;
90 len = read(m_info[0], &resultByte, 1 ); 90 len = read(m_info[0], &resultByte, 1 );
91 /* len == 1 start up failed */ 91 /* len == 1 start up failed */
92 if ( len == 1 ) { 92 if ( len == 1 ) {
93 emit error( StartError, tr("Could not start") ); 93 emit error( StartError, tr("Could not start") );
94 return; 94 return;
95 } 95 }
96 if ( len == -1 ) 96 if ( len == -1 )
97 if ( (errno == ECHILD ) || (errno == EINTR ) ) 97 if ( (errno == ECHILD ) || (errno == EINTR ) )
98 continue; 98 continue;
99 99
100 // len == 0 or something like this 100 // len == 0 or something like this
101 break; 101 break;
102 } 102 }
103 if ( m_info[0] ) 103 if ( m_info[0] )
104 close( m_info[0] ); 104 close( m_info[0] );
105 105
106 106
107 107
108 /* replace by QSocketNotifier!!! */ 108 /* replace by QSocketNotifier!!! */
109 m_not = new QSocketNotifier(m_comm[0], QSocketNotifier::Read ); 109 m_not = new QSocketNotifier(m_comm[0], QSocketNotifier::Read );
110 connect(m_not, SIGNAL(activated(int) ), 110 connect(m_not, SIGNAL(activated(int) ),
111 this, SLOT(slotRead() ) ); 111 this, SLOT(slotRead() ) );
112 if ( pipe(m_term) < 0 ) 112 if ( pipe(m_term) < 0 )
113 m_term[0] = m_term[1] = 0; 113 m_term[0] = m_term[1] = 0;
114 114
115 ProcCtl::self()->add(m_pid, m_term[1] ); 115 ProcCtl::self()->add(m_pid, m_term[1] );
116 m_proc = new QSocketNotifier(m_term[0], QSocketNotifier::Read ); 116 m_proc = new QSocketNotifier(m_term[0], QSocketNotifier::Read );
117 connect(m_proc, SIGNAL(activated(int) ), 117 connect(m_proc, SIGNAL(activated(int) ),
118 this, SLOT(slotExec() ) ); 118 this, SLOT(slotExec() ) );
119 119
120 } 120 }
121 break; 121 break;
122 } 122 }
123} 123}
124/* 124/*
125 * let's call the one with the filename 125 * let's call the one with the filename
126 */ 126 */
127void FileTransfer::sendFile( const QFile& file ) { 127void FileTransfer::sendFile( const QFile& file ) {
128 sendFile( file.name() ); 128 sendFile( file.name() );
129} 129}
130 130
131/* 131/*
132 * setting up communication 132 * setting up communication
133 * between parent child and ioLayer 133 * between parent child and ioLayer
134 */ 134 */
135void FileTransfer::setupChild() { 135void FileTransfer::setupChild() {
136 /* 136 /*
137 * we do not want to read from our 137 * we do not want to read from our
138 * information channel 138 * information channel
139 */ 139 */
140 if (m_info[0] ) 140 if (m_info[0] )
141 close(m_info[0] ); 141 close(m_info[0] );
142 /* 142 /*
143 * FD_CLOEXEC will close the 143 * FD_CLOEXEC will close the
144 * fd on successfull exec 144 * fd on successful exec
145 */ 145 */
146 if (m_info[1] ) 146 if (m_info[1] )
147 fcntl(m_info[1], F_SETFD, FD_CLOEXEC ); 147 fcntl(m_info[1], F_SETFD, FD_CLOEXEC );
148 148
149 if (m_comm[0] ) 149 if (m_comm[0] )
150 close( m_comm[0] ); 150 close( m_comm[0] );
151 /* 151 /*
152 * now set the communication 152 * now set the communication
153 * m_fd STDIN_FILENO 153 * m_fd STDIN_FILENO
154 * STDOUT_FILENO 154 * STDOUT_FILENO
155 * STDERR_FILENO 155 * STDERR_FILENO
156 */ 156 */
157 dup2( m_fd, STDIN_FILENO ); 157 dup2( m_fd, STDIN_FILENO );
158 dup2( m_fd, STDOUT_FILENO ); 158 dup2( m_fd, STDOUT_FILENO );
159 dup2( m_comm[1], STDERR_FILENO ); 159 dup2( m_comm[1], STDERR_FILENO );
160} 160}
161 161
162/* 162/*
163 * read from the stderr of the child 163 * read from the stderr of the child
164 * process 164 * process
165 */ 165 */
166void FileTransfer::slotRead() { 166void FileTransfer::slotRead() {
167 QByteArray ar(4096); 167 QByteArray ar(4096);
168 int len = read(m_comm[0], ar.data(), 4096 ); 168 int len = read(m_comm[0], ar.data(), 4096 );
169 for (int i = 0; i < len; i++ ) { 169 for (int i = 0; i < len; i++ ) {
170 // printf("%c", ar[i] ); 170 // printf("%c", ar[i] );
171 } 171 }
172 ar.resize( len ); 172 ar.resize( len );
173 QString str( ar ); 173 QString str( ar );
174 QStringList lis = QStringList::split(' ', str ); 174 QStringList lis = QStringList::split(' ', str );
175 /* 175 /*
176 * Transfer finished.. either complete or incomplete 176 * Transfer finished.. either complete or incomplete
177 */ 177 */
178 if ( lis[0].simplifyWhiteSpace() == "Transfer" ) { 178 if ( lis[0].simplifyWhiteSpace() == "Transfer" ) {
179 return; 179 return;
180 } 180 }
181 /* 181 /*
182 * do progress reading 182 * do progress reading
183 */ 183 */
184 slotProgress( lis ); 184 slotProgress( lis );
185 185
186 186
187} 187}
188/* 188/*
189 * find the progress 189 * find the progress
190 */ 190 */
191void FileTransfer::slotProgress( const QStringList& list ) { 191void FileTransfer::slotProgress( const QStringList& list ) {
192 if ( m_type != SZ ) 192 if ( m_type != SZ )
193 return; 193 return;
194 bool complete = true; 194 bool complete = true;
195 int min, sec; 195 int min, sec;
196 int bps; 196 int bps;
197 unsigned long sent, total; 197 unsigned long sent, total;
198 198
199 min = sec = bps = -1; 199 min = sec = bps = -1;
200 sent = total = 0; 200 sent = total = 0;
201 201
202 // Data looks like this 202 // Data looks like this
203 // 0 1 2 3 4 5 203 // 0 1 2 3 4 5
204 // Bytes Sent 65536/11534336 BPS:7784 ETA 24:33 204 // Bytes Sent 65536/11534336 BPS:7784 ETA 24:33
205 QStringList progi = QStringList::split('/', list[2].simplifyWhiteSpace() ); 205 QStringList progi = QStringList::split('/', list[2].simplifyWhiteSpace() );
206 sent = progi[0].toULong(&complete ); 206 sent = progi[0].toULong(&complete );
207 if (!complete ) return; 207 if (!complete ) return;
208 208
209 total = progi[1].toULong(&complete ); 209 total = progi[1].toULong(&complete );
210 if (!complete || total == 0) { 210 if (!complete || total == 0) {
211 return; 211 return;
212 } 212 }
213 213
214 214
215 double pro = (double)sent/total; 215 double pro = (double)sent/total;
216 int prog = pro * 100; 216 int prog = pro * 100;
217 217
218 // speed 218 // speed
219 progi = QStringList::split(':', list[3].simplifyWhiteSpace() ); 219 progi = QStringList::split(':', list[3].simplifyWhiteSpace() );
220 bps = progi[1].toInt(); 220 bps = progi[1].toInt();
221 221
222 // time 222 // time
223 progi = QStringList::split(':', list[5].simplifyWhiteSpace() ); 223 progi = QStringList::split(':', list[5].simplifyWhiteSpace() );
224 min = progi[0].toInt(); 224 min = progi[0].toInt();
225 sec = progi[1].toInt(); 225 sec = progi[1].toInt();
226 226
227 227
228 if ( prog > m_prog ) { 228 if ( prog > m_prog ) {
229 m_prog = prog; 229 m_prog = prog;
230 emit progress(m_file, m_prog, bps, -1, min , sec ); 230 emit progress(m_file, m_prog, bps, -1, min , sec );
231 } 231 }
232 232
233} 233}
234void FileTransfer::cancel() { 234void FileTransfer::cancel() {
235 if(m_pid > 0) ::kill(m_pid,9 ); 235 if(m_pid > 0) ::kill(m_pid,9 );
236 236
237} 237}
238void FileTransfer::slotExec() { 238void FileTransfer::slotExec() {
239 char buf[2]; 239 char buf[2];
240 ::read(m_term[0], buf, 1 ); 240 ::read(m_term[0], buf, 1 );
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
@@ -662,193 +662,193 @@ void OpieFtp::populateLocalView()
662 fileDate= fi->lastModified().toString(); 662 fileDate= fi->lastModified().toString();
663 if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { 663 if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) {
664 fileL+="/"; 664 fileL+="/";
665 isDir=TRUE; 665 isDir=TRUE;
666// qDebug( fileL); 666// qDebug( fileL);
667 } 667 }
668 } 668 }
669 if(fileL !="./" && fi->exists()) { 669 if(fileL !="./" && fi->exists()) {
670 item = new QListViewItem( Local_View,fileL, fileDate, fileS ); 670 item = new QListViewItem( Local_View,fileL, fileDate, fileS );
671 QPixmap pm; 671 QPixmap pm;
672 672
673 if(isDir || fileL.find("/",0,TRUE) != -1) { 673 if(isDir || fileL.find("/",0,TRUE) != -1) {
674 if( !QDir( fi->filePath() ).isReadable()) 674 if( !QDir( fi->filePath() ).isReadable())
675 pm = Resource::loadPixmap( "lockedfolder" ); 675 pm = Resource::loadPixmap( "lockedfolder" );
676 else 676 else
677 pm= Resource::loadPixmap( "folder" ); 677 pm= Resource::loadPixmap( "folder" );
678 item->setPixmap( 0,pm ); 678 item->setPixmap( 0,pm );
679 } else { 679 } else {
680 if( !fi->isReadable() ) 680 if( !fi->isReadable() )
681 pm = Resource::loadPixmap( "locked" ); 681 pm = Resource::loadPixmap( "locked" );
682 else { 682 else {
683 MimeType mt(fi->filePath()); 683 MimeType mt(fi->filePath());
684 pm=mt.pixmap(); //sets the correct pixmap for mimetype 684 pm=mt.pixmap(); //sets the correct pixmap for mimetype
685 if(pm.isNull()) 685 if(pm.isNull())
686 pm = unknownXpm; 686 pm = unknownXpm;
687 } 687 }
688 } 688 }
689 if( fileL.find("->",0,TRUE) != -1) { 689 if( fileL.find("->",0,TRUE) != -1) {
690 // overlay link image 690 // overlay link image
691 pm= Resource::loadPixmap( "folder" ); 691 pm= Resource::loadPixmap( "folder" );
692 QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); 692 QPixmap lnk = Resource::loadPixmap( "opie/symlink" );
693 QPainter painter( &pm ); 693 QPainter painter( &pm );
694 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); 694 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk );
695 pm.setMask( pm.createHeuristicMask( FALSE ) ); 695 pm.setMask( pm.createHeuristicMask( FALSE ) );
696 } 696 }
697 item->setPixmap( 0,pm); 697 item->setPixmap( 0,pm);
698 } 698 }
699 isDir=FALSE; 699 isDir=FALSE;
700 ++it; 700 ++it;
701 } 701 }
702 Local_View->setSorting( 3,FALSE); 702 Local_View->setSorting( 3,FALSE);
703 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath() ); 703 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath() );
704 fillCombo( (const QString &)currentDir); 704 fillCombo( (const QString &)currentDir);
705} 705}
706 706
707bool OpieFtp::populateRemoteView( ) 707bool OpieFtp::populateRemoteView( )
708{ 708{
709// qDebug("populate remoteview"); 709// qDebug("populate remoteview");
710 QString sfile=QDir::homeDirPath(); 710 QString sfile=QDir::homeDirPath();
711 if(sfile.right(1) != "/") 711 if(sfile.right(1) != "/")
712 sfile+="/._temp"; 712 sfile+="/._temp";
713 else 713 else
714 sfile+="._temp"; 714 sfile+="._temp";
715 QFile file( sfile); 715 QFile file( sfile);
716 Remote_View->clear(); 716 Remote_View->clear();
717 QString s, File_Name; 717 QString s, File_Name;
718 QListViewItem *itemDir=NULL, *itemFile=NULL; 718 QListViewItem *itemDir=NULL, *itemFile=NULL;
719 QRegExp monthRe(" [JFMASOND][eapuecoe][brynlgptvc] [ 0-9][0-9] [ 0-9][0-9][:0-9][0-9][0-9] "); 719 QRegExp monthRe(" [JFMASOND][eapuecoe][brynlgptvc] [ 0-9][0-9] [ 0-9][0-9][:0-9][0-9][0-9] ");
720 QString fileL, fileS, fileDate; 720 QString fileL, fileS, fileDate;
721 if ( file.open(IO_ReadOnly)) { 721 if ( file.open(IO_ReadOnly)) {
722 QTextStream t( &file ); // use a text stream 722 QTextStream t( &file ); // use a text stream
723 while ( !t.eof()) { 723 while ( !t.eof()) {
724 s = t.readLine(); 724 s = t.readLine();
725 725
726 if(s.find("total",0,TRUE) == 0) 726 if(s.find("total",0,TRUE) == 0)
727 continue; 727 continue;
728 728
729 int len, month = monthRe.match(s, 0, &len); 729 int len, month = monthRe.match(s, 0, &len);
730 fileDate = s.mid(month + 1, len - 2); // minus spaces 730 fileDate = s.mid(month + 1, len - 2); // minus spaces
731 fileL = s.right(s.length() - month - len); 731 fileL = s.right(s.length() - month - len);
732 if(s.left(1) == "d") 732 if(s.left(1) == "d")
733 fileL = fileL+"/"; 733 fileL = fileL+"/";
734 fileS = s.mid(month - 8, 8); // FIXME 734 fileS = s.mid(month - 8, 8); // FIXME
735 fileS = fileS.stripWhiteSpace(); 735 fileS = fileS.stripWhiteSpace();
736 736
737 if(s.left(1) == "d" || fileL.find("/",0,TRUE) != -1) { 737 if(s.left(1) == "d" || fileL.find("/",0,TRUE) != -1) {
738 QListViewItem * item = new QListViewItem( Remote_View, fileL, fileDate, fileS,"d"); 738 QListViewItem * item = new QListViewItem( Remote_View, fileL, fileDate, fileS,"d");
739 item->setPixmap( 0, Resource::loadPixmap( "folder" )); 739 item->setPixmap( 0, Resource::loadPixmap( "folder" ));
740// if(itemDir) 740// if(itemDir)
741 item->moveItem(itemDir); 741 item->moveItem(itemDir);
742 itemDir=item; 742 itemDir=item;
743 } else { 743 } else {
744 QListViewItem * item = new QListViewItem( Remote_View, fileL, fileDate, fileS,"f"); 744 QListViewItem * item = new QListViewItem( Remote_View, fileL, fileDate, fileS,"f");
745 item->setPixmap( 0, Resource::loadPixmap( "fileopen" )); 745 item->setPixmap( 0, Resource::loadPixmap( "fileopen" ));
746// if(itemFile) 746// if(itemFile)
747 item->moveItem(itemDir); 747 item->moveItem(itemDir);
748 item->moveItem(itemFile); 748 item->moveItem(itemFile);
749 itemFile=item; 749 itemFile=item;
750 } 750 }
751 } 751 }
752 QListViewItem * item1 = new QListViewItem( Remote_View, "../"); 752 QListViewItem * item1 = new QListViewItem( Remote_View, "../");
753 item1->setPixmap( 0, Resource::loadPixmap( "folder" )); 753 item1->setPixmap( 0, Resource::loadPixmap( "folder" ));
754 file.close(); 754 file.close();
755 if( file.exists()) 755 if( file.exists())
756 file. remove(); 756 file. remove();
757 } else 757 } else
758 qDebug("temp file not opened successfullly "+sfile); 758 qDebug("temp file not opened successfully "+sfile);
759 Remote_View->setSorting( 4,TRUE); 759 Remote_View->setSorting( 4,TRUE);
760 return true; 760 return true;
761} 761}
762 762
763void OpieFtp::remoteListClicked(QListViewItem *selectedItem) 763void OpieFtp::remoteListClicked(QListViewItem *selectedItem)
764{ 764{
765 if( selectedItem) { 765 if( selectedItem) {
766 // if(selectedItem!= NULL) { 766 // if(selectedItem!= NULL) {
767// QCopEnvelope ( "QPE/System", "busy()" ); 767// QCopEnvelope ( "QPE/System", "busy()" );
768 QString oldRemoteCurrentDir = currentRemoteDir; 768 QString oldRemoteCurrentDir = currentRemoteDir;
769 QString strItem=selectedItem->text(0); 769 QString strItem=selectedItem->text(0);
770 strItem=strItem.simplifyWhiteSpace(); 770 strItem=strItem.simplifyWhiteSpace();
771 if(strItem == "../") { // the user wants to go ^ 771 if(strItem == "../") { // the user wants to go ^
772 if( FtpCDUp( conn) == 0) { 772 if( FtpCDUp( conn) == 0) {
773 QString msg; 773 QString msg;
774 msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn)); 774 msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn));
775 msg.replace(QRegExp(":"),"\n"); 775 msg.replace(QRegExp(":"),"\n");
776 QMessageBox::message(tr("Note"),msg); 776 QMessageBox::message(tr("Note"),msg);
777// qDebug(msg); 777// qDebug(msg);
778 } 778 }
779 char path[256]; 779 char path[256];
780 if( FtpPwd( path,sizeof(path),conn) == 0) { //this is easier than fudging the string 780 if( FtpPwd( path,sizeof(path),conn) == 0) { //this is easier than fudging the string
781 QString msg; 781 QString msg;
782 msg.sprintf(tr("Unable to get working dir\n")+"%s",FtpLastResponse(conn)); 782 msg.sprintf(tr("Unable to get working dir\n")+"%s",FtpLastResponse(conn));
783 msg.replace(QRegExp(":"),"\n"); 783 msg.replace(QRegExp(":"),"\n");
784 QMessageBox::message(tr("Note"),msg); 784 QMessageBox::message(tr("Note"),msg);
785// qDebug(msg); 785// qDebug(msg);
786 } 786 }
787 currentRemoteDir=path; 787 currentRemoteDir=path;
788 } else { 788 } else {
789 if(strItem.find("->",0,TRUE) != -1) { //symlink on some servers 789 if(strItem.find("->",0,TRUE) != -1) { //symlink on some servers
790 strItem=strItem.right( strItem.length() - strItem.find("->",0,TRUE) - 2 ); 790 strItem=strItem.right( strItem.length() - strItem.find("->",0,TRUE) - 2 );
791 strItem = strItem.stripWhiteSpace(); 791 strItem = strItem.stripWhiteSpace();
792 currentRemoteDir = strItem; 792 currentRemoteDir = strItem;
793 if( !remoteChDir( (const QString &)strItem)) { 793 if( !remoteChDir( (const QString &)strItem)) {
794 currentRemoteDir = oldRemoteCurrentDir; 794 currentRemoteDir = oldRemoteCurrentDir;
795 strItem=""; 795 strItem="";
796// qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); 796// qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir);
797 } 797 }
798 } else if(strItem.find("/",0,TRUE) != -1) { // this is a directory 798 } else if(strItem.find("/",0,TRUE) != -1) { // this is a directory
799 if( !remoteChDir( (const QString &)currentRemoteDir + strItem)) { 799 if( !remoteChDir( (const QString &)currentRemoteDir + strItem)) {
800 currentRemoteDir = oldRemoteCurrentDir; 800 currentRemoteDir = oldRemoteCurrentDir;
801 strItem=""; 801 strItem="";
802// qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); 802// qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir);
803 803
804 } else { 804 } else {
805 currentRemoteDir = currentRemoteDir+strItem; 805 currentRemoteDir = currentRemoteDir+strItem;
806 } 806 }
807 } else { 807 } else {
808// QCopEnvelope ( "QPE/System", "notBusy()" ); 808// QCopEnvelope ( "QPE/System", "notBusy()" );
809 return; 809 return;
810 } 810 }
811 } 811 }
812 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate 812 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
813 if(currentRemoteDir.right(1) !="/") 813 if(currentRemoteDir.right(1) !="/")
814 currentRemoteDir +="/"; 814 currentRemoteDir +="/";
815 currentPathCombo->lineEdit()->setText( currentRemoteDir); 815 currentPathCombo->lineEdit()->setText( currentRemoteDir);
816 fillRemoteCombo( (const QString &)currentRemoteDir); 816 fillRemoteCombo( (const QString &)currentRemoteDir);
817// QCopEnvelope ( "QPE/System", "notBusy()" ); 817// QCopEnvelope ( "QPE/System", "notBusy()" );
818 Remote_View->ensureItemVisible(Remote_View->firstChild()); 818 Remote_View->ensureItemVisible(Remote_View->firstChild());
819 819
820 } 820 }
821} 821}
822 822
823void OpieFtp::localListClicked(QListViewItem *selectedItem) 823void OpieFtp::localListClicked(QListViewItem *selectedItem)
824{ 824{
825 if(selectedItem!= NULL) { 825 if(selectedItem!= NULL) {
826 826
827 QString strItem=selectedItem->text(0); 827 QString strItem=selectedItem->text(0);
828 QString strSize=selectedItem->text(1); 828 QString strSize=selectedItem->text(1);
829 strSize=strSize.stripWhiteSpace(); 829 strSize=strSize.stripWhiteSpace();
830 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink 830 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink
831 // is symlink 831 // is symlink
832 QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); 832 QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4);
833 if(QDir(strItem2).exists() ) { 833 if(QDir(strItem2).exists() ) {
834 currentDir.cd(strItem2, TRUE); 834 currentDir.cd(strItem2, TRUE);
835 populateLocalView(); 835 populateLocalView();
836 } 836 }
837 } else { // not a symlink 837 } else { // not a symlink
838 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { 838 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) {
839 839
840 if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { 840 if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) {
841 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); 841 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem);
842 currentDir.cd(strItem,FALSE); 842 currentDir.cd(strItem,FALSE);
843 populateLocalView(); 843 populateLocalView();
844 } else { 844 } else {
845 currentDir.cdUp(); 845 currentDir.cdUp();
846 populateLocalView(); 846 populateLocalView();
847 } 847 }
848 if(QDir(strItem).exists()){ 848 if(QDir(strItem).exists()){
849 currentDir.cd(strItem, TRUE); 849 currentDir.cd(strItem, TRUE);
850 populateLocalView(); 850 populateLocalView();
851 } 851 }
852 } else { 852 } else {
853 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); 853 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem);
854 if( QFile::exists(strItem ) ) { 854 if( QFile::exists(strItem ) ) {
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
@@ -195,277 +195,277 @@ void BackupAndRestore::scanForApplicationSettings()
195 if ( ( fi->fileName() != "." ) && ( fi->fileName() != ".." ) ) 195 if ( ( fi->fileName() != "." ) && ( fi->fileName() != ".." ) )
196 { 196 {
197 QListViewItem *newItem = new QListViewItem(applicationSettings, fi->fileName()); 197 QListViewItem *newItem = new QListViewItem(applicationSettings, fi->fileName());
198 selectItem(newItem); 198 selectItem(newItem);
199 } 199 }
200 ++it; 200 ++it;
201 } 201 }
202} 202}
203 203
204/** 204/**
205 * The "Backup" button has been pressed. Get a list of all of the files that 205 * The "Backup" button has been pressed. Get a list of all of the files that
206 * should be backed up. If there are no files, emit and error and exit. 206 * should be backed up. If there are no files, emit and error and exit.
207 * Determine the file name to store the backup in. Backup the file(s) using 207 * Determine the file name to store the backup in. Backup the file(s) using
208 * tar and gzip --best. Report failure or success 208 * tar and gzip --best. Report failure or success
209 */ 209 */
210void BackupAndRestore::backup() 210void BackupAndRestore::backup()
211{ 211{
212 QString backupFiles; 212 QString backupFiles;
213 if(getBackupFiles(backupFiles, NULL) == 0) 213 if(getBackupFiles(backupFiles, NULL) == 0)
214 { 214 {
215 QMessageBox::critical(this, "Message", 215 QMessageBox::critical(this, "Message",
216 "No items selected.",QString("Ok") ); 216 "No items selected.",QString("Ok") );
217 return; 217 return;
218 } 218 }
219 219
220 setCaption(tr("Backup and Restore... working...")); 220 setCaption(tr("Backup and Restore... working..."));
221 QString outputFile = backupLocations[storeToLocation->currentText()]; 221 QString outputFile = backupLocations[storeToLocation->currentText()];
222 222
223 QDateTime datetime = QDateTime::currentDateTime(); 223 QDateTime datetime = QDateTime::currentDateTime();
224 QString dateString = QString::number( datetime.date().year() ) + QString::number( datetime.date().month() ).rightJustify(2, '0') + 224 QString dateString = QString::number( datetime.date().year() ) + QString::number( datetime.date().month() ).rightJustify(2, '0') +
225 QString::number( datetime.date().day() ).rightJustify(2, '0'); 225 QString::number( datetime.date().day() ).rightJustify(2, '0');
226 226
227 outputFile += "/" + dateString; 227 outputFile += "/" + dateString;
228 228
229 QString t = outputFile; 229 QString t = outputFile;
230 int c = 1; 230 int c = 1;
231 while(QFile::exists(outputFile + EXTENSION)) 231 while(QFile::exists(outputFile + EXTENSION))
232 { 232 {
233 outputFile = t + QString("%1").arg(c); 233 outputFile = t + QString("%1").arg(c);
234 c++; 234 c++;
235 } 235 }
236 236
237 // We execute tar and compressing its output with gzip.. 237 // We execute tar and compressing its output with gzip..
238 // The error output will be written into a temp-file which could be provided 238 // The error output will be written into a temp-file which could be provided
239 // for debugging.. 239 // for debugging..
240 qDebug( "Storing file: %s", outputFile.latin1() ); 240 qDebug( "Storing file: %s", outputFile.latin1() );
241 outputFile += EXTENSION; 241 outputFile += EXTENSION;
242 242
243 QString commandLine = QString( "(tar -C %1 -c %2 | gzip > %3 ) 2> %4" ).arg( QDir::homeDirPath() ) 243 QString commandLine = QString( "(tar -C %1 -c %2 | gzip > %3 ) 2> %4" ).arg( QDir::homeDirPath() )
244 .arg( backupFiles ) 244 .arg( backupFiles )
245 .arg( outputFile.latin1() ) 245 .arg( outputFile.latin1() )
246 .arg( tempFileName.latin1() ); 246 .arg( tempFileName.latin1() );
247 247
248 qDebug( commandLine ); 248 qDebug( commandLine );
249 249
250 int r = system( commandLine ); 250 int r = system( commandLine );
251 251
252 if(r != 0) 252 if(r != 0)
253 { 253 {
254 perror("Error: "); 254 perror("Error: ");
255 QString errorMsg= tr( "Error from System:\n" ) + (QString)strerror( errno ); 255 QString errorMsg= tr( "Error from System:\n" ) + (QString)strerror( errno );
256 256
257 switch( QMessageBox::critical(this, tr( "Message" ), tr( "Backup Failed!" ) + "\n" 257 switch( QMessageBox::critical(this, tr( "Message" ), tr( "Backup Failed!" ) + "\n"
258 + errorMsg, QString( tr( "Ok" ) ), QString( tr( "Details" ) ) ) ) 258 + errorMsg, QString( tr( "Ok" ) ), QString( tr( "Details" ) ) ) )
259 { 259 {
260 260
261 case 1: 261 case 1:
262 qWarning("Details pressed !"); 262 qWarning("Details pressed !");
263 ErrorDialog* pErrDialog = new ErrorDialog( this, NULL, true ); 263 ErrorDialog* pErrDialog = new ErrorDialog( this, NULL, true );
264 QFile errorFile( tempFileName ); 264 QFile errorFile( tempFileName );
265 if ( errorFile.open(IO_ReadOnly) ) 265 if ( errorFile.open(IO_ReadOnly) )
266 { 266 {
267 QTextStream t( &errorFile ); 267 QTextStream t( &errorFile );
268 QString s; 268 QString s;
269 while ( !t.eof() ) 269 while ( !t.eof() )
270 { // until end of file... 270 { // until end of file...
271 s += t.readLine(); // line of text excluding '\n' 271 s += t.readLine(); // line of text excluding '\n'
272 } 272 }
273 errorFile.close(); 273 errorFile.close();
274 274
275 pErrDialog->m_textarea->setText( s ); 275 pErrDialog->m_textarea->setText( s );
276 } 276 }
277 else 277 else
278 { 278 {
279 pErrDialog->m_textarea->setText( "Unable to open File: /tmp/backup.er" ); 279 pErrDialog->m_textarea->setText( "Unable to open File: /tmp/backup.er" );
280 } 280 }
281 pErrDialog->showMaximized(); 281 pErrDialog->showMaximized();
282 pErrDialog->exec(); 282 pErrDialog->exec();
283 delete pErrDialog; 283 delete pErrDialog;
284 break; 284 break;
285 } 285 }
286 setCaption(tr("Backup and Restore.. Failed !!")); 286 setCaption(tr("Backup and Restore.. Failed !!"));
287 return; 287 return;
288 } 288 }
289 else 289 else
290 { 290 {
291 QMessageBox::information(this, tr( "Message" ), tr( "Backup Successfull." ), QString(tr( "Ok" ) ) ); 291 QMessageBox::information(this, tr( "Message" ), tr( "Backup Successful." ), QString(tr( "Ok" ) ) );
292 292
293 } 293 }
294 294
295 //write store-location 295 //write store-location
296 Config config( "BackupAndRestore" ); 296 Config config( "BackupAndRestore" );
297 config.setGroup( "LastLocation" ); 297 config.setGroup( "LastLocation" );
298 config.writeEntry( "LastStoreLocation", storeToLocation->currentText() ); 298 config.writeEntry( "LastStoreLocation", storeToLocation->currentText() );
299 299
300 setCaption(tr("Backup and Restore")); 300 setCaption(tr("Backup and Restore"));
301} 301}
302 302
303/*** 303/***
304 * Get a list of all of the files to backup. 304 * Get a list of all of the files to backup.
305 */ 305 */
306int BackupAndRestore::getBackupFiles(QString &backupFiles, QListViewItem *parent) 306int BackupAndRestore::getBackupFiles(QString &backupFiles, QListViewItem *parent)
307{ 307{
308 QListViewItem * currentItem; 308 QListViewItem * currentItem;
309 QString currentHome; 309 QString currentHome;
310 if(!parent) 310 if(!parent)
311 currentItem = backupList->firstChild(); 311 currentItem = backupList->firstChild();
312 else 312 else
313 { 313 {
314 currentItem = parent->firstChild(); 314 currentItem = parent->firstChild();
315 currentHome = parent->text(BACKUP_LOCATION); 315 currentHome = parent->text(BACKUP_LOCATION);
316 } 316 }
317 317
318 uint count = 0; 318 uint count = 0;
319 while( currentItem != 0 ) 319 while( currentItem != 0 )
320 { 320 {
321 if(currentItem->text(HEADER_BACKUP) == "B" ) 321 if(currentItem->text(HEADER_BACKUP) == "B" )
322 { 322 {
323 if(currentItem->childCount() == 0 ) 323 if(currentItem->childCount() == 0 )
324 { 324 {
325 if(parent == NULL) 325 if(parent == NULL)
326 backupFiles += currentItem->text(BACKUP_LOCATION); 326 backupFiles += currentItem->text(BACKUP_LOCATION);
327 else 327 else
328 backupFiles += currentHome + currentItem->text(HEADER_NAME); 328 backupFiles += currentHome + currentItem->text(HEADER_NAME);
329 backupFiles += " "; 329 backupFiles += " ";
330 count++; 330 count++;
331 } 331 }
332 else 332 else
333 { 333 {
334 count += getBackupFiles(backupFiles, currentItem); 334 count += getBackupFiles(backupFiles, currentItem);
335 } 335 }
336 } 336 }
337 currentItem = currentItem->nextSibling(); 337 currentItem = currentItem->nextSibling();
338 } 338 }
339 return count; 339 return count;
340} 340}
341 341
342void BackupAndRestore::sourceDirChanged(int selection) 342void BackupAndRestore::sourceDirChanged(int selection)
343{ 343{
344 restoreList->clear(); 344 restoreList->clear();
345 rescanFolder(backupLocations[restoreSource->text(selection)]); 345 rescanFolder(backupLocations[restoreSource->text(selection)]);
346} 346}
347 347
348void BackupAndRestore::fileListUpdate() 348void BackupAndRestore::fileListUpdate()
349{ 349{
350 qWarning("void BackupAndRestore::fileListUpdate()"); 350 qWarning("void BackupAndRestore::fileListUpdate()");
351 restoreList->clear(); 351 restoreList->clear();
352 rescanFolder( backupLocations[restoreSource->currentText()] ); 352 rescanFolder( backupLocations[restoreSource->currentText()] );
353} 353}
354 354
355/** 355/**
356 * Scans directory for any backup files. Will recursivly go down, 356 * Scans directory for any backup files. Will recursivly go down,
357 * but will not follow symlinks. 357 * but will not follow symlinks.
358 * @param directory - the directory to look in. 358 * @param directory - the directory to look in.
359 */ 359 */
360void BackupAndRestore::rescanFolder(QString directory) 360void BackupAndRestore::rescanFolder(QString directory)
361{ 361{
362 //qDebug(QString("rescanFolder: ") + directory.latin1()); 362 //qDebug(QString("rescanFolder: ") + directory.latin1());
363 QDir d(directory); 363 QDir d(directory);
364 if(!d.exists()) 364 if(!d.exists())
365 return; 365 return;
366 366
367 d.setFilter( QDir::Files | QDir::Hidden | QDir::Dirs); 367 d.setFilter( QDir::Files | QDir::Hidden | QDir::Dirs);
368 const QFileInfoList *list = d.entryInfoList(); 368 const QFileInfoList *list = d.entryInfoList();
369 QFileInfoListIterator it( *list ); 369 QFileInfoListIterator it( *list );
370 QFileInfo *file; 370 QFileInfo *file;
371 while ( (file=it.current()) ) 371 while ( (file=it.current()) )
372 { // for each file... 372 { // for each file...
373 // If it is a dir and not .. or . then add it as a tab and go down. 373 // If it is a dir and not .. or . then add it as a tab and go down.
374 if(file->isDir()) 374 if(file->isDir())
375 { 375 {
376 if(file->fileName() != ".." && file->fileName() != ".") 376 if(file->fileName() != ".." && file->fileName() != ".")
377 { 377 {
378 rescanFolder(directory + "/" + file->fileName()); 378 rescanFolder(directory + "/" + file->fileName());
379 } 379 }
380 } 380 }
381 else 381 else
382 { 382 {
383 // If it is a backup file add to list. 383 // If it is a backup file add to list.
384 if(file->fileName().contains(EXTENSION)) 384 if(file->fileName().contains(EXTENSION))
385 (void)new QListViewItem(restoreList, file->fileName()); 385 (void)new QListViewItem(restoreList, file->fileName());
386 } 386 }
387 ++it; 387 ++it;
388 } 388 }
389} 389}
390 390
391/** 391/**
392 * Restore a backup file. 392 * Restore a backup file.
393 * Report errors or success 393 * Report errors or success
394 */ 394 */
395void BackupAndRestore::restore() 395void BackupAndRestore::restore()
396{ 396{
397 QListViewItem *restoreItem = restoreList->currentItem(); 397 QListViewItem *restoreItem = restoreList->currentItem();
398 if(!restoreItem) 398 if(!restoreItem)
399 { 399 {
400 QMessageBox::critical(this, tr( "Message" ), 400 QMessageBox::critical(this, tr( "Message" ),
401 tr( "Please select something to restore." ),QString( tr( "Ok") ) ); 401 tr( "Please select something to restore." ),QString( tr( "Ok") ) );
402 return; 402 return;
403 } 403 }
404 setCaption(tr("Backup and Restore... working...")); 404 setCaption(tr("Backup and Restore... working..."));
405 405
406 QString restoreFile = backupLocations[restoreSource->currentText()]; 406 QString restoreFile = backupLocations[restoreSource->currentText()];
407 407
408 restoreFile += "/" + restoreItem->text(0); 408 restoreFile += "/" + restoreItem->text(0);
409 409
410 qDebug( restoreFile ); 410 qDebug( restoreFile );
411 411
412 QString commandLine = QString( "tar -C %1 -zxf %2 2> %3" ).arg( QDir::homeDirPath() ) 412 QString commandLine = QString( "tar -C %1 -zxf %2 2> %3" ).arg( QDir::homeDirPath() )
413 .arg( restoreFile.latin1() ) 413 .arg( restoreFile.latin1() )
414 .arg( tempFileName.latin1() ); 414 .arg( tempFileName.latin1() );
415 415
416 qDebug( commandLine ); 416 qDebug( commandLine );
417 417
418 int r = system( commandLine ); 418 int r = system( commandLine );
419 419
420 if(r != 0) 420 if(r != 0)
421 { 421 {
422 QString errorMsg= tr( "Error from System:\n" ) + (QString)strerror( errno ); 422 QString errorMsg= tr( "Error from System:\n" ) + (QString)strerror( errno );
423 switch( QMessageBox::critical(this, tr( "Message" ), tr( "Restore Failed." ) + "\n" 423 switch( QMessageBox::critical(this, tr( "Message" ), tr( "Restore Failed." ) + "\n"
424 + errorMsg, QString( tr( "Ok") ), QString( tr( "Details" ) ) ) ) 424 + errorMsg, QString( tr( "Ok") ), QString( tr( "Details" ) ) ) )
425 { 425 {
426 case 1: 426 case 1:
427 qWarning("Details pressed !"); 427 qWarning("Details pressed !");
428 ErrorDialog* pErrDialog = new ErrorDialog( this, NULL, true ); 428 ErrorDialog* pErrDialog = new ErrorDialog( this, NULL, true );
429 QFile errorFile( tempFileName ); 429 QFile errorFile( tempFileName );
430 if ( errorFile.open(IO_ReadOnly) ) 430 if ( errorFile.open(IO_ReadOnly) )
431 { 431 {
432 QTextStream t( &errorFile ); 432 QTextStream t( &errorFile );
433 QString s; 433 QString s;
434 while ( !t.eof() ) 434 while ( !t.eof() )
435 { // until end of file... 435 { // until end of file...
436 s += t.readLine(); // line of text excluding '\n' 436 s += t.readLine(); // line of text excluding '\n'
437 } 437 }
438 errorFile.close(); 438 errorFile.close();
439 439
440 pErrDialog->m_textarea->setText( s ); 440 pErrDialog->m_textarea->setText( s );
441 } 441 }
442 else 442 else
443 { 443 {
444 pErrDialog->m_textarea->setText( tr( "Unable to open File: %1" ).arg( "/tmp/backup.er" ) ); 444 pErrDialog->m_textarea->setText( tr( "Unable to open File: %1" ).arg( "/tmp/backup.er" ) );
445 } 445 }
446 pErrDialog->showMaximized(); 446 pErrDialog->showMaximized();
447 pErrDialog->exec(); 447 pErrDialog->exec();
448 delete pErrDialog; 448 delete pErrDialog;
449 449
450 setCaption(tr("Backup and Restore.. Failed !!")); 450 setCaption(tr("Backup and Restore.. Failed !!"));
451 return; 451 return;
452 452
453 break; 453 break;
454 454
455 } 455 }
456 } 456 }
457 else 457 else
458 { 458 {
459 QMessageBox::information(this, tr( "Message" ), tr( "Restore Successfull." ), QString( tr( "Ok") ) ); 459 QMessageBox::information(this, tr( "Message" ), tr( "Restore Successful." ), QString( tr( "Ok") ) );
460 } 460 }
461 461
462 //write restore-location 462 //write restore-location
463 Config config( "BackupAndRestore" ); 463 Config config( "BackupAndRestore" );
464 config.setGroup( "LastLocation" ); 464 config.setGroup( "LastLocation" );
465 config.writeEntry( "LastRestoreLocation", restoreSource->currentText() ); 465 config.writeEntry( "LastRestoreLocation", restoreSource->currentText() );
466 466
467 setCaption(tr("Backup and Restore")); 467 setCaption(tr("Backup and Restore"));
468} 468}
469 469
470// backuprestore.cpp 470// backuprestore.cpp
471 471
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,216 +1,216 @@
1/** 1/**
2 * $Author$ 2 * $Author$
3 * $Date$ 3 * $Date$
4 */ 4 */
5 5
6#include "interface.h" 6#include "interface.h"
7#include <qdatetime.h> 7#include <qdatetime.h>
8#include <qfile.h> 8#include <qfile.h>
9#include <qdir.h> 9#include <qdir.h>
10#include <qfileinfo.h> 10#include <qfileinfo.h>
11#include <qtextstream.h> 11#include <qtextstream.h>
12 12
13#define IFCONFIG "/sbin/ifconfig" 13#define IFCONFIG "/sbin/ifconfig"
14#define DHCP_INFO_DIR "/etc/dhcpc" 14#define DHCP_INFO_DIR "/etc/dhcpc"
15 15
16#include <stdio.h> 16#include <stdio.h>
17#include <stdlib.h> 17#include <stdlib.h>
18 18
19Interface::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"){ 19Interface::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"){
20 refresh(); 20 refresh();
21} 21}
22 22
23/** 23/**
24 * Set status 24 * Set status
25 * @param newStatus - the new status 25 * @param newStatus - the new status
26 * emit updateInterface 26 * emit updateInterface
27 */ 27 */
28void Interface::setStatus(bool newStatus){ 28void Interface::setStatus(bool newStatus){
29 if(status != newStatus){ 29 if(status != newStatus){
30 status = newStatus; 30 status = newStatus;
31 refresh(); 31 refresh();
32 } 32 }
33}; 33};
34 34
35/** 35/**
36 * Set if attached or not (802.11 card pulled out for example) 36 * Set if attached or not (802.11 card pulled out for example)
37 * @param isAttached - if attached 37 * @param isAttached - if attached
38 * emit updateInterface 38 * emit updateInterface
39 */ 39 */
40void Interface::setAttached(bool isAttached){ 40void Interface::setAttached(bool isAttached){
41 attached = isAttached; 41 attached = isAttached;
42 emit(updateInterface(this)); 42 emit(updateInterface(this));
43}; 43};
44 44
45/** 45/**
46 * Set Hardware name 46 * Set Hardware name
47 * @param name - the new name 47 * @param name - the new name
48 * emit updateInterface 48 * emit updateInterface
49 */ 49 */
50void Interface::setHardwareName(const QString &name){ 50void Interface::setHardwareName(const QString &name){
51 hardwareName = name; 51 hardwareName = name;
52 emit(updateInterface(this)); 52 emit(updateInterface(this));
53}; 53};
54 54
55/** 55/**
56 * Set Module owner 56 * Set Module owner
57 * @param owner - the new owner 57 * @param owner - the new owner
58 * emit updateInterface 58 * emit updateInterface
59 */ 59 */
60void Interface::setModuleOwner(Module *owner){ 60void Interface::setModuleOwner(Module *owner){
61 moduleOwner = owner; 61 moduleOwner = owner;
62 emit(updateInterface(this)); 62 emit(updateInterface(this));
63}; 63};
64 64
65 65
66/** 66/**
67 * Try to start the interface. 67 * Try to start the interface.
68 */ 68 */
69void Interface::start(){ 69void Interface::start(){
70 // check to see if we are already running. 70 // check to see if we are already running.
71 if(true == status){ 71 if(true == status){
72 emit (updateMessage("Unable to start interface,\n already started")); 72 emit (updateMessage("Unable to start interface,\n already started"));
73 return; 73 return;
74 } 74 }
75 75
76 int ret = system(QString("%1 %2 up").arg(IFCONFIG).arg(this->name()).latin1()); 76 int ret = system(QString("%1 %2 up").arg(IFCONFIG).arg(this->name()).latin1());
77 // See if it was successfull... 77 // See if it was successful...
78 if(ret != 0){ 78 if(ret != 0){
79 emit (updateMessage("Starting interface failed")); 79 emit (updateMessage("Starting interface failed"));
80 return; 80 return;
81 } 81 }
82 82
83 status = true; 83 status = true;
84 refresh(); 84 refresh();
85 emit (updateMessage("Start successfull")); 85 emit (updateMessage("Start successful"));
86} 86}
87 87
88/** 88/**
89 * Try to stop the interface. 89 * Try to stop the interface.
90 */ 90 */
91void Interface::stop(){ 91void Interface::stop(){
92 // check to see if we are already stopped. 92 // check to see if we are already stopped.
93 if(false == status){ 93 if(false == status){
94 emit (updateMessage("Unable to stop interface,\n already stopped")); 94 emit (updateMessage("Unable to stop interface,\n already stopped"));
95 return; 95 return;
96 } 96 }
97 97
98 int ret = system(QString("%1 %2 down").arg(IFCONFIG).arg(this->name()).latin1()); 98 int ret = system(QString("%1 %2 down").arg(IFCONFIG).arg(this->name()).latin1());
99 if(ret != 0){ 99 if(ret != 0){
100 emit (updateMessage("Stopping interface failed")); 100 emit (updateMessage("Stopping interface failed"));
101 return; 101 return;
102 } 102 }
103 103
104 status = false; 104 status = false;
105 refresh(); 105 refresh();
106 emit (updateMessage("Stop successfull")); 106 emit (updateMessage("Stop successful"));
107} 107}
108 108
109/** 109/**
110 * Try to restart the interface. 110 * Try to restart the interface.
111 */ 111 */
112void Interface::restart(){ 112void Interface::restart(){
113 stop(); 113 stop();
114 start(); 114 start();
115} 115}
116 116
117/** 117/**
118 * Try to refresh the information about the interface. 118 * Try to refresh the information about the interface.
119 * First call ifconfig, then check the dhcp-info file 119 * First call ifconfig, then check the dhcp-info file
120 * @return bool true if successfull. 120 * @return bool true if successful.
121 */ 121 */
122bool Interface::refresh(){ 122bool Interface::refresh(){
123 // See if we are up. 123 // See if we are up.
124 if(status == false){ 124 if(status == false){
125 macAddress = ""; 125 macAddress = "";
126 ip = "0.0.0.0"; 126 ip = "0.0.0.0";
127 subnetMask = "0.0.0.0"; 127 subnetMask = "0.0.0.0";
128 broadcast = ""; 128 broadcast = "";
129 dhcp = false; 129 dhcp = false;
130 dhcpServerIp = ""; 130 dhcpServerIp = "";
131 leaseObtained = ""; 131 leaseObtained = "";
132 leaseExpires = ""; 132 leaseExpires = "";
133 emit(updateInterface(this)); 133 emit(updateInterface(this));
134 return true; 134 return true;
135 } 135 }
136 136
137 QString fileName = QString("/tmp/%1_ifconfig_info").arg(this->name()); 137 QString fileName = QString("/tmp/%1_ifconfig_info").arg(this->name());
138 int ret = system(QString("LANG=C %1 %2 > %3").arg(IFCONFIG).arg(this->name()).arg(fileName).latin1()); 138 int ret = system(QString("LANG=C %1 %2 > %3").arg(IFCONFIG).arg(this->name()).arg(fileName).latin1());
139 if(ret != 0){ 139 if(ret != 0){
140 qDebug(QString("Interface: Ifconfig return value: %1, is not 0").arg(ret).latin1()); 140 qDebug(QString("Interface: Ifconfig return value: %1, is not 0").arg(ret).latin1());
141 return false; 141 return false;
142 } 142 }
143 143
144 QFile file(fileName); 144 QFile file(fileName);
145 if (!file.open(IO_ReadOnly)){ 145 if (!file.open(IO_ReadOnly)){
146 qDebug(QString("Interface: Can't open file: %1").arg(fileName).latin1()); 146 qDebug(QString("Interface: Can't open file: %1").arg(fileName).latin1());
147 return false; 147 return false;
148 } 148 }
149 149
150 // Set to the defaults 150 // Set to the defaults
151 macAddress = ""; 151 macAddress = "";
152 ip = "0.0.0.0"; 152 ip = "0.0.0.0";
153 subnetMask = "0.0.0.0"; 153 subnetMask = "0.0.0.0";
154 broadcast = ""; 154 broadcast = "";
155 155
156 QTextStream stream( &file ); 156 QTextStream stream( &file );
157 QString line; 157 QString line;
158 while ( !stream.eof() ) { 158 while ( !stream.eof() ) {
159 line = stream.readLine(); 159 line = stream.readLine();
160 if(line.contains("HWaddr")){ 160 if(line.contains("HWaddr")){
161 int mac = line.find("HWaddr"); 161 int mac = line.find("HWaddr");
162 macAddress = line.mid(mac+7, line.length()); 162 macAddress = line.mid(mac+7, line.length());
163 } 163 }
164 if(line.contains("inet addr")){ 164 if(line.contains("inet addr")){
165 int ipl = line.find("inet addr"); 165 int ipl = line.find("inet addr");
166 int space = line.find(" ", ipl+10); 166 int space = line.find(" ", ipl+10);
167 ip = line.mid(ipl+10, space-ipl-10); 167 ip = line.mid(ipl+10, space-ipl-10);
168 } 168 }
169 if(line.contains("Mask")){ 169 if(line.contains("Mask")){
170 int mask = line.find("Mask"); 170 int mask = line.find("Mask");
171 subnetMask = line.mid(mask+5, line.length()); 171 subnetMask = line.mid(mask+5, line.length());
172 } 172 }
173 if(line.contains("Bcast")){ 173 if(line.contains("Bcast")){
174 int mask = line.find("Bcast"); 174 int mask = line.find("Bcast");
175 int space = line.find(" ", mask+6); 175 int space = line.find(" ", mask+6);
176 broadcast = line.mid(mask+6, space-mask-6); 176 broadcast = line.mid(mask+6, space-mask-6);
177 } 177 }
178 } 178 }
179 file.close(); 179 file.close();
180 QFile::remove(fileName); 180 QFile::remove(fileName);
181 181
182 // DHCP TESTING 182 // DHCP TESTING
183 // reset DHCP info 183 // reset DHCP info
184 dhcpServerIp = ""; 184 dhcpServerIp = "";
185 leaseObtained = ""; 185 leaseObtained = "";
186 leaseExpires = ""; 186 leaseExpires = "";
187 dhcp = false; 187 dhcp = false;
188 188
189 QString dhcpDirectory(DHCP_INFO_DIR); 189 QString dhcpDirectory(DHCP_INFO_DIR);
190 QDir d(dhcpDirectory); 190 QDir d(dhcpDirectory);
191 if(!d.exists(dhcpDirectory)) 191 if(!d.exists(dhcpDirectory))
192 dhcpDirectory = "/var/run"; 192 dhcpDirectory = "/var/run";
193 193
194 // See if we have 194 // See if we have
195 QString dhcpFile(QString(dhcpDirectory+"/dhcpcd-%1.info").arg(this->name())); 195 QString dhcpFile(QString(dhcpDirectory+"/dhcpcd-%1.info").arg(this->name()));
196 // If there is no DHCP information then exit now with no errors. 196 // If there is no DHCP information then exit now with no errors.
197 if(!QFile::exists(dhcpFile)){ 197 if(!QFile::exists(dhcpFile)){
198 emit(updateInterface(this)); 198 emit(updateInterface(this));
199 return true; 199 return true;
200 } 200 }
201 201
202 file.setName(dhcpFile); 202 file.setName(dhcpFile);
203 if (!file.open(IO_ReadOnly)){ 203 if (!file.open(IO_ReadOnly)){
204 qDebug(QString("Interface: Can't open file: %1").arg(dhcpFile).latin1()); 204 qDebug(QString("Interface: Can't open file: %1").arg(dhcpFile).latin1());
205 return false; 205 return false;
206 } 206 }
207 207
208 // leaseTime and renewalTime and used if pid and deamon exe can be accessed. 208 // leaseTime and renewalTime and used if pid and deamon exe can be accessed.
209 int leaseTime = 0; 209 int leaseTime = 0;
210 int renewalTime = 0; 210 int renewalTime = 0;
211 211
212 stream.setDevice( &file ); 212 stream.setDevice( &file );
213 while ( !stream.eof() ) { 213 while ( !stream.eof() ) {
214 line = stream.readLine(); 214 line = stream.readLine();
215 if(line.contains("DHCPSIADDR=")) 215 if(line.contains("DHCPSIADDR="))
216 dhcpServerIp = line.mid(11, line.length()); 216 dhcpServerIp = line.mid(11, line.length());
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 @@
1#include "interfaces.h" 1#include "interfaces.h"
2 2
3#include <qcheckbox.h> 3#include <qcheckbox.h>
4#include <qfile.h> 4#include <qfile.h>
5#include <qtextstream.h> 5#include <qtextstream.h>
6#include <qregexp.h> 6#include <qregexp.h>
7 7
8// The three stanza's 8// The three stanza's
9#define AUTO "auto" 9#define AUTO "auto"
10#define IFACE "iface" 10#define IFACE "iface"
11#define MAPPING "mapping" 11#define MAPPING "mapping"
12 12
13/** 13/**
14 * Constructor. Reads in the interfaces file and then split the file up by 14 * Constructor. Reads in the interfaces file and then split the file up by
15 * the \n for interfaces variable. 15 * the \n for interfaces variable.
16 * @param useInterfacesFile if an interface file other then the default is 16 * @param useInterfacesFile if an interface file other then the default is
17 * desired to be used it should be passed in. 17 * desired to be used it should be passed in.
18 */ 18 */
19Interfaces::Interfaces(QString useInterfacesFile){ 19Interfaces::Interfaces(QString useInterfacesFile){
20 acceptedFamily.append(INTERFACES_FAMILY_INET); 20 acceptedFamily.append(INTERFACES_FAMILY_INET);
21 acceptedFamily.append(INTERFACES_FAMILY_IPX); 21 acceptedFamily.append(INTERFACES_FAMILY_IPX);
22 acceptedFamily.append(INTERFACES_FAMILY_INET6); 22 acceptedFamily.append(INTERFACES_FAMILY_INET6);
23 23
24 interfacesFile = useInterfacesFile; 24 interfacesFile = useInterfacesFile;
25 QFile file(interfacesFile); 25 QFile file(interfacesFile);
26 if (!file.open(IO_ReadOnly)){ 26 if (!file.open(IO_ReadOnly)){
27 qDebug("Interfaces: Can't open file: %s for reading.", interfacesFile.latin1() ); 27 qDebug("Interfaces: Can't open file: %s for reading.", interfacesFile.latin1() );
28 currentIface = interfaces.end(); 28 currentIface = interfaces.end();
29 currentMapping = interfaces.end(); 29 currentMapping = interfaces.end();
30 return; 30 return;
31 } 31 }
32 QTextStream stream( &file ); 32 QTextStream stream( &file );
33 QString line; 33 QString line;
34 while ( !stream.eof() ) { 34 while ( !stream.eof() ) {
35 line += stream.readLine(); 35 line += stream.readLine();
36 line += "\n"; 36 line += "\n";
37 } 37 }
38 file.close(); 38 file.close();
39 interfaces = QStringList::split("\n", line, true); 39 interfaces = QStringList::split("\n", line, true);
40 40
41 currentIface = interfaces.end(); 41 currentIface = interfaces.end();
42 currentMapping = interfaces.end(); 42 currentMapping = interfaces.end();
43} 43}
44 44
45 45
46/** 46/**
47 * Get a list of all interfaces in the interface file. Usefull for 47 * Get a list of all interfaces in the interface file. Useful for
48 * hardware that is not currently connected such as an 802.11b card 48 * hardware that is not currently connected such as an 802.11b card
49 * not plugged in, but configured for when it is plugged in. 49 * not plugged in, but configured for when it is plugged in.
50 * @return Return string list of interfaces. 50 * @return Return string list of interfaces.
51 **/ 51 **/
52QStringList Interfaces::getInterfaceList(){ 52QStringList Interfaces::getInterfaceList(){
53 QStringList list; 53 QStringList list;
54 for ( QStringList::Iterator it = interfaces.begin(); it != interfaces.end(); ++it ) { 54 for ( QStringList::Iterator it = interfaces.begin(); it != interfaces.end(); ++it ) {
55 QString line = (*it).simplifyWhiteSpace(); 55 QString line = (*it).simplifyWhiteSpace();
56 if(line.contains(IFACE) && line.at(0) != '#'){ 56 if(line.contains(IFACE) && line.at(0) != '#'){
57 line = line.mid(QString(IFACE).length() +1, line.length()); 57 line = line.mid(QString(IFACE).length() +1, line.length());
58 line = line.simplifyWhiteSpace(); 58 line = line.simplifyWhiteSpace();
59 int findSpace = line.find(" "); 59 int findSpace = line.find(" ");
60 if( findSpace >= 0){ 60 if( findSpace >= 0){
61 line = line.mid(0, findSpace); 61 line = line.mid(0, findSpace);
62 list.append(line); 62 list.append(line);
63 } 63 }
64 } 64 }
65 } 65 }
66 return list; 66 return list;
67} 67}
68 68
69/** 69/**
70 * Find out if interface is in an "auto" group or not. 70 * Find out if interface is in an "auto" group or not.
71 * Report any duplicates such as eth0 being in two differnt auto's 71 * Report any duplicates such as eth0 being in two differnt auto's
72 * @param interface interface to check to see if it is on or not. 72 * @param interface interface to check to see if it is on or not.
73 * @return true is interface is in auto 73 * @return true is interface is in auto
74 */ 74 */
75bool Interfaces::isAuto(const QString &interface) const { 75bool Interfaces::isAuto(const QString &interface) const {
76 QStringList autoLines = interfaces.grep(QRegExp(AUTO)); 76 QStringList autoLines = interfaces.grep(QRegExp(AUTO));
77 QStringList awi = autoLines.grep(QRegExp(interface)); 77 QStringList awi = autoLines.grep(QRegExp(interface));
78 if(awi.count() > 1) 78 if(awi.count() > 1)
79 qDebug(QString("Interfaces: Found more then auto group with interface: %1.").arg(interface).latin1()); 79 qDebug(QString("Interfaces: Found more then auto group with interface: %1.").arg(interface).latin1());
80 return awi.count() > 0; 80 return awi.count() > 0;
81} 81}
82 82
83/** 83/**
84 * Attempt to set the auto option for interface to setAuto. 84 * Attempt to set the auto option for interface to setAuto.
85 * @param interface the interface to set 85 * @param interface the interface to set
86 * @param setAuto the value to set interface to. 86 * @param setAuto the value to set interface to.
87 * @return false if already set to setAuto. 87 * @return false if already set to setAuto.
88 * */ 88 * */
89bool Interfaces::setAuto(const QString &interface, bool setAuto){ 89bool Interfaces::setAuto(const QString &interface, bool setAuto){
90 // Don't need to set it if it is already set. 90 // Don't need to set it if it is already set.
91 if(isAuto(interface) == setAuto) 91 if(isAuto(interface) == setAuto)
92 return false; 92 return false;
93 93
94 bool changed = false; 94 bool changed = false;
95 for ( QStringList::Iterator it = interfaces.begin(); it != interfaces.end(); ++it ) { 95 for ( QStringList::Iterator it = interfaces.begin(); it != interfaces.end(); ++it ) {
96 if((*it).contains(AUTO)){ 96 if((*it).contains(AUTO)){
97 //We know that they are not in any group so let add to this auto. 97 //We know that they are not in any group so let add to this auto.
98 if(setAuto){ 98 if(setAuto){
99 (*it) = (*it) += " " + interface; 99 (*it) = (*it) += " " + interface;
100 // Don't care to have such thins as: auto eth0 lo usb0 100 // Don't care to have such thins as: auto eth0 lo usb0
101 (*it) = (*it).simplifyWhiteSpace(); 101 (*it) = (*it).simplifyWhiteSpace();
102 changed = true; 102 changed = true;
103 break; 103 break;
104 } 104 }
105 // else see if we need to remove from this one 105 // else see if we need to remove from this one
106 else{ 106 else{
107 if((*it).contains(interface)){ 107 if((*it).contains(interface)){
108 (*it) = (*it).replace(QRegExp(interface), ""); 108 (*it) = (*it).replace(QRegExp(interface), "");
109 // if AUTO is the only thing left clear the line 109 // if AUTO is the only thing left clear the line
110 if(((*it).simplifyWhiteSpace()).replace(QRegExp(" "),"") == AUTO) 110 if(((*it).simplifyWhiteSpace()).replace(QRegExp(" "),"") == AUTO)
111 (*it) = ""; 111 (*it) = "";
112 changed = true; 112 changed = true;
113 // Don't break because we want to make sure we remove all cases. 113 // Don't break because we want to make sure we remove all cases.
114 } 114 }
115 } 115 }
116 } 116 }
117 } 117 }
118 // In the case where there is no AUTO field add one. 118 // In the case where there is no AUTO field add one.
119 if(!changed && setAuto) 119 if(!changed && setAuto)
120 interfaces.append(QString(AUTO" %1").arg(interface)); 120 interfaces.append(QString(AUTO" %1").arg(interface));
121 return true; 121 return true;
122} 122}
123 123
124/** 124/**
125 * Set the current interface to interface. This needs to be done before you 125 * Set the current interface to interface. This needs to be done before you
126 * can call getFamily(), getMethod, and get/setOption(). 126 * can call getFamily(), getMethod, and get/setOption().
127 * @param interface the name of the interface to set. All whitespace is 127 * @param interface the name of the interface to set. All whitespace is
128 * removed from the interface name. 128 * removed from the interface name.
129 * @return bool true if it is successfull. 129 * @return bool true if it is successful.
130 */ 130 */
131bool Interfaces::setInterface(QString interface){ 131bool Interfaces::setInterface(QString interface){
132 interface = interface.simplifyWhiteSpace(); 132 interface = interface.simplifyWhiteSpace();
133 interface = interface.replace(QRegExp(" "), ""); 133 interface = interface.replace(QRegExp(" "), "");
134 return setStanza(IFACE, interface, currentIface); 134 return setStanza(IFACE, interface, currentIface);
135} 135}
136 136
137/** 137/**
138 * A quick helper funtion to see if the current interface is set. 138 * A quick helper funtion to see if the current interface is set.
139 * @return bool true if set, false otherwise. 139 * @return bool true if set, false otherwise.
140 */ 140 */
141bool Interfaces::isInterfaceSet() const { 141bool Interfaces::isInterfaceSet() const {
142 return (interfaces.end() != currentIface); 142 return (interfaces.end() != currentIface);
143} 143}
144 144
145/** 145/**
146 * Add a new interface of with the settings - family and method 146 * Add a new interface of with the settings - family and method
147 * @param interface the name of the interface to set. All whitespace is 147 * @param interface the name of the interface to set. All whitespace is
148 * removed from the interface name. 148 * removed from the interface name.
149 * @param family the family of this interface inet or inet, ipx or inet6 149 * @param family the family of this interface inet or inet, ipx or inet6
150 * Must of one of the families defined in interfaces.h 150 * Must of one of the families defined in interfaces.h
151 * @param method for the family. see interfaces man page for family methods. 151 * @param method for the family. see interfaces man page for family methods.
152 * @return true if successfull. 152 * @return true if successful.
153 */ 153 */
154bool Interfaces::addInterface(const QString &interface, const QString &family, const QString &method){ 154bool Interfaces::addInterface(const QString &interface, const QString &family, const QString &method){
155 qDebug("Interfaces::addInterface(%s)",interface.latin1()); 155 qDebug("Interfaces::addInterface(%s)",interface.latin1());
156 if(0 == acceptedFamily.contains(family)) 156 if(0 == acceptedFamily.contains(family))
157 return false; 157 return false;
158 QString newInterface = interface.simplifyWhiteSpace(); 158 QString newInterface = interface.simplifyWhiteSpace();
159 newInterface = newInterface.replace(QRegExp(" "), ""); 159 newInterface = newInterface.replace(QRegExp(" "), "");
160 interfaces.append(""); 160 interfaces.append("");
161 interfaces.append(QString(IFACE " %1 %2 %3").arg(newInterface).arg(family).arg(method)); 161 interfaces.append(QString(IFACE " %1 %2 %3").arg(newInterface).arg(family).arg(method));
162 return true; 162 return true;
163} 163}
164 164
165/** 165/**
166 * Copies interface with name interface to name newInterface 166 * Copies interface with name interface to name newInterface
167 * @param newInterface name of the new interface. 167 * @param newInterface name of the new interface.
168 * @return bool true if successfull 168 * @return bool true if successful
169 */ 169 */
170bool Interfaces::copyInterface(const QString &interface, const QString &newInterface){ 170bool Interfaces::copyInterface(const QString &interface, const QString &newInterface){
171 qDebug("copy interface %s to %s", interface.latin1(), newInterface.latin1()); 171 qDebug("copy interface %s to %s", interface.latin1(), newInterface.latin1());
172 if(!setInterface(interface)) 172 if(!setInterface(interface))
173 return false; 173 return false;
174 174
175 // Store the old interface and bump past the stanza line. 175 // Store the old interface and bump past the stanza line.
176 QStringList::Iterator it = currentIface; 176 QStringList::Iterator it = currentIface;
177 it++; 177 it++;
178 178
179 // Add the new interface 179 // Add the new interface
180 bool error; 180 bool error;
181 addInterface(newInterface, getInterfaceFamily(error), getInterfaceMethod(error)); 181 addInterface(newInterface, getInterfaceFamily(error), getInterfaceMethod(error));
182 if(!setInterface(newInterface)) 182 if(!setInterface(newInterface))
183 return false; 183 return false;
184 184
185 QStringList::Iterator newIface = currentIface; 185 QStringList::Iterator newIface = currentIface;
186 newIface++; 186 newIface++;
187 187
188 // Copy all of the lines 188 // Copy all of the lines
189 for ( ; it != interfaces.end(); ++it ){ 189 for ( ; it != interfaces.end(); ++it ){
190 if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO))) 190 if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)))
191 break; 191 break;
192 newIface = interfaces.insert(newIface, *it); 192 newIface = interfaces.insert(newIface, *it);
193 } 193 }
194 194
195 return true; 195 return true;
196} 196}
197 197
198/** 198/**
199 * Remove the currently selected interface and all of its options. 199 * Remove the currently selected interface and all of its options.
200 * @return bool if successfull or not. 200 * @return bool if successful or not.
201 */ 201 */
202bool Interfaces::removeInterface(){ 202bool Interfaces::removeInterface(){
203 return removeStanza(currentIface); 203 return removeStanza(currentIface);
204} 204}
205 205
206/** 206/**
207 * Gets the hardware name of the interface that is currently selected. 207 * Gets the hardware name of the interface that is currently selected.
208 * @return QString name of the hardware interface (eth0, usb2, wlan1...). 208 * @return QString name of the hardware interface (eth0, usb2, wlan1...).
209 * @param error set to true if any error occurs, false otherwise. 209 * @param error set to true if any error occurs, false otherwise.
210 */ 210 */
211QString Interfaces::getInterfaceName(bool &error){ 211QString Interfaces::getInterfaceName(bool &error){
212 if(currentIface == interfaces.end()){ 212 if(currentIface == interfaces.end()){
213 error = true; 213 error = true;
214 return QString(); 214 return QString();
215 } 215 }
216 QString line = (*currentIface); 216 QString line = (*currentIface);
217 line = line.mid(QString(IFACE).length() +1, line.length()); 217 line = line.mid(QString(IFACE).length() +1, line.length());
218 line = line.simplifyWhiteSpace(); 218 line = line.simplifyWhiteSpace();
219 int findSpace = line.find(" "); 219 int findSpace = line.find(" ");
220 if( findSpace < 0){ 220 if( findSpace < 0){
221 error = true; 221 error = true;
222 return QString(); 222 return QString();
223 } 223 }
224 error = false; 224 error = false;
225 return line.mid(0, findSpace); 225 return line.mid(0, findSpace);
226} 226}
227 227
228/** 228/**
229 * Gets the family name of the interface that is currently selected. 229 * Gets the family name of the interface that is currently selected.
230 * @return QString name of the family (inet, inet6, ipx). 230 * @return QString name of the family (inet, inet6, ipx).
231 * @param error set to true if any error occurs, false otherwise. 231 * @param error set to true if any error occurs, false otherwise.
232 */ 232 */
233QString Interfaces::getInterfaceFamily(bool &error){ 233QString Interfaces::getInterfaceFamily(bool &error){
234 QString name = getInterfaceName(error); 234 QString name = getInterfaceName(error);
235 if(error) 235 if(error)
236 return QString(); 236 return QString();
237 QString line = (*currentIface); 237 QString line = (*currentIface);
238 line = line.mid(QString(IFACE).length() +1, line.length()); 238 line = line.mid(QString(IFACE).length() +1, line.length());
239 line = line.mid(name.length()+1, line.length()); 239 line = line.mid(name.length()+1, line.length());
240 line = line.simplifyWhiteSpace(); 240 line = line.simplifyWhiteSpace();
241 int findSpace = line.find(" "); 241 int findSpace = line.find(" ");
242 if( findSpace < 0){ 242 if( findSpace < 0){
243 error = true; 243 error = true;
244 return QString(); 244 return QString();
245 } 245 }
246 error = false; 246 error = false;
247 return line.mid(0, findSpace); 247 return line.mid(0, findSpace);
248} 248}
249 249
250/** 250/**
251 * Gets the method of the interface that is currently selected. 251 * Gets the method of the interface that is currently selected.
252 * @return QString name of the method such as staic or dhcp. 252 * @return QString name of the method such as staic or dhcp.
253 * See the man page of interfaces for possible methods depending on the family. 253 * See the man page of interfaces for possible methods depending on the family.
254 * @param error set to true if any error occurs, false otherwise. 254 * @param error set to true if any error occurs, false otherwise.
255 */ 255 */
256QString Interfaces::getInterfaceMethod(bool &error){ 256QString Interfaces::getInterfaceMethod(bool &error){
257 QString name = getInterfaceName(error); 257 QString name = getInterfaceName(error);
258 if(error) 258 if(error)
259 return QString(); 259 return QString();
260 QString family = getInterfaceFamily(error); 260 QString family = getInterfaceFamily(error);
261 if(error) 261 if(error)
262 return QString(); 262 return QString();
263 QString line = (*currentIface); 263 QString line = (*currentIface);
264 line = line.mid(QString(IFACE).length()+1, line.length()); 264 line = line.mid(QString(IFACE).length()+1, line.length());
265 line = line.mid(name.length()+1, line.length()); 265 line = line.mid(name.length()+1, line.length());
266 line = line.mid(family.length()+1, line.length()); 266 line = line.mid(family.length()+1, line.length());
267 line = line.simplifyWhiteSpace(); 267 line = line.simplifyWhiteSpace();
268 error = false; 268 error = false;
269 return line; 269 return line;
270} 270}
271 271
272/** 272/**
273 * Sets the interface name to newName. 273 * Sets the interface name to newName.
274 * @param newName the new name of the interface. All whitespace is removed. 274 * @param newName the new name of the interface. All whitespace is removed.
275 * @return bool true if successfull. 275 * @return bool true if successful.
276 */ 276 */
277bool Interfaces::setInterfaceName(const QString &newName){ 277bool Interfaces::setInterfaceName(const QString &newName){
278 qDebug("setInterfaceName %s", newName.latin1()); 278 qDebug("setInterfaceName %s", newName.latin1());
279 if(currentIface == interfaces.end()) 279 if(currentIface == interfaces.end())
280 return false; 280 return false;
281 QString name = newName.simplifyWhiteSpace(); 281 QString name = newName.simplifyWhiteSpace();
282 name = name.replace(QRegExp(" "), ""); 282 name = name.replace(QRegExp(" "), "");
283 bool returnValue = false; 283 bool returnValue = false;
284 QString tmp = QString("iface %1 %2 %3").arg(name).arg(getInterfaceFamily(returnValue)).arg(getInterfaceMethod(returnValue)); 284 QString tmp = QString("iface %1 %2 %3").arg(name).arg(getInterfaceFamily(returnValue)).arg(getInterfaceMethod(returnValue));
285 qDebug("setting %s",tmp.latin1()); 285 qDebug("setting %s",tmp.latin1());
286 286
287 (*currentIface) = tmp; 287 (*currentIface) = tmp;
288 return !returnValue; 288 return !returnValue;
289} 289}
290 290
291/** 291/**
292 * Sets the interface family to newName. 292 * Sets the interface family to newName.
293 * @param newName the new name of the interface. Must be one of the families 293 * @param newName the new name of the interface. Must be one of the families
294 * defined in the interfaces.h file. 294 * defined in the interfaces.h file.
295 * @return bool true if successfull. 295 * @return bool true if successful.
296 */ 296 */
297bool Interfaces::setInterfaceFamily(const QString &newName){ 297bool Interfaces::setInterfaceFamily(const QString &newName){
298 if(currentIface == interfaces.end()) 298 if(currentIface == interfaces.end())
299 return false; 299 return false;
300 if(acceptedFamily.contains(newName)==0) 300 if(acceptedFamily.contains(newName)==0)
301 return false; 301 return false;
302 bool returnValue = false; 302 bool returnValue = false;
303 (*currentIface) = QString("iface %1 %2 %3").arg(getInterfaceName(returnValue)).arg(newName).arg(getInterfaceMethod(returnValue)); 303 (*currentIface) = QString("iface %1 %2 %3").arg(getInterfaceName(returnValue)).arg(newName).arg(getInterfaceMethod(returnValue));
304 return !returnValue; 304 return !returnValue;
305} 305}
306 306
307/** 307/**
308 * Sets the interface method to newName 308 * Sets the interface method to newName
309 * @param newName the new name of the interface 309 * @param newName the new name of the interface
310 * @return bool true if successfull. 310 * @return bool true if successful.
311 */ 311 */
312bool Interfaces::setInterfaceMethod(const QString &newName){ 312bool Interfaces::setInterfaceMethod(const QString &newName){
313 if(currentIface == interfaces.end()) 313 if(currentIface == interfaces.end())
314 return false; 314 return false;
315 bool returnValue = false; 315 bool returnValue = false;
316 (*currentIface) = QString("iface %1 %2 %3").arg(getInterfaceName(returnValue)).arg(getInterfaceFamily(returnValue)).arg(newName); 316 (*currentIface) = QString("iface %1 %2 %3").arg(getInterfaceName(returnValue)).arg(getInterfaceFamily(returnValue)).arg(newName);
317 return !returnValue; 317 return !returnValue;
318} 318}
319 319
320/** 320/**
321 * Get a value for an option in the currently selected interface. For example 321 * Get a value for an option in the currently selected interface. For example
322 * calling getInterfaceOption("address") on the following stanza would 322 * calling getInterfaceOption("address") on the following stanza would
323 * return 192.168.1.1. 323 * return 192.168.1.1.
324 * iface eth0 static 324 * iface eth0 static
325 * address 192.168.1.1 325 * address 192.168.1.1
326 * @param option the options to get the value. 326 * @param option the options to get the value.
327 * @param error set to true if any error occurs, false otherwise. 327 * @param error set to true if any error occurs, false otherwise.
328 * @return QString the options value. QString::null if error == true 328 * @return QString the options value. QString::null if error == true
329 */ 329 */
330QString Interfaces::getInterfaceOption(const QString &option, bool &error){ 330QString Interfaces::getInterfaceOption(const QString &option, bool &error){
331 return getOption(currentIface, option, error); 331 return getOption(currentIface, option, error);
332} 332}
333 333
334/** 334/**
335 * Set a value for an option in the currently selected interface. If option 335 * Set a value for an option in the currently selected interface. If option
336 * doesn't exist then it is added along with the value. 336 * doesn't exist then it is added along with the value.
337 * If value isEmpty() then we will remove the option 337 * If value isEmpty() then we will remove the option
338 * 338 *
339 * @param option the options to set the value. 339 * @param option the options to set the value.
340 * @param value the value that option should be set to. 340 * @param value the value that option should be set to.
341 * @param error set to true if any error occurs, false otherwise. 341 * @param error set to true if any error occurs, false otherwise.
342 * @return QString the options value. QString::null if error == true 342 * @return QString the options value. QString::null if error == true
343 */ 343 */
344bool Interfaces::setInterfaceOption(const QString &option, const QString &value){ 344bool Interfaces::setInterfaceOption(const QString &option, const QString &value){
345 if( value.stripWhiteSpace().isEmpty() ) 345 if( value.stripWhiteSpace().isEmpty() )
346 return removeInterfaceOption( option ); 346 return removeInterfaceOption( option );
347 347
348 qDebug("iface >%s< option >%s< value >%s<", (*currentIface).latin1(), option.latin1(),value.latin1()); 348 qDebug("iface >%s< option >%s< value >%s<", (*currentIface).latin1(), option.latin1(),value.latin1());
349 return setOption(currentIface, option, value); 349 return setOption(currentIface, option, value);
350} 350}
351 351
352/** 352/**
353 * Removes a value for an option in the currently selected interface. 353 * Removes a value for an option in the currently selected interface.
354 * @param option the options to set the value. 354 * @param option the options to set the value.
355 * @param error set to true if any error occurs, false otherwise. 355 * @param error set to true if any error occurs, false otherwise.
356 * @return QString the options value. QString::null if error == true 356 * @return QString the options value. QString::null if error == true
357 */ 357 */
358bool Interfaces::removeInterfaceOption(const QString &option){ 358bool Interfaces::removeInterfaceOption(const QString &option){
359 return removeOption(currentIface, option); 359 return removeOption(currentIface, option);
360} 360}
361 361
362/** 362/**
363 * Removes a value for an option in the currently selected interface. 363 * Removes a value for an option in the currently selected interface.
364 * @param option the options to set the value. 364 * @param option the options to set the value.
365 * @param value the value that option should be set to. 365 * @param value the value that option should be set to.
366 * @param error set to true if any error occurs, false otherwise. 366 * @param error set to true if any error occurs, false otherwise.
367 * @return QString the options value. QString::null if error == true 367 * @return QString the options value. QString::null if error == true
368 */ 368 */
369bool Interfaces::removeInterfaceOption(const QString &option, const QString &value){ 369bool Interfaces::removeInterfaceOption(const QString &option, const QString &value){
370 return removeOption(currentIface, option, value); 370 return removeOption(currentIface, option, value);
371} 371}
372 372
373/** 373/**
374 * Removes all of the options from the currently selected interface. 374 * Removes all of the options from the currently selected interface.
375 * @return bool error if if successfull 375 * @return bool error if if successful
376 */ 376 */
377bool Interfaces::removeAllInterfaceOptions(){ 377bool Interfaces::removeAllInterfaceOptions(){
378 return removeAllOptions(currentIface); 378 return removeAllOptions(currentIface);
379} 379}
380 380
381/** 381/**
382 * Set the current map to interface's map. This needs to be done before you 382 * Set the current map to interface's map. This needs to be done before you
383 * can call addMapping(), set/getMap(), and get/setScript(). 383 * can call addMapping(), set/getMap(), and get/setScript().
384 * @param interface the name of the interface to set. All whitespace is 384 * @param interface the name of the interface to set. All whitespace is
385 * removed from the interface name. 385 * removed from the interface name.
386 * @return bool true if it is successfull. 386 * @return bool true if it is successful.
387 */ 387 */
388bool Interfaces::setMapping(const QString &interface){ 388bool Interfaces::setMapping(const QString &interface){
389 QString interfaceName = interface.simplifyWhiteSpace(); 389 QString interfaceName = interface.simplifyWhiteSpace();
390 interfaceName = interfaceName.replace(QRegExp(" "), ""); 390 interfaceName = interfaceName.replace(QRegExp(" "), "");
391 return setStanza(MAPPING, interfaceName, currentMapping); 391 return setStanza(MAPPING, interfaceName, currentMapping);
392} 392}
393 393
394/** 394/**
395 * Adds a new Mapping to the interfaces file with interfaces. 395 * Adds a new Mapping to the interfaces file with interfaces.
396 * @param interface the name(s) of the interfaces to set to this mapping 396 * @param interface the name(s) of the interfaces to set to this mapping
397 */ 397 */
398void Interfaces::addMapping(const QString &option){ 398void Interfaces::addMapping(const QString &option){
399 interfaces.append(""); 399 interfaces.append("");
400 interfaces.append(QString(MAPPING " %1").arg(option)); 400 interfaces.append(QString(MAPPING " %1").arg(option));
401} 401}
402 402
403/** 403/**
404 * Remove the currently selected map and all of its options. 404 * Remove the currently selected map and all of its options.
405 * @return bool if successfull or not. 405 * @return bool if successful or not.
406 */ 406 */
407bool Interfaces::removeMapping(){ 407bool Interfaces::removeMapping(){
408 return removeStanza(currentMapping); 408 return removeStanza(currentMapping);
409} 409}
410 410
411/** 411/**
412 * Set a map option within a mapping. 412 * Set a map option within a mapping.
413 * @param map map to use 413 * @param map map to use
414 * @param value value to go with map 414 * @param value value to go with map
415 * @return bool true if it is successfull. 415 * @return bool true if it is successful.
416 */ 416 */
417bool Interfaces::setMap(const QString &map, const QString &value){ 417bool Interfaces::setMap(const QString &map, const QString &value){
418 return setOption(currentMapping, map, value); 418 return setOption(currentMapping, map, value);
419} 419}
420 420
421/** 421/**
422 * Removes a map option within a mapping. 422 * Removes a map option within a mapping.
423 * @param map map to use 423 * @param map map to use
424 * @param value value to go with map 424 * @param value value to go with map
425 * @return bool true if it is successfull. 425 * @return bool true if it is successful.
426 */ 426 */
427bool Interfaces::removeMap(const QString &map, const QString &value){ 427bool Interfaces::removeMap(const QString &map, const QString &value){
428 return removeOption(currentMapping, map, value); 428 return removeOption(currentMapping, map, value);
429} 429}
430 430
431/** 431/**
432 * Get a map value within a mapping. 432 * Get a map value within a mapping.
433 * @param map map to get value of 433 * @param map map to get value of
434 * @param bool true if it is successfull. 434 * @param bool true if it is successful.
435 * @return value that goes to the map 435 * @return value that goes to the map
436 */ 436 */
437QString Interfaces::getMap(const QString &map, bool &error){ 437QString Interfaces::getMap(const QString &map, bool &error){
438 return getOption(currentMapping, map, error); 438 return getOption(currentMapping, map, error);
439} 439}
440 440
441/** 441/**
442 * Sets a script value of the current mapping to argument. 442 * Sets a script value of the current mapping to argument.
443 * @param argument the script name. 443 * @param argument the script name.
444 * @return true if successfull. 444 * @return true if successful.
445 */ 445 */
446bool Interfaces::setScript(const QString &argument){ 446bool Interfaces::setScript(const QString &argument){
447 return setOption(currentMapping, "script", argument); 447 return setOption(currentMapping, "script", argument);
448} 448}
449 449
450/** 450/**
451 * @param error true if could not retrieve the current script argument. 451 * @param error true if could not retrieve the current script argument.
452 * @return QString the argument of the script for the current mapping. 452 * @return QString the argument of the script for the current mapping.
453 */ 453 */
454QString Interfaces::getScript(bool &error){ 454QString Interfaces::getScript(bool &error){
455 return getOption(currentMapping, "script", error); 455 return getOption(currentMapping, "script", error);
456} 456}
457 457
458 458
459 459
460/** 460/**
461 * Helper function used to parse through the QStringList and put pointers in 461 * Helper function used to parse through the QStringList and put pointers in
462 * the correct place. 462 * the correct place.
463 * @param stanza The stanza (auto, iface, mapping) to look for. 463 * @param stanza The stanza (auto, iface, mapping) to look for.
464 * @param option string that must be in the stanza's main line. 464 * @param option string that must be in the stanza's main line.
465 * @param interator interator to place at location of stanza if successfull. 465 * @param interator interator to place at location of stanza if successful.
466 * @return bool true if the stanza is found. 466 * @return bool true if the stanza is found.
467 */ 467 */
468bool Interfaces::setStanza(const QString &stanza, const QString &option, QStringList::Iterator &iterator){ 468bool Interfaces::setStanza(const QString &stanza, const QString &option, QStringList::Iterator &iterator){
469 bool found = false; 469 bool found = false;
470 iterator = interfaces.end(); 470 iterator = interfaces.end();
471 for ( QStringList::Iterator it = interfaces.begin(); it != interfaces.end(); ++it ) { 471 for ( QStringList::Iterator it = interfaces.begin(); it != interfaces.end(); ++it ) {
472 QString line = (*it).simplifyWhiteSpace(); 472 QString line = (*it).simplifyWhiteSpace();
473 if(line.contains(stanza) && line.contains(option) && line.at(0) != '#'){ 473 if(line.contains(stanza) && line.contains(option) && line.at(0) != '#'){
474 uint point = line.find(option); 474 uint point = line.find(option);
475 bool valid = true; 475 bool valid = true;
476 if(point > 0){ 476 if(point > 0){
477 // There are more chars in the line. check +1 477 // There are more chars in the line. check +1
478 if(line.at(point-1) != ' ') 478 if(line.at(point-1) != ' ')
479 valid = false; 479 valid = false;
480 } 480 }
481 point += option.length(); 481 point += option.length();
482 if(point < line.length()-1){ 482 if(point < line.length()-1){
483 // There are more chars in the line. check -1 483 // There are more chars in the line. check -1
484 if(line.at(point) != ' ') 484 if(line.at(point) != ' ')
485 valid = false; 485 valid = false;
486 } 486 }
487 if(valid){ 487 if(valid){
488 if(found == true){ 488 if(found == true){
489 qDebug(QString("Interfaces: Found multiple stanza's for search: %1 %2").arg(stanza).arg(option).latin1()); 489 qDebug(QString("Interfaces: Found multiple stanza's for search: %1 %2").arg(stanza).arg(option).latin1());
490 } 490 }
491 found = true; 491 found = true;
492 iterator = it; 492 iterator = it;
493 } 493 }
494 } 494 }
495 } 495 }
496 return found; 496 return found;
497} 497}
498 498
499/** 499/**
500 * Sets a value of an option in a stanza 500 * Sets a value of an option in a stanza
501 * @param start the start of the stanza 501 * @param start the start of the stanza
502 * @param option the option to use when setting value. 502 * @param option the option to use when setting value.
503 * @return bool true if successfull, false otherwise. 503 * @return bool true if successful, false otherwise.
504 */ 504 */
505bool Interfaces::setOption(const QStringList::Iterator &start, const QString &option, const QString &value){ 505bool Interfaces::setOption(const QStringList::Iterator &start, const QString &option, const QString &value){
506 if(start == interfaces.end()) 506 if(start == interfaces.end())
507 return false; 507 return false;
508 qDebug("setting option"); 508 qDebug("setting option");
509 bool found = false; 509 bool found = false;
510 bool replaced = false; 510 bool replaced = false;
511 QStringList::Iterator insertAt = NULL; 511 QStringList::Iterator insertAt = NULL;
512 for ( QStringList::Iterator it = start; it != interfaces.end(); ++it ) { 512 for ( QStringList::Iterator it = start; it != interfaces.end(); ++it ) {
513 qDebug(" Interfaces::setOption got line >%s<",(*it).latin1()); 513 qDebug(" Interfaces::setOption got line >%s<",(*it).latin1());
514 // FIXME: was not completly stupid just wrong sice all options got inserted bevore the iface line 514 // FIXME: was not completly stupid just wrong sice all options got inserted bevore the iface line
515 // but since it works with an empty interfaces file I (tille) will not do anything more 515 // but since it works with an empty interfaces file I (tille) will not do anything more
516 if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)) ){ 516 if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)) ){
517 if (found) break; 517 if (found) break;
518// && it != start){ 518// && it != start){
519// if(!found && value != ""){ 519// if(!found && value != ""){
520// // Got to the end of the stanza without finding it, so append it. 520// // Got to the end of the stanza without finding it, so append it.
521// qDebug(" Got to the end of the stanza without finding it, so append it."); 521// qDebug(" Got to the end of the stanza without finding it, so append it.");
522// interfaces.insert(--it, QString("\t%1 %2").arg(option).arg(value)); 522// interfaces.insert(--it, QString("\t%1 %2").arg(option).arg(value));
523// } 523// }
524 qDebug("found 1"); 524 qDebug("found 1");
525// interfaces.insert(++it, QString("\t%1 %2").arg(option).arg(value)); 525// interfaces.insert(++it, QString("\t%1 %2").arg(option).arg(value));
526 found = true; 526 found = true;
527 insertAt = it; 527 insertAt = it;
528 528
529 } 529 }
530 if((*it).contains(option) && it != start && (*it).at(0) != '#'){ 530 if((*it).contains(option) && it != start && (*it).at(0) != '#'){
531 // Found it in stanza so replace it. 531 // Found it in stanza so replace it.
532 qDebug("found 2"); 532 qDebug("found 2");
533 if(found) 533 if(found)
534 qDebug(QString("Interfaces: Set Options found more then one value for option: %1 in stanza: %1").arg(option).arg((*start)).latin1()); 534 qDebug(QString("Interfaces: Set Options found more then one value for option: %1 in stanza: %1").arg(option).arg((*start)).latin1());
535 found = true; 535 found = true;
536 replaced = true; 536 replaced = true;
537 (*it) = QString("\t%1 %2").arg(option).arg(value); 537 (*it) = QString("\t%1 %2").arg(option).arg(value);
538 } 538 }
539 } 539 }
540 if(!found){ 540 if(!found){
541 qDebug("! found insert anyway"); 541 qDebug("! found insert anyway");
542 QStringList::Iterator p = start; 542 QStringList::Iterator p = start;
543 interfaces.insert(++p, QString("\t%1 %2").arg(option).arg(value)); 543 interfaces.insert(++p, QString("\t%1 %2").arg(option).arg(value));
544 found = true; 544 found = true;
545 } 545 }
546 546
547 if(found && !replaced){ 547 if(found && !replaced){
548 qDebug("found iface but not the option so insert it here..."); 548 qDebug("found iface but not the option so insert it here...");
549 interfaces.insert(++insertAt, QString("\t%1 %2").arg(option).arg(value)); 549 interfaces.insert(++insertAt, QString("\t%1 %2").arg(option).arg(value));
550 } 550 }
551 return found; 551 return found;
552} 552}
553 553
554/** 554/**
555 * Removes a stanza and all of its options 555 * Removes a stanza and all of its options
556 * @param stanza the stanza to remove 556 * @param stanza the stanza to remove
557 * @return bool true if successfull. 557 * @return bool true if successful.
558 */ 558 */
559bool Interfaces::removeStanza(QStringList::Iterator &stanza){ 559bool Interfaces::removeStanza(QStringList::Iterator &stanza){
560 if(stanza == interfaces.end()) 560 if(stanza == interfaces.end())
561 return false; 561 return false;
562 (*stanza) = ""; 562 (*stanza) = "";
563 return removeAllOptions(stanza); 563 return removeAllOptions(stanza);
564} 564}
565 565
566/** 566/**
567 * Removes a option in a stanza 567 * Removes a option in a stanza
568 * @param start the start of the stanza 568 * @param start the start of the stanza
569 * @param option the option to remove 569 * @param option the option to remove
570 * @return bool true if successfull, false otherwise. 570 * @return bool true if successful, false otherwise.
571 */ 571 */
572bool Interfaces::removeOption(const QStringList::Iterator &start, const QString &option){ 572bool Interfaces::removeOption(const QStringList::Iterator &start, const QString &option){
573 if(start == interfaces.end()) 573 if(start == interfaces.end())
574 return false; 574 return false;
575 575
576 bool found = false; 576 bool found = false;
577 for ( QStringList::Iterator it = start; it != interfaces.end(); ++it ) { 577 for ( QStringList::Iterator it = start; it != interfaces.end(); ++it ) {
578 if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)) && it != start){ 578 if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)) && it != start){
579 // got to the end without finding it 579 // got to the end without finding it
580 break; 580 break;
581 } 581 }
582 if((*it).contains(option) && it != start && (*it).at(0) != '#'){ 582 if((*it).contains(option) && it != start && (*it).at(0) != '#'){
583 // Found it in stanza so replace it. 583 // Found it in stanza so replace it.
584 if(found) 584 if(found)
585 qDebug(QString("Interfaces: Set Options found more then one value for option: %1 in stanza: %1").arg(option).arg((*start)).latin1()); 585 qDebug(QString("Interfaces: Set Options found more then one value for option: %1 in stanza: %1").arg(option).arg((*start)).latin1());
586 found = true; 586 found = true;
587 it = interfaces.remove( it ); // we really want to remove the line 587 it = interfaces.remove( it ); // we really want to remove the line
588 --it; // we do ++it later in the head of the for loop 588 --it; // we do ++it later in the head of the for loop
589 } 589 }
590 } 590 }
591 return found; 591 return found;
592} 592}
593 593
594/** 594/**
595 * Removes a option in a stanza 595 * Removes a option in a stanza
596 * @param start the start of the stanza 596 * @param start the start of the stanza
597 * @param option the option to use when setting value. 597 * @param option the option to use when setting value.
598 * @return bool true if successfull, false otherwise. 598 * @return bool true if successful, false otherwise.
599 */ 599 */
600bool Interfaces::removeOption(const QStringList::Iterator &start, const QString &option, const QString &value){ 600bool Interfaces::removeOption(const QStringList::Iterator &start, const QString &option, const QString &value){
601 if(start == interfaces.end()) 601 if(start == interfaces.end())
602 return false; 602 return false;
603 603
604 bool found = false; 604 bool found = false;
605 for ( QStringList::Iterator it = start; it != interfaces.end(); ++it ) { 605 for ( QStringList::Iterator it = start; it != interfaces.end(); ++it ) {
606 if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)) && it != start){ 606 if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)) && it != start){
607 // got to the end without finding it 607 // got to the end without finding it
608 break; 608 break;
609 } 609 }
610 if((*it).contains(option) && (*it).contains(value) && it != start && (*it).at(0) != '#'){ 610 if((*it).contains(option) && (*it).contains(value) && it != start && (*it).at(0) != '#'){
611 // Found it in stanza so replace it. 611 // Found it in stanza so replace it.
612 if(found) 612 if(found)
613 qDebug(QString("Interfaces: Set Options found more then one value for option: %1 in stanza: %1").arg(option).arg((*start)).latin1()); 613 qDebug(QString("Interfaces: Set Options found more then one value for option: %1 in stanza: %1").arg(option).arg((*start)).latin1());
614 found = true; 614 found = true;
615 it = interfaces.remove( it ); // we really want to remove the line 615 it = interfaces.remove( it ); // we really want to remove the line
616 --it; // we do ++it later in the head of the for loop 616 --it; // we do ++it later in the head of the for loop
617 } 617 }
618 } 618 }
619 return found; 619 return found;
620} 620}
621 621
622/** 622/**
623 * Removes all options in a stanza 623 * Removes all options in a stanza
624 * @param start the start of the stanza 624 * @param start the start of the stanza
625 * @return bool true if successfull, false otherwise. 625 * @return bool true if successful, false otherwise.
626 */ 626 */
627bool Interfaces::removeAllOptions(const QStringList::Iterator &start){ 627bool Interfaces::removeAllOptions(const QStringList::Iterator &start){
628 if(start == interfaces.end()) 628 if(start == interfaces.end())
629 return false; 629 return false;
630 630
631 QStringList::Iterator it = start; 631 QStringList::Iterator it = start;
632 it = ++it; 632 it = ++it;
633 for (; it != interfaces.end(); ++it ) { 633 for (; it != interfaces.end(); ++it ) {
634 if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)) && it != start){ 634 if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)) && it != start){
635 break; 635 break;
636 } 636 }
637 it = interfaces.remove(it); 637 it = interfaces.remove(it);
638 it = --it; 638 it = --it;
639 } 639 }
640 // Leave a space between this interface and the next. 640 // Leave a space between this interface and the next.
641 interfaces.insert(it, QString("")); 641 interfaces.insert(it, QString(""));
642 return true; 642 return true;
643} 643}
644 644
645/** 645/**
646 * Gets a value of an option in a stanza 646 * Gets a value of an option in a stanza
647 * @param start the start of the stanza 647 * @param start the start of the stanza
648 * @param option the option to use when getting the value. 648 * @param option the option to use when getting the value.
649 * @param bool true if errors false otherwise. 649 * @param bool true if errors false otherwise.
650 * @return QString the value of option QString::null() if error == true. 650 * @return QString the value of option QString::null() if error == true.
651 */ 651 */
652QString Interfaces::getOption(const QStringList::Iterator &start, const QString &option, bool &error){ 652QString Interfaces::getOption(const QStringList::Iterator &start, const QString &option, bool &error){
653 if(start == interfaces.end()){ 653 if(start == interfaces.end()){
654 error = false; 654 error = false;
655 return QString(); 655 return QString();
656 } 656 }
657 657
658 QString value; 658 QString value;
659 bool found = false; 659 bool found = false;
660 for ( QStringList::Iterator it = start; it != interfaces.end(); ++it ) { 660 for ( QStringList::Iterator it = start; it != interfaces.end(); ++it ) {
661 if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)) && it != start){ 661 if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)) && it != start){
662 break; 662 break;
663 } 663 }
664 if((*it).contains(option) && (*it).at(0) != '#'){ 664 if((*it).contains(option) && (*it).at(0) != '#'){
665 if(found) 665 if(found)
666 qDebug(QString("Interfaces: getOption found more then one value: %1 for option: %2 in stanza %3").arg((*it)).arg(option).arg((*start)).latin1()); 666 qDebug(QString("Interfaces: getOption found more then one value: %1 for option: %2 in stanza %3").arg((*it)).arg(option).arg((*start)).latin1());
667 found = true; 667 found = true;
668 QString line = (*it).simplifyWhiteSpace(); 668 QString line = (*it).simplifyWhiteSpace();
669 int space = line.find(" ", option.length()); 669 int space = line.find(" ", option.length());
670 if(space != -1){ 670 if(space != -1){
671 value = line.mid(space+1, line.length()); 671 value = line.mid(space+1, line.length());
672 break; 672 break;
673 } 673 }
674 } 674 }
675 } 675 }
676 error = !found; 676 error = !found;
677 return value; 677 return value;
678} 678}
679 679
680/** 680/**
681 * Write out the interfaces file to the file passed into the constructor. 681 * Write out the interfaces file to the file passed into the constructor.
682 * Removes any excess blank lines over 1 line long. 682 * Removes any excess blank lines over 1 line long.
683 * @return bool true if successfull, false if not. 683 * @return bool true if successful, false if not.
684 */ 684 */
685bool Interfaces::write(){ 685bool Interfaces::write(){
686 QFile::remove(interfacesFile); 686 QFile::remove(interfacesFile);
687 QFile file(interfacesFile); 687 QFile file(interfacesFile);
688 688
689 if (!file.open(IO_ReadWrite)){ 689 if (!file.open(IO_ReadWrite)){
690 qDebug(QString("Interfaces: Can't open file: %1 for writing.").arg(interfacesFile).latin1()); 690 qDebug(QString("Interfaces: Can't open file: %1 for writing.").arg(interfacesFile).latin1());
691 return false; 691 return false;
692 } 692 }
693 QTextStream stream( &file ); 693 QTextStream stream( &file );
694 int whiteSpaceCount = 0; 694 int whiteSpaceCount = 0;
695 for ( QStringList::Iterator it = interfaces.begin(); it != interfaces.end(); ++it ) { 695 for ( QStringList::Iterator it = interfaces.begin(); it != interfaces.end(); ++it ) {
696 QString line = (*it).simplifyWhiteSpace(); 696 QString line = (*it).simplifyWhiteSpace();
697 line = line.replace(QRegExp(" "),""); 697 line = line.replace(QRegExp(" "),"");
698 if(line.length() == 0) 698 if(line.length() == 0)
699 whiteSpaceCount++; 699 whiteSpaceCount++;
700 else 700 else
701 whiteSpaceCount = 0; 701 whiteSpaceCount = 0;
702 if(whiteSpaceCount < 2){ 702 if(whiteSpaceCount < 2){
703 qDebug((*it).latin1()); 703 qDebug((*it).latin1());
704 stream << (*it) << '\n'; 704 stream << (*it) << '\n';
705 } 705 }
706 } 706 }
707 file.close(); 707 file.close();
708 return true; 708 return true;
709} 709}
710 710
711// interfaces.cpp 711// interfaces.cpp
712 712
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,182 +1,182 @@
1#include "interfacesetupimp.h" 1#include "interfacesetupimp.h"
2#include "interface.h" 2#include "interface.h"
3 3
4#include <qcheckbox.h> 4#include <qcheckbox.h>
5#include <qlineedit.h> 5#include <qlineedit.h>
6#include <qspinbox.h> 6#include <qspinbox.h>
7#include <qgroupbox.h> 7#include <qgroupbox.h>
8#include <qlabel.h> 8#include <qlabel.h>
9 9
10#include <qmessagebox.h> 10#include <qmessagebox.h>
11 11
12#include <opie/oprocess.h> 12#include <opie/oprocess.h>
13 13
14#ifdef QWS 14#ifdef QWS
15#include <opie/owait.h> 15#include <opie/owait.h>
16#include <qpe/global.h> 16#include <qpe/global.h>
17#include <qapplication.h> 17#include <qapplication.h>
18#endif 18#endif
19 19
20#define DNSSCRIPT "changedns" 20#define DNSSCRIPT "changedns"
21 21
22/** 22/**
23 * Constuctor. Set up the connection. A profile must be set. 23 * Constuctor. Set up the connection. A profile must be set.
24 */ 24 */
25InterfaceSetupImp::InterfaceSetupImp(QWidget* parent, const char* name, Interface *i, Interfaces *j, WFlags fl) : InterfaceSetup(parent, name, fl), interface(i), interfaces(j), delInterfaces(false){ 25InterfaceSetupImp::InterfaceSetupImp(QWidget* parent, const char* name, Interface *i, Interfaces *j, WFlags fl) : InterfaceSetup(parent, name, fl), interface(i), interfaces(j), delInterfaces(false){
26 if (j == 0) { 26 if (j == 0) {
27 delInterfaces = true; 27 delInterfaces = true;
28 interfaces = new Interfaces; 28 interfaces = new Interfaces;
29 } 29 }
30} 30}
31 31
32/** 32/**
33 * Destructor 33 * Destructor
34 */ 34 */
35InterfaceSetupImp::~InterfaceSetupImp(){ 35InterfaceSetupImp::~InterfaceSetupImp(){
36 if(delInterfaces) { 36 if(delInterfaces) {
37 delete interfaces; 37 delete interfaces;
38 } 38 }
39} 39}
40 40
41/** 41/**
42 * Save the current settings, then write out the interfaces file and close. 42 * Save the current settings, then write out the interfaces file and close.
43 */ 43 */
44bool InterfaceSetupImp::saveChanges(){ 44bool InterfaceSetupImp::saveChanges(){
45 bool error; 45 bool error;
46 QString iface = interfaces->getInterfaceName(error); 46 QString iface = interfaces->getInterfaceName(error);
47 qDebug("InterfaceSetupImp::saveChanges saves interface %s", iface.latin1() ); 47 qDebug("InterfaceSetupImp::saveChanges saves interface %s", iface.latin1() );
48 if(!saveSettings()) 48 if(!saveSettings())
49 return false; 49 return false;
50 50
51 interfaces->write(); 51 interfaces->write();
52 52
53 if (interface->getStatus()) { 53 if (interface->getStatus()) {
54 QString ifup; 54 QString ifup;
55 ifup += "ifdown "; 55 ifup += "ifdown ";
56 ifup += iface; 56 ifup += iface;
57 ifup += "; ifup "; 57 ifup += "; ifup ";
58 ifup += iface; 58 ifup += iface;
59 ifup += ";"; 59 ifup += ";";
60 60
61 OProcess restart; 61 OProcess restart;
62 restart << "sh"; 62 restart << "sh";
63 restart << "-c"; 63 restart << "-c";
64 restart << ifup; 64 restart << ifup;
65 65
66 OWait *owait = new OWait(); 66 OWait *owait = new OWait();
67 Global::statusMessage( tr( "Restarting interface" ) ); 67 Global::statusMessage( tr( "Restarting interface" ) );
68 68
69 owait->show(); 69 owait->show();
70 qApp->processEvents(); 70 qApp->processEvents();
71 71
72 if (!restart.start(OProcess::Block, OProcess::NoCommunication) ) { 72 if (!restart.start(OProcess::Block, OProcess::NoCommunication) ) {
73 qWarning("unstable to spawn ifdown/ifup"); 73 qWarning("unstable to spawn ifdown/ifup");
74 } 74 }
75 75
76 owait->hide(); 76 owait->hide();
77 delete owait; 77 delete owait;
78 78
79 interface->refresh(); 79 interface->refresh();
80 } 80 }
81 return true; 81 return true;
82} 82}
83 83
84/** 84/**
85 * Save the settings for the current Interface. 85 * Save the settings for the current Interface.
86 * @return bool true if successfull, false otherwise 86 * @return bool true if successful, false otherwise
87 */ 87 */
88bool InterfaceSetupImp::saveSettings(){ 88bool InterfaceSetupImp::saveSettings(){
89 // eh can't really do anything about it other then return. :-D 89 // eh can't really do anything about it other then return. :-D
90 if(!interfaces->isInterfaceSet()) 90 if(!interfaces->isInterfaceSet())
91 return true; 91 return true;
92 92
93 bool error = false; 93 bool error = false;
94 // Loopback case 94 // Loopback case
95 if(interfaces->getInterfaceMethod(error) == INTERFACES_LOOPBACK){ 95 if(interfaces->getInterfaceMethod(error) == INTERFACES_LOOPBACK){
96 interfaces->setAuto(interface->getInterfaceName(), autoStart->isChecked()); 96 interfaces->setAuto(interface->getInterfaceName(), autoStart->isChecked());
97 return true; 97 return true;
98 } 98 }
99 99
100 if(!dhcpCheckBox->isChecked() && (ipAddressEdit->text().isEmpty() || subnetMaskEdit->text().isEmpty())){ 100 if(!dhcpCheckBox->isChecked() && (ipAddressEdit->text().isEmpty() || subnetMaskEdit->text().isEmpty())){
101 QMessageBox::information(this, "Not Saved.", "Please fill in the IP address and\n subnet entries.", QMessageBox::Ok); 101 QMessageBox::information(this, "Not Saved.", "Please fill in the IP address and\n subnet entries.", QMessageBox::Ok);
102 return false; 102 return false;
103 } 103 }
104 // DHCP 104 // DHCP
105 if(dhcpCheckBox->isChecked()) { 105 if(dhcpCheckBox->isChecked()) {
106 interfaces->setInterfaceMethod(INTERFACES_METHOD_DHCP); 106 interfaces->setInterfaceMethod(INTERFACES_METHOD_DHCP);
107 interfaces->removeInterfaceOption("address"); 107 interfaces->removeInterfaceOption("address");
108 interfaces->removeInterfaceOption("netmask"); 108 interfaces->removeInterfaceOption("netmask");
109 interfaces->removeInterfaceOption("gateway"); 109 interfaces->removeInterfaceOption("gateway");
110 interfaces->removeInterfaceOption("up "DNSSCRIPT" -a "); 110 interfaces->removeInterfaceOption("up "DNSSCRIPT" -a ");
111 interfaces->removeInterfaceOption("down "DNSSCRIPT" -r "); 111 interfaces->removeInterfaceOption("down "DNSSCRIPT" -r ");
112 } else{ 112 } else{
113 interfaces->setInterfaceMethod("static"); 113 interfaces->setInterfaceMethod("static");
114 interfaces->setInterfaceOption("address", ipAddressEdit->text()); 114 interfaces->setInterfaceOption("address", ipAddressEdit->text());
115 interfaces->setInterfaceOption("netmask", subnetMaskEdit->text()); 115 interfaces->setInterfaceOption("netmask", subnetMaskEdit->text());
116 interfaces->setInterfaceOption("gateway", gatewayEdit->text()); 116 interfaces->setInterfaceOption("gateway", gatewayEdit->text());
117 if(!firstDNSLineEdit->text().isEmpty() || !secondDNSLineEdit->text().isEmpty()){ 117 if(!firstDNSLineEdit->text().isEmpty() || !secondDNSLineEdit->text().isEmpty()){
118 QString dns = firstDNSLineEdit->text() + " " + secondDNSLineEdit->text(); 118 QString dns = firstDNSLineEdit->text() + " " + secondDNSLineEdit->text();
119 interfaces->setInterfaceOption("up "DNSSCRIPT" -a ", dns); 119 interfaces->setInterfaceOption("up "DNSSCRIPT" -a ", dns);
120 interfaces->setInterfaceOption("down "DNSSCRIPT" -r ", dns); 120 interfaces->setInterfaceOption("down "DNSSCRIPT" -r ", dns);
121 }else{ 121 }else{
122 interfaces->removeInterfaceOption("up "DNSSCRIPT" -a "); 122 interfaces->removeInterfaceOption("up "DNSSCRIPT" -a ");
123 interfaces->removeInterfaceOption("down "DNSSCRIPT" -r"); 123 interfaces->removeInterfaceOption("down "DNSSCRIPT" -r");
124 } 124 }
125 } 125 }
126 126
127 // IP Information 127 // IP Information
128 interfaces->setAuto(interface->getInterfaceName(), autoStart->isChecked()); 128 interfaces->setAuto(interface->getInterfaceName(), autoStart->isChecked());
129 return true; 129 return true;
130} 130}
131 131
132/** 132/**
133 * The Profile has changed. 133 * The Profile has changed.
134 * @param QString profile the new profile. 134 * @param QString profile the new profile.
135 */ 135 */
136void InterfaceSetupImp::setProfile(const QString &profile){ 136void InterfaceSetupImp::setProfile(const QString &profile){
137 /* 137 /*
138 bool error = false; 138 bool error = false;
139 if(interfaces->getInterfaceMethod(error) == INTERFACES_LOOPBACK){ 139 if(interfaces->getInterfaceMethod(error) == INTERFACES_LOOPBACK){
140 staticGroupBox->hide(); 140 staticGroupBox->hide();
141 dhcpCheckBox->hide(); 141 dhcpCheckBox->hide();
142 leaseTime->hide(); 142 leaseTime->hide();
143 leaseHoursLabel->hide(); 143 leaseHoursLabel->hide();
144 } 144 }
145 */ 145 */
146 146
147 QString newInterfaceName = interface->getInterfaceName(); 147 QString newInterfaceName = interface->getInterfaceName();
148 if(profile.length() > 0) 148 if(profile.length() > 0)
149 newInterfaceName += "_" + profile; 149 newInterfaceName += "_" + profile;
150 // See if we have to make a interface. 150 // See if we have to make a interface.
151 if(!interfaces->setInterface(newInterfaceName)){ 151 if(!interfaces->setInterface(newInterfaceName)){
152 // Add making for this new interface if need too 152 // Add making for this new interface if need too
153 if(profile != ""){ 153 if(profile != ""){
154 interfaces->copyInterface(interface->getInterfaceName(), newInterfaceName); 154 interfaces->copyInterface(interface->getInterfaceName(), newInterfaceName);
155 if(!interfaces->setMapping(interface->getInterfaceName())){ 155 if(!interfaces->setMapping(interface->getInterfaceName())){
156 interfaces->addMapping(interface->getInterfaceName()); 156 interfaces->addMapping(interface->getInterfaceName());
157 if(!interfaces->setMapping(interface->getInterfaceName())){ 157 if(!interfaces->setMapping(interface->getInterfaceName())){
158 qDebug("InterfaceSetupImp: Added Mapping, but still can't setInterface."); 158 qDebug("InterfaceSetupImp: Added Mapping, but still can't setInterface.");
159 return; 159 return;
160 } 160 }
161 } 161 }
162 interfaces->setMap("map", newInterfaceName); 162 interfaces->setMap("map", newInterfaceName);
163 interfaces->setScript("getprofile.sh"); 163 interfaces->setScript("getprofile.sh");
164 } 164 }
165 else{ 165 else{
166 interfaces->addInterface(newInterfaceName, INTERFACES_FAMILY_INET, INTERFACES_METHOD_DHCP); 166 interfaces->addInterface(newInterfaceName, INTERFACES_FAMILY_INET, INTERFACES_METHOD_DHCP);
167 if(!interfaces->setInterface(newInterfaceName)){ 167 if(!interfaces->setInterface(newInterfaceName)){
168 qDebug("InterfaceSetupImp: Added interface, but still can't setInterface."); 168 qDebug("InterfaceSetupImp: Added interface, but still can't setInterface.");
169 return; 169 return;
170 } 170 }
171 } 171 }
172 } 172 }
173 173
174 // We must have a valid interface to get this far so read some settings. 174 // We must have a valid interface to get this far so read some settings.
175 175
176 // DHCP 176 // DHCP
177 bool error = false; 177 bool error = false;
178 if(interfaces->getInterfaceMethod(error) == INTERFACES_METHOD_DHCP) 178 if(interfaces->getInterfaceMethod(error) == INTERFACES_METHOD_DHCP)
179 dhcpCheckBox->setChecked(true); 179 dhcpCheckBox->setChecked(true);
180 else 180 else
181 dhcpCheckBox->setChecked(false); 181 dhcpCheckBox->setChecked(false);
182 182
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 @@
1#ifndef NETCONF_MODULE_H 1#ifndef NETCONF_MODULE_H
2#define NETCONF_MODULE_H 2#define NETCONF_MODULE_H
3 3
4#include <qobject.h> 4#include <qobject.h>
5#if QT_VERSION < 300 5#if QT_VERSION < 300
6#include <qlist.h> 6#include <qlist.h>
7#else 7#else
8#include <qptrlist.h> 8#include <qptrlist.h>
9#endif 9#endif
10#include <qmap.h> 10#include <qmap.h>
11#include "interface.h" 11#include "interface.h"
12 12
13class QWidget; 13class QWidget;
14class QTabWidget; 14class QTabWidget;
15 15
16class Module : QObject{ 16class Module : QObject{
17 17
18signals: 18signals:
19 void updateInterface(Interface *i); 19 void updateInterface(Interface *i);
20 20
21 21
22public: 22public:
23 Module(){}; 23 Module(){};
24 24
25 /** 25 /**
26 * The type of the plugin 26 * The type of the plugin
27 * and the name of the dcop call 27 * and the name of the dcop call
28 */ 28 */
29 virtual const QString type() = 0; 29 virtual const QString type() = 0;
30 30
31 /** 31 /**
32 * The current profile has been changed and the module should do any 32 * The current profile has been changed and the module should do any
33 * neccesary changes also. 33 * neccesary changes also.
34 * @param newProfile what the profile should be changed to. 34 * @param newProfile what the profile should be changed to.
35 */ 35 */
36 virtual void setProfile(const QString &newProfile) = 0; 36 virtual void setProfile(const QString &newProfile) = 0;
37 37
38 /** 38 /**
39 * get the icon name for this device. 39 * get the icon name for this device.
40 * @param Interface* can be used in determining the icon. 40 * @param Interface* can be used in determining the icon.
41 * @return QString the icon name (minus .png, .gif etc) 41 * @return QString the icon name (minus .png, .gif etc)
42 */ 42 */
43 virtual QString getPixmapName(Interface *) = 0; 43 virtual QString getPixmapName(Interface *) = 0;
44 44
45 /** 45 /**
46 * Check to see if the interface i is owned by this module. 46 * Check to see if the interface i is owned by this module.
47 * @param Interface* interface to check against 47 * @param Interface* interface to check against
48 * @return bool true if i is owned by this module, false otherwise. 48 * @return bool true if i is owned by this module, false otherwise.
49 */ 49 */
50 virtual bool isOwner(Interface *){ return false; }; 50 virtual bool isOwner(Interface *){ return false; };
51 51
52 /** 52 /**
53 * Create and return the WLANConfigure Module 53 * Create and return the WLANConfigure Module
54 * @param Interface *i the interface to configure. 54 * @param Interface *i the interface to configure.
55 * @return QWidget* pointer to this modules configure. 55 * @return QWidget* pointer to this modules configure.
56 */ 56 */
57 virtual QWidget *configure(Interface *){ return NULL; } ; 57 virtual QWidget *configure(Interface *){ return NULL; } ;
58 58
59 /** 59 /**
60 * Create, and return the Information Module 60 * Create, and return the Information Module
61 * @param Interface *i the interface to get info on. 61 * @param Interface *i the interface to get info on.
62 * @return QWidget* pointer to this modules info. 62 * @return QWidget* pointer to this modules info.
63 */ 63 */
64 virtual QWidget *information(Interface *){ return NULL; }; 64 virtual QWidget *information(Interface *){ return NULL; };
65 65
66 /** 66 /**
67 * Get all active (up or down) interfaces 67 * Get all active (up or down) interfaces
68 * @return QList<Interface> A list of interfaces that exsist that havn't 68 * @return QList<Interface> A list of interfaces that exsist that havn't
69 * been called by isOwner() 69 * been called by isOwner()
70 */ 70 */
71 virtual QList<Interface> getInterfaces() = 0; 71 virtual QList<Interface> getInterfaces() = 0;
72 72
73 /** 73 /**
74 * Adds possible new interfaces to the list (Example: usb(ppp), ir(ppp), 74 * Adds possible new interfaces to the list (Example: usb(ppp), ir(ppp),
75 * modem ppp) 75 * modem ppp)
76 */ 76 */
77 virtual void possibleNewInterfaces(QMap<QString, QString> &list) = 0; 77 virtual void possibleNewInterfaces(QMap<QString, QString> &list) = 0;
78 78
79 /** 79 /**
80 * Attempts to create a new interface from name 80 * Attempts to create a new interface from name
81 * @return Interface* NULL if it was unable to be created. 81 * @return Interface* NULL if it was unable to be created.
82 * @param name the type of interface to create 82 * @param name the type of interface to create
83 */ 83 */
84 virtual Interface *addNewInterface(const QString &name) = 0; 84 virtual Interface *addNewInterface(const QString &name) = 0;
85 85
86 /** 86 /**
87 * Attempts to remove the interface, doesn't delete i 87 * Attempts to remove the interface, doesn't delete i
88 * @return bool true if successfull, false otherwise. 88 * @return bool true if successful, false otherwise.
89 */ 89 */
90 virtual bool remove(Interface* i) = 0; 90 virtual bool remove(Interface* i) = 0;
91 91
92 /** 92 /**
93 * get dcop calls 93 * get dcop calls
94 */ 94 */
95 virtual void receive(const QCString &msg, const QByteArray &arg) = 0; 95 virtual void receive(const QCString &msg, const QByteArray &arg) = 0;
96 96
97 QStringList handledInterfaceNames()const { return m_inter; } 97 QStringList handledInterfaceNames()const { return m_inter; }
98protected: 98protected:
99 /** 99 /**
100 * set which interfaceNames should not be shown cause they're handled 100 * set which interfaceNames should not be shown cause they're handled
101 * internally of this module.. An already running ppp link or 101 * internally of this module.. An already running ppp link or
102 * a tunnel... 102 * a tunnel...
103 */ 103 */
104 void setHandledInterfaceNames( const QStringList& in) { m_inter = in; } 104 void setHandledInterfaceNames( const QStringList& in) { m_inter = in; }
105 105
106private: 106private:
107 QStringList m_inter; 107 QStringList m_inter;
108}; 108};
109 109
110#endif 110#endif
111 111
112// module.h 112// module.h
113 113
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
@@ -87,164 +87,164 @@ PPPModule::~PPPModule(){
87 qDebug("Iface %s is still up", i->getHardwareName().latin1() ); 87 qDebug("Iface %s is still up", i->getHardwareName().latin1() );
88 InterfacePPP* ppp = static_cast<InterfacePPP*>(i); 88 InterfacePPP* ppp = static_cast<InterfacePPP*>(i);
89 keeper.addInterface( ppp->pppPID(), ppp->pppDev(), ppp->getHardwareName() ); 89 keeper.addInterface( ppp->pppPID(), ppp->pppDev(), ppp->getHardwareName() );
90 } 90 }
91 ifaces.insert( i->getInterfaceName(), i->getHardwareName() ); 91 ifaces.insert( i->getInterfaceName(), i->getHardwareName() );
92 delete i; 92 delete i;
93 } 93 }
94 PPPData::setConfiguredInterfaces( ifaces ); 94 PPPData::setConfiguredInterfaces( ifaces );
95} 95}
96 96
97/** 97/**
98 * Change the current profile 98 * Change the current profile
99 */ 99 */
100void PPPModule::setProfile(const QString &newProfile){ 100void PPPModule::setProfile(const QString &newProfile){
101 profile = newProfile; 101 profile = newProfile;
102} 102}
103 103
104/** 104/**
105 * get the icon name for this device. 105 * get the icon name for this device.
106 * @param Interface* can be used in determining the icon. 106 * @param Interface* can be used in determining the icon.
107 * @return QString the icon name (minus .png, .gif etc) 107 * @return QString the icon name (minus .png, .gif etc)
108 */ 108 */
109QString PPPModule::getPixmapName(Interface* ){ 109QString PPPModule::getPixmapName(Interface* ){
110 return "ppp"; 110 return "ppp";
111} 111}
112 112
113/** 113/**
114 * Check to see if the interface i is owned by this module. 114 * Check to see if the interface i is owned by this module.
115 * @param Interface* interface to check against 115 * @param Interface* interface to check against
116 * @return bool true if i is owned by this module, false otherwise. 116 * @return bool true if i is owned by this module, false otherwise.
117 */ 117 */
118bool PPPModule::isOwner(Interface *i){ 118bool PPPModule::isOwner(Interface *i){
119 return list.find( i ) != -1; 119 return list.find( i ) != -1;
120} 120}
121 121
122/** 122/**
123 * Create, and return the WLANConfigure Module 123 * Create, and return the WLANConfigure Module
124 * @return QWidget* pointer to this modules configure. 124 * @return QWidget* pointer to this modules configure.
125 */ 125 */
126QWidget *PPPModule::configure(Interface *i){ 126QWidget *PPPModule::configure(Interface *i){
127 qDebug("return ModemWidget"); 127 qDebug("return ModemWidget");
128 PPPConfigWidget *pppconfig = new PPPConfigWidget( (InterfacePPP*)i, 128 PPPConfigWidget *pppconfig = new PPPConfigWidget( (InterfacePPP*)i,
129 0, "PPPConfig", false, 129 0, "PPPConfig", false,
130 Qt::WDestructiveClose | Qt::WStyle_ContextHelp); 130 Qt::WDestructiveClose | Qt::WStyle_ContextHelp);
131 return pppconfig; 131 return pppconfig;
132} 132}
133 133
134/** 134/**
135 * Create, and return the Information Module 135 * Create, and return the Information Module
136 * @return QWidget* pointer to this modules info. 136 * @return QWidget* pointer to this modules info.
137 */ 137 */
138QWidget *PPPModule::information(Interface *i){ 138QWidget *PPPModule::information(Interface *i){
139 // We don't have any advanced pppd information widget yet :-D 139 // We don't have any advanced pppd information widget yet :-D
140 // TODO ^ 140 // TODO ^
141 141
142 return new InterfaceInformationPPP( 0, "InterfaceInformationPPP", i ); 142 return new InterfaceInformationPPP( 0, "InterfaceInformationPPP", i );
143} 143}
144 144
145/** 145/**
146 * Get all active (up or down) interfaces 146 * Get all active (up or down) interfaces
147 * @return QList<Interface> A list of interfaces that exsist that havn't 147 * @return QList<Interface> A list of interfaces that exsist that havn't
148 * been called by isOwner() 148 * been called by isOwner()
149 */ 149 */
150QList<Interface> PPPModule::getInterfaces(){ 150QList<Interface> PPPModule::getInterfaces(){
151 // List all of the files in the peer directory 151 // List all of the files in the peer directory
152 qDebug("PPPModule::getInterfaces"); 152 qDebug("PPPModule::getInterfaces");
153 return list; 153 return list;
154} 154}
155 155
156/** 156/**
157 * Attempt to add a new interface as defined by name 157 * Attempt to add a new interface as defined by name
158 * @param name the name of the type of interface that should be created given 158 * @param name the name of the type of interface that should be created given
159 * by possibleNewInterfaces(); 159 * by possibleNewInterfaces();
160 * @return Interface* NULL if it was unable to be created. 160 * @return Interface* NULL if it was unable to be created.
161 */ 161 */
162Interface *PPPModule::addNewInterface(const QString &newInterface){ 162Interface *PPPModule::addNewInterface(const QString &newInterface){
163 163
164 InterfacePPP *ifaceppp; 164 InterfacePPP *ifaceppp;
165 Interface *iface; 165 Interface *iface;
166 ifaceppp = new InterfacePPP(); 166 ifaceppp = new InterfacePPP();
167 PPPConfigWidget imp(ifaceppp, 0, "PPPConfigImp", true); 167 PPPConfigWidget imp(ifaceppp, 0, "PPPConfigImp", true);
168 imp.showMaximized(); 168 imp.showMaximized();
169 if(imp.exec() == QDialog::Accepted ){ 169 if(imp.exec() == QDialog::Accepted ){
170 iface = (InterfacePPP*) ifaceppp; 170 iface = (InterfacePPP*) ifaceppp;
171 iface->setModuleOwner( this ); 171 iface->setModuleOwner( this );
172 list.append( iface ); 172 list.append( iface );
173 return iface; 173 return iface;
174 }else { 174 }else {
175 delete ifaceppp; 175 delete ifaceppp;
176 iface = NULL; 176 iface = NULL;
177 } 177 }
178 return iface; 178 return iface;
179} 179}
180 180
181/** 181/**
182 * Attempts to remove the interface, doesn't delete i 182 * Attempts to remove the interface, doesn't delete i
183 * @return bool true if successfull, false otherwise. 183 * @return bool true if successful, false otherwise.
184 */ 184 */
185bool PPPModule::remove(Interface *i){ 185bool PPPModule::remove(Interface *i){
186 return list.remove(i); 186 return list.remove(i);
187} 187}
188 188
189void PPPModule::possibleNewInterfaces(QMap<QString, QString> &newIfaces) 189void PPPModule::possibleNewInterfaces(QMap<QString, QString> &newIfaces)
190{ 190{
191 newIfaces.insert(QObject::tr("PPP") , 191 newIfaces.insert(QObject::tr("PPP") ,
192 QObject::tr("generic ppp device")); 192 QObject::tr("generic ppp device"));
193} 193}
194 194
195 195
196 196
197namespace { 197namespace {
198 InterfaceKeeper::InterfaceKeeper( ) { 198 InterfaceKeeper::InterfaceKeeper( ) {
199 } 199 }
200 InterfaceKeeper::~InterfaceKeeper() { 200 InterfaceKeeper::~InterfaceKeeper() {
201 Config cfg("ppp_plugin_keeper"); 201 Config cfg("ppp_plugin_keeper");
202 QStringList lst = cfg.groupList(); 202 QStringList lst = cfg.groupList();
203 for (QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) { 203 for (QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) {
204 Connection con; 204 Connection con;
205 cfg.setGroup( (*it) ); 205 cfg.setGroup( (*it) );
206 cfg.clearGroup(); 206 cfg.clearGroup();
207 } 207 }
208 208
209 for (QMap<QString, Connection>::Iterator it = m_interfaces.begin(); it != m_interfaces.end(); ++it ) { 209 for (QMap<QString, Connection>::Iterator it = m_interfaces.begin(); it != m_interfaces.end(); ++it ) {
210 Connection con = it.data(); 210 Connection con = it.data();
211 cfg.setGroup( con.name ); 211 cfg.setGroup( con.name );
212 cfg.writeEntry( "pid", con.pid ); 212 cfg.writeEntry( "pid", con.pid );
213 cfg.writeEntry( "device", con.device ); 213 cfg.writeEntry( "device", con.device );
214 } 214 }
215 } 215 }
216 void InterfaceKeeper::addInterface(pid_t pid, const QString& dev, const QString& name ) { 216 void InterfaceKeeper::addInterface(pid_t pid, const QString& dev, const QString& name ) {
217 Connection con; 217 Connection con;
218 con.pid = pid; 218 con.pid = pid;
219 con.device = dev; 219 con.device = dev;
220 con.name = name; 220 con.name = name;
221 m_interfaces.insert( name, con ); 221 m_interfaces.insert( name, con );
222 } 222 }
223 QMap<QString, Connection> InterfaceKeeper::interfaces()const { 223 QMap<QString, Connection> InterfaceKeeper::interfaces()const {
224 Config cfg("ppp_plugin_keeper"); 224 Config cfg("ppp_plugin_keeper");
225 QMap<QString, Connection> ifaces; 225 QMap<QString, Connection> ifaces;
226 QStringList lst = cfg.groupList(); 226 QStringList lst = cfg.groupList();
227 for (QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) { 227 for (QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) {
228 Connection con; 228 Connection con;
229 cfg.setGroup( (*it) ); 229 cfg.setGroup( (*it) );
230 con.name = (*it); 230 con.name = (*it);
231 con.pid = cfg.readNumEntry("pid"); 231 con.pid = cfg.readNumEntry("pid");
232 con.device = cfg.readEntry("device"); 232 con.device = cfg.readEntry("device");
233 qDebug(" %s %s %d", con.name.latin1(), con.device.latin1(), con.pid ); 233 qDebug(" %s %s %d", con.name.latin1(), con.device.latin1(), con.pid );
234 234
235 if ( con.pid != -1 && isAvailable( con.pid ) ) 235 if ( con.pid != -1 && isAvailable( con.pid ) )
236 ifaces.insert( con.name, con ); 236 ifaces.insert( con.name, con );
237 } 237 }
238 return ifaces; 238 return ifaces;
239 } 239 }
240 bool InterfaceKeeper::isAvailable( pid_t p)const { 240 bool InterfaceKeeper::isAvailable( pid_t p)const {
241 if (::kill(p, 0 ) == 0 || errno != ESRCH ) { 241 if (::kill(p, 0 ) == 0 || errno != ESRCH ) {
242 qDebug("isAvailable %d", p); 242 qDebug("isAvailable %d", p);
243 return true; 243 return true;
244 } 244 }
245 245
246 qDebug("notAvailable %d", p); 246 qDebug("notAvailable %d", p);
247 return false; 247 return false;
248 } 248 }
249 249
250} 250}
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
@@ -62,139 +62,139 @@ QString WExtensions::essid(){
62 if(!hasWirelessExtensions) 62 if(!hasWirelessExtensions)
63 return QString(); 63 return QString();
64 if ( 0 == ioctl( fd, SIOCGIWESSID, &iwr )){ 64 if ( 0 == ioctl( fd, SIOCGIWESSID, &iwr )){
65 iwr.u.essid.pointer[(unsigned int) iwr.u.essid.length] = '\0'; 65 iwr.u.essid.pointer[(unsigned int) iwr.u.essid.length] = '\0';
66 return QString(iwr.u.essid.pointer); 66 return QString(iwr.u.essid.pointer);
67 } 67 }
68 return QString(); 68 return QString();
69} 69}
70 70
71/** 71/**
72 * @return QString the mode of interface 72 * @return QString the mode of interface
73 */ 73 */
74QString WExtensions::mode(){ 74QString WExtensions::mode(){
75 if(!hasWirelessExtensions) 75 if(!hasWirelessExtensions)
76 return QString(); 76 return QString();
77 if ( 0 == ioctl( fd, SIOCGIWMODE, &iwr ) ) 77 if ( 0 == ioctl( fd, SIOCGIWMODE, &iwr ) )
78 return QString("%1").arg(iwr.u.mode == IW_MODE_ADHOC ? "Ad-Hoc" : "Managed"); 78 return QString("%1").arg(iwr.u.mode == IW_MODE_ADHOC ? "Ad-Hoc" : "Managed");
79 return QString(); 79 return QString();
80} 80}
81 81
82/** 82/**
83 * Get the frequency that the interface is running at. 83 * Get the frequency that the interface is running at.
84 * @return int the frequency that the interfacae is running at. 84 * @return int the frequency that the interfacae is running at.
85 */ 85 */
86double WExtensions::frequency(){ 86double WExtensions::frequency(){
87 if(!hasWirelessExtensions) 87 if(!hasWirelessExtensions)
88 return 0; 88 return 0;
89 if ( 0 == ioctl( fd, SIOCGIWFREQ, &iwr )) 89 if ( 0 == ioctl( fd, SIOCGIWFREQ, &iwr ))
90 return (double( iwr.u.freq.m ) * pow( 10, iwr.u.freq.e ) / 1000000000); 90 return (double( iwr.u.freq.m ) * pow( 10, iwr.u.freq.e ) / 1000000000);
91 return 0; 91 return 0;
92} 92}
93 93
94/** 94/**
95 * Get the channel that the interface is running at. 95 * Get the channel that the interface is running at.
96 * @return int the channel that the interfacae is running at. 96 * @return int the channel that the interfacae is running at.
97 */ 97 */
98int WExtensions::channel(){ 98int WExtensions::channel(){
99 if(!hasWirelessExtensions) 99 if(!hasWirelessExtensions)
100 return 0; 100 return 0;
101 if ( 0 != ioctl( fd, SIOCGIWFREQ, &iwr )) 101 if ( 0 != ioctl( fd, SIOCGIWFREQ, &iwr ))
102 return 0; 102 return 0;
103 103
104 // http://www.elanix.com/pdf/an137e.pdf 104 // http://www.elanix.com/pdf/an137e.pdf
105 105
106 double num = (double( iwr.u.freq.m ) * pow( 10, iwr.u.freq.e ) / 1000000000); 106 double num = (double( iwr.u.freq.m ) * pow( 10, iwr.u.freq.e ) / 1000000000);
107 double left = 2.401; 107 double left = 2.401;
108 double right = 2.416; 108 double right = 2.416;
109 for(int channel = 1; channel<= 15; channel++){ 109 for(int channel = 1; channel<= 15; channel++){
110 if( num >= left && num <= right ) 110 if( num >= left && num <= right )
111 return channel; 111 return channel;
112 left += 0.005; 112 left += 0.005;
113 right += 0.005; 113 right += 0.005;
114 } 114 }
115 qDebug(QString("Unknown frequency: %1, returning -1 for the channel.").arg(num).latin1()); 115 qDebug(QString("Unknown frequency: %1, returning -1 for the channel.").arg(num).latin1());
116 return -1; 116 return -1;
117} 117}
118 118
119/*** 119/***
120 * Get the current rate that the card is transmiting at. 120 * Get the current rate that the card is transmiting at.
121 * @return double the rate, 0 if error. 121 * @return double the rate, 0 if error.
122 */ 122 */
123double WExtensions::rate(){ 123double WExtensions::rate(){
124 if(!hasWirelessExtensions) 124 if(!hasWirelessExtensions)
125 return 0; 125 return 0;
126 if(0 == ioctl(fd, SIOCGIWRATE, &iwr)){ 126 if(0 == ioctl(fd, SIOCGIWRATE, &iwr)){
127 return ((double)iwr.u.bitrate.value)/1000000; 127 return ((double)iwr.u.bitrate.value)/1000000;
128 } 128 }
129 return 0; 129 return 0;
130} 130}
131 131
132 132
133/** 133/**
134 * @return QString the AccessPoint that the interface is connected to. 134 * @return QString the AccessPoint that the interface is connected to.
135 */ 135 */
136QString WExtensions::ap(){ 136QString WExtensions::ap(){
137 if(!hasWirelessExtensions) 137 if(!hasWirelessExtensions)
138 return QString(); 138 return QString();
139 if ( 0 == ioctl( fd, SIOCGIWAP, &iwr )){ 139 if ( 0 == ioctl( fd, SIOCGIWAP, &iwr )){
140 QString ap; 140 QString ap;
141 ap = ap.sprintf( "%.2X:%.2X:%.2X:%.2X:%.2X:%.2X", 141 ap = ap.sprintf( "%.2X:%.2X:%.2X:%.2X:%.2X:%.2X",
142 iwr.u.ap_addr.sa_data[0]&0xff, 142 iwr.u.ap_addr.sa_data[0]&0xff,
143 iwr.u.ap_addr.sa_data[1]&0xff, 143 iwr.u.ap_addr.sa_data[1]&0xff,
144 iwr.u.ap_addr.sa_data[2]&0xff, 144 iwr.u.ap_addr.sa_data[2]&0xff,
145 iwr.u.ap_addr.sa_data[3]&0xff, 145 iwr.u.ap_addr.sa_data[3]&0xff,
146 iwr.u.ap_addr.sa_data[4]&0xff, 146 iwr.u.ap_addr.sa_data[4]&0xff,
147 iwr.u.ap_addr.sa_data[5]&0xff ); 147 iwr.u.ap_addr.sa_data[5]&0xff );
148 return ap; 148 return ap;
149 } 149 }
150 else return QString(); 150 else return QString();
151} 151}
152 152
153/** 153/**
154 * Get the stats for interfaces 154 * Get the stats for interfaces
155 * @param signal the signal strength of interface 155 * @param signal the signal strength of interface
156 * @param noise the noise level of the interface 156 * @param noise the noise level of the interface
157 * @param quality the quality level of the interface 157 * @param quality the quality level of the interface
158 * @return bool true if successfull 158 * @return bool true if successful
159 */ 159 */
160bool WExtensions::stats(int &signal, int &noise, int &quality){ 160bool WExtensions::stats(int &signal, int &noise, int &quality){
161 // gather link quality from /proc/net/wireless 161 // gather link quality from /proc/net/wireless
162 if(!QFile::exists(PROCNETWIRELESS)) 162 if(!QFile::exists(PROCNETWIRELESS))
163 return false; 163 return false;
164 164
165 char c; 165 char c;
166 QString status; 166 QString status;
167 QString name; 167 QString name;
168 168
169 QFile wfile( PROCNETWIRELESS ); 169 QFile wfile( PROCNETWIRELESS );
170 if(!wfile.open( IO_ReadOnly )) 170 if(!wfile.open( IO_ReadOnly ))
171 return false; 171 return false;
172 172
173 QTextStream wstream( &wfile ); 173 QTextStream wstream( &wfile );
174 wstream.readLine(); // skip the first two lines 174 wstream.readLine(); // skip the first two lines
175 wstream.readLine(); // because they only contain headers 175 wstream.readLine(); // because they only contain headers
176 while(!wstream.atEnd()){ 176 while(!wstream.atEnd()){
177 wstream >> name >> status >> quality >> c >> signal >> c >> noise; 177 wstream >> name >> status >> quality >> c >> signal >> c >> noise;
178 if(name == QString("%1:").arg(interface)){ 178 if(name == QString("%1:").arg(interface)){
179 if ( quality > 92 ) 179 if ( quality > 92 )
180 qDebug( "WIFIAPPLET: D'oh! Quality %d > estimated max!\n", quality ); 180 qDebug( "WIFIAPPLET: D'oh! Quality %d > estimated max!\n", quality );
181 if ( ( signal > IW_UPPER ) || ( signal < IW_LOWER ) ) 181 if ( ( signal > IW_UPPER ) || ( signal < IW_LOWER ) )
182 qDebug( "WIFIAPPLET: Doh! Strength %d > estimated max!\n", signal ); 182 qDebug( "WIFIAPPLET: Doh! Strength %d > estimated max!\n", signal );
183 if ( ( noise > IW_UPPER ) || ( noise < IW_LOWER ) ) 183 if ( ( noise > IW_UPPER ) || ( noise < IW_LOWER ) )
184 qDebug( "WIFIAPPLET: Doh! Noise %d > estimated max!\n", noise ); 184 qDebug( "WIFIAPPLET: Doh! Noise %d > estimated max!\n", noise );
185 //qDebug(QString("q:%1, s:%2, n:%3").arg(quality).arg(signal).arg(noise).latin1()); 185 //qDebug(QString("q:%1, s:%2, n:%3").arg(quality).arg(signal).arg(noise).latin1());
186 signal = ( ( signal-IW_LOWER ) * 100 ) / IW_UPPER; 186 signal = ( ( signal-IW_LOWER ) * 100 ) / IW_UPPER;
187 noise = ( ( noise-IW_LOWER ) * 100 ) / IW_UPPER; 187 noise = ( ( noise-IW_LOWER ) * 100 ) / IW_UPPER;
188 quality = ( quality*100 ) / 92; 188 quality = ( quality*100 ) / 92;
189 return true; 189 return true;
190 } 190 }
191 } 191 }
192 192
193 qDebug("WExtensions::statsCard no longer present."); 193 qDebug("WExtensions::statsCard no longer present.");
194 quality = -1; 194 quality = -1;
195 signal = IW_LOWER; 195 signal = IW_LOWER;
196 noise = IW_LOWER; 196 noise = IW_LOWER;
197 return false; 197 return false;
198} 198}
199 199
200// wextensions.cpp 200// 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
@@ -17,193 +17,193 @@
17 17
18/** 18/**
19 * Constructor, find all of the possible interfaces 19 * Constructor, find all of the possible interfaces
20 */ 20 */
21WLANModule::WLANModule() 21WLANModule::WLANModule()
22 : Module(), 22 : Module(),
23 wlanconfigWiget(0) 23 wlanconfigWiget(0)
24{ 24{
25} 25}
26 26
27/** 27/**
28 * Delete any interfaces that we own. 28 * Delete any interfaces that we own.
29 */ 29 */
30WLANModule::~WLANModule(){ 30WLANModule::~WLANModule(){
31 Interface *i; 31 Interface *i;
32 for ( i=list.first(); i != 0; i=list.next() ) 32 for ( i=list.first(); i != 0; i=list.next() )
33 delete i; 33 delete i;
34 34
35} 35}
36 36
37/** 37/**
38 * Change the current profile 38 * Change the current profile
39 */ 39 */
40void WLANModule::setProfile(const QString &newProfile){ 40void WLANModule::setProfile(const QString &newProfile){
41 profile = newProfile; 41 profile = newProfile;
42} 42}
43 43
44/** 44/**
45 * get the icon name for this device. 45 * get the icon name for this device.
46 * @param Interface* can be used in determining the icon. 46 * @param Interface* can be used in determining the icon.
47 * @return QString the icon name (minus .png, .gif etc) 47 * @return QString the icon name (minus .png, .gif etc)
48 */ 48 */
49QString WLANModule::getPixmapName(Interface* ){ 49QString WLANModule::getPixmapName(Interface* ){
50 return "wlan"; 50 return "wlan";
51} 51}
52 52
53/** 53/**
54 * Check to see if the interface i is owned by this module. 54 * Check to see if the interface i is owned by this module.
55 * @param Interface* interface to check against 55 * @param Interface* interface to check against
56 * @return bool true if i is owned by this module, false otherwise. 56 * @return bool true if i is owned by this module, false otherwise.
57 */ 57 */
58bool WLANModule::isOwner(Interface *i){ 58bool WLANModule::isOwner(Interface *i){
59 WExtensions we(i->getInterfaceName()); 59 WExtensions we(i->getInterfaceName());
60 if(!we.doesHaveWirelessExtensions()) 60 if(!we.doesHaveWirelessExtensions())
61 return false; 61 return false;
62 62
63 i->setHardwareName("802.11b"); 63 i->setHardwareName("802.11b");
64 list.append(i); 64 list.append(i);
65 return true; 65 return true;
66} 66}
67 67
68/** 68/**
69 * Create, and return the WLANConfigure Module 69 * Create, and return the WLANConfigure Module
70 * @return QWidget* pointer to this modules configure. 70 * @return QWidget* pointer to this modules configure.
71 */ 71 */
72QWidget *WLANModule::configure(Interface *i){ 72QWidget *WLANModule::configure(Interface *i){
73 WLANImp *wlanconfig = new WLANImp(0, "WlanConfig", i, true, Qt::WDestructiveClose); 73 WLANImp *wlanconfig = new WLANImp(0, "WlanConfig", i, true, Qt::WDestructiveClose);
74 wlanconfig->setProfile(profile); 74 wlanconfig->setProfile(profile);
75 return wlanconfig; 75 return wlanconfig;
76} 76}
77 77
78/** 78/**
79 * Create, and return the Information Module 79 * Create, and return the Information Module
80 * @return QWidget* pointer to this modules info. 80 * @return QWidget* pointer to this modules info.
81 */ 81 */
82QWidget *WLANModule::information(Interface *i){ 82QWidget *WLANModule::information(Interface *i){
83 WExtensions we(i->getInterfaceName()); 83 WExtensions we(i->getInterfaceName());
84 if(!we.doesHaveWirelessExtensions()) 84 if(!we.doesHaveWirelessExtensions())
85 return NULL; 85 return NULL;
86 86
87 return getInfo( i ); 87 return getInfo( i );
88} 88}
89 89
90/** 90/**
91 * Get all active (up or down) interfaces 91 * Get all active (up or down) interfaces
92 * @return QList<Interface> A list of interfaces that exsist that havn't 92 * @return QList<Interface> A list of interfaces that exsist that havn't
93 * been called by isOwner() 93 * been called by isOwner()
94 */ 94 */
95QList<Interface> WLANModule::getInterfaces(){ 95QList<Interface> WLANModule::getInterfaces(){
96 return list; 96 return list;
97} 97}
98 98
99/** 99/**
100 * Attempt to add a new interface as defined by name 100 * Attempt to add a new interface as defined by name
101 * @param name the name of the type of interface that should be created given 101 * @param name the name of the type of interface that should be created given
102 * by possibleNewInterfaces(); 102 * by possibleNewInterfaces();
103 * @return Interface* NULL if it was unable to be created. 103 * @return Interface* NULL if it was unable to be created.
104 */ 104 */
105Interface *WLANModule::addNewInterface(const QString &){ 105Interface *WLANModule::addNewInterface(const QString &){
106 // We can't add a 802.11 interface, either the hardware will be there 106 // We can't add a 802.11 interface, either the hardware will be there
107 // or it wont. 107 // or it wont.
108 return NULL; 108 return NULL;
109} 109}
110 110
111/** 111/**
112 * Attempts to remove the interface, doesn't delete i 112 * Attempts to remove the interface, doesn't delete i
113 * @return bool true if successfull, false otherwise. 113 * @return bool true if successful, false otherwise.
114 */ 114 */
115bool WLANModule::remove(Interface*){ 115bool WLANModule::remove(Interface*){
116 // Can't remove a hardware device, you can stop it though. 116 // Can't remove a hardware device, you can stop it though.
117 return false; 117 return false;
118} 118}
119 119
120void WLANModule::receive(const QCString &param, const QByteArray &arg) 120void WLANModule::receive(const QCString &param, const QByteArray &arg)
121{ 121{
122 qDebug("WLANModule::receive "+param); 122 qDebug("WLANModule::receive "+param);
123 QStringList params = QStringList::split(",",param); 123 QStringList params = QStringList::split(",",param);
124 int count = params.count(); 124 int count = params.count();
125 qDebug("WLANModule got %i params", count ); 125 qDebug("WLANModule got %i params", count );
126 if (count < 2){ 126 if (count < 2){
127 qDebug("Erorr less than 2 parameter"); 127 qDebug("Erorr less than 2 parameter");
128 qDebug("RETURNING"); 128 qDebug("RETURNING");
129 return; 129 return;
130 } 130 }
131 131
132 QDataStream stream(arg,IO_ReadOnly); 132 QDataStream stream(arg,IO_ReadOnly);
133 QString interface; 133 QString interface;
134 QString action; 134 QString action;
135 int countMsgs = 0; 135 int countMsgs = 0;
136 stream >> interface; 136 stream >> interface;
137 qDebug("got count? >%s<",interface.latin1()); 137 qDebug("got count? >%s<",interface.latin1());
138 if (interface == "count"){ 138 if (interface == "count"){
139 qDebug("got count"); 139 qDebug("got count");
140 stream >> action; 140 stream >> action;
141 qDebug("Got count num >%s<", action.latin1()); 141 qDebug("Got count num >%s<", action.latin1());
142 countMsgs = action.toInt(); 142 countMsgs = action.toInt();
143 } 143 }
144 144
145 QDialog *toShow; 145 QDialog *toShow;
146 //while (! stream.atEnd() ){ 146 //while (! stream.atEnd() ){
147 for (int i = 0; i < countMsgs; i++){ 147 for (int i = 0; i < countMsgs; i++){
148 qDebug("start stream %d/%d",i,countMsgs); 148 qDebug("start stream %d/%d",i,countMsgs);
149 if (stream.atEnd()){ 149 if (stream.atEnd()){
150 qDebug("end of stream"); 150 qDebug("end of stream");
151 return; 151 return;
152 } 152 }
153 stream >> interface; 153 stream >> interface;
154 qDebug("got iface"); 154 qDebug("got iface");
155 stream >> action; 155 stream >> action;
156 qDebug("WLANModule got interface %s and acion %s", interface.latin1(), action.latin1()); 156 qDebug("WLANModule got interface %s and acion %s", interface.latin1(), action.latin1());
157 // find interfaces 157 // find interfaces
158 Interface *ifa=0; 158 Interface *ifa=0;
159 for ( Interface *i=list.first(); i != 0; i=list.next() ){ 159 for ( Interface *i=list.first(); i != 0; i=list.next() ){
160 if (i->getInterfaceName() == interface){ 160 if (i->getInterfaceName() == interface){
161 qDebug("WLANModule found interface %s",interface.latin1()); 161 qDebug("WLANModule found interface %s",interface.latin1());
162 ifa = i; 162 ifa = i;
163 } 163 }
164 } 164 }
165 165
166 if (ifa == 0){ 166 if (ifa == 0){
167 qDebug("WLANModule Did not find %s",interface.latin1()); 167 qDebug("WLANModule Did not find %s",interface.latin1());
168 qDebug("skipping"); 168 qDebug("skipping");
169 count = 0; 169 count = 0;
170 } 170 }
171 171
172 if (count == 2){ 172 if (count == 2){
173 // those should call the interface directly 173 // those should call the interface directly
174 QWidget *info = getInfo( ifa ); 174 QWidget *info = getInfo( ifa );
175 info->showMaximized(); 175 info->showMaximized();
176 176
177 if ( action.contains("start" ) ){ 177 if ( action.contains("start" ) ){
178 ifa->start(); 178 ifa->start();
179 } else if ( action.contains("restart" ) ){ 179 } else if ( action.contains("restart" ) ){
180 ifa->restart(); 180 ifa->restart();
181 } else if ( action.contains("stop" ) ){ 181 } else if ( action.contains("stop" ) ){
182 ifa->stop(); 182 ifa->stop();
183 }else if ( action.contains("refresh" ) ){ 183 }else if ( action.contains("refresh" ) ){
184 ifa->refresh(); 184 ifa->refresh();
185 } 185 }
186 }else if (count == 3){ 186 }else if (count == 3){
187 QString value; 187 QString value;
188 if (!wlanconfigWiget){ 188 if (!wlanconfigWiget){
189 //FIXME: what if it got closed meanwhile? 189 //FIXME: what if it got closed meanwhile?
190 wlanconfigWiget = (WLANImp*) configure(ifa); 190 wlanconfigWiget = (WLANImp*) configure(ifa);
191 toShow = (QDialog*) wlanconfigWiget; 191 toShow = (QDialog*) wlanconfigWiget;
192 } 192 }
193 wlanconfigWiget->showMaximized(); 193 wlanconfigWiget->showMaximized();
194 stream >> value; 194 stream >> value;
195 qDebug("WLANModule (build 4) is setting %s of %s to %s", action.latin1(), interface.latin1(), value.latin1() ); 195 qDebug("WLANModule (build 4) is setting %s of %s to %s", action.latin1(), interface.latin1(), value.latin1() );
196 if (value.isEmpty()){ 196 if (value.isEmpty()){
197 qDebug("value is empty!!!\nreturning"); 197 qDebug("value is empty!!!\nreturning");
198 return; 198 return;
199 } 199 }
200 if ( action.contains("ESSID") ){ 200 if ( action.contains("ESSID") ){
201 QComboBox *combo = wlanconfigWiget->essid; 201 QComboBox *combo = wlanconfigWiget->essid;
202 bool found = false; 202 bool found = false;
203 for ( int i = 0; i < combo->count(); i++) 203 for ( int i = 0; i < combo->count(); i++)
204 if ( combo->text( i ) == value ){ 204 if ( combo->text( i ) == value ){
205 combo->setCurrentItem( i ); 205 combo->setCurrentItem( i );
206 found = true; 206 found = true;
207 } 207 }
208 if (!found) combo->insertItem( value, 0 ); 208 if (!found) combo->insertItem( value, 0 );
209 }else if ( action.contains("Mode") ){ 209 }else if ( action.contains("Mode") ){
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
@@ -95,211 +95,211 @@ void TabManager::rescanFolder(QString directory, QListViewItem* parent){
95 AppLnk app(directory + "/" + fi->fileName()); 95 AppLnk app(directory + "/" + fi->fileName());
96 if(parent){ 96 if(parent){
97 parent->setPixmap(0,app.pixmap()); 97 parent->setPixmap(0,app.pixmap());
98 parent->setText(0, app.name()); 98 parent->setText(0, app.name());
99 } 99 }
100 } 100 }
101 else{ 101 else{
102 // Add any desktop files found. 102 // Add any desktop files found.
103 QListViewItem* newItem; 103 QListViewItem* newItem;
104 if(directory != HOME_APP_DIR){ 104 if(directory != HOME_APP_DIR){
105 if(!parent) 105 if(!parent)
106 newItem = new QListViewItem(tabList, fi->fileName()); 106 newItem = new QListViewItem(tabList, fi->fileName());
107 else 107 else
108 newItem = new QListViewItem(parent, fi->fileName()); 108 newItem = new QListViewItem(parent, fi->fileName());
109 if(fi->fileName().right(APPLICATION_EXTENSION_LENGTH) == APPLICATION_EXTENSION){ 109 if(fi->fileName().right(APPLICATION_EXTENSION_LENGTH) == APPLICATION_EXTENSION){
110 AppLnk app(directory + "/" + fi->fileName()); 110 AppLnk app(directory + "/" + fi->fileName());
111 newItem->setPixmap(0,app.pixmap()); 111 newItem->setPixmap(0,app.pixmap());
112 newItem->setText(0, app.name()); 112 newItem->setText(0, app.name());
113 itemList.insert(newItem, directory + "/" + fi->fileName()); 113 itemList.insert(newItem, directory + "/" + fi->fileName());
114 } 114 }
115 } 115 }
116 } 116 }
117 } 117 }
118 ++it; // goto next list element 118 ++it; // goto next list element
119 } 119 }
120} 120}
121 121
122/** 122/**
123 * Create a new blank Tab. 123 * Create a new blank Tab.
124 * Create a physical folder with .directory file 124 * Create a physical folder with .directory file
125 * Create a item on the list 125 * Create a item on the list
126 */ 126 */
127void TabManager::newFolder(){ 127void TabManager::newFolder(){
128 QDir r; 128 QDir r;
129 r.mkdir(QString(HOME_APP_DIR) + "/" + NEW_FOLDER); 129 r.mkdir(QString(HOME_APP_DIR) + "/" + NEW_FOLDER);
130 system((QString("echo [Desktop Entry] | cat >> ") + HOME_APP_DIR + "/" + NEW_FOLDER "/.directory").latin1()); 130 system((QString("echo [Desktop Entry] | cat >> ") + HOME_APP_DIR + "/" + NEW_FOLDER "/.directory").latin1());
131 system((QString("echo Name=" NEW_FOLDER " | cat >> ") + HOME_APP_DIR + "/" + NEW_FOLDER "/.directory").latin1()); 131 system((QString("echo Name=" NEW_FOLDER " | cat >> ") + HOME_APP_DIR + "/" + NEW_FOLDER "/.directory").latin1());
132 132
133 QString homeLocation = QString(HOME_APP_DIR) + "/" + NEW_FOLDER + "/.directory"; 133 QString homeLocation = QString(HOME_APP_DIR) + "/" + NEW_FOLDER + "/.directory";
134 QListViewItem *newItem = new QListViewItem(tabList, NEW_FOLDER); 134 QListViewItem *newItem = new QListViewItem(tabList, NEW_FOLDER);
135 itemList.insert(newItem, homeLocation ); 135 itemList.insert(newItem, homeLocation );
136 136
137 // We have changed something. 137 // We have changed something.
138 changed = true; 138 changed = true;
139} 139}
140 140
141/** 141/**
142 * Create a new blank application 142 * Create a new blank application
143 * Make sure a tab is selected 143 * Make sure a tab is selected
144 * create physical file 144 * create physical file
145 * fill file with default information (entry, name, type). 145 * fill file with default information (entry, name, type).
146 */ 146 */
147void TabManager::newApplication(){ 147void TabManager::newApplication(){
148 QListViewItem *item = tabList->currentItem(); 148 QListViewItem *item = tabList->currentItem();
149 if(!item || item->parent()) 149 if(!item || item->parent())
150 return; 150 return;
151 151
152 QString parentDir = itemList[item].mid(0,itemList[item].length()-11); 152 QString parentDir = itemList[item].mid(0,itemList[item].length()-11);
153 QString homeLocation = parentDir + "/" NEW_APPLICATION APPLICATION_EXTENSION; 153 QString homeLocation = parentDir + "/" NEW_APPLICATION APPLICATION_EXTENSION;
154 system((QString("echo [Desktop Entry] | cat >> ") + homeLocation).latin1()); 154 system((QString("echo [Desktop Entry] | cat >> ") + homeLocation).latin1());
155 system((QString("echo Name=" NEW_APPLICATION " | cat >> ") + homeLocation).latin1()); 155 system((QString("echo Name=" NEW_APPLICATION " | cat >> ") + homeLocation).latin1());
156 int slash = parentDir.findRev('/', -1); 156 int slash = parentDir.findRev('/', -1);
157 QString folderName = parentDir.mid(slash+1, parentDir.length()); 157 QString folderName = parentDir.mid(slash+1, parentDir.length());
158 158
159 system((QString("echo Type=") + folderName + " | cat >> " + homeLocation).latin1()); 159 system((QString("echo Type=") + folderName + " | cat >> " + homeLocation).latin1());
160 160
161 // Insert into the tree 161 // Insert into the tree
162 QListViewItem *newItem = new QListViewItem(item, NEW_APPLICATION); 162 QListViewItem *newItem = new QListViewItem(item, NEW_APPLICATION);
163 itemList.insert(newItem, homeLocation ); 163 itemList.insert(newItem, homeLocation );
164 164
165 // We have changed something. 165 // We have changed something.
166 changed = true; 166 changed = true;
167} 167}
168 168
169/** 169/**
170 * Remove the item. 170 * Remove the item.
171 * Check if we can 171 * Check if we can
172 * Prompt user 172 * Prompt user
173 * Delete physical file (Dir, remove .dir, then dir. File, remove file) 173 * Delete physical file (Dir, remove .dir, then dir. File, remove file)
174 * Remove from installer if need too. 174 * Remove from installer if need too.
175 */ 175 */
176void TabManager::removeItem(){ 176void TabManager::removeItem(){
177 // Make sure we can delete 177 // Make sure we can delete
178 QListViewItem *item = tabList->currentItem(); 178 QListViewItem *item = tabList->currentItem();
179 if(!item) 179 if(!item)
180 return; 180 return;
181 if(item->childCount() > 0){ 181 if(item->childCount() > 0){
182 QMessageBox::critical(this, tr("Message"), tr("Can't remove with applications\nstill in the group."), tr("Ok") ); 182 QMessageBox::critical(this, tr("Message"), tr("Can't remove with applications\nstill in the group."), tr("Ok") );
183 return; 183 return;
184 } 184 }
185 185
186 // Prompt. 186 // Prompt.
187 int answer = QMessageBox::warning(this, tr("Message"), tr("Are you sure you want to delete?"), tr("Yes"), tr("Cancel"), 0, 1 ); 187 int answer = QMessageBox::warning(this, tr("Message"), tr("Are you sure you want to delete?"), tr("Yes"), tr("Cancel"), 0, 1 );
188 if (answer) 188 if (answer)
189 return; 189 return;
190 190
191 bool removeSuccessfull = true; 191 bool removeSuccessful = true;
192 QString location = itemList[item]; 192 QString location = itemList[item];
193 // Remove file (.directory in a Directory case) 193 // Remove file (.directory in a Directory case)
194 if(!QFile::remove(location)) 194 if(!QFile::remove(location))
195 removeSuccessfull = false; 195 removeSuccessful = false;
196 196
197 // Remove directory 197 // Remove directory
198 if(item->parent() == NULL){ 198 if(item->parent() == NULL){
199 // Remove .directory file string 199 // Remove .directory file string
200 location = location.mid(0,location.length()-10); 200 location = location.mid(0,location.length()-10);
201 QDir dir; 201 QDir dir;
202 if(!dir.rmdir(location)) 202 if(!dir.rmdir(location))
203 removeSuccessfull = false; 203 removeSuccessful = false;
204 else 204 else
205 removeSuccessfull = true; 205 removeSuccessful = true;
206 } 206 }
207 207
208 // If removing failed. 208 // If removing failed.
209 if(!removeSuccessfull){ 209 if(!removeSuccessful){
210 qDebug((QString("removeItem: ") + location).latin1()); 210 qDebug((QString("removeItem: ") + location).latin1());
211 QMessageBox::critical(this, tr("Message"), tr("Can't remove."), tr("Ok") ); 211 QMessageBox::critical(this, tr("Message"), tr("Can't remove."), tr("Ok") );
212 return; 212 return;
213 } 213 }
214 214
215 // Remove from the installer so it wont fail. 215 // Remove from the installer so it wont fail.
216 // Don't need to do this sense the current install uses rm -f so no error 216 // Don't need to do this sense the current install uses rm -f so no error
217 217
218 // Remove from the gui list. 218 // Remove from the gui list.
219 itemList.remove(item); 219 itemList.remove(item);
220 if(item->parent()) 220 if(item->parent())
221 item->parent()->takeItem(item); 221 item->parent()->takeItem(item);
222 delete item; 222 delete item;
223 223
224 // We have changed something. 224 // We have changed something.
225 changed = true; 225 changed = true;
226} 226}
227 227
228/** 228/**
229 * Helper function. Edits the current item. 229 * Helper function. Edits the current item.
230 * calls editItem with the currently selected item. 230 * calls editItem with the currently selected item.
231 */ 231 */
232void TabManager::editCurrentItem(){ 232void TabManager::editCurrentItem(){
233 editItem(tabList->currentItem()); 233 editItem(tabList->currentItem());
234} 234}
235 235
236/** 236/**
237 * Edit the item that is passed in. 237 * Edit the item that is passed in.
238 * Show application dialog and if anything changed 238 * Show application dialog and if anything changed
239 * @param item the item to edit. 239 * @param item the item to edit.
240 */ 240 */
241void TabManager::editItem( QListViewItem * item){ 241void TabManager::editItem( QListViewItem * item){
242 if(!item) 242 if(!item)
243 return; 243 return;
244 244
245 TabAppLnk app(itemList[item]); 245 TabAppLnk app(itemList[item]);
246 if(!app.isValid()){ 246 if(!app.isValid()){
247 qDebug(QString("editItem: Not a valid applnk file: ") + itemList[item].latin1()); 247 qDebug(QString("editItem: Not a valid applnk file: ") + itemList[item].latin1());
248 return; 248 return;
249 } 249 }
250 250
251 // Fill with all of the icons 251 // Fill with all of the icons
252 if(!application){ 252 if(!application){
253 Wait waitDialog(this, "Wait dialog"); 253 Wait waitDialog(this, "Wait dialog");
254 waitDialog.waitLabel->setText(tr("Gathering icons...")); 254 waitDialog.waitLabel->setText(tr("Gathering icons..."));
255 waitDialog.show(); 255 waitDialog.show();
256 qApp->processEvents(); 256 qApp->processEvents();
257 application = new AppEdit(this, "Application edit", true); 257 application = new AppEdit(this, "Application edit", true);
258 258
259 QDir d(QPEApplication::qpeDir() + "/pics/"); 259 QDir d(QPEApplication::qpeDir() + "/pics/");
260 d.setFilter( QDir::Files); 260 d.setFilter( QDir::Files);
261 261
262 const QFileInfoList *list = d.entryInfoList(); 262 const QFileInfoList *list = d.entryInfoList();
263 QFileInfoListIterator it( *list ); // create list iterator 263 QFileInfoListIterator it( *list ); // create list iterator
264 QFileInfo *fi; // pointer for traversing 264 QFileInfo *fi; // pointer for traversing
265 265
266 while ( (fi=it.current()) ) { // for each file... 266 while ( (fi=it.current()) ) { // for each file...
267 QString fileName = fi->fileName(); 267 QString fileName = fi->fileName();
268 if(fileName.right(4) == ".png"){ 268 if(fileName.right(4) == ".png"){
269 fileName = fileName.mid(0,fileName.length()-4); 269 fileName = fileName.mid(0,fileName.length()-4);
270 QPixmap imageOfFile(Resource::loadPixmap(fileName)); 270 QPixmap imageOfFile(Resource::loadPixmap(fileName));
271 QImage foo = imageOfFile.convertToImage(); 271 QImage foo = imageOfFile.convertToImage();
272 foo = foo.smoothScale(16,16); 272 foo = foo.smoothScale(16,16);
273 imageOfFile.convertFromImage(foo); 273 imageOfFile.convertFromImage(foo);
274 application->iconLineEdit->insertItem(imageOfFile,fileName); 274 application->iconLineEdit->insertItem(imageOfFile,fileName);
275 } 275 }
276 //qDebug(fi->fileName().latin1()); 276 //qDebug(fi->fileName().latin1());
277 ++it; 277 ++it;
278 } 278 }
279 waitDialog.hide(); 279 waitDialog.hide();
280 } 280 }
281 int pixmap = -1; 281 int pixmap = -1;
282 QString pixmapText = app.pixmapString(); 282 QString pixmapText = app.pixmapString();
283 QComboBox *f = application->iconLineEdit; 283 QComboBox *f = application->iconLineEdit;
284 for(int i = 0; i < application->iconLineEdit->count(); i++){ 284 for(int i = 0; i < application->iconLineEdit->count(); i++){
285 if(f->text(i) == pixmapText){ 285 if(f->text(i) == pixmapText){
286 pixmap = i; 286 pixmap = i;
287 break; 287 break;
288 } 288 }
289 } 289 }
290 if(pixmap != -1) 290 if(pixmap != -1)
291 application->iconLineEdit->setCurrentItem(pixmap); 291 application->iconLineEdit->setCurrentItem(pixmap);
292 else if(pixmapText.isEmpty()){ 292 else if(pixmapText.isEmpty()){
293 application->iconLineEdit->setCurrentItem(0); 293 application->iconLineEdit->setCurrentItem(0);
294 } 294 }
295 else{ 295 else{
296 QPixmap imageOfFile(Resource::loadPixmap(pixmapText)); 296 QPixmap imageOfFile(Resource::loadPixmap(pixmapText));
297 QImage foo = imageOfFile.convertToImage(); 297 QImage foo = imageOfFile.convertToImage();
298 foo = foo.smoothScale(16,16); 298 foo = foo.smoothScale(16,16);
299 imageOfFile.convertFromImage(foo); 299 imageOfFile.convertFromImage(foo);
300 application->iconLineEdit->insertItem(imageOfFile,pixmapText,0); 300 application->iconLineEdit->insertItem(imageOfFile,pixmapText,0);
301 application->iconLineEdit->setCurrentItem(0); 301 application->iconLineEdit->setCurrentItem(0);
302 } 302 }
303 303
304 application->nameLineEdit->setText(app.name()); 304 application->nameLineEdit->setText(app.name());
305 application->execLineEdit->setText(app.exec()); 305 application->execLineEdit->setText(app.exec());
@@ -343,166 +343,166 @@ void TabManager::editItem( QListViewItem * item){
343 item->setText(0,app.name()); 343 item->setText(0,app.name());
344 item->setPixmap(0,app.pixmap()); 344 item->setPixmap(0,app.pixmap());
345 345
346 // We have changed something. 346 // We have changed something.
347 changed = true; 347 changed = true;
348 348
349 // If we were dealing with a new folder or new application change 349 // If we were dealing with a new folder or new application change
350 // the file names. Also change the item location in itemList 350 // the file names. Also change the item location in itemList
351 if(oldName == NEW_FOLDER){ 351 if(oldName == NEW_FOLDER){
352 QDir r; 352 QDir r;
353 QString oldName = itemList[item]; 353 QString oldName = itemList[item];
354 oldName = oldName.mid(0,oldName.length()-11); 354 oldName = oldName.mid(0,oldName.length()-11);
355 QString newName = oldName.mid(0,oldName.length()-9); 355 QString newName = oldName.mid(0,oldName.length()-9);
356 newName = newName + "/" + app.name(); 356 newName = newName + "/" + app.name();
357 r.rename(oldName, newName); 357 r.rename(oldName, newName);
358 itemList.remove(item); 358 itemList.remove(item);
359 itemList.insert(item, newName + "/.directory" ); 359 itemList.insert(item, newName + "/.directory" );
360 } 360 }
361 else if(oldName == NEW_APPLICATION){ 361 else if(oldName == NEW_APPLICATION){
362 if(!item->parent()) 362 if(!item->parent())
363 return; 363 return;
364 QString parentDir = itemList[item->parent()]; 364 QString parentDir = itemList[item->parent()];
365 QDir r; 365 QDir r;
366 QString oldName = itemList[item]; 366 QString oldName = itemList[item];
367 QString newName = oldName.mid(0, parentDir.length()-10); 367 QString newName = oldName.mid(0, parentDir.length()-10);
368 newName = newName + app.name() + APPLICATION_EXTENSION; 368 newName = newName + app.name() + APPLICATION_EXTENSION;
369 r.rename(oldName, newName); 369 r.rename(oldName, newName);
370 itemList.remove(item); 370 itemList.remove(item);
371 itemList.insert(item, newName); 371 itemList.insert(item, newName);
372 } 372 }
373} 373}
374 374
375/** 375/**
376 * Move an application from one directory to another. 376 * Move an application from one directory to another.
377 * Move in the gui, move in the applnk file, move in the installer. 377 * Move in the gui, move in the applnk file, move in the installer.
378 * @param item the application to move 378 * @param item the application to move
379 * @pearam newGroup the new parent of this application 379 * @pearam newGroup the new parent of this application
380 */ 380 */
381void TabManager::moveApplication(QListViewItem *item, QListViewItem *newGroup){ 381void TabManager::moveApplication(QListViewItem *item, QListViewItem *newGroup){
382 // Can we even move it? 382 // Can we even move it?
383 if(!item || !item->parent() || newGroup->parent()) 383 if(!item || !item->parent() || newGroup->parent())
384 return; 384 return;
385 if(item->parent() == newGroup) 385 if(item->parent() == newGroup)
386 return; 386 return;
387 387
388 // Get the new folder, new file name, 388 // Get the new folder, new file name,
389 QString newFolder = itemList[newGroup]; 389 QString newFolder = itemList[newGroup];
390 newFolder = newFolder.mid(0,newFolder.length()-11); 390 newFolder = newFolder.mid(0,newFolder.length()-11);
391 int slash = newFolder.findRev('/', -1); 391 int slash = newFolder.findRev('/', -1);
392 QString folderName = newFolder.mid(slash+1, newFolder.length()); 392 QString folderName = newFolder.mid(slash+1, newFolder.length());
393 393
394 QString desktopFile = itemList[item]; 394 QString desktopFile = itemList[item];
395 slash = desktopFile.findRev('/', -1); 395 slash = desktopFile.findRev('/', -1);
396 desktopFile = desktopFile.mid(slash, desktopFile.length()); 396 desktopFile = desktopFile.mid(slash, desktopFile.length());
397 newFolder = newFolder + desktopFile; 397 newFolder = newFolder + desktopFile;
398 398
399 // Move file 399 // Move file
400 QDir r; 400 QDir r;
401 if(!r.rename(itemList[item], newFolder)){ 401 if(!r.rename(itemList[item], newFolder)){
402 QMessageBox::critical(this, tr("Message"), "Can't move application.", tr("Ok") ); 402 QMessageBox::critical(this, tr("Message"), "Can't move application.", tr("Ok") );
403 return; 403 return;
404 } 404 }
405 //qDebug((QString("moveApplication: ") + itemList[item]).latin1()); 405 //qDebug((QString("moveApplication: ") + itemList[item]).latin1());
406 //qDebug((QString("moveApplication: ") + newFolder).latin1()); 406 //qDebug((QString("moveApplication: ") + newFolder).latin1());
407 407
408 // Move in the gui 408 // Move in the gui
409 item->parent()->takeItem(item); 409 item->parent()->takeItem(item);
410 newGroup->insertItem(item); 410 newGroup->insertItem(item);
411 newGroup->setOpen(true); 411 newGroup->setOpen(true);
412 412
413 // Move file in the installer 413 // Move file in the installer
414 QString installedAppFile; 414 QString installedAppFile;
415 if(findInstalledApplication(desktopFile, installedAppFile)) 415 if(findInstalledApplication(desktopFile, installedAppFile))
416 swapInstalledLocation(installedAppFile, desktopFile, newFolder); 416 swapInstalledLocation(installedAppFile, desktopFile, newFolder);
417 else 417 else
418 qDebug("moveApplication: No installed app found for dekstop file"); 418 qDebug("moveApplication: No installed app found for dekstop file");
419 419
420 // Move application type 420 // Move application type
421 AppLnk app(newFolder); 421 AppLnk app(newFolder);
422 app.setType(folderName); 422 app.setType(folderName);
423 app.writeLink(); 423 app.writeLink();
424 424
425 // Move in our internal list 425 // Move in our internal list
426 itemList.remove(item); 426 itemList.remove(item);
427 itemList.insert(item, newFolder); 427 itemList.insert(item, newFolder);
428 428
429 // We have changed something. 429 // We have changed something.
430 changed = true; 430 changed = true;
431} 431}
432 432
433/** 433/**
434 * File the installed application that has this desktop file. 434 * File the installed application that has this desktop file.
435 * Go through each file in HOME_APP_INSTALL_DIR and see if it contains desktop 435 * Go through each file in HOME_APP_INSTALL_DIR and see if it contains desktop
436 * file 436 * file
437 * @param desktopFile - the .desktop file to search for [foo.desktop] 437 * @param desktopFile - the .desktop file to search for [foo.desktop]
438 * @param installedAppFile - location of the app install list 438 * @param installedAppFile - location of the app install list
439 * @return true if successfull, false if file not found. 439 * @return true if successful, false if file not found.
440 */ 440 */
441bool TabManager::findInstalledApplication(QString desktopFile, QString &installedAppFile){ 441bool TabManager::findInstalledApplication(QString desktopFile, QString &installedAppFile){
442 442
443 QDir d; 443 QDir d;
444 d.setPath(HOME_APP_INSTALL_DIR); 444 d.setPath(HOME_APP_INSTALL_DIR);
445 d.setFilter( QDir::Files ); 445 d.setFilter( QDir::Files );
446 446
447 const QFileInfoList *list = d.entryInfoList(); 447 const QFileInfoList *list = d.entryInfoList();
448 QFileInfoListIterator it( *list ); // create list iterator 448 QFileInfoListIterator it( *list ); // create list iterator
449 QFileInfo *fi; // pointer for traversing 449 QFileInfo *fi; // pointer for traversing
450 450
451 while ( (fi=it.current()) ) { // for each file... 451 while ( (fi=it.current()) ) { // for each file...
452 QFile file(QString(HOME_APP_INSTALL_DIR) + "/" + fi->fileName()); 452 QFile file(QString(HOME_APP_INSTALL_DIR) + "/" + fi->fileName());
453 if ( file.open(IO_ReadOnly) ) { // file opened successfully 453 if ( file.open(IO_ReadOnly) ) { // file opened successfully
454 QTextStream stream( &file ); // use a text stream 454 QTextStream stream( &file ); // use a text stream
455 QString line; 455 QString line;
456 while ( !stream.eof() ) { // until end of file... 456 while ( !stream.eof() ) { // until end of file...
457 line = stream.readLine(); // line of text excluding '\n' 457 line = stream.readLine(); // line of text excluding '\n'
458 if(line.contains(desktopFile)){ 458 if(line.contains(desktopFile)){
459 installedAppFile = QString(HOME_APP_INSTALL_DIR) + "/" + fi->fileName(); 459 installedAppFile = QString(HOME_APP_INSTALL_DIR) + "/" + fi->fileName();
460 file.close(); 460 file.close();
461 return true; 461 return true;
462 } 462 }
463 } 463 }
464 file.close(); 464 file.close();
465 } 465 }
466 else 466 else
467 qDebug((QString("findInstalledApplication: Can't open file") + HOME_APP_INSTALL_DIR + "/" + fi->fileName()).latin1()); 467 qDebug((QString("findInstalledApplication: Can't open file") + HOME_APP_INSTALL_DIR + "/" + fi->fileName()).latin1());
468 ++it; // goto next list element 468 ++it; // goto next list element
469 } 469 }
470 return false; 470 return false;
471} 471}
472 472
473/** 473/**
474 * Open a file and replace a file containing the old desktop file with the new. 474 * Open a file and replace a file containing the old desktop file with the new.
475 * @param installedAppFile application installed list 475 * @param installedAppFile application installed list
476 * @param desktopFile old .desktop file 476 * @param desktopFile old .desktop file
477 * @param newLocation new .desktop file 477 * @param newLocation new .desktop file
478 */ 478 */
479void TabManager::swapInstalledLocation( QString installedAppFile, QString desktopFile, QString newLocation ){ 479void TabManager::swapInstalledLocation( QString installedAppFile, QString desktopFile, QString newLocation ){
480 QFile file(installedAppFile); 480 QFile file(installedAppFile);
481 if ( !file.open(IO_ReadOnly) ){ 481 if ( !file.open(IO_ReadOnly) ){
482 qDebug(QString("swapInstalledLocation: Can't edit file: %1").arg(installedAppFile).latin1()); 482 qDebug(QString("swapInstalledLocation: Can't edit file: %1").arg(installedAppFile).latin1());
483 return; 483 return;
484 } 484 }
485 485
486 QTextStream stream( &file ); // use a text stream 486 QTextStream stream( &file ); // use a text stream
487 QString allLines; 487 QString allLines;
488 while ( !stream.eof() ) { // until end of file... 488 while ( !stream.eof() ) { // until end of file...
489 QString line = stream.readLine(); // line of text excluding '\n' 489 QString line = stream.readLine(); // line of text excluding '\n'
490 if(line.contains(desktopFile)) 490 if(line.contains(desktopFile))
491 allLines += newLocation; 491 allLines += newLocation;
492 else 492 else
493 allLines += line; 493 allLines += line;
494 allLines += '\n'; 494 allLines += '\n';
495 } 495 }
496 file.close(); 496 file.close();
497 497
498 if ( !file.open(IO_ReadWrite) ){ 498 if ( !file.open(IO_ReadWrite) ){
499 qDebug(QString("swapInstalledLocation: Can't edit file: %1").arg(installedAppFile).latin1()); 499 qDebug(QString("swapInstalledLocation: Can't edit file: %1").arg(installedAppFile).latin1());
500 return; 500 return;
501 } 501 }
502 QTextStream streamOut( &file ); 502 QTextStream streamOut( &file );
503 streamOut << allLines; 503 streamOut << allLines;
504 file.close(); 504 file.close();
505} 505}
506 506
507// tabmanager.cpp 507// tabmanager.cpp
508 508
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 @@
1Mail TODO 1Mail TODO
2----------------------------------------------------------------------------- 2-----------------------------------------------------------------------------
3 3
4General stuff: 4General stuff:
5 - This program needs a name! 5 - This program needs a name!
6 - If password is empty, ask for it during fetch. 6 - If password is empty, ask for it during fetch.
7 - Check if all necessary fields in AccoundEditor are filled. 7 - Check if all necessary fields in AccoundEditor are filled.
8 - Seperate Sending and Recieving in configuration. 8 - Seperate Sending and Recieving in configuration.
9 9
10Protocol related: 10Protocol related:
11 - The IMAP implentation is kinda strange and slow. 11 - The IMAP implentation is kinda strange and slow.
12 - The SMTP implentation is goddamn strange. 12 - The SMTP implentation is goddamn strange.
13 - POP3 support would be nice. 13 - POP3 support would be nice.
14 - NNTP would be kinda neat, too. 14 - NNTP would be kinda neat, too.
15 - Implent a plugin system. 15 - Implent a plugin system.
16 16
17Security related: 17Security related:
18 - GnuPG support. This will require a seperate gpg managing utility in 18 - GnuPG support. This will require a seperate gpg managing utility in
19 the settings tab. 19 the settings tab.
20 - sMIME? maybe in the distant future. 20 - sMIME? maybe in the distant future.
21 - Integrated SSH tunneling. 21 - Integrated SSH tunneling.
22 22
23Mail management: 23Mail management:
24 - Header caching 24 - Header caching
25 - Sieve filtering support? 25 - Sieve filtering support?
26 - Enqueueing/Draft support both on the IMAP server and local. 26 - Enqueueing/Draft support both on the IMAP server and local.
27 27
28Testing: 28Testing:
29 I'm using the courier-imap server at my developement site. I didn't have 29 I'm using the courier-imap server at my developement site. I didn't have
30 much opportunity to test on other servers. Giving me test-accounts on other 30 much opportunity to test on other servers. Giving me test-accounts on other
31 servers would be helpfull. 31 servers would be helpful.
32 32
33If you want something added, drop a mail. Comments are always welcome. 33If you want something added, drop a mail. Comments are always welcome.
34 34
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
@@ -137,178 +137,178 @@ void FolderWidget::slotMenuActivated(int itemid)
137 137
138 if (itemid == MENU_RENAME) { 138 if (itemid == MENU_RENAME) {
139 if (((FolderWidgetItem *)currentItem())->folder().fullName().isEmpty()) return; 139 if (((FolderWidgetItem *)currentItem())->folder().fullName().isEmpty()) return;
140 140
141 Folder folder = ((FolderWidgetItem *)currentItem())->folder(); 141 Folder folder = ((FolderWidgetItem *)currentItem())->folder();
142 QString newName = Rename::rename(folder.fullName(), this); 142 QString newName = Rename::rename(folder.fullName(), this);
143 if (newName.isNull()) return; 143 if (newName.isNull()) return;
144 144
145 folder.topFolder().handler()->iRename(folder.fullName(), newName); 145 folder.topFolder().handler()->iRename(folder.fullName(), newName);
146 connect(folder.topFolder().handler(), SIGNAL(gotResponse(IMAPResponse &)), SLOT(slotIMAPRename(IMAPResponse &))); 146 connect(folder.topFolder().handler(), SIGNAL(gotResponse(IMAPResponse &)), SLOT(slotIMAPRename(IMAPResponse &)));
147 } else if (itemid == MENU_DELETE) { 147 } else if (itemid == MENU_DELETE) {
148 if (((FolderWidgetItem *)currentItem())->folder().fullName().isEmpty()) return; 148 if (((FolderWidgetItem *)currentItem())->folder().fullName().isEmpty()) return;
149 149
150 Folder folder = ((FolderWidgetItem *)currentItem())->folder(); 150 Folder folder = ((FolderWidgetItem *)currentItem())->folder();
151 151
152 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")); 152 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"));
153 if (ret == 1) return; 153 if (ret == 1) return;
154 154
155 _createFolder = folder; 155 _createFolder = folder;
156 156
157 folder.topFolder().handler()->iDelete(folder.fullName()); 157 folder.topFolder().handler()->iDelete(folder.fullName());
158 connect(folder.topFolder().handler(), SIGNAL(gotResponse(IMAPResponse &)), SLOT(slotIMAPDelete(IMAPResponse &))); 158 connect(folder.topFolder().handler(), SIGNAL(gotResponse(IMAPResponse &)), SLOT(slotIMAPDelete(IMAPResponse &)));
159 } else if (itemid == MENU_MOVE) { 159 } else if (itemid == MENU_MOVE) {
160 160
161 } else if (itemid == MENU_COPY) { 161 } else if (itemid == MENU_COPY) {
162 162
163 } else if (itemid == MENU_CREATE) { 163 } else if (itemid == MENU_CREATE) {
164 Folder folder = (((FolderWidgetItem *)currentItem())->folder()); 164 Folder folder = (((FolderWidgetItem *)currentItem())->folder());
165 _createFolder = folder; 165 _createFolder = folder;
166 166
167 QString folderName = Rename::getText(tr("Foldername"), tr("<p>Please enter the name of the new folder.</p>"), this); 167 QString folderName = Rename::getText(tr("Foldername"), tr("<p>Please enter the name of the new folder.</p>"), this);
168 if (folderName.isNull()) return; 168 if (folderName.isNull()) return;
169 169
170 folder.topFolder().handler()->iCreate(folder.fullName() + folder.separator() + folderName); 170 folder.topFolder().handler()->iCreate(folder.fullName() + folder.separator() + folderName);
171 connect(folder.topFolder().handler(), SIGNAL(gotResponse(IMAPResponse &)), SLOT(slotIMAPCreate(IMAPResponse &))); 171 connect(folder.topFolder().handler(), SIGNAL(gotResponse(IMAPResponse &)), SLOT(slotIMAPCreate(IMAPResponse &)));
172 } else if (itemid == MENU_RESCAN) { 172 } else if (itemid == MENU_RESCAN) {
173 Folder folder = (((FolderWidgetItem *)currentItem())->folder()); 173 Folder folder = (((FolderWidgetItem *)currentItem())->folder());
174 _rescanAccount = folder.topFolder().account(); 174 _rescanAccount = folder.topFolder().account();
175 175
176 folder.topFolder().handler()->iList("", "*"); 176 folder.topFolder().handler()->iList("", "*");
177 connect(folder.topFolder().handler(), SIGNAL(gotResponse(IMAPResponse &)), SLOT(slotIMAPList(IMAPResponse &))); 177 connect(folder.topFolder().handler(), SIGNAL(gotResponse(IMAPResponse &)), SLOT(slotIMAPList(IMAPResponse &)));
178 } 178 }
179} 179}
180 180
181void FolderWidget::slotItemClicked(QListViewItem *item) 181void FolderWidget::slotItemClicked(QListViewItem *item)
182{ 182{
183 if (item == NULL) return; 183 if (item == NULL) return;
184 Folder folder = ((FolderWidgetItem *)item)->folder(); 184 Folder folder = ((FolderWidgetItem *)item)->folder();
185 if (folder.fullName().isEmpty()) return; 185 if (folder.fullName().isEmpty()) return;
186 186
187 emit folderSelected(folder); 187 emit folderSelected(folder);
188} 188}
189 189
190void FolderWidget::slotIMAPLookingUpHost() 190void FolderWidget::slotIMAPLookingUpHost()
191{ 191{
192 emit status(tr("Looking up host...")); 192 emit status(tr("Looking up host..."));
193 emit connecting(); 193 emit connecting();
194} 194}
195 195
196void FolderWidget::slotIMAPHostFound() 196void FolderWidget::slotIMAPHostFound()
197{ 197{
198 emit status(tr("Host found.")); 198 emit status(tr("Host found."));
199} 199}
200 200
201void FolderWidget::slotIMAPConnected() 201void FolderWidget::slotIMAPConnected()
202{ 202{
203 emit status(tr("Connected to host.")); 203 emit status(tr("Connected to host."));
204 emit connected(); 204 emit connected();
205} 205}
206 206
207void FolderWidget::slotIMAPError(int error) 207void FolderWidget::slotIMAPError(int error)
208{ 208{
209 if (error == IMAPBase::IMAPErrConnectionRefused) { 209 if (error == IMAPBase::IMAPErrConnectionRefused) {
210 QMessageBox::warning(this, tr("Error"), tr("<p>The IMAP connection was refused.</p>"), tr("Ok")); 210 QMessageBox::warning(this, tr("Error"), tr("<p>The IMAP connection was refused.</p>"), tr("Ok"));
211 } else if (error == IMAPBase::IMAPErrHostNotFound) { 211 } else if (error == IMAPBase::IMAPErrHostNotFound) {
212 QMessageBox::warning(this, tr("Error"), tr("<p>The host was not found.</p>"), tr("Ok")); 212 QMessageBox::warning(this, tr("Error"), tr("<p>The host was not found.</p>"), tr("Ok"));
213 } else if (error == IMAPBase::IMAPErrSocketRead) { 213 } else if (error == IMAPBase::IMAPErrSocketRead) {
214 QMessageBox::warning(this, tr("Error"), tr("<p>There was an error while reading from the socket.</p>"), tr("Ok")); 214 QMessageBox::warning(this, tr("Error"), tr("<p>There was an error while reading from the socket.</p>"), tr("Ok"));
215 } else if (error == IMAPBase::IMAPErrLoginFailed) { 215 } else if (error == IMAPBase::IMAPErrLoginFailed) {
216 QMessageBox::warning(this, tr("Error"), tr("<p>Login failed. Check your password/username.</p>"), tr("Ok")); 216 QMessageBox::warning(this, tr("Error"), tr("<p>Login failed. Check your password/username.</p>"), tr("Ok"));
217 } else { 217 } else {
218 QMessageBox::warning(this, tr("Error"), tr("<p>An unknown error was encountered.</p>"), tr("Ok")); 218 QMessageBox::warning(this, tr("Error"), tr("<p>An unknown error was encountered.</p>"), tr("Ok"));
219 } 219 }
220} 220}
221 221
222void FolderWidget::slotIMAPDisconnected() 222void FolderWidget::slotIMAPDisconnected()
223{ 223{
224 emit status(tr("Disconnected.")); 224 emit status(tr("Disconnected."));
225 emit disconnected(); 225 emit disconnected();
226} 226}
227 227
228void FolderWidget::slotIMAPLogin(IMAPResponse &response) 228void FolderWidget::slotIMAPLogin(IMAPResponse &response)
229{ 229{
230 disconnect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse &)), this, SLOT(slotIMAPLogin(IMAPResponse &))); 230 disconnect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse &)), this, SLOT(slotIMAPLogin(IMAPResponse &)));
231 231
232 if (response.statusResponse().status() == IMAPResponseEnums::OK) { 232 if (response.statusResponse().status() == IMAPResponseEnums::OK) {
233 emit status(tr("Login successfull!")); 233 emit status(tr("Login successful!"));
234 } else { 234 } else {
235 QMessageBox::warning(this, tr("Error"), tr("<p>Login failed. Go away.</p>"), tr("Ok")); 235 QMessageBox::warning(this, tr("Error"), tr("<p>Login failed. Go away.</p>"), tr("Ok"));
236 } 236 }
237} 237}
238 238
239void FolderWidget::slotIMAPRename(IMAPResponse &response) 239void FolderWidget::slotIMAPRename(IMAPResponse &response)
240{ 240{
241 disconnect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse &)), this, SLOT(slotIMAPRename(IMAPResponse &))); 241 disconnect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse &)), this, SLOT(slotIMAPRename(IMAPResponse &)));
242 242
243 if (response.statusResponse().status() == IMAPResponseEnums::OK) { 243 if (response.statusResponse().status() == IMAPResponseEnums::OK) {
244 emit status(tr("Renaming successfull!")); 244 emit status(tr("Renaming successful!"));
245 } else { 245 } else {
246 QMessageBox::warning(this, tr("Error"), tr("<p>Renaming failed. (Server said: %1)</p>").arg(response.statusResponse().comment()), tr("Ok")); 246 QMessageBox::warning(this, tr("Error"), tr("<p>Renaming failed. (Server said: %1)</p>").arg(response.statusResponse().comment()), tr("Ok"));
247 } 247 }
248} 248}
249 249
250void FolderWidget::slotIMAPDelete(IMAPResponse &response) 250void FolderWidget::slotIMAPDelete(IMAPResponse &response)
251{ 251{
252 disconnect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse &)), this, SLOT(slotIMAPDelete(IMAPResponse &))); 252 disconnect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse &)), this, SLOT(slotIMAPDelete(IMAPResponse &)));
253 253
254 if (response.statusResponse().status() == IMAPResponseEnums::OK) { 254 if (response.statusResponse().status() == IMAPResponseEnums::OK) {
255 emit status(tr("Deletion successfull!")); 255 emit status(tr("Deletion successful!"));
256 256
257 _rescanAccount = _createFolder.topFolder().account(); 257 _rescanAccount = _createFolder.topFolder().account();
258 258
259 _createFolder.topFolder().handler()->iList(".", "*"); 259 _createFolder.topFolder().handler()->iList(".", "*");
260 connect(_createFolder.topFolder().handler(), SIGNAL(gotResponse(IMAPResponse &)), SLOT(slotIMAPList(IMAPResponse &))); 260 connect(_createFolder.topFolder().handler(), SIGNAL(gotResponse(IMAPResponse &)), SLOT(slotIMAPList(IMAPResponse &)));
261 } else { 261 } else {
262 QMessageBox::warning(this, tr("Error"), tr("<p>Delete failed. (Server said: %1)</p>").arg(response.statusResponse().comment()), tr("Ok")); 262 QMessageBox::warning(this, tr("Error"), tr("<p>Delete failed. (Server said: %1)</p>").arg(response.statusResponse().comment()), tr("Ok"));
263 } 263 }
264} 264}
265 265
266void FolderWidget::slotIMAPCreate(IMAPResponse &response) 266void FolderWidget::slotIMAPCreate(IMAPResponse &response)
267{ 267{
268 disconnect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse &)), this, SLOT(slotIMAPCreate(IMAPResponse &))); 268 disconnect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse &)), this, SLOT(slotIMAPCreate(IMAPResponse &)));
269 269
270 if (response.statusResponse().status() == IMAPResponseEnums::OK) { 270 if (response.statusResponse().status() == IMAPResponseEnums::OK) {
271 emit status(tr("Folder created. Rescanning...")); 271 emit status(tr("Folder created. Rescanning..."));
272 272
273 _rescanAccount = _createFolder.topFolder().account(); 273 _rescanAccount = _createFolder.topFolder().account();
274 274
275 _createFolder.topFolder().handler()->iList(".", "*"); 275 _createFolder.topFolder().handler()->iList(".", "*");
276 connect(_createFolder.topFolder().handler(), SIGNAL(gotResponse(IMAPResponse &)), SLOT(slotIMAPList(IMAPResponse &))); 276 connect(_createFolder.topFolder().handler(), SIGNAL(gotResponse(IMAPResponse &)), SLOT(slotIMAPList(IMAPResponse &)));
277 } else { 277 } else {
278 QMessageBox::warning(this, tr("Error"), tr("<p>The folder could not be created. (Server said: %1)</p>").arg(response.statusResponse().comment()), tr("Ok")); 278 QMessageBox::warning(this, tr("Error"), tr("<p>The folder could not be created. (Server said: %1)</p>").arg(response.statusResponse().comment()), tr("Ok"));
279 } 279 }
280} 280}
281 281
282void FolderWidget::slotIMAPList(IMAPResponse &response) 282void FolderWidget::slotIMAPList(IMAPResponse &response)
283{ 283{
284 disconnect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse &)), this, SLOT(slotIMAPList(IMAPResponse &))); 284 disconnect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse &)), this, SLOT(slotIMAPList(IMAPResponse &)));
285 285
286 if (response.statusResponse().status() == IMAPResponseEnums::OK) { 286 if (response.statusResponse().status() == IMAPResponseEnums::OK) {
287 QDir d((QString) getenv("HOME") + "/Applications/mail/foldercache"); 287 QDir d((QString) getenv("HOME") + "/Applications/mail/foldercache");
288 if (!d.exists()) { 288 if (!d.exists()) {
289 system("mkdir -p $HOME/Applications/mail/foldercache"); 289 system("mkdir -p $HOME/Applications/mail/foldercache");
290 qWarning("Created $HOME/Applications/mail/foldercache."); 290 qWarning("Created $HOME/Applications/mail/foldercache.");
291 } 291 }
292 QFile f((QString) getenv("HOME") + "/Applications/mail/foldercache/foldercache-" + _rescanAccount.accountName()); 292 QFile f((QString) getenv("HOME") + "/Applications/mail/foldercache/foldercache-" + _rescanAccount.accountName());
293 if (!f.open(IO_WriteOnly)) { 293 if (!f.open(IO_WriteOnly)) {
294 QMessageBox::critical(this, tr("Error"), tr("<p>Couldn't open folder cache file for writing!</p>"), tr("Ok")); 294 QMessageBox::critical(this, tr("Error"), tr("<p>Couldn't open folder cache file for writing!</p>"), tr("Ok"));
295 return; 295 return;
296 } 296 }
297 QTextStream t(&f); 297 QTextStream t(&f);
298 298
299 QValueList<IMAPResponseLIST>::Iterator it; 299 QValueList<IMAPResponseLIST>::Iterator it;
300 QValueList<IMAPResponseLIST> lists = response.LIST(); 300 QValueList<IMAPResponseLIST> lists = response.LIST();
301 for (it = lists.begin(); it != lists.end(); it++) { 301 for (it = lists.begin(); it != lists.end(); it++) {
302 t << (*it).folderSeparator() << "\n"; 302 t << (*it).folderSeparator() << "\n";
303 t << (*it).folder() << "\n"; 303 t << (*it).folder() << "\n";
304 } 304 }
305 305
306 f.close(); 306 f.close();
307 307
308 emit status(tr("Got folder list.")); 308 emit status(tr("Got folder list."));
309 getAccounts(); 309 getAccounts();
310 } else { 310 } else {
311 QMessageBox::warning(this, tr("Error"), tr("<p>Couldn't retrieve the folder list. (Server said: %1)</p>").arg(response.statusResponse().comment()), tr("Ok")); 311 QMessageBox::warning(this, tr("Error"), tr("<p>Couldn't retrieve the folder list. (Server said: %1)</p>").arg(response.statusResponse().comment()), tr("Ok"));
312 } 312 }
313} 313}
314 314
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
@@ -249,193 +249,193 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
249 mkt << "PARSERS ="; 249 mkt << "PARSERS =";
250 if(!project->isEmpty("YACCSOURCES")) { 250 if(!project->isEmpty("YACCSOURCES")) {
251 QStringList &yaccs = project->variables()["YACCSOURCES"]; 251 QStringList &yaccs = project->variables()["YACCSOURCES"];
252 for(QStringList::Iterator yit = yaccs.begin(); yit != yaccs.end(); ++yit) { 252 for(QStringList::Iterator yit = yaccs.begin(); yit != yaccs.end(); ++yit) {
253 QFileInfo fi((*yit)); 253 QFileInfo fi((*yit));
254 mkt << " " << fi.dirPath() << Option::dir_sep << fi.baseName(TRUE) 254 mkt << " " << fi.dirPath() << Option::dir_sep << fi.baseName(TRUE)
255 << Option::yacc_mod << Option::cpp_ext.first(); 255 << Option::yacc_mod << Option::cpp_ext.first();
256 } 256 }
257 } 257 }
258 if(!project->isEmpty("LEXSOURCES")) { 258 if(!project->isEmpty("LEXSOURCES")) {
259 QStringList &lexs = project->variables()["LEXSOURCES"]; 259 QStringList &lexs = project->variables()["LEXSOURCES"];
260 for(QStringList::Iterator lit = lexs.begin(); lit != lexs.end(); ++lit) { 260 for(QStringList::Iterator lit = lexs.begin(); lit != lexs.end(); ++lit) {
261 QFileInfo fi((*lit)); 261 QFileInfo fi((*lit));
262 mkt << " " << fi.dirPath() << Option::dir_sep << fi.baseName(TRUE) 262 mkt << " " << fi.dirPath() << Option::dir_sep << fi.baseName(TRUE)
263 << Option::lex_mod << Option::cpp_ext.first(); 263 << Option::lex_mod << Option::cpp_ext.first();
264 } 264 }
265 } 265 }
266 mkt << "\n"; 266 mkt << "\n";
267 mkt << "preprocess: $(FORMS) $(MOCS) $(PARSERS)" << endl; 267 mkt << "preprocess: $(FORMS) $(MOCS) $(PARSERS)" << endl;
268 mkt << "preprocess_clean: mocclean uiclean parser_clean" << endl << endl; 268 mkt << "preprocess_clean: mocclean uiclean parser_clean" << endl << endl;
269 mkt << "mocclean:" << "\n"; 269 mkt << "mocclean:" << "\n";
270 if(!project->isEmpty("SRCMOC")) 270 if(!project->isEmpty("SRCMOC"))
271 mkt << "\t-rm -f $(MOCS)" << "\n"; 271 mkt << "\t-rm -f $(MOCS)" << "\n";
272 mkt << "uiclean:" << "\n"; 272 mkt << "uiclean:" << "\n";
273 if(!project->isEmpty("UICIMPLS")) 273 if(!project->isEmpty("UICIMPLS"))
274 mkt << "\t-rm -f $(FORMS)" << "\n"; 274 mkt << "\t-rm -f $(FORMS)" << "\n";
275 mkt << "parser_clean:" << "\n"; 275 mkt << "parser_clean:" << "\n";
276 if(!project->isEmpty("YACCSOURCES") || !project->isEmpty("LEXSOURCES")) 276 if(!project->isEmpty("YACCSOURCES") || !project->isEmpty("LEXSOURCES"))
277 mkt << "\t-rm -f $(PARSERS)" << "\n"; 277 mkt << "\t-rm -f $(PARSERS)" << "\n";
278 writeUicSrc(mkt, "FORMS"); 278 writeUicSrc(mkt, "FORMS");
279 writeMocSrc(mkt, "HEADERS"); 279 writeMocSrc(mkt, "HEADERS");
280 writeMocSrc(mkt, "SOURCES"); 280 writeMocSrc(mkt, "SOURCES");
281 writeMocSrc(mkt, "UICDECLS"); 281 writeMocSrc(mkt, "UICDECLS");
282 writeYaccSrc(mkt, "YACCSOURCES"); 282 writeYaccSrc(mkt, "YACCSOURCES");
283 writeLexSrc(mkt, "LEXSOURCES"); 283 writeLexSrc(mkt, "LEXSOURCES");
284 mkf.close(); 284 mkf.close();
285 } 285 }
286 QString target_key = keyFor("QMAKE_PBX_PREPROCESS_TARGET"); 286 QString target_key = keyFor("QMAKE_PBX_PREPROCESS_TARGET");
287 mkfile = fileFixify(mkfile, QDir::currentDirPath()); 287 mkfile = fileFixify(mkfile, QDir::currentDirPath());
288 t << "\t\t" << target_key << " = {" << "\n" 288 t << "\t\t" << target_key << " = {" << "\n"
289 << "\t\t\t" << "buildArgumentsString = \"-f " << mkfile << "\";" << "\n" 289 << "\t\t\t" << "buildArgumentsString = \"-f " << mkfile << "\";" << "\n"
290 << "\t\t\t" << "buildPhases = (" << "\n" 290 << "\t\t\t" << "buildPhases = (" << "\n"
291 << "\t\t\t" << ");" << "\n" 291 << "\t\t\t" << ");" << "\n"
292 << "\t\t\t" << "buildSettings = {" << "\n" 292 << "\t\t\t" << "buildSettings = {" << "\n"
293 << "\t\t\t" << "};" << "\n" 293 << "\t\t\t" << "};" << "\n"
294 << "\t\t\t" << "buildToolPath = \"/usr/bin/gnumake\";"<< "\n" 294 << "\t\t\t" << "buildToolPath = \"/usr/bin/gnumake\";"<< "\n"
295 << "\t\t\t" << "buildWorkingDirectory = \"" << QDir::currentDirPath() << "\";" << "\n" 295 << "\t\t\t" << "buildWorkingDirectory = \"" << QDir::currentDirPath() << "\";" << "\n"
296 << "\t\t\t" << "dependencies = (" << "\n" 296 << "\t\t\t" << "dependencies = (" << "\n"
297 << "\t\t\t" << ");" << "\n" 297 << "\t\t\t" << ");" << "\n"
298 << "\t\t\t" << "isa = PBXLegacyTarget;" << "\n" 298 << "\t\t\t" << "isa = PBXLegacyTarget;" << "\n"
299 << "\t\t\t" << "name = QtPreprocessors;" << "\n" 299 << "\t\t\t" << "name = QtPreprocessors;" << "\n"
300 << "\t\t\t" << "productName = QtPreprocessors;" << "\n" 300 << "\t\t\t" << "productName = QtPreprocessors;" << "\n"
301 << "\t\t\t" << "settingsToExpand = 6;" << "\n" 301 << "\t\t\t" << "settingsToExpand = 6;" << "\n"
302 << "\t\t\t" << "settingsToPassInEnvironment = 287;" << "\n" 302 << "\t\t\t" << "settingsToPassInEnvironment = 287;" << "\n"
303 << "\t\t\t" << "settingsToPassOnCommandLine = 280;" << "\n" 303 << "\t\t\t" << "settingsToPassOnCommandLine = 280;" << "\n"
304 << "\t\t\t" << "shouldsUseHeadermap = 0;" << "\n" 304 << "\t\t\t" << "shouldsUseHeadermap = 0;" << "\n"
305 << "\t\t" << "};" << "\n"; 305 << "\t\t" << "};" << "\n";
306 306
307 QString target_depend_key = keyFor("QMAKE_PBX_PREPROCESS_TARGET_DEPEND"); 307 QString target_depend_key = keyFor("QMAKE_PBX_PREPROCESS_TARGET_DEPEND");
308 project->variables()["QMAKE_PBX_TARGETDEPENDS"].append(target_depend_key); 308 project->variables()["QMAKE_PBX_TARGETDEPENDS"].append(target_depend_key);
309 t << "\t\t" << target_depend_key << " = {" << "\n" 309 t << "\t\t" << target_depend_key << " = {" << "\n"
310 << "\t\t\t" << "isa = PBXTargetDependency;" << "\n" 310 << "\t\t\t" << "isa = PBXTargetDependency;" << "\n"
311 << "\t\t\t" << "target = " << target_key << ";" << "\n" 311 << "\t\t\t" << "target = " << target_key << ";" << "\n"
312 << "\t\t" << "};" << "\n"; 312 << "\t\t" << "};" << "\n";
313 } 313 }
314 //SOURCE BUILDPHASE 314 //SOURCE BUILDPHASE
315 if(!project->isEmpty("QMAKE_PBX_OBJ")) { 315 if(!project->isEmpty("QMAKE_PBX_OBJ")) {
316 QString grp = "Build Sources", key = keyFor(grp); 316 QString grp = "Build Sources", key = keyFor(grp);
317 project->variables()["QMAKE_PBX_BUILDPHASES"].append(key); 317 project->variables()["QMAKE_PBX_BUILDPHASES"].append(key);
318 t << "\t\t" << key << " = {" << "\n" 318 t << "\t\t" << key << " = {" << "\n"
319 << "\t\t\t" << "buildActionMask = 2147483647;" << "\n" 319 << "\t\t\t" << "buildActionMask = 2147483647;" << "\n"
320 << "\t\t\t" << "files = (" << "\n" 320 << "\t\t\t" << "files = (" << "\n"
321 << varGlue("QMAKE_PBX_OBJ", "\t\t\t\t", ",\n\t\t\t\t", "\n") 321 << varGlue("QMAKE_PBX_OBJ", "\t\t\t\t", ",\n\t\t\t\t", "\n")
322 << "\t\t\t" << ");" << "\n" 322 << "\t\t\t" << ");" << "\n"
323 << "\t\t\t" << "isa = PBXSourcesBuildPhase;" << "\n" 323 << "\t\t\t" << "isa = PBXSourcesBuildPhase;" << "\n"
324 << "\t\t\t" << "name = \"" << grp << "\";" << "\n" 324 << "\t\t\t" << "name = \"" << grp << "\";" << "\n"
325 << "\t\t" << "};" << "\n"; 325 << "\t\t" << "};" << "\n";
326 } 326 }
327 327
328 if(!project->isActiveConfig("staticlib")) { //DUMP LIBRARIES 328 if(!project->isActiveConfig("staticlib")) { //DUMP LIBRARIES
329 QStringList &libdirs = project->variables()["QMAKE_PBX_LIBPATHS"]; 329 QStringList &libdirs = project->variables()["QMAKE_PBX_LIBPATHS"];
330 QString libs[] = { "QMAKE_LIBDIR_FLAGS", "QMAKE_LIBS", QString::null }; 330 QString libs[] = { "QMAKE_LIBDIR_FLAGS", "QMAKE_LIBS", QString::null };
331 for(i = 0; !libs[i].isNull(); i++) { 331 for(i = 0; !libs[i].isNull(); i++) {
332 tmp = project->variables()[libs[i]]; 332 tmp = project->variables()[libs[i]];
333 for(QStringList::Iterator it = tmp.begin(); it != tmp.end();) { 333 for(QStringList::Iterator it = tmp.begin(); it != tmp.end();) {
334 bool remove = FALSE; 334 bool remove = FALSE;
335 QString library, name, opt = (*it).stripWhiteSpace(); 335 QString library, name, opt = (*it).stripWhiteSpace();
336 if(opt.startsWith("-L")) { 336 if(opt.startsWith("-L")) {
337 QString r = opt.right(opt.length() - 2); 337 QString r = opt.right(opt.length() - 2);
338 fixEnvVariables(r); 338 fixEnvVariables(r);
339 libdirs.append(r); 339 libdirs.append(r);
340 } else if(opt.startsWith("-l")) { 340 } else if(opt.startsWith("-l")) {
341 name = opt.right(opt.length() - 2); 341 name = opt.right(opt.length() - 2);
342 QString lib("lib" + name); 342 QString lib("lib" + name);
343 for(QStringList::Iterator lit = libdirs.begin(); lit != libdirs.end(); ++lit) { 343 for(QStringList::Iterator lit = libdirs.begin(); lit != libdirs.end(); ++lit) {
344 if(project->isActiveConfig("link_prl")) { 344 if(project->isActiveConfig("link_prl")) {
345 /* This isn't real nice, but it is real usefull. This looks in a prl 345 /* This isn't real nice, but it is real useful. This looks in a prl
346 for what the library will ultimately be called so we can stick it 346 for what the library will ultimately be called so we can stick it
347 in the ProjectFile. If the prl format ever changes (not likely) then 347 in the ProjectFile. If the prl format ever changes (not likely) then
348 this will not really work. However, more concerning is that it will 348 this will not really work. However, more concerning is that it will
349 encode the version number in the Project file which might be a bad 349 encode the version number in the Project file which might be a bad
350 things in days to come? --Sam 350 things in days to come? --Sam
351 */ 351 */
352 QString prl_file = (*lit) + Option::dir_sep + lib + Option::prl_ext; 352 QString prl_file = (*lit) + Option::dir_sep + lib + Option::prl_ext;
353 if(QFile::exists(prl_file)) { 353 if(QFile::exists(prl_file)) {
354 QMakeProject proj; 354 QMakeProject proj;
355 if(proj.read(prl_file, QDir::currentDirPath())) { 355 if(proj.read(prl_file, QDir::currentDirPath())) {
356 if(!proj.isEmpty("QMAKE_PRL_TARGET")) { 356 if(!proj.isEmpty("QMAKE_PRL_TARGET")) {
357 library = (*lit) + Option::dir_sep + proj.first("QMAKE_PRL_TARGET"); 357 library = (*lit) + Option::dir_sep + proj.first("QMAKE_PRL_TARGET");
358 debug_msg(1, "pbuilder: Found library (%s) via PRL %s (%s)", 358 debug_msg(1, "pbuilder: Found library (%s) via PRL %s (%s)",
359 opt.latin1(), prl_file.latin1(), library.latin1()); 359 opt.latin1(), prl_file.latin1(), library.latin1());
360 remove = TRUE; 360 remove = TRUE;
361 } 361 }
362 } 362 }
363 363
364 } 364 }
365 } 365 }
366 if(!remove) { 366 if(!remove) {
367 QString extns[] = { ".dylib", ".so", ".a", QString::null }; 367 QString extns[] = { ".dylib", ".so", ".a", QString::null };
368 for(int n = 0; !remove && !extns[n].isNull(); n++) { 368 for(int n = 0; !remove && !extns[n].isNull(); n++) {
369 QString tmp = (*lit) + Option::dir_sep + lib + extns[n]; 369 QString tmp = (*lit) + Option::dir_sep + lib + extns[n];
370 if(QFile::exists(tmp)) { 370 if(QFile::exists(tmp)) {
371 library = tmp; 371 library = tmp;
372 debug_msg(1, "pbuilder: Found library (%s) via %s", 372 debug_msg(1, "pbuilder: Found library (%s) via %s",
373 opt.latin1(), library.latin1()); 373 opt.latin1(), library.latin1());
374 remove = TRUE; 374 remove = TRUE;
375 } 375 }
376 } 376 }
377 } 377 }
378 } 378 }
379 } else if(opt == "-framework") { 379 } else if(opt == "-framework") {
380 ++it; 380 ++it;
381 if(it == tmp.end()) 381 if(it == tmp.end())
382 break; 382 break;
383 QStringList &fdirs = project->variables()["QMAKE_FRAMEWORKDIR"]; 383 QStringList &fdirs = project->variables()["QMAKE_FRAMEWORKDIR"];
384 if(fdirs.isEmpty()) 384 if(fdirs.isEmpty())
385 fdirs.append("/System/Library/Frameworks/"); 385 fdirs.append("/System/Library/Frameworks/");
386 for(QStringList::Iterator fit = fdirs.begin(); fit != fdirs.end(); ++fit) { 386 for(QStringList::Iterator fit = fdirs.begin(); fit != fdirs.end(); ++fit) {
387 if(QFile::exists((*fit) + QDir::separator() + (*it) + ".framework")) { 387 if(QFile::exists((*fit) + QDir::separator() + (*it) + ".framework")) {
388 --it; 388 --it;
389 it = tmp.remove(it); 389 it = tmp.remove(it);
390 remove = TRUE; 390 remove = TRUE;
391 library = (*fit) + Option::dir_sep + (*it) + ".framework"; 391 library = (*fit) + Option::dir_sep + (*it) + ".framework";
392 break; 392 break;
393 } 393 }
394 } 394 }
395 } else if(opt.left(1) != "-") { 395 } else if(opt.left(1) != "-") {
396 remove = TRUE; 396 remove = TRUE;
397 library = opt; 397 library = opt;
398 } 398 }
399 if(!library.isEmpty()) { 399 if(!library.isEmpty()) {
400 if(name.isEmpty()) { 400 if(name.isEmpty()) {
401 int slsh = library.findRev(Option::dir_sep); 401 int slsh = library.findRev(Option::dir_sep);
402 if(slsh != -1) 402 if(slsh != -1)
403 name = library.right(library.length() - slsh - 1); 403 name = library.right(library.length() - slsh - 1);
404 } 404 }
405 library = fileFixify(library); 405 library = fileFixify(library);
406 QString key = keyFor(library); 406 QString key = keyFor(library);
407 bool is_frmwrk = (library.endsWith(".framework")); 407 bool is_frmwrk = (library.endsWith(".framework"));
408 t << "\t\t" << key << " = {" << "\n" 408 t << "\t\t" << key << " = {" << "\n"
409 << "\t\t\t" << "isa = " << (is_frmwrk ? "PBXFrameworkReference" : "PBXFileReference") << ";" << "\n" 409 << "\t\t\t" << "isa = " << (is_frmwrk ? "PBXFrameworkReference" : "PBXFileReference") << ";" << "\n"
410 << "\t\t\t" << "name = \"" << name << "\";" << "\n" 410 << "\t\t\t" << "name = \"" << name << "\";" << "\n"
411 << "\t\t\t" << "path = \"" << library << "\";" << "\n" 411 << "\t\t\t" << "path = \"" << library << "\";" << "\n"
412 << "\t\t\t" << "refType = " << reftypeForFile(library) << ";" << "\n" 412 << "\t\t\t" << "refType = " << reftypeForFile(library) << ";" << "\n"
413 << "\t\t" << "};" << "\n"; 413 << "\t\t" << "};" << "\n";
414 project->variables()["QMAKE_PBX_LIBRARIES"].append(key); 414 project->variables()["QMAKE_PBX_LIBRARIES"].append(key);
415 QString obj_key = library + ".o"; 415 QString obj_key = library + ".o";
416 obj_key = keyFor(obj_key); 416 obj_key = keyFor(obj_key);
417 t << "\t\t" << obj_key << " = {" << "\n" 417 t << "\t\t" << obj_key << " = {" << "\n"
418 << "\t\t\t" << "fileRef = " << key << ";" << "\n" 418 << "\t\t\t" << "fileRef = " << key << ";" << "\n"
419 << "\t\t\t" << "isa = PBXBuildFile;" << "\n" 419 << "\t\t\t" << "isa = PBXBuildFile;" << "\n"
420 << "\t\t\t" << "settings = {" << "\n" 420 << "\t\t\t" << "settings = {" << "\n"
421 << "\t\t\t" << "};" << "\n" 421 << "\t\t\t" << "};" << "\n"
422 << "\t\t" << "};" << "\n"; 422 << "\t\t" << "};" << "\n";
423 project->variables()["QMAKE_PBX_BUILD_LIBRARIES"].append(obj_key); 423 project->variables()["QMAKE_PBX_BUILD_LIBRARIES"].append(obj_key);
424 } 424 }
425 if(remove) 425 if(remove)
426 it = tmp.remove(it); 426 it = tmp.remove(it);
427 else 427 else
428 ++it; 428 ++it;
429 } 429 }
430 project->variables()[libs[i]] = tmp; 430 project->variables()[libs[i]] = tmp;
431 } 431 }
432 } 432 }
433 //SUBLIBS BUILDPHASE (just another makefile) 433 //SUBLIBS BUILDPHASE (just another makefile)
434 if(!project->isEmpty("SUBLIBS")) { 434 if(!project->isEmpty("SUBLIBS")) {
435 QString mkfile = pbx_dir + Option::dir_sep + "qt_sublibs.mak"; 435 QString mkfile = pbx_dir + Option::dir_sep + "qt_sublibs.mak";
436 QFile mkf(mkfile); 436 QFile mkf(mkfile);
437 if(mkf.open(IO_WriteOnly | IO_Translate)) { 437 if(mkf.open(IO_WriteOnly | IO_Translate)) {
438 debug_msg(1, "pbuilder: Creating file: %s", mkfile.latin1()); 438 debug_msg(1, "pbuilder: Creating file: %s", mkfile.latin1());
439 QTextStream mkt(&mkf); 439 QTextStream mkt(&mkf);
440 writeHeader(mkt); 440 writeHeader(mkt);
441 mkt << "SUBLIBS= "; 441 mkt << "SUBLIBS= ";
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
@@ -22,193 +22,193 @@ OCopServer::OCopServer()
22 init(); 22 init();
23 initSocket(); 23 initSocket();
24} 24}
25OCopServer::~OCopServer() { 25OCopServer::~OCopServer() {
26// socket notifiers should be deleted 26// socket notifiers should be deleted
27 close(m_serverfd ); 27 close(m_serverfd );
28} 28}
29void OCopServer::init() { 29void OCopServer::init() {
30 /* 30 /*
31 * we set SIGPIPE to SIG_IGN 31 * we set SIGPIPE to SIG_IGN
32 * to get EPIPE on reads ;) 32 * to get EPIPE on reads ;)
33 */ 33 */
34// qWarning("SIGPIPE to be ignored"); 34// qWarning("SIGPIPE to be ignored");
35 signal(SIGPIPE, SIG_IGN ); 35 signal(SIGPIPE, SIG_IGN );
36 36
37 /* 37 /*
38 * initialize some variables 38 * initialize some variables
39 */ 39 */
40 m_server = 0l; 40 m_server = 0l;
41 m_serverError = 0l; 41 m_serverError = 0l;
42} 42}
43 43
44/** 44/**
45 * here we will init our server 45 * here we will init our server
46 * socket and bind and do the listen 46 * socket and bind and do the listen
47 */ 47 */
48void OCopServer::initSocket() { 48void OCopServer::initSocket() {
49 /* get the home dir */ 49 /* get the home dir */
50 QCString home( getenv("HOME") ); 50 QCString home( getenv("HOME") );
51 QCString path( home + "/.opie.cop"); 51 QCString path( home + "/.opie.cop");
52 52
53 if ( ( m_serverfd = socket( PF_UNIX, SOCK_STREAM, 0 ) ) == -1 ) { 53 if ( ( m_serverfd = socket( PF_UNIX, SOCK_STREAM, 0 ) ) == -1 ) {
54 qWarning("failed to create server socket"); 54 qWarning("failed to create server socket");
55 /* try again later */ 55 /* try again later */
56 QTimer::singleShot( 400, this, SLOT(initSocket() ) ); 56 QTimer::singleShot( 400, this, SLOT(initSocket() ) );
57 return; 57 return;
58 } 58 }
59 qWarning( "unlinking file %s", path.data() ); 59 qWarning( "unlinking file %s", path.data() );
60 60
61 /* unlink previous sockets */ 61 /* unlink previous sockets */
62 unlink( path.data() ); 62 unlink( path.data() );
63 63
64 struct sockaddr_un m_address; 64 struct sockaddr_un m_address;
65 memset(&m_address, 0, sizeof(m_address ) ); 65 memset(&m_address, 0, sizeof(m_address ) );
66 m_address.sun_family = AF_UNIX; /* unix domain socket */ 66 m_address.sun_family = AF_UNIX; /* unix domain socket */
67 strcpy(m_address.sun_path, path.data() ); 67 strcpy(m_address.sun_path, path.data() );
68 m_adrlaenge = sizeof(m_address.sun_family) + strlen(m_address.sun_path ); 68 m_adrlaenge = sizeof(m_address.sun_family) + strlen(m_address.sun_path );
69 69
70 /* cast to make it a (sockadr*) */ 70 /* cast to make it a (sockadr*) */
71 if (bind(m_serverfd, (struct sockaddr*)&m_address, m_adrlaenge ) == -1 ) { 71 if (bind(m_serverfd, (struct sockaddr*)&m_address, m_adrlaenge ) == -1 ) {
72 qWarning("Server could not bind try again"); 72 qWarning("Server could not bind try again");
73 close(m_serverfd); 73 close(m_serverfd);
74 QTimer::singleShot(400, this, SLOT(initSocket() ) ); 74 QTimer::singleShot(400, this, SLOT(initSocket() ) );
75 return; 75 return;
76 } 76 }
77 77
78 /* tell the kernel that we're listening and accepting 78 /* tell the kernel that we're listening and accepting
79 * 5 pending connections */ 79 * 5 pending connections */
80 if (listen(m_serverfd, 5) == -1 ) { 80 if (listen(m_serverfd, 5) == -1 ) {
81 qWarning("could not listen"); 81 qWarning("could not listen");
82 close(m_serverfd ); 82 close(m_serverfd );
83 QTimer::singleShot(400, this, SLOT(initSocket() ) ); 83 QTimer::singleShot(400, this, SLOT(initSocket() ) );
84 return; 84 return;
85 } 85 }
86 86
87 /* 87 /*
88 * now we will create two QSocketNotifier 88 * now we will create two QSocketNotifier
89 * which will us notify on reads 89 * which will us notify on reads
90 * and errors 90 * and errors
91 * we do this because they integrate 91 * we do this because they integrate
92 * nicely into the QApplication eventloop 92 * nicely into the QApplication eventloop
93 */ 93 */
94 m_server = new QSocketNotifier(m_serverfd, QSocketNotifier::Read, this ); 94 m_server = new QSocketNotifier(m_serverfd, QSocketNotifier::Read, this );
95 connect( m_server, SIGNAL(activated(int) ), 95 connect( m_server, SIGNAL(activated(int) ),
96 this, SLOT(newOnServer() ) ); 96 this, SLOT(newOnServer() ) );
97 97
98 m_serverError = new QSocketNotifier( m_serverfd, QSocketNotifier::Exception, this); 98 m_serverError = new QSocketNotifier( m_serverfd, QSocketNotifier::Exception, this);
99 connect(m_serverError, SIGNAL(activated(int) ), 99 connect(m_serverError, SIGNAL(activated(int) ),
100 this, SLOT(errorOnServer() ) ); 100 this, SLOT(errorOnServer() ) );
101 101
102 qWarning("done with registering"); 102 qWarning("done with registering");
103} 103}
104/** 104/**
105 * we got the possibility to read 105 * we got the possibility to read
106 * on the server 106 * on the server
107 * this is mostly due a connect 107 * this is mostly due a connect
108 * on a client side 108 * on a client side
109 * we will accept it 109 * we will accept it
110 * add it to our list 110 * add it to our list
111 */ 111 */
112void OCopServer::newOnServer() { 112void OCopServer::newOnServer() {
113 int fd = accept(); 113 int fd = accept();
114 if ( fd < 0 ) 114 if ( fd < 0 )
115 return; 115 return;
116 116
117 /* 117 /*
118 * we got a successfull new connection 118 * we got a successful new connection
119 * be happy 119 * be happy
120 * set SocketNotifier 120 * set SocketNotifier
121 * connect it 121 * connect it
122 * and a OCOPClient 122 * and a OCOPClient
123 */ 123 */
124// qWarning("Heureka new connection %d", fd ); 124// qWarning("Heureka new connection %d", fd );
125 125
126 126
127 registerClient( fd ); 127 registerClient( fd );
128} 128}
129int OCopServer::accept() { 129int OCopServer::accept() {
130 /* 130 /*
131 * accept it 131 * accept it
132 * the socket is currently blocking IIRC 132 * the socket is currently blocking IIRC
133 */ 133 */
134 return ::accept( m_serverfd, (struct sockaddr*)&m_address, &m_adrlaenge ); 134 return ::accept( m_serverfd, (struct sockaddr*)&m_address, &m_adrlaenge );
135} 135}
136void OCopServer::newOnClient( int fd ) { 136void OCopServer::newOnClient( int fd ) {
137 errno = 0; 137 errno = 0;
138 OCOPHead head; 138 OCOPHead head;
139 memset(&head, 0, sizeof(head) ); 139 memset(&head, 0, sizeof(head) );
140 int rea = ::read(fd, &head, sizeof(head) ); 140 int rea = ::read(fd, &head, sizeof(head) );
141 //qWarning("read %d %d", rea, errno); 141 //qWarning("read %d %d", rea, errno);
142 /* 142 /*
143 * I should get EPIPE but nothing like this happens 143 * I should get EPIPE but nothing like this happens
144 * so if rea == 0 and we were signaled by the notifier 144 * so if rea == 0 and we were signaled by the notifier
145 * we close it and drop the clients... 145 * we close it and drop the clients...
146 */ 146 */
147 if ( rea <= 0 ) { 147 if ( rea <= 0 ) {
148 deregisterClient( fd ); 148 deregisterClient( fd );
149 return; 149 return;
150 } 150 }
151 /* 151 /*
152 * OCOPHead 152 * OCOPHead
153 */ 153 */
154 //qWarning("data %s %d", &bug, rea ); 154 //qWarning("data %s %d", &bug, rea );
155 155
156 /* 156 /*
157 * Check the magic 157 * Check the magic
158 * if chcked read till EOF if magic does not match 158 * if chcked read till EOF if magic does not match
159 * otherwise do read 159 * otherwise do read
160 * channel 160 * channel
161 * func 161 * func
162 * data into mem 162 * data into mem
163 * and then send the OCOPPacket 163 * and then send the OCOPPacket
164 * 164 *
165 */ 165 */
166 if (head.magic == 47 ) { 166 if (head.magic == 47 ) {
167// qWarning("magic match"); 167// qWarning("magic match");
168 QCString channel( head.chlen+1 ); 168 QCString channel( head.chlen+1 );
169 QCString func( head.funclen+1 ); 169 QCString func( head.funclen+1 );
170 QByteArray data ( head.datalen+1 ); 170 QByteArray data ( head.datalen+1 );
171 171
172 /* 172 /*
173 * we do not check for errors 173 * we do not check for errors
174 */ 174 */
175// qWarning("read "); 175// qWarning("read ");
176 int s = read(fd, channel.data(), head.chlen ); 176 int s = read(fd, channel.data(), head.chlen );
177 s = read(fd, func.data(), head.funclen ); 177 s = read(fd, func.data(), head.funclen );
178 s = read(fd, data.data(), head.datalen ); 178 s = read(fd, data.data(), head.datalen );
179// qWarning("read"); 179// qWarning("read");
180 180
181 /* debug output */ 181 /* debug output */
182// qWarning("channel %s %d", channel.data(), head.chlen ); 182// qWarning("channel %s %d", channel.data(), head.chlen );
183// qWarning("func %s %d", func.data(), head.funclen ); 183// qWarning("func %s %d", func.data(), head.funclen );
184 /* debug end */ 184 /* debug end */
185 185
186 /* 186 /*
187 * now that we got the complete body 187 * now that we got the complete body
188 * we need to make a package 188 * we need to make a package
189 * and then we need to send it to clients 189 * and then we need to send it to clients
190 * making a package is done here 190 * making a package is done here
191 * dispatching it not 191 * dispatching it not
192 */ 192 */
193 OCOPPacket packet( head.type, channel, func, data ); 193 OCOPPacket packet( head.type, channel, func, data );
194 dispatch( packet, fd ); 194 dispatch( packet, fd );
195 195
196 }else{ 196 }else{
197// qWarning("magic does not match"); 197// qWarning("magic does not match");
198// qWarning("magic %d", head.magic ); 198// qWarning("magic %d", head.magic );
199 } 199 }
200} 200}
201void OCopServer::registerClient( int fd ) { 201void OCopServer::registerClient( int fd ) {
202 if (m_clients.contains(fd) ) 202 if (m_clients.contains(fd) )
203 return; 203 return;
204 204
205 QSocketNotifier* notify = new QSocketNotifier(fd, QSocketNotifier::Read, this ); 205 QSocketNotifier* notify = new QSocketNotifier(fd, QSocketNotifier::Read, this );
206 connect(notify, SIGNAL(activated(int) ), 206 connect(notify, SIGNAL(activated(int) ),
207 this, SLOT(newOnClient(int) ) ); 207 this, SLOT(newOnClient(int) ) );
208 OCOPClient client; 208 OCOPClient client;
209 client.fd = fd; 209 client.fd = fd;
210 client.notify = notify; 210 client.notify = notify;
211 m_clients.insert( client.fd, client ); 211 m_clients.insert( client.fd, client );
212// qWarning("clients are up to %d", m_clients.count() ); 212// qWarning("clients are up to %d", m_clients.count() );
213}; 213};
214void OCopServer::deregisterClient(int fd ) { 214void OCopServer::deregisterClient(int fd ) {