author | llornkcor <llornkcor> | 2002-04-14 21:40:33 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-04-14 21:40:33 (UTC) |
commit | f519bc8b0dd5e1f183b8eb2b0c7f59787afe130c (patch) (unidiff) | |
tree | 137200abe04002cbcd27176352ab2f5ec0d4f636 /core/apps/textedit/textedit.cpp | |
parent | 9c779ca27c9e44c2bae69892d060e628e5ea5bd3 (diff) | |
download | opie-f519bc8b0dd5e1f183b8eb2b0c7f59787afe130c.zip opie-f519bc8b0dd5e1f183b8eb2b0c7f59787afe130c.tar.gz opie-f519bc8b0dd5e1f183b8eb2b0c7f59787afe130c.tar.bz2 |
fixed trying to open .desktop files- give user a choice: .desktop or file linked too
Diffstat (limited to 'core/apps/textedit/textedit.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/apps/textedit/textedit.cpp | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp index cc3ccbc..834bd8c 100644 --- a/core/apps/textedit/textedit.cpp +++ b/core/apps/textedit/textedit.cpp | |||
@@ -643,18 +643,32 @@ void TextEdit::newFile( const DocLnk &f ) | |||
643 | void TextEdit::openFile( const QString &f ) | 643 | void TextEdit::openFile( const QString &f ) |
644 | { | 644 | { |
645 | 645 | qDebug("filename is "+ f); | |
646 | QString filer; | ||
646 | // bFromDocView = TRUE; | 647 | // bFromDocView = TRUE; |
648 | if(f.find(".desktop",0,TRUE)) { | ||
649 | switch ( QMessageBox::warning(this,tr("Text Editor"), | ||
650 | tr("Text Editor has detected\n you selected a .desktop file.\nOpen .desktop file or linked file?"), | ||
651 | tr(".desktop File"),tr("Link"),0,0,1) ) { | ||
652 | case 0: | ||
653 | filer = f; | ||
654 | break; | ||
655 | case 1: | ||
656 | DocLnk sf(f); | ||
657 | filer = sf.file(); | ||
658 | break; | ||
659 | } | ||
660 | } | ||
647 | DocLnk nf; | 661 | DocLnk nf; |
648 | nf.setType("text/plain"); | 662 | nf.setType("text/plain"); |
649 | nf.setFile(f); | 663 | nf.setFile(filer); |
650 | currentFileName=f; | 664 | currentFileName=filer; |
651 | QFileInfo fi( currentFileName); | 665 | QFileInfo fi( currentFileName); |
652 | nf.setName(fi.baseName()); | 666 | nf.setName(fi.baseName()); |
653 | qDebug("openFile string"+currentFileName); | 667 | qDebug("openFile string "+currentFileName); |
654 | 668 | ||
655 | openFile(nf); | 669 | openFile(nf); |
656 | showEditTools(); | 670 | showEditTools(); |
657 | // Show filename in caption | 671 | // Show filename in caption |
658 | QString name = f; | 672 | QString name = filer; |
659 | int sep = name.findRev( '/' ); | 673 | int sep = name.findRev( '/' ); |
660 | if ( sep > 0 ) | 674 | if ( sep > 0 ) |
@@ -858,10 +872,5 @@ void TextEdit::setDocument(const QString& fileref) | |||
858 | { | 872 | { |
859 | bFromDocView = TRUE; | 873 | bFromDocView = TRUE; |
860 | if(fileref.find(".desktop",0,TRUE) == -1) { | 874 | openFile(fileref); |
861 | openFile(fileref); | ||
862 | } else { | ||
863 | qDebug("is desktop file"); | ||
864 | openFile(DocLnk(fileref)); | ||
865 | } | ||
866 | editor->setEdited(TRUE); | 875 | editor->setEdited(TRUE); |
867 | edited1=FALSE; | 876 | edited1=FALSE; |