This repository has been archived by the owner on Jun 9, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ehaulervalidateaction.cpp
62 lines (55 loc) · 2.04 KB
/
ehaulervalidateaction.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/****************************************************
edifreader.cpp
Part of Data Import for Ontario Tire Stewardship
Copyright (C) Joshua Netterfield 2012
All rights reserved.
*****************************************************/
#include "ehaulervalidateaction.h"
#include <QSettings>
EHaulerValidateAction::EHaulerValidateAction(EBrowser &browser, const QString ®Number) : EAction(browser), s_regNumber(regNumber)
{
browser.loadPage("http://www.ontariots.ca//?q=haulerwebform/validate");
connect(&browser,SIGNAL(ready()),this,SLOT(continue1()));
}
void EHaulerValidateAction::continue1()
{
disconnect(&s_browser,SIGNAL(ready()),this,SLOT(continue1()));
if(s_browser.htmlContains("Your online OTS Hauler Account is not activated for this Web User ID"))
{
emit error("Your online OTS Hauler Account is not activated for this Web User ID");
return;
}
s_browser.setInput("edit-hauler-reg-no",s_regNumber);
s_browser.clickInput("edit-submit");
connect(&s_browser,SIGNAL(ready()),this,SLOT(continue2()));
}
void EHaulerValidateAction::continue2()
{
RUN_SECOND_TIME
disconnect(&s_browser,SIGNAL(ready()),this,SLOT(continue2()));
if(s_browser.htmlContains("Your online OTS Hauler Account is not activated for this Web User ID"))
{
emit error("Your online OTS Hauler Account is not activated for this Web User ID");
return;
}
else if(s_browser.htmlContains("<legend>Claim Form</legend>"))
{
QSettings settings("Nettek","Data Import for Ontario Tire Stewardship");
QStringList keys=settings.value("HaulerNums",QStringList()).toStringList();
for(int i=0;i<keys.size();i++)
{
if(keys.at(i)==s_regNumber)
{
keys.removeAt(i);
--i;
}
}
keys.push_back(s_regNumber);
settings.setValue("HaulerNums",keys);
emit done();
}
else
{
emit error("An unknown error occured while validating the hauler number.");
}
}