1 | /* |
2 | * spellingfilter.h |
3 | * |
4 | * Copyright (c) 2002 Dave Corrie <kde@davecorrie.com> |
5 | * |
6 | * This library is free software; you can redistribute it and/or |
7 | * modify it under the terms of the GNU Library General Public |
8 | * License as published by the Free Software Foundation; either |
9 | * version 2 of the License, or (at your option) any later version. |
10 | * |
11 | * This library 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 GNU |
14 | * Library General Public License for more details. |
15 | * |
16 | * You should have received a copy of the GNU Library General Public License |
17 | * along with this library; see the file COPYING.LIB. If not, write to |
18 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
19 | * Boston, MA 02110-1301, USA. |
20 | */ |
21 | /** |
22 | @file |
23 | This file is part of the KDEPIM Utilities library and provides the |
24 | SpellingFilter class. |
25 | |
26 | @brief |
27 | Filters message text that should not be spellchecked. |
28 | |
29 | @author Dave Corrie \<kde@davecorrie.com\> |
30 | */ |
31 | |
32 | #ifndef KPIMUTILS_SPELLINGFILTER_H |
33 | #define KPIMUTILS_SPELLINGFILTER_H |
34 | |
35 | #include "kpimutils_export.h" |
36 | #include "linklocator.h" |
37 | |
38 | #include <QtCore/QString> |
39 | #include <QtCore/QStringList> |
40 | |
41 | namespace KPIMUtils { |
42 | |
43 | /** @deprecated unused, scheduled for removal in KF5. */ |
44 | class KPIMUTILS_DEPRECATED_EXPORT SpellingFilter |
45 | { |
46 | public: |
47 | enum UrlFiltering { |
48 | DontFilterUrls, |
49 | FilterUrls |
50 | }; |
51 | enum EmailAddressFiltering { |
52 | DontFilterEmailAddresses, |
53 | FilterEmailAddresses |
54 | }; |
55 | |
56 | SpellingFilter( const QString &text, const QString "ePrefix, |
57 | UrlFiltering filterUrls = FilterUrls, |
58 | EmailAddressFiltering filterEmailAddresses = FilterEmailAddresses, |
59 | const QStringList &filterStrings = QStringList() ); |
60 | ~SpellingFilter(); |
61 | |
62 | QString originalText() const; |
63 | QString filteredText() const; |
64 | |
65 | class TextCensor; |
66 | |
67 | private: |
68 | //@cond PRIVATE |
69 | class Private; |
70 | Private *const d; |
71 | //@endcond |
72 | }; |
73 | |
74 | class SpellingFilter::TextCensor : public LinkLocator |
75 | { |
76 | public: |
77 | TextCensor( const QString &s ); |
78 | |
79 | void censorQuotations( const QString "ePrefix ); |
80 | void censorUrls(); |
81 | void censorEmailAddresses(); |
82 | void censorString( const QString &s ); |
83 | |
84 | QString censoredText() const; |
85 | |
86 | private: |
87 | bool atLineStart() const; |
88 | void skipLine(); |
89 | |
90 | bool atQuotation( const QString "ePrefix ) const; |
91 | void skipQuotation( const QString "ePrefix ); |
92 | void findQuotation( const QString "ePrefix ); |
93 | |
94 | void findEmailAddress(); |
95 | }; |
96 | |
97 | } |
98 | |
99 | #endif |
100 | |