summaryrefslogtreecommitdiffstats
path: root/python/pykde/sip/khtml/khtml_settings.sip
blob: b018c6e7046d900477014721f739d8e41f7e33d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
//
//     Copyright 2006 Jim Bublitz <jbublitz@nwinternet.com>
//     Earlier copyrights 1998 - 2005 Jim Bublitz and/or Phil Thompson
//     may also apply


//                 Generated by preSip
//            module khtml  version KDE 3.5.3


// This software is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; either version 2 of
// the License, or (at your option) any later version.
//
// This software is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public
// License along with this library; see the file COPYING.
// If not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.


class KHTMLSettings
{
%TypeHeaderCode
#include <khtml_settings.h>
%End


public:

    enum KJavaScriptAdvice
    {
        KJavaScriptDunno, 
        KJavaScriptAccept, 
        KJavaScriptReject
    };


    enum KAnimationAdvice
    {
        KAnimationDisabled, 
        KAnimationLoopOnce, 
        KAnimationEnabled
    };


%If ( KDE_3_2_0 -  )

    enum KJSWindowOpenPolicy
    {
        KJSWindowOpenAllow, 
        KJSWindowOpenAsk, 
        KJSWindowOpenDeny, 
        KJSWindowOpenSmart
    };


    enum KJSWindowStatusPolicy
    {
        KJSWindowStatusAllow, 
        KJSWindowStatusIgnore
    };


    enum KJSWindowMovePolicy
    {
        KJSWindowMoveAllow, 
        KJSWindowMoveIgnore
    };


    enum KJSWindowResizePolicy
    {
        KJSWindowResizeAllow, 
        KJSWindowResizeIgnore
    };


    enum KJSWindowFocusPolicy
    {
        KJSWindowFocusAllow, 
        KJSWindowFocusIgnore
    };

%End

                         KHTMLSettings ();
                         KHTMLSettings (const KHTMLSettings&);
    void                 init ();
    void                 init (KConfig*, bool = 1);
    bool                 changeCursor ();
    bool                 underlineLink ();
    bool                 hoverLink ();

%If ( KDE_3_4_0 -  )
    bool                 allowTabulation () const;
    bool                 autoSpellCheck () const;
%End

    KHTMLSettings::KAnimationAdvice showAnimations () const;
    QString              stdFontName () const;
    QString              fixedFontName () const;
    QString              serifFontName () const;
    QString              sansSerifFontName () const;
    QString              cursiveFontName () const;
    QString              fantasyFontName () const;
    void                 setStdFontName (const QString&);
    void                 setFixedFontName (const QString&);
    int                  minFontSize () const;
    int                  mediumFontSize () const;

%If ( KDE_3_2_0 -  )
    bool                 jsErrorsEnabled () const;
    void                 setJSErrorsEnabled (bool);
%End

    const QString&       encoding () const;

%If ( KDE_3_4_0 -  )
    bool                 followSystemColors () const;
%End

    const QColor&        textColor ();

%If ( KDE_3_4_0 -  )
    const QColor&        baseColor () const;
%End

    const QColor&        linkColor ();
    const QColor&        vLinkColor ();
    bool                 autoLoadImages ();

%If ( KDE_3_4_0 -  )
    bool                 unfinishedImageFrame () const;
%End


%If ( KDE_3_3_0 -  )
    bool                 isOpenMiddleClickEnabled ();
%End


%If ( KDE_3_1_0 -  )
    bool                 isBackRightClickEnabled ();
%End

    bool                 isJavaEnabled (const QString& = QString ::null );
    bool                 isJavaScriptEnabled (const QString& = QString ::null );
    bool                 isJavaScriptDebugEnabled (const QString& = QString ::null );

%If ( KDE_3_2_0 -  )
    bool                 isJavaScriptErrorReportingEnabled (const QString& = QString ::null ) const;
%End

