author | llornkcor <llornkcor> | 2004-10-18 09:18:50 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2004-10-18 09:18:50 (UTC) |
commit | b4a613303322cd557915baa621d4a1cef749af59 (patch) (unidiff) | |
tree | 2bb7ba0e89ce00d0ccb408a69ae79b5c38af6b0e | |
parent | e95fcb09fc069a83b3c10c19c081873daba49831 (diff) | |
download | opie-b4a613303322cd557915baa621d4a1cef749af59.zip opie-b4a613303322cd557915baa621d4a1cef749af59.tar.gz opie-b4a613303322cd557915baa621d4a1cef749af59.tar.bz2 |
change doclnk handling
-rw-r--r-- | core/apps/textedit/textedit.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp index 571df27..cabeb20 100644 --- a/core/apps/textedit/textedit.cpp +++ b/core/apps/textedit/textedit.cpp | |||
@@ -775,35 +775,36 @@ void TextEdit::showEditTools() { | |||
775 | /*! | 775 | /*! |
776 | unprompted save */ | 776 | unprompted save */ |
777 | bool TextEdit::save() { | 777 | bool TextEdit::save() { |
778 | QString name, file; | 778 | QString name, file; |
779 | odebug << "saveAsFile " + currentFileName << oendl; | 779 | odebug << "saveAsFile " + currentFileName << oendl; |
780 | if(currentFileName.isEmpty()) { | 780 | if(currentFileName.isEmpty()) { |
781 | saveAs(); | 781 | saveAs(); |
782 | return false; | 782 | return false; |
783 | } | 783 | } |
784 | name = currentFileName; | 784 | name = currentFileName; |
785 | if(doc) { | 785 | if(doc) { |
786 | file = doc->file(); | 786 | file = doc->file(); |
787 | odebug << "saver file "+file << oendl; | 787 | odebug << "saver file "+file << oendl; |
788 | name = doc->name(); | 788 | name = doc->name(); |
789 | odebug << "File named "+name << oendl; | 789 | odebug << "File named "+name << oendl; |
790 | } else { | 790 | } else { |
791 | name = file = currentFileName; | 791 | file = currentFileName; |
792 | name = QFileInfo(currentFileName).baseName(); | ||
792 | } | 793 | } |
793 | 794 | ||
794 | QString rt = editor->text(); | 795 | QString rt = editor->text(); |
795 | if( !rt.isEmpty() ) { | 796 | if( !rt.isEmpty() ) { |
796 | if(name.isEmpty()) { | 797 | if(name.isEmpty()) { |
797 | saveAs(); | 798 | saveAs(); |
798 | } else { | 799 | } else { |
799 | currentFileName = name; | 800 | currentFileName = name; |
800 | odebug << "saveFile "+currentFileName << oendl; | 801 | odebug << "saveFile "+currentFileName << oendl; |
801 | 802 | ||
802 | struct stat buf; | 803 | struct stat buf; |
803 | mode_t mode; | 804 | mode_t mode; |
804 | stat(file.latin1(), &buf); | 805 | stat(file.latin1(), &buf); |
805 | mode = buf.st_mode; | 806 | mode = buf.st_mode; |
806 | 807 | ||
807 | if(!fileIs) { | 808 | if(!fileIs) { |
808 | doc->setName( name); | 809 | doc->setName( name); |
809 | FileManager fm; | 810 | FileManager fm; |
@@ -911,33 +912,33 @@ bool TextEdit::saveAs() { | |||
911 | if(!str.isEmpty()) { | 912 | if(!str.isEmpty()) { |
912 | QString fileNm=str; | 913 | QString fileNm=str; |
913 | 914 | ||
914 | odebug << "saving filename "+fileNm << oendl; | 915 | odebug << "saving filename "+fileNm << oendl; |
915 | QFileInfo fi(fileNm); | 916 | QFileInfo fi(fileNm); |
916 | currentFileName=fi.fileName(); | 917 | currentFileName=fi.fileName(); |
917 | if(doc) | 918 | if(doc) |
918 | // QString file = doc->file(); | 919 | // QString file = doc->file(); |
919 | // doc->removeFiles(); | 920 | // doc->removeFiles(); |
920 | delete doc; | 921 | delete doc; |
921 | DocLnk nf; | 922 | DocLnk nf; |
922 | nf.setType("text/plain"); | 923 | nf.setType("text/plain"); |
923 | nf.setFile( fileNm); | 924 | nf.setFile( fileNm); |
924 | doc = new DocLnk(nf); | 925 | doc = new DocLnk(nf); |
925 | // editor->setText(rt); | 926 | // editor->setText(rt); |
926 | odebug << "Saving file as "+currentFileName << oendl; | 927 | odebug << "Saving file as "+currentFileName << oendl; |
927 | doc->setName( currentFileName); | 928 | doc->setName( fi.baseName() /*currentFileName*/); |
928 | updateCaption( currentFileName); | 929 | updateCaption( currentFileName); |
929 | 930 | ||
930 | FileManager fm; | 931 | FileManager fm; |
931 | if ( !fm.saveFile( *doc, rt ) ) { | 932 | if ( !fm.saveFile( *doc, rt ) ) { |
932 | QMessageBox::message(tr("Text Edit"),tr("Save Failed")); | 933 | QMessageBox::message(tr("Text Edit"),tr("Save Failed")); |
933 | return false; | 934 | return false; |
934 | } | 935 | } |
935 | 936 | ||
936 | if( filePerms ) { | 937 | if( filePerms ) { |
937 | filePermissions *filePerm; | 938 | filePermissions *filePerm; |
938 | filePerm = new filePermissions(this, | 939 | filePerm = new filePermissions(this, |
939 | tr("Permissions"),true, | 940 | tr("Permissions"),true, |
940 | 0,(const QString &)fileNm); | 941 | 0,(const QString &)fileNm); |
941 | QPEApplication::execDialog( filePerm ); | 942 | QPEApplication::execDialog( filePerm ); |
942 | 943 | ||
943 | if( filePerm) | 944 | if( filePerm) |