summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-03-13 02:57:16 (UTC)
committer llornkcor <llornkcor>2002-03-13 02:57:16 (UTC)
commit13d8ac43bf8d4c6e492e57d2ab3c7353935a9365 (patch) (unidiff)
tree4efc47c39ebde1ad5bc6fe824b79d19ccb2cab7d
parentad4f318f600a00905d45a780cd100bcf1e08efaa (diff)
downloadopie-13d8ac43bf8d4c6e492e57d2ab3c7353935a9365.zip
opie-13d8ac43bf8d4c6e492e57d2ab3c7353935a9365.tar.gz
opie-13d8ac43bf8d4c6e492e57d2ab3c7353935a9365.tar.bz2
I fixed somethin
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/textedit/textedit.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp
index f031a0f..c46f089 100644
--- a/core/apps/textedit/textedit.cpp
+++ b/core/apps/textedit/textedit.cpp
@@ -490,480 +490,481 @@ void TextEdit::setBold(bool y)
490} 490}
491 491
492void TextEdit::setItalic(bool y) 492void TextEdit::setItalic(bool y)
493{ 493{
494 QFont f = editor->font(); 494 QFont f = editor->font();
495 f.setItalic(y); 495 f.setItalic(y);
496 editor->setFont(f); 496 editor->setFont(f);
497} 497}
498 498
499void TextEdit::setWordWrap(bool y) 499void TextEdit::setWordWrap(bool y)
500{ 500{
501 bool state = editor->edited(); 501 bool state = editor->edited();
502 editor->setWordWrap(y ? QMultiLineEdit::WidgetWidth : QMultiLineEdit::NoWrap ); 502 editor->setWordWrap(y ? QMultiLineEdit::WidgetWidth : QMultiLineEdit::NoWrap );
503 editor->setEdited( state ); 503 editor->setEdited( state );
504} 504}
505 505
506void TextEdit::fileNew() 506void TextEdit::fileNew()
507{ 507{
508 if( !bFromDocView ) { 508 if( !bFromDocView ) {
509 saveAs(); 509 saveAs();
510 } 510 }
511 newFile(DocLnk()); 511 newFile(DocLnk());
512} 512}
513 513
514void TextEdit::fileOpen() 514void TextEdit::fileOpen()
515{ 515{
516// if ( !save() ) { 516// if ( !save() ) {
517// if ( QMessageBox::critical( this, tr( "Out of space" ), 517// if ( QMessageBox::critical( this, tr( "Out of space" ),
518// tr( "Text Editor was unable to\n" 518// tr( "Text Editor was unable to\n"
519// "save your changes.\n" 519// "save your changes.\n"
520// "Free some space and try again.\n" 520// "Free some space and try again.\n"
521// "\nContinue anyway?" ), 521// "\nContinue anyway?" ),
522// QMessageBox::Yes|QMessageBox::Escape, 522// QMessageBox::Yes|QMessageBox::Escape,
523// QMessageBox::No|QMessageBox::Default ) 523// QMessageBox::No|QMessageBox::Default )
524// != QMessageBox::Yes ) 524// != QMessageBox::Yes )
525// return; 525// return;
526// else { 526// else {
527// delete doc; 527// delete doc;
528// doc = 0; 528// doc = 0;
529// } 529// }
530// } 530// }
531 menu->hide(); 531 menu->hide();
532 editBar->hide(); 532 editBar->hide();
533 searchBar->hide(); 533 searchBar->hide();
534 clearWState (WState_Reserved1 ); 534 clearWState (WState_Reserved1 );
535 editorStack->raiseWidget( fileSelector ); 535 editorStack->raiseWidget( fileSelector );
536 fileSelector->reread(); 536 fileSelector->reread();
537 updateCaption(); 537 updateCaption();
538} 538}
539 539
540void TextEdit::newFileOpen() 540void TextEdit::newFileOpen()
541{ 541{
542 browseForFiles=new fileBrowser(this,"Open File",TRUE,0, "*"); 542 browseForFiles=new fileBrowser(this,"Open File",TRUE,0, "*");
543 if( browseForFiles->exec() != -1 ) { 543 if( browseForFiles->exec() != -1 ) {
544 QString selFile= browseForFiles->selectedFileName; 544 QString selFile= browseForFiles->selectedFileName;
545 QStringList fileList=browseForFiles->fileList; 545 QStringList fileList=browseForFiles->fileList;
546 qDebug(selFile); 546 qDebug(selFile);
547 QStringList::ConstIterator f; 547 QStringList::ConstIterator f;
548 QString fileTemp; 548 QString fileTemp;
549 for ( f = fileList.begin(); f != fileList.end(); f++ ) { 549 for ( f = fileList.begin(); f != fileList.end(); f++ ) {
550 fileTemp = *f; 550 fileTemp = *f;
551 fileTemp.right( fileTemp.length()-5); 551 fileTemp.right( fileTemp.length()-5);
552 QString fileName = fileTemp; 552 QString fileName = fileTemp;
553 if( fileName != "Unnamed" || fileName != "Empty Text" ) { 553 if( fileName != "Unnamed" || fileName != "Empty Text" ) {
554 currentFileName = fileName; 554 currentFileName = fileName;
555 qDebug("please open "+currentFileName); 555 qDebug("please open "+currentFileName);
556 openFile(fileName ); 556 openFile(fileName );
557 } 557 }
558 } 558 }
559 } 559 }
560 delete browseForFiles; 560 delete browseForFiles;
561 editor->setEdited( FALSE); 561 editor->setEdited( FALSE);
562 edited1=FALSE; 562 edited1=FALSE;
563 edited=FALSE; 563 edited=FALSE;
564 if(caption().left(1)=="*") 564 if(caption().left(1)=="*")
565 setCaption(caption().right(caption().length()-1)); 565 setCaption(caption().right(caption().length()-1));
566} 566}
567 567
568#if 0 568#if 0
569void TextEdit::slotFind() 569void TextEdit::slotFind()
570{ 570{
571 FindDialog frmFind( "Text Editor", this ); 571 FindDialog frmFind( "Text Editor", this );
572 connect( &frmFind, SIGNAL(signalFindClicked(const QString &, bool, bool, int)), 572 connect( &frmFind, SIGNAL(signalFindClicked(const QString &, bool, bool, int)),
573 editor, SLOT(slotDoFind( const QString&,bool,bool))); 573 editor, SLOT(slotDoFind( const QString&,bool,bool)));
574 574
575 //case sensitive, backwards, [category] 575 //case sensitive, backwards, [category]
576 576
577 connect( editor, SIGNAL(notFound()), 577 connect( editor, SIGNAL(notFound()),
578 &frmFind, SLOT(slotNotFound()) ); 578 &frmFind, SLOT(slotNotFound()) );
579 connect( editor, SIGNAL(searchWrapped()), 579 connect( editor, SIGNAL(searchWrapped()),
580 &frmFind, SLOT(slotWrapAround()) ); 580 &frmFind, SLOT(slotWrapAround()) );
581 581
582 frmFind.exec(); 582 frmFind.exec();
583 583
584 584
585} 585}
586#endif 586#endif
587 587
588void TextEdit::fileRevert() 588void TextEdit::fileRevert()
589{ 589{
590 clear(); 590 clear();
591 fileOpen(); 591 fileOpen();
592} 592}
593 593
594void TextEdit::editCut() 594void TextEdit::editCut()
595{ 595{
596#ifndef QT_NO_CLIPBOARD 596#ifndef QT_NO_CLIPBOARD
597 editor->cut(); 597 editor->cut();
598#endif 598#endif
599} 599}
600 600
601void TextEdit::editCopy() 601void TextEdit::editCopy()
602{ 602{
603#ifndef QT_NO_CLIPBOARD 603#ifndef QT_NO_CLIPBOARD
604 editor->copy(); 604 editor->copy();
605#endif 605#endif
606} 606}
607 607
608void TextEdit::editPaste() 608void TextEdit::editPaste()
609{ 609{
610#ifndef QT_NO_CLIPBOARD 610#ifndef QT_NO_CLIPBOARD
611 editor->paste(); 611 editor->paste();
612#endif 612#endif
613} 613}
614 614
615void TextEdit::editFind() 615void TextEdit::editFind()
616{ 616{
617 searchBar->show(); 617 searchBar->show();
618 searchVisible = TRUE; 618 searchVisible = TRUE;
619 searchEdit->setFocus(); 619 searchEdit->setFocus();
620} 620}
621 621
622void TextEdit::findNext() 622void TextEdit::findNext()
623{ 623{
624 editor->find( searchEdit->text(), FALSE, FALSE ); 624 editor->find( searchEdit->text(), FALSE, FALSE );
625 625
626} 626}
627 627
628void TextEdit::findClose() 628void TextEdit::findClose()
629{ 629{
630 searchVisible = FALSE; 630 searchVisible = FALSE;
631 searchBar->hide(); 631 searchBar->hide();
632} 632}
633 633
634void TextEdit::search() 634void TextEdit::search()
635{ 635{
636 editor->find( searchEdit->text(), FALSE, FALSE ); 636 editor->find( searchEdit->text(), FALSE, FALSE );
637} 637}
638 638
639void TextEdit::newFile( const DocLnk &f ) 639void TextEdit::newFile( const DocLnk &f )
640{ 640{
641 DocLnk nf = f; 641 DocLnk nf = f;
642 nf.setType("text/plain"); 642 nf.setType("text/plain");
643 clear(); 643 clear();
644 editorStack->raiseWidget( editor ); 644 editorStack->raiseWidget( editor );
645 setWState (WState_Reserved1 ); 645 setWState (WState_Reserved1 );
646 editor->setFocus(); 646 editor->setFocus();
647 doc = new DocLnk(nf); 647 doc = new DocLnk(nf);
648 qDebug("newFile "+currentFileName); 648 qDebug("newFile "+currentFileName);
649 updateCaption(currentFileName); 649 updateCaption(currentFileName);
650} 650}
651 651
652void TextEdit::openFile( const QString &f ) 652void TextEdit::openFile( const QString &f )
653{ 653{
654 bFromDocView = TRUE; 654 bFromDocView = TRUE;
655 DocLnk nf; 655 DocLnk nf;
656 nf.setType("text/plain"); 656 nf.setType("text/plain");
657 nf.setFile(f); 657 nf.setFile(f);
658 currentFileName=f; 658 currentFileName=f;
659 QFileInfo fi( currentFileName); 659 QFileInfo fi( currentFileName);
660 nf.setName(fi.baseName()); 660 nf.setName(fi.baseName());
661 qDebug("openFile string"+currentFileName); 661 qDebug("openFile string"+currentFileName);
662 662
663 openFile(nf); 663 openFile(nf);
664 showEditTools(); 664 showEditTools();
665 // Show filename in caption 665 // Show filename in caption
666 QString name = f; 666 QString name = f;
667 int sep = name.findRev( '/' ); 667 int sep = name.findRev( '/' );
668 if ( sep > 0 ) 668 if ( sep > 0 )
669 name = name.mid( sep+1 ); 669 name = name.mid( sep+1 );
670 updateCaption( name ); 670 updateCaption( name );
671} 671}
672 672
673void TextEdit::openFile( const DocLnk &f ) 673void TextEdit::openFile( const DocLnk &f )
674{ 674{
675// clear(); 675// clear();
676 bFromDocView = TRUE; 676 bFromDocView = TRUE;
677 FileManager fm; 677 FileManager fm;
678 QString txt; 678 QString txt;
679 currentFileName=f.name(); 679 currentFileName=f.name();
680 qDebug("openFile doclnk " + currentFileName); 680 qDebug("openFile doclnk " + currentFileName);
681 if ( !fm.loadFile( f, txt ) ) { 681 if ( !fm.loadFile( f, txt ) ) {
682 // ####### could be a new file 682 // ####### could be a new file
683 qDebug( "Cannot open file" ); 683 qDebug( "Cannot open file" );
684 684
685 //return; 685 //return;
686 } 686 }
687 687
688 fileNew(); 688 fileNew();
689 if ( doc ) 689 if ( doc )
690 delete doc; 690 delete doc;
691 doc = new DocLnk(f); 691 doc = new DocLnk(f);
692 editor->setText(txt); 692 editor->setText(txt);
693 editor->setEdited( FALSE); 693 editor->setEdited( FALSE);
694 edited1=FALSE; 694 edited1=FALSE;
695 edited=FALSE; 695 edited=FALSE;
696 696
697 qDebug("openFile doclnk "+currentFileName); 697 qDebug("openFile doclnk "+currentFileName);
698 doc->setName(currentFileName); 698 doc->setName(currentFileName);
699 updateCaption(); 699 updateCaption();
700} 700}
701 701
702void TextEdit::showEditTools() 702void TextEdit::showEditTools()
703{ 703{
704// if ( !doc ) 704// if ( !doc )
705// close(); 705// close();
706// clear(); 706// clear();
707 fileSelector->hide(); 707 fileSelector->hide();
708 menu->show(); 708 menu->show();
709 editBar->show(); 709 editBar->show();
710 if ( searchVisible ) 710 if ( searchVisible )
711 searchBar->show(); 711 searchBar->show();
712// updateCaption(); 712// updateCaption();
713 editorStack->raiseWidget( editor ); 713 editorStack->raiseWidget( editor );
714 setWState (WState_Reserved1 ); 714 setWState (WState_Reserved1 );
715} 715}
716 716
717/*! 717/*!
718 unprompted save */ 718 unprompted save */
719bool TextEdit::save() 719bool TextEdit::save()
720{ 720{
721 QString file = doc->file(); 721 QString file = doc->file();
722 qDebug(file); 722 qDebug(file);
723 QString name= doc->name(); 723 QString name= doc->name();
724 qDebug(name); 724 qDebug(name);
725 QString rt = editor->text(); 725 QString rt = editor->text();
726 if( !rt.isEmpty() ) { 726 if( !rt.isEmpty() ) {
727 if(name.isEmpty()) { 727 if(name.isEmpty()) {
728 saveAs(); 728 saveAs();
729 } else { 729 } else {
730 currentFileName= name ; 730 currentFileName= name ;
731 qDebug("saveFile "+currentFileName); 731 qDebug("saveFile "+currentFileName);
732 732
733 struct stat buf; 733 struct stat buf;
734 mode_t mode; 734 mode_t mode;
735 stat(file.latin1(), &buf); 735 stat(file.latin1(), &buf);
736 mode = buf.st_mode; 736 mode = buf.st_mode;
737 737
738 doc->setName( name); 738 doc->setName( name);
739 FileManager fm; 739 FileManager fm;
740 if ( !fm.saveFile( *doc, rt ) ) { 740 if ( !fm.saveFile( *doc, rt ) ) {
741 return false; 741 return false;
742 } 742 }
743 editor->setEdited( FALSE); 743 editor->setEdited( FALSE);
744 edited1=FALSE; 744 edited1=FALSE;
745 edited=FALSE; 745 edited=FALSE;
746 if(caption().left(1)=="*")
746 setCaption(caption().right(caption().length()-1)); 747 setCaption(caption().right(caption().length()-1));
747 748
748 749
749 chmod( file.latin1(), mode); 750 chmod( file.latin1(), mode);
750 } 751 }
751 return true; 752 return true;
752 } 753 }
753 return false; 754 return false;
754} 755}
755 756
756/*! 757/*!
757 prompted save */ 758 prompted save */
758bool TextEdit::saveAs() 759bool TextEdit::saveAs()
759{ 760{
760// qDebug("saveAsFile "+currentFileName); 761// qDebug("saveAsFile "+currentFileName);
761 762
762 // case of nothing to save... /// there's always something to save 763 // case of nothing to save... /// there's always something to save
763// if ( !doc )//|| !bFromDocView) 764// if ( !doc )//|| !bFromDocView)
764// { 765// {
765// qDebug("no doc"); 766// qDebug("no doc");
766// return true; 767// return true;
767// } 768// }
768 if ( !editor->edited() ) { 769 if ( !editor->edited() ) {
769 delete doc; 770 delete doc;
770 doc = 0; 771 doc = 0;
771 return true; 772 return true;
772 } 773 }
773 774
774 QString rt = editor->text(); 775 QString rt = editor->text();
775 qDebug(currentFileName); 776 qDebug(currentFileName);
776 777
777 if( currentFileName.isEmpty() || currentFileName == "Unnamed") { 778 if( currentFileName.isEmpty() || currentFileName == "Unnamed") {
778 qDebug("do silly TT filename thing"); 779 qDebug("do silly TT filename thing");
779 if ( doc->name().isEmpty() ) { 780 if ( doc->name().isEmpty() ) {
780 QString pt = rt.simplifyWhiteSpace(); 781 QString pt = rt.simplifyWhiteSpace();
781 int i = pt.find( ' ' ); 782 int i = pt.find( ' ' );
782 QString docname = pt; 783 QString docname = pt;
783 if ( i > 0 ) 784 if ( i > 0 )
784 docname = pt.left( i ); 785 docname = pt.left( i );
785 // remove "." at the beginning 786 // remove "." at the beginning
786 while( docname.startsWith( "." ) ) 787 while( docname.startsWith( "." ) )
787 docname = docname.mid( 1 ); 788 docname = docname.mid( 1 );
788 docname.replace( QRegExp("/"), "_" ); 789 docname.replace( QRegExp("/"), "_" );
789 // cut the length. filenames longer than that don't make sense and something goes wrong when they get too long. 790 // cut the length. filenames longer than that don't make sense and something goes wrong when they get too long.
790 if ( docname.length() > 40 ) 791 if ( docname.length() > 40 )
791 docname = docname.left(40); 792 docname = docname.left(40);
792 if ( docname.isEmpty() ) 793 if ( docname.isEmpty() )
793 docname = "Unnamed"; 794 docname = "Unnamed";
794 doc->setName(docname); 795 doc->setName(docname);
795 currentFileName=docname; 796 currentFileName=docname;
796 } 797 }
797 } 798 }
798 799
799 800
800 fileSaveDlg=new fileSaver(this,"Save File As?",TRUE, 0, currentFileName); 801 fileSaveDlg=new fileSaver(this,"Save File As?",TRUE, 0, currentFileName);
801 qDebug("wanna save filename "+currentFileName); 802 qDebug("wanna save filename "+currentFileName);
802 fileSaveDlg->exec(); 803 fileSaveDlg->exec();
803 if( fileSaveDlg->result() == 1 ) { 804 if( fileSaveDlg->result() == 1 ) {
804 QString fileNm=fileSaveDlg->selectedFileName; 805 QString fileNm=fileSaveDlg->selectedFileName;
805 qDebug("saving filename "+fileNm); 806 qDebug("saving filename "+fileNm);
806 QFileInfo fi(fileNm); 807 QFileInfo fi(fileNm);
807 currentFileName=fi.fileName(); 808 currentFileName=fi.fileName();
808 if(doc) { 809 if(doc) {
809// QString file = doc->file(); 810// QString file = doc->file();
810// doc->removeFiles(); 811// doc->removeFiles();
811 delete doc; 812 delete doc;
812 DocLnk nf; 813 DocLnk nf;
813 nf.setType("text/plain"); 814 nf.setType("text/plain");
814 nf.setFile( fileNm); 815 nf.setFile( fileNm);
815 doc = new DocLnk(nf); 816 doc = new DocLnk(nf);
816// editor->setText(rt); 817// editor->setText(rt);
817// qDebug("openFile doclnk "+currentFileName); 818// qDebug("openFile doclnk "+currentFileName);
818 doc->setName( currentFileName); 819 doc->setName( currentFileName);
819 updateCaption( currentFileName); 820 updateCaption( currentFileName);
820 821
821 FileManager fm; 822 FileManager fm;
822 if ( !fm.saveFile( *doc, rt ) ) { 823 if ( !fm.saveFile( *doc, rt ) ) {
823 return false; 824 return false;
824 } 825 }
825 if( fileSaveDlg->filePermCheck->isChecked() ) { 826 if( fileSaveDlg->filePermCheck->isChecked() ) {
826 filePermissions *filePerm; 827 filePermissions *filePerm;
827 filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)fileNm); 828 filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)fileNm);
828 filePerm->exec(); 829 filePerm->exec();
829 830
830 if( filePerm) 831 if( filePerm)
831 delete filePerm; 832 delete filePerm;
832 } 833 }
833 } 834 }
834 } 835 }
835 editor->setEdited( FALSE); 836 editor->setEdited(TRUE);
836 edited1=FALSE; 837 edited1=FALSE;
837 edited=FALSE; 838 edited=TRUE;
838 if(caption().left(1)=="*") 839 if(caption().left(1)=="*")
839 setCaption(caption().right(caption().length()-1)); 840 setCaption(caption().right(caption().length()-1));
840 841
841 if(fileSaveDlg) 842 if(fileSaveDlg)
842 delete fileSaveDlg; 843 delete fileSaveDlg;
843 return true; 844 return true;
844} 845}
845 846
846void TextEdit::clear() 847void TextEdit::clear()
847{ 848{
848 delete doc; 849 delete doc;
849 doc = 0; 850 doc = 0;
850 editor->clear(); 851 editor->clear();
851} 852}
852 853
853void TextEdit::updateCaption( const QString &name ) 854void TextEdit::updateCaption( const QString &name )
854{ 855{
855 if ( !doc ) 856 if ( !doc )
856 setCaption( tr("Text Editor") ); 857 setCaption( tr("Text Editor") );
857 else { 858 else {
858 QString s = name; 859 QString s = name;
859 if ( s.isNull() ) 860 if ( s.isNull() )
860 s = doc->name(); 861 s = doc->name();
861 if ( s.isEmpty() ) { 862 if ( s.isEmpty() ) {
862 s = tr( "Unnamed" ); 863 s = tr( "Unnamed" );
863 currentFileName=s; 864 currentFileName=s;
864 } 865 }
865 866
866 setCaption( s + " - " + tr("Text Editor") ); 867 setCaption( s + " - " + tr("Text Editor") );
867 } 868 }
868} 869}
869 870
870void TextEdit::setDocument(const QString& fileref) 871void TextEdit::setDocument(const QString& fileref)
871{ 872{
872 bFromDocView = TRUE; 873 bFromDocView = TRUE;
873 qDebug("setDocument "+fileref); 874 qDebug("setDocument "+fileref);
874 bFromDocView = TRUE; 875 bFromDocView = TRUE;
875 if(fileref.find(".desktop",0,TRUE) == -1) { 876 if(fileref.find(".desktop",0,TRUE) == -1) {
876 openFile(fileref); 877 openFile(fileref);
877 } else { 878 } else {
878 openFile(DocLnk(fileref)); 879 openFile(DocLnk(fileref));
879 } 880 }
880 editor->setEdited(TRUE); 881 editor->setEdited(TRUE);
881 edited1=FALSE; 882 edited1=FALSE;
882 edited=TRUE; 883 edited=TRUE;
883} 884}
884 885
885void TextEdit::closeEvent( QCloseEvent *e ) 886void TextEdit::closeEvent( QCloseEvent *e )
886{ 887{
887 if ( editorStack->visibleWidget() == fileSelector && !bFromDocView ) { 888 if ( editorStack->visibleWidget() == fileSelector && !bFromDocView ) {
888 e->ignore(); 889 e->ignore();
889 repaint(); 890 repaint();
890// fileRevert(); 891// fileRevert();
891 892
892 } else { 893 } else {
893 bFromDocView = FALSE; 894 bFromDocView = FALSE;
894 e->accept(); 895 e->accept();
895 } 896 }
896} 897}
897 898
898void TextEdit::accept() 899void TextEdit::accept()
899 { 900 {
900 QString file = doc->file(); 901 QString file = doc->file();
901 if (file.find("_.txt",0,TRUE) ==-1) 902 if (file.find("_.txt",0,TRUE) ==-1)
902 save(); 903 save();
903 else { 904 else {
904 QFile(file).remove(); 905 QFile(file).remove();
905 } 906 }
906 exit(0); 907 exit(0);
907 908
908} 909}
909 910
910void TextEdit::changeFont() { 911void TextEdit::changeFont() {
911 FontDatabase fdb; 912 FontDatabase fdb;
912 QFont defaultFont=editor->font(); 913 QFont defaultFont=editor->font();
913 QFontInfo fontInfo(defaultFont); 914 QFontInfo fontInfo(defaultFont);
914 Config cfg("TextEdit"); 915 Config cfg("TextEdit");
915 cfg.setGroup("Font"); 916 cfg.setGroup("Font");
916 QString family = cfg.readEntry("Family", fontInfo.family()); 917 QString family = cfg.readEntry("Family", fontInfo.family());
917 QString style = cfg.readEntry("Style", fdb.styleString(defaultFont)); 918 QString style = cfg.readEntry("Style", fdb.styleString(defaultFont));
918 int i_size = cfg.readNumEntry("Size", fontInfo.pointSize()/10); 919 int i_size = cfg.readNumEntry("Size", fontInfo.pointSize()/10);
919 QString charSet = cfg.readEntry("CharSet", QFont::encodingName( fontInfo.charSet()) ); 920 QString charSet = cfg.readEntry("CharSet", QFont::encodingName( fontInfo.charSet()) );
920 921
921 defaultFont = fdb.font(family,style,i_size,charSet); 922 defaultFont = fdb.font(family,style,i_size,charSet);
922 923
923 FontDialog *fontDlg; 924 FontDialog *fontDlg;
924 fontDlg=new FontDialog(this,"FontDialog",TRUE); 925 fontDlg=new FontDialog(this,"FontDialog",TRUE);
925 926
926 fontDlg->exec(); 927 fontDlg->exec();
927 928
928 QFont myFont=fontDlg->selectedFont; 929 QFont myFont=fontDlg->selectedFont;
929 editor->setFont( myFont); 930 editor->setFont( myFont);
930 delete fontDlg; 931 delete fontDlg;
931 932
932} 933}
933 934
934void TextEdit::editDelete() 935void TextEdit::editDelete()
935{ 936{
936 switch ( QMessageBox::warning(this,"Text Editor","Do you really want\nto delete the current file\nfrom the disk?\nThis is irreversable!!","Yes","No",0,0,1) ) { 937 switch ( QMessageBox::warning(this,"Text Editor","Do you really want\nto delete the current file\nfrom the disk?\nThis is irreversable!!","Yes","No",0,0,1) ) {
937 case 0: 938 case 0:
938 if(doc) { 939 if(doc) {
939 doc->removeFiles(); 940 doc->removeFiles();
940 clear(); 941 clear();
941 setCaption( tr("Text Editor") ); 942 setCaption( tr("Text Editor") );
942 } 943 }
943 break; 944 break;
944 case 1: 945 case 1:
945 // exit 946 // exit
946 break; 947 break;
947 }; 948 };
948} 949}
949 950
950void TextEdit::changeStartConfig( bool b ) { 951void TextEdit::changeStartConfig( bool b ) {
951 952
952 Config cfg("TextEdit"); 953 Config cfg("TextEdit");
953 cfg.setGroup("View"); 954 cfg.setGroup("View");
954 if(b) { 955 if(b) {
955 qDebug("bool"); 956 qDebug("bool");
956 cfg.writeEntry("startNew","TRUE"); 957 cfg.writeEntry("startNew","TRUE");
957 } else { 958 } else {
958 cfg.writeEntry("startNew","FALSE"); 959 cfg.writeEntry("startNew","FALSE");
959 } 960 }
960 update(); 961 update();
961} 962}
962 963
963void TextEdit::editorChanged() { 964void TextEdit::editorChanged() {
964 if(editor->edited() && edited && !edited1) { 965 if(editor->edited() && edited && !edited1) {
965 setCaption( "*"+caption()); 966 setCaption( "*"+caption());
966 edited1=TRUE; 967 edited1=TRUE;
967 } 968 }
968 edited=TRUE; 969 edited=TRUE;
969} 970}