Merge "persistent color scheme selection"
[trojita.git] / src / Gui / ComposerTextEdit.h
blobef1be8c5d1ba905a563d535b16026e5c9a1aa6c8
1 /* Copyright (C) 2012 Thomas Lübking <thomas.luebking@gmail.com>
3 This file is part of the Trojita Qt IMAP e-mail client,
4 http://trojita.flaska.net/
6 This program is free software; you can redistribute it and/or
7 modify it under the terms of the GNU General Public License as
8 published by the Free Software Foundation; either version 2 of
9 the License or (at your option) version 3 or any later version
10 accepted by the membership of KDE e.V. (or its successor approved
11 by the membership of KDE e.V.), which shall act as a proxy
12 defined in Section 14 of version 3 of the license.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>.
23 #pragma once
25 class QTimer;
27 #include <QList>
28 #include <QUrl>
29 #include <QTextEdit>
31 class ComposerTextEdit : public QTextEdit {
32 Q_OBJECT
33 public:
34 explicit ComposerTextEdit(QWidget *parent = 0);
35 /**
36 * use the view to display a notification for @p timeout ms
37 * using an empty or null string will clear the notification at once
38 * a @p timeout of 0ms shows the notification until it's replaced or reset
40 void notify(const QString &n, uint timeout = 0);
41 /** 80em viewport **/
42 int idealWidth() const;
43 signals:
44 void sendRequest();
45 void urlsAdded(QList<QUrl> urls);
46 protected:
47 /** DND reimplementation **/
48 bool canInsertFromMimeData( const QMimeData * source ) const;
49 void insertFromMimeData(const QMimeData *source);
50 void keyPressEvent(QKeyEvent *event);
51 void keyReleaseEvent(QKeyEvent *event);
52 /** painter reimplementation for notification **/
53 void paintEvent(QPaintEvent *pe);
54 virtual void contextMenuEvent(QContextMenuEvent *e);
55 private slots:
56 void resetNotification();
57 void slotPasteAsQuotation();
58 private:
59 QString m_notification;
60 QTimer *m_notificationTimer;
61 bool m_couldBeSendRequest;
62 QAction *m_pasteQuoted;
63 int m_wrapIndicatorOffset;
64 QColor m_wrapIndicatorColor;