summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/textedit/textedit.cpp49
1 files changed, 26 insertions, 23 deletions
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp
index c7273c5..26b907b 100644
--- a/core/apps/textedit/textedit.cpp
+++ b/core/apps/textedit/textedit.cpp
@@ -395,77 +395,80 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f )
bool wrap = cfg. readBoolEntry ( "Wrap", true );
wa-> setOn ( wrap );
setWordWrap ( wrap );
/////////////////
if( qApp->argc() > 1) {
currentFileName=qApp->argv()[1];
QFileInfo fi(currentFileName);
if(fi.baseName().left(1) == "") {
openDotFile(currentFileName);
} else {
openFile(currentFileName);
}
} else {
edited1=false;
openDotFile("");
}
viewSelection = cfg.readNumEntry( "FileView", 0 );
}
TextEdit::~TextEdit() {
- owarn << "textedit d'tor" << oendl;
+ if( edited1 && !promptExit) {
+ switch( savePrompt() ) {
+ case 1: {
+ saveAs();
+ }
+ break;
+ };
+ }
+
delete editor;
}
void TextEdit::closeEvent(QCloseEvent *) {
- if( edited1 && promptExit)
- {
- switch( savePrompt() )
- {
- case 1:
- {
- saveAs();
- qApp->quit();
- }
- break;
-
- case 2:
- {
- qApp->quit();
- }
- break;
-
- case -1:
- break;
- };
- }
+ if( promptExit) {
+ switch( savePrompt() ) {
+ case 1: {
+ saveAs();
+ qApp->quit();
+ }
+ break;
+
+ case 2: {
+ qApp->quit();
+ }
+ break;
+
+ case -1:
+ break;
+ };
+ }
else
qApp->quit();
-
}
void TextEdit::cleanUp() {
Config cfg ( "TextEdit" );
cfg. setGroup ( "Font" );
QFont f = editor->font();
cfg.writeEntry ( "Family", f. family ( ));
cfg.writeEntry ( "Size", f. pointSize ( ));
cfg.writeEntry ( "Weight", f. weight ( ));
cfg.writeEntry ( "Italic", f. italic ( ));
cfg.setGroup ( "View" );
cfg.writeEntry ( "Wrap", editor->wordWrap() == QMultiLineEdit::WidgetWidth );
cfg.writeEntry ( "FileView", viewSelection );
cfg.writeEntry ( "PromptExit", promptExit );
cfg.writeEntry ( "OpenDesktop", openDesktop );
cfg.writeEntry ( "FilePermissions", filePerms );
cfg.writeEntry ( "SearchBar", useSearchBar );
cfg.writeEntry ( "startNew", startWithNew );
}