Welcome to mirror list, hosted at ThFree Co, Russian Federation.

pagerunner.h « qtjsruntime « programs « webodf « src « files_odfviewer « apps - github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 9c848acc1059256cc0bb647c74d3ead3b4a24f5b (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
#ifndef PAGERUNNER_H
#define PAGERUNNER_H

#include <QtCore/QTextStream>
#include <QtCore/QTime>
#include <QtWebKit/QWebPage>

class NAM;
class NativeIO;

class PageRunner : public QWebPage {
Q_OBJECT
private:
    QUrl url;
    NAM* nam;
    QTextStream out;
    QTextStream err;
    bool changed;
    QWidget* const view;
    QTime time;
    bool scriptMode;
    NativeIO* nativeio;
    QString exportpdf;
    QString exportpng;
    bool sawJSError;
public:
    PageRunner(const QStringList& args);
    ~PageRunner();
private slots:
    void finished(bool ok);
    void noteChange() {
        changed = true;
    }
    void reallyFinished();
    void slotInitWindowObjects();
    bool shouldInterruptJavaScript() {
        changed = true;
        return false;
    }
private:
    void javaScriptConsoleMessage(const QString& message, int lineNumber,
            const QString& sourceID) {
        changed = true;
        if (scriptMode) {
            err << message << endl;
        } else {
            err << sourceID << ":" << lineNumber << " " << message << endl;
        }
        sawJSError = true;
    }
    void javaScriptAlert(QWebFrame* /*frame*/, const QString& msg) {
        changed = true;
        err << "ALERT: " << msg << endl;
    }
    bool javaScriptPrompt(QWebFrame*, const QString&, const QString&, QString*){
        changed = true;
        return false;
    }
    void renderToFile(const QString& filename);
    void printToFile(const QString& filename);
    // overload because default impl was causing a crash
    QString userAgentForUrl(const QUrl&) const {
        return QString();
    }
    QMap<QString, QString> parseArguments(const QStringList& args);
};

#endif