summaryrefslogtreecommitdiff
Unidiff
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 8b3c4c6..af427ac 100644
--- a/core/apps/textedit/textedit.cpp
+++ b/core/apps/textedit/textedit.cpp
@@ -928,98 +928,99 @@ bool TextEdit::saveAs() {
928 filePerm->exec(); 928 filePerm->exec();
929 929
930 if( filePerm) 930 if( filePerm)
931 delete filePerm; 931 delete filePerm;
932 } 932 }
933// } 933// }
934 editor->setEdited( false); 934 editor->setEdited( false);
935 edited1 = false; 935 edited1 = false;
936 edited = false; 936 edited = false;
937 if(caption().left(1)=="*") 937 if(caption().left(1)=="*")
938 setCaption(caption().right(caption().length()-1)); 938 setCaption(caption().right(caption().length()-1));
939 939
940 return true; 940 return true;
941 } 941 }
942 qDebug("returning false"); 942 qDebug("returning false");
943 return false; 943 return false;
944} //end saveAs 944} //end saveAs
945 945
946void TextEdit::clear() { 946void TextEdit::clear() {
947 delete doc; 947 delete doc;
948 doc = 0; 948 doc = 0;
949 editor->clear(); 949 editor->clear();
950} 950}
951 951
952void TextEdit::updateCaption( const QString &name ) { 952void TextEdit::updateCaption( const QString &name ) {
953 953
954 if ( name.isEmpty() ) 954 if ( name.isEmpty() )
955 setCaption( tr("Text Editor") ); 955 setCaption( tr("Text Editor") );
956 else { 956 else {
957 QString s = name; 957 QString s = name;
958 if ( s.isNull() ) 958 if ( s.isNull() )
959 s = doc->name(); 959 s = doc->name();
960 if ( s.isEmpty() ) { 960 if ( s.isEmpty() ) {
961 s = tr( "Unnamed" ); 961 s = tr( "Unnamed" );
962 currentFileName=s; 962 currentFileName=s;
963 } 963 }
964// if(s.left(1) == "/") 964// if(s.left(1) == "/")
965// s = s.right(s.length()-1); 965// s = s.right(s.length()-1);
966 setCaption( s + " - " + tr("Text Editor") ); 966 setCaption( s + " - " + tr("Text Editor") );
967 } 967 }
968} 968}
969 969
970void TextEdit::setDocument(const QString& fileref) { 970void TextEdit::setDocument(const QString& fileref) {
971 if(fileref != "Unnamed") { 971 if(fileref != "Unnamed") {
972 currentFileName=fileref; 972 currentFileName=fileref;
973 qDebug("setDocument"); 973 qDebug("setDocument");
974 QFileInfo fi(currentFileName); 974 QFileInfo fi(currentFileName);
975 qDebug("basename:"+fi.baseName()+": current filenmame "+currentFileName); 975 qDebug("basename:"+fi.baseName()+": current filenmame "+currentFileName);
976 if(fi.baseName().left(1) == "") { 976 if( (fi.baseName().left(1)).isEmpty() ) {
977 // openDotFile(currentFileName); 977 openDotFile(currentFileName);
978
978 } else { 979 } else {
979 qDebug("setDoc open"); 980 qDebug("setDoc open");
980 bFromDocView = true; 981 bFromDocView = true;
981 openFile(fileref); 982 openFile(fileref);
982 editor->setEdited(true); 983 editor->setEdited(true);
983 edited1=false; 984 edited1=false;
984 edited=true; 985 edited=true;
985 // fromSetDocument=false; 986 // fromSetDocument=false;
986 // doSearchBar(); 987 // doSearchBar();
987 } 988 }
988 } 989 }
989 updateCaption( currentFileName); 990 updateCaption( currentFileName);
990} 991}
991 992
992void TextEdit::changeFont() { 993void TextEdit::changeFont() {
993 QDialog *d = new QDialog ( this, "FontDialog", true ); 994 QDialog *d = new QDialog ( this, "FontDialog", true );
994 d-> setCaption ( tr( "Choose font" )); 995 d-> setCaption ( tr( "Choose font" ));
995 QBoxLayout *lay = new QVBoxLayout ( d ); 996 QBoxLayout *lay = new QVBoxLayout ( d );
996 OFontSelector *ofs = new OFontSelector ( true, d ); 997 OFontSelector *ofs = new OFontSelector ( true, d );
997 lay-> addWidget ( ofs ); 998 lay-> addWidget ( ofs );
998 ofs-> setSelectedFont ( editor-> font ( )); 999 ofs-> setSelectedFont ( editor-> font ( ));
999 1000
1000 d-> showMaximized ( ); 1001 d-> showMaximized ( );
1001 if ( d-> exec ( ) == QDialog::Accepted ) 1002 if ( d-> exec ( ) == QDialog::Accepted )
1002 editor-> setFont ( ofs-> selectedFont ( )); 1003 editor-> setFont ( ofs-> selectedFont ( ));
1003 delete d; 1004 delete d;
1004 1005
1005} 1006}
1006 1007
1007void TextEdit::editDelete() { 1008void TextEdit::editDelete() {
1008 switch ( QMessageBox::warning(this,tr("Text Editor"), 1009 switch ( QMessageBox::warning(this,tr("Text Editor"),
1009 tr("Do you really want<BR>to <B>delete</B> " 1010 tr("Do you really want<BR>to <B>delete</B> "
1010 "the current file\nfrom the disk?<BR>This is " 1011 "the current file\nfrom the disk?<BR>This is "
1011 "<B>irreversable!!</B>"), 1012 "<B>irreversable!!</B>"),
1012 tr("Yes"),tr("No"),0,0,1) ) { 1013 tr("Yes"),tr("No"),0,0,1) ) {
1013 case 0: 1014 case 0:
1014 if(doc) { 1015 if(doc) {
1015 doc->removeFiles(); 1016 doc->removeFiles();
1016 clear(); 1017 clear();
1017 setCaption( tr("Text Editor") ); 1018 setCaption( tr("Text Editor") );
1018 } 1019 }
1019 break; 1020 break;
1020 case 1: 1021 case 1:
1021 // exit 1022 // exit
1022 break; 1023 break;
1023 }; 1024 };
1024} 1025}
1025 1026