Commit 77946ab8 authored by Laurent Montel's avatar Laurent Montel 😁

Use QStringLiteral + use new connect api

parent 1fc0d5cb
......@@ -140,7 +140,7 @@ public:
void ApplicationModelPrivate::fillNode(const QString &_relPath, AppNode *node)
{
if (_relPath=="new/") {
if (_relPath==QLatin1String("new/")) {
Q_FOREACH (const QString &it, newInstalledPrograms) {
KService::Ptr p = KService::serviceByStorageId(it);
......@@ -153,7 +153,7 @@ void ApplicationModelPrivate::fillNode(const QString &_relPath, AppNode *node)
continue;
}
AppNode *newnode = new AppNode();
newnode->icon = QIcon::fromTheme(p->icon(), QIcon::fromTheme("unknown"));
newnode->icon = QIcon::fromTheme(p->icon(), QIcon::fromTheme(QStringLiteral("unknown")));
newnode->appName = p->name();
newnode->genericName = p->genericName();
newnode->desktopEntry = p->entryPath();
......@@ -272,7 +272,7 @@ void ApplicationModelPrivate::fillNode(const QString &_relPath, AppNode *node)
AppNode *newnode = new AppNode();
newnode->iconName = icon;
newnode->icon = QIcon::fromTheme(icon, QIcon::fromTheme("unknown"));
newnode->icon = QIcon::fromTheme(icon, QIcon::fromTheme(QStringLiteral("unknown")));
newnode->appName = appName;
newnode->genericName = genericName;
newnode->relPath = relPath;
......@@ -292,9 +292,9 @@ void ApplicationModelPrivate::fillNode(const QString &_relPath, AppNode *node)
if (showRecentlyInstalled && _relPath.isEmpty() && !newInstalledPrograms.isEmpty()) {
AppNode *newnode = new AppNode();
newnode->icon = QIcon::fromTheme("chronometer");
newnode->icon = QIcon::fromTheme(QStringLiteral("chronometer"));
newnode->appName = i18n("Recently Installed");
newnode->relPath = "new/";
newnode->relPath = QStringLiteral("new/");
newnode->isDir = true;
newnode->parent = node;
node->children.prepend(newnode);
......@@ -325,8 +325,8 @@ ApplicationModel::ApplicationModel(QObject *parent, bool allowSeparators)
setRoleNames(roles);
QDBusConnection dbus = QDBusConnection::sessionBus();
(void)new KickoffAdaptor(this);
QDBusConnection::sessionBus().registerObject("/kickoff", this);
dbus.connect(QString(), "/kickoff", "org.kde.plasma", "reloadMenu", this, SLOT(reloadMenu()));
QDBusConnection::sessionBus().registerObject(QStringLiteral("/kickoff"), this);
dbus.connect(QString(), QStringLiteral("/kickoff"), QStringLiteral("org.kde.plasma"), QStringLiteral("reloadMenu"), this, SLOT(reloadMenu()));
connect(KSycoca::self(), SIGNAL(databaseChanged(QStringList)), this, SLOT(checkSycocaChange(QStringList)));
// TODO: remove me again
......@@ -414,7 +414,7 @@ QVariant ApplicationModel::data(const QModelIndex &index, int role) const
}
case Kickoff::UrlRole:
if (node->isDir) {
return QString::fromLatin1("applications://%1").arg(node->desktopEntry);
return QStringLiteral("applications://%1").arg(node->desktopEntry);
} else {
return node->desktopEntry;
}
......@@ -561,7 +561,7 @@ void ApplicationModel::reloadMenu()
void ApplicationModel::checkSycocaChange(const QStringList &changes)
{
if (changes.contains("services") || changes.contains("apps")) {
if (changes.contains(QStringLiteral("services")) || changes.contains(QStringLiteral("apps"))) {
reloadMenu();
}
}
......@@ -645,7 +645,7 @@ bool ApplicationModel::createNewProgramListForPath(const QString &relPath)
} else if (e->isType(KST_KService)) {
KService::Ptr s(KService::Ptr(static_cast<KService*>(e.data())));
if (s->isApplication() && !s->noDisplay()) {
QString shortStorageId = s->storageId().remove(".desktop");
QString shortStorageId = s->storageId().remove(QStringLiteral(".desktop"));
QHash<QString, QDate>::Iterator it_find = d->seenPrograms.find(shortStorageId);
if (it_find == d->seenPrograms.end()) {
seenProgramsChanged = true;
......@@ -695,17 +695,17 @@ QHash<QString, QString> ApplicationModelPrivate::iconNameMap()
{
static QHash<QString, QString> map;
if (map.isEmpty()) {
map.insert("gnome-util", "applications-accessories");
map.insert(QStringLiteral("gnome-util"), QStringLiteral("applications-accessories"));
// accessibility Oxygen icon was missing when this list was compiled
map.insert("accessibility-directory", "applications-other");
map.insert("gnome-devel", "applications-development");
map.insert("package_edutainment", "applications-education");
map.insert("gnome-joystick", "applications-games");
map.insert("gnome-graphics", "applications-graphics");
map.insert("gnome-globe", "applications-internet");
map.insert("gnome-multimedia", "applications-multimedia");
map.insert("gnome-applications", "applications-office");
map.insert("gnome-system", "applications-system");
map.insert(QStringLiteral("accessibility-directory"), QStringLiteral("applications-other"));
map.insert(QStringLiteral("gnome-devel"), QStringLiteral("applications-development"));
map.insert(QStringLiteral("package_edutainment"), QStringLiteral("applications-education"));
map.insert(QStringLiteral("gnome-joystick"), QStringLiteral("applications-games"));
map.insert(QStringLiteral("gnome-graphics"), QStringLiteral("applications-graphics"));
map.insert(QStringLiteral("gnome-globe"), QStringLiteral("applications-internet"));
map.insert(QStringLiteral("gnome-multimedia"), QStringLiteral("applications-multimedia"));
map.insert(QStringLiteral("gnome-applications"), QStringLiteral("applications-office"));
map.insert(QStringLiteral("gnome-system"), QStringLiteral("applications-system"));
}
return map;
}
......
......@@ -47,8 +47,8 @@ public:
: q(parent),
displayOrder(NameAfterDescription)
{
Kdelibs4ConfigMigrator migrator("plasma");//app name is unused for what we want, but we get a warning otherwise
migrator.setConfigFiles(QStringList("kickoffrc"));
Kdelibs4ConfigMigrator migrator(QStringLiteral("plasma"));//app name is unused for what we want, but we get a warning otherwise
migrator.setConfigFiles(QStringList(QStringLiteral("kickoffrc")));
migrator.migrate();
init();
......@@ -119,7 +119,7 @@ public:
QString browser = config.readPathEntry("BrowserApplication", QString());
if (browser.isEmpty()) {
const KService::Ptr htmlApp = KMimeTypeTrader::self()->preferredService(QLatin1String("text/html"));
const KService::Ptr htmlApp = KMimeTypeTrader::self()->preferredService(QStringLiteral("text/html"));
if (htmlApp) {
browser = htmlApp->storageId().replace(QLatin1String(".desktop"), QString());
......@@ -134,12 +134,12 @@ public:
// whether it uses the current or a previous name).
// BUG: 351550
applications << browser
<< "org.kde.kontact" << "kontact"
<< "org.kde.systemsettings" << "systemsettings"
<< "org.kde.dolphin" << "dolphin"
<< "org.kde.ktpcontactlist" << "ktp-contactlist"
<< "org.kde.kate" << "kate"
<< "org.kde.discover" << "muon-discover" << "discover";
<< QStringLiteral("org.kde.kontact") << QStringLiteral("kontact")
<< QStringLiteral("org.kde.systemsettings") << QStringLiteral("systemsettings")
<< QStringLiteral("org.kde.dolphin") << QStringLiteral("dolphin")
<< QStringLiteral("org.kde.ktpcontactlist") << QStringLiteral("ktp-contactlist")
<< QStringLiteral("org.kde.kate") << QStringLiteral("kate")
<< QStringLiteral("org.kde.discover") << QStringLiteral("muon-discover") << QStringLiteral("discover");
QList<QString> desktopFiles;
......
......@@ -73,46 +73,46 @@ bool LeaveItemHandler::openUrl(const KUrl& url)
{
m_logoutAction = url.path().remove('/');
if (m_logoutAction == "sleep") {
if (m_logoutAction == QLatin1String("sleep")) {
// decouple dbus call, otherwise we'll run into a dead-lock
QTimer::singleShot(0, this, SLOT(suspendRAM()));
QTimer::singleShot(0, this, &LeaveItemHandler::suspendRAM);
return true;
} else if (m_logoutAction == "hibernate") {
} else if (m_logoutAction == QLatin1String("hibernate")) {
// decouple dbus call, otherwise we'll run into a dead-lock
QTimer::singleShot(0, this, SLOT(suspendDisk()));
QTimer::singleShot(0, this, &LeaveItemHandler::suspendDisk);
return true;
} else if (m_logoutAction == "lock") {
} else if (m_logoutAction == QLatin1String("lock")) {
// decouple dbus call, otherwise we'll run into a dead-lock
QTimer::singleShot(0, this, SLOT(lock()));
QTimer::singleShot(0, this, &LeaveItemHandler::lock);
return true;
} else if (m_logoutAction == "switch") {
} else if (m_logoutAction == QLatin1String("switch")) {
// decouple dbus call, otherwise we'll run into a dead-lock
QTimer::singleShot(0, this, SLOT(switchUser()));
QTimer::singleShot(0, this, &LeaveItemHandler::switchUser);
return true;
} else if (m_logoutAction == "logout" || m_logoutAction == "logoutonly" ||
m_logoutAction == "restart" || m_logoutAction == "shutdown") {
} else if (m_logoutAction == QLatin1String("logout") || m_logoutAction == QLatin1String("logoutonly") ||
m_logoutAction == QLatin1String("restart") || m_logoutAction == QLatin1String("shutdown")) {
// decouple dbus call, otherwise we'll run into a dead-lock
QTimer::singleShot(0, this, SLOT(logout()));
QTimer::singleShot(0, this, &LeaveItemHandler::logout);
return true;
} else if (m_logoutAction == "savesession") {
} else if (m_logoutAction == QLatin1String("savesession")) {
// decouple dbus call, otherwise we'll run into a dead-lock
QTimer::singleShot(0, this, SLOT(saveSession()));
QTimer::singleShot(0, this, &LeaveItemHandler::saveSession);
return true;
} else if (m_logoutAction == "standby") {
} else if (m_logoutAction == QLatin1String("standby")) {
// decouple dbus call, otherwise we'll run into a dead-lock
QTimer::singleShot(0, this, SLOT(standby()));
QTimer::singleShot(0, this, &LeaveItemHandler::standby);
return true;
} else if (m_logoutAction == "suspendram") {
} else if (m_logoutAction == QLatin1String("suspendram")) {
// decouple dbus call, otherwise we'll run into a dead-lock
QTimer::singleShot(0, this, SLOT(suspendRAM()));
QTimer::singleShot(0, this, &LeaveItemHandler::suspendRAM);
return true;
} else if (m_logoutAction == "suspenddisk") {
} else if (m_logoutAction == QLatin1String("suspenddisk")) {
// decouple dbus call, otherwise we'll run into a dead-lock
QTimer::singleShot(0, this, SLOT(suspendDisk()));
QTimer::singleShot(0, this, &LeaveItemHandler::suspendDisk);
return true;
} else if (m_logoutAction == "run") {
} else if (m_logoutAction == QLatin1String("run")) {
// decouple dbus call, otherwise we'll run into a dead-lock
QTimer::singleShot(0, this, SLOT(runCommand()));
QTimer::singleShot(0, this, &LeaveItemHandler::runCommand);
return true;
}
......@@ -121,9 +121,9 @@ bool LeaveItemHandler::openUrl(const KUrl& url)
void LeaveItemHandler::runCommand()
{
if (KAuthorized::authorize("run_command")) {
QString interface("org.kde.krunner");
org::kde::krunner::App krunner(interface, "/App", QDBusConnection::sessionBus());
if (KAuthorized::authorize(QStringLiteral("run_command"))) {
QString interface(QStringLiteral("org.kde.krunner"));
org::kde::krunner::App krunner(interface, QStringLiteral("/App"), QDBusConnection::sessionBus());
krunner.display();
}
}
......@@ -133,15 +133,15 @@ void LeaveItemHandler::logout()
KWorkSpace::ShutdownConfirm confirm = KWorkSpace::ShutdownConfirmDefault;
KWorkSpace::ShutdownType type = KWorkSpace::ShutdownTypeNone;
if (m_logoutAction == "logout" || m_logoutAction == "logoutonly") {
if (m_logoutAction == QLatin1String("logout") || m_logoutAction == QLatin1String("logoutonly")) {
type = KWorkSpace::ShutdownTypeNone;
} else if (m_logoutAction == "lock") {
} else if (m_logoutAction == QLatin1String("lock")) {
qDebug() << "Locking screen";
} else if (m_logoutAction == "switch") {
} else if (m_logoutAction == QLatin1String("switch")) {
qDebug() << "Switching user";
} else if (m_logoutAction == "restart") {
} else if (m_logoutAction == QLatin1String("restart")) {
type = KWorkSpace::ShutdownTypeReboot;
} else if (m_logoutAction == "shutdown") {
} else if (m_logoutAction == QLatin1String("shutdown")) {
type = KWorkSpace::ShutdownTypeHalt;
}
......@@ -150,23 +150,23 @@ void LeaveItemHandler::logout()
void LeaveItemHandler::lock()
{
QString interface("org.freedesktop.ScreenSaver");
org::freedesktop::ScreenSaver screensaver(interface, "/ScreenSaver", QDBusConnection::sessionBus());
QString interface(QStringLiteral("org.freedesktop.ScreenSaver"));
org::freedesktop::ScreenSaver screensaver(interface, QStringLiteral("/ScreenSaver"), QDBusConnection::sessionBus());
screensaver.Lock();
}
void LeaveItemHandler::switchUser()
{
QString interface("org.kde.krunner");
org::kde::krunner::App krunner(interface, "/App", QDBusConnection::sessionBus());
QString interface(QStringLiteral("org.kde.krunner"));
org::kde::krunner::App krunner(interface, QStringLiteral("/App"), QDBusConnection::sessionBus());
krunner.switchUser();
}
void LeaveItemHandler::saveSession()
{
QString interface("org.kde.ksmserver");
QString interface(QStringLiteral("org.kde.ksmserver"));
org::kde::KSMServerInterface ksmserver(interface, "/KSMServer", QDBusConnection::sessionBus());
org::kde::KSMServerInterface ksmserver(interface, QStringLiteral("/KSMServer"), QDBusConnection::sessionBus());
if (ksmserver.isValid()) {
ksmserver.saveCurrentSession();
}
......
......@@ -74,7 +74,7 @@ QMimeData *KickoffAbstractModel::mimeData(const QModelIndexList &indexes) const
QStringList KickoffAbstractModel::mimeTypes() const
{
QStringList types;
types << QLatin1String("text/uri-list");
types << QStringLiteral("text/uri-list");
return types;
}
......
......@@ -82,7 +82,7 @@ QMimeData *KickoffModel::mimeData(const QModelIndexList &indexes) const
QStringList KickoffModel::mimeTypes() const
{
QStringList types;
types << QLatin1String("text/uri-list");
types << QStringLiteral("text/uri-list");
return types;
}
......
......@@ -74,7 +74,7 @@ QMimeData *KickoffProxyModel::mimeData(const QModelIndexList &indexes) const
QStringList KickoffProxyModel::mimeTypes() const
{
QStringList types;
types << QLatin1String("text/uri-list");
types << QStringLiteral("text/uri-list");
return types;
}
......
......@@ -59,13 +59,13 @@ Plasma::RunnerManager * runnerManager() {
// initializing allowed runners
QStringList allowed;
allowed
<< "places"
<< "shell"
<< "services"
<< "bookmarks"
<< "recentdocuments"
<< "locations"
<< "baloosearch";
<< QStringLiteral("places")
<< QStringLiteral("shell")
<< QStringLiteral("services")
<< QStringLiteral("bookmarks")
<< QStringLiteral("recentdocuments")
<< QStringLiteral("locations")
<< QStringLiteral("baloosearch");
_runnerManager->setAllowedRunners(allowed);
......@@ -111,7 +111,7 @@ KService::Ptr Kickoff::serviceForUrl(const KUrl & url)
// URL path example: services_kde4-kate.desktop
// or: services_firefox.desktop
id.remove("services_");
id.remove(QStringLiteral("services_"));
return KService::serviceByStorageId(id);
}
......@@ -178,11 +178,11 @@ KRunnerModel::KRunnerModel(QObject *parent)
, d(new Private())
{
connect(runnerManager(),
SIGNAL(matchesChanged(QList<Plasma::QueryMatch>)),
&Plasma::RunnerManager::matchesChanged,
this,
SLOT(matchesChanged(QList<Plasma::QueryMatch>)));
&KRunnerModel::matchesChanged);
UrlItemLauncher::addGlobalHandler(UrlItemLauncher::ProtocolHandler, "krunner", new KRunnerItemHandler);
UrlItemLauncher::addGlobalHandler(UrlItemLauncher::ProtocolHandler, QStringLiteral("krunner"), new KRunnerItemHandler);
}
KRunnerModel::~KRunnerModel()
......@@ -234,7 +234,7 @@ void KRunnerModel::matchesChanged(const QList< Plasma::QueryMatch > & m)
while (matches.size()) {
Plasma::QueryMatch match = matches.takeLast();
qDebug() << "matches " << QString("krunner://") + match.runner()->id() + "/" + match.id();
qDebug() << "matches " << QStringLiteral("krunner://") + match.runner()->id() + "/" + match.id();
QString mimeUrl;
if (runnerManager()->mimeDataForMatch(match)) {
mimeUrl = runnerManager()->mimeDataForMatch(match)->urls().first().toString();
......@@ -244,7 +244,7 @@ void KRunnerModel::matchesChanged(const QList< Plasma::QueryMatch > & m)
match.icon(),
match.text(),
match.subtext(),
QString("krunner://") + match.runner()->id() + "/" + match.id(),
QStringLiteral("krunner://") + match.runner()->id() + "/" + match.id(),
mimeUrl
)
);
......@@ -258,7 +258,7 @@ Qt::ItemFlags KRunnerModel::flags(const QModelIndex &index) const
if (index.isValid()) {
KUrl url = data(index, UrlRole).toString();
QString host = url.host();
if (host != "services") {
if (host != QLatin1String("services")) {
flags &= ~ ( Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled );
}
} else {
......
......@@ -49,39 +49,39 @@ QStandardItem* LeaveModel::createStandardItem(const QString& url)
//Q_ASSERT(KUrl(url).scheme() == "leave");
QStandardItem *item = new QStandardItem();
const QString basename = QFileInfo(url).baseName();
if (basename == "logoutonly") {
if (basename == QLatin1String("logoutonly")) {
item->setText(i18n("Log out"));
item->setData(i18n("End session"), Kickoff::SubTitleRole);
item->setData("system-log-out", Kickoff::IconNameRole);
} else if (basename == "lock") {
} else if (basename == QLatin1String("lock")) {
item->setText(i18n("Lock"));
item->setData(i18n("Lock screen"), Kickoff::SubTitleRole);
item->setData("system-lock-screen", Kickoff::IconNameRole);
} else if (basename == "switch") {
} else if (basename == QLatin1String("switch")) {
item->setText(i18n("Switch user"));
item->setData(i18n("Start a parallel session as a different user"), Kickoff::SubTitleRole);
item->setData("system-switch-user", Kickoff::IconNameRole);
} else if (basename == "shutdown") {
} else if (basename == QLatin1String("shutdown")) {
item->setText(i18n("Shut down"));
item->setData(i18n("Turn off computer"), Kickoff::SubTitleRole);
item->setData("system-shutdown", Kickoff::IconNameRole);
} else if (basename == "restart") {
} else if (basename == QLatin1String("restart")) {
item->setText(i18nc("Restart computer", "Restart"));
item->setData(i18n("Restart computer"), Kickoff::SubTitleRole);
item->setData("system-reboot", Kickoff::IconNameRole);
} else if (basename == "savesession") {
} else if (basename == QLatin1String("savesession")) {
item->setText(i18n("Save Session"));
item->setData(i18n("Save current session for next login"), Kickoff::SubTitleRole);
item->setData("document-save", Kickoff::IconNameRole);
} else if (basename == "standby") {
} else if (basename == QLatin1String("standby")) {
item->setText(i18nc("Puts the system on standby", "Standby"));
item->setData(i18n("Pause without logging out"), Kickoff::SubTitleRole);
item->setData("system-suspend", Kickoff::IconNameRole);
} else if (basename == "suspenddisk") {
} else if (basename == QLatin1String("suspenddisk")) {
item->setText(i18n("Hibernate"));
item->setData(i18n("Suspend to disk"), Kickoff::SubTitleRole);
item->setData("system-suspend-hibernate", Kickoff::IconNameRole);
} else if (basename == "suspendram") {
} else if (basename == QLatin1String("suspendram")) {
item->setText(i18n("Suspend"));
item->setData(i18n("Suspend to RAM"), Kickoff::SubTitleRole);
item->setData("system-suspend", Kickoff::IconNameRole);
......@@ -107,7 +107,7 @@ LeaveModel::LeaveModel(QObject *parent)
roles[Kickoff::IconNameRole] = "iconName";
setRoleNames(roles);
updateModel();
Kickoff::UrlItemLauncher::addGlobalHandler(Kickoff::UrlItemLauncher::ProtocolHandler, "leave", new Kickoff::LeaveItemHandler);
Kickoff::UrlItemLauncher::addGlobalHandler(Kickoff::UrlItemLauncher::ProtocolHandler, QStringLiteral("leave"), new Kickoff::LeaveItemHandler);
const QString configFile = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + "/ksmserverrc";
......@@ -142,33 +142,33 @@ void LeaveModel::updateModel()
const QString session = i18n("Session");
// Logout
const bool canLogout = KAuthorized::authorizeKAction("logout") && KAuthorized::authorize("logout");
const bool canLogout = KAuthorized::authorizeKAction(QStringLiteral("logout")) && KAuthorized::authorize(QStringLiteral("logout"));
if (canLogout) {
QStandardItem *logoutOption = createStandardItem("leave:/logoutonly");
QStandardItem *logoutOption = createStandardItem(QStringLiteral("leave:/logoutonly"));
logoutOption->setData(session, Kickoff::GroupNameRole);
appendRow(logoutOption);
}
// Lock
if (KAuthorized::authorizeKAction("lock_screen")) {
QStandardItem *lockOption = createStandardItem("leave:/lock");
if (KAuthorized::authorizeKAction(QStringLiteral("lock_screen"))) {
QStandardItem *lockOption = createStandardItem(QStringLiteral("leave:/lock"));
lockOption->setData(session, Kickoff::GroupNameRole);
appendRow(lockOption);
}
// Save Session
if (canLogout) {
KConfigGroup c(KSharedConfig::openConfig("ksmserverrc", KConfig::NoGlobals), "General");
if (c.readEntry("loginMode") == "restoreSavedSession") {
QStandardItem *saveSessionOption = createStandardItem("leave:/savesession");
KConfigGroup c(KSharedConfig::openConfig(QStringLiteral("ksmserverrc"), KConfig::NoGlobals), "General");
if (c.readEntry("loginMode") == QLatin1String("restoreSavedSession")) {
QStandardItem *saveSessionOption = createStandardItem(QStringLiteral("leave:/savesession"));
saveSessionOption->setData(session, Kickoff::GroupNameRole);
appendRow(saveSessionOption);
}
}
// Switch User
if (KDisplayManager().isSwitchable() && KAuthorized::authorize(QLatin1String("switch_user"))) {
QStandardItem *switchUserOption = createStandardItem("leave:/switch");
if (KDisplayManager().isSwitchable() && KAuthorized::authorize(QStringLiteral("switch_user"))) {
QStandardItem *switchUserOption = createStandardItem(QStringLiteral("leave:/switch"));
switchUserOption->setData(session, Kickoff::GroupNameRole);
appendRow(switchUserOption);
}
......@@ -180,19 +180,19 @@ void LeaveModel::updateModel()
const QString system = i18n("System");
QSet< Solid::PowerManagement::SleepState > spdMethods = Solid::PowerManagement::supportedSleepStates();
if (spdMethods.contains(Solid::PowerManagement::StandbyState)) {
QStandardItem *standbyOption = createStandardItem("leave:/standby");
QStandardItem *standbyOption = createStandardItem(QStringLiteral("leave:/standby"));
standbyOption->setData(system, Kickoff::GroupNameRole);
appendRow(standbyOption);
}
if (spdMethods.contains(Solid::PowerManagement::SuspendState)) {
QStandardItem *suspendramOption = createStandardItem("leave:/suspendram");
QStandardItem *suspendramOption = createStandardItem(QStringLiteral("leave:/suspendram"));
suspendramOption->setData(system, Kickoff::GroupNameRole);
appendRow(suspendramOption);
}
if (spdMethods.contains(Solid::PowerManagement::HibernateState)) {
QStandardItem *suspenddiskOption = createStandardItem("leave:/suspenddisk");
QStandardItem *suspenddiskOption = createStandardItem(QStringLiteral("leave:/suspenddisk"));
suspenddiskOption->setData(system, Kickoff::GroupNameRole);
appendRow(suspenddiskOption);
}
......@@ -200,14 +200,14 @@ void LeaveModel::updateModel()
if (canLogout) {
if (KWorkSpace::canShutDown(KWorkSpace::ShutdownConfirmDefault, KWorkSpace::ShutdownTypeReboot)) {
// Restart
QStandardItem *restartOption = createStandardItem("leave:/restart");
QStandardItem *restartOption = createStandardItem(QStringLiteral("leave:/restart"));
restartOption->setData(system, Kickoff::GroupNameRole);
appendRow(restartOption);
}
if (KWorkSpace::canShutDown(KWorkSpace::ShutdownConfirmDefault, KWorkSpace::ShutdownTypeHalt)) {
// Shutdown
QStandardItem *shutDownOption = createStandardItem("leave:/shutdown");
QStandardItem *shutDownOption = createStandardItem(QStringLiteral("leave:/shutdown"));
shutDownOption->setData(system, Kickoff::GroupNameRole);
appendRow(shutDownOption);
}
......
......@@ -83,7 +83,7 @@ QStandardItem *StandardItemFactory::createItemForUrl(const QString& urlString, D
item = new QStandardItem;
KDesktopFile desktopFile(url.toLocalFile());
item->setText(QFileInfo(urlString.mid(0, urlString.lastIndexOf('.'))).completeBaseName());
item->setIcon(QIcon::fromTheme(desktopFile.readIcon(), QIcon::fromTheme("unknown")));
item->setIcon(QIcon::fromTheme(desktopFile.readIcon(), QIcon::fromTheme(QStringLiteral("unknown"))));
//FIXME: desktopUrl is a hack around borkage in KRecentDocuments which
// stores a path in the URL field!
......@@ -101,7 +101,7 @@ QStandardItem *StandardItemFactory::createItemForUrl(const QString& urlString, D
item->setData(subTitle, Kickoff::SubTitleRole);
setSpecialUrlProperties(desktopUrl, item);