summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-11-09 00:55:56 (UTC)
committer llornkcor <llornkcor>2002-11-09 00:55:56 (UTC)
commit84e685e0c2922899dcdd69cfc23ecbccbf855af4 (patch) (side-by-side diff)
tree1a3d34d261c5ebc4982d3b9276e63ebae57d8d39
parent028753a6a3857cdcf7476e537de1cd5c471424c4 (diff)
downloadopie-84e685e0c2922899dcdd69cfc23ecbccbf855af4.zip
opie-84e685e0c2922899dcdd69cfc23ecbccbf855af4.tar.gz
opie-84e685e0c2922899dcdd69cfc23ecbccbf855af4.tar.bz2
fix for #435
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/textedit/textedit.cpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp
index f38ea53..e3b8361 100644
--- a/core/apps/textedit/textedit.cpp
+++ b/core/apps/textedit/textedit.cpp
@@ -759,71 +759,76 @@ bool TextEdit::save() {
chmod( file.latin1(), mode);
}
return true;
}
return false;
}
/*!
prompted save */
bool TextEdit::saveAs() {
- qDebug("saveAsFile "+currentFileName);
+ qDebug("saveAsFile " + currentFileName);
// case of nothing to save...
if ( !doc ) {
//|| !bFromDocView)
qDebug("no doc");
return true;
}
if ( !editor->edited() ) {
delete doc;
doc = 0;
return true;
}
QString rt = editor->text();
qDebug(currentFileName);
- if( currentFileName.isEmpty() || currentFileName == tr("Unnamed") || currentFileName == tr("Text Editor")) {
+ if( currentFileName.isEmpty()
+ || currentFileName == tr("Unnamed")
+ || currentFileName == tr("Text Editor")) {
// qDebug("do silly TT filename thing");
if ( 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
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.
+ // 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");
doc->setName(docname);
currentFileName=docname;
}
}
QMap<QString, QStringList> map;
map.insert(tr("All"), QStringList() );
QStringList text;
text << "text/*";
map.insert(tr("Text"), text );
text << "*";
map.insert(tr("All"), text );
-
- QString str = OFileDialog::getSaveFileName( 2,QPEApplication::documentDir(), QString::null, map);
+// if(currentFileName
+ QString str = OFileDialog::getSaveFileName( 2,
+ QPEApplication::documentDir(),
+ currentFileName, map);
if(!str.isEmpty() ) {
QString fileNm=str;
qDebug("saving filename "+fileNm);
QFileInfo fi(fileNm);
currentFileName=fi.fileName();
if(doc) {
// QString file = doc->file();
// doc->removeFiles();
delete doc;
DocLnk nf;
@@ -833,25 +838,27 @@ bool TextEdit::saveAs() {
// editor->setText(rt);
// qDebug("openFile doclnk "+currentFileName);
doc->setName( currentFileName);
updateCaption( currentFileName);
FileManager fm;
if ( !fm.saveFile( *doc, rt ) ) {
return false;
}
if( filePerms ) {
filePermissions *filePerm;
- filePerm = new filePermissions(this, tr("Permissions"),true,0,(const QString &)fileNm);
+ filePerm = new filePermissions(this,
+ tr("Permissions"),true,
+ 0,(const QString &)fileNm);
filePerm->showMaximized();
filePerm->exec();
if( filePerm)
delete filePerm;
}
}
editor->setEdited( false);
edited1 = false;
edited = false;
if(caption().left(1)=="*")
setCaption(caption().right(caption().length()-1));