Skip to content

Commit 45bb34f

Browse files
committed
Merge branch 'hotfix/0.2.1' into stable
2 parents fcf0cef + 5fb2e90 commit 45bb34f

File tree

7 files changed

+19
-10
lines changed

7 files changed

+19
-10
lines changed

src/core/application.cpp

+8-2
Original file line numberDiff line numberDiff line change
@@ -147,12 +147,14 @@ void Application::extract(const QString &filePath, const QString &destination, c
147147

148148
QNetworkReply *Application::download(const QUrl &url)
149149
{
150-
static const QString userAgent = userAgentJson();
150+
static const QString ua = userAgent();
151+
static const QString uaJson = userAgentJson();
151152

152153
QNetworkRequest request(url);
154+
request.setHeader(QNetworkRequest::UserAgentHeader, ua);
153155

154156
if (url.host().endsWith(QLatin1String(".zealdocs.org", Qt::CaseInsensitive)))
155-
request.setRawHeader("X-Zeal-User-Agent", userAgent.toUtf8());
157+
request.setRawHeader("X-Zeal-User-Agent", uaJson.toUtf8());
156158

157159
return m_networkManager->get(request);
158160
}
@@ -218,6 +220,10 @@ void Application::applySettings()
218220
}
219221
}
220222

223+
QString Application::userAgent()
224+
{
225+
return QString("Zeal/%1").arg(QCoreApplication::applicationVersion());
226+
}
221227

222228
QString Application::userAgentJson() const
223229
{

src/core/application.h

+1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ private slots:
7474
void applySettings();
7575

7676
private:
77+
static inline QString userAgent();
7778
QString userAgentJson() const;
7879

7980
static Application *m_instance;

src/core/settings.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ void Settings::load()
9494
m_settings->endGroup();
9595

9696
m_settings->beginGroup(GroupProxy);
97-
proxyType = m_settings->value(QStringLiteral("type"), ProxyType::System).value<ProxyType>();
97+
proxyType = static_cast<ProxyType>(m_settings->value(QStringLiteral("type"),
98+
ProxyType::System).toUInt());
9899
proxyHost = m_settings->value(QStringLiteral("host")).toString();
99100
proxyPort = m_settings->value(QStringLiteral("port"), 0).toInt();
100101
proxyAuthenticate = m_settings->value(QStringLiteral("authenticate"), false).toBool();
@@ -126,7 +127,7 @@ void Settings::load()
126127
// Avoid curly braces (QTBUG-885)
127128
QUuid::createUuid().toString().mid(1, 36)).toString();
128129
version = m_settings->value(QStringLiteral("version"),
129-
QCoreApplication::applicationVersion()).toString();
130+
QCoreApplication::applicationVersion()).toString();
130131
m_settings->endGroup();
131132
}
132133

@@ -170,11 +171,10 @@ void Settings::save()
170171

171172
m_settings->beginGroup(GroupInternal);
172173
m_settings->setValue(QStringLiteral("install_id"), installId);
173-
m_settings->setValue(QStringLiteral("version"), version);
174+
m_settings->setValue(QStringLiteral("version"), QCoreApplication::applicationVersion());
174175
m_settings->endGroup();
175176

176177
m_settings->sync();
177178

178179
emit updated();
179180
}
180-

src/core/settings.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class Settings : public QObject
5858
/// TODO: QString customCss;
5959

6060
// Network
61-
enum ProxyType {
61+
enum ProxyType : unsigned int {
6262
None,
6363
System,
6464
UserDefined

src/registry/docset.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,10 @@ Docset::Docset(const QString &path) :
105105
}
106106

107107
/// TODO: Verify if this is needed
108-
if (plist[InfoPlist::DashDocSetFamily].toString() == QLatin1String("cheatsheet"))
108+
if (plist.contains(InfoPlist::DashDocSetFamily)
109+
&& plist[InfoPlist::DashDocSetFamily].toString() == QLatin1String("cheatsheet")) {
109110
m_name = m_name + QLatin1String("cheats");
111+
}
110112

111113
if (!dir.cd(QStringLiteral("Resources")) || !dir.exists(QStringLiteral("docSet.dsidx")))
112114
return;

src/src.pro

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ portable {
1515
DEFINES += PORTABLE_BUILD
1616
}
1717

18-
VERSION = 0.2.0
18+
VERSION = 0.2.1
1919
DEFINES += ZEAL_VERSION=\\\"$${VERSION}\\\"
2020

2121
HEADERS += \

src/ui/widgets/searchedit.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ void SearchEdit::showCompletions(const QString &newValue)
140140
const int frameWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
141141
const int textWidth = fontMetrics().width(newValue);
142142

143-
if (!m_prefixCompleter)
143+
if (m_prefixCompleter)
144144
m_prefixCompleter->setCompletionPrefix(text());
145145

146146
const QString completed = currentCompletion(newValue).mid(newValue.size());

0 commit comments

Comments
 (0)