summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-06-29 00:34:32 (UTC)
committer llornkcor <llornkcor>2002-06-29 00:34:32 (UTC)
commit9cc6f3de75b884f338f708ff03900b197f281802 (patch) (unidiff)
treefa325ddf6fd61fbfcaa3cb9ec9e772dbef87fe0d
parent971f94ceb114149efbf8d90b607d25dcbd358435 (diff)
downloadopie-9cc6f3de75b884f338f708ff03900b197f281802.zip
opie-9cc6f3de75b884f338f708ff03900b197f281802.tar.gz
opie-9cc6f3de75b884f338f708ff03900b197f281802.tar.bz2
b bye and added all files to ofiledialog
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/textedit/textedit.cpp60
1 files changed, 12 insertions, 48 deletions
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp
index ccc43fa..ea27e1b 100644
--- a/core/apps/textedit/textedit.cpp
+++ b/core/apps/textedit/textedit.cpp
@@ -1,170 +1,167 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20// changes added by L. J. Potter Sun 02-17-2002 21:31:31 20// changes added by L. J. Potter Sun 02-17-2002 21:31:31
21 21
22#include "textedit.h" 22#include "textedit.h"
23//#include "fileBrowser.h"
24#include "fileSaver.h" 23#include "fileSaver.h"
25#include "filePermissions.h" 24#include "filePermissions.h"
26
27#include "fontDialog.h" 25#include "fontDialog.h"
28 26
27#include <opie/ofileselector.h>
28#include <opie/ofiledialog.h>
29
29#include <qpe/fontdatabase.h> 30#include <qpe/fontdatabase.h>
30#include <qpe/global.h> 31#include <qpe/global.h>
31#include <qpe/fileselector.h> 32#include <qpe/fileselector.h>
32#include <qpe/applnk.h> 33#include <qpe/applnk.h>
33#include <qpe/resource.h> 34#include <qpe/resource.h>
34#include <qpe/config.h> 35#include <qpe/config.h>
35#include <qpe/qpeapplication.h> 36#include <qpe/qpeapplication.h>
36#include <qpe/qpemenubar.h> 37#include <qpe/qpemenubar.h>
37#include <qpe/qpetoolbar.h> 38#include <qpe/qpetoolbar.h>
38#include <qpe/qcopenvelope_qws.h> 39#include <qpe/qcopenvelope_qws.h>
39//#include <qpe/finddialog.h>
40
41#include <opie/ofileselector.h>
42#include <opie/ofiledialog.h>
43 40
44#include <qstringlist.h> 41#include <qstringlist.h>
45#include <qaction.h> 42#include <qaction.h>
46#include <qcolordialog.h> 43#include <qcolordialog.h>
47#include <qfileinfo.h> 44#include <qfileinfo.h>
48#include <qlineedit.h> 45#include <qlineedit.h>
49#include <qmessagebox.h> 46#include <qmessagebox.h>
50#include <qobjectlist.h> 47#include <qobjectlist.h>
51#include <qpopupmenu.h> 48#include <qpopupmenu.h>
52#include <qspinbox.h> 49#include <qspinbox.h>
53#include <qtoolbutton.h> 50#include <qtoolbutton.h>
54#include <qwidgetstack.h> 51#include <qwidgetstack.h>
55#include <qcheckbox.h> 52#include <qcheckbox.h>
56#include <qcombo.h> 53#include <qcombo.h>
57#include <unistd.h> 54#include <unistd.h>
58#include <sys/stat.h> 55#include <sys/stat.h>
59 56
60#include <stdlib.h> //getenv 57#include <stdlib.h> //getenv
61/* XPM */ 58/* XPM */
62static char * filesave_xpm[] = { 59static char * filesave_xpm[] = {
63"16 16 78 1", 60"16 16 78 1",
64" c None", 61" c None",
65". c #343434", 62". c #343434",
66"+ c #A0A0A0", 63"+ c #A0A0A0",
67"@ c #565656", 64"@ c #565656",
68"# c #9E9E9E", 65"# c #9E9E9E",
69"$ c #525252", 66"$ c #525252",
70"% c #929292", 67"% c #929292",
71"& c #676767", 68"& c #676767",
72"* c #848484", 69"* c #848484",
73"= c #666666", 70"= c #666666",
74"- c #D8D8D8", 71"- c #D8D8D8",
75"; c #FFFFFF", 72"; c #FFFFFF",
76"> c #DBDBDB", 73"> c #DBDBDB",
77", c #636363", 74", c #636363",
78"' c #989898", 75"' c #989898",
79") c #2D2D2D", 76") c #2D2D2D",
80"! c #909090", 77"! c #909090",
81"~ c #AEAEAE", 78"~ c #AEAEAE",
82"{ c #EAEAEA", 79"{ c #EAEAEA",
83"] c #575757", 80"] c #575757",
84"^ c #585858", 81"^ c #585858",
85"/ c #8A8A8A", 82"/ c #8A8A8A",
86"( c #828282", 83"( c #828282",
87"_ c #6F6F6F", 84"_ c #6F6F6F",
88": c #C9C9C9", 85": c #C9C9C9",
89"< c #050505", 86"< c #050505",
90"[ c #292929", 87"[ c #292929",
91"} c #777777", 88"} c #777777",
92"| c #616161", 89"| c #616161",
93"1 c #3A3A3A", 90"1 c #3A3A3A",
94"2 c #BEBEBE", 91"2 c #BEBEBE",
95"3 c #2C2C2C", 92"3 c #2C2C2C",
96"4 c #7C7C7C", 93"4 c #7C7C7C",
97"5 c #F6F6F6", 94"5 c #F6F6F6",
98"6 c #FCFCFC", 95"6 c #FCFCFC",
99"7 c #6B6B6B", 96"7 c #6B6B6B",
100"8 c #959595", 97"8 c #959595",
101"9 c #4F4F4F", 98"9 c #4F4F4F",
102"0 c #808080", 99"0 c #808080",
103"a c #767676", 100"a c #767676",
104"b c #818181", 101"b c #818181",
105"c c #B8B8B8", 102"c c #B8B8B8",
106"d c #FBFBFB", 103"d c #FBFBFB",
107"e c #F9F9F9", 104"e c #F9F9F9",
108"f c #CCCCCC", 105"f c #CCCCCC",
109"g c #030303", 106"g c #030303",
110"h c #737373", 107"h c #737373",
111"i c #7A7A7A", 108"i c #7A7A7A",
112"j c #7E7E7E", 109"j c #7E7E7E",
113"k c #6A6A6A", 110"k c #6A6A6A",
114"l c #FAFAFA", 111"l c #FAFAFA",
115"m c #505050", 112"m c #505050",
116"n c #9D9D9D", 113"n c #9D9D9D",
117"o c #333333", 114"o c #333333",
118"p c #7B7B7B", 115"p c #7B7B7B",
119"q c #787878", 116"q c #787878",
120"r c #696969", 117"r c #696969",
121"s c #494949", 118"s c #494949",
122"t c #555555", 119"t c #555555",
123"u c #949494", 120"u c #949494",
124"v c #E6E6E6", 121"v c #E6E6E6",
125"w c #424242", 122"w c #424242",
126"x c #515151", 123"x c #515151",
127"y c #535353", 124"y c #535353",
128"z c #3E3E3E", 125"z c #3E3E3E",
129"A c #D4D4D4", 126"A c #D4D4D4",
130"B c #0C0C0C", 127"B c #0C0C0C",
131"C c #353535", 128"C c #353535",
132"D c #474747", 129"D c #474747",
133"E c #ECECEC", 130"E c #ECECEC",
134"F c #919191", 131"F c #919191",
135"G c #7D7D7D", 132"G c #7D7D7D",
136"H c #000000", 133"H c #000000",
137"I c #404040", 134"I c #404040",
138"J c #858585", 135"J c #858585",
139"K c #323232", 136"K c #323232",
140"L c #D0D0D0", 137"L c #D0D0D0",
141"M c #1C1C1C", 138"M c #1C1C1C",
142" ...+ ", 139" ...+ ",
143" @#$%&..+ ", 140" @#$%&..+ ",
144" .*=-;;>,..+ ", 141" .*=-;;>,..+ ",
145" ')!~;;;;;;{]..", 142" ')!~;;;;;;{]..",
146" ^/(-;;;;;;;_:<", 143" ^/(-;;;;;;;_:<",
147" [}|;;;;;;;{12$", 144" [}|;;;;;;;{12$",
148" #34-55;;;;678$+", 145" #34-55;;;;678$+",
149" 90ab=c;dd;e1fg ", 146" 90ab=c;dd;e1fg ",
150" [ahij((kbl0mn$ ", 147" [ahij((kbl0mn$ ",
151" op^q^^7r&]s/$+ ", 148" op^q^^7r&]s/$+ ",
152"@btu;vbwxy]zAB ", 149"@btu;vbwxy]zAB ",
153"CzDEvEv;;DssF$ ", 150"CzDEvEv;;DssF$ ",
154"G.H{E{E{IxsJ$+ ", 151"G.H{E{E{IxsJ$+ ",
155" +...vEKxzLM ", 152" +...vEKxzLM ",
156" +...z]n$ ", 153" +...z]n$ ",
157" +... "}; 154" +... "};
158 155
159 156
160#if QT_VERSION < 300 157#if QT_VERSION < 300
161 158
162class QpeEditor : public QMultiLineEdit 159class QpeEditor : public QMultiLineEdit
163{ 160{
164 // Q_OBJECT 161 // Q_OBJECT
165public: 162public:
166 QpeEditor( QWidget *parent, const char * name = 0 ) 163 QpeEditor( QWidget *parent, const char * name = 0 )
167 : QMultiLineEdit( parent, name ) 164 : QMultiLineEdit( parent, name )
168 { 165 {
169 clearTableFlags(); 166 clearTableFlags();
170 setTableFlags( Tbl_vScrollBar | Tbl_autoHScrollBar ); 167 setTableFlags( Tbl_vScrollBar | Tbl_autoHScrollBar );
@@ -382,300 +379,267 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f )
382 a->addTo( edit ); 379 a->addTo( edit );
383 380
384 searchBar->hide(); 381 searchBar->hide();
385 382
386 editor = new QpeEditor( this ); 383 editor = new QpeEditor( this );
387 setCentralWidget( editor ); 384 setCentralWidget( editor );
388 editor->setFrameStyle( QFrame::Panel | QFrame::Sunken ); 385 editor->setFrameStyle( QFrame::Panel | QFrame::Sunken );
389 connect( editor, SIGNAL( textChanged() ), this, SLOT( editorChanged() ) ); 386 connect( editor, SIGNAL( textChanged() ), this, SLOT( editorChanged() ) );
390 387
391// resize( 200, 300 ); 388// resize( 200, 300 );
392 389
393// setFontSize(defsize,TRUE); 390// setFontSize(defsize,TRUE);
394 FontDatabase fdb; 391 FontDatabase fdb;
395 QFont defaultFont=editor->font(); 392 QFont defaultFont=editor->font();
396 QFontInfo fontInfo(defaultFont); 393 QFontInfo fontInfo(defaultFont);
397 394
398 cfg.setGroup("Font"); 395 cfg.setGroup("Font");
399 QString family = cfg.readEntry("Family", fontInfo.family()); 396 QString family = cfg.readEntry("Family", fontInfo.family());
400 QString style = cfg.readEntry("Style", fdb.styleString(defaultFont)); 397 QString style = cfg.readEntry("Style", fdb.styleString(defaultFont));
401 int i_size = cfg.readNumEntry("Size", fontInfo.pointSize()/10); 398 int i_size = cfg.readNumEntry("Size", fontInfo.pointSize()/10);
402 QString charSet = cfg.readEntry("CharSet", QFont::encodingName( fontInfo.charSet()) ); 399 QString charSet = cfg.readEntry("CharSet", QFont::encodingName( fontInfo.charSet()) );
403 400
404 defaultFont = fdb.font(family,style,i_size,charSet); 401 defaultFont = fdb.font(family,style,i_size,charSet);
405 editor->setFont( defaultFont); 402 editor->setFont( defaultFont);
406 403
407 wa->setOn(wrap); 404 wa->setOn(wrap);
408 updateCaption(); 405 updateCaption();
409 406
410 cfg.setGroup("View"); 407 cfg.setGroup("View");
411 if(cfg.readEntry("startNew","TRUE") == "TRUE") { 408 if(cfg.readEntry("startNew","TRUE") == "TRUE") {
412 nStart->setOn(TRUE); 409 nStart->setOn(TRUE);
413 fileNew(); 410 fileNew();
414 } else { 411 } else {
415 fileOpen(); 412 fileOpen();
416 } 413 }
417 414
418 viewSelection = cfg.readNumEntry( "FileView", 0 ); 415 viewSelection = cfg.readNumEntry( "FileView", 0 );
419} 416}
420 417
421void TextEdit::cleanUp() 418void TextEdit::cleanUp()
422{ 419{
423// save(); 420// save();
424 Config cfg("TextEdit"); 421 Config cfg("TextEdit");
425 cfg.setGroup("View"); 422 cfg.setGroup("View");
426 QFont f = editor->font(); 423 QFont f = editor->font();
427 cfg.writeEntry("FontSize",f.pointSize()); 424 cfg.writeEntry("FontSize",f.pointSize());
428 cfg.writeEntry("Bold",f.bold()); 425 cfg.writeEntry("Bold",f.bold());
429 cfg.writeEntry("Italic",f.italic()); 426 cfg.writeEntry("Italic",f.italic());
430 cfg.writeEntry("Wrap",editor->wordWrap() == QMultiLineEdit::WidgetWidth); 427 cfg.writeEntry("Wrap",editor->wordWrap() == QMultiLineEdit::WidgetWidth);
431 cfg.writeEntry( "FileView", viewSelection ); 428 cfg.writeEntry( "FileView", viewSelection );
432 429
433} 430}
434 431
435TextEdit::~TextEdit() 432TextEdit::~TextEdit()
436{ 433{
437} 434}
438 435
439void TextEdit::zoomIn() 436void TextEdit::zoomIn()
440{ 437{
441 setFontSize(editor->font().pointSize()+1,FALSE); 438 setFontSize(editor->font().pointSize()+1,FALSE);
442} 439}
443 440
444void TextEdit::zoomOut() 441void TextEdit::zoomOut()
445{ 442{
446 setFontSize(editor->font().pointSize()-1,TRUE); 443 setFontSize(editor->font().pointSize()-1,TRUE);
447} 444}
448 445
449 446
450void TextEdit::setFontSize(int sz, bool round_down_not_up) 447void TextEdit::setFontSize(int sz, bool round_down_not_up)
451{ 448{
452 int s=10; 449 int s=10;
453 for (int i=0; i<nfontsizes; i++) { 450 for (int i=0; i<nfontsizes; i++) {
454 if ( fontsize[i] == sz ) { 451 if ( fontsize[i] == sz ) {
455 s = sz; 452 s = sz;
456 break; 453 break;
457 } else if ( round_down_not_up ) { 454 } else if ( round_down_not_up ) {
458 if ( fontsize[i] < sz ) 455 if ( fontsize[i] < sz )
459 s = fontsize[i]; 456 s = fontsize[i];
460 } else { 457 } else {
461 if ( fontsize[i] > sz ) { 458 if ( fontsize[i] > sz ) {
462 s = fontsize[i]; 459 s = fontsize[i];
463 break; 460 break;
464 } 461 }
465 } 462 }
466 } 463 }
467 464
468 QFont f = editor->font(); 465 QFont f = editor->font();
469 f.setPointSize(s); 466 f.setPointSize(s);
470 editor->setFont(f); 467 editor->setFont(f);
471 468
472 zin->setEnabled(s != fontsize[nfontsizes-1]); 469 zin->setEnabled(s != fontsize[nfontsizes-1]);
473 zout->setEnabled(s != fontsize[0]); 470 zout->setEnabled(s != fontsize[0]);
474} 471}
475 472
476void TextEdit::setBold(bool y) 473void TextEdit::setBold(bool y)
477{ 474{
478 QFont f = editor->font(); 475 QFont f = editor->font();
479 f.setBold(y); 476 f.setBold(y);
480 editor->setFont(f); 477 editor->setFont(f);
481} 478}
482 479
483void TextEdit::setItalic(bool y) 480void TextEdit::setItalic(bool y)
484{ 481{
485 QFont f = editor->font(); 482 QFont f = editor->font();
486 f.setItalic(y); 483 f.setItalic(y);
487 editor->setFont(f); 484 editor->setFont(f);
488} 485}
489 486
490void TextEdit::setWordWrap(bool y) 487void TextEdit::setWordWrap(bool y)
491{ 488{
492 bool state = editor->edited(); 489 bool state = editor->edited();
493 editor->setWordWrap(y ? QMultiLineEdit::WidgetWidth : QMultiLineEdit::NoWrap ); 490 editor->setWordWrap(y ? QMultiLineEdit::WidgetWidth : QMultiLineEdit::NoWrap );
494 editor->setEdited( state ); 491 editor->setEdited( state );
495} 492}
496 493
497void TextEdit::fileNew() 494void TextEdit::fileNew()
498{ 495{
499// if( !bFromDocView ) { 496// if( !bFromDocView ) {
500// saveAs(); 497// saveAs();
501// } 498// }
502 newFile(DocLnk()); 499 newFile(DocLnk());
503} 500}
504 501
505void TextEdit::fileOpen() 502void TextEdit::fileOpen()
506{ 503{
507 Config cfg("TextEdit"); 504 Config cfg("TextEdit");
508 cfg.setGroup("View"); 505 cfg.setGroup("View");
509 bool b=FALSE; 506 bool b=FALSE;
510// if(cfg.readEntry("useOldFileDialog") == "TRUE") 507
511// b=TRUE; 508 QMap<QString, QStringList> map;
512// if(!b) { 509 map.insert(tr("All"), QStringList() );
513 QMap<QString, QStringList> map; 510 QStringList text;
514 map.insert(tr("All"), QStringList() ); 511 text << "text/*";
515 QStringList text; 512 map.insert(tr("Text"), text );
516 text << "text/*"; 513 text << "*";
517 map.insert(tr("Text"), text ); 514 map.insert(tr("All"), text );
518 QString str = OFileDialog::getOpenFileName( 2,"/", QString::null, map);//,"", "*", this ); 515 QString str = OFileDialog::getOpenFileName( 2,"/", QString::null, map);
519 if(!str.isEmpty() ) 516 if(!str.isEmpty() )
520 openFile( str ); 517 openFile( str );
521// } else {
522// QString str;
523// browseForFiles = new fileBrowser(this,tr("Open File"),TRUE,0, "*"); //
524// browseForFiles->setFileView( viewSelection );
525// browseForFiles->showMaximized();
526// // if( result != -1 )
527
528// if( browseForFiles->exec() != -1 ) {
529// QString selFile = browseForFiles->selectedFileName;
530// QStringList fileList = browseForFiles->fileList;
531// qDebug(selFile);
532// QStringList::ConstIterator f;
533// QString fileTemp;
534// for ( f = fileList.begin(); f != fileList.end(); f++ ) {
535// fileTemp = *f;
536// fileTemp.right( fileTemp.length()-5);
537// QString fileName = fileTemp;
538// if( fileName != "Unnamed" || fileName != "Empty Text" ) {
539// currentFileName = fileName;
540// qDebug("please open "+currentFileName);
541// openFile(currentFileName );
542// }
543// }
544// viewSelection = browseForFiles->SelectionCombo->currentItem();
545// }
546// delete browseForFiles;
547// editor->setEdited( FALSE);
548// edited1=FALSE;
549// edited=FALSE;
550// if(caption().left(1)=="*")
551// setCaption(caption().right(caption().length()-1));
552// doSearchBar();
553// }
554 518
555} 519}
556 520
557void TextEdit::doSearchBar() 521void TextEdit::doSearchBar()
558{ 522{
559 Config cfg("TextEdit"); 523 Config cfg("TextEdit");
560 cfg.setGroup("View"); 524 cfg.setGroup("View");
561 if(cfg.readEntry("SearchBar","Closed") != "Opened") 525 if(cfg.readEntry("SearchBar","Closed") != "Opened")
562 searchBar->hide(); 526 searchBar->hide();
563} 527}
564 528
565#if 0 529#if 0
566void TextEdit::slotFind() 530void TextEdit::slotFind()
567{ 531{
568 FindDialog frmFind( tr("Text Editor"), this ); 532 FindDialog frmFind( tr("Text Editor"), this );
569 connect( &frmFind, SIGNAL(signalFindClicked(const QString &, bool, bool, int)), 533 connect( &frmFind, SIGNAL(signalFindClicked(const QString &, bool, bool, int)),
570 editor, SLOT(slotDoFind( const QString&,bool,bool))); 534 editor, SLOT(slotDoFind( const QString&,bool,bool)));
571 535
572 //case sensitive, backwards, [category] 536 //case sensitive, backwards, [category]
573 537
574 connect( editor, SIGNAL(notFound()), 538 connect( editor, SIGNAL(notFound()),
575 &frmFind, SLOT(slotNotFound()) ); 539 &frmFind, SLOT(slotNotFound()) );
576 connect( editor, SIGNAL(searchWrapped()), 540 connect( editor, SIGNAL(searchWrapped()),
577 &frmFind, SLOT(slotWrapAround()) ); 541 &frmFind, SLOT(slotWrapAround()) );
578 542
579 frmFind.exec(); 543 frmFind.exec();
580 544
581 545
582} 546}
583#endif 547#endif
584 548
585void TextEdit::fileRevert() 549void TextEdit::fileRevert()
586{ 550{
587 clear(); 551 clear();
588 fileOpen(); 552 fileOpen();
589} 553}
590 554
591void TextEdit::editCut() 555void TextEdit::editCut()
592{ 556{
593#ifndef QT_NO_CLIPBOARD 557#ifndef QT_NO_CLIPBOARD
594 editor->cut(); 558 editor->cut();
595#endif 559#endif
596} 560}
597 561
598void TextEdit::editCopy() 562void TextEdit::editCopy()
599{ 563{
600#ifndef QT_NO_CLIPBOARD 564#ifndef QT_NO_CLIPBOARD
601 editor->copy(); 565 editor->copy();
602#endif 566#endif
603} 567}
604 568
605void TextEdit::editPaste() 569void TextEdit::editPaste()
606{ 570{
607#ifndef QT_NO_CLIPBOARD 571#ifndef QT_NO_CLIPBOARD
608 editor->paste(); 572 editor->paste();
609#endif 573#endif
610} 574}
611 575
612void TextEdit::editFind() 576void TextEdit::editFind()
613{ 577{
614 searchBar->show(); 578 searchBar->show();
615 searchVisible = TRUE; 579 searchVisible = TRUE;
616 searchEdit->setFocus(); 580 searchEdit->setFocus();
617 Config cfg("TextEdit"); 581 Config cfg("TextEdit");
618 cfg.setGroup("View"); 582 cfg.setGroup("View");
619 cfg.writeEntry("SearchBar","Opened"); 583 cfg.writeEntry("SearchBar","Opened");
620 584
621} 585}
622 586
623void TextEdit::findNext() 587void TextEdit::findNext()
624{ 588{
625 editor->find( searchEdit->text(), FALSE, FALSE ); 589 editor->find( searchEdit->text(), FALSE, FALSE );
626 590
627} 591}
628 592
629void TextEdit::findClose() 593void TextEdit::findClose()
630{ 594{
631 searchVisible = FALSE; 595 searchVisible = FALSE;
632 searchBar->hide(); 596 searchBar->hide();
633 Config cfg("TextEdit"); 597 Config cfg("TextEdit");
634 cfg.setGroup("View"); 598 cfg.setGroup("View");
635 cfg.writeEntry("SearchBar","Closed"); 599 cfg.writeEntry("SearchBar","Closed");
636 cfg.write(); 600 cfg.write();
637} 601}
638 602
639void TextEdit::search() 603void TextEdit::search()
640{ 604{
641 editor->find( searchEdit->text(), FALSE, FALSE ); 605 editor->find( searchEdit->text(), FALSE, FALSE );
642} 606}
643 607
644void TextEdit::newFile( const DocLnk &f ) 608void TextEdit::newFile( const DocLnk &f )
645{ 609{
646 DocLnk nf = f; 610 DocLnk nf = f;
647 nf.setType("text/plain"); 611 nf.setType("text/plain");
648 clear(); 612 clear();
649 setWState (WState_Reserved1 ); 613 setWState (WState_Reserved1 );
650 editor->setFocus(); 614 editor->setFocus();
651 doc = new DocLnk(nf); 615 doc = new DocLnk(nf);
652 currentFileName = "Unnamed"; 616 currentFileName = "Unnamed";
653 qDebug("newFile "+currentFileName); 617 qDebug("newFile "+currentFileName);
654 updateCaption( currentFileName); 618 updateCaption( currentFileName);
655// editor->setEdited( FALSE); 619// editor->setEdited( FALSE);
656} 620}
657 621
658void TextEdit::openFile( const QString &f ) 622void TextEdit::openFile( const QString &f )
659{ 623{
660 qDebug("filename is "+ f); 624 qDebug("filename is "+ f);
661 QString filer; 625 QString filer;
662// bFromDocView = TRUE; 626// bFromDocView = TRUE;
663 if(f.find(".desktop",0,TRUE) != -1) { 627 if(f.find(".desktop",0,TRUE) != -1) {
664 switch ( QMessageBox::warning(this,tr("Text Editor"), 628 switch ( QMessageBox::warning(this,tr("Text Editor"),
665 tr("Text Editor has detected\n you selected a .desktop file.\nOpen .desktop file or linked file?"), 629 tr("Text Editor has detected\n you selected a .desktop file.\nOpen .desktop file or linked file?"),
666 tr(".desktop File"),tr("Linked Document"),0,1,1) ) { 630 tr(".desktop File"),tr("Linked Document"),0,1,1) ) {
667 case 0: 631 case 0:
668 filer = f; 632 filer = f;
669 break; 633 break;
670 case 1: 634 case 1:
671 DocLnk sf(f); 635 DocLnk sf(f);
672 filer = sf.file(); 636 filer = sf.file();
673 break; 637 break;
674 } 638 }
675 } else { 639 } else {
676 filer = f; 640 filer = f;
677 fileIs = TRUE; 641 fileIs = TRUE;
678 } 642 }
679 643
680 DocLnk nf; 644 DocLnk nf;
681 nf.setType("text/plain"); 645 nf.setType("text/plain");