    bool                 isPluginsEnabled (const QString& = QString ::null );

%If ( KDE_3_5_0 -  )
    bool                 isAdFiltered (const QString&) const;
    bool                 isAdFilterEnabled () const;
    bool                 isHideAdsEnabled () const;
    void                 addAdFilter (const QString&);
    bool                 accessKeysEnabled () const;
%End


%If ( KDE_3_2_0 -  )
    KHTMLSettings::KJSWindowOpenPolicy windowOpenPolicy (const QString& = QString ::null ) const;
    KHTMLSettings::KJSWindowMovePolicy windowMovePolicy (const QString& = QString ::null ) const;
    KHTMLSettings::KJSWindowResizePolicy windowResizePolicy (const QString& = QString ::null ) const;
    KHTMLSettings::KJSWindowStatusPolicy windowStatusPolicy (const QString& = QString ::null ) const;
    KHTMLSettings::KJSWindowFocusPolicy windowFocusPolicy (const QString& = QString ::null ) const;
%End

    static KJavaScriptAdvice strToAdvice (const QString&);
//ig     static void          splitDomainAdvice (const QString&, QString&, KHTMLSettings::KJavaScriptAdvice&, KHTMLSettings::KJavaScriptAdvice&);
    static const char*   adviceToStr (KHTMLSettings::KJavaScriptAdvice);

%If ( KDE_3_2_0 -  )
//ig     void                 readDomainSettings (KConfig*, bool, bool, KPerDomainSettings&);
%End

    QString              settingsToCSS () const;
    static const QString& availableFamilies ();
    QString              userStyleSheet () const;
    bool                 isFormCompletionEnabled () const;
    int                  maxFormCompletionItems () const;

%If ( KDE_3_1_1 -  )
    bool                 isAutoDelayedActionsEnabled () const;

%If ( KDE_3_5_0 -  )
    QValueList<QPair<QString,QChar>> fallbackAccessKeysAssignments () const;
    void                 setJSPopupBlockerPassivePopup (bool);
    bool                 jsPopupBlockerPassivePopup () const;
%End

%End


};  // class KHTMLSettings



%If (KDE_3_5_0 - )
%MappedType QValueList<QPair<QString,QChar>>
//converts a Python list of tuples (QString,QChar)
{
%TypeHeaderCode
#include <qvaluelist.h>
#include <qstring.h>
#include <khtml_settings.h>
#include <sipqtQString.h>
#include <sipqtQChar.h>
#include <sipkhtmlKHTMLSettings.h>
typedef QPair<QString,QChar> AssignPair;
%End

%ConvertFromTypeCode
    if (!sipCpp)
        return PyList_New(0);

    // Create the list
    PyObject *pylist;
    if ((pylist = PyList_New(0)) == NULL)
        return NULL;

    QValueList<AssignPair> *cpplist = (QValueList<AssignPair> *)sipCpp;
    PyObject *inst;

    // Get it.
    QValueList<AssignPair>::Iterator it;
    for( it = cpplist->begin(); it != cpplist->end(); ++it )
    {
        QString s = (*it).first;
        QChar c  = (*it).second;
        PyObject *pys = sipBuildResult (NULL, "N", new QString (s), sipClass_QString);
        PyObject *pyc = sipBuildResult (NULL, "N", new QChar (c), sipClass_QChar);
        if ((pys == NULL) || ((inst = Py_BuildValue ("NN", pys, pyc)) == NULL)
            || PyList_Append (pylist, inst) < 0)
        {
            Py_XDECREF (inst);
            Py_XDECREF (pys);
            Py_XDECREF (pyc);
            Py_DECREF (pylist);
            return NULL;
        }
    }

    return pylist;
%End


%ConvertToTypeCode
    if (sipIsErr == NULL)
        return PyList_Check(sipPy);

    QValueList<AssignPair> *cpplist = new QValueList<AssignPair>;

    QString p1;
    QChar p2;
    int iserr = 0;

    for (int i = 0; i < PyList_Size (sipPy); i++)
    {
        PyObject *elem = PyList_GET_ITEM (sipPy, i);
        PyObject *pyp1 = PyTuple_GET_ITEM (elem, 0);
        PyObject *pyp2 = PyTuple_GET_ITEM (elem, 1);
        p1 = *(QString *)sipForceConvertTo_QString (pyp1, &iserr);
        p2 = *(QChar *)sipForceConvertTo_QChar (pyp2, &iserr);

        if (iserr)
        {
            *sipIsErr = 1;
            delete cpplist;
            return 0;
        }

        cpplist->append (AssignPair (p1, p2));
    }

    *sipCppPtr = cpplist;

    return 1;
%End
};
%End