mirror of
https://github.com/KDE/latte-dock.git
synced 2025-01-24 18:03:53 +03:00
Reorder inits to Fix wrong initialize problem and fixes for string compares
This commit is contained in:
parent
21b187b94c
commit
03e9c6c954
@ -31,6 +31,7 @@
|
||||
#include <QProcess>
|
||||
#include <QTemporaryDir>
|
||||
#include <QTimer>
|
||||
#include <QLatin1String>
|
||||
|
||||
// KDE
|
||||
#include <KDirWatch>
|
||||
@ -250,7 +251,7 @@ bool Factory::isCustomType(const QString &id) const
|
||||
bool Factory::metadataAreValid(KPluginMetaData &metadata)
|
||||
{
|
||||
return metadata.isValid()
|
||||
&& metadata.category() == "Latte Indicator"
|
||||
&& metadata.category() == QLatin1String("Latte Indicator")
|
||||
&& !metadata.value("X-Latte-MainScript").isEmpty();
|
||||
}
|
||||
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include <QDir>
|
||||
#include <QDebug>
|
||||
#include <QFile>
|
||||
#include <QLatin1String>
|
||||
|
||||
// KDE
|
||||
#include <KSharedConfig>
|
||||
@ -265,27 +266,27 @@ QString AbstractLayout::defaultCustomBackground()
|
||||
QString AbstractLayout::defaultTextColor(const QString &color)
|
||||
{
|
||||
//! the user is in default layout theme
|
||||
if (color == "blue") {
|
||||
if (color == QLatin1String("blue")) {
|
||||
return "#D7E3FF";
|
||||
} else if (color == "brown") {
|
||||
} else if (color == QLatin1String("brown")) {
|
||||
return "#F1DECB";
|
||||
} else if (color == "darkgrey") {
|
||||
} else if (color == QLatin1String("darkgrey")) {
|
||||
return "#ECECEC";
|
||||
} else if (color == "gold") {
|
||||
} else if (color == QLatin1String("gold")) {
|
||||
return "#7C3636";
|
||||
} else if (color == "green") {
|
||||
} else if (color == QLatin1String("green")) {
|
||||
return "#4D7549";
|
||||
} else if (color == "lightskyblue") {
|
||||
} else if (color == QLatin1String("lightskyblue")) {
|
||||
return "#0C2A43";
|
||||
} else if (color == "orange") {
|
||||
} else if (color == QLatin1String("orange")) {
|
||||
return "#6F3902";
|
||||
} else if (color == "pink") {
|
||||
} else if (color == QLatin1String("pink")) {
|
||||
return "#743C46";
|
||||
} else if (color == "purple") {
|
||||
} else if (color == QLatin1String("purple")) {
|
||||
return "#ECD9FF";
|
||||
} else if (color == "red") {
|
||||
} else if (color == QLatin1String("red")) {
|
||||
return "#F3E4E4";
|
||||
} else if (color == "wheat") {
|
||||
} else if (color == QLatin1String("wheat")) {
|
||||
return "#6A4E25";
|
||||
} else {
|
||||
return "#FCFCFC";
|
||||
|
@ -31,6 +31,7 @@
|
||||
|
||||
// Qt
|
||||
#include <QFile>
|
||||
#include <QLatin1String>
|
||||
|
||||
// KDE
|
||||
#include <KArchive/KTar>
|
||||
@ -119,10 +120,10 @@ bool Importer::importOldLayout(QString oldAppletsPath, QString newName, bool alt
|
||||
|
||||
bool shouldImport = false;
|
||||
|
||||
if (plugin == "org.kde.latte.containment" && session == DefaultSession && !alternative) {
|
||||
if (plugin == QLatin1String("org.kde.latte.containment") && session == DefaultSession && !alternative) {
|
||||
qDebug() << containmentId << " - " << plugin << " - " << session;
|
||||
shouldImport = true;
|
||||
} else if (plugin == "org.kde.latte.containment" && session == AlternativeSession && alternative) {
|
||||
} else if (plugin == QLatin1String("org.kde.latte.containment") && session == AlternativeSession && alternative) {
|
||||
qDebug() << containmentId << " - " << plugin << " - " << session;
|
||||
shouldImport = true;
|
||||
}
|
||||
@ -329,8 +330,8 @@ bool Importer::importOldConfiguration(QString oldConfigPath, QString newName)
|
||||
for(const auto &name : rootDir->entries()) {
|
||||
auto fileEntry = rootDir->file(name);
|
||||
|
||||
if (fileEntry && (fileEntry->name() == "lattedockrc"
|
||||
|| fileEntry->name() == "lattedock-appletsrc")) {
|
||||
if (fileEntry && (fileEntry->name() == QLatin1String("lattedockrc")
|
||||
|| fileEntry->name() == QLatin1String("lattedock-appletsrc"))) {
|
||||
if (!fileEntry->copyTo(tempDir.absolutePath())) {
|
||||
qInfo() << i18nc("import/export config", "The extracted file could not be copied!!!");
|
||||
archive.close();
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QMessageBox>
|
||||
#include <QLatin1String>
|
||||
|
||||
// KDE
|
||||
#include <KMessageBox>
|
||||
@ -355,7 +356,7 @@ void Manager::cleanupOnStartup(QString path)
|
||||
for (const auto &actId : actionGroups.groupList()) {
|
||||
QString pluginId = actionGroups.group(actId).readEntry("RightButton;NoModifier", "");
|
||||
|
||||
if (pluginId == "org.kde.contextmenu") {
|
||||
if (pluginId == QStringLiteral("org.kde.contextmenu")) {
|
||||
deprecatedActionGroup << actId;
|
||||
}
|
||||
}
|
||||
@ -372,7 +373,7 @@ void Manager::cleanupOnStartup(QString path)
|
||||
for (const auto &cId : containmentGroups.groupList()) {
|
||||
QString pluginId = containmentGroups.group(cId).readEntry("plugin", "");
|
||||
|
||||
if (pluginId == "org.kde.desktopcontainment") { //!must remove ghost containments first
|
||||
if (pluginId == QStringLiteral("org.kde.desktopcontainment")) { //!must remove ghost containments first
|
||||
removeContaimentsList << cId;
|
||||
}
|
||||
}
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QLatin1String>
|
||||
|
||||
// KDE
|
||||
#include <KConfigGroup>
|
||||
@ -99,7 +100,7 @@ bool Storage::isLatteContainment(const Plasma::Containment *containment) const
|
||||
return false;
|
||||
}
|
||||
|
||||
if (containment->pluginMetaData().pluginId() == "org.kde.latte.containment") {
|
||||
if (containment->pluginMetaData().pluginId() == QLatin1String("org.kde.latte.containment")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -109,7 +110,7 @@ bool Storage::isLatteContainment(const Plasma::Containment *containment) const
|
||||
bool Storage::isLatteContainment(const KConfigGroup &group) const
|
||||
{
|
||||
QString pluginId = group.readEntry("plugin", "");
|
||||
return pluginId == "org.kde.latte.containment";
|
||||
return pluginId == QLatin1String("org.kde.latte.containment");
|
||||
}
|
||||
|
||||
bool Storage::isSubContainment(const Layout::GenericLayout *layout, const Plasma::Applet *applet) const
|
||||
@ -298,7 +299,7 @@ bool Storage::appletGroupIsValid(const KConfigGroup &appletGroup)
|
||||
{
|
||||
return !( appletGroup.keyList().count() == 0
|
||||
&& appletGroup.groupList().count() == 1
|
||||
&& appletGroup.groupList().at(0) == "Configuration"
|
||||
&& appletGroup.groupList().at(0) == QLatin1String("Configuration")
|
||||
&& appletGroup.group("Configuration").keyList().count() == 1
|
||||
&& appletGroup.group("Configuration").hasKey("PreloadWeight") );
|
||||
}
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
// Qt
|
||||
#include <QDebug>
|
||||
#include <QLatin1String>
|
||||
|
||||
// KDE
|
||||
#include <KPackage/PackageLoader>
|
||||
@ -86,7 +87,7 @@ void Package::pathChanged(KPackage::Package *package)
|
||||
if (!pluginName.isEmpty() && pluginName != "org.kde.latte.shell") {
|
||||
auto fallback = KPackage::PackageLoader::self()->loadPackage("Plasma/Shell", "org.kde.latte.shell");
|
||||
package->setFallbackPackage(fallback);
|
||||
} else if (pluginName.isEmpty() || pluginName == "org.kde.latte.shell") {
|
||||
} else if (pluginName.isEmpty() || pluginName == QLatin1String("org.kde.latte.shell")) {
|
||||
package->setFallbackPackage(KPackage::Package());
|
||||
}
|
||||
}
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include <QList>
|
||||
#include <QRgb>
|
||||
#include <QtMath>
|
||||
#include <QLatin1String>
|
||||
|
||||
// Plasma
|
||||
#include <Plasma>
|
||||
@ -119,7 +120,7 @@ bool BackgroundCache::isDesktopContainment(const KConfigGroup &containment) cons
|
||||
{
|
||||
const auto type = containment.readEntry("plugin", QString());
|
||||
|
||||
if (type == "org.kde.desktopcontainment" || type == "org.kde.plasma.folder" ) {
|
||||
if (type == QLatin1String("org.kde.desktopcontainment") || type == QLatin1String("org.kde.plasma.folder") ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include <QAction>
|
||||
#include <QDir>
|
||||
#include <QDebug>
|
||||
#include <QLatin1String>
|
||||
|
||||
// KDE
|
||||
#include <KConfigGroup>
|
||||
@ -111,7 +112,7 @@ QString ShortcutsTracker::shortcutToBadge(QStringList shortcutRecords)
|
||||
badge = modifiers[modifiers.count() - 1];
|
||||
|
||||
//! when shortcut follows Meta+"Character" scheme
|
||||
if (modifiers.count() == 2 && modifiers[0] == "Meta") {
|
||||
if (modifiers.count() == 2 && modifiers[0] == QLatin1String("Meta")) {
|
||||
badge = badge.toLower();
|
||||
} else {
|
||||
badge = badge.toUpper();
|
||||
|
@ -28,6 +28,7 @@
|
||||
|
||||
// Qt
|
||||
#include <QDebug>
|
||||
#include <QLatin1String>
|
||||
|
||||
// Plasma
|
||||
#include <Plasma/Applet>
|
||||
@ -83,9 +84,9 @@ void ContainmentInterface::identifyShortcutsHost()
|
||||
const auto &childItems = graphicItem->childItems();
|
||||
|
||||
for (QQuickItem *item : childItems) {
|
||||
if (item->objectName() == "containmentViewLayout" ) {
|
||||
if (item->objectName() == QLatin1String("containmentViewLayout")) {
|
||||
for (QQuickItem *subitem : item->childItems()) {
|
||||
if (subitem->objectName() == "PositionShortcutsAbilityHost") {
|
||||
if (subitem->objectName() == QLatin1String("PositionShortcutsAbilityHost")) {
|
||||
m_shortcutsHost = subitem;
|
||||
identifyMethods();
|
||||
return;
|
||||
@ -212,7 +213,7 @@ bool ContainmentInterface::updateBadgeForLatteTask(const QString identifier, con
|
||||
for (auto *applet : applets) {
|
||||
KPluginMetaData meta = applet->kPackage().metadata();
|
||||
|
||||
if (meta.pluginId() == "org.kde.latte.plasmoid") {
|
||||
if (meta.pluginId() == QLatin1String("org.kde.latte.plasmoid")) {
|
||||
|
||||
if (QQuickItem *appletInterface = applet->property("_plasma_graphicObject").value<QQuickItem *>()) {
|
||||
const auto &childItems = appletInterface->childItems();
|
||||
@ -642,7 +643,7 @@ void ContainmentInterface::onAppletAdded(Plasma::Applet *applet)
|
||||
KPluginMetaData meta = applet->kPackage().metadata();
|
||||
const auto &provides = KPluginMetaData::readStringList(meta.rawData(), QStringLiteral("X-Plasma-Provides"));
|
||||
|
||||
if (meta.pluginId() == "org.kde.latte.plasmoid") {
|
||||
if (meta.pluginId() == QLatin1String("org.kde.latte.plasmoid")) {
|
||||
//! populate latte tasks applet
|
||||
m_latteTasksModel->addTask(ai);
|
||||
} else if (provides.contains(QLatin1String("org.kde.plasma.multitasking"))) {
|
||||
|
@ -28,6 +28,7 @@
|
||||
// Qt
|
||||
#include <QMouseEvent>
|
||||
#include <QVersionNumber>
|
||||
#include <QLatin1String>
|
||||
|
||||
// KDE
|
||||
#include <KActionCollection>
|
||||
@ -151,7 +152,7 @@ bool ContextMenu::mousePressEventForContainmentMenu(QQuickView *view, QMouseEven
|
||||
|
||||
QString trigger = Plasma::ContainmentActions::eventToString(event);
|
||||
|
||||
if (trigger == "RightButton;NoModifier") {
|
||||
if (trigger == QLatin1String("RightButton;NoModifier")) {
|
||||
Plasma::ContainmentActions *plugin = m_latteView->containment()->containmentActions().value(trigger);
|
||||
|
||||
if (!plugin || plugin->contextualActions().isEmpty()) {
|
||||
@ -235,7 +236,7 @@ bool ContextMenu::mousePressEvent(QMouseEvent *event)
|
||||
//qDebug() << "1 ...";
|
||||
QString trigger = Plasma::ContainmentActions::eventToString(event);
|
||||
|
||||
if (trigger == "RightButton;NoModifier") {
|
||||
if (trigger == QLatin1String("RightButton;NoModifier")) {
|
||||
Plasma::ContainmentActions *plugin = m_latteView->containment()->containmentActions().value(trigger);
|
||||
|
||||
if (!plugin || plugin->contextualActions().isEmpty()) {
|
||||
|
@ -29,6 +29,7 @@
|
||||
|
||||
// Qt
|
||||
#include <QFileDialog>
|
||||
#include <QLatin1String>
|
||||
|
||||
// KDE
|
||||
#include <KLocalizedString>
|
||||
@ -153,11 +154,11 @@ void Indicator::setPluginIsReady(bool ready)
|
||||
|
||||
int Indicator::index(const QString &type)
|
||||
{
|
||||
if (type == "org.kde.latte.default") {
|
||||
if (type == QLatin1String("org.kde.latte.default")) {
|
||||
return 0;
|
||||
} else if (type == "org.kde.latte.plasma") {
|
||||
} else if (type == QLatin1String("org.kde.latte.plasma")) {
|
||||
return 1;
|
||||
} else if (type == "org.kde.latte.plasmatabstyle") {
|
||||
} else if (type == QLatin1String("org.kde.latte.plasmatabstyle")) {
|
||||
return 2;
|
||||
} else if (customPluginIds().contains(type)){
|
||||
return 3 + customPluginIds().indexOf(type);
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
#include <QLatin1String>
|
||||
|
||||
// KDE
|
||||
#include <KConfigGroup>
|
||||
@ -159,7 +160,7 @@ QString SchemeColors::possibleSchemeFile(QString scheme)
|
||||
|
||||
QString tempScheme = scheme;
|
||||
|
||||
if (scheme == "kdeglobals") {
|
||||
if (scheme == QLatin1String("kdeglobals")) {
|
||||
QString settingsFile = Latte::configPath() + "/kdeglobals";
|
||||
|
||||
if (QFileInfo(settingsFile).exists()) {
|
||||
|
@ -26,6 +26,7 @@
|
||||
|
||||
// Qt
|
||||
#include <QDir>
|
||||
#include <QLatin1String>
|
||||
|
||||
// KDE
|
||||
#include <KDirWatch>
|
||||
@ -117,12 +118,12 @@ SchemeColors *Schemes::schemeForWindow(WindowId wid)
|
||||
|
||||
void Schemes::setColorSchemeForWindow(WindowId wid, QString scheme)
|
||||
{
|
||||
if (scheme == "kdeglobals" && !m_windowScheme.contains(wid)) {
|
||||
if (scheme == QLatin1String("kdeglobals") && !m_windowScheme.contains(wid)) {
|
||||
//default scheme does not have to be set
|
||||
return;
|
||||
}
|
||||
|
||||
if (scheme == "kdeglobals") {
|
||||
if (scheme == QLatin1String("kdeglobals")) {
|
||||
//! a window that previously had an explicit set scheme now is set back to default scheme
|
||||
m_windowScheme.remove(wid);
|
||||
} else {
|
||||
|
@ -19,6 +19,8 @@
|
||||
|
||||
#include "trackedgeneralinfo.h"
|
||||
|
||||
#include <QLatin1String>
|
||||
|
||||
//local
|
||||
#include "windowstracker.h"
|
||||
#include "../abstractwindowinterface.h"
|
||||
@ -117,7 +119,7 @@ bool TrackedGeneralInfo::isTrackingCurrentActivity() const
|
||||
|
||||
void TrackedGeneralInfo::updateTrackingCurrentActivity()
|
||||
{
|
||||
m_isTrackingCurrentActivity = ( m_activities.isEmpty() || m_activities[0] == "{0}" || m_activities.contains(m_wm->currentActivity()));
|
||||
m_isTrackingCurrentActivity = ( m_activities.isEmpty() || m_activities[0] == QLatin1String("{0}") || m_activities.contains(m_wm->currentActivity()));
|
||||
}
|
||||
|
||||
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include <QApplication>
|
||||
#include <QtX11Extras/QX11Info>
|
||||
#include <QRasterWindow>
|
||||
#include <QLatin1String>
|
||||
|
||||
// KDE
|
||||
#include <KWindowSystem>
|
||||
@ -929,7 +930,7 @@ void WaylandInterface::windowCreatedProxy(KWayland::Client::PlasmaWindow *w)
|
||||
trackWindow(w);
|
||||
emit windowAdded(w->internalId());
|
||||
|
||||
if (w->appId() == "latte-dock") {
|
||||
if (w->appId() == QLatin1String("latte-dock")) {
|
||||
emit latteWindowAdded();
|
||||
}
|
||||
}
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include <QMenu>
|
||||
#include <QtDBus>
|
||||
#include <QTimer>
|
||||
#include <QLatin1String>
|
||||
|
||||
// KDE
|
||||
#include <KActionCollection>
|
||||
@ -496,7 +497,7 @@ void Menu::switchToLayout(QAction *action)
|
||||
{
|
||||
const QString layout = action->data().toString();
|
||||
|
||||
if (layout == " _show_latte_settings_dialog_") {
|
||||
if (layout == QLatin1String(" _show_latte_settings_dialog_")) {
|
||||
QTimer::singleShot(400, [this]() {
|
||||
QDBusInterface iface("org.kde.lattedock", "/Latte", "", QDBusConnection::sessionBus());
|
||||
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include <QPixmap>
|
||||
#include <QSGSimpleTextureNode>
|
||||
#include <QuickAddons/ManagedTextureNode>
|
||||
#include <QLatin1String>
|
||||
|
||||
// KDE
|
||||
#include <KIconTheme>
|
||||
@ -43,13 +44,14 @@ namespace Latte {
|
||||
|
||||
IconItem::IconItem(QQuickItem *parent)
|
||||
: QQuickItem(parent),
|
||||
m_lastValidSourceName(QString()),
|
||||
m_smooth(false),
|
||||
m_active(false),
|
||||
m_smooth(false),
|
||||
m_textureChanged(false),
|
||||
m_sizeChanged(false),
|
||||
m_usesPlasmaTheme(false),
|
||||
m_lastValidSourceName(QString()),
|
||||
m_colorGroup(Plasma::Theme::NormalColorGroup)
|
||||
|
||||
{
|
||||
setFlag(ItemHasContents, true);
|
||||
connect(KIconLoader::global(), SIGNAL(iconLoaderSettingsChanged()),
|
||||
@ -214,7 +216,7 @@ QString IconItem::lastValidSourceName()
|
||||
|
||||
void IconItem::setLastValidSourceName(QString name)
|
||||
{
|
||||
if (m_lastValidSourceName == name || name == "" || name == "application-x-executable") {
|
||||
if (m_lastValidSourceName == name || name.isEmpty() || name == QLatin1String("application-x-executable")) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user