summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/textedit/textedit.cpp40
-rw-r--r--core/apps/textedit/textedit.h5
2 files changed, 37 insertions, 8 deletions
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp
index 03f3a1e..78c4d8a 100644
--- a/core/apps/textedit/textedit.cpp
+++ b/core/apps/textedit/textedit.cpp
@@ -144,52 +144,52 @@ static char * filesave_xpm[] = {
144" 90ab=c;dd;e1fg ", 144" 90ab=c;dd;e1fg ",
145" [ahij((kbl0mn$ ", 145" [ahij((kbl0mn$ ",
146" op^q^^7r&]s/$+ ", 146" op^q^^7r&]s/$+ ",
147"@btu;vbwxy]zAB ", 147"@btu;vbwxy]zAB ",
148"CzDEvEv;;DssF$ ", 148"CzDEvEv;;DssF$ ",
149"G.H{E{E{IxsJ$+ ", 149"G.H{E{E{IxsJ$+ ",
150" +...vEKxzLM ", 150" +...vEKxzLM ",
151" +...z]n$ ", 151" +...z]n$ ",
152" +... "}; 152" +... "};
153 153
154 154
155#if QT_VERSION < 300 155#if QT_VERSION < 300
156 156
157class QpeEditor : public QMultiLineEdit 157class QpeEditor : public QMultiLineEdit
158{ 158{
159 // Q_OBJECT 159 // Q_OBJECT
160public: 160public:
161 QpeEditor( QWidget *parent, const char * name = 0 ) 161 QpeEditor( QWidget *parent, const char * name = 0 )
162 : QMultiLineEdit( parent, name ) 162 : QMultiLineEdit( parent, name )
163 { 163 {
164 clearTableFlags(); 164 clearTableFlags();
165 setTableFlags( Tbl_vScrollBar | Tbl_autoHScrollBar ); 165 setTableFlags( Tbl_vScrollBar | Tbl_autoHScrollBar );
166 } 166 }
167 167
168 //public slots:
169 void find( const QString &txt, bool caseSensitive, 168 void find( const QString &txt, bool caseSensitive,
170 bool backwards ); 169 bool backwards );
171 /* 170//public slots:
171 /*
172signals: 172signals:
173 void notFound(); 173 void notFound();
174 void searchWrapped(); 174 void searchWrapped();
175 */ 175 */
176 176
177private: 177private:
178 178
179}; 179};
180 180
181 181
182void QpeEditor::find ( const QString &txt, bool caseSensitive, 182void QpeEditor::find ( const QString &txt, bool caseSensitive,
183 bool backwards ) 183 bool backwards )
184{ 184{
185 static bool wrap = FALSE; 185 static bool wrap = FALSE;
186 int line, col; 186 int line, col;
187 if ( wrap ) { 187 if ( wrap ) {
188 if ( !backwards ) 188 if ( !backwards )
189 line = col = 0; 189 line = col = 0;
190 wrap = FALSE; 190 wrap = FALSE;
191 // emit searchWrapped(); 191 // emit searchWrapped();
192 } else { 192 } else {
193 getCursorPosition( &line, &col ); 193 getCursorPosition( &line, &col );
194 } 194 }
195 //ignore backwards for now.... 195 //ignore backwards for now....
@@ -219,49 +219,50 @@ void QpeEditor::find ( const QString &txt, bool caseSensitive,
219 219
220 220
221#else 221#else
222 222
223#error "Must make a QpeEditor that inherits QTextEdit" 223#error "Must make a QpeEditor that inherits QTextEdit"
224 224
225#endif 225#endif
226 226
227 227
228 228
229 229
230static int u_id = 1; 230static int u_id = 1;
231static int get_unique_id() 231static int get_unique_id()
232{ 232{
233 return u_id++; 233 return u_id++;
234} 234}
235 235
236static const int nfontsizes = 6; 236static const int nfontsizes = 6;
237static const int fontsize[nfontsizes] = {8,10,12,14,18,24}; 237static const int fontsize[nfontsizes] = {8,10,12,14,18,24};
238 238
239TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f ) 239TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f )
240 : QMainWindow( parent, name, f ), bFromDocView( FALSE ) 240 : QMainWindow( parent, name, f ), bFromDocView( FALSE )
241{ 241{
242 doc = 0; 242 doc = 0;
243 243 edited=FALSE;
244 edited1=FALSE;
244 setToolBarsMovable( FALSE ); 245 setToolBarsMovable( FALSE );
245 246
246 setIcon( Resource::loadPixmap( "TextEditor" ) ); 247 setIcon( Resource::loadPixmap( "TextEditor" ) );
247 248
248 QPEToolBar *bar = new QPEToolBar( this ); 249 QPEToolBar *bar = new QPEToolBar( this );
249 bar->setHorizontalStretchable( TRUE ); 250 bar->setHorizontalStretchable( TRUE );
250 menu = bar; 251 menu = bar;
251 252
252 QPEMenuBar *mb = new QPEMenuBar( bar ); 253 QPEMenuBar *mb = new QPEMenuBar( bar );
253 QPopupMenu *file = new QPopupMenu( this ); 254 QPopupMenu *file = new QPopupMenu( this );
254 QPopupMenu *edit = new QPopupMenu( this ); 255 QPopupMenu *edit = new QPopupMenu( this );
255 font = new QPopupMenu( this ); 256 font = new QPopupMenu( this );
256 257
257 bar = new QPEToolBar( this ); 258 bar = new QPEToolBar( this );
258 editBar = bar; 259 editBar = bar;
259 260
260 QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); 261 QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 );
261 connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) ); 262 connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) );
262 a->addTo( bar ); 263 a->addTo( bar );
263 a->addTo( file ); 264 a->addTo( file );
264 265
265 a = new QAction( tr( "Open" ), Resource::loadPixmap( "fileopen" ), QString::null, 0, this, 0 ); 266 a = new QAction( tr( "Open" ), Resource::loadPixmap( "fileopen" ), QString::null, 0, this, 0 );
266 connect( a, SIGNAL( activated() ), this, SLOT( fileOpen() ) ); 267 connect( a, SIGNAL( activated() ), this, SLOT( fileOpen() ) );
267// a->addTo( bar ); 268// a->addTo( bar );
@@ -379,48 +380,49 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f )
379 connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); 380 connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) );
380 a->addTo( searchBar ); 381 a->addTo( searchBar );
381 382
382 edit->insertSeparator(); 383 edit->insertSeparator();
383 a = new QAction( tr( "Delete" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); 384 a = new QAction( tr( "Delete" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
384 connect( a, SIGNAL( activated() ), this, SLOT( editDelete() ) ); 385 connect( a, SIGNAL( activated() ), this, SLOT( editDelete() ) );
385 a->addTo( edit ); 386 a->addTo( edit );
386 387
387 searchBar->hide(); 388 searchBar->hide();
388 389
389 editorStack = new QWidgetStack( this ); 390 editorStack = new QWidgetStack( this );
390 setCentralWidget( editorStack ); 391 setCentralWidget( editorStack );
391 392
392 searchVisible = FALSE; 393 searchVisible = FALSE;
393 394
394 fileSelector = new FileSelector( "text/*", editorStack, "fileselector" , TRUE, TRUE); //buggy 395 fileSelector = new FileSelector( "text/*", editorStack, "fileselector" , TRUE, TRUE); //buggy
395 connect( fileSelector, SIGNAL( closeMe() ), this, SLOT( showEditTools() ) ); 396 connect( fileSelector, SIGNAL( closeMe() ), this, SLOT( showEditTools() ) );
396 connect( fileSelector, SIGNAL( newSelected( const DocLnk &) ), this, SLOT( newFile( const DocLnk & ) ) ); 397 connect( fileSelector, SIGNAL( newSelected( const DocLnk &) ), this, SLOT( newFile( const DocLnk & ) ) );
397 connect( fileSelector, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( openFile( const DocLnk & ) ) ); 398 connect( fileSelector, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( openFile( const DocLnk & ) ) );
398// fileOpen(); 399// fileOpen();
399 400
400 editor = new QpeEditor( editorStack ); 401 editor = new QpeEditor( editorStack );
401 editor->setFrameStyle( QFrame::Panel | QFrame::Sunken ); 402 editor->setFrameStyle( QFrame::Panel | QFrame::Sunken );
402 editorStack->addWidget( editor, get_unique_id() ); 403 editorStack->addWidget( editor, get_unique_id() );
404 connect( editor, SIGNAL( textChanged() ), this, SLOT( editorChanged() ) );
403 405
404 resize( 200, 300 ); 406 resize( 200, 300 );
405 407
406// setFontSize(defsize,TRUE); 408// setFontSize(defsize,TRUE);
407 FontDatabase fdb; 409 FontDatabase fdb;
408 QFont defaultFont=editor->font(); 410 QFont defaultFont=editor->font();
409 QFontInfo fontInfo(defaultFont); 411 QFontInfo fontInfo(defaultFont);
410 412
411 cfg.setGroup("Font"); 413 cfg.setGroup("Font");
412 QString family = cfg.readEntry("Family", fontInfo.family()); 414 QString family = cfg.readEntry("Family", fontInfo.family());
413 QString style = cfg.readEntry("Style", fdb.styleString(defaultFont)); 415 QString style = cfg.readEntry("Style", fdb.styleString(defaultFont));
414 int i_size = cfg.readNumEntry("Size", fontInfo.pointSize()/10); 416 int i_size = cfg.readNumEntry("Size", fontInfo.pointSize()/10);
415 QString charSet = cfg.readEntry("CharSet", QFont::encodingName( fontInfo.charSet()) ); 417 QString charSet = cfg.readEntry("CharSet", QFont::encodingName( fontInfo.charSet()) );
416 418
417 defaultFont = fdb.font(family,style,i_size,charSet); 419 defaultFont = fdb.font(family,style,i_size,charSet);
418 editor->setFont( defaultFont); 420 editor->setFont( defaultFont);
419 421
420 wa->setOn(wrap); 422 wa->setOn(wrap);
421 updateCaption(); 423 updateCaption();
422 424
423 cfg.setGroup("View"); 425 cfg.setGroup("View");
424 if(cfg.readEntry("startNew","TRUE") == "TRUE") { 426 if(cfg.readEntry("startNew","TRUE") == "TRUE") {
425 nStart->setOn(TRUE); 427 nStart->setOn(TRUE);
426 fileNew(); 428 fileNew();
@@ -535,49 +537,52 @@ void TextEdit::fileOpen()
535 updateCaption(); 537 updateCaption();
536} 538}
537 539
538void TextEdit::newFileOpen() 540void TextEdit::newFileOpen()
539{ 541{
540 browseForFiles=new fileBrowser(this,"Open File",TRUE,0, "*"); 542 browseForFiles=new fileBrowser(this,"Open File",TRUE,0, "*");
541 if( browseForFiles->exec() != -1 ) { 543 if( browseForFiles->exec() != -1 ) {
542 QString selFile= browseForFiles->selectedFileName; 544 QString selFile= browseForFiles->selectedFileName;
543 QStringList fileList=browseForFiles->fileList; 545 QStringList fileList=browseForFiles->fileList;
544 qDebug(selFile); 546 qDebug(selFile);
545 QStringList::ConstIterator f; 547 QStringList::ConstIterator f;
546 QString fileTemp; 548 QString fileTemp;
547 for ( f = fileList.begin(); f != fileList.end(); f++ ) { 549 for ( f = fileList.begin(); f != fileList.end(); f++ ) {
548 fileTemp = *f; 550 fileTemp = *f;
549 fileTemp.right( fileTemp.length()-5); 551 fileTemp.right( fileTemp.length()-5);
550 QString fileName = fileTemp; 552 QString fileName = fileTemp;
551 if( fileName != "Unnamed" || fileName != "Empty Text" ) { 553 if( fileName != "Unnamed" || fileName != "Empty Text" ) {
552 currentFileName = fileName; 554 currentFileName = fileName;
553 qDebug("please open "+currentFileName); 555 qDebug("please open "+currentFileName);
554 openFile(fileName ); 556 openFile(fileName );
555 } 557 }
556 } 558 }
557 } 559 }
558 delete browseForFiles; 560 delete browseForFiles;
559 editor->setEdited( true ); 561 editor->setEdited( FALSE);
562 edited1=FALSE;
563 edited=FALSE;
564 setCaption(caption().right(caption().length()-1));
560} 565}
561 566
562#if 0 567#if 0
563void TextEdit::slotFind() 568void TextEdit::slotFind()
564{ 569{
565 FindDialog frmFind( "Text Editor", this ); 570 FindDialog frmFind( "Text Editor", this );
566 connect( &frmFind, SIGNAL(signalFindClicked(const QString &, bool, bool, int)), 571 connect( &frmFind, SIGNAL(signalFindClicked(const QString &, bool, bool, int)),
567 editor, SLOT(slotDoFind( const QString&,bool,bool))); 572 editor, SLOT(slotDoFind( const QString&,bool,bool)));
568 573
569 //case sensitive, backwards, [category] 574 //case sensitive, backwards, [category]
570 575
571 connect( editor, SIGNAL(notFound()), 576 connect( editor, SIGNAL(notFound()),
572 &frmFind, SLOT(slotNotFound()) ); 577 &frmFind, SLOT(slotNotFound()) );
573 connect( editor, SIGNAL(searchWrapped()), 578 connect( editor, SIGNAL(searchWrapped()),
574 &frmFind, SLOT(slotWrapAround()) ); 579 &frmFind, SLOT(slotWrapAround()) );
575 580
576 frmFind.exec(); 581 frmFind.exec();
577 582
578 583
579} 584}
580#endif 585#endif
581 586
582void TextEdit::fileRevert() 587void TextEdit::fileRevert()
583{ 588{
@@ -663,96 +668,104 @@ void TextEdit::openFile( const QString &f )
663 name = name.mid( sep+1 ); 668 name = name.mid( sep+1 );
664 updateCaption( name ); 669 updateCaption( name );
665} 670}
666 671
667void TextEdit::openFile( const DocLnk &f ) 672void TextEdit::openFile( const DocLnk &f )
668{ 673{
669// clear(); 674// clear();
670 bFromDocView = TRUE; 675 bFromDocView = TRUE;
671 FileManager fm; 676 FileManager fm;
672 QString txt; 677 QString txt;
673 currentFileName=f.name(); 678 currentFileName=f.name();
674 qDebug("openFile doclnk " + currentFileName); 679 qDebug("openFile doclnk " + currentFileName);
675 if ( !fm.loadFile( f, txt ) ) { 680 if ( !fm.loadFile( f, txt ) ) {
676 // ####### could be a new file 681 // ####### could be a new file
677 qDebug( "Cannot open file" ); 682 qDebug( "Cannot open file" );
678 683
679 //return; 684 //return;
680 } 685 }
681 686
682 fileNew(); 687 fileNew();
683 if ( doc ) 688 if ( doc )
684 delete doc; 689 delete doc;
685 doc = new DocLnk(f); 690 doc = new DocLnk(f);
686 editor->setText(txt); 691 editor->setText(txt);
687 editor->setEdited( false); 692 editor->setEdited( FALSE);
693 edited1=FALSE;
694 edited=FALSE;
695 setCaption(caption().right(caption().length()-1));
696
688 qDebug("openFile doclnk "+currentFileName); 697 qDebug("openFile doclnk "+currentFileName);
689 doc->setName(currentFileName); 698 doc->setName(currentFileName);
690 updateCaption(); 699 updateCaption();
691} 700}
692 701
693void TextEdit::showEditTools() 702void TextEdit::showEditTools()
694{ 703{
695// if ( !doc ) 704// if ( !doc )
696// close(); 705// close();
697// clear(); 706// clear();
698 fileSelector->hide(); 707 fileSelector->hide();
699 menu->show(); 708 menu->show();
700 editBar->show(); 709 editBar->show();
701 if ( searchVisible ) 710 if ( searchVisible )
702 searchBar->show(); 711 searchBar->show();
703// updateCaption(); 712// updateCaption();
704 editorStack->raiseWidget( editor ); 713 editorStack->raiseWidget( editor );
705 setWState (WState_Reserved1 ); 714 setWState (WState_Reserved1 );
706} 715}
707 716
708/*! 717/*!
709 unprompted save */ 718 unprompted save */
710bool TextEdit::save() 719bool TextEdit::save()
711{ 720{
712 QString file = doc->file(); 721 QString file = doc->file();
713 qDebug(file); 722 qDebug(file);
714 QString name= doc->name(); 723 QString name= doc->name();
715 qDebug(name); 724 qDebug(name);
716 QString rt = editor->text(); 725 QString rt = editor->text();
717 if( !rt.isEmpty() ) { 726 if( !rt.isEmpty() ) {
718 if(name.isEmpty()) { 727 if(name.isEmpty()) {
719 saveAs(); 728 saveAs();
720 } else { 729 } else {
721 currentFileName= name ; 730 currentFileName= name ;
722 qDebug("saveFile "+currentFileName); 731 qDebug("saveFile "+currentFileName);
723 732
724 struct stat buf; 733 struct stat buf;
725 mode_t mode; 734 mode_t mode;
726 stat(file.latin1(), &buf); 735 stat(file.latin1(), &buf);
727 mode = buf.st_mode; 736 mode = buf.st_mode;
728 737
729 doc->setName( name); 738 doc->setName( name);
730 FileManager fm; 739 FileManager fm;
731 if ( !fm.saveFile( *doc, rt ) ) { 740 if ( !fm.saveFile( *doc, rt ) ) {
732 return false; 741 return false;
733 } 742 }
734 editor->setEdited( false ); 743 editor->setEdited( FALSE);
744 edited1=FALSE;
745 edited=FALSE;
746 setCaption(caption().right(caption().length()-1));
747
735 748
736 chmod( file.latin1(), mode); 749 chmod( file.latin1(), mode);
737 } 750 }
738 return true; 751 return true;
739 } 752 }
740 return false; 753 return false;
741} 754}
742 755
743/*! 756/*!
744 prompted save */ 757 prompted save */
745bool TextEdit::saveAs() 758bool TextEdit::saveAs()
746{ 759{
747// qDebug("saveAsFile "+currentFileName); 760// qDebug("saveAsFile "+currentFileName);
748 761
749 // case of nothing to save... /// there's always something to save 762 // case of nothing to save... /// there's always something to save
750// if ( !doc )//|| !bFromDocView) 763// if ( !doc )//|| !bFromDocView)
751// { 764// {
752// qDebug("no doc"); 765// qDebug("no doc");
753// return true; 766// return true;
754// } 767// }
755 if ( !editor->edited() ) { 768 if ( !editor->edited() ) {
756 delete doc; 769 delete doc;
757 doc = 0; 770 doc = 0;
758 return true; 771 return true;
@@ -792,54 +805,59 @@ bool TextEdit::saveAs()
792 qDebug("saving filename "+fileNm); 805 qDebug("saving filename "+fileNm);
793 QFileInfo fi(fileNm); 806 QFileInfo fi(fileNm);
794 currentFileName=fi.fileName(); 807 currentFileName=fi.fileName();
795 if(doc) { 808 if(doc) {
796// QString file = doc->file(); 809// QString file = doc->file();
797// doc->removeFiles(); 810// doc->removeFiles();
798 delete doc; 811 delete doc;
799 DocLnk nf; 812 DocLnk nf;
800 nf.setType("text/plain"); 813 nf.setType("text/plain");
801 nf.setFile( fileNm); 814 nf.setFile( fileNm);
802 doc = new DocLnk(nf); 815 doc = new DocLnk(nf);
803// editor->setText(rt); 816// editor->setText(rt);
804// qDebug("openFile doclnk "+currentFileName); 817// qDebug("openFile doclnk "+currentFileName);
805 doc->setName( currentFileName); 818 doc->setName( currentFileName);
806 updateCaption( currentFileName); 819 updateCaption( currentFileName);
807 820
808 FileManager fm; 821 FileManager fm;
809 if ( !fm.saveFile( *doc, rt ) ) { 822 if ( !fm.saveFile( *doc, rt ) ) {
810 return false; 823 return false;
811 } 824 }
812 if( fileSaveDlg->filePermCheck->isChecked() ) { 825 if( fileSaveDlg->filePermCheck->isChecked() ) {
813 filePermissions *filePerm; 826 filePermissions *filePerm;
814 filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)fileNm); 827 filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)fileNm);
815 filePerm->exec(); 828 filePerm->exec();
816 editor->setEdited( false ); 829
817 if( filePerm) 830 if( filePerm)
818 delete filePerm; 831 delete filePerm;
819 } 832 }
820 } 833 }
821 } 834 }
835 editor->setEdited( FALSE);
836 edited1=FALSE;
837 edited=FALSE;
838 if(caption().left(1)=="*")
839 setCaption(caption().right(caption().length()-1));
822 840
823 if(fileSaveDlg) 841 if(fileSaveDlg)
824 delete fileSaveDlg; 842 delete fileSaveDlg;
825 return true; 843 return true;
826} 844}
827 845
828void TextEdit::clear() 846void TextEdit::clear()
829{ 847{
830 delete doc; 848 delete doc;
831 doc = 0; 849 doc = 0;
832 editor->clear(); 850 editor->clear();
833} 851}
834 852
835void TextEdit::updateCaption( const QString &name ) 853void TextEdit::updateCaption( const QString &name )
836{ 854{
837 if ( !doc ) 855 if ( !doc )
838 setCaption( tr("Text Editor") ); 856 setCaption( tr("Text Editor") );
839 else { 857 else {
840 QString s = name; 858 QString s = name;
841 if ( s.isNull() ) 859 if ( s.isNull() )
842 s = doc->name(); 860 s = doc->name();
843 if ( s.isEmpty() ) { 861 if ( s.isEmpty() ) {
844 s = tr( "Unnamed" ); 862 s = tr( "Unnamed" );
845 currentFileName=s; 863 currentFileName=s;
@@ -917,24 +935,32 @@ void TextEdit::editDelete()
917 if(doc) { 935 if(doc) {
918 doc->removeFiles(); 936 doc->removeFiles();
919 clear(); 937 clear();
920 setCaption( tr("Text Editor") ); 938 setCaption( tr("Text Editor") );
921 } 939 }
922 break; 940 break;
923 case 1: 941 case 1:
924 // exit 942 // exit
925 break; 943 break;
926 }; 944 };
927} 945}
928 946
929void TextEdit::changeStartConfig( bool b ) { 947void TextEdit::changeStartConfig( bool b ) {
930 948
931 Config cfg("TextEdit"); 949 Config cfg("TextEdit");
932 cfg.setGroup("View"); 950 cfg.setGroup("View");
933 if(b) { 951 if(b) {
934 qDebug("bool"); 952 qDebug("bool");
935 cfg.writeEntry("startNew","TRUE"); 953 cfg.writeEntry("startNew","TRUE");
936 } else { 954 } else {
937 cfg.writeEntry("startNew","FALSE"); 955 cfg.writeEntry("startNew","FALSE");
938 } 956 }
939 update(); 957 update();
940} 958}
959
960void TextEdit::editorChanged() {
961 if(editor->edited() && edited && !edited1) {
962 setCaption( "*"+caption());
963 edited1=TRUE;
964 }
965 edited=TRUE;
966}
diff --git a/core/apps/textedit/textedit.h b/core/apps/textedit/textedit.h
index fb58738..e7e20e3 100644
--- a/core/apps/textedit/textedit.h
+++ b/core/apps/textedit/textedit.h
@@ -33,50 +33,53 @@
33#include <qmultilineedit.h> 33#include <qmultilineedit.h>
34#include <qlist.h> 34#include <qlist.h>
35#include <qmap.h> 35#include <qmap.h>
36 36
37class QAction; 37class QAction;
38class QWidgetStack; 38class QWidgetStack;
39class QToolButton; 39class QToolButton;
40class QPopupMenu; 40class QPopupMenu;
41class QToolBar; 41class QToolBar;
42class QLineEdit; 42class QLineEdit;
43class QAction; 43class QAction;
44class FileSelector; 44class FileSelector;
45class QpeEditor; 45class QpeEditor;
46class QPopupMenu; 46class QPopupMenu;
47 47
48class TextEdit : public QMainWindow 48class TextEdit : public QMainWindow
49{ 49{
50 Q_OBJECT 50 Q_OBJECT
51 51
52public: 52public:
53 TextEdit( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); 53 TextEdit( QWidget *parent = 0, const char *name = 0, WFlags f = 0 );
54 ~TextEdit(); 54 ~TextEdit();
55 QPopupMenu *font; 55 QPopupMenu *font;
56 QAction *nStart; 56 QAction *nStart;
57 bool edited, edited1;
57 void openFile( const QString & ); 58 void openFile( const QString & );
58 59public slots:
60 void editorChanged();
61
59protected: 62protected:
60 void closeEvent( QCloseEvent *e ); 63 void closeEvent( QCloseEvent *e );
61 64
62private slots: 65private slots:
63 void setDocument(const QString&); 66 void setDocument(const QString&);
64 void changeFont(); 67 void changeFont();
65 void fileNew(); 68 void fileNew();
66 void fileRevert(); 69 void fileRevert();
67 void fileOpen(); 70 void fileOpen();
68 void newFileOpen(); 71 void newFileOpen();
69 void changeStartConfig(bool); 72 void changeStartConfig(bool);
70 bool save(); 73 bool save();
71 bool saveAs(); 74 bool saveAs();
72 75
73 76
74 void editCut(); 77 void editCut();
75 void editCopy(); 78 void editCopy();
76 void editPaste(); 79 void editPaste();
77 void editFind(); 80 void editFind();
78 void editDelete(); 81 void editDelete();
79 82
80 void findNext(); 83 void findNext();
81 void findClose(); 84 void findClose();
82 85