summaryrefslogtreecommitdiff
Unidiff
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 )
395 bool wrap = cfg. readBoolEntry ( "Wrap", true ); 395 bool wrap = cfg. readBoolEntry ( "Wrap", true );
396 wa-> setOn ( wrap ); 396 wa-> setOn ( wrap );
397 setWordWrap ( wrap ); 397 setWordWrap ( wrap );
398 398
399///////////////// 399/////////////////
400 if( qApp->argc() > 1) { 400 if( qApp->argc() > 1) {
401 currentFileName=qApp->argv()[1]; 401 currentFileName=qApp->argv()[1];
402 402
403 QFileInfo fi(currentFileName); 403 QFileInfo fi(currentFileName);
404 404
405 if(fi.baseName().left(1) == "") { 405 if(fi.baseName().left(1) == "") {
406 openDotFile(currentFileName); 406 openDotFile(currentFileName);
407 } else { 407 } else {
408 openFile(currentFileName); 408 openFile(currentFileName);
409 } 409 }
410 } else { 410 } else {
411 edited1=false; 411 edited1=false;
412 openDotFile(""); 412 openDotFile("");
413 } 413 }
414 414
415 viewSelection = cfg.readNumEntry( "FileView", 0 ); 415 viewSelection = cfg.readNumEntry( "FileView", 0 );
416} 416}
417 417
418TextEdit::~TextEdit() { 418TextEdit::~TextEdit() {
419 owarn << "textedit d'tor" << oendl; 419 if( edited1 && !promptExit) {
420 switch( savePrompt() ) {
421 case 1: {
422 saveAs();
423 }
424 break;
425 };
426 }
427
420 delete editor; 428 delete editor;
421} 429}
422 430
423void TextEdit::closeEvent(QCloseEvent *) { 431void TextEdit::closeEvent(QCloseEvent *) {
424 if( edited1 && promptExit) 432 if( promptExit) {
425 { 433 switch( savePrompt() ) {
426 switch( savePrompt() ) 434 case 1: {
427 { 435 saveAs();
428 case 1: 436 qApp->quit();
429 { 437 }
430 saveAs(); 438 break;
431 qApp->quit(); 439
432 } 440 case 2: {
433 break; 441 qApp->quit();
434 442 }
435 case 2: 443 break;
436 { 444
437 qApp->quit(); 445 case -1:
438 } 446 break;
439 break; 447 };
440 448 }
441 case -1:
442 break;
443 };
444 }
445 else 449 else
446 qApp->quit(); 450 qApp->quit();
447
448} 451}
449 452
450void TextEdit::cleanUp() { 453void TextEdit::cleanUp() {
451 454
452 Config cfg ( "TextEdit" ); 455 Config cfg ( "TextEdit" );
453 cfg. setGroup ( "Font" ); 456 cfg. setGroup ( "Font" );
454 QFont f = editor->font(); 457 QFont f = editor->font();
455 cfg.writeEntry ( "Family", f. family ( )); 458 cfg.writeEntry ( "Family", f. family ( ));
456 cfg.writeEntry ( "Size", f. pointSize ( )); 459 cfg.writeEntry ( "Size", f. pointSize ( ));
457 cfg.writeEntry ( "Weight", f. weight ( )); 460 cfg.writeEntry ( "Weight", f. weight ( ));
458 cfg.writeEntry ( "Italic", f. italic ( )); 461 cfg.writeEntry ( "Italic", f. italic ( ));
459 462
460 cfg.setGroup ( "View" ); 463 cfg.setGroup ( "View" );
461 cfg.writeEntry ( "Wrap", editor->wordWrap() == QMultiLineEdit::WidgetWidth ); 464 cfg.writeEntry ( "Wrap", editor->wordWrap() == QMultiLineEdit::WidgetWidth );
462 cfg.writeEntry ( "FileView", viewSelection ); 465 cfg.writeEntry ( "FileView", viewSelection );
463 466
464 cfg.writeEntry ( "PromptExit", promptExit ); 467 cfg.writeEntry ( "PromptExit", promptExit );
465 cfg.writeEntry ( "OpenDesktop", openDesktop ); 468 cfg.writeEntry ( "OpenDesktop", openDesktop );
466 cfg.writeEntry ( "FilePermissions", filePerms ); 469 cfg.writeEntry ( "FilePermissions", filePerms );
467 cfg.writeEntry ( "SearchBar", useSearchBar ); 470 cfg.writeEntry ( "SearchBar", useSearchBar );
468 cfg.writeEntry ( "startNew", startWithNew ); 471 cfg.writeEntry ( "startNew", startWithNew );
469 472
470} 473}
471 474