summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/textedit/textedit.cpp158
1 files changed, 67 insertions, 91 deletions
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp
index 107695a..d61da2a 100644
--- a/core/apps/textedit/textedit.cpp
+++ b/core/apps/textedit/textedit.cpp
@@ -358,18 +358,24 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f )
358 connect( nStart, SIGNAL( toggled(bool) ), this, SLOT( changeStartConfig(bool) ) ); 358 connect( nStart, SIGNAL( toggled(bool) ), this, SLOT( changeStartConfig(bool) ) );
359 nStart->setToggleAction(TRUE); 359 nStart->setToggleAction(TRUE);
360 nStart->addTo( font ); 360 nStart->addTo( font );
361 361
362 nAdvanced = new QAction( tr("Advanced features"), QString::null, 0, this, 0 ); 362 nAdvanced = new QAction( tr("Advanced features"), QString::null, 0, this, 0 );
363 connect( nAdvanced, SIGNAL( toggled(bool) ), this, SLOT( doAdvanced(bool) ) ); 363 connect( nAdvanced, SIGNAL( toggled(bool) ), this, SLOT( doAdvanced(bool) ) );
364 nAdvanced->setToggleAction(TRUE); 364 nAdvanced->setToggleAction(TRUE);
365 nAdvanced->addTo( font ); 365 nAdvanced->addTo( font );
366 if(cfg.readBoolEntry("AdvancedFeatures")) 366
367 nAdvanced->setOn(TRUE); 367 if(cfg.readBoolEntry("AdvancedFeatures")) {
368 qDebug("using advanced features");
369 useAdvancedFeatures = true;
370 nAdvanced->setOn(TRUE);
371 } else
372 useAdvancedFeatures = false;
373
368 font->insertSeparator(); 374 font->insertSeparator();
369 375
370 font->insertItem(tr("About"), this, SLOT( doAbout()) ); 376 font->insertItem(tr("About"), this, SLOT( doAbout()) );
371 377
372 mb->insertItem( tr( "File" ), file ); 378 mb->insertItem( tr( "File" ), file );
373 mb->insertItem( tr( "Edit" ), edit ); 379 mb->insertItem( tr( "Edit" ), edit );
374 mb->insertItem( tr( "View" ), font ); 380 mb->insertItem( tr( "View" ), font );
375 381
@@ -429,47 +435,48 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f )
429 fileNew(); 435 fileNew();
430 } else { 436 } else {
431 fileOpen(); 437 fileOpen();
432 } 438 }
433 439
434 viewSelection = cfg.readNumEntry( "FileView", 0 ); 440 viewSelection = cfg.readNumEntry( "FileView", 0 );
435} 441}
436 442
437void TextEdit::cleanUp() 443TextEdit::~TextEdit() {
438{ 444}
445
446void TextEdit::cleanUp() {
439// save(); 447// save();
440 Config cfg("TextEdit"); 448 Config cfg("TextEdit");
441 cfg.setGroup("View"); 449 cfg.setGroup("View");
442 QFont f = editor->font(); 450 QFont f = editor->font();
443 cfg.writeEntry("FontSize",f.pointSize()); 451 cfg.writeEntry("FontSize",f.pointSize());
444 cfg.writeEntry("Bold",f.bold()); 452 cfg.writeEntry("Bold",f.bold());
445 cfg.writeEntry("Italic",f.italic()); 453 cfg.writeEntry("Italic",f.italic());
446 cfg.writeEntry("Wrap",editor->wordWrap() == QMultiLineEdit::WidgetWidth); 454 cfg.writeEntry("Wrap",editor->wordWrap() == QMultiLineEdit::WidgetWidth);
447 cfg.writeEntry( "FileView", viewSelection ); 455 cfg.writeEntry( "FileView", viewSelection );
448
449} 456}
450 457
451TextEdit::~TextEdit() 458
452{ 459void TextEdit::accept() {
460 if(edited1)
461 saveAs();
462 exit(0);
453} 463}
454 464
455void TextEdit::zoomIn() 465void TextEdit::zoomIn() {
456{
457 setFontSize(editor->font().pointSize()+1,FALSE); 466 setFontSize(editor->font().pointSize()+1,FALSE);
458} 467}
459 468
460void TextEdit::zoomOut() 469void TextEdit::zoomOut() {
461{
462 setFontSize(editor->font().pointSize()-1,TRUE); 470 setFontSize(editor->font().pointSize()-1,TRUE);
463} 471}
464 472
465 473
466void TextEdit::setFontSize(int sz, bool round_down_not_up) 474void TextEdit::setFontSize(int sz, bool round_down_not_up) {
467{
468 int s=10; 475 int s=10;
469 for (int i=0; i<nfontsizes; i++) { 476 for (int i=0; i<nfontsizes; i++) {
470 if ( fontsize[i] == sz ) { 477 if ( fontsize[i] == sz ) {
471 s = sz; 478 s = sz;
472 break; 479 break;
473 } else if ( round_down_not_up ) { 480 } else if ( round_down_not_up ) {
474 if ( fontsize[i] < sz ) 481 if ( fontsize[i] < sz )
475 s = fontsize[i]; 482 s = fontsize[i];
@@ -484,47 +491,42 @@ void TextEdit::setFontSize(int sz, bool round_down_not_up)
484 QFont f = editor->font(); 491 QFont f = editor->font();
485 f.setPointSize(s); 492 f.setPointSize(s);
486 editor->setFont(f); 493 editor->setFont(f);
487 494
488 zin->setEnabled(s != fontsize[nfontsizes-1]); 495 zin->setEnabled(s != fontsize[nfontsizes-1]);
489 zout->setEnabled(s != fontsize[0]); 496 zout->setEnabled(s != fontsize[0]);
490} 497}
491 498
492void TextEdit::setBold(bool y) 499void TextEdit::setBold(bool y) {
493{
494 QFont f = editor->font(); 500 QFont f = editor->font();
495 f.setBold(y); 501 f.setBold(y);
496 editor->setFont(f); 502 editor->setFont(f);
497} 503}
498 504
499void TextEdit::setItalic(bool y) 505void TextEdit::setItalic(bool y) {
500{
501 QFont f = editor->font(); 506 QFont f = editor->font();
502 f.setItalic(y); 507 f.setItalic(y);
503 editor->setFont(f); 508 editor->setFont(f);
504} 509}
505 510
506void TextEdit::setWordWrap(bool y) 511void TextEdit::setWordWrap(bool y) {
507{
508 bool state = editor->edited(); 512 bool state = editor->edited();
509 editor->setWordWrap(y ? QMultiLineEdit::WidgetWidth : QMultiLineEdit::NoWrap ); 513 editor->setWordWrap(y ? QMultiLineEdit::WidgetWidth : QMultiLineEdit::NoWrap );
510 editor->setEdited( state ); 514 editor->setEdited( state );
511} 515}
512 516
513void TextEdit::fileNew() 517void TextEdit::fileNew() {
514{
515// if( !bFromDocView ) { 518// if( !bFromDocView ) {
516// saveAs(); 519// saveAs();
517// } 520// }
518 newFile(DocLnk()); 521 newFile(DocLnk());
519} 522}
520 523
521void TextEdit::fileOpen() 524void TextEdit::fileOpen() {
522{
523 Config cfg("TextEdit"); 525 Config cfg("TextEdit");
524 cfg.setGroup("View"); 526 cfg.setGroup("View");
525 // bool b=FALSE; 527 // bool b=FALSE;
526 528
527 QMap<QString, QStringList> map; 529 QMap<QString, QStringList> map;
528 map.insert(tr("All"), QStringList() ); 530 map.insert(tr("All"), QStringList() );
529 QStringList text; 531 QStringList text;
530 text << "text/*"; 532 text << "text/*";
@@ -532,27 +534,25 @@ void TextEdit::fileOpen()
532 text << "*"; 534 text << "*";
533 map.insert(tr("All"), text ); 535 map.insert(tr("All"), text );
534 QString str = OFileDialog::getOpenFileName( 2,"/", QString::null, map); 536 QString str = OFileDialog::getOpenFileName( 2,"/", QString::null, map);
535 if(!str.isEmpty() ) 537 if(!str.isEmpty() )
536 openFile( str ); 538 openFile( str );
537 539
538} 540}
539 541
540void TextEdit::doSearchBar() 542void TextEdit::doSearchBar() {
541{
542 Config cfg("TextEdit"); 543 Config cfg("TextEdit");
543 cfg.setGroup("View"); 544 cfg.setGroup("View");
544 if(cfg.readEntry("SearchBar","Closed") != "Opened") 545 if(cfg.readEntry("SearchBar","Closed") != "Opened")
545 searchBar->hide(); 546 searchBar->hide();
546} 547}
547 548
548#if 0 549#if 0
549void TextEdit::slotFind() 550void TextEdit::slotFind() {
550{
551 FindDialog frmFind( tr("Text Editor"), this ); 551 FindDialog frmFind( tr("Text Editor"), this );
552 connect( &frmFind, SIGNAL(signalFindClicked(const QString &, bool, bool, int)), 552 connect( &frmFind, SIGNAL(signalFindClicked(const QString &, bool, bool, int)),
553 editor, SLOT(slotDoFind( const QString&,bool,bool))); 553 editor, SLOT(slotDoFind( const QString&,bool,bool)));
554 554
555 //case sensitive, backwards, [category] 555 //case sensitive, backwards, [category]
556 556
557 connect( editor, SIGNAL(notFound()), 557 connect( editor, SIGNAL(notFound()),
558 &frmFind, SLOT(slotNotFound()) ); 558 &frmFind, SLOT(slotNotFound()) );
@@ -560,91 +560,81 @@ void TextEdit::slotFind()
560 &frmFind, SLOT(slotWrapAround()) ); 560 &frmFind, SLOT(slotWrapAround()) );
561 561
562 frmFind.exec(); 562 frmFind.exec();
563 563
564 564
565} 565}
566#endif 566#endif
567 567
568void TextEdit::fileRevert() 568void TextEdit::fileRevert() {
569{
570 clear(); 569 clear();
571 fileOpen(); 570 fileOpen();
572} 571}
573 572
574void TextEdit::editCut() 573void TextEdit::editCut() {
575{
576#ifndef QT_NO_CLIPBOARD 574#ifndef QT_NO_CLIPBOARD
577 editor->cut(); 575 editor->cut();
578#endif 576#endif
579} 577}
580 578
581void TextEdit::editCopy() 579void TextEdit::editCopy() {
582{
583#ifndef QT_NO_CLIPBOARD 580#ifndef QT_NO_CLIPBOARD
584 editor->copy(); 581 editor->copy();
585#endif 582#endif
586} 583}
587 584
588void TextEdit::editPaste() 585void TextEdit::editPaste() {
589{
590#ifndef QT_NO_CLIPBOARD 586#ifndef QT_NO_CLIPBOARD
591 editor->paste(); 587 editor->paste();
592#endif 588#endif
593} 589}
594 590
595void TextEdit::editFind() 591void TextEdit::editFind() {
596{
597 searchBar->show(); 592 searchBar->show();
598 searchVisible = TRUE; 593 searchVisible = TRUE;
599 searchEdit->setFocus(); 594 searchEdit->setFocus();
600 Config cfg("TextEdit"); 595 Config cfg("TextEdit");
601 cfg.setGroup("View"); 596 cfg.setGroup("View");
602 cfg.writeEntry("SearchBar","Opened"); 597 cfg.writeEntry("SearchBar","Opened");
603 598
604} 599}
605 600
606void TextEdit::findNext() 601void TextEdit::findNext() {
607{
608 editor->find( searchEdit->text(), FALSE, FALSE ); 602 editor->find( searchEdit->text(), FALSE, FALSE );
609 603
610} 604}
611 605
612void TextEdit::findClose() 606void TextEdit::findClose() {
613{
614 searchVisible = FALSE; 607 searchVisible = FALSE;
615 searchBar->hide(); 608 searchBar->hide();
616 Config cfg("TextEdit"); 609 Config cfg("TextEdit");
617 cfg.setGroup("View"); 610 cfg.setGroup("View");
618 cfg.writeEntry("SearchBar","Closed"); 611 cfg.writeEntry("SearchBar","Closed");
619 cfg.write(); 612 cfg.write();
620} 613}
621 614
622void TextEdit::search() 615void TextEdit::search() {
623{
624 editor->find( searchEdit->text(), FALSE, FALSE ); 616 editor->find( searchEdit->text(), FALSE, FALSE );
625} 617}
626 618
627void TextEdit::newFile( const DocLnk &f ) 619void TextEdit::newFile( const DocLnk &f ) {
628{
629 DocLnk nf = f; 620 DocLnk nf = f;
630 nf.setType("text/plain"); 621 nf.setType("text/plain");
631 clear(); 622 clear();
632 setWState (WState_Reserved1 ); 623 setWState (WState_Reserved1 );
633 editor->setFocus(); 624 editor->setFocus();
634 doc = new DocLnk(nf); 625 doc = new DocLnk(nf);
635 currentFileName = "Unnamed"; 626 currentFileName = "Unnamed";
636 qDebug("newFile "+currentFileName); 627 qDebug("newFile "+currentFileName);
637 updateCaption( currentFileName); 628 updateCaption( currentFileName);
638// editor->setEdited( FALSE); 629// editor->setEdited( FALSE);
639} 630}
640 631
641void TextEdit::openFile( const QString &f ) 632void TextEdit::openFile( const QString &f ) {
642{
643 qDebug("filename is "+ f); 633 qDebug("filename is "+ f);
644 QString filer; 634 QString filer;
645// bFromDocView = TRUE; 635// bFromDocView = TRUE;
646 if(f.find(".desktop",0,TRUE) != -1 && useAdvancedFeatures) { 636 if(f.find(".desktop",0,TRUE) != -1 && useAdvancedFeatures) {
647 switch ( QMessageBox::warning(this,tr("Text Editor"), 637 switch ( QMessageBox::warning(this,tr("Text Editor"),
648 tr("Text Editor has detected\n you selected a .desktop file.\nOpen .desktop file or linked file?"), 638 tr("Text Editor has detected\n you selected a .desktop file.\nOpen .desktop file or linked file?"),
649 tr(".desktop File"),tr("Linked Document"),0,1,1) ) { 639 tr(".desktop File"),tr("Linked Document"),0,1,1) ) {
650 case 0: 640 case 0:
@@ -673,18 +663,17 @@ void TextEdit::openFile( const QString &f )
673 // Show filename in caption 663 // Show filename in caption
674 QString name = filer; 664 QString name = filer;
675 int sep = name.findRev( '/' ); 665 int sep = name.findRev( '/' );
676 if ( sep > 0 ) 666 if ( sep > 0 )
677 name = name.mid( sep+1 ); 667 name = name.mid( sep+1 );
678 updateCaption( name ); 668 updateCaption( name );
679} 669}
680 670
681void TextEdit::openFile( const DocLnk &f ) 671void TextEdit::openFile( const DocLnk &f ) {
682{
683// clear(); 672// clear();
684// bFromDocView = TRUE; 673// bFromDocView = TRUE;
685 FileManager fm; 674 FileManager fm;
686 QString txt; 675 QString txt;
687 currentFileName=f.file(); 676 currentFileName=f.file();
688 qDebug("openFile doclnk " + currentFileName); 677 qDebug("openFile doclnk " + currentFileName);
689 if ( !fm.loadFile( f, txt ) ) { 678 if ( !fm.loadFile( f, txt ) ) {
690 // ####### could be a new file 679 // ####### could be a new file
@@ -698,33 +687,31 @@ void TextEdit::openFile( const DocLnk &f )
698 editor->setEdited( FALSE); 687 editor->setEdited( FALSE);
699 edited1=FALSE; 688 edited1=FALSE;
700 edited=FALSE; 689 edited=FALSE;
701 690
702 doc->setName(currentFileName); 691 doc->setName(currentFileName);
703 updateCaption(); 692 updateCaption();
704} 693}
705 694
706void TextEdit::showEditTools() 695void TextEdit::showEditTools() {
707{
708// if ( !doc ) 696// if ( !doc )
709// close(); 697// close();
710// clear(); 698// clear();
711 menu->show(); 699 menu->show();
712 editBar->show(); 700 editBar->show();
713 if ( searchVisible ) 701 if ( searchVisible )
714 searchBar->show(); 702 searchBar->show();
715// updateCaption(); 703// updateCaption();
716 setWState (WState_Reserved1 ); 704 setWState (WState_Reserved1 );
717} 705}
718 706
719/*! 707/*!
720 unprompted save */ 708 unprompted save */
721bool TextEdit::save() 709bool TextEdit::save() {
722{
723 QString file = doc->file(); 710 QString file = doc->file();
724 qDebug("saver file "+file); 711 qDebug("saver file "+file);
725 QString name= doc->name(); 712 QString name= doc->name();
726 qDebug("File named "+name); 713 qDebug("File named "+name);
727 QString rt = editor->text(); 714 QString rt = editor->text();
728 if( !rt.isEmpty() ) { 715 if( !rt.isEmpty() ) {
729 if(name.isEmpty()) { 716 if(name.isEmpty()) {
730 saveAs(); 717 saveAs();
@@ -766,36 +753,35 @@ bool TextEdit::save()
766 } 753 }
767 return true; 754 return true;
768 } 755 }
769 return false; 756 return false;
770} 757}
771 758
772/*! 759/*!
773 prompted save */ 760 prompted save */
774bool TextEdit::saveAs() 761bool TextEdit::saveAs() {
775{ 762 qDebug("saveAsFile "+currentFileName);
776// qDebug("saveAsFile "+currentFileName); 763 // case of nothing to save...
777 // case of nothing to save... 764 if ( !doc ) {
778 if ( !doc )//|| !bFromDocView) 765//|| !bFromDocView)
779 { 766 qDebug("no doc");
780 qDebug("no doc"); 767 return true;
781 return true; 768 }
782 }
783 if ( !editor->edited() ) { 769 if ( !editor->edited() ) {
784 delete doc; 770 delete doc;
785 doc = 0; 771 doc = 0;
786 return true; 772 return true;
787 } 773 }
788 774
789 QString rt = editor->text(); 775 QString rt = editor->text();
790 qDebug(currentFileName); 776 qDebug(currentFileName);
791 777
792 if( currentFileName.isEmpty() || currentFileName == tr("Unnamed") || currentFileName == tr("Text Editor")) { 778 if( currentFileName.isEmpty() || currentFileName == tr("Unnamed") || currentFileName == tr("Text Editor")) {
793 qDebug("do silly TT filename thing"); 779// qDebug("do silly TT filename thing");
794 if ( doc->name().isEmpty() ) { 780 if ( doc->name().isEmpty() ) {
795 QString pt = rt.simplifyWhiteSpace(); 781 QString pt = rt.simplifyWhiteSpace();
796 int i = pt.find( ' ' ); 782 int i = pt.find( ' ' );
797 QString docname = pt; 783 QString docname = pt;
798 if ( i > 0 ) 784 if ( i > 0 )
799 docname = pt.left( i ); 785 docname = pt.left( i );
800 // remove "." at the beginning 786 // remove "." at the beginning
801 while( docname.startsWith( "." ) ) 787 while( docname.startsWith( "." ) )
@@ -813,17 +799,19 @@ bool TextEdit::saveAs()
813 799
814 QMap<QString, QStringList> map; 800 QMap<QString, QStringList> map;
815 map.insert(tr("All"), QStringList() ); 801 map.insert(tr("All"), QStringList() );
816 QStringList text; 802 QStringList text;
817 text << "text/*"; 803 text << "text/*";
818 map.insert(tr("Text"), text ); 804 map.insert(tr("Text"), text );
819 text << "*"; 805 text << "*";
820 map.insert(tr("All"), text ); 806 map.insert(tr("All"), text );
807
821 QString str = OFileDialog::getSaveFileName( 2,"/", QString::null, map); 808 QString str = OFileDialog::getSaveFileName( 2,"/", QString::null, map);
809
822 if(!str.isEmpty() ) { 810 if(!str.isEmpty() ) {
823 QString fileNm=str; 811 QString fileNm=str;
824 812
825 qDebug("saving filename "+fileNm); 813 qDebug("saving filename "+fileNm);
826 QFileInfo fi(fileNm); 814 QFileInfo fi(fileNm);
827 currentFileName=fi.fileName(); 815 currentFileName=fi.fileName();
828 if(doc) { 816 if(doc) {
829// QString file = doc->file(); 817// QString file = doc->file();
@@ -843,80 +831,69 @@ bool TextEdit::saveAs()
843 return false; 831 return false;
844 } 832 }
845 833
846 if( useAdvancedFeatures ) { 834 if( useAdvancedFeatures ) {
847 filePermissions *filePerm; 835 filePermissions *filePerm;
848 filePerm = new filePermissions(this, tr("Permissions"),true,0,(const QString &)fileNm); 836 filePerm = new filePermissions(this, tr("Permissions"),true,0,(const QString &)fileNm);
849 filePerm->exec(); 837 filePerm->exec();
850 838
851 if( filePerm) 839 if( filePerm)
852 delete filePerm; 840 delete filePerm;
853 } 841 }
854 } 842 }
843 editor->setEdited( false);
844 edited1 = false;
845 edited = false;
846 if(caption().left(1)=="*")
847 setCaption(caption().right(caption().length()-1));
848
849 return true;
855 } 850 }
856 editor->setEdited(TRUE); 851 qDebug("returning false");
857 edited1=FALSE; 852 return false;
858 edited=TRUE;
859 if(caption().left(1)=="*")
860 setCaption(caption().right(caption().length()-1));
861
862 return true;
863} //end saveAs 853} //end saveAs
864 854
865void TextEdit::clear() 855void TextEdit::clear() {
866{
867 delete doc; 856 delete doc;
868 doc = 0; 857 doc = 0;
869 editor->clear(); 858 editor->clear();
870} 859}
871 860
872void TextEdit::updateCaption( const QString &name ) 861void TextEdit::updateCaption( const QString &name ) {
873{
874 if ( !doc ) 862 if ( !doc )
875 setCaption( tr("Text Editor") ); 863 setCaption( tr("Text Editor") );
876 else { 864 else {
877 QString s = name; 865 QString s = name;
878 if ( s.isNull() ) 866 if ( s.isNull() )
879 s = doc->name(); 867 s = doc->name();
880 if ( s.isEmpty() ) { 868 if ( s.isEmpty() ) {
881 s = tr( "Unnamed" ); 869 s = tr( "Unnamed" );
882 currentFileName=s; 870 currentFileName=s;
883 } 871 }
884 if(s.left(1) == "/") 872 if(s.left(1) == "/")
885 s = s.right(s.length()-1); 873 s = s.right(s.length()-1);
886 setCaption( s + " - " + tr("Text Editor") ); 874 setCaption( s + " - " + tr("Text Editor") );
887 } 875 }
888} 876}
889 877
890void TextEdit::setDocument(const QString& fileref) 878void TextEdit::setDocument(const QString& fileref) {
891{
892 bFromDocView = TRUE; 879 bFromDocView = TRUE;
893 openFile(fileref); 880 openFile(fileref);
894 editor->setEdited(TRUE); 881 editor->setEdited(TRUE);
895 edited1=FALSE; 882 edited1=FALSE;
896 edited=TRUE; 883 edited=TRUE;
897 doSearchBar(); 884 doSearchBar();
898} 885}
899 886
900void TextEdit::closeEvent( QCloseEvent *e ) 887void TextEdit::closeEvent( QCloseEvent *e ) {
901{
902 bFromDocView = FALSE; 888 bFromDocView = FALSE;
903 e->accept(); 889 e->accept();
904} 890}
905 891
906void TextEdit::accept()
907 {
908 //if(caption() !="Unnamed")
909 if(edited1)
910 saveAs();
911 exit(0);
912
913}
914
915void TextEdit::changeFont() { 892void TextEdit::changeFont() {
916 FontDatabase fdb; 893 FontDatabase fdb;
917 QFont defaultFont=editor->font(); 894 QFont defaultFont=editor->font();
918 QFontInfo fontInfo(defaultFont); 895 QFontInfo fontInfo(defaultFont);
919 Config cfg("TextEdit"); 896 Config cfg("TextEdit");
920 cfg.setGroup("Font"); 897 cfg.setGroup("Font");
921 QString family = cfg.readEntry("Family", fontInfo.family()); 898 QString family = cfg.readEntry("Family", fontInfo.family());
922 QString style = cfg.readEntry("Style", fdb.styleString(defaultFont)); 899 QString style = cfg.readEntry("Style", fdb.styleString(defaultFont));
@@ -931,18 +908,17 @@ void TextEdit::changeFont() {
931 fontDlg->exec(); 908 fontDlg->exec();
932 909
933 QFont myFont=fontDlg->selectedFont; 910 QFont myFont=fontDlg->selectedFont;
934 editor->setFont( myFont); 911 editor->setFont( myFont);
935 delete fontDlg; 912 delete fontDlg;
936 913
937} 914}
938 915
939void TextEdit::editDelete() 916void TextEdit::editDelete() {
940{
941 switch ( QMessageBox::warning(this,tr("Text Editor"),tr("Do you really want\nto delete the current file\nfrom the disk?\nThis is irreversable!!"),tr("Yes"),tr("No"),0,0,1) ) { 917 switch ( QMessageBox::warning(this,tr("Text Editor"),tr("Do you really want\nto delete the current file\nfrom the disk?\nThis is irreversable!!"),tr("Yes"),tr("No"),0,0,1) ) {
942 case 0: 918 case 0:
943 if(doc) { 919 if(doc) {
944 doc->removeFiles(); 920 doc->removeFiles();
945 clear(); 921 clear();
946 setCaption( tr("Text Editor") ); 922 setCaption( tr("Text Editor") );
947 } 923 }
948 break; 924 break;