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
@@ -832,96 +832,99 @@ bool TextEdit::saveAs()
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;