author | zecke <zecke> | 2003-02-11 17:49:47 (UTC) |
---|---|---|
committer | zecke <zecke> | 2003-02-11 17:49:47 (UTC) |
commit | 613ae8a0a9c82dea1332651ba4f4a8e2f06eee0b (patch) (unidiff) | |
tree | 46fd1cb0033e5d2aed86ba4e929afa337bae08be | |
parent | f84b2b2bced083c3664099d5ae99e4732388812e (diff) | |
download | opie-613ae8a0a9c82dea1332651ba4f4a8e2f06eee0b.zip opie-613ae8a0a9c82dea1332651ba4f4a8e2f06eee0b.tar.gz opie-613ae8a0a9c82dea1332651ba4f4a8e2f06eee0b.tar.bz2 |
do not allow to open directories...
-rw-r--r-- | core/apps/textedit/textedit.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp index 9ef423c..4cf1b07 100644 --- a/core/apps/textedit/textedit.cpp +++ b/core/apps/textedit/textedit.cpp | |||
@@ -576,129 +576,129 @@ void TextEdit::setFontSize(int sz, bool round_down_not_up) { | |||
576 | QFont f = editor->font(); | 576 | QFont f = editor->font(); |
577 | f.setPointSize(s); | 577 | f.setPointSize(s); |
578 | editor->setFont(f); | 578 | editor->setFont(f); |
579 | 579 | ||
580 | zin->setEnabled(s != fontsize[nfontsizes-1]); | 580 | zin->setEnabled(s != fontsize[nfontsizes-1]); |
581 | zout->setEnabled(s != fontsize[0]); | 581 | zout->setEnabled(s != fontsize[0]); |
582 | } | 582 | } |
583 | 583 | ||
584 | void TextEdit::setBold(bool y) { | 584 | void TextEdit::setBold(bool y) { |
585 | QFont f = editor->font(); | 585 | QFont f = editor->font(); |
586 | f.setBold(y); | 586 | f.setBold(y); |
587 | editor->setFont(f); | 587 | editor->setFont(f); |
588 | } | 588 | } |
589 | 589 | ||
590 | void TextEdit::setItalic(bool y) { | 590 | void TextEdit::setItalic(bool y) { |
591 | QFont f = editor->font(); | 591 | QFont f = editor->font(); |
592 | f.setItalic(y); | 592 | f.setItalic(y); |
593 | editor->setFont(f); | 593 | editor->setFont(f); |
594 | } | 594 | } |
595 | 595 | ||
596 | void TextEdit::setWordWrap(bool y) { | 596 | void TextEdit::setWordWrap(bool y) { |
597 | bool state = editor->edited(); | 597 | bool state = editor->edited(); |
598 | QString captionStr = caption(); | 598 | QString captionStr = caption(); |
599 | bool b1 = edited1; | 599 | bool b1 = edited1; |
600 | bool b2 = edited; | 600 | bool b2 = edited; |
601 | 601 | ||
602 | editor->setWordWrap(y ? QMultiLineEdit::WidgetWidth : QMultiLineEdit::NoWrap ); | 602 | editor->setWordWrap(y ? QMultiLineEdit::WidgetWidth : QMultiLineEdit::NoWrap ); |
603 | editor->setEdited( state ); | 603 | editor->setEdited( state ); |
604 | edited1=b1; | 604 | edited1=b1; |
605 | edited=b2; | 605 | edited=b2; |
606 | setCaption(captionStr); | 606 | setCaption(captionStr); |
607 | } | 607 | } |
608 | 608 | ||
609 | void TextEdit::setSearchBar(bool b) { | 609 | void TextEdit::setSearchBar(bool b) { |
610 | useSearchBar=b; | 610 | useSearchBar=b; |
611 | Config cfg("TextEdit"); | 611 | Config cfg("TextEdit"); |
612 | cfg.setGroup("View"); | 612 | cfg.setGroup("View"); |
613 | cfg.writeEntry ( "SearchBar", b ); | 613 | cfg.writeEntry ( "SearchBar", b ); |
614 | searchBarAction->setOn(b); | 614 | searchBarAction->setOn(b); |
615 | if(b) | 615 | if(b) |
616 | searchBar->show(); | 616 | searchBar->show(); |
617 | else | 617 | else |
618 | searchBar->hide(); | 618 | searchBar->hide(); |
619 | editor->setFocus(); | 619 | editor->setFocus(); |
620 | } | 620 | } |
621 | 621 | ||
622 | void TextEdit::fileNew() { | 622 | void TextEdit::fileNew() { |
623 | // if( !bFromDocView ) { | 623 | // if( !bFromDocView ) { |
624 | // saveAs(); | 624 | // saveAs(); |
625 | // } | 625 | // } |
626 | newFile(DocLnk()); | 626 | newFile(DocLnk()); |
627 | } | 627 | } |
628 | 628 | ||
629 | void TextEdit::fileOpen() { | 629 | void TextEdit::fileOpen() { |
630 | QMap<QString, QStringList> map; | 630 | QMap<QString, QStringList> map; |
631 | map.insert(tr("All"), QStringList() ); | 631 | map.insert(tr("All"), QStringList() ); |
632 | QStringList text; | 632 | QStringList text; |
633 | text << "text/*"; | 633 | text << "text/*"; |
634 | map.insert(tr("Text"), text ); | 634 | map.insert(tr("Text"), text ); |
635 | text << "*"; | 635 | text << "*"; |
636 | map.insert(tr("All"), text ); | 636 | map.insert(tr("All"), text ); |
637 | QString str = OFileDialog::getOpenFileName( 2, | 637 | QString str = OFileDialog::getOpenFileName( 2, |
638 | QPEApplication::documentDir(), | 638 | QPEApplication::documentDir(), |
639 | QString::null, map); | 639 | QString::null, map); |
640 | if( QFile(str).exists()) | 640 | if( QFile(str).exists() && !QFileInfo(str).isDir() ) |
641 | openFile( str ); | 641 | openFile( str ); |
642 | else | 642 | else |
643 | updateCaption(); | 643 | updateCaption(); |
644 | } | 644 | } |
645 | 645 | ||
646 | void TextEdit::doSearchBar() { | 646 | void TextEdit::doSearchBar() { |
647 | if(!useSearchBar) | 647 | if(!useSearchBar) |
648 | searchBar->hide(); | 648 | searchBar->hide(); |
649 | else | 649 | else |
650 | searchBar->show(); | 650 | searchBar->show(); |
651 | } | 651 | } |
652 | 652 | ||
653 | #if 0 | 653 | #if 0 |
654 | void TextEdit::slotFind() { | 654 | void TextEdit::slotFind() { |
655 | FindDialog frmFind( tr("Text Editor"), this ); | 655 | FindDialog frmFind( tr("Text Editor"), this ); |
656 | connect( &frmFind, SIGNAL(signalFindClicked(const QString &, bool, bool, int)), | 656 | connect( &frmFind, SIGNAL(signalFindClicked(const QString &, bool, bool, int)), |
657 | editor, SLOT(slotDoFind( const QString&,bool,bool))); | 657 | editor, SLOT(slotDoFind( const QString&,bool,bool))); |
658 | 658 | ||
659 | //case sensitive, backwards, [category] | 659 | //case sensitive, backwards, [category] |
660 | 660 | ||
661 | connect( editor, SIGNAL(notFound()), | 661 | connect( editor, SIGNAL(notFound()), |
662 | &frmFind, SLOT(slotNotFound()) ); | 662 | &frmFind, SLOT(slotNotFound()) ); |
663 | connect( editor, SIGNAL(searchWrapped()), | 663 | connect( editor, SIGNAL(searchWrapped()), |
664 | &frmFind, SLOT(slotWrapAround()) ); | 664 | &frmFind, SLOT(slotWrapAround()) ); |
665 | 665 | ||
666 | frmFind.exec(); | 666 | frmFind.exec(); |
667 | 667 | ||
668 | 668 | ||
669 | } | 669 | } |
670 | #endif | 670 | #endif |
671 | 671 | ||
672 | void TextEdit::fileRevert() { | 672 | void TextEdit::fileRevert() { |
673 | clear(); | 673 | clear(); |
674 | fileOpen(); | 674 | fileOpen(); |
675 | } | 675 | } |
676 | 676 | ||
677 | void TextEdit::editCut() { | 677 | void TextEdit::editCut() { |
678 | #ifndef QT_NO_CLIPBOARD | 678 | #ifndef QT_NO_CLIPBOARD |
679 | editor->cut(); | 679 | editor->cut(); |
680 | #endif | 680 | #endif |
681 | } | 681 | } |
682 | 682 | ||
683 | void TextEdit::editCopy() { | 683 | void TextEdit::editCopy() { |
684 | #ifndef QT_NO_CLIPBOARD | 684 | #ifndef QT_NO_CLIPBOARD |
685 | editor->copy(); | 685 | editor->copy(); |
686 | #endif | 686 | #endif |
687 | } | 687 | } |
688 | 688 | ||
689 | void TextEdit::editPaste() { | 689 | void TextEdit::editPaste() { |
690 | #ifndef QT_NO_CLIPBOARD | 690 | #ifndef QT_NO_CLIPBOARD |
691 | editor->paste(); | 691 | editor->paste(); |
692 | #endif | 692 | #endif |
693 | } | 693 | } |
694 | 694 | ||
695 | void TextEdit::editFind() { | 695 | void TextEdit::editFind() { |
696 | searchBar->show(); | 696 | searchBar->show(); |
697 | searchEdit->setFocus(); | 697 | searchEdit->setFocus(); |
698 | } | 698 | } |
699 | 699 | ||
700 | void TextEdit::findNext() { | 700 | void TextEdit::findNext() { |
701 | editor->find( searchEdit->text(), false, false ); | 701 | editor->find( searchEdit->text(), false, false ); |
702 | 702 | ||
703 | } | 703 | } |
704 | 704 | ||