summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-02-18 14:52:54 (UTC)
committer llornkcor <llornkcor>2002-02-18 14:52:54 (UTC)
commit00f89d28e669140eb50f1f220c389f88fba1105c (patch) (side-by-side diff)
treedeb87bb87d855bbacddc79d8a0a79edfb1cf1cd8
parent9741205aa0b0892b870d2b7df7c5dd7e25b0bb18 (diff)
downloadopie-00f89d28e669140eb50f1f220c389f88fba1105c.zip
opie-00f89d28e669140eb50f1f220c389f88fba1105c.tar.gz
opie-00f89d28e669140eb50f1f220c389f88fba1105c.tar.bz2
fixed filesave and fileopen cancel
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
@@ -30,5 +30,7 @@ fileSaver::fileSaver( QWidget* parent, const char* name, bool modal, WFlags fl
resize( 236, 280 );
setCaption(tr( "Save file" ) );
-// filterStr=currentFileName;
+ QFileInfo fi(currentFileName);
+ QString tmpFileName=fi.fileName();
+// qDebug( tmpFileName);
dirLabel = new QLabel(this, "DirLabel");
@@ -50,9 +52,14 @@ 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);
- // 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();
}
@@ -161,4 +168,5 @@ 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
@@ -486,5 +486,7 @@ void TextEdit::setWordWrap(bool y)
void TextEdit::fileNew()
{
- save();
+ if( !bFromDocView ) {
+ save();
+ }
newFile(DocLnk());
}
@@ -513,5 +515,5 @@ void TextEdit::fileOpen()
editorStack->raiseWidget( fileSelector );
fileSelector->reread();
- updateCaption();
+ updateCaption(currentFileName);
}
@@ -520,18 +522,19 @@ void TextEdit::newFileOpen()
fileBrowser *browseForFiles;
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 );
+ }
}
}
@@ -620,5 +623,5 @@ void TextEdit::newFile( const DocLnk &f )
editor->setFocus();
doc = new DocLnk(nf);
- updateCaption();
+// updateCaption();
}
@@ -642,4 +645,5 @@ void TextEdit::openFile( const DocLnk &f )
{
// clear();
+ bFromDocView = TRUE;
FileManager fm;
QString txt;
@@ -657,5 +661,5 @@ void TextEdit::openFile( const DocLnk &f )
editor->setText(txt);
editor->setEdited(FALSE);
- updateCaption();
+ updateCaption(currentFileName);
}
@@ -670,5 +674,5 @@ void TextEdit::showEditTools()
if ( searchVisible )
searchBar->show();
- updateCaption();
+// updateCaption();
editorStack->raiseWidget( editor );
setWState (WState_Reserved1 );
@@ -687,6 +691,7 @@ bool TextEdit::save()
QString rt = editor->text();
-
- if(currentFileName.isEmpty() || currentFileName == "Unnamed") {
+ qDebug(currentFileName);
+
+ if( currentFileName.isEmpty() || currentFileName == "Unnamed") {
if ( doc->name().isEmpty() ) {
@@ -712,9 +717,10 @@ 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;
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
@@ -56,5 +56,5 @@ protected:
private slots:
void setDocument(const QString&);
- void changeFont();
+ void changeFont();
void fileNew();
void fileRevert();