summaryrefslogtreecommitdiff
Side-by-side diff
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
@@ -653,40 +653,41 @@ void TextEdit::newFile( const DocLnk &f ) {
clear();
setWState (WState_Reserved1 );
editor->setFocus();
doc = new DocLnk(nf);
currentFileName = "Unnamed";
odebug << "newFile "+currentFileName << oendl;
updateCaption( currentFileName);
// editor->setEdited( false);
}
void TextEdit::openDotFile( const QString &f ) {
if(!currentFileName.isEmpty()) {
- currentFileName=f;
-
- odebug << "openFile dotfile " + currentFileName << oendl;
- QString txt;
- QFile file(f);
- file.open(IO_ReadWrite);
- QTextStream t(&file);
- while ( !t.atEnd()) {
- txt+=t.readLine()+"\n";
- }
- editor->setText(txt);
- editor->setEdited( false);
- edited1=false;
- edited=false;
-
-
+ currentFileName=f;
+
+ odebug << "openFile dotfile " + currentFileName << oendl;
+ QString txt;
+ QFile file(f);
+ if (!file.open(IO_ReadWrite))
+ owarn << "Failed to open file " << file.name() << oendl;
+ else {
+ QTextStream t(&file);
+ while ( !t.atEnd()) {
+ txt+=t.readLine()+"\n";
+ }
+ editor->setText(txt);
+ editor->setEdited( false);
+ edited1=false;
+ edited=false;
+ }
}
updateCaption( currentFileName);
}
void TextEdit::openFile( const QString &f ) {
odebug << "filename is "+ f << oendl;
QString filer;
QFileInfo fi( f);
// bFromDocView = true;
if(f.find(".desktop",0,true) != -1 && !openDesktop )
{
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) )
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
@@ -304,25 +304,29 @@ void QProcessManager::cleanup()
void QProcessManager::removeMe()
{
if ( procList->count() == 0 ) {
qprocess_cleanup_procmanager.remove( &QProcessPrivate::procManager );
QProcessPrivate::procManager = 0;
delete this;
}
}
void QProcessManager::sigchldHnd( int fd )
{
char tmp;
- ::read( fd, &tmp, sizeof(tmp) );
+ if (::read( fd, &tmp, sizeof(tmp) ) < 0)
+#if defined(QT_QPROCESS_DEBUG)
+ odebug << "QProcessManager::sigchldHnd() failed dummy read of file descriptor" << oendl;
+#endif
+ ;
#if defined(QT_QPROCESS_DEBUG)
odebug << "QProcessManager::sigchldHnd()" << oendl;
#endif
QProc *proc;
QProcess *process;
bool removeProc;
proc = procList->first();
while ( proc != 0 ) {
removeProc = FALSE;
process = proc->process;
QProcess *process_exit_notify=0;
if ( process != 0 ) {
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
@@ -358,34 +358,42 @@ void Server::systemMsg(const QCString &msg, const QByteArray &data)
mkdir( dir );
} else if ( msg == "rdiffGenSig(QString,QString)" ) {
QString baseFile, sigFile;
stream >> baseFile >> sigFile;
QRsync::generateSignature( baseFile, sigFile );
} else if ( msg == "rdiffGenDiff(QString,QString,QString)" ) {
QString baseFile, sigFile, deltaFile;
stream >> baseFile >> sigFile >> deltaFile;
QRsync::generateDiff( baseFile, sigFile, deltaFile );
} else if ( msg == "rdiffApplyPatch(QString,QString)" ) {
QString baseFile, deltaFile;
stream >> baseFile >> deltaFile;
+ bool fileWasCreated = false;
if ( !QFile::exists( baseFile ) ) {
QFile f( baseFile );
- f.open( IO_WriteOnly );
+ fileWasCreated = f.open( IO_WriteOnly );
f.close();
}
- QRsync::applyDiff( baseFile, deltaFile );
+ if ( fileWasCreated ) {
+ QRsync::applyDiff( baseFile, deltaFile );
#ifndef QT_NO_COP
- QCopEnvelope e( "QPE/Desktop", "patchApplied(QString)" );
- e << baseFile;
+ QCopEnvelope e( "QPE/Desktop", "patchApplied(QString)" );
+ e << baseFile;
#endif
+ } else {
+#ifndef QT_NO_COP
+ QCopEnvelope e( "QPE/Desktop", "patchUnapplied(QString)" );
+ e << baseFile;
+#endif
+ }
} else if ( msg == "rdiffCleanup()" ) {
mkdir( "/tmp/rdiff" );
QDir dir;
dir.setPath( "/tmp/rdiff" );
QStringList entries = dir.entryList();
for ( QStringList::Iterator it = entries.begin(); it != entries.end(); ++it )
dir.remove( *it );
} else if ( msg == "sendHandshakeInfo()" ) {
QString home = getenv( "HOME" );
#ifndef QT_NO_COP
QCopEnvelope e( "QPE/Desktop", "handshakeInfo(QString,bool)" );
e << home;
@@ -989,18 +997,19 @@ void Server::finishedQueuedRequests()
}
}
void Server::startSoundServer() {
if ( !process ) {
process = new Opie::Core::OProcess( this );
connect(process, SIGNAL(processExited(Opie::Core::OProcess*)),
SLOT(soundServerExited()));
}
process->clearArguments();
*process << QPEApplication::qpeDir() + "bin/qss";
- process->start();
+ if (!process->start())
+ owarn << "Sound server process did not start" << oendl;
}
void Server::soundServerExited() {
QTimer::singleShot(5000, this, SLOT(startSoundServer()));
}
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
@@ -24,24 +24,25 @@ _;:, .> :=|. This file is free software; you can
59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "menusettings.h"
#include <qpe/config.h>
#include <qpe/qlibrary.h>
#include <qpe/qpeapplication.h>
#include <qpe/menuappletinterface.h>
#include <qpe/qcopenvelope_qws.h>
+#include <opie2/odebug.h>
#include <qdir.h>
#include <qlistview.h>
#include <qcheckbox.h>
#include <qheader.h>
#include <qlayout.h>
#include <qlabel.h>
#include <qwhatsthis.h>
#include <stdlib.h>
@@ -85,25 +86,27 @@ void MenuSettings::init ( )
#ifdef Q_OS_MACX
QStringList list = QDir ( path, "lib*.dylib" ). entryList ( );
#else
QStringList list = QDir ( path, "lib*.so" ). entryList ( );
#endif /* Q_OS_MACX */
for ( QStringList::Iterator it = list. begin ( ); it != list. end ( ); ++it ) {
QString name;
QPixmap icon;
MenuAppletInterface *iface = 0;
QLibrary *lib = new QLibrary ( path + "/" + *it );
- lib-> queryInterface ( IID_MenuApplet, (QUnknownInterface**) &iface );
+ QRESULT retVal = QS_OK;
+ if ((retVal = lib-> queryInterface ( IID_MenuApplet, (QUnknownInterface**)(&iface) )) != QS_OK )
+ owarn << "queryInterface failed with " << retVal << oendl;
if ( iface ) {
QString lang = getenv( "LANG" );
QTranslator *trans = new QTranslator ( qApp );
QString type = (*it). left ((*it). find ("."));
QString tfn = QPEApplication::qpeDir ( ) + "i18n/" + lang + "/" + type + ".qm";
if ( trans-> load ( tfn ))
qApp-> installTranslator ( trans );
else
delete trans;
name = iface-> name ( );
icon = iface-> icon ( ). pixmap ();
iface-> release ( );
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
@@ -82,67 +82,70 @@ void TaskbarSettings::init ( )
QStringList list = QDir ( path, "lib*.dylib" ). entryList ( );
#else
QStringList list = QDir ( path, "lib*.so" ). entryList ( );
#endif /* Q_OS_MACX */
for ( QStringList::Iterator it = list. begin ( ); it != list. end ( ); ++it ) {
QString name;
QPixmap icon;
TaskbarNamedAppletInterface *iface = 0;
owarn << "Load applet: " << (*it) << "" << oendl;
QLibrary *lib = new QLibrary ( path + "/" + *it );
- lib-> queryInterface ( IID_TaskbarNamedApplet, (QUnknownInterface**) &iface );
+ QRESULT retVal = QS_OK;
+ if ((retVal = lib-> queryInterface ( IID_TaskbarNamedApplet, (QUnknownInterface**)(&iface) )) != QS_OK)
+ owarn << "<0>" << oendl;
owarn << "<1>" << oendl;
if ( iface ) {
owarn << "<2>" << oendl;
QString lang = getenv( "LANG" );
QTranslator *trans = new QTranslator ( qApp );
QString type = (*it). left ((*it). find ("."));
QString tfn = QPEApplication::qpeDir ( ) + "i18n/" + lang + "/" + type + ".qm";
if ( trans-> load ( tfn ))
qApp-> installTranslator ( trans );
else
delete trans;
name = iface-> name ( );
icon = iface-> icon ( );
iface-> release ( );
}
owarn << "<3>" << oendl;
if ( !iface ) {
owarn << "<4>" << oendl;
- lib-> queryInterface ( IID_TaskbarApplet, (QUnknownInterface**) &iface );
+ if ((retVal = lib-> queryInterface ( IID_TaskbarApplet, (QUnknownInterface**)(&iface))) != QS_OK)
+ owarn << "<5>" << oendl;
if ( iface ) {
- owarn << "<5>" << oendl;
+ owarn << "<6>" << oendl;
name = (*it). mid ( 3 );
owarn << "Found applet: " << name << "" << oendl;
#ifdef Q_OS_MACX
int sep = name. find( ".dylib" );
#else
int sep = name. find( ".so" );
#endif /* Q_OS_MACX */
if ( sep > 0 )
name. truncate ( sep );
sep = name. find ( "applet" );
if ( sep == (int) name.length ( ) - 6 )
name. truncate ( sep );
name[0] = name[0]. upper ( );
iface-> release ( );
}
}
- owarn << "<6>" << oendl;
+ owarn << "<7>" << oendl;
if ( iface ) {
- owarn << "<7>" << oendl;
+ owarn << "<8>" << oendl;
QCheckListItem *item;
item = new QCheckListItem ( m_list, name, QCheckListItem::CheckBox );
if ( !icon. isNull ( ))
item-> setPixmap ( 0, icon );
item-> setOn ( exclude. find ( *it ) == exclude. end ( ));
m_applets [*it] = item;
}
lib-> unload ( );
delete lib;
}
}
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
@@ -335,25 +335,25 @@ bool OGlobal::isAppLnkFileName( const QString& str )
*/
bool OGlobal::isDocumentFileName( const QString& file )
{
if (file.isEmpty()||file.at(file.length()-1)==QDir::separator()) return false;
if (file.startsWith(QPEApplication::documentDir()+QDir::separator())) return true;
StorageInfo si;
QList< FileSystem > fl = si.fileSystems();
FileSystem*fs;
for (fs = fl.first();fs!=0;fs=fl.next()) {
if (fs->isRemovable()&&file.startsWith(fs->name()+QDir::separator()))
return true;
}
- if (file.startsWith(homeDirPath())+"/Documents/") return true;
+ if (file.startsWith(homeDirPath()+"/Documents/")) return true;
return false;
}
QString OGlobal::tempDirPath()
{
static QString defstring="/tmp";
char * tmpp = 0;
if ( (tmpp=getenv("TEMP"))) {
return tmpp;
}
return defstring;
}
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
@@ -919,25 +919,25 @@ bool OProcess::isExecutable( const QCString &filename )
}
int OProcess::processPID( const QString& process )
{
QString line;
QDir d = QDir( "/proc" );
QStringList dirs = d.entryList( QDir::Dirs );
QStringList::Iterator it;
for ( it = dirs.begin(); it != dirs.end(); ++it )
{
//qDebug( "next entry: %s", (const char*) *it );
QFile file( "/proc/"+*it+"/cmdline" );
- file.open( IO_ReadOnly );
+ if ( !file.open( IO_ReadOnly ) ) continue;
if ( !file.isOpen() ) continue;
QTextStream t( &file );
line = t.readLine();
//qDebug( "cmdline = %s", (const char*) line );
if ( line.contains( process ) ) break; //FIXME: That may find also other process, if the name is not long enough ;)
}
if ( line.contains( process ) )
{
//qDebug( "found process id #%d", (*it).toInt() );
return (*it).toInt();
}
else
diff --git a/library/global.cpp b/library/global.cpp
index f7a0767..7bdd0b1 100644
--- a/library/global.cpp
+++ b/library/global.cpp
@@ -207,57 +207,56 @@ Global::Global()
{
}
/*!
Returns the unchangeable QDawg that contains general
words for the current locale.
\sa addedDawg()
*/
const QDawg& Global::fixedDawg()
{
if ( !fixed_dawg ) {
- if ( !docDirCreated )
- createDocDir();
-
- fixed_dawg = new QDawg;
- QString dawgfilename = dictDir() + "/dawg";
- QString words_lang;
- QStringList langs = Global::languageList();
- for (QStringList::ConstIterator it = langs.begin(); it!=langs.end(); ++it) {
- QString lang = *it;
- words_lang = dictDir() + "/words." + lang;
- QString dawgfilename_lang = dawgfilename + "." + lang;
- if ( QFile::exists(dawgfilename_lang) ||
- QFile::exists(words_lang) ) {
- dawgfilename = dawgfilename_lang;
- break;
- }
- }
- QFile dawgfile(dawgfilename);
-
- if ( !dawgfile.exists() ) {
- QString fn = dictDir() + "/words";
- if ( QFile::exists(words_lang) )
- fn = words_lang;
- QFile in(fn);
- if ( in.open(IO_ReadOnly) ) {
- fixed_dawg->createFromWords(&in);
- dawgfile.open(IO_WriteOnly);
- fixed_dawg->write(&dawgfile);
- dawgfile.close();
+ if ( !docDirCreated )
+ createDocDir();
+
+ fixed_dawg = new QDawg;
+ QString dawgfilename = dictDir() + "/dawg";
+ QString words_lang;
+ QStringList langs = Global::languageList();
+ for (QStringList::ConstIterator it = langs.begin(); it!=langs.end(); ++it) {
+ QString lang = *it;
+ words_lang = dictDir() + "/words." + lang;
+ QString dawgfilename_lang = dawgfilename + "." + lang;
+ if ( QFile::exists(dawgfilename_lang) ||
+ QFile::exists(words_lang) ) {
+ dawgfilename = dawgfilename_lang;
+ break;
+ }
}
- } else {
- fixed_dawg->readFile(dawgfilename);
- }
+ QFile dawgfile(dawgfilename);
+
+ if ( !dawgfile.exists() ) {
+ QString fn = dictDir() + "/words";
+ if ( QFile::exists(words_lang) )
+ fn = words_lang;
+ QFile in(fn);
+ if ( in.open(IO_ReadOnly) ) {
+ fixed_dawg->createFromWords(&in);
+ if (dawgfile.open(IO_WriteOnly))
+ fixed_dawg->write(&dawgfile);
+ dawgfile.close();
+ }
+ } else
+ fixed_dawg->readFile(dawgfilename);
}
return *fixed_dawg;
}
/*!
Returns the changeable QDawg that contains general
words for the current locale.
\sa fixedDawg()
*/
const QDawg& Global::addedDawg()
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
@@ -183,26 +183,27 @@ void Output::saveOutput() {
InputDialog *fileDlg;
fileDlg = new InputDialog(this,tr("Save output to file (name only)"),TRUE, 0);
fileDlg->exec();
if( fileDlg->result() == 1 ) {
QString filename = QPEApplication::documentDir();
if(filename.right(1).find('/') == -1)
filename+="/";
QString name = fileDlg->LineEdit1->text();
filename+="text/plain/"+name;
odebug << filename << oendl;
QFile f(filename);
- f.open( IO_WriteOnly);
- if( f.writeBlock( OutputEdit->text(), qstrlen( OutputEdit->text()) ) != -1) {
+ if ( !f.open( IO_WriteOnly ) )
+ owarn << "Could no open file" << oendl;
+ else if( f.writeBlock( OutputEdit->text(), qstrlen( OutputEdit->text()) ) != -1) {
DocLnk lnk;
lnk.setName(name); //sets file name
lnk.setFile(filename); //sets File property
lnk.setType("text/plain");
if(!lnk.writeLink()) {
odebug << "Writing doclink did not work" << oendl;
}
} else
owarn << "Could not write file" << oendl;
f.close();
}
}
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
@@ -63,25 +63,28 @@ KWBuffer::clear()
/**
* Insert a file at line @p line in the buffer.
*/
void
KWBuffer::insertFile(int line, const QString &file, QTextCodec *codec)
{
if (line) {
odebug << "insert File only supports insertion at line 0 == file opening" << oendl;
return;
}
clear();
QFile iofile(file);
- iofile.open(IO_ReadOnly);
+ if (!iofile.open(IO_ReadOnly)) {
+ owarn << "failed to open file " << iofile.name() << oendl;
+ return;
+ }
QTextStream stream(&iofile);
stream.setCodec(codec);
QString qsl;
int count=0;
for (count=0;((qsl=stream.readLine())!=QString::null); count++)
{
if (count==0)
{
(*m_stringListIt)->append(qsl.unicode(),qsl.length());
}
else
{
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
@@ -233,27 +233,30 @@ bool UserDialog::addUser(int uid, int gid)
if (temp->text()=="audio") temp->setOn(true);
if (temp->text()=="time") temp->setOn(true);
if (temp->text()=="power") temp->setOn(true);
if (temp->text()=="input") temp->setOn(true);
if (temp->text()=="sharp") temp->setOn(true);
if (temp->text()=="tty") temp->setOn(true);
}
}
// Show the dialog!
if(!(adduserDialog->exec())) return false;
if((adduserDialog->groupComboBox->currentItem()!=0))
{
- accounts->findGroup(adduserDialog->groupComboBox->currentText());
- adduserDialog->groupID=accounts->gr_gid;
- owarn << QString::number(accounts->gr_gid) << oendl;
+ // making the call findGroup() puts the group info in the accounts gr_gid
+ if (accounts->findGroup(adduserDialog->groupComboBox->currentText()))
+ {
+ adduserDialog->groupID=accounts->gr_gid;
+ owarn << QString::number(accounts->gr_gid) << oendl;
+ }
}
if(!(accounts->addUser(adduserDialog->loginLineEdit->text(), adduserDialog->passwordLineEdit->text(),
adduserDialog->uidLineEdit->text().toInt(), adduserDialog->groupID, adduserDialog->gecosLineEdit->text(),
QString("/home/")+adduserDialog->loginLineEdit->text() , adduserDialog->shellComboBox->currentText())))
{
QMessageBox::information(0,"Ooops!","Something went wrong!\nUnable to add user.");
return false;
}
// Add User to additional groups.
QListViewItemIterator it( adduserDialog->groupsListView );
for ( ; it.current(); ++it )