summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-04-17 23:27:59 (UTC)
committer llornkcor <llornkcor>2002-04-17 23:27:59 (UTC)
commit025156262b9bcab1e484347fe89657671f8f951f (patch) (side-by-side diff)
tree1d80440bb9c954de4efb92afe30c7441aa85f92c
parent7b19e1d98d5acf01102ac057ec077fc036c034c6 (diff)
downloadopie-025156262b9bcab1e484347fe89657671f8f951f.zip
opie-025156262b9bcab1e484347fe89657671f8f951f.tar.gz
opie-025156262b9bcab1e484347fe89657671f8f951f.tar.bz2
bug fix
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/textedit/textedit.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp
index 834bd8c..18402d4 100644
--- a/core/apps/textedit/textedit.cpp
+++ b/core/apps/textedit/textedit.cpp
@@ -492,27 +492,24 @@ void TextEdit::setWordWrap(bool y)
}
void TextEdit::fileNew()
{
// if( !bFromDocView ) {
// saveAs();
// }
newFile(DocLnk());
}
void TextEdit::fileOpen()
{
- // OFileSelector *fileSelector;
- // fileSelector = new OFileSelector( this, 1,1,"/","", "text/*");
- //fileSelector->showMaximized();
QString str = OFileDialog::getOpenFileName(1,"/","", QStringList() , this );
if(!str.isEmpty() )
openFile( str );
// browseForFiles = new fileBrowser(this,tr("Open File"),TRUE,0, "text/*"); //
// browseForFiles->setFileView( viewSelection );
// browseForFiles->showMaximized();
// // if( result != -1 )
// if( browseForFiles->exec() != -1 ) {
// QString selFile = browseForFiles->selectedFileName;
// QStringList fileList = browseForFiles->fileList;
// qDebug(selFile);
@@ -636,62 +633,64 @@ void TextEdit::newFile( const DocLnk &f )
doc = new DocLnk(nf);
currentFileName = "Unnamed";
qDebug("newFile "+currentFileName);
updateCaption( currentFileName);
// editor->setEdited( FALSE);
}
void TextEdit::openFile( const QString &f )
{
qDebug("filename is "+ f);
QString filer;
// bFromDocView = TRUE;
- if(f.find(".desktop",0,TRUE)) {
+ if(f.find(".desktop",0,TRUE) != -1) {
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) ) {
+ tr("Text Editor has detected\n you selected a .desktop file.\nOpen .desktop file or linked file?"),
+ tr(".desktop File"),tr("Linked Document"),0,1,1) ) {
case 0:
filer = f;
break;
case 1:
DocLnk sf(f);
filer = sf.file();
break;
}
- }
+ } else
+ filer = f;
+
DocLnk nf;
nf.setType("text/plain");
nf.setFile(filer);
currentFileName=filer;
QFileInfo fi( currentFileName);
nf.setName(fi.baseName());
qDebug("openFile string "+currentFileName);
openFile(nf);
showEditTools();
// Show filename in caption
QString name = filer;
int sep = name.findRev( '/' );
if ( sep > 0 )
name = name.mid( sep+1 );
updateCaption( name );
}
void TextEdit::openFile( const DocLnk &f )
{
// clear();
// bFromDocView = TRUE;
FileManager fm;
QString txt;
- currentFileName=f.name();
+ currentFileName=f.file();
qDebug("openFile doclnk " + currentFileName);
if ( !fm.loadFile( f, txt ) ) {
// ####### could be a new file
qDebug( "Cannot open file" );
}
// fileNew();
if ( doc )
delete doc;
doc = new DocLnk(f);
editor->setText(txt);
editor->setEdited( FALSE);
edited1=FALSE;