-rw-r--r-- | core/apps/textedit/fileSaver.cpp | 12 | ||||
-rw-r--r-- | core/apps/textedit/textedit.cpp | 22 | ||||
-rw-r--r-- | core/apps/textedit/textedit.h | 0 |
3 files changed, 24 insertions, 10 deletions
diff --git a/core/apps/textedit/fileSaver.cpp b/core/apps/textedit/fileSaver.cpp index d01daee..88608cc 100644 --- a/core/apps/textedit/fileSaver.cpp +++ b/core/apps/textedit/fileSaver.cpp @@ -29,7 +29,9 @@ fileSaver::fileSaver( QWidget* parent, const char* name, bool modal, WFlags fl setName( "fileSaver" ); resize( 236, 280 ); setCaption(tr( "Save file" ) ); -// filterStr=currentFileName; + QFileInfo fi(currentFileName); + QString tmpFileName=fi.fileName(); +// qDebug( tmpFileName); dirLabel = new QLabel(this, "DirLabel"); dirLabel->setText(currentDir.canonicalPath()); @@ -49,10 +51,15 @@ fileSaver::fileSaver( QWidget* parent, const char* name, bool modal, WFlags fl fileEdit= new QLineEdit(this); fileEdit->setGeometry( QRect( 10, 230, 200, 25)); - fileEdit->setText(currentFileName); + + fileEdit->setText( tmpFileName); + // signals and slots connections connect( ListView, SIGNAL(doubleClicked( QListViewItem*)), SLOT(listDoubleClicked(QListViewItem *)) ); connect( ListView, SIGNAL(pressed( QListViewItem*)), SLOT(listClicked(QListViewItem *)) ); + +// tmpFileName=fi.FilePath(); +// qDebug( tmpFileName); currentDir.setPath(QDir::currentDirPath() ); populateList(); } @@ -160,5 +167,6 @@ void fileSaver::OnOK() void fileSaver::accept() { selectedFileName = fileEdit->text(); selectedFileName = currentDir.canonicalPath()+ selectedFileName; + qDebug("goint to save "+selectedFileName); reject(); } diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp index 14bc496..429c195 100644 --- a/core/apps/textedit/textedit.cpp +++ b/core/apps/textedit/textedit.cpp @@ -485,7 +485,9 @@ void TextEdit::setWordWrap(bool y) void TextEdit::fileNew() { + if( !bFromDocView ) { save(); + } newFile(DocLnk()); } @@ -512,14 +514,14 @@ void TextEdit::fileOpen() clearWState (WState_Reserved1 ); editorStack->raiseWidget( fileSelector ); fileSelector->reread(); - updateCaption(); + updateCaption(currentFileName); } void TextEdit::newFileOpen() { fileBrowser *browseForFiles; browseForFiles=new fileBrowser(this,"fileBrowser",TRUE,0, "*"); - browseForFiles->exec(); + if( browseForFiles->exec()!= 0 ) { QString selFile= browseForFiles->selectedFileName; QStringList fileList=browseForFiles->fileList; qDebug(selFile); @@ -531,10 +533,11 @@ void TextEdit::newFileOpen() QString fileName = fileTemp; if( fileName != "Unnamed" || fileName != "Empty Text" ) { currentFileName = fileName; - qDebug("please open "+currentFileName); +// qDebug("please open "+currentFileName); openFile(fileName ); } } + } delete browseForFiles; } @@ -619,7 +622,7 @@ void TextEdit::newFile( const DocLnk &f ) setWState (WState_Reserved1 ); editor->setFocus(); doc = new DocLnk(nf); - updateCaption(); +// updateCaption(); } void TextEdit::openFile( const QString &f ) @@ -641,6 +644,7 @@ void TextEdit::openFile( const QString &f ) void TextEdit::openFile( const DocLnk &f ) { // clear(); + bFromDocView = TRUE; FileManager fm; QString txt; if ( !fm.loadFile( f, txt ) ) { @@ -656,7 +660,7 @@ void TextEdit::openFile( const DocLnk &f ) doc = new DocLnk(f); editor->setText(txt); editor->setEdited(FALSE); - updateCaption(); + updateCaption(currentFileName); } void TextEdit::showEditTools() @@ -669,7 +673,7 @@ void TextEdit::showEditTools() editBar->show(); if ( searchVisible ) searchBar->show(); - updateCaption(); +// updateCaption(); editorStack->raiseWidget( editor ); setWState (WState_Reserved1 ); } @@ -686,6 +690,7 @@ bool TextEdit::save() } QString rt = editor->text(); + qDebug(currentFileName); if(currentFileName.isEmpty() || currentFileName == "Unnamed") { @@ -711,11 +716,12 @@ bool TextEdit::save() fileSaver *fileSaveDlg; fileSaveDlg=new fileSaver(this,"SaveFile",TRUE,0, currentFileName); - fileSaveDlg->exec(); + if( fileSaveDlg->exec() != 0 ) { QString fileNm=fileSaveDlg->selectedFileName; qDebug("save filename "+fileNm); doc->setName(fileNm); - updateCaption(); + updateCaption(fileNm); + } delete fileSaveDlg; FileManager fm; diff --git a/core/apps/textedit/textedit.h b/core/apps/textedit/textedit.h index 4e469cc..4bfb260 100644 --- a/core/apps/textedit/textedit.h +++ b/core/apps/textedit/textedit.h |