-rw-r--r-- | core/apps/textedit/textedit.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp index 1c95a97..b875228 100644 --- a/core/apps/textedit/textedit.cpp +++ b/core/apps/textedit/textedit.cpp | |||
@@ -693,55 +693,62 @@ void TextEdit::openFile( const QString &f ) { | |||
693 | qDebug("filename is "+ f); | 693 | qDebug("filename is "+ f); |
694 | QString filer; | 694 | QString filer; |
695 | QFileInfo fi( f); | 695 | QFileInfo fi( f); |
696 | // bFromDocView = true; | 696 | // bFromDocView = true; |
697 | if(f.find(".desktop",0,true) != -1 && !openDesktop ) | 697 | if(f.find(".desktop",0,true) != -1 && !openDesktop ) |
698 | { | 698 | { |
699 | switch ( QMessageBox::warning(this,tr("Text Editor"),tr("Text Editor has detected<BR>you selected a <B>.desktop</B>file.<BR>Open<B>.desktop</B> file or <B>linked</B> file?"),tr(".desktop File"),tr("Linked Document"),0,1,1) ) | 699 | switch ( QMessageBox::warning(this,tr("Text Editor"),tr("Text Editor has detected<BR>you selected a <B>.desktop</B>file.<BR>Open<B>.desktop</B> file or <B>linked</B> file?"),tr(".desktop File"),tr("Linked Document"),0,1,1) ) |
700 | { | 700 | { |
701 | case 0: //desktop | 701 | case 0: //desktop |
702 | filer = f; | 702 | filer = f; |
703 | break; | 703 | break; |
704 | case 1: //linked | 704 | case 1: //linked |
705 | DocLnk sf(f); | 705 | DocLnk sf(f); |
706 | filer = sf.file(); | 706 | filer = sf.file(); |
707 | break; | 707 | break; |
708 | }; | 708 | }; |
709 | } | 709 | } |
710 | else if(fi.baseName().left(1) == "") | 710 | else if(fi.baseName().left(1) == "") |
711 | { | 711 | { |
712 | qDebug("opening dotfile"); | 712 | qDebug("opening dotfile"); |
713 | currentFileName=f; | 713 | currentFileName=f; |
714 | openDotFile(currentFileName); | 714 | openDotFile(currentFileName); |
715 | return; | 715 | return; |
716 | } | 716 | } |
717 | else | 717 | /* |
718 | * The problem is a file where Config(f).isValid() and it does not | ||
719 | * end with .desktop will be treated as desktop file | ||
720 | */ | ||
721 | else if (f.find(".desktop",0,true) != -1 ) | ||
718 | { | 722 | { |
719 | DocLnk sf(f); | 723 | DocLnk sf(f); |
720 | filer = sf.file(); | 724 | filer = sf.file(); |
721 | if(filer.right(1) == "/") | 725 | if(filer.right(1) == "/") |
722 | filer = f; | 726 | filer = f; |
727 | |||
723 | } | 728 | } |
729 | else | ||
730 | filer = f; | ||
724 | 731 | ||
725 | DocLnk nf; | 732 | DocLnk nf; |
726 | nf.setType("text/plain"); | 733 | nf.setType("text/plain"); |
727 | nf.setFile(filer); | 734 | nf.setFile(filer); |
728 | currentFileName=filer; | 735 | currentFileName=filer; |
729 | 736 | ||
730 | nf.setName(fi.baseName()); | 737 | nf.setName(fi.baseName()); |
731 | openFile(nf); | 738 | openFile(nf); |
732 | 739 | ||
733 | qDebug("openFile string "+currentFileName); | 740 | qDebug("openFile string "+currentFileName); |
734 | 741 | ||
735 | showEditTools(); | 742 | showEditTools(); |
736 | // Show filename in caption | 743 | // Show filename in caption |
737 | QString name = filer; | 744 | QString name = filer; |
738 | int sep = name.findRev( '/' ); | 745 | int sep = name.findRev( '/' ); |
739 | if ( sep > 0 ) | 746 | if ( sep > 0 ) |
740 | name = name.mid( sep+1 ); | 747 | name = name.mid( sep+1 ); |
741 | updateCaption( name ); | 748 | updateCaption( name ); |
742 | } | 749 | } |
743 | 750 | ||
744 | void TextEdit::openFile( const DocLnk &f ) { | 751 | void TextEdit::openFile( const DocLnk &f ) { |
745 | // clear(); | 752 | // clear(); |
746 | // bFromDocView = true; | 753 | // bFromDocView = true; |
747 | FileManager fm; | 754 | FileManager fm; |