• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

messageviewer

  • sources
  • kde-4.12
  • kdepim
  • messageviewer
  • adblock
adblockrulenullimpl.cpp
Go to the documentation of this file.
1 /* ============================================================
2 *
3 * This file is a part of the rekonq project
4 * Copyright (c) 2013 Montel Laurent <montel@kde.org>
5 * based on code from rekonq
6 * Copyright (C) 2011-2012 by Andrea Diamantini <adjam7 at gmail dot com>
7 *
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation; either version 2 of
12 * the License or (at your option) version 3 or any later version
13 * accepted by the membership of KDE e.V. (or its successor approved
14 * by the membership of KDE e.V.), which shall act as a proxy
15 * defined in Section 14 of version 3 of the license.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program. If not, see <http://www.gnu.org/licenses/>.
24 *
25 * ============================================================ */
26 
27 
28 // Self Includes
29 #include "adblockrulenullimpl.h"
30 
31 // Qt Includes
32 #include <QStringList>
33 
34 using namespace MessageViewer;
35 AdBlockRuleNullImpl::AdBlockRuleNullImpl(const QString &filter)
36  : AdBlockRuleImpl(filter)
37 {
38 }
39 
40 
41 bool AdBlockRuleNullImpl::match(const QNetworkRequest &, const QString &, const QString &) const
42 {
43  return false;
44 }
45 
46 
47 bool AdBlockRuleNullImpl::isNullFilter(const QString &filter)
48 {
49  QString parsedLine = filter;
50 
51  const int optionsNumber = parsedLine.lastIndexOf(QLatin1Char('$'));
52  if (optionsNumber == 0)
53  return false;
54 
55  const QStringList options(parsedLine.mid(optionsNumber + 1).split(QLatin1Char(',')));
56 
57  Q_FOREACH(const QString & option, options)
58  {
59  // NOTE:
60  // I moved the check from option == QLatin1String to option.endsWith()
61  // to check option && ~option. Hope it will NOT be a problem...
62 
63  // third_party: managed inside adblockrulefallbackimpl
64  if (option.endsWith(QLatin1String("third-party")))
65  return false;
66 
67  // script
68  if (option.endsWith(QLatin1String("script")))
69  return true;
70 
71  // image
72  if (option.endsWith(QLatin1String("image")))
73  return true;
74 
75  // background
76  if (option.endsWith(QLatin1String("background")))
77  return true;
78 
79  // stylesheet
80  if (option.endsWith(QLatin1String("stylesheet")))
81  return true;
82 
83  // object
84  if (option.endsWith(QLatin1String("object")))
85  return true;
86 
87  // xbl
88  if (option.endsWith(QLatin1String("xbl")))
89  return true;
90 
91  // ping
92  if (option.endsWith(QLatin1String("ping")))
93  return true;
94 
95  // xmlhttprequest
96  if (option.endsWith(QLatin1String("xmlhttprequest")))
97  return true;
98 
99  // object_subrequest
100  if (option.endsWith(QLatin1String("object-subrequest")))
101  return true;
102 
103  // dtd
104  if (option.endsWith(QLatin1String("dtd")))
105  return true;
106 
107  // subdocument
108  if (option.endsWith(QLatin1String("subdocument")))
109  return true;
110 
111  // document
112  if (option.endsWith(QLatin1String("document")))
113  return true;
114 
115  // other
116  if (option.endsWith(QLatin1String("other")))
117  return true;
118 
119  // collapse
120  if (option.endsWith(QLatin1String("collapse")))
121  return true;
122  }
123 
124  return false;
125 }
126 
127 
128 QString AdBlockRuleNullImpl::ruleString() const
129 {
130  return QString();
131 }
132 
133 
134 QString AdBlockRuleNullImpl::ruleType() const
135 {
136  return QLatin1String("AdBlockRuleNullImpl");
137 }
MessageViewer::AdBlockRuleNullImpl::ruleString
QString ruleString() const
Definition: adblockrulenullimpl.cpp:128
AdBlockRuleImpl
Definition: adblockruleimpl.h:32
adblockrulenullimpl.h
MessageViewer::AdBlockRuleNullImpl::match
bool match(const QNetworkRequest &, const QString &, const QString &) const
Definition: adblockrulenullimpl.cpp:41
MessageViewer::AdBlockRuleNullImpl::isNullFilter
static bool isNullFilter(const QString &filter)
Definition: adblockrulenullimpl.cpp:47
MessageViewer::AdBlockRuleNullImpl::AdBlockRuleNullImpl
AdBlockRuleNullImpl(const QString &filter)
Definition: adblockrulenullimpl.cpp:35
MessageViewer::AdBlockRuleNullImpl::ruleType
QString ruleType() const
Definition: adblockrulenullimpl.cpp:134
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:55:57 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

messageviewer

Skip menu "messageviewer"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal