author | llornkcor <llornkcor> | 2002-02-18 14:52:54 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-02-18 14:52:54 (UTC) |
commit | 00f89d28e669140eb50f1f220c389f88fba1105c (patch) (unidiff) | |
tree | deb87bb87d855bbacddc79d8a0a79edfb1cf1cd8 /core/apps/textedit/textedit.cpp | |
parent | 9741205aa0b0892b870d2b7df7c5dd7e25b0bb18 (diff) | |
download | opie-00f89d28e669140eb50f1f220c389f88fba1105c.zip opie-00f89d28e669140eb50f1f220c389f88fba1105c.tar.gz opie-00f89d28e669140eb50f1f220c389f88fba1105c.tar.bz2 |
fixed filesave and fileopen cancel
Diffstat (limited to 'core/apps/textedit/textedit.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | core/apps/textedit/textedit.cpp | 22 |
1 files changed, 14 insertions, 8 deletions
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) | |||
485 | 485 | ||
486 | void TextEdit::fileNew() | 486 | void TextEdit::fileNew() |
487 | { | 487 | { |
488 | if( !bFromDocView ) { | ||
488 | save(); | 489 | save(); |
490 | } | ||
489 | newFile(DocLnk()); | 491 | newFile(DocLnk()); |
490 | } | 492 | } |
491 | 493 | ||
@@ -512,14 +514,14 @@ void TextEdit::fileOpen() | |||
512 | clearWState (WState_Reserved1 ); | 514 | clearWState (WState_Reserved1 ); |
513 | editorStack->raiseWidget( fileSelector ); | 515 | editorStack->raiseWidget( fileSelector ); |
514 | fileSelector->reread(); | 516 | fileSelector->reread(); |
515 | updateCaption(); | 517 | updateCaption(currentFileName); |
516 | } | 518 | } |
517 | 519 | ||
518 | void TextEdit::newFileOpen() | 520 | void TextEdit::newFileOpen() |
519 | { | 521 | { |
520 | fileBrowser *browseForFiles; | 522 | fileBrowser *browseForFiles; |
521 | browseForFiles=new fileBrowser(this,"fileBrowser",TRUE,0, "*"); | 523 | browseForFiles=new fileBrowser(this,"fileBrowser",TRUE,0, "*"); |
522 | browseForFiles->exec(); | 524 | if( browseForFiles->exec()!= 0 ) { |
523 | QString selFile= browseForFiles->selectedFileName; | 525 | QString selFile= browseForFiles->selectedFileName; |
524 | QStringList fileList=browseForFiles->fileList; | 526 | QStringList fileList=browseForFiles->fileList; |
525 | qDebug(selFile); | 527 | qDebug(selFile); |
@@ -531,10 +533,11 @@ void TextEdit::newFileOpen() | |||
531 | QString fileName = fileTemp; | 533 | QString fileName = fileTemp; |
532 | if( fileName != "Unnamed" || fileName != "Empty Text" ) { | 534 | if( fileName != "Unnamed" || fileName != "Empty Text" ) { |
533 | currentFileName = fileName; | 535 | currentFileName = fileName; |
534 | qDebug("please open "+currentFileName); | 536 | // qDebug("please open "+currentFileName); |
535 | openFile(fileName ); | 537 | openFile(fileName ); |
536 | } | 538 | } |
537 | } | 539 | } |
540 | } | ||
538 | delete browseForFiles; | 541 | delete browseForFiles; |
539 | 542 | ||
540 | } | 543 | } |
@@ -619,7 +622,7 @@ void TextEdit::newFile( const DocLnk &f ) | |||
619 | setWState (WState_Reserved1 ); | 622 | setWState (WState_Reserved1 ); |
620 | editor->setFocus(); | 623 | editor->setFocus(); |
621 | doc = new DocLnk(nf); | 624 | doc = new DocLnk(nf); |
622 | updateCaption(); | 625 | // updateCaption(); |
623 | } | 626 | } |
624 | 627 | ||
625 | void TextEdit::openFile( const QString &f ) | 628 | void TextEdit::openFile( const QString &f ) |
@@ -641,6 +644,7 @@ void TextEdit::openFile( const QString &f ) | |||
641 | void TextEdit::openFile( const DocLnk &f ) | 644 | void TextEdit::openFile( const DocLnk &f ) |
642 | { | 645 | { |
643 | // clear(); | 646 | // clear(); |
647 | bFromDocView = TRUE; | ||
644 | FileManager fm; | 648 | FileManager fm; |
645 | QString txt; | 649 | QString txt; |
646 | if ( !fm.loadFile( f, txt ) ) { | 650 | if ( !fm.loadFile( f, txt ) ) { |
@@ -656,7 +660,7 @@ void TextEdit::openFile( const DocLnk &f ) | |||
656 | doc = new DocLnk(f); | 660 | doc = new DocLnk(f); |
657 | editor->setText(txt); | 661 | editor->setText(txt); |
658 | editor->setEdited(FALSE); | 662 | editor->setEdited(FALSE); |
659 | updateCaption(); | 663 | updateCaption(currentFileName); |
660 | } | 664 | } |
661 | 665 | ||
662 | void TextEdit::showEditTools() | 666 | void TextEdit::showEditTools() |
@@ -669,7 +673,7 @@ void TextEdit::showEditTools() | |||
669 | editBar->show(); | 673 | editBar->show(); |
670 | if ( searchVisible ) | 674 | if ( searchVisible ) |
671 | searchBar->show(); | 675 | searchBar->show(); |
672 | updateCaption(); | 676 | // updateCaption(); |
673 | editorStack->raiseWidget( editor ); | 677 | editorStack->raiseWidget( editor ); |
674 | setWState (WState_Reserved1 ); | 678 | setWState (WState_Reserved1 ); |
675 | } | 679 | } |
@@ -686,6 +690,7 @@ bool TextEdit::save() | |||
686 | } | 690 | } |
687 | 691 | ||
688 | QString rt = editor->text(); | 692 | QString rt = editor->text(); |
693 | qDebug(currentFileName); | ||
689 | 694 | ||
690 | if(currentFileName.isEmpty() || currentFileName == "Unnamed") { | 695 | if(currentFileName.isEmpty() || currentFileName == "Unnamed") { |
691 | 696 | ||
@@ -711,11 +716,12 @@ bool TextEdit::save() | |||
711 | 716 | ||
712 | fileSaver *fileSaveDlg; | 717 | fileSaver *fileSaveDlg; |
713 | fileSaveDlg=new fileSaver(this,"SaveFile",TRUE,0, currentFileName); | 718 | fileSaveDlg=new fileSaver(this,"SaveFile",TRUE,0, currentFileName); |
714 | fileSaveDlg->exec(); | 719 | if( fileSaveDlg->exec() != 0 ) { |
715 | QString fileNm=fileSaveDlg->selectedFileName; | 720 | QString fileNm=fileSaveDlg->selectedFileName; |
716 | qDebug("save filename "+fileNm); | 721 | qDebug("save filename "+fileNm); |
717 | doc->setName(fileNm); | 722 | doc->setName(fileNm); |
718 | updateCaption(); | 723 | updateCaption(fileNm); |
724 | } | ||
719 | delete fileSaveDlg; | 725 | delete fileSaveDlg; |
720 | 726 | ||
721 | FileManager fm; | 727 | FileManager fm; |