1 #include "texteditor.h"
10 extern int statusbarTime;
11 extern Settings settings;
13 extern QAction *actionViewToggleNoteEditor;
15 extern QString iconPath;
16 extern QString vymName;
21 ///////////////////////////////////////////////////////////////////////
22 ///////////////////////////////////////////////////////////////////////
25 TextEditor::TextEditor()
27 printer = new QPrinter( QPrinter::HighResolution );
28 printer->setPrinterName (settings.value("/mainwindow/printerName",printer->printerName()).toString());
30 e = new QTextEdit( this);
32 e->setTextFormat(Qt::RichText); // default
33 e->setTabStopWidth (20); // unit is pixel
34 e->setColor (Qt::black);
35 e->setAutoFillBackground (true);
36 connect (e, SIGNAL( textChanged() ), this, SLOT( editorChanged() ) );
37 setCentralWidget( e );
38 statusBar()->message( tr("Ready","Statusbar message"), statusbarTime);
39 setCaption(vymName +" - " +tr ("Note Editor","Window caption"));
42 connect(e, SIGNAL(currentCharFormatChanged(const QTextCharFormat &)),
43 this, SLOT(formatChanged(const QTextCharFormat &)));
51 setupSettingsActions();
54 blockChangedSignal=false;
58 resize (settings.value ( "/satellite/noteeditor/geometry/size", QSize(450,600)).toSize());
59 move (settings.value ( "/satellite/noteeditor/geometry/pos", QPoint (250,50)).toPoint());
61 setShowWithMain (settings.value ( "/satellite/noteeditor/showWithMain",true).toBool());
63 varFont.fromString( settings.value
64 ("/satellite/noteeditor/fonts/varFont",
65 "Nimbus Sans l,14,-1,5,48,0,0,0,0,0").toString()
67 fixedFont.fromString (settings.value(
68 "/satellite/noteeditor/fonts/fixedFont",
69 "Courier,14,-1,5,48,0,0,0,1,0").toString()
71 QString s=settings.value ("/satellite/noteeditor/fonts/fonthintDefault","variable").toString();
74 actionSettingsFonthintDefault->setOn (true);
75 e->setCurrentFont (fixedFont);
78 actionSettingsFonthintDefault->setOn (false);
79 e->setCurrentFont (varFont);
83 // Restore position of toolbars
84 restoreState (settings.value("/satellite/noteeditor/state",0).toByteArray());
86 // Save settings in vymrc
87 settings.setValue("/mainwindow/printerName",printer->printerName());
91 TextEditor::~TextEditor()
93 if (printer) delete printer;
95 settings.setValue( "/satellite/noteeditor/geometry/size", size() );
96 settings.setValue( "/satellite/noteeditor/geometry/pos", pos() );
97 settings.setValue ("/satellite/noteeditor/state",saveState(0));
99 settings.setValue( "/satellite/noteeditor/showWithMain",showwithmain);
102 if (actionSettingsFonthintDefault->isOn() )
106 settings.setValue( "/satellite/noteeditor/fonts/fonthintDefault",s );
107 settings.setValue("/satellite/noteeditor/fonts/varFont", varFont.toString() );
108 settings.setValue("/satellite/noteeditor/fonts/fixedFont", fixedFont.toString() );
113 bool TextEditor::isEmpty()
115 if (e->toPlainText().length()>0)
121 void TextEditor::setShowWithMain(bool v)
126 bool TextEditor::showWithMain()
132 void TextEditor::setFontHint (const QString &fh)
135 actionFormatUseFixedFont->setOn (true);
137 actionFormatUseFixedFont->setOn (false);
141 QString TextEditor::getFontHint()
143 if (actionFormatUseFixedFont->isOn())
149 QString TextEditor::getFontHintDefault()
151 if (actionSettingsFonthintDefault->isOn())
157 void TextEditor::setFilename(const QString &fn)
159 if (state==filledEditor)
164 statusBar()->message( tr("No filename available for this note.","Statusbar message"), statusbarTime );
169 statusBar()->message( tr(QString( "Current filename is %1" ).arg( filename ),"Statusbar message"), statusbarTime );
174 QString TextEditor::getFilename()
179 void TextEditor::setFilenameHint(const QString &fnh)
184 QString TextEditor::getFilenameHint()
189 QString TextEditor::getText()
191 if (e->toPlainText().isEmpty())
197 NoteObj TextEditor::getNoteObj()
199 NoteObj note (getText() );
200 note.setFontHint (getFontHint() );
201 note.setFilenameHint (getFilenameHint () );
205 void TextEditor::setNote (const NoteObj ¬e)
207 setText (note.getNote() );
208 setFilenameHint (note.getFilenameHint() );
209 setFontHint (note.getFontHint() );
212 bool TextEditor::findText(const QString &t, const QTextDocument::FindFlags &flags)
214 if (e->find (t,flags))
220 void TextEditor::setupFileActions()
222 QToolBar *tb = addToolBar ( tr("Note Actions") );
223 tb->setObjectName ("noteEditorFileActions");
224 QMenu *fileMenu = menuBar()->addMenu( tr( "&Note","Menubar" ));
227 a = new QAction( QPixmap( iconPath+"fileopen.png"), tr( "&Import..." ),this);
228 a->setStatusTip (tr( "Import","Status tip for Note menu" ) );
229 a->setShortcut( Qt::CTRL + Qt::Key_O );
230 connect( a, SIGNAL( activated() ), this, SLOT( textLoad() ) );
232 fileMenu->addAction (a);
235 fileMenu->addSeparator();
236 a = new QAction( QPixmap(iconPath+"filesave.png" ), tr( "&Export..." ),this);
237 a->setStatusTip (tr( "Export Note (HTML)","Status tip for Note menu" ) );
238 a->setShortcut( Qt::CTRL + Qt::Key_S );
239 connect( a, SIGNAL( activated() ), this, SLOT( textSave() ) );
241 fileMenu->addAction (a);
244 a = new QAction( QPixmap(), tr( "Export &As... (HTML)" ), this);
245 a->setStatusTip (tr( "Export Note As (HTML) ","Status tip for Note Menu" ));
246 connect( a, SIGNAL( activated() ), this, SLOT( textSaveAs() ) );
247 fileMenu->addAction (a);
250 a = new QAction(QPixmap(), tr( "Export &As...(ASCII)" ), this);
251 a->setStatusTip ( tr( "Export Note As (ASCII) ","Status tip for note menu" ) );
252 a->setShortcut(Qt::ALT + Qt::Key_X );
253 connect( a, SIGNAL( activated() ), this, SLOT( textExportAsASCII() ) );
254 fileMenu->addAction (a);
257 fileMenu->addSeparator();
258 a = new QAction( QPixmap(iconPath+"fileprint.png" ), tr( "&Print..." ),this);
259 a->setStatusTip (tr( "Print Note","Status tip for note menu" ) );
260 a->setShortcut( Qt::CTRL + Qt::Key_P );
261 connect( a, SIGNAL( activated() ), this, SLOT( textPrint() ) );
263 fileMenu->addAction (a);
267 void TextEditor::setupEditActions()
269 QToolBar *tb = addToolBar ( tr( "Edit Actions" ));
270 tb->setObjectName ("noteEditorEditActions");
271 QMenu *editMenu = menuBar()->addMenu ( tr( "&Edit" ));
274 a = new QAction(QPixmap(iconPath+"undo.png"), tr( "&Undo" ), this );
275 a->setStatusTip ( tr( "Undo","Status tip for note menu" ) );
276 a->setShortcut(Qt::CTRL + Qt::Key_Z );
277 connect( a, SIGNAL( activated() ), e, SLOT( undo() ) );
278 editMenu->addAction (a);
282 a = new QAction(QPixmap(iconPath+"redo.png" ), tr( "&Redo" ),this);
283 a->setStatusTip ( tr( "Redo","Status tip for note menu" ) );
284 a->setShortcut( Qt::CTRL + Qt::Key_Y );
285 connect( a, SIGNAL( activated() ), e, SLOT( redo() ) );
286 editMenu->addAction (a);
290 editMenu->addSeparator();
291 a = new QAction(QPixmap(), tr( "Select and copy &all" ),this);
292 a->setStatusTip ( tr( "Select and copy all","Status tip for note menu" ) );
293 a->setShortcut( Qt::CTRL + Qt::Key_A );
294 connect( a, SIGNAL( activated() ), this, SLOT( editCopyAll() ) );
295 editMenu->addAction (a);
297 editMenu->addSeparator();
298 a = new QAction(QPixmap(iconPath+"editcopy.png" ), tr( "&Copy" ),this);
299 a->setStatusTip ( tr( "Copy","Status tip for note menu" ) );
300 a->setShortcut( Qt::CTRL + Qt::Key_C );
301 connect( a, SIGNAL( activated() ), e, SLOT( copy() ) );
302 editMenu->addAction (a);
306 a = new QAction(QPixmap(iconPath+"editcut.png" ), tr( "Cu&t" ),this);
307 a->setStatusTip ( tr( "Cut","Status tip for note menu" ) );
308 a->setShortcut( Qt::CTRL + Qt::Key_X );
309 connect( a, SIGNAL( activated() ), e, SLOT( cut() ) );
310 editMenu->addAction (a);
314 a = new QAction(QPixmap(iconPath+"editpaste.png" ), tr( "&Paste" ),this);
315 a->setStatusTip ( tr( "Paste","Status tip for note menu" ) );
316 a->setShortcut( Qt::CTRL + Qt::Key_V );
317 connect( a, SIGNAL( activated() ), e, SLOT( paste() ) );
318 editMenu->addAction (a);
322 a = new QAction( QPixmap( iconPath+"edittrash.png"), tr( "&Delete All" ), this);
323 a->setStatusTip (tr( "Delete all","Status tip for note menu" ) );
324 connect( a, SIGNAL( activated() ), e, SLOT( clear() ) );
325 editMenu->addAction (a);
327 actionEditDeleteAll=a;
331 void TextEditor::setupFormatActions()
333 QToolBar *tb = addToolBar ( tr("Format Actions" ));
334 tb->setObjectName ("noteEditorFormatActions");
335 QMenu *formatMenu = menuBar()->addMenu ( tr( "F&ormat" ));
339 a = new QAction( QPixmap(iconPath+"formatfixedfont.png"), tr( "&Font hint" ), Qt::ALT + Qt::Key_I, this, "fontHint" );
340 a->setStatusTip (tr( "Toggle font hint for the whole text","Status tip for note menu" ) );
341 a->setToggleAction (true);
342 a->setOn (settings.value("/noteeditor/fonts/useFixedByDefault",false).toBool() );
343 connect( a, SIGNAL( activated() ), this, SLOT( toggleFonthint() ) );
344 formatMenu->addAction (a);
346 actionFormatUseFixedFont=a;
348 comboFont = new QComboBox;
349 tb->addWidget (comboFont);
350 QFontDatabase fontDB;
351 comboFont->insertStringList( fontDB.families() );
352 connect( comboFont, SIGNAL( activated( const QString & ) ),
353 this, SLOT( textFamily( const QString & ) ) );
354 comboFont->addItem( QApplication::font().family() );
355 comboSize = new QComboBox;
356 tb->addWidget (comboSize);
357 QList<int> sizes=fontDB.standardSizes();
358 QList<int>::iterator i = sizes.begin();
359 while (i != sizes.end())
361 ++i; // increment i before using it
362 comboSize->insertItem ( QString::number(*i));
364 connect( comboSize, SIGNAL( activated( const QString & ) ),
365 this, SLOT( textSize( const QString & ) ) );
366 comboSize->addItem ( QString::number( QApplication::font().pointSize() ) );
368 formatMenu->addSeparator();
370 QPixmap pix( 16, 16 );
371 pix.fill( e->color());
372 a = new QAction( pix, tr( "&Color..." ), this);
373 formatMenu->addAction (a);
375 connect( a, SIGNAL( activated() ), this, SLOT( textColor() ) );
378 a = new QAction( QPixmap (iconPath+"text_bold.png"), tr( "&Bold" ), this);
379 a->setShortcut(Qt::CTRL + Qt::Key_B );
380 connect( a, SIGNAL( activated() ), this, SLOT( textBold() ) );
382 formatMenu->addAction (a);
383 a->setToggleAction( true );
386 a = new QAction( QPixmap(iconPath+"text_italic.png"), tr( "&Italic" ), this);
387 a->setShortcut(Qt::CTRL + Qt::Key_I);
388 connect( a, SIGNAL( activated() ), this, SLOT( textItalic() ) );
390 formatMenu->addAction (a);
391 a->setToggleAction( true );
394 a = new QAction( QPixmap (iconPath+"text_under.png"), tr( "&Underline" ), this);
395 a->setShortcut(Qt::CTRL + Qt::Key_U );
396 connect( a, SIGNAL( activated() ), this, SLOT( textUnderline() ) );
398 formatMenu->addAction (a);
399 a->setToggleAction( true );
400 actionTextUnderline=a;
401 formatMenu->addSeparator();
403 QActionGroup *grp2 = new QActionGroup( this );
404 grp2->setExclusive(true);
405 a = new QAction( QPixmap (iconPath+"text_sub.png"), tr( "Subs&cript" ),grp2 );
406 a->setShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_B );
407 a->setToggleAction( true );
409 formatMenu->addAction (a);
410 connect(a, SIGNAL(activated()), this, SLOT(textVAlign()));
411 actionAlignSubScript=a;
413 a = new QAction( QPixmap (iconPath+"text_super.png"), tr( "Su&perscript" ),grp2 );
414 a->setShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_P );
415 a->setToggleAction( true );
417 formatMenu->addAction (a);
418 connect(a, SIGNAL(activated()), this, SLOT(textVAlign()));
419 actionAlignSuperScript=a;
420 QActionGroup *grp = new QActionGroup( this );
421 connect( grp, SIGNAL( selected( QAction* ) ), this, SLOT( textAlign( QAction* ) ) );
423 formatMenu->addSeparator();
425 a = new QAction( QPixmap (iconPath+"text_left.png"), tr( "&Left" ),grp );
426 a->setShortcut( Qt::CTRL+Qt::Key_L );
427 a->setToggleAction( true );
429 formatMenu->addAction (a);
431 a = new QAction( QPixmap (iconPath+"text_center.png"), tr( "C&enter" ),grp);
432 a->setShortcut( Qt::CTRL + Qt::Key_E);
433 a->setToggleAction( true );
435 formatMenu->addAction (a);
437 a = new QAction( QPixmap (iconPath+"text_right.png" ), tr( "&Right" ), grp);
438 a->setShortcut(Qt::CTRL + Qt::Key_R );
439 a->setToggleAction( true );
441 formatMenu->addAction (a);
443 a = new QAction( QPixmap ( iconPath+"text_block.png"), tr( "&Justify" ), grp );
444 a->setShortcut(Qt::CTRL + Qt::Key_J );
445 a->setToggleAction( true );
447 formatMenu->addAction (a);
448 actionAlignJustify=a;
451 void TextEditor::setupSettingsActions()
453 QMenu *settingsMenu = menuBar()->addMenu ( tr( "&Settings" ));
456 a = new QAction(tr( "Set &fixed font" ), this);
457 a->setStatusTip ( tr( "Set fixed font","Status tip for note menu" ));
458 connect( a, SIGNAL( activated() ), this, SLOT( setFixedFont() ) );
459 settingsMenu->addAction (a);
460 actionSettingsFixedFont=a;
462 a = new QAction(tr( "Set &variable font" ), this);
463 a->setStatusTip ( tr( "Set variable font","Status tip for note menu" ) );
464 connect( a, SIGNAL( activated() ), this, SLOT( setVarFont() ) );
465 settingsMenu->addAction (a);
466 actionSettingsVarFont=a;
468 a = new QAction(tr( "&fixed font is default" ), this);
469 a->setStatusTip (tr( "Used fixed font by default","Status tip for note menu" ) );
470 a->setToggleAction (true);
471 // set state later in constructor...
472 settingsMenu->addAction (a);
473 actionSettingsFonthintDefault=a;
476 void TextEditor::textLoad()
478 if (state!=inactiveEditor)
482 QMessageBox mb( vymName + " - " +tr("Note Editor"),
483 "Loading will overwrite the existing note",
484 QMessageBox::Warning,
485 QMessageBox::Yes | QMessageBox::Default,
488 mb.setButtonText( QMessageBox::Yes, "Load note" );
489 switch( mb.exec() ) {
490 case QMessageBox::Cancel:
496 QFileDialog *fd=new QFileDialog( this);
498 types<< "VYM notes (*.html)" <<
499 "ASCII texts (*.txt)" <<
501 fd->setFilters (types);
502 fd->setDirectory (QDir().current());
505 if ( fd->exec() == QDialog::Accepted )
506 fn = fd->selectedFile();
511 if ( !f.open( QIODevice::ReadOnly ) )
514 QTextStream ts( &f );
515 setText( ts.read() );
521 void TextEditor::closeEvent( QCloseEvent* ce )
523 ce->accept(); // TextEditor can be reopened with show()
526 emit (windowClosed() );
530 void TextEditor::editorChanged()
537 if (state==emptyEditor)
538 setState (emptyEditor);
540 setState (filledEditor);
541 // SLOT is LinkableMapObj, which will update systemFlag
542 if (!blockChangedSignal) emit (textHasChanged() );
546 void TextEditor::setText(const QString &t)
548 blockChangedSignal=true;
549 e->setReadOnly(false);
552 blockChangedSignal=false;
555 void TextEditor::setInactive()
557 state=inactiveEditor;
559 setState (inactiveEditor);
560 e->setReadOnly (true);
565 void TextEditor::editCopyAll()
571 void TextEditor::textSaveAs()
573 QString fn = QFileDialog::getSaveFileName( QString::null, "VYM Note (HTML) (*.html);;All files (*)",
574 this,"export note dialog",tr("Export Note to single file") );
581 QMessageBox mb( vymName,
582 tr("The file %1\nexists already.\nDo you want to overwrite it?","dialog 'save note as'").arg(fn),
583 QMessageBox::Warning,
584 QMessageBox::Yes | QMessageBox::Default,
585 QMessageBox::Cancel | QMessageBox::Escape,
587 mb.setButtonText( QMessageBox::Yes, tr("Overwrite") );
588 mb.setButtonText( QMessageBox::No, tr("Cancel"));
589 switch( mb.exec() ) {
590 case QMessageBox::Yes:
595 case QMessageBox::Cancel:
606 statusBar()->message(tr( "Couldn't export note ","dialog 'save note as'") + fn, statusbarTime );
610 void TextEditor::textSave()
612 if ( filename.isEmpty() )
618 QString text = e->text();
620 if ( !f.open( QIODevice::WriteOnly ) )
622 statusBar()->message( QString("Could not write to %1").arg(filename),
631 e->setModified( FALSE );
633 statusBar()->message( QString( "Note exported as %1" ).arg( filename ), statusbarTime );
636 void TextEditor::textExportAsASCII()
638 QString text = NoteObj (e->text()).getNoteASCII();
640 if (!filenameHint.isEmpty())
642 if (!filenameHint.contains (".txt"))
643 s=filenameHint+".txt";
648 fn = QFileDialog::getSaveFileName( s, "VYM Note (ASCII) (*.txt);;All files (*)", this,"export note dialog",tr("Export Note to single file (ASCII)") );
656 QMessageBox mb( vymName,
657 tr("The file %1\nexists already.\nDo you want to overwrite it?","dialog 'save note as'").arg(fn),
658 QMessageBox::Warning,
659 QMessageBox::Yes | QMessageBox::Default,
660 QMessageBox::Cancel | QMessageBox::Escape,
662 mb.setButtonText( QMessageBox::Yes, tr("Overwrite") );
663 mb.setButtonText( QMessageBox::No, tr("Cancel"));
666 if (ret==QMessageBox::Cancel)
670 if ( !file.open( QIODevice::WriteOnly ) )
671 statusBar()->message( QString("Could not write to %1").arg(filename),
675 QTextStream t( &file );
679 statusBar()->message( QString( "Note exported as %1" ).arg( fn ), statusbarTime );
685 void TextEditor::textPrint()
688 QTextDocument *document = e->document();
691 QPrintDialog *dialog = new QPrintDialog(&printer, this);
692 dialog->setWindowTitle(tr("Print Note"));
693 if (dialog->exec() != QDialog::Accepted)
696 document->print(&printer);
699 void TextEditor::textEditUndo()
703 void TextEditor::toggleFonthint()
705 setUpdatesEnabled (false);
707 if (!actionFormatUseFixedFont->isOn() )
708 e->setCurrentFont (varFont);
710 e->setCurrentFont (fixedFont);
712 setUpdatesEnabled (true);
716 void TextEditor::setFixedFont()
719 QFont font =QFontDialog::getFont(
720 &ok, fixedFont, this );
722 // font is set to the font the user selected
726 void TextEditor::setVarFont()
729 QFont font =QFontDialog::getFont(
730 &ok, varFont, this );
732 // font is set to the font the user selected
736 void TextEditor::textBold()
738 e->setBold( actionTextBold->isOn() );
741 void TextEditor::textUnderline()
743 e->setUnderline( actionTextUnderline->isOn() );
746 void TextEditor::textItalic()
748 e->setItalic( actionTextItalic->isOn() );
751 void TextEditor::textFamily( const QString &f )
756 void TextEditor::textSize( const QString &p )
758 e->setPointSize( p.toInt() );
762 void TextEditor::textColor()
764 QColor col = QColorDialog::getColor( e->color(), this );
765 if ( !col.isValid() ) return;
767 QPixmap pix( 16, 16 );
768 pix.fill( Qt::black );
769 actionTextColor->setIconSet( pix );
772 void TextEditor::textAlign( QAction *a )
774 if ( a == actionAlignLeft )
775 e->setAlignment( Qt::AlignLeft );
776 else if ( a == actionAlignCenter )
777 e->setAlignment( Qt::AlignHCenter );
778 else if ( a == actionAlignRight )
779 e->setAlignment( Qt::AlignRight );
780 else if ( a == actionAlignJustify )
781 e->setAlignment( Qt::AlignJustify );
784 void TextEditor::textVAlign()
786 QTextCharFormat format;
788 if ( sender() == actionAlignSuperScript && actionAlignSuperScript->isOn()) {
789 format.setVerticalAlignment(QTextCharFormat::AlignSuperScript);
790 } else if (sender() == actionAlignSubScript && actionAlignSubScript->isOn()) {
791 format.setVerticalAlignment(QTextCharFormat::AlignSubScript);
793 format.setVerticalAlignment(QTextCharFormat::AlignNormal);
795 e->mergeCurrentCharFormat(format);
799 void TextEditor::fontChanged( const QFont &f )
801 int i=comboFont->findText(f.family());
802 if (i>=0) comboFont->setCurrentIndex (i);
803 i=comboSize->findText(QString::number(f.pointSize()));
804 if (i>=0) comboSize->setCurrentIndex(i);
805 actionTextBold->setOn( f.bold() );
806 actionTextItalic->setOn( f.italic() );
807 actionTextUnderline->setOn( f.underline() );
810 void TextEditor::colorChanged( const QColor &c )
812 QPixmap pix( 16, 16 );
814 actionTextColor->setIconSet( pix );
817 void TextEditor::formatChanged( const QTextCharFormat &f )
819 fontChanged(f.font());
820 colorChanged(f.foreground().color());
821 alignmentChanged(e->alignment());
822 verticalAlignmentChanged (f.verticalAlignment());
825 void TextEditor::alignmentChanged( int a )
827 if ( ( a == Qt::AlignLeft ) || ( a & Qt::AlignLeft ))
828 actionAlignLeft->setOn( true );
829 else if ( ( a & Qt::AlignHCenter ) )
830 actionAlignCenter->setOn( true );
831 else if ( ( a & Qt::AlignRight ) )
832 actionAlignRight->setOn( true );
833 else if ( ( a & Qt::AlignJustify ) )
834 actionAlignJustify->setOn( true );
837 void TextEditor::verticalAlignmentChanged(QTextCharFormat::VerticalAlignment a)
839 actionAlignSubScript->setOn (false);
840 actionAlignSuperScript->setOn (false);
843 case QTextCharFormat::AlignSuperScript:
844 actionAlignSuperScript->setOn (true);
846 case QTextCharFormat::AlignSubScript:
847 actionAlignSubScript->setOn (true);
855 void TextEditor::enableActions()
857 actionFileLoad->setEnabled(true);
858 actionFileSave->setEnabled(true);
859 actionFileSaveAs->setEnabled(true);
860 actionFilePrint->setEnabled(true);
861 actionEditUndo->setEnabled(true);
862 actionEditRedo->setEnabled(true);
863 actionEditCopy->setEnabled(true);
864 actionEditCut->setEnabled(true);
865 actionEditPaste->setEnabled(true);
866 actionEditDeleteAll->setEnabled(true);
867 actionFormatUseFixedFont->setEnabled(true);
870 void TextEditor::disableActions()
872 actionFileLoad->setEnabled(false);
873 actionFileSave->setEnabled(false);
874 actionFileSaveAs->setEnabled(false);
875 actionFilePrint->setEnabled(false);
876 actionEditUndo->setEnabled(false);
877 actionEditRedo->setEnabled(false);
878 actionEditCopy->setEnabled(false);
879 actionEditCut->setEnabled(false);
880 actionEditPaste->setEnabled(false);
881 actionEditDeleteAll->setEnabled(false);
882 actionFormatUseFixedFont->setEnabled(false);
885 void TextEditor::setState (EditorState s)
888 QPalette p=palette();
892 case emptyEditor: c=QColor (150,150,150); break;
893 case filledEditor: c=QColor (255,255,255); break;
894 case inactiveEditor: c=QColor (0,0,0);
896 p.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(9), c);
897 p.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(9), c);