summaryrefslogtreecommitdiff
authorerik <erik>2007-01-19 01:18:01 (UTC)
committer erik <erik>2007-01-19 01:18:01 (UTC)
commit32343107b30904806d02672955c57ed53d39fe79 (patch) (unidiff)
tree9114a0ea170e3adc807a2445b49360f1bfde9626
parentac0ce844e90a64247c0adb210e0a23021b011d57 (diff)
downloadopie-32343107b30904806d02672955c57ed53d39fe79.zip
opie-32343107b30904806d02672955c57ed53d39fe79.tar.gz
opie-32343107b30904806d02672955c57ed53d39fe79.tar.bz2
Every file in this commit has a change to check the return value of a call.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/textedit/textedit.cpp33
-rw-r--r--core/launcher/qprocess_unix.cpp6
-rw-r--r--core/launcher/server.cpp19
-rw-r--r--core/settings/launcher/menusettings.cpp5
-rw-r--r--core/settings/launcher/taskbarsettings.cpp13
-rw-r--r--libopie2/opiecore/oglobal.cpp2
-rw-r--r--libopie2/opiecore/oprocess.cpp2
-rw-r--r--library/global.cpp63
-rw-r--r--noncore/apps/advancedfm/output.cpp5
-rw-r--r--noncore/apps/tinykate/libkate/document/katebuffer.cpp5
-rw-r--r--noncore/settings/usermanager/userdialog.cpp9
11 files changed, 94 insertions, 68 deletions
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp
index 759e440..61beac5 100644
--- a/core/apps/textedit/textedit.cpp
+++ b/core/apps/textedit/textedit.cpp
@@ -633,80 +633,81 @@ void TextEdit::editFind() {
633 searchBar->show(); 633 searchBar->show();
634 searchEdit->setFocus(); 634 searchEdit->setFocus();
635} 635}
636 636
637void TextEdit::findNext() { 637void TextEdit::findNext() {
638 editor->find( searchEdit->text(), false, false ); 638 editor->find( searchEdit->text(), false, false );
639 639
640} 640}
641 641
642void TextEdit::findClose() { 642void TextEdit::findClose() {
643 searchBar->hide(); 643 searchBar->hide();
644} 644}
645 645
646void TextEdit::search() { 646void TextEdit::search() {
647 editor->find( searchEdit->text(), false, false ); 647 editor->find( searchEdit->text(), false, false );
648} 648}
649 649
650void TextEdit::newFile( const DocLnk &f ) { 650void TextEdit::newFile( const DocLnk &f ) {
651 DocLnk nf = f; 651 DocLnk nf = f;
652 nf.setType("text/plain"); 652 nf.setType("text/plain");
653 clear(); 653 clear();
654 setWState (WState_Reserved1 ); 654 setWState (WState_Reserved1 );
655 editor->setFocus(); 655 editor->setFocus();
656 doc = new DocLnk(nf); 656 doc = new DocLnk(nf);
657 currentFileName = "Unnamed"; 657 currentFileName = "Unnamed";
658 odebug << "newFile "+currentFileName << oendl; 658 odebug << "newFile "+currentFileName << oendl;
659 updateCaption( currentFileName); 659 updateCaption( currentFileName);
660// editor->setEdited( false); 660// editor->setEdited( false);
661} 661}
662 662
663void TextEdit::openDotFile( const QString &f ) { 663void TextEdit::openDotFile( const QString &f ) {
664 if(!currentFileName.isEmpty()) { 664 if(!currentFileName.isEmpty()) {
665 currentFileName=f; 665 currentFileName=f;
666 666
667 odebug << "openFile dotfile " + currentFileName << oendl; 667 odebug << "openFile dotfile " + currentFileName << oendl;
668 QString txt; 668 QString txt;
669 QFile file(f); 669 QFile file(f);
670 file.open(IO_ReadWrite); 670 if (!file.open(IO_ReadWrite))
671 QTextStream t(&file); 671 owarn << "Failed to open file " << file.name() << oendl;
672 while ( !t.atEnd()) { 672 else {
673 txt+=t.readLine()+"\n"; 673 QTextStream t(&file);
674 } 674 while ( !t.atEnd()) {
675 editor->setText(txt); 675 txt+=t.readLine()+"\n";
676 editor->setEdited( false); 676 }
677 edited1=false; 677 editor->setText(txt);
678 edited=false; 678 editor->setEdited( false);
679 679 edited1=false;
680 680 edited=false;
681 }
681 } 682 }
682 updateCaption( currentFileName); 683 updateCaption( currentFileName);
683} 684}
684 685
685void TextEdit::openFile( const QString &f ) { 686void TextEdit::openFile( const QString &f ) {
686 odebug << "filename is "+ f << oendl; 687 odebug << "filename is "+ f << oendl;
687 QString filer; 688 QString filer;
688 QFileInfo fi( f); 689 QFileInfo fi( f);
689// bFromDocView = true; 690// bFromDocView = true;
690 if(f.find(".desktop",0,true) != -1 && !openDesktop ) 691 if(f.find(".desktop",0,true) != -1 && !openDesktop )
691 { 692 {
692 switch ( QMessageBox::warning(this,tr("Text Editor"),tr("Text Editor has detected<BR>you selected a <B>.desktop</B>file.<BR>Open<B>.desktop</B> file or <B>linked</B> file?"),tr(".desktop File"),tr("Linked Document"),0,1,1) ) 693 switch ( QMessageBox::warning(this,tr("Text Editor"),tr("Text Editor has detected<BR>you selected a <B>.desktop</B>file.<BR>Open<B>.desktop</B> file or <B>linked</B> file?"),tr(".desktop File"),tr("Linked Document"),0,1,1) )
693 { 694 {
694 case 0: //desktop 695 case 0: //desktop
695 filer = f; 696 filer = f;
696 break; 697 break;
697 case 1: //linked 698 case 1: //linked
698 DocLnk sf(f); 699 DocLnk sf(f);
699 filer = sf.file(); 700 filer = sf.file();
700 break; 701 break;
701 }; 702 };
702 } 703 }
703 else if(fi.baseName().left(1) == "") 704 else if(fi.baseName().left(1) == "")
704 { 705 {
705 odebug << "opening dotfile" << oendl; 706 odebug << "opening dotfile" << oendl;
706 currentFileName=f; 707 currentFileName=f;
707 openDotFile(currentFileName); 708 openDotFile(currentFileName);
708 return; 709 return;
709 } 710 }
710 /* 711 /*
711 * The problem is a file where Config(f).isValid() and it does not 712 * The problem is a file where Config(f).isValid() and it does not
712 * end with .desktop will be treated as desktop file 713 * end with .desktop will be treated as desktop file
diff --git a/core/launcher/qprocess_unix.cpp b/core/launcher/qprocess_unix.cpp
index 97c0460..3125bcc 100644
--- a/core/launcher/qprocess_unix.cpp
+++ b/core/launcher/qprocess_unix.cpp
@@ -284,65 +284,69 @@ void QProcessManager::append( QProc *p )
284 odebug << "QProcessManager: append process (procList.count(): " << procList->count() << ")" << oendl; 284 odebug << "QProcessManager: append process (procList.count(): " << procList->count() << ")" << oendl;
285#endif 285#endif
286} 286}
287 287
288void QProcessManager::remove( QProc *p ) 288void QProcessManager::remove( QProc *p )
289{ 289{
290 procList->remove( p ); 290 procList->remove( p );
291#if defined(QT_QPROCESS_DEBUG) 291#if defined(QT_QPROCESS_DEBUG)
292 odebug << "QProcessManager: remove process (procList.count(): " << procList->count() << ")" << oendl; 292 odebug << "QProcessManager: remove process (procList.count(): " << procList->count() << ")" << oendl;
293#endif 293#endif
294 cleanup(); 294 cleanup();
295} 295}
296 296
297void QProcessManager::cleanup() 297void QProcessManager::cleanup()
298{ 298{
299 if ( procList->count() == 0 ) { 299 if ( procList->count() == 0 ) {
300 QTimer::singleShot( 0, this, SLOT(removeMe()) ); 300 QTimer::singleShot( 0, this, SLOT(removeMe()) );
301 } 301 }
302} 302}
303 303
304void QProcessManager::removeMe() 304void QProcessManager::removeMe()
305{ 305{
306 if ( procList->count() == 0 ) { 306 if ( procList->count() == 0 ) {
307 qprocess_cleanup_procmanager.remove( &QProcessPrivate::procManager ); 307 qprocess_cleanup_procmanager.remove( &QProcessPrivate::procManager );
308 QProcessPrivate::procManager = 0; 308 QProcessPrivate::procManager = 0;
309 delete this; 309 delete this;
310 } 310 }
311} 311}
312 312
313void QProcessManager::sigchldHnd( int fd ) 313void QProcessManager::sigchldHnd( int fd )
314{ 314{
315 char tmp; 315 char tmp;
316 ::read( fd, &tmp, sizeof(tmp) ); 316 if (::read( fd, &tmp, sizeof(tmp) ) < 0)
317#if defined(QT_QPROCESS_DEBUG)
318 odebug << "QProcessManager::sigchldHnd() failed dummy read of file descriptor" << oendl;
319#endif
320 ;
317#if defined(QT_QPROCESS_DEBUG) 321#if defined(QT_QPROCESS_DEBUG)
318 odebug << "QProcessManager::sigchldHnd()" << oendl; 322 odebug << "QProcessManager::sigchldHnd()" << oendl;
319#endif 323#endif
320 QProc *proc; 324 QProc *proc;
321 QProcess *process; 325 QProcess *process;
322 bool removeProc; 326 bool removeProc;
323 proc = procList->first(); 327 proc = procList->first();
324 while ( proc != 0 ) { 328 while ( proc != 0 ) {
325 removeProc = FALSE; 329 removeProc = FALSE;
326 process = proc->process; 330 process = proc->process;
327 QProcess *process_exit_notify=0; 331 QProcess *process_exit_notify=0;
328 if ( process != 0 ) { 332 if ( process != 0 ) {
329 if ( !process->isRunning() ) { 333 if ( !process->isRunning() ) {
330#if defined(QT_QPROCESS_DEBUG) 334#if defined(QT_QPROCESS_DEBUG)
331 odebug << "QProcessManager::sigchldHnd() (PID: " << proc->pid << "): process exited (QProcess available)" << oendl; 335 odebug << "QProcessManager::sigchldHnd() (PID: " << proc->pid << "): process exited (QProcess available)" << oendl;
332#endif 336#endif
333 // read pending data 337 // read pending data
334 int nbytes = 0; 338 int nbytes = 0;
335 if ( ::ioctl(proc->socketStdout, FIONREAD, (char*)&nbytes)==0 && nbytes>0 ) { 339 if ( ::ioctl(proc->socketStdout, FIONREAD, (char*)&nbytes)==0 && nbytes>0 ) {
336#if defined(QT_QPROCESS_DEBUG) 340#if defined(QT_QPROCESS_DEBUG)
337 odebug << "QProcessManager::sigchldHnd() (PID: " << proc->pid << "): reading " << nbytes << " bytes of pending data on stdout" << oendl; 341 odebug << "QProcessManager::sigchldHnd() (PID: " << proc->pid << "): reading " << nbytes << " bytes of pending data on stdout" << oendl;
338#endif 342#endif
339 process->socketRead( proc->socketStdout ); 343 process->socketRead( proc->socketStdout );
340 } 344 }
341 nbytes = 0; 345 nbytes = 0;
342 if ( ::ioctl(proc->socketStderr, FIONREAD, (char*)&nbytes)==0 && nbytes>0 ) { 346 if ( ::ioctl(proc->socketStderr, FIONREAD, (char*)&nbytes)==0 && nbytes>0 ) {
343#if defined(QT_QPROCESS_DEBUG) 347#if defined(QT_QPROCESS_DEBUG)
344 odebug << "QProcessManager::sigchldHnd() (PID: " << proc->pid << "): reading " << nbytes << " bytes of pending data on stderr" << oendl; 348 odebug << "QProcessManager::sigchldHnd() (PID: " << proc->pid << "): reading " << nbytes << " bytes of pending data on stderr" << oendl;
345#endif 349#endif
346 process->socketRead( proc->socketStderr ); 350 process->socketRead( proc->socketStderr );
347 } 351 }
348 352
diff --git a/core/launcher/server.cpp b/core/launcher/server.cpp
index 921b790..c45265a 100644
--- a/core/launcher/server.cpp
+++ b/core/launcher/server.cpp
@@ -338,74 +338,82 @@ void Server::systemMsg(const QCString &msg, const QByteArray &data)
338#warning FIXME support TempScreenSaverMode 338#warning FIXME support TempScreenSaverMode
339#if 0 339#if 0
340 } else if ( msg == "setTempScreenSaverMode(int,int)" ) { 340 } else if ( msg == "setTempScreenSaverMode(int,int)" ) {
341 int mode, pid; 341 int mode, pid;
342 stream >> mode >> pid; 342 stream >> mode >> pid;
343 tsmMonitor->setTempMode(mode, pid); 343 tsmMonitor->setTempMode(mode, pid);
344#endif 344#endif
345 } else if ( msg == "linkChanged(QString)" ) { 345 } else if ( msg == "linkChanged(QString)" ) {
346 QString link; 346 QString link;
347 stream >> link; 347 stream >> link;
348 odebug << "desktop.cpp systemMsg -> linkchanged( " << link << " )" << oendl; 348 odebug << "desktop.cpp systemMsg -> linkchanged( " << link << " )" << oendl;
349 docList->linkChanged(link); 349 docList->linkChanged(link);
350 } else if (msg =="reforceDocuments()") { 350 } else if (msg =="reforceDocuments()") {
351 docList->reforceDocuments(); 351 docList->reforceDocuments();
352 } else if ( msg == "serviceChanged(QString)" ) { 352 } else if ( msg == "serviceChanged(QString)" ) {
353 MimeType::updateApplications(); 353 MimeType::updateApplications();
354 } else if ( msg == "mkdir(QString)" ) { 354 } else if ( msg == "mkdir(QString)" ) {
355 QString dir; 355 QString dir;
356 stream >> dir; 356 stream >> dir;
357 if ( !dir.isEmpty() ) 357 if ( !dir.isEmpty() )
358 mkdir( dir ); 358 mkdir( dir );
359 } else if ( msg == "rdiffGenSig(QString,QString)" ) { 359 } else if ( msg == "rdiffGenSig(QString,QString)" ) {
360 QString baseFile, sigFile; 360 QString baseFile, sigFile;
361 stream >> baseFile >> sigFile; 361 stream >> baseFile >> sigFile;
362 QRsync::generateSignature( baseFile, sigFile ); 362 QRsync::generateSignature( baseFile, sigFile );
363 } else if ( msg == "rdiffGenDiff(QString,QString,QString)" ) { 363 } else if ( msg == "rdiffGenDiff(QString,QString,QString)" ) {
364 QString baseFile, sigFile, deltaFile; 364 QString baseFile, sigFile, deltaFile;
365 stream >> baseFile >> sigFile >> deltaFile; 365 stream >> baseFile >> sigFile >> deltaFile;
366 QRsync::generateDiff( baseFile, sigFile, deltaFile ); 366 QRsync::generateDiff( baseFile, sigFile, deltaFile );
367 } else if ( msg == "rdiffApplyPatch(QString,QString)" ) { 367 } else if ( msg == "rdiffApplyPatch(QString,QString)" ) {
368 QString baseFile, deltaFile; 368 QString baseFile, deltaFile;
369 stream >> baseFile >> deltaFile; 369 stream >> baseFile >> deltaFile;
370 bool fileWasCreated = false;
370 if ( !QFile::exists( baseFile ) ) { 371 if ( !QFile::exists( baseFile ) ) {
371 QFile f( baseFile ); 372 QFile f( baseFile );
372 f.open( IO_WriteOnly ); 373 fileWasCreated = f.open( IO_WriteOnly );
373 f.close(); 374 f.close();
374 } 375 }
375 QRsync::applyDiff( baseFile, deltaFile ); 376 if ( fileWasCreated ) {
377 QRsync::applyDiff( baseFile, deltaFile );
376#ifndef QT_NO_COP 378#ifndef QT_NO_COP
377 QCopEnvelope e( "QPE/Desktop", "patchApplied(QString)" ); 379 QCopEnvelope e( "QPE/Desktop", "patchApplied(QString)" );
378 e << baseFile; 380 e << baseFile;
379#endif 381#endif
382 } else {
383#ifndef QT_NO_COP
384 QCopEnvelope e( "QPE/Desktop", "patchUnapplied(QString)" );
385 e << baseFile;
386#endif
387 }
380 } else if ( msg == "rdiffCleanup()" ) { 388 } else if ( msg == "rdiffCleanup()" ) {
381 mkdir( "/tmp/rdiff" ); 389 mkdir( "/tmp/rdiff" );
382 QDir dir; 390 QDir dir;
383 dir.setPath( "/tmp/rdiff" ); 391 dir.setPath( "/tmp/rdiff" );
384 QStringList entries = dir.entryList(); 392 QStringList entries = dir.entryList();
385 for ( QStringList::Iterator it = entries.begin(); it != entries.end(); ++it ) 393 for ( QStringList::Iterator it = entries.begin(); it != entries.end(); ++it )
386 dir.remove( *it ); 394 dir.remove( *it );
387 } else if ( msg == "sendHandshakeInfo()" ) { 395 } else if ( msg == "sendHandshakeInfo()" ) {
388 QString home = getenv( "HOME" ); 396 QString home = getenv( "HOME" );
389#ifndef QT_NO_COP 397#ifndef QT_NO_COP
390 QCopEnvelope e( "QPE/Desktop", "handshakeInfo(QString,bool)" ); 398 QCopEnvelope e( "QPE/Desktop", "handshakeInfo(QString,bool)" );
391 e << home; 399 e << home;
392 int locked = (int) ServerApplication::screenLocked(); 400 int locked = (int) ServerApplication::screenLocked();
393 e << locked; 401 e << locked;
394#endif 402#endif
395 } else if ( msg == "sendVersionInfo()" ) { 403 } else if ( msg == "sendVersionInfo()" ) {
396 /* 404 /*
397 * @&$*! Qtopiadesktop relies on the major number 405 * @&$*! Qtopiadesktop relies on the major number
398 * to start with 1. (or 2 as the case of version 2.1 will be) 406 * to start with 1. (or 2 as the case of version 2.1 will be)
399 * we need to fake 1.7 to be able 407 * we need to fake 1.7 to be able
400 * to sync with Qtopiadesktop 1.7. 408 * to sync with Qtopiadesktop 1.7.
401 * We'll send it Opie's version in the platform string for now, 409 * We'll send it Opie's version in the platform string for now,
402 * until such time when QD gets rewritten correctly. 410 * until such time when QD gets rewritten correctly.
403 */ 411 */
404 QCopEnvelope e( "QPE/Desktop", "versionInfo(QString,QString)" ); 412 QCopEnvelope e( "QPE/Desktop", "versionInfo(QString,QString)" );
405 413
406 QString opiename = "Opie "+QString(QPE_VERSION); 414 QString opiename = "Opie "+QString(QPE_VERSION);
407 QString QDVersion="1.7"; 415 QString QDVersion="1.7";
408 e << QDVersion << opiename; 416 e << QDVersion << opiename;
409 417
410 } else if ( msg == "sendCardInfo()" ) { 418 } else if ( msg == "sendCardInfo()" ) {
411#ifndef QT_NO_COP 419#ifndef QT_NO_COP
@@ -969,38 +977,39 @@ void Server::postDirectAccess()
969#endif 977#endif
970} 978}
971 979
972void Server::finishedQueuedRequests() 980void Server::finishedQueuedRequests()
973{ 981{
974 if ( qrr->readyToDelete ) { 982 if ( qrr->readyToDelete ) {
975 delete qrr; 983 delete qrr;
976 qrr = 0; 984 qrr = 0;
977 // Get rid of the dialog 985 // Get rid of the dialog
978 if ( syncDialog ) { 986 if ( syncDialog ) {
979 delete syncDialog; 987 delete syncDialog;
980 syncDialog = 0; 988 syncDialog = 0;
981 } 989 }
982#warning FIXME support TempScreenSaverMode 990#warning FIXME support TempScreenSaverMode
983#if 0 991#if 0
984 QPEApplication::setTempScreenSaverMode(QPEApplication::Enable); 992 QPEApplication::setTempScreenSaverMode(QPEApplication::Enable);
985#endif 993#endif
986 } else { 994 } else {
987 qrr->readyToDelete = TRUE; 995 qrr->readyToDelete = TRUE;
988 QTimer::singleShot( 0, this, SLOT(finishedQueuedRequests()) ); 996 QTimer::singleShot( 0, this, SLOT(finishedQueuedRequests()) );
989 } 997 }
990} 998}
991 999
992void Server::startSoundServer() { 1000void Server::startSoundServer() {
993 if ( !process ) { 1001 if ( !process ) {
994 process = new Opie::Core::OProcess( this ); 1002 process = new Opie::Core::OProcess( this );
995 connect(process, SIGNAL(processExited(Opie::Core::OProcess*)), 1003 connect(process, SIGNAL(processExited(Opie::Core::OProcess*)),
996 SLOT(soundServerExited())); 1004 SLOT(soundServerExited()));
997 } 1005 }
998 1006
999 process->clearArguments(); 1007 process->clearArguments();
1000 *process << QPEApplication::qpeDir() + "bin/qss"; 1008 *process << QPEApplication::qpeDir() + "bin/qss";
1001 process->start(); 1009 if (!process->start())
1010 owarn << "Sound server process did not start" << oendl;
1002} 1011}
1003 1012
1004void Server::soundServerExited() { 1013void Server::soundServerExited() {
1005 QTimer::singleShot(5000, this, SLOT(startSoundServer())); 1014 QTimer::singleShot(5000, this, SLOT(startSoundServer()));
1006} 1015}
diff --git a/core/settings/launcher/menusettings.cpp b/core/settings/launcher/menusettings.cpp
index 29ce841..d63b203 100644
--- a/core/settings/launcher/menusettings.cpp
+++ b/core/settings/launcher/menusettings.cpp
@@ -4,126 +4,129 @@
4 .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> 4 .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
5 .>+-= 5 .>+-=
6_;:, .> :=|. This file is free software; you can 6_;:, .> :=|. This file is free software; you can
7.> <`_, > . <= redistribute it and/or modify it under 7.> <`_, > . <= redistribute it and/or modify it under
8:`=1 )Y*s>-.-- : the terms of the GNU General Public 8:`=1 )Y*s>-.-- : the terms of the GNU General Public
9.="- .-=="i, .._ License as published by the Free Software 9.="- .-=="i, .._ License as published by the Free Software
10- . .-<_> .<> Foundation; either version 2 of the License, 10- . .-<_> .<> Foundation; either version 2 of the License,
11 ._= =} : or (at your option) any later version. 11 ._= =} : or (at your option) any later version.
12 .%`+i> _;_. 12 .%`+i> _;_.
13 .i_,=:_. -<s. This file is distributed in the hope that 13 .i_,=:_. -<s. This file is distributed in the hope that
14 + . -:. = it will be useful, but WITHOUT ANY WARRANTY; 14 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
15 : .. .:, . . . without even the implied warranty of 15 : .. .:, . . . without even the implied warranty of
16 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A 16 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
17 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General 17 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General
18..}^=.= = ; Public License for more details. 18..}^=.= = ; Public License for more details.
19++= -. .` .: 19++= -. .` .:
20: = ...= . :.=- You should have received a copy of the GNU 20: = ...= . :.=- You should have received a copy of the GNU
21-. .:....=;==+<; General Public License along with this file; 21-. .:....=;==+<; General Public License along with this file;
22 -_. . . )=. = see the file COPYING. If not, write to the 22 -_. . . )=. = see the file COPYING. If not, write to the
23 -- :-=` Free Software Foundation, Inc., 23 -- :-=` Free Software Foundation, Inc.,
24 59 Temple Place - Suite 330, 24 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28 28
29#include "menusettings.h" 29#include "menusettings.h"
30 30
31#include <qpe/config.h> 31#include <qpe/config.h>
32#include <qpe/qlibrary.h> 32#include <qpe/qlibrary.h>
33#include <qpe/qpeapplication.h> 33#include <qpe/qpeapplication.h>
34#include <qpe/menuappletinterface.h> 34#include <qpe/menuappletinterface.h>
35#include <qpe/qcopenvelope_qws.h> 35#include <qpe/qcopenvelope_qws.h>
36#include <opie2/odebug.h>
36 37
37#include <qdir.h> 38#include <qdir.h>
38#include <qlistview.h> 39#include <qlistview.h>
39#include <qcheckbox.h> 40#include <qcheckbox.h>
40#include <qheader.h> 41#include <qheader.h>
41#include <qlayout.h> 42#include <qlayout.h>
42#include <qlabel.h> 43#include <qlabel.h>
43#include <qwhatsthis.h> 44#include <qwhatsthis.h>
44 45
45#include <stdlib.h> 46#include <stdlib.h>
46 47
47 48
48MenuSettings::MenuSettings ( QWidget *parent, const char *name ) 49MenuSettings::MenuSettings ( QWidget *parent, const char *name )
49 : QWidget ( parent, name ) 50 : QWidget ( parent, name )
50{ 51{
51 m_applets_changed = false; 52 m_applets_changed = false;
52 53
53 QBoxLayout *lay = new QVBoxLayout ( this, 4, 4 ); 54 QBoxLayout *lay = new QVBoxLayout ( this, 4, 4 );
54 55
55 QLabel *l = new QLabel ( tr( "Load applets in O-Menu:" ), this ); 56 QLabel *l = new QLabel ( tr( "Load applets in O-Menu:" ), this );
56 lay-> addWidget ( l ); 57 lay-> addWidget ( l );
57 58
58 m_list = new QListView ( this ); 59 m_list = new QListView ( this );
59 m_list-> addColumn ( "foobar" ); 60 m_list-> addColumn ( "foobar" );
60 m_list-> header ( )-> hide ( ); 61 m_list-> header ( )-> hide ( );
61 62
62 lay-> addWidget ( m_list ); 63 lay-> addWidget ( m_list );
63 64
64 m_menutabs = new QCheckBox ( tr( "Show Launcher tabs in O-Menu" ), this ); 65 m_menutabs = new QCheckBox ( tr( "Show Launcher tabs in O-Menu" ), this );
65 lay-> addWidget ( m_menutabs ); 66 lay-> addWidget ( m_menutabs );
66 67
67 m_menusubpopup = new QCheckBox ( tr( "Show Applications in Subpopups" ), this ); 68 m_menusubpopup = new QCheckBox ( tr( "Show Applications in Subpopups" ), this );
68 lay-> addWidget ( m_menusubpopup ); 69 lay-> addWidget ( m_menusubpopup );
69 70
70 QWhatsThis::add ( m_list, tr( "Check the applets that you want to have included in the O-Menu." )); 71 QWhatsThis::add ( m_list, tr( "Check the applets that you want to have included in the O-Menu." ));
71 QWhatsThis::add ( m_menutabs, tr( "Adds the contents of the Launcher Tabs as menus in the O-Menu." )); 72 QWhatsThis::add ( m_menutabs, tr( "Adds the contents of the Launcher Tabs as menus in the O-Menu." ));
72 73
73 connect ( m_list, SIGNAL( clicked(QListViewItem*)), this, SLOT( appletChanged())); 74 connect ( m_list, SIGNAL( clicked(QListViewItem*)), this, SLOT( appletChanged()));
74 75
75 init ( ); 76 init ( );
76} 77}
77 78
78void MenuSettings::init ( ) 79void MenuSettings::init ( )
79{ 80{
80 Config cfg ( "StartMenu" ); 81 Config cfg ( "StartMenu" );
81 cfg. setGroup ( "Applets" ); 82 cfg. setGroup ( "Applets" );
82 QStringList exclude = cfg. readListEntry ( "ExcludeApplets", ',' ); 83 QStringList exclude = cfg. readListEntry ( "ExcludeApplets", ',' );
83 84
84 QString path = QPEApplication::qpeDir ( ) + "plugins/applets"; 85 QString path = QPEApplication::qpeDir ( ) + "plugins/applets";
85#ifdef Q_OS_MACX 86#ifdef Q_OS_MACX
86 QStringList list = QDir ( path, "lib*.dylib" ). entryList ( ); 87 QStringList list = QDir ( path, "lib*.dylib" ). entryList ( );
87#else 88#else
88 QStringList list = QDir ( path, "lib*.so" ). entryList ( ); 89 QStringList list = QDir ( path, "lib*.so" ). entryList ( );
89#endif /* Q_OS_MACX */ 90#endif /* Q_OS_MACX */
90 91
91 for ( QStringList::Iterator it = list. begin ( ); it != list. end ( ); ++it ) { 92 for ( QStringList::Iterator it = list. begin ( ); it != list. end ( ); ++it ) {
92 QString name; 93 QString name;
93 QPixmap icon; 94 QPixmap icon;
94 MenuAppletInterface *iface = 0; 95 MenuAppletInterface *iface = 0;
95 96
96 QLibrary *lib = new QLibrary ( path + "/" + *it ); 97 QLibrary *lib = new QLibrary ( path + "/" + *it );
97 lib-> queryInterface ( IID_MenuApplet, (QUnknownInterface**) &iface ); 98 QRESULT retVal = QS_OK;
99 if ((retVal = lib-> queryInterface ( IID_MenuApplet, (QUnknownInterface**)(&iface) )) != QS_OK )
100 owarn << "queryInterface failed with " << retVal << oendl;
98 if ( iface ) { 101 if ( iface ) {
99 QString lang = getenv( "LANG" ); 102 QString lang = getenv( "LANG" );
100 QTranslator *trans = new QTranslator ( qApp ); 103 QTranslator *trans = new QTranslator ( qApp );
101 QString type = (*it). left ((*it). find (".")); 104 QString type = (*it). left ((*it). find ("."));
102 QString tfn = QPEApplication::qpeDir ( ) + "i18n/" + lang + "/" + type + ".qm"; 105 QString tfn = QPEApplication::qpeDir ( ) + "i18n/" + lang + "/" + type + ".qm";
103 if ( trans-> load ( tfn )) 106 if ( trans-> load ( tfn ))
104 qApp-> installTranslator ( trans ); 107 qApp-> installTranslator ( trans );
105 else 108 else
106 delete trans; 109 delete trans;
107 name = iface-> name ( ); 110 name = iface-> name ( );
108 icon = iface-> icon ( ). pixmap (); 111 icon = iface-> icon ( ). pixmap ();
109 iface-> release ( ); 112 iface-> release ( );
110 lib-> unload ( ); 113 lib-> unload ( );
111 114
112 QCheckListItem *item; 115 QCheckListItem *item;
113 item = new QCheckListItem ( m_list, name, QCheckListItem::CheckBox ); 116 item = new QCheckListItem ( m_list, name, QCheckListItem::CheckBox );
114 if ( !icon. isNull ( )) 117 if ( !icon. isNull ( ))
115 item-> setPixmap ( 0, icon ); 118 item-> setPixmap ( 0, icon );
116 item-> setOn ( exclude. find ( *it ) == exclude. end ( )); 119 item-> setOn ( exclude. find ( *it ) == exclude. end ( ));
117 m_applets [*it] = item; 120 m_applets [*it] = item;
118 } else { 121 } else {
119 delete lib; 122 delete lib;
120 } 123 }
121 } 124 }
122 125
123 cfg. setGroup ( "Menu" ); 126 cfg. setGroup ( "Menu" );
124 m_menutabs->setChecked( cfg.readBoolEntry( "LauncherTabs", true ) ); 127 m_menutabs->setChecked( cfg.readBoolEntry( "LauncherTabs", true ) );
125 m_menusubpopup->setChecked( cfg.readBoolEntry( "LauncherSubPopup", true ) ); 128 m_menusubpopup->setChecked( cfg.readBoolEntry( "LauncherSubPopup", true ) );
126 m_menusubpopup->setEnabled( m_menutabs->isChecked() ); 129 m_menusubpopup->setEnabled( m_menutabs->isChecked() );
127 connect( m_menutabs, SIGNAL( stateChanged(int) ), m_menusubpopup, SLOT( setEnabled(bool) ) ); 130 connect( m_menutabs, SIGNAL( stateChanged(int) ), m_menusubpopup, SLOT( setEnabled(bool) ) );
128 131
129} 132}
diff --git a/core/settings/launcher/taskbarsettings.cpp b/core/settings/launcher/taskbarsettings.cpp
index 861ff3a..c2b82b9 100644
--- a/core/settings/launcher/taskbarsettings.cpp
+++ b/core/settings/launcher/taskbarsettings.cpp
@@ -62,107 +62,110 @@ TaskbarSettings::TaskbarSettings ( QWidget *parent, const char *name )
62 m_list-> addColumn ( "foobar" ); 62 m_list-> addColumn ( "foobar" );
63 m_list-> header ( )-> hide ( ); 63 m_list-> header ( )-> hide ( );
64 64
65 lay-> addWidget ( m_list ); 65 lay-> addWidget ( m_list );
66 66
67 QWhatsThis::add ( m_list, tr( "Check the applets that you want displayed in the Taskbar." )); 67 QWhatsThis::add ( m_list, tr( "Check the applets that you want displayed in the Taskbar." ));
68 68
69 connect ( m_list, SIGNAL( clicked(QListViewItem*)), this, SLOT( appletChanged())); 69 connect ( m_list, SIGNAL( clicked(QListViewItem*)), this, SLOT( appletChanged()));
70 70
71 init ( ); 71 init ( );
72} 72}
73 73
74void TaskbarSettings::init ( ) 74void TaskbarSettings::init ( )
75{ 75{
76 Config cfg ( "Taskbar" ); 76 Config cfg ( "Taskbar" );
77 cfg. setGroup ( "Applets" ); 77 cfg. setGroup ( "Applets" );
78 QStringList exclude = cfg. readListEntry ( "ExcludeApplets", ',' ); 78 QStringList exclude = cfg. readListEntry ( "ExcludeApplets", ',' );
79 79
80 QString path = QPEApplication::qpeDir ( ) + "plugins/applets"; 80 QString path = QPEApplication::qpeDir ( ) + "plugins/applets";
81#ifdef Q_OS_MACX 81#ifdef Q_OS_MACX
82 QStringList list = QDir ( path, "lib*.dylib" ). entryList ( ); 82 QStringList list = QDir ( path, "lib*.dylib" ). entryList ( );
83#else 83#else
84 QStringList list = QDir ( path, "lib*.so" ). entryList ( ); 84 QStringList list = QDir ( path, "lib*.so" ). entryList ( );
85#endif /* Q_OS_MACX */ 85#endif /* Q_OS_MACX */
86 86
87 for ( QStringList::Iterator it = list. begin ( ); it != list. end ( ); ++it ) { 87 for ( QStringList::Iterator it = list. begin ( ); it != list. end ( ); ++it ) {
88 QString name; 88 QString name;
89 QPixmap icon; 89 QPixmap icon;
90 TaskbarNamedAppletInterface *iface = 0; 90 TaskbarNamedAppletInterface *iface = 0;
91 91
92 owarn << "Load applet: " << (*it) << "" << oendl; 92 owarn << "Load applet: " << (*it) << "" << oendl;
93 QLibrary *lib = new QLibrary ( path + "/" + *it ); 93 QLibrary *lib = new QLibrary ( path + "/" + *it );
94 lib-> queryInterface ( IID_TaskbarNamedApplet, (QUnknownInterface**) &iface ); 94 QRESULT retVal = QS_OK;
95 if ((retVal = lib-> queryInterface ( IID_TaskbarNamedApplet, (QUnknownInterface**)(&iface) )) != QS_OK)
96 owarn << "<0>" << oendl;
95 owarn << "<1>" << oendl; 97 owarn << "<1>" << oendl;
96 if ( iface ) { 98 if ( iface ) {
97 owarn << "<2>" << oendl; 99 owarn << "<2>" << oendl;
98 QString lang = getenv( "LANG" ); 100 QString lang = getenv( "LANG" );
99 QTranslator *trans = new QTranslator ( qApp ); 101 QTranslator *trans = new QTranslator ( qApp );
100 QString type = (*it). left ((*it). find (".")); 102 QString type = (*it). left ((*it). find ("."));
101 QString tfn = QPEApplication::qpeDir ( ) + "i18n/" + lang + "/" + type + ".qm"; 103 QString tfn = QPEApplication::qpeDir ( ) + "i18n/" + lang + "/" + type + ".qm";
102 if ( trans-> load ( tfn )) 104 if ( trans-> load ( tfn ))
103 qApp-> installTranslator ( trans ); 105 qApp-> installTranslator ( trans );
104 else 106 else
105 delete trans; 107 delete trans;
106 name = iface-> name ( ); 108 name = iface-> name ( );
107 icon = iface-> icon ( ); 109 icon = iface-> icon ( );
108 iface-> release ( ); 110 iface-> release ( );
109 } 111 }
110 owarn << "<3>" << oendl; 112 owarn << "<3>" << oendl;
111 if ( !iface ) { 113 if ( !iface ) {
112 owarn << "<4>" << oendl; 114 owarn << "<4>" << oendl;
113 lib-> queryInterface ( IID_TaskbarApplet, (QUnknownInterface**) &iface ); 115 if ((retVal = lib-> queryInterface ( IID_TaskbarApplet, (QUnknownInterface**)(&iface))) != QS_OK)
116 owarn << "<5>" << oendl;
114 117
115 if ( iface ) { 118 if ( iface ) {
116 owarn << "<5>" << oendl; 119 owarn << "<6>" << oendl;
117 name = (*it). mid ( 3 ); 120 name = (*it). mid ( 3 );
118 owarn << "Found applet: " << name << "" << oendl; 121 owarn << "Found applet: " << name << "" << oendl;
119#ifdef Q_OS_MACX 122#ifdef Q_OS_MACX
120 int sep = name. find( ".dylib" ); 123 int sep = name. find( ".dylib" );
121#else 124#else
122 int sep = name. find( ".so" ); 125 int sep = name. find( ".so" );
123#endif /* Q_OS_MACX */ 126#endif /* Q_OS_MACX */
124 if ( sep > 0 ) 127 if ( sep > 0 )
125 name. truncate ( sep ); 128 name. truncate ( sep );
126 sep = name. find ( "applet" ); 129 sep = name. find ( "applet" );
127 if ( sep == (int) name.length ( ) - 6 ) 130 if ( sep == (int) name.length ( ) - 6 )
128 name. truncate ( sep ); 131 name. truncate ( sep );
129 name[0] = name[0]. upper ( ); 132 name[0] = name[0]. upper ( );
130 iface-> release ( ); 133 iface-> release ( );
131 } 134 }
132 } 135 }
133 owarn << "<6>" << oendl; 136 owarn << "<7>" << oendl;
134 137
135 if ( iface ) { 138 if ( iface ) {
136 owarn << "<7>" << oendl; 139 owarn << "<8>" << oendl;
137 QCheckListItem *item; 140 QCheckListItem *item;
138 item = new QCheckListItem ( m_list, name, QCheckListItem::CheckBox ); 141 item = new QCheckListItem ( m_list, name, QCheckListItem::CheckBox );
139 if ( !icon. isNull ( )) 142 if ( !icon. isNull ( ))
140 item-> setPixmap ( 0, icon ); 143 item-> setPixmap ( 0, icon );
141 item-> setOn ( exclude. find ( *it ) == exclude. end ( )); 144 item-> setOn ( exclude. find ( *it ) == exclude. end ( ));
142 m_applets [*it] = item; 145 m_applets [*it] = item;
143 } 146 }
144 lib-> unload ( ); 147 lib-> unload ( );
145 delete lib; 148 delete lib;
146 } 149 }
147} 150}
148 151
149void TaskbarSettings::appletChanged() 152void TaskbarSettings::appletChanged()
150{ 153{
151 m_applets_changed = true; 154 m_applets_changed = true;
152} 155}
153 156
154void TaskbarSettings::accept ( ) 157void TaskbarSettings::accept ( )
155{ 158{
156 Config cfg ( "Taskbar" ); 159 Config cfg ( "Taskbar" );
157 cfg. setGroup ( "Applets" ); 160 cfg. setGroup ( "Applets" );
158 161
159 if ( m_applets_changed ) { 162 if ( m_applets_changed ) {
160 QStringList exclude; 163 QStringList exclude;
161 QMap <QString, QCheckListItem *>::Iterator it; 164 QMap <QString, QCheckListItem *>::Iterator it;
162 for ( it = m_applets. begin ( ); it != m_applets. end ( ); ++it ) { 165 for ( it = m_applets. begin ( ); it != m_applets. end ( ); ++it ) {
163 if ( !(*it)-> isOn ( )) 166 if ( !(*it)-> isOn ( ))
164 exclude << it. key ( ); 167 exclude << it. key ( );
165 } 168 }
166 cfg. writeEntry ( "ExcludeApplets", exclude, ',' ); 169 cfg. writeEntry ( "ExcludeApplets", exclude, ',' );
167 } 170 }
168 cfg. writeEntry ( "SafeMode", false ); 171 cfg. writeEntry ( "SafeMode", false );
diff --git a/libopie2/opiecore/oglobal.cpp b/libopie2/opiecore/oglobal.cpp
index 706ac6c..b7d59fc 100644
--- a/libopie2/opiecore/oglobal.cpp
+++ b/libopie2/opiecore/oglobal.cpp
@@ -315,65 +315,65 @@ QByteArray OGlobal::decodeBase64( const QByteArray& in) {
315 if (++didx < len ) 315 if (++didx < len )
316 out[didx] = (((out[sidx+1] << 4) & 255) | ((out[sidx+2] >> 2) & 017)); 316 out[didx] = (((out[sidx+1] << 4) & 255) | ((out[sidx+2] >> 2) & 017));
317 317
318 // Resize the output buffer 318 // Resize the output buffer
319 if ( len == 0 || len < out.size() ) 319 if ( len == 0 || len < out.size() )
320 out.resize(len); 320 out.resize(len);
321 321
322 return out; 322 return out;
323} 323}
324 324
325bool OGlobal::isAppLnkFileName( const QString& str ) 325bool OGlobal::isAppLnkFileName( const QString& str )
326{ 326{
327 if (str.isEmpty()||str.at(str.length()-1)==QDir::separator()) return false; 327 if (str.isEmpty()||str.at(str.length()-1)==QDir::separator()) return false;
328 return str.startsWith(MimeType::appsFolderName()+QDir::separator()); 328 return str.startsWith(MimeType::appsFolderName()+QDir::separator());
329} 329}
330 330
331/* ToDo: 331/* ToDo:
332 * This fun should check the document-path value for the mounted media 332 * This fun should check the document-path value for the mounted media
333 * which has to be implemented later. this moment we just check for a 333 * which has to be implemented later. this moment we just check for a
334 * mounted media name. 334 * mounted media name.
335 */ 335 */
336bool OGlobal::isDocumentFileName( const QString& file ) 336bool OGlobal::isDocumentFileName( const QString& file )
337{ 337{
338 if (file.isEmpty()||file.at(file.length()-1)==QDir::separator()) return false; 338 if (file.isEmpty()||file.at(file.length()-1)==QDir::separator()) return false;
339 if (file.startsWith(QPEApplication::documentDir()+QDir::separator())) return true; 339 if (file.startsWith(QPEApplication::documentDir()+QDir::separator())) return true;
340 StorageInfo si; 340 StorageInfo si;
341 QList< FileSystem > fl = si.fileSystems(); 341 QList< FileSystem > fl = si.fileSystems();
342 FileSystem*fs; 342 FileSystem*fs;
343 for (fs = fl.first();fs!=0;fs=fl.next()) { 343 for (fs = fl.first();fs!=0;fs=fl.next()) {
344 if (fs->isRemovable()&&file.startsWith(fs->name()+QDir::separator())) 344 if (fs->isRemovable()&&file.startsWith(fs->name()+QDir::separator()))
345 return true; 345 return true;
346 } 346 }
347 if (file.startsWith(homeDirPath())+"/Documents/") return true; 347 if (file.startsWith(homeDirPath()+"/Documents/")) return true;
348 return false; 348 return false;
349} 349}
350 350
351QString OGlobal::tempDirPath() 351QString OGlobal::tempDirPath()
352{ 352{
353 static QString defstring="/tmp"; 353 static QString defstring="/tmp";
354 char * tmpp = 0; 354 char * tmpp = 0;
355 if ( (tmpp=getenv("TEMP"))) { 355 if ( (tmpp=getenv("TEMP"))) {
356 return tmpp; 356 return tmpp;
357 } 357 }
358 return defstring; 358 return defstring;
359} 359}
360 360
361QString OGlobal::homeDirPath() 361QString OGlobal::homeDirPath()
362{ 362{
363 char * tmpp = getenv("HOME"); 363 char * tmpp = getenv("HOME");
364 return (tmpp?tmpp:"/"); 364 return (tmpp?tmpp:"/");
365} 365}
366 366
367bool OGlobal::weekStartsOnMonday() 367bool OGlobal::weekStartsOnMonday()
368{ 368{
369 OConfig*conf=OGlobal::qpe_config(); 369 OConfig*conf=OGlobal::qpe_config();
370 if (!conf)return false; 370 if (!conf)return false;
371 conf->setGroup("Time"); 371 conf->setGroup("Time");
372 return conf->readBoolEntry("MONDAY",true); 372 return conf->readBoolEntry("MONDAY",true);
373} 373}
374 374
375void OGlobal::setWeekStartsOnMonday( bool what) 375void OGlobal::setWeekStartsOnMonday( bool what)
376{ 376{
377 OConfig*conf=OGlobal::qpe_config(); 377 OConfig*conf=OGlobal::qpe_config();
378 if (!conf)return; 378 if (!conf)return;
379 conf->setGroup("Time"); 379 conf->setGroup("Time");
diff --git a/libopie2/opiecore/oprocess.cpp b/libopie2/opiecore/oprocess.cpp
index b3f9724..56f9883 100644
--- a/libopie2/opiecore/oprocess.cpp
+++ b/libopie2/opiecore/oprocess.cpp
@@ -899,53 +899,53 @@ bool OProcess::isExecutable( const QCString &filename )
899 // CC: anyway, we cannot execute directories, block/character devices, fifos or sockets 899 // CC: anyway, we cannot execute directories, block/character devices, fifos or sockets
900 if ( ( S_ISDIR( fileinfo.st_mode ) ) || 900 if ( ( S_ISDIR( fileinfo.st_mode ) ) ||
901 ( S_ISCHR( fileinfo.st_mode ) ) || 901 ( S_ISCHR( fileinfo.st_mode ) ) ||
902 ( S_ISBLK( fileinfo.st_mode ) ) || 902 ( S_ISBLK( fileinfo.st_mode ) ) ||
903#ifdef S_ISSOCK 903#ifdef S_ISSOCK
904 // CC: SYSVR4 systems don't have that macro 904 // CC: SYSVR4 systems don't have that macro
905 ( S_ISSOCK( fileinfo.st_mode ) ) || 905 ( S_ISSOCK( fileinfo.st_mode ) ) ||
906#endif 906#endif
907 ( S_ISFIFO( fileinfo.st_mode ) ) || 907 ( S_ISFIFO( fileinfo.st_mode ) ) ||
908 ( S_ISDIR( fileinfo.st_mode ) ) ) 908 ( S_ISDIR( fileinfo.st_mode ) ) )
909 { 909 {
910 return false; 910 return false;
911 } 911 }
912 912
913 // CC: now check for permission to execute the file 913 // CC: now check for permission to execute the file
914 if ( access( filename.data(), X_OK ) != 0 ) 914 if ( access( filename.data(), X_OK ) != 0 )
915 return false; 915 return false;
916 916
917 // CC: we've passed all the tests... 917 // CC: we've passed all the tests...
918 return true; 918 return true;
919} 919}
920 920
921int OProcess::processPID( const QString& process ) 921int OProcess::processPID( const QString& process )
922{ 922{
923 QString line; 923 QString line;
924 QDir d = QDir( "/proc" ); 924 QDir d = QDir( "/proc" );
925 QStringList dirs = d.entryList( QDir::Dirs ); 925 QStringList dirs = d.entryList( QDir::Dirs );
926 QStringList::Iterator it; 926 QStringList::Iterator it;
927 for ( it = dirs.begin(); it != dirs.end(); ++it ) 927 for ( it = dirs.begin(); it != dirs.end(); ++it )
928 { 928 {
929 //qDebug( "next entry: %s", (const char*) *it ); 929 //qDebug( "next entry: %s", (const char*) *it );
930 QFile file( "/proc/"+*it+"/cmdline" ); 930 QFile file( "/proc/"+*it+"/cmdline" );
931 file.open( IO_ReadOnly ); 931 if ( !file.open( IO_ReadOnly ) ) continue;
932 if ( !file.isOpen() ) continue; 932 if ( !file.isOpen() ) continue;
933 QTextStream t( &file ); 933 QTextStream t( &file );
934 line = t.readLine(); 934 line = t.readLine();
935 //qDebug( "cmdline = %s", (const char*) line ); 935 //qDebug( "cmdline = %s", (const char*) line );
936 if ( line.contains( process ) ) break; //FIXME: That may find also other process, if the name is not long enough ;) 936 if ( line.contains( process ) ) break; //FIXME: That may find also other process, if the name is not long enough ;)
937 } 937 }
938 if ( line.contains( process ) ) 938 if ( line.contains( process ) )
939 { 939 {
940 //qDebug( "found process id #%d", (*it).toInt() ); 940 //qDebug( "found process id #%d", (*it).toInt() );
941 return (*it).toInt(); 941 return (*it).toInt();
942 } 942 }
943 else 943 else
944 { 944 {
945 //qDebug( "process '%s' not found", (const char*) process ); 945 //qDebug( "process '%s' not found", (const char*) process );
946 return 0; 946 return 0;
947 } 947 }
948} 948}
949 949
950} 950}
951} 951}
diff --git a/library/global.cpp b/library/global.cpp
index f7a0767..7bdd0b1 100644
--- a/library/global.cpp
+++ b/library/global.cpp
@@ -187,97 +187,96 @@ static QString dictDir()
187 \section1 Quoting 187 \section1 Quoting
188 188
189 The shellQuote() function quotes a string suitable for passing to a 189 The shellQuote() function quotes a string suitable for passing to a
190 shell. The stringQuote() function backslash escapes '\' and '"' 190 shell. The stringQuote() function backslash escapes '\' and '"'
191 characters. 191 characters.
192 192
193 \section1 Hardware 193 \section1 Hardware
194 194
195 The implementation of the writeHWClock() function depends on the AlarmServer 195 The implementation of the writeHWClock() function depends on the AlarmServer
196 implementation. If the AlarmServer is using atd the clock will be synced to 196 implementation. If the AlarmServer is using atd the clock will be synced to
197 hardware. If opie-alarm is used the hardware clock will be synced before 197 hardware. If opie-alarm is used the hardware clock will be synced before
198 suspending the device. opie-alarm is used by iPAQ and Zaurii implementation 198 suspending the device. opie-alarm is used by iPAQ and Zaurii implementation
199 199
200 \ingroup qtopiaemb 200 \ingroup qtopiaemb
201*/ 201*/
202 202
203/*! 203/*!
204 \internal 204 \internal
205*/ 205*/
206Global::Global() 206Global::Global()
207{ 207{
208} 208}
209 209
210/*! 210/*!
211 Returns the unchangeable QDawg that contains general 211 Returns the unchangeable QDawg that contains general
212 words for the current locale. 212 words for the current locale.
213 213
214 \sa addedDawg() 214 \sa addedDawg()
215*/ 215*/
216const QDawg& Global::fixedDawg() 216const QDawg& Global::fixedDawg()
217{ 217{
218 if ( !fixed_dawg ) { 218 if ( !fixed_dawg ) {
219 if ( !docDirCreated ) 219 if ( !docDirCreated )
220 createDocDir(); 220 createDocDir();
221 221
222 fixed_dawg = new QDawg; 222 fixed_dawg = new QDawg;
223 QString dawgfilename = dictDir() + "/dawg"; 223 QString dawgfilename = dictDir() + "/dawg";
224 QString words_lang; 224 QString words_lang;
225 QStringList langs = Global::languageList(); 225 QStringList langs = Global::languageList();
226 for (QStringList::ConstIterator it = langs.begin(); it!=langs.end(); ++it) { 226 for (QStringList::ConstIterator it = langs.begin(); it!=langs.end(); ++it) {
227 QString lang = *it; 227 QString lang = *it;
228 words_lang = dictDir() + "/words." + lang; 228 words_lang = dictDir() + "/words." + lang;
229 QString dawgfilename_lang = dawgfilename + "." + lang; 229 QString dawgfilename_lang = dawgfilename + "." + lang;
230 if ( QFile::exists(dawgfilename_lang) || 230 if ( QFile::exists(dawgfilename_lang) ||
231 QFile::exists(words_lang) ) { 231 QFile::exists(words_lang) ) {
232 dawgfilename = dawgfilename_lang; 232 dawgfilename = dawgfilename_lang;
233 break; 233 break;
234 } 234 }
235 }
236 QFile dawgfile(dawgfilename);
237
238 if ( !dawgfile.exists() ) {
239 QString fn = dictDir() + "/words";
240 if ( QFile::exists(words_lang) )
241 fn = words_lang;
242 QFile in(fn);
243 if ( in.open(IO_ReadOnly) ) {
244 fixed_dawg->createFromWords(&in);
245 dawgfile.open(IO_WriteOnly);
246 fixed_dawg->write(&dawgfile);
247 dawgfile.close();
248 } 235 }
249 } else { 236 QFile dawgfile(dawgfilename);
250 fixed_dawg->readFile(dawgfilename); 237
251 } 238 if ( !dawgfile.exists() ) {
239 QString fn = dictDir() + "/words";
240 if ( QFile::exists(words_lang) )
241 fn = words_lang;
242 QFile in(fn);
243 if ( in.open(IO_ReadOnly) ) {
244 fixed_dawg->createFromWords(&in);
245 if (dawgfile.open(IO_WriteOnly))
246 fixed_dawg->write(&dawgfile);
247 dawgfile.close();
248 }
249 } else
250 fixed_dawg->readFile(dawgfilename);
252 } 251 }
253 252
254 return *fixed_dawg; 253 return *fixed_dawg;
255} 254}
256 255
257/*! 256/*!
258 Returns the changeable QDawg that contains general 257 Returns the changeable QDawg that contains general
259 words for the current locale. 258 words for the current locale.
260 259
261 \sa fixedDawg() 260 \sa fixedDawg()
262*/ 261*/
263const QDawg& Global::addedDawg() 262const QDawg& Global::addedDawg()
264{ 263{
265 return dawg("local"); 264 return dawg("local");
266} 265}
267 266
268/*! 267/*!
269 Returns the QDawg with the given \a name. 268 Returns the QDawg with the given \a name.
270 This is an application-specific word list. 269 This is an application-specific word list.
271 270
272 \a name should not contain "/". 271 \a name should not contain "/".
273*/ 272*/
274const QDawg& Global::dawg(const QString& name) 273const QDawg& Global::dawg(const QString& name)
275{ 274{
276 createDocDir(); 275 createDocDir();
277 if ( !named_dawg ) 276 if ( !named_dawg )
278 named_dawg = new QDict<QDawg>; 277 named_dawg = new QDict<QDawg>;
279 QDawg* r = named_dawg->find(name); 278 QDawg* r = named_dawg->find(name);
280 if ( !r ) { 279 if ( !r ) {
281 r = new QDawg; 280 r = new QDawg;
282 named_dawg->insert(name,r); 281 named_dawg->insert(name,r);
283 QString dawgfilename = applicationFileName("Dictionary", name ) + ".dawg"; 282 QString dawgfilename = applicationFileName("Dictionary", name ) + ".dawg";
diff --git a/noncore/apps/advancedfm/output.cpp b/noncore/apps/advancedfm/output.cpp
index 8c585f4..8f654d5 100644
--- a/noncore/apps/advancedfm/output.cpp
+++ b/noncore/apps/advancedfm/output.cpp
@@ -163,66 +163,67 @@ Output::Output( const QStringList commands, QWidget* parent, const char* name,
163 odebug << "" << (*it).latin1() << "" << oendl; 163 odebug << "" << (*it).latin1() << "" << oendl;
164 * proc << (*it).latin1(); 164 * proc << (*it).latin1();
165 } 165 }
166 166
167 if(!proc->start(OProcess::NotifyOnExit, OProcess::All)) { 167 if(!proc->start(OProcess::NotifyOnExit, OProcess::All)) {
168 168
169 OutputEdit->append(tr("Process could not start") ); 169 OutputEdit->append(tr("Process could not start") );
170 OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE); 170 OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE);
171 perror("Error: "); 171 perror("Error: ");
172 QString errorMsg=tr("Error\n")+(QString)strerror(errno); 172 QString errorMsg=tr("Error\n")+(QString)strerror(errno);
173 OutputEdit->append( errorMsg); 173 OutputEdit->append( errorMsg);
174 OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE); 174 OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE);
175 } 175 }
176} 176}
177 177
178Output::~Output() { 178Output::~Output() {
179} 179}
180 180
181void Output::saveOutput() { 181void Output::saveOutput() {
182 182
183 InputDialog *fileDlg; 183 InputDialog *fileDlg;
184 fileDlg = new InputDialog(this,tr("Save output to file (name only)"),TRUE, 0); 184 fileDlg = new InputDialog(this,tr("Save output to file (name only)"),TRUE, 0);
185 fileDlg->exec(); 185 fileDlg->exec();
186 if( fileDlg->result() == 1 ) { 186 if( fileDlg->result() == 1 ) {
187 QString filename = QPEApplication::documentDir(); 187 QString filename = QPEApplication::documentDir();
188 if(filename.right(1).find('/') == -1) 188 if(filename.right(1).find('/') == -1)
189 filename+="/"; 189 filename+="/";
190 QString name = fileDlg->LineEdit1->text(); 190 QString name = fileDlg->LineEdit1->text();
191 filename+="text/plain/"+name; 191 filename+="text/plain/"+name;
192 odebug << filename << oendl; 192 odebug << filename << oendl;
193 193
194 QFile f(filename); 194 QFile f(filename);
195 f.open( IO_WriteOnly); 195 if ( !f.open( IO_WriteOnly ) )
196 if( f.writeBlock( OutputEdit->text(), qstrlen( OutputEdit->text()) ) != -1) { 196 owarn << "Could no open file" << oendl;
197 else if( f.writeBlock( OutputEdit->text(), qstrlen( OutputEdit->text()) ) != -1) {
197 DocLnk lnk; 198 DocLnk lnk;
198 lnk.setName(name); //sets file name 199 lnk.setName(name); //sets file name
199 lnk.setFile(filename); //sets File property 200 lnk.setFile(filename); //sets File property
200 lnk.setType("text/plain"); 201 lnk.setType("text/plain");
201 if(!lnk.writeLink()) { 202 if(!lnk.writeLink()) {
202 odebug << "Writing doclink did not work" << oendl; 203 odebug << "Writing doclink did not work" << oendl;
203 } 204 }
204 } else 205 } else
205 owarn << "Could not write file" << oendl; 206 owarn << "Could not write file" << oendl;
206 f.close(); 207 f.close();
207 } 208 }
208} 209}
209 210
210void Output::commandStdout(OProcess*, char *buffer, int buflen) { 211void Output::commandStdout(OProcess*, char *buffer, int buflen) {
211 owarn << "received stdout " << buflen << " bytes" << oendl; 212 owarn << "received stdout " << buflen << " bytes" << oendl;
212 213
213// QByteArray data(buflen); 214// QByteArray data(buflen);
214// data.fill(*buffer, buflen); 215// data.fill(*buffer, buflen);
215// for (uint i = 0; i < data.count(); i++ ) { 216// for (uint i = 0; i < data.count(); i++ ) {
216// printf("%c", buffer[i] ); 217// printf("%c", buffer[i] );
217// } 218// }
218// printf("\n"); 219// printf("\n");
219 220
220 QString lineStr = buffer; 221 QString lineStr = buffer;
221 lineStr=lineStr.left(lineStr.length()-1); 222 lineStr=lineStr.left(lineStr.length()-1);
222 OutputEdit->append(lineStr); 223 OutputEdit->append(lineStr);
223 OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE); 224 OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE);
224} 225}
225 226
226 227
227void Output::commandStdin( const QByteArray &data) { 228void Output::commandStdin( const QByteArray &data) {
228 owarn << "received stdin " << data.size() << " bytes" << oendl; 229 owarn << "received stdin " << data.size() << " bytes" << oendl;
diff --git a/noncore/apps/tinykate/libkate/document/katebuffer.cpp b/noncore/apps/tinykate/libkate/document/katebuffer.cpp
index 4c15fd0..d89edbd 100644
--- a/noncore/apps/tinykate/libkate/document/katebuffer.cpp
+++ b/noncore/apps/tinykate/libkate/document/katebuffer.cpp
@@ -43,65 +43,68 @@
43#include <assert.h> 43#include <assert.h>
44 44
45/** 45/**
46 * Create an empty buffer. 46 * Create an empty buffer.
47 */ 47 */
48KWBuffer::KWBuffer() 48KWBuffer::KWBuffer()
49{ 49{
50 clear(); 50 clear();
51} 51}
52 52
53void 53void
54KWBuffer::clear() 54KWBuffer::clear()
55{ 55{
56 m_stringListIt=0; 56 m_stringListIt=0;
57 m_stringListCurrent=0; 57 m_stringListCurrent=0;
58 m_stringList.clear(); 58 m_stringList.clear();
59 m_lineCount=1; 59 m_lineCount=1;
60 m_stringListIt = m_stringList.append(new TextLine()); 60 m_stringListIt = m_stringList.append(new TextLine());
61} 61}
62 62
63/** 63/**
64 * Insert a file at line @p line in the buffer. 64 * Insert a file at line @p line in the buffer.
65 */ 65 */
66void 66void
67KWBuffer::insertFile(int line, const QString &file, QTextCodec *codec) 67KWBuffer::insertFile(int line, const QString &file, QTextCodec *codec)
68{ 68{
69 if (line) { 69 if (line) {
70 odebug << "insert File only supports insertion at line 0 == file opening" << oendl; 70 odebug << "insert File only supports insertion at line 0 == file opening" << oendl;
71 return; 71 return;
72 } 72 }
73 clear(); 73 clear();
74 QFile iofile(file); 74 QFile iofile(file);
75 iofile.open(IO_ReadOnly); 75 if (!iofile.open(IO_ReadOnly)) {
76 owarn << "failed to open file " << iofile.name() << oendl;
77 return;
78 }
76 QTextStream stream(&iofile); 79 QTextStream stream(&iofile);
77 stream.setCodec(codec); 80 stream.setCodec(codec);
78 QString qsl; 81 QString qsl;
79 int count=0; 82 int count=0;
80 for (count=0;((qsl=stream.readLine())!=QString::null); count++) 83 for (count=0;((qsl=stream.readLine())!=QString::null); count++)
81 { 84 {
82 if (count==0) 85 if (count==0)
83 { 86 {
84 (*m_stringListIt)->append(qsl.unicode(),qsl.length()); 87 (*m_stringListIt)->append(qsl.unicode(),qsl.length());
85 } 88 }
86 else 89 else
87 { 90 {
88 TextLine::Ptr tl=new TextLine(); 91 TextLine::Ptr tl=new TextLine();
89 tl ->append(qsl.unicode(),qsl.length()); 92 tl ->append(qsl.unicode(),qsl.length());
90 m_stringListIt=m_stringList.append(tl); 93 m_stringListIt=m_stringList.append(tl);
91 } 94 }
92 } 95 }
93 if (count!=0) 96 if (count!=0)
94 { 97 {
95 m_stringListCurrent=count-1; 98 m_stringListCurrent=count-1;
96 m_lineCount=count; 99 m_lineCount=count;
97 } 100 }
98} 101}
99 102
100void 103void
101KWBuffer::loadFilePart() 104KWBuffer::loadFilePart()
102{ 105{
103} 106}
104 107
105 108
106void 109void
107KWBuffer::insertData(int line, const QByteArray &data, QTextCodec *codec) 110KWBuffer::insertData(int line, const QByteArray &data, QTextCodec *codec)
diff --git a/noncore/settings/usermanager/userdialog.cpp b/noncore/settings/usermanager/userdialog.cpp
index 3654639..75a96a6 100644
--- a/noncore/settings/usermanager/userdialog.cpp
+++ b/noncore/settings/usermanager/userdialog.cpp
@@ -213,67 +213,70 @@ bool UserDialog::addUser(int uid, int gid)
213 QCheckListItem *temp; 213 QCheckListItem *temp;
214 QFile ozTest; 214 QFile ozTest;
215 int oz=false; 215 int oz=false;
216 if(ODevice::inst()->system()==System_OpenZaurus) oz=true; 216 if(ODevice::inst()->system()==System_OpenZaurus) oz=true;
217 // viewmode is a workaround for a bug in qte-2.3.4 that gives bus error on manipulating adduserDialog's widgets here. 217 // viewmode is a workaround for a bug in qte-2.3.4 that gives bus error on manipulating adduserDialog's widgets here.
218 UserDialog *adduserDialog=new UserDialog(VIEWMODE_NEW); 218 UserDialog *adduserDialog=new UserDialog(VIEWMODE_NEW);
219 adduserDialog->setCaption(tr("Add User")); 219 adduserDialog->setCaption(tr("Add User"));
220 adduserDialog->userID=uid; // Set next available UID as default uid. 220 adduserDialog->userID=uid; // Set next available UID as default uid.
221 adduserDialog->groupID=gid; // Set next available GID as default gid. 221 adduserDialog->groupID=gid; // Set next available GID as default gid.
222 // Insert default group into groupComboBox 222 // Insert default group into groupComboBox
223 adduserDialog->groupComboBox->insertItem("<create new group>",0); 223 adduserDialog->groupComboBox->insertItem("<create new group>",0);
224 adduserDialog->uidLineEdit->setText(QString::number(uid)); 224 adduserDialog->uidLineEdit->setText(QString::number(uid));
225 // If we're running on OZ, add new users to some default groups. 225 // If we're running on OZ, add new users to some default groups.
226 if(oz) 226 if(oz)
227 { 227 {
228 QListViewItemIterator iter( adduserDialog->groupsListView ); 228 QListViewItemIterator iter( adduserDialog->groupsListView );
229 for ( ; iter.current(); ++iter ) 229 for ( ; iter.current(); ++iter )
230 { 230 {
231 temp=(QCheckListItem*)iter.current(); 231 temp=(QCheckListItem*)iter.current();
232 if (temp->text()=="video") temp->setOn(true); 232 if (temp->text()=="video") temp->setOn(true);
233 if (temp->text()=="audio") temp->setOn(true); 233 if (temp->text()=="audio") temp->setOn(true);
234 if (temp->text()=="time") temp->setOn(true); 234 if (temp->text()=="time") temp->setOn(true);
235 if (temp->text()=="power") temp->setOn(true); 235 if (temp->text()=="power") temp->setOn(true);
236 if (temp->text()=="input") temp->setOn(true); 236 if (temp->text()=="input") temp->setOn(true);
237 if (temp->text()=="sharp") temp->setOn(true); 237 if (temp->text()=="sharp") temp->setOn(true);
238 if (temp->text()=="tty") temp->setOn(true); 238 if (temp->text()=="tty") temp->setOn(true);
239 } 239 }
240 } 240 }
241 // Show the dialog! 241 // Show the dialog!
242 if(!(adduserDialog->exec())) return false; 242 if(!(adduserDialog->exec())) return false;
243 if((adduserDialog->groupComboBox->currentItem()!=0)) 243 if((adduserDialog->groupComboBox->currentItem()!=0))
244 { 244 {
245 accounts->findGroup(adduserDialog->groupComboBox->currentText()); 245 // making the call findGroup() puts the group info in the accounts gr_gid
246 adduserDialog->groupID=accounts->gr_gid; 246 if (accounts->findGroup(adduserDialog->groupComboBox->currentText()))
247 owarn << QString::number(accounts->gr_gid) << oendl; 247 {
248 adduserDialog->groupID=accounts->gr_gid;
249 owarn << QString::number(accounts->gr_gid) << oendl;
250 }
248 } 251 }
249 if(!(accounts->addUser(adduserDialog->loginLineEdit->text(), adduserDialog->passwordLineEdit->text(), 252 if(!(accounts->addUser(adduserDialog->loginLineEdit->text(), adduserDialog->passwordLineEdit->text(),
250 adduserDialog->uidLineEdit->text().toInt(), adduserDialog->groupID, adduserDialog->gecosLineEdit->text(), 253 adduserDialog->uidLineEdit->text().toInt(), adduserDialog->groupID, adduserDialog->gecosLineEdit->text(),
251 QString("/home/")+adduserDialog->loginLineEdit->text() , adduserDialog->shellComboBox->currentText()))) 254 QString("/home/")+adduserDialog->loginLineEdit->text() , adduserDialog->shellComboBox->currentText())))
252 { 255 {
253 QMessageBox::information(0,"Ooops!","Something went wrong!\nUnable to add user."); 256 QMessageBox::information(0,"Ooops!","Something went wrong!\nUnable to add user.");
254 return false; 257 return false;
255 } 258 }
256 259
257 // Add User to additional groups. 260 // Add User to additional groups.
258 QListViewItemIterator it( adduserDialog->groupsListView ); 261 QListViewItemIterator it( adduserDialog->groupsListView );
259 for ( ; it.current(); ++it ) 262 for ( ; it.current(); ++it )
260 { 263 {
261 temp=(QCheckListItem*)it.current(); 264 temp=(QCheckListItem*)it.current();
262 if (temp->isOn() ) 265 if (temp->isOn() )
263 accounts->addGroupMember(it.current()->text(0),adduserDialog->loginLineEdit->text()); 266 accounts->addGroupMember(it.current()->text(0),adduserDialog->loginLineEdit->text());
264 } 267 }
265 // Copy image to pics/users/ 268 // Copy image to pics/users/
266 if(!(adduserDialog->userImage.isNull())) 269 if(!(adduserDialog->userImage.isNull()))
267 { 270 {
268 QDir d; 271 QDir d;
269 if(!(d.exists(QPEApplication::qpeDir() + "pics/users"))) 272 if(!(d.exists(QPEApplication::qpeDir() + "pics/users")))
270 { 273 {
271 d.mkdir(QPEApplication::qpeDir() + "pics/users"); 274 d.mkdir(QPEApplication::qpeDir() + "pics/users");
272 } 275 }
273 QString filename= QPEApplication::qpeDir()+"pics/users/"+accounts->pw_name+".png"; 276 QString filename= QPEApplication::qpeDir()+"pics/users/"+accounts->pw_name+".png";
274 // adduserDialog->userImage=adduserDialog->userImage.smoothScale(48,48); 277 // adduserDialog->userImage=adduserDialog->userImage.smoothScale(48,48);
275 adduserDialog->userImage.save(filename,"PNG"); 278 adduserDialog->userImage.save(filename,"PNG");
276 } 279 }
277 280
278 // Should we copy the skeleton homedirectory /etc/skel to the user's homedirectory? 281 // Should we copy the skeleton homedirectory /etc/skel to the user's homedirectory?
279 accounts->findUser(adduserDialog->loginLineEdit->text()); 282 accounts->findUser(adduserDialog->loginLineEdit->text());