summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/textedit/textedit.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp
index 2f59ede..019ffee 100644
--- a/core/apps/textedit/textedit.cpp
+++ b/core/apps/textedit/textedit.cpp
@@ -648,97 +648,97 @@ void TextEdit::openFile( const QString &f )
void TextEdit::openFile( const DocLnk &f )
{
// clear();
bFromDocView = TRUE;
FileManager fm;
QString txt;
currentFileName=f.name();
qDebug("openFile doclnk " + currentFileName);
if ( !fm.loadFile( f, txt ) ) {
// ####### could be a new file
qDebug( "Cannot open file" );
//return;
}
fileNew();
if ( doc )
delete doc;
doc = new DocLnk(f);
editor->setText(txt);
editor->setEdited( false);
qDebug("openFile doclnk "+currentFileName);
doc->setName(currentFileName);
updateCaption();
}
void TextEdit::showEditTools()
{
// if ( !doc )
// close();
// clear();
fileSelector->hide();
menu->show();
editBar->show();
if ( searchVisible )
searchBar->show();
// updateCaption();
editorStack->raiseWidget( editor );
setWState (WState_Reserved1 );
}
/*!
unprompted save */
bool TextEdit::save()
{
QString file = doc->file();
QString name= doc->name();
QString rt = editor->text();
- currentFileName= file ;
+ currentFileName= name ;
qDebug("saveFile "+currentFileName);
doc->setName( name);
FileManager fm;
if ( !fm.saveFile( *doc, rt ) ) {
return false;
}
// if(doc)
// delete doc;
// doc = 0;
editor->setEdited( false );
return true;
}
/*!
prompted save */
bool TextEdit::saveAs()
{
qDebug("saveAsFile "+currentFileName);
// case of nothing to save... /// there's always something 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 == "Unnamed") {
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.