Skip to content

Commit

Permalink
request protect: fixed wrong names of buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
benapetr committed May 1, 2019
1 parent a0e1a37 commit c912ae6
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 27 deletions.
46 changes: 23 additions & 23 deletions src/huggle_ui/requestprotect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand All @@ -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"));
Expand All @@ -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();
}
9 changes: 5 additions & 4 deletions src/huggle_ui/requestprotect.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit c912ae6

Please sign in to comment.