1 #include "texteditor.h"
8 #include <qtextstream.h>
10 #include <QFontDialog>
11 #include <QMessageBox>
12 #include <QColorDialog>
16 #include <QCloseEvent>
25 extern int statusbarTime;
26 extern QSettings settings;
28 extern QAction *actionViewToggleNoteEditor;
30 extern QString iconPath;
35 ///////////////////////////////////////////////////////////////////////
36 ///////////////////////////////////////////////////////////////////////
39 TextEditor::TextEditor()
41 printer = new QPrinter( QPrinter::HighResolution );
42 printer->setPrinterName (settings.value("/mainwindow/printerName",printer->printerName()).toString());
44 e = new QTextEdit( this);
46 e->setTextFormat(Qt::RichText); // default
47 e->setTabStopWidth (20); // unit is pixel
48 e->setColor (Qt::black);
49 e->setAutoFillBackground (true);
50 connect (e, SIGNAL( textChanged() ), this, SLOT( editorChanged() ) );
51 setCentralWidget( e );
52 statusBar()->message( tr("Ready","Statusbar message"), statusbarTime);
53 setCaption(__VYM " - " +tr ("Note Editor"));
56 connect(e, SIGNAL(currentCharFormatChanged(const QTextCharFormat &)),
57 this, SLOT(formatChanged(const QTextCharFormat &)));
65 setupSettingsActions();
71 resize (settings.value ( "/noteeditor/geometry/size", QSize(450,600)).toSize());
72 move (settings.value ( "/noteeditor/geometry/pos", QPoint (250,50)).toPoint());
74 if (settings.value ( "/noteeditor/showWithMain",true).toBool())
75 setShowWithMain(true);
77 setShowWithMain(false);
79 varFont.fromString( settings.value
80 ("/noteeditor/fonts/varFont",
81 "Nimbus Sans l,14,-1,5,48,0,0,0,0,0").toString()
83 fixedFont.fromString (settings.value(
84 "/noteeditor/fonts/fixedFont",
85 "Courier,14,-1,5,48,0,0,0,1,0").toString()
87 QString s=settings.value ("/noteeditor/fonts/fonthintDefault","variable").toString();
90 actionSettingsFonthintDefault->setOn (true);
91 e->setCurrentFont (fixedFont);
94 actionSettingsFonthintDefault->setOn (false);
95 e->setCurrentFont (varFont);
99 // Restore position of toolbars
100 restoreState (settings.value("/noteeditor/state",0).toByteArray());
102 // Save settings in vymrc
103 settings.setValue("/mainwindow/printerName",printer->printerName());
107 TextEditor::~TextEditor()
109 if (printer) delete printer;
111 settings.setValue( "/noteeditor/geometry/size", size() );
112 settings.setValue( "/noteeditor/geometry/pos", pos() );
113 settings.setValue ("/noteeditor/state",saveState(0));
115 settings.setValue( "/noteeditor/showWithMain",showWithMain());
118 if (actionSettingsFonthintDefault->isOn() )
122 settings.setValue( "/noteeditor/fonts/fonthintDefault",s );
123 settings.setValue("/noteeditor/fonts/varFont", varFont.toString() );
124 settings.setValue("/noteeditor/fonts/fixedFont", fixedFont.toString() );
129 bool TextEditor::isEmpty()
131 if (e->toPlainText().length()>0)
137 void TextEditor::setShowWithMain(bool v)
142 bool TextEditor::showWithMain()
147 void TextEditor::setFontHint (const QString &fh)
150 actionFormatUseFixedFont->setOn (true);
152 actionFormatUseFixedFont->setOn (false);
156 QString TextEditor::getFontHint()
158 if (actionFormatUseFixedFont->isOn())
164 QString TextEditor::getFontHintDefault()
166 if (actionSettingsFonthintDefault->isOn())
172 void TextEditor::setFilename(const QString &fn)
174 if (state==filledEditor)
178 statusBar()->message( tr("No filename available for this note.","Statusbar message"), statusbarTime );
183 statusBar()->message( tr(QString( "Current filename is %1" ).arg( filename ),"Statusbar message"), statusbarTime );
187 QString TextEditor::getFilename()
192 void TextEditor::setFilenameHint(const QString &fnh)
197 QString TextEditor::getFilenameHint()
202 bool TextEditor::findText(const QString &t, const QTextDocument::FindFlags &flags)
204 if (e->find (t,flags))
210 void TextEditor::setupFileActions()
212 QToolBar *tb = addToolBar ( tr("Note Actions") );
213 QMenu *fileMenu = menuBar()->addMenu( tr( "&Note" ));
216 a = new QAction( QPixmap( iconPath+"fileopen.png"), tr( "&Import..." ),this);
217 a->setStatusTip (tr( "Import" ) );
218 a->setShortcut( Qt::CTRL + Qt::Key_O );
219 connect( a, SIGNAL( activated() ), this, SLOT( textLoad() ) );
221 fileMenu->addAction (a);
224 fileMenu->addSeparator();
225 a = new QAction( QPixmap(iconPath+"filesave.png" ), tr( "&Export..." ),this);
226 a->setStatusTip (tr( "Export Note (HTML)" ) );
227 a->setShortcut( Qt::CTRL + Qt::Key_S );
228 connect( a, SIGNAL( activated() ), this, SLOT( textSave() ) );
230 fileMenu->addAction (a);
233 a = new QAction( QPixmap(), tr( "Export &As... (HTML)" ), this);
234 a->setStatusTip (tr( "Export Note As (HTML) " ));
235 connect( a, SIGNAL( activated() ), this, SLOT( textSaveAs() ) );
236 fileMenu->addAction (a);
239 a = new QAction(QPixmap(), tr( "Export &As...(ASCII)" ), this);
240 a->setStatusTip ( tr( "Export Note As (ASCII) " ) );
241 a->setShortcut(Qt::ALT + Qt::Key_X );
242 connect( a, SIGNAL( activated() ), this, SLOT( textExportAsASCII() ) );
243 fileMenu->addAction (a);
246 fileMenu->addSeparator();
247 a = new QAction( QPixmap(iconPath+"fileprint.png" ), tr( "&Print..." ),this);
248 a->setStatusTip (tr( "Print Note" ) );
249 a->setShortcut( Qt::CTRL + Qt::Key_P );
250 connect( a, SIGNAL( activated() ), this, SLOT( textPrint() ) );
252 fileMenu->addAction (a);
256 void TextEditor::setupEditActions()
258 QToolBar *tb = addToolBar ( tr( "Edit Actions" ));
259 QMenu *editMenu = menuBar()->addMenu ( tr( "&Edit" ));
262 a = new QAction(QPixmap(iconPath+"undo.png"), tr( "&Undo" ), this );
263 a->setStatusTip ( tr( "Undo" ) );
264 a->setShortcut(Qt::CTRL + Qt::Key_Z );
265 connect( a, SIGNAL( activated() ), e, SLOT( undo() ) );
266 editMenu->addAction (a);
270 a = new QAction(QPixmap(iconPath+"redo.png" ), tr( "&Redo" ),this);
271 a->setStatusTip ( tr( "Redo" ) );
272 a->setShortcut( Qt::CTRL + Qt::Key_Y );
273 connect( a, SIGNAL( activated() ), e, SLOT( redo() ) );
274 editMenu->addAction (a);
278 editMenu->addSeparator();
279 a = new QAction(QPixmap(), tr( "Select and copy &all" ),this);
280 a->setStatusTip ( tr( "Select and copy all" ) );
281 a->setShortcut( Qt::CTRL + Qt::Key_A );
282 connect( a, SIGNAL( activated() ), this, SLOT( editCopyAll() ) );
283 editMenu->addAction (a);
285 editMenu->addSeparator();
286 a = new QAction(QPixmap(iconPath+"editcopy.png" ), tr( "&Copy" ),this);
287 a->setStatusTip ( tr( "Copy" ) );
288 a->setShortcut( Qt::CTRL + Qt::Key_C );
289 connect( a, SIGNAL( activated() ), e, SLOT( copy() ) );
290 editMenu->addAction (a);
294 a = new QAction(QPixmap(iconPath+"editcut.png" ), tr( "Cu&t" ),this);
295 a->setStatusTip ( tr( "Cut" ) );
296 a->setShortcut( Qt::CTRL + Qt::Key_X );
297 connect( a, SIGNAL( activated() ), e, SLOT( cut() ) );
298 editMenu->addAction (a);
302 a = new QAction(QPixmap(iconPath+"editpaste.png" ), tr( "&Paste" ),this);
303 a->setStatusTip ( tr( "Paste" ) );
304 a->setShortcut( Qt::CTRL + Qt::Key_V );
305 connect( a, SIGNAL( activated() ), e, SLOT( paste() ) );
306 editMenu->addAction (a);
310 a = new QAction( QPixmap( iconPath+"edittrash.png"), tr( "&Delete All" ), this);
311 a->setStatusTip (tr( "Delete all" ) );
312 connect( a, SIGNAL( activated() ), e, SLOT( clear() ) );
313 editMenu->addAction (a);
315 actionEditDeleteAll=a;
319 void TextEditor::setupFormatActions()
321 QToolBar *tb = addToolBar ( tr("Format Actions" ));
322 QMenu *formatMenu = menuBar()->addMenu ( tr( "F&ormat" ));
326 a = new QAction( QPixmap(iconPath+"formatfixedfont.png"), tr( "&Font hint" ), Qt::ALT + Qt::Key_I, this, "fontHint" );
327 a->setStatusTip (tr( "Toggle font hint for the whole text" ) );
328 a->setToggleAction (true);
329 a->setOn (settings.value("/noteeditor/fonts/useFixedByDefault",false).toBool() );
330 connect( a, SIGNAL( activated() ), this, SLOT( toggleFonthint() ) );
331 formatMenu->addAction (a);
333 actionFormatUseFixedFont=a;
335 comboFont = new QComboBox;
336 tb->addWidget (comboFont);
337 QFontDatabase fontDB;
338 comboFont->insertStringList( fontDB.families() );
339 connect( comboFont, SIGNAL( activated( const QString & ) ),
340 this, SLOT( textFamily( const QString & ) ) );
341 comboFont->addItem( QApplication::font().family() );
342 comboSize = new QComboBox;
343 tb->addWidget (comboSize);
344 QList<int> sizes=fontDB.standardSizes();
345 QList<int>::iterator i = sizes.begin();
346 while (i != sizes.end())
348 ++i; // increment i before using it
349 comboSize->insertItem ( QString::number(*i));
351 connect( comboSize, SIGNAL( activated( const QString & ) ),
352 this, SLOT( textSize( const QString & ) ) );
353 comboSize->addItem ( QString::number( QApplication::font().pointSize() ) );
355 formatMenu->addSeparator();
357 QPixmap pix( 16, 16 );
358 pix.fill( e->color());
359 a = new QAction( pix, tr( "&Color..." ), this);
360 formatMenu->addAction (a);
362 connect( a, SIGNAL( activated() ), this, SLOT( textColor() ) );
365 a = new QAction( QPixmap (iconPath+"text_bold.png"), tr( "&Bold" ), this);
366 a->setShortcut(Qt::CTRL + Qt::Key_B );
367 connect( a, SIGNAL( activated() ), this, SLOT( textBold() ) );
369 formatMenu->addAction (a);
370 a->setToggleAction( true );
373 a = new QAction( QPixmap(iconPath+"text_italic.png"), tr( "&Italic" ), this);
374 a->setShortcut(Qt::CTRL + Qt::Key_I);
375 connect( a, SIGNAL( activated() ), this, SLOT( textItalic() ) );
377 formatMenu->addAction (a);
378 a->setToggleAction( true );
381 a = new QAction( QPixmap (iconPath+"text_under.png"), tr( "&Underline" ), this);
382 a->setShortcut(Qt::CTRL + Qt::Key_U );
383 connect( a, SIGNAL( activated() ), this, SLOT( textUnderline() ) );
385 formatMenu->addAction (a);
386 a->setToggleAction( true );
387 actionTextUnderline=a;
388 formatMenu->addSeparator();
390 QActionGroup *grp2 = new QActionGroup( this );
391 grp2->setExclusive(true);
392 a = new QAction( QPixmap (iconPath+"text_sub.png"), tr( "Subs&cript" ),grp2 );
393 a->setShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_B );
394 a->setToggleAction( true );
396 formatMenu->addAction (a);
397 connect(a, SIGNAL(activated()), this, SLOT(textVAlign()));
398 actionAlignSubScript=a;
400 a = new QAction( QPixmap (iconPath+"text_super.png"), tr( "Su&perscript" ),grp2 );
401 a->setShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_P );
402 a->setToggleAction( true );
404 formatMenu->addAction (a);
405 connect(a, SIGNAL(activated()), this, SLOT(textVAlign()));
406 actionAlignSuperScript=a;
407 QActionGroup *grp = new QActionGroup( this );
408 connect( grp, SIGNAL( selected( QAction* ) ), this, SLOT( textAlign( QAction* ) ) );
410 formatMenu->addSeparator();
412 a = new QAction( QPixmap (iconPath+"text_left.png"), tr( "&Left" ),grp );
413 a->setShortcut( Qt::CTRL+Qt::Key_L );
414 a->setToggleAction( true );
416 formatMenu->addAction (a);
418 a = new QAction( QPixmap (iconPath+"text_center.png"), tr( "C&enter" ),grp);
419 a->setShortcut( Qt::CTRL + Qt::Key_E);
420 a->setToggleAction( true );
422 formatMenu->addAction (a);
424 a = new QAction( QPixmap (iconPath+"text_right.png" ), tr( "&Right" ), grp);
425 a->setShortcut(Qt::CTRL + Qt::Key_R );
426 a->setToggleAction( true );
428 formatMenu->addAction (a);
430 a = new QAction( QPixmap ( iconPath+"text_block.png"), tr( "&Justify" ), grp );
431 a->setShortcut(Qt::CTRL + Qt::Key_J );
432 a->setToggleAction( true );
434 formatMenu->addAction (a);
435 actionAlignJustify=a;
440 connect( e, SIGNAL( currentFontChanged( const QFont & ) ),
441 this, SLOT( fontChanged( const QFont & ) ) );
442 connect( e, SIGNAL( currentColorChanged( const QColor & ) ),
443 this, SLOT( colorChanged( const QColor & ) ) );
444 connect( e, SIGNAL( currentAlignmentChanged( int ) ),
445 this, SLOT( alignmentChanged( int ) ) );
446 connect( e, SIGNAL( currentVerticalAlignmentChanged(int)),
447 this, SLOT( verticalAlignmentChanged(int)));
452 void TextEditor::setupSettingsActions()
454 QMenu *settingsMenu = menuBar()->addMenu ( tr( "&Settings" ));
457 a = new QAction(tr( "Set &fixed font" ), this);
458 a->setStatusTip ( tr( "Set fixed font" ));
459 connect( a, SIGNAL( activated() ), this, SLOT( setFixedFont() ) );
460 settingsMenu->addAction (a);
461 actionSettingsFixedFont=a;
463 a = new QAction(tr( "Set &variable font" ), this);
464 a->setStatusTip ( tr( "Set variable font" ) );
465 connect( a, SIGNAL( activated() ), this, SLOT( setVarFont() ) );
466 settingsMenu->addAction (a);
467 actionSettingsVarFont=a;
469 a = new QAction(tr( "&fixed font is default" ), this);
470 a->setStatusTip (tr( "Used fixed font by default" ) );
471 a->setToggleAction (true);
472 // set state later in constructor...
473 settingsMenu->addAction (a);
474 actionSettingsFonthintDefault=a;
477 void TextEditor::textLoad()
479 if (state!=inactiveEditor)
481 if (e->text().length())
483 QMessageBox mb( __VYM " - " +tr("Note Editor"),
484 "Loading will overwrite the existing note",
485 QMessageBox::Warning,
486 QMessageBox::Yes | QMessageBox::Default,
489 mb.setButtonText( QMessageBox::Yes, "Load note" );
490 switch( mb.exec() ) {
491 case QMessageBox::Cancel:
497 QFileDialog *fd=new QFileDialog( this);
499 types<< "VYM notes (*.html)" <<
500 "ASCII texts (*.txt)" <<
502 fd->setFilters (types);
503 fd->setDirectory (QDir().current());
506 if ( fd->exec() == QDialog::Accepted )
507 fn = fd->selectedFile();
512 if ( !f.open( QIODevice::ReadOnly ) )
515 QTextStream ts( &f );
516 setText( ts.read() );
522 void TextEditor::closeEvent( QCloseEvent* ce )
524 ce->accept(); // TextEditor can be reopened with show()
525 actionViewToggleNoteEditor->setOn (false);
530 QString TextEditor::getText()
532 if (e->toPlainText().isEmpty())
538 void TextEditor::editorChanged()
545 if (state==emptyEditor)
546 setState (emptyEditor);
548 setState (filledEditor);
549 // SLOT is LinkableMapObj, which will update systemFlag
550 emit (textHasChanged() );
554 void TextEditor::setText(QString t)
556 e->setReadOnly(false);
561 void TextEditor::setInactive()
563 state=inactiveEditor;
565 setState (inactiveEditor);
566 e->setReadOnly (true);
571 void TextEditor::editCopyAll()
577 void TextEditor::textSaveAs()
579 QString fn = QFileDialog::getSaveFileName( QString::null, "VYM Note (HTML) (*.html);;All files (*)",
580 this,"export note dialog",tr("Export Note to single file") );
587 QMessageBox mb( __VYM,
588 tr("The file ") + fn +
589 tr(" exists already. "
590 "Do you want to overwrite it?"),
591 QMessageBox::Warning,
592 QMessageBox::Yes | QMessageBox::Default,
593 QMessageBox::Cancel | QMessageBox::Escape,
595 mb.setButtonText( QMessageBox::Yes, tr("Overwrite") );
596 mb.setButtonText( QMessageBox::No, tr("Cancel"));
597 switch( mb.exec() ) {
598 case QMessageBox::Yes:
603 case QMessageBox::Cancel:
614 statusBar()->message(tr( "Couldn't export note ") + fn, statusbarTime );
618 void TextEditor::textSave()
620 if ( filename.isEmpty() )
626 QString text = e->text();
628 if ( !f.open( QIODevice::WriteOnly ) )
630 statusBar()->message( QString("Could not write to %1").arg(filename),
639 e->setModified( FALSE );
641 statusBar()->message( QString( "Note exported as %1" ).arg( filename ), statusbarTime );
644 void TextEditor::textExportAsASCII()
646 QString text = NoteObj (e->text()).getNoteASCII();
648 if (!filenameHint.isEmpty())
650 if (!filenameHint.contains (".txt"))
651 s=filenameHint+".txt";
656 fn = QFileDialog::getSaveFileName( s, "VYM Note (ASCII) (*.txt);;All files (*)", this,"export note dialog",tr("Export Note to single file (ASCII)") );
664 QMessageBox mb( "VYM",
665 tr("The file ") + fn +
666 tr(" exists already. "
667 "Do you want to overwrite it?"),
668 QMessageBox::Warning,
669 QMessageBox::Yes | QMessageBox::Default,
670 QMessageBox::Cancel | QMessageBox::Escape,
672 mb.setButtonText( QMessageBox::Yes, tr("Overwrite") );
673 mb.setButtonText( QMessageBox::No, tr("Cancel"));
676 if (ret==QMessageBox::Cancel)
680 if ( !file.open( QIODevice::WriteOnly ) )
681 statusBar()->message( QString("Could not write to %1").arg(filename),
685 QTextStream t( &file );
689 statusBar()->message( QString( "Note exported as %1" ).arg( fn ), statusbarTime );
695 void TextEditor::textPrint()
698 QTextDocument *document = e->document();
701 QPrintDialog *dialog = new QPrintDialog(&printer, this);
702 dialog->setWindowTitle(tr("Print Document"));
703 if (dialog->exec() != QDialog::Accepted)
706 document->print(&printer);
709 void TextEditor::textEditUndo()
713 void TextEditor::toggleFonthint()
715 setUpdatesEnabled (false);
717 if (!actionFormatUseFixedFont->isOn() )
718 e->setCurrentFont (varFont);
720 e->setCurrentFont (fixedFont);
722 setUpdatesEnabled (true);
726 void TextEditor::setFixedFont()
729 QFont font =QFontDialog::getFont(
730 &ok, fixedFont, this );
732 // font is set to the font the user selected
736 void TextEditor::setVarFont()
739 QFont font =QFontDialog::getFont(
740 &ok, varFont, this );
742 // font is set to the font the user selected
746 void TextEditor::textBold()
748 e->setBold( actionTextBold->isOn() );
751 void TextEditor::textUnderline()
753 e->setUnderline( actionTextUnderline->isOn() );
756 void TextEditor::textItalic()
758 e->setItalic( actionTextItalic->isOn() );
761 void TextEditor::textFamily( const QString &f )
766 void TextEditor::textSize( const QString &p )
768 e->setPointSize( p.toInt() );
772 void TextEditor::textColor()
774 QColor col = QColorDialog::getColor( e->color(), this );
775 if ( !col.isValid() ) return;
777 QPixmap pix( 16, 16 );
778 pix.fill( Qt::black );
779 actionTextColor->setIconSet( pix );
782 void TextEditor::textAlign( QAction *a )
784 if ( a == actionAlignLeft )
785 e->setAlignment( Qt::AlignLeft );
786 else if ( a == actionAlignCenter )
787 e->setAlignment( Qt::AlignHCenter );
788 else if ( a == actionAlignRight )
789 e->setAlignment( Qt::AlignRight );
790 else if ( a == actionAlignJustify )
791 e->setAlignment( Qt::AlignJustify );
794 void TextEditor::textVAlign()
796 QTextCharFormat format;
798 if ( sender() == actionAlignSuperScript && actionAlignSuperScript->isOn()) {
799 format.setVerticalAlignment(QTextCharFormat::AlignSuperScript);
800 } else if (sender() == actionAlignSubScript && actionAlignSubScript->isOn()) {
801 format.setVerticalAlignment(QTextCharFormat::AlignSubScript);
803 format.setVerticalAlignment(QTextCharFormat::AlignNormal);
805 e->mergeCurrentCharFormat(format);
809 void TextEditor::fontChanged( const QFont &f )
811 int i=comboFont->findText(f.family());
812 if (i>=0) comboFont->setCurrentIndex (i);
813 i=comboSize->findText(QString::number(f.pointSize()));
814 if (i>=0) comboSize->setCurrentIndex(i);
815 actionTextBold->setOn( f.bold() );
816 actionTextItalic->setOn( f.italic() );
817 actionTextUnderline->setOn( f.underline() );
820 void TextEditor::colorChanged( const QColor &c )
822 QPixmap pix( 16, 16 );
824 actionTextColor->setIconSet( pix );
827 void TextEditor::formatChanged( const QTextCharFormat &f )
829 fontChanged(f.font());
830 colorChanged(f.foreground().color());
831 alignmentChanged(e->alignment());
832 verticalAlignmentChanged (f.verticalAlignment());
835 void TextEditor::alignmentChanged( int a )
837 if ( ( a == Qt::AlignLeft ) || ( a & Qt::AlignLeft ))
838 actionAlignLeft->setOn( true );
839 else if ( ( a & Qt::AlignHCenter ) )
840 actionAlignCenter->setOn( true );
841 else if ( ( a & Qt::AlignRight ) )
842 actionAlignRight->setOn( true );
843 else if ( ( a & Qt::AlignJustify ) )
844 actionAlignJustify->setOn( true );
847 void TextEditor::verticalAlignmentChanged(QTextCharFormat::VerticalAlignment a)
849 actionAlignSubScript->setOn (false);
850 actionAlignSuperScript->setOn (false);
853 case QTextCharFormat::AlignSuperScript:
854 actionAlignSuperScript->setOn (true);
856 case QTextCharFormat::AlignSubScript:
857 actionAlignSubScript->setOn (true);
865 void TextEditor::enableActions()
867 actionFileLoad->setEnabled(true);
868 actionFileSave->setEnabled(true);
869 actionFileSaveAs->setEnabled(true);
870 actionFilePrint->setEnabled(true);
871 actionEditUndo->setEnabled(true);
872 actionEditRedo->setEnabled(true);
873 actionEditCopy->setEnabled(true);
874 actionEditCut->setEnabled(true);
875 actionEditPaste->setEnabled(true);
876 actionEditDeleteAll->setEnabled(true);
877 actionFormatUseFixedFont->setEnabled(true);
880 void TextEditor::disableActions()
882 actionFileLoad->setEnabled(false);
883 actionFileSave->setEnabled(false);
884 actionFileSaveAs->setEnabled(false);
885 actionFilePrint->setEnabled(false);
886 actionEditUndo->setEnabled(false);
887 actionEditRedo->setEnabled(false);
888 actionEditCopy->setEnabled(false);
889 actionEditCut->setEnabled(false);
890 actionEditPaste->setEnabled(false);
891 actionEditDeleteAll->setEnabled(false);
892 actionFormatUseFixedFont->setEnabled(false);
895 void TextEditor::setState (EditorState s)
898 QPalette p=palette();
902 case emptyEditor: c=QColor (150,150,150); break;
903 case filledEditor: c=QColor (255,255,255); break;
904 case inactiveEditor: c=QColor (0,0,0);
906 p.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(9), c);
907 p.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(9), c);