diff --git a/src/huggle_ui/requestprotect.cpp b/src/huggle_ui/requestprotect.cpp index be481ebc3..49cbac6b5 100644 --- a/src/huggle_ui/requestprotect.cpp +++ b/src/huggle_ui/requestprotect.cpp @@ -142,27 +142,6 @@ void RequestProtect::Tick() } } -void Huggle::RequestProtect::on_pushButton_clicked() -{ - this->qRFPPage = new ApiQuery(ActionQuery, this->page->GetSite()); - // if this wiki has the requests in separate section, get it, if not, we get a whole page - if (this->page->GetSite()->GetProjectConfig()->RFPP_Section == 0) - { - this->qRFPPage->Parameters = "prop=revisions&rvprop=" + QUrl::toPercentEncoding("timestamp|user|comment|content") + - "&titles=" + QUrl::toPercentEncoding(this->page->GetSite()->GetProjectConfig()->RFPP_Page); - } else - { - this->qRFPPage->Parameters = "prop=revisions&rvprop=" + QUrl::toPercentEncoding("timestamp|user|comment|content") + - "&titles=" + QUrl::toPercentEncoding(this->page->GetSite()->GetProjectConfig()->RFPP_Page) + - "&rvsection=" + QString::number(this->page->GetSite()->GetProjectConfig()->RFPP_Section); - } - QueryPool::HugglePool->AppendQuery(this->qRFPPage); - this->qRFPPage->Process(); - this->tm->start(HUGGLE_TIMER); - this->ui->pushButton_RequestProtection->setText(_l("retrieving")); - this->ui->pushButton_RequestProtection->setEnabled(false); -} - QString RequestProtect::ProtectionType() { if (this->ui->radioButton_Indefinite->isChecked()) @@ -172,7 +151,7 @@ QString RequestProtect::ProtectionType() return this->qRFPPage->GetSite()->GetProjectConfig()->RFPP_Temporary; } -void RequestProtect::Fail(QString message) +void RequestProtect::Fail(const QString &message) { QMessageBox mb; mb.setWindowTitle(_l("error")); @@ -186,7 +165,28 @@ void RequestProtect::Fail(QString message) this->ui->pushButton_RequestProtection->setText(_l("request")); } -void Huggle::RequestProtect::on_pushButton_2_clicked() +void RequestProtect::on_pushButton_RequestProtection_clicked() +{ + this->qRFPPage = new ApiQuery(ActionQuery, this->page->GetSite()); + // if this wiki has the requests in separate section, get it, if not, we get a whole page + if (this->page->GetSite()->GetProjectConfig()->RFPP_Section == 0) + { + this->qRFPPage->Parameters = "prop=revisions&rvprop=" + QUrl::toPercentEncoding("timestamp|user|comment|content") + + "&titles=" + QUrl::toPercentEncoding(this->page->GetSite()->GetProjectConfig()->RFPP_Page); + } else + { + this->qRFPPage->Parameters = "prop=revisions&rvprop=" + QUrl::toPercentEncoding("timestamp|user|comment|content") + + "&titles=" + QUrl::toPercentEncoding(this->page->GetSite()->GetProjectConfig()->RFPP_Page) + + "&rvsection=" + QString::number(this->page->GetSite()->GetProjectConfig()->RFPP_Section); + } + QueryPool::HugglePool->AppendQuery(this->qRFPPage); + this->qRFPPage->Process(); + this->tm->start(HUGGLE_TIMER); + this->ui->pushButton_RequestProtection->setText(_l("retrieving")); + this->ui->pushButton_RequestProtection->setEnabled(false); +} + +void RequestProtect::on_pushButton_Cancel_clicked() { this->close(); } diff --git a/src/huggle_ui/requestprotect.hpp b/src/huggle_ui/requestprotect.hpp index af3ac8c5c..35217b7b4 100644 --- a/src/huggle_ui/requestprotect.hpp +++ b/src/huggle_ui/requestprotect.hpp @@ -37,14 +37,15 @@ namespace Huggle Q_OBJECT public: explicit RequestProtect(WikiPage *wikiPage, QWidget *parent = nullptr); - ~RequestProtect(); + ~RequestProtect() override; private slots: void Tick(); - void on_pushButton_clicked(); - void on_pushButton_2_clicked(); + void on_pushButton_RequestProtection_clicked(); + void on_pushButton_Cancel_clicked(); + private: QString ProtectionType(); - void Fail(QString message); + void Fail(const QString &message); QString Timestamp; WikiPage *page; QTimer *tm;