Diffstat (limited to 'core/apps/textedit/textedit.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/apps/textedit/textedit.cpp | 70 |
1 files changed, 47 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 | |||
@@ -262,6 +262,8 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f ) | |||
262 | QPEMenuBar *mb = new QPEMenuBar( bar ); | 262 | QPEMenuBar *mb = new QPEMenuBar( bar ); |
263 | QPopupMenu *file = new QPopupMenu( this ); | 263 | QPopupMenu *file = new QPopupMenu( this ); |
264 | QPopupMenu *edit = new QPopupMenu( this ); | 264 | QPopupMenu *edit = new QPopupMenu( this ); |
265 | QPopupMenu *advancedMenu = new QPopupMenu(this); | ||
266 | |||
265 | font = new QPopupMenu( this ); | 267 | font = new QPopupMenu( this ); |
266 | 268 | ||
267 | bar = new QPEToolBar( this ); | 269 | bar = new QPEToolBar( this ); |
@@ -324,27 +326,36 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f ) | |||
324 | zout->addTo( font ); | 326 | zout->addTo( font ); |
325 | 327 | ||
326 | font->insertSeparator(); | 328 | font->insertSeparator(); |
329 | // font->insertSeparator(); | ||
330 | font->insertItem(tr("Font"), this, SLOT(changeFont()) ); | ||
327 | 331 | ||
332 | font->insertSeparator(); | ||
333 | font->insertItem(tr("Advanced Features"), advancedMenu); | ||
334 | |||
328 | QAction *wa = new QAction( tr("Wrap lines"), QString::null, 0, this, 0 ); | 335 | QAction *wa = new QAction( tr("Wrap lines"), QString::null, 0, this, 0 ); |
329 | connect( wa, SIGNAL( toggled(bool) ), this, SLOT( setWordWrap(bool) ) ); | 336 | connect( wa, SIGNAL( toggled(bool) ), this, SLOT( setWordWrap(bool) ) ); |
330 | wa->setToggleAction(TRUE); | 337 | wa->setToggleAction(TRUE); |
331 | wa->addTo( font ); | 338 | wa->addTo( advancedMenu); |
332 | |||
333 | font->insertSeparator(); | ||
334 | font->insertItem(tr("Font"), this, SLOT(changeFont()) ); | ||
335 | |||
336 | font->insertSeparator(); | ||
337 | 339 | ||
338 | nStart = new QAction( tr("Start with new file"), QString::null, 0, this, 0 ); | 340 | nStart = new QAction( tr("Start with new file"), QString::null, 0, this, 0 ); |
339 | connect( nStart, SIGNAL( toggled(bool) ), this, SLOT( changeStartConfig(bool) ) ); | 341 | connect( nStart, SIGNAL( toggled(bool) ), this, SLOT( changeStartConfig(bool) ) ); |
340 | nStart->setToggleAction(TRUE); | 342 | nStart->setToggleAction(TRUE); |
341 | nStart->addTo( font ); | 343 | nStart->addTo( advancedMenu ); |
342 | 344 | ||
343 | nAdvanced = new QAction( tr("Advanced features"), QString::null, 0, this, 0 ); | 345 | nAdvanced = new QAction( tr("Prompt on Exit"), QString::null, 0, this, 0 ); |
344 | connect( nAdvanced, SIGNAL( toggled(bool) ), this, SLOT( doAdvanced(bool) ) ); | 346 | connect( nAdvanced, SIGNAL( toggled(bool) ), this, SLOT( doPrompt(bool) ) ); |
345 | nAdvanced->setToggleAction(TRUE); | 347 | nAdvanced->setToggleAction(TRUE); |
346 | nAdvanced->addTo( font ); | 348 | nAdvanced->addTo( advancedMenu ); |
349 | |||
350 | desktopAction = new QAction( tr("Always open linked file"), QString::null, 0, this, 0 ); | ||
351 | connect( desktopAction, SIGNAL( toggled(bool) ), this, SLOT( doDesktop(bool) ) ); | ||
352 | desktopAction->setToggleAction(TRUE); | ||
353 | desktopAction->addTo( advancedMenu); | ||
347 | 354 | ||
355 | filePermAction = new QAction( tr("File Permissions"), QString::null, 0, this, 0 ); | ||
356 | connect( filePermAction, SIGNAL( toggled(bool) ), this, SLOT( doFilePerms(bool) ) ); | ||
357 | filePermAction->setToggleAction(TRUE); | ||
358 | filePermAction->addTo( advancedMenu); | ||
348 | 359 | ||
349 | font->insertSeparator(); | 360 | font->insertSeparator(); |
350 | 361 | ||
@@ -386,8 +397,7 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f ) | |||
386 | connect( editor, SIGNAL( textChanged() ), this, SLOT( editorChanged() ) ); | 397 | connect( editor, SIGNAL( textChanged() ), this, SLOT( editorChanged() ) ); |
387 | 398 | ||
388 | Config cfg("TextEdit"); | 399 | Config cfg("TextEdit"); |
389 | 400 | cfg. setGroup ( "Font" ); | |
390 | cfg. setGroup ( "Font" ); | ||
391 | 401 | ||
392 | QFont defaultFont = editor-> font ( ); | 402 | QFont defaultFont = editor-> font ( ); |
393 | 403 | ||
@@ -403,11 +413,14 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f ) | |||
403 | 413 | ||
404 | cfg.setGroup ( "View" ); | 414 | cfg.setGroup ( "View" ); |
405 | 415 | ||
406 | useAdvancedFeatures = cfg. readBoolEntry ( "AdvancedFeatures", false ); | 416 | promptExit = cfg. readBoolEntry ( "PromptExit", false ); |
407 | 417 | openDesktop = cfg. readBoolEntry ( "OpenDesktop", true ); | |
408 | if ( useAdvancedFeatures ) | 418 | filePerms = cfg. readBoolEntry ( "FilePermissions", false ); |
409 | nAdvanced-> setOn ( true ); | 419 | |
410 | 420 | if(promptExit ) nAdvanced->setOn ( true ); | |
421 | if(openDesktop) desktopAction->setOn ( true ); | ||
422 | if(filePerms) filePermAction->setOn ( true ); | ||
423 | |||
411 | bool wrap = cfg. readBoolEntry ( "Wrap", true ); | 424 | bool wrap = cfg. readBoolEntry ( "Wrap", true ); |
412 | wa-> setOn ( wrap ); | 425 | wa-> setOn ( wrap ); |
413 | setWordWrap ( wrap ); | 426 | setWordWrap ( wrap ); |
@@ -423,7 +436,7 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f ) | |||
423 | } | 436 | } |
424 | 437 | ||
425 | TextEdit::~TextEdit() { | 438 | TextEdit::~TextEdit() { |
426 | if( edited1 & !useAdvancedFeatures ) | 439 | if( edited1 & promptExit ) |
427 | saveAs(); | 440 | saveAs(); |
428 | } | 441 | } |
429 | 442 | ||
@@ -441,7 +454,10 @@ void TextEdit::cleanUp() { | |||
441 | cfg. setGroup ( "View" ); | 454 | cfg. setGroup ( "View" ); |
442 | cfg. writeEntry ( "Wrap", editor-> wordWrap ( ) == QMultiLineEdit::WidgetWidth ); | 455 | cfg. writeEntry ( "Wrap", editor-> wordWrap ( ) == QMultiLineEdit::WidgetWidth ); |
443 | cfg. writeEntry ( "FileView", viewSelection ); | 456 | cfg. writeEntry ( "FileView", viewSelection ); |
444 | cfg. writeEntry ( "AdvancedFeatures", useAdvancedFeatures ); | 457 | |
458 | cfg. writeEntry ( "PromptExit", promptExit ); | ||
459 | cfg. writeEntry ( "OpenDesktop", openDesktop ); | ||
460 | cfg. writeEntry ( "FilePermissions", filePerms ); | ||
445 | } | 461 | } |
446 | 462 | ||
447 | 463 | ||
@@ -622,7 +638,7 @@ void TextEdit::openFile( const QString &f ) { | |||
622 | qDebug("filename is "+ f); | 638 | qDebug("filename is "+ f); |
623 | QString filer; | 639 | QString filer; |
624 | // bFromDocView = TRUE; | 640 | // bFromDocView = TRUE; |
625 | if(f.find(".desktop",0,TRUE) != -1 && useAdvancedFeatures) { | 641 | if(f.find(".desktop",0,TRUE) != -1 && !openDesktop) { |
626 | switch ( QMessageBox::warning(this,tr("Text Editor"), | 642 | switch ( QMessageBox::warning(this,tr("Text Editor"), |
627 | tr("Text Editor has detected<BR>you selected a <B>.desktop</B> | 643 | tr("Text Editor has detected<BR>you selected a <B>.desktop</B> |
628 | file.<BR>Open <B>.desktop</B> file or <B>linked</B> file?"), | 644 | file.<BR>Open <B>.desktop</B> file or <B>linked</B> file?"), |
@@ -823,7 +839,7 @@ bool TextEdit::saveAs() { | |||
823 | return false; | 839 | return false; |
824 | } | 840 | } |
825 | 841 | ||
826 | if( useAdvancedFeatures ) { | 842 | if( filePerms ) { |
827 | filePermissions *filePerm; | 843 | filePermissions *filePerm; |
828 | filePerm = new filePermissions(this, tr("Permissions"),true,0,(const QString &)fileNm); | 844 | filePerm = new filePermissions(this, tr("Permissions"),true,0,(const QString &)fileNm); |
829 | filePerm->showMaximized(); | 845 | filePerm->showMaximized(); |
@@ -947,8 +963,16 @@ void TextEdit::doAbout() { | |||
947 | "and is licensed under the GPL")); | 963 | "and is licensed under the GPL")); |
948 | } | 964 | } |
949 | 965 | ||
950 | void TextEdit::doAdvanced(bool b) { | 966 | void TextEdit::doPrompt(bool b) { |
951 | useAdvancedFeatures=b; | 967 | promptExit=b; |
968 | } | ||
969 | |||
970 | void TextEdit::doDesktop(bool b) { | ||
971 | openDesktop=b; | ||
972 | } | ||
973 | |||
974 | void TextEdit::doFilePerms(bool b) { | ||
975 | filePerms=b; | ||
952 | } | 976 | } |
953 | 977 | ||
954 | void TextEdit::editPasteTimeDate() { | 978 | void TextEdit::editPasteTimeDate() { |