Remove commented code
[kdepim.git] / knotes / src / knoteedit.h
blob4007c1864c36300d8eed9166f7d6f8ca27a91a8c
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 *******************************************************************/
21 #ifndef KNOTEEDIT_H
22 #define KNOTEEDIT_H
24 #include "knotes_export.h"
25 #include <QTextCharFormat>
26 #include <QWidget>
28 #include <KTextEdit>
29 class QFont;
31 class QAction;
32 class KActionCollection;
33 class KFontAction;
34 class KFontSizeAction;
35 class KToggleAction;
36 class KNote;
37 namespace PimCommon
39 class KActionMenuChangeCase;
41 class KNOTES_EXPORT KNoteEdit : public KTextEdit
43 Q_OBJECT
44 public:
45 explicit KNoteEdit(KActionCollection *actions, QWidget *parent = Q_NULLPTR);
46 ~KNoteEdit();
48 void setNote(KNote *_note);
50 void setText(const QString &text);
51 QString text() const;
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;
61 public Q_SLOTS:
62 void setRichText(bool);
64 void textBold(bool);
65 void textStrikeOut(bool);
67 void slotTextColor();
69 void textAlignLeft();
70 void textAlignCenter();
71 void textAlignRight();
72 void textAlignBlock();
74 void textList();
76 void textSuperScript();
77 void textSubScript();
79 void textIncreaseIndent();
80 void textDecreaseIndent();
81 void setTextFontSize(int);
83 void slotTextBackgroundColor();
84 void slotInsertDate();
86 protected:
87 void keyPressEvent(QKeyEvent *) Q_DECL_OVERRIDE;
88 void focusInEvent(QFocusEvent *) Q_DECL_OVERRIDE;
89 void focusOutEvent(QFocusEvent *) Q_DECL_OVERRIDE;
91 private Q_SLOTS:
92 void slotCurrentCharFormatChanged(const QTextCharFormat &);
93 void slotCursorPositionChanged();
94 void slotUpperCase();
95 void slotLowerCase();
96 void slotSentenceCase();
97 void slotInsertCheckMark();
98 void slotReverseCase();
99 private:
100 void autoIndent();
102 void enableRichTextActions(bool enabled);
104 private:
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;
128 KNote *m_note;
129 KActionCollection *m_actions;
130 PimCommon::KActionMenuChangeCase *mChangeCaseActionMenu;
131 bool m_autoIndentMode;
134 #endif