Commit 94023fdb authored by David Jarvie's avatar David Jarvie
Browse files

Include function names in debug messages

parent 90d9ceef
......@@ -783,7 +783,7 @@ static bool checkItem_isArchived(const Item& item)
void AkonadiModel::slotUpdateArchivedColour(const QColor&)
{
qCDebug(KALARM_LOG);
qCDebug(KALARM_LOG) << "AkonadiModel::slotUpdateArchivedColour";
signalDataChanged(&checkItem_isArchived, 0, ColumnCount - 1, QModelIndex());
}
......@@ -803,7 +803,7 @@ static bool checkItem_isDisabled(const Item& item)
void AkonadiModel::slotUpdateDisabledColour(const QColor&)
{
qCDebug(KALARM_LOG);
qCDebug(KALARM_LOG) << "AkonadiModel::slotUpdateDisabledColour";
signalDataChanged(&checkItem_isDisabled, 0, ColumnCount - 1, QModelIndex());
}
......@@ -823,7 +823,7 @@ static bool checkItem_excludesHolidays(const Item& item)
void AkonadiModel::slotUpdateHolidays()
{
qCDebug(KALARM_LOG);
qCDebug(KALARM_LOG) << "AkonadiModel::slotUpdateHolidays";
Q_ASSERT(TimeToColumn == TimeColumn + 1); // signal should be emitted only for TimeTo and Time columns
signalDataChanged(&checkItem_excludesHolidays, TimeColumn, TimeToColumn, QModelIndex());
}
......@@ -844,7 +844,7 @@ static bool checkItem_workTimeOnly(const Item& item)
void AkonadiModel::slotUpdateWorkingHours()
{
qCDebug(KALARM_LOG);
qCDebug(KALARM_LOG) << "AkonadiModel::slotUpdateWorkingHours";
Q_ASSERT(TimeToColumn == TimeColumn + 1); // signal should be emitted only for TimeTo and Time columns
signalDataChanged(&checkItem_workTimeOnly, TimeColumn, TimeToColumn, QModelIndex());
}
......@@ -1092,7 +1092,7 @@ bool AkonadiModel::removeCollection(const Akonadi::Collection& collection)
{
if (!collection.isValid())
return false;
qCDebug(KALARM_LOG) << collection.id();
qCDebug(KALARM_LOG) << "AkonadiModel::removeCollection:" << collection.id();
Collection col = collection;
mCollectionsDeleting << collection.id();
// Note: CollectionDeleteJob deletes the backend storage also.
......@@ -1150,7 +1150,7 @@ bool AkonadiModel::reloadCollection(const Akonadi::Collection& collection)
{
if (!collection.isValid())
return false;
qCDebug(KALARM_LOG) << collection.id();
qCDebug(KALARM_LOG) << "AkonadiModel::reloadCollection:" << collection.id();
mMonitor->setCollectionMonitored(collection, false);
mMonitor->setCollectionMonitored(collection, true);
return true;
......@@ -1161,7 +1161,7 @@ bool AkonadiModel::reloadCollection(const Akonadi::Collection& collection)
*/
void AkonadiModel::reload()
{
qCDebug(KALARM_LOG);
qCDebug(KALARM_LOG) << "AkonadiModel::reload";
const Collection::List collections = mMonitor->collectionsMonitored();
foreach (const Collection& collection, collections)
{
......@@ -1309,7 +1309,7 @@ KAEvent AkonadiModel::event(const Akonadi::Item& item, const QModelIndex& index,
*/
AkonadiModel::Result AkonadiModel::addEvent(KAEvent* event, CalEvent::Type type, QWidget* promptParent, bool noPrompt)
{
qCDebug(KALARM_LOG) << event->id();
qCDebug(KALARM_LOG) << "AkonadiModel::addEvent:" << event->id();
// Determine parent collection - prompt or use default
bool cancelled;
......@@ -1360,7 +1360,7 @@ bool AkonadiModel::addEvents(const KAEvent::List& events, Collection& collection
*/
bool AkonadiModel::addEvent(KAEvent& event, Collection& collection)
{
qCDebug(KALARM_LOG) << "ID:" << event.id();
qCDebug(KALARM_LOG) << "AkonadiModel::addEvent: ID:" << event.id();
Item item;
if (!event.setItemPayload(item, collection.contentMimeTypes()))
{
......@@ -1387,7 +1387,7 @@ qCDebug(KALARM_LOG)<<"...exiting";
*/
bool AkonadiModel::updateEvent(KAEvent& event)
{
qCDebug(KALARM_LOG) << "ID:" << event.id();
qCDebug(KALARM_LOG) << "AkonadiModel::updateEvent: ID:" << event.id();
return updateEvent(event.itemId(), event);
}
bool AkonadiModel::updateEvent(Akonadi::Item::Id itemId, KAEvent& newEvent)
......@@ -1418,7 +1418,7 @@ bool AkonadiModel::deleteEvent(const KAEvent& event)
}
bool AkonadiModel::deleteEvent(Akonadi::Item::Id itemId)
{
qCDebug(KALARM_LOG) << itemId;
qCDebug(KALARM_LOG) << "AkonadiModel::deleteEvent:" << itemId;
const QModelIndex ix = itemIndex(itemId);
if (!ix.isValid())
return false;
......@@ -1445,7 +1445,7 @@ bool AkonadiModel::deleteEvent(Akonadi::Item::Id itemId)
*/
void AkonadiModel::queueItemModifyJob(const Item& item)
{
qCDebug(KALARM_LOG) << item.id();
qCDebug(KALARM_LOG) << "AkonadiModel::queueItemModifyJob:" << item.id();
QMap<Item::Id, Item>::Iterator it = mItemModifyJobQueue.find(item.id());
if (it != mItemModifyJobQueue.end())
{
......@@ -1495,7 +1495,7 @@ void AkonadiModel::itemJobDone(KJob* j)
mPendingItemJobs.erase(it);
}
const QByteArray jobClass = j->metaObject()->className();
qCDebug(KALARM_LOG) << jobClass;
qCDebug(KALARM_LOG) << "AkonadiModel::itemJobDone:" << jobClass;
if (j->error())
{
QString errMsg;
......@@ -1592,7 +1592,7 @@ qCDebug(KALARM_LOG)<<"No more jobs queued";
*/
void AkonadiModel::slotRowsInserted(const QModelIndex& parent, int start, int end)
{
qCDebug(KALARM_LOG) << start << "-" << end << "(parent =" << parent << ")";
qCDebug(KALARM_LOG) << "AkonadiModel::slotRowsInserted:" << start << "-" << end << "(parent =" << parent << ")";
for (int row = start; row <= end; ++row)
{
const QModelIndex ix = index(row, 0, parent);
......@@ -1639,7 +1639,7 @@ void AkonadiModel::slotRowsInserted(const QModelIndex& parent, int start, int en
*/
void AkonadiModel::slotRowsAboutToBeRemoved(const QModelIndex& parent, int start, int end)
{
qCDebug(KALARM_LOG) << start << "-" << end << "(parent =" << parent << ")";
qCDebug(KALARM_LOG) << "AkonadiModel::slotRowsAboutToBeRemoved:" << start << "-" << end << "(parent =" << parent << ")";
const EventList events = eventList(parent, start, end);
if (!events.isEmpty())
{
......@@ -1677,7 +1677,7 @@ void AkonadiModel::setCollectionChanged(const Collection& collection, const QSet
const Collection::Rights newRights = collection.rights() & writableRights;
if (newRights != oldRights)
{
qCDebug(KALARM_LOG) << "Collection" << collection.id() << ": rights ->" << newRights;
qCDebug(KALARM_LOG) << "AkonadiModel::setCollectionChanged:" << collection.id() << ": rights ->" << newRights;
mCollectionRights[collection.id()] = newRights;
Q_EMIT collectionStatusChanged(collection, ReadOnly, (newRights != writableRights), rowInserted);
}
......@@ -1688,7 +1688,7 @@ void AkonadiModel::setCollectionChanged(const Collection& collection, const QSet
const CalEvent::Types newAlarmTypes = CalEvent::types(collection.contentMimeTypes());
if (newAlarmTypes != oldAlarmTypes)
{
qCDebug(KALARM_LOG) << "Collection" << collection.id() << ": alarm types ->" << newAlarmTypes;
qCDebug(KALARM_LOG) << "AkonadiModel::setCollectionChanged:" << collection.id() << ": alarm types ->" << newAlarmTypes;
mCollectionAlarmTypes[collection.id()] = newAlarmTypes;
Q_EMIT collectionStatusChanged(collection, AlarmTypes, static_cast<int>(newAlarmTypes), rowInserted);
}
......@@ -1701,7 +1701,7 @@ void AkonadiModel::setCollectionChanged(const Collection& collection, const QSet
const CalEvent::Types newEnabled = collection.hasAttribute<CollectionAttribute>() ? collection.attribute<CollectionAttribute>()->enabled() : CalEvent::EMPTY;
if (firstEnabled || newEnabled != oldEnabled)
{
qCDebug(KALARM_LOG) << "Collection" << collection.id() << ": enabled ->" << newEnabled;
qCDebug(KALARM_LOG) << "AkonadiModel::setCollectionChanged:" << collection.id() << ": enabled ->" << newEnabled;
firstEnabled = false;
mCollectionEnabled[collection.id()] = newEnabled;
Q_EMIT collectionStatusChanged(collection, Enabled, static_cast<int>(newEnabled), rowInserted);
......@@ -1712,7 +1712,7 @@ void AkonadiModel::setCollectionChanged(const Collection& collection, const QSet
if (attributeNames.contains(CompatibilityAttribute::name()))
{
// Update to current KAlarm format if necessary, and if the user agrees
qCDebug(KALARM_LOG) << "CompatibilityAttribute";
qCDebug(KALARM_LOG) << "AkonadiModel::setCollectionChanged: CompatibilityAttribute";
Collection col(collection);
refresh(col);
CalendarMigrator::updateToCurrentFormat(col, false, MainWindow::mainMainWindow());
......@@ -1724,7 +1724,7 @@ void AkonadiModel::setCollectionChanged(const Collection& collection, const QSet
if (mCollectionsBeingCreated.isEmpty() && mCollectionIdsBeingCreated.isEmpty()
&& CalendarMigrator::completed())
{
qCDebug(KALARM_LOG) << "Migration completed";
qCDebug(KALARM_LOG) << "AkonadiModel::setCollectionChanged: Migration completed";
mMigrating = false;
Q_EMIT migrationCompleted();
}
......@@ -1737,7 +1737,7 @@ void AkonadiModel::setCollectionChanged(const Collection& collection, const QSet
void AkonadiModel::slotCollectionRemoved(const Collection& collection)
{
const Collection::Id id = collection.id();
qCDebug(KALARM_LOG) << id;
qCDebug(KALARM_LOG) << "AkonadiModel::slotCollectionRemoved:" << id;
mCollectionRights.remove(id);
mCollectionsDeleting.removeAll(id);
while (mCollectionsDeleted.count() > 20) // don't let list grow indefinitely
......@@ -1777,7 +1777,7 @@ void AkonadiModel::slotMigrationCompleted()
*/
void AkonadiModel::slotMonitoredItemChanged(const Akonadi::Item& item, const QSet<QByteArray>&)
{
qCDebug(KALARM_LOG) << "item id=" << item.id() << ", revision=" << item.revision();
qCDebug(KALARM_LOG) << "AkonadiModel::slotMonitoredItemChanged: item id=" << item.id() << ", revision=" << item.revision();
mItemsBeingCreated.removeAll(item.id()); // the new item has now been initialised
checkQueuedItemModifyJob(item); // execute the next job queued for the item
......
......@@ -58,7 +58,7 @@ void AkonadiResourceCreator::createResource()
void AkonadiResourceCreator::getAgentType()
{
qCDebug(KALARM_LOG) << "Type:" << mDefaultType;
qCDebug(KALARM_LOG) << "AkonadiResourceCreator::getAgentType: Type:" << mDefaultType;
// Use AutoQPointer to guard against crash on application exit while
// the dialogue is still open. It prevents double deletion (both on
// deletion of parent, and on return from this function).
......@@ -106,7 +106,7 @@ void AkonadiResourceCreator::agentInstanceCreated(KJob* j)
AgentInstanceCreateJob* job = static_cast<AgentInstanceCreateJob*>(j);
if (j->error())
{
qCCritical(KALARM_LOG) << "Failed to create new calendar resource:" << j->errorString();
qCCritical(KALARM_LOG) << "AkonadiResourceCreator::agentInstanceCreated: Failed to create new calendar resource:" << j->errorString();
KMessageBox::error(nullptr, xi18nc("@info", "%1<nl/>(%2)", i18nc("@info", "Failed to create new calendar resource"), j->errorString()));
exitWithError();
}
......@@ -129,7 +129,7 @@ void AkonadiResourceCreator::agentInstanceCreated(KJob* j)
if (!controlOk)
{
delete agentControlIface;
qCWarning(KALARM_LOG) << "Unable to access D-Bus interface of created agent.";
qCWarning(KALARM_LOG) << "AkonadiResourceCreator::agentInstanceCreated: Unable to access D-Bus interface of created agent.";
}
else
{
......@@ -155,7 +155,7 @@ void AkonadiResourceCreator::setResourceAlarmType()
Settings iface(QStringLiteral("org.freedesktop.Akonadi.Resource.") + mAgentInstance.identifier(),
QStringLiteral("/Settings"), QDBusConnection::sessionBus(), this);
if (!iface.isValid())
qCCritical(KALARM_LOG) << "Error creating D-Bus interface for" << mAgentInstance.identifier() << "resource configuration.";
qCCritical(KALARM_LOG) << "AkonadiResourceCreator::setResourceAlarmType: Error creating D-Bus interface for" << mAgentInstance.identifier() << "resource configuration.";
else
{
iface.setAlarmTypes(CalEvent::mimeTypes(mDefaultType));
......
......@@ -100,7 +100,7 @@ AlarmCalendar* AlarmCalendar::displayCalendarOpen()
{
if (mDisplayCalendar->open())
return mDisplayCalendar;
qCCritical(KALARM_LOG) << "Open error";
qCCritical(KALARM_LOG) << "AlarmCalendar::displayCalendarOpen: Open error";
return nullptr;
}
......@@ -193,7 +193,7 @@ bool AlarmCalendar::open()
if (!mUrl.isValid())
return false;
qCDebug(KALARM_LOG) << mUrl.toDisplayString();
qCDebug(KALARM_LOG) << "AlarmCalendar::open:" << mUrl.toDisplayString();
if (!mCalendarStorage)
{
MemoryCalendar::Ptr calendar(new MemoryCalendar(Preferences::timeSpecAsZone()));
......@@ -247,13 +247,13 @@ int AlarmCalendar::load()
return -2;
QString filename;
qCDebug(KALARM_LOG) << mUrl.toDisplayString();
qCDebug(KALARM_LOG) << "AlarmCalendar::load:" << mUrl.toDisplayString();
if (!mUrl.isLocalFile()) {
auto getJob = KIO::storedGet(mUrl);
KJobWidgets::setWindow(getJob, MainWindow::mainMainWindow());
if (!getJob->exec())
{
qCCritical(KALARM_LOG) << "Download failure";
qCCritical(KALARM_LOG) << "AlarmCalendar::load: Download failure";
KAMessageBox::error(MainWindow::mainMainWindow(),
xi18nc("@info", "Cannot download calendar: <filename>%1</filename>", mUrl.toDisplayString()));
return -1;
......@@ -280,7 +280,7 @@ int AlarmCalendar::load()
return 0; // file is zero length
}
qCCritical(KALARM_LOG) << "Error loading calendar file '" << filename <<"'";
qCCritical(KALARM_LOG) << "AlarmCalendar::load: Error loading calendar file '" << filename <<"'";
KAMessageBox::error(MainWindow::mainMainWindow(),
xi18nc("@info", "<para>Error loading calendar:</para><para><filename>%1</filename></para><para>Please fix or delete the file.</para>", mUrl.toDisplayString()));
// load() could have partially populated the calendar, so clear it out
......@@ -312,7 +312,7 @@ bool AlarmCalendar::reload()
if (!mCalendarStorage)
return false;
{
qCDebug(KALARM_LOG) << mUrl.toDisplayString();
qCDebug(KALARM_LOG) << "AlarmCalendar::reload:" << mUrl.toDisplayString();
close();
return open();
}
......@@ -332,7 +332,7 @@ bool AlarmCalendar::saveCal(const QString& newFile)
if (!mOpen && newFile.isNull())
return false;
qCDebug(KALARM_LOG) << "\"" << newFile << "\"," << mEventType;
qCDebug(KALARM_LOG) << "AlarmCalendar::saveCal:" << "\"" << newFile << "\"," << mEventType;
QString saveFilename = newFile.isNull() ? mLocalFile : newFile;
if (mCalType == LOCAL_VCAL && newFile.isNull() && mUrl.isLocalFile())
saveFilename = mICalUrl.toLocalFile();
......@@ -340,7 +340,7 @@ bool AlarmCalendar::saveCal(const QString& newFile)
mCalendarStorage->setSaveFormat(new ICalFormat);
if (!mCalendarStorage->save())
{
qCCritical(KALARM_LOG) << "Saving" << saveFilename << "failed.";
qCCritical(KALARM_LOG) << "AlarmCalendar::saveCal: Saving" << saveFilename << "failed.";
KAMessageBox::error(MainWindow::mainMainWindow(),
xi18nc("@info", "Failed to save calendar to <filename>%1</filename>", mICalUrl.toDisplayString()));
return false;
......@@ -354,7 +354,7 @@ bool AlarmCalendar::saveCal(const QString& newFile)
KJobWidgets::setWindow(putJob, MainWindow::mainMainWindow());
if (!putJob->exec())
{
qCCritical(KALARM_LOG) << saveFilename << "upload failed.";
qCCritical(KALARM_LOG) << "AlarmCalendar::saveCal:" << saveFilename << "upload failed.";
KAMessageBox::error(MainWindow::mainMainWindow(),
xi18nc("@info", "Cannot upload calendar to <filename>%1</filename>", mICalUrl.toDisplayString()));
return false;
......@@ -417,7 +417,7 @@ void AlarmCalendar::updateDisplayKAEvents()
{
if (mCalType == RESOURCES)
return;
qCDebug(KALARM_LOG);
qCDebug(KALARM_LOG) << "AlarmCalendar::updateDisplayKAEvents";
const Collection::Id key = DISPLAY_COL_ID;
KAEvent::List& events = mResourceMap[key];
int i, end;
......@@ -443,7 +443,7 @@ void AlarmCalendar::updateDisplayKAEvents()
KAEvent* event = new KAEvent(kcalevent);
if (!event->isValid())
{
qCWarning(KALARM_LOG) << "Ignoring unusable event" << kcalevent->uid();
qCWarning(KALARM_LOG) << "AlarmCalendar::updateDisplayKAEvents: Ignoring unusable event" << kcalevent->uid();
delete event;
continue; // ignore events without usable alarms
}
......@@ -475,7 +475,7 @@ void AlarmCalendar::removeKAEvents(Collection::Id key, bool closing, CalEvent::T
if (remove)
{
if (key != DISPLAY_COL_ID)
qCCritical(KALARM_LOG) << "Event" << event->id() << ", collection" << event->collectionId() << "Indexed under collection" << key;
qCCritical(KALARM_LOG) << "AlarmCalendar::removeKAEvents: Event" << event->id() << ", collection" << event->collectionId() << "Indexed under collection" << key;
}
else
remove = event->category() & types;
......@@ -538,7 +538,7 @@ void AlarmCalendar::slotEventChanged(const AkonadiModel::Event& event)
{
if (!event.isConsistent())
{
qCCritical(KALARM_LOG) << "Inconsistent AkonadiModel::Event: event:" << event.event.collectionId() << ", collection" << event.collection.id();
qCCritical(KALARM_LOG) << "AlarmCalendar::slotEventChanged: Inconsistent AkonadiModel::Event: event:" << event.event.collectionId() << ", collection" << event.collection.id();
return;
}
......@@ -579,7 +579,7 @@ void AlarmCalendar::slotEventsToBeRemoved(const AkonadiModel::EventList& events)
for (int i = 0, count = events.count(); i < count; ++i)
{
if (!events[i].isConsistent())
qCCritical(KALARM_LOG) << "Inconsistent AkonadiModel::Event: event:" << events[i].event.collectionId() << ", collection" << events[i].collection.id();
qCCritical(KALARM_LOG) << "AlarmCalendar::slotEventsToBeRemoved: Inconsistent AkonadiModel::Event: event:" << events[i].event.collectionId() << ", collection" << events[i].collection.id();
else if (mEventMap.contains(events[i].eventId()))
deleteEventInternal(events[i].event, events[i].collection, false);
}
......@@ -594,20 +594,20 @@ void AlarmCalendar::slotEventsToBeRemoved(const AkonadiModel::EventList& events)
*/
bool AlarmCalendar::importAlarms(QWidget* parent, Collection* collection)
{
qCDebug(KALARM_LOG);
qCDebug(KALARM_LOG) << "AlarmCalendar::importAlarms";
QUrl url = KFileDialog::getOpenUrl(QUrl(QStringLiteral("filedialog:///importalarms")),
QStringLiteral("*.vcs *.ics|%1").arg(i18nc("@info", "Calendar Files")), parent);
if (url.isEmpty())
{
qCCritical(KALARM_LOG) << "Empty URL";
qCCritical(KALARM_LOG) << "AlarmCalendar::importAlarms: Empty URL";
return false;
}
if (!url.isValid())
{
qCDebug(KALARM_LOG) << "Invalid URL";
qCDebug(KALARM_LOG) << "AlarmCalendar::importAlarms: Invalid URL";
return false;
}
qCDebug(KALARM_LOG) << url.toDisplayString();
qCDebug(KALARM_LOG) << "AlarmCalendar::importAlarms:" << url.toDisplayString();
bool success = true;
QString filename;
......@@ -617,7 +617,7 @@ bool AlarmCalendar::importAlarms(QWidget* parent, Collection* collection)
filename = url.toLocalFile();
if (!QFile::exists(filename))
{
qCDebug(KALARM_LOG) << "File '" << url.toDisplayString() <<"' not found";
qCDebug(KALARM_LOG) << "AlarmCalendar::importAlarms: File '" << url.toDisplayString() <<"' not found";
KAMessageBox::error(parent, xi18nc("@info", "Could not load calendar <filename>%1</filename>.", url.toDisplayString()));
return false;
}
......@@ -628,7 +628,7 @@ bool AlarmCalendar::importAlarms(QWidget* parent, Collection* collection)
KJobWidgets::setWindow(getJob, MainWindow::mainMainWindow());
if (!getJob->exec())
{
qCCritical(KALARM_LOG) << "Download failure";
qCCritical(KALARM_LOG) << "AlarmCalendar::importAlarms: Download failure";
KAMessageBox::error(parent, xi18nc("@info", "Cannot download calendar: <filename>%1</filename>", url.toDisplayString()));
return false;
}
......@@ -646,7 +646,7 @@ bool AlarmCalendar::importAlarms(QWidget* parent, Collection* collection)
success = calStorage->load();
if (!success)
{
qCDebug(KALARM_LOG) << "Error loading calendar '" << filename <<"'";
qCDebug(KALARM_LOG) << "AlarmCalendar::importAlarms: Error loading calendar '" << filename <<"'";
KAMessageBox::error(parent, xi18nc("@info", "Could not load calendar <filename>%1</filename>.", url.toDisplayString()));
}
else
......@@ -735,10 +735,10 @@ bool AlarmCalendar::exportAlarms(const KAEvent::List& events, QWidget* parent)
QUrl url = QUrl::fromLocalFile(file);
if (!url.isValid())
{
qCDebug(KALARM_LOG) << "Invalid URL" << url;
qCDebug(KALARM_LOG) << "AlarmCalendar::exportAlarms: Invalid URL" << url;
return false;
}
qCDebug(KALARM_LOG) << url.toDisplayString();
qCDebug(KALARM_LOG) << "AlarmCalendar::exportAlarms:" << url.toDisplayString();
MemoryCalendar::Ptr calendar(new MemoryCalendar(Preferences::timeSpecAsZone()));
FileStorage::Ptr calStorage(new FileStorage(calendar, file));
......@@ -751,7 +751,7 @@ bool AlarmCalendar::exportAlarms(const KAEvent::List& events, QWidget* parent)
KFileItem fi(statJob->statResult(), url);
if (fi.size())
{
qCCritical(KALARM_LOG) << "Error loading calendar file" << file << "for append";
qCCritical(KALARM_LOG) << "AlarmCalendar::exportAlarms: Error loading calendar file" << file << "for append";
KAMessageBox::error(MainWindow::mainMainWindow(),
xi18nc("@info", "Error loading calendar to append to:<nl/><filename>%1</filename>", url.toDisplayString()));
return false;
......@@ -791,7 +791,7 @@ bool AlarmCalendar::exportAlarms(const KAEvent::List& events, QWidget* parent)
calStorage->setSaveFormat(new ICalFormat);
if (!calStorage->save())
{
qCCritical(KALARM_LOG) << file << ": failed";
qCCritical(KALARM_LOG) << "AlarmCalendar::exportAlarms:" << file << ": failed";
KAMessageBox::error(MainWindow::mainMainWindow(),
xi18nc("@info", "Failed to save new calendar to:<nl/><filename>%1</filename>", url.toDisplayString()));
success = false;
......@@ -804,7 +804,7 @@ bool AlarmCalendar::exportAlarms(const KAEvent::List& events, QWidget* parent)
KJobWidgets::setWindow(uploadJob, parent);
if (!uploadJob->exec())
{
qCCritical(KALARM_LOG) << file << ": upload failed";
qCCritical(KALARM_LOG) << "AlarmCalendar::exportAlarms:" << file << ": upload failed";
KAMessageBox::error(MainWindow::mainMainWindow(),
xi18nc("@info", "Cannot upload new calendar to:<nl/><filename>%1</filename>", url.toDisplayString()));
success = false;
......@@ -894,7 +894,7 @@ bool AlarmCalendar::addEvent(KAEvent& evnt, QWidget* promptParent, bool useEvent
if (!mOpen)
return false;
// Check that the event type is valid for the calendar
qCDebug(KALARM_LOG) << evnt.id();
qCDebug(KALARM_LOG) << "AlarmCalendar::addEvent:" << evnt.id();
CalEvent::Type type = evnt.category();
if (type != mEventType)
{
......@@ -1034,11 +1034,11 @@ void AlarmCalendar::addNewEvent(const Collection& collection, KAEvent* event, bo
bool AlarmCalendar::modifyEvent(const EventId& oldEventId, KAEvent& newEvent)
{
EventId newId(oldEventId.collectionId(), newEvent.id());
qCDebug(KALARM_LOG) << oldEventId << "->" << newId;
qCDebug(KALARM_LOG) << "AlarmCalendar::modifyEvent:" << oldEventId << "->" << newId;
bool noNewId = newId.isEmpty();
if (!noNewId && oldEventId == newId)
{
qCCritical(KALARM_LOG) << "Same IDs";
qCCritical(KALARM_LOG) << "AlarmCalendar::modifyEvent: Same IDs";
return false;
}
if (!mOpen)
......@@ -1050,7 +1050,7 @@ bool AlarmCalendar::modifyEvent(const EventId& oldEventId, KAEvent& newEvent)
KAEvent* storedEvent = event(oldEventId);
if (!storedEvent)
{
qCCritical(KALARM_LOG) << "Old event not found";
qCCritical(KALARM_LOG) << "AlarmCalendar::modifyEvent: Old event not found";
return false;
}
if (noNewId)
......@@ -1101,7 +1101,7 @@ KAEvent* AlarmCalendar::updateEvent(const KAEvent* evnt)
return kaevnt;
}
}
qCDebug(KALARM_LOG) << "error";
qCDebug(KALARM_LOG) << "AlarmCalendar::updateEvent: error";
return nullptr;
}
......@@ -1168,7 +1168,7 @@ CalEvent::Type AlarmCalendar::deleteEventInternal(const KAEvent& event, const Ak
return CalEvent::EMPTY;
if (event.collectionId() != collection.id())
{
qCCritical(KALARM_LOG) << "Event" << event.id() << ": collection" << event.collectionId() << "differs from 'collection'" << collection.id();
qCCritical(KALARM_LOG) << "AlarmCalendar::deleteEventInternal: Event" << event.id() << ": collection" << event.collectionId() << "differs from 'collection'" << collection.id();
return CalEvent::EMPTY;
}
return deleteEventInternal(event.id(), event, collection, deleteFromAkonadi);
......@@ -1244,7 +1244,7 @@ KAEvent* AlarmCalendar::event(const EventId& uniqueID, bool checkDuplicates)
KAEvent::List list = events(eventId);
if (list.count() > 1)
{
qCWarning(KALARM_LOG) << "Multiple events found with ID" << eventId;
qCWarning(KALARM_LOG) << "AlarmCalendar::event: Multiple events found with ID" << eventId;
return nullptr;
}
if (list.isEmpty())
......@@ -1555,7 +1555,7 @@ void AlarmCalendar::setAlarmPending(KAEvent* event, bool pending)
{
QString id = event->id();
bool wasPending = mPendingAlarms.contains(id);
qCDebug(KALARM_LOG) << id << "," << pending << "(was" << wasPending << ")";
qCDebug(KALARM_LOG) << "AlarmCalendar::setAlarmPending:" << id << "," << pending << "(was" << wasPending << ")";
if (pending)
{
if (wasPending)
......
......@@ -149,7 +149,7 @@ CalendarMigrator::CalendarMigrator(QObject* parent)
CalendarMigrator::~CalendarMigrator()
{
qCDebug(KALARM_LOG);
qCDebug(KALARM_LOG) << "~CalendarMigrator";
mInstance = nullptr;
}
......@@ -184,7 +184,7 @@ void CalendarMigrator::execute()
*/
void CalendarMigrator::migrateOrCreate()
{
qCDebug(KALARM_LOG);
qCDebug(KALARM_LOG) << "CalendarMigrator::migrateOrCreate";
// First, check whether any Akonadi resources already exist, and if
// so, find their alarm types.
......@@ -260,12 +260,12 @@ void CalendarMigrator::collectionFetchResult(KJob* j)
CollectionFetchJob* job = static_cast<CollectionFetchJob*>(j);
const QString id = job->fetchScope().resource();
if (j->error())
qCCritical(KALARM_LOG) << "CollectionFetchJob" << id << "error: " << j->errorString();
qCCritical(KALARM_LOG) << "CalendarMigrator::collectionFetchResult: CollectionFetchJob" << id << "error: " << j->errorString();
else
{
const Collection::List collections = job->collections();
if (collections.isEmpty())
qCCritical(KALARM_LOG) << "No collections found for resource" << id;
qCCritical(KALARM_LOG) << "CalendarMigrator::collectionFetchResult: No collections found for resource" << id;
else
mExistingAlarmTypes |= CalEvent::types(collections[0].contentMimeTypes());
}
......@@ -288,7 +288,7 @@ void CalendarMigrator::collectionFetchResult(KJob* j)
*/
void CalendarMigrator::createDefaultResources()
{
qCDebug(KALARM_LOG);
qCDebug(KALARM_LOG) << "CalendarMigrator::createDefaultResources";
CalendarCreator* creator;
if (!(mExistingAlarmTypes & CalEvent::ACTIVE))
{
......@@ -379,7 +379,7 @@ void CalendarMigrator::calendarCreated(CalendarCreator* creator)
*/
void CalendarMigrator::updateToCurrentFormat(const Collection& collection, bool ignoreKeepFormat, QWidget* parent)
{
qCDebug(KALARM_LOG) << collection.id();
qCDebug(KALARM_LOG) << "CalendarMigrator::updateToCurrentFormat:" << collection.id();
if (CalendarUpdater::containsCollection(collection.id()))
return; // prevent multiple simultaneous user prompts
const AgentInstance agent = AgentManager::self()->instance(collection.resource());
......@@ -391,7 +391,7 @@ void CalendarMigrator::updateToCurrentFormat(const Collection& collection, bool
dirResource = true;
else
{
qCCritical(KALARM_LOG) << "Invalid agent type" << id;
qCCritical(KALARM_LOG) << "CalendarMigrator::updateToCurrentFormat: Invalid agent type" << id;
return;
}
CalendarUpdater* updater = new CalendarUpdater(collection, dirResource, ignoreKeepFormat, false, parent);
......@@ -430,7 +430,7 @@ bool CalendarUpdater::containsCollection(Collection::Id id)
bool CalendarUpdater::update()
{
qCDebug(KALARM_LOG) << mCollection.id() << (mDirResource ? "directory" : "file");
qCDebug(KALARM_LOG) << "CalendarUpdater::update:" << mCollection.id() << (mDirResource ? "directory" : "file");
bool result = true;
if (!mDuplicate // prevent concurrent updates
&& mCollection.hasAttribute<CompatibilityAttribute>()) // must know format to update
......@@ -445,13 +445,13 @@ bool CalendarUpdater::update()
if (!mIgnoreKeepFormat
&& mCollection.hasAttribute<CollectionAttribute>()
&& mCollection.attribute<CollectionAttribute>()->keepFormat())
qCDebug(KALARM_LOG) << "Not updating format (previous user choice)";
qCDebug(KALARM_LOG) << "CalendarUpdater::update: Not updating format (previous user choice)";
else
{
// The user hasn't previously said not to convert it
const QString versionString = KAlarmCal::getVersionString(compatAttr->version());
const QString msg = KAlarm::conversionPrompt(mCollection.name(), versionString, false);
qCDebug(KALARM_LOG) << "Version" << versionString;
qCDebug(KALARM_LOG) << "CalendarUpdater::update: Version" << versionString;
if (KAMessageBox::warningYesNo(qobject_cast<QWidget*>(mParent), msg) != KMessageBox::Yes)
result = false; // the user chose not to update the calendar
else
......@@ -501,17 +501,17 @@ bool CalendarUpdater::update()
*/
template <class Interface> bool CalendarMigrator::updateStorageFormat(const AgentInstance& agent, QString& errorMessage, QObject* parent)
{
qCDebug(KALARM_LOG);
qCDebug(KALARM_LOG) << "CalendarMigrator::updateStorageFormat";
Interface* iface = getAgentInterface<Interface>(agent, errorMessage, parent);
if (!iface)
{
qCDebug(KALARM_LOG) << errorMessage;
qCDebug(KALARM_LOG) << "CalendarMigrator::updateStorageFormat:" << errorMessage;
return false;
}
iface->setUpdateStorageFormat(true);
iface->save();
delete iface;
qCDebug(KALARM_LOG) << "true";
qCDebug(KALARM_LOG) << "CalendarMigrator::updateStorageFormat: true";
return true;
}
......@@ -527,7 +527,7 @@ template <class Interface> Interface* CalendarMigrator::getAgentInterface(const
if (!iface->isValid())
{
errorMessage = iface->lastError().message();
qCDebug(KALARM_LOG) << "D-Bus error accessing resource:" << errorMessage;
qCDebug(KALARM_LOG) << "CalendarMigrator::getAgentInterface: D-Bus error accessing resource:" << errorMessage;
delete iface;
return nullptr;
}
......@@ -562,7 +562,7 @@ CalendarCreator::CalendarCreator(const QString& resourceType, const KConfigGroup
}