Commit 5dce6496 authored by Laurent Montel's avatar Laurent Montel 😁

Use qCDebug(KALARM_LOG)

parent e75bd285
......@@ -54,6 +54,7 @@ set(libkalarm_SRCS
)
set(kalarm_bin_SRCS ${libkalarm_SRCS}
kalarm_debug.cpp
birthdaydlg.cpp
birthdaymodel.cpp
main.cpp
......@@ -177,7 +178,7 @@ install(PROGRAMS kalarm-version.pl kalarm-1.2.1-general.pl kalarm-1.9.5-defaults
########### KAuth helper ###############
add_executable(kalarm_helper rtcwakeaction.cpp)
add_executable(kalarm_helper rtcwakeaction.cpp kalarm_debug.cpp)
target_link_libraries(kalarm_helper KF5::Auth KF5::KDELibs4Support)
install(TARGETS kalarm_helper DESTINATION ${LIBEXEC_INSTALL_DIR})
kauth_install_helper_files(kalarm_helper org.kde.kalarmrtcwake root)
......
......@@ -58,7 +58,7 @@
#include <QApplication>
#include <QFileInfo>
#include <QTimer>
#include <QDebug>
#include "kalarm_debug.h"
using namespace Akonadi;
using namespace KAlarmCal;
......@@ -168,14 +168,14 @@ void AkonadiModel::checkResources(ServerManager::State state)
case ServerManager::Running:
if (!mResourcesChecked)
{
qDebug() << "Server running";
qCDebug(KALARM_LOG) << "Server running";
mResourcesChecked = true;
mMigrating = true;
CalendarMigrator::execute();
}
break;
case ServerManager::NotRunning:
qDebug() << "Server stopped";
qCDebug(KALARM_LOG) << "Server stopped";
mResourcesChecked = false;
mMigrating = false;
mCollectionAlarmTypes.clear();
......@@ -560,7 +560,7 @@ bool AkonadiModel::setData(const QModelIndex& index, const QVariant& value, int
attr = collection.attribute<CollectionAttribute>(Entity::AddIfMissing);
if (attr->enabled() == types)
return true; // no change
qDebug() << "Set enabled:" << types << ", was=" << attr->enabled();
qCDebug(KALARM_LOG) << "Set enabled:" << types << ", was=" << attr->enabled();
attr->setEnabled(types);
updateCollection = true;
break;
......@@ -571,7 +571,7 @@ bool AkonadiModel::setData(const QModelIndex& index, const QVariant& value, int
{
const CalEvent::Types types = static_cast<CalEvent::Types>(value.value<int>());
attr = collection.attribute<CollectionAttribute>(Entity::AddIfMissing);
qDebug()<<"Set standard:"<<types<<", was="<<attr->standard();
qCDebug(KALARM_LOG)<<"Set standard:"<<types<<", was="<<attr->standard();
attr->setStandard(types);
updateCollection = true;
}
......@@ -630,7 +630,7 @@ qDebug()<<"Set standard:"<<types<<", was="<<attr->standard();
return true; // no change
attr->setCommandError(err);
updateItem = true;
qDebug()<<"Item:"<<item.id()<<" CommandErrorRole ->"<<err;
qCDebug(KALARM_LOG)<<"Item:"<<item.id()<<" CommandErrorRole ->"<<err;
break;
}
default:
......@@ -639,7 +639,7 @@ qDebug()<<"Item:"<<item.id()<<" CommandErrorRole ->"<<err;
break;
}
default:
qDebug()<<"Item: passing to EntityTreeModel::setData("<<role<<")";
qCDebug(KALARM_LOG)<<"Item: passing to EntityTreeModel::setData("<<role<<")";
break;
}
if (updateItem)
......@@ -775,7 +775,7 @@ static bool checkItem_isArchived(const Item& item)
void AkonadiModel::slotUpdateArchivedColour(const QColor&)
{
qDebug();
qCDebug(KALARM_LOG);
signalDataChanged(&checkItem_isArchived, 0, ColumnCount - 1, QModelIndex());
}
......@@ -795,7 +795,7 @@ static bool checkItem_isDisabled(const Item& item)
void AkonadiModel::slotUpdateDisabledColour(const QColor&)
{
qDebug();
qCDebug(KALARM_LOG);
signalDataChanged(&checkItem_isDisabled, 0, ColumnCount - 1, QModelIndex());
}
......@@ -815,7 +815,7 @@ static bool checkItem_excludesHolidays(const Item& item)
void AkonadiModel::slotUpdateHolidays()
{
qDebug();
qCDebug(KALARM_LOG);
Q_ASSERT(TimeToColumn == TimeColumn + 1); // signal should be emitted only for TimeTo and Time columns
signalDataChanged(&checkItem_excludesHolidays, TimeColumn, TimeToColumn, QModelIndex());
}
......@@ -836,7 +836,7 @@ static bool checkItem_workTimeOnly(const Item& item)
void AkonadiModel::slotUpdateWorkingHours()
{
qDebug();
qCDebug(KALARM_LOG);
Q_ASSERT(TimeToColumn == TimeColumn + 1); // signal should be emitted only for TimeTo and Time columns
signalDataChanged(&checkItem_workTimeOnly, TimeColumn, TimeToColumn, QModelIndex());
}
......@@ -1084,7 +1084,7 @@ bool AkonadiModel::removeCollection(const Akonadi::Collection& collection)
{
if (!collection.isValid())
return false;
qDebug() << collection.id();
qCDebug(KALARM_LOG) << collection.id();
Collection col = collection;
mCollectionsDeleting << collection.id();
// Note: CollectionDeleteJob deletes the backend storage also.
......@@ -1142,7 +1142,7 @@ bool AkonadiModel::reloadCollection(const Akonadi::Collection& collection)
{
if (!collection.isValid())
return false;
qDebug() << collection.id();
qCDebug(KALARM_LOG) << collection.id();
mMonitor->setCollectionMonitored(collection, false);
mMonitor->setCollectionMonitored(collection, true);
return true;
......@@ -1153,7 +1153,7 @@ bool AkonadiModel::reloadCollection(const Akonadi::Collection& collection)
*/
void AkonadiModel::reload()
{
qDebug();
qCDebug(KALARM_LOG);
const Collection::List collections = mMonitor->collectionsMonitored();
foreach (const Collection& collection, collections)
{
......@@ -1301,7 +1301,7 @@ KAEvent AkonadiModel::event(const Item& item, const QModelIndex& index, Collecti
*/
AkonadiModel::Result AkonadiModel::addEvent(KAEvent* event, CalEvent::Type type, QWidget* promptParent, bool noPrompt)
{
qDebug() << event->id();
qCDebug(KALARM_LOG) << event->id();
// Determine parent collection - prompt or use default
bool cancelled;
......@@ -1311,12 +1311,12 @@ AkonadiModel::Result AkonadiModel::addEvent(KAEvent* event, CalEvent::Type type,
delete event;
if (cancelled)
return Cancelled;
qDebug() << "No collection";
qCDebug(KALARM_LOG) << "No collection";
return Failed;
}
if (!addEvent(event, collection))
{
qDebug() << "Failed";
qCDebug(KALARM_LOG) << "Failed";
return Failed; // event was deleted by addEvent()
}
return Success;
......@@ -1352,20 +1352,20 @@ bool AkonadiModel::addEvents(const KAEvent::List& events, Collection& collection
*/
bool AkonadiModel::addEvent(KAEvent& event, Collection& collection)
{
qDebug() << "ID:" << event.id();
qCDebug(KALARM_LOG) << "ID:" << event.id();
Item item;
if (!event.setItemPayload(item, collection.contentMimeTypes()))
{
qWarning() << "Invalid mime type for collection";
qCWarning(KALARM_LOG) << "Invalid mime type for collection";
return false;
}
event.setItemId(item.id());
qDebug()<<"-> item id="<<item.id();
qCDebug(KALARM_LOG)<<"-> item id="<<item.id();
ItemCreateJob* job = new ItemCreateJob(item, collection);
connect(job, &ItemCreateJob::result, this, &AkonadiModel::itemJobDone);
mPendingItemJobs[job] = item.id();
job->start();
qDebug()<<"...exiting";
qCDebug(KALARM_LOG)<<"...exiting";
return true;
}
......@@ -1379,21 +1379,21 @@ qDebug()<<"...exiting";
*/
bool AkonadiModel::updateEvent(KAEvent& event)
{
qDebug() << "ID:" << event.id();
qCDebug(KALARM_LOG) << "ID:" << event.id();
return updateEvent(event.itemId(), event);
}
bool AkonadiModel::updateEvent(Akonadi::Entity::Id itemId, KAEvent& newEvent)
{
qDebug()<<"item id="<<itemId;
qCDebug(KALARM_LOG)<<"item id="<<itemId;
const QModelIndex ix = itemIndex(itemId);
if (!ix.isValid())
return false;
const Collection collection = ix.data(ParentCollectionRole).value<Collection>();
Item item = ix.data(ItemRole).value<Item>();
qDebug()<<"item id="<<item.id()<<", revision="<<item.revision();
qCDebug(KALARM_LOG)<<"item id="<<item.id()<<", revision="<<item.revision();
if (!newEvent.setItemPayload(item, collection.contentMimeTypes()))
{
qWarning() << "Invalid mime type for collection";
qCWarning(KALARM_LOG) << "Invalid mime type for collection";
return false;
}
// setData(ix, QVariant::fromValue(item), ItemRole);
......@@ -1410,13 +1410,13 @@ bool AkonadiModel::deleteEvent(const KAEvent& event)
}
bool AkonadiModel::deleteEvent(Akonadi::Entity::Id itemId)
{
qDebug() << itemId;
qCDebug(KALARM_LOG) << itemId;
const QModelIndex ix = itemIndex(itemId);
if (!ix.isValid())
return false;
if (mCollectionsDeleting.contains(ix.data(ParentCollectionRole).value<Collection>().id()))
{
qDebug() << "Collection being deleted";
qCDebug(KALARM_LOG) << "Collection being deleted";
return true; // the event's collection is being deleted
}
const Item item = ix.data(ItemRole).value<Item>();
......@@ -1437,12 +1437,12 @@ bool AkonadiModel::deleteEvent(Akonadi::Entity::Id itemId)
*/
void AkonadiModel::queueItemModifyJob(const Item& item)
{
qDebug() << item.id();
qCDebug(KALARM_LOG) << item.id();
QMap<Item::Id, Item>::Iterator it = mItemModifyJobQueue.find(item.id());
if (it != mItemModifyJobQueue.end())
{
// A job is already queued for this item. Replace the queued item value with the new one.
qDebug() << "Replacing previously queued job";
qCDebug(KALARM_LOG) << "Replacing previously queued job";
it.value() = item;
}
else
......@@ -1450,7 +1450,7 @@ void AkonadiModel::queueItemModifyJob(const Item& item)
// There is no job already queued for this item
if (mItemsBeingCreated.contains(item.id()))
{
qDebug() << "Waiting for item initialisation";
qCDebug(KALARM_LOG) << "Waiting for item initialisation";
mItemModifyJobQueue[item.id()] = item; // wait for item initialisation to complete
}
else
......@@ -1464,7 +1464,7 @@ void AkonadiModel::queueItemModifyJob(const Item& item)
job->disableRevisionCheck();
connect(job, &ItemModifyJob::result, this, &AkonadiModel::itemJobDone);
mPendingItemJobs[job] = item.id();
qDebug() << "Executing Modify job for item" << item.id() << ", revision=" << newItem.revision();
qCDebug(KALARM_LOG) << "Executing Modify job for item" << item.id() << ", revision=" << newItem.revision();
}
}
}
......@@ -1487,7 +1487,7 @@ void AkonadiModel::itemJobDone(KJob* j)
mPendingItemJobs.erase(it);
}
const QByteArray jobClass = j->metaObject()->className();
qDebug() << jobClass;
qCDebug(KALARM_LOG) << jobClass;
if (j->error())
{
QString errMsg;
......@@ -1517,7 +1517,7 @@ void AkonadiModel::itemJobDone(KJob* j)
// Prevent modification of the item until it is fully initialised.
// Either slotMonitoredItemChanged() or slotRowsInserted(), or both,
// will be called when the item is done.
qDebug() << "item id=" << static_cast<ItemCreateJob*>(j)->item().id();
qCDebug(KALARM_LOG) << "item id=" << static_cast<ItemCreateJob*>(j)->item().id();
mItemsBeingCreated << static_cast<ItemCreateJob*>(j)->item().id();
}
emit itemDone(itemId);
......@@ -1548,19 +1548,19 @@ void AkonadiModel::itemJobDone(KJob* j)
void AkonadiModel::checkQueuedItemModifyJob(const Item& item)
{
if (mItemsBeingCreated.contains(item.id()))
{qDebug()<<"Still being created";
{qCDebug(KALARM_LOG)<<"Still being created";
return; // the item hasn't been fully initialised yet
}
const QMap<Item::Id, Item>::iterator it = mItemModifyJobQueue.find(item.id());
if (it == mItemModifyJobQueue.end())
{qDebug()<<"No jobs queued";
{qCDebug(KALARM_LOG)<<"No jobs queued";
return; // there are no jobs queued for the item
}
Item qitem = it.value();
if (!qitem.isValid())
{
// There is no further job queued for the item, so remove the item from the list
qDebug()<<"No more jobs queued";
qCDebug(KALARM_LOG)<<"No more jobs queued";
mItemModifyJobQueue.erase(it);
}
else
......@@ -1573,7 +1573,7 @@ qDebug()<<"No more jobs queued";
job->disableRevisionCheck();
connect(job, &ItemModifyJob::result, this, &AkonadiModel::itemJobDone);
mPendingItemJobs[job] = qitem.id();
qDebug() << "Executing queued Modify job for item" << qitem.id() << ", revision=" << qitem.revision();
qCDebug(KALARM_LOG) << "Executing queued Modify job for item" << qitem.id() << ", revision=" << qitem.revision();
}
}
......@@ -1582,7 +1582,7 @@ qDebug()<<"No more jobs queued";
*/
void AkonadiModel::slotRowsInserted(const QModelIndex& parent, int start, int end)
{
qDebug() << start << "-" << end << "(parent =" << parent << ")";
qCDebug(KALARM_LOG) << start << "-" << end << "(parent =" << parent << ")";
for (int row = start; row <= end; ++row)
{
const QModelIndex ix = index(row, 0, parent);
......@@ -1591,7 +1591,7 @@ void AkonadiModel::slotRowsInserted(const QModelIndex& parent, int start, int en
{
// A collection has been inserted.
// Ignore it if it isn't owned by a valid resource.
qDebug() << "Collection" << collection.id() << collection.name();
qCDebug(KALARM_LOG) << "Collection" << collection.id() << collection.name();
if (AgentManager::self()->instance(collection.resource()).isValid())
{
QSet<QByteArray> attrs;
......@@ -1613,7 +1613,7 @@ void AkonadiModel::slotRowsInserted(const QModelIndex& parent, int start, int en
const Item item = ix.data(ItemRole).value<Item>();
if (item.isValid())
{
qDebug() << "item id=" << item.id() << ", revision=" << item.revision();
qCDebug(KALARM_LOG) << "item id=" << item.id() << ", revision=" << item.revision();
if (mItemsBeingCreated.removeAll(item.id())) // the new item has now been initialised
checkQueuedItemModifyJob(item); // execute the next job queued for the item
}
......@@ -1629,12 +1629,12 @@ void AkonadiModel::slotRowsInserted(const QModelIndex& parent, int start, int en
*/
void AkonadiModel::slotRowsAboutToBeRemoved(const QModelIndex& parent, int start, int end)
{
qDebug() << start << "-" << end << "(parent =" << parent << ")";
qCDebug(KALARM_LOG) << start << "-" << end << "(parent =" << parent << ")";
const EventList events = eventList(parent, start, end);
if (!events.isEmpty())
{
foreach (const Event& event, events)
qDebug() << "Collection:" << event.collection.id() << ", Event ID:" << event.event.id();
qCDebug(KALARM_LOG) << "Collection:" << event.collection.id() << ", Event ID:" << event.event.id();
emit eventsToBeRemoved(events);
}
}
......@@ -1667,7 +1667,7 @@ void AkonadiModel::setCollectionChanged(const Collection& collection, const QSet
const Collection::Rights newRights = collection.rights() & writableRights;
if (newRights != oldRights)
{
qDebug() << "Collection" << collection.id() << ": rights ->" << newRights;
qCDebug(KALARM_LOG) << "Collection" << collection.id() << ": rights ->" << newRights;
mCollectionRights[collection.id()] = newRights;
emit collectionStatusChanged(collection, ReadOnly, (newRights != writableRights), rowInserted);
}
......@@ -1678,7 +1678,7 @@ void AkonadiModel::setCollectionChanged(const Collection& collection, const QSet
const CalEvent::Types newAlarmTypes = CalEvent::types(collection.contentMimeTypes());
if (newAlarmTypes != oldAlarmTypes)
{
qDebug() << "Collection" << collection.id() << ": alarm types ->" << newAlarmTypes;
qCDebug(KALARM_LOG) << "Collection" << collection.id() << ": alarm types ->" << newAlarmTypes;
mCollectionAlarmTypes[collection.id()] = newAlarmTypes;
emit collectionStatusChanged(collection, AlarmTypes, static_cast<int>(newAlarmTypes), rowInserted);
}
......@@ -1691,7 +1691,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)
{
qDebug() << "Collection" << collection.id() << ": enabled ->" << newEnabled;
qCDebug(KALARM_LOG) << "Collection" << collection.id() << ": enabled ->" << newEnabled;
firstEnabled = false;
mCollectionEnabled[collection.id()] = newEnabled;
emit collectionStatusChanged(collection, Enabled, static_cast<int>(newEnabled), rowInserted);
......@@ -1702,7 +1702,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
qDebug() << "CompatibilityAttribute";
qCDebug(KALARM_LOG) << "CompatibilityAttribute";
Collection col(collection);
refresh(col);
CalendarMigrator::updateToCurrentFormat(col, false, MainWindow::mainMainWindow());
......@@ -1714,7 +1714,7 @@ void AkonadiModel::setCollectionChanged(const Collection& collection, const QSet
if (mCollectionsBeingCreated.isEmpty() && mCollectionIdsBeingCreated.isEmpty()
&& CalendarMigrator::completed())
{
qDebug() << "Migration completed";
qCDebug(KALARM_LOG) << "Migration completed";
mMigrating = false;
emit migrationCompleted();
}
......@@ -1727,7 +1727,7 @@ void AkonadiModel::setCollectionChanged(const Collection& collection, const QSet
void AkonadiModel::slotCollectionRemoved(const Collection& collection)
{
const Collection::Id id = collection.id();
qDebug() << id;
qCDebug(KALARM_LOG) << id;
mCollectionRights.remove(id);
mCollectionsDeleting.removeAll(id);
while (mCollectionsDeleted.count() > 20) // don't let list grow indefinitely
......@@ -1756,7 +1756,7 @@ void AkonadiModel::slotMigrationCompleted()
{
if (mCollectionsBeingCreated.isEmpty() && mCollectionIdsBeingCreated.isEmpty())
{
qDebug() << "Migration completed";
qCDebug(KALARM_LOG) << "Migration completed";
mMigrating = false;
emit migrationCompleted();
}
......@@ -1767,7 +1767,7 @@ void AkonadiModel::slotMigrationCompleted()
*/
void AkonadiModel::slotMonitoredItemChanged(const Akonadi::Item& item, const QSet<QByteArray>&)
{
qDebug() << "item id=" << item.id() << ", revision=" << item.revision();
qCDebug(KALARM_LOG) << "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
......
......@@ -34,7 +34,7 @@
#include <KLocalizedString>
#include <QTimer>
#include <qdebug.h>
#include "kalarm_debug.h"
using namespace Akonadi;
using namespace KAlarmCal;
......@@ -57,7 +57,7 @@ void AkonadiResourceCreator::createResource()
void AkonadiResourceCreator::getAgentType()
{
qDebug() << "Type:" << mDefaultType;
qCDebug(KALARM_LOG) << "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).
......@@ -128,7 +128,7 @@ void AkonadiResourceCreator::agentInstanceCreated(KJob* j)
if (!controlOk)
{
delete agentControlIface;
qWarning() << "Unable to access D-Bus interface of created agent.";
qCWarning(KALARM_LOG) << "Unable to access D-Bus interface of created agent.";
}
else
{
......
......@@ -40,7 +40,7 @@
#include <KSharedConfig>
#include <QTemporaryFile>
#include <QStandardPaths>
#include <qdebug.h>
#include "kalarm_debug.h"
using namespace Akonadi;
using namespace KCalCore;
......@@ -189,7 +189,7 @@ bool AlarmCalendar::open()
if (!mUrl.isValid())
return false;
qDebug() << mUrl.prettyUrl();
qCDebug(KALARM_LOG) << mUrl.prettyUrl();
if (!mCalendarStorage)
{
MemoryCalendar::Ptr calendar(new MemoryCalendar(Preferences::timeZone(true)));
......@@ -241,7 +241,7 @@ int AlarmCalendar::load()
if (!mCalendarStorage)
return -2;
qDebug() << mUrl.prettyUrl();
qCDebug(KALARM_LOG) << mUrl.prettyUrl();
QString tmpFile;
if (!KIO::NetAccess::download(mUrl, tmpFile, MainWindow::mainMainWindow()))
{
......@@ -250,7 +250,7 @@ int AlarmCalendar::load()
xi18nc("@info", "Cannot download calendar: <filename>%1</filename>", mUrl.prettyUrl()));
return -1;
}
qDebug() << "--- Downloaded to" << tmpFile;
qCDebug(KALARM_LOG) << "--- Downloaded to" << tmpFile;
mCalendarStorage->calendar()->setTimeSpec(Preferences::timeZone(true));
mCalendarStorage->setFileName(tmpFile);
if (!mCalendarStorage->load())
......@@ -292,7 +292,7 @@ bool AlarmCalendar::reload()
if (!mCalendarStorage)
return false;
{
qDebug() << mUrl.prettyUrl();
qCDebug(KALARM_LOG) << mUrl.prettyUrl();
close();
return open();
}
......@@ -312,7 +312,7 @@ bool AlarmCalendar::saveCal(const QString& newFile)
if (!mOpen && newFile.isNull())
return false;
qDebug() << "\"" << newFile << "\"," << mEventType;
qCDebug(KALARM_LOG) << "\"" << newFile << "\"," << mEventType;
QString saveFilename = newFile.isNull() ? mLocalFile : newFile;
if (mCalType == LOCAL_VCAL && newFile.isNull() && mUrl.isLocalFile())
saveFilename = mICalUrl.toLocalFile();
......@@ -391,7 +391,7 @@ void AlarmCalendar::updateDisplayKAEvents()
{
if (mCalType == RESOURCES)
return;
qDebug();
qCDebug(KALARM_LOG);
const Collection::Id key = DISPLAY_COL_ID;
KAEvent::List& events = mResourceMap[key];
int i, end;
......@@ -417,7 +417,7 @@ void AlarmCalendar::updateDisplayKAEvents()
KAEvent* event = new KAEvent(kcalevent);
if (!event->isValid())
{
qWarning() << "Ignoring unusable event" << kcalevent->uid();
qCWarning(KALARM_LOG) << "Ignoring unusable event" << kcalevent->uid();
delete event;
continue; // ignore events without usable alarms
}
......@@ -568,7 +568,7 @@ void AlarmCalendar::slotEventsToBeRemoved(const AkonadiModel::EventList& events)
*/
bool AlarmCalendar::importAlarms(QWidget* parent, Collection* collection)
{
qDebug();
qCDebug(KALARM_LOG);
QUrl url = KFileDialog::getOpenUrl(KUrl("filedialog:///importalarms"),
QString::fromLatin1("*.vcs *.ics|%1").arg(i18nc("@info", "Calendar Files")), parent);
if (url.isEmpty())
......@@ -578,10 +578,10 @@ bool AlarmCalendar::importAlarms(QWidget* parent, Collection* collection)
}
if (!url.isValid())
{
qDebug() << "Invalid URL";
qCDebug(KALARM_LOG) << "Invalid URL";
return false;
}
qDebug() << url.toDisplayString();
qCDebug(KALARM_LOG) << url.toDisplayString();
bool success = true;
QString filename;
......@@ -591,7 +591,7 @@ bool AlarmCalendar::importAlarms(QWidget* parent, Collection* collection)
filename = url.toLocalFile();
if (!KStandardDirs::exists(filename))
{
qDebug() << "File '" << url.toDisplayString() <<"' not found";
qCDebug(KALARM_LOG) << "File '" << url.toDisplayString() <<"' not found";
KAMessageBox::error(parent, xi18nc("@info", "Could not load calendar <filename>%1</filename>.", url.toDisplayString()));
return false;
}
......@@ -604,7 +604,7 @@ bool AlarmCalendar::importAlarms(QWidget* parent, Collection* collection)
KAMessageBox::error(parent, xi18nc("@info", "Cannot download calendar: <filename>%1</filename>", url.toDisplayString()));
return false;
}
qDebug() << "--- Downloaded to" << filename;
qCDebug(KALARM_LOG) << "--- Downloaded to" << filename;
}
// Read the calendar and add its alarms to the current calendars
......@@ -613,7 +613,7 @@ bool AlarmCalendar::importAlarms(QWidget* parent, Collection* collection)
success = calStorage->load();
if (!success)
{
qDebug() << "Error loading calendar '" << filename <<"'";
qCDebug(KALARM_LOG) << "Error loading calendar '" << filename <<"'";
KAMessageBox::error(parent, xi18nc("@info", "Could not load calendar <filename>%1</filename>.", url.toDisplayString()));
}
else
......@@ -703,10 +703,10 @@ bool AlarmCalendar::exportAlarms(const KAEvent::List& events, QWidget* parent)
url.setPath(file);
if (!url.isValid())
{
qDebug() << "Invalid URL";
qCDebug(KALARM_LOG) << "Invalid URL";
return false;
}
qDebug() << url.prettyUrl();
qCDebug(KALARM_LOG) << url.prettyUrl();
MemoryCalendar::Ptr calendar(new MemoryCalendar(Preferences::timeZone(true)));
FileStorage::Ptr calStorage(new FileStorage(calendar, file));
......@@ -853,7 +853,7 @@ bool AlarmCalendar::addEvent(KAEvent& evnt, QWidget* promptParent, bool useEvent
if (!mOpen)
return false;
// Check that the event type is valid for the calendar
qDebug() << evnt.id();
qCDebug(KALARM_LOG) << evnt.id();
CalEvent::Type type = evnt.category();
if (type != mEventType)
{
......@@ -993,7 +993,7 @@ void AlarmCalendar::addNewEvent(const Collection& collection, KAEvent* event, bo
bool AlarmCalendar::modifyEvent(const EventId& oldEventId, KAEvent& newEvent)
{
EventId newId(oldEventId.collectionId(), newEvent.id());
qDebug() << oldEventId << "->" << newId;
qCDebug(KALARM_LOG) << oldEventId << "->" << newId;
bool noNewId = newId.isEmpty();
if (!noNewId && oldEventId == newId)
{
......@@ -1060,7 +1060,7 @@ KAEvent* AlarmCalendar::updateEvent(const KAEvent* evnt)
return kaevnt;
}
}
qDebug() << "error";
qCDebug(KALARM_LOG) << "error";
return 0;
}
......@@ -1203,7 +1203,7 @@ KAEvent* AlarmCalendar::event(const EventId& uniqueID, bool checkDuplicates)
KAEvent::List list = events(eventId);
if (list.count() > 1)
{
qWarning() << "Multiple events found with ID" << eventId;
qCWarning(KALARM_LOG) << "Multiple events found with ID" << eventId;
return 0;
}
if (list.isEmpty())
......@@ -1514,7 +1514,7 @@ void AlarmCalendar::setAlarmPending(KAEvent* event, bool pending)
{
QString id = event->id();
bool wasPending = mPendingAlarms.contains(id);
qDebug() << id << "," << pending << "(was" << wasPending << ")";
qCDebug(KALARM_LOG) << id << "," << pending << "(was" << wasPending << ")";
if (pending)
{
if (wasPending)
......
......@@ -29,7 +29,7 @@
#include <kcolorscheme.h>
#include <QApplication>
#include <qdebug.h>
#include "kalarm_debug.h"
void AlarmListDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const
......
......@@ -27,7 +27,7 @@
#include <kglobal.h>
#include <KLocalizedString>
#include <qapplication.h>