summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/textedit/textedit.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp
index dafe1dc..f031a0f 100644
--- a/core/apps/textedit/textedit.cpp
+++ b/core/apps/textedit/textedit.cpp
@@ -496,471 +496,474 @@ void TextEdit::setItalic(bool 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 setCaption(caption().right(caption().length()-1)); 746 setCaption(caption().right(caption().length()-1));
747 747
748 748
749 chmod( file.latin1(), mode); 749 chmod( file.latin1(), mode);
750 } 750 }
751 return true; 751 return true;
752 } 752 }
753 return false; 753 return false;
754} 754}
755 755
756/*! 756/*!
757 prompted save */ 757 prompted save */
758bool TextEdit::saveAs() 758bool TextEdit::saveAs()
759{ 759{
760// qDebug("saveAsFile "+currentFileName); 760// qDebug("saveAsFile "+currentFileName);
761 761
762 // case of nothing to save... /// there's always something to save 762 // case of nothing to save... /// there's always something to save
763// if ( !doc )//|| !bFromDocView) 763// if ( !doc )//|| !bFromDocView)
764// { 764// {
765// qDebug("no doc"); 765// qDebug("no doc");
766// return true; 766// return true;
767// } 767// }
768 if ( !editor->edited() ) { 768 if ( !editor->edited() ) {
769 delete doc; 769 delete doc;
770 doc = 0; 770 doc = 0;
771 return true; 771 return true;
772 } 772 }
773 773
774 QString rt = editor->text(); 774 QString rt = editor->text();
775 qDebug(currentFileName); 775 qDebug(currentFileName);
776 776
777 if( currentFileName.isEmpty() || currentFileName == "Unnamed") { 777 if( currentFileName.isEmpty() || currentFileName == "Unnamed") {
778 qDebug("do silly TT filename thing"); 778 qDebug("do silly TT filename thing");
779 if ( doc->name().isEmpty() ) { 779 if ( doc->name().isEmpty() ) {
780 QString pt = rt.simplifyWhiteSpace(); 780 QString pt = rt.simplifyWhiteSpace();
781 int i = pt.find( ' ' ); 781 int i = pt.find( ' ' );
782 QString docname = pt; 782 QString docname = pt;
783 if ( i > 0 ) 783 if ( i > 0 )
784 docname = pt.left( i ); 784 docname = pt.left( i );
785 // remove "." at the beginning 785 // remove "." at the beginning
786 while( docname.startsWith( "." ) ) 786 while( docname.startsWith( "." ) )
787 docname = docname.mid( 1 ); 787 docname = docname.mid( 1 );
788 docname.replace( QRegExp("/"), "_" ); 788 docname.replace( QRegExp("/"), "_" );
789 // cut the length. filenames longer than that don't make sense and something goes wrong when they get too long. 789 // 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 ) 790 if ( docname.length() > 40 )
791 docname = docname.left(40); 791 docname = docname.left(40);
792 if ( docname.isEmpty() ) 792 if ( docname.isEmpty() )
793 docname = "Unnamed"; 793 docname = "Unnamed";
794 doc->setName(docname); 794 doc->setName(docname);
795 currentFileName=docname; 795 currentFileName=docname;
796 } 796 }
797 } 797 }
798 798
799 799
800 fileSaveDlg=new fileSaver(this,"Save File As?",TRUE, 0, currentFileName); 800 fileSaveDlg=new fileSaver(this,"Save File As?",TRUE, 0, currentFileName);
801 qDebug("wanna save filename "+currentFileName); 801 qDebug("wanna save filename "+currentFileName);
802 fileSaveDlg->exec(); 802 fileSaveDlg->exec();
803 if( fileSaveDlg->result() == 1 ) { 803 if( fileSaveDlg->result() == 1 ) {
804 QString fileNm=fileSaveDlg->selectedFileName; 804 QString fileNm=fileSaveDlg->selectedFileName;
805 qDebug("saving filename "+fileNm); 805 qDebug("saving filename "+fileNm);
806 QFileInfo fi(fileNm); 806 QFileInfo fi(fileNm);
807 currentFileName=fi.fileName(); 807 currentFileName=fi.fileName();
808 if(doc) { 808 if(doc) {
809// QString file = doc->file(); 809// QString file = doc->file();
810// doc->removeFiles(); 810// doc->removeFiles();
811 delete doc; 811 delete doc;
812 DocLnk nf; 812 DocLnk nf;
813 nf.setType("text/plain"); 813 nf.setType("text/plain");
814 nf.setFile( fileNm); 814 nf.setFile( fileNm);
815 doc = new DocLnk(nf); 815 doc = new DocLnk(nf);
816// editor->setText(rt); 816// editor->setText(rt);
817// qDebug("openFile doclnk "+currentFileName); 817// qDebug("openFile doclnk "+currentFileName);
818 doc->setName( currentFileName); 818 doc->setName( currentFileName);
819 updateCaption( currentFileName); 819 updateCaption( currentFileName);
820 820
821 FileManager fm; 821 FileManager fm;
822 if ( !fm.saveFile( *doc, rt ) ) { 822 if ( !fm.saveFile( *doc, rt ) ) {
823 return false; 823 return false;
824 } 824 }
825 if( fileSaveDlg->filePermCheck->isChecked() ) { 825 if( fileSaveDlg->filePermCheck->isChecked() ) {
826 filePermissions *filePerm; 826 filePermissions *filePerm;
827 filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)fileNm); 827 filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)fileNm);
828 filePerm->exec(); 828 filePerm->exec();
829 829
830 if( filePerm) 830 if( filePerm)
831 delete filePerm; 831 delete filePerm;
832 } 832 }
833 } 833 }
834 } 834 }
835 editor->setEdited( FALSE); 835 editor->setEdited( FALSE);
836 edited1=FALSE; 836 edited1=FALSE;
837 edited=FALSE; 837 edited=FALSE;
838 if(caption().left(1)=="*") 838 if(caption().left(1)=="*")
839 setCaption(caption().right(caption().length()-1)); 839 setCaption(caption().right(caption().length()-1));
840 840
841 if(fileSaveDlg) 841 if(fileSaveDlg)
842 delete fileSaveDlg; 842 delete fileSaveDlg;
843 return true; 843 return true;
844} 844}
845 845
846void TextEdit::clear() 846void TextEdit::clear()
847{ 847{
848 delete doc; 848 delete doc;
849 doc = 0; 849 doc = 0;
850 editor->clear(); 850 editor->clear();
851} 851}
852 852
853void TextEdit::updateCaption( const QString &name ) 853void TextEdit::updateCaption( const QString &name )
854{ 854{
855 if ( !doc ) 855 if ( !doc )
856 setCaption( tr("Text Editor") ); 856 setCaption( tr("Text Editor") );
857 else { 857 else {
858 QString s = name; 858 QString s = name;
859 if ( s.isNull() ) 859 if ( s.isNull() )
860 s = doc->name(); 860 s = doc->name();
861 if ( s.isEmpty() ) { 861 if ( s.isEmpty() ) {
862 s = tr( "Unnamed" ); 862 s = tr( "Unnamed" );
863 currentFileName=s; 863 currentFileName=s;
864 } 864 }
865 865
866 setCaption( s + " - " + tr("Text Editor") ); 866 setCaption( s + " - " + tr("Text Editor") );
867 } 867 }
868} 868}
869 869
870void TextEdit::setDocument(const QString& fileref) 870void TextEdit::setDocument(const QString& fileref)
871{ 871{
872 bFromDocView = TRUE; 872 bFromDocView = TRUE;
873 qDebug("setDocument "+fileref); 873 qDebug("setDocument "+fileref);
874 bFromDocView = TRUE; 874 bFromDocView = TRUE;
875 if(fileref.find(".desktop",0,TRUE) == -1) { 875 if(fileref.find(".desktop",0,TRUE) == -1) {
876 openFile(fileref); 876 openFile(fileref);
877 } else { 877 } else {
878 openFile(DocLnk(fileref)); 878 openFile(DocLnk(fileref));
879 } 879 }
880 editor->setEdited(TRUE);
881 edited1=FALSE;
882 edited=TRUE;
880} 883}
881 884
882void TextEdit::closeEvent( QCloseEvent *e ) 885void TextEdit::closeEvent( QCloseEvent *e )
883{ 886{
884 if ( editorStack->visibleWidget() == fileSelector && !bFromDocView ) { 887 if ( editorStack->visibleWidget() == fileSelector && !bFromDocView ) {
885 e->ignore(); 888 e->ignore();
886 repaint(); 889 repaint();
887// fileRevert(); 890// fileRevert();
888 891
889 } else { 892 } else {
890 bFromDocView = FALSE; 893 bFromDocView = FALSE;
891 e->accept(); 894 e->accept();
892 } 895 }
893} 896}
894 897
895void TextEdit::accept() 898void TextEdit::accept()
896 { 899 {
897 QString file = doc->file(); 900 QString file = doc->file();
898 if (file.find("_.txt",0,TRUE) ==-1) 901 if (file.find("_.txt",0,TRUE) ==-1)
899 save(); 902 save();
900 else { 903 else {
901 QFile(file).remove(); 904 QFile(file).remove();
902 } 905 }
903 exit(0); 906 exit(0);
904 907
905} 908}
906 909
907void TextEdit::changeFont() { 910void TextEdit::changeFont() {
908 FontDatabase fdb; 911 FontDatabase fdb;
909 QFont defaultFont=editor->font(); 912 QFont defaultFont=editor->font();
910 QFontInfo fontInfo(defaultFont); 913 QFontInfo fontInfo(defaultFont);
911 Config cfg("TextEdit"); 914 Config cfg("TextEdit");
912 cfg.setGroup("Font"); 915 cfg.setGroup("Font");
913 QString family = cfg.readEntry("Family", fontInfo.family()); 916 QString family = cfg.readEntry("Family", fontInfo.family());
914 QString style = cfg.readEntry("Style", fdb.styleString(defaultFont)); 917 QString style = cfg.readEntry("Style", fdb.styleString(defaultFont));
915 int i_size = cfg.readNumEntry("Size", fontInfo.pointSize()/10); 918 int i_size = cfg.readNumEntry("Size", fontInfo.pointSize()/10);
916 QString charSet = cfg.readEntry("CharSet", QFont::encodingName( fontInfo.charSet()) ); 919 QString charSet = cfg.readEntry("CharSet", QFont::encodingName( fontInfo.charSet()) );
917 920
918 defaultFont = fdb.font(family,style,i_size,charSet); 921 defaultFont = fdb.font(family,style,i_size,charSet);
919 922
920 FontDialog *fontDlg; 923 FontDialog *fontDlg;
921 fontDlg=new FontDialog(this,"FontDialog",TRUE); 924 fontDlg=new FontDialog(this,"FontDialog",TRUE);
922 925
923 fontDlg->exec(); 926 fontDlg->exec();
924 927
925 QFont myFont=fontDlg->selectedFont; 928 QFont myFont=fontDlg->selectedFont;
926 editor->setFont( myFont); 929 editor->setFont( myFont);
927 delete fontDlg; 930 delete fontDlg;
928 931
929} 932}
930 933
931void TextEdit::editDelete() 934void TextEdit::editDelete()
932{ 935{
933 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) ) { 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) ) {
934 case 0: 937 case 0:
935 if(doc) { 938 if(doc) {
936 doc->removeFiles(); 939 doc->removeFiles();
937 clear(); 940 clear();
938 setCaption( tr("Text Editor") ); 941 setCaption( tr("Text Editor") );
939 } 942 }
940 break; 943 break;
941 case 1: 944 case 1:
942 // exit 945 // exit
943 break; 946 break;
944 }; 947 };
945} 948}
946 949
947void TextEdit::changeStartConfig( bool b ) { 950void TextEdit::changeStartConfig( bool b ) {
948 951
949 Config cfg("TextEdit"); 952 Config cfg("TextEdit");
950 cfg.setGroup("View"); 953 cfg.setGroup("View");
951 if(b) { 954 if(b) {
952 qDebug("bool"); 955 qDebug("bool");
953 cfg.writeEntry("startNew","TRUE"); 956 cfg.writeEntry("startNew","TRUE");
954 } else { 957 } else {
955 cfg.writeEntry("startNew","FALSE"); 958 cfg.writeEntry("startNew","FALSE");
956 } 959 }
957 update(); 960 update();
958} 961}
959 962
960void TextEdit::editorChanged() { 963void TextEdit::editorChanged() {
961 if(editor->edited() && edited && !edited1) { 964 if(editor->edited() && edited && !edited1) {
962 setCaption( "*"+caption()); 965 setCaption( "*"+caption());
963 edited1=TRUE; 966 edited1=TRUE;
964 } 967 }
965 edited=TRUE; 968 edited=TRUE;
966} 969}