1.11.2 split up of xml helper functions. started to work on attributes
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 setShowWithMain (settings.value ( "/satellite/noteeditor/showWithMain",true).toBool());
64 varFont.fromString( settings.value
65 ("/satellite/noteeditor/fonts/varFont",
66 "Nimbus Sans l,14,-1,5,48,0,0,0,0,0").toString()
68 fixedFont.fromString (settings.value(
69 "/satellite/noteeditor/fonts/fixedFont",
70 "Courier,14,-1,5,48,0,0,0,1,0").toString()
72 QString s=settings.value ("/satellite/noteeditor/fonts/fonthintDefault","variable").toString();
75 actionSettingsFonthintDefault->setOn (true);
76 e->setCurrentFont (fixedFont);
79 actionSettingsFonthintDefault->setOn (false);
80 e->setCurrentFont (varFont);
84 // Restore position of toolbars
85 restoreState (settings.value("/satellite/noteeditor/state",0).toByteArray());
87 // Save settings in vymrc
88 settings.setValue("/mainwindow/printerName",printer->printerName());
92 TextEditor::~TextEditor()
94 if (printer) delete printer;
96 settings.setValue( "/satellite/noteeditor/geometry/size", size() );
97 settings.setValue( "/satellite/noteeditor/geometry/pos", pos() );
98 settings.setValue ("/satellite/noteeditor/state",saveState(0));
100 settings.setValue( "/satellite/noteeditor/showWithMain",showwithmain);
103 if (actionSettingsFonthintDefault->isOn() )
107 settings.setValue( "/satellite/noteeditor/fonts/fonthintDefault",s );
108 settings.setValue("/satellite/noteeditor/fonts/varFont", varFont.toString() );
109 settings.setValue("/satellite/noteeditor/fonts/fixedFont", fixedFont.toString() );
114 bool TextEditor::isEmpty()
116 if (e->toPlainText().length()>0)
122 void TextEditor::setShowWithMain(bool v)
127 bool TextEditor::showWithMain()
133 void TextEditor::setFontHint (const QString &fh)
136 actionFormatUseFixedFont->setOn (true);
138 actionFormatUseFixedFont->setOn (false);
142 QString TextEditor::getFontHint()
144 if (actionFormatUseFixedFont->isOn())
150 QString TextEditor::getFontHintDefault()
152 if (actionSettingsFonthintDefault->isOn())
158 void TextEditor::setFilename(const QString &fn)
160 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 );
173 QString TextEditor::getFilename()
178 void TextEditor::setFilenameHint(const QString &fnh)
183 QString TextEditor::getFilenameHint()
188 bool TextEditor::findText(const QString &t, const QTextDocument::FindFlags &flags)
190 if (e->find (t,flags))
196 void TextEditor::setupFileActions()
198 QToolBar *tb = addToolBar ( tr("Note Actions") );
199 tb->setObjectName ("noteEditorFileActions");
200 QMenu *fileMenu = menuBar()->addMenu( tr( "&Note","Menubar" ));
203 a = new QAction( QPixmap( iconPath+"fileopen.png"), tr( "&Import..." ),this);
204 a->setStatusTip (tr( "Import","Status tip for Note menu" ) );
205 a->setShortcut( Qt::CTRL + Qt::Key_O );
206 connect( a, SIGNAL( activated() ), this, SLOT( textLoad() ) );
208 fileMenu->addAction (a);
211 fileMenu->addSeparator();
212 a = new QAction( QPixmap(iconPath+"filesave.png" ), tr( "&Export..." ),this);
213 a->setStatusTip (tr( "Export Note (HTML)","Status tip for Note menu" ) );
214 a->setShortcut( Qt::CTRL + Qt::Key_S );
215 connect( a, SIGNAL( activated() ), this, SLOT( textSave() ) );
217 fileMenu->addAction (a);
220 a = new QAction( QPixmap(), tr( "Export &As... (HTML)" ), this);
221 a->setStatusTip (tr( "Export Note As (HTML) ","Status tip for Note Menu" ));
222 connect( a, SIGNAL( activated() ), this, SLOT( textSaveAs() ) );
223 fileMenu->addAction (a);
226 a = new QAction(QPixmap(), tr( "Export &As...(ASCII)" ), this);
227 a->setStatusTip ( tr( "Export Note As (ASCII) ","Status tip for note menu" ) );
228 a->setShortcut(Qt::ALT + Qt::Key_X );
229 connect( a, SIGNAL( activated() ), this, SLOT( textExportAsASCII() ) );
230 fileMenu->addAction (a);
233 fileMenu->addSeparator();
234 a = new QAction( QPixmap(iconPath+"fileprint.png" ), tr( "&Print..." ),this);
235 a->setStatusTip (tr( "Print Note","Status tip for note menu" ) );
236 a->setShortcut( Qt::CTRL + Qt::Key_P );
237 connect( a, SIGNAL( activated() ), this, SLOT( textPrint() ) );
239 fileMenu->addAction (a);
243 void TextEditor::setupEditActions()
245 QToolBar *tb = addToolBar ( tr( "Edit Actions" ));
246 tb->setObjectName ("noteEditorEditActions");
247 QMenu *editMenu = menuBar()->addMenu ( tr( "&Edit" ));
250 a = new QAction(QPixmap(iconPath+"undo.png"), tr( "&Undo" ), this );
251 a->setStatusTip ( tr( "Undo","Status tip for note menu" ) );
252 a->setShortcut(Qt::CTRL + Qt::Key_Z );
253 connect( a, SIGNAL( activated() ), e, SLOT( undo() ) );
254 editMenu->addAction (a);
258 a = new QAction(QPixmap(iconPath+"redo.png" ), tr( "&Redo" ),this);
259 a->setStatusTip ( tr( "Redo","Status tip for note menu" ) );
260 a->setShortcut( Qt::CTRL + Qt::Key_Y );
261 connect( a, SIGNAL( activated() ), e, SLOT( redo() ) );
262 editMenu->addAction (a);
266 editMenu->addSeparator();
267 a = new QAction(QPixmap(), tr( "Select and copy &all" ),this);
268 a->setStatusTip ( tr( "Select and copy all","Status tip for note menu" ) );
269 a->setShortcut( Qt::CTRL + Qt::Key_A );
270 connect( a, SIGNAL( activated() ), this, SLOT( editCopyAll() ) );
271 editMenu->addAction (a);
273 editMenu->addSeparator();
274 a = new QAction(QPixmap(iconPath+"editcopy.png" ), tr( "&Copy" ),this);
275 a->setStatusTip ( tr( "Copy","Status tip for note menu" ) );
276 a->setShortcut( Qt::CTRL + Qt::Key_C );
277 connect( a, SIGNAL( activated() ), e, SLOT( copy() ) );
278 editMenu->addAction (a);
282 a = new QAction(QPixmap(iconPath+"editcut.png" ), tr( "Cu&t" ),this);
283 a->setStatusTip ( tr( "Cut","Status tip for note menu" ) );
284 a->setShortcut( Qt::CTRL + Qt::Key_X );
285 connect( a, SIGNAL( activated() ), e, SLOT( cut() ) );
286 editMenu->addAction (a);
290 a = new QAction(QPixmap(iconPath+"editpaste.png" ), tr( "&Paste" ),this);
291 a->setStatusTip ( tr( "Paste","Status tip for note menu" ) );
292 a->setShortcut( Qt::CTRL + Qt::Key_V );
293 connect( a, SIGNAL( activated() ), e, SLOT( paste() ) );
294 editMenu->addAction (a);
298 a = new QAction( QPixmap( iconPath+"edittrash.png"), tr( "&Delete All" ), this);
299 a->setStatusTip (tr( "Delete all","Status tip for note menu" ) );
300 connect( a, SIGNAL( activated() ), e, SLOT( clear() ) );
301 editMenu->addAction (a);
303 actionEditDeleteAll=a;
307 void TextEditor::setupFormatActions()
309 QToolBar *tb = addToolBar ( tr("Format Actions" ));
310 tb->setObjectName ("noteEditorFormatActions");
311 QMenu *formatMenu = menuBar()->addMenu ( tr( "F&ormat" ));
315 a = new QAction( QPixmap(iconPath+"formatfixedfont.png"), tr( "&Font hint" ), Qt::ALT + Qt::Key_I, this, "fontHint" );
316 a->setStatusTip (tr( "Toggle font hint for the whole text","Status tip for note menu" ) );
317 a->setToggleAction (true);
318 a->setOn (settings.value("/noteeditor/fonts/useFixedByDefault",false).toBool() );
319 connect( a, SIGNAL( activated() ), this, SLOT( toggleFonthint() ) );
320 formatMenu->addAction (a);
322 actionFormatUseFixedFont=a;
324 comboFont = new QComboBox;
325 tb->addWidget (comboFont);
326 QFontDatabase fontDB;
327 comboFont->insertStringList( fontDB.families() );
328 connect( comboFont, SIGNAL( activated( const QString & ) ),
329 this, SLOT( textFamily( const QString & ) ) );
330 comboFont->addItem( QApplication::font().family() );
331 comboSize = new QComboBox;
332 tb->addWidget (comboSize);
333 QList<int> sizes=fontDB.standardSizes();
334 QList<int>::iterator i = sizes.begin();
335 while (i != sizes.end())
337 ++i; // increment i before using it
338 comboSize->insertItem ( QString::number(*i));
340 connect( comboSize, SIGNAL( activated( const QString & ) ),
341 this, SLOT( textSize( const QString & ) ) );
342 comboSize->addItem ( QString::number( QApplication::font().pointSize() ) );
344 formatMenu->addSeparator();
346 QPixmap pix( 16, 16 );
347 pix.fill( e->color());
348 a = new QAction( pix, tr( "&Color..." ), this);
349 formatMenu->addAction (a);
351 connect( a, SIGNAL( activated() ), this, SLOT( textColor() ) );
354 a = new QAction( QPixmap (iconPath+"text_bold.png"), tr( "&Bold" ), this);
355 a->setShortcut(Qt::CTRL + Qt::Key_B );
356 connect( a, SIGNAL( activated() ), this, SLOT( textBold() ) );
358 formatMenu->addAction (a);
359 a->setToggleAction( true );
362 a = new QAction( QPixmap(iconPath+"text_italic.png"), tr( "&Italic" ), this);
363 a->setShortcut(Qt::CTRL + Qt::Key_I);
364 connect( a, SIGNAL( activated() ), this, SLOT( textItalic() ) );
366 formatMenu->addAction (a);
367 a->setToggleAction( true );
370 a = new QAction( QPixmap (iconPath+"text_under.png"), tr( "&Underline" ), this);
371 a->setShortcut(Qt::CTRL + Qt::Key_U );
372 connect( a, SIGNAL( activated() ), this, SLOT( textUnderline() ) );
374 formatMenu->addAction (a);
375 a->setToggleAction( true );
376 actionTextUnderline=a;
377 formatMenu->addSeparator();
379 QActionGroup *grp2 = new QActionGroup( this );
380 grp2->setExclusive(true);
381 a = new QAction( QPixmap (iconPath+"text_sub.png"), tr( "Subs&cript" ),grp2 );
382 a->setShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_B );
383 a->setToggleAction( true );
385 formatMenu->addAction (a);
386 connect(a, SIGNAL(activated()), this, SLOT(textVAlign()));
387 actionAlignSubScript=a;
389 a = new QAction( QPixmap (iconPath+"text_super.png"), tr( "Su&perscript" ),grp2 );
390 a->setShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_P );
391 a->setToggleAction( true );
393 formatMenu->addAction (a);
394 connect(a, SIGNAL(activated()), this, SLOT(textVAlign()));
395 actionAlignSuperScript=a;
396 QActionGroup *grp = new QActionGroup( this );
397 connect( grp, SIGNAL( selected( QAction* ) ), this, SLOT( textAlign( QAction* ) ) );
399 formatMenu->addSeparator();
401 a = new QAction( QPixmap (iconPath+"text_left.png"), tr( "&Left" ),grp );
402 a->setShortcut( Qt::CTRL+Qt::Key_L );
403 a->setToggleAction( true );
405 formatMenu->addAction (a);
407 a = new QAction( QPixmap (iconPath+"text_center.png"), tr( "C&enter" ),grp);
408 a->setShortcut( Qt::CTRL + Qt::Key_E);
409 a->setToggleAction( true );
411 formatMenu->addAction (a);
413 a = new QAction( QPixmap (iconPath+"text_right.png" ), tr( "&Right" ), grp);
414 a->setShortcut(Qt::CTRL + Qt::Key_R );
415 a->setToggleAction( true );
417 formatMenu->addAction (a);
419 a = new QAction( QPixmap ( iconPath+"text_block.png"), tr( "&Justify" ), grp );
420 a->setShortcut(Qt::CTRL + Qt::Key_J );
421 a->setToggleAction( true );
423 formatMenu->addAction (a);
424 actionAlignJustify=a;
427 void TextEditor::setupSettingsActions()
429 QMenu *settingsMenu = menuBar()->addMenu ( tr( "&Settings" ));
432 a = new QAction(tr( "Set &fixed font" ), this);
433 a->setStatusTip ( tr( "Set fixed font","Status tip for note menu" ));
434 connect( a, SIGNAL( activated() ), this, SLOT( setFixedFont() ) );
435 settingsMenu->addAction (a);
436 actionSettingsFixedFont=a;
438 a = new QAction(tr( "Set &variable font" ), this);
439 a->setStatusTip ( tr( "Set variable font","Status tip for note menu" ) );
440 connect( a, SIGNAL( activated() ), this, SLOT( setVarFont() ) );
441 settingsMenu->addAction (a);
442 actionSettingsVarFont=a;
444 a = new QAction(tr( "&fixed font is default" ), this);
445 a->setStatusTip (tr( "Used fixed font by default","Status tip for note menu" ) );
446 a->setToggleAction (true);
447 // set state later in constructor...
448 settingsMenu->addAction (a);
449 actionSettingsFonthintDefault=a;
452 void TextEditor::textLoad()
454 if (state!=inactiveEditor)
456 if (e->text().length())
458 QMessageBox mb( vymName + " - " +tr("Note Editor"),
459 "Loading will overwrite the existing note",
460 QMessageBox::Warning,
461 QMessageBox::Yes | QMessageBox::Default,
464 mb.setButtonText( QMessageBox::Yes, "Load note" );
465 switch( mb.exec() ) {
466 case QMessageBox::Cancel:
472 QFileDialog *fd=new QFileDialog( this);
474 types<< "VYM notes (*.html)" <<
475 "ASCII texts (*.txt)" <<
477 fd->setFilters (types);
478 fd->setDirectory (QDir().current());
481 if ( fd->exec() == QDialog::Accepted )
482 fn = fd->selectedFile();
487 if ( !f.open( QIODevice::ReadOnly ) )
490 QTextStream ts( &f );
491 setText( ts.read() );
497 void TextEditor::closeEvent( QCloseEvent* ce )
499 ce->accept(); // TextEditor can be reopened with show()
502 emit (windowClosed() );
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 if (!blockChangedSignal) emit (textHasChanged() );
530 void TextEditor::setText(QString t)
532 blockChangedSignal=true;
533 e->setReadOnly(false);
536 blockChangedSignal=false;
539 void TextEditor::setInactive()
541 state=inactiveEditor;
543 setState (inactiveEditor);
544 e->setReadOnly (true);
549 void TextEditor::editCopyAll()
555 void TextEditor::textSaveAs()
557 QString fn = QFileDialog::getSaveFileName( QString::null, "VYM Note (HTML) (*.html);;All files (*)",
558 this,"export note dialog",tr("Export Note to single file") );
565 QMessageBox mb( vymName,
566 tr("The file %1\nexists already.\nDo you want to overwrite it?","dialog 'save note as'").arg(fn),
567 QMessageBox::Warning,
568 QMessageBox::Yes | QMessageBox::Default,
569 QMessageBox::Cancel | QMessageBox::Escape,
571 mb.setButtonText( QMessageBox::Yes, tr("Overwrite") );
572 mb.setButtonText( QMessageBox::No, tr("Cancel"));
573 switch( mb.exec() ) {
574 case QMessageBox::Yes:
579 case QMessageBox::Cancel:
590 statusBar()->message(tr( "Couldn't export note ","dialog 'save note as'") + fn, statusbarTime );
594 void TextEditor::textSave()
596 if ( filename.isEmpty() )
602 QString text = e->text();
604 if ( !f.open( QIODevice::WriteOnly ) )
606 statusBar()->message( QString("Could not write to %1").arg(filename),
615 e->setModified( FALSE );
617 statusBar()->message( QString( "Note exported as %1" ).arg( filename ), statusbarTime );
620 void TextEditor::textExportAsASCII()
622 QString text = NoteObj (e->text()).getNoteASCII();
624 if (!filenameHint.isEmpty())
626 if (!filenameHint.contains (".txt"))
627 s=filenameHint+".txt";
632 fn = QFileDialog::getSaveFileName( s, "VYM Note (ASCII) (*.txt);;All files (*)", this,"export note dialog",tr("Export Note to single file (ASCII)") );
640 QMessageBox mb( vymName,
641 tr("The file %1\nexists already.\nDo you want to overwrite it?","dialog 'save note as'").arg(fn),
642 QMessageBox::Warning,
643 QMessageBox::Yes | QMessageBox::Default,
644 QMessageBox::Cancel | QMessageBox::Escape,
646 mb.setButtonText( QMessageBox::Yes, tr("Overwrite") );
647 mb.setButtonText( QMessageBox::No, tr("Cancel"));
650 if (ret==QMessageBox::Cancel)
654 if ( !file.open( QIODevice::WriteOnly ) )
655 statusBar()->message( QString("Could not write to %1").arg(filename),
659 QTextStream t( &file );
663 statusBar()->message( QString( "Note exported as %1" ).arg( fn ), statusbarTime );
669 void TextEditor::textPrint()
672 QTextDocument *document = e->document();
675 QPrintDialog *dialog = new QPrintDialog(&printer, this);
676 dialog->setWindowTitle(tr("Print Note"));
677 if (dialog->exec() != QDialog::Accepted)
680 document->print(&printer);
683 void TextEditor::textEditUndo()
687 void TextEditor::toggleFonthint()
689 setUpdatesEnabled (false);
691 if (!actionFormatUseFixedFont->isOn() )
692 e->setCurrentFont (varFont);
694 e->setCurrentFont (fixedFont);
696 setUpdatesEnabled (true);
700 void TextEditor::setFixedFont()
703 QFont font =QFontDialog::getFont(
704 &ok, fixedFont, this );
706 // font is set to the font the user selected
710 void TextEditor::setVarFont()
713 QFont font =QFontDialog::getFont(
714 &ok, varFont, this );
716 // font is set to the font the user selected
720 void TextEditor::textBold()
722 e->setBold( actionTextBold->isOn() );
725 void TextEditor::textUnderline()
727 e->setUnderline( actionTextUnderline->isOn() );
730 void TextEditor::textItalic()
732 e->setItalic( actionTextItalic->isOn() );
735 void TextEditor::textFamily( const QString &f )
740 void TextEditor::textSize( const QString &p )
742 e->setPointSize( p.toInt() );
746 void TextEditor::textColor()
748 QColor col = QColorDialog::getColor( e->color(), this );
749 if ( !col.isValid() ) return;
751 QPixmap pix( 16, 16 );
752 pix.fill( Qt::black );
753 actionTextColor->setIconSet( pix );
756 void TextEditor::textAlign( QAction *a )
758 if ( a == actionAlignLeft )
759 e->setAlignment( Qt::AlignLeft );
760 else if ( a == actionAlignCenter )
761 e->setAlignment( Qt::AlignHCenter );
762 else if ( a == actionAlignRight )
763 e->setAlignment( Qt::AlignRight );
764 else if ( a == actionAlignJustify )
765 e->setAlignment( Qt::AlignJustify );
768 void TextEditor::textVAlign()
770 QTextCharFormat format;
772 if ( sender() == actionAlignSuperScript && actionAlignSuperScript->isOn()) {
773 format.setVerticalAlignment(QTextCharFormat::AlignSuperScript);
774 } else if (sender() == actionAlignSubScript && actionAlignSubScript->isOn()) {
775 format.setVerticalAlignment(QTextCharFormat::AlignSubScript);
777 format.setVerticalAlignment(QTextCharFormat::AlignNormal);
779 e->mergeCurrentCharFormat(format);
783 void TextEditor::fontChanged( const QFont &f )
785 int i=comboFont->findText(f.family());
786 if (i>=0) comboFont->setCurrentIndex (i);
787 i=comboSize->findText(QString::number(f.pointSize()));
788 if (i>=0) comboSize->setCurrentIndex(i);
789 actionTextBold->setOn( f.bold() );
790 actionTextItalic->setOn( f.italic() );
791 actionTextUnderline->setOn( f.underline() );
794 void TextEditor::colorChanged( const QColor &c )
796 QPixmap pix( 16, 16 );
798 actionTextColor->setIconSet( pix );
801 void TextEditor::formatChanged( const QTextCharFormat &f )
803 fontChanged(f.font());
804 colorChanged(f.foreground().color());
805 alignmentChanged(e->alignment());
806 verticalAlignmentChanged (f.verticalAlignment());
809 void TextEditor::alignmentChanged( int a )
811 if ( ( a == Qt::AlignLeft ) || ( a & Qt::AlignLeft ))
812 actionAlignLeft->setOn( true );
813 else if ( ( a & Qt::AlignHCenter ) )
814 actionAlignCenter->setOn( true );
815 else if ( ( a & Qt::AlignRight ) )
816 actionAlignRight->setOn( true );
817 else if ( ( a & Qt::AlignJustify ) )
818 actionAlignJustify->setOn( true );
821 void TextEditor::verticalAlignmentChanged(QTextCharFormat::VerticalAlignment a)
823 actionAlignSubScript->setOn (false);
824 actionAlignSuperScript->setOn (false);
827 case QTextCharFormat::AlignSuperScript:
828 actionAlignSuperScript->setOn (true);
830 case QTextCharFormat::AlignSubScript:
831 actionAlignSubScript->setOn (true);
839 void TextEditor::enableActions()
841 actionFileLoad->setEnabled(true);
842 actionFileSave->setEnabled(true);
843 actionFileSaveAs->setEnabled(true);
844 actionFilePrint->setEnabled(true);
845 actionEditUndo->setEnabled(true);
846 actionEditRedo->setEnabled(true);
847 actionEditCopy->setEnabled(true);
848 actionEditCut->setEnabled(true);
849 actionEditPaste->setEnabled(true);
850 actionEditDeleteAll->setEnabled(true);
851 actionFormatUseFixedFont->setEnabled(true);
854 void TextEditor::disableActions()
856 actionFileLoad->setEnabled(false);
857 actionFileSave->setEnabled(false);
858 actionFileSaveAs->setEnabled(false);
859 actionFilePrint->setEnabled(false);
860 actionEditUndo->setEnabled(false);
861 actionEditRedo->setEnabled(false);
862 actionEditCopy->setEnabled(false);
863 actionEditCut->setEnabled(false);
864 actionEditPaste->setEnabled(false);
865 actionEditDeleteAll->setEnabled(false);
866 actionFormatUseFixedFont->setEnabled(false);
869 void TextEditor::setState (EditorState s)
872 QPalette p=palette();
876 case emptyEditor: c=QColor (150,150,150); break;
877 case filledEditor: c=QColor (255,255,255); break;
878 case inactiveEditor: c=QColor (0,0,0);
880 p.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(9), c);
881 p.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(9), c);