author | llornkcor <llornkcor> | 2002-12-16 04:34:10 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-12-16 04:34:10 (UTC) |
commit | d1d849bab2d54b1e9144bca1f30786882be9a464 (patch) (unidiff) | |
tree | 4a17e9dba5e5ec84cd2344f55640b262d57f0d96 | |
parent | 71f0618e5fdfe7c7f5c251fef3885ee3833d1046 (diff) | |
download | opie-d1d849bab2d54b1e9144bca1f30786882be9a464.zip opie-d1d849bab2d54b1e9144bca1f30786882be9a464.tar.gz opie-d1d849bab2d54b1e9144bca1f30786882be9a464.tar.bz2 |
work around for changing wrap changing edited state. also fixed opening dotFiles line endings
-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 af427ac..bd7cfb6 100644 --- a/core/apps/textedit/textedit.cpp +++ b/core/apps/textedit/textedit.cpp | |||
@@ -532,50 +532,57 @@ void TextEdit::setFontSize(int sz, bool round_down_not_up) { | |||
532 | } | 532 | } |
533 | 533 | ||
534 | QFont f = editor->font(); | 534 | QFont f = editor->font(); |
535 | f.setPointSize(s); | 535 | f.setPointSize(s); |
536 | editor->setFont(f); | 536 | editor->setFont(f); |
537 | 537 | ||
538 | zin->setEnabled(s != fontsize[nfontsizes-1]); | 538 | zin->setEnabled(s != fontsize[nfontsizes-1]); |
539 | zout->setEnabled(s != fontsize[0]); | 539 | zout->setEnabled(s != fontsize[0]); |
540 | } | 540 | } |
541 | 541 | ||
542 | void TextEdit::setBold(bool y) { | 542 | void TextEdit::setBold(bool y) { |
543 | QFont f = editor->font(); | 543 | QFont f = editor->font(); |
544 | f.setBold(y); | 544 | f.setBold(y); |
545 | editor->setFont(f); | 545 | editor->setFont(f); |
546 | } | 546 | } |
547 | 547 | ||
548 | void TextEdit::setItalic(bool y) { | 548 | void TextEdit::setItalic(bool y) { |
549 | QFont f = editor->font(); | 549 | QFont f = editor->font(); |
550 | f.setItalic(y); | 550 | f.setItalic(y); |
551 | editor->setFont(f); | 551 | editor->setFont(f); |
552 | } | 552 | } |
553 | 553 | ||
554 | void TextEdit::setWordWrap(bool y) { | 554 | void TextEdit::setWordWrap(bool y) { |
555 | bool state = editor->edited(); | 555 | bool state = editor->edited(); |
556 | QString captionStr = caption(); | ||
557 | bool b1 = edited1; | ||
558 | bool b2 = edited; | ||
559 | |||
556 | editor->setWordWrap(y ? QMultiLineEdit::WidgetWidth : QMultiLineEdit::NoWrap ); | 560 | editor->setWordWrap(y ? QMultiLineEdit::WidgetWidth : QMultiLineEdit::NoWrap ); |
557 | editor->setEdited( state ); | 561 | editor->setEdited( state ); |
562 | edited1=b1; | ||
563 | edited=b2; | ||
564 | setCaption(captionStr); | ||
558 | } | 565 | } |
559 | 566 | ||
560 | void TextEdit::setSearchBar(bool b) { | 567 | void TextEdit::setSearchBar(bool b) { |
561 | useSearchBar=b; | 568 | useSearchBar=b; |
562 | Config cfg("TextEdit"); | 569 | Config cfg("TextEdit"); |
563 | cfg.setGroup("View"); | 570 | cfg.setGroup("View"); |
564 | cfg.writeEntry ( "SearchBar", b ); | 571 | cfg.writeEntry ( "SearchBar", b ); |
565 | searchBarAction->setOn(b); | 572 | searchBarAction->setOn(b); |
566 | if(b) | 573 | if(b) |
567 | searchBar->show(); | 574 | searchBar->show(); |
568 | else | 575 | else |
569 | searchBar->hide(); | 576 | searchBar->hide(); |
570 | editor->setFocus(); | 577 | editor->setFocus(); |
571 | } | 578 | } |
572 | 579 | ||
573 | void TextEdit::fileNew() { | 580 | void TextEdit::fileNew() { |
574 | // if( !bFromDocView ) { | 581 | // if( !bFromDocView ) { |
575 | // saveAs(); | 582 | // saveAs(); |
576 | // } | 583 | // } |
577 | newFile(DocLnk()); | 584 | newFile(DocLnk()); |
578 | } | 585 | } |
579 | 586 | ||
580 | void TextEdit::fileOpen() { | 587 | void TextEdit::fileOpen() { |
581 | QMap<QString, QStringList> map; | 588 | QMap<QString, QStringList> map; |
@@ -663,49 +670,49 @@ void TextEdit::search() { | |||
663 | 670 | ||
664 | void TextEdit::newFile( const DocLnk &f ) { | 671 | void TextEdit::newFile( const DocLnk &f ) { |
665 | DocLnk nf = f; | 672 | DocLnk nf = f; |
666 | nf.setType("text/plain"); | 673 | nf.setType("text/plain"); |
667 | clear(); | 674 | clear(); |
668 | setWState (WState_Reserved1 ); | 675 | setWState (WState_Reserved1 ); |
669 | editor->setFocus(); | 676 | editor->setFocus(); |
670 | doc = new DocLnk(nf); | 677 | doc = new DocLnk(nf); |
671 | currentFileName = "Unnamed"; | 678 | currentFileName = "Unnamed"; |
672 | qDebug("newFile "+currentFileName); | 679 | qDebug("newFile "+currentFileName); |
673 | updateCaption( currentFileName); | 680 | updateCaption( currentFileName); |
674 | // editor->setEdited( false); | 681 | // editor->setEdited( false); |
675 | } | 682 | } |
676 | 683 | ||
677 | void TextEdit::openDotFile( const QString &f ) { | 684 | void TextEdit::openDotFile( const QString &f ) { |
678 | if(!currentFileName.isEmpty()) { | 685 | if(!currentFileName.isEmpty()) { |
679 | currentFileName=f; | 686 | currentFileName=f; |
680 | 687 | ||
681 | qDebug("openFile dotfile " + currentFileName); | 688 | qDebug("openFile dotfile " + currentFileName); |
682 | QString txt; | 689 | QString txt; |
683 | QFile file(f); | 690 | QFile file(f); |
684 | file.open(IO_ReadWrite); | 691 | file.open(IO_ReadWrite); |
685 | QTextStream t(&file); | 692 | QTextStream t(&file); |
686 | while ( !t.atEnd()) { | 693 | while ( !t.atEnd()) { |
687 | txt+=t.readLine(); | 694 | txt+=t.readLine()+"\n"; |
688 | } | 695 | } |
689 | editor->setText(txt); | 696 | editor->setText(txt); |
690 | editor->setEdited( false); | 697 | editor->setEdited( false); |
691 | edited1=false; | 698 | edited1=false; |
692 | edited=false; | 699 | edited=false; |
693 | 700 | ||
694 | 701 | ||
695 | } | 702 | } |
696 | updateCaption( currentFileName); | 703 | updateCaption( currentFileName); |
697 | } | 704 | } |
698 | 705 | ||
699 | void TextEdit::openFile( const QString &f ) { | 706 | void TextEdit::openFile( const QString &f ) { |
700 | qDebug("filename is "+ f); | 707 | qDebug("filename is "+ f); |
701 | QString filer; | 708 | QString filer; |
702 | QFileInfo fi( f); | 709 | QFileInfo fi( f); |
703 | // bFromDocView = true; | 710 | // bFromDocView = true; |
704 | if(f.find(".desktop",0,true) != -1 && !openDesktop ) { | 711 | if(f.find(".desktop",0,true) != -1 && !openDesktop ) { |
705 | switch ( QMessageBox::warning(this,tr("Text Editor"), | 712 | switch ( QMessageBox::warning(this,tr("Text Editor"), |
706 | tr("Text Editor has detected<BR>you selected a <B>.desktop</B> | 713 | tr("Text Editor has detected<BR>you selected a <B>.desktop</B> |
707 | file.<BR>Open <B>.desktop</B> file or <B>linked</B> file?"), | 714 | file.<BR>Open <B>.desktop</B> file or <B>linked</B> file?"), |
708 | tr(".desktop File"),tr("Linked Document"),0,1,1) ) { | 715 | tr(".desktop File"),tr("Linked Document"),0,1,1) ) { |
709 | case 0: | 716 | case 0: |
710 | filer = f; | 717 | filer = f; |
711 | break; | 718 | break; |