1 /* Copyright 2009 Thomas McGuire <mcguire@kde.org>
3 This program is free software; you can redistribute it and/or
4 modify it under the terms of the GNU General Public License as
5 published by the Free Software Foundation; either version 2 of
6 the License or (at your option) version 3 or any later version
7 accepted by the membership of KDE e.V. (or its successor approved
8 by the membership of KDE e.V.), which shall act as a proxy
9 defined in Section 14 of version 3 of the license.
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, see <http://www.gnu.org/licenses/>.
19 #ifndef HTMLQUOTECOLORER_H
20 #define HTMLQUOTECOLORER_H
24 namespace MessageViewer
{
27 * Little helper class that takes a HTML source as input and finds all
28 * lines that are quoted with '>' or '|'. The HTML text is then modified so
29 * that the quoted lines appear in the defined quote colors.
31 class HTMLQuoteColorer
38 * Sets the quote color of the specific leve.
39 * This class supports 3 levels, from 0 to 2.
40 * Level 2 is the most quoted, with three quote signs in front of the line, and
41 * level 0 is the least quoted, with one quote sign in front of the line.
43 * If you don't call this, the color of the quoting will be black.
45 void setQuoteColor( int level
, const QColor
&color
);
48 * Do the work and add nice colors to the HTML.
49 * @param htmlSource the input HTML code
50 * @return the modified HTML code, without any <body>, <html> or <head> tags
52 QString
process( const QString
&htmlSource
);
56 QColor mQuoteColors
[3];