-rw-r--r-- | core/apps/embeddedkonsole/konsole.cpp | 10 | ||||
-rw-r--r-- | core/apps/textedit/textedit.cpp | 100 | ||||
-rw-r--r-- | noncore/applets/notesapplet/notes.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 2 |
4 files changed, 49 insertions, 65 deletions
diff --git a/core/apps/embeddedkonsole/konsole.cpp b/core/apps/embeddedkonsole/konsole.cpp index f4ca0bf..5c40569 100644 --- a/core/apps/embeddedkonsole/konsole.cpp +++ b/core/apps/embeddedkonsole/konsole.cpp @@ -218,8 +218,14 @@ static void konsoleInit(const char** shell) { #endif + if (!shell) { + owarn << "No double pointer 'shell'" << oendl; + return; + } + *shell = getenv("SHELL"); - owarn << "SHell initially is " << *shell << "" << oendl; + if (*shell) + owarn << "Current shell: " << *shell << "" << oendl; - if (shell == NULL || *shell == '\0') { + if (*shell == NULL || **shell == '\0') { struct passwd *ent = 0; uid_t me = getuid(); diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp index 61beac5..4bbc62b 100644 --- a/core/apps/textedit/textedit.cpp +++ b/core/apps/textedit/textedit.cpp @@ -851,15 +851,4 @@ bool TextEdit::saveAs() { return false; odebug << "saveAsFile " + currentFileName << oendl; - // case of nothing to save... -// if ( !doc && !currentFileName.isEmpty()) { -// //|| !bFromDocView) -// odebug << "no doc" << oendl; -// return true; -// } -// if ( !editor->edited() ) { -// delete doc; -// doc = 0; -// return true; -// } QString rt = editor->text(); @@ -868,27 +857,24 @@ bool TextEdit::saveAs() { if( currentFileName.isEmpty() || currentFileName == tr("Unnamed") - || currentFileName == tr("Text Editor")) { + || currentFileName == tr("Text Editor")) + { odebug << "do silly TT filename thing" << oendl; -// if ( doc && doc->name().isEmpty() ) { QString pt = rt.simplifyWhiteSpace(); int i = pt.find( ' ' ); QString docname = pt; - if ( i > 0 ) - docname = pt.left( i ); - // remove "." at the beginning + if ( i > 0 ) docname = pt.left( i ); + while( docname.startsWith( "." ) ) docname = docname.mid( 1 ); docname.replace( QRegExp("/"), "_" ); - // cut the length. filenames longer than that - //don't make sense and something goes wrong when they get too long. - if ( docname.length() > 40 ) - docname = docname.left(40); - if ( docname.isEmpty() ) - docname = tr("Unnamed"); + // Cut the length. Filenames longer than 40 are not helpful + // and something goes wrong when they get too long. + if ( docname.length() > 40 ) docname = docname.left(40); + + if ( docname.isEmpty() ) docname = tr("Unnamed"); + if(doc) doc->setName(docname); + currentFileName=docname; -// } -// else -// odebug << "hmmmmmm" << oendl; } @@ -907,10 +893,9 @@ bool TextEdit::saveAs() { if(dire==".") dire = QPEApplication::documentDir(); + QString str; if( !featureAutoSave) { - str = OFileDialog::getSaveFileName( 2, - dire, - filee, map); - } else + str = OFileDialog::getSaveFileName( 2, dire, filee, map); + } else str = currentFileName; @@ -922,33 +907,28 @@ bool TextEdit::saveAs() { currentFileName=fi.fileName(); if(doc) -// QString file = doc->file(); -// doc->removeFiles(); delete doc; - DocLnk nf; - nf.setType("text/plain"); - nf.setFile( fileNm); - doc = new DocLnk(nf); -// editor->setText(rt); - odebug << "Saving file as "+currentFileName << oendl; - doc->setName( fi.baseName() /*currentFileName*/); - updateCaption( currentFileName); - - FileManager fm; - if ( !fm.saveFile( *doc, rt ) ) { - QMessageBox::message(tr("Text Edit"),tr("Save Failed")); - return false; - } - - if( filePerms ) { - filePermissions *filePerm; - filePerm = new filePermissions(this, - tr("Permissions"),true, - 0,(const QString &)fileNm); - QPEApplication::execDialog( filePerm ); - - if( filePerm) - delete filePerm; - } -// } + + DocLnk nf; + nf.setType("text/plain"); + nf.setFile( fileNm); + doc = new DocLnk(nf); + odebug << "Saving file as "+currentFileName << oendl; + doc->setName( fi.baseName() ); + updateCaption( currentFileName); + + FileManager fm; + if ( !fm.saveFile( *doc, rt ) ) { + QMessageBox::message(tr("Text Edit"),tr("Save Failed")); + return false; + } + + if( filePerms ) { + filePermissions *filePerm; + filePerm = new filePermissions(this, tr("Permissions"),true, 0, + (const QString &)fileNm); + QPEApplication::execDialog( filePerm ); + + delete filePerm; + } editor->setEdited( false); edited1 = false; @@ -1198,8 +1178,6 @@ void TextEdit::doGoto() { gotoEdit->hide(); - if(gotoEdit) { - delete gotoEdit; - gotoEdit = 0; - } + delete gotoEdit; + gotoEdit = 0; bool ok; diff --git a/noncore/applets/notesapplet/notes.cpp b/noncore/applets/notesapplet/notes.cpp index 13f297e..61a47d7 100644 --- a/noncore/applets/notesapplet/notes.cpp +++ b/noncore/applets/notesapplet/notes.cpp @@ -236,5 +236,5 @@ void NotesControl::showMenu() { m->exec( QCursor::pos() ); - if(m) delete m; + delete m; } diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index 828f5a1..cf19ba8 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp @@ -497,5 +497,5 @@ void AdvancedFm::showFileMenu() { m->exec(QPoint(QCursor::pos().x(),QCursor::pos().y())); - if(m) delete m; + delete m; } |