jhilmer@142: /* emacs: -*- Mode: C; c-style: "bsd"; c-basic-offset: 4; c-recognize-knr-p: nil; -*- */
insilmaril@0: #include "texteditor.h"
insilmaril@0:
insilmaril@0: #include
insilmaril@0: #include
insilmaril@0: #include
insilmaril@0: #include
insilmaril@0: #include
insilmaril@0: #include
insilmaril@0: #include
insilmaril@0: #include
insilmaril@0: #include
insilmaril@0: #include
insilmaril@0: #include
insilmaril@0: #include
insilmaril@0: #include
insilmaril@0: #include
insilmaril@0: #include
insilmaril@0: #include
insilmaril@0: #include
insilmaril@0: #include
insilmaril@0: #include
insilmaril@0: #include
insilmaril@0: #include
insilmaril@0: #include
insilmaril@0: #include
insilmaril@0:
insilmaril@0: #include
insilmaril@95: #include
insilmaril@0: #include
insilmaril@0:
insilmaril@0: #include "icons/fileopen.xpm"
insilmaril@0: #include "icons/filesave.xpm"
insilmaril@0: #include "icons/fileprint.xpm"
insilmaril@0: #include "icons/editundo.xpm"
insilmaril@0: #include "icons/editredo.xpm"
insilmaril@0: #include "icons/editcopy.xpm"
insilmaril@0: #include "icons/editcut.xpm"
insilmaril@0: #include "icons/editpaste.xpm"
insilmaril@0: #include "icons/edittrash.xpm"
insilmaril@0: #include "icons/formatfixedfont.xpm"
insilmaril@0: #include "icons/formattextbold.xpm"
insilmaril@0: #include "icons/formattextitalic.xpm"
insilmaril@0: #include "icons/formattextunder.xpm"
insilmaril@0: #include "icons/formattextleft.xpm"
insilmaril@0: #include "icons/formattextcenter.xpm"
insilmaril@0: #include "icons/formattextright.xpm"
insilmaril@0: #include "icons/formattextjustify.xpm"
jhilmer@142: #include "icons/formattextsub.xpm"
jhilmer@142: #include "icons/formattextsuper.xpm"
insilmaril@0:
insilmaril@0: extern QCanvas* actCanvas;
insilmaril@0: extern int statusbarTime;
insilmaril@0: extern QSettings settings;
insilmaril@0:
insilmaril@94: extern QAction *actionViewToggleNoteEditor;
insilmaril@94:
insilmaril@0: using namespace std;
insilmaril@0:
insilmaril@0:
insilmaril@0: ///////////////////////////////////////////////////////////////////////
insilmaril@0: ///////////////////////////////////////////////////////////////////////
insilmaril@0:
jhilmer@142:
insilmaril@0: TextEditor::TextEditor()
insilmaril@0: {
insilmaril@0: printer = new QPrinter( QPrinter::HighResolution );
insilmaril@123: printer->setPrinterName (settings.readEntry("/vym/mainwindow/printerName",printer->printerName()));
insilmaril@0:
jhilmer@142: // Editor (use MyTextEdit to wrap verticalAlignmentChanged to
jhilmer@142: // int argument. see header file)
jhilmer@142: e = new MyTextEdit( this, "editor" );
insilmaril@0: e->setFocus();
insilmaril@0: e->setTextFormat(RichText); // default
insilmaril@0: e->setTabStopWidth (20); // unit is pixel
insilmaril@0: e->setColor (black);
insilmaril@0: connect (e, SIGNAL( textChanged() ), this, SLOT( editorChanged() ) );
insilmaril@0: setCentralWidget( e );
insilmaril@0: statusBar()->message( "Ready", statusbarTime);
insilmaril@0: setCaption("VYM - Note Editor");
insilmaril@0:
insilmaril@0: // Toolbars
insilmaril@0: setupFileActions();
insilmaril@0: setupEditActions();
insilmaril@0: setupFormatActions();
insilmaril@0: setupSettingsActions();
insilmaril@0:
insilmaril@0: // Various states
insilmaril@0: emptyPaper = QBrush(gray);
insilmaril@0: filledPaper = QBrush(white);
insilmaril@0: inactivePaper= QBrush(black);
insilmaril@0: setInactive();
insilmaril@0:
insilmaril@0: // Load Settings
insilmaril@0: resize (settings.readNumEntry( "/vym/noteeditor/geometry/width", 450),
insilmaril@0: settings.readNumEntry( "/vym/noteeditor/geometry/height",600));
insilmaril@0: move (settings.readNumEntry( "/vym/noteeditor/geometry/posX", 150),
insilmaril@0: settings.readNumEntry( "/vym/noteeditor/geometry/posY", 50));
insilmaril@0:
insilmaril@0: if (settings.readEntry( "/vym/noteeditor/showWithMain","yes") =="yes")
insilmaril@0: setShowWithMain(true);
insilmaril@0: else
insilmaril@0: setShowWithMain(false);
insilmaril@0:
insilmaril@0: varFont.fromString( settings.readEntry
insilmaril@0: ("/vym/noteeditor/fonts/varFont",
insilmaril@0: "Nimbus Sans l,14,-1,5,48,0,0,0,0,0")
insilmaril@0: );
insilmaril@0: fixedFont.fromString (settings.readEntry (
insilmaril@0: "/vym/noteeditor/fonts/fixedFont",
insilmaril@0: "Courier,14,-1,5,48,0,0,0,1,0")
insilmaril@0: );
insilmaril@0: QString s=settings.readEntry ("/vym/noteeditor/fonts/fonthintDefault","variable");
insilmaril@0: if (s == "fixed")
insilmaril@0: {
insilmaril@0: actionSettingsFonthintDefault->setOn (true);
insilmaril@0: e->setCurrentFont (fixedFont);
insilmaril@0: } else
insilmaril@0: {
insilmaril@0: actionSettingsFonthintDefault->setOn (false);
insilmaril@0: e->setCurrentFont (varFont);
insilmaril@0: }
insilmaril@106: filenameHint="";
insilmaril@123:
insilmaril@123: // Save settings in vymrc
insilmaril@123: settings.writeEntry("/vym/mainwindow/printerName",printer->printerName());
insilmaril@0: }
insilmaril@0:
insilmaril@0:
insilmaril@0: TextEditor::~TextEditor()
insilmaril@0: {
insilmaril@0: if (printer) delete printer;
insilmaril@0: // Save Settings
insilmaril@0: settings.writeEntry( "/vym/noteeditor/geometry/width", width() );
insilmaril@0: settings.writeEntry( "/vym/noteeditor/geometry/height", height() );
insilmaril@0: settings.writeEntry( "/vym/noteeditor/geometry/posX", pos().x() );
insilmaril@0: settings.writeEntry( "/vym/noteeditor/geometry/posY", pos().y() );
insilmaril@0:
insilmaril@0: if (showWithMain())
insilmaril@0: settings.writeEntry( "/vym/noteeditor/showWithMain","yes");
insilmaril@0: else
insilmaril@0: settings.writeEntry( "/vym/noteeditor/showWithMain","no");
insilmaril@0:
insilmaril@0: QString s;
insilmaril@0: if (actionSettingsFonthintDefault->isOn() )
insilmaril@0: s="fixed";
insilmaril@0: else
insilmaril@0: s="variable";
insilmaril@0: settings.writeEntry( "/vym/noteeditor/fonts/fonthintDefault",s );
insilmaril@0: settings.writeEntry ("/vym/noteeditor/fonts/varFont",
insilmaril@0: varFont.toString() );
insilmaril@0: settings.writeEntry ("/vym/noteeditor/fonts/fixedFont",
insilmaril@0: fixedFont.toString() );
insilmaril@0: }
insilmaril@0:
insilmaril@0: bool TextEditor::isEmpty()
insilmaril@0: {
insilmaril@0: if (e->text().length())
insilmaril@0: return false;
insilmaril@0: else
insilmaril@0: return true;
insilmaril@0: }
insilmaril@0:
insilmaril@0: void TextEditor::setShowWithMain(bool v)
insilmaril@0: {
insilmaril@0: showwithmain=v;
insilmaril@0: }
insilmaril@0:
insilmaril@0: bool TextEditor::showWithMain()
insilmaril@0: {
insilmaril@0: return showwithmain;
insilmaril@0: }
insilmaril@0:
insilmaril@0: void TextEditor::setFontHint (const QString &fh)
insilmaril@0: {
insilmaril@0: if (fh=="fixed")
insilmaril@0: actionFormatUseFixedFont->setOn (true);
insilmaril@0: else
insilmaril@0: actionFormatUseFixedFont->setOn (false);
insilmaril@0: }
insilmaril@0:
insilmaril@0:
insilmaril@0: QString TextEditor::getFontHint()
insilmaril@0: {
insilmaril@0: if (actionFormatUseFixedFont->isOn())
insilmaril@0: return "fixed";
insilmaril@0: else
insilmaril@0: return "var";
insilmaril@0: }
insilmaril@0:
insilmaril@0: QString TextEditor::getFontHintDefault()
insilmaril@0: {
insilmaril@0: if (actionSettingsFonthintDefault->isOn())
insilmaril@0: return "fixed";
insilmaril@0: else
insilmaril@0: return "var";
insilmaril@0: }
insilmaril@0:
insilmaril@0: void TextEditor::setFilename(const QString &fn)
insilmaril@0: {
insilmaril@0: if (state==filledEditor)
insilmaril@0: if (fn.isEmpty() )
insilmaril@0: {
insilmaril@0: filename="";
insilmaril@0: statusBar()->message( "No filename available for this note.", statusbarTime );
insilmaril@0: }
insilmaril@0: else
insilmaril@0: {
insilmaril@0: filename=fn;
insilmaril@0: statusBar()->message( QString( "Current filename is %1" ).arg( filename ), statusbarTime );
insilmaril@0: }
insilmaril@0: }
insilmaril@0:
insilmaril@0: QString TextEditor::getFilename()
insilmaril@0: {
insilmaril@0: return filename;
insilmaril@0: }
insilmaril@0:
insilmaril@106: void TextEditor::setFilenameHint(const QString &fnh)
insilmaril@106: {
insilmaril@106: filenameHint=fnh;
insilmaril@106: }
insilmaril@106:
insilmaril@106: QString TextEditor::getFilenameHint()
insilmaril@106: {
insilmaril@106: return filenameHint;
insilmaril@106: }
insilmaril@106:
insilmaril@0: bool TextEditor::findText(const QString &t, const bool &cs)
insilmaril@0: {
insilmaril@0: bool wo=false; // word matches
insilmaril@0: if (e->find (t, cs, wo, true, 0, 0 ))
insilmaril@0: return true;
insilmaril@0: else
insilmaril@0: return false;
insilmaril@0: }
insilmaril@0:
insilmaril@0: void TextEditor::setupFileActions()
insilmaril@0: {
insilmaril@0: QToolBar *tb = new QToolBar( this );
insilmaril@0: tb->setLabel( "File Actions" );
insilmaril@0: QPopupMenu *menu = new QPopupMenu( this );
insilmaril@0: menuBar()->insertItem( tr( "&File" ), menu );
insilmaril@0:
insilmaril@0: QAction *a;
insilmaril@0: a = new QAction( tr( "Import" ), QPixmap( fileopen_xpm), tr( "&Import..." ), CTRL + Key_O, this, "fileImport" );
insilmaril@0: connect( a, SIGNAL( activated() ), this, SLOT( textLoad() ) );
insilmaril@0: a->setEnabled(false);
insilmaril@0: a->addTo( tb );
insilmaril@0: a->addTo( menu );
insilmaril@0: actionFileLoad=a;
insilmaril@0:
insilmaril@0: menu->insertSeparator();
insilmaril@0: a = new QAction( tr( "Export Note (HTML)" ), QPixmap( filesave_xpm ), tr( "&Export..." ), CTRL + Key_S, this, "fileSave" );
insilmaril@0: connect( a, SIGNAL( activated() ), this, SLOT( textSave() ) );
insilmaril@0: a->addTo( tb );
insilmaril@0: a->addTo( menu );
insilmaril@0: actionFileSave=a;
insilmaril@0:
insilmaril@0: a = new QAction( tr( "Export Note As (HTML) " ), QPixmap(), tr( "Export &As... (HTML)" ), 0, this, "exportHTML" );
insilmaril@0: connect( a, SIGNAL( activated() ), this, SLOT( textSaveAs() ) );
insilmaril@0: a->addTo( menu );
insilmaril@0: actionFileSaveAs=a;
insilmaril@0:
insilmaril@0: a = new QAction( tr( "Export Note As (ASCII) " ), QPixmap(), tr( "Export &As...(ASCII)" ), ALT + Key_X, this, "exportASCII" );
insilmaril@0: connect( a, SIGNAL( activated() ), this, SLOT( textExportAsASCII() ) );
insilmaril@0: a->addTo( menu );
insilmaril@0: actionFileSaveAs=a;
insilmaril@0:
insilmaril@0: menu->insertSeparator();
insilmaril@0: a = new QAction( tr( "Print Note" ), QPixmap( fileprint_xpm ), tr( "&Print..." ), CTRL + Key_P, this, "filePrint" );
insilmaril@0: connect( a, SIGNAL( activated() ), this, SLOT( textPrint() ) );
insilmaril@0: a->addTo( tb );
insilmaril@0: a->addTo( menu );
insilmaril@0: actionFilePrint=a;
insilmaril@0: }
insilmaril@0:
insilmaril@0: void TextEditor::setupEditActions()
insilmaril@0: {
insilmaril@0: QToolBar *tb = new QToolBar( this );
insilmaril@0: tb->setLabel( "Edit Actions" );
insilmaril@0: QPopupMenu *menu = new QPopupMenu( this );
insilmaril@0: menuBar()->insertItem( tr( "&Edit" ), menu );
insilmaril@0:
insilmaril@0: QAction *a;
insilmaril@0: a = new QAction( tr( "Undo" ), QPixmap(editundo_xpm), tr( "&Undo" ), CTRL + Key_Z, this, "undoEvent" );
insilmaril@0: connect( a, SIGNAL( activated() ), e, SLOT( undo() ) );
insilmaril@0: a->addTo( menu );
insilmaril@0: a->addTo( tb);
insilmaril@0: actionEditUndo=a;
insilmaril@0:
insilmaril@0: a = new QAction( tr( "Redo" ), QPixmap( editredo_xpm ), tr( "&Redo" ), CTRL + Key_Y, this, "editRedo" );
insilmaril@0: connect( a, SIGNAL( activated() ), e, SLOT( redo() ) );
insilmaril@0: a->addTo( tb );
insilmaril@0: a->addTo( menu );
insilmaril@0: actionEditRedo=a;
insilmaril@0:
insilmaril@0: menu->insertSeparator();
insilmaril@0: a = new QAction( tr( "Select and copy all" ), QPixmap(), tr( "Select and copy &all" ), CTRL + Key_A, this, "editcopyall" );
insilmaril@0: connect( a, SIGNAL( activated() ), this, SLOT( editCopyAll() ) );
insilmaril@0: a->addTo( menu );
insilmaril@0:
insilmaril@0: menu->insertSeparator();
insilmaril@0: a = new QAction( tr( "Copy" ), QPixmap( editcopy_xpm ), tr( "&Copy" ), CTRL + Key_C, this, "editCopy" );
insilmaril@0: connect( a, SIGNAL( activated() ), e, SLOT( copy() ) );
insilmaril@0: a->addTo( tb );
insilmaril@0: a->addTo( menu );
insilmaril@0: actionEditCopy=a;
insilmaril@0:
insilmaril@0: a = new QAction( tr( "Cut" ), QPixmap( editcut_xpm ), tr( "Cu&t" ), CTRL + Key_X, this, "editCut" );
insilmaril@0: connect( a, SIGNAL( activated() ), e, SLOT( cut() ) );
insilmaril@0: a->addTo( tb );
insilmaril@0: a->addTo( menu );
insilmaril@0: actionEditCut=a;
insilmaril@0:
insilmaril@0: a = new QAction( tr( "Paste" ), QPixmap( editpaste_xpm ), tr( "&Paste" ), CTRL + Key_V, this, "editPaste" );
insilmaril@0: connect( a, SIGNAL( activated() ), e, SLOT( paste() ) );
insilmaril@0: a->addTo( tb );
insilmaril@0: a->addTo( menu );
insilmaril@0: actionEditPaste=a;
insilmaril@0:
insilmaril@0: a = new QAction( tr( "Delete all" ), QPixmap( edittrash_xpm ), tr( "&Delete All" ), 0, this, "editDeleteAll" );
insilmaril@0: connect( a, SIGNAL( activated() ), e, SLOT( clear() ) );
insilmaril@0: a->addTo( tb );
insilmaril@0: a->addTo( menu );
insilmaril@0: actionEditDeleteAll=a;
insilmaril@0:
insilmaril@0: a = new QAction( tr( "Convert paragraphs to linebreaks" ), QPixmap(), tr( "&Convert Paragraphs" ), ALT + Key_P, this, "editConvertPar" );
insilmaril@0: connect( a, SIGNAL( activated() ), this, SLOT( textConvertPar() ) );
insilmaril@0: a->addTo( menu );
insilmaril@0: actionEditConvertPar=a;
insilmaril@0:
insilmaril@0: a = new QAction( tr( "Join all lines of a paragraph" ), QPixmap(), tr( "&Join lines" ), ALT + Key_J, this, "editJoinLines" );
insilmaril@0: connect( a, SIGNAL( activated() ), this, SLOT( textJoinLines() ) );
insilmaril@0: a->addTo( menu );
insilmaril@0: actionEditJoinLines=a;
insilmaril@0: }
insilmaril@0:
insilmaril@0: void TextEditor::setupFormatActions()
insilmaril@0: {
insilmaril@0: QToolBar *tb = new QToolBar( this );
insilmaril@0: tb->setLabel( "Format Actions" );
insilmaril@0: QPopupMenu *menu = new QPopupMenu( this );
insilmaril@0: menuBar()->insertItem( tr( "&Format" ), menu );
insilmaril@0:
insilmaril@0: QAction *a;
insilmaril@0:
insilmaril@0: a = new QAction( tr( "Toggle font hint for the whole text" ), QPixmap(formatfixedfont_xpm), tr( "&Font hint" ), ALT + Key_I, this, "fontHint" );
insilmaril@0: a->setToggleAction (true);
insilmaril@0: a->setOn (settings.readBoolEntry ("/vym/noteeditor/fonts/useFixedByDefault",false) );
insilmaril@0: connect( a, SIGNAL( activated() ), this, SLOT( toggleFonthint() ) );
insilmaril@0: a->addTo( menu );
insilmaril@0: a->addTo( tb );
insilmaril@0: actionFormatUseFixedFont=a;
insilmaril@0:
insilmaril@0: menu->insertSeparator();
insilmaril@0:
insilmaril@0: comboFont = new QComboBox( true, tb );
insilmaril@0: QFontDatabase db;
insilmaril@0: comboFont->insertStringList( db.families() );
insilmaril@0: connect( comboFont, SIGNAL( activated( const QString & ) ),
insilmaril@0: this, SLOT( textFamily( const QString & ) ) );
insilmaril@0: comboFont->lineEdit()->setText( QApplication::font().family() );
insilmaril@0:
insilmaril@0: comboSize = new QComboBox( true, tb );
insilmaril@0: QValueList sizes = db.standardSizes();
insilmaril@0: QValueList::Iterator it = sizes.begin();
insilmaril@0: for ( ; it != sizes.end(); ++it )
insilmaril@0: comboSize->insertItem( QString::number( *it ) );
insilmaril@0: connect( comboSize, SIGNAL( activated( const QString & ) ),
insilmaril@0: this, SLOT( textSize( const QString & ) ) );
insilmaril@0: comboSize->lineEdit()->setText( QString::number( QApplication::font().pointSize() ) );
insilmaril@0:
insilmaril@0: menu->insertSeparator();
insilmaril@0:
insilmaril@0: QPixmap pix( 16, 16 );
insilmaril@0: pix.fill( e->color());
insilmaril@0: actionTextColor = new QAction( pix, tr( "&Color..." ), 0, this, "textColor" );
insilmaril@0: connect( actionTextColor, SIGNAL( activated() ), this, SLOT( textColor() ) );
insilmaril@0: actionTextColor->addTo( tb );
insilmaril@0: actionTextColor->addTo( menu );
insilmaril@0:
insilmaril@0: actionTextBold = new QAction( QPixmap (formattextbold_xpm), tr( "&Bold" ), CTRL + Key_B, this, "textBold" );
insilmaril@0: connect( actionTextBold, SIGNAL( activated() ), this, SLOT( textBold() ) );
insilmaril@0: actionTextBold->addTo( tb );
insilmaril@0: actionTextBold->addTo( menu );
insilmaril@0: actionTextBold->setToggleAction( true );
insilmaril@0: actionTextItalic = new QAction( QPixmap(formattextitalic_xpm ), tr( "&Italic" ), CTRL + Key_I, this, "textItalic" );
insilmaril@0: connect( actionTextItalic, SIGNAL( activated() ), this, SLOT( textItalic() ) );
insilmaril@0: actionTextItalic->addTo( tb );
insilmaril@0: actionTextItalic->addTo( menu );
insilmaril@0: actionTextItalic->setToggleAction( true );
insilmaril@0: actionTextUnderline = new QAction( QPixmap (formattextunder_xpm ), tr( "&Underline" ), CTRL + Key_U, this, "textUnderline" );
insilmaril@0: connect( actionTextUnderline, SIGNAL( activated() ), this, SLOT( textUnderline() ) );
insilmaril@0: actionTextUnderline->addTo( tb );
insilmaril@0: actionTextUnderline->addTo( menu );
insilmaril@0: actionTextUnderline->setToggleAction( true );
insilmaril@0: menu->insertSeparator();
insilmaril@0:
insilmaril@0: QActionGroup *grp = new QActionGroup( this );
insilmaril@0: connect( grp, SIGNAL( selected( QAction* ) ), this, SLOT( textAlign( QAction* ) ) );
insilmaril@0:
insilmaril@0: actionAlignLeft = new QAction( QPixmap (formattextleft_xpm ), tr( "&Left" ), CTRL + Key_L, grp, "textLeft" );
insilmaril@0: actionAlignLeft->setToggleAction( true );
insilmaril@0: actionAlignCenter = new QAction( QPixmap (formattextcenter_xpm ), tr( "C&enter" ), CTRL + Key_E, grp, "textCenter" );
insilmaril@0: actionAlignCenter->setToggleAction( true );
insilmaril@0: actionAlignRight = new QAction( QPixmap (formattextright_xpm ), tr( "&Right" ), CTRL + Key_R, grp, "textRight" );
insilmaril@0: actionAlignRight->setToggleAction( true );
insilmaril@0: actionAlignJustify = new QAction( QPixmap ( formattextjustify_xpm ), tr( "&Justify" ), CTRL + Key_J, grp, "textjustify" );
insilmaril@0: actionAlignJustify->setToggleAction( true );
insilmaril@0:
insilmaril@0: grp->addTo( tb );
insilmaril@0: grp->addTo( menu );
insilmaril@0:
jhilmer@142: QActionGroup *grp2 = new QActionGroup( this );
jhilmer@142: grp2->setExclusive(false);
jhilmer@142: actionAlignSubScript = new QAction( QPixmap (formattextsub_xpm ), tr( "Subs&cript" ), CTRL + SHIFT + Key_B, grp2, "textSubscript" );
jhilmer@142:
jhilmer@142: actionAlignSubScript->setToggleAction( true );
jhilmer@142: connect(actionAlignSubScript, SIGNAL(activated()), this, SLOT(textVAlign()));
jhilmer@142:
jhilmer@142: actionAlignSuperScript = new QAction( QPixmap (formattextsuper_xpm ), tr( "Su&perscript" ), CTRL + SHIFT + Key_P, grp2, "textSuperscript" );
jhilmer@142:
jhilmer@142: actionAlignSuperScript->setToggleAction( true );
jhilmer@142: connect(actionAlignSuperScript, SIGNAL(activated()), this, SLOT(textVAlign()));
jhilmer@142:
jhilmer@142: menu->insertSeparator();
jhilmer@142:
jhilmer@142: grp2->addTo(tb);
jhilmer@142: grp2->addTo(menu);
jhilmer@142:
insilmaril@0: connect( e, SIGNAL( currentFontChanged( const QFont & ) ),
insilmaril@0: this, SLOT( fontChanged( const QFont & ) ) );
insilmaril@0: connect( e, SIGNAL( currentColorChanged( const QColor & ) ),
insilmaril@0: this, SLOT( colorChanged( const QColor & ) ) );
insilmaril@0: connect( e, SIGNAL( currentAlignmentChanged( int ) ),
insilmaril@0: this, SLOT( alignmentChanged( int ) ) );
jhilmer@142: connect( e, SIGNAL( currentVerticalAlignmentChanged(int)),
jhilmer@142: this, SLOT( verticalAlignmentChanged(int)));
insilmaril@0:
insilmaril@0: }
insilmaril@0:
insilmaril@0: void TextEditor::setupSettingsActions()
insilmaril@0: {
insilmaril@0: QPopupMenu *menu = new QPopupMenu( this );
insilmaril@0: menuBar()->insertItem( tr( "&Settings" ), menu );
insilmaril@0:
insilmaril@0: QAction *a;
insilmaril@0: a = new QAction( tr( "Set fixed font" ), QPixmap(), tr( "Set &fixed font" ), 0, this, "setFixedFont" );
insilmaril@0: connect( a, SIGNAL( activated() ), this, SLOT( setFixedFont() ) );
insilmaril@0: a->addTo( menu );
insilmaril@0: actionSettingsFixedFont=a;
insilmaril@0:
insilmaril@0: a = new QAction( tr( "Set variable font" ), QPixmap(), tr( "Set &variable font" ), 0, this, "setvariableFont" );
insilmaril@0: connect( a, SIGNAL( activated() ), this, SLOT( setVarFont() ) );
insilmaril@0: a->addTo( menu );
insilmaril@0: actionSettingsVarFont=a;
insilmaril@0:
insilmaril@0: a = new QAction( tr( "Used fixed font by default" ), QPixmap(), tr( "&fixed font is default" ), 0, this, "fonthintDefault" );
insilmaril@0: a->setToggleAction (true);
insilmaril@0: // set state later in constructor...
insilmaril@0: a->addTo( menu );
insilmaril@0: actionSettingsFonthintDefault=a;
insilmaril@0: }
insilmaril@0:
insilmaril@0: void TextEditor::textLoad()
insilmaril@0: {
insilmaril@0: if (state!=inactiveEditor)
insilmaril@0: {
insilmaril@0: if (e->length())
insilmaril@0: {
insilmaril@0: QMessageBox mb( "VYM - Note Editor",
insilmaril@0: "Loading will overwrite the existing note",
insilmaril@0: QMessageBox::Warning,
insilmaril@0: QMessageBox::Yes | QMessageBox::Default,
insilmaril@0: QMessageBox::Cancel,
insilmaril@0: 0 );
insilmaril@0: mb.setButtonText( QMessageBox::Yes, "Load note" );
insilmaril@0: switch( mb.exec() ) {
insilmaril@0: case QMessageBox::Cancel:
insilmaril@0: return;
insilmaril@0: break;
insilmaril@0: }
insilmaril@0: }
insilmaril@0: // Load note
insilmaril@0: QFileDialog *fd=new QFileDialog( this);
insilmaril@0: fd->addFilter ("ASCII texts (*.txt)");
insilmaril@0: fd->addFilter ("VYM notes (*.html)");
insilmaril@0: fd->show();
insilmaril@0: QString fn;
insilmaril@0: if ( fd->exec() == QDialog::Accepted )
insilmaril@0: fn = fd->selectedFile();
insilmaril@0:
insilmaril@0: if ( !fn.isEmpty() )
insilmaril@0: {
insilmaril@0: QFile f( fn );
insilmaril@0: if ( !f.open( IO_ReadOnly ) )
insilmaril@0: return;
insilmaril@0:
insilmaril@0: QTextStream ts( &f );
insilmaril@0: setText( ts.read() );
insilmaril@0: editorChanged();
insilmaril@0: }
insilmaril@0: }
insilmaril@0: }
insilmaril@0:
insilmaril@0: void TextEditor::closeEvent( QCloseEvent* ce )
insilmaril@0: {
jhilmer@144: ce->accept(); // TextEditor can be reopened with show()
jhilmer@144: actionViewToggleNoteEditor->setOn (false);
jhilmer@144: showwithmain=false;
jhilmer@144: return;
insilmaril@0: }
insilmaril@0:
insilmaril@0: QString TextEditor::getText()
insilmaril@0: {
insilmaril@0: return e->text();
insilmaril@0: }
insilmaril@0:
insilmaril@0: void TextEditor::editorChanged()
insilmaril@0: {
insilmaril@0: // received, when QTextEdit::text() has changed
insilmaril@0: EditorState oldstate=state;
insilmaril@0:
insilmaril@0: if (isEmpty())
insilmaril@0: state=emptyEditor;
insilmaril@0: else
insilmaril@0: state=filledEditor;
insilmaril@0:
insilmaril@0: if (state==emptyEditor)
insilmaril@0: e->setPaper (emptyPaper);
insilmaril@0: else
insilmaril@0: e->setPaper (filledPaper);
insilmaril@0: // SLOT is LinkableMapObj, which will update systemFlag
insilmaril@0: emit (textHasChanged() );
insilmaril@0: }
insilmaril@0:
insilmaril@0:
insilmaril@0: void TextEditor::setText(QString t)
insilmaril@0: {
insilmaril@0: if ( !QStyleSheet::mightBeRichText( t ) )
insilmaril@0: t = QStyleSheet::convertFromPlainText( t, QStyleSheetItem::WhiteSpaceNormal );
insilmaril@0: e->setReadOnly(false);
insilmaril@0: e->setText(t);
insilmaril@160: // editorChanged(); //not called automagically FIXME or is it?
insilmaril@0:
insilmaril@0: enableActions();
insilmaril@0: }
insilmaril@0:
insilmaril@0: void TextEditor::setInactive()
insilmaril@0: {
jhilmer@135: state=inactiveEditor;
insilmaril@0: setText("");
insilmaril@0: e->setPaper (inactivePaper);
insilmaril@0: e->setReadOnly (true);
insilmaril@0:
insilmaril@0: disableActions();
insilmaril@0: }
insilmaril@0:
insilmaril@0: void TextEditor::editCopyAll()
insilmaril@0: {
insilmaril@0: e->selectAll();
insilmaril@0: e->copy();
insilmaril@0: }
insilmaril@0:
insilmaril@0: void TextEditor::textSaveAs()
insilmaril@0: {
insilmaril@0: QString fn = QFileDialog::getSaveFileName( QString::null, "VYM Note (HTML) (*.html);;All files (*)",
insilmaril@0: this,"export note dialog",tr("Export Note to single file") );
insilmaril@0:
insilmaril@0: if ( !fn.isEmpty() )
insilmaril@0: {
insilmaril@0: QFile file (fn);
insilmaril@0: if (file.exists())
insilmaril@0: {
insilmaril@0: QMessageBox mb( "VYM",
insilmaril@0: tr("The file ") + fn +
insilmaril@0: tr(" exists already. "
insilmaril@0: "Do you want to overwrite it?"),
insilmaril@0: QMessageBox::Warning,
insilmaril@0: QMessageBox::Yes | QMessageBox::Default,
insilmaril@0: QMessageBox::Cancel | QMessageBox::Escape,
insilmaril@0: QMessageBox::NoButton );
insilmaril@0: mb.setButtonText( QMessageBox::Yes, tr("Overwrite") );
insilmaril@0: mb.setButtonText( QMessageBox::No, tr("Cancel"));
insilmaril@0: switch( mb.exec() ) {
insilmaril@0: case QMessageBox::Yes:
insilmaril@0: // save
insilmaril@0: filename = fn;
insilmaril@0: textSave();
insilmaril@0: return;
insilmaril@0: case QMessageBox::Cancel:
insilmaril@0: // do nothing
insilmaril@0: break;
insilmaril@0: }
insilmaril@0: } else
insilmaril@0: {
insilmaril@0: filename = fn;
insilmaril@0: textSave();
insilmaril@0: return;
insilmaril@0: }
insilmaril@0: }
insilmaril@0: statusBar()->message(tr( "Couldn't export note ") + fn, statusbarTime );
insilmaril@0: }
insilmaril@0:
insilmaril@0:
insilmaril@0: void TextEditor::textSave()
insilmaril@0: {
insilmaril@0: if ( filename.isEmpty() )
insilmaril@0: {
insilmaril@0: textSaveAs();
insilmaril@0: return;
insilmaril@0: }
insilmaril@0:
insilmaril@0: QString text = e->text();
insilmaril@0: QFile f( filename );
insilmaril@0: if ( !f.open( IO_WriteOnly ) )
insilmaril@0: {
insilmaril@0: statusBar()->message( QString("Could not write to %1").arg(filename),
insilmaril@0: statusbarTime );
insilmaril@0: return;
insilmaril@0: }
insilmaril@0:
insilmaril@0: QTextStream t( &f );
insilmaril@0: t << text;
insilmaril@0: f.close();
insilmaril@0:
insilmaril@0: e->setModified( FALSE );
insilmaril@0:
insilmaril@0: statusBar()->message( QString( "Note exported as %1" ).arg( filename ), statusbarTime );
insilmaril@0: }
insilmaril@0:
insilmaril@0: void TextEditor::textConvertPar()
insilmaril@0: {
insilmaril@0: // In X11 a copy&paste generates paragraphs,
insilmaril@0: // which is not always wanted
insilmaril@0: // This function replaces paragraphs by linebreaks.
insilmaril@0: int parFrom, parTo, indFrom, indTo;
insilmaril@0: e->getSelection (&parFrom,&indFrom,&parTo,&indTo);
insilmaril@0: QString t;
insilmaril@0: if (parFrom>-1)
insilmaril@0: t=e->selectedText();
insilmaril@0: else
insilmaril@0: t=e->text();
insilmaril@0:
insilmaril@0: QRegExp re("");
insilmaril@0: re.setMinimal(true);
insilmaril@0: t.replace (re,"");
insilmaril@0: t.replace ("
","
");
insilmaril@0: if (parFrom>-1)
insilmaril@0: {
insilmaril@0: e->setCursorPosition (parFrom,indFrom);
insilmaril@0: e->cut();
insilmaril@0: // Tried to simply insert the changed text with
insilmaril@0: // e->insert (t,(uint)(QTextEdit::RemoveSelected));
insilmaril@0: // but then the html would be quoted. So I use the ugly
insilmaril@0: // way: insert a marker, replace it in whole text of QTextEdit
insilmaril@0: QString marker="R3PlAcEMeL4teR!";
insilmaril@0: e->insert (marker);
insilmaril@0: e->setText (e->text().replace(marker,t));
insilmaril@0: } else
insilmaril@0: e->setText(t);
insilmaril@0: }
insilmaril@0:
insilmaril@0: void TextEditor::textJoinLines()
insilmaril@0: {
insilmaril@0: int parFrom, parTo, indFrom, indTo;
insilmaril@0: e->getSelection (&parFrom,&indFrom,&parTo,&indTo);
insilmaril@0: QString t;
insilmaril@0: if (parFrom>-1)
insilmaril@0: t=e->selectedText();
insilmaril@0: else
insilmaril@0: t=e->text();
insilmaril@0: // In addition to textConvertPar it is sometimes
insilmaril@0: // useful to join all lines of a paragraph
insilmaril@0: QRegExp re("\n+(?!
)");
insilmaril@0: re.setMinimal(true);
insilmaril@0: t.replace (re," ");
insilmaril@0:
insilmaril@0: // Above we may have introduced new " " at beginning of a
insilmaril@0: // paragraph - remove it.
insilmaril@0: re.setPattern(" ");
insilmaril@0: t.replace (re,"
");
insilmaril@0: if (parFrom>-1)
insilmaril@0: {
insilmaril@0: e->setCursorPosition (parFrom,indFrom);
insilmaril@0: e->cut();
insilmaril@0: // Tried to simply insert the changed text with
insilmaril@0: // e->insert (t,(uint)(QTextEdit::RemoveSelected));
insilmaril@0: // but then the html would be quoted. So I use the ugly
insilmaril@0: // way: insert a marker, replace it in whole text of QTextEdit
insilmaril@0: QString marker="R3PlAcEMeL4teR!";
insilmaril@0: e->insert (marker);
insilmaril@0: e->setText (e->text().replace(marker,t));
insilmaril@0: } else
insilmaril@0: e->setText(t);
insilmaril@0: }
insilmaril@0:
insilmaril@131: QString textConvertToASCII(const QString &t)
insilmaril@0: {
insilmaril@0: QString r=t;
insilmaril@0:
insilmaril@0: // convert all "
" to "\n"
insilmaril@0: QRegExp re("");
insilmaril@0: re.setMinimal(true);
insilmaril@0: r.replace (re,"\n");
insilmaril@0:
insilmaril@131: // convert all "" to "\n"
insilmaril@131: re.setPattern ("
");
insilmaril@0: r.replace (re,"\n");
insilmaril@0:
insilmaril@0: // remove all remaining tags
insilmaril@0: re.setPattern ("<.*>");
insilmaril@0: r.replace (re,"");
insilmaril@0:
insilmaril@0: // convert "&", "<" and ">"
insilmaril@0: re.setPattern (">");
insilmaril@0: r.replace (re,">");
insilmaril@0: re.setPattern ("<");
insilmaril@0: r.replace (re,"<");
insilmaril@0: re.setPattern ("&");
insilmaril@0: r.replace (re,"&");
insilmaril@131: re.setPattern (""");
insilmaril@131: r.replace (re,"\"");
insilmaril@0: return r;
insilmaril@0: }
insilmaril@0:
insilmaril@0: void TextEditor::textExportAsASCII()
insilmaril@0: {
insilmaril@0: QString text = textConvertToASCII( e->text());
insilmaril@106: QString fn,s;
insilmaril@106: if (!filenameHint.isEmpty())
insilmaril@106: {
insilmaril@106: if (!filenameHint.contains (".txt"))
insilmaril@106: s=filenameHint+".txt";
insilmaril@106: else
insilmaril@106: s=filenameHint;
insilmaril@106: } else
insilmaril@106: s=QString::null;
insilmaril@106: fn = QFileDialog::getSaveFileName( s, "VYM Note (ASCII) (*.txt);;All files (*)", this,"export note dialog",tr("Export Note to single file (ASCII)") );
insilmaril@0: int ret=-1;
insilmaril@0:
insilmaril@0: if ( !fn.isEmpty() )
insilmaril@0: {
insilmaril@0: QFile file (fn);
insilmaril@0: if (file.exists())
insilmaril@0: {
insilmaril@0: QMessageBox mb( "VYM",
insilmaril@0: tr("The file ") + fn +
insilmaril@0: tr(" exists already. "
insilmaril@0: "Do you want to overwrite it?"),
insilmaril@0: QMessageBox::Warning,
insilmaril@0: QMessageBox::Yes | QMessageBox::Default,
insilmaril@0: QMessageBox::Cancel | QMessageBox::Escape,
insilmaril@0: QMessageBox::NoButton );
insilmaril@0: mb.setButtonText( QMessageBox::Yes, tr("Overwrite") );
insilmaril@0: mb.setButtonText( QMessageBox::No, tr("Cancel"));
insilmaril@0: ret=mb.exec();
insilmaril@0: }
insilmaril@0: if (ret==QMessageBox::Cancel)
insilmaril@0: return;
insilmaril@0:
insilmaril@0: // save
insilmaril@0: if ( !file.open( IO_WriteOnly ) )
insilmaril@0: statusBar()->message( QString("Could not write to %1").arg(filename),
insilmaril@0: statusbarTime );
insilmaril@0: else
insilmaril@0: {
insilmaril@0: QTextStream t( &file );
insilmaril@0: t << text;
insilmaril@0: file.close();
insilmaril@0:
insilmaril@0: statusBar()->message( QString( "Note exported as %1" ).arg( fn ), statusbarTime );
insilmaril@0: }
insilmaril@0: }
insilmaril@0: }
insilmaril@0:
insilmaril@0:
insilmaril@0: void TextEditor::textPrint()
insilmaril@0: {
insilmaril@0: printer->setFullPage(TRUE);
insilmaril@0: if ( printer->setup( this ) )
insilmaril@0: {
insilmaril@0: QPainter p( printer );
insilmaril@0: // Check that there is a valid device to print to.
insilmaril@0: if ( !p.device() ) return;
insilmaril@0: QPaintDeviceMetrics metrics( p.device() );
insilmaril@0: int dpiy = metrics.logicalDpiY();
insilmaril@0: int margin = (int) ( (2/2.54)*dpiy ); // 2 cm margins
insilmaril@0: QRect body( margin, margin, metrics.width() - 2*margin, metrics.height() - 2*margin );
insilmaril@0: QFont font( e->currentFont() );
insilmaril@0: font.setPointSize( 10 ); // we define 10pt to be a nice base size for printing
insilmaril@0:
insilmaril@0: QSimpleRichText richText( e->text(), font,
insilmaril@0: e->context(),
insilmaril@0: e->styleSheet(),
insilmaril@0: e->mimeSourceFactory(),
insilmaril@0: body.height() );
insilmaril@0: richText.setWidth( &p, body.width() );
insilmaril@0: QRect view( body );
insilmaril@0: int page = 1;
insilmaril@0: do
insilmaril@0: {
insilmaril@0: richText.draw( &p, body.left(), body.top(), view, colorGroup() );
insilmaril@0: view.moveBy( 0, body.height() );
insilmaril@0: p.translate( 0 , -body.height() );
insilmaril@0: p.setFont( font );
insilmaril@0: p.drawText( view.right() - p.fontMetrics().width( QString::number( page ) ),
insilmaril@0: view.bottom() + p.fontMetrics().ascent() + 5, QString::number( page ) );
insilmaril@0: if ( view.top() >= richText.height() )
insilmaril@0: break;
insilmaril@0: printer->newPage();
insilmaril@0: page++;
insilmaril@0: } while (TRUE);
insilmaril@0: }
insilmaril@0: }
insilmaril@0:
insilmaril@0: void TextEditor::textEditUndo()
insilmaril@0: {
insilmaril@0: }
insilmaril@0:
insilmaril@0: void TextEditor::toggleFonthint()
insilmaril@0: {
insilmaril@0: setUpdatesEnabled (false);
insilmaril@0: e->selectAll (true);
insilmaril@0: if (!actionFormatUseFixedFont->isOn() )
insilmaril@0: e->setCurrentFont (varFont);
insilmaril@0: else
insilmaril@0: e->setCurrentFont (fixedFont);
insilmaril@0: e->selectAll (false);
insilmaril@0: setUpdatesEnabled (true);
insilmaril@0: repaint();
insilmaril@0: }
insilmaril@0:
insilmaril@0: void TextEditor::setFixedFont()
insilmaril@0: {
insilmaril@0: bool ok;
insilmaril@0: QFont font =QFontDialog::getFont(
insilmaril@0: &ok, fixedFont, this );
insilmaril@0: if ( ok )
insilmaril@0: // font is set to the font the user selected
insilmaril@0: fixedFont=font;
insilmaril@0: }
insilmaril@0:
insilmaril@0: void TextEditor::setVarFont()
insilmaril@0: {
insilmaril@0: bool ok;
insilmaril@0: QFont font =QFontDialog::getFont(
insilmaril@0: &ok, varFont, this );
insilmaril@0: if ( ok )
insilmaril@0: // font is set to the font the user selected
insilmaril@0: varFont=font;
insilmaril@0: }
insilmaril@0:
insilmaril@0: void TextEditor::textBold()
insilmaril@0: {
insilmaril@0: e->setBold( actionTextBold->isOn() );
insilmaril@0: }
insilmaril@0:
insilmaril@0: void TextEditor::textUnderline()
insilmaril@0: {
insilmaril@0: e->setUnderline( actionTextUnderline->isOn() );
insilmaril@0: }
insilmaril@0:
insilmaril@0: void TextEditor::textItalic()
insilmaril@0: {
insilmaril@0: e->setItalic( actionTextItalic->isOn() );
insilmaril@0: }
insilmaril@0:
insilmaril@0: void TextEditor::textFamily( const QString &f )
insilmaril@0: {
insilmaril@0: e->setFamily( f );
insilmaril@0: }
insilmaril@0:
insilmaril@0: void TextEditor::textSize( const QString &p )
insilmaril@0: {
insilmaril@0: e->setPointSize( p.toInt() );
insilmaril@0: }
insilmaril@0:
insilmaril@0:
insilmaril@0: void TextEditor::textColor()
insilmaril@0: {
insilmaril@0: QColor col = QColorDialog::getColor( e->color(), this );
insilmaril@0: if ( !col.isValid() )
insilmaril@0: return;
insilmaril@0: e->setColor( col );
insilmaril@0: QPixmap pix( 16, 16 );
insilmaril@0: pix.fill( black );
insilmaril@0: actionTextColor->setIconSet( pix );
insilmaril@0: }
insilmaril@0:
insilmaril@0: void TextEditor::textAlign( QAction *a )
insilmaril@0: {
insilmaril@0: if ( a == actionAlignLeft )
insilmaril@0: e->setAlignment( AlignLeft );
insilmaril@0: else if ( a == actionAlignCenter )
insilmaril@0: e->setAlignment( AlignHCenter );
insilmaril@0: else if ( a == actionAlignRight )
insilmaril@0: e->setAlignment( AlignRight );
insilmaril@0: else if ( a == actionAlignJustify )
insilmaril@0: e->setAlignment( AlignJustify );
insilmaril@0: }
insilmaril@0:
jhilmer@142: void TextEditor::textVAlign()
jhilmer@142: {
jhilmer@142: if ( sender() == actionAlignSuperScript && actionAlignSuperScript->isOn()) {
jhilmer@142: e->setVerticalAlignment( QTextEdit::AlignSuperScript);
jhilmer@142: } else if (sender() == actionAlignSubScript && actionAlignSubScript->isOn()) {
jhilmer@142: e->setVerticalAlignment( QTextEdit::AlignSubScript);
jhilmer@142: } else {
jhilmer@142: e->setVerticalAlignment( QTextEdit::AlignNormal);
jhilmer@142: }
jhilmer@142: }
jhilmer@142:
jhilmer@142:
insilmaril@0: void TextEditor::fontChanged( const QFont &f )
insilmaril@0: {
insilmaril@0: comboFont->lineEdit()->setText( f.family() );
insilmaril@0: comboSize->lineEdit()->setText( QString::number( f.pointSize() ) );
insilmaril@0: actionTextBold->setOn( f.bold() );
insilmaril@0: actionTextItalic->setOn( f.italic() );
insilmaril@0: actionTextUnderline->setOn( f.underline() );
insilmaril@0: }
insilmaril@0:
insilmaril@0: void TextEditor::colorChanged( const QColor &c )
insilmaril@0: {
insilmaril@0: QPixmap pix( 16, 16 );
insilmaril@0: pix.fill( c );
insilmaril@0: actionTextColor->setIconSet( pix );
insilmaril@0: }
insilmaril@0:
insilmaril@0: void TextEditor::alignmentChanged( int a )
insilmaril@0: {
insilmaril@0: if ( ( a == AlignAuto ) || ( a & AlignLeft ))
insilmaril@0: actionAlignLeft->setOn( true );
insilmaril@0: else if ( ( a & AlignHCenter ) )
insilmaril@0: actionAlignCenter->setOn( true );
insilmaril@0: else if ( ( a & AlignRight ) )
insilmaril@0: actionAlignRight->setOn( true );
insilmaril@0: else if ( ( a & AlignJustify ) )
insilmaril@0: actionAlignJustify->setOn( true );
insilmaril@0: }
insilmaril@0:
jhilmer@142: void TextEditor::verticalAlignmentChanged(int a)
jhilmer@142: {
jhilmer@142: if (a == QTextEdit::AlignSuperScript ) {
jhilmer@142: actionAlignSuperScript->setOn(true);
jhilmer@142: actionAlignSubScript->setOn(false);
jhilmer@142: } else if (a == QTextEdit::AlignSubScript ) {
jhilmer@142: actionAlignSuperScript->setOn(false);
jhilmer@142: actionAlignSubScript->setOn(true);
jhilmer@142: } else {
jhilmer@142: actionAlignSuperScript->setOn(false);
jhilmer@142: actionAlignSubScript->setOn(false);
jhilmer@142: }
jhilmer@142: }
jhilmer@142:
insilmaril@0:
insilmaril@0:
insilmaril@0: void TextEditor::enableActions()
insilmaril@0: {
insilmaril@0: actionFileLoad->setEnabled(true);
insilmaril@0: actionFileSave->setEnabled(true);
insilmaril@0: actionFileSaveAs->setEnabled(true);
insilmaril@0: actionFilePrint->setEnabled(true);
insilmaril@0: actionEditUndo->setEnabled(true);
insilmaril@0: actionEditRedo->setEnabled(true);
insilmaril@0: actionEditCopy->setEnabled(true);
insilmaril@0: actionEditCut->setEnabled(true);
insilmaril@0: actionEditPaste->setEnabled(true);
insilmaril@0: actionEditDeleteAll->setEnabled(true);
insilmaril@0: actionEditConvertPar->setEnabled(true);
insilmaril@0: actionEditJoinLines->setEnabled(true);
insilmaril@0: actionFormatUseFixedFont->setEnabled(true);
insilmaril@0: }
insilmaril@0:
insilmaril@0: void TextEditor::disableActions()
insilmaril@0: {
insilmaril@0: actionFileLoad->setEnabled(false);
insilmaril@0: actionFileSave->setEnabled(false);
insilmaril@0: actionFileSaveAs->setEnabled(false);
insilmaril@0: actionFilePrint->setEnabled(false);
insilmaril@0: actionEditUndo->setEnabled(false);
insilmaril@0: actionEditRedo->setEnabled(false);
insilmaril@0: actionEditCopy->setEnabled(false);
insilmaril@0: actionEditCut->setEnabled(false);
insilmaril@0: actionEditPaste->setEnabled(false);
insilmaril@0: actionEditDeleteAll->setEnabled(false);
insilmaril@0: actionEditConvertPar->setEnabled(false);
insilmaril@0: actionEditJoinLines->setEnabled(false);
insilmaril@0: actionFormatUseFixedFont->setEnabled(false);
insilmaril@0: }
insilmaril@0:
insilmaril@0: