summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-11-09 23:11:09 (UTC)
committer llornkcor <llornkcor>2002-11-09 23:11:09 (UTC)
commit0c81c6287771d5ad416c2ddf0ae32ad5ce18c116 (patch) (unidiff)
tree9e565161740031ed63f51ce09377b7e2ef2bb4a7
parentc1f59c3404e9c0312e3d0418d5286b12d2e98d92 (diff)
downloadopie-0c81c6287771d5ad416c2ddf0ae32ad5ce18c116.zip
opie-0c81c6287771d5ad416c2ddf0ae32ad5ce18c116.tar.gz
opie-0c81c6287771d5ad416c2ddf0ae32ad5ce18c116.tar.bz2
various fixes.. saveAs and quit stuff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/textedit/textedit.cpp281
-rw-r--r--core/apps/textedit/textedit.h4
2 files changed, 137 insertions, 148 deletions
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp
index 464671a..1c3b393 100644
--- a/core/apps/textedit/textedit.cpp
+++ b/core/apps/textedit/textedit.cpp
@@ -195,10 +195,10 @@ void QpeEditor::find ( const QString &txt, bool caseSensitive,
195 bool backwards ) 195 bool backwards )
196{ 196{
197 static bool wrap = FALSE; 197 static bool wrap = false;
198 int line, col; 198 int line, col;
199 if ( wrap ) { 199 if ( wrap ) {
200 if ( !backwards ) 200 if ( !backwards )
201 line = col = 0; 201 line = col = 0;
202 wrap = FALSE; 202 wrap = false;
203 // emit searchWrapped(); 203 // emit searchWrapped();
204 } else { 204 } else {
@@ -209,5 +209,5 @@ void QpeEditor::find ( const QString &txt, bool caseSensitive,
209 for ( ; ; ) { 209 for ( ; ; ) {
210 if ( line >= numLines() ) { 210 if ( line >= numLines() ) {
211 wrap = TRUE; 211 wrap = true;
212 //emit notFound(); 212 //emit notFound();
213 break; 213 break;
@@ -215,9 +215,9 @@ void QpeEditor::find ( const QString &txt, bool caseSensitive,
215 int findCol = getString( line )->find( txt, col, caseSensitive ); 215 int findCol = getString( line )->find( txt, col, caseSensitive );
216 if ( findCol >= 0 ) { 216 if ( findCol >= 0 ) {
217 setCursorPosition( line, findCol, FALSE ); 217 setCursorPosition( line, findCol, false );
218 col = findCol + txt.length(); 218 col = findCol + txt.length();
219 setCursorPosition( line, col, TRUE ); 219 setCursorPosition( line, col, true );
220 220
221 //found = TRUE; 221 //found = true;
222 break; 222 break;
223 } 223 }
@@ -240,10 +240,10 @@ static const int fontsize[nfontsizes] = {8,10,12,14,18,24};
240 240
241TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f ) 241TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f )
242 : QMainWindow( parent, name, f ), bFromDocView( FALSE ) 242 : QMainWindow( parent, name, f ), bFromDocView( false )
243{ 243{
244 doc = 0; 244 doc = 0;
245 edited=FALSE; 245 edited=false;
246 edited1=FALSE; 246 edited1=false;
247 setToolBarsMovable( FALSE ); 247 setToolBarsMovable( false );
248 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); 248 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
249 249
@@ -255,5 +255,5 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f )
255 255
256 QPEToolBar *bar = new QPEToolBar( this ); 256 QPEToolBar *bar = new QPEToolBar( this );
257 bar->setHorizontalStretchable( TRUE ); 257 bar->setHorizontalStretchable( true );
258 menu = bar; 258 menu = bar;
259 259
@@ -333,30 +333,30 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f )
333 QAction *wa = new QAction( tr("Wrap lines"), QString::null, 0, this, 0 ); 333 QAction *wa = new QAction( tr("Wrap lines"), QString::null, 0, this, 0 );
334 connect( wa, SIGNAL( toggled(bool) ), this, SLOT( setWordWrap(bool) ) ); 334 connect( wa, SIGNAL( toggled(bool) ), this, SLOT( setWordWrap(bool) ) );
335 wa->setToggleAction(TRUE); 335 wa->setToggleAction(true);
336 wa->addTo( advancedMenu); 336 wa->addTo( advancedMenu);
337 337
338 nStart = new QAction( tr("Start with new file"), QString::null, 0, this, 0 ); 338 nStart = new QAction( tr("Start with new file"), QString::null, 0, this, 0 );
339 connect( nStart, SIGNAL( toggled(bool) ), this, SLOT( changeStartConfig(bool) ) ); 339 connect( nStart, SIGNAL( toggled(bool) ), this, SLOT( changeStartConfig(bool) ) );
340 nStart->setToggleAction(TRUE); 340 nStart->setToggleAction(true);
341 nStart->addTo( advancedMenu ); 341 nStart->addTo( advancedMenu );
342 342
343 nAdvanced = new QAction( tr("Prompt on Exit"), QString::null, 0, this, 0 ); 343 nAdvanced = new QAction( tr("Prompt on Exit"), QString::null, 0, this, 0 );
344 connect( nAdvanced, SIGNAL( toggled(bool) ), this, SLOT( doPrompt(bool) ) ); 344 connect( nAdvanced, SIGNAL( toggled(bool) ), this, SLOT( doPrompt(bool) ) );
345 nAdvanced->setToggleAction(TRUE); 345 nAdvanced->setToggleAction(true);
346 nAdvanced->addTo( advancedMenu ); 346 nAdvanced->addTo( advancedMenu );
347 347
348 desktopAction = new QAction( tr("Always open linked file"), QString::null, 0, this, 0 ); 348 desktopAction = new QAction( tr("Always open linked file"), QString::null, 0, this, 0 );
349 connect( desktopAction, SIGNAL( toggled(bool) ), this, SLOT( doDesktop(bool) ) ); 349 connect( desktopAction, SIGNAL( toggled(bool) ), this, SLOT( doDesktop(bool) ) );
350 desktopAction->setToggleAction(TRUE); 350 desktopAction->setToggleAction(true);
351 desktopAction->addTo( advancedMenu); 351 desktopAction->addTo( advancedMenu);
352 352
353 filePermAction = new QAction( tr("File Permissions"), QString::null, 0, this, 0 ); 353 filePermAction = new QAction( tr("File Permissions"), QString::null, 0, this, 0 );
354 connect( filePermAction, SIGNAL( toggled(bool) ), this, SLOT( doFilePerms(bool) ) ); 354 connect( filePermAction, SIGNAL( toggled(bool) ), this, SLOT( doFilePerms(bool) ) );
355 filePermAction->setToggleAction(TRUE); 355 filePermAction->setToggleAction(true);
356 filePermAction->addTo( advancedMenu); 356 filePermAction->addTo( advancedMenu);
357 357
358 searchBarAction = new QAction( tr("Search Bar Open"), QString::null, 0, this, 0 ); 358 searchBarAction = new QAction( tr("Search Bar Open"), QString::null, 0, this, 0 );
359 connect( searchBarAction, SIGNAL( toggled(bool) ), this, SLOT( setSearchBar(bool) ) ); 359 connect( searchBarAction, SIGNAL( toggled(bool) ), this, SLOT( setSearchBar(bool) ) );
360 searchBarAction->setToggleAction(TRUE); 360 searchBarAction->setToggleAction(true);
361 searchBarAction->addTo( advancedMenu); 361 searchBarAction->addTo( advancedMenu);
362 362
@@ -371,7 +371,7 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f )
371 371
372 searchBar = new QPEToolBar(this); 372 searchBar = new QPEToolBar(this);
373 addToolBar( searchBar, "Search", QMainWindow::Top, TRUE ); 373 addToolBar( searchBar, "Search", QMainWindow::Top, true );
374 374
375 searchBar->setHorizontalStretchable( TRUE ); 375 searchBar->setHorizontalStretchable( true );
376 376
377 searchEdit = new QLineEdit( searchBar, "searchEdit" ); 377 searchEdit = new QLineEdit( searchBar, "searchEdit" );
@@ -423,12 +423,11 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f )
423 filePerms = cfg.readBoolEntry ( "FilePermissions", false ); 423 filePerms = cfg.readBoolEntry ( "FilePermissions", false );
424 useSearchBar = cfg.readBoolEntry ( "SearchBar", false ); 424 useSearchBar = cfg.readBoolEntry ( "SearchBar", false );
425 425 startWithNew = cfg.readBoolEntry ( "startNew", true);
426 if(useSearchBar) { 426
427 searchBarAction->setOn(true); 427 if(useSearchBar) searchBarAction->setOn(true);
428 } else{ 428 if(promptExit ) nAdvanced->setOn( true );
429 } 429 if(openDesktop) desktopAction->setOn( true );
430 if(promptExit ) nAdvanced->setOn ( true ); 430 if(filePerms) filePermAction->setOn( true );
431 if(openDesktop) desktopAction->setOn ( true ); 431 if(startWithNew) nStart->setOn( true );
432 if(filePerms) filePermAction->setOn ( true );
433 432
434 bool wrap = cfg. readBoolEntry ( "Wrap", true ); 433 bool wrap = cfg. readBoolEntry ( "Wrap", true );
@@ -436,24 +435,22 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f )
436 setWordWrap ( wrap ); 435 setWordWrap ( wrap );
437 436
438 if( qApp->argc() > 0) { 437 if( qApp->argc() > 1) {
439 currentFileName=qApp->argv()[1]; 438 currentFileName=qApp->argv()[1];
440// qDebug("<<<<<<<<<<<<<<<<<<<<<<<< "+currentFileName); 439// qDebug("<<<<<<<<<<<<<<<<<<<<<<<< "+currentFileName+" %d",qApp->argc());
441 QFileInfo fi(currentFileName); 440 QFileInfo fi(currentFileName);
442
443 if(fi.baseName().left(1) == "") {
444 openDotFile(currentFileName);
445 } else {
446
447 nStart->setOn(TRUE);
448 openFile(currentFileName);
449 }
450 } else
451 if(cfg.readEntry("startNew","TRUE") == "TRUE") {
452 441
453 nStart->setOn(TRUE); 442 if(fi.baseName().left(1) == "") {
454 fileNew(); 443 openDotFile(currentFileName);
444 } else {
445 openFile(currentFileName);
446 }
455 } else { 447 } else {
456 448// qDebug("Do other thing");
457 fileOpen(); 449 if(startWithNew) {
450 openDotFile("");
451// fileNew();
452 } else {
453 fileOpen();
454 }
458 } 455 }
459 456
@@ -462,10 +459,16 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f )
462 459
463TextEdit::~TextEdit() { 460TextEdit::~TextEdit() {
464 if( edited1 & promptExit ) 461// qDebug("destr");
465 saveAs(); 462}
463
464void TextEdit::closeEvent(QCloseEvent *) {
465// qDebug("closing here");
466 if( edited1 && promptExit)
467 saveAs();
468 qApp->quit();
466} 469}
467 470
468void TextEdit::cleanUp() { 471void TextEdit::cleanUp() {
469 qDebug("cleanUp");// save(); 472// qDebug("cleanUp");// save();
470 473
471 Config cfg ( "TextEdit" ); 474 Config cfg ( "TextEdit" );
@@ -478,5 +481,5 @@ void TextEdit::cleanUp() {
478 481
479 cfg.setGroup ( "View" ); 482 cfg.setGroup ( "View" );
480 cfg.writeEntry ( "Wrap", editor-> wordWrap ( ) == QMultiLineEdit::WidgetWidth ); 483 cfg.writeEntry ( "Wrap", editor->wordWrap() == QMultiLineEdit::WidgetWidth );
481 cfg.writeEntry ( "FileView", viewSelection ); 484 cfg.writeEntry ( "FileView", viewSelection );
482 485
@@ -485,19 +488,22 @@ void TextEdit::cleanUp() {
485 cfg.writeEntry ( "FilePermissions", filePerms ); 488 cfg.writeEntry ( "FilePermissions", filePerms );
486 cfg.writeEntry ( "SearchBar", useSearchBar ); 489 cfg.writeEntry ( "SearchBar", useSearchBar );
490 cfg.writeEntry ( "startNew", startWithNew );
491
487} 492}
488 493
489 494
490void TextEdit::accept() { 495void TextEdit::accept() {
491 if( edited1) 496// qDebug("accept");
492 saveAs(); 497 if( edited1)
493 exit(0); 498 saveAs();
499 qApp->quit();
494} 500}
495 501
496void TextEdit::zoomIn() { 502void TextEdit::zoomIn() {
497 setFontSize(editor->font().pointSize()+1,FALSE); 503 setFontSize(editor->font().pointSize()+1,false);
498} 504}
499 505
500void TextEdit::zoomOut() { 506void TextEdit::zoomOut() {
501 setFontSize(editor->font().pointSize()-1,TRUE); 507 setFontSize(editor->font().pointSize()-1,true);
502} 508}
503 509
@@ -567,8 +573,4 @@ void TextEdit::fileNew() {
567 573
568void TextEdit::fileOpen() { 574void TextEdit::fileOpen() {
569 Config cfg("TextEdit");
570 cfg.setGroup("View");
571 // bool b=FALSE;
572
573 QMap<QString, QStringList> map; 575 QMap<QString, QStringList> map;
574 map.insert(tr("All"), QStringList() ); 576 map.insert(tr("All"), QStringList() );
@@ -578,8 +580,11 @@ void TextEdit::fileOpen() {
578 text << "*"; 580 text << "*";
579 map.insert(tr("All"), text ); 581 map.insert(tr("All"), text );
580 QString str = OFileDialog::getOpenFileName( 2, QPEApplication::documentDir(), QString::null, map); 582 QString str = OFileDialog::getOpenFileName( 2,
583 QPEApplication::documentDir(),
584 QString::null, map);
581 if(!str.isEmpty() ) 585 if(!str.isEmpty() )
582 openFile( str ); 586 openFile( str );
583 587 else
588 updateCaption();
584} 589}
585 590
@@ -635,28 +640,18 @@ void TextEdit::editPaste() {
635void TextEdit::editFind() { 640void TextEdit::editFind() {
636 searchBar->show(); 641 searchBar->show();
637 searchVisible = TRUE;
638 searchEdit->setFocus(); 642 searchEdit->setFocus();
639// Config cfg("TextEdit");
640// cfg.setGroup("View");
641// cfg.writeEntry("SearchBar","Opened");
642
643} 643}
644 644
645void TextEdit::findNext() { 645void TextEdit::findNext() {
646 editor->find( searchEdit->text(), FALSE, FALSE ); 646 editor->find( searchEdit->text(), false, false );
647 647
648} 648}
649 649
650void TextEdit::findClose() { 650void TextEdit::findClose() {
651 searchVisible = FALSE;
652 searchBar->hide(); 651 searchBar->hide();
653// Config cfg("TextEdit");
654// cfg.setGroup("View");
655// cfg.writeEntry("SearchBar","Closed");
656// cfg.write();
657} 652}
658 653
659void TextEdit::search() { 654void TextEdit::search() {
660 editor->find( searchEdit->text(), FALSE, FALSE ); 655 editor->find( searchEdit->text(), false, false );
661} 656}
662 657
@@ -671,5 +666,5 @@ void TextEdit::newFile( const DocLnk &f ) {
671 qDebug("newFile "+currentFileName); 666 qDebug("newFile "+currentFileName);
672 updateCaption( currentFileName); 667 updateCaption( currentFileName);
673// editor->setEdited( FALSE); 668// editor->setEdited( false);
674} 669}
675 670
@@ -687,7 +682,7 @@ void TextEdit::openDotFile( const QString &f ) {
687 } 682 }
688 editor->setText(txt); 683 editor->setText(txt);
689 editor->setEdited( FALSE); 684 editor->setEdited( false);
690 edited1=FALSE; 685 edited1=false;
691 edited=FALSE; 686 edited=false;
692 687
693 688
@@ -700,6 +695,6 @@ void TextEdit::openFile( const QString &f ) {
700 QString filer; 695 QString filer;
701 QFileInfo fi( f); 696 QFileInfo fi( f);
702// bFromDocView = TRUE; 697// bFromDocView = true;
703 if(f.find(".desktop",0,TRUE) != -1 && !openDesktop) { 698 if(f.find(".desktop",0,true) != -1 && !openDesktop) {
704 switch ( QMessageBox::warning(this,tr("Text Editor"), 699 switch ( QMessageBox::warning(this,tr("Text Editor"),
705 tr("Text Editor has detected<BR>you selected a <B>.desktop</B> 700 tr("Text Editor has detected<BR>you selected a <B>.desktop</B>
@@ -745,5 +740,5 @@ file.<BR>Open <B>.desktop</B> file or <B>linked</B> file?"),
745void TextEdit::openFile( const DocLnk &f ) { 740void TextEdit::openFile( const DocLnk &f ) {
746// clear(); 741// clear();
747// bFromDocView = TRUE; 742// bFromDocView = true;
748 FileManager fm; 743 FileManager fm;
749 QString txt; 744 QString txt;
@@ -759,7 +754,7 @@ void TextEdit::openFile( const DocLnk &f ) {
759 doc = new DocLnk(f); 754 doc = new DocLnk(f);
760 editor->setText(txt); 755 editor->setText(txt);
761 editor->setEdited( FALSE); 756 editor->setEdited( false);
762 edited1=FALSE; 757 edited1=false;
763 edited=FALSE; 758 edited=false;
764 759
765 doc->setName(currentFileName); 760 doc->setName(currentFileName);
@@ -768,12 +763,10 @@ void TextEdit::openFile( const DocLnk &f ) {
768 763
769void TextEdit::showEditTools() { 764void TextEdit::showEditTools() {
770// if ( !doc )
771// close();
772// clear();
773 menu->show(); 765 menu->show();
774 editBar->show(); 766 editBar->show();
775 if ( searchVisible ) 767 if(!useSearchBar)
768 searchBar->hide();
769 else
776 searchBar->show(); 770 searchBar->show();
777// updateCaption();
778 setWState (WState_Reserved1 ); 771 setWState (WState_Reserved1 );
779} 772}
@@ -817,7 +810,7 @@ bool TextEdit::save() {
817 810
818 } 811 }
819 editor->setEdited( FALSE); 812 editor->setEdited( false);
820 edited1=FALSE; 813 edited1=false;
821 edited=FALSE; 814 edited=false;
822 if(caption().left(1)=="*") 815 if(caption().left(1)=="*")
823 setCaption(caption().right(caption().length()-1)); 816 setCaption(caption().right(caption().length()-1));
@@ -836,14 +829,14 @@ bool TextEdit::saveAs() {
836 qDebug("saveAsFile " + currentFileName); 829 qDebug("saveAsFile " + currentFileName);
837 // case of nothing to save... 830 // case of nothing to save...
838 if ( !doc ) { 831// if ( !doc && !currentFileName.isEmpty()) {
839//|| !bFromDocView) 832// //|| !bFromDocView)
840 qDebug("no doc"); 833// qDebug("no doc");
841 return true; 834// return true;
842 } 835// }
843 if ( !editor->edited() ) { 836// if ( !editor->edited() ) {
844 delete doc; 837// delete doc;
845 doc = 0; 838// doc = 0;
846 return true; 839// return true;
847 } 840// }
848 841
849 QString rt = editor->text(); 842 QString rt = editor->text();
@@ -853,26 +846,29 @@ bool TextEdit::saveAs() {
853 || currentFileName == tr("Unnamed") 846 || currentFileName == tr("Unnamed")
854 || currentFileName == tr("Text Editor")) { 847 || currentFileName == tr("Text Editor")) {
855// qDebug("do silly TT filename thing"); 848 qDebug("do silly TT filename thing");
856 if ( doc->name().isEmpty() ) { 849// if ( doc && doc->name().isEmpty() ) {
857 QString pt = rt.simplifyWhiteSpace(); 850 QString pt = rt.simplifyWhiteSpace();
858 int i = pt.find( ' ' ); 851 int i = pt.find( ' ' );
859 QString docname = pt; 852 QString docname = pt;
860 if ( i > 0 ) 853 if ( i > 0 )
861 docname = pt.left( i ); 854 docname = pt.left( i );
862 // remove "." at the beginning 855 // remove "." at the beginning
863 while( docname.startsWith( "." ) ) 856 while( docname.startsWith( "." ) )
864 docname = docname.mid( 1 ); 857 docname = docname.mid( 1 );
865 docname.replace( QRegExp("/"), "_" ); 858 docname.replace( QRegExp("/"), "_" );
866 // cut the length. filenames longer than that 859 // cut the length. filenames longer than that
867 //don't make sense and something goes wrong when they get too long. 860 //don't make sense and something goes wrong when they get too long.
868 if ( docname.length() > 40 ) 861 if ( docname.length() > 40 )
869 docname = docname.left(40); 862 docname = docname.left(40);
870 if ( docname.isEmpty() ) 863 if ( docname.isEmpty() )
871 docname = tr("Unnamed"); 864 docname = tr("Unnamed");
872 doc->setName(docname); 865 if(doc) doc->setName(docname);
873 currentFileName=docname; 866 currentFileName=docname;
874 } 867// }
868// else
869// qDebug("hmmmmmm");
875 } 870 }
876 871
872
877 QMap<QString, QStringList> map; 873 QMap<QString, QStringList> map;
878 map.insert(tr("All"), QStringList() ); 874 map.insert(tr("All"), QStringList() );
@@ -882,10 +878,15 @@ bool TextEdit::saveAs() {
882 text << "*"; 878 text << "*";
883 map.insert(tr("All"), text ); 879 map.insert(tr("All"), text );
884// if(currentFileName 880
881 QFileInfo cuFi( currentFileName);
882 QString filee = cuFi.fileName();
883 QString dire = cuFi.dirPath();
884 if(dire==".")
885 dire = QPEApplication::documentDir();
885 QString str = OFileDialog::getSaveFileName( 2, 886 QString str = OFileDialog::getSaveFileName( 2,
886 QPEApplication::documentDir(), 887 dire,
887 currentFileName, map); 888 filee, map);
888 889
889 if(!str.isEmpty() ) { 890 if(!str.isEmpty()) {
890 QString fileNm=str; 891 QString fileNm=str;
891 892
@@ -893,5 +894,5 @@ bool TextEdit::saveAs() {
893 QFileInfo fi(fileNm); 894 QFileInfo fi(fileNm);
894 currentFileName=fi.fileName(); 895 currentFileName=fi.fileName();
895 if(doc) { 896 if(doc)
896// QString file = doc->file(); 897// QString file = doc->file();
897// doc->removeFiles(); 898// doc->removeFiles();
@@ -902,5 +903,5 @@ bool TextEdit::saveAs() {
902 doc = new DocLnk(nf); 903 doc = new DocLnk(nf);
903// editor->setText(rt); 904// editor->setText(rt);
904// qDebug("openFile doclnk "+currentFileName); 905 qDebug("Saving file as "+currentFileName);
905 doc->setName( currentFileName); 906 doc->setName( currentFileName);
906 updateCaption( currentFileName); 907 updateCaption( currentFileName);
@@ -922,5 +923,5 @@ bool TextEdit::saveAs() {
922 delete filePerm; 923 delete filePerm;
923 } 924 }
924 } 925// }
925 editor->setEdited( false); 926 editor->setEdited( false);
926 edited1 = false; 927 edited1 = false;
@@ -969,9 +970,9 @@ void TextEdit::setDocument(const QString& fileref) {
969 } else { 970 } else {
970 qDebug("setDoc open"); 971 qDebug("setDoc open");
971 bFromDocView = TRUE; 972 bFromDocView = true;
972 openFile(fileref); 973 openFile(fileref);
973 editor->setEdited(TRUE); 974 editor->setEdited(true);
974 edited1=FALSE; 975 edited1=false;
975 edited=TRUE; 976 edited=true;
976 977
977// doSearchBar(); 978// doSearchBar();
@@ -981,9 +982,4 @@ void TextEdit::setDocument(const QString& fileref) {
981} 982}
982 983
983void TextEdit::closeEvent( QCloseEvent *e ) {
984 bFromDocView = FALSE;
985 e->accept();
986}
987
988void TextEdit::changeFont() { 984void TextEdit::changeFont() {
989 QDialog *d = new QDialog ( this, "FontDialog", true ); 985 QDialog *d = new QDialog ( this, "FontDialog", true );
@@ -1017,13 +1013,8 @@ void TextEdit::editDelete() {
1017 1013
1018void TextEdit::changeStartConfig( bool b ) { 1014void TextEdit::changeStartConfig( bool b ) {
1019 1015 startWithNew=b;
1020 Config cfg("TextEdit"); 1016 Config cfg("TextEdit");
1021 cfg.setGroup("View"); 1017 cfg.setGroup("View");
1022 if(b) { 1018 cfg.writeEntry("startNew",b);
1023 qDebug("bool");
1024 cfg.writeEntry("startNew","TRUE");
1025 } else {
1026 cfg.writeEntry("startNew","FALSE");
1027 }
1028 update(); 1019 update();
1029} 1020}
@@ -1032,7 +1023,7 @@ void TextEdit::editorChanged() {
1032 if(editor->edited() && edited && !edited1) { 1023 if(editor->edited() && edited && !edited1) {
1033 setCaption( "*"+caption()); 1024 setCaption( "*"+caption());
1034 edited1=TRUE; 1025 edited1=true;
1035 } 1026 }
1036 edited=TRUE; 1027 edited=true;
1037} 1028}
1038 1029
diff --git a/core/apps/textedit/textedit.h b/core/apps/textedit/textedit.h
index a95e742..bb7d693 100644
--- a/core/apps/textedit/textedit.h
+++ b/core/apps/textedit/textedit.h
@@ -66,5 +66,4 @@ public slots:
66void receive(const QCString&, const QByteArray&); 66void receive(const QCString&, const QByteArray&);
67protected: 67protected:
68 bool fileIs, useAdvancedFeatures, promptExit, openDesktop, filePerms, useSearchBar;
69 void closeEvent( QCloseEvent *e ); 68 void closeEvent( QCloseEvent *e );
70 void doSearchBar(); 69 void doSearchBar();
@@ -115,5 +114,4 @@ private:
115 void updateCaption( const QString &name=QString::null ); 114 void updateCaption( const QString &name=QString::null );
116 void setFontSize(int sz, bool round_down_not_up); 115 void setFontSize(int sz, bool round_down_not_up);
117
118private: 116private:
119// fileSaver *fileSaveDlg; 117// fileSaver *fileSaveDlg;
@@ -124,5 +122,5 @@ private:
124 QLineEdit *searchEdit; 122 QLineEdit *searchEdit;
125 DocLnk *doc; 123 DocLnk *doc;
126 bool searchVisible; 124 bool fileIs, useAdvancedFeatures, promptExit, openDesktop, filePerms, useSearchBar, startWithNew;
127 bool bFromDocView; 125 bool bFromDocView;
128 int viewSelection; 126 int viewSelection;