-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 @@ -644,11 +644,25 @@ void TextEdit::openFile( const QString &f ) { - + qDebug("filename is "+ f); + QString filer; // bFromDocView = TRUE; + if(f.find(".desktop",0,TRUE)) { + switch ( QMessageBox::warning(this,tr("Text Editor"), + tr("Text Editor has detected\n you selected a .desktop file.\nOpen .desktop file or linked file?"), + tr(".desktop File"),tr("Link"),0,0,1) ) { + case 0: + filer = f; + break; + case 1: + DocLnk sf(f); + filer = sf.file(); + break; + } + } DocLnk nf; nf.setType("text/plain"); - nf.setFile(f); - currentFileName=f; + nf.setFile(filer); + currentFileName=filer; QFileInfo fi( currentFileName); nf.setName(fi.baseName()); - qDebug("openFile string"+currentFileName); + qDebug("openFile string "+currentFileName); @@ -657,3 +671,3 @@ void TextEdit::openFile( const QString &f ) // Show filename in caption - QString name = f; + QString name = filer; int sep = name.findRev( '/' ); @@ -859,8 +873,3 @@ void TextEdit::setDocument(const QString& fileref) bFromDocView = TRUE; - if(fileref.find(".desktop",0,TRUE) == -1) { - openFile(fileref); - } else { - qDebug("is desktop file"); - openFile(DocLnk(fileref)); - } + openFile(fileref); editor->setEdited(TRUE); |