~ubuntu-branches/ubuntu/wily/kdebase/wily

« back to all changes in this revision

Viewing changes to apps/konqueror/settings/konqhtml/policies.h

  • Committer: Bazaar Package Importer
  • Author(s): Philip Muškovac, Jonathan Riddell, Felix Geyer
  • Date: 2011-03-03 16:25:47 UTC
  • mfrom: (1.1.58 upstream)
  • Revision ID: james.westby@ubuntu.com-20110303162547-2zf9j33cu6j5gj0a
Tags: 4:4.6.1a-0ubuntu1
[ Jonathan Riddell ]
* New upstream release
* Update kde-sc-dev-latest version

[ Felix Geyer ]
* Reduce the x-www-browser priority for konqueror to 30 as rekonq is the
  default Kubuntu browser.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
  Copyright (c) 2002 Leo Savernik <l.savernik@aon.at>
3
 
  Derived from jsopt.h, code copied from there is copyrighted to its
4
 
  respective owners.
5
 
 
6
 
  This program is free software; you can redistribute it and/or modify
7
 
  it under the terms of the GNU General Public License as published by
8
 
  the Free Software Foundation; either version 2 of the License, or
9
 
  (at your option) any later version.
10
 
 
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.
15
 
 
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
 
 
20
 
*/
21
 
 
22
 
#ifndef __POLICIES_H__
23
 
#define __POLICIES_H__
24
 
 
25
 
 
26
 
#include <ksharedconfig.h>
27
 
 
28
 
// special value for inheriting a global policy
29
 
#define INHERIT_POLICY          32767
30
 
 
31
 
/**
32
 
 * @short Contains the basic policies and methods for their manipulation.
33
 
 *
34
 
 * This class provides access to the basic policies that are common
35
 
 * to all features.
36
 
 *
37
 
 * @author Leo Savernik
38
 
 */
39
 
class Policies {
40
 
public:
41
 
  /**
42
 
   * constructor
43
 
   * @param config configuration to initialize this instance from
44
 
   * @param group config group to use if this instance contains the global
45
 
   *    policies (global == true)
46
 
   * @param global true if this instance contains the global policy settings,
47
 
   *    false if it contains policies specific to a domain.
48
 
   * @param domain name of the domain this instance is used to configure the
49
 
   *    policies for (case insensitive, ignored if global == true)
50
 
   * @param prefix prefix to use for configuration keys. The domain-specific
51
 
   *    policies use of the format "&lt;feature&gt;." (note the trailing dot).
52
 
   *    Global policies have no prefix, it is ignored if global == true.
53
 
   * @param feature_key key of the "feature enabled" policy. The final
54
 
   *    key the policy is stored under will be prefix + featureKey.
55
 
   */
56
 
  Policies(KSharedConfig::Ptr config, const QString &group, bool global,
57
 
                const QString &domain, const QString &prefix,
58
 
                const QString &feature_key);
59
 
 
60
 
  virtual ~Policies();
61
 
 
62
 
  /**
63
 
   * Returns true if this is the global policies object
64
 
   */
65
 
  bool isGlobal() const {
66
 
    return is_global;
67
 
  }
68
 
 
69
 
  /** sets a new domain for this policy
70
 
   * @param domain domain name, will be converted to lowercase
71
 
   */
72
 
  void setDomain(const QString &domain);
73
 
 
74
 
  /**
75
 
   * Returns whether the "feature enabled" policy is inherited.
76
 
   */
77
 
  bool isFeatureEnabledPolicyInherited() const {
78
 
    return feature_enabled == INHERIT_POLICY;
79
 
  }
80
 
  /** inherits "feature enabled" policy */
81
 
  void inheritFeatureEnabledPolicy() {
82
 
    feature_enabled = INHERIT_POLICY;
83
 
  }
84
 
  /**
85
 
   * Returns whether this feature is enabled.
86
 
   *
87
 
   * This will return an illegal value if isFeatureEnabledPolicyInherited
88
 
   * is true.
89
 
   */
90
 
  bool isFeatureEnabled() const {
91
 
    return (bool)feature_enabled;
92
 
  }
93
 
  /**
94
 
   * Enables/disables this feature
95
 
   * @param on true will enable it, false disable it
96
 
   */
97
 
  void setFeatureEnabled(int on) {
98
 
    feature_enabled = on;
99
 
  }
100
 
 
101
 
  /**
102
 
   * (re)loads settings from configuration file given in the constructor.
103
 
   *
104
 
   * Implicitely sets the group given in the constructor. Don't forget to
105
 
   * call this method from derived methods.
106
 
   */
107
 
  virtual void load();
108
 
  /**
109
 
   * saves current settings to the configuration file given in the constructor
110
 
   *
111
 
   * Implicitely sets the group given in the constructor. Don't forget to
112
 
   * call this method from derived methods.
113
 
   */
114
 
  virtual void save();
115
 
  /**
116
 
   * restores the default settings
117
 
   */
118
 
  virtual void defaults();
119
 
 
120
 
protected:
121
 
  // true or false or INHERIT_POLICY
122
 
  unsigned int feature_enabled;
123
 
 
124
 
  bool is_global;
125
 
  KSharedConfig::Ptr config;
126
 
  QString groupname;
127
 
  QString domain;
128
 
  QString prefix;
129
 
  QString feature_key;
130
 
};
131
 
 
132
 
#endif          // __POLICIES_H__
133