summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/textedit/fileSaver.cpp16
-rw-r--r--core/apps/textedit/textedit.cpp52
-rw-r--r--core/apps/textedit/textedit.h2
3 files changed, 42 insertions, 28 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
@@ -31,3 +31,5 @@ fileSaver::fileSaver( QWidget* parent, const char* name, bool modal, WFlags fl
setCaption(tr( "Save file" ) );
-// filterStr=currentFileName;
+ QFileInfo fi(currentFileName);
+ QString tmpFileName=fi.fileName();
+// qDebug( tmpFileName);
@@ -51,7 +53,12 @@ fileSaver::fileSaver( QWidget* parent, const char* name, bool modal, WFlags fl
fileEdit->setGeometry( QRect( 10, 230, 200, 25));
- fileEdit->setText(currentFileName);
- // signals and slots connections
+
+ fileEdit->setText( tmpFileName);
+
+ // signals and slots connections
connect( ListView, SIGNAL(doubleClicked( QListViewItem*)), SLOT(listDoubleClicked(QListViewItem *)) );
connect( ListView, SIGNAL(pressed( QListViewItem*)), SLOT(listClicked(QListViewItem *)) );
- currentDir.setPath(QDir::currentDirPath() );
+
+// tmpFileName=fi.FilePath();
+// qDebug( tmpFileName);
+ currentDir.setPath( QDir::currentDirPath() );
populateList();
@@ -162,2 +169,3 @@ void fileSaver::accept() {
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
@@ -487,3 +487,5 @@ void TextEdit::fileNew()
{
- save();
+ if( !bFromDocView ) {
+ save();
+ }
newFile(DocLnk());
@@ -514,3 +516,3 @@ void TextEdit::fileOpen()
fileSelector->reread();
- updateCaption();
+ updateCaption(currentFileName);
}
@@ -521,16 +523,17 @@ void TextEdit::newFileOpen()
browseForFiles=new fileBrowser(this,"fileBrowser",TRUE,0, "*");
- browseForFiles->exec();
- QString selFile= browseForFiles->selectedFileName;
- QStringList fileList=browseForFiles->fileList;
- qDebug(selFile);
- QStringList::ConstIterator f;
- QString fileTemp;
- for ( f = fileList.begin(); f != fileList.end(); f++ ) {
- fileTemp = *f;
- fileTemp.right( fileTemp.length()-5);
- QString fileName = fileTemp;
- if( fileName != "Unnamed" || fileName != "Empty Text" ) {
- currentFileName = fileName;
- qDebug("please open "+currentFileName);
- openFile(fileName );
+ if( browseForFiles->exec()!= 0 ) {
+ QString selFile= browseForFiles->selectedFileName;
+ QStringList fileList=browseForFiles->fileList;
+ qDebug(selFile);
+ QStringList::ConstIterator f;
+ QString fileTemp;
+ for ( f = fileList.begin(); f != fileList.end(); f++ ) {
+ fileTemp = *f;
+ fileTemp.right( fileTemp.length()-5);
+ QString fileName = fileTemp;
+ if( fileName != "Unnamed" || fileName != "Empty Text" ) {
+ currentFileName = fileName;
+// qDebug("please open "+currentFileName);
+ openFile(fileName );
+ }
}
@@ -621,3 +624,3 @@ void TextEdit::newFile( const DocLnk &f )
doc = new DocLnk(nf);
- updateCaption();
+// updateCaption();
}
@@ -643,2 +646,3 @@ void TextEdit::openFile( const DocLnk &f )
// clear();
+ bFromDocView = TRUE;
FileManager fm;
@@ -658,3 +662,3 @@ void TextEdit::openFile( const DocLnk &f )
editor->setEdited(FALSE);
- updateCaption();
+ updateCaption(currentFileName);
}
@@ -671,3 +675,3 @@ void TextEdit::showEditTools()
searchBar->show();
- updateCaption();
+// updateCaption();
editorStack->raiseWidget( editor );
@@ -688,4 +692,5 @@ bool TextEdit::save()
QString rt = editor->text();
-
- if(currentFileName.isEmpty() || currentFileName == "Unnamed") {
+ qDebug(currentFileName);
+
+ if( currentFileName.isEmpty() || currentFileName == "Unnamed") {
@@ -713,3 +718,3 @@ bool TextEdit::save()
fileSaveDlg=new fileSaver(this,"SaveFile",TRUE,0, currentFileName);
- fileSaveDlg->exec();
+ if( fileSaveDlg->exec() != 0 ) {
QString fileNm=fileSaveDlg->selectedFileName;
@@ -717,3 +722,4 @@ bool TextEdit::save()
doc->setName(fileNm);
- updateCaption();
+ updateCaption(fileNm);
+ }
delete fileSaveDlg;
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
@@ -57,3 +57,3 @@ private slots:
void setDocument(const QString&);
- void changeFont();
+ void changeFont();
void fileNew();