int nGroups = model->rowCount(QModelIndex());
for (int i = 0; i < nGroups; i++) {
- kDebug(5001) << "openEditor for row " << i;
+ kDebug() << "openEditor for row " << i;
openPersistentEditor(model->index(i, TransferTreeModel::Status, QModelIndex()));
}
{
if (!parent.isValid()) {
for (int i = start; i <= end; ++i) {
- kDebug(5001) << "openEditor for row " << i;
+ kDebug() << "openEditor for row " << i;
openPersistentEditor(model()->index(i, TransferTreeModel::Status, parent));
}
}
void TransfersGroupTree::changeIcon(const QString &icon)
{
- kDebug(5001);
TransferTreeSelectionModel *selModel = KGet::selectionModel();
QModelIndexList indexList = selModel->selectedRows();
: m_srcUrl(srcUrl),
m_destUrl(destUrl)
{
- kDebug(5001) << "DownloadFile: " << m_srcUrl.url() << " to dest: " << m_destUrl.url();
+ kDebug() << "DownloadFile: " << m_srcUrl.url() << " to dest: " << m_destUrl.url();
m_copyJob = KIO::get(m_srcUrl, KIO::NoReload, KIO::HideProgressInfo);
connect(m_copyJob, SIGNAL(data(KIO::Job*,QByteArray)), SLOT(slotData(KIO::Job*,QByteArray)));
connect(m_copyJob, SIGNAL(result(KJob*)), SLOT(slotResult(KJob*)));
void Download::slotData(KIO::Job *job, const QByteArray& data)
{
Q_UNUSED(job)
- kDebug(5001);
/**if (data.size() == 0)
{
slotResult(job);
void Download::slotResult(KJob * job)
{
- kDebug(5001);
switch (job->error())
{
case 0://The download has finished
{
- kDebug(5001) << "Downloading successfully finished" << m_destUrl.url();
+ kDebug() << "Downloading successfully finished" << m_destUrl.url();
QFile torrentFile(m_destUrl.toLocalFile());
if (!torrentFile.open(QIODevice::WriteOnly | QIODevice::Text)) {}
//TODO: Do a Message box here
}
case KIO::ERR_FILE_ALREADY_EXIST:
{
- kDebug(5001) << "ERROR - File already exists";
+ kDebug() << "ERROR - File already exists";
QFile file(m_destUrl.toLocalFile());
emit finishedSuccessfully(m_destUrl, file.readAll());
m_data = 0;
break;
}
default:
- kDebug(5001) << "We are sorry to say you, that there were errors while downloading :(";
+ kDebug() << "We are sorry to say you, that there were errors while downloading :(";
m_data = 0;
emit finishedWithError();
break;
void Job::setStartStatus(Status jobStatus)
{
- kDebug(5001) << "Setting start status to " << jobStatus;
+ kDebug() << "Setting start status to " << jobStatus;
m_startStatus = jobStatus;
}
if(jobPolicy == m_policy)
return;
- kDebug(5001) << "Job::setPolicy(" << jobPolicy << ")";
+ kDebug() << "Job::setPolicy(" << jobPolicy << ")";
m_policy = jobPolicy;
m_scheduler->jobChangedEvent(this, m_policy);
void JobQueue::move(Job * job, Job * after)
{
- kDebug(5001) << "JobQueue::move";
+ kDebug() << "JobQueue::move";
if( (m_jobs.removeAll(job) == 0) || (job == after) ||
((after) && (after->jobQueue() != this)) )
bool KGet::addGroup(const QString& groupName)
{
- kDebug(5001);
-
// Check if a group with that name already exists
if (m_transferTreeModel->findGroup(groupName))
return false;
{
srcUrl = mostLocalUrl(srcUrl);
// Note: destDir may actually be a full path to a file :-(
- kDebug(5001) << "Source:" << srcUrl.url() << ", dest: " << destDir << ", sugg file: " << suggestedFileName;
+ kDebug() << "Source:" << srcUrl.url() << ", dest: " << destDir << ", sugg file: " << suggestedFileName;
KUrl destUrl; // the final destination, including filename
KUrl destUrl = KUrl(e.attribute("Dest"));
data << TransferData(srcUrl, destUrl, groupName, false, &e);
- kDebug(5001) << "src=" << srcUrl << " dest=" << destUrl << " group=" << groupName;
+ kDebug() << "src=" << srcUrl << " dest=" << destUrl << " group=" << groupName;
}
return createTransfers(data);
QList<TransferHandler *> KGet::selectedTransfers()
{
-// kDebug(5001) << "KGet::selectedTransfers";
+ // kDebug() << "KGet::selectedTransfers";
QList<TransferHandler *> selectedTransfers;
void KGet::load( QString filename ) // krazy:exclude=passbyvalue
{
- kDebug(5001) << "(" << filename << ")";
+ kDebug() << "(" << filename << ")";
if(filename.isEmpty())
filename = KStandardDirs::locateLocal("appdata", "transfers.kgt");
QFile file(tmpFile);
QDomDocument doc;
- kDebug(5001) << "file:" << filename;
+ kDebug() << "file:" << filename;
if(doc.setContent(&file))
{
{
TransferGroup * foundGroup = m_transferTreeModel->findGroup( nodeList.item(i).toElement().attribute("Name") );
- kDebug(5001) << "KGet::load -> group = " << nodeList.item(i).toElement().attribute("Name");
+ kDebug() << "KGet::load -> group = " << nodeList.item(i).toElement().attribute("Name");
if( !foundGroup )
{
- kDebug(5001) << "KGet::load -> group not found";
+ kDebug() << "KGet::load -> group not found";
TransferGroup * newGroup = new TransferGroup(m_transferTreeModel, m_scheduler);
}
else
{
- kDebug(5001) << "KGet::load -> group found";
+ kDebug() << "KGet::load -> group found";
//A group with this name already exists.
//Integrate the group's transfers with the ones read from file
}
else
{
- kWarning(5001) << "Error reading the transfers file";
+ kWarning() << "Error reading the transfers file";
}
if (m_transferTreeModel->transferGroups().isEmpty()) //Create the default group
KSaveFile file(filename);
if ( !file.open( QIODevice::WriteOnly ) )
{
- //kWarning(5001)<<"Unable to open output file when saving";
+ // kWarning() << "Unable to open output file when saving";
KGet::showNotification(m_mainWindow, "error",
i18n("Unable to save to: %1", filename));
return;
void KGet::checkSystemTray()
{
- kDebug(5001);
bool running = false;
foreach (TransferHandler *handler, KGet::allTransfers())
void KGet::settingsChanged()
{
- kDebug(5001);
-
foreach (TransferFactory *factory, m_transferFactories)
{
factory->settingsChanged();
QStringList urlsFailed;
foreach (const TransferData &data, dataItems) {
- kDebug(5001) << "srcUrl=" << data.src << " destUrl=" << data.dest << " group=" << data.groupName;
+ kDebug() << "srcUrl=" << data.src << " destUrl=" << data.dest << " group=" << data.groupName;
TransferGroup *group = m_transferTreeModel->findGroup(data.groupName);
if (!group) {
- kDebug(5001) << "KGet::createTransfer -> group not found";
+ kDebug() << "KGet::createTransfer -> group not found";
group = m_transferTreeModel->transferGroups().first();
}
Transfer *newTransfer = 0;
foreach (TransferFactory *factory, m_transferFactories) {
- kDebug(5001) << "Trying plugin n.plugins=" << m_transferFactories.size();
+ kDebug() << "Trying plugin n.plugins=" << m_transferFactories.size();
if ((newTransfer = factory->createTransfer(data.src, data.dest, group, m_scheduler))) {
- // kDebug(5001) << "KGet::createTransfer -> CREATING NEW TRANSFER ON GROUP: _" << group->name() << "_";
+ // kDebug() << "KGet::createTransfer -> CREATING NEW TRANSFER ON GROUP: _" << group->name() << "_";
newTransfer->create();
newTransfer->load(data.e);
handlers << newTransfer->handler();
}
if (!newTransfer) {
urlsFailed << data.src.url();
- kWarning(5001) << "Warning! No plugin found to handle" << data.src;
+ kWarning() << "Warning! No plugin found to handle" << data.src;
}
}
TransferDataSource * KGet::createTransferDataSource(const KUrl &src, const QDomElement &type, QObject *parent)
{
- kDebug(5001);
-
TransferDataSource *dataSource;
foreach (TransferFactory *factory, m_transferFactories)
{
bool KGet::isValidDestDirectory(const QString & destDir)
{
- kDebug(5001) << destDir;
+ kDebug() << destDir;
if (!QFileInfo(destDir).isDir())
{
if (QFileInfo(KUrl(destDir).directory()).isWritable())
for ( int i = 0; i < offers.count(); ++i )
{
services[ offers[i]->property( "X-KDE-KGet-rank" ).toInt() ] = offers[i];
- kDebug(5001) << " TransferFactory plugin found:\n" <<
+ kDebug() << " TransferFactory plugin found:\n" <<
" rank = " << offers[i]->property( "X-KDE-KGet-rank" ).toInt() << '\n' <<
" plugintype = " << offers[i]->property( "X-KDE-KGet-plugintype" );
}
info.load(plugins);
if( !info.isPluginEnabled() ) {
- kDebug(5001) << "TransferFactory plugin (" << service->library()
- << ") found, but not enabled";
+ kDebug() << "TransferFactory plugin (" << service->library()
+ << ") found, but not enabled";
continue;
}
const QString pluginName = info.name();
pluginList.prepend(plugin);
- kDebug(5001) << "TransferFactory plugin (" << (service)->library()
- << ") found and added to the list of available plugins";
+ kDebug() << "TransferFactory plugin (" << (service)->library()
+ << ") found and added to the list of available plugins";
}
else
{
- kDebug(5001) << "Error loading TransferFactory plugin ("
- << service->library() << ")";
+ kDebug() << "Error loading TransferFactory plugin ("
+ << service->library() << ")";
}
}
m_transferFactories.append(qobject_cast<TransferFactory *>(plugin));
}
- kDebug(5001) << "Number of factories = " << m_transferFactories.size();
+ kDebug() << "Number of factories = " << m_transferFactories.size();
}
void KGet::setHasNetworkConnection(bool hasConnection)
{
- kDebug(5001) << "Existing internet connection:" << hasConnection << "old:" << m_hasConnection;
+ kDebug() << "Existing internet connection:" << hasConnection << "old:" << m_hasConnection;
if (hasConnection == m_hasConnection) {
return;
}
KGet::showNotification(m_mainWindow, "error",
i18n("Plugin loader could not load the plugin: %1.", service->library()),
"dialog-info");
- kError(5001) << "KPluginFactory could not load the plugin:" << service->library() << loader.errorString();
+ kError() << "KPluginFactory could not load the plugin:" << service->library() << loader.errorString();
return 0;
}
KGetPlugin * plugin = factory->create< TransferFactory >(KGet::m_mainWindow);
//case if checkSysTray is set to true)
if (checkSysTray && Settings::afterFinishActionEnabled() && allFinished)
{
- kDebug(5001) << "All finished";
+ kDebug() << "All finished";
KNotification *notification = 0;
if (!m_finishAction) {
void GenericObserver::slotAfterFinishAction()
{
- kDebug(5001);
-
switch (Settings::afterFinishAction()) {
case KGet::Quit:
- kDebug(5001) << "Quit Kget.";
+ kDebug() << "Quit Kget.";
QTimer::singleShot(0, KGet::m_mainWindow, SLOT(slotQuit()));
break;
#ifdef HAVE_KWORKSPACE
void GenericObserver::slotAbortAfterFinishAction()
{
- kDebug(5001);
-
m_finishAction->stop();
}
}
}
-// kDebug(5001) << totalAmount;
+ // kDebug() << totalAmount;
if (totalAmount > 0)
percent = 100 * processedAmount / totalAmount;
bool KGetGlobalJob::doKill()
{
- kDebug(5001) << "Kill of global job called:" << this;
+ kDebug() << "Kill of global job called:" << this;
emit requestStop(this, 0);
return KJob::doKill();
}
-
bool KGetKJobAdapter::doKill()
{
- kDebug(5001) << "Kill of job adapter called:" << this << m_transferHandler->dest();
+ kDebug() << "Kill of job adapter called:" << this << m_transferHandler->dest();
emit requestStop(this, m_transferHandler);
return KJob::doKill();
}
void KUiServerJobs::slotTransfersAdded(QList<TransferHandler*> transfers)
{
- kDebug(5001);
-
foreach (TransferHandler *transfer, transfers) {
if(shouldBeShown(transfer))
registerJob(transfer->kJobAdapter(), transfer);
void KUiServerJobs::slotTransfersAboutToBeRemoved(const QList<TransferHandler*> &transfers)
{
- kDebug(5001);
-
m_invalidTransfers << transfers;
foreach (TransferHandler *transfer, transfers) {
unregisterJob(transfer->kJobAdapter(), transfer);
void KUiServerJobs::slotTransfersChanged(QMap<TransferHandler *, Transfer::ChangesFlags> transfers)
{
- kDebug(5001);
-
if(!Settings::enableKUIServerIntegration())
return;
-
+
QMapIterator<TransferHandler *, Transfer::ChangesFlags> i(transfers);
while (i.hasNext()) {
i.next();
-// if(!m_invalidTransfers.contains(i.key()))
+ // if(!m_invalidTransfers.contains(i.key()))
{
TransferHandler * transfer = i.key();
if (shouldBeShown(transfer)) {
KUrl mostLocalUrl(const KUrl &url)
{
- kDebug(5001);
const QString protocol = url.protocol();
foreach (TransferFactory *factory, KGet::factories()) {
if (factory->addsProtocols().contains(protocol)) {
}
}
- kDebug(5001) << "Starting KIO::NetAccess::mostLocalUrl for:" << url;
+ kDebug() << "Starting KIO::NetAccess::mostLocalUrl for:" << url;
return KIO::NetAccess::mostLocalUrl(url, 0);
}
}
if (startJob) {
- kDebug(5001) << "Starting KIO::mostLocalUrl for:" << m_url;
+ kDebug() << "Starting KIO::mostLocalUrl for:" << m_url;
KIO::Job *job = KIO::mostLocalUrl(m_url, KIO::HideProgressInfo);
addSubjob(job);
} else {
void MostLocalUrlJob::slotResult(KJob* job)
{
if (job->error()) {
- kWarning(5001) << "Error" << job->error() << "happened for:" << m_url;
+ kWarning() << "Error" << job->error() << "happened for:" << m_url;
m_mostLocalUrl = m_url;
} else {
m_mostLocalUrl = static_cast<KIO::StatJob*>(job)->mostLocalUrl();
}
- kDebug(5001) << "Setting mostLocalUrl to" << m_mostLocalUrl;
+ kDebug() << "Setting mostLocalUrl to" << m_mostLocalUrl;
emitResult();
}
void Scheduler::jobChangedEvent(Job * job, Job::Status status)
{
- kDebug(5001) << "Scheduler::jobChangedEvent (job=" << job << " status=" << status << ")";
+ kDebug() << "Scheduler::jobChangedEvent (job=" << job << " status=" << status << ")";
if (!m_failureCheckTimer)
m_failureCheckTimer = startTimer(1000);
switch(failure.status)
{
case None:
- kDebug(5001) << "job = " << job << " failure (#" << failure.count << ") = None ";
+ kDebug() << "job = " << job << " failure (#" << failure.count << ") = None ";
break;
case AboutToStall:
- kDebug(5001) << "job = " << job << " failure (#" << failure.count << ") = AboutToStall ";
+ kDebug() << "job = " << job << " failure (#" << failure.count << ") = AboutToStall ";
break;
case Stall:
- kDebug(5001) << "job = " << job << " failure (#" << failure.count << ") = Stall ";
+ kDebug() << "job = " << job << " failure (#" << failure.count << ") = Stall ";
break;
case StallTimeout:
- kDebug(5001) << "job = " << job << " failure (#" << failure.count << ") = StallTimeout ";
+ kDebug() << "job = " << job << " failure (#" << failure.count << ") = StallTimeout ";
break;
case Abort:
- kDebug(5001) << "job = " << job << " failure (#" << failure.count << ") = Abort ";
+ kDebug() << "job = " << job << " failure (#" << failure.count << ") = Abort ";
break;
case AbortTimeout:
- kDebug(5001) << "job = " << job << " failure (#" << failure.count << ") = AbortTimeout ";
+ kDebug() << "job = " << job << " failure (#" << failure.count << ") = AbortTimeout ";
break;
case Error:
- kDebug(5001) << "job = " << job << " failure (#" << failure.count << ") = Error ";
+ kDebug() << "job = " << job << " failure (#" << failure.count << ") = Error ";
break;
}
for( int job=0 ; it!=itEnd ; ++it, ++job)
{
- //kDebug(5001) << "MaxSimJobs " << queue->maxSimultaneousJobs();
- kDebug(5001) << "Scheduler: Evaluating job " << job;
+ // kDebug() << "MaxSimJobs " << queue->maxSimultaneousJobs();
+ kDebug() << "Scheduler: Evaluating job " << job;
JobFailure failure = m_failedJobs.value(*it);
{
if( !shouldBeRunning(*it) )
{
- kDebug(5001) << "Scheduler: stopping job";
+ kDebug() << "Scheduler: stopping job";
(*it)->stop();
}
else if(failure.status == None || failure.status == AboutToStall)
{
if( shouldBeRunning(*it) )
{
- kDebug(5001) << "Scheduler: starting job";
+ kDebug() << "Scheduler: starting job";
(*it)->start();
if((failure.status == None || failure.status == AboutToStall) && (*it)->status() != Job::FinishedKeepAlive)
runningJobs++;
}
else
{
- //Stop all the other running downloads
- kDebug(5001) << "Scheduler: stopping job over maxSimJobs limit";
+ // Stop all the other running downloads
+ kDebug() << "Scheduler: stopping job over maxSimJobs limit";
(*it)->stop();
}
}
void Scheduler::timerEvent( QTimerEvent * event )
{
Q_UNUSED(event)
-// kDebug(5001);
-
if (!shouldUpdate()) {
return;
}
else // No failure detected, remove it
m_failedJobs.remove(*it);
-// if(failure.isValid() || prevFailure.isValid())
-// kDebug(5001) << "failure = " << failure.status << " T=" << failure.time << " prevFailure = " << prevFailure.status;
+ // if(failure.isValid() || prevFailure.isValid())
+ // kDebug() << "failure = " << failure.status << " T=" << failure.time << " prevFailure = " << prevFailure.status;
if(failure.status != prevFailure.status)
jobChangedEvent(*it, failure); // Notify the scheduler
m_currentSegments(0),
m_capabilities(0)
{
- kDebug(5001) ;
}
TransferDataSource::~TransferDataSource()
{
- kDebug(5001) ;
}
Transfer::Capabilities TransferDataSource::capabilities() const
void TransferGroup::calculateSpeedLimits()
{
- kDebug(5001) << "We will calculate the new SpeedLimits now";
+ kDebug() << "We will calculate the new SpeedLimits now";
calculateDownloadLimit();
calculateUploadLimit();
}
void TransferGroup::calculateDownloadLimit()
{
- kDebug(5001) << "Calculate new DownloadLimit of " + QString::number(m_downloadLimit);
+ kDebug() << "Calculate new DownloadLimit of " + QString::number(m_downloadLimit);
if (supportsSpeedLimits())
{
const QList<Job*> running = runningJobs();
void TransferGroup::calculateUploadLimit()
{
- kDebug(5001) << "Calculate new Upload Limit of " + QString::number(m_uploadLimit);
+ kDebug() << "Calculate new Upload Limit of " + QString::number(m_uploadLimit);
if (supportsSpeedLimits())
{
const QList<Job*> running = runningJobs();
void TransferGroup::save(QDomElement e) // krazy:exclude=passbyvalue
{
- //kDebug(5001) << " --> " << name();
+ // kDebug() << " --> " << name();
e.setAttribute("Name", m_name);
e.setAttribute("DefaultFolder", m_defaultFolder);
for( ; it!=itEnd; ++it )
{
Transfer* transfer = static_cast<Transfer*>(*it);
- kDebug(5001) << " --> " << name() << " transfer: " << transfer->source();
+ kDebug() << " --> " << name() << " transfer: " << transfer->source();
QDomElement t = e.ownerDocument().createElement("Transfer");
e.appendChild(t);
transfer->save(t);
void TransferGroup::load(const QDomElement & e)
{
- kDebug(5001) << "TransferGroup::load";
+ kDebug() << "TransferGroup::load";
m_name = e.attribute("Name");
m_defaultFolder = e.attribute("DefaultFolder");
elements << nodeList.item(i).toElement();
}
- kDebug(5001) << "TransferGroup::load ->" << "add" << nItems << "transfers";
+ kDebug() << "TransferGroup::load ->" << "add" << nItems << "transfers";
KGet::addTransfers(elements, name());
}
void TransferGroupHandler::start()
{
- kDebug(5001) << "TransferGroupHandler::start()";
+ kDebug() << "TransferGroupHandler::start()";
m_group->setStatus( JobQueue::Running );
}
void TransferGroupHandler::stop()
{
- kDebug(5001) << "TransferGroupHandler::stop()";
+ kDebug() << "TransferGroupHandler::stop()";
m_group->setStatus( JobQueue::Stopped );
}
TransferHandler * TransferGroupHandler::operator[] (int i)
{
-// kDebug(5001) << "TransferGroupHandler::operator[" << i << "]";
+ // kDebug() << "TransferGroupHandler::operator[" << i << "]";
return (*m_group)[i]->handler();
}
QVariant TransferGroupHandler::data(int column)
{
-// kDebug(5001) << "TransferGroupHandler::data(" << column << ")";
+ // kDebug() << "TransferGroupHandler::data(" << column << ")";
switch(column)
{
void TransferGroupScheduler::calculateUploadLimit()
{
int n = KGet::allTransferGroups().count();
- kDebug(5001) << n;
+ kDebug() << n;
int pool = 0;//We create a pool where we have some KiB/s to go to other groups...
QList<TransferGroupHandler*> transfergroupsNeedSpeed;
foreach (TransferGroupHandler *handler, KGet::allTransferGroups())
QVariant TransferHandler::data(int column)
{
-// kDebug(5001) << "TransferHandler::data(" << column << ")";
+ // kDebug() << "TransferHandler::data(" << column << ")";
switch(column)
{
else
return i18nc("not available", "n/a");
case 3:
-// return QString::number(percent())+'%'; // display progressbar instead
+ // return QString::number(percent())+'%'; // display progressbar instead
return QVariant();
case 4:
if (downloadSpeed() == 0)
void TransferHandler::destroy()
{
- kDebug(5001) << "TransferHandler::destroy() ENTERING";
-
- kDebug(5001) << "TransferHandler::destroy() LEAVING";
+ kDebug() << "TransferHandler::destroy()";
}
void TransferHandler::setTransferChange(ChangesFlags change, bool notifyModel)
if (dbFile.open(QFile::ReadOnly)) {
m_dbDoc = QJsonDocument::fromJson(dbFile.readAll());
if (m_dbDoc.isNull()) {
- kWarning(5001) << m_dbDoc.errorString();
+ kWarning() << m_dbDoc.errorString();
} else {
const QVariantMap dbMap = m_dbDoc.toVariant().toMap();
const QStringList dbKeys = dbMap.keys();
dbFile.close();
} else {
// may not exist yet
- kDebug(5001) << "could not open" << m_dbName;
+ kDebug() << "could not open" << m_dbName;
}
emit loadFinished();
const QByteArray dbData = m_dbDoc.toJson();
if (dbFile.write(dbData.constData(), dbData.size()) != dbData.size()) {
- kWarning(5001) << "could not write data to" << m_dbName;;
+ kWarning() << "could not write data to" << m_dbName;;
}
dbFile.close();
} else {
- kWarning(5001) << "could not open" << m_dbName;
+ kWarning() << "could not open" << m_dbName;
}
emit saveFinished();
const QByteArray dbData = m_dbDoc.toJson();
if (dbFile.write(dbData.constData(), dbData.size()) != dbData.size()) {
- kWarning(5001) << "could not write data to" << m_dbName;;
+ kWarning() << "could not write data to" << m_dbName;;
}
dbFile.close();
} else {
- kWarning(5001) << "could not open" << m_dbName;
+ kWarning() << "could not open" << m_dbName;
}
emit deleteFinished();
if (!doc.setContent(&file, &error, &line, &column))
{
- kDebug(5001) << "Error1" << error << line << column;
+ kDebug() << "Error1" << error << line << column;
return;
}
file.close();
if (!doc.setContent(&file, &error, &line, &column))
{
- kDebug(5001) << "Error1" << error << line << column;
+ kDebug() << "Error1" << error << line << column;
file.close();
return;
}
Qt::ItemFlags TransferTreeModel::flags (const QModelIndex & index) const
{
-// kDebug(5001) << "TransferTreeModel::flags()";
+ // kDebug() << "TransferTreeModel::flags()";
if (!index.isValid())
return Qt::ItemIsEnabled;
const ItemMimeData *itemData = qobject_cast<const ItemMimeData*>(mdata);
if (!itemData) {
- kWarning(5001) << "Unsuported mime data dropped.";
+ kWarning() << "Unsuported mime data dropped.";
return false;
}
TransferGroup *destGroup = findGroup(data(parent, Qt::DisplayRole).toString());
if (!destGroup) {
- kWarning(5001) << "No group could be found where the transfers should be inserted to.";
+ kWarning() << "No group could be found where the transfers should be inserted to.";
return false;
}
if (parent.isValid())
- kDebug(5001) << "TransferTreeModel::dropMimeData" << " " << row << " "
+ kDebug() << "TransferTreeModel::dropMimeData" << " " << row << " "
<< column;
QList<QWeakPointer<TransferHandler> > transfers = itemData->transfers();
- kDebug(5001) << "TransferTreeModel::dropMimeData:" << transfers.count() << "transfers.";
+ kDebug() << "TransferTreeModel::dropMimeData:" << transfers.count() << "transfers.";
const bool droppedInsideGroup = parent.isValid();
Transfer * after = 0;
for (int i = 0; i < transfers.count(); ++i) {
bool b = destGroup->size() > row && row - 1 >= 0;
if (b)
- kDebug(5001) << "TRANSFER AFTER:" << destGroup->operator[](row - 1)->source();
+ kDebug() << "TRANSFER AFTER:" << destGroup->operator[](row - 1)->source();
else
- kDebug(5001) << "TRANSFER AFTER NOT EXISTING";
+ kDebug() << "TRANSFER AFTER NOT EXISTING";
if (!after) {
bool rowValid = (row - 1 >= 0) && (destGroup->size() >= row);
void TransferTreeModel::timerEvent(QTimerEvent *event)
{
Q_UNUSED(event)
-// kDebug(5001) << "TransferTreeModel::timerEvent";
+ // kDebug() << "TransferTreeModel::timerEvent";
QMap<TransferHandler *, Transfer::ChangesFlags> updatedTransfers;
QMap<TransferGroupHandler *, TransferGroup::ChangesFlags> updatedGroups;
int row = group->indexOf(transfer);
-// kDebug(5001) << "CHILD = " << item->child(row, column(Transfer::Tc_FileName));
+ // kDebug() << "CHILD = " << item->child(row, column(Transfer::Tc_FileName));
// Now, check that model child items already exist (there are some cases when the transfer
// can notify for changes before the gui has been correctly initialized)
}*/
if (showNotification && (error != NoError)) {
- kDebug(5001) << "Source:" << src << "has error:" << error;
+ kDebug() << "Source:" << src << "has error:" << error;
KGet::showNotification(KGet::m_mainWindow, "error", message(src, Source, error));
}
}
if (showNotification && (error != NoError)) {
- kDebug(5001) << "Destination:" << destination << "has error:" << error;
+ kDebug() << "Destination:" << destination << "has error:" << error;
KGet::showNotification(KGet::m_mainWindow, "error", message(destination, Destination, error));
}
}
if (showNotification && (error != NoError)) {
- kDebug(5001) << "Folder:" << folder << "has error:" << error;
+ kDebug() << "Folder:" << folder << "has error:" << error;
KGet::showNotification(KGet::m_mainWindow, "error", message(folder, Folder, error));
}
void VerificationModel::addChecksum(const QString &type, const QString &checksum, int verified)
{
if (!Verifier::isChecksum(type, checksum)) {
- kWarning(5001) << "Could not add checksum.\nType:" << type << "\nChecksum:" << checksum;
+ kWarning() << "Could not add checksum.\nType:" << type << "\nChecksum:" << checksum;
return;
}
}
const QString hash = Verifier::checksum(url, type);
- kDebug(5001) << "Type:" << type << "Calculated checksum:" << hash << "Entered checksum:" << checksum;
+ kDebug() << "Type:" << type << "Calculated checksum:" << hash << "Entered checksum:" << checksum;
const bool fileVerified = (hash == checksum);
m_mutex.lock();
const QStringList fileChecksums = Verifier::partialChecksums(url, type, length).checksums();
if (fileChecksums.size() != checksums.size())
{
- kDebug(5001) << "Number of checksums differs!";
+ kDebug() << "Number of checksums differs!";
emit brokenPieces(broken, length);
return;
}
if (fileChecksums.at(i) != checksums.at(i))
{
const int brokenStart = length * i;
- kDebug(5001) << url << "broken segment" << i << "start" << brokenStart << "length" << length;
+ kDebug() << url << "broken segment" << i << "start" << brokenStart << "length" << length;
broken.append(brokenStart);
}
}
void Verifier::changeStatus(const QString &type, bool isVerified)
{
- kDebug(5001) << "Verified:" << isVerified;
+ kDebug() << "Verified:" << isVerified;
d->status = isVerified ? Verifier::Verified : Verifier::NotVerified;
d->model->setVerificationStatus(type, d->status);
emit verified(isVerified);
bool DBusKGetWrapper::delTransfer(const QString& dbusObjectPath)
{
- kDebug(5001) << "deleting Transfer";
+ kDebug() << "deleting Transfer";
Transfer *transfer = KGet::model()->findTransferByDBusObjectPath(dbusObjectPath);
else if (map.at(0) == "group")
group = KUrl::fromPercentEncoding(QByteArray(map.at(1).toUtf8()));
}
- kDebug(5001) << action << data << group;
+ kDebug() << action << data << group;
if (action == "add") {
//find a folder to store the download in
QString defaultFolder;
if (transfer)
KGet::delTransfer(transfer);
} else {
- kWarning(5001) << "not implemented action" << action << data;
+ kWarning() << "not implemented action" << action << data;
}
}
} else { // read it from filesystem
break;
}
- // kDebug(5001) << it.key() << ": " << it.value();
+ // kDebug() << it.key() << ": " << it.value();
}
if (update)
void MainWindow::setSystemTrayDownloading(bool running)
{
- kDebug(5001);
-
if (m_dock)
m_dock->setDownloading(running);
}
void MainWindow::slotTransferGroupSettings()
{
- kDebug(5001);
QList<TransferGroupHandler*> list = KGet::selectedTransferGroups();
foreach(TransferGroupHandler* group, list)
{
void MainWindow::slotTransferSettings()
{
- kDebug(5001);
QList<TransferHandler*> list = KGet::selectedTransfers();
foreach(TransferHandler* transfer, list)
{
if (m_engine) {
m_engine->connectSource("KGet", this, POLL_INTERVAL);
} else {
- kDebug(5001) << "KGet Engine could not be loaded";
+ kDebug() << "KGet Engine could not be loaded";
}
m_globalProgress = new Plasma::Meter(this);
m_globalProgress->setMeterType(Plasma::Meter::BarMeterHorizontal);
void KGetApplet::dropEvent(QGraphicsSceneDragDropEvent * event)
{
- kDebug(5001);
-
QStringList urls;
if (event->mimeData()->hasUrls())
{
void KGetApplet::dropEvent(QDropEvent * event)
{
- kDebug(5001);
-
QStringList urls;
if (event->mimeData()->hasUrls())
{
const QString typeString = elem.attribute("type").toLower();
if (!s_stringCommands.contains(typeString)) {
- kDebug(5001) << "Error while parsing, type" << typeString << "not supported.";
+ kDebug() << "Error while parsing, type" << typeString << "not supported.";
QWARN("Problem while parsing.");
return commands;
}
break;
}
}
- kDebug(5001) << "Parsing IsVerifyable/Verified/Repair failed.";
+ kDebug() << "Parsing IsVerifyable/Verified/Repair failed.";
QWARN("Problem while parsing.");
break;
case AddChecksum:
data = args;
commands.append(QPair<int, QVariant>(type, data));
} else {
- kDebug(5001) << "Parsing setHash failed.";
+ kDebug() << "Parsing setHash failed.";
QWARN("Problem while parsing.");
}
break;
break;
}
}
- kDebug(5001) << "Parsing AddPartialChecksums failed.";
+ kDebug() << "Parsing AddPartialChecksums failed.";
QWARN("Problem while parsing.");
break;
}
commands.append(QPair<int, QVariant>(type, data));
break;
}
- kDebug(5001) << "Parsing BrokenPieces failed.";
+ kDebug() << "Parsing BrokenPieces failed.";
QWARN("Problem while parsing.");
break;
}
}
}
}
- kDebug(5001) << "Parsing RandomAction failed.";
+ kDebug() << "Parsing RandomAction failed.";
QWARN("Problem while parsing.");
break;
}
break;
}
}
- kDebug(5001) << "Parsing SetDirectory failed.";
+ kDebug() << "Parsing SetDirectory failed.";
QWARN("Problem while parsing.");
break;
case Wait:
break;
}
}
- kDebug(5001) << "Parsing Wait failed.";
+ kDebug() << "Parsing Wait failed.";
QWARN("Problem while parsing.");
break;
case ChangedEvent:
}
}
}
- kDebug(5001) << "Parsing ChangedEvent failed" << args;
+ kDebug() << "Parsing ChangedEvent failed" << args;
QWARN("Problem while parsing.");
break;
default:
}
m_transfer = transfer;
- kDebug(5001) << this << "associated with" << m_transfer << m_source;
+ kDebug() << this << "associated with" << m_transfer << m_source;
QDBusPendingReply<QString> reply = m_transfer->dest();
const QString dest = reply.value();
const int value = KRandom::randomMax(10);
//70% of the cases start, in 30% stop
if (value > 2) {
- kDebug(5001) << this << "is randomly started.";
+ kDebug() << this << "is randomly started.";
m_transfer->start();
} else {
- kDebug(5001) << this << "is randomly stopped";
+ kDebug() << this << "is randomly stopped";
m_transfer->stop();
}
}
switch (type) {
case Start:
m_transfer->start();
- kDebug(5001) << this << "is started.";
+ kDebug() << this << "is started.";
break;
case Stop:
m_transfer->stop();
- kDebug(5001) << this << "is stopped.";
+ kDebug() << this << "is stopped.";
break;
case AddChecksum: {
QStringList hash = command.toStringList();
- kDebug(5001) << this << "adding hash" << hash;
+ kDebug() << this << "adding hash" << hash;
QDBusPendingReply<void> reply = m_verifier->addChecksum(hash.takeFirst(), hash.takeLast());
break;
}
case AddPartialChecksums: {
QList<QVariant> list = command.toList();
- kDebug(5001) << this << "adding partial hash" << list;
+ kDebug() << this << "adding partial hash" << list;
const QString type = list.takeFirst().toString();
const qulonglong length = list.takeFirst().toULongLong();
QStringList checksums;
case IsVerifyable: {
const bool shouldWork = command.toBool();
QDBusPendingReply<bool> reply = m_verifier->isVerifyable();
- kDebug(5001) << this << "isVerifyable" << reply.value();
+ kDebug() << this << "isVerifyable" << reply.value();
QVERIFY(reply.value() == shouldWork);
break;
}
case Verify: {
- kDebug(5001) << this << "verification started.";
+ kDebug() << this << "verification started.";
m_verifier->verify();
break;
}
case FindBrokenPieces:
- kDebug(5001) << this << "find broken pieces.";
+ kDebug() << this << "find broken pieces.";
m_verifier->brokenPieces();
break;
case Repair: {
QDBusPendingReply<bool> reply = m_transfer->repair(dest.value());
const bool isRepairable = reply.value();
- kDebug(5001) << this << "repair started" << isRepairable;
+ kDebug() << this << "repair started" << isRepairable;
QVERIFY(isRepairable == shouldWork);
break;
}
QDBusPendingReply<bool> reply = m_transfer->setDirectory(newDirectory);
const bool moveStarted = reply.value();
- kDebug(5001) << this << "set changing directory started" << moveStarted;
+ kDebug() << this << "set changing directory started" << moveStarted;
QVERIFY(moveStarted == shouldWork);
break;
}
case Wait: {
const int time = command.toInt();
- kDebug(5001) << this << "waiting for" << time << "msecs" << m_transfer;
+ kDebug() << this << "waiting for" << time << "msecs" << m_transfer;
QTimer::singleShot(time, this, SLOT(slotWaitEvent()));
return;
break;
const bool turnOn = commands.takeFirst().toBool();
if (m_timerId == -1) {
if (turnOn) {
- kDebug(5001) << this << "starting random timer.";
+ kDebug() << this << "starting random timer.";
m_timerId = startTimer(commands.takeFirst().toInt());
}
} else {
- kDebug(5001) << this << "killing random timer.";
+ kDebug() << this << "killing random timer.";
killTimer(m_timerId);
m_timerId = -1;
if (turnOn) {
- kDebug(5001) << this << "starting random timer.";
+ kDebug() << this << "starting random timer.";
m_timerId = startTimer(commands.takeFirst().toInt());
}
}
case Transfer::Tc_Percent: {
QDBusPendingReply<int> reply = m_transfer->percent();
if (reply.value() >= compareValue) {
- kDebug(5001) << this << "ChangedEvent percent.";
+ kDebug() << this << "ChangedEvent percent.";
m_commands.takeFirst();
executeCommands();
}
m_commands.takeFirst();
if (command.canConvert(QVariant::Bool)) {
const bool shouldWork = command.toBool();
- kDebug(5001) << this << "is verified" << verified;
+ kDebug() << this << "is verified" << verified;
QVERIFY(verified == shouldWork);
}
}
}
- kDebug(5001) << this << "is verified" << verified;
+ kDebug() << this << "is verified" << verified;
QVERIFY(verified);
}
}
m_dir.reset(new KTempDir());
- kDebug(5001) << "Using temp dir:" << tempDir();
+ kDebug() << "Using temp dir:" << tempDir();
//TODO add a signal to check if the move worked!!
if (!QDBusConnection::sessionBus().interface()->isServiceRegistered("org.kde.kget")) {
- kDebug(5001) << "Service not registered yet, retrying.";
+ kDebug() << "Service not registered yet, retrying.";
QTimer::singleShot(500, this, SLOT(createTransfer()));
return;
}
reply.waitForFinished();
if (reply.value().size()) {
- kDebug(5001) << "TestTransfers::createTransfer -> transfer = " << reply.value();
+ kDebug() << "TestTransfers::createTransfer -> transfer = " << reply.value();
OrgKdeKgetTransferInterface *transfer = new OrgKdeKgetTransferInterface("org.kde.kget", reply.value().first(), QDBusConnection::sessionBus(), this);
command->associateTransfer(transfer);
path.append("test.txt");
QFile file(path);
if (!file.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
- kError(5001) << "Creating file failed:" << path;
+ kError() << "Creating file failed:" << path;
abort();
}
m_file = KUrl(path);
const qint64 size = data.size();
for (int i = 0; i < 50000; ++i) {
if (file.write(data) != size) {
- kError(5001) << "Creating file failed:" << path;
+ kError() << "Creating file failed:" << path;
abort();
}
}
- kDebug(5001) << "Supported types:" << m_supported;
+ kDebug() << "Supported types:" << m_supported;
//Otherwise testVerify fails
qRegisterMetaType<KUrl>("KUrl");
void ChecksumSearch::slotResult(KJob *job)
{
- kDebug(5001);
-
m_data.clear();
switch (job->error())
{
case 0://The download has finished
{
- kDebug(5001) << "Correctly downloaded" << m_src.pathOrUrl();
+ kDebug() << "Correctly downloaded" << m_src.pathOrUrl();
m_data = QString(m_dataBA);
break;
}
default:
- kDebug(5001) << "There was error" << job->error() << "while downloading" << m_src.pathOrUrl();
+ kDebug() << "There was error" << job->error() << "while downloading" << m_src.pathOrUrl();
break;
}
void ChecksumSearch::parseDownload()
{
if (!m_data.isEmpty()) {
- kDebug(5001) << "*******Parse*******\n" << m_data << "*******************";
+ kDebug() << "*******Parse*******\n" << m_data << "*******************";
}
//no type has been specified
if (rxChecksum.indexIn(line) > -1) {
hash = rxChecksum.cap(0).toLower();
if (!m_fileName.contains(hash, Qt::CaseInsensitive)) {
- kDebug(5001) << "Found hash: " << hash;
+ kDebug() << "Found hash: " << hash;
emit data(m_type, hash);
}
}
if (hash.isEmpty() && (rxChecksum.indexIn(m_data) > -1)) {
QString hash = rxChecksum.cap(0);
if (!m_fileName.contains(hash, Qt::CaseInsensitive)) {
- kDebug(5001) << "Found hash:" << hash;
+ kDebug() << "Found hash:" << hash;
emit data(m_type, hash);
}
}
KGET_EXPORT_PLUGIN( ChecksumSearchFactory )
ChecksumSearchFactory::ChecksumSearchFactory(QObject *parent, const QVariantList &args)
- : TransferFactory(parent, args)
+ : TransferFactory(parent, args)
{
}
TransferDataSource *ChecksumSearchFactory::createTransferDataSource(const KUrl &srcUrl, const QDomElement &type, QObject *parent)
{
- kDebug(5001);
-
if (type.attribute("type") == "checksumsearch") {
return new ChecksumSearchTransferDataSource(srcUrl, parent);
}
#include <KIO/NetAccess>
ChecksumSearchTransferDataSource::ChecksumSearchTransferDataSource(const KUrl &srcUrl, QObject *parent)
- : TransferDataSource(srcUrl, parent)
+ : TransferDataSource(srcUrl, parent)
{
}
void ChecksumSearchTransferDataSource::start()
{
- kDebug(5001);
-
QStringList changes = ChecksumSearchSettings::self()->searchStrings();
QList<int> modes = ChecksumSearchSettings::self()->urlChangeModeList();
QStringList types = ChecksumSearchSettings::self()->checksumTypeList();
}
}
- kDebug(5001) << "Creating Checksumsearch for" << urls.count() << "urls.";
+ kDebug() << "Creating Checksumsearch for" << urls.count() << "urls.";
if (urls.count() && types.count()) {
ChecksumSearch *search = new ChecksumSearch(urls, m_sourceUrl.fileName(), types);
void ChecksumSearchTransferDataSource::stop()
{
- kDebug(5001);
}
void ChecksumSearchTransferDataSource::addSegments(const QPair<KIO::fileoffset_t, KIO::fileoffset_t> &segmentSize, const QPair<int, int> &segmentRange)
{
Q_UNUSED(segmentSize)
Q_UNUSED(segmentRange)
- kDebug(5001);
}
#include "moc_checksumsearchtransferdatasource.cpp"
void DlgChecksumSettingsWidget::save()
{
- kDebug(5001);
QStringList changes;
QList<int> modes;
QStringList types;
void TransferKio::start()
{
if (status() != Job::Finished) {
- kDebug(5001) << "TransferKio::start";
+ kDebug() << "TransferKio::start";
setStatus(Job::Running);
setTransferChange(Transfer::Tc_Status, true);
m_copyjob = nullptr;
}
- kDebug(5001) << "Stop";
+ kDebug() << "Stop";
setStatus(Job::Stopped);
m_downloadSpeed = 0;
setTransferChange(Transfer::Tc_Status | Transfer::Tc_DownloadSpeed, true);
foreach (const QString &checksum, checksums) {
const QStringList splitchecksum = checksum.split(",");
if (splitchecksum.size() != 2) {
- kDebug(5001) << "invalid checksum" << checksum;
+ kDebug() << "invalid checksum" << checksum;
continue;
}
m_checksums.insert(splitchecksum.at(0), splitchecksum.at(1));
void TransferKio::slotResult( KJob * kioJob )
{
- kDebug(5001) << "slotResult" << kioJob->error() << kioJob->errorString();
+ kDebug() << "slotResult" << kioJob->error() << kioJob->errorString();
m_downloadSpeed = 0;
setTransferChange(Transfer::Tc_DownloadSpeed, true);
void TransferKio::slotInfoMessage( KJob * kioJob, const QString & msg )
{
- kDebug(5001) << "slotInfoMessage";
+ kDebug() << "slotInfoMessage";
Q_UNUSED(kioJob);
setLog(msg, Transfer::Log_Info);
void TransferKio::slotPercent( KJob * kioJob, unsigned long percent )
{
- kDebug(5001) << "slotPercent";
+ kDebug() << "slotPercent";
Q_UNUSED(kioJob);
m_percent = percent;
void TransferKio::slotTotalSize( KJob * kioJob, qulonglong size )
{
- kDebug(5001) << "slotTotalSize";
+ kDebug() << "slotTotalSize";
Q_UNUSED(kioJob);
m_totalSize = size;
void TransferKio::slotProcessedSize( KJob * kioJob, qulonglong size )
{
- kDebug(5001) << "slotProcessedSize";
+ kDebug() << "slotProcessedSize";
Q_UNUSED(kioJob);
m_downloadedSize = size;
void TransferKio::slotSpeed( KJob * kioJob, unsigned long bytes_per_second )
{
- kDebug(5001) << "slotSpeed";
+ kDebug() << "slotSpeed";
Q_UNUSED(kioJob)
m_downloadSpeed = bytes_per_second;
TransferGroup * parent,
Scheduler * scheduler)
{
- kDebug(5001) << "TransferKioFactory::createTransfer";
+ kDebug() << "TransferKioFactory::createTransfer";
if (isSupported(srcUrl)) {
return new TransferKio(parent, this, scheduler, srcUrl, destUrl);
bool TransferKioFactory::isSupported(const KUrl &url) const
{
QString prot = url.protocol();
- kDebug(5001) << "Protocol = " << prot;
+ kDebug() << "Protocol = " << prot;
return addsProtocols().contains(prot);
}
m_retryDownload(false)
{
m_fileTemp = KStandardDirs::locateLocal("appdata", m_dest.fileName());
- kDebug(5001) << "Mms transfer initialized: " + m_source.prettyUrl();
+ kDebug() << "Mms transfer initialized: " + m_source.prettyUrl();
}
MmsTransfer::~MmsTransfer()
MmsTransferFactory::MmsTransferFactory(QObject *parent, const QVariantList &args)
: TransferFactory(parent, args)
-{}
+{
+}
MmsTransferFactory::~MmsTransferFactory()
-{}
+{
+}
Transfer * MmsTransferFactory::createTransfer( const KUrl &srcUrl, const KUrl &destUrl,
TransferGroup * parent,
Scheduler * scheduler)
{
- kDebug(5001) << "MmsTransferFactory::createTransfer";
+ kDebug() << "MmsTransferFactory::createTransfer";
QString prot = srcUrl.protocol();
- kDebug(5001) << "Protocol = " << prot;
+ kDebug() << "Protocol = " << prot;
if (prot == "mms" || prot == "mmsh") {
return new MmsTransfer(parent, this, scheduler, srcUrl, destUrl);
}
bool MmsTransferFactory::isSupported(const KUrl &url) const
{
QString prot = url.protocol();
- kDebug(5001) << "Protocol = " << prot;
+ kDebug() << "Protocol = " << prot;
return (prot == "mms" || prot == "mmsh");
}
m_lthandle.set_upload_limit(uploadLimit * 1024);
m_lthandle.set_download_limit(downloadLimit * 1024);
} else {
- kDebug(5001) << "torrent handle is not valid";
+ kDebug() << "torrent handle is not valid";
}
}
result.insert(KUrl(lttracker.url.c_str()), QPair<bool,int>(true, 1));
}
} else {
- kDebug(5001) << "torrent handle is not valid";
+ kDebug() << "torrent handle is not valid";
}
return result;
if (m_lthandle.is_valid()) {
m_lthandle.replace_trackers(lttrackers);
} else {
- kDebug(5001) << "torrent handle is not valid";
+ kDebug() << "torrent handle is not valid";
}
}
const QString sourcestring = sourceurl.url();
const QByteArray destination = directory().toLocalFile().toLocal8Bit();
- kDebug(5001) << "source" << sourceurl;
- kDebug(5001) << "destination" << destination;
+ kDebug() << "source" << sourceurl << "destination" << destination;
try {
lt::add_torrent_params ltparams;
#else
if (lterror != lt::errors::no_error) {
#endif
- kError(5001) << lterror.message().c_str();
+ kError() << lterror.message().c_str();
const QString errormesssage = translatelterror(lterror);
setError(errormesssage, SmallIcon("dialog-error"), Job::NotSolveable);
ltparams.ti = boost::make_shared<lt::torrent_info>(source.constData());
#endif
if (!ltparams.ti->is_valid()) {
- kError(5001) << "invalid torrent file";
+ kError() << "invalid torrent file";
const QString errormesssage = i18n("Invalid torrent file");
setError(errormesssage, SmallIcon("dialog-error"), Job::NotSolveable);
m_totalSize = ltparams.ti->total_size();
setTransferChange(Transfer::Tc_TotalSize, true);
} else {
- kError(5001) << "invalid source" << sourceurl;
+ kError() << "invalid source" << sourceurl;
const QString errormesssage = i18n("Invalid source URL");
setError(errormesssage, SmallIcon("dialog-error"), Job::NotSolveable);
bool TransferTorrent::isStalled() const
{
if (!m_lthandle.is_valid()) {
- kDebug(5001) << "torrent handle is not valid";
+ kDebug() << "torrent handle is not valid";
return true;
}
const lt::torrent_status ltstatus = m_lthandle.status();
const QModelIndex fileindex = m_filemodel->index(url, FileItem::File);
const int checkstate = m_filemodel->data(fileindex, Qt::CheckStateRole).toInt();
if (checkstate != int(Qt::Unchecked)) {
- kDebug(5001) << "will downloand" << url;
+ kDebug() << "will downloand" << url;
m_priorities.push_back(LTPriorities::NormalPriority);
m_lthandle.file_priority(counter, LTPriorities::NormalPriority);
} else {
- kDebug(5001) << "will not downloand" << url;
+ kDebug() << "will not downloand" << url;
m_lthandle.file_priority(counter, LTPriorities::Disabled);
m_priorities.push_back(LTPriorities::Disabled);
void TransferTorrent::slotSettingsDirty(const QString &settings)
{
- kDebug(5001) << "torrent settings are dirty";
+ kDebug() << "torrent settings are dirty";
Q_UNUSED(settings);
applySettings();
}
void TransferTorrent::applySettings()
{
if (!m_ltsession) {
- kDebug(5001) << "null torrent session pointer";
+ kDebug() << "null torrent session pointer";
return;
}
break;
}
default: {
- kWarning(5001) << "invalid setting type";
+ kWarning() << "invalid setting type";
break;
}
}
}
if (event->timerId() == m_resumetimerid) {
- kDebug(5001) << "posting save resume data alert";
+ kDebug() << "posting save resume data alert";
if (m_lthandle.is_valid()) {
m_lthandle.save_resume_data();
}
setStatus(Job::FinishedKeepAlive);
setTransferChange(Transfer::Tc_Status, true);
} else if (lt::alert_cast<lt::save_resume_data_alert>(ltalert)) {
- kDebug(5001) << "save resume data alert";
+ kDebug() << "save resume data alert";
#if LIBTORRENT_VERSION_NUM >= 10200
const lt::save_resume_data_alert* ltresumealert = lt::alert_cast<lt::save_resume_data_alert>(ltalert);
}
#endif
} else if (lt::alert_cast<lt::torrent_error_alert>(ltalert)) {
- kError(5001) << ltalert->message().c_str();
+ kError() << ltalert->message().c_str();
const lt::torrent_error_alert* lterror = lt::alert_cast<lt::torrent_error_alert>(ltalert);
TransferGroup* parent,
Scheduler* scheduler)
{
- kDebug(5001) << "TransferTorrentFactory::createTransfer";
+ kDebug() << "TransferTorrentFactory::createTransfer";
if (isSupported(srcUrl)) {
return new TransferTorrent(parent, this, scheduler, srcUrl, destUrl);
}
watcher = new QFileSystemWatcher();
watcher->addPath(KStandardDirs::locateLocal("appdata", QString()));
- kDebug(5001) << watcher->directories();
+ kDebug() << watcher->directories();
m_store = TransferHistoryStore::getStore();
mt = KMimeType::findByUrl(linkitem, 0, true, true);
}
- kDebug(5001) << "Adding:" << linkitem;
+ kDebug() << "Adding:" << linkitem;
QString file = url.fileName();
if (file.isEmpty())
} else {
foreach (const KUrl &sourceUrl, sources) {
if (sourceUrl.url() != KUrl(sourceUrl.url()).fileName()) {//TODO simplify, whatfor is this check anyway, shouldn't the sources be checked already and if not add this to UrlChecker
- kDebug(5001) << "Insert" << sourceUrl;
+ kDebug() << "Insert" << sourceUrl;
QListWidgetItem *newItem = new QListWidgetItem(sourceUrl.pathOrUrl(), ui.listWidget);
newItem->setCheckState(Qt::Checked);
}
m_sources << list;
UrlChecker::removeDuplicates(m_sources);
const int size = m_sources.size();
- kDebug(5001) << "SET SOURCES " << m_sources << " MULTIPLE " << (size > 1);
+ kDebug() << "SET SOURCES " << m_sources << " MULTIPLE " << (size > 1);
setMultiple(size > 1);
if (size) {
KWindowSystem::forceActiveWindow(m_window->winId());
}
- kDebug(5001) << "Show the dialog!";
+ kDebug() << "Show the dialog!";
show();
}
enableButtonOk((folderValid || destinationValid) && sourceValid);
}
- kDebug(5001) << source << source.fileName() << dest << dest.fileName();
+ kDebug() << source << source.fileName() << dest << dest.fileName();
}
void NewTransferDialog::slotFinished(int resultCode)
void NewTransferDialog::dialogAccepted()
{
- kDebug(5001) << "Dialog accepted.";
+ kDebug() << "Dialog accepted.";
//an existing transfer has been specified and since ok was clicked, it was chosen to be overwritten
if (m_existingTransfer) {
- kDebug(5001) << "Removing existing transfer:" << m_existingTransfer;
+ kDebug() << "Removing existing transfer:" << m_existingTransfer;
KGet::delTransfer(m_existingTransfer);
}
QList<KGet::TransferData> data;
if (!m_multiple) {
if (m_overWriteSingle) {
- kDebug(5001) << "Removing existing file:" << m_destination;
+ kDebug() << "Removing existing file:" << m_destination;
//removes m_destination if it exists, do that here so that it is removed no matter if a transfer could be created or not
//as the user decided to throw the file away
FileDeleter::deleteFile(m_destination);
//sourceUrl is valid, has been checked before
const KUrl sourceUrl = KUrl(ui.urlRequester->text().trimmed());
- kDebug(5001) << "Downloading" << sourceUrl << "to" << m_destination;
+ kDebug() << "Downloading" << sourceUrl << "to" << m_destination;
data << KGet::TransferData(sourceUrl, m_destination, group, true);
} else {
KUrl::List list;
//both sourceUrl and destUrl are valid, they have been tested in checkInput
const KUrl sourceUrl = KUrl(item->text().trimmed());
const KUrl destUrl = UrlChecker::destUrl(m_destination, sourceUrl);
- kDebug(5001) << "Downloading" << sourceUrl << "to" << destUrl;
+ kDebug() << "Downloading" << sourceUrl << "to" << destUrl;
//file exists already, remove it
if (item->background() == m_existingFileBackground) {
- kDebug(5001) << "Removing existing file:" << destUrl;
+ kDebug() << "Removing existing file:" << destUrl;
//removes destUrl if it exists, do that here so that it is removed no matter if a transfer could be created or not
//as the user decided to throw the file away
FileDeleter::deleteFile(destUrl);
const int jobId = job->property("jobId").toInt();
if (job->error()) {
- kWarning(5001) << "An error happened for" << job->url();
+ kWarning() << "An error happened for" << job->url();
} else {
m_urls[jobId].urls << job->mostLocalUrl();
}
{
QHash<int, UrlData>::iterator itUrls = m_urls.find(jobId);
if (itUrls == m_urls.end()) {
- kWarning(5001) << "JobId" << jobId << "was not defined, could not handle urls for it.";
+ kWarning() << "JobId" << jobId << "was not defined, could not handle urls for it.";
return;
}
}
///Now handle default folders/groups
- kDebug(5001) << "DIRECTORIES AS SUGGESTION" << Settings::directoriesAsSuggestion();
+ kDebug() << "DIRECTORIES AS SUGGESTION" << Settings::directoriesAsSuggestion();
if (!Settings::directoriesAsSuggestion() && !urls.isEmpty()) {
- kDebug(5001) << "No, Directories not as suggestion";
+ kDebug() << "No, Directories not as suggestion";
//find the associated groups first, we just need the first matching group though
const QList<TransferGroupHandler*> groups = KGet::allTransferGroups();
void TransferDetails::slotTransferChanged(TransferHandler * transfer, TransferHandler::ChangesFlags flags)
{
- kDebug(5001) << "TransferDetails::slotTransferChanged";
+ kDebug() << "TransferDetails::slotTransferChanged";
Q_UNUSED(transfer)
for(int i = 0; i < nGroups; i++)
{
- kDebug(5001) << "openEditor for row " << i;
+ kDebug() << "openEditor for row " << i;
openPersistentEditor(model->index(i, TransferTreeModel::Status, QModelIndex()));
}
void TransfersView::rowsInserted(const QModelIndex & parent, int start, int end)
{
- kDebug(5001) << "TransfersView::rowsInserted";
+ kDebug() << "TransfersView::rowsInserted";
if(!parent.isValid())
{
- kDebug(5001) << "parent is not valid " << start << " " << end;
+ kDebug() << "parent is not valid " << start << " " << end;
for(int i = start; i <= end; i++)
{
- kDebug(5001) << "openEditor for row " << i;
+ kDebug() << "openEditor for row " << i;
openPersistentEditor(model()->index(i, TransferTreeModel::Status, parent));
}
}
QList<TransferHandler *> transfers = groupHandler->transfers();
foreach(TransferHandler * transfer, transfers) {
- kDebug(5001) << "Transfer = " << transfer->source().prettyUrl();
+ kDebug() << "Transfer = " << transfer->source().prettyUrl();
view_delegate->contractItem(KGet::model()->itemFromTransferHandler(transfer)->index());
}
}
void GroupStatusButton::checkStateSet()
{
-// kDebug(5001) << "GroupStatusButton::checkStateSet";
+ // kDebug() << "GroupStatusButton::checkStateSet";
QToolButton::checkStateSet();
/// These lines are just for testing purposes. Uncomment them to show on the view the repaint events.
// static int i=0;
-// kDebug(5001) << "paint!!! " << i++ << " " << index.internalPointer() << " " << index.column();
+// kDebug() << "paint!!! " << i++ << " " << index.internalPointer() << " " << index.column();
//
// painter->drawRect(option.rect);
// painter->drawText(option.rect.topLeft(), QString::number(i));
ModelItem *item = transferTreeModel->itemFromIndex(index);
if (!item) {
- kWarning(5001) << "Sizehint for non-existing item.";
+ kWarning() << "Sizehint for non-existing item.";
return QSize();
}
QMouseEvent * mouseEvent = static_cast<QMouseEvent *>(event);
if (mouseEvent->button() == Qt::RightButton)
{
-// kDebug(5001) << "TransfersViewDelegate::editorEvent() -> rightClick";
+ // kDebug() << "TransfersViewDelegate::editorEvent() -> rightClick";
KMenu *popup = 0;
ModelItem * item = transferTreeModel->itemFromIndex(index);
if (item->isGroup())
{
-// kDebug(5001) << "isTransferGroup = true";
+ // kDebug() << "isTransferGroup = true";
TransferGroupHandler * transferGroupHandler = item->asGroup()->groupHandler();
popup = ContextMenu::createTransferGroupContextMenu(transferGroupHandler, qobject_cast<QWidget*>(this));
}
else
{
-// kDebug(5001) << "isTransferGroup = false";
+ // kDebug() << "isTransferGroup = false";
TransferHandler * transferHandler = item->asTransfer()->transferHandler();
// switch between Active or Passive state
void Tray::setDownloading( bool downloading )
{
- kDebug(5001) << "Tray::setDownloading";
+ kDebug() << "Tray::setDownloading";
if (downloading)
{
return;
setStatus(KStatusNotifierItem::Passive);
setOverlayIconByName(QString());
- }
+ }
}
bool Tray::isDownloading()