Remove unused functions in WebClient #4696

This commit is contained in:
Jerry (Xinyu Hou) 2015-10-19 17:02:59 -07:00
parent 4197fb7a0e
commit 6c4ee29649
2 changed files with 0 additions and 56 deletions

View File

@ -89,56 +89,6 @@ int WebClient::getEdition(
return edition; return edition;
} }
void WebClient::queryPluginList()
{
QString responseJson;
try {
QStringList args("--get-plugin-list");
responseJson = request(m_Email, m_Password, args);
}
catch (std::exception& e)
{
emit error(tr("An error occurred while trying to query the "
"plugin list. Please contact the help desk, and "
"provide the following details.\n\n%1").arg(e.what()));
return;
}
QRegExp resultRegex(".*\"result\".*:.*(true|false).*");
if (resultRegex.exactMatch(responseJson)) {
QString boolString = resultRegex.cap(1);
if (boolString == "true") {
QRegExp editionRegex(".*\"plugins\".*:.*\"([^\"]+)\".*");
if (editionRegex.exactMatch(responseJson)) {
QString e = editionRegex.cap(1);
m_PluginList = e.split(",");
}
emit queryPluginDone();
return;
}
else if (boolString == "false") {
emit error(tr("Get plugin list failed, invalid user email "
"or password."));
return;
}
}
else {
QRegExp errorRegex(".*\"error\".*:.*\"([^\"]+)\".*");
if (errorRegex.exactMatch(responseJson)) {
// replace "\n" with real new lines.
QString e = errorRegex.cap(1).replace("\\n", "\n");
emit error(tr("Get plugin list failed, an error occurred."
"\n\n%1").arg(e));
return;
}
}
emit error(tr("Get plugin list failed, an error occurred.\n\n"
"Server response:\n\n%1").arg(responseJson));
return;
}
QString WebClient::request( QString WebClient::request(
const QString& email, const QString& email,
const QString& password, const QString& password,

View File

@ -39,14 +39,9 @@ public:
QWidget* w); QWidget* w);
void setEmail(QString& e) { m_Email = e; } void setEmail(QString& e) { m_Email = e; }
void setPassword(QString& p) { m_Password = p; } void setPassword(QString& p) { m_Password = p; }
QStringList& getPluginList() { return m_PluginList; }
public slots:
void queryPluginList();
signals: signals:
void error(QString e); void error(QString e);
void queryPluginDone();
private: private:
QString request(const QString& email, QString request(const QString& email,
@ -56,7 +51,6 @@ private:
private: private:
QString m_Email; QString m_Email;
QString m_Password; QString m_Password;
QStringList m_PluginList;
CoreInterface m_CoreInterface; CoreInterface m_CoreInterface;
}; };