44 #include <QtScript/qscriptengine.h> 45 #include <QtNetwork/qnetworkrequest.h> 46 #include <QtNetwork/qnetworkreply.h> 47 #include <QtCore/qfile.h> 49 #include <private/qdeclarativeengine_p.h> 50 #include <private/qdeclarativeglobalscriptclass_p.h> 57 :
QObject(engine), m_engine(engine), m_network(0), m_reply(0), m_url(url), m_redirectCount(0)
109 #define INCLUDE_MAXIMUM_REDIRECT_RECURSION 15 229 engine->
evaluate(code, urlString, 1);
257 if (url.isRelative()) {
262 urlString = url.toString();
289 engine->
evaluate(code, urlString, 1);
The QVariant class acts like a union for the most common Qt data types.
static QString urlToLocalFileOrQrc(const QUrl &url)
static QScriptEngine * getScriptEngine(QDeclarativeEngine *e)
The QScriptContext class represents a Qt Script function invocation.
QScriptValue newUrlContext(QDeclarativeContextData *, QObject *, const QString &)
void setUrl(const QUrl &url)
Sets the URL this network request is referring to to be url.
NetworkError error() const
Returns the error that was found during the processing of this request.
QScriptValue evaluate(const QString &program, const QString &fileName=QString(), int lineNumber=1)
Evaluates program, using lineNumber as the base line number, and returns the result of the evaluation...
virtual QNetworkAccessManager * networkAccessManager()
#define QT_END_NAMESPACE
This macro expands to.
bool isFunction() const
Returns true if this QScriptValue is a function; otherwise returns false.
QString toString(FormattingOptions options=None) const
Returns the human-displayable string representation of the URL.
bool open(OpenMode flags)
Opens the file using OpenMode mode, returning true if successful; otherwise false.
QVariant attribute(QNetworkRequest::Attribute code) const
Returns the attribute associated with the code code.
static QScriptValue include(QScriptContext *ctxt, QScriptEngine *engine)
static QDeclarativeEngine * getEngine(QScriptEngine *e)
The QByteArray class provides an array of bytes.
QScriptValue throwError(Error error, const QString &text)
Throws an error with the given text.
bool isEmpty() const
Returns true if the URL has no data; otherwise returns false.
QString toString() const
Returns the string value of this QScriptValue, as defined in ECMA-262 section 9.8, "ToString".
QDeclarativeGlobalScriptClass * globalClass
QDeclarativeGuard< QNetworkReply > m_reply
static LibLoadStatus status
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
static QScriptValue worker_include(QScriptContext *ctxt, QScriptEngine *engine)
void popContext()
Pops the current execution context and restores the previous one.
QDeclarativeContextData * contextFromValue(const QScriptValue &)
The QUrl class provides a convenient interface for working with URLs.
The QString class provides a Unicode character string.
The QObject class is the base class of all Qt objects.
static QDeclarativeEnginePrivate * get(QDeclarativeEngine *e)
static QDeclarativeParser::Object::ScriptBlock::Pragmas extractPragmas(QString &)
bool isRelative() const
Returns true if the URL is relative; otherwise returns false.
static QDeclarativeScriptEngine * get(QScriptEngine *e)
void setActivationObject(const QScriptValue &activation)
Sets the activation object of this QScriptContext to be the given activation.
const QScriptValue & staticGlobalObject() const
The QScriptEngine class provides an environment for evaluating Qt Script code.
#define QT_BEGIN_NAMESPACE
This macro expands to.
void setCallback(const QScriptValue &)
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
QDeclarativeGuardedContextData m_context
static QString fromUtf8(const char *, int size=-1)
Returns a QString initialized with the first size bytes of the UTF-8 string str.
QDeclarativeEngine * m_engine
static const char * data(const QByteArray &arr)
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal...
QScriptValue newObject()
Creates a QtScript object of class Object.
QScriptValue result() const
QNetworkReply * get(const QNetworkRequest &request)
Posts a request to obtain the contents of the target request and returns a new QNetworkReply object o...
QUrl toUrl() const
Returns the variant as a QUrl if the variant has type() Url ; otherwise returns an invalid QUrl...
int argumentCount() const
Returns the number of arguments passed to the function in this invocation.
static QScriptValue resultValue(QScriptEngine *, Status status=Loading)
QScriptValue callback() const
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
Disconnects signal in object sender from method in object receiver.
QScriptValue data() const
Returns the internal data of this QScriptValue object.
void setProperty(const QString &name, const QScriptValue &value, const PropertyFlags &flags=KeepExistingFlags)
Sets the value of this QScriptValue's property with the given name to the given value.
The QFile class provides an interface for reading from and writing to files.
The QDeclarativeEngine class provides an environment for instantiating QML components.
QScriptEngine * m_scriptEngine
QUrl urlFromValue(const QScriptValue &)
QDeclarativeInclude(const QUrl &, QDeclarativeEngine *, QScriptContext *ctxt)
static QScriptValue scopeChainValue(QScriptContext *, int index)
#define INCLUDE_MAXIMUM_REDIRECT_RECURSION
QByteArray readAll()
Reads all available data from the device, and returns it as a QByteArray.
void clearExceptions()
Clears any uncaught exceptions in this engine.
The QNetworkRequest class holds a request to be sent with QNetworkAccessManager.
QScriptValue undefinedValue()
Returns a QScriptValue of the primitive type Undefined.
QScriptValue newArray(uint length=0)
Creates a QtScript object of class Array with the given length.
QUrl resolved(const QUrl &relative) const
Returns the result of the merge of this URL with relative.
bool isValid() const
Returns true if the storage type of this variant is not QVariant::Invalid; otherwise returns false...
void pushScope(const QScriptValue &object)
Adds the given object to the front of this context's scope chain.
bool hasUncaughtException() const
Returns true if the last script evaluation resulted in an uncaught exception; otherwise returns false...
The QScriptValue class acts as a container for the Qt Script data types.
QScriptValue call(const QScriptValue &thisObject=QScriptValue(), const QScriptValueList &args=QScriptValueList())
Calls this QScriptValue as a function, using thisObject as the `this' object in the function call...
void deleteLater()
Schedules this object for deletion.
QScriptValue argument(int index) const
Returns the function argument at the given index.
bool isValid() const
Returns true if this QScriptValue is valid; otherwise returns false.
static QScriptContext * pushCleanContext(QScriptEngine *)
Enters a new execution context and returns the associated QScriptContext object.
QScriptValue uncaughtException() const
Returns the current uncaught exception, or an invalid QScriptValue if there is no uncaught exception...
void setData(const QScriptValue &data)
Sets the internal data of this QScriptValue object.
QNetworkAccessManager * m_network
QDeclarativeContextScriptClass * contextClass