Changeset View
Changeset View
Standalone View
Standalone View
src/core/simplejob.cpp
Show First 20 Lines • Show All 142 Lines • ▼ Show 20 Line(s) | 142 | q->connect(slave, SIGNAL(infoMessage(QString)), | |||
---|---|---|---|---|---|
143 | SLOT(_k_slotSlaveInfoMessage(QString))); | 143 | SLOT(_k_slotSlaveInfoMessage(QString))); | ||
144 | 144 | | |||
145 | q->connect(slave, SIGNAL(connected()), | 145 | q->connect(slave, SIGNAL(connected()), | ||
146 | SLOT(slotConnected())); | 146 | SLOT(slotConnected())); | ||
147 | 147 | | |||
148 | q->connect(slave, SIGNAL(finished()), | 148 | q->connect(slave, SIGNAL(finished()), | ||
149 | SLOT(slotFinished())); | 149 | SLOT(slotFinished())); | ||
150 | 150 | | |||
151 | q->connect(slave, SIGNAL(privilegeOperationRequested()), | ||||
dfaure: This is not a very good signal name.
Signals notify a state changed and usually end with "ed". | |||||
152 | SLOT(slotPrivilegeOperationRequested())); | ||||
153 | | ||||
151 | if ((m_extraFlags & EF_TransferJobDataSent) == 0) { // this is a "get" job | 154 | if ((m_extraFlags & EF_TransferJobDataSent) == 0) { // this is a "get" job | ||
152 | q->connect(slave, SIGNAL(totalSize(KIO::filesize_t)), | 155 | q->connect(slave, SIGNAL(totalSize(KIO::filesize_t)), | ||
153 | SLOT(slotTotalSize(KIO::filesize_t))); | 156 | SLOT(slotTotalSize(KIO::filesize_t))); | ||
154 | 157 | | |||
155 | q->connect(slave, SIGNAL(processedSize(KIO::filesize_t)), | 158 | q->connect(slave, SIGNAL(processedSize(KIO::filesize_t)), | ||
156 | SLOT(slotProcessedSize(KIO::filesize_t))); | 159 | SLOT(slotProcessedSize(KIO::filesize_t))); | ||
157 | 160 | | |||
158 | q->connect(slave, SIGNAL(speed(ulong)), | 161 | q->connect(slave, SIGNAL(speed(ulong)), | ||
▲ Show 20 Lines • Show All 173 Lines • ▼ Show 20 Line(s) | 318 | { | |||
332 | } | 335 | } | ||
333 | } | 336 | } | ||
334 | 337 | | |||
335 | void SimpleJob::storeSSLSessionFromJob(const QUrl &redirectionURL) | 338 | void SimpleJob::storeSSLSessionFromJob(const QUrl &redirectionURL) | ||
336 | { | 339 | { | ||
337 | Q_UNUSED(redirectionURL); | 340 | Q_UNUSED(redirectionURL); | ||
338 | } | 341 | } | ||
339 | 342 | | |||
343 | void SimpleJobPrivate::slotPrivilegeOperationRequested() | ||||
344 | { | ||||
345 | m_slave->send(MSG_PRIVILEGE_EXEC, QByteArray::number(tryAskPrivilegeOpConfirmation())); | ||||
346 | } | ||||
dfaure: use QLatin1String rather than QStringLiteral for comparisons | |||||
I'm not sure if the bool->int conversion is safe and guaranteed (AFAIK, in theory a bool can convert to 2 or anything else that is not 0, depending on how it was set in the first place) This would be safer if it said QByteArray::number(confirmed ? 1 : 0), but then that's even better written as confirmed ? "1" : "0", no need to call int->string conversion code; dfaure: I'm not sure if the bool->int conversion is safe and guaranteed (AFAIK, in theory a bool can… | |||||
dfaure: Check that this is consistent with SlaveBase... | |||||
347 | | ||||
340 | ////////// | 348 | ////////// | ||
341 | SimpleJob *KIO::rmdir(const QUrl &url) | 349 | SimpleJob *KIO::rmdir(const QUrl &url) | ||
342 | { | 350 | { | ||
343 | //qDebug() << "rmdir " << url; | 351 | //qDebug() << "rmdir " << url; | ||
344 | KIO_ARGS << url << qint8(false); // isFile is false | 352 | KIO_ARGS << url << qint8(false); // isFile is false | ||
345 | return SimpleJobPrivate::newJob(url, CMD_DEL, packedArgs); | 353 | return SimpleJobPrivate::newJob(url, CMD_DEL, packedArgs); | ||
346 | } | 354 | } | ||
OK, so the data is two possible strings, and the reply is two possible strings, why not use enums instead? You can define them in SlaveBase for instance. You might have to use lambdas to avoid the enum appearing in Q_PRIVATE_SLOT in public headers (and requiring slavebase.h) dfaure: OK, so the data is two possible strings, and the reply is two possible strings, why not use… | |||||
347 | 355 | | |||
348 | SimpleJob *KIO::chmod(const QUrl &url, int permissions) | 356 | SimpleJob *KIO::chmod(const QUrl &url, int permissions) | ||
349 | { | 357 | { | ||
350 | //qDebug() << "chmod " << url; | 358 | //qDebug() << "chmod " << url; | ||
351 | KIO_ARGS << url << permissions; | 359 | KIO_ARGS << url << permissions; | ||
352 | return SimpleJobPrivate::newJob(url, CMD_CHMOD, packedArgs); | 360 | return SimpleJobPrivate::newJob(url, CMD_CHMOD, packedArgs); | ||
353 | } | 361 | } | ||
354 | 362 | | |||
▲ Show 20 Lines • Show All 67 Lines • Show Last 20 Lines |
This is not a very good signal name.
Signals notify a state changed and usually end with "ed".
Would it make sense to call this privilegeOperationRequested() or something?
I need to find more about when this is emitted and what the data is ;)