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 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)
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()
503 emit (windowClosed() );
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);