Huggle  build:^490^dce1e5c
 All Classes Namespaces Functions Variables Enumerations Enumerator Pages
login.cpp
1 //This program is free software: you can redistribute it and/or modify
2 //it under the terms of the GNU General Public License as published by
3 //the Free Software Foundation, either version 3 of the License, or
4 //(at your option) any later version.
5 
6 //This program is distributed in the hope that it will be useful,
7 //but WITHOUT ANY WARRANTY; without even the implied warranty of
8 //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 //GNU General Public License for more details.
10 
11 #include "login.hpp"
12 #include "ui_login.h"
13 
14 using namespace Huggle;
15 
16 QString Login::Test = "<login result=\"NeedToken\" token=\"";
17 
18 Login::Login(QWidget *parent) : QDialog(parent), ui(new Ui::Login)
19 {
20  ui->setupUi(this);
21  this->_Status = Nothing;
22  this->LoginQuery = NULL;
23  this->timer = new QTimer(this);
24  connect(this->timer, SIGNAL(timeout()), this, SLOT(on_Time()));
25  this->setWindowTitle("Huggle 3 QT [" + Configuration::HuggleVersion + "]");
26  this->Reset();
27  ui->checkBox->setChecked(Configuration::UsingSSL);
28  // set the language to dummy english
29  int l=0;
30  while (l<Core::LocalizationData.count())
31  {
32  ui->Language->addItem(Core::LocalizationData.at(l)->LanguageID);
33  l++;
34  }
35  ui->Language->setCurrentIndex(0);
36  Reload();
37  wq = NULL;
38  if (!QSslSocket::supportsSsl())
39  {
41  ui->checkBox->setEnabled(false);
42  ui->checkBox->setChecked(false);
43  }
44  ui->ButtonExit->setText(Core::Localize("[[main-system-exit]]"));
45  Localize();
46 }
47 
48 Login::~Login()
49 {
50  delete wq;
51  delete LoginQuery;
52  delete ui;
53  delete timer;
54 }
55 
56 void Login::Progress(const int progress)
57 {
58  ui->progressBar->setValue(progress);
59 }
60 
62 {
63  ui->ButtonExit->setText(Core::Localize("[[main-system-exit]]"));
64  ui->ButtonOK->setText(Core::Localize("[[login-start]]"));
65  ui->checkBox->setText(Core::Localize("[[login-ssl]]"));
66  ui->label_2->setText(Core::Localize("[[login-username]]"));
67  ui->pushButton->setText(Core::Localize("[[reload]]"));
68  ui->label_3->setText(Core::Localize("[[login-username]]"));
69  ui->label_4->setText(Core::Localize("[[login-project]]"));
70  ui->label_5->setText(Core::Localize("[[login-language]]"));
71  ui->label_7->setText(Core::Localize("[[login-password"));
72 }
73 
75 {
76  ui->label_6->setText(Core::Localize("[[login-intro]]"));
77 }
78 
80 {
81  this->timer->stop();
82  ui->progressBar->setValue(0);
83  this->Enable();
84  this->_Status = Nothing;
85  ui->lineEdit_3->setText("");
86  ui->ButtonOK->setText(Core::Localize("[[login-start]]"));
87 }
88 
90 {
91  ui->lineEdit->setEnabled(true);
92  ui->Language->setEnabled(true);
93  ui->Project->setEnabled(true);
94  ui->checkBox->setEnabled(QSslSocket::supportsSsl());
95  ui->lineEdit_2->setEnabled(true);
96  ui->ButtonExit->setEnabled(true);
97  ui->lineEdit_3->setEnabled(true);
98  ui->pushButton->setEnabled(true);
99 }
100 
101 void Login::Reload()
102 {
103  int current = 0;
104  ui->Project->clear();
105  while (current < Configuration::ProjectList.size())
106  {
107  ui->Project->addItem(Configuration::ProjectList.at(current)->Name);
108  current++;
109  }
110  ui->Project->setCurrentIndex(0);
111 }
112 
113 void Login::DB()
114 {
115  if (this->LoginQuery == NULL)
116  {
117  return;
118  }
119 
120  if (this->LoginQuery->Processed())
121  {
122  Core::DebugLog(LoginQuery->Result->Data);
123  QDomDocument d;
124  d.setContent(this->LoginQuery->Result->Data);
125  QDomNodeList l = d.elementsByTagName("rev");
126  if (l.count() > 0)
127  {
128  Core::Log(l.at(0).toElement().text());
129  if (QFile().exists(Configuration::WikiDB))
130  {
131  QFile().remove(Configuration::WikiDB);
132  }
133  QFile wiki(Configuration::WikiDB);
134  if (wiki.open(QIODevice::WriteOnly))
135  {
136  wiki.write(l.at(0).toElement().text().toUtf8());
137  Core::LoadDB();
138  }
139  Reload();
140  }
141  this->timer->stop();
142  this->Enable();
143  this->_Status = Nothing;
144  this->Localize();
145  }
146 }
147 
148 void Login::Disable()
149 {
150  ui->lineEdit->setDisabled(true);
151  ui->Language->setDisabled(true);
152  ui->Project->setDisabled(true);
153  ui->checkBox->setDisabled(true);
154  ui->ButtonExit->setDisabled(true);
155  ui->lineEdit_3->setDisabled(true);
156  ui->lineEdit_2->setDisabled(true);
157  ui->pushButton->setDisabled(true);
158 }
159 
161 {
162  if (ui->tab->isVisible())
163  {
164  QMessageBox mb;
165  mb.setWindowTitle("Function not supported");
166  /// \todo LOCALIZE ME
167  mb.setText("This function is not available for wmf wikis in this moment");
168  mb.exec();
169  return;
170  }
171  Configuration::Project = WikiSite(Configuration::ProjectList.at(ui->Project->currentIndex()));
172  Configuration::UsingSSL = ui->checkBox->isChecked();
173  if (ui->lineEdit_2->text() == "Developer Mode")
174  {
175  DeveloperMode();
176  return;
177  }
178  Configuration::UserName = ui->lineEdit_2->text();
179  Configuration::Password = ui->lineEdit_3->text();
180  this->_Status = LoggingIn;
181  this->Disable();
182  ui->ButtonOK->setText(Core::Localize("[[cancel]]"));
183  // First of all, we need to login to the site
184  this->timer->start(200);
185 }
186 
187 void Login::PerformLogin()
188 {
189  ui->label_6->setText(Core::Localize("[[login-progress-start]]"));
190  this->Progress(8);
191  // we create an api request to login
192  this->LoginQuery = new ApiQuery();
193  this->LoginQuery->SetAction(ActionLogin);
194  this->LoginQuery->Parameters = "lgname=" + QUrl::toPercentEncoding(Configuration::UserName);
195  this->LoginQuery->HiddenQuery = true;
196  this->LoginQuery->UsingPOST = true;
197  this->LoginQuery->Process();
198  this->_Status = WaitingForLoginQuery;
199 }
200 
201 void Login::FinishLogin()
202 {
203  if (!this->LoginQuery->Processed())
204  {
205  return;
206  }
207  if (this->LoginQuery->Result->Failed)
208  {
209  ui->label_6->setText(Core::Localize("[[login-fail]]") + ": " + this->LoginQuery->Result->ErrorMessage);
210  this->Progress(0);
211  this->_Status = LoginFailed;
212  delete this->LoginQuery;
213  this->LoginQuery = NULL;
214  return;
215  }
216  this->Progress(18);
217  this->Token = this->LoginQuery->Result->Data;
218  this->_Status = WaitingForToken;
219  delete this->LoginQuery;
220  this->Token = GetToken();
221  this->LoginQuery = new ApiQuery();
222  this->LoginQuery->SetAction(ActionLogin);
223  this->LoginQuery->HiddenQuery = true;
224  this->LoginQuery->Parameters = "lgname=" + QUrl::toPercentEncoding(Configuration::UserName)
225  + "&lgpassword=" + QUrl::toPercentEncoding(Configuration::Password) + "&lgtoken=" + Token ;
226  this->LoginQuery->UsingPOST = true;
227  // we generate a random string of same size of current password
228  QString pw = "";
229  while (pw.length() < Configuration::Password.length())
230  {
231  pw += ".";
232  }
233  // we no longer need a password since this
235  ui->lineEdit_3->setText(pw);
236  this->LoginQuery->Process();
237 }
238 
240 {
241  if (this->LoginQuery != NULL)
242  {
243  if (this->LoginQuery->Processed())
244  {
245  if (this->LoginQuery->Result->Failed)
246  {
247  ui->label_6->setText(Core::Localize("[[login-error-global]]") + ": " + this->LoginQuery->Result->ErrorMessage);
248  this->Progress(0);
249  this->_Status = LoginFailed;
250  delete this->LoginQuery;
251  this->LoginQuery = NULL;
252  return;
253  }
254  QDomDocument d;
255  d.setContent(this->LoginQuery->Result->Data);
256  QDomNodeList l = d.elementsByTagName("rev");
257  if (l.count() == 0)
258  {
259  ui->label_6->setText("Login failed unable to retrieve global config, the api query returned no data");
260  this->Progress(0);
261  this->_Status = LoginFailed;
262  delete this->LoginQuery;
263  this->LoginQuery = NULL;
264  return;
265  }
266  QDomElement data = l.at(0).toElement();
267  if (Configuration::ParseGlobalConfig(data.text()))
268  {
269  if (!Configuration::GlobalConfig_EnableAll)
270  {
271  /// \todo LOCALIZE ME
272  ui->label_6->setText("Login failed because huggle is globally disabled");
273  this->Progress(0);
274  this->_Status = LoginFailed;
275  delete this->LoginQuery;
276  this->LoginQuery = NULL;
277  return;
278  }
279  delete this->LoginQuery;
280  this->LoginQuery = NULL;
281  this->_Status = RetrievingWhitelist;
282  return;
283  }
284  /// \todo LOCALIZE ME
285  ui->label_6->setText("Login failed unable to parse the global config, see debug log for more details");
286  Core::DebugLog(data.text());
287  this->Progress(0);
288  this->_Status = LoginFailed;
289  delete this->LoginQuery;
290  this->LoginQuery = NULL;
291  return;
292  }
293  return;
294  }
295  this->Progress(40);
296  ui->label_6->setText(Core::Localize("[[login-progress-global]]"));
297  this->LoginQuery = new ApiQuery();
298  this->LoginQuery->SetAction(ActionQuery);
300  this->LoginQuery->Parameters = "prop=revisions&format=xml&rvprop=content&rvlimit=1&titles=Huggle/Config";
301  this->LoginQuery->Process();
302 }
303 
304 void Login::FinishToken()
305 {
306  if (!this->LoginQuery->Processed())
307  {
308  return;
309  }
310  if (this->LoginQuery->Result->Failed)
311  {
312  ui->label_6->setText("Login failed: " + this->LoginQuery->Result->ErrorMessage);
313  this->Progress(0);
314  this->_Status = LoginFailed;
315  delete this->LoginQuery;
316  this->LoginQuery = NULL;
317  return;
318  }
319  this->Progress(28);
320 
321  // Assume login was successful
322  if (this->ProcessOutput())
323  {
324  this->_Status = RetrievingGlobalConfig;
325  }
326  // that's all
327  delete this->LoginQuery;
328  this->LoginQuery = NULL;
329 }
330 
331 void Login::RetrieveWhitelist()
332 {
333  if (wq != NULL)
334  {
335  if (wq->Processed())
336  {
337  if (wq->Result->Failed)
338  {
340  } else
341  {
342  QString list = wq->Result->Data;
343  list = list.replace("<!-- list -->", "");
344  Configuration::WhiteList = list.split("|");
345  int c = 0;
346  while (c < Configuration::WhiteList.count())
347  {
348  if (Configuration::WhiteList.at(c) == "")
349  {
350  Configuration::WhiteList.removeAt(c);
351  continue;
352  }
353  c++;
354  }
355  }
356  wq->SafeDelete();
357  wq = NULL;
358  // Now global config
359  this->_Status = RetrievingLocalConfig;
360  return;
361  }
362  return;
363  }
364  this->Progress(52);
365  ui->label_6->setText(Core::Localize("[[login-progress-whitelist]]"));
366  wq = new WLQuery();
367  wq->RetryOnTimeoutFailure = false;
368  wq->Process();
369  return;
370 }
371 
373 {
374  if (this->LoginQuery != NULL)
375  {
376  if (this->LoginQuery->Processed())
377  {
378  if (this->LoginQuery->Result->Failed)
379  {
380  /// \todo LOCALIZE ME
381  ui->label_6->setText("Login failed unable to retrieve local config: " + this->LoginQuery->Result->ErrorMessage);
382  this->Progress(0);
383  this->_Status = LoginFailed;
384  delete this->LoginQuery;
385  this->LoginQuery = NULL;
386  return;
387  }
388  QDomDocument d;
389  d.setContent(this->LoginQuery->Result->Data);
390  QDomNodeList l = d.elementsByTagName("rev");
391  if (l.count() == 0)
392  {
393  /// \todo LOCALIZE ME
394  ui->label_6->setText("Login failed unable to retrieve local config, the api query returned no data");
395  this->Progress(0);
396  this->_Status = LoginFailed;
397  delete this->LoginQuery;
398  this->LoginQuery = NULL;
399  return;
400  }
401  QDomElement data = l.at(0).toElement();
402  if (Configuration::ParseLocalConfig(data.text()))
403  {
404  if (!Configuration::LocalConfig_EnableAll)
405  {
406  /// \todo LOCALIZE ME
407  ui->label_6->setText("Login failed because huggle is disabled");
408  this->Progress(0);
409  this->_Status = LoginFailed;
410  delete this->LoginQuery;
411  this->LoginQuery = NULL;
412  return;
413  }
414  delete this->LoginQuery;
415  this->LoginQuery = NULL;
416  this->_Status = RetrievingUserConfig;
417  return;
418  }
419  /// \todo LOCALIZE ME
420  ui->label_6->setText("Login failed unable to parse the local config, see debug log for more details");
421  Core::DebugLog(data.text());
422  this->Progress(0);
423  this->_Status = LoginFailed;
424  delete this->LoginQuery;
425  this->LoginQuery = NULL;
426  return;
427  }
428  return;
429  }
430  this->Progress(68);
431  /// \todo LOCALIZE ME
432  ui->label_6->setText("Retrieving local config");
433  this->LoginQuery = new ApiQuery();
434  this->LoginQuery->SetAction(ActionQuery);
435  this->LoginQuery->Parameters = "prop=revisions&format=xml&rvprop=content&rvlimit=1&titles=Project:Huggle/Config";
436  this->LoginQuery->Process();
437 }
438 
440 {
441  if (this->LoginQuery != NULL)
442  {
443  if (this->LoginQuery->Processed())
444  {
445  if (this->LoginQuery->Result->Failed)
446  {
447  /// \todo LOCALIZE ME
448  ui->label_6->setText("Login failed unable to retrieve user config: " + this->LoginQuery->Result->ErrorMessage);
449  this->Progress(0);
450  this->_Status = LoginFailed;
451  delete this->LoginQuery;
452  this->LoginQuery = NULL;
453  return;
454  }
455  QDomDocument d;
456  d.setContent(this->LoginQuery->Result->Data);
457  QDomNodeList l = d.elementsByTagName("rev");
458  if (l.count() == 0)
459  {
460  Core::DebugLog(this->LoginQuery->Result->Data);
461  /// \todo LOCALIZE ME
462  ui->label_6->setText("Login failed unable to retrieve user config, the api query returned no data");
463  this->Progress(0);
464  this->_Status = LoginFailed;
465  delete this->LoginQuery;
466  this->LoginQuery = NULL;
467  return;
468  }
469  QDomElement data = l.at(0).toElement();
470  if (Configuration::ParseUserConfig(data.text()))
471  {
472  if (!Configuration::LocalConfig_EnableAll)
473  {
474  /// \todo LOCALIZE ME
475  ui->label_6->setText("Login failed because you don't have enable:true in your personal config");
476  this->Progress(0);
477  this->_Status = LoginFailed;
478  delete this->LoginQuery;
479  this->LoginQuery = NULL;
480  return;
481  }
482  delete this->LoginQuery;
483  this->LoginQuery = NULL;
484  this->_Status = RetrievingUser;
485  return;
486  }
487  /// \todo LOCALIZE ME
488  ui->label_6->setText("Login failed unable to parse the user config, see debug log for more details");
489  Core::DebugLog(data.text());
490  this->Progress(0);
491  this->_Status = LoginFailed;
492  delete this->LoginQuery;
493  this->LoginQuery = NULL;
494  return;
495  }
496  return;
497  }
498  this->Progress(82);
499  ui->label_6->setText("Retrieving user config");
500  this->LoginQuery = new ApiQuery();
501  QString page = Configuration::GlobalConfig_UserConf;
502  page = page.replace("$1", Configuration::UserName);
503  this->LoginQuery->SetAction(ActionQuery);
504  this->LoginQuery->Parameters = "prop=revisions&rvprop=content&rvlimit=1&titles=" +
505  QUrl::toPercentEncoding(page);
506  this->LoginQuery->Process();
507 }
508 
510 {
511  if (this->LoginQuery != NULL)
512  {
513  if (this->LoginQuery->Processed())
514  {
515  if (this->LoginQuery->Result->Failed)
516  {
517  /// \todo LOCALIZE ME
518  ui->label_6->setText("Login failed unable to retrieve user info: " + this->LoginQuery->Result->ErrorMessage);
519  this->Progress(0);
520  this->_Status = LoginFailed;
521  delete this->LoginQuery;
522  this->LoginQuery = NULL;
523  return;
524  }
525  QDomDocument d;
526  d.setContent(this->LoginQuery->Result->Data);
527  QDomNodeList l = d.elementsByTagName("r");
528  if (l.count() == 0)
529  {
530  Core::DebugLog(this->LoginQuery->Result->Data);
531  /// \todo LOCALIZE ME
532  ui->label_6->setText("Login failed unable to retrieve user info, the api query returned no data");
533  this->Progress(0);
534  this->_Status = LoginFailed;
535  delete this->LoginQuery;
536  this->LoginQuery = NULL;
537  return;
538  }
539  int c=0;
540  while(c<l.count())
541  {
542  Configuration::Rights.append(l.at(c).toElement().text());
543  c++;
544  }
545  if (Configuration::LocalConfig_RequireRollback && !Configuration::Rights.contains("rollback"))
546  {
547  /// \todo LOCALIZE ME
548  ui->label_6->setText("Login failed because you don't have rollback permissions on this project");
549  this->Progress(0);
550  this->_Status = LoginFailed;
551  delete this->LoginQuery;
552  this->LoginQuery = NULL;
553  return;
554  }
555  delete this->LoginQuery;
556  this->LoginQuery = NULL;
557  this->_Status = LoginDone;
558  Finish();
559  return;
560  }
561  return;
562  }
563  this->Progress(96);
564  /// \todo LOCALIZE ME
565  ui->label_6->setText("Retrieving user info");
566  this->LoginQuery = new ApiQuery();
567  this->LoginQuery->SetAction(ActionQuery);
568  this->LoginQuery->Parameters = "meta=userinfo&format=xml&uiprop=rights";
569  this->LoginQuery->Process();
570 }
571 
572 void Login::DeveloperMode()
573 {
575  Core::Main = new MainWindow();
576  Core::Main->show();
577  this->hide();
578 }
579 
580 void Login::DisplayError(QString message)
581 {
582  this->_Status = LoginFailed;
583  Core::DebugLog(this->LoginQuery->Result->Data);
584  ui->label_6->setText(message);
585  this->CancelLogin();
586 }
587 
588 void Login::Finish()
589 {
590  this->timer->stop();
591  Core::Main = new MainWindow();
592  this->hide();
593  Core::Main->show();
594 }
595 
596 void Login::reject()
597 {
598  if (this->_Status != LoginDone)
599  {
600  QApplication::quit();
601  }
602 }
603 
605 {
606  // Check what the result was
607  QString Result = this->LoginQuery->Result->Data;
608  if (!Result.contains(("<login result")))
609  {
610  /// \todo LOCALIZE ME
611  DisplayError("ERROR: The api.php responded with invalid text (webserver is down?), please check debug log for precise information");
612  return false;
613  }
614 
615  Result = Result.mid(Result.indexOf("result=\"") + 8);
616  if (!Result.contains("\""))
617  {
618  /// \todo LOCALIZE ME
619  DisplayError("ERROR: The api.php responded with invalid text (webserver is broken), please check debug log for precise information");
620  return false;
621  }
622 
623  Result = Result.mid(0, Result.indexOf("\""));
624 
625  if (Result == "Success")
626  {
627  return true;
628  }
629 
630  if (Result == "EmptyPass")
631  {
632  /// \todo LOCALIZE ME
633  DisplayError("The password you entered was empty");
634  return false;
635  }
636 
637  if (Result == "WrongPass")
638  {
639  /// \todo LOCALIZE ME
640  DisplayError("Your password is not correct");
641  return false;
642  }
643 
644  if (Result == "NoName")
645  {
646  /// \todo LOCALIZE ME
647  DisplayError("You provided no correct user name for login");
648  return false;
649  }
650 
651  /// \todo LOCALIZE ME
652  DisplayError("ERROR: The api.php responded with unknown result: " + Result);
653  return false;
654 }
655 
657 {
658  QString token = this->Token;
659  if (!token.contains(Login::Test))
660  {
661  // this is invalid token?
662  /// \todo LOCALIZE ME
663  Core::Log("WARNING: the result of api request doesn't contain valid token");
664  Core::DebugLog("The token didn't contain the correct string, token was " + token);
665  return "<invalid token>";
666  }
667  token = token.mid(token.indexOf(Login::Test) + Login::Test.length());
668  if (!token.contains("\""))
669  {
670  // this is invalid token?
671  /// \todo LOCALIZE ME
672  Core::Log("WARNING: the result of api request doesn't contain valid token");
673  Core::DebugLog("The token didn't contain the closing mark, token was " + token);
674  return "<invalid token>";
675  }
676  token = token.mid(0, token.indexOf("\""));
677  return token;
678 }
679 
680 void Login::on_ButtonOK_clicked()
681 {
682  if (this->_Status == Nothing)
683  {
684  this->PressOK();
685  return;
686  }
687  else
688  {
689  this->CancelLogin();
690  this->Reset();
691  return;
692  }
693 }
694 
695 void Login::on_ButtonExit_clicked()
696 {
697  Core::Shutdown();
698 }
699 
700 void Login::on_Time()
701 {
702  switch (this->_Status)
703  {
704  case LoggingIn:
705  PerformLogin();
706  break;
707  case WaitingForLoginQuery:
708  FinishLogin();
709  break;
710  case RetrievingWhitelist:
711  RetrieveWhitelist();
712  break;
713  case WaitingForToken:
714  FinishToken();
715  break;
716  case RetrievingGlobalConfig:
718  break;
719  case RetrievingLocalConfig:
721  break;
722  case RetrievingUserConfig:
724  break;
725  case RetrievingUser:
727  break;
728  case Refreshing:
729  DB();
730  case LoggedIn:
731  case Nothing:
732  case Cancelling:
733  case LoginFailed:
734  case LoginDone:
735  break;
736  }
737 
738 
739  if (this->_Status == LoginFailed)
740  {
741  this->Enable();
742  timer->stop();
743  ui->ButtonOK->setText("Login");
744  this->_Status = Nothing;
745  }
746 }
747 
748 void Login::on_pushButton_clicked()
749 {
750  this->Disable();
751  if(this->LoginQuery != NULL)
752  {
753  delete this->LoginQuery;
754  }
755 
756  this->LoginQuery = new ApiQuery();
757  this->_Status = Refreshing;
758  this->LoginQuery->SetAction(ActionQuery);
759  this->timer->start(200);
761  this->ui->ButtonOK->setText(Core::Localize("[[cancel]]"));
762  this->LoginQuery->Parameters = "prop=revisions&format=xml&rvprop=content&rvlimit=1&titles=Project:Huggle/List";
763  this->LoginQuery->Process();
764 }
765 
766 void Login::on_Language_currentIndexChanged(const QString &arg1)
767 {
768  QString lang = "en";
769  int c = 0;
770  while (c<Core::LocalizationData.count())
771  {
772  if (Core::LocalizationData.at(c)->LanguageID == arg1)
773  {
774  lang = Core::LocalizationData.at(c)->LanguageName;
775  break;
776  }
777  c++;
778  }
780  Localize();
781 }
static QString HuggleVersion
Version.
void Process()
Execute query.
Definition: wlquery.cpp:26
virtual bool SafeDelete()
Use this if you are not sure if you can delete this object in this moment.
Definition: collectable.cpp:38
static QString WikiDB
Path to a file where information about wikis are stored.
Primary huggle window.
Definition: mainwindow.hpp:110
static void Log(QString Message)
Write text to terminal as well as ring log.
Definition: core.cpp:563
bool HiddenQuery
Definition: query.hpp:96
static QString UserName
User name.
WLQuery * wq
Definition: login.hpp:81
static bool Restricted
When this is true most of functions will not work.
void Progress(const int progress)
Definition: login.cpp:56
Whitelist query :o.
Definition: wlquery.hpp:23
virtual bool Processed()
Returns true in case that query is processed.
Definition: query.cpp:45
_Status
Status of a query.
Definition: query.hpp:32
QString GetToken()
Definition: login.cpp:656
void Process()
Run.
Definition: apiquery.cpp:138
void Localize()
Definition: login.cpp:61
QString OverrideWiki
You can change this to url of different wiki than a project.
Definition: apiquery.hpp:100
Window that is displayed as first when huggle is started.
Definition: login.hpp:56
static void Shutdown()
Terminate the process, call this after you release all resources and finish all queries.
Definition: core.cpp:684
void RetrieveGlobalConfig()
Definition: login.cpp:239
void CancelLogin()
Cancel currently running login attempt.
Definition: login.cpp:79
void Reset()
Reset the interface to default.
Definition: login.cpp:74
void Enable()
Enable parts of interface.
Definition: login.cpp:89
void RetrieveLocalConfig()
Definition: login.cpp:372
static QString Language
Language selected by user this is only a language of interface.
static QString Password
Password.
static QStringList WhiteList
Data of wl.
void SetAction(const Action action)
Change the action type.
Definition: apiquery.cpp:185
void PressOK()
Definition: login.cpp:160
static bool ParseUserConfig(QString config)
bool UsingPOST
Whether the query will submit parameters using POST data.
Definition: apiquery.hpp:77
static WikiSite Project
currently selected project
void RetrievePrivateConfig()
Definition: login.cpp:439
static void DebugLog(QString Message, unsigned int Verbosity=1)
This log is only shown if verbosity is same or larger than requested verbosity.
Definition: core.cpp:641
static bool ParseGlobalConfig(QString config)
Parse all information from global config on meta.
static QList< Language * > LocalizationData
Languages D:
Definition: core.hpp:131
QString ErrorMessage
If query is in error the reason for error is stored here.
Definition: queryresult.hpp:27
QString Parameters
Parameters for action, for example page title.
Definition: apiquery.hpp:84
static bool WhitelistDisabled
Whitelist is not useable.
static bool UsingSSL
If SSL is being used.
static bool ParseLocalConfig(QString config)
Parse all information from local config, this function is used in login.
bool ProcessOutput()
This function make sure that login result is done.
Definition: login.cpp:604
static QList< WikiSite * > ProjectList
List of projects.
static QString GlobalConfigurationWikiAddress
URL of wiki that contains a global config.
static QString Test
Definition: login.hpp:86
QString Token
The token obtained from login.
Definition: login.hpp:84
static MainWindow * Main
Pointer to main.
Definition: core.hpp:111
This class can be used to execute any kind of api query on any wiki.
Definition: apiquery.hpp:55
void RetrieveUserInfo()
Definition: login.cpp:509
QString Data
Data retrieved by query.
Definition: queryresult.hpp:25
QueryResult * Result
Result of query, see documentation of QueryResult for more.
Definition: query.hpp:68