Permalink
Browse files

New feature

  • Loading branch information...
benapetr committed Jan 26, 2015
1 parent 5495a60 commit ebc1b69b970aa659ee05ba65e81a43ff90359fce
Showing with 23 additions and 0 deletions.
  1. +22 −0 src/enwiki.cpp
  2. +1 −0 src/enwiki.h
View
@@ -13,6 +13,7 @@
#include <core.hpp>
#include <collectable_smartptr.hpp>
#include <localization.hpp>
#include <QMessageBox>
#include <query.hpp>
#include <querypool.hpp>
#include <mainwindow.hpp>
@@ -21,6 +22,7 @@
#include <wikiedit.hpp>
#include <wikisite.hpp>
#include <wikipage.hpp>
#include <wikiuser.hpp>
#include <speedyform.hpp>
#include <syslog.hpp>
#include <configuration.hpp>
@@ -70,6 +72,26 @@ void enwiki::Hook_MainWindowOnLoad(void *window)
connect(this->menuProd, SIGNAL(triggered()), this, SLOT(ClickPROD()));
}
bool enwiki::Hook_RevertPreflight(void *edit)
{
if (edit == nullptr)
return true;
WikiEdit *E = (WikiEdit*)edit;
if (E->GetSite()->Name != "enwiki")
return true;
if (E->Page->FounderKnown() && E->Page->GetFounder() == E->User->Username)
{
int result = Generic::MessageBox("Revert", "This edit was made by a person who created this page, do you want to request a speedy deletion instead?",
Huggle::MessageBoxStyleQuestion);
if (result == QMessageBox::Yes)
{
this->Window->RequestPD(E);
return false;
}
}
return true;
}
bool enwiki::Hook_SpeedyBeforeOK(void *edit, void *form)
{
SpeedyForm *sw = (SpeedyForm*)form;
View
@@ -42,6 +42,7 @@ class enwiki : public QDeclarativeItem, public Huggle::iExtension
QString GetExtensionDescription() { return "Various tools for english wikipedia"; }
QString GetExtensionVersion() { return "1.0.0"; }
QAction *menu;
bool Hook_RevertPreflight(void *edit);
bool Hook_SpeedyBeforeOK(void *edit, void *form);
bool RequestCore() { return true; }
bool RequestNetwork() { return true; }

0 comments on commit ebc1b69

Please sign in to comment.