1 /*******************************************************************
2 KNotes -- Notes for the KDE project
4 Copyright (c) 1997-2013, The KNotes Developers
6 This program is free software; you can redistribute it and/or
7 modify it under the terms of the GNU General Public License
8 as published by the Free Software Foundation; either version 2
9 of the License, or (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 *******************************************************************/
24 #include "knotes_export.h"
25 #include <QTextCharFormat>
32 class KActionCollection
;
34 class KFontSizeAction
;
39 class KActionMenuChangeCase
;
41 class KNOTES_EXPORT KNoteEdit
: public KTextEdit
45 explicit KNoteEdit(KActionCollection
*actions
, QWidget
*parent
= Q_NULLPTR
);
48 void setNote(KNote
*_note
);
50 void setText(const QString
&text
);
53 void setTextFont(const QFont
&font
);
54 void setTabStop(int tabs
);
55 void setAutoIndentMode(bool newmode
);
57 void setColor(const QColor
&fg
, const QColor
&bg
);
58 void setCursorPositionFromStart(int pos
);
59 int cursorPositionFromStart() const;
60 QMenu
*mousePopupMenu() Q_DECL_OVERRIDE
;
62 void setRichText(bool);
65 void textStrikeOut(bool);
70 void textAlignCenter();
71 void textAlignRight();
72 void textAlignBlock();
76 void textSuperScript();
79 void textIncreaseIndent();
80 void textDecreaseIndent();
81 void setTextFontSize(int);
83 void slotTextBackgroundColor();
84 void slotInsertDate();
87 void keyPressEvent(QKeyEvent
*) Q_DECL_OVERRIDE
;
88 void focusInEvent(QFocusEvent
*) Q_DECL_OVERRIDE
;
89 void focusOutEvent(QFocusEvent
*) Q_DECL_OVERRIDE
;
92 void slotCurrentCharFormatChanged(const QTextCharFormat
&);
93 void slotCursorPositionChanged();
96 void slotSentenceCase();
97 void slotInsertCheckMark();
98 void slotReverseCase();
102 void enableRichTextActions(bool enabled
);
105 QColor mDefaultBackgroundColor
;
106 QColor mDefaultForegroundColor
;
108 KToggleAction
*m_textBold
;
109 KToggleAction
*m_textItalic
;
110 KToggleAction
*m_textUnderline
;
111 KToggleAction
*m_textStrikeOut
;
113 KToggleAction
*m_textAlignLeft
;
114 KToggleAction
*m_textAlignCenter
;
115 KToggleAction
*m_textAlignRight
;
116 KToggleAction
*m_textAlignBlock
;
118 KToggleAction
*m_textList
;
119 KToggleAction
*m_textSuper
;
120 KToggleAction
*m_textSub
;
122 QAction
*m_textIncreaseIndent
;
123 QAction
*m_textDecreaseIndent
;
125 QAction
*m_textColor
;
126 KFontAction
*m_textFont
;
127 KFontSizeAction
*m_textSize
;
129 KActionCollection
*m_actions
;
130 PimCommon::KActionMenuChangeCase
*mChangeCaseActionMenu
;
131 bool m_autoIndentMode
;