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 ( "/satellite/noteeditor/geometry/size", QSize(450,600)).toSize());
60 move (settings.value ( "/satellite/noteeditor/geometry/pos", QPoint (250,50)).toPoint());
62 if (settings.value ( "/satellite/noteeditor/showWithMain",true).toBool())
67 varFont.fromString( settings.value
68 ("/satellite/noteeditor/fonts/varFont",
69 "Nimbus Sans l,14,-1,5,48,0,0,0,0,0").toString()
71 fixedFont.fromString (settings.value(
72 "/satellite/noteeditor/fonts/fixedFont",
73 "Courier,14,-1,5,48,0,0,0,1,0").toString()
75 QString s=settings.value ("/satellite/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("/satellite/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( "/satellite/noteeditor/geometry/size", size() );
100 settings.setValue( "/satellite/noteeditor/geometry/pos", pos() );
101 settings.setValue ("/satellite/noteeditor/state",saveState(0));
103 settings.setValue( "/satellite/noteeditor/showWithMain",isVisible());
106 if (actionSettingsFonthintDefault->isOn() )
110 settings.setValue( "/satellite/noteeditor/fonts/fonthintDefault",s );
111 settings.setValue("/satellite/noteeditor/fonts/varFont", varFont.toString() );
112 settings.setValue("/satellite/noteeditor/fonts/fixedFont", fixedFont.toString() );
117 bool TextEditor::isEmpty()
119 if (e->toPlainText().length()>0)
125 void TextEditor::setFontHint (const QString &fh)
128 actionFormatUseFixedFont->setOn (true);
130 actionFormatUseFixedFont->setOn (false);
134 QString TextEditor::getFontHint()
136 if (actionFormatUseFixedFont->isOn())
142 QString TextEditor::getFontHintDefault()
144 if (actionSettingsFonthintDefault->isOn())
150 void TextEditor::setFilename(const QString &fn)
152 if (state==filledEditor)
156 statusBar()->message( tr("No filename available for this note.","Statusbar message"), statusbarTime );
161 statusBar()->message( tr(QString( "Current filename is %1" ).arg( filename ),"Statusbar message"), statusbarTime );
165 QString TextEditor::getFilename()
170 void TextEditor::setFilenameHint(const QString &fnh)
175 QString TextEditor::getFilenameHint()
180 bool TextEditor::findText(const QString &t, const QTextDocument::FindFlags &flags)
182 if (e->find (t,flags))
188 void TextEditor::setupFileActions()
190 QToolBar *tb = addToolBar ( tr("Note Actions") );
191 tb->setObjectName ("noteEditorFileActions");
192 QMenu *fileMenu = menuBar()->addMenu( tr( "&Note","Menubar" ));
195 a = new QAction( QPixmap( iconPath+"fileopen.png"), tr( "&Import..." ),this);
196 a->setStatusTip (tr( "Import","Status tip for Note menu" ) );
197 a->setShortcut( Qt::CTRL + Qt::Key_O );
198 connect( a, SIGNAL( activated() ), this, SLOT( textLoad() ) );
200 fileMenu->addAction (a);
203 fileMenu->addSeparator();
204 a = new QAction( QPixmap(iconPath+"filesave.png" ), tr( "&Export..." ),this);
205 a->setStatusTip (tr( "Export Note (HTML)","Status tip for Note menu" ) );
206 a->setShortcut( Qt::CTRL + Qt::Key_S );
207 connect( a, SIGNAL( activated() ), this, SLOT( textSave() ) );
209 fileMenu->addAction (a);
212 a = new QAction( QPixmap(), tr( "Export &As... (HTML)" ), this);
213 a->setStatusTip (tr( "Export Note As (HTML) ","Status tip for Note Menu" ));
214 connect( a, SIGNAL( activated() ), this, SLOT( textSaveAs() ) );
215 fileMenu->addAction (a);
218 a = new QAction(QPixmap(), tr( "Export &As...(ASCII)" ), this);
219 a->setStatusTip ( tr( "Export Note As (ASCII) ","Status tip for note menu" ) );
220 a->setShortcut(Qt::ALT + Qt::Key_X );
221 connect( a, SIGNAL( activated() ), this, SLOT( textExportAsASCII() ) );
222 fileMenu->addAction (a);
225 fileMenu->addSeparator();
226 a = new QAction( QPixmap(iconPath+"fileprint.png" ), tr( "&Print..." ),this);
227 a->setStatusTip (tr( "Print Note","Status tip for note menu" ) );
228 a->setShortcut( Qt::CTRL + Qt::Key_P );
229 connect( a, SIGNAL( activated() ), this, SLOT( textPrint() ) );
231 fileMenu->addAction (a);
235 void TextEditor::setupEditActions()
237 QToolBar *tb = addToolBar ( tr( "Edit Actions" ));
238 tb->setObjectName ("noteEditorEditActions");
239 QMenu *editMenu = menuBar()->addMenu ( tr( "&Edit" ));
242 a = new QAction(QPixmap(iconPath+"undo.png"), tr( "&Undo" ), this );
243 a->setStatusTip ( tr( "Undo","Status tip for note menu" ) );
244 a->setShortcut(Qt::CTRL + Qt::Key_Z );
245 connect( a, SIGNAL( activated() ), e, SLOT( undo() ) );
246 editMenu->addAction (a);
250 a = new QAction(QPixmap(iconPath+"redo.png" ), tr( "&Redo" ),this);
251 a->setStatusTip ( tr( "Redo","Status tip for note menu" ) );
252 a->setShortcut( Qt::CTRL + Qt::Key_Y );
253 connect( a, SIGNAL( activated() ), e, SLOT( redo() ) );
254 editMenu->addAction (a);
258 editMenu->addSeparator();
259 a = new QAction(QPixmap(), tr( "Select and copy &all" ),this);
260 a->setStatusTip ( tr( "Select and copy all","Status tip for note menu" ) );
261 a->setShortcut( Qt::CTRL + Qt::Key_A );
262 connect( a, SIGNAL( activated() ), this, SLOT( editCopyAll() ) );
263 editMenu->addAction (a);
265 editMenu->addSeparator();
266 a = new QAction(QPixmap(iconPath+"editcopy.png" ), tr( "&Copy" ),this);
267 a->setStatusTip ( tr( "Copy","Status tip for note menu" ) );
268 a->setShortcut( Qt::CTRL + Qt::Key_C );
269 connect( a, SIGNAL( activated() ), e, SLOT( copy() ) );
270 editMenu->addAction (a);
274 a = new QAction(QPixmap(iconPath+"editcut.png" ), tr( "Cu&t" ),this);
275 a->setStatusTip ( tr( "Cut","Status tip for note menu" ) );
276 a->setShortcut( Qt::CTRL + Qt::Key_X );
277 connect( a, SIGNAL( activated() ), e, SLOT( cut() ) );
278 editMenu->addAction (a);
282 a = new QAction(QPixmap(iconPath+"editpaste.png" ), tr( "&Paste" ),this);
283 a->setStatusTip ( tr( "Paste","Status tip for note menu" ) );
284 a->setShortcut( Qt::CTRL + Qt::Key_V );
285 connect( a, SIGNAL( activated() ), e, SLOT( paste() ) );
286 editMenu->addAction (a);
290 a = new QAction( QPixmap( iconPath+"edittrash.png"), tr( "&Delete All" ), this);
291 a->setStatusTip (tr( "Delete all","Status tip for note menu" ) );
292 connect( a, SIGNAL( activated() ), e, SLOT( clear() ) );
293 editMenu->addAction (a);
295 actionEditDeleteAll=a;
299 void TextEditor::setupFormatActions()
301 QToolBar *tb = addToolBar ( tr("Format Actions" ));
302 tb->setObjectName ("noteEditorFormatActions");
303 QMenu *formatMenu = menuBar()->addMenu ( tr( "F&ormat" ));
307 a = new QAction( QPixmap(iconPath+"formatfixedfont.png"), tr( "&Font hint" ), Qt::ALT + Qt::Key_I, this, "fontHint" );
308 a->setStatusTip (tr( "Toggle font hint for the whole text","Status tip for note menu" ) );
309 a->setToggleAction (true);
310 a->setOn (settings.value("/noteeditor/fonts/useFixedByDefault",false).toBool() );
311 connect( a, SIGNAL( activated() ), this, SLOT( toggleFonthint() ) );
312 formatMenu->addAction (a);
314 actionFormatUseFixedFont=a;
316 comboFont = new QComboBox;
317 tb->addWidget (comboFont);
318 QFontDatabase fontDB;
319 comboFont->insertStringList( fontDB.families() );
320 connect( comboFont, SIGNAL( activated( const QString & ) ),
321 this, SLOT( textFamily( const QString & ) ) );
322 comboFont->addItem( QApplication::font().family() );
323 comboSize = new QComboBox;
324 tb->addWidget (comboSize);
325 QList<int> sizes=fontDB.standardSizes();
326 QList<int>::iterator i = sizes.begin();
327 while (i != sizes.end())
329 ++i; // increment i before using it
330 comboSize->insertItem ( QString::number(*i));
332 connect( comboSize, SIGNAL( activated( const QString & ) ),
333 this, SLOT( textSize( const QString & ) ) );
334 comboSize->addItem ( QString::number( QApplication::font().pointSize() ) );
336 formatMenu->addSeparator();
338 QPixmap pix( 16, 16 );
339 pix.fill( e->color());
340 a = new QAction( pix, tr( "&Color..." ), this);
341 formatMenu->addAction (a);
343 connect( a, SIGNAL( activated() ), this, SLOT( textColor() ) );
346 a = new QAction( QPixmap (iconPath+"text_bold.png"), tr( "&Bold" ), this);
347 a->setShortcut(Qt::CTRL + Qt::Key_B );
348 connect( a, SIGNAL( activated() ), this, SLOT( textBold() ) );
350 formatMenu->addAction (a);
351 a->setToggleAction( true );
354 a = new QAction( QPixmap(iconPath+"text_italic.png"), tr( "&Italic" ), this);
355 a->setShortcut(Qt::CTRL + Qt::Key_I);
356 connect( a, SIGNAL( activated() ), this, SLOT( textItalic() ) );
358 formatMenu->addAction (a);
359 a->setToggleAction( true );
362 a = new QAction( QPixmap (iconPath+"text_under.png"), tr( "&Underline" ), this);
363 a->setShortcut(Qt::CTRL + Qt::Key_U );
364 connect( a, SIGNAL( activated() ), this, SLOT( textUnderline() ) );
366 formatMenu->addAction (a);
367 a->setToggleAction( true );
368 actionTextUnderline=a;
369 formatMenu->addSeparator();
371 QActionGroup *grp2 = new QActionGroup( this );
372 grp2->setExclusive(true);
373 a = new QAction( QPixmap (iconPath+"text_sub.png"), tr( "Subs&cript" ),grp2 );
374 a->setShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_B );
375 a->setToggleAction( true );
377 formatMenu->addAction (a);
378 connect(a, SIGNAL(activated()), this, SLOT(textVAlign()));
379 actionAlignSubScript=a;
381 a = new QAction( QPixmap (iconPath+"text_super.png"), tr( "Su&perscript" ),grp2 );
382 a->setShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_P );
383 a->setToggleAction( true );
385 formatMenu->addAction (a);
386 connect(a, SIGNAL(activated()), this, SLOT(textVAlign()));
387 actionAlignSuperScript=a;
388 QActionGroup *grp = new QActionGroup( this );
389 connect( grp, SIGNAL( selected( QAction* ) ), this, SLOT( textAlign( QAction* ) ) );
391 formatMenu->addSeparator();
393 a = new QAction( QPixmap (iconPath+"text_left.png"), tr( "&Left" ),grp );
394 a->setShortcut( Qt::CTRL+Qt::Key_L );
395 a->setToggleAction( true );
397 formatMenu->addAction (a);
399 a = new QAction( QPixmap (iconPath+"text_center.png"), tr( "C&enter" ),grp);
400 a->setShortcut( Qt::CTRL + Qt::Key_E);
401 a->setToggleAction( true );
403 formatMenu->addAction (a);
405 a = new QAction( QPixmap (iconPath+"text_right.png" ), tr( "&Right" ), grp);
406 a->setShortcut(Qt::CTRL + Qt::Key_R );
407 a->setToggleAction( true );
409 formatMenu->addAction (a);
411 a = new QAction( QPixmap ( iconPath+"text_block.png"), tr( "&Justify" ), grp );
412 a->setShortcut(Qt::CTRL + Qt::Key_J );
413 a->setToggleAction( true );
415 formatMenu->addAction (a);
416 actionAlignJustify=a;
419 void TextEditor::setupSettingsActions()
421 QMenu *settingsMenu = menuBar()->addMenu ( tr( "&Settings" ));
424 a = new QAction(tr( "Set &fixed font" ), this);
425 a->setStatusTip ( tr( "Set fixed font","Status tip for note menu" ));
426 connect( a, SIGNAL( activated() ), this, SLOT( setFixedFont() ) );
427 settingsMenu->addAction (a);
428 actionSettingsFixedFont=a;
430 a = new QAction(tr( "Set &variable font" ), this);
431 a->setStatusTip ( tr( "Set variable font","Status tip for note menu" ) );
432 connect( a, SIGNAL( activated() ), this, SLOT( setVarFont() ) );
433 settingsMenu->addAction (a);
434 actionSettingsVarFont=a;
436 a = new QAction(tr( "&fixed font is default" ), this);
437 a->setStatusTip (tr( "Used fixed font by default","Status tip for note menu" ) );
438 a->setToggleAction (true);
439 // set state later in constructor...
440 settingsMenu->addAction (a);
441 actionSettingsFonthintDefault=a;
444 void TextEditor::textLoad()
446 if (state!=inactiveEditor)
448 if (e->text().length())
450 QMessageBox mb( vymName + " - " +tr("Note Editor"),
451 "Loading will overwrite the existing note",
452 QMessageBox::Warning,
453 QMessageBox::Yes | QMessageBox::Default,
456 mb.setButtonText( QMessageBox::Yes, "Load note" );
457 switch( mb.exec() ) {
458 case QMessageBox::Cancel:
464 QFileDialog *fd=new QFileDialog( this);
466 types<< "VYM notes (*.html)" <<
467 "ASCII texts (*.txt)" <<
469 fd->setFilters (types);
470 fd->setDirectory (QDir().current());
473 if ( fd->exec() == QDialog::Accepted )
474 fn = fd->selectedFile();
479 if ( !f.open( QIODevice::ReadOnly ) )
482 QTextStream ts( &f );
483 setText( ts.read() );
489 void TextEditor::closeEvent( QCloseEvent* ce )
491 ce->accept(); // TextEditor can be reopened with show()
493 emit (windowClosed() );
497 QString TextEditor::getText()
499 if (e->toPlainText().isEmpty())
505 void TextEditor::editorChanged()
512 if (state==emptyEditor)
513 setState (emptyEditor);
515 setState (filledEditor);
516 // SLOT is LinkableMapObj, which will update systemFlag
517 if (!blockChangedSignal) emit (textHasChanged() );
521 void TextEditor::setText(QString t)
523 blockChangedSignal=true;
524 e->setReadOnly(false);
527 blockChangedSignal=false;
530 void TextEditor::setInactive()
532 state=inactiveEditor;
534 setState (inactiveEditor);
535 e->setReadOnly (true);
540 void TextEditor::editCopyAll()
546 void TextEditor::textSaveAs()
548 QString fn = QFileDialog::getSaveFileName( QString::null, "VYM Note (HTML) (*.html);;All files (*)",
549 this,"export note dialog",tr("Export Note to single file") );
556 QMessageBox mb( vymName,
557 tr("The file %1\nexists already.\nDo you want to overwrite it?","dialog 'save note as'").arg(fn),
558 QMessageBox::Warning,
559 QMessageBox::Yes | QMessageBox::Default,
560 QMessageBox::Cancel | QMessageBox::Escape,
562 mb.setButtonText( QMessageBox::Yes, tr("Overwrite") );
563 mb.setButtonText( QMessageBox::No, tr("Cancel"));
564 switch( mb.exec() ) {
565 case QMessageBox::Yes:
570 case QMessageBox::Cancel:
581 statusBar()->message(tr( "Couldn't export note ","dialog 'save note as'") + fn, statusbarTime );
585 void TextEditor::textSave()
587 if ( filename.isEmpty() )
593 QString text = e->text();
595 if ( !f.open( QIODevice::WriteOnly ) )
597 statusBar()->message( QString("Could not write to %1").arg(filename),
606 e->setModified( FALSE );
608 statusBar()->message( QString( "Note exported as %1" ).arg( filename ), statusbarTime );
611 void TextEditor::textExportAsASCII()
613 QString text = NoteObj (e->text()).getNoteASCII();
615 if (!filenameHint.isEmpty())
617 if (!filenameHint.contains (".txt"))
618 s=filenameHint+".txt";
623 fn = QFileDialog::getSaveFileName( s, "VYM Note (ASCII) (*.txt);;All files (*)", this,"export note dialog",tr("Export Note to single file (ASCII)") );
631 QMessageBox mb( vymName,
632 tr("The file %1\nexists already.\nDo you want to overwrite it?","dialog 'save note as'").arg(fn),
633 QMessageBox::Warning,
634 QMessageBox::Yes | QMessageBox::Default,
635 QMessageBox::Cancel | QMessageBox::Escape,
637 mb.setButtonText( QMessageBox::Yes, tr("Overwrite") );
638 mb.setButtonText( QMessageBox::No, tr("Cancel"));
641 if (ret==QMessageBox::Cancel)
645 if ( !file.open( QIODevice::WriteOnly ) )
646 statusBar()->message( QString("Could not write to %1").arg(filename),
650 QTextStream t( &file );
654 statusBar()->message( QString( "Note exported as %1" ).arg( fn ), statusbarTime );
660 void TextEditor::textPrint()
663 QTextDocument *document = e->document();
666 QPrintDialog *dialog = new QPrintDialog(&printer, this);
667 dialog->setWindowTitle(tr("Print Note"));
668 if (dialog->exec() != QDialog::Accepted)
671 document->print(&printer);
674 void TextEditor::textEditUndo()
678 void TextEditor::toggleFonthint()
680 setUpdatesEnabled (false);
682 if (!actionFormatUseFixedFont->isOn() )
683 e->setCurrentFont (varFont);
685 e->setCurrentFont (fixedFont);
687 setUpdatesEnabled (true);
691 void TextEditor::setFixedFont()
694 QFont font =QFontDialog::getFont(
695 &ok, fixedFont, this );
697 // font is set to the font the user selected
701 void TextEditor::setVarFont()
704 QFont font =QFontDialog::getFont(
705 &ok, varFont, this );
707 // font is set to the font the user selected
711 void TextEditor::textBold()
713 e->setBold( actionTextBold->isOn() );
716 void TextEditor::textUnderline()
718 e->setUnderline( actionTextUnderline->isOn() );
721 void TextEditor::textItalic()
723 e->setItalic( actionTextItalic->isOn() );
726 void TextEditor::textFamily( const QString &f )
731 void TextEditor::textSize( const QString &p )
733 e->setPointSize( p.toInt() );
737 void TextEditor::textColor()
739 QColor col = QColorDialog::getColor( e->color(), this );
740 if ( !col.isValid() ) return;
742 QPixmap pix( 16, 16 );
743 pix.fill( Qt::black );
744 actionTextColor->setIconSet( pix );
747 void TextEditor::textAlign( QAction *a )
749 if ( a == actionAlignLeft )
750 e->setAlignment( Qt::AlignLeft );
751 else if ( a == actionAlignCenter )
752 e->setAlignment( Qt::AlignHCenter );
753 else if ( a == actionAlignRight )
754 e->setAlignment( Qt::AlignRight );
755 else if ( a == actionAlignJustify )
756 e->setAlignment( Qt::AlignJustify );
759 void TextEditor::textVAlign()
761 QTextCharFormat format;
763 if ( sender() == actionAlignSuperScript && actionAlignSuperScript->isOn()) {
764 format.setVerticalAlignment(QTextCharFormat::AlignSuperScript);
765 } else if (sender() == actionAlignSubScript && actionAlignSubScript->isOn()) {
766 format.setVerticalAlignment(QTextCharFormat::AlignSubScript);
768 format.setVerticalAlignment(QTextCharFormat::AlignNormal);
770 e->mergeCurrentCharFormat(format);
774 void TextEditor::fontChanged( const QFont &f )
776 int i=comboFont->findText(f.family());
777 if (i>=0) comboFont->setCurrentIndex (i);
778 i=comboSize->findText(QString::number(f.pointSize()));
779 if (i>=0) comboSize->setCurrentIndex(i);
780 actionTextBold->setOn( f.bold() );
781 actionTextItalic->setOn( f.italic() );
782 actionTextUnderline->setOn( f.underline() );
785 void TextEditor::colorChanged( const QColor &c )
787 QPixmap pix( 16, 16 );
789 actionTextColor->setIconSet( pix );
792 void TextEditor::formatChanged( const QTextCharFormat &f )
794 fontChanged(f.font());
795 colorChanged(f.foreground().color());
796 alignmentChanged(e->alignment());
797 verticalAlignmentChanged (f.verticalAlignment());
800 void TextEditor::alignmentChanged( int a )
802 if ( ( a == Qt::AlignLeft ) || ( a & Qt::AlignLeft ))
803 actionAlignLeft->setOn( true );
804 else if ( ( a & Qt::AlignHCenter ) )
805 actionAlignCenter->setOn( true );
806 else if ( ( a & Qt::AlignRight ) )
807 actionAlignRight->setOn( true );
808 else if ( ( a & Qt::AlignJustify ) )
809 actionAlignJustify->setOn( true );
812 void TextEditor::verticalAlignmentChanged(QTextCharFormat::VerticalAlignment a)
814 actionAlignSubScript->setOn (false);
815 actionAlignSuperScript->setOn (false);
818 case QTextCharFormat::AlignSuperScript:
819 actionAlignSuperScript->setOn (true);
821 case QTextCharFormat::AlignSubScript:
822 actionAlignSubScript->setOn (true);
830 void TextEditor::enableActions()
832 actionFileLoad->setEnabled(true);
833 actionFileSave->setEnabled(true);
834 actionFileSaveAs->setEnabled(true);
835 actionFilePrint->setEnabled(true);
836 actionEditUndo->setEnabled(true);
837 actionEditRedo->setEnabled(true);
838 actionEditCopy->setEnabled(true);
839 actionEditCut->setEnabled(true);
840 actionEditPaste->setEnabled(true);
841 actionEditDeleteAll->setEnabled(true);
842 actionFormatUseFixedFont->setEnabled(true);
845 void TextEditor::disableActions()
847 actionFileLoad->setEnabled(false);
848 actionFileSave->setEnabled(false);
849 actionFileSaveAs->setEnabled(false);
850 actionFilePrint->setEnabled(false);
851 actionEditUndo->setEnabled(false);
852 actionEditRedo->setEnabled(false);
853 actionEditCopy->setEnabled(false);
854 actionEditCut->setEnabled(false);
855 actionEditPaste->setEnabled(false);
856 actionEditDeleteAll->setEnabled(false);
857 actionFormatUseFixedFont->setEnabled(false);
860 void TextEditor::setState (EditorState s)
863 QPalette p=palette();
867 case emptyEditor: c=QColor (150,150,150); break;
868 case filledEditor: c=QColor (255,255,255); break;
869 case inactiveEditor: c=QColor (0,0,0);
871 p.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(9), c);
872 p.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(9), c);