author | llornkcor <llornkcor> | 2002-10-09 19:06:44 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-10-09 19:06:44 (UTC) |
commit | 381ad47090a7dcf79d1d4fd11fff87ff565fb36b (patch) (side-by-side diff) | |
tree | a7f3b79d610dea39515936d8361fd1c03c9da4d8 /core | |
parent | c80818d8388c07c1606a70306aea0c9a1e17ea3c (diff) | |
download | opie-381ad47090a7dcf79d1d4fd11fff87ff565fb36b.zip opie-381ad47090a7dcf79d1d4fd11fff87ff565fb36b.tar.gz opie-381ad47090a7dcf79d1d4fd11fff87ff565fb36b.tar.bz2 |
split features up
-rw-r--r-- | core/apps/textedit/textedit.cpp | 64 | ||||
-rw-r--r-- | core/apps/textedit/textedit.h | 9 |
2 files changed, 50 insertions, 23 deletions
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp index 6844023..f3937b1 100644 --- a/core/apps/textedit/textedit.cpp +++ b/core/apps/textedit/textedit.cpp @@ -264,2 +264,4 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f ) QPopupMenu *edit = new QPopupMenu( this ); + QPopupMenu *advancedMenu = new QPopupMenu(this); + font = new QPopupMenu( this ); @@ -326,2 +328,7 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f ) font->insertSeparator(); +// font->insertSeparator(); + font->insertItem(tr("Font"), this, SLOT(changeFont()) ); + + font->insertSeparator(); + font->insertItem(tr("Advanced Features"), advancedMenu); @@ -330,8 +337,3 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f ) wa->setToggleAction(TRUE); - wa->addTo( font ); - - font->insertSeparator(); - font->insertItem(tr("Font"), this, SLOT(changeFont()) ); - - font->insertSeparator(); + wa->addTo( advancedMenu); @@ -340,9 +342,18 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f ) nStart->setToggleAction(TRUE); - nStart->addTo( font ); + nStart->addTo( advancedMenu ); - nAdvanced = new QAction( tr("Advanced features"), QString::null, 0, this, 0 ); - connect( nAdvanced, SIGNAL( toggled(bool) ), this, SLOT( doAdvanced(bool) ) ); + nAdvanced = new QAction( tr("Prompt on Exit"), QString::null, 0, this, 0 ); + connect( nAdvanced, SIGNAL( toggled(bool) ), this, SLOT( doPrompt(bool) ) ); nAdvanced->setToggleAction(TRUE); - nAdvanced->addTo( font ); + nAdvanced->addTo( advancedMenu ); + + desktopAction = new QAction( tr("Always open linked file"), QString::null, 0, this, 0 ); + connect( desktopAction, SIGNAL( toggled(bool) ), this, SLOT( doDesktop(bool) ) ); + desktopAction->setToggleAction(TRUE); + desktopAction->addTo( advancedMenu); + filePermAction = new QAction( tr("File Permissions"), QString::null, 0, this, 0 ); + connect( filePermAction, SIGNAL( toggled(bool) ), this, SLOT( doFilePerms(bool) ) ); + filePermAction->setToggleAction(TRUE); + filePermAction->addTo( advancedMenu); @@ -388,3 +399,2 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f ) Config cfg("TextEdit"); - cfg. setGroup ( "Font" ); @@ -405,6 +415,9 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f ) - useAdvancedFeatures = cfg. readBoolEntry ( "AdvancedFeatures", false ); + promptExit = cfg. readBoolEntry ( "PromptExit", false ); + openDesktop = cfg. readBoolEntry ( "OpenDesktop", true ); + filePerms = cfg. readBoolEntry ( "FilePermissions", false ); - if ( useAdvancedFeatures ) - nAdvanced-> setOn ( true ); + if(promptExit ) nAdvanced->setOn ( true ); + if(openDesktop) desktopAction->setOn ( true ); + if(filePerms) filePermAction->setOn ( true ); @@ -425,3 +438,3 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f ) TextEdit::~TextEdit() { - if( edited1 & !useAdvancedFeatures ) + if( edited1 & promptExit ) saveAs(); @@ -443,3 +456,6 @@ void TextEdit::cleanUp() { cfg. writeEntry ( "FileView", viewSelection ); - cfg. writeEntry ( "AdvancedFeatures", useAdvancedFeatures ); + + cfg. writeEntry ( "PromptExit", promptExit ); + cfg. writeEntry ( "OpenDesktop", openDesktop ); + cfg. writeEntry ( "FilePermissions", filePerms ); } @@ -624,3 +640,3 @@ void TextEdit::openFile( const QString &f ) { // bFromDocView = TRUE; - if(f.find(".desktop",0,TRUE) != -1 && useAdvancedFeatures) { + if(f.find(".desktop",0,TRUE) != -1 && !openDesktop) { switch ( QMessageBox::warning(this,tr("Text Editor"), @@ -825,3 +841,3 @@ bool TextEdit::saveAs() { - if( useAdvancedFeatures ) { + if( filePerms ) { filePermissions *filePerm; @@ -949,4 +965,12 @@ void TextEdit::doAbout() { -void TextEdit::doAdvanced(bool b) { - useAdvancedFeatures=b; +void TextEdit::doPrompt(bool b) { + promptExit=b; +} + +void TextEdit::doDesktop(bool b) { + openDesktop=b; +} + +void TextEdit::doFilePerms(bool b) { + filePerms=b; } diff --git a/core/apps/textedit/textedit.h b/core/apps/textedit/textedit.h index a2badaa..4848051 100644 --- a/core/apps/textedit/textedit.h +++ b/core/apps/textedit/textedit.h @@ -59,3 +59,3 @@ public: QPopupMenu *font; - QAction *nStart, *nFileDlgOpt, *nAdvanced; + QAction *nStart, *nFileDlgOpt, *nAdvanced, *desktopAction, *filePermAction; bool edited, edited1; @@ -67,3 +67,3 @@ void receive(const QCString&, const QByteArray&); protected: - bool fileIs, useAdvancedFeatures; + bool fileIs, useAdvancedFeatures, promptExit, openDesktop, filePerms; void closeEvent( QCloseEvent *e ); @@ -72,3 +72,5 @@ private slots: void editPasteTimeDate(); - void doAdvanced(bool); + void doPrompt(bool); + void doDesktop(bool); + void doFilePerms(bool); void doAbout(); @@ -118,2 +120,3 @@ private: QToolBar *menu, *editBar, *searchBar; + QPopupMenu *advancedMenu; QLineEdit *searchEdit; |