historywindow moved to mainwindow. Started to get rid of Q3PtrList finally
1 #include "texteditor.h"
11 extern int statusbarTime;
12 extern Settings settings;
14 extern QAction *actionViewToggleNoteEditor;
16 extern QString iconPath;
17 extern QString vymName;
22 ///////////////////////////////////////////////////////////////////////
23 ///////////////////////////////////////////////////////////////////////
26 TextEditor::TextEditor()
28 printer = new QPrinter( QPrinter::HighResolution );
29 printer->setPrinterName (settings.value("/mainwindow/printerName",printer->printerName()).toString());
31 e = new QTextEdit( this);
33 e->setTextFormat(Qt::RichText); // default
34 e->setTabStopWidth (20); // unit is pixel
35 e->setColor (Qt::black);
36 e->setAutoFillBackground (true);
37 connect (e, SIGNAL( textChanged() ), this, SLOT( editorChanged() ) );
38 setCentralWidget( e );
39 statusBar()->message( tr("Ready","Statusbar message"), statusbarTime);
40 setCaption(vymName +" - " +tr ("Note Editor","Window caption"));
43 connect(e, SIGNAL(currentCharFormatChanged(const QTextCharFormat &)),
44 this, SLOT(formatChanged(const QTextCharFormat &)));
52 setupSettingsActions();
58 resize (settings.value ( "/noteeditor/geometry/size", QSize(450,600)).toSize());
59 move (settings.value ( "/noteeditor/geometry/pos", QPoint (250,50)).toPoint());
61 if (settings.value ( "/noteeditor/showWithMain",true).toBool())
62 setShowWithMain(true);
64 setShowWithMain(false);
66 varFont.fromString( settings.value
67 ("/noteeditor/fonts/varFont",
68 "Nimbus Sans l,14,-1,5,48,0,0,0,0,0").toString()
70 fixedFont.fromString (settings.value(
71 "/noteeditor/fonts/fixedFont",
72 "Courier,14,-1,5,48,0,0,0,1,0").toString()
74 QString s=settings.value ("/noteeditor/fonts/fonthintDefault","variable").toString();
77 actionSettingsFonthintDefault->setOn (true);
78 e->setCurrentFont (fixedFont);
81 actionSettingsFonthintDefault->setOn (false);
82 e->setCurrentFont (varFont);
86 // Restore position of toolbars
87 restoreState (settings.value("/noteeditor/state",0).toByteArray());
89 // Save settings in vymrc
90 settings.setValue("/mainwindow/printerName",printer->printerName());
94 TextEditor::~TextEditor()
96 if (printer) delete printer;
98 settings.setValue( "/noteeditor/geometry/size", size() );
99 settings.setValue( "/noteeditor/geometry/pos", pos() );
100 settings.setValue ("/noteeditor/state",saveState(0));
102 settings.setValue( "/noteeditor/showWithMain",showWithMain());
105 if (actionSettingsFonthintDefault->isOn() )
109 settings.setValue( "/noteeditor/fonts/fonthintDefault",s );
110 settings.setValue("/noteeditor/fonts/varFont", varFont.toString() );
111 settings.setValue("/noteeditor/fonts/fixedFont", fixedFont.toString() );
116 bool TextEditor::isEmpty()
118 if (e->toPlainText().length()>0)
124 void TextEditor::setShowWithMain(bool v)
129 bool TextEditor::showWithMain()
134 void TextEditor::setFontHint (const QString &fh)
137 actionFormatUseFixedFont->setOn (true);
139 actionFormatUseFixedFont->setOn (false);
143 QString TextEditor::getFontHint()
145 if (actionFormatUseFixedFont->isOn())
151 QString TextEditor::getFontHintDefault()
153 if (actionSettingsFonthintDefault->isOn())
159 void TextEditor::setFilename(const QString &fn)
161 if (state==filledEditor)
165 statusBar()->message( tr("No filename available for this note.","Statusbar message"), statusbarTime );
170 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 bool TextEditor::findText(const QString &t, const QTextDocument::FindFlags &flags)
191 if (e->find (t,flags))
197 void TextEditor::setupFileActions()
199 QToolBar *tb = addToolBar ( tr("Note Actions") );
200 tb->setObjectName ("noteEditorFileActions");
201 QMenu *fileMenu = menuBar()->addMenu( tr( "&Note","Menubar" ));
204 a = new QAction( QPixmap( iconPath+"fileopen.png"), tr( "&Import..." ),this);
205 a->setStatusTip (tr( "Import","Status tip for Note menu" ) );
206 a->setShortcut( Qt::CTRL + Qt::Key_O );
207 connect( a, SIGNAL( activated() ), this, SLOT( textLoad() ) );
209 fileMenu->addAction (a);
212 fileMenu->addSeparator();
213 a = new QAction( QPixmap(iconPath+"filesave.png" ), tr( "&Export..." ),this);
214 a->setStatusTip (tr( "Export Note (HTML)","Status tip for Note menu" ) );
215 a->setShortcut( Qt::CTRL + Qt::Key_S );
216 connect( a, SIGNAL( activated() ), this, SLOT( textSave() ) );
218 fileMenu->addAction (a);
221 a = new QAction( QPixmap(), tr( "Export &As... (HTML)" ), this);
222 a->setStatusTip (tr( "Export Note As (HTML) ","Status tip for Note Menu" ));
223 connect( a, SIGNAL( activated() ), this, SLOT( textSaveAs() ) );
224 fileMenu->addAction (a);
227 a = new QAction(QPixmap(), tr( "Export &As...(ASCII)" ), this);
228 a->setStatusTip ( tr( "Export Note As (ASCII) ","Status tip for note menu" ) );
229 a->setShortcut(Qt::ALT + Qt::Key_X );
230 connect( a, SIGNAL( activated() ), this, SLOT( textExportAsASCII() ) );
231 fileMenu->addAction (a);
234 fileMenu->addSeparator();
235 a = new QAction( QPixmap(iconPath+"fileprint.png" ), tr( "&Print..." ),this);
236 a->setStatusTip (tr( "Print Note","Status tip for note menu" ) );
237 a->setShortcut( Qt::CTRL + Qt::Key_P );
238 connect( a, SIGNAL( activated() ), this, SLOT( textPrint() ) );
240 fileMenu->addAction (a);
244 void TextEditor::setupEditActions()
246 QToolBar *tb = addToolBar ( tr( "Edit Actions" ));
247 tb->setObjectName ("noteEditorEditActions");
248 QMenu *editMenu = menuBar()->addMenu ( tr( "&Edit" ));
251 a = new QAction(QPixmap(iconPath+"undo.png"), tr( "&Undo" ), this );
252 a->setStatusTip ( tr( "Undo","Status tip for note menu" ) );
253 a->setShortcut(Qt::CTRL + Qt::Key_Z );
254 connect( a, SIGNAL( activated() ), e, SLOT( undo() ) );
255 editMenu->addAction (a);
259 a = new QAction(QPixmap(iconPath+"redo.png" ), tr( "&Redo" ),this);
260 a->setStatusTip ( tr( "Redo","Status tip for note menu" ) );
261 a->setShortcut( Qt::CTRL + Qt::Key_Y );
262 connect( a, SIGNAL( activated() ), e, SLOT( redo() ) );
263 editMenu->addAction (a);
267 editMenu->addSeparator();
268 a = new QAction(QPixmap(), tr( "Select and copy &all" ),this);
269 a->setStatusTip ( tr( "Select and copy all","Status tip for note menu" ) );
270 a->setShortcut( Qt::CTRL + Qt::Key_A );
271 connect( a, SIGNAL( activated() ), this, SLOT( editCopyAll() ) );
272 editMenu->addAction (a);
274 editMenu->addSeparator();
275 a = new QAction(QPixmap(iconPath+"editcopy.png" ), tr( "&Copy" ),this);
276 a->setStatusTip ( tr( "Copy","Status tip for note menu" ) );
277 a->setShortcut( Qt::CTRL + Qt::Key_C );
278 connect( a, SIGNAL( activated() ), e, SLOT( copy() ) );
279 editMenu->addAction (a);
283 a = new QAction(QPixmap(iconPath+"editcut.png" ), tr( "Cu&t" ),this);
284 a->setStatusTip ( tr( "Cut","Status tip for note menu" ) );
285 a->setShortcut( Qt::CTRL + Qt::Key_X );
286 connect( a, SIGNAL( activated() ), e, SLOT( cut() ) );
287 editMenu->addAction (a);
291 a = new QAction(QPixmap(iconPath+"editpaste.png" ), tr( "&Paste" ),this);
292 a->setStatusTip ( tr( "Paste","Status tip for note menu" ) );
293 a->setShortcut( Qt::CTRL + Qt::Key_V );
294 connect( a, SIGNAL( activated() ), e, SLOT( paste() ) );
295 editMenu->addAction (a);
299 a = new QAction( QPixmap( iconPath+"edittrash.png"), tr( "&Delete All" ), this);
300 a->setStatusTip (tr( "Delete all","Status tip for note menu" ) );
301 connect( a, SIGNAL( activated() ), e, SLOT( clear() ) );
302 editMenu->addAction (a);
304 actionEditDeleteAll=a;
308 void TextEditor::setupFormatActions()
310 QToolBar *tb = addToolBar ( tr("Format Actions" ));
311 tb->setObjectName ("noteEditorFormatActions");
312 QMenu *formatMenu = menuBar()->addMenu ( tr( "F&ormat" ));
316 a = new QAction( QPixmap(iconPath+"formatfixedfont.png"), tr( "&Font hint" ), Qt::ALT + Qt::Key_I, this, "fontHint" );
317 a->setStatusTip (tr( "Toggle font hint for the whole text","Status tip for note menu" ) );
318 a->setToggleAction (true);
319 a->setOn (settings.value("/noteeditor/fonts/useFixedByDefault",false).toBool() );
320 connect( a, SIGNAL( activated() ), this, SLOT( toggleFonthint() ) );
321 formatMenu->addAction (a);
323 actionFormatUseFixedFont=a;
325 comboFont = new QComboBox;
326 tb->addWidget (comboFont);
327 QFontDatabase fontDB;
328 comboFont->insertStringList( fontDB.families() );
329 connect( comboFont, SIGNAL( activated( const QString & ) ),
330 this, SLOT( textFamily( const QString & ) ) );
331 comboFont->addItem( QApplication::font().family() );
332 comboSize = new QComboBox;
333 tb->addWidget (comboSize);
334 QList<int> sizes=fontDB.standardSizes();
335 QList<int>::iterator i = sizes.begin();
336 while (i != sizes.end())
338 ++i; // increment i before using it
339 comboSize->insertItem ( QString::number(*i));
341 connect( comboSize, SIGNAL( activated( const QString & ) ),
342 this, SLOT( textSize( const QString & ) ) );
343 comboSize->addItem ( QString::number( QApplication::font().pointSize() ) );
345 formatMenu->addSeparator();
347 QPixmap pix( 16, 16 );
348 pix.fill( e->color());
349 a = new QAction( pix, tr( "&Color..." ), this);
350 formatMenu->addAction (a);
352 connect( a, SIGNAL( activated() ), this, SLOT( textColor() ) );
355 a = new QAction( QPixmap (iconPath+"text_bold.png"), tr( "&Bold" ), this);
356 a->setShortcut(Qt::CTRL + Qt::Key_B );
357 connect( a, SIGNAL( activated() ), this, SLOT( textBold() ) );
359 formatMenu->addAction (a);
360 a->setToggleAction( true );
363 a = new QAction( QPixmap(iconPath+"text_italic.png"), tr( "&Italic" ), this);
364 a->setShortcut(Qt::CTRL + Qt::Key_I);
365 connect( a, SIGNAL( activated() ), this, SLOT( textItalic() ) );
367 formatMenu->addAction (a);
368 a->setToggleAction( true );
371 a = new QAction( QPixmap (iconPath+"text_under.png"), tr( "&Underline" ), this);
372 a->setShortcut(Qt::CTRL + Qt::Key_U );
373 connect( a, SIGNAL( activated() ), this, SLOT( textUnderline() ) );
375 formatMenu->addAction (a);
376 a->setToggleAction( true );
377 actionTextUnderline=a;
378 formatMenu->addSeparator();
380 QActionGroup *grp2 = new QActionGroup( this );
381 grp2->setExclusive(true);
382 a = new QAction( QPixmap (iconPath+"text_sub.png"), tr( "Subs&cript" ),grp2 );
383 a->setShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_B );
384 a->setToggleAction( true );
386 formatMenu->addAction (a);
387 connect(a, SIGNAL(activated()), this, SLOT(textVAlign()));
388 actionAlignSubScript=a;
390 a = new QAction( QPixmap (iconPath+"text_super.png"), tr( "Su&perscript" ),grp2 );
391 a->setShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_P );
392 a->setToggleAction( true );
394 formatMenu->addAction (a);
395 connect(a, SIGNAL(activated()), this, SLOT(textVAlign()));
396 actionAlignSuperScript=a;
397 QActionGroup *grp = new QActionGroup( this );
398 connect( grp, SIGNAL( selected( QAction* ) ), this, SLOT( textAlign( QAction* ) ) );
400 formatMenu->addSeparator();
402 a = new QAction( QPixmap (iconPath+"text_left.png"), tr( "&Left" ),grp );
403 a->setShortcut( Qt::CTRL+Qt::Key_L );
404 a->setToggleAction( true );
406 formatMenu->addAction (a);
408 a = new QAction( QPixmap (iconPath+"text_center.png"), tr( "C&enter" ),grp);
409 a->setShortcut( Qt::CTRL + Qt::Key_E);
410 a->setToggleAction( true );
412 formatMenu->addAction (a);
414 a = new QAction( QPixmap (iconPath+"text_right.png" ), tr( "&Right" ), grp);
415 a->setShortcut(Qt::CTRL + Qt::Key_R );
416 a->setToggleAction( true );
418 formatMenu->addAction (a);
420 a = new QAction( QPixmap ( iconPath+"text_block.png"), tr( "&Justify" ), grp );
421 a->setShortcut(Qt::CTRL + Qt::Key_J );
422 a->setToggleAction( true );
424 formatMenu->addAction (a);
425 actionAlignJustify=a;
428 void TextEditor::setupSettingsActions()
430 QMenu *settingsMenu = menuBar()->addMenu ( tr( "&Settings" ));
433 a = new QAction(tr( "Set &fixed font" ), this);
434 a->setStatusTip ( tr( "Set fixed font","Status tip for note menu" ));
435 connect( a, SIGNAL( activated() ), this, SLOT( setFixedFont() ) );
436 settingsMenu->addAction (a);
437 actionSettingsFixedFont=a;
439 a = new QAction(tr( "Set &variable font" ), this);
440 a->setStatusTip ( tr( "Set variable font","Status tip for note menu" ) );
441 connect( a, SIGNAL( activated() ), this, SLOT( setVarFont() ) );
442 settingsMenu->addAction (a);
443 actionSettingsVarFont=a;
445 a = new QAction(tr( "&fixed font is default" ), this);
446 a->setStatusTip (tr( "Used fixed font by default","Status tip for note menu" ) );
447 a->setToggleAction (true);
448 // set state later in constructor...
449 settingsMenu->addAction (a);
450 actionSettingsFonthintDefault=a;
453 void TextEditor::textLoad()
455 if (state!=inactiveEditor)
457 if (e->text().length())
459 QMessageBox mb( vymName + " - " +tr("Note Editor"),
460 "Loading will overwrite the existing note",
461 QMessageBox::Warning,
462 QMessageBox::Yes | QMessageBox::Default,
465 mb.setButtonText( QMessageBox::Yes, "Load note" );
466 switch( mb.exec() ) {
467 case QMessageBox::Cancel:
473 QFileDialog *fd=new QFileDialog( this);
475 types<< "VYM notes (*.html)" <<
476 "ASCII texts (*.txt)" <<
478 fd->setFilters (types);
479 fd->setDirectory (QDir().current());
482 if ( fd->exec() == QDialog::Accepted )
483 fn = fd->selectedFile();
488 if ( !f.open( QIODevice::ReadOnly ) )
491 QTextStream ts( &f );
492 setText( ts.read() );
498 void TextEditor::closeEvent( QCloseEvent* ce )
500 ce->accept(); // TextEditor can be reopened with show()
502 emit (textEditorClosed() );
506 QString TextEditor::getText()
508 if (e->toPlainText().isEmpty())
514 void TextEditor::editorChanged()
521 if (state==emptyEditor)
522 setState (emptyEditor);
524 setState (filledEditor);
525 // SLOT is LinkableMapObj, which will update systemFlag
526 emit (textHasChanged() );
530 void TextEditor::setText(QString t)
532 e->setReadOnly(false);
537 void TextEditor::setInactive()
539 state=inactiveEditor;
541 setState (inactiveEditor);
542 e->setReadOnly (true);
547 void TextEditor::editCopyAll()
553 void TextEditor::textSaveAs()
555 QString fn = QFileDialog::getSaveFileName( QString::null, "VYM Note (HTML) (*.html);;All files (*)",
556 this,"export note dialog",tr("Export Note to single file") );
563 QMessageBox mb( vymName,
564 tr("The file %1\nexists already.\nDo you want to overwrite it?","dialog 'save note as'").arg(fn),
565 QMessageBox::Warning,
566 QMessageBox::Yes | QMessageBox::Default,
567 QMessageBox::Cancel | QMessageBox::Escape,
569 mb.setButtonText( QMessageBox::Yes, tr("Overwrite") );
570 mb.setButtonText( QMessageBox::No, tr("Cancel"));
571 switch( mb.exec() ) {
572 case QMessageBox::Yes:
577 case QMessageBox::Cancel:
588 statusBar()->message(tr( "Couldn't export note ","dialog 'save note as'") + fn, statusbarTime );
592 void TextEditor::textSave()
594 if ( filename.isEmpty() )
600 QString text = e->text();
602 if ( !f.open( QIODevice::WriteOnly ) )
604 statusBar()->message( QString("Could not write to %1").arg(filename),
613 e->setModified( FALSE );
615 statusBar()->message( QString( "Note exported as %1" ).arg( filename ), statusbarTime );
618 void TextEditor::textExportAsASCII()
620 QString text = NoteObj (e->text()).getNoteASCII();
622 if (!filenameHint.isEmpty())
624 if (!filenameHint.contains (".txt"))
625 s=filenameHint+".txt";
630 fn = QFileDialog::getSaveFileName( s, "VYM Note (ASCII) (*.txt);;All files (*)", this,"export note dialog",tr("Export Note to single file (ASCII)") );
638 QMessageBox mb( vymName,
639 tr("The file %1\nexists already.\nDo you want to overwrite it?","dialog 'save note as'").arg(fn),
640 QMessageBox::Warning,
641 QMessageBox::Yes | QMessageBox::Default,
642 QMessageBox::Cancel | QMessageBox::Escape,
644 mb.setButtonText( QMessageBox::Yes, tr("Overwrite") );
645 mb.setButtonText( QMessageBox::No, tr("Cancel"));
648 if (ret==QMessageBox::Cancel)
652 if ( !file.open( QIODevice::WriteOnly ) )
653 statusBar()->message( QString("Could not write to %1").arg(filename),
657 QTextStream t( &file );
661 statusBar()->message( QString( "Note exported as %1" ).arg( fn ), statusbarTime );
667 void TextEditor::textPrint()
670 QTextDocument *document = e->document();
673 QPrintDialog *dialog = new QPrintDialog(&printer, this);
674 dialog->setWindowTitle(tr("Print Note"));
675 if (dialog->exec() != QDialog::Accepted)
678 document->print(&printer);
681 void TextEditor::textEditUndo()
685 void TextEditor::toggleFonthint()
687 setUpdatesEnabled (false);
689 if (!actionFormatUseFixedFont->isOn() )
690 e->setCurrentFont (varFont);
692 e->setCurrentFont (fixedFont);
694 setUpdatesEnabled (true);
698 void TextEditor::setFixedFont()
701 QFont font =QFontDialog::getFont(
702 &ok, fixedFont, this );
704 // font is set to the font the user selected
708 void TextEditor::setVarFont()
711 QFont font =QFontDialog::getFont(
712 &ok, varFont, this );
714 // font is set to the font the user selected
718 void TextEditor::textBold()
720 e->setBold( actionTextBold->isOn() );
723 void TextEditor::textUnderline()
725 e->setUnderline( actionTextUnderline->isOn() );
728 void TextEditor::textItalic()
730 e->setItalic( actionTextItalic->isOn() );
733 void TextEditor::textFamily( const QString &f )
738 void TextEditor::textSize( const QString &p )
740 e->setPointSize( p.toInt() );
744 void TextEditor::textColor()
746 QColor col = QColorDialog::getColor( e->color(), this );
747 if ( !col.isValid() ) return;
749 QPixmap pix( 16, 16 );
750 pix.fill( Qt::black );
751 actionTextColor->setIconSet( pix );
754 void TextEditor::textAlign( QAction *a )
756 if ( a == actionAlignLeft )
757 e->setAlignment( Qt::AlignLeft );
758 else if ( a == actionAlignCenter )
759 e->setAlignment( Qt::AlignHCenter );
760 else if ( a == actionAlignRight )
761 e->setAlignment( Qt::AlignRight );
762 else if ( a == actionAlignJustify )
763 e->setAlignment( Qt::AlignJustify );
766 void TextEditor::textVAlign()
768 QTextCharFormat format;
770 if ( sender() == actionAlignSuperScript && actionAlignSuperScript->isOn()) {
771 format.setVerticalAlignment(QTextCharFormat::AlignSuperScript);
772 } else if (sender() == actionAlignSubScript && actionAlignSubScript->isOn()) {
773 format.setVerticalAlignment(QTextCharFormat::AlignSubScript);
775 format.setVerticalAlignment(QTextCharFormat::AlignNormal);
777 e->mergeCurrentCharFormat(format);
781 void TextEditor::fontChanged( const QFont &f )
783 int i=comboFont->findText(f.family());
784 if (i>=0) comboFont->setCurrentIndex (i);
785 i=comboSize->findText(QString::number(f.pointSize()));
786 if (i>=0) comboSize->setCurrentIndex(i);
787 actionTextBold->setOn( f.bold() );
788 actionTextItalic->setOn( f.italic() );
789 actionTextUnderline->setOn( f.underline() );
792 void TextEditor::colorChanged( const QColor &c )
794 QPixmap pix( 16, 16 );
796 actionTextColor->setIconSet( pix );
799 void TextEditor::formatChanged( const QTextCharFormat &f )
801 fontChanged(f.font());
802 colorChanged(f.foreground().color());
803 alignmentChanged(e->alignment());
804 verticalAlignmentChanged (f.verticalAlignment());
807 void TextEditor::alignmentChanged( int a )
809 if ( ( a == Qt::AlignLeft ) || ( a & Qt::AlignLeft ))
810 actionAlignLeft->setOn( true );
811 else if ( ( a & Qt::AlignHCenter ) )
812 actionAlignCenter->setOn( true );
813 else if ( ( a & Qt::AlignRight ) )
814 actionAlignRight->setOn( true );
815 else if ( ( a & Qt::AlignJustify ) )
816 actionAlignJustify->setOn( true );
819 void TextEditor::verticalAlignmentChanged(QTextCharFormat::VerticalAlignment a)
821 actionAlignSubScript->setOn (false);
822 actionAlignSuperScript->setOn (false);
825 case QTextCharFormat::AlignSuperScript:
826 actionAlignSuperScript->setOn (true);
828 case QTextCharFormat::AlignSubScript:
829 actionAlignSubScript->setOn (true);
837 void TextEditor::enableActions()
839 actionFileLoad->setEnabled(true);
840 actionFileSave->setEnabled(true);
841 actionFileSaveAs->setEnabled(true);
842 actionFilePrint->setEnabled(true);
843 actionEditUndo->setEnabled(true);
844 actionEditRedo->setEnabled(true);
845 actionEditCopy->setEnabled(true);
846 actionEditCut->setEnabled(true);
847 actionEditPaste->setEnabled(true);
848 actionEditDeleteAll->setEnabled(true);
849 actionFormatUseFixedFont->setEnabled(true);
852 void TextEditor::disableActions()
854 actionFileLoad->setEnabled(false);
855 actionFileSave->setEnabled(false);
856 actionFileSaveAs->setEnabled(false);
857 actionFilePrint->setEnabled(false);
858 actionEditUndo->setEnabled(false);
859 actionEditRedo->setEnabled(false);
860 actionEditCopy->setEnabled(false);
861 actionEditCut->setEnabled(false);
862 actionEditPaste->setEnabled(false);
863 actionEditDeleteAll->setEnabled(false);
864 actionFormatUseFixedFont->setEnabled(false);
867 void TextEditor::setState (EditorState s)
870 QPalette p=palette();
874 case emptyEditor: c=QColor (150,150,150); break;
875 case filledEditor: c=QColor (255,255,255); break;
876 case inactiveEditor: c=QColor (0,0,0);
878 p.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(9), c);
879 p.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(9), c);