summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/opie-gutenbrowser/LibraryDialog.cpp12
-rw-r--r--noncore/apps/opie-gutenbrowser/openetext.cpp124
-rw-r--r--noncore/multimedia/opieplayer2/lib.cpp4
-rw-r--r--noncore/multimedia/opieplayer2/om3u.cpp17
-rw-r--r--noncore/multimedia/opieplayer2/threadutil.cpp11
-rw-r--r--noncore/net/opiestumbler/opiestumbler.cpp3
-rw-r--r--noncore/settings/networksettings/mainwindow/mainwindowimp.cpp9
-rw-r--r--noncore/settings/networksettings/ppp/modem.cpp6
8 files changed, 93 insertions, 93 deletions
diff --git a/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp b/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp
index 6c246e97..7f21ab3 100644
--- a/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp
+++ b/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp
@@ -20,7 +20,7 @@
#include <qpe/applnk.h>
#include <qpe/qpeapplication.h>
#include <qpe/qpedialog.h>
-//#include <opie2///odebug.h>
+#include <opie2/odebug.h>
/* QT */
#include <qpushbutton.h>
@@ -472,8 +472,12 @@ bool LibraryDialog::getEtext(const QStringList &networkList)
if(File_Name.right(4) == ".txt") {
QString s_fileName = File_Name;
s_fileName.replace( s_fileName.length() - 3, 3, "gtn");
- // s_fileName.replace( s_fileName.length()-3,3,"etx");
- rename( File_Name.latin1(), s_fileName.latin1());
+ if (rename( File_Name.latin1(), s_fileName.latin1()) == 1) {
+ owarn << "Failed to rename " << File_Name.latin1() << " to "
+ << s_fileName.latin1() << oendl;
+ return false;
+ }
+
File_Name = s_fileName;
//odebug << "Filename is now "+File_Name << oendl;
@@ -499,7 +503,6 @@ bool LibraryDialog::getEtext(const QStringList &networkList)
lnk.setIcon("gutenbrowser/Gutenbrowser");
if(!lnk.writeLink()) {
//odebug << "Writing doclink did not work" << oendl;
- } else {
}
} else
QMessageBox::message("Note","<p>There was an error with the file</p>");
@@ -701,7 +704,6 @@ void LibraryDialog::onButtonSearch()
int i_berger = 0;
if( searchDlg->exec() != 0 ) {
QString searcherStr = searchDlg->get_text();
- int fluff = 0;
bool cS;
if( searchDlg->caseSensitiveCheckBox->isChecked())
diff --git a/noncore/apps/opie-gutenbrowser/openetext.cpp b/noncore/apps/opie-gutenbrowser/openetext.cpp
index 0267416..a5d855d 100644
--- a/noncore/apps/opie-gutenbrowser/openetext.cpp
+++ b/noncore/apps/opie-gutenbrowser/openetext.cpp
@@ -57,8 +57,7 @@ void OpenEtext::getTitles()
Config config("Gutenbrowser");
config.setGroup( "Files" );
s_numofFiles = config.readEntry("NumberOfFiles", "0");
- QLabel_1->setText( tr(
- s_numofFiles+" etexts in your library."));
+ QLabel_1->setText( tr( s_numofFiles+" etexts in your library." ) );
int i_numofFiles = s_numofFiles.toInt();
for (int i = 1; i <= i_numofFiles+1; i++) {
QString temp;
@@ -68,7 +67,12 @@ void OpenEtext::getTitles()
config.setGroup( "Titles" );
title = config.readEntry(ramble, "");
if( !title.isEmpty()) {
- QListBox_1->insertItem ( QPixmap( QPEApplication::qpeDir()+"pics/gutenbrowser/gutenbrowser_sm.png"), title, -1);
+ QListBox_1->insertItem ( QPixmap(
+ QPEApplication::qpeDir() +
+ "pics/gutenbrowser/gutenbrowser_sm.png"
+ ),
+ title,
+ -1);
}
}
}
@@ -100,8 +104,9 @@ void OpenEtext::select_title(int index )
OpenEtext::accept();
}
-/*
- This function imports already existing etexts into the local library list*/
+/*!
+ * This function imports already existing etexts into the local library list
+ */
void OpenEtext::open()
{
OpenFileButton->setDown(TRUE);
@@ -113,14 +118,6 @@ OpenFileButton->setDown(TRUE);
local = (QDir::homeDirPath () +"Applications/gutenbrowser");
QDir library( local);
-// fileBrowser *browseForFiles;
-// browseForFiles=new fileBrowser(this,"Browse for File", TRUE, 0, "guten/plain;text/plain");
-// // browseForFiles=new fileBrowser(this,"fileBrowser",TRUE,0, "*");
-// browseForFiles->setFileView( 0);
-// browseForFiles->showMaximized();
-// browseForFiles->exec();
-// QString selFile= browseForFiles->selectedFileName;
-// fileList=browseForFiles->fileList;
Config cfg("Gutenbrowser");
cfg. setGroup ( "View" );
QString dir = cfg.readEntry("LastOpenDirectory", QPEApplication::documentDir());
@@ -139,45 +136,33 @@ OpenFileButton->setDown(TRUE);
odebug << "Open file: "+str << oendl;
- // QStringList::ConstIterator f;
-// QString fileTemp;
-// for ( f = fileList.begin(); f != fileList.end(); f++ ) {
-// fileTemp = *f;
-// fileTemp.right( fileTemp.length()-5);
-// fileName = fileTemp;
-// if( !fileName.isEmpty() ){
-// filer = fileName;
-// } else { //filename is empty
-// // QString sMsg;
-// // sMsg = "Error opening library filelist "+fileName;
-// }
-
- if( filer.right(4) == ".txt"
- || filer.right(4) == ".TXT"
- || filer.right(4) == ".etx"
- || filer.right(4) == ".ETX"
- || filer.right(4) == ".etx"
- || filer.right(4) == ".ETX"
- || filer.right(4) == ".zip"
- || filer.right(4) == ".ZIP" ) {
+ if( filer.right(4) == ".txt" ||
+ filer.right(4) == ".TXT" ||
+ filer.right(4) == ".etx" ||
+ filer.right(4) == ".ETX" ||
+ filer.right(4) == ".etx" ||
+ filer.right(4) == ".ETX" ||
+ filer.right(4) == ".zip" ||
+ filer.right(4) == ".ZIP" )
+ {
QFileInfo zipFile( filer);
QString s_fileName = zipFile.fileName();
QString cmd;
- if( s_fileName.right(4) == ".zip") { // unzip that sucker....
+ if( s_fileName.right(4) == ".zip") { // unzip the file
s_fileName = s_fileName.left( s_fileName.length() - 4);
if( chdir((const char*)local_library.latin1())!=0)
- odebug << "chdir failed." << oendl; // QString cmd = "gunzip -d " + filer + " -d " + local_library;
+ odebug << "chdir failed." << oendl;
cmd = "gunzip -S .zip " + filer;
fileName = local_library + s_fileName + ".txt";
system( cmd);
- }
-// this renames the .txt to .etx!!
- else /*if( s_fileName.right(4) == ".txt" || if( s_fileName.right(4) == ".TXT"))*/ {
+ } else { // else rename .txt to .etx
// odebug << "Filename is "+fileName << oendl;
s_fileName = fileName;
- s_fileName.replace( s_fileName.length()-3,3,"gtn");// s_fileName.replace( s_fileName.length()-3,3,"etx");
- rename(fileName.latin1(),s_fileName.latin1());
+ s_fileName.replace( s_fileName.length()-3,3,"gtn");
+ if (rename(fileName.latin1(),s_fileName.latin1()) == -1)
+ owarn << "Rename of " << fileName.latin1() << " to "
+ << s_fileName.latin1() << " failed" << oendl;
fileName = s_fileName;
// odebug << "Filename is now "+fileName << oendl;
}
@@ -201,7 +186,10 @@ OpenFileButton->setDown(TRUE);
getTitles();
odebug << "Filename is "+fileName << oendl;
lnk.setFile(fileName); //sets File property
- lnk.setType("guten/plain");// hey is this a REGISTERED mime type?!?!? ;D
+ // @bug This is probably not a registered MIME type. Perhaps we should
+ // set a valid MIME type here instead. Or maybe register .etx as a
+ // Gutenberge etext?
+ lnk.setType("guten/plain");
lnk.setExec(fileName);
lnk.setIcon("gutenbrowser/Gutenbrowser");
if(!lnk.writeLink())
@@ -225,7 +213,6 @@ bool OpenEtext::FindTitle( QString filename)
odebug << "filename to open is " + name << oendl;
QFile indexLib( filename);
bool findCheck = FALSE;
- // int Titlenumber=0;
if ( indexLib.open( IO_ReadOnly) ) {
odebug << "file opened successfully" << oendl;
@@ -277,7 +264,6 @@ bool OpenEtext::FindTitle( QString filename)
}
if ( checkConf() == false && findCheck == TRUE) {
-
config.setGroup( "Files");
config.writeEntry("NumberOfFiles",i_numofFiles + 1 );
QString interger;
@@ -315,10 +301,10 @@ QString OpenEtext::titleFromLibrary( QString fileName)
QString target;
int find1 = fileName.findRev("/",-1,TRUE) + 1;
int find2 = fileName.findRev(".gtn",-1,TRUE) - find1;
- if(find2==-1-find1)
- int find2 = fileName.findRev(".etx",-1,TRUE) - find1;
- else if(find2==-1-find1)
- int find2 = fileName.findRev(".txt",-1,TRUE) - find1;
+ if(find2== (-1-find1))
+ find2 = fileName.findRev(".etx",-1,TRUE) - find1;
+ else if(find2==(-1-find1))
+ find2 = fileName.findRev(".txt",-1,TRUE) - find1;
target = fileName.mid( find1, find2 );
QString checker = target.right(1);
@@ -344,7 +330,6 @@ QString OpenEtext::titleFromLibrary( QString fileName)
if( indexLine.find( target,0,FALSE) > 0 ) {
findCheck = TRUE;
title = indexLine.mid( 9, 50);
-// title = indexLine.mid( 26, indexLine.length() );
title = title.stripWhiteSpace ();
// odebug << "Finally Found the title and it is\n " << title << "" << oendl;
// QListBox_1->insertItem ( title);
@@ -381,22 +366,25 @@ void OpenEtext::remove()
{
title_text = QListBox_1->text( QListBox_1->currentItem() );
title_text=title_text.stripWhiteSpace();
- QString msg ="<p>Do you really want to REMOVE\n" +title_text +"?\nThis will not delete the file.</P>";
- switch( QMessageBox::information( this, (tr("Remove Etext")),
- (tr(msg)),
- (tr("&Yes")), (tr("&Cancel")), 0 )){
+ QString msg ="<p>Do you really want to REMOVE\n" + title_text +
+ "?\nThis will not delete the file.</P>";
+ switch( QMessageBox::information( this, tr("Remove Etext"),
+ tr(msg),
+ tr("&Yes"), tr("&Cancel"), 0 ) )
+ {
case 0: // Yes clicked,
removeSelection();
QListBox_1->clear();
getTitles();
break;
- case 1: // Cancel
- break;
- };
+ case 1:
+ default:
+ }
}
-/*
- this removes selected title entry*/
+/*!
+ * This removes selected title entry
+ */
void OpenEtext::removeSelection()
{
Config config("Gutenbrowser");
@@ -436,11 +424,11 @@ void OpenEtext::removeSelection()
}
config.writeEntry("NumberOfFiles", i_numofFiles - 1 );
config.removeEntry(fileNum2);
-// remFile();
}
-/*
- removes file title name from list and config file*/
+/*!
+ * Removes file title name from list and config file
+ */
void OpenEtext::remFile()
{
Config config("Gutenbrowser");
@@ -461,20 +449,20 @@ void OpenEtext::remFile()
fileNum2.setNum( fg + 1);
QString s_filename2 = config.readEntry(fileNum2, "" );
- if (!s_filename2.isEmpty()) {
+ if (!s_filename2.isEmpty())
config.writeEntry(fileNum, s_filename2 );
}
}
}
- }
config.writeEntry("NumberOfFiles", i_numofFiles - 1 );
config.removeEntry(s_numofFiles);
QListBox_1->triggerUpdate(true);
}
-/*
-sorts the list*/
+/*!
+ * Sorts the list
+ */
void OpenEtext::scan() {
QListBox_1->sort(TRUE);
@@ -510,7 +498,11 @@ void OpenEtext::editTitle() {
//odebug << titleEdit->newTitle << oendl;
config.writeEntry( s_filename, titleEdit->newTitle);
QListBox_1->removeItem(currentItem);
- QListBox_1->insertItem ( QPixmap( QPEApplication::qpeDir()+"pics/gutenbrowser/gutenbrowser_sm.png"), titleEdit->newTitle, currentItem);
+ QListBox_1->insertItem (
+ QPixmap( QPEApplication::qpeDir()+
+ "pics/gutenbrowser/gutenbrowser_sm.png"),
+ titleEdit->newTitle, currentItem
+ );
}
}
}
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp
index 84d28ce..5f281b7 100644
--- a/noncore/multimedia/opieplayer2/lib.cpp
+++ b/noncore/multimedia/opieplayer2/lib.cpp
@@ -77,7 +77,7 @@ Lib::Lib( InitializationMode initMode, XineVideoWidget* widget )
// not really OO, should be an extra class, later
if ( !QFile::exists(configPath) ) {
QFile f(configPath);
- f.open(IO_WriteOnly);
+ if (f.open(IO_WriteOnly)) {
QTextStream ts( &f );
ts << "misc.memcpy_method:glibc\n";
ts << "# uncomment if you experience double speed audio \n #audio.oss_sync_method:softsync\n";
@@ -91,6 +91,8 @@ Lib::Lib( InitializationMode initMode, XineVideoWidget* widget )
ts << "audio.out_size_zero_buf:1024\n";
ts << "audio.passthrough_offset:0\n";
f.close();
+ } else
+ owarn << "Failed to open " f.name() << oendl;
}
if ( initMode == InitializeImmediately ) {
diff --git a/noncore/multimedia/opieplayer2/om3u.cpp b/noncore/multimedia/opieplayer2/om3u.cpp
index 790fa09..f2a01d3 100644
--- a/noncore/multimedia/opieplayer2/om3u.cpp
+++ b/noncore/multimedia/opieplayer2/om3u.cpp
@@ -38,10 +38,13 @@ using namespace Opie::Core;
//extern PlayListWidget *playList;
Om3u::Om3u( const QString &filePath, int mode)
- : QStringList (){
+ : QStringList ()
+{
odebug << "<<<<<<<new m3u "+filePath << oendl;
f.setName(filePath);
- f.open(mode);
+ if (!f.open(mode)) {
+ owarn << "Unable to open file " << f.name() << oendl;
+ }
}
Om3u::~Om3u(){}
@@ -83,12 +86,6 @@ void Om3u::readPls() { //it's a pls file
s = s.stripWhiteSpace();
s.replace( QRegExp( "%20" )," ");
// odebug << "adding " + s + " to playlist" << oendl;
- // numberofentries=2
- // File1=http
- // Title
- // Length
- // Version
- // File2=http
s = s.replace( QRegExp( "\\" ), "/" );
QFileInfo f( s );
QString name = f.baseName();
@@ -101,9 +98,6 @@ void Om3u::readPls() { //it's a pls file
if( s.at( s.length() - 4) == '.') // if this is probably a file
append(s);
else { //if its a url
-// if( name.right( 1 ).find( '/' ) == -1) {
-// s += "/";
-// }
append(s);
}
}
@@ -120,7 +114,6 @@ void Om3u::write() { //writes list to m3u file
t << *it << "\n";
}
}
-// f.close();
}
void Om3u::add(const QString &filePath) { //adds to m3u file
diff --git a/noncore/multimedia/opieplayer2/threadutil.cpp b/noncore/multimedia/opieplayer2/threadutil.cpp
index b5cac61..5fc8a0b 100644
--- a/noncore/multimedia/opieplayer2/threadutil.cpp
+++ b/noncore/multimedia/opieplayer2/threadutil.cpp
@@ -233,12 +233,17 @@ void Thread::exit()
pthread_exit( 0 );
}
-OnewayNotifier::OnewayNotifier()
+OnewayNotifier::OnewayNotifier() :
+ m_readFd(-1),
+ m_writeFd(-1)
{
- int fds[ 2 ];
- pipe( fds );
+ int fds[ 2 ] = { -1, -1 };
+ if (pipe( fds ) == 0) {
m_readFd = fds[ 0 ];
m_writeFd = fds[ 1 ];
+ } else {
+ owarn << "Call to pipe() failed" << oendl;
+ }
m_notifier = new QSocketNotifier( m_readFd, QSocketNotifier::Read );
connect( m_notifier, SIGNAL( activated(int) ),
diff --git a/noncore/net/opiestumbler/opiestumbler.cpp b/noncore/net/opiestumbler/opiestumbler.cpp
index 9b0d099..ab0b8d8 100644
--- a/noncore/net/opiestumbler/opiestumbler.cpp
+++ b/noncore/net/opiestumbler/opiestumbler.cpp
@@ -342,7 +342,8 @@ void OpieStumbler::slotAssociated()
m_proc = new Opie::Core::OProcess(this);
*m_proc << "udhcpc" << "-f" << "-n" << "-i" << m_interface;
- m_proc->start(Opie::Core::OProcess::DontCare);
+ if (!m_proc->start(Opie::Core::OProcess::DontCare))
+ owarn << "Execution of udhcpc returned false. Are paths correct?" << oendl;
QTimer::singleShot(5000, this, SLOT(slotCheckDHCP()));
}
diff --git a/noncore/settings/networksettings/mainwindow/mainwindowimp.cpp b/noncore/settings/networksettings/mainwindow/mainwindowimp.cpp
index 650e634..e81f603 100644
--- a/noncore/settings/networksettings/mainwindow/mainwindowimp.cpp
+++ b/noncore/settings/networksettings/mainwindow/mainwindowimp.cpp
@@ -196,7 +196,8 @@ void MainWindowImp::getAllInterfaces()
}
else
{
- procFile.open(IO_ReadOnly);
+ if (!procFile.open(IO_ReadOnly))
+ owarn << "Failed to open proc file " << procFile.name() << oendl;
QString line;
QTextStream procTs(&procFile);
int loc = -1;
@@ -732,7 +733,8 @@ void MainWindowImp::setHostname()
_procTemp="";
h << "hostname" << m_Nameinput->text();
connect(&h,SIGNAL(receivedStderr(Opie::Core::OProcess*,char*,int)),this,SLOT(slotHostname(Opie::Core::OProcess*,char*,int)));
- h.start(OProcess::Block,OProcess::Stderr);
+ if (!h.start(OProcess::Block,OProcess::Stderr))
+ owarn << "Failed execution of 'hostname'. Are the paths correct?" << oendl;
odebug << "Got " << _procTemp << " - " << h.exitStatus() << oendl;
if (h.exitStatus()!=0) {
QMessageBox::critical(0, tr("Sorry"), QString(tr("Could not set name.\n%1")).arg(_procTemp.stripWhiteSpace()));
@@ -768,7 +770,8 @@ void MainWindowImp::initHostname()
h << "hostname";
connect(&h,SIGNAL(receivedStdout(Opie::Core::OProcess*,char*,int)),this,SLOT(slotHostname(Opie::Core::OProcess*,char*,int)));
- h.start(OProcess::Block,OProcess::AllOutput);
+ if (!h.start(OProcess::Block,OProcess::AllOutput))
+ owarn << "Could not execute 'hostname'. Are the paths correct?" oendl;
odebug << "Got " << _procTemp <<oendl;
m_Nameinput->setText(_procTemp.stripWhiteSpace());
_procTemp="";
diff --git a/noncore/settings/networksettings/ppp/modem.cpp b/noncore/settings/networksettings/ppp/modem.cpp
index 7b2e2a3..17ada9b 100644
--- a/noncore/settings/networksettings/ppp/modem.cpp
+++ b/noncore/settings/networksettings/ppp/modem.cpp
@@ -768,8 +768,10 @@ bool Modem::createAuthFile(Auth method, const char *username, const char *passwo
// delete old file if any
unlink(oldName);
- rename(authfile, oldName);
- rename(newName, authfile);
+ if (rename(authfile, oldName) == -1)
+ return false;
+ if (rename(newName, authfile) == -1)
+ return false;
return true;
}