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;
53 extern QAction *actionViewToggleNoteEditor;
58 ///////////////////////////////////////////////////////////////////////
59 ///////////////////////////////////////////////////////////////////////
61 TextEditor::TextEditor()
63 printer = new QPrinter( QPrinter::HighResolution );
66 e = new QTextEdit( this, "editor" );
68 e->setTextFormat(RichText); // default
69 e->setTabStopWidth (20); // unit is pixel
71 connect (e, SIGNAL( textChanged() ), this, SLOT( editorChanged() ) );
72 setCentralWidget( e );
73 statusBar()->message( "Ready", statusbarTime);
74 setCaption("VYM - Note Editor");
80 setupSettingsActions();
83 emptyPaper = QBrush(gray);
84 filledPaper = QBrush(white);
85 inactivePaper= QBrush(black);
89 resize (settings.readNumEntry( "/vym/noteeditor/geometry/width", 450),
90 settings.readNumEntry( "/vym/noteeditor/geometry/height",600));
91 move (settings.readNumEntry( "/vym/noteeditor/geometry/posX", 150),
92 settings.readNumEntry( "/vym/noteeditor/geometry/posY", 50));
94 if (settings.readEntry( "/vym/noteeditor/showWithMain","yes") =="yes")
95 setShowWithMain(true);
97 setShowWithMain(false);
99 varFont.fromString( settings.readEntry
100 ("/vym/noteeditor/fonts/varFont",
101 "Nimbus Sans l,14,-1,5,48,0,0,0,0,0")
103 fixedFont.fromString (settings.readEntry (
104 "/vym/noteeditor/fonts/fixedFont",
105 "Courier,14,-1,5,48,0,0,0,1,0")
107 QString s=settings.readEntry ("/vym/noteeditor/fonts/fonthintDefault","variable");
110 actionSettingsFonthintDefault->setOn (true);
111 e->setCurrentFont (fixedFont);
114 actionSettingsFonthintDefault->setOn (false);
115 e->setCurrentFont (varFont);
120 TextEditor::~TextEditor()
122 if (printer) delete printer;
124 settings.writeEntry( "/vym/noteeditor/geometry/width", width() );
125 settings.writeEntry( "/vym/noteeditor/geometry/height", height() );
126 settings.writeEntry( "/vym/noteeditor/geometry/posX", pos().x() );
127 settings.writeEntry( "/vym/noteeditor/geometry/posY", pos().y() );
130 settings.writeEntry( "/vym/noteeditor/showWithMain","yes");
132 settings.writeEntry( "/vym/noteeditor/showWithMain","no");
135 if (actionSettingsFonthintDefault->isOn() )
139 settings.writeEntry( "/vym/noteeditor/fonts/fonthintDefault",s );
140 settings.writeEntry ("/vym/noteeditor/fonts/varFont",
141 varFont.toString() );
142 settings.writeEntry ("/vym/noteeditor/fonts/fixedFont",
143 fixedFont.toString() );
146 bool TextEditor::isEmpty()
148 if (e->text().length())
154 void TextEditor::setShowWithMain(bool v)
159 bool TextEditor::showWithMain()
164 void TextEditor::setFontHint (const QString &fh)
167 actionFormatUseFixedFont->setOn (true);
169 actionFormatUseFixedFont->setOn (false);
173 QString TextEditor::getFontHint()
175 if (actionFormatUseFixedFont->isOn())
181 QString TextEditor::getFontHintDefault()
183 if (actionSettingsFonthintDefault->isOn())
189 void TextEditor::setFilename(const QString &fn)
191 if (state==filledEditor)
195 statusBar()->message( "No filename available for this note.", statusbarTime );
200 statusBar()->message( QString( "Current filename is %1" ).arg( filename ), statusbarTime );
204 QString TextEditor::getFilename()
209 bool TextEditor::findText(const QString &t, const bool &cs)
211 bool wo=false; // word matches
212 if (e->find (t, cs, wo, true, 0, 0 ))
218 void TextEditor::setupFileActions()
220 QToolBar *tb = new QToolBar( this );
221 tb->setLabel( "File Actions" );
222 QPopupMenu *menu = new QPopupMenu( this );
223 menuBar()->insertItem( tr( "&File" ), menu );
226 a = new QAction( tr( "Import" ), QPixmap( fileopen_xpm), tr( "&Import..." ), CTRL + Key_O, this, "fileImport" );
227 connect( a, SIGNAL( activated() ), this, SLOT( textLoad() ) );
228 a->setEnabled(false);
233 menu->insertSeparator();
234 a = new QAction( tr( "Export Note (HTML)" ), QPixmap( filesave_xpm ), tr( "&Export..." ), CTRL + Key_S, this, "fileSave" );
235 connect( a, SIGNAL( activated() ), this, SLOT( textSave() ) );
240 a = new QAction( tr( "Export Note As (HTML) " ), QPixmap(), tr( "Export &As... (HTML)" ), 0, this, "exportHTML" );
241 connect( a, SIGNAL( activated() ), this, SLOT( textSaveAs() ) );
245 a = new QAction( tr( "Export Note As (ASCII) " ), QPixmap(), tr( "Export &As...(ASCII)" ), ALT + Key_X, this, "exportASCII" );
246 connect( a, SIGNAL( activated() ), this, SLOT( textExportAsASCII() ) );
250 menu->insertSeparator();
251 a = new QAction( tr( "Print Note" ), QPixmap( fileprint_xpm ), tr( "&Print..." ), CTRL + Key_P, this, "filePrint" );
252 connect( a, SIGNAL( activated() ), this, SLOT( textPrint() ) );
258 void TextEditor::setupEditActions()
260 QToolBar *tb = new QToolBar( this );
261 tb->setLabel( "Edit Actions" );
262 QPopupMenu *menu = new QPopupMenu( this );
263 menuBar()->insertItem( tr( "&Edit" ), menu );
266 a = new QAction( tr( "Undo" ), QPixmap(editundo_xpm), tr( "&Undo" ), CTRL + Key_Z, this, "undoEvent" );
267 connect( a, SIGNAL( activated() ), e, SLOT( undo() ) );
272 a = new QAction( tr( "Redo" ), QPixmap( editredo_xpm ), tr( "&Redo" ), CTRL + Key_Y, this, "editRedo" );
273 connect( a, SIGNAL( activated() ), e, SLOT( redo() ) );
278 menu->insertSeparator();
279 a = new QAction( tr( "Select and copy all" ), QPixmap(), tr( "Select and copy &all" ), CTRL + Key_A, this, "editcopyall" );
280 connect( a, SIGNAL( activated() ), this, SLOT( editCopyAll() ) );
283 menu->insertSeparator();
284 a = new QAction( tr( "Copy" ), QPixmap( editcopy_xpm ), tr( "&Copy" ), CTRL + Key_C, this, "editCopy" );
285 connect( a, SIGNAL( activated() ), e, SLOT( copy() ) );
290 a = new QAction( tr( "Cut" ), QPixmap( editcut_xpm ), tr( "Cu&t" ), CTRL + Key_X, this, "editCut" );
291 connect( a, SIGNAL( activated() ), e, SLOT( cut() ) );
296 a = new QAction( tr( "Paste" ), QPixmap( editpaste_xpm ), tr( "&Paste" ), CTRL + Key_V, this, "editPaste" );
297 connect( a, SIGNAL( activated() ), e, SLOT( paste() ) );
302 a = new QAction( tr( "Delete all" ), QPixmap( edittrash_xpm ), tr( "&Delete All" ), 0, this, "editDeleteAll" );
303 connect( a, SIGNAL( activated() ), e, SLOT( clear() ) );
306 actionEditDeleteAll=a;
308 a = new QAction( tr( "Convert paragraphs to linebreaks" ), QPixmap(), tr( "&Convert Paragraphs" ), ALT + Key_P, this, "editConvertPar" );
309 connect( a, SIGNAL( activated() ), this, SLOT( textConvertPar() ) );
311 actionEditConvertPar=a;
313 a = new QAction( tr( "Join all lines of a paragraph" ), QPixmap(), tr( "&Join lines" ), ALT + Key_J, this, "editJoinLines" );
314 connect( a, SIGNAL( activated() ), this, SLOT( textJoinLines() ) );
316 actionEditJoinLines=a;
319 void TextEditor::setupFormatActions()
321 QToolBar *tb = new QToolBar( this );
322 tb->setLabel( "Format Actions" );
323 QPopupMenu *menu = new QPopupMenu( this );
324 menuBar()->insertItem( tr( "&Format" ), menu );
328 a = new QAction( tr( "Toggle font hint for the whole text" ), QPixmap(formatfixedfont_xpm), tr( "&Font hint" ), ALT + Key_I, this, "fontHint" );
329 a->setToggleAction (true);
330 a->setOn (settings.readBoolEntry ("/vym/noteeditor/fonts/useFixedByDefault",false) );
331 connect( a, SIGNAL( activated() ), this, SLOT( toggleFonthint() ) );
334 actionFormatUseFixedFont=a;
336 menu->insertSeparator();
338 comboFont = new QComboBox( true, tb );
340 comboFont->insertStringList( db.families() );
341 connect( comboFont, SIGNAL( activated( const QString & ) ),
342 this, SLOT( textFamily( const QString & ) ) );
343 comboFont->lineEdit()->setText( QApplication::font().family() );
345 comboSize = new QComboBox( true, tb );
346 QValueList<int> sizes = db.standardSizes();
347 QValueList<int>::Iterator it = sizes.begin();
348 for ( ; it != sizes.end(); ++it )
349 comboSize->insertItem( QString::number( *it ) );
350 connect( comboSize, SIGNAL( activated( const QString & ) ),
351 this, SLOT( textSize( const QString & ) ) );
352 comboSize->lineEdit()->setText( QString::number( QApplication::font().pointSize() ) );
354 menu->insertSeparator();
356 QPixmap pix( 16, 16 );
357 pix.fill( e->color());
358 actionTextColor = new QAction( pix, tr( "&Color..." ), 0, this, "textColor" );
359 connect( actionTextColor, SIGNAL( activated() ), this, SLOT( textColor() ) );
360 actionTextColor->addTo( tb );
361 actionTextColor->addTo( menu );
363 actionTextBold = new QAction( QPixmap (formattextbold_xpm), tr( "&Bold" ), CTRL + Key_B, this, "textBold" );
364 connect( actionTextBold, SIGNAL( activated() ), this, SLOT( textBold() ) );
365 actionTextBold->addTo( tb );
366 actionTextBold->addTo( menu );
367 actionTextBold->setToggleAction( true );
368 actionTextItalic = new QAction( QPixmap(formattextitalic_xpm ), tr( "&Italic" ), CTRL + Key_I, this, "textItalic" );
369 connect( actionTextItalic, SIGNAL( activated() ), this, SLOT( textItalic() ) );
370 actionTextItalic->addTo( tb );
371 actionTextItalic->addTo( menu );
372 actionTextItalic->setToggleAction( true );
373 actionTextUnderline = new QAction( QPixmap (formattextunder_xpm ), tr( "&Underline" ), CTRL + Key_U, this, "textUnderline" );
374 connect( actionTextUnderline, SIGNAL( activated() ), this, SLOT( textUnderline() ) );
375 actionTextUnderline->addTo( tb );
376 actionTextUnderline->addTo( menu );
377 actionTextUnderline->setToggleAction( true );
378 menu->insertSeparator();
380 QActionGroup *grp = new QActionGroup( this );
381 connect( grp, SIGNAL( selected( QAction* ) ), this, SLOT( textAlign( QAction* ) ) );
383 actionAlignLeft = new QAction( QPixmap (formattextleft_xpm ), tr( "&Left" ), CTRL + Key_L, grp, "textLeft" );
384 actionAlignLeft->setToggleAction( true );
385 actionAlignCenter = new QAction( QPixmap (formattextcenter_xpm ), tr( "C&enter" ), CTRL + Key_E, grp, "textCenter" );
386 actionAlignCenter->setToggleAction( true );
387 actionAlignRight = new QAction( QPixmap (formattextright_xpm ), tr( "&Right" ), CTRL + Key_R, grp, "textRight" );
388 actionAlignRight->setToggleAction( true );
389 actionAlignJustify = new QAction( QPixmap ( formattextjustify_xpm ), tr( "&Justify" ), CTRL + Key_J, grp, "textjustify" );
390 actionAlignJustify->setToggleAction( true );
395 connect( e, SIGNAL( currentFontChanged( const QFont & ) ),
396 this, SLOT( fontChanged( const QFont & ) ) );
397 connect( e, SIGNAL( currentColorChanged( const QColor & ) ),
398 this, SLOT( colorChanged( const QColor & ) ) );
399 connect( e, SIGNAL( currentAlignmentChanged( int ) ),
400 this, SLOT( alignmentChanged( int ) ) );
404 void TextEditor::setupSettingsActions()
406 QPopupMenu *menu = new QPopupMenu( this );
407 menuBar()->insertItem( tr( "&Settings" ), menu );
410 a = new QAction( tr( "Set fixed font" ), QPixmap(), tr( "Set &fixed font" ), 0, this, "setFixedFont" );
411 connect( a, SIGNAL( activated() ), this, SLOT( setFixedFont() ) );
413 actionSettingsFixedFont=a;
415 a = new QAction( tr( "Set variable font" ), QPixmap(), tr( "Set &variable font" ), 0, this, "setvariableFont" );
416 connect( a, SIGNAL( activated() ), this, SLOT( setVarFont() ) );
418 actionSettingsVarFont=a;
420 a = new QAction( tr( "Used fixed font by default" ), QPixmap(), tr( "&fixed font is default" ), 0, this, "fonthintDefault" );
421 a->setToggleAction (true);
422 // set state later in constructor...
424 actionSettingsFonthintDefault=a;
427 void TextEditor::textLoad()
429 if (state!=inactiveEditor)
433 QMessageBox mb( "VYM - Note Editor",
434 "Loading will overwrite the existing note",
435 QMessageBox::Warning,
436 QMessageBox::Yes | QMessageBox::Default,
439 mb.setButtonText( QMessageBox::Yes, "Load note" );
440 switch( mb.exec() ) {
441 case QMessageBox::Cancel:
447 QFileDialog *fd=new QFileDialog( this);
448 fd->addFilter ("ASCII texts (*.txt)");
449 fd->addFilter ("VYM notes (*.html)");
452 if ( fd->exec() == QDialog::Accepted )
453 fn = fd->selectedFile();
458 if ( !f.open( IO_ReadOnly ) )
461 QTextStream ts( &f );
462 setText( ts.read() );
468 void TextEditor::closeEvent( QCloseEvent* ce )
470 if ( !e->isModified() )
472 ce->accept(); // TextEditor can be reopened with show()
473 actionViewToggleNoteEditor->setOn (false);
479 QString TextEditor::getText()
484 void TextEditor::editorChanged()
486 // received, when QTextEdit::text() has changed
487 EditorState oldstate=state;
494 if (state != oldstate)
496 if (state==emptyEditor)
497 e->setPaper (emptyPaper);
499 e->setPaper (filledPaper);
501 // SLOT is LinkableMapObj, which will update systemFlag
502 emit (textHasChanged() );
506 void TextEditor::setText(QString t)
508 if ( !QStyleSheet::mightBeRichText( t ) )
509 t = QStyleSheet::convertFromPlainText( t, QStyleSheetItem::WhiteSpaceNormal );
510 e->setReadOnly(false);
512 editorChanged(); //not called automagically
517 void TextEditor::setInactive()
520 state=inactiveEditor;
521 e->setPaper (inactivePaper);
522 e->setReadOnly (true);
527 void TextEditor::editCopyAll()
533 void TextEditor::textSaveAs()
535 QString fn = QFileDialog::getSaveFileName( QString::null, "VYM Note (HTML) (*.html);;All files (*)",
536 this,"export note dialog",tr("Export Note to single file") );
543 QMessageBox mb( "VYM",
544 tr("The file ") + fn +
545 tr(" exists already. "
546 "Do you want to overwrite it?"),
547 QMessageBox::Warning,
548 QMessageBox::Yes | QMessageBox::Default,
549 QMessageBox::Cancel | QMessageBox::Escape,
550 QMessageBox::NoButton );
551 mb.setButtonText( QMessageBox::Yes, tr("Overwrite") );
552 mb.setButtonText( QMessageBox::No, tr("Cancel"));
553 switch( mb.exec() ) {
554 case QMessageBox::Yes:
559 case QMessageBox::Cancel:
570 statusBar()->message(tr( "Couldn't export note ") + fn, statusbarTime );
574 void TextEditor::textSave()
576 if ( filename.isEmpty() )
582 QString text = e->text();
584 if ( !f.open( IO_WriteOnly ) )
586 statusBar()->message( QString("Could not write to %1").arg(filename),
595 e->setModified( FALSE );
597 statusBar()->message( QString( "Note exported as %1" ).arg( filename ), statusbarTime );
600 void TextEditor::textConvertPar()
602 // In X11 a copy&paste generates paragraphs,
603 // which is not always wanted
604 // This function replaces paragraphs by linebreaks.
605 int parFrom, parTo, indFrom, indTo;
606 e->getSelection (&parFrom,&indFrom,&parTo,&indTo);
616 t.replace ("</p>","<br />");
619 e->setCursorPosition (parFrom,indFrom);
621 // Tried to simply insert the changed text with
622 // e->insert (t,(uint)(QTextEdit::RemoveSelected));
623 // but then the html would be quoted. So I use the ugly
624 // way: insert a marker, replace it in whole text of QTextEdit
625 QString marker="R3PlAcEMeL4teR!";
627 e->setText (e->text().replace(marker,t));
632 void TextEditor::textJoinLines()
634 int parFrom, parTo, indFrom, indTo;
635 e->getSelection (&parFrom,&indFrom,&parTo,&indTo);
641 // In addition to textConvertPar it is sometimes
642 // useful to join all lines of a paragraph
643 QRegExp re("</p>\n+<p>(?!</p>)");
647 // Above we may have introduced new " " at beginning of a
648 // paragraph - remove it.
649 re.setPattern("<p> ");
650 t.replace (re,"<p>");
653 e->setCursorPosition (parFrom,indFrom);
655 // Tried to simply insert the changed text with
656 // e->insert (t,(uint)(QTextEdit::RemoveSelected));
657 // but then the html would be quoted. So I use the ugly
658 // way: insert a marker, replace it in whole text of QTextEdit
659 QString marker="R3PlAcEMeL4teR!";
661 e->setText (e->text().replace(marker,t));
666 QString TextEditor::textConvertToASCII(const QString &t)
670 // convert all "<br*>" to "\n"
671 QRegExp re("<br.*>");
675 // convert all "</p>" to "\n"
676 re.setPattern ("/p");
679 // remove all remaining tags
680 re.setPattern ("<.*>");
683 // convert "&", "<" and ">"
684 re.setPattern (">");
686 re.setPattern ("<");
688 re.setPattern ("&");
693 void TextEditor::textExportAsASCII()
695 QString text = textConvertToASCII( e->text());
696 QString fn = QFileDialog::getSaveFileName( QString::null, "VYM Note (ASCII) (*.txt);;All files (*)",
697 this,"export note dialog",tr("Export Note to single file (ASCII)") );
705 QMessageBox mb( "VYM",
706 tr("The file ") + fn +
707 tr(" exists already. "
708 "Do you want to overwrite it?"),
709 QMessageBox::Warning,
710 QMessageBox::Yes | QMessageBox::Default,
711 QMessageBox::Cancel | QMessageBox::Escape,
712 QMessageBox::NoButton );
713 mb.setButtonText( QMessageBox::Yes, tr("Overwrite") );
714 mb.setButtonText( QMessageBox::No, tr("Cancel"));
717 if (ret==QMessageBox::Cancel)
721 if ( !file.open( IO_WriteOnly ) )
722 statusBar()->message( QString("Could not write to %1").arg(filename),
726 QTextStream t( &file );
730 statusBar()->message( QString( "Note exported as %1" ).arg( fn ), statusbarTime );
736 void TextEditor::textPrint()
738 printer->setFullPage(TRUE);
739 if ( printer->setup( this ) )
741 QPainter p( printer );
742 // Check that there is a valid device to print to.
743 if ( !p.device() ) return;
744 QPaintDeviceMetrics metrics( p.device() );
745 int dpiy = metrics.logicalDpiY();
746 int margin = (int) ( (2/2.54)*dpiy ); // 2 cm margins
747 QRect body( margin, margin, metrics.width() - 2*margin, metrics.height() - 2*margin );
748 QFont font( e->currentFont() );
749 font.setPointSize( 10 ); // we define 10pt to be a nice base size for printing
751 QSimpleRichText richText( e->text(), font,
754 e->mimeSourceFactory(),
756 richText.setWidth( &p, body.width() );
761 richText.draw( &p, body.left(), body.top(), view, colorGroup() );
762 view.moveBy( 0, body.height() );
763 p.translate( 0 , -body.height() );
765 p.drawText( view.right() - p.fontMetrics().width( QString::number( page ) ),
766 view.bottom() + p.fontMetrics().ascent() + 5, QString::number( page ) );
767 if ( view.top() >= richText.height() )
775 void TextEditor::textEditUndo()
779 void TextEditor::toggleFonthint()
781 setUpdatesEnabled (false);
783 if (!actionFormatUseFixedFont->isOn() )
784 e->setCurrentFont (varFont);
786 e->setCurrentFont (fixedFont);
787 e->selectAll (false);
788 setUpdatesEnabled (true);
792 void TextEditor::setFixedFont()
795 QFont font =QFontDialog::getFont(
796 &ok, fixedFont, this );
798 // font is set to the font the user selected
802 void TextEditor::setVarFont()
805 QFont font =QFontDialog::getFont(
806 &ok, varFont, this );
808 // font is set to the font the user selected
812 void TextEditor::textBold()
814 e->setBold( actionTextBold->isOn() );
817 void TextEditor::textUnderline()
819 e->setUnderline( actionTextUnderline->isOn() );
822 void TextEditor::textItalic()
824 e->setItalic( actionTextItalic->isOn() );
827 void TextEditor::textFamily( const QString &f )
832 void TextEditor::textSize( const QString &p )
834 e->setPointSize( p.toInt() );
838 void TextEditor::textColor()
840 QColor col = QColorDialog::getColor( e->color(), this );
841 if ( !col.isValid() )
844 QPixmap pix( 16, 16 );
846 actionTextColor->setIconSet( pix );
849 void TextEditor::textAlign( QAction *a )
851 if ( a == actionAlignLeft )
852 e->setAlignment( AlignLeft );
853 else if ( a == actionAlignCenter )
854 e->setAlignment( AlignHCenter );
855 else if ( a == actionAlignRight )
856 e->setAlignment( AlignRight );
857 else if ( a == actionAlignJustify )
858 e->setAlignment( AlignJustify );
861 void TextEditor::fontChanged( const QFont &f )
863 comboFont->lineEdit()->setText( f.family() );
864 comboSize->lineEdit()->setText( QString::number( f.pointSize() ) );
865 actionTextBold->setOn( f.bold() );
866 actionTextItalic->setOn( f.italic() );
867 actionTextUnderline->setOn( f.underline() );
870 void TextEditor::colorChanged( const QColor &c )
872 QPixmap pix( 16, 16 );
874 actionTextColor->setIconSet( pix );
877 void TextEditor::alignmentChanged( int a )
879 if ( ( a == AlignAuto ) || ( a & AlignLeft ))
880 actionAlignLeft->setOn( true );
881 else if ( ( a & AlignHCenter ) )
882 actionAlignCenter->setOn( true );
883 else if ( ( a & AlignRight ) )
884 actionAlignRight->setOn( true );
885 else if ( ( a & AlignJustify ) )
886 actionAlignJustify->setOn( true );
891 void TextEditor::enableActions()
893 actionFileLoad->setEnabled(true);
894 actionFileSave->setEnabled(true);
895 actionFileSaveAs->setEnabled(true);
896 actionFilePrint->setEnabled(true);
897 actionEditUndo->setEnabled(true);
898 actionEditRedo->setEnabled(true);
899 actionEditCopy->setEnabled(true);
900 actionEditCut->setEnabled(true);
901 actionEditPaste->setEnabled(true);
902 actionEditDeleteAll->setEnabled(true);
903 actionEditConvertPar->setEnabled(true);
904 actionEditJoinLines->setEnabled(true);
905 actionFormatUseFixedFont->setEnabled(true);
908 void TextEditor::disableActions()
910 actionFileLoad->setEnabled(false);
911 actionFileSave->setEnabled(false);
912 actionFileSaveAs->setEnabled(false);
913 actionFilePrint->setEnabled(false);
914 actionEditUndo->setEnabled(false);
915 actionEditRedo->setEnabled(false);
916 actionEditCopy->setEnabled(false);
917 actionEditCut->setEnabled(false);
918 actionEditPaste->setEnabled(false);
919 actionEditDeleteAll->setEnabled(false);
920 actionEditConvertPar->setEnabled(false);
921 actionEditJoinLines->setEnabled(false);
922 actionFormatUseFixedFont->setEnabled(false);