Commit 2be4fc89 authored by David Jarvie's avatar David Jarvie
Browse files

Use QStringLiteral

parent f000b91e
...@@ -58,7 +58,7 @@ QString AlarmTime::alarmTimeText(const DateTime& dateTime) ...@@ -58,7 +58,7 @@ QString AlarmTime::alarmTimeText(const DateTime& dateTime)
if (QApplication::isLeftToRight()) // don't try to align right-to-left languages if (QApplication::isLeftToRight()) // don't try to align right-to-left languages
{ {
QString fmt = locale->timeFormat(); QString fmt = locale->timeFormat();
int i = fmt.indexOf(QRegExp(QLatin1String("%[kl]"))); // check if leading zeroes are omitted int i = fmt.indexOf(QRegExp(QStringLiteral("%[kl]"))); // check if leading zeroes are omitted
if (i >= 0 && i == fmt.indexOf(QLatin1Char('%'))) // and whether the hour is first if (i >= 0 && i == fmt.indexOf(QLatin1Char('%'))) // and whether the hour is first
mTimeHourPos = i; // yes, so need to align mTimeHourPos = i; // yes, so need to align
} }
...@@ -235,12 +235,12 @@ KDateTime AlarmTime::applyTimeZone(const QString& tzstring, const QDate& date, c ...@@ -235,12 +235,12 @@ KDateTime AlarmTime::applyTimeZone(const QString& tzstring, const QDate& date, c
{ {
bool error = false; bool error = false;
KDateTime::Spec spec = KDateTime::LocalZone; KDateTime::Spec spec = KDateTime::LocalZone;
QString zone = tzstring.trimmed(); const QString zone = tzstring.trimmed();
if (!zone.isEmpty()) if (!zone.isEmpty())
{ {
if (zone == QLatin1String("Clock")) if (zone == QStringLiteral("Clock"))
spec = KDateTime::ClockTime; spec = KDateTime::ClockTime;
else if (zone == QLatin1String("UTC")) else if (zone == QStringLiteral("UTC"))
spec = KDateTime::UTC; spec = KDateTime::UTC;
else else
{ {
......
/* /*
* calendarmigrator.cpp - migrates or creates KAlarm Akonadi resources * calendarmigrator.cpp - migrates or creates KAlarm Akonadi resources
* Program: kalarm * Program: kalarm
* Copyright © 2011-2014 by David Jarvie <djarvie@kde.org> * Copyright © 2011-2015 by David Jarvie <djarvie@kde.org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
...@@ -48,6 +48,11 @@ ...@@ -48,6 +48,11 @@
using namespace Akonadi; using namespace Akonadi;
using namespace KAlarmCal; using namespace KAlarmCal;
namespace
{
const QString KALARM_RESOURCE("akonadi_kalarm_resource");
const QString KALARM_DIR_RESOURCE("akonadi_kalarm_dir_resource");
}
// Creates, or migrates from KResources, a single alarm calendar // Creates, or migrates from KResources, a single alarm calendar
class CalendarCreator : public QObject class CalendarCreator : public QObject
...@@ -186,8 +191,7 @@ void CalendarMigrator::migrateOrCreate() ...@@ -186,8 +191,7 @@ void CalendarMigrator::migrateOrCreate()
foreach (const AgentInstance& agent, agents) foreach (const AgentInstance& agent, agents)
{ {
const QString type = agent.type().identifier(); const QString type = agent.type().identifier();
if (type == QLatin1String("akonadi_kalarm_resource") if (type == KALARM_RESOURCE || type == KALARM_DIR_RESOURCE)
|| type == QLatin1String("akonadi_kalarm_dir_resource"))
{ {
// Fetch the resource's collection to determine its alarm types // Fetch the resource's collection to determine its alarm types
CollectionFetchJob* job = new CollectionFetchJob(Collection::root(), CollectionFetchJob::FirstLevel); CollectionFetchJob* job = new CollectionFetchJob(Collection::root(), CollectionFetchJob::FirstLevel);
...@@ -203,7 +207,7 @@ void CalendarMigrator::migrateOrCreate() ...@@ -203,7 +207,7 @@ void CalendarMigrator::migrateOrCreate()
{ {
// There are no Akonadi resources, so migrate any KResources alarm // There are no Akonadi resources, so migrate any KResources alarm
// calendars from pre-Akonadi versions of KAlarm. // calendars from pre-Akonadi versions of KAlarm.
const QString configFile = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + QLatin1String("/kresources/alarms/stdrc"); const QString configFile = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + QStringLiteral("/kresources/alarms/stdrc");
const KConfig config(configFile, KConfig::SimpleConfig); const KConfig config(configFile, KConfig::SimpleConfig);
// Fetch all the KResource identifiers which are actually in use // Fetch all the KResource identifiers which are actually in use
...@@ -215,15 +219,15 @@ void CalendarMigrator::migrateOrCreate() ...@@ -215,15 +219,15 @@ void CalendarMigrator::migrateOrCreate()
CalendarCreator* creator; CalendarCreator* creator;
foreach (const QString& id, keys) foreach (const QString& id, keys)
{ {
const KConfigGroup configGroup = config.group(QLatin1String("Resource_") + id); const KConfigGroup configGroup = config.group(QStringLiteral("Resource_") + id);
const QString resourceType = configGroup.readEntry("ResourceType", QString()); const QString resourceType = configGroup.readEntry("ResourceType", QString());
QString agentType; QString agentType;
if (resourceType == QLatin1String("file")) if (resourceType == QStringLiteral("file"))
agentType = QLatin1String("akonadi_kalarm_resource"); agentType = KALARM_RESOURCE;
else if (resourceType == QLatin1String("dir")) else if (resourceType == QStringLiteral("dir"))
agentType = QLatin1String("akonadi_kalarm_dir_resource"); agentType = KALARM_DIR_RESOURCE;
else if (resourceType == QLatin1String("remote")) else if (resourceType == QStringLiteral("remote"))
agentType = QLatin1String("akonadi_kalarm_resource"); agentType = KALARM_RESOURCE;
else else
continue; // unknown resource type - can't convert continue; // unknown resource type - can't convert
...@@ -291,7 +295,7 @@ void CalendarMigrator::createDefaultResources() ...@@ -291,7 +295,7 @@ void CalendarMigrator::createDefaultResources()
connect(creator, SIGNAL(finished(CalendarCreator*)), SLOT(calendarCreated(CalendarCreator*))); connect(creator, SIGNAL(finished(CalendarCreator*)), SLOT(calendarCreated(CalendarCreator*)));
connect(creator, SIGNAL(creating(QString)), SLOT(creatingCalendar(QString))); connect(creator, SIGNAL(creating(QString)), SLOT(creatingCalendar(QString)));
mCalendarsPending << creator; mCalendarsPending << creator;
creator->createAgent(QLatin1String("akonadi_kalarm_resource"), this); creator->createAgent(KALARM_RESOURCE, this);
} }
if (!(mExistingAlarmTypes & CalEvent::ARCHIVED)) if (!(mExistingAlarmTypes & CalEvent::ARCHIVED))
{ {
...@@ -299,7 +303,7 @@ void CalendarMigrator::createDefaultResources() ...@@ -299,7 +303,7 @@ void CalendarMigrator::createDefaultResources()
connect(creator, SIGNAL(finished(CalendarCreator*)), SLOT(calendarCreated(CalendarCreator*))); connect(creator, SIGNAL(finished(CalendarCreator*)), SLOT(calendarCreated(CalendarCreator*)));
connect(creator, SIGNAL(creating(QString)), SLOT(creatingCalendar(QString))); connect(creator, SIGNAL(creating(QString)), SLOT(creatingCalendar(QString)));
mCalendarsPending << creator; mCalendarsPending << creator;
creator->createAgent(QLatin1String("akonadi_kalarm_resource"), this); creator->createAgent(KALARM_RESOURCE, this);
} }
if (!(mExistingAlarmTypes & CalEvent::TEMPLATE)) if (!(mExistingAlarmTypes & CalEvent::TEMPLATE))
{ {
...@@ -307,7 +311,7 @@ void CalendarMigrator::createDefaultResources() ...@@ -307,7 +311,7 @@ void CalendarMigrator::createDefaultResources()
connect(creator, SIGNAL(finished(CalendarCreator*)), SLOT(calendarCreated(CalendarCreator*))); connect(creator, SIGNAL(finished(CalendarCreator*)), SLOT(calendarCreated(CalendarCreator*)));
connect(creator, SIGNAL(creating(QString)), SLOT(creatingCalendar(QString))); connect(creator, SIGNAL(creating(QString)), SLOT(creatingCalendar(QString)));
mCalendarsPending << creator; mCalendarsPending << creator;
creator->createAgent(QLatin1String("akonadi_kalarm_resource"), this); creator->createAgent(KALARM_RESOURCE, this);
} }
if (mCalendarsPending.isEmpty()) if (mCalendarsPending.isEmpty())
...@@ -380,9 +384,9 @@ void CalendarMigrator::updateToCurrentFormat(const Collection& collection, bool ...@@ -380,9 +384,9 @@ void CalendarMigrator::updateToCurrentFormat(const Collection& collection, bool
const AgentInstance agent = AgentManager::self()->instance(collection.resource()); const AgentInstance agent = AgentManager::self()->instance(collection.resource());
const QString id = agent.type().identifier(); const QString id = agent.type().identifier();
bool dirResource; bool dirResource;
if (id == QLatin1String("akonadi_kalarm_resource")) if (id == KALARM_RESOURCE)
dirResource = false; dirResource = false;
else if (id == QLatin1String("akonadi_kalarm_dir_resource")) else if (id == KALARM_DIR_RESOURCE)
dirResource = true; dirResource = true;
else else
{ {
...@@ -517,8 +521,8 @@ template <class Interface> bool CalendarMigrator::updateStorageFormat(const Agen ...@@ -517,8 +521,8 @@ template <class Interface> bool CalendarMigrator::updateStorageFormat(const Agen
*/ */
template <class Interface> Interface* CalendarMigrator::getAgentInterface(const AgentInstance& agent, QString& errorMessage, QObject* parent) template <class Interface> Interface* CalendarMigrator::getAgentInterface(const AgentInstance& agent, QString& errorMessage, QObject* parent)
{ {
Interface* iface = new Interface(QLatin1String("org.freedesktop.Akonadi.Resource.") + agent.identifier(), Interface* iface = new Interface(QStringLiteral("org.freedesktop.Akonadi.Resource.") + agent.identifier(),
QLatin1String("/Settings"), QDBusConnection::sessionBus(), parent); QStringLiteral("/Settings"), QDBusConnection::sessionBus(), parent);
if (!iface->isValid()) if (!iface->isValid())
{ {
errorMessage = iface->lastError().message(); errorMessage = iface->lastError().message();
...@@ -540,17 +544,17 @@ CalendarCreator::CalendarCreator(const QString& resourceType, const KConfigGroup ...@@ -540,17 +544,17 @@ CalendarCreator::CalendarCreator(const QString& resourceType, const KConfigGroup
{ {
// Read the resource configuration parameters from the config // Read the resource configuration parameters from the config
const char* pathKey = Q_NULLPTR; const char* pathKey = Q_NULLPTR;
if (resourceType == QLatin1String("file")) if (resourceType == QStringLiteral("file"))
{ {
mResourceType = LocalFile; mResourceType = LocalFile;
pathKey = "CalendarURL"; pathKey = "CalendarURL";
} }
else if (resourceType == QLatin1String("dir")) else if (resourceType == QStringLiteral("dir"))
{ {
mResourceType = LocalDir; mResourceType = LocalDir;
pathKey = "CalendarURL"; pathKey = "CalendarURL";
} }
else if (resourceType == QLatin1String("remote")) else if (resourceType == QStringLiteral("remote"))
{ {
mResourceType = RemoteFile; mResourceType = RemoteFile;
pathKey = "DownloadUrl"; pathKey = "DownloadUrl";
...@@ -774,7 +778,7 @@ void CalendarCreator::collectionFetchResult(KJob* j) ...@@ -774,7 +778,7 @@ void CalendarCreator::collectionFetchResult(KJob* j)
mCollectionId = collection.id(); mCollectionId = collection.id();
collection.setContentMimeTypes(CalEvent::mimeTypes(mAlarmType)); collection.setContentMimeTypes(CalEvent::mimeTypes(mAlarmType));
EntityDisplayAttribute* dattr = collection.attribute<EntityDisplayAttribute>(Collection::AddIfMissing); EntityDisplayAttribute* dattr = collection.attribute<EntityDisplayAttribute>(Collection::AddIfMissing);
dattr->setIconName(QLatin1String("kalarm")); dattr->setIconName(QStringLiteral("kalarm"));
CollectionAttribute* attr = collection.attribute<CollectionAttribute>(Entity::AddIfMissing); CollectionAttribute* attr = collection.attribute<CollectionAttribute>(Entity::AddIfMissing);
attr->setEnabled(mEnabled ? mAlarmType : CalEvent::EMPTY); attr->setEnabled(mEnabled ? mAlarmType : CalEvent::EMPTY);
if (mStandard) if (mStandard)
......
...@@ -605,7 +605,7 @@ bool CollectionView::viewportEvent(QEvent* e) ...@@ -605,7 +605,7 @@ bool CollectionView::viewportEvent(QEvent* e)
int i = toolTip.indexOf(QLatin1Char('@')); int i = toolTip.indexOf(QLatin1Char('@'));
if (i > 0) if (i > 0)
{ {
int j = toolTip.indexOf(QRegExp(QLatin1String("<(nl|br)"), Qt::CaseInsensitive), i + 1); int j = toolTip.indexOf(QRegExp(QStringLiteral("<(nl|br)"), Qt::CaseInsensitive), i + 1);
int k = toolTip.indexOf(QLatin1Char('@'), j); int k = toolTip.indexOf(QLatin1Char('@'), j);
const QString name = toolTip.mid(i + 1, j - i - 1); const QString name = toolTip.mid(i + 1, j - i - 1);
value = model()->data(index, Qt::FontRole); value = model()->data(index, Qt::FontRole);
...@@ -954,7 +954,7 @@ QString CollectionControlModel::typeListForDisplay(CalEvent::Types alarmTypes) ...@@ -954,7 +954,7 @@ QString CollectionControlModel::typeListForDisplay(CalEvent::Types alarmTypes)
if (alarmTypes & CalEvent::TEMPLATE) if (alarmTypes & CalEvent::TEMPLATE)
list += QLatin1String("<item>") + i18nc("@info", "Alarm Templates") + QLatin1String("</item>"); list += QLatin1String("<item>") + i18nc("@info", "Alarm Templates") + QLatin1String("</item>");
if (!list.isEmpty()) if (!list.isEmpty())
list = QLatin1String("<list>") + list + QLatin1String("</list>"); list = QStringLiteral("<list>") + list + QStringLiteral("</list>");
return list; return list;
} }
......
...@@ -41,7 +41,10 @@ using namespace KCalCore; ...@@ -41,7 +41,10 @@ using namespace KCalCore;
#include <stdlib.h> #include <stdlib.h>
static const char* REQUEST_DBUS_OBJECT = "/kalarm"; // D-Bus object path of KAlarm's request interface namespace
{
const QString REQUEST_DBUS_OBJECT("/kalarm"); // D-Bus object path of KAlarm's request interface
}
/*============================================================================= /*=============================================================================
...@@ -52,7 +55,7 @@ DBusHandler::DBusHandler() ...@@ -52,7 +55,7 @@ DBusHandler::DBusHandler()
{ {
qCDebug(KALARM_LOG); qCDebug(KALARM_LOG);
new KalarmAdaptor(this); new KalarmAdaptor(this);
QDBusConnection::sessionBus().registerObject(QLatin1String(REQUEST_DBUS_OBJECT), this); QDBusConnection::sessionBus().registerObject(REQUEST_DBUS_OBJECT, this);
} }
......
...@@ -1181,7 +1181,7 @@ void EditEmailAlarmDlg::type_initValues(const KAEvent* event) ...@@ -1181,7 +1181,7 @@ void EditEmailAlarmDlg::type_initValues(const KAEvent* event)
{ {
// Set the values to those for the specified event // Set the values to those for the specified event
mEmailAttachList->addItems(event->emailAttachments()); mEmailAttachList->addItems(event->emailAttachments());
mEmailToEdit->setText(event->emailAddresses(QLatin1String(", "))); mEmailToEdit->setText(event->emailAddresses(QStringLiteral(", ")));
mEmailSubjectEdit->setText(event->emailSubject()); mEmailSubjectEdit->setText(event->emailSubject());
mEmailBcc->setChecked(event->emailBcc()); mEmailBcc->setChecked(event->emailBcc());
if (mEmailFromList) if (mEmailFromList)
......
...@@ -1394,7 +1394,7 @@ QString runKMail(bool minimise) ...@@ -1394,7 +1394,7 @@ QString runKMail(bool minimise)
QString errmsg; QString errmsg;
if (minimise && Private::startKMailMinimised()) if (minimise && Private::startKMailMinimised())
return QString(); return QString();
if (KToolInvocation::startServiceByDesktopName(QLatin1String("kmail"), QString(), &errmsg)) if (KToolInvocation::startServiceByDesktopName(QStringLiteral("kmail"), QString(), &errmsg))
{ {
qCCritical(KALARM_LOG) << "Couldn't start KMail (" << errmsg << ")"; qCCritical(KALARM_LOG) << "Couldn't start KMail (" << errmsg << ")";
return xi18nc("@info", "Unable to start <application>KMail</application><nl/>(<message>%1</message>)", errmsg); return xi18nc("@info", "Unable to start <application>KMail</application><nl/>(<message>%1</message>)", errmsg);
...@@ -1606,11 +1606,11 @@ void writeConfigWindowSize(const char* window, const QSize& size, int splitterWi ...@@ -1606,11 +1606,11 @@ void writeConfigWindowSize(const char* window, const QSize& size, int splitterWi
*/ */
FileType fileType(const KMimeType::Ptr& mimetype) FileType fileType(const KMimeType::Ptr& mimetype)
{ {
if (mimetype->is(QLatin1String("text/html"))) if (mimetype->is(QStringLiteral("text/html")))
return TextFormatted; return TextFormatted;
if (mimetype->is(QLatin1String("application/x-executable"))) if (mimetype->is(QStringLiteral("application/x-executable")))
return TextApplication; return TextApplication;
if (mimetype->is(QLatin1String("text/plain"))) if (mimetype->is(QStringLiteral("text/plain")))
return TextPlain; return TextPlain;
if (mimetype->name().startsWith(QStringLiteral("image/"))) if (mimetype->name().startsWith(QStringLiteral("image/")))
return Image; return Image;
...@@ -1627,7 +1627,7 @@ FileErr checkFileExists(QString& filename, KUrl& url) ...@@ -1627,7 +1627,7 @@ FileErr checkFileExists(QString& filename, KUrl& url)
url = KUrl(); url = KUrl();
FileErr err = FileErr_None; FileErr err = FileErr_None;
QString file = filename; QString file = filename;
QRegExp f(QLatin1String("^file:/+")); QRegExp f(QStringLiteral("^file:/+"));
if (f.indexIn(file) >= 0) if (f.indexIn(file) >= 0)
file = file.mid(f.matchedLength() - 1); file = file.mid(f.matchedLength() - 1);
// Convert any relative file path to absolute // Convert any relative file path to absolute
...@@ -1675,7 +1675,7 @@ bool showFileErrMessage(const QString& filename, FileErr err, FileErr blankError ...@@ -1675,7 +1675,7 @@ bool showFileErrMessage(const QString& filename, FileErr err, FileErr blankError
{ {
// If file is a local file, remove "file://" from name // If file is a local file, remove "file://" from name
QString file = filename; QString file = filename;
QRegExp f(QLatin1String("^file:/+")); QRegExp f(QStringLiteral("^file:/+"));
if (f.indexIn(file) >= 0) if (f.indexIn(file) >= 0)
file = file.mid(f.matchedLength() - 1); file = file.mid(f.matchedLength() - 1);
...@@ -1712,7 +1712,7 @@ bool showFileErrMessage(const QString& filename, FileErr err, FileErr blankError ...@@ -1712,7 +1712,7 @@ bool showFileErrMessage(const QString& filename, FileErr err, FileErr blankError
*/ */
QString pathOrUrl(const QString& url) QString pathOrUrl(const QString& url)
{ {
static const QRegExp localfile(QLatin1String("^file:/+")); static const QRegExp localfile(QStringLiteral("^file:/+"));
return (localfile.indexIn(url) >= 0) ? url.mid(localfile.matchedLength() - 1) : url; return (localfile.indexIn(url) >= 0) ? url.mid(localfile.matchedLength() - 1) : url;
} }
...@@ -1732,7 +1732,7 @@ QString pathOrUrl(const QString& url) ...@@ -1732,7 +1732,7 @@ QString pathOrUrl(const QString& url)
QString browseFile(const QString& caption, QString& defaultDir, const QString& initialFile, QString browseFile(const QString& caption, QString& defaultDir, const QString& initialFile,
const QString& filter, KFile::Modes mode, QWidget* parent) const QString& filter, KFile::Modes mode, QWidget* parent)
{ {
QString initialDir = !initialFile.isEmpty() ? QString(initialFile).remove(QRegExp(QLatin1String("/[^/]*$"))) QString initialDir = !initialFile.isEmpty() ? QString(initialFile).remove(QRegExp(QStringLiteral("/[^/]*$")))
: !defaultDir.isEmpty() ? defaultDir : !defaultDir.isEmpty() ? defaultDir
: QDir::homePath(); : QDir::homePath();
// Use AutoQPointer to guard against crash on application exit while // Use AutoQPointer to guard against crash on application exit while
...@@ -1745,7 +1745,7 @@ QString browseFile(const QString& caption, QString& defaultDir, const QString& i ...@@ -1745,7 +1745,7 @@ QString browseFile(const QString& caption, QString& defaultDir, const QString& i
if (!initialFile.isEmpty()) if (!initialFile.isEmpty())
fileDlg->setSelection(initialFile); fileDlg->setSelection(initialFile);
if (fileDlg->exec() != QDialog::Accepted) if (fileDlg->exec() != QDialog::Accepted)
return fileDlg ? QLatin1String("") : QString(); // return null only if dialog was deleted return fileDlg ? QStringLiteral("") : QString(); // return null only if dialog was deleted
KUrl url = fileDlg->selectedUrl(); KUrl url = fileDlg->selectedUrl();
if (url.isEmpty()) if (url.isEmpty())
return QStringLiteral(""); // return empty, non-null string return QStringLiteral(""); // return empty, non-null string
...@@ -1799,7 +1799,7 @@ void setTestModeConditions() ...@@ -1799,7 +1799,7 @@ void setTestModeConditions()
void setSimulatedSystemTime(const KDateTime& dt) void setSimulatedSystemTime(const KDateTime& dt)
{ {
KDateTime::setSimulatedSystemTime(dt); KDateTime::setSimulatedSystemTime(dt);
qCDebug(KALARM_LOG) << "New time =" << qPrintable(KDateTime::currentLocalDateTime().toString(QLatin1String("%Y-%m-%d %H:%M %:Z"))); qCDebug(KALARM_LOG) << "New time =" << qPrintable(KDateTime::currentLocalDateTime().toString(QStringLiteral("%Y-%m-%d %H:%M %:Z")));
} }
#endif #endif
...@@ -1869,7 +1869,7 @@ KAlarm::UpdateResult sendToKOrganizer(const KAEvent& event) ...@@ -1869,7 +1869,7 @@ KAlarm::UpdateResult sendToKOrganizer(const KAEvent& event)
? Identities::identityManager()->identityForUoid(event.emailFromId()).fullEmailAddr() ? Identities::identityManager()->identityForUoid(event.emailFromId()).fullEmailAddr()
: Preferences::emailAddress(); : Preferences::emailAddress();
AlarmText atext; AlarmText atext;
atext.setEmail(event.emailAddresses(QLatin1String(", ")), from, QString(), QString(), event.emailSubject(), QString()); atext.setEmail(event.emailAddresses(QStringLiteral(", ")), from, QString(), QString(), event.emailSubject(), QString());
kcalEvent->setSummary(atext.displayText()); kcalEvent->setSummary(atext.displayText());
userEmail = from; userEmail = from;
break; break;
...@@ -1937,7 +1937,7 @@ KAlarm::UpdateResult runKOrganizer() ...@@ -1937,7 +1937,7 @@ KAlarm::UpdateResult runKOrganizer()
{ {
KAlarm::UpdateResult status; KAlarm::UpdateResult status;
QString error, dbusService; QString error, dbusService;
int result = KDBusServiceStarter::self()->findServiceFor(QLatin1String("DBUS/Organizer"), QString(), &error, &dbusService); int result = KDBusServiceStarter::self()->findServiceFor(QStringLiteral("DBUS/Organizer"), QString(), &error, &dbusService);
if (result) if (result)
{ {
status.set(KAlarm::UPDATE_KORG_ERRINIT, error); status.set(KAlarm::UPDATE_KORG_ERRINIT, error);
...@@ -1947,14 +1947,14 @@ KAlarm::UpdateResult runKOrganizer() ...@@ -1947,14 +1947,14 @@ KAlarm::UpdateResult runKOrganizer()
// If Kontact is running, there is a load() method which needs to be called to // If Kontact is running, there is a load() method which needs to be called to
// load KOrganizer into Kontact. But if KOrganizer is running independently, // load KOrganizer into Kontact. But if KOrganizer is running independently,
// the load() method doesn't exist. // the load() method doesn't exist.
QDBusInterface iface(KORG_DBUS_SERVICE, QLatin1String(KORG_DBUS_LOAD_PATH), QStringLiteral("org.kde.PIMUniqueApplication")); QDBusInterface iface(KORG_DBUS_SERVICE, QStringLiteral(KORG_DBUS_LOAD_PATH), QStringLiteral("org.kde.PIMUniqueApplication"));
if (!iface.isValid()) if (!iface.isValid())
{ {
status.set(KAlarm::UPDATE_KORG_ERR, iface.lastError().message()); status.set(KAlarm::UPDATE_KORG_ERR, iface.lastError().message());
qCWarning(KALARM_LOG) << "Unable to access " KORG_DBUS_LOAD_PATH " D-Bus interface:" << status.message; qCWarning(KALARM_LOG) << "Unable to access " KORG_DBUS_LOAD_PATH " D-Bus interface:" << status.message;
return status; return status;
} }
QDBusReply<bool> reply = iface.call(QLatin1String("load")); QDBusReply<bool> reply = iface.call(QStringLiteral("load"));
if ((!reply.isValid() || !reply.value()) if ((!reply.isValid() || !reply.value())
&& iface.lastError().type() != QDBusError::UnknownMethod) && iface.lastError().type() != QDBusError::UnknownMethod)
{ {
...@@ -1968,7 +1968,7 @@ KAlarm::UpdateResult runKOrganizer() ...@@ -1968,7 +1968,7 @@ KAlarm::UpdateResult runKOrganizer()
if (!korgInterface || !korgInterface->isValid()) if (!korgInterface || !korgInterface->isValid())
{ {
delete korgInterface; delete korgInterface;
korgInterface = new QDBusInterface(KORG_DBUS_SERVICE, QLatin1String(KORG_DBUS_PATH), KORG_DBUS_IFACE); korgInterface = new QDBusInterface(KORG_DBUS_SERVICE, QStringLiteral(KORG_DBUS_PATH), KORG_DBUS_IFACE);
if (!korgInterface->isValid()) if (!korgInterface->isValid())
{ {
status.set(KAlarm::UPDATE_KORG_ERRSTART, korgInterface->lastError().message()); status.set(KAlarm::UPDATE_KORG_ERRSTART, korgInterface->lastError().message());
......
...@@ -165,7 +165,7 @@ KAlarmApp::KAlarmApp() ...@@ -165,7 +165,7 @@ KAlarmApp::KAlarmApp()
} }
// Check if the speech synthesis daemon is installed // Check if the speech synthesis daemon is installed
mSpeechEnabled = (KServiceTypeTrader::self()->query(QLatin1String("DBUS/Text-to-Speech"), QStringLiteral("Name == 'KTTSD'")).count() > 0); mSpeechEnabled = (KServiceTypeTrader::self()->query(QStringLiteral("DBUS/Text-to-Speech"), QStringLiteral("Name == 'KTTSD'")).count() > 0);
if (!mSpeechEnabled) { qCDebug(KALARM_LOG) << "Speech synthesis disabled (KTTSD not found)"; } if (!mSpeechEnabled) { qCDebug(KALARM_LOG) << "Speech synthesis disabled (KTTSD not found)"; }
// Check if KOrganizer is installed // Check if KOrganizer is installed
const QString korg = QLatin1String("korganizer"); const QString korg = QLatin1String("korganizer");
...@@ -269,8 +269,8 @@ bool KAlarmApp::restoreSession() ...@@ -269,8 +269,8 @@ bool KAlarmApp::restoreSession()
MainWindow* trayParent = Q_NULLPTR; MainWindow* trayParent = Q_NULLPTR;
for (int i = 1; KMainWindow::canBeRestored(i); ++i) for (int i = 1; KMainWindow::canBeRestored(i); ++i)
{ {
QString type = KMainWindow::classNameOfToplevel(i); const QString type = KMainWindow::classNameOfToplevel(i);
if (type == QLatin1String("MainWindow")) if (type == QStringLiteral("MainWindow"))
{ {
MainWindow* win = MainWindow::create(true); MainWindow* win = MainWindow::create(true);
win->restore(i, false); win->restore(i, false);
...@@ -279,7 +279,7 @@ bool KAlarmApp::restoreSession() ...@@ -279,7 +279,7 @@ bool KAlarmApp::restoreSession()
else else
win->show(); win->show();
} }
else if (type == QLatin1String("MessageWin")) else if (type == QStringLiteral("MessageWin"))
{ {
MessageWin* win = new MessageWin; MessageWin* win = new MessageWin;
win->restore(i, false); win->restore(i, false);
...@@ -763,7 +763,7 @@ void KAlarmApp::checkNextDueAlarm() ...@@ -763,7 +763,7 @@ void KAlarmApp::checkNextDueAlarm()
KDateTime nextDt = nextEvent->nextTrigger(KAEvent::ALL_TRIGGER).effectiveKDateTime(); KDateTime nextDt = nextEvent->nextTrigger(KAEvent::ALL_TRIGGER).effectiveKDateTime();
KDateTime now = KDateTime::currentDateTime(Preferences::timeZone()); KDateTime now = KDateTime::currentDateTime(Preferences::timeZone());
qint64 interval = now.secsTo_long(nextDt); qint64 interval = now.secsTo_long(nextDt);
qCDebug(KALARM_LOG) << "now:" << qPrintable(now.toString(QLatin1String("%Y-%m-%d %H:%M %:Z"))) << ", next:" << qPrintable(nextDt.toString(QLatin1String("%Y-%m-%d %H:%M %:Z"))) << ", due:" << interval; qCDebug(KALARM_LOG) << "now:" << qPrintable(now.toString(QStringLiteral("%Y-%m-%d %H:%M %:Z"))) << ", next:" << qPrintable(nextDt.toString(QStringLiteral("%Y-%m-%d %H:%M %:Z"))) << ", due:" << interval;
if (interval <= 0) if (interval <= 0)
{ {
// Queue the alarm // Queue the alarm
...@@ -1231,7 +1231,7 @@ QStringList KAlarmApp::scheduledAlarmList() ...@@ -1231,7 +1231,7 @@ QStringList KAlarmApp::scheduledAlarmList()
AkonadiModel::instance()->refresh(c); AkonadiModel::instance()->refresh(c);
QString text(c.resource() + QLatin1String(":")); QString text(c.resource() + QLatin1String(":"));
text += event->id() + QLatin1Char(' ') text += event->id() + QLatin1Char(' ')
+ dateTime.toString(QLatin1String("%Y%m%dT%H%M ")) + dateTime.toString(QStringLiteral("%Y%m%dT%H%M "))
+ AlarmText::summary(*event, 1); + AlarmText::summary(*event, 1);
alarms << text; alarms << text;
} }
...@@ -1351,7 +1351,7 @@ bool KAlarmApp::dbusHandleEvent(const EventId& eventID, EventFunc function) ...@@ -1351,7 +1351,7 @@ bool KAlarmApp::dbusHandleEvent(const EventId& eventID, EventFunc function)
QString KAlarmApp::dbusList() QString KAlarmApp::dbusList()
{ {
qCDebug(KALARM_LOG); qCDebug(KALARM_LOG);
return scheduledAlarmList().join(QLatin1String("\n")) + QLatin1Char('\n'); return scheduledAlarmList().join(QStringLiteral("\n")) + QLatin1Char('\n');
} }
/****************************************************************************** /******************************************************************************
...@@ -1390,7 +1390,7 @@ bool KAlarmApp::handleEvent(const EventId& id, EventFunc function, bool checkDup ...@@ -1390,7 +1390,7 @@ bool KAlarmApp::handleEvent(const EventId& id, EventFunc function, bool checkDup
case EVENT_HANDLE: // handle it if it's due case EVENT_HANDLE: // handle it if it's due
{ {
KDateTime now = KDateTime::currentUtcDateTime(); KDateTime now = KDateTime::currentUtcDateTime();
qCDebug(KALARM_LOG) << eventID << "," << (function==EVENT_TRIGGER?"TRIGGER:":"HANDLE:") << qPrintable(now.dateTime().toString(QLatin1String("yyyy-MM-dd hh:mm"))) << "UTC"; qCDebug(KALARM_LOG) << eventID << "," << (function==EVENT_TRIGGER?"TRIGGER:":"HANDLE:") << qPrintable(now.dateTime().toString(QStringLiteral("yyyy-MM-dd hh:mm"))) << "UTC";
bool updateCalAndDisplay = false; bool updateCalAndDisplay = false;
bool alarmToExecuteValid = false; bool alarmToExecuteValid = false;
KAAlarm alarmToExecute; KAAlarm alarmToExecute;
...@@ -1877,7 +1877,7 @@ void* KAlarmApp::execAlarm(KAEvent& event, const KAAlarm& alarm, bool reschedule ...@@ -1877,7 +1877,7 @@ void* KAlarmApp::execAlarm(KAEvent& event, const KAAlarm& alarm, bool reschedule
} }
case KAAlarm::EMAIL: case KAAlarm::EMAIL:
{ {
qCDebug(KALARM_LOG) << "EMAIL to:" << event.emailAddresses(QLatin1String(",")); qCDebug(KALARM_LOG) << "EMAIL to:" << event.emailAddresses(QStringLiteral(","));
QStringList errmsgs; QStringList errmsgs;
KAMail::JobData data(event, alarm, reschedule, (reschedule || allowDefer)); KAMail::JobData data(event, alarm, reschedule, (reschedule || allowDefer));
data.queued = true; data.queued = true;
...@@ -2006,7 +2006,7 @@ ShellProcess* KAlarmApp::doShellCommand(const QString& command, const KAEvent& e ...@@ -2006,7 +2006,7 @@ ShellProcess* KAlarmApp::doShellCommand(const QString& command, const KAEvent& e