Commit fcd7ab48 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Use Q_EMIT

parent 11e0618f
......@@ -252,7 +252,7 @@ bool AutoPasteModel::setData(const QModelIndex &index, const QVariant &value, in
return false;
}
emit dataChanged(index, index);
Q_EMIT dataChanged(index, index);
return true;
}
......
......@@ -17,8 +17,7 @@
#include <kwallet.h>
DlgWebinterface::DlgWebinterface(QDialog *parent)
: QWidget(parent),
m_wallet(nullptr)
: QWidget(parent)
{
setupUi(this);
......@@ -66,7 +65,7 @@ void DlgWebinterface::saveSettings()
if (m_wallet) {
m_wallet->writePassword("Webinterface", webinterfacePwd->text());
}
emit saved();
Q_EMIT saved();
}
......@@ -100,7 +100,7 @@ void IntegrationPreferences::slotAddItem()
ui.pattern->clear();
ui.pattern->setFocus();
emit changed();
Q_EMIT changed();
}
void IntegrationPreferences::slotRemoveItem()
......@@ -111,7 +111,7 @@ void IntegrationPreferences::slotRemoveItem()
const QModelIndex index = selection->selectedRows().first();
m_model->removeRow(index.row());
}
emit changed();
Q_EMIT changed();
}
}
......@@ -120,7 +120,7 @@ void IntegrationPreferences::slotIncreasePriority()
const int row = ui.list->currentIndex().row();
m_model->moveItem(row, row - 1);
slotUpdateButtons();
emit changed();
Q_EMIT changed();
}
void IntegrationPreferences::slotDecreasePriority()
......@@ -128,6 +128,6 @@ void IntegrationPreferences::slotDecreasePriority()
const int row = ui.list->currentIndex().row();
m_model->moveItem(row, row + 2);
slotUpdateButtons();
emit changed();
Q_EMIT changed();
}
......@@ -98,7 +98,7 @@ void PreferencesDialog::slotToggleAfterFinishAction(int state)
void PreferencesDialog::updateWidgetsDefault()
{
emit resetDefaults();
Q_EMIT resetDefaults();
KConfigDialog::updateWidgetsDefault();
}
......
......@@ -150,5 +150,5 @@ void TransfersGroupTree::changeIcon(const QString &icon)
group->setIconName(icon);
}
}
emit dataChanged(indexList.first(),indexList.last());
Q_EMIT dataChanged(indexList.first(),indexList.last());
}
......@@ -139,7 +139,7 @@ void DataSourceFactory::slotFoundFileSize(TransferDataSource *source, KIO::files
{
m_size = fileSize;
qCDebug(KGET_DEBUG) << source << "found size" << m_size << "and is assigned segments" << segmentRange << this;
emit dataSourceFactoryChange(Transfer::Tc_TotalSize);
Q_EMIT dataSourceFactoryChange(Transfer::Tc_TotalSize);
init();
......@@ -497,7 +497,7 @@ void DataSourceFactory::slotUrlChanged(const QUrl &old, const QUrl &newUrl)
{
TransferDataSource * ds = m_sources.take(old);
m_sources[newUrl] = ds;
emit dataSourceFactoryChange(Transfer::Tc_Source | Transfer::Tc_FileName);
Q_EMIT dataSourceFactoryChange(Transfer::Tc_Source | Transfer::Tc_FileName);
}
void DataSourceFactory::removeMirror(const QUrl &url)
......@@ -765,7 +765,7 @@ void DataSourceFactory::slotDataWritten(KIO::Job *job, KIO::filesize_t written)
if (written == tempSize)//TODO if not same cache it temporarily!
{
m_downloadedSize += written;
emit dataSourceFactoryChange(Transfer::Tc_DownloadedSize);
Q_EMIT dataSourceFactoryChange(Transfer::Tc_DownloadedSize);
// m_tempCache.clear();
}
......@@ -783,7 +783,7 @@ void DataSourceFactory::slotPercent(KJob* job, ulong p)
{
Q_UNUSED(job)
m_percent = p;
emit dataSourceFactoryChange(Transfer::Tc_Percent);
Q_EMIT dataSourceFactoryChange(Transfer::Tc_Percent);
}
void DataSourceFactory::speedChanged()
......@@ -799,7 +799,7 @@ void DataSourceFactory::speedChanged()
m_percent = percent;
Transfer::ChangesFlags change = (percentChanged ? (Transfer::Tc_DownloadSpeed | Transfer::Tc_Percent) : Transfer::Tc_DownloadSpeed);
emit dataSourceFactoryChange(change);
Q_EMIT dataSourceFactoryChange(change);
}
void DataSourceFactory::killPutJob()
......@@ -943,7 +943,7 @@ void DataSourceFactory::slotRepair(const QList<KIO::fileoffset_t> &offsets, KIO:
change |= Transfer::Tc_Percent;
m_percent = (m_downloadedSize * 100 / m_size);
}
emit dataSourceFactoryChange(change);
Q_EMIT dataSourceFactoryChange(change);
m_status = Job::Stopped;
start();
......@@ -1063,7 +1063,7 @@ void DataSourceFactory::load(const QDomElement *element)
//m_status = static_cast<Job::Status>(e.attribute("status").toInt());
if (change != Transfer::Tc_None) {
emit dataSourceFactoryChange(change);
Q_EMIT dataSourceFactoryChange(change);
}
}
......@@ -1111,7 +1111,7 @@ void DataSourceFactory::changeStatus(Job::Status status)
break;
}
emit dataSourceFactoryChange(change);
Q_EMIT dataSourceFactoryChange(change);
}
void DataSourceFactory::save(const QDomElement &element)
......@@ -1264,7 +1264,7 @@ void DataSourceFactory::slotUpdateCapabilities()
if (oldCaps != newCaps) {
m_capabilities = newCaps;
emit capabilitiesChanged();
Q_EMIT capabilitiesChanged();
}
}
......
......@@ -53,7 +53,7 @@ void Download::slotResult(KJob * job)
//TODO: Do a Message box here
torrentFile.write(m_data);
torrentFile.close();
emit finishedSuccessfully(m_destUrl, m_data);
Q_EMIT finishedSuccessfully(m_destUrl, m_data);
m_data = nullptr;
break;
}
......@@ -61,14 +61,14 @@ void Download::slotResult(KJob * job)
{
qCDebug(KGET_DEBUG) << "ERROR - File already exists";
QFile file(m_destUrl.toLocalFile());
emit finishedSuccessfully(m_destUrl, file.readAll());
Q_EMIT finishedSuccessfully(m_destUrl, file.readAll());
m_data = nullptr;
break;
}
default:
qCDebug(KGET_DEBUG) << "We are sorry to say you, that there were errors while downloading :(";
m_data = nullptr;
emit finishedWithError();
Q_EMIT finishedWithError();
break;
}
}
......
......@@ -526,11 +526,11 @@ int FileModel::rowCount(const QModelIndex &parent) const
void FileModel::changeData(int row, int column, FileItem *item, bool finished)
{
QModelIndex index = createIndex(row, column, item);
emit dataChanged(index, index);
Q_EMIT dataChanged(index, index);
if (finished) {
const QUrl file = getUrl(index);
emit fileFinished(file);
Q_EMIT fileFinished(file);
}
}
......@@ -672,7 +672,7 @@ void FileModel::rename(const QModelIndex &file, const QString &newName)
setData(file, newName);
emit rename(oldUrl, newUrl);
Q_EMIT rename(oldUrl, newUrl);
}
void FileModel::renameFailed(const QUrl &beforeRename, const QUrl &afterRename)
......@@ -690,7 +690,7 @@ void FileModel::stopWatchCheckState()
{
if (m_checkStateChanged)
{
emit checkStateChanged();
Q_EMIT checkStateChanged();
}
m_checkStateChanged = false;
......
......@@ -53,7 +53,7 @@ void KGetGlobalJob::update()
else
percent = 0;
emit description(this, "KGet global information",
Q_EMIT description(this, "KGet global information",
qMakePair(QString("source"), i18np("KGet is downloading %1 file", "KGet is downloading %1 files", runningTransfers)));
emitSpeed(speed);
......@@ -66,7 +66,7 @@ void KGetGlobalJob::update()
bool KGetGlobalJob::doKill()
{
qCDebug(KGET_DEBUG) << "Kill of global job called:" << this;
emit requestStop(this, nullptr);
Q_EMIT requestStop(this, nullptr);
return KJob::doKill();
}
......@@ -44,7 +44,7 @@ unsigned long KGetKJobAdapter::percent() const
void KGetKJobAdapter::slotUpdateDescription()
{
emit description(this, i18n("KGet Transfer"),
Q_EMIT description(this, i18n("KGet Transfer"),
qMakePair(QString("source"), m_transferHandler->source().toString()),
qMakePair(QString("destination"), m_transferHandler->dest().toString()));
......@@ -57,14 +57,14 @@ void KGetKJobAdapter::slotUpdateDescription()
bool KGetKJobAdapter::doKill()
{
qCDebug(KGET_DEBUG) << "Kill of job adapter called:" << this << m_transferHandler->dest();
emit requestStop(this, m_transferHandler);
Q_EMIT requestStop(this, m_transferHandler);
return KJob::doKill();
}
bool KGetKJobAdapter::doSuspend()
{
if (m_transferHandler->capabilities() & Transfer::Cap_Resuming) {
emit requestSuspend(this, m_transferHandler);
Q_EMIT requestSuspend(this, m_transferHandler);
return true;
}
......@@ -73,6 +73,6 @@ bool KGetKJobAdapter::doSuspend()
bool KGetKJobAdapter::doResume()
{
emit requestResume(this, m_transferHandler);
Q_EMIT requestResume(this, m_transferHandler);
return true;
}
......@@ -80,7 +80,7 @@ void LinkImporter::copyRemoteFile()
KIO::CopyJob *job = KIO::copy(m_url, aux, KIO::HideProgressInfo);
if(!job->exec()) {
emit error(ki18n("Error trying to get %1").subs(m_url.url()));
Q_EMIT error(ki18n("Error trying to get %1").subs(m_url.url()));
}
}
......@@ -109,12 +109,12 @@ void LinkImporter::slotReadFile(const QUrl &url)
regexPos += rx.matchedLength();
position = lastPosition + regexPos;
emit progress(position * 100 / size);
Q_EMIT progress(position * 100 / size);
}
position += line.size();
emit progress(position * 100 / size);
Q_EMIT progress(position * 100 / size);
}
if(!m_url.isLocalFile()) {
......
......@@ -163,7 +163,7 @@ void Signature::setSignature(const QByteArray &signature, SignatureType type)
d->verificationResult = GpgME::VerificationResult();
#endif //HAVE_QGPGME
emit verified(d->status);//FIXME
Q_EMIT verified(d->status);//FIXME
}
Signature::SignatureType Signature::type() const
......@@ -210,7 +210,7 @@ void Signature::slotVerified(const GpgME::VerificationResult &result)
if (!d->verificationResult.numSignatures()) {
qCDebug(KGET_DEBUG) << "No signatures\n";
emit verified(d->status);
Q_EMIT verified(d->status);
return;
}
......@@ -230,7 +230,7 @@ void Signature::slotVerified(const GpgME::VerificationResult &result)
i18n("The key to verify the signature is missing, do you want to download it?")) == KMessageBox::Yes)) {
d->verifyTried = true;
downloadKey(d->fingerprint);
emit verified(d->status);
Q_EMIT verified(d->status);
return;
}
}
......@@ -254,7 +254,7 @@ void Signature::slotVerified(const GpgME::VerificationResult &result)
}
}
emit verified(d->status);
Q_EMIT verified(d->status);
}
#endif //HAVE_QGPGME
......
......@@ -70,7 +70,7 @@ void SignatureThread::run()
GpgME::VerificationResult result = SignaturePrivate::verify(dest, sig);
if (!m_abort) {
emit verified(result);
Q_EMIT verified(result);
}
}
#else //HAVE_QGPGME
......
......@@ -62,7 +62,7 @@ void Transfer::setCapabilities(Capabilities capabilities)
{
if (m_capabilities != capabilities) {
m_capabilities = capabilities;
emit capabilitiesChanged();
Q_EMIT capabilitiesChanged();
}
}
......
......@@ -38,7 +38,7 @@ Transfer::Capabilities TransferDataSource::capabilities() const
void TransferDataSource::setCapabilities(Transfer::Capabilities capabilities)
{
m_capabilities = capabilities;
emit capabilitiesChanged();
Q_EMIT capabilitiesChanged();
}
void TransferDataSource::findFileSize(KIO::fileoffset_t segmentSize)
......
......@@ -59,14 +59,14 @@ void SQLiteStore::load()
item.setSize(query.value(rec.indexOf("size")).toInt());
m_items << item;
emit elementLoaded(query.at(), query.size(), item);
Q_EMIT elementLoaded(query.at(), query.size(), item);
}
}
}
sql().close();
emit loadFinished();
Q_EMIT loadFinished();
}
void SQLiteStore::clear()
......@@ -109,7 +109,7 @@ void SQLiteStore::saveItems(const QList<TransferHistoryItem> &items)
}
sql().close();
emit saveFinished();
Q_EMIT saveFinished();
}
void SQLiteStore::deleteItem(const TransferHistoryItem &item)
......@@ -131,7 +131,7 @@ void SQLiteStore::deleteItem(const TransferHistoryItem &item)
}
sql().close();
emit deleteFinished();
Q_EMIT deleteFinished();
}
QSqlDatabase SQLiteStore::sql()
......
......@@ -164,7 +164,7 @@ void XmlStore::LoadThread::run()
item.setDateTime(QDateTime::fromSecsSinceEpoch(dom.attribute("Time").toUInt()));
item.setState(dom.attribute("State").toInt());
emit elementLoaded(i, total, item);
Q_EMIT elementLoaded(i, total, item);
}
doc.clear();
file.close();
......@@ -249,7 +249,7 @@ void XmlStore::slotDeleteElement()
m_items.clear();
m_items << m_deleteThread->items();
emit loadFinished();
Q_EMIT loadFinished();
}
......@@ -215,7 +215,7 @@ void TransferTreeModel::addGroup(TransferGroup * group)
m_transferGroups.append(static_cast<GroupModelItem*>(items.first()));
emit groupAddedEvent(group->handler());
Q_EMIT groupAddedEvent(group->handler());
KGet::m_scheduler->addQueue(group);
}
......@@ -242,7 +242,7 @@ void TransferTreeModel::delGroup(TransferGroup * group)
m_changedGroups.removeAll(group->handler());
emit groupRemovedEvent(group->handler());
Q_EMIT groupRemovedEvent(group->handler());
KGet::m_scheduler->delQueue(group);
}
......@@ -281,7 +281,7 @@ void TransferTreeModel::addTransfers(const QList<Transfer*> &transfers, Transfer
//notify the rest of the changes
blockSignals(false);
endInsertRows();
emit transfersAddedEvent(handlers);
Q_EMIT transfersAddedEvent(handlers);
}
void TransferTreeModel::delTransfers(const QList<Transfer*> &t)
......@@ -308,7 +308,7 @@ void TransferTreeModel::delTransfers(const QList<Transfer*> &t)
}
}
emit transfersAboutToBeRemovedEvent(handlers);
Q_EMIT transfersAboutToBeRemovedEvent(handlers);
//remove the items from the model
{
......@@ -359,7 +359,7 @@ void TransferTreeModel::delTransfers(const QList<Transfer*> &t)
}
}
emit transfersRemovedEvent(handlers);
Q_EMIT transfersRemovedEvent(handlers);
}
TransferModelItem * TransferTreeModel::itemFromTransferHandler(TransferHandler * handler)
......@@ -433,7 +433,7 @@ void TransferTreeModel::moveTransfer(Transfer * transfer, TransferGroup * destGr
itemFromHandler(destGroup->handler())->insertRow(destGroup->indexOf(transfer), items);
if (!sameGroup)
emit transferMovedEvent(transfer->handler(), destGroup->handler());
Q_EMIT transferMovedEvent(transfer->handler(), destGroup->handler());
KGet::selectionModel()->clearSelection();
}
......@@ -715,7 +715,7 @@ void TransferTreeModel::timerEvent(QTimerEvent *event)
ModelItem * item = itemFromHandler(group);
Transfer::ChangesFlags changesFlags = transfer->changesFlags();
emit transfer->transferChangedEvent(transfer, changesFlags);
Q_EMIT transfer->transferChangedEvent(transfer, changesFlags);
int row = group->indexOf(transfer);
......@@ -744,7 +744,7 @@ void TransferTreeModel::timerEvent(QTimerEvent *event)
}
if(!updatedTransfers.isEmpty())
emit transfersChangedEvent(updatedTransfers);
Q_EMIT transfersChangedEvent(updatedTransfers);
foreach(TransferGroupHandler * group, m_changedGroups)
{
......@@ -752,7 +752,7 @@ void TransferTreeModel::timerEvent(QTimerEvent *event)
{
TransferGroup::ChangesFlags changesFlags = group->changesFlags();
emit group->groupChangedEvent(group, changesFlags);
Q_EMIT group->groupChangedEvent(group, changesFlags);
int row = itemFromHandler(group)->row();
......@@ -774,7 +774,7 @@ void TransferTreeModel::timerEvent(QTimerEvent *event)
QStandardItem *groupItem = itemFromHandler(group);
dynamic_cast<ModelItem*>(invisibleRootItem()->child(groupItem->row(), i))->emitDataChanged();
//QModelIndex index = createIndex(m_transferGroups.indexOf(group->m_group), i, group);
//emit dataChanged(index,index);
//Q_EMIT dataChanged(index,index);
}
}*/
......@@ -784,7 +784,7 @@ void TransferTreeModel::timerEvent(QTimerEvent *event)
}
if(!updatedGroups.isEmpty())
emit groupsChangedEvent(updatedGroups);
Q_EMIT groupsChangedEvent(updatedGroups);
m_changedTransfers.clear();
m_changedGroups.clear();
......
......@@ -107,7 +107,7 @@ bool VerificationModel::setData(const QModelIndex &index, const QVariant &value,
const QString type = value.toString();
if (Verifier::supportedVerficationTypes().contains(type) && !d->types.contains(type)) {
d->types[index.row()] = type;
emit dataChanged(index, index);
Q_EMIT dataChanged(index, index);
return true;
}
} else if ((index.column() == VerificationModel::Checksum) && role == Qt::EditRole) {
......@@ -116,12 +116,12 @@ bool VerificationModel::setData(const QModelIndex &index, const QVariant &value,
const QString checksum = value.toString();
if (Verifier::isChecksum(type, checksum)) {
d->checksums[index.row()] = checksum;
emit dataChanged(index, index);
Q_EMIT dataChanged(index, index);
return true;
}
} else if (index.column() == VerificationModel::Verified && role == Qt::EditRole) {
d->verificationStatus[index.row()] = value.toInt();
emit dataChanged(index, index);
Q_EMIT dataChanged(index, index);
return true;
}
......@@ -189,7 +189,7 @@ void VerificationModel::addChecksum(const QString &type, const QString &checksum
if (position > -1) {
d->checksums[position] = checksum;
const QModelIndex index = this->index(position, VerificationModel::Checksum, QModelIndex());
emit dataChanged(index, index);
Q_EMIT dataChanged(index, index);
return;
}
......@@ -216,6 +216,6 @@ void VerificationModel::setVerificationStatus(const QString &type, int verified)
if (position > -1) {
d->verificationStatus[position] = verified;
const QModelIndex index = this->index(position, VerificationModel::Verified, QModelIndex());
emit dataChanged(index, index);
Q_EMIT dataChanged(index, index);
}
}
......@@ -124,8 +124,8 @@ void VerificationThread::doVerify()
m_mutex.lock();
if (!m_abort)
{
emit verified(type, fileVerified, url);
emit verified(fileVerified);
Q_EMIT verified(type, fileVerified, url);
Q_EMIT verified(fileVerified);
}
run = m_files.count();
m_mutex.unlock();
......@@ -149,28 +149,28 @@ void VerificationThread::doBrokenPieces()
QFile file(url.toString());
if (!file.open(QIODevice::ReadOnly))
{
emit brokenPieces(broken, length);
Q_EMIT brokenPieces(broken, length);
return;
}
const KIO::filesize_t fileSize = file.size();
if (!length || !fileSize)
{
emit brokenPieces(broken, length);
Q_EMIT brokenPieces(broken, length);
return;
}
const QStringList fileChecksums = Verifier::partialChecksums(url, type, length, &m_abort).checksums();
if (m_abort)
{
emit brokenPieces(broken, length);
Q_EMIT brokenPieces(broken, length);
return;
}
if (fileChecksums.size() != checksums.size())
{
qCDebug(KGET_DEBUG) << "Number of checksums differs!";
emit brokenPieces(broken, length);
Q_EMIT brokenPieces(broken, length);
return;
}
......@@ -185,5 +185,5 @@ void VerificationThread::doBrokenPieces()
}
}
emit brokenPieces(broken, length);
Q_EMIT brokenPieces(broken, length);
}
......@@ -357,7 +357,7 @@ void Verifier::changeStatus(const QString &type, bool isVerified)
qCDebug(KGET_DEBUG) << "Verified:" << isVerified;
d->status = isVerified ? Verifier::Verified : Verifier::NotVerified;
d->model->setVerificationStatus(type, d->status);
emit verified(isVerified);
Q_EMIT verified(isVerified);
}
void Verifier::verify(const QModelIndex &index)
......
......@@ -165,7 +165,7 @@ class KGET_EXPORT Verifier : public QObject