-rw-r--r-- | core/apps/textedit/textedit.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp index 209c5de..f38ea53 100644 --- a/core/apps/textedit/textedit.cpp +++ b/core/apps/textedit/textedit.cpp | |||
@@ -872,115 +872,124 @@ void TextEdit::updateCaption( const QString &name ) { | |||
872 | if ( !doc ) | 872 | if ( !doc ) |
873 | setCaption( tr("Text Editor") ); | 873 | setCaption( tr("Text Editor") ); |
874 | else { | 874 | else { |
875 | QString s = name; | 875 | QString s = name; |
876 | if ( s.isNull() ) | 876 | if ( s.isNull() ) |
877 | s = doc->name(); | 877 | s = doc->name(); |
878 | if ( s.isEmpty() ) { | 878 | if ( s.isEmpty() ) { |
879 | s = tr( "Unnamed" ); | 879 | s = tr( "Unnamed" ); |
880 | currentFileName=s; | 880 | currentFileName=s; |
881 | } | 881 | } |
882 | if(s.left(1) == "/") | 882 | if(s.left(1) == "/") |
883 | s = s.right(s.length()-1); | 883 | s = s.right(s.length()-1); |
884 | setCaption( s + " - " + tr("Text Editor") ); | 884 | setCaption( s + " - " + tr("Text Editor") ); |
885 | } | 885 | } |
886 | } | 886 | } |
887 | 887 | ||
888 | void TextEdit::setDocument(const QString& fileref) { | 888 | void TextEdit::setDocument(const QString& fileref) { |
889 | bFromDocView = TRUE; | 889 | bFromDocView = TRUE; |
890 | openFile(fileref); | 890 | openFile(fileref); |
891 | editor->setEdited(TRUE); | 891 | editor->setEdited(TRUE); |
892 | edited1=FALSE; | 892 | edited1=FALSE; |
893 | edited=TRUE; | 893 | edited=TRUE; |
894 | doSearchBar(); | 894 | doSearchBar(); |
895 | } | 895 | } |
896 | 896 | ||
897 | void TextEdit::closeEvent( QCloseEvent *e ) { | 897 | void TextEdit::closeEvent( QCloseEvent *e ) { |
898 | bFromDocView = FALSE; | 898 | bFromDocView = FALSE; |
899 | e->accept(); | 899 | e->accept(); |
900 | } | 900 | } |
901 | 901 | ||
902 | void TextEdit::changeFont() { | 902 | void TextEdit::changeFont() { |
903 | QDialog *d = new QDialog ( this, "FontDialog", true ); | 903 | QDialog *d = new QDialog ( this, "FontDialog", true ); |
904 | d-> setCaption ( tr( "Choose font" )); | 904 | d-> setCaption ( tr( "Choose font" )); |
905 | QBoxLayout *lay = new QVBoxLayout ( d ); | 905 | QBoxLayout *lay = new QVBoxLayout ( d ); |
906 | OFontSelector *ofs = new OFontSelector ( true, d ); | 906 | OFontSelector *ofs = new OFontSelector ( true, d ); |
907 | lay-> addWidget ( ofs ); | 907 | lay-> addWidget ( ofs ); |
908 | ofs-> setSelectedFont ( editor-> font ( )); | 908 | ofs-> setSelectedFont ( editor-> font ( )); |
909 | 909 | ||
910 | d-> showMaximized ( ); | 910 | d-> showMaximized ( ); |
911 | if ( d-> exec ( ) == QDialog::Accepted ) | 911 | if ( d-> exec ( ) == QDialog::Accepted ) |
912 | editor-> setFont ( ofs-> selectedFont ( )); | 912 | editor-> setFont ( ofs-> selectedFont ( )); |
913 | delete d; | 913 | delete d; |
914 | 914 | ||
915 | } | 915 | } |
916 | 916 | ||
917 | void TextEdit::editDelete() { | 917 | void TextEdit::editDelete() { |
918 | switch ( QMessageBox::warning(this,tr("Text Editor"),tr("Do you really want<BR>to <B>delete</B> the current file\nfrom the disk?<BR>This is <B>irreversable!!</B>"),tr("Yes"),tr("No"),0,0,1) ) { | 918 | switch ( QMessageBox::warning(this,tr("Text Editor"),tr("Do you really want<BR>to <B>delete</B> the current file\nfrom the disk?<BR>This is <B>irreversable!!</B>"),tr("Yes"),tr("No"),0,0,1) ) { |
919 | case 0: | 919 | case 0: |
920 | if(doc) { | 920 | if(doc) { |
921 | doc->removeFiles(); | 921 | doc->removeFiles(); |
922 | clear(); | 922 | clear(); |
923 | setCaption( tr("Text Editor") ); | 923 | setCaption( tr("Text Editor") ); |
924 | } | 924 | } |
925 | break; | 925 | break; |
926 | case 1: | 926 | case 1: |
927 | // exit | 927 | // exit |
928 | break; | 928 | break; |
929 | }; | 929 | }; |
930 | } | 930 | } |
931 | 931 | ||
932 | void TextEdit::changeStartConfig( bool b ) { | 932 | void TextEdit::changeStartConfig( bool b ) { |
933 | 933 | ||
934 | Config cfg("TextEdit"); | 934 | Config cfg("TextEdit"); |
935 | cfg.setGroup("View"); | 935 | cfg.setGroup("View"); |
936 | if(b) { | 936 | if(b) { |
937 | qDebug("bool"); | 937 | qDebug("bool"); |
938 | cfg.writeEntry("startNew","TRUE"); | 938 | cfg.writeEntry("startNew","TRUE"); |
939 | } else { | 939 | } else { |
940 | cfg.writeEntry("startNew","FALSE"); | 940 | cfg.writeEntry("startNew","FALSE"); |
941 | } | 941 | } |
942 | update(); | 942 | update(); |
943 | } | 943 | } |
944 | 944 | ||
945 | void TextEdit::editorChanged() { | 945 | void TextEdit::editorChanged() { |
946 | if(editor->edited() && edited && !edited1) { | 946 | if(editor->edited() && edited && !edited1) { |
947 | setCaption( "*"+caption()); | 947 | setCaption( "*"+caption()); |
948 | edited1=TRUE; | 948 | edited1=TRUE; |
949 | } | 949 | } |
950 | edited=TRUE; | 950 | edited=TRUE; |
951 | } | 951 | } |
952 | 952 | ||
953 | void TextEdit::receive(const QCString&msg, const QByteArray&) { | 953 | void TextEdit::receive(const QCString&msg, const QByteArray&) { |
954 | qDebug("QCop "+msg); | 954 | qDebug("QCop "+msg); |
955 | if ( msg == "setDocument(QString)" ) { | 955 | if ( msg == "setDocument(QString)" ) { |
956 | qDebug("bugger all"); | 956 | qDebug("bugger all"); |
957 | } | 957 | } |
958 | 958 | ||
959 | } | 959 | } |
960 | void TextEdit::doAbout() { | 960 | void TextEdit::doAbout() { |
961 | QMessageBox::about(0,tr("Text Edit"),tr("Text Edit is copyright<BR>" | 961 | QMessageBox::about(0,tr("Text Edit"),tr("Text Edit is copyright<BR>" |
962 | "2000 Trolltech AS, and<BR>" | 962 | "2000 Trolltech AS, and<BR>" |
963 | "2002 by <B>L. J. Potter <BR>llornkcor@handhelds.org</B><BR>" | 963 | "2002 by <B>L. J. Potter <BR>llornkcor@handhelds.org</B><BR>" |
964 | "and is licensed under the GPL")); | 964 | "and is licensed under the GPL")); |
965 | } | 965 | } |
966 | 966 | ||
967 | void TextEdit::doPrompt(bool b) { | 967 | void TextEdit::doPrompt(bool b) { |
968 | promptExit=b; | 968 | promptExit=b; |
969 | Config cfg("TextEdit"); | ||
970 | cfg.setGroup ( "View" ); | ||
971 | cfg.writeEntry ( "PromptExit", b); | ||
969 | } | 972 | } |
970 | 973 | ||
971 | void TextEdit::doDesktop(bool b) { | 974 | void TextEdit::doDesktop(bool b) { |
972 | openDesktop=b; | 975 | openDesktop=b; |
976 | Config cfg("TextEdit"); | ||
977 | cfg.setGroup ( "View" ); | ||
978 | cfg.writeEntry ( "OpenDesktop", b); | ||
973 | } | 979 | } |
974 | 980 | ||
975 | void TextEdit::doFilePerms(bool b) { | 981 | void TextEdit::doFilePerms(bool b) { |
976 | filePerms=b; | 982 | filePerms=b; |
983 | Config cfg("TextEdit"); | ||
984 | cfg.setGroup ( "View" ); | ||
985 | cfg.writeEntry ( "FilePermissions", b); | ||
977 | } | 986 | } |
978 | 987 | ||
979 | void TextEdit::editPasteTimeDate() { | 988 | void TextEdit::editPasteTimeDate() { |
980 | #ifndef QT_NO_CLIPBOARD | 989 | #ifndef QT_NO_CLIPBOARD |
981 | QClipboard *cb = QApplication::clipboard(); | 990 | QClipboard *cb = QApplication::clipboard(); |
982 | QDateTime dt = QDateTime::currentDateTime(); | 991 | QDateTime dt = QDateTime::currentDateTime(); |
983 | cb->setText( dt.toString()); | 992 | cb->setText( dt.toString()); |
984 | editor->paste(); | 993 | editor->paste(); |
985 | #endif | 994 | #endif |
986 | } | 995 | } |