Changeset View
Changeset View
Standalone View
Standalone View
src/core/slaveinterface.cpp
Show First 20 Lines • Show All 286 Lines • ▼ Show 20 Line(s) | 284 | if (m.contains(QStringLiteral("ssl_in_use"))) { | |||
---|---|---|---|---|---|
287 | for (MetaData::ConstIterator it = constM.lowerBound(ssl_); it != constM.constEnd(); ++it) { | 287 | for (MetaData::ConstIterator it = constM.lowerBound(ssl_); it != constM.constEnd(); ++it) { | ||
288 | if (it.key().startsWith(ssl_)) { | 288 | if (it.key().startsWith(ssl_)) { | ||
289 | d->sslMetaData.insert(it.key(), it.value()); | 289 | d->sslMetaData.insert(it.key(), it.value()); | ||
290 | } else { | 290 | } else { | ||
291 | // we're past the ssl_* entries; remember that QMap is ordered. | 291 | // we're past the ssl_* entries; remember that QMap is ordered. | ||
292 | break; | 292 | break; | ||
293 | } | 293 | } | ||
294 | } | 294 | } | ||
295 | } | 295 | } | ||
dfaure: This fails to build for me...
slaveinterface.cpp:291:55: error: ‘QString::QString(const… | |||||
296 | emit metaData(m); | 296 | emit metaData(m); | ||
297 | break; | 297 | break; | ||
298 | } | 298 | } | ||
299 | case MSG_NET_REQUEST: { | 299 | case MSG_NET_REQUEST: { | ||
300 | QString host; | 300 | QString host; | ||
301 | QString slaveid; | 301 | QString slaveid; | ||
302 | stream >> host >> slaveid; | 302 | stream >> host >> slaveid; | ||
303 | requestNetwork(host, slaveid); | 303 | requestNetwork(host, slaveid); | ||
Show All 14 Lines | 317 | case MSG_HOST_INFO_REQ: { | |||
318 | QString hostName; | 318 | QString hostName; | ||
319 | stream >> hostName; | 319 | stream >> hostName; | ||
320 | HostInfo::lookupHost(hostName, this, SLOT(slotHostInfo(QHostInfo))); | 320 | HostInfo::lookupHost(hostName, this, SLOT(slotHostInfo(QHostInfo))); | ||
321 | break; | 321 | break; | ||
322 | } | 322 | } | ||
323 | case MSG_PRIVILEGE_EXEC: | 323 | case MSG_PRIVILEGE_EXEC: | ||
324 | emit privilegeOperationRequested(); | 324 | emit privilegeOperationRequested(); | ||
325 | break; | 325 | break; | ||
326 | case INF_PRIVILEGE_CONF: { | ||||
327 | QString caption, message, details; | ||||
328 | stream >> caption >> message >> details; | ||||
329 | requestPrivilegeConfirmation(caption, message, details); | ||||
330 | break; | ||||
331 | } | ||||
332 | | ||||
326 | default: | 333 | default: | ||
327 | qCWarning(KIO_CORE) << "Slave sends unknown command (" << _cmd << "), dropping slave"; | 334 | qCWarning(KIO_CORE) << "Slave sends unknown command (" << _cmd << "), dropping slave"; | ||
328 | return false; | 335 | return false; | ||
329 | } | 336 | } | ||
330 | return true; | 337 | return true; | ||
331 | } | 338 | } | ||
332 | 339 | | |||
333 | void SlaveInterface::setOffset(KIO::filesize_t o) | 340 | void SlaveInterface::setOffset(KIO::filesize_t o) | ||
▲ Show 20 Lines • Show All 49 Lines • ▼ Show 20 Line(s) | 382 | { | |||
383 | } | 390 | } | ||
384 | QByteArray packedArgs; | 391 | QByteArray packedArgs; | ||
385 | QDataStream stream(&packedArgs, QIODevice::WriteOnly); | 392 | QDataStream stream(&packedArgs, QIODevice::WriteOnly); | ||
386 | stream << result; | 393 | stream << result; | ||
387 | d->connection->sendnow(CMD_MESSAGEBOXANSWER, packedArgs); | 394 | d->connection->sendnow(CMD_MESSAGEBOXANSWER, packedArgs); | ||
388 | // qDebug() << "message box answer" << result; | 395 | // qDebug() << "message box answer" << result; | ||
389 | } | 396 | } | ||
390 | 397 | | |||
398 | void SlaveInterface::sendPrivilegeConfirmationAnswer(bool conf) | ||||
399 | { | ||||
400 | Q_D(SlaveInterface); | ||||
401 | if (!d->connection) { | ||||
402 | return; | ||||
403 | } | ||||
404 | | ||||
405 | if (d->connection->suspended()) { | ||||
406 | d->connection->resume(); | ||||
407 | } | ||||
408 | QByteArray packedArgs; | ||||
409 | QDataStream stream(&packedArgs, QIODevice::WriteOnly); | ||||
410 | stream << conf; | ||||
411 | d->connection->sendnow(INF_PRIVILEGE_CONF, packedArgs); | ||||
412 | } | ||||
413 | | ||||
391 | void SlaveInterface::messageBox(int type, const QString &text, const QString &_caption, | 414 | void SlaveInterface::messageBox(int type, const QString &text, const QString &_caption, | ||
392 | const QString &buttonYes, const QString &buttonNo) | 415 | const QString &buttonYes, const QString &buttonNo) | ||
393 | { | 416 | { | ||
394 | messageBox(type, text, _caption, buttonYes, buttonNo, QString()); | 417 | messageBox(type, text, _caption, buttonYes, buttonNo, QString()); | ||
395 | } | 418 | } | ||
396 | 419 | | |||
397 | void SlaveInterface::messageBox(int type, const QString &text, const QString &caption, | 420 | void SlaveInterface::messageBox(int type, const QString &text, const QString &caption, | ||
398 | const QString &buttonYes, const QString &buttonNo, const QString &dontAskAgainName) | 421 | const QString &buttonYes, const QString &buttonNo, const QString &dontAskAgainName) | ||
399 | { | 422 | { | ||
400 | Q_D(SlaveInterface); | 423 | Q_D(SlaveInterface); | ||
401 | if (d->connection) { | 424 | if (d->connection) { | ||
402 | d->connection->suspend(); | 425 | d->connection->suspend(); | ||
403 | } | 426 | } | ||
404 | 427 | | |||
405 | QHash<UserNotificationHandler::MessageBoxDataType, QVariant> data; | 428 | QHash<UserNotificationHandler::MessageBoxDataType, QVariant> data; | ||
429 | data.insert(UserNotificationHandler::MSG_TYPE, type); | ||||
406 | data.insert(UserNotificationHandler::MSG_TEXT, text); | 430 | data.insert(UserNotificationHandler::MSG_TEXT, text); | ||
407 | data.insert(UserNotificationHandler::MSG_CAPTION, caption); | 431 | data.insert(UserNotificationHandler::MSG_CAPTION, caption); | ||
408 | data.insert(UserNotificationHandler::MSG_YES_BUTTON_TEXT, buttonYes); | 432 | data.insert(UserNotificationHandler::MSG_YES_BUTTON_TEXT, buttonYes); | ||
409 | data.insert(UserNotificationHandler::MSG_NO_BUTTON_TEXT, buttonNo); | 433 | data.insert(UserNotificationHandler::MSG_NO_BUTTON_TEXT, buttonNo); | ||
410 | data.insert(UserNotificationHandler::MSG_DONT_ASK_AGAIN, dontAskAgainName); | 434 | data.insert(UserNotificationHandler::MSG_DONT_ASK_AGAIN, dontAskAgainName); | ||
411 | 435 | | |||
412 | // SMELL: the braindead way to support button icons | 436 | // SMELL: the braindead way to support button icons | ||
413 | // TODO: Fix this in KIO::SlaveBase. | 437 | // TODO: Fix this in KIO::SlaveBase. | ||
414 | if (buttonYes == i18n("&Details")) { | 438 | if (buttonYes == i18n("&Details")) { | ||
415 | data.insert(UserNotificationHandler::MSG_YES_BUTTON_ICON, QLatin1String("help-about")); | 439 | data.insert(UserNotificationHandler::MSG_YES_BUTTON_ICON, QLatin1String("help-about")); | ||
416 | } else if (buttonYes == i18n("&Forever")) { | 440 | } else if (buttonYes == i18n("&Forever")) { | ||
417 | data.insert(UserNotificationHandler::MSG_YES_BUTTON_ICON, QLatin1String("flag-green")); | 441 | data.insert(UserNotificationHandler::MSG_YES_BUTTON_ICON, QLatin1String("flag-green")); | ||
418 | } | 442 | } | ||
419 | 443 | | |||
420 | if (buttonNo == i18n("Co&ntinue")) { | 444 | if (buttonNo == i18n("Co&ntinue")) { | ||
421 | data.insert(UserNotificationHandler::MSG_NO_BUTTON_ICON, QLatin1String("arrow-right")); | 445 | data.insert(UserNotificationHandler::MSG_NO_BUTTON_ICON, QLatin1String("arrow-right")); | ||
422 | } else if (buttonNo == i18n("&Current Session only")) { | 446 | } else if (buttonNo == i18n("&Current Session only")) { | ||
423 | data.insert(UserNotificationHandler::MSG_NO_BUTTON_ICON, QLatin1String("chronometer")); | 447 | data.insert(UserNotificationHandler::MSG_NO_BUTTON_ICON, QLatin1String("chronometer")); | ||
424 | } | 448 | } | ||
425 | 449 | | |||
426 | if (type == KIO::SlaveBase::SSLMessageBox) { | 450 | if (type == KIO::SlaveBase::SSLMessageBox) { | ||
427 | data.insert(UserNotificationHandler::MSG_META_DATA, d->sslMetaData.toVariant()); | 451 | data.insert(UserNotificationHandler::MSG_META_DATA, d->sslMetaData.toVariant()); | ||
428 | } | 452 | } | ||
429 | 453 | | |||
430 | globalUserNotificationHandler()->requestMessageBox(this, type, data); | 454 | globalUserNotificationHandler()->createRequest(this, UserNotificationHandler::REQUEST_MSGBOX, data); | ||
455 | } | ||||
456 | | ||||
457 | void SlaveInterface::requestPrivilegeConfirmation(const QString &caption, const QString &text, const QString &details) | ||||
458 | { | ||||
459 | Q_D(SlaveInterface); | ||||
460 | if (d->connection) { | ||||
461 | d->connection->suspend(); | ||||
462 | } | ||||
463 | | ||||
464 | QHash<UserNotificationHandler::MessageBoxDataType, QVariant> data; | ||||
465 | data.insert(UserNotificationHandler::MSG_TYPE, -1); | ||||
466 | data.insert(UserNotificationHandler::MSG_TEXT, text); | ||||
467 | data.insert(UserNotificationHandler::MSG_CAPTION, caption); | ||||
468 | data.insert(UserNotificationHandler::MSG_DETAILS, details); | ||||
469 | globalUserNotificationHandler()->createRequest(this, UserNotificationHandler::REQUEST_PRIVILEGE_CONFIRMATION, data); | ||||
470 | | ||||
431 | } | 471 | } | ||
432 | 472 | | |||
433 | void SlaveInterfacePrivate::slotHostInfo(const QHostInfo &info) | 473 | void SlaveInterfacePrivate::slotHostInfo(const QHostInfo &info) | ||
434 | { | 474 | { | ||
435 | QByteArray data; | 475 | QByteArray data; | ||
436 | QDataStream stream(&data, QIODevice::WriteOnly); | 476 | QDataStream stream(&data, QIODevice::WriteOnly); | ||
437 | stream << info.hostName() << info.addresses() << info.error() << info.errorString(); | 477 | stream << info.hostName() << info.addresses() << info.error() << info.errorString(); | ||
438 | connection->send(CMD_HOST_INFO, data); | 478 | connection->send(CMD_HOST_INFO, data); | ||
439 | } | 479 | } | ||
440 | 480 | | |||
441 | #include "moc_slaveinterface.cpp" | 481 | #include "moc_slaveinterface.cpp" |
This fails to build for me...
slaveinterface.cpp:291:55: error: ‘QString::QString(const char*)’ is private within this context
It needs QStringLiteral like the previous one.