-rw-r--r-- | core/apps/textedit/textedit.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp index bd7cfb6..4f4f994 100644 --- a/core/apps/textedit/textedit.cpp +++ b/core/apps/textedit/textedit.cpp | |||
@@ -766,49 +766,54 @@ void TextEdit::openFile( const DocLnk &f ) { | |||
766 | delete doc; | 766 | delete doc; |
767 | doc = new DocLnk(f); | 767 | doc = new DocLnk(f); |
768 | editor->setText(txt); | 768 | editor->setText(txt); |
769 | editor->setEdited( false); | 769 | editor->setEdited( false); |
770 | edited1=false; | 770 | edited1=false; |
771 | edited=false; | 771 | edited=false; |
772 | 772 | ||
773 | doc->setName(currentFileName); | 773 | doc->setName(currentFileName); |
774 | updateCaption(); | 774 | updateCaption(); |
775 | } | 775 | } |
776 | 776 | ||
777 | void TextEdit::showEditTools() { | 777 | void TextEdit::showEditTools() { |
778 | menu->show(); | 778 | menu->show(); |
779 | editBar->show(); | 779 | editBar->show(); |
780 | if(!useSearchBar) | 780 | if(!useSearchBar) |
781 | searchBar->hide(); | 781 | searchBar->hide(); |
782 | else | 782 | else |
783 | searchBar->show(); | 783 | searchBar->show(); |
784 | setWState (WState_Reserved1 ); | 784 | setWState (WState_Reserved1 ); |
785 | } | 785 | } |
786 | 786 | ||
787 | /*! | 787 | /*! |
788 | unprompted save */ | 788 | unprompted save */ |
789 | bool TextEdit::save() { | 789 | bool TextEdit::save() { |
790 | QString file = doc->file(); | 790 | qDebug("saveAsFile " + currentFileName); |
791 | if(currentFileName.isEmpty()) { | ||
792 | saveAs(); | ||
793 | return; | ||
794 | } | ||
795 | QString file = doc->file(); | ||
791 | qDebug("saver file "+file); | 796 | qDebug("saver file "+file); |
792 | QString name= doc->name(); | 797 | QString name= doc->name(); |
793 | qDebug("File named "+name); | 798 | qDebug("File named "+name); |
794 | QString rt = editor->text(); | 799 | QString rt = editor->text(); |
795 | if( !rt.isEmpty() ) { | 800 | if( !rt.isEmpty() ) { |
796 | if(name.isEmpty()) { | 801 | if(name.isEmpty()) { |
797 | saveAs(); | 802 | saveAs(); |
798 | } else { | 803 | } else { |
799 | currentFileName= name ; | 804 | currentFileName= name ; |
800 | qDebug("saveFile "+currentFileName); | 805 | qDebug("saveFile "+currentFileName); |
801 | 806 | ||
802 | struct stat buf; | 807 | struct stat buf; |
803 | mode_t mode; | 808 | mode_t mode; |
804 | stat(file.latin1(), &buf); | 809 | stat(file.latin1(), &buf); |
805 | mode = buf.st_mode; | 810 | mode = buf.st_mode; |
806 | 811 | ||
807 | if(!fileIs) { | 812 | if(!fileIs) { |
808 | doc->setName( name); | 813 | doc->setName( name); |
809 | FileManager fm; | 814 | FileManager fm; |
810 | if ( !fm.saveFile( *doc, rt ) ) { | 815 | if ( !fm.saveFile( *doc, rt ) ) { |
811 | return false; | 816 | return false; |
812 | } | 817 | } |
813 | } else { | 818 | } else { |
814 | qDebug("regular save file"); | 819 | qDebug("regular save file"); |