36 #include <QtDBus/QtDBus>
37 #include <QtCore/QPointer>
38 #include <QtNetwork/QSslCertificate>
39 #include <QtNetwork/QSslError>
79 assert( d->connection );
84 int ret = d->connection->read( &cmd, data );
94 if (d->slave_calcs_speed) {
95 d->speed_timer.stop();
100 gettimeofday(&tv, 0);
102 long diff = ((tv.tv_sec - d->start_time.tv_sec) * 1000000 +
103 tv.tv_usec - d->start_time.tv_usec) / 1000;
104 if (diff - d->last_time >= 900) {
109 for (
unsigned int i = 1; i <
max_nums; ++i) {
110 d->times[i-1] = d->times[i];
111 d->sizes[i-1] = d->sizes[i];
115 d->times[d->nums] = diff;
116 d->sizes[d->nums++] = d->filesize - d->offset;
118 KIO::filesize_t lspeed = 1000 * (d->sizes[d->nums-1] - d->sizes[0]) / (d->times[d->nums-1] - d->times[0]);
130 d->sizes[0] = d->filesize - d->offset;
136 #ifndef KDE_USE_FINAL // already defined in slavebase.cpp
141 template<
int T>
struct PIDType {
typedef pid_t PID_t; } ;
142 template<>
struct PIDType<2> {
typedef qint16 PID_t; } ;
143 template<>
struct PIDType<4> {
typedef qint32 PID_t; } ;
151 QDataStream stream(rawdata);
171 d->speed_timer.stop();
186 for (uint i = 0; i < count; i++) {
199 d->filesize = d->offset;
204 kDebug(7007) <<
"error " << i <<
" " << str1;
208 PIDType<sizeof(pid_t)>::PID_t stream_pid;
211 stream >> stream_pid >> protocol >> str1 >> b;
226 gettimeofday(&d->start_time, 0);
228 d->filesize = d->offset;
229 d->sizes[0] = d->filesize - d->offset;
232 d->speed_timer.start(1000);
233 d->slave_calcs_speed =
false;
250 d->slave_calcs_speed =
true;
251 d->speed_timer.stop();
268 if (!d->connection->suspended())
269 d->connection->sendnow(
CMD_NONE, QByteArray());
276 kDebug(7007) <<
"needs a msg box";
279 stream >> type >> text >> caption >> buttonYes >> buttonNo;
280 if (stream.atEnd()) {
281 messageBox(type, text, caption, buttonYes, buttonNo);
283 stream >> dontAskAgainName;
284 messageBox(type, text, caption, buttonYes, buttonNo, dontAskAgainName);
297 if (m.contains(QLatin1String(
"ssl_in_use"))) {
298 const QLatin1String ssl_(
"ssl_");
300 for (MetaData::ConstIterator it = constM.lowerBound(ssl_); it != constM.constEnd(); ++it) {
301 if (it.key().startsWith(ssl_)) {
302 d->sslMetaData.insert(it.key(), it.value());
315 stream >> host >> slaveid;
322 stream >> host >> slaveid;
337 kWarning(7007) <<
"Slave sends unknown command (" << _cmd <<
"), dropping slave";
358 kDebug(7007) <<
"requestNetwork " << host << slaveid;
359 QByteArray packedArgs;
360 QDataStream stream( &packedArgs, QIODevice::WriteOnly );
367 kDebug(7007) <<
"dropNetwork " << host << slaveid;
373 kDebug(7007) <<
"ok for resuming:" << resume;
387 kDebug(7007) <<
"messageBox " << type <<
" " << text <<
" - " << caption <<
" " << dontAskAgainName;
388 QByteArray packedArgs;
389 QDataStream stream( &packedArgs, QIODevice::WriteOnly );
391 QPointer<SlaveInterface> me =
this;
392 if (d->connection) d->connection->suspend();
393 int result = d->messageBox( type, text, caption, buttonYes, buttonNo, dontAskAgainName );
394 if ( me && d->connection )
396 d->connection->resume();
397 kDebug(7007) <<
this <<
" SlaveInterface result=" << result;
412 return d->parentWindow;
419 kDebug() << type << text <<
"caption=" << caption;
427 if (buttonYes ==
i18n(
"&Details"))
428 buttonYesGui =
KGuiItem(buttonYes,
"help-about");
429 else if (buttonYes ==
i18n(
"&Forever"))
430 buttonYesGui =
KGuiItem(buttonYes,
"flag-green");
434 if (buttonNo ==
i18n(
"Co&ntinue"))
435 buttonNoGui =
KGuiItem(buttonNo,
"arrow-right");
436 else if (buttonNo ==
i18n(
"&Current Session only"))
437 buttonNoGui =
KGuiItem(buttonNo,
"chronometer");
445 buttonNoGui, dontAskAgainName);
450 buttonNoGui, dontAskAgainName);
455 KStandardGuiItem::cancel(), dontAskAgainName);
460 KStandardGuiItem::cancel(), dontAskAgainName);
471 QStringList sl = meta[
"ssl_peer_chain"].split(
'\x01', QString::SkipEmptyParts);
473 bool decodedOk =
true;
474 foreach (
const QString &s, sl) {
475 certChain.append(QSslCertificate(s.toLatin1()));
476 if (certChain.last().isNull()) {
482 if (decodedOk ||
true) {
483 kid->setSslInfo(certChain,
486 meta[
"ssl_protocol_version"],
488 meta[
"ssl_cipher_used_bits"].toInt(),
489 meta[
"ssl_cipher_bits"].toInt(),
492 kDebug(7024) <<
"Showing SSL Info dialog";
494 kDebug(7024) <<
"SSL Info dialog closed";
497 "appears to be corrupt."),
506 kWarning(7024) <<
"Unknown type" << type;
518 QDataStream stream(&data, QIODevice::WriteOnly);
519 stream << info.hostName() << info.addresses() << info.error() << info.errorString();
523 #include "slaveinterface.moc"