-rw-r--r-- | core/apps/textedit/textedit.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp index 019ffee..197b28b 100644 --- a/core/apps/textedit/textedit.cpp +++ b/core/apps/textedit/textedit.cpp | |||
@@ -512,49 +512,49 @@ void TextEdit::fileOpen() | |||
512 | menu->hide(); | 512 | menu->hide(); |
513 | editBar->hide(); | 513 | editBar->hide(); |
514 | searchBar->hide(); | 514 | searchBar->hide(); |
515 | clearWState (WState_Reserved1 ); | 515 | clearWState (WState_Reserved1 ); |
516 | editorStack->raiseWidget( fileSelector ); | 516 | editorStack->raiseWidget( fileSelector ); |
517 | fileSelector->reread(); | 517 | fileSelector->reread(); |
518 | updateCaption(); | 518 | updateCaption(); |
519 | } | 519 | } |
520 | 520 | ||
521 | void TextEdit::newFileOpen() | 521 | void TextEdit::newFileOpen() |
522 | { | 522 | { |
523 | browseForFiles=new fileBrowser(this,"fileBrowser",TRUE,0, "*"); | 523 | browseForFiles=new fileBrowser(this,"fileBrowser",TRUE,0, "*"); |
524 | if( browseForFiles->exec() != -1 ) { | 524 | if( browseForFiles->exec() != -1 ) { |
525 | QString selFile= browseForFiles->selectedFileName; | 525 | QString selFile= browseForFiles->selectedFileName; |
526 | QStringList fileList=browseForFiles->fileList; | 526 | QStringList fileList=browseForFiles->fileList; |
527 | qDebug(selFile); | 527 | qDebug(selFile); |
528 | QStringList::ConstIterator f; | 528 | QStringList::ConstIterator f; |
529 | QString fileTemp; | 529 | QString fileTemp; |
530 | for ( f = fileList.begin(); f != fileList.end(); f++ ) { | 530 | for ( f = fileList.begin(); f != fileList.end(); f++ ) { |
531 | fileTemp = *f; | 531 | fileTemp = *f; |
532 | fileTemp.right( fileTemp.length()-5); | 532 | fileTemp.right( fileTemp.length()-5); |
533 | QString fileName = fileTemp; | 533 | QString fileName = fileTemp; |
534 | if( fileName != "Unnamed" || fileName != "Empty Text" ) { | 534 | if( fileName != "Unnamed" || fileName != "Empty Text" ) { |
535 | currentFileName = fileName; | 535 | currentFileName = fileName; |
536 | // qDebug("please open "+currentFileName); | 536 | qDebug("please open "+currentFileName); |
537 | openFile(fileName ); | 537 | openFile(fileName ); |
538 | } | 538 | } |
539 | } | 539 | } |
540 | } | 540 | } |
541 | delete browseForFiles; | 541 | delete browseForFiles; |
542 | editor->setEdited( true ); | 542 | editor->setEdited( true ); |
543 | } | 543 | } |
544 | 544 | ||
545 | #if 0 | 545 | #if 0 |
546 | void TextEdit::slotFind() | 546 | void TextEdit::slotFind() |
547 | { | 547 | { |
548 | FindDialog frmFind( "Text Editor", this ); | 548 | FindDialog frmFind( "Text Editor", this ); |
549 | connect( &frmFind, SIGNAL(signalFindClicked(const QString &, bool, bool, int)), | 549 | connect( &frmFind, SIGNAL(signalFindClicked(const QString &, bool, bool, int)), |
550 | editor, SLOT(slotDoFind( const QString&,bool,bool))); | 550 | editor, SLOT(slotDoFind( const QString&,bool,bool))); |
551 | 551 | ||
552 | //case sensitive, backwards, [category] | 552 | //case sensitive, backwards, [category] |
553 | 553 | ||
554 | connect( editor, SIGNAL(notFound()), | 554 | connect( editor, SIGNAL(notFound()), |
555 | &frmFind, SLOT(slotNotFound()) ); | 555 | &frmFind, SLOT(slotNotFound()) ); |
556 | connect( editor, SIGNAL(searchWrapped()), | 556 | connect( editor, SIGNAL(searchWrapped()), |
557 | &frmFind, SLOT(slotWrapAround()) ); | 557 | &frmFind, SLOT(slotWrapAround()) ); |
558 | 558 | ||
559 | frmFind.exec(); | 559 | frmFind.exec(); |
560 | 560 | ||
@@ -612,48 +612,50 @@ void TextEdit::search() | |||
612 | { | 612 | { |
613 | editor->find( searchEdit->text(), FALSE, FALSE ); | 613 | editor->find( searchEdit->text(), FALSE, FALSE ); |
614 | } | 614 | } |
615 | 615 | ||
616 | void TextEdit::newFile( const DocLnk &f ) | 616 | void TextEdit::newFile( const DocLnk &f ) |
617 | { | 617 | { |
618 | DocLnk nf = f; | 618 | DocLnk nf = f; |
619 | nf.setType("text/plain"); | 619 | nf.setType("text/plain"); |
620 | clear(); | 620 | clear(); |
621 | editorStack->raiseWidget( editor ); | 621 | editorStack->raiseWidget( editor ); |
622 | setWState (WState_Reserved1 ); | 622 | setWState (WState_Reserved1 ); |
623 | editor->setFocus(); | 623 | editor->setFocus(); |
624 | doc = new DocLnk(nf); | 624 | doc = new DocLnk(nf); |
625 | qDebug("newFile "+currentFileName); | 625 | qDebug("newFile "+currentFileName); |
626 | updateCaption(currentFileName); | 626 | updateCaption(currentFileName); |
627 | } | 627 | } |
628 | 628 | ||
629 | void TextEdit::openFile( const QString &f ) | 629 | void TextEdit::openFile( const QString &f ) |
630 | { | 630 | { |
631 | bFromDocView = TRUE; | 631 | bFromDocView = TRUE; |
632 | DocLnk nf; | 632 | DocLnk nf; |
633 | nf.setType("text/plain"); | 633 | nf.setType("text/plain"); |
634 | nf.setFile(f); | 634 | nf.setFile(f); |
635 | currentFileName=f; | 635 | currentFileName=f; |
636 | QFileInfo fi( currentFileName); | ||
637 | nf.setName(fi.baseName()); | ||
636 | qDebug("openFile string"+currentFileName); | 638 | qDebug("openFile string"+currentFileName); |
637 | 639 | ||
638 | openFile(nf); | 640 | openFile(nf); |
639 | showEditTools(); | 641 | showEditTools(); |
640 | // Show filename in caption | 642 | // Show filename in caption |
641 | QString name = f; | 643 | QString name = f; |
642 | int sep = name.findRev( '/' ); | 644 | int sep = name.findRev( '/' ); |
643 | if ( sep > 0 ) | 645 | if ( sep > 0 ) |
644 | name = name.mid( sep+1 ); | 646 | name = name.mid( sep+1 ); |
645 | updateCaption( name ); | 647 | updateCaption( name ); |
646 | } | 648 | } |
647 | 649 | ||
648 | void TextEdit::openFile( const DocLnk &f ) | 650 | void TextEdit::openFile( const DocLnk &f ) |
649 | { | 651 | { |
650 | // clear(); | 652 | // clear(); |
651 | bFromDocView = TRUE; | 653 | bFromDocView = TRUE; |
652 | FileManager fm; | 654 | FileManager fm; |
653 | QString txt; | 655 | QString txt; |
654 | currentFileName=f.name(); | 656 | currentFileName=f.name(); |
655 | qDebug("openFile doclnk " + currentFileName); | 657 | qDebug("openFile doclnk " + currentFileName); |
656 | if ( !fm.loadFile( f, txt ) ) { | 658 | if ( !fm.loadFile( f, txt ) ) { |
657 | // ####### could be a new file | 659 | // ####### could be a new file |
658 | qDebug( "Cannot open file" ); | 660 | qDebug( "Cannot open file" ); |
659 | 661 | ||