Commit 3e0b359b authored by Laurent Montel's avatar Laurent Montel 😁

Port to qCCritical

parent 8870f278
......@@ -105,7 +105,7 @@ if(KDEPIM_BUILD_DESKTOP)
########### next target ###############
set(korganizerpart_PART_SRCS korganizer_part.cpp)
set(korganizerpart_PART_SRCS korganizer_part.cpp korganizer_debug.cpp)
add_library(korganizerpart MODULE ${korganizerpart_PART_SRCS})
......
......@@ -1370,7 +1370,7 @@ bool ActionManager::handleCommandLine()
bool ret = true;
if (!mainWindow) {
qCritical() << "Unable to find default calendar resources view.";
qCCritical(KORGANIZER_LOG) << "Unable to find default calendar resources view.";
ret = false;
} else if (args->count() <= 0) {
// No filenames given => all other args are meaningless, show main Window
......
......@@ -650,7 +650,7 @@ void CalendarView::slotCreateFinished(int changeId,
updateUnmanagedViews();
checkForFilteredChange(item);
} else if (!errorString.isEmpty()) {
qCritical() << "Incidence not added, job reported error: " << errorString;
qCCritical(KORGANIZER_LOG) << "Incidence not added, job reported error: " << errorString;
}
}
......@@ -661,7 +661,7 @@ void CalendarView::slotModifyFinished(int changeId,
{
Q_UNUSED(changeId);
if (resultCode != Akonadi::IncidenceChanger::ResultCodeSuccess) {
qCritical() << "Incidence not modified, job reported error: " << errorString;
qCCritical(KORGANIZER_LOG) << "Incidence not modified, job reported error: " << errorString;
return;
}
......@@ -693,7 +693,7 @@ void CalendarView::slotModifyFinished(int changeId,
journal->setDescription(description);
if (mChanger->createIncidence(journal, item.parentCollection(), this) == -1) {
qCritical() << "Unable to add Journal";
qCCritical(KORGANIZER_LOG) << "Unable to add Journal";
return;
}
......@@ -728,7 +728,7 @@ void CalendarView::slotDeleteFinished(int changeId,
}
updateUnmanagedViews();
} else {
qCritical() << "Incidence not deleted, job reported error: " << errorString;
qCCritical(KORGANIZER_LOG) << "Incidence not deleted, job reported error: " << errorString;
}
}
......@@ -825,7 +825,7 @@ void CalendarView::edit_cut()
const Akonadi::Item item = selectedIncidence();
KCalCore::Incidence::Ptr incidence = CalendarSupport::incidence(item);
if (!incidence) {
qCritical() << "Null incidence";
qCCritical(KORGANIZER_LOG) << "Null incidence";
return;
}
......@@ -838,14 +838,14 @@ void CalendarView::edit_copy()
if (!item.isValid()) {
KNotification::beep();
qCritical() << "Invalid item";
qCCritical(KORGANIZER_LOG) << "Invalid item";
return;
}
KCalCore::Incidence::Ptr incidence = CalendarSupport::incidence(item);
Q_ASSERT(incidence);
if (!mCalendarClipboard->copyIncidence(incidence, Akonadi::CalendarClipboard::AskMode)) {
qCritical() << "Error copying incidence";
qCCritical(KORGANIZER_LOG) << "Error copying incidence";
}
checkClipboard();
......@@ -1350,7 +1350,7 @@ bool CalendarView::deleteIncidence(Akonadi::Item::Id id, bool force)
{
Akonadi::Item item = mCalendar->item(id);
if (!CalendarSupport::hasIncidence(item)) {
qCritical() << "CalendarView::deleteIncidence(): Item does not contain incidence.";
qCCritical(KORGANIZER_LOG) << "CalendarView::deleteIncidence(): Item does not contain incidence.";
return false;
}
return deleteIncidence(item, force);
......@@ -1360,7 +1360,7 @@ void CalendarView::toggleAlarm(const Akonadi::Item &item)
{
const KCalCore::Incidence::Ptr incidence = CalendarSupport::incidence(item);
if (!incidence) {
qCritical() << "Null incidence";
qCCritical(KORGANIZER_LOG) << "Null incidence";
return;
}
KCalCore::Incidence::Ptr oldincidence(incidence->clone());
......@@ -1404,7 +1404,7 @@ void CalendarView::toggleTodoCompleted(const Akonadi::Item &todoItem)
const KCalCore::Incidence::Ptr incidence = CalendarSupport::incidence(todoItem);
if (!incidence) {
qCritical() << "Null incidence";
qCCritical(KORGANIZER_LOG) << "Null incidence";
return;
}
if (incidence->type() != KCalCore::Incidence::TypeTodo) {
......@@ -1432,7 +1432,7 @@ void CalendarView::copyIncidenceToResource(const Akonadi::Item &item, const Akon
{
#ifdef AKONADI_PORT_DISABLED
if (!incidence) {
qCritical() << "Null incidence";
qCCritical(KORGANIZER_LOG) << "Null incidence";
return;
}
......@@ -1502,7 +1502,7 @@ void CalendarView::moveIncidenceToResource(const Akonadi::Item &item, const Akon
{
#ifdef AKONADI_PORT_DISABLED
if (!incidence) {
qCritical() << "Null incidence";
qCCritical(KORGANIZER_LOG) << "Null incidence";
return;
}
......@@ -1589,7 +1589,7 @@ void CalendarView::dissociateOccurrences(const Akonadi::Item &item, const QDate
const KCalCore::Incidence::Ptr incidence = CalendarSupport::incidence(item);
if (!incidence) {
qCritical() << "Null incidence";
qCCritical(KORGANIZER_LOG) << "Null incidence";
return;
}
......@@ -2295,7 +2295,7 @@ bool CalendarView::editIncidence(const Akonadi::Item &item, bool isCounter)
Q_UNUSED(isCounter);
KCalCore::Incidence::Ptr incidence = CalendarSupport::incidence(item);
if (!incidence) {
qCritical() << "Null incidence";
qCCritical(KORGANIZER_LOG) << "Null incidence";
KNotification::beep();
return false;
}
......@@ -2385,10 +2385,10 @@ bool CalendarView::deleteIncidence(const Akonadi::Item &item, bool force)
KCalCore::Incidence::Ptr incidence = CalendarSupport::incidence(item);
if (!incidence) {
if (!force) {
qCritical() << "Null incidence";
qCCritical(KORGANIZER_LOG) << "Null incidence";
KNotification::beep();
}
qCritical() << "CalendarView::deleteIncidence(): Unable do delete, incidence is null.";
qCCritical(KORGANIZER_LOG) << "CalendarView::deleteIncidence(): Unable do delete, incidence is null.";
return false;
}
......
......@@ -80,7 +80,7 @@ int KOrganizerApp::newInstance()
processCalendar(QUrl());
KOrg::MainWindow *korg = ActionManager::findInstance(QUrl());
if (!korg) {
qCritical() << "Unable to find default calendar resources view.";
qCCritical(KORGANIZER_LOG) << "Unable to find default calendar resources view.";
return -1;
}
// Check for import, merge or ask
......
......@@ -253,7 +253,7 @@ KOrg::Part::List KOCore::loadParts(KOrg::MainWindow *parent)
KOrg::Part *part = loadPart(*it, parent);
if (part) {
if (!parent->mainGuiClient()) {
qCritical() << "parent has no mainGuiClient.";
qCCritical(KORGANIZER_LOG) << "parent has no mainGuiClient.";
} else {
parent->mainGuiClient()->insertChildClient(part);
parts.append(part);
......
......@@ -235,7 +235,7 @@ void KOEventPopupMenu::forward()
if (action) {
action->trigger();
} else {
qCritical() << "What happened to the schedule_forward action?";
qCCritical(KORGANIZER_LOG) << "What happened to the schedule_forward action?";
}
}
......
......@@ -89,11 +89,11 @@ QMenu *KOEventView::newEventPopup()
{
KXMLGUIClient *client = KOCore::self()->xmlguiClient(this);
if (!client) {
qCritical() << "no xmlGuiClient.";
qCCritical(KORGANIZER_LOG) << "no xmlGuiClient.";
return Q_NULLPTR;
}
if (!client->factory()) {
qCritical() << "no factory";
qCCritical(KORGANIZER_LOG) << "no factory";
return Q_NULLPTR; // can happen if called too early
}
......@@ -141,7 +141,7 @@ void KOEventView::showNewEventPopup()
{
QMenu *popup = newEventPopup();
if (!popup) {
qCritical() << "popup creation failed";
qCCritical(KORGANIZER_LOG) << "popup creation failed";
return;
}
......
......@@ -57,7 +57,7 @@ KOrganizerPart::KOrganizerPart(QWidget *parentWidget, QObject *parent, const QVa
} else if (parent && parent->isWidgetType()) {
mTopLevelWidget = (QWidget *)parent;
} else {
qCritical() << "Cannot initialize the part without a top level widget.";
qCCritical(KORGANIZER_LOG) << "Cannot initialize the part without a top level widget.";
}
KOCore::self()->addXMLGUIClient(mTopLevelWidget, this);
......
......@@ -531,7 +531,7 @@ void Composer::removeAttachmentPart(AttachmentPart::Ptr part)
if (d->attachmentParts.contains(part)) {
d->attachmentParts.removeAll(part);
} else {
qCritical() << "Unknown attachment part" << part.get();
qCCritical(MESSAGECOMPOSER_LOG) << "Unknown attachment part" << part.get();
Q_ASSERT(false);
return;
}
......
......@@ -966,7 +966,7 @@ void MessageFactory::applyCharset(const KMime::Message::Ptr msg)
QTextCodec *codec = KCharsets::charsets()->codecForName(QString::fromLatin1(msg->contentType()->charset()));
if (!codec) {
qCritical() << "Could not get text codec for charset" << msg->contentType()->charset();
qCCritical(MESSAGECOMPOSER_LOG) << "Could not get text codec for charset" << msg->contentType()->charset();
} else if (!codec->canEncode(body)) { // charset can't encode body, fall back to preferred
const QStringList charsets = MessageComposer::MessageComposerSettings::preferredCharsets();
......
......@@ -100,7 +100,7 @@ KMime::Content *ContentJobBase::extraContent() const
bool ContentJobBase::addSubjob(KJob *job)
{
Q_UNUSED(job);
qCritical() << "Use appendJob() instead.";
qCCritical(MESSAGECOMPOSER_LOG) << "Use appendJob() instead.";
Q_ASSERT(false);
return false;
}
......
......@@ -52,7 +52,7 @@ GlobalPart *JobBase::globalPart()
}
}
qCritical() << "Job is not part of a Composer.";
qCCritical(MESSAGECOMPOSER_LOG) << "Job is not part of a Composer.";
return Q_NULLPTR;
}
......@@ -157,7 +157,7 @@ bool MainTextJobPrivate::encodeTexts()
Q_Q(MainTextJob);
QTextCodec *codec = KCharsets::charsets()->codecForName(QString::fromLatin1(chosenCharset));
if (!codec) {
qCritical() << "Could not get text codec for charset" << chosenCharset;
qCCritical(MESSAGECOMPOSER_LOG) << "Could not get text codec for charset" << chosenCharset;
q->setError(JobBase::BugError);
q->setErrorText(i18n("Could not get text codec for charset \"%1\".", QString::fromLatin1(chosenCharset)));
return false;
......
......@@ -44,7 +44,7 @@ void KWindowPositioner::reposition()
relativePos = QPoint(mMaster->width() - mSlave->frameGeometry().width(),
mMaster->height());
} else {
qCritical() << "KWindowPositioner: Illegal mode";
qCCritical(MESSAGECOMPOSER_LOG) << "KWindowPositioner: Illegal mode";
}
QPoint pos = mMaster->mapToGlobal(relativePos);
......
......@@ -38,6 +38,7 @@
#include "header/plainheaderstyle.h"
#include "header/entrepriseheaderstyle.h"
#include "header/fancyheaderstyle.h"
#include "messageviewer_debug.h"
#include <KLocalizedString>
......@@ -83,7 +84,7 @@ HeaderStyle *HeaderStyle::create(Type type)
case Custom: return custom();
case Grantlee: return grantlee();
}
qCritical() << "Unknown header style ( type ==" << (int)type << ") requested!";
qCCritical(MESSAGEVIEWER_LOG) << "Unknown header style ( type ==" << (int)type << ") requested!";
return 0; // make compiler happy
}
......
......@@ -364,7 +364,7 @@ void ObjectTreeParser::parseObjectTreeInternal(KMime::Content *node)
const BodyPartFormatter *bpf
= BodyPartFormatter::createFor(mediaType, subType);
if (!bpf) {
qCritical() << "THIS SHOULD NO LONGER HAPPEN:" << mediaType << '/' << subType;
qCCritical(MESSAGEVIEWER_LOG) << "THIS SHOULD NO LONGER HAPPEN:" << mediaType << '/' << subType;
}
writeAttachmentMarkHeader(node);
if (bpf && !bpf->process(this, node, processResult)) {
......
......@@ -1024,10 +1024,10 @@ QString ViewerPrivate::writeMsgHeader(KMime::Message *aMsg, KMime::Content *vCar
bool topLevel)
{
if (!headerStyle()) {
qCritical() << "trying to writeMsgHeader() without a header style set!";
qCCritical(MESSAGEVIEWER_LOG) << "trying to writeMsgHeader() without a header style set!";
}
if (!headerStrategy()) {
qCritical() << "trying to writeMsgHeader() without a header strategy set!";
qCCritical(MESSAGEVIEWER_LOG) << "trying to writeMsgHeader() without a header strategy set!";
}
QString href;
if (vCardNode) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment