Initial import.
1 #include "texteditor.h"
4 #include <qstatusbar.h>
5 #include <qmessagebox.h>
7 #include <qapplication.h>
11 #include <qfiledialog.h>
13 #include <qpopupmenu.h>
15 #include <qtextedit.h>
17 #include <qtextstream.h>
18 #include <qpaintdevicemetrics.h>
19 #include <qsettings.h>
20 #include <qfontdialog.h>
21 #include <qmessagebox.h>
22 #include <qcolordialog.h>
24 #include <qlineedit.h>
25 #include <qsimplerichtext.h>
31 #include "icons/fileopen.xpm"
32 #include "icons/filesave.xpm"
33 #include "icons/fileprint.xpm"
34 #include "icons/editundo.xpm"
35 #include "icons/editredo.xpm"
36 #include "icons/editcopy.xpm"
37 #include "icons/editcut.xpm"
38 #include "icons/editpaste.xpm"
39 #include "icons/edittrash.xpm"
40 #include "icons/formatfixedfont.xpm"
41 #include "icons/formattextbold.xpm"
42 #include "icons/formattextitalic.xpm"
43 #include "icons/formattextunder.xpm"
44 #include "icons/formattextleft.xpm"
45 #include "icons/formattextcenter.xpm"
46 #include "icons/formattextright.xpm"
47 #include "icons/formattextjustify.xpm"
49 extern QCanvas* actCanvas;
50 extern int statusbarTime;
51 extern QSettings settings;
56 ///////////////////////////////////////////////////////////////////////
57 ///////////////////////////////////////////////////////////////////////
59 TextEditor::TextEditor()
61 printer = new QPrinter( QPrinter::HighResolution );
64 e = new QTextEdit( this, "editor" );
66 e->setTextFormat(RichText); // default
67 e->setTabStopWidth (20); // unit is pixel
69 connect (e, SIGNAL( textChanged() ), this, SLOT( editorChanged() ) );
70 setCentralWidget( e );
71 statusBar()->message( "Ready", statusbarTime);
72 setCaption("VYM - Note Editor");
78 setupSettingsActions();
81 emptyPaper = QBrush(gray);
82 filledPaper = QBrush(white);
83 inactivePaper= QBrush(black);
87 resize (settings.readNumEntry( "/vym/noteeditor/geometry/width", 450),
88 settings.readNumEntry( "/vym/noteeditor/geometry/height",600));
89 move (settings.readNumEntry( "/vym/noteeditor/geometry/posX", 150),
90 settings.readNumEntry( "/vym/noteeditor/geometry/posY", 50));
92 if (settings.readEntry( "/vym/noteeditor/showWithMain","yes") =="yes")
93 setShowWithMain(true);
95 setShowWithMain(false);
97 varFont.fromString( settings.readEntry
98 ("/vym/noteeditor/fonts/varFont",
99 "Nimbus Sans l,14,-1,5,48,0,0,0,0,0")
101 fixedFont.fromString (settings.readEntry (
102 "/vym/noteeditor/fonts/fixedFont",
103 "Courier,14,-1,5,48,0,0,0,1,0")
105 QString s=settings.readEntry ("/vym/noteeditor/fonts/fonthintDefault","variable");
108 actionSettingsFonthintDefault->setOn (true);
109 e->setCurrentFont (fixedFont);
112 actionSettingsFonthintDefault->setOn (false);
113 e->setCurrentFont (varFont);
118 TextEditor::~TextEditor()
120 if (printer) delete printer;
122 settings.writeEntry( "/vym/noteeditor/geometry/width", width() );
123 settings.writeEntry( "/vym/noteeditor/geometry/height", height() );
124 settings.writeEntry( "/vym/noteeditor/geometry/posX", pos().x() );
125 settings.writeEntry( "/vym/noteeditor/geometry/posY", pos().y() );
128 settings.writeEntry( "/vym/noteeditor/showWithMain","yes");
130 settings.writeEntry( "/vym/noteeditor/showWithMain","no");
133 if (actionSettingsFonthintDefault->isOn() )
137 settings.writeEntry( "/vym/noteeditor/fonts/fonthintDefault",s );
138 settings.writeEntry ("/vym/noteeditor/fonts/varFont",
139 varFont.toString() );
140 settings.writeEntry ("/vym/noteeditor/fonts/fixedFont",
141 fixedFont.toString() );
144 bool TextEditor::isEmpty()
146 if (e->text().length())
152 void TextEditor::setShowWithMain(bool v)
157 bool TextEditor::showWithMain()
162 void TextEditor::setFontHint (const QString &fh)
165 actionFormatUseFixedFont->setOn (true);
167 actionFormatUseFixedFont->setOn (false);
171 QString TextEditor::getFontHint()
173 if (actionFormatUseFixedFont->isOn())
179 QString TextEditor::getFontHintDefault()
181 if (actionSettingsFonthintDefault->isOn())
187 void TextEditor::setFilename(const QString &fn)
189 if (state==filledEditor)
193 statusBar()->message( "No filename available for this note.", statusbarTime );
198 statusBar()->message( QString( "Current filename is %1" ).arg( filename ), statusbarTime );
202 QString TextEditor::getFilename()
207 bool TextEditor::findText(const QString &t, const bool &cs)
209 bool wo=false; // word matches
210 if (e->find (t, cs, wo, true, 0, 0 ))
216 void TextEditor::setupFileActions()
218 QToolBar *tb = new QToolBar( this );
219 tb->setLabel( "File Actions" );
220 QPopupMenu *menu = new QPopupMenu( this );
221 menuBar()->insertItem( tr( "&File" ), menu );
224 a = new QAction( tr( "Import" ), QPixmap( fileopen_xpm), tr( "&Import..." ), CTRL + Key_O, this, "fileImport" );
225 connect( a, SIGNAL( activated() ), this, SLOT( textLoad() ) );
226 a->setEnabled(false);
231 menu->insertSeparator();
232 a = new QAction( tr( "Export Note (HTML)" ), QPixmap( filesave_xpm ), tr( "&Export..." ), CTRL + Key_S, this, "fileSave" );
233 connect( a, SIGNAL( activated() ), this, SLOT( textSave() ) );
238 a = new QAction( tr( "Export Note As (HTML) " ), QPixmap(), tr( "Export &As... (HTML)" ), 0, this, "exportHTML" );
239 connect( a, SIGNAL( activated() ), this, SLOT( textSaveAs() ) );
243 a = new QAction( tr( "Export Note As (ASCII) " ), QPixmap(), tr( "Export &As...(ASCII)" ), ALT + Key_X, this, "exportASCII" );
244 connect( a, SIGNAL( activated() ), this, SLOT( textExportAsASCII() ) );
248 menu->insertSeparator();
249 a = new QAction( tr( "Print Note" ), QPixmap( fileprint_xpm ), tr( "&Print..." ), CTRL + Key_P, this, "filePrint" );
250 connect( a, SIGNAL( activated() ), this, SLOT( textPrint() ) );
256 void TextEditor::setupEditActions()
258 QToolBar *tb = new QToolBar( this );
259 tb->setLabel( "Edit Actions" );
260 QPopupMenu *menu = new QPopupMenu( this );
261 menuBar()->insertItem( tr( "&Edit" ), menu );
264 a = new QAction( tr( "Undo" ), QPixmap(editundo_xpm), tr( "&Undo" ), CTRL + Key_Z, this, "undoEvent" );
265 connect( a, SIGNAL( activated() ), e, SLOT( undo() ) );
270 a = new QAction( tr( "Redo" ), QPixmap( editredo_xpm ), tr( "&Redo" ), CTRL + Key_Y, this, "editRedo" );
271 connect( a, SIGNAL( activated() ), e, SLOT( redo() ) );
276 menu->insertSeparator();
277 a = new QAction( tr( "Select and copy all" ), QPixmap(), tr( "Select and copy &all" ), CTRL + Key_A, this, "editcopyall" );
278 connect( a, SIGNAL( activated() ), this, SLOT( editCopyAll() ) );
281 menu->insertSeparator();
282 a = new QAction( tr( "Copy" ), QPixmap( editcopy_xpm ), tr( "&Copy" ), CTRL + Key_C, this, "editCopy" );
283 connect( a, SIGNAL( activated() ), e, SLOT( copy() ) );
288 a = new QAction( tr( "Cut" ), QPixmap( editcut_xpm ), tr( "Cu&t" ), CTRL + Key_X, this, "editCut" );
289 connect( a, SIGNAL( activated() ), e, SLOT( cut() ) );
294 a = new QAction( tr( "Paste" ), QPixmap( editpaste_xpm ), tr( "&Paste" ), CTRL + Key_V, this, "editPaste" );
295 connect( a, SIGNAL( activated() ), e, SLOT( paste() ) );
300 a = new QAction( tr( "Delete all" ), QPixmap( edittrash_xpm ), tr( "&Delete All" ), 0, this, "editDeleteAll" );
301 connect( a, SIGNAL( activated() ), e, SLOT( clear() ) );
304 actionEditDeleteAll=a;
306 a = new QAction( tr( "Convert paragraphs to linebreaks" ), QPixmap(), tr( "&Convert Paragraphs" ), ALT + Key_P, this, "editConvertPar" );
307 connect( a, SIGNAL( activated() ), this, SLOT( textConvertPar() ) );
309 actionEditConvertPar=a;
311 a = new QAction( tr( "Join all lines of a paragraph" ), QPixmap(), tr( "&Join lines" ), ALT + Key_J, this, "editJoinLines" );
312 connect( a, SIGNAL( activated() ), this, SLOT( textJoinLines() ) );
314 actionEditJoinLines=a;
317 void TextEditor::setupFormatActions()
319 QToolBar *tb = new QToolBar( this );
320 tb->setLabel( "Format Actions" );
321 QPopupMenu *menu = new QPopupMenu( this );
322 menuBar()->insertItem( tr( "&Format" ), menu );
326 a = new QAction( tr( "Toggle font hint for the whole text" ), QPixmap(formatfixedfont_xpm), tr( "&Font hint" ), ALT + Key_I, this, "fontHint" );
327 a->setToggleAction (true);
328 a->setOn (settings.readBoolEntry ("/vym/noteeditor/fonts/useFixedByDefault",false) );
329 connect( a, SIGNAL( activated() ), this, SLOT( toggleFonthint() ) );
332 actionFormatUseFixedFont=a;
334 menu->insertSeparator();
336 comboFont = new QComboBox( true, tb );
338 comboFont->insertStringList( db.families() );
339 connect( comboFont, SIGNAL( activated( const QString & ) ),
340 this, SLOT( textFamily( const QString & ) ) );
341 comboFont->lineEdit()->setText( QApplication::font().family() );
343 comboSize = new QComboBox( true, tb );
344 QValueList<int> sizes = db.standardSizes();
345 QValueList<int>::Iterator it = sizes.begin();
346 for ( ; it != sizes.end(); ++it )
347 comboSize->insertItem( QString::number( *it ) );
348 connect( comboSize, SIGNAL( activated( const QString & ) ),
349 this, SLOT( textSize( const QString & ) ) );
350 comboSize->lineEdit()->setText( QString::number( QApplication::font().pointSize() ) );
352 menu->insertSeparator();
354 QPixmap pix( 16, 16 );
355 pix.fill( e->color());
356 actionTextColor = new QAction( pix, tr( "&Color..." ), 0, this, "textColor" );
357 connect( actionTextColor, SIGNAL( activated() ), this, SLOT( textColor() ) );
358 actionTextColor->addTo( tb );
359 actionTextColor->addTo( menu );
361 actionTextBold = new QAction( QPixmap (formattextbold_xpm), tr( "&Bold" ), CTRL + Key_B, this, "textBold" );
362 connect( actionTextBold, SIGNAL( activated() ), this, SLOT( textBold() ) );
363 actionTextBold->addTo( tb );
364 actionTextBold->addTo( menu );
365 actionTextBold->setToggleAction( true );
366 actionTextItalic = new QAction( QPixmap(formattextitalic_xpm ), tr( "&Italic" ), CTRL + Key_I, this, "textItalic" );
367 connect( actionTextItalic, SIGNAL( activated() ), this, SLOT( textItalic() ) );
368 actionTextItalic->addTo( tb );
369 actionTextItalic->addTo( menu );
370 actionTextItalic->setToggleAction( true );
371 actionTextUnderline = new QAction( QPixmap (formattextunder_xpm ), tr( "&Underline" ), CTRL + Key_U, this, "textUnderline" );
372 connect( actionTextUnderline, SIGNAL( activated() ), this, SLOT( textUnderline() ) );
373 actionTextUnderline->addTo( tb );
374 actionTextUnderline->addTo( menu );
375 actionTextUnderline->setToggleAction( true );
376 menu->insertSeparator();
378 QActionGroup *grp = new QActionGroup( this );
379 connect( grp, SIGNAL( selected( QAction* ) ), this, SLOT( textAlign( QAction* ) ) );
381 actionAlignLeft = new QAction( QPixmap (formattextleft_xpm ), tr( "&Left" ), CTRL + Key_L, grp, "textLeft" );
382 actionAlignLeft->setToggleAction( true );
383 actionAlignCenter = new QAction( QPixmap (formattextcenter_xpm ), tr( "C&enter" ), CTRL + Key_E, grp, "textCenter" );
384 actionAlignCenter->setToggleAction( true );
385 actionAlignRight = new QAction( QPixmap (formattextright_xpm ), tr( "&Right" ), CTRL + Key_R, grp, "textRight" );
386 actionAlignRight->setToggleAction( true );
387 actionAlignJustify = new QAction( QPixmap ( formattextjustify_xpm ), tr( "&Justify" ), CTRL + Key_J, grp, "textjustify" );
388 actionAlignJustify->setToggleAction( true );
393 connect( e, SIGNAL( currentFontChanged( const QFont & ) ),
394 this, SLOT( fontChanged( const QFont & ) ) );
395 connect( e, SIGNAL( currentColorChanged( const QColor & ) ),
396 this, SLOT( colorChanged( const QColor & ) ) );
397 connect( e, SIGNAL( currentAlignmentChanged( int ) ),
398 this, SLOT( alignmentChanged( int ) ) );
402 void TextEditor::setupSettingsActions()
404 QPopupMenu *menu = new QPopupMenu( this );
405 menuBar()->insertItem( tr( "&Settings" ), menu );
408 a = new QAction( tr( "Set fixed font" ), QPixmap(), tr( "Set &fixed font" ), 0, this, "setFixedFont" );
409 connect( a, SIGNAL( activated() ), this, SLOT( setFixedFont() ) );
411 actionSettingsFixedFont=a;
413 a = new QAction( tr( "Set variable font" ), QPixmap(), tr( "Set &variable font" ), 0, this, "setvariableFont" );
414 connect( a, SIGNAL( activated() ), this, SLOT( setVarFont() ) );
416 actionSettingsVarFont=a;
418 a = new QAction( tr( "Used fixed font by default" ), QPixmap(), tr( "&fixed font is default" ), 0, this, "fonthintDefault" );
419 a->setToggleAction (true);
420 // set state later in constructor...
422 actionSettingsFonthintDefault=a;
425 void TextEditor::textLoad()
427 if (state!=inactiveEditor)
431 QMessageBox mb( "VYM - Note Editor",
432 "Loading will overwrite the existing note",
433 QMessageBox::Warning,
434 QMessageBox::Yes | QMessageBox::Default,
437 mb.setButtonText( QMessageBox::Yes, "Load note" );
438 switch( mb.exec() ) {
439 case QMessageBox::Cancel:
445 QFileDialog *fd=new QFileDialog( this);
446 fd->addFilter ("ASCII texts (*.txt)");
447 fd->addFilter ("VYM notes (*.html)");
450 if ( fd->exec() == QDialog::Accepted )
451 fn = fd->selectedFile();
456 if ( !f.open( IO_ReadOnly ) )
459 QTextStream ts( &f );
460 setText( ts.read() );
466 void TextEditor::closeEvent( QCloseEvent* ce )
468 if ( !e->isModified() )
470 ce->accept(); // TextEditor can be reopened with show()
475 QString TextEditor::getText()
480 void TextEditor::editorChanged()
482 // received, when QTextEdit::text() has changed
483 EditorState oldstate=state;
490 if (state != oldstate)
492 if (state==emptyEditor)
493 e->setPaper (emptyPaper);
495 e->setPaper (filledPaper);
497 // SLOT is LinkableMapObj, which will update systemFlag
498 emit (textHasChanged() );
502 void TextEditor::setText(QString t)
504 if ( !QStyleSheet::mightBeRichText( t ) )
505 t = QStyleSheet::convertFromPlainText( t, QStyleSheetItem::WhiteSpaceNormal );
506 e->setReadOnly(false);
508 editorChanged(); //not called automagically
513 void TextEditor::setInactive()
516 state=inactiveEditor;
517 e->setPaper (inactivePaper);
518 e->setReadOnly (true);
523 void TextEditor::editCopyAll()
529 void TextEditor::textSaveAs()
531 QString fn = QFileDialog::getSaveFileName( QString::null, "VYM Note (HTML) (*.html);;All files (*)",
532 this,"export note dialog",tr("Export Note to single file") );
539 QMessageBox mb( "VYM",
540 tr("The file ") + fn +
541 tr(" exists already. "
542 "Do you want to overwrite it?"),
543 QMessageBox::Warning,
544 QMessageBox::Yes | QMessageBox::Default,
545 QMessageBox::Cancel | QMessageBox::Escape,
546 QMessageBox::NoButton );
547 mb.setButtonText( QMessageBox::Yes, tr("Overwrite") );
548 mb.setButtonText( QMessageBox::No, tr("Cancel"));
549 switch( mb.exec() ) {
550 case QMessageBox::Yes:
555 case QMessageBox::Cancel:
566 statusBar()->message(tr( "Couldn't export note ") + fn, statusbarTime );
570 void TextEditor::textSave()
572 if ( filename.isEmpty() )
578 QString text = e->text();
580 if ( !f.open( IO_WriteOnly ) )
582 statusBar()->message( QString("Could not write to %1").arg(filename),
591 e->setModified( FALSE );
593 statusBar()->message( QString( "Note exported as %1" ).arg( filename ), statusbarTime );
596 void TextEditor::textConvertPar()
598 // In X11 a copy&paste generates paragraphs,
599 // which is not always wanted
600 // This function replaces paragraphs by linebreaks.
601 int parFrom, parTo, indFrom, indTo;
602 e->getSelection (&parFrom,&indFrom,&parTo,&indTo);
612 t.replace ("</p>","<br />");
615 e->setCursorPosition (parFrom,indFrom);
617 // Tried to simply insert the changed text with
618 // e->insert (t,(uint)(QTextEdit::RemoveSelected));
619 // but then the html would be quoted. So I use the ugly
620 // way: insert a marker, replace it in whole text of QTextEdit
621 QString marker="R3PlAcEMeL4teR!";
623 e->setText (e->text().replace(marker,t));
628 void TextEditor::textJoinLines()
630 int parFrom, parTo, indFrom, indTo;
631 e->getSelection (&parFrom,&indFrom,&parTo,&indTo);
637 // In addition to textConvertPar it is sometimes
638 // useful to join all lines of a paragraph
639 QRegExp re("</p>\n+<p>(?!</p>)");
643 // Above we may have introduced new " " at beginning of a
644 // paragraph - remove it.
645 re.setPattern("<p> ");
646 t.replace (re,"<p>");
649 e->setCursorPosition (parFrom,indFrom);
651 // Tried to simply insert the changed text with
652 // e->insert (t,(uint)(QTextEdit::RemoveSelected));
653 // but then the html would be quoted. So I use the ugly
654 // way: insert a marker, replace it in whole text of QTextEdit
655 QString marker="R3PlAcEMeL4teR!";
657 e->setText (e->text().replace(marker,t));
662 QString TextEditor::textConvertToASCII(const QString &t)
666 // convert all "<br*>" to "\n"
667 QRegExp re("<br.*>");
671 // convert all "</p>" to "\n"
672 re.setPattern ("/p");
675 // remove all remaining tags
676 re.setPattern ("<.*>");
679 // convert "&", "<" and ">"
680 re.setPattern (">");
682 re.setPattern ("<");
684 re.setPattern ("&");
689 void TextEditor::textExportAsASCII()
691 QString text = textConvertToASCII( e->text());
692 QString fn = QFileDialog::getSaveFileName( QString::null, "VYM Note (ASCII) (*.txt);;All files (*)",
693 this,"export note dialog",tr("Export Note to single file (ASCII)") );
701 QMessageBox mb( "VYM",
702 tr("The file ") + fn +
703 tr(" exists already. "
704 "Do you want to overwrite it?"),
705 QMessageBox::Warning,
706 QMessageBox::Yes | QMessageBox::Default,
707 QMessageBox::Cancel | QMessageBox::Escape,
708 QMessageBox::NoButton );
709 mb.setButtonText( QMessageBox::Yes, tr("Overwrite") );
710 mb.setButtonText( QMessageBox::No, tr("Cancel"));
713 if (ret==QMessageBox::Cancel)
717 if ( !file.open( IO_WriteOnly ) )
718 statusBar()->message( QString("Could not write to %1").arg(filename),
722 QTextStream t( &file );
726 statusBar()->message( QString( "Note exported as %1" ).arg( fn ), statusbarTime );
732 void TextEditor::textPrint()
734 printer->setFullPage(TRUE);
735 if ( printer->setup( this ) )
737 QPainter p( printer );
738 // Check that there is a valid device to print to.
739 if ( !p.device() ) return;
740 QPaintDeviceMetrics metrics( p.device() );
741 int dpiy = metrics.logicalDpiY();
742 int margin = (int) ( (2/2.54)*dpiy ); // 2 cm margins
743 QRect body( margin, margin, metrics.width() - 2*margin, metrics.height() - 2*margin );
744 QFont font( e->currentFont() );
745 font.setPointSize( 10 ); // we define 10pt to be a nice base size for printing
747 QSimpleRichText richText( e->text(), font,
750 e->mimeSourceFactory(),
752 richText.setWidth( &p, body.width() );
757 richText.draw( &p, body.left(), body.top(), view, colorGroup() );
758 view.moveBy( 0, body.height() );
759 p.translate( 0 , -body.height() );
761 p.drawText( view.right() - p.fontMetrics().width( QString::number( page ) ),
762 view.bottom() + p.fontMetrics().ascent() + 5, QString::number( page ) );
763 if ( view.top() >= richText.height() )
771 void TextEditor::textEditUndo()
775 void TextEditor::toggleFonthint()
777 setUpdatesEnabled (false);
779 if (!actionFormatUseFixedFont->isOn() )
780 e->setCurrentFont (varFont);
782 e->setCurrentFont (fixedFont);
783 e->selectAll (false);
784 setUpdatesEnabled (true);
788 void TextEditor::setFixedFont()
791 QFont font =QFontDialog::getFont(
792 &ok, fixedFont, this );
794 // font is set to the font the user selected
798 void TextEditor::setVarFont()
801 QFont font =QFontDialog::getFont(
802 &ok, varFont, this );
804 // font is set to the font the user selected
808 void TextEditor::textBold()
810 e->setBold( actionTextBold->isOn() );
813 void TextEditor::textUnderline()
815 e->setUnderline( actionTextUnderline->isOn() );
818 void TextEditor::textItalic()
820 e->setItalic( actionTextItalic->isOn() );
823 void TextEditor::textFamily( const QString &f )
828 void TextEditor::textSize( const QString &p )
830 e->setPointSize( p.toInt() );
834 void TextEditor::textColor()
836 QColor col = QColorDialog::getColor( e->color(), this );
837 if ( !col.isValid() )
840 QPixmap pix( 16, 16 );
842 actionTextColor->setIconSet( pix );
845 void TextEditor::textAlign( QAction *a )
847 if ( a == actionAlignLeft )
848 e->setAlignment( AlignLeft );
849 else if ( a == actionAlignCenter )
850 e->setAlignment( AlignHCenter );
851 else if ( a == actionAlignRight )
852 e->setAlignment( AlignRight );
853 else if ( a == actionAlignJustify )
854 e->setAlignment( AlignJustify );
857 void TextEditor::fontChanged( const QFont &f )
859 comboFont->lineEdit()->setText( f.family() );
860 comboSize->lineEdit()->setText( QString::number( f.pointSize() ) );
861 actionTextBold->setOn( f.bold() );
862 actionTextItalic->setOn( f.italic() );
863 actionTextUnderline->setOn( f.underline() );
866 void TextEditor::colorChanged( const QColor &c )
868 QPixmap pix( 16, 16 );
870 actionTextColor->setIconSet( pix );
873 void TextEditor::alignmentChanged( int a )
875 if ( ( a == AlignAuto ) || ( a & AlignLeft ))
876 actionAlignLeft->setOn( true );
877 else if ( ( a & AlignHCenter ) )
878 actionAlignCenter->setOn( true );
879 else if ( ( a & AlignRight ) )
880 actionAlignRight->setOn( true );
881 else if ( ( a & AlignJustify ) )
882 actionAlignJustify->setOn( true );
887 void TextEditor::enableActions()
889 actionFileLoad->setEnabled(true);
890 actionFileSave->setEnabled(true);
891 actionFileSaveAs->setEnabled(true);
892 actionFilePrint->setEnabled(true);
893 actionEditUndo->setEnabled(true);
894 actionEditRedo->setEnabled(true);
895 actionEditCopy->setEnabled(true);
896 actionEditCut->setEnabled(true);
897 actionEditPaste->setEnabled(true);
898 actionEditDeleteAll->setEnabled(true);
899 actionEditConvertPar->setEnabled(true);
900 actionEditJoinLines->setEnabled(true);
901 actionFormatUseFixedFont->setEnabled(true);
904 void TextEditor::disableActions()
906 actionFileLoad->setEnabled(false);
907 actionFileSave->setEnabled(false);
908 actionFileSaveAs->setEnabled(false);
909 actionFilePrint->setEnabled(false);
910 actionEditUndo->setEnabled(false);
911 actionEditRedo->setEnabled(false);
912 actionEditCopy->setEnabled(false);
913 actionEditCut->setEnabled(false);
914 actionEditPaste->setEnabled(false);
915 actionEditDeleteAll->setEnabled(false);
916 actionEditConvertPar->setEnabled(false);
917 actionEditJoinLines->setEnabled(false);
918 actionFormatUseFixedFont->setEnabled(false);