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();
55 blockChangedSignal=false;
59 resize (settings.value ( "/noteeditor/geometry/size", QSize(450,600)).toSize());
60 move (settings.value ( "/noteeditor/geometry/pos", QPoint (250,50)).toPoint());
62 if (settings.value ( "/noteeditor/showWithMain",true).toBool())
63 setShowWithMain(true);
65 setShowWithMain(false);
67 varFont.fromString( settings.value
68 ("/noteeditor/fonts/varFont",
69 "Nimbus Sans l,14,-1,5,48,0,0,0,0,0").toString()
71 fixedFont.fromString (settings.value(
72 "/noteeditor/fonts/fixedFont",
73 "Courier,14,-1,5,48,0,0,0,1,0").toString()
75 QString s=settings.value ("/noteeditor/fonts/fonthintDefault","variable").toString();
78 actionSettingsFonthintDefault->setOn (true);
79 e->setCurrentFont (fixedFont);
82 actionSettingsFonthintDefault->setOn (false);
83 e->setCurrentFont (varFont);
87 // Restore position of toolbars
88 restoreState (settings.value("/noteeditor/state",0).toByteArray());
90 // Save settings in vymrc
91 settings.setValue("/mainwindow/printerName",printer->printerName());
95 TextEditor::~TextEditor()
97 if (printer) delete printer;
99 settings.setValue( "/noteeditor/geometry/size", size() );
100 settings.setValue( "/noteeditor/geometry/pos", pos() );
101 settings.setValue ("/noteeditor/state",saveState(0));
103 settings.setValue( "/noteeditor/showWithMain",showWithMain());
106 if (actionSettingsFonthintDefault->isOn() )
110 settings.setValue( "/noteeditor/fonts/fonthintDefault",s );
111 settings.setValue("/noteeditor/fonts/varFont", varFont.toString() );
112 settings.setValue("/noteeditor/fonts/fixedFont", fixedFont.toString() );
117 bool TextEditor::isEmpty()
119 if (e->toPlainText().length()>0)
125 void TextEditor::setShowWithMain(bool v)
130 bool TextEditor::showWithMain()
135 void TextEditor::setFontHint (const QString &fh)
138 actionFormatUseFixedFont->setOn (true);
140 actionFormatUseFixedFont->setOn (false);
144 QString TextEditor::getFontHint()
146 if (actionFormatUseFixedFont->isOn())
152 QString TextEditor::getFontHintDefault()
154 if (actionSettingsFonthintDefault->isOn())
160 void TextEditor::setFilename(const QString &fn)
162 if (state==filledEditor)
166 statusBar()->message( tr("No filename available for this note.","Statusbar message"), statusbarTime );
171 statusBar()->message( tr(QString( "Current filename is %1" ).arg( filename ),"Statusbar message"), statusbarTime );
175 QString TextEditor::getFilename()
180 void TextEditor::setFilenameHint(const QString &fnh)
185 QString TextEditor::getFilenameHint()
190 bool TextEditor::findText(const QString &t, const QTextDocument::FindFlags &flags)
192 if (e->find (t,flags))
198 void TextEditor::setupFileActions()
200 QToolBar *tb = addToolBar ( tr("Note Actions") );
201 tb->setObjectName ("noteEditorFileActions");
202 QMenu *fileMenu = menuBar()->addMenu( tr( "&Note","Menubar" ));
205 a = new QAction( QPixmap( iconPath+"fileopen.png"), tr( "&Import..." ),this);
206 a->setStatusTip (tr( "Import","Status tip for Note menu" ) );
207 a->setShortcut( Qt::CTRL + Qt::Key_O );
208 connect( a, SIGNAL( activated() ), this, SLOT( textLoad() ) );
210 fileMenu->addAction (a);
213 fileMenu->addSeparator();
214 a = new QAction( QPixmap(iconPath+"filesave.png" ), tr( "&Export..." ),this);
215 a->setStatusTip (tr( "Export Note (HTML)","Status tip for Note menu" ) );
216 a->setShortcut( Qt::CTRL + Qt::Key_S );
217 connect( a, SIGNAL( activated() ), this, SLOT( textSave() ) );
219 fileMenu->addAction (a);
222 a = new QAction( QPixmap(), tr( "Export &As... (HTML)" ), this);
223 a->setStatusTip (tr( "Export Note As (HTML) ","Status tip for Note Menu" ));
224 connect( a, SIGNAL( activated() ), this, SLOT( textSaveAs() ) );
225 fileMenu->addAction (a);
228 a = new QAction(QPixmap(), tr( "Export &As...(ASCII)" ), this);
229 a->setStatusTip ( tr( "Export Note As (ASCII) ","Status tip for note menu" ) );
230 a->setShortcut(Qt::ALT + Qt::Key_X );
231 connect( a, SIGNAL( activated() ), this, SLOT( textExportAsASCII() ) );
232 fileMenu->addAction (a);
235 fileMenu->addSeparator();
236 a = new QAction( QPixmap(iconPath+"fileprint.png" ), tr( "&Print..." ),this);
237 a->setStatusTip (tr( "Print Note","Status tip for note menu" ) );
238 a->setShortcut( Qt::CTRL + Qt::Key_P );
239 connect( a, SIGNAL( activated() ), this, SLOT( textPrint() ) );
241 fileMenu->addAction (a);
245 void TextEditor::setupEditActions()
247 QToolBar *tb = addToolBar ( tr( "Edit Actions" ));
248 tb->setObjectName ("noteEditorEditActions");
249 QMenu *editMenu = menuBar()->addMenu ( tr( "&Edit" ));
252 a = new QAction(QPixmap(iconPath+"undo.png"), tr( "&Undo" ), this );
253 a->setStatusTip ( tr( "Undo","Status tip for note menu" ) );
254 a->setShortcut(Qt::CTRL + Qt::Key_Z );
255 connect( a, SIGNAL( activated() ), e, SLOT( undo() ) );
256 editMenu->addAction (a);
260 a = new QAction(QPixmap(iconPath+"redo.png" ), tr( "&Redo" ),this);
261 a->setStatusTip ( tr( "Redo","Status tip for note menu" ) );
262 a->setShortcut( Qt::CTRL + Qt::Key_Y );
263 connect( a, SIGNAL( activated() ), e, SLOT( redo() ) );
264 editMenu->addAction (a);
268 editMenu->addSeparator();
269 a = new QAction(QPixmap(), tr( "Select and copy &all" ),this);
270 a->setStatusTip ( tr( "Select and copy all","Status tip for note menu" ) );
271 a->setShortcut( Qt::CTRL + Qt::Key_A );
272 connect( a, SIGNAL( activated() ), this, SLOT( editCopyAll() ) );
273 editMenu->addAction (a);
275 editMenu->addSeparator();
276 a = new QAction(QPixmap(iconPath+"editcopy.png" ), tr( "&Copy" ),this);
277 a->setStatusTip ( tr( "Copy","Status tip for note menu" ) );
278 a->setShortcut( Qt::CTRL + Qt::Key_C );
279 connect( a, SIGNAL( activated() ), e, SLOT( copy() ) );
280 editMenu->addAction (a);
284 a = new QAction(QPixmap(iconPath+"editcut.png" ), tr( "Cu&t" ),this);
285 a->setStatusTip ( tr( "Cut","Status tip for note menu" ) );
286 a->setShortcut( Qt::CTRL + Qt::Key_X );
287 connect( a, SIGNAL( activated() ), e, SLOT( cut() ) );
288 editMenu->addAction (a);
292 a = new QAction(QPixmap(iconPath+"editpaste.png" ), tr( "&Paste" ),this);
293 a->setStatusTip ( tr( "Paste","Status tip for note menu" ) );
294 a->setShortcut( Qt::CTRL + Qt::Key_V );
295 connect( a, SIGNAL( activated() ), e, SLOT( paste() ) );
296 editMenu->addAction (a);
300 a = new QAction( QPixmap( iconPath+"edittrash.png"), tr( "&Delete All" ), this);
301 a->setStatusTip (tr( "Delete all","Status tip for note menu" ) );
302 connect( a, SIGNAL( activated() ), e, SLOT( clear() ) );
303 editMenu->addAction (a);
305 actionEditDeleteAll=a;
309 void TextEditor::setupFormatActions()
311 QToolBar *tb = addToolBar ( tr("Format Actions" ));
312 tb->setObjectName ("noteEditorFormatActions");
313 QMenu *formatMenu = menuBar()->addMenu ( tr( "F&ormat" ));
317 a = new QAction( QPixmap(iconPath+"formatfixedfont.png"), tr( "&Font hint" ), Qt::ALT + Qt::Key_I, this, "fontHint" );
318 a->setStatusTip (tr( "Toggle font hint for the whole text","Status tip for note menu" ) );
319 a->setToggleAction (true);
320 a->setOn (settings.value("/noteeditor/fonts/useFixedByDefault",false).toBool() );
321 connect( a, SIGNAL( activated() ), this, SLOT( toggleFonthint() ) );
322 formatMenu->addAction (a);
324 actionFormatUseFixedFont=a;
326 comboFont = new QComboBox;
327 tb->addWidget (comboFont);
328 QFontDatabase fontDB;
329 comboFont->insertStringList( fontDB.families() );
330 connect( comboFont, SIGNAL( activated( const QString & ) ),
331 this, SLOT( textFamily( const QString & ) ) );
332 comboFont->addItem( QApplication::font().family() );
333 comboSize = new QComboBox;
334 tb->addWidget (comboSize);
335 QList<int> sizes=fontDB.standardSizes();
336 QList<int>::iterator i = sizes.begin();
337 while (i != sizes.end())
339 ++i; // increment i before using it
340 comboSize->insertItem ( QString::number(*i));
342 connect( comboSize, SIGNAL( activated( const QString & ) ),
343 this, SLOT( textSize( const QString & ) ) );
344 comboSize->addItem ( QString::number( QApplication::font().pointSize() ) );
346 formatMenu->addSeparator();
348 QPixmap pix( 16, 16 );
349 pix.fill( e->color());
350 a = new QAction( pix, tr( "&Color..." ), this);
351 formatMenu->addAction (a);
353 connect( a, SIGNAL( activated() ), this, SLOT( textColor() ) );
356 a = new QAction( QPixmap (iconPath+"text_bold.png"), tr( "&Bold" ), this);
357 a->setShortcut(Qt::CTRL + Qt::Key_B );
358 connect( a, SIGNAL( activated() ), this, SLOT( textBold() ) );
360 formatMenu->addAction (a);
361 a->setToggleAction( true );
364 a = new QAction( QPixmap(iconPath+"text_italic.png"), tr( "&Italic" ), this);
365 a->setShortcut(Qt::CTRL + Qt::Key_I);
366 connect( a, SIGNAL( activated() ), this, SLOT( textItalic() ) );
368 formatMenu->addAction (a);
369 a->setToggleAction( true );
372 a = new QAction( QPixmap (iconPath+"text_under.png"), tr( "&Underline" ), this);
373 a->setShortcut(Qt::CTRL + Qt::Key_U );
374 connect( a, SIGNAL( activated() ), this, SLOT( textUnderline() ) );
376 formatMenu->addAction (a);
377 a->setToggleAction( true );
378 actionTextUnderline=a;
379 formatMenu->addSeparator();
381 QActionGroup *grp2 = new QActionGroup( this );
382 grp2->setExclusive(true);
383 a = new QAction( QPixmap (iconPath+"text_sub.png"), tr( "Subs&cript" ),grp2 );
384 a->setShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_B );
385 a->setToggleAction( true );
387 formatMenu->addAction (a);
388 connect(a, SIGNAL(activated()), this, SLOT(textVAlign()));
389 actionAlignSubScript=a;
391 a = new QAction( QPixmap (iconPath+"text_super.png"), tr( "Su&perscript" ),grp2 );
392 a->setShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_P );
393 a->setToggleAction( true );
395 formatMenu->addAction (a);
396 connect(a, SIGNAL(activated()), this, SLOT(textVAlign()));
397 actionAlignSuperScript=a;
398 QActionGroup *grp = new QActionGroup( this );
399 connect( grp, SIGNAL( selected( QAction* ) ), this, SLOT( textAlign( QAction* ) ) );
401 formatMenu->addSeparator();
403 a = new QAction( QPixmap (iconPath+"text_left.png"), tr( "&Left" ),grp );
404 a->setShortcut( Qt::CTRL+Qt::Key_L );
405 a->setToggleAction( true );
407 formatMenu->addAction (a);
409 a = new QAction( QPixmap (iconPath+"text_center.png"), tr( "C&enter" ),grp);
410 a->setShortcut( Qt::CTRL + Qt::Key_E);
411 a->setToggleAction( true );
413 formatMenu->addAction (a);
415 a = new QAction( QPixmap (iconPath+"text_right.png" ), tr( "&Right" ), grp);
416 a->setShortcut(Qt::CTRL + Qt::Key_R );
417 a->setToggleAction( true );
419 formatMenu->addAction (a);
421 a = new QAction( QPixmap ( iconPath+"text_block.png"), tr( "&Justify" ), grp );
422 a->setShortcut(Qt::CTRL + Qt::Key_J );
423 a->setToggleAction( true );
425 formatMenu->addAction (a);
426 actionAlignJustify=a;
429 void TextEditor::setupSettingsActions()
431 QMenu *settingsMenu = menuBar()->addMenu ( tr( "&Settings" ));
434 a = new QAction(tr( "Set &fixed font" ), this);
435 a->setStatusTip ( tr( "Set fixed font","Status tip for note menu" ));
436 connect( a, SIGNAL( activated() ), this, SLOT( setFixedFont() ) );
437 settingsMenu->addAction (a);
438 actionSettingsFixedFont=a;
440 a = new QAction(tr( "Set &variable font" ), this);
441 a->setStatusTip ( tr( "Set variable font","Status tip for note menu" ) );
442 connect( a, SIGNAL( activated() ), this, SLOT( setVarFont() ) );
443 settingsMenu->addAction (a);
444 actionSettingsVarFont=a;
446 a = new QAction(tr( "&fixed font is default" ), this);
447 a->setStatusTip (tr( "Used fixed font by default","Status tip for note menu" ) );
448 a->setToggleAction (true);
449 // set state later in constructor...
450 settingsMenu->addAction (a);
451 actionSettingsFonthintDefault=a;
454 void TextEditor::textLoad()
456 if (state!=inactiveEditor)
458 if (e->text().length())
460 QMessageBox mb( vymName + " - " +tr("Note Editor"),
461 "Loading will overwrite the existing note",
462 QMessageBox::Warning,
463 QMessageBox::Yes | QMessageBox::Default,
466 mb.setButtonText( QMessageBox::Yes, "Load note" );
467 switch( mb.exec() ) {
468 case QMessageBox::Cancel:
474 QFileDialog *fd=new QFileDialog( this);
476 types<< "VYM notes (*.html)" <<
477 "ASCII texts (*.txt)" <<
479 fd->setFilters (types);
480 fd->setDirectory (QDir().current());
483 if ( fd->exec() == QDialog::Accepted )
484 fn = fd->selectedFile();
489 if ( !f.open( QIODevice::ReadOnly ) )
492 QTextStream ts( &f );
493 setText( ts.read() );
499 void TextEditor::closeEvent( QCloseEvent* ce )
501 ce->accept(); // TextEditor can be reopened with show()
503 emit (textEditorClosed() );
507 QString TextEditor::getText()
509 if (e->toPlainText().isEmpty())
515 void TextEditor::editorChanged()
522 if (state==emptyEditor)
523 setState (emptyEditor);
525 setState (filledEditor);
526 // SLOT is LinkableMapObj, which will update systemFlag
527 if (!blockChangedSignal) emit (textHasChanged() );
531 void TextEditor::setText(QString t)
533 blockChangedSignal=true;
534 e->setReadOnly(false);
537 blockChangedSignal=false;
540 void TextEditor::setInactive()
542 state=inactiveEditor;
544 setState (inactiveEditor);
545 e->setReadOnly (true);
550 void TextEditor::editCopyAll()
556 void TextEditor::textSaveAs()
558 QString fn = QFileDialog::getSaveFileName( QString::null, "VYM Note (HTML) (*.html);;All files (*)",
559 this,"export note dialog",tr("Export Note to single file") );
566 QMessageBox mb( vymName,
567 tr("The file %1\nexists already.\nDo you want to overwrite it?","dialog 'save note as'").arg(fn),
568 QMessageBox::Warning,
569 QMessageBox::Yes | QMessageBox::Default,
570 QMessageBox::Cancel | QMessageBox::Escape,
572 mb.setButtonText( QMessageBox::Yes, tr("Overwrite") );
573 mb.setButtonText( QMessageBox::No, tr("Cancel"));
574 switch( mb.exec() ) {
575 case QMessageBox::Yes:
580 case QMessageBox::Cancel:
591 statusBar()->message(tr( "Couldn't export note ","dialog 'save note as'") + fn, statusbarTime );
595 void TextEditor::textSave()
597 if ( filename.isEmpty() )
603 QString text = e->text();
605 if ( !f.open( QIODevice::WriteOnly ) )
607 statusBar()->message( QString("Could not write to %1").arg(filename),
616 e->setModified( FALSE );
618 statusBar()->message( QString( "Note exported as %1" ).arg( filename ), statusbarTime );
621 void TextEditor::textExportAsASCII()
623 QString text = NoteObj (e->text()).getNoteASCII();
625 if (!filenameHint.isEmpty())
627 if (!filenameHint.contains (".txt"))
628 s=filenameHint+".txt";
633 fn = QFileDialog::getSaveFileName( s, "VYM Note (ASCII) (*.txt);;All files (*)", this,"export note dialog",tr("Export Note to single file (ASCII)") );
641 QMessageBox mb( vymName,
642 tr("The file %1\nexists already.\nDo you want to overwrite it?","dialog 'save note as'").arg(fn),
643 QMessageBox::Warning,
644 QMessageBox::Yes | QMessageBox::Default,
645 QMessageBox::Cancel | QMessageBox::Escape,
647 mb.setButtonText( QMessageBox::Yes, tr("Overwrite") );
648 mb.setButtonText( QMessageBox::No, tr("Cancel"));
651 if (ret==QMessageBox::Cancel)
655 if ( !file.open( QIODevice::WriteOnly ) )
656 statusBar()->message( QString("Could not write to %1").arg(filename),
660 QTextStream t( &file );
664 statusBar()->message( QString( "Note exported as %1" ).arg( fn ), statusbarTime );
670 void TextEditor::textPrint()
673 QTextDocument *document = e->document();
676 QPrintDialog *dialog = new QPrintDialog(&printer, this);
677 dialog->setWindowTitle(tr("Print Note"));
678 if (dialog->exec() != QDialog::Accepted)
681 document->print(&printer);
684 void TextEditor::textEditUndo()
688 void TextEditor::toggleFonthint()
690 setUpdatesEnabled (false);
692 if (!actionFormatUseFixedFont->isOn() )
693 e->setCurrentFont (varFont);
695 e->setCurrentFont (fixedFont);
697 setUpdatesEnabled (true);
701 void TextEditor::setFixedFont()
704 QFont font =QFontDialog::getFont(
705 &ok, fixedFont, this );
707 // font is set to the font the user selected
711 void TextEditor::setVarFont()
714 QFont font =QFontDialog::getFont(
715 &ok, varFont, this );
717 // font is set to the font the user selected
721 void TextEditor::textBold()
723 e->setBold( actionTextBold->isOn() );
726 void TextEditor::textUnderline()
728 e->setUnderline( actionTextUnderline->isOn() );
731 void TextEditor::textItalic()
733 e->setItalic( actionTextItalic->isOn() );
736 void TextEditor::textFamily( const QString &f )
741 void TextEditor::textSize( const QString &p )
743 e->setPointSize( p.toInt() );
747 void TextEditor::textColor()
749 QColor col = QColorDialog::getColor( e->color(), this );
750 if ( !col.isValid() ) return;
752 QPixmap pix( 16, 16 );
753 pix.fill( Qt::black );
754 actionTextColor->setIconSet( pix );
757 void TextEditor::textAlign( QAction *a )
759 if ( a == actionAlignLeft )
760 e->setAlignment( Qt::AlignLeft );
761 else if ( a == actionAlignCenter )
762 e->setAlignment( Qt::AlignHCenter );
763 else if ( a == actionAlignRight )
764 e->setAlignment( Qt::AlignRight );
765 else if ( a == actionAlignJustify )
766 e->setAlignment( Qt::AlignJustify );
769 void TextEditor::textVAlign()
771 QTextCharFormat format;
773 if ( sender() == actionAlignSuperScript && actionAlignSuperScript->isOn()) {
774 format.setVerticalAlignment(QTextCharFormat::AlignSuperScript);
775 } else if (sender() == actionAlignSubScript && actionAlignSubScript->isOn()) {
776 format.setVerticalAlignment(QTextCharFormat::AlignSubScript);
778 format.setVerticalAlignment(QTextCharFormat::AlignNormal);
780 e->mergeCurrentCharFormat(format);
784 void TextEditor::fontChanged( const QFont &f )
786 int i=comboFont->findText(f.family());
787 if (i>=0) comboFont->setCurrentIndex (i);
788 i=comboSize->findText(QString::number(f.pointSize()));
789 if (i>=0) comboSize->setCurrentIndex(i);
790 actionTextBold->setOn( f.bold() );
791 actionTextItalic->setOn( f.italic() );
792 actionTextUnderline->setOn( f.underline() );
795 void TextEditor::colorChanged( const QColor &c )
797 QPixmap pix( 16, 16 );
799 actionTextColor->setIconSet( pix );
802 void TextEditor::formatChanged( const QTextCharFormat &f )
804 fontChanged(f.font());
805 colorChanged(f.foreground().color());
806 alignmentChanged(e->alignment());
807 verticalAlignmentChanged (f.verticalAlignment());
810 void TextEditor::alignmentChanged( int a )
812 if ( ( a == Qt::AlignLeft ) || ( a & Qt::AlignLeft ))
813 actionAlignLeft->setOn( true );
814 else if ( ( a & Qt::AlignHCenter ) )
815 actionAlignCenter->setOn( true );
816 else if ( ( a & Qt::AlignRight ) )
817 actionAlignRight->setOn( true );
818 else if ( ( a & Qt::AlignJustify ) )
819 actionAlignJustify->setOn( true );
822 void TextEditor::verticalAlignmentChanged(QTextCharFormat::VerticalAlignment a)
824 actionAlignSubScript->setOn (false);
825 actionAlignSuperScript->setOn (false);
828 case QTextCharFormat::AlignSuperScript:
829 actionAlignSuperScript->setOn (true);
831 case QTextCharFormat::AlignSubScript:
832 actionAlignSubScript->setOn (true);
840 void TextEditor::enableActions()
842 actionFileLoad->setEnabled(true);
843 actionFileSave->setEnabled(true);
844 actionFileSaveAs->setEnabled(true);
845 actionFilePrint->setEnabled(true);
846 actionEditUndo->setEnabled(true);
847 actionEditRedo->setEnabled(true);
848 actionEditCopy->setEnabled(true);
849 actionEditCut->setEnabled(true);
850 actionEditPaste->setEnabled(true);
851 actionEditDeleteAll->setEnabled(true);
852 actionFormatUseFixedFont->setEnabled(true);
855 void TextEditor::disableActions()
857 actionFileLoad->setEnabled(false);
858 actionFileSave->setEnabled(false);
859 actionFileSaveAs->setEnabled(false);
860 actionFilePrint->setEnabled(false);
861 actionEditUndo->setEnabled(false);
862 actionEditRedo->setEnabled(false);
863 actionEditCopy->setEnabled(false);
864 actionEditCut->setEnabled(false);
865 actionEditPaste->setEnabled(false);
866 actionEditDeleteAll->setEnabled(false);
867 actionFormatUseFixedFont->setEnabled(false);
870 void TextEditor::setState (EditorState s)
873 QPalette p=palette();
877 case emptyEditor: c=QColor (150,150,150); break;
878 case filledEditor: c=QColor (255,255,255); break;
879 case inactiveEditor: c=QColor (0,0,0);
881 p.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(9), c);
882 p.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(9), c);