summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/textedit/textedit.cpp24
-rw-r--r--core/apps/textedit/textedit.h5
2 files changed, 23 insertions, 6 deletions
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp
index b276cbb..0af18da 100644
--- a/core/apps/textedit/textedit.cpp
+++ b/core/apps/textedit/textedit.cpp
@@ -333,30 +333,39 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f )
333 font->insertSeparator(); 333 font->insertSeparator();
334#endif 334#endif
335 335
336 QAction *wa = new QAction( tr("Wrap lines"), QString::null, 0, this, 0 ); 336 QAction *wa = new QAction( tr("Wrap lines"), QString::null, 0, this, 0 );
337 connect( wa, SIGNAL( toggled(bool) ), this, SLOT( setWordWrap(bool) ) ); 337 connect( wa, SIGNAL( toggled(bool) ), this, SLOT( setWordWrap(bool) ) );
338 wa->setToggleAction(TRUE); 338 wa->setToggleAction(TRUE);
339 wa->addTo( font ); 339 wa->addTo( font );
340 340
341 font->insertSeparator(); 341 font->insertSeparator();
342 font->insertItem(tr("Font"), this, SLOT(changeFont()) ); 342 font->insertItem(tr("Font"), this, SLOT(changeFont()) );
343 343
344 font->insertSeparator(); 344 font->insertSeparator();
345
345 nStart = new QAction( tr("Start with new file"), QString::null, 0, this, 0 ); 346 nStart = new QAction( tr("Start with new file"), QString::null, 0, this, 0 );
346 connect( nStart, SIGNAL( toggled(bool) ), this, SLOT( changeStartConfig(bool) ) ); 347 connect( nStart, SIGNAL( toggled(bool) ), this, SLOT( changeStartConfig(bool) ) );
347 nStart->setToggleAction(TRUE); 348 nStart->setToggleAction(TRUE);
348 nStart->addTo( font ); 349 nStart->addTo( font );
350
351 nAdvanced = new QAction( tr("Advanced features"), QString::null, 0, this, 0 );
352 connect( nAdvanced, SIGNAL( toggled(bool) ), this, SLOT( doAdvanced(bool) ) );
353 nAdvanced->setToggleAction(TRUE);
354 nAdvanced->addTo( font );
355 if(cfg.readBoolEntry("AdvancedFeatures"))
356 nAdvanced->setOn(TRUE);
349 font->insertSeparator(); 357 font->insertSeparator();
350 font->insertItem(tr("About"), this, SLOT( doAbout()) ); 358
359 font->insertItem(tr("About"), this, SLOT( doAbout()) );
351 360
352 mb->insertItem( tr( "File" ), file ); 361 mb->insertItem( tr( "File" ), file );
353 mb->insertItem( tr( "Edit" ), edit ); 362 mb->insertItem( tr( "Edit" ), edit );
354 mb->insertItem( tr( "View" ), font ); 363 mb->insertItem( tr( "View" ), font );
355 364
356 searchBar = new QPEToolBar(this); 365 searchBar = new QPEToolBar(this);
357 addToolBar( searchBar, "Search", QMainWindow::Top, TRUE ); 366 addToolBar( searchBar, "Search", QMainWindow::Top, TRUE );
358 367
359 searchBar->setHorizontalStretchable( TRUE ); 368 searchBar->setHorizontalStretchable( TRUE );
360 369
361 searchEdit = new QLineEdit( searchBar, "searchEdit" ); 370 searchEdit = new QLineEdit( searchBar, "searchEdit" );
362 searchBar->setStretchableWidget( searchEdit ); 371 searchBar->setStretchableWidget( searchEdit );
@@ -614,25 +623,25 @@ void TextEdit::newFile( const DocLnk &f )
614 doc = new DocLnk(nf); 623 doc = new DocLnk(nf);
615 currentFileName = "Unnamed"; 624 currentFileName = "Unnamed";
616 qDebug("newFile "+currentFileName); 625 qDebug("newFile "+currentFileName);
617 updateCaption( currentFileName); 626 updateCaption( currentFileName);
618// editor->setEdited( FALSE); 627// editor->setEdited( FALSE);
619} 628}
620 629
621void TextEdit::openFile( const QString &f ) 630void TextEdit::openFile( const QString &f )
622{ 631{
623 qDebug("filename is "+ f); 632 qDebug("filename is "+ f);
624 QString filer; 633 QString filer;
625// bFromDocView = TRUE; 634// bFromDocView = TRUE;
626 if(f.find(".desktop",0,TRUE) != -1) { 635 if(f.find(".desktop",0,TRUE) != -1 && useAdvancedFeatures) {
627 switch ( QMessageBox::warning(this,tr("Text Editor"), 636 switch ( QMessageBox::warning(this,tr("Text Editor"),
628 tr("Text Editor has detected\n you selected a .desktop file.\nOpen .desktop file or linked file?"), 637 tr("Text Editor has detected\n you selected a .desktop file.\nOpen .desktop file or linked file?"),
629 tr(".desktop File"),tr("Linked Document"),0,1,1) ) { 638 tr(".desktop File"),tr("Linked Document"),0,1,1) ) {
630 case 0: 639 case 0:
631 filer = f; 640 filer = f;
632 break; 641 break;
633 case 1: 642 case 1:
634 DocLnk sf(f); 643 DocLnk sf(f);
635 filer = sf.file(); 644 filer = sf.file();
636 break; 645 break;
637 } 646 }
638 } else { 647 } else {
@@ -814,32 +823,32 @@ bool TextEdit::saveAs()
814 nf.setFile( fileNm); 823 nf.setFile( fileNm);
815 doc = new DocLnk(nf); 824 doc = new DocLnk(nf);
816// editor->setText(rt); 825// editor->setText(rt);
817// qDebug("openFile doclnk "+currentFileName); 826// qDebug("openFile doclnk "+currentFileName);
818 doc->setName( currentFileName); 827 doc->setName( currentFileName);
819 updateCaption( currentFileName); 828 updateCaption( currentFileName);
820 829
821 FileManager fm; 830 FileManager fm;
822 if ( !fm.saveFile( *doc, rt ) ) { 831 if ( !fm.saveFile( *doc, rt ) ) {
823 return false; 832 return false;
824 } 833 }
825 834
826// if( fileSaveDlg->filePermCheck->isChecked() ) { 835 if( useAdvancedFfeatures ) {
827 filePermissions *filePerm; 836 filePermissions *filePerm;
828 filePerm = new filePermissions(this, tr("Permissions"),true,0,(const QString &)fileNm); 837 filePerm = new filePermissions(this, tr("Permissions"),true,0,(const QString &)fileNm);
829 filePerm->exec(); 838 filePerm->exec();
830 839
831 if( filePerm) 840 if( filePerm)
832 delete filePerm; 841 delete filePerm;
833// } 842 }
834 } 843 }
835 } 844 }
836 editor->setEdited(TRUE); 845 editor->setEdited(TRUE);
837 edited1=FALSE; 846 edited1=FALSE;
838 edited=TRUE; 847 edited=TRUE;
839 if(caption().left(1)=="*") 848 if(caption().left(1)=="*")
840 setCaption(caption().right(caption().length()-1)); 849 setCaption(caption().right(caption().length()-1));
841 850
842 return true; 851 return true;
843} //end saveAs 852} //end saveAs
844 853
845void TextEdit::clear() 854void TextEdit::clear()
@@ -957,12 +966,19 @@ void TextEdit::receive(const QCString&msg, const QByteArray&) {
957 qDebug("QCop "+msg); 966 qDebug("QCop "+msg);
958 if ( msg == "setDocument(QString)" ) { 967 if ( msg == "setDocument(QString)" ) {
959 qDebug("bugger all"); 968 qDebug("bugger all");
960 } 969 }
961 970
962} 971}
963void TextEdit::doAbout() { 972void TextEdit::doAbout() {
964 QMessageBox::about(0,"Text Edit","Text Edit is copyright\n" 973 QMessageBox::about(0,"Text Edit","Text Edit is copyright\n"
965 "2000 Trolltech AS, and\n" 974 "2000 Trolltech AS, and\n"
966 "2002 by L.J.Potter \nljp@llornkcor.com\n" 975 "2002 by L.J.Potter \nljp@llornkcor.com\n"
967 "and is licensed under the GPL"); 976 "and is licensed under the GPL");
968} 977}
978
979void TextEdit::doAdvanced(bool b) {
980 useAdvancedFeatures=b;
981 Config cfg("TextEdit");
982 cfg.setGroup("View");
983 cfg.writeEntry("AdvancedFeatures",b);
984}
diff --git a/core/apps/textedit/textedit.h b/core/apps/textedit/textedit.h
index 764d852..aec6427 100644
--- a/core/apps/textedit/textedit.h
+++ b/core/apps/textedit/textedit.h
@@ -48,36 +48,37 @@ class FileSelector;
48class QpeEditor; 48class QpeEditor;
49class QPopupMenu; 49class QPopupMenu;
50 50
51class TextEdit : public QMainWindow 51class TextEdit : public QMainWindow
52{ 52{
53 Q_OBJECT 53 Q_OBJECT
54 54
55public: 55public:
56 TextEdit( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); 56 TextEdit( QWidget *parent = 0, const char *name = 0, WFlags f = 0 );
57 ~TextEdit(); 57 ~TextEdit();
58 58
59 QPopupMenu *font; 59 QPopupMenu *font;
60 QAction *nStart, *nFileDlgOpt; 60 QAction *nStart, *nFileDlgOpt, *nAdvanced;
61 bool edited, edited1; 61 bool edited, edited1;
62 void openFile( const QString & ); 62 void openFile( const QString & );
63 QCopChannel * channel; 63 QCopChannel * channel;
64public slots: 64public slots:
65 void editorChanged(); 65 void editorChanged();
66void receive(const QCString&, const QByteArray&); 66void receive(const QCString&, const QByteArray&);
67protected: 67protected:
68 bool fileIs; 68 bool fileIs, useAdvancedFeatures;
69 void closeEvent( QCloseEvent *e ); 69 void closeEvent( QCloseEvent *e );
70 void doSearchBar(); 70 void doSearchBar();
71private slots: 71private slots:
72 void doAdvanced(bool);
72 void doAbout(); 73 void doAbout();
73 void setDocument(const QString&); 74 void setDocument(const QString&);
74 void changeFont(); 75 void changeFont();
75 void fileNew(); 76 void fileNew();
76 void fileRevert(); 77 void fileRevert();
77 void fileOpen(); 78 void fileOpen();
78 void changeStartConfig(bool); 79 void changeStartConfig(bool);
79 bool save(); 80 bool save();
80 bool saveAs(); 81 bool saveAs();
81 void cleanUp(); 82 void cleanUp();
82 83
83 84