11 #include "editquery.hpp"
13 using namespace Huggle;
15 EditQuery::EditQuery()
27 EditQuery::~EditQuery()
37 this->Status = StatusProcessing;
38 this->StartTime = QDateTime::currentDateTime();
41 qToken->
Parameters =
"prop=info&intoken=edit&titles=" + QUrl::toPercentEncoding(
page);
43 qToken->
Target =
"Retrieving token to edit " +
page;
61 if (qToken->
Result->Failed)
64 this->
Result->Failed =
true;
73 QDomNodeList l = d.elementsByTagName(
"page");
77 this->
Result->Failed =
true;
85 QDomElement element = l.at(0).toElement();
86 if (!element.attributes().contains(
"edittoken"))
89 this->
Result->Failed =
true;
97 _Token = element.attribute(
"edittoken");
107 "&summary=" + QUrl::toPercentEncoding(this->
summary) +
"&token=" + QUrl::toPercentEncoding(
_Token);
120 QDomNodeList l = d.elementsByTagName(
"edit");
123 QDomElement element = l.at(0).toElement();
124 if (element.attributes().contains(
"result"))
126 if (element.attribute(
"result") ==
"Success")
131 item.Result =
"Successful";
132 item.
Type = HistoryEdit;
133 item.Target = this->
page;
static void Log(QString Message)
Write text to terminal as well as ring log.
History * _History
Pointer to history.
QString Target
This is optional property which contains a label of target this query is for.
void Process()
Execute query.
QString summary
Edit summary.
virtual bool Processed()
Returns true in case that query is processed.
void UnregisterConsumer(const int consumer)
This function will remove a string which prevent the object from being removed.
bool Minor
Whether the edit is minor or not.
void RegisterConsumer(const int consumer)
Registers a consumer.
QString page
Page that is going to be edited.
static void AppendQuery(Query *item)
Insert a query to internal list of running queries, so that they can be watched This will insert it t...
ApiQuery * qEdit
Api query to edit page.
QueryType Type
Type of a query.
void Prepend(HistoryItem item)
Insert a new item to top of list.
void SetAction(const Action action)
Change the action type.
QString text
Text a page will be replaced with.
bool UsingPOST
Whether the query will submit parameters using POST data.
bool Processed()
Returns true in case that query is processed.
HistoryType Type
Type of item.
static void DebugLog(QString Message, unsigned int Verbosity=1)
This log is only shown if verbosity is same or larger than requested verbosity.
QString ErrorMessage
If query is in error the reason for error is stored here.
QString Parameters
Parameters for action, for example page title.
History consist of these items.
void Lock()
Lock this object so that other threads can't change consumers or modify its properties.
static MainWindow * Main
Pointer to main.
This class can be used to execute any kind of api query on any wiki.
QString _Token
Edit token, will be retrieved during request.
QString Data
Data retrieved by query.
QueryResult * Result
Result of query, see documentation of QueryResult for more.