-rw-r--r-- | core/apps/textedit/textedit.cpp | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp index d61da2a..8eaafce 100644 --- a/core/apps/textedit/textedit.cpp +++ b/core/apps/textedit/textedit.cpp | |||
@@ -438,29 +438,31 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f ) | |||
438 | } | 438 | } |
439 | 439 | ||
440 | viewSelection = cfg.readNumEntry( "FileView", 0 ); | 440 | viewSelection = cfg.readNumEntry( "FileView", 0 ); |
441 | } | 441 | } |
442 | 442 | ||
443 | TextEdit::~TextEdit() { | 443 | TextEdit::~TextEdit() { |
444 | if( edited1 & !useAdvancedFeatures ) | ||
445 | saveAs(); | ||
444 | } | 446 | } |
445 | 447 | ||
446 | void TextEdit::cleanUp() { | 448 | void TextEdit::cleanUp() { |
447 | // save(); | 449 | qDebug("cleanUp");// save(); |
448 | Config cfg("TextEdit"); | 450 | Config cfg("TextEdit"); |
449 | cfg.setGroup("View"); | 451 | cfg.setGroup("View"); |
450 | QFont f = editor->font(); | 452 | QFont f = editor->font(); |
451 | cfg.writeEntry("FontSize",f.pointSize()); | 453 | cfg.writeEntry("FontSize",f.pointSize()); |
452 | cfg.writeEntry("Bold",f.bold()); | 454 | cfg.writeEntry("Bold",f.bold()); |
453 | cfg.writeEntry("Italic",f.italic()); | 455 | cfg.writeEntry("Italic",f.italic()); |
454 | cfg.writeEntry("Wrap",editor->wordWrap() == QMultiLineEdit::WidgetWidth); | 456 | cfg.writeEntry("Wrap",editor->wordWrap() == QMultiLineEdit::WidgetWidth); |
455 | cfg.writeEntry( "FileView", viewSelection ); | 457 | cfg.writeEntry( "FileView", viewSelection ); |
456 | } | 458 | } |
457 | 459 | ||
458 | 460 | ||
459 | void TextEdit::accept() { | 461 | void TextEdit::accept() { |
460 | if(edited1) | 462 | if( edited1) |
461 | saveAs(); | 463 | saveAs(); |
462 | exit(0); | 464 | exit(0); |
463 | } | 465 | } |
464 | 466 | ||
465 | void TextEdit::zoomIn() { | 467 | void TextEdit::zoomIn() { |
466 | setFontSize(editor->font().pointSize()+1,FALSE); | 468 | setFontSize(editor->font().pointSize()+1,FALSE); |
@@ -632,25 +634,27 @@ void TextEdit::newFile( const DocLnk &f ) { | |||
632 | void TextEdit::openFile( const QString &f ) { | 634 | void TextEdit::openFile( const QString &f ) { |
633 | qDebug("filename is "+ f); | 635 | qDebug("filename is "+ f); |
634 | QString filer; | 636 | QString filer; |
635 | // bFromDocView = TRUE; | 637 | // bFromDocView = TRUE; |
636 | if(f.find(".desktop",0,TRUE) != -1 && useAdvancedFeatures) { | 638 | if(f.find(".desktop",0,TRUE) != -1 && useAdvancedFeatures) { |
637 | switch ( QMessageBox::warning(this,tr("Text Editor"), | 639 | switch ( QMessageBox::warning(this,tr("Text Editor"), |
638 | tr("Text Editor has detected\n you selected a .desktop file.\nOpen .desktop file or linked file?"), | 640 | tr("Text Editor has detected<BR>you selected a <B>.desktop</B> file.<BR>Open <B>.desktop</B> file or <B>linked</B> file?"), |
639 | tr(".desktop File"),tr("Linked Document"),0,1,1) ) { | 641 | tr(".desktop File"),tr("Linked Document"),0,1,1) ) { |
640 | case 0: | 642 | case 0: |
641 | filer = f; | 643 | filer = f; |
642 | break; | 644 | break; |
643 | case 1: | 645 | case 1: |
644 | DocLnk sf(f); | 646 | DocLnk sf(f); |
645 | filer = sf.file(); | 647 | filer = sf.file(); |
646 | break; | 648 | break; |
647 | } | 649 | } |
648 | } else { | 650 | } else { |
649 | filer = f; | 651 | DocLnk sf(f); |
650 | fileIs = TRUE; | 652 | filer = sf.file(); |
653 | // filer = f; | ||
654 | // fileIs = TRUE; | ||
651 | } | 655 | } |
652 | 656 | ||
653 | DocLnk nf; | 657 | DocLnk nf; |
654 | nf.setType("text/plain"); | 658 | nf.setType("text/plain"); |
655 | nf.setFile(filer); | 659 | nf.setFile(filer); |
656 | currentFileName=filer; | 660 | currentFileName=filer; |
@@ -734,13 +738,13 @@ bool TextEdit::save() { | |||
734 | qDebug("regular save file"); | 738 | qDebug("regular save file"); |
735 | QFile f(file); | 739 | QFile f(file); |
736 | if( f.open(IO_WriteOnly)) { | 740 | if( f.open(IO_WriteOnly)) { |
737 | QCString crt = rt.utf8(); | 741 | QCString crt = rt.utf8(); |
738 | f.writeBlock(crt,crt.length()); | 742 | f.writeBlock(crt,crt.length()); |
739 | } else { | 743 | } else { |
740 | QMessageBox::message("Text Edit","Write Failed"); | 744 | QMessageBox::message(tr("Text Edit"),tr("Write Failed")); |
741 | return false; | 745 | return false; |
742 | } | 746 | } |
743 | 747 | ||
744 | } | 748 | } |
745 | editor->setEdited( FALSE); | 749 | editor->setEdited( FALSE); |
746 | edited1=FALSE; | 750 | edited1=FALSE; |
@@ -911,13 +915,13 @@ void TextEdit::changeFont() { | |||
911 | editor->setFont( myFont); | 915 | editor->setFont( myFont); |
912 | delete fontDlg; | 916 | delete fontDlg; |
913 | 917 | ||
914 | } | 918 | } |
915 | 919 | ||
916 | void TextEdit::editDelete() { | 920 | void TextEdit::editDelete() { |
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) ) { | 921 | 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 | case 0: | 922 | case 0: |
919 | if(doc) { | 923 | if(doc) { |
920 | doc->removeFiles(); | 924 | doc->removeFiles(); |
921 | clear(); | 925 | clear(); |
922 | setCaption( tr("Text Editor") ); | 926 | setCaption( tr("Text Editor") ); |
923 | } | 927 | } |
@@ -954,16 +958,16 @@ void TextEdit::receive(const QCString&msg, const QByteArray&) { | |||
954 | if ( msg == "setDocument(QString)" ) { | 958 | if ( msg == "setDocument(QString)" ) { |
955 | qDebug("bugger all"); | 959 | qDebug("bugger all"); |
956 | } | 960 | } |
957 | 961 | ||
958 | } | 962 | } |
959 | void TextEdit::doAbout() { | 963 | void TextEdit::doAbout() { |
960 | QMessageBox::about(0,"Text Edit","Text Edit is copyright\n" | 964 | QMessageBox::about(0,tr("Text Edit"),tr("Text Edit is copyright<BR>" |
961 | "2000 Trolltech AS, and\n" | 965 | "2000 Trolltech AS, and<BR>" |
962 | "2002 by L.J.Potter \nljp@llornkcor.com\n" | 966 | "2002 by <B>L. J. Potter <BR>llornkcor@handhelds.org</B><BR>" |
963 | "and is licensed under the GPL"); | 967 | "and is licensed under the GPL")); |
964 | } | 968 | } |
965 | 969 | ||
966 | void TextEdit::doAdvanced(bool b) { | 970 | void TextEdit::doAdvanced(bool b) { |
967 | useAdvancedFeatures=b; | 971 | useAdvancedFeatures=b; |
968 | Config cfg("TextEdit"); | 972 | Config cfg("TextEdit"); |
969 | cfg.setGroup("View"); | 973 | cfg.setGroup("View"); |