Changeset View
Changeset View
Standalone View
Standalone View
src/bugzillaintegration/reportassistantpages_bugzilla.cpp
Show First 20 Lines • Show All 121 Lines • ▼ Show 20 Line(s) | 121 | ui.m_loginButton->setEnabled( !ui.m_userEdit->text().isEmpty() && | |||
---|---|---|---|---|---|
122 | !ui.m_passwordEdit->password().isEmpty() && | 122 | !ui.m_passwordEdit->password().isEmpty() && | ||
123 | m_bugzillaVersionFound ); | 123 | m_bugzillaVersionFound ); | ||
124 | } | 124 | } | ||
125 | 125 | | |||
126 | void BugzillaLoginPage::loginError(const QString & err, const QString & extendedMessage) | 126 | void BugzillaLoginPage::loginError(const QString & err, const QString & extendedMessage) | ||
127 | { | 127 | { | ||
128 | loginFinished(false); | 128 | loginFinished(false); | ||
129 | ui.m_statusWidget->setIdle(xi18nc("@info:status","Error when trying to login: " | 129 | ui.m_statusWidget->setIdle(xi18nc("@info:status","Error when trying to login: " | ||
130 | "<message>%1.</message>", err)); | 130 | "<message>%1</message>", err)); | ||
131 | if (!extendedMessage.isEmpty()) { | 131 | if (!extendedMessage.isEmpty()) { | ||
132 | new UnhandledErrorDialog(this, err, extendedMessage); | 132 | new UnhandledErrorDialog(this, err, extendedMessage); | ||
133 | } | 133 | } | ||
134 | } | 134 | } | ||
135 | 135 | | |||
136 | void BugzillaLoginPage::aboutToShow() | 136 | void BugzillaLoginPage::aboutToShow() | ||
137 | { | 137 | { | ||
138 | if (bugzillaManager()->getLogged()) { | 138 | if (bugzillaManager()->getLogged()) { | ||
▲ Show 20 Lines • Show All 87 Lines • ▼ Show 20 Line(s) | 216 | if (!username.isEmpty() && !password.isEmpty()) { | |||
226 | ui.m_passwordEdit->setPassword(password); | 226 | ui.m_passwordEdit->setPassword(password); | ||
227 | } | 227 | } | ||
228 | } | 228 | } | ||
229 | 229 | | |||
230 | } | 230 | } | ||
231 | } | 231 | } | ||
232 | } | 232 | } | ||
233 | 233 | | |||
234 | bool BugzillaLoginPage::canSetCookies() | | |||
235 | { | | |||
236 | if (bugzillaManager()->securityMethod() != BugzillaManager::UseCookies) { | | |||
237 | qCDebug(DRKONQI_LOG) << "Bugzilla software no longer issues cookies."; | | |||
238 | return false; | | |||
239 | } | | |||
240 | QDBusInterface kded(QStringLiteral("org.kde.kded5"), | | |||
241 | QStringLiteral("/kded"), | | |||
242 | QStringLiteral("org.kde.kded5")); | | |||
243 | QDBusReply<bool> kcookiejarLoaded = kded.call(QStringLiteral("loadModule"), | | |||
244 | QStringLiteral("kcookiejar")); | | |||
245 | if (!kcookiejarLoaded.isValid()) { | | |||
246 | KMessageBox::error(this, i18n("Failed to communicate with kded. Make sure it is running.")); | | |||
247 | return false; | | |||
248 | } else if (!kcookiejarLoaded.value()) { | | |||
249 | KMessageBox::error(this, i18n("Failed to load KCookieServer. Check your KDE installation.")); | | |||
250 | return false; | | |||
251 | } | | |||
252 | | ||||
253 | | ||||
254 | QDBusInterface kcookiejar(QStringLiteral("org.kde.kded5"), | | |||
255 | QStringLiteral("/modules/kcookiejar"), | | |||
256 | QStringLiteral("org.kde.KCookieServer")); | | |||
257 | QDBusReply<QString> advice = kcookiejar.call(QStringLiteral("getDomainAdvice"), | | |||
258 | KDE_BUGZILLA_URL); | | |||
259 | | ||||
260 | if (!advice.isValid()) { | | |||
261 | KMessageBox::error(this, i18n("Failed to communicate with KCookieServer.")); | | |||
262 | return false; | | |||
263 | } | | |||
264 | | ||||
265 | qCDebug(DRKONQI_LOG) << "Got reply from KCookieServer:" << advice.value(); | | |||
266 | | ||||
267 | if (advice.value() == QLatin1String("Reject")) { | | |||
268 | QString msg = i18nc("@info 1 is the bugzilla website url", | | |||
269 | "Cookies are not allowed in your KDE network settings. In order to " | | |||
270 | "proceed, you need to allow %1 to set cookies.", KDE_BUGZILLA_URL); | | |||
271 | | ||||
272 | KGuiItem yesItem = KStandardGuiItem::yes(); | | |||
273 | yesItem.setText(i18nc("@action:button 1 is the bugzilla website url", | | |||
274 | "Allow %1 to set cookies", KDE_BUGZILLA_URL)); | | |||
275 | | ||||
276 | KGuiItem noItem = KStandardGuiItem::no(); | | |||
277 | noItem.setText(i18nc("@action:button do not allow the bugzilla website " | | |||
278 | "to set cookies", "No, do not allow")); | | |||
279 | | ||||
280 | if (KMessageBox::warningYesNo(this, msg, QString(), yesItem, noItem) == KMessageBox::Yes) { | | |||
281 | QDBusReply<bool> success = kcookiejar.call(QStringLiteral("setDomainAdvice"), | | |||
282 | KDE_BUGZILLA_URL, | | |||
283 | QStringLiteral("Accept")); | | |||
284 | if (!success.isValid() || !success.value()) { | | |||
285 | qCWarning(DRKONQI_LOG) << "Failed to set domain advice in KCookieServer"; | | |||
286 | return false; | | |||
287 | } else { | | |||
288 | return true; | | |||
289 | } | | |||
290 | } else { | | |||
291 | return false; | | |||
292 | } | | |||
293 | } | | |||
294 | | ||||
295 | return true; | | |||
296 | } | | |||
297 | | ||||
298 | void BugzillaLoginPage::loginClicked() | 234 | void BugzillaLoginPage::loginClicked() | ||
299 | { | 235 | { | ||
300 | if (!(ui.m_userEdit->text().isEmpty() || ui.m_passwordEdit->password().isEmpty())) { | 236 | if (!(ui.m_userEdit->text().isEmpty() || ui.m_passwordEdit->password().isEmpty())) { | ||
301 | | ||||
302 | if ((bugzillaManager()->securityMethod() == BugzillaManager::UseCookies) | | |||
303 | && (!canSetCookies())) { | | |||
304 | return; | | |||
305 | } | | |||
306 | | ||||
307 | updateWidget(false); | 237 | updateWidget(false); | ||
308 | 238 | | |||
309 | if (ui.m_savePasswordCheckBox->checkState()==Qt::Checked) { //Wants to save data | 239 | if (ui.m_savePasswordCheckBox->checkState()==Qt::Checked) { //Wants to save data | ||
310 | if (!m_wallet) { | 240 | if (!m_wallet) { | ||
311 | openWallet(); | 241 | openWallet(); | ||
312 | } | 242 | } | ||
313 | //Got wallet open ? | 243 | //Got wallet open ? | ||
314 | if (m_wallet) { | 244 | if (m_wallet) { | ||
▲ Show 20 Lines • Show All 569 Lines • Show Last 20 Lines |