Const'ify. Clean forward declaration

wilder-5.14
Laurent Montel 8 years ago
parent ab61d1bb36
commit bfbfeef253
  1. 11
      applets/appmenu/lib/appmenuapplet.cpp
  2. 1
      applets/appmenu/lib/appmenuapplet.h
  3. 4
      applets/appmenu/plugin/appmenumodel.cpp
  4. 1
      applets/digital-clock/plugin/digitalclockplugin.h
  5. 6
      applets/digital-clock/plugin/timezonemodel.cpp

@ -36,8 +36,9 @@
#include <QTimer>
int AppMenuApplet::s_refs = 0;
static const QString s_viewService(QStringLiteral("org.kde.kappmenuview"));
namespace {
QString viewService() { return QStringLiteral("org.kde.kappmenuview"); }
}
AppMenuApplet::AppMenuApplet(QObject *parent, const QVariantList &data)
: Plasma::Applet(parent, data)
@ -45,7 +46,7 @@ AppMenuApplet::AppMenuApplet(QObject *parent, const QVariantList &data)
++s_refs;
//if we're the first, regster the service
if (s_refs == 1) {
QDBusConnection::sessionBus().interface()->registerService(s_viewService,
QDBusConnection::sessionBus().interface()->registerService(viewService(),
QDBusConnectionInterface::QueueService,
QDBusConnectionInterface::DontAllowReplacement);
}
@ -60,12 +61,12 @@ AppMenuApplet::AppMenuApplet(QObject *parent, const QVariantList &data)
if (destroyed) {
//if we were the last, unregister
if (--s_refs == 0) {
QDBusConnection::sessionBus().interface()->unregisterService(s_viewService);
QDBusConnection::sessionBus().interface()->unregisterService(viewService());
}
} else {
//if we're the first, regster the service
if (++s_refs == 1) {
QDBusConnection::sessionBus().interface()->registerService(s_viewService,
QDBusConnection::sessionBus().interface()->registerService(viewService(),
QDBusConnectionInterface::QueueService,
QDBusConnectionInterface::DontAllowReplacement);
}

@ -24,7 +24,6 @@
#include <Plasma/Applet>
#include <QPointer>
class KDBusMenuImporter;
class QQuickItem;
class QMenu;
class AppMenuModel;

@ -221,8 +221,8 @@ void AppMenuModel::onActiveWindowChanged(WId id)
QHash<int, QByteArray> AppMenuModel::roleNames() const
{
QHash<int, QByteArray> roleNames;
roleNames[MenuRole] = "activeMenu";
roleNames[ActionRole] = "activeActions";
roleNames[MenuRole] = QByteArrayLiteral("activeMenu");
roleNames[ActionRole] = QByteArrayLiteral("activeActions");
return roleNames;
}

@ -22,7 +22,6 @@
#include <QQmlExtensionPlugin>
class QQmlEngine;
class DigitalClockPlugin : public QQmlExtensionPlugin
{
Q_OBJECT

@ -132,7 +132,7 @@ void TimeZoneModel::update()
m_data.clear();
QTimeZone localZone = QTimeZone(QTimeZone::systemTimeZoneId());
QStringList data = QString::fromUtf8(localZone.id()).split(QLatin1Char('/'));
const QStringList data = QString::fromUtf8(localZone.id()).split(QLatin1Char('/'));
TimeZoneData local;
local.id = QStringLiteral("Local");
@ -146,7 +146,7 @@ void TimeZoneModel::update()
QStringList cities;
QHash<QString, QTimeZone> zonesByCity;
QList<QByteArray> systemTimeZones = QTimeZone::availableTimeZoneIds();
const QList<QByteArray> systemTimeZones = QTimeZone::availableTimeZoneIds();
for (auto it = systemTimeZones.constBegin(); it != systemTimeZones.constEnd(); ++it) {
const QTimeZone zone(*it);
@ -170,7 +170,7 @@ void TimeZoneModel::update()
comment = i18n(comment.toUtf8());
}
QStringList cityCountryContinent = key.split(QLatin1Char('|'));
const QStringList cityCountryContinent = key.split(QLatin1Char('|'));
TimeZoneData newData;
newData.id = timeZone.id();

Loading…
Cancel
Save