mirror of
https://github.com/KDE/latte-dock.git
synced 2025-03-27 14:50:21 +03:00
REFACTOR:replace all "foreach" statements
This commit is contained in:
parent
d48d2da2cd
commit
c735792c30
@ -72,7 +72,7 @@ bool Importer::updateOldConfiguration()
|
||||
KConfigGroup externalSettings = KConfigGroup(extFileConfig, "External");
|
||||
QStringList userLayouts = externalSettings.readEntry("userLayouts", QStringList());
|
||||
|
||||
foreach (auto userConfig, userLayouts) {
|
||||
for(const auto &userConfig : userLayouts) {
|
||||
qDebug() << "user layout : " << userConfig;
|
||||
importOldConfiguration(userConfig);
|
||||
}
|
||||
@ -101,7 +101,7 @@ bool Importer::importOldLayout(QString oldAppletsPath, QString newName, bool alt
|
||||
|
||||
//! first copy the latte containments that correspond to the correct session
|
||||
//! and find also the systrays that should be copied also
|
||||
foreach (auto containmentId, containments.groupList()) {
|
||||
for(const auto &containmentId : containments.groupList()) {
|
||||
KConfigGroup containmentGroup = containments.group(containmentId);
|
||||
|
||||
QString plugin = containmentGroup.readEntry("plugin", QString());
|
||||
@ -121,7 +121,7 @@ bool Importer::importOldLayout(QString oldAppletsPath, QString newName, bool alt
|
||||
if (shouldImport) {
|
||||
auto applets = containments.group(containmentId).group("Applets");
|
||||
|
||||
foreach (auto applet, applets.groupList()) {
|
||||
for(const auto &applet : applets.groupList()) {
|
||||
KConfigGroup appletSettings = applets.group(applet).group("Configuration");
|
||||
|
||||
int systrayId = appletSettings.readEntry("SystrayContainmentId", "-1").toInt();
|
||||
@ -146,7 +146,7 @@ bool Importer::importOldLayout(QString oldAppletsPath, QString newName, bool alt
|
||||
}
|
||||
|
||||
//! copy also the systrays that were discovered
|
||||
foreach (auto containmentId, containments.groupList()) {
|
||||
for(const auto &containmentId : containments.groupList()) {
|
||||
int cId = containmentId.toInt();
|
||||
|
||||
if (systrays.contains(cId)) {
|
||||
@ -206,7 +206,7 @@ QString Importer::standardPath(QString subPath, bool localfirst)
|
||||
QStringList paths = standardPaths(localfirst);
|
||||
|
||||
if (localfirst) {
|
||||
foreach (auto pt, paths) {
|
||||
for(const auto &pt : paths) {
|
||||
QString ptF = pt + "/" +subPath;
|
||||
if (QFileInfo(ptF).exists()) {
|
||||
return ptF;
|
||||
@ -307,7 +307,7 @@ bool Importer::importOldConfiguration(QString oldConfigPath, QString newName)
|
||||
if (!tempDir.exists())
|
||||
tempDir.mkpath(tempDir.absolutePath());
|
||||
|
||||
foreach (auto &name, rootDir->entries()) {
|
||||
for(const auto &name : rootDir->entries()) {
|
||||
auto fileEntry = rootDir->file(name);
|
||||
|
||||
if (fileEntry && (fileEntry->name() == "lattedockrc"
|
||||
@ -355,7 +355,7 @@ bool Importer::importOldConfiguration(QString oldConfigPath, QString newName)
|
||||
KConfigGroup m_screensGroup = KConfigGroup(oldScreensConfig, "ScreenConnectors");
|
||||
|
||||
//restore the known ids to connector mappings
|
||||
foreach (const QString &key, m_screensGroup.keyList()) {
|
||||
for(const QString &key : m_screensGroup.keyList()) {
|
||||
QString connector = m_screensGroup.readEntry(key, QString());
|
||||
int id = key.toInt();
|
||||
|
||||
@ -381,7 +381,7 @@ bool Importer::exportFullConfiguration(QString file)
|
||||
|
||||
archive.addLocalFile(QString(QDir::homePath() + "/.config/lattedockrc"), QStringLiteral("lattedockrc"));
|
||||
|
||||
foreach (auto layoutName, availableLayouts()) {
|
||||
for(const auto &layoutName : availableLayouts()) {
|
||||
archive.addLocalFile(layoutFilePath(layoutName), QString("latte/" + layoutName + ".layout.latte"));
|
||||
}
|
||||
|
||||
@ -538,7 +538,7 @@ QStringList Importer::availableLayouts()
|
||||
|
||||
QStringList layoutNames;
|
||||
|
||||
foreach (auto file, files) {
|
||||
for(const auto &file : files) {
|
||||
layoutNames.append(Layout::layoutName(file));
|
||||
}
|
||||
|
||||
@ -598,7 +598,7 @@ QStringList Importer::checkRepairMultipleLayoutsLinkedFile()
|
||||
//! layoutName and its Containments
|
||||
QHash<QString, QStringList> linkedLayoutContainmentGroups;
|
||||
|
||||
foreach (auto cId, linkedContainments.groupList()) {
|
||||
for(const auto &cId : linkedContainments.groupList()) {
|
||||
QString layoutName = linkedContainments.group(cId).readEntry("layoutId", QString());
|
||||
|
||||
if (!layoutName.isEmpty()) {
|
||||
@ -610,7 +610,7 @@ QStringList Importer::checkRepairMultipleLayoutsLinkedFile()
|
||||
|
||||
QStringList updatedLayouts;
|
||||
|
||||
foreach (auto layoutName, linkedLayoutContainmentGroups.uniqueKeys()) {
|
||||
for(const auto &layoutName : linkedLayoutContainmentGroups.uniqueKeys()) {
|
||||
if (layoutName != Layout::MultipleLayoutsName && layoutExists(layoutName)) {
|
||||
updatedLayouts << layoutName;
|
||||
KSharedConfigPtr layoutFilePtr = KSharedConfig::openConfig(layoutFilePath(layoutName));
|
||||
@ -620,7 +620,7 @@ QStringList Importer::checkRepairMultipleLayoutsLinkedFile()
|
||||
origLayoutContainments.deleteGroup();
|
||||
|
||||
//Update containments
|
||||
foreach (auto cId, linkedLayoutContainmentGroups[layoutName]) {
|
||||
for(const auto &cId : linkedLayoutContainmentGroups[layoutName]) {
|
||||
KConfigGroup newContainment = origLayoutContainments.group(cId);
|
||||
linkedContainments.group(cId).copyTo(&newContainment);
|
||||
linkedContainments.group(cId).deleteGroup();
|
||||
@ -631,7 +631,7 @@ QStringList Importer::checkRepairMultipleLayoutsLinkedFile()
|
||||
}
|
||||
|
||||
//! clear all remaining ghost containments
|
||||
foreach (auto cId, linkedContainments.groupList()) {
|
||||
for(const auto &cId : linkedContainments.groupList()) {
|
||||
linkedContainments.group(cId).deleteGroup();
|
||||
}
|
||||
|
||||
|
@ -123,7 +123,7 @@ void Factory::reload()
|
||||
if (standard.exists()) {
|
||||
QStringList pluginDirs = standard.entryList(QStringList(),QDir::AllDirs | QDir::NoSymLinks);
|
||||
|
||||
foreach (auto pluginDir, pluginDirs) {
|
||||
for (const auto &pluginDir : pluginDirs) {
|
||||
if (pluginDir != "." && pluginDir != "..") {
|
||||
QString metadataFile = standard.absolutePath() + "/" + pluginDir + "/metadata.desktop";
|
||||
KPluginMetaData metadata = KPluginMetaData::fromDesktopFile(metadataFile);
|
||||
|
@ -304,7 +304,7 @@ void Corona::cleanConfig()
|
||||
auto containmentsEntries = config()->group("Containments");
|
||||
bool changed = false;
|
||||
|
||||
foreach (auto cId, containmentsEntries.groupList()) {
|
||||
for(const auto &cId : containmentsEntries.groupList()) {
|
||||
if (!containmentExists(cId.toUInt())) {
|
||||
//cleanup obsolete containments
|
||||
containmentsEntries.group(cId).deleteGroup();
|
||||
@ -314,7 +314,7 @@ void Corona::cleanConfig()
|
||||
//cleanup obsolete applets of running containments
|
||||
auto appletsEntries = containmentsEntries.group(cId).group("Applets");
|
||||
|
||||
foreach (auto appletId, appletsEntries.groupList()) {
|
||||
for(const auto &appletId : appletsEntries.groupList()) {
|
||||
if (!appletExists(cId.toUInt(), appletId.toUInt())) {
|
||||
appletsEntries.group(appletId).deleteGroup();
|
||||
changed = true;
|
||||
@ -332,7 +332,7 @@ void Corona::cleanConfig()
|
||||
|
||||
bool Corona::containmentExists(uint id) const
|
||||
{
|
||||
foreach (auto containment, containments()) {
|
||||
for(const auto containment : containments()) {
|
||||
if (id == containment->id()) {
|
||||
return true;
|
||||
}
|
||||
@ -345,7 +345,7 @@ bool Corona::appletExists(uint containmentId, uint appletId) const
|
||||
{
|
||||
Plasma::Containment *containment = nullptr;
|
||||
|
||||
foreach (auto cont, containments()) {
|
||||
for(const auto cont : containments()) {
|
||||
if (containmentId == cont->id()) {
|
||||
containment = cont;
|
||||
break;
|
||||
@ -356,7 +356,7 @@ bool Corona::appletExists(uint containmentId, uint appletId) const
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach (auto applet, containment->applets()) {
|
||||
for(const auto applet : containment->applets()) {
|
||||
if (applet->id() == appletId) {
|
||||
return true;
|
||||
}
|
||||
@ -425,7 +425,7 @@ QRect Corona::screenGeometry(int id) const
|
||||
if (m_screenPool->knownIds().contains(id))
|
||||
screenName = m_screenPool->connector(id);
|
||||
|
||||
foreach (auto scr, screens) {
|
||||
for(const auto scr : screens) {
|
||||
if (scr->name() == screenName) {
|
||||
screen = scr;
|
||||
break;
|
||||
@ -450,7 +450,7 @@ QRegion Corona::availableScreenRegionWithCriteria(int id, QString forLayout) con
|
||||
if (m_screenPool->knownIds().contains(id))
|
||||
screenName = m_screenPool->connector(id);
|
||||
|
||||
foreach (auto scr, screens) {
|
||||
for(auto scr : screens) {
|
||||
if (scr->name() == screenName) {
|
||||
screen = scr;
|
||||
break;
|
||||
@ -576,7 +576,7 @@ QRect Corona::availableScreenRectWithCriteria(int id, QList<Types::Visibility> m
|
||||
if (m_screenPool->knownIds().contains(id)) {
|
||||
QString scrName = m_screenPool->connector(id);
|
||||
|
||||
foreach (auto scr, screens) {
|
||||
for(const auto scr : screens) {
|
||||
if (scr->name() == scrName) {
|
||||
screen = scr;
|
||||
break;
|
||||
@ -913,7 +913,7 @@ QStringList Corona::containmentsIds()
|
||||
{
|
||||
QStringList ids;
|
||||
|
||||
foreach (auto containment, containments()) {
|
||||
for(const auto containment : containments()) {
|
||||
ids << QString::number(containment->id());
|
||||
}
|
||||
|
||||
@ -924,7 +924,7 @@ QStringList Corona::appletsIds()
|
||||
{
|
||||
QStringList ids;
|
||||
|
||||
foreach (auto containment, containments()) {
|
||||
for(const auto containment : containments()) {
|
||||
auto applets = containment->config().group("Applets");
|
||||
ids << applets.groupList();
|
||||
}
|
||||
@ -1001,7 +1001,7 @@ QStringList Corona::contextMenuData()
|
||||
data << m_layoutManager->currentLayoutName();
|
||||
data << QString::number((int)viewType);
|
||||
|
||||
foreach (auto layoutName, m_layoutManager->menuLayouts()) {
|
||||
for(const auto &layoutName : m_layoutManager->menuLayouts()) {
|
||||
if (m_layoutManager->activeLayout(layoutName)) {
|
||||
data << QString("1," + layoutName);
|
||||
} else {
|
||||
|
@ -57,8 +57,8 @@ QList<Plasma::Applet *> LaunchersSignals::lattePlasmoids(QString layoutName)
|
||||
containments = *(layout->containments());
|
||||
}
|
||||
|
||||
foreach (auto containment, containments) {
|
||||
for (auto *applet : containment->applets()) {
|
||||
for(const auto containment : containments) {
|
||||
for(auto *applet : containment->applets()) {
|
||||
KPluginMetaData meta = applet->kPackage().metadata();
|
||||
|
||||
if (meta.pluginId() == "org.kde.latte.plasmoid") {
|
||||
@ -80,7 +80,7 @@ void LaunchersSignals::addLauncher(QString layoutName, int launcherGroup, QStrin
|
||||
|
||||
QString lName = (group == Types::LayoutLaunchers) ? layoutName : "";
|
||||
|
||||
foreach (auto applet, lattePlasmoids(lName)) {
|
||||
for(const auto applet : lattePlasmoids(lName)) {
|
||||
if (QQuickItem *appletInterface = applet->property("_plasma_graphicObject").value<QQuickItem *>()) {
|
||||
const auto &childItems = appletInterface->childItems();
|
||||
|
||||
@ -114,7 +114,7 @@ void LaunchersSignals::removeLauncher(QString layoutName, int launcherGroup, QSt
|
||||
|
||||
QString lName = (group == Types::LayoutLaunchers) ? layoutName : "";
|
||||
|
||||
foreach (auto applet, lattePlasmoids(lName)) {
|
||||
for(const auto applet : lattePlasmoids(lName)) {
|
||||
if (QQuickItem *appletInterface = applet->property("_plasma_graphicObject").value<QQuickItem *>()) {
|
||||
const auto &childItems = appletInterface->childItems();
|
||||
|
||||
@ -148,7 +148,7 @@ void LaunchersSignals::addLauncherToActivity(QString layoutName, int launcherGro
|
||||
|
||||
QString lName = (group == Types::LayoutLaunchers) ? layoutName : "";
|
||||
|
||||
foreach (auto applet, lattePlasmoids(lName)) {
|
||||
for(const auto applet : lattePlasmoids(lName)) {
|
||||
if (QQuickItem *appletInterface = applet->property("_plasma_graphicObject").value<QQuickItem *>()) {
|
||||
const auto &childItems = appletInterface->childItems();
|
||||
|
||||
@ -182,7 +182,7 @@ void LaunchersSignals::removeLauncherFromActivity(QString layoutName, int launch
|
||||
|
||||
QString lName = (group == Types::LayoutLaunchers) ? layoutName : "";
|
||||
|
||||
foreach (auto applet, lattePlasmoids(lName)) {
|
||||
for(const auto applet : lattePlasmoids(lName)) {
|
||||
if (QQuickItem *appletInterface = applet->property("_plasma_graphicObject").value<QQuickItem *>()) {
|
||||
const auto &childItems = appletInterface->childItems();
|
||||
|
||||
@ -216,7 +216,7 @@ void LaunchersSignals::urlsDropped(QString layoutName, int launcherGroup, QStrin
|
||||
|
||||
QString lName = (group == Types::LayoutLaunchers) ? layoutName : "";
|
||||
|
||||
foreach (auto applet, lattePlasmoids(lName)) {
|
||||
for(const auto applet : lattePlasmoids(lName)) {
|
||||
if (QQuickItem *appletInterface = applet->property("_plasma_graphicObject").value<QQuickItem *>()) {
|
||||
const auto &childItems = appletInterface->childItems();
|
||||
|
||||
@ -250,7 +250,7 @@ void LaunchersSignals::moveTask(QString layoutName, int senderId, int launcherGr
|
||||
|
||||
QString lName = (group == Types::LayoutLaunchers) ? layoutName : "";
|
||||
|
||||
foreach (auto applet, lattePlasmoids(lName)) {
|
||||
for(const auto applet : lattePlasmoids(lName)) {
|
||||
if (applet->id() != senderId) {
|
||||
if (QQuickItem *appletInterface = applet->property("_plasma_graphicObject").value<QQuickItem *>()) {
|
||||
const auto &childItems = appletInterface->childItems();
|
||||
@ -286,7 +286,7 @@ void LaunchersSignals::validateLaunchersOrder(QString layoutName, int senderId,
|
||||
|
||||
QString lName = (group == Types::LayoutLaunchers) ? layoutName : "";
|
||||
|
||||
foreach (auto applet, lattePlasmoids(lName)) {
|
||||
for(const auto applet : lattePlasmoids(lName)) {
|
||||
if (applet->id() != senderId) {
|
||||
if (QQuickItem *appletInterface = applet->property("_plasma_graphicObject").value<QQuickItem *>()) {
|
||||
const auto &childItems = appletInterface->childItems();
|
||||
|
@ -93,7 +93,7 @@ void Layout::syncToLayoutFile(bool removeLayoutId)
|
||||
|
||||
qDebug() << " LAYOUT :: " << m_layoutName << " is syncing its original file.";
|
||||
|
||||
foreach (auto containment, m_containments) {
|
||||
for (const auto containment : m_containments) {
|
||||
if (removeLayoutId) {
|
||||
containment->config().writeEntry("layoutId", "");
|
||||
}
|
||||
@ -124,11 +124,11 @@ void Layout::unloadContainments()
|
||||
<< " ,latteViews in memory ::: " << m_latteViews.size()
|
||||
<< " ,hidden latteViews in memory ::: " << m_waitingLatteViews.size();
|
||||
|
||||
foreach (auto view, m_latteViews) {
|
||||
for (const auto view : m_latteViews) {
|
||||
view->disconnectSensitiveSignals();
|
||||
}
|
||||
|
||||
foreach (auto view, m_waitingLatteViews) {
|
||||
for (const auto view : m_waitingLatteViews) {
|
||||
view->disconnectSensitiveSignals();
|
||||
}
|
||||
|
||||
@ -137,7 +137,7 @@ void Layout::unloadContainments()
|
||||
QList<Plasma::Containment *> systrays;
|
||||
|
||||
//!identify systrays and unload them first
|
||||
foreach (auto containment, m_containments) {
|
||||
for (const auto containment : m_containments) {
|
||||
if (Plasma::Applet *parentApplet = qobject_cast<Plasma::Applet *>(containment->parent())) {
|
||||
systrays.append(containment);
|
||||
}
|
||||
@ -199,7 +199,7 @@ void Layout::initToCorona(Latte::Corona *corona)
|
||||
m_shortcuts = new LayoutPart::Shortcuts(this);
|
||||
}
|
||||
|
||||
foreach (auto containment, m_corona->containments()) {
|
||||
for (const auto containment : m_corona->containments()) {
|
||||
if (m_corona->layoutManager()->memoryUsage() == Types::SingleLayout) {
|
||||
addContainment(containment);
|
||||
} else if (m_corona->layoutManager()->memoryUsage() == Types::MultipleLayouts) {
|
||||
@ -429,7 +429,7 @@ void Layout::renameLayout(QString newName)
|
||||
|
||||
//! thus this is a linked file
|
||||
if (m_corona) {
|
||||
foreach (auto containment, m_containments) {
|
||||
for (const auto containment : m_containments) {
|
||||
containment->config().writeEntry("layoutId", m_layoutName);
|
||||
}
|
||||
}
|
||||
@ -618,13 +618,13 @@ bool Layout::layoutIsBroken() const
|
||||
ids << containmentsEntries.groupList();
|
||||
conts << ids;
|
||||
|
||||
foreach (auto cId, containmentsEntries.groupList()) {
|
||||
for (const auto &cId : containmentsEntries.groupList()) {
|
||||
auto appletsEntries = containmentsEntries.group(cId).group("Applets");
|
||||
|
||||
QStringList validAppletIds;
|
||||
bool updated{false};
|
||||
|
||||
foreach (auto appletId, appletsEntries.groupList()) {
|
||||
for (const auto &appletId : appletsEntries.groupList()) {
|
||||
KConfigGroup appletGroup = appletsEntries.group(appletId);
|
||||
|
||||
if (appletGroupIsValid(appletGroup)) {
|
||||
@ -645,11 +645,11 @@ bool Layout::layoutIsBroken() const
|
||||
applets << validAppletIds;
|
||||
}
|
||||
} else {
|
||||
foreach (auto containment, m_containments) {
|
||||
for (const auto containment : m_containments) {
|
||||
ids << QString::number(containment->id());
|
||||
conts << QString::number(containment->id());
|
||||
|
||||
foreach (auto applet, containment->applets()) {
|
||||
for (const auto applet : containment->applets()) {
|
||||
ids << QString::number(applet->id());
|
||||
applets << QString::number(applet->id());
|
||||
}
|
||||
@ -681,7 +681,7 @@ bool Layout::layoutIsBroken() const
|
||||
qDebug() << "Containments :: " << conts;
|
||||
qDebug() << "Applets :: " << applets;
|
||||
|
||||
foreach (QString c, conts) {
|
||||
for (const QString &c : conts) {
|
||||
if (applets.contains(c)) {
|
||||
qDebug() << "Error: Same applet and containment id found ::: " << c;
|
||||
}
|
||||
@ -700,16 +700,16 @@ bool Layout::layoutIsBroken() const
|
||||
if (!m_corona) {
|
||||
KConfigGroup containmentsEntries = KConfigGroup(lFile, "Containments");
|
||||
|
||||
foreach (auto cId, containmentsEntries.groupList()) {
|
||||
for (const auto &cId : containmentsEntries.groupList()) {
|
||||
auto appletsEntries = containmentsEntries.group(cId).group("Applets");
|
||||
|
||||
qDebug() << " CONTAINMENT : " << cId << " APPLETS : " << appletsEntries.groupList();
|
||||
}
|
||||
} else {
|
||||
foreach (auto containment, m_containments) {
|
||||
for (const auto containment : m_containments) {
|
||||
QStringList appletsIds;
|
||||
|
||||
foreach (auto applet, containment->applets()) {
|
||||
for (const auto applet : containment->applets()) {
|
||||
appletsIds << QString::number(applet->id());
|
||||
}
|
||||
|
||||
@ -818,7 +818,7 @@ QHash<const Plasma::Containment *, Latte::View *> *Layout::latteViews()
|
||||
|
||||
Types::ViewType Layout::latteViewType(int containmentId) const
|
||||
{
|
||||
foreach (auto view, m_latteViews) {
|
||||
for (const auto view : m_latteViews) {
|
||||
if (view->containment() && view->containment()->id() == containmentId) {
|
||||
return view->type();
|
||||
}
|
||||
@ -839,7 +839,7 @@ QList<Latte::View *> Layout::sortedLatteViews()
|
||||
QList<Latte::View *> sortedViews;
|
||||
|
||||
//! create views list to be sorted out
|
||||
foreach (auto view, m_latteViews) {
|
||||
for (const auto view : m_latteViews) {
|
||||
sortedViews.append(view);
|
||||
}
|
||||
|
||||
@ -969,10 +969,10 @@ QList<Latte::View *> Layout::viewsWithPlasmaShortcuts()
|
||||
|
||||
QList<int> appletsWithShortcuts = m_corona->globalShortcuts()->shortcutsTracker()->appletsWithPlasmaShortcuts();
|
||||
|
||||
foreach(auto appletId, appletsWithShortcuts) {
|
||||
foreach(auto view, m_latteViews) {
|
||||
for (const auto &appletId : appletsWithShortcuts) {
|
||||
for (const auto view : m_latteViews) {
|
||||
bool found{false};
|
||||
foreach(auto applet, view->containment()->applets()) {
|
||||
for (const auto applet : view->containment()->applets()) {
|
||||
if (appletId == applet->id()) {
|
||||
if (!views.contains(view)) {
|
||||
views.append(view);
|
||||
@ -1142,7 +1142,7 @@ void Layout::addView(Plasma::Containment *containment, bool forceOnPrimary, int
|
||||
qDebug() << "add dock - connector : " << connector;
|
||||
bool found{false};
|
||||
|
||||
foreach (auto scr, qGuiApp->screens()) {
|
||||
for (const auto scr : qGuiApp->screens()) {
|
||||
if (scr && scr->name() == connector) {
|
||||
found = true;
|
||||
nextScreen = scr;
|
||||
@ -1167,7 +1167,7 @@ void Layout::addView(Plasma::Containment *containment, bool forceOnPrimary, int
|
||||
QString connector = m_corona->screenPool()->connector(id);
|
||||
qDebug() << "add dock - connector : " << connector;
|
||||
|
||||
foreach (auto view, m_latteViews) {
|
||||
for (const auto view : m_latteViews) {
|
||||
auto testContainment = view->containment();
|
||||
|
||||
int testScreenId = testContainment->screen();
|
||||
@ -1289,7 +1289,7 @@ void Layout::copyView(Plasma::Containment *containment)
|
||||
QString systrayAppletId;
|
||||
auto applets = containment->config().group("Applets");
|
||||
|
||||
foreach (auto applet, applets.groupList()) {
|
||||
for (const auto &applet : applets.groupList()) {
|
||||
KConfigGroup appletSettings = applets.group(applet).group("Configuration");
|
||||
|
||||
int tSysId = appletSettings.readEntry("SystrayContainmentId", -1);
|
||||
@ -1305,7 +1305,7 @@ void Layout::copyView(Plasma::Containment *containment)
|
||||
if (systrayId != -1) {
|
||||
Plasma::Containment *systray{nullptr};
|
||||
|
||||
foreach (auto containment, m_corona->containments()) {
|
||||
for (const auto containment : m_corona->containments()) {
|
||||
if (containment->id() == systrayId) {
|
||||
systray = containment;
|
||||
break;
|
||||
@ -1359,7 +1359,7 @@ void Layout::copyView(Plasma::Containment *containment)
|
||||
qDebug() << "COPY DOCK SCREEN ::: " << dockScrId;
|
||||
|
||||
if (dockScrId != -1 && screens.count() > 1) {
|
||||
foreach (auto scr, screens) {
|
||||
for (const auto scr : screens) {
|
||||
copyScrId = m_corona->screenPool()->id(scr->name());
|
||||
|
||||
//the screen must exist and not be the same with the original dock
|
||||
@ -1420,7 +1420,7 @@ void Layout::appletCreated(Plasma::Applet *applet)
|
||||
if (systrayId != -1) {
|
||||
uint sId = (uint)systrayId;
|
||||
|
||||
foreach (auto containment, m_corona->containments()) {
|
||||
for (const auto containment : m_corona->containments()) {
|
||||
if (containment->id() == sId) {
|
||||
containment->config().writeEntry("layoutId", m_layoutName);
|
||||
}
|
||||
@ -1535,13 +1535,13 @@ QString Layout::newUniqueIdsLayoutFromFile(QString file)
|
||||
//KConfigGroup copied_c1 = KConfigGroup(&copied_conts, QString::number(containment->id()));
|
||||
|
||||
//! Record the containment and applet ids
|
||||
foreach (auto cId, investigate_conts.groupList()) {
|
||||
for (const auto &cId : investigate_conts.groupList()) {
|
||||
toInvestigateContainmentIds << cId;
|
||||
auto appletsEntries = investigate_conts.group(cId).group("Applets");
|
||||
toInvestigateAppletIds << appletsEntries.groupList();
|
||||
|
||||
//! investigate for systrays
|
||||
foreach (auto appletId, appletsEntries.groupList()) {
|
||||
for (const auto &appletId : appletsEntries.groupList()) {
|
||||
KConfigGroup appletSettings = appletsEntries.group(appletId).group("Configuration");
|
||||
|
||||
int tSysId = appletSettings.readEntry("SystrayContainmentId", -1);
|
||||
@ -1558,14 +1558,14 @@ QString Layout::newUniqueIdsLayoutFromFile(QString file)
|
||||
}
|
||||
|
||||
//! Reassign containment and applet ids to unique ones
|
||||
foreach (auto contId, toInvestigateContainmentIds) {
|
||||
for (const auto &contId : toInvestigateContainmentIds) {
|
||||
QString newId = availableId(allIds, assignedIds, 12);
|
||||
|
||||
assignedIds << newId;
|
||||
assigned[contId] = newId;
|
||||
}
|
||||
|
||||
foreach (auto appId, toInvestigateAppletIds) {
|
||||
for (const auto &appId : toInvestigateAppletIds) {
|
||||
QString newId = availableId(allIds, assignedIds, 40);
|
||||
|
||||
assignedIds << newId;
|
||||
@ -1575,7 +1575,7 @@ QString Layout::newUniqueIdsLayoutFromFile(QString file)
|
||||
qDebug() << "ALL CORONA IDS ::: " << allIds;
|
||||
qDebug() << "FULL ASSIGNMENTS ::: " << assigned;
|
||||
|
||||
foreach (auto cId, toInvestigateContainmentIds) {
|
||||
for (const auto &cId : toInvestigateContainmentIds) {
|
||||
QString value = assigned[cId];
|
||||
|
||||
if (assigned.contains(value)) {
|
||||
@ -1589,7 +1589,7 @@ QString Layout::newUniqueIdsLayoutFromFile(QString file)
|
||||
}
|
||||
}
|
||||
|
||||
foreach (auto aId, toInvestigateAppletIds) {
|
||||
for (const auto &aId : toInvestigateAppletIds) {
|
||||
QString value = assigned[aId];
|
||||
|
||||
if (assigned.contains(value)) {
|
||||
@ -1606,13 +1606,13 @@ QString Layout::newUniqueIdsLayoutFromFile(QString file)
|
||||
qDebug() << "FIXED FULL ASSIGNMENTS ::: " << assigned;
|
||||
|
||||
//! update applet ids in their containment order and in MultipleLayouts update also the layoutId
|
||||
foreach (auto cId, investigate_conts.groupList()) {
|
||||
for (const auto &cId : investigate_conts.groupList()) {
|
||||
//! Update options that contain applet ids
|
||||
//! (appletOrder) and (lockedZoomApplets) and (userBlocksColorizingApplets)
|
||||
QStringList options;
|
||||
options << "appletOrder" << "lockedZoomApplets" << "userBlocksColorizingApplets";
|
||||
|
||||
foreach (auto settingStr, options) {
|
||||
for (const auto &settingStr : options) {
|
||||
QString order1 = investigate_conts.group(cId).group("General").readEntry(settingStr, QString());
|
||||
|
||||
if (!order1.isEmpty()) {
|
||||
@ -1634,7 +1634,7 @@ QString Layout::newUniqueIdsLayoutFromFile(QString file)
|
||||
}
|
||||
|
||||
//! must update also the systray id in its applet
|
||||
foreach (auto systrayId, toInvestigateSystrayContIds) {
|
||||
for (const auto &systrayId : toInvestigateSystrayContIds) {
|
||||
KConfigGroup systrayParentContainment = investigate_conts.group(systrayParentContainmentIds[systrayId]);
|
||||
systrayParentContainment.group("Applets").group(systrayAppletIds[systrayId]).group("Configuration").writeEntry("SystrayContainmentId", assigned[systrayId]);
|
||||
systrayParentContainment.sync();
|
||||
@ -1646,7 +1646,7 @@ QString Layout::newUniqueIdsLayoutFromFile(QString file)
|
||||
KSharedConfigPtr file2Ptr = KSharedConfig::openConfig(tempFile);
|
||||
KConfigGroup fixedNewContainmets = KConfigGroup(file2Ptr, "Containments");
|
||||
|
||||
foreach (auto contId, investigate_conts.groupList()) {
|
||||
for (const auto &contId : investigate_conts.groupList()) {
|
||||
QString pluginId = investigate_conts.group(contId).readEntry("plugin", "");
|
||||
|
||||
if (pluginId != "org.kde.desktopcontainment") { //!don't add ghost containments
|
||||
@ -1655,7 +1655,7 @@ QString Layout::newUniqueIdsLayoutFromFile(QString file)
|
||||
|
||||
newContainmentGroup.group("Applets").deleteGroup();
|
||||
|
||||
foreach (auto appId, investigate_conts.group(contId).group("Applets").groupList()) {
|
||||
for (const auto &appId : investigate_conts.group(contId).group("Applets").groupList()) {
|
||||
KConfigGroup appletGroup = investigate_conts.group(contId).group("Applets").group(appId);
|
||||
KConfigGroup newAppletGroup = fixedNewContainmets.group(assigned[contId]).group("Applets").group(assigned[appId]);
|
||||
appletGroup.copyTo(&newAppletGroup);
|
||||
@ -1679,7 +1679,7 @@ QList<Plasma::Containment *> Layout::importLayoutFile(QString file)
|
||||
QList<Plasma::Containment *> importedDocks;
|
||||
//QList<Plasma::Containment *> systrays;
|
||||
|
||||
foreach (auto containment, newContainments) {
|
||||
for (const auto containment : newContainments) {
|
||||
if (isLatteContainment(containment)) {
|
||||
qDebug() << "new latte containment id: " << containment->id();
|
||||
importedDocks << containment;
|
||||
@ -1688,7 +1688,7 @@ QList<Plasma::Containment *> Layout::importLayoutFile(QString file)
|
||||
|
||||
///after systrays were found we must update in latte the relevant ids
|
||||
/*if (!systrays.isEmpty()) {
|
||||
foreach (auto systray, systrays) {
|
||||
for (const auto systray : systrays) {
|
||||
qDebug() << "systray found with id : " << systray->id();
|
||||
Plasma::Applet *parentApplet = qobject_cast<Plasma::Applet *>(systray->parent());
|
||||
|
||||
@ -1752,7 +1752,7 @@ void Layout::syncLatteViewsToScreens()
|
||||
QString prmScreenName = qGuiApp->primaryScreen()->name();
|
||||
|
||||
//! first step: primary docks must be placed in primary screen free edges
|
||||
foreach (auto containment, m_containments) {
|
||||
for (const auto containment : m_containments) {
|
||||
if (isLatteContainment(containment)) {
|
||||
int screenId = 0;
|
||||
|
||||
@ -1787,7 +1787,7 @@ void Layout::syncLatteViewsToScreens()
|
||||
}
|
||||
|
||||
//! second step: explicit docks must be placed in their screens if the screen edge is free
|
||||
foreach (auto containment, m_containments) {
|
||||
for (const auto containment : m_containments) {
|
||||
if (isLatteContainment(containment)) {
|
||||
int screenId = 0;
|
||||
|
||||
@ -1830,7 +1830,7 @@ void Layout::syncLatteViewsToScreens()
|
||||
qDebug() << "FUTURESHOWNVIEWS MUST BE :: " << futureShownViews;
|
||||
|
||||
//! add views
|
||||
foreach (auto containment, m_containments) {
|
||||
for (const auto containment : m_containments) {
|
||||
int screenId = containment->screen();
|
||||
|
||||
if (screenId == -1) {
|
||||
@ -1844,7 +1844,7 @@ void Layout::syncLatteViewsToScreens()
|
||||
}
|
||||
|
||||
//! remove views
|
||||
foreach (auto view, m_latteViews) {
|
||||
for (const auto view : m_latteViews) {
|
||||
if (view->containment() && !futureShownViews.contains(view->containment()->id())) {
|
||||
qDebug() << "syncLatteViewsToScreens: view must be deleted... for containment:" << view->containment()->id() << " at screen:" << view->positioner()->currentScreenName();
|
||||
auto viewToDelete = m_latteViews.take(view->containment());
|
||||
@ -1854,7 +1854,7 @@ void Layout::syncLatteViewsToScreens()
|
||||
}
|
||||
|
||||
//! reconsider views
|
||||
foreach (auto view, m_latteViews) {
|
||||
for (const auto view : m_latteViews) {
|
||||
if (view->containment() && futureShownViews.contains(view->containment()->id())) {
|
||||
//! if the dock will not be deleted its a very good point to reconsider
|
||||
//! if the screen in which is running is the correct one
|
||||
@ -1875,7 +1875,7 @@ void Layout::assignToLayout(Latte::View *latteView, QList<Plasma::Containment *>
|
||||
m_latteViews[latteView->containment()] = latteView;
|
||||
m_containments << containments;
|
||||
|
||||
foreach (auto containment, containments) {
|
||||
for (const auto containment : containments) {
|
||||
containment->config().writeEntry("layoutId", name());
|
||||
|
||||
connect(containment, &QObject::destroyed, this, &Layout::containmentDestroyed);
|
||||
@ -1904,7 +1904,7 @@ QList<Plasma::Containment *> Layout::unassignFromLayout(Latte::View *latteView)
|
||||
|
||||
containments << latteView->containment();
|
||||
|
||||
foreach (auto containment, m_containments) {
|
||||
for (const auto containment : m_containments) {
|
||||
Plasma::Applet *parentApplet = qobject_cast<Plasma::Applet *>(containment->parent());
|
||||
|
||||
//! add systrays from that latteView
|
||||
@ -1916,7 +1916,7 @@ QList<Plasma::Containment *> Layout::unassignFromLayout(Latte::View *latteView)
|
||||
}
|
||||
}
|
||||
|
||||
foreach (auto containment, containments) {
|
||||
for (const auto containment : containments) {
|
||||
m_containments.removeAll(containment);
|
||||
}
|
||||
|
||||
@ -1951,7 +1951,7 @@ QList<Plasma::Types::Location> Layout::availableEdgesForView(QScreen *scr, Latte
|
||||
return edges;
|
||||
}
|
||||
|
||||
foreach (auto view, m_latteViews) {
|
||||
for (const auto view : m_latteViews) {
|
||||
//! make sure that availabe edges takes into account only views that should be excluded,
|
||||
//! this is why the forView should not be excluded
|
||||
if (view && view != forView && view->positioner()->currentScreenName() == scr->name()) {
|
||||
@ -1972,7 +1972,7 @@ QList<int> Layout::qmlFreeEdges(int screen) const
|
||||
const auto edges = freeEdges(screen);
|
||||
QList<int> edgesInt;
|
||||
|
||||
foreach (Plasma::Types::Location edge, edges) {
|
||||
for (const Plasma::Types::Location &edge : edges) {
|
||||
edgesInt.append(static_cast<int>(edge));
|
||||
}
|
||||
|
||||
@ -1989,7 +1989,7 @@ QList<Plasma::Types::Location> Layout::freeEdges(QScreen *scr) const
|
||||
return edges;
|
||||
}
|
||||
|
||||
foreach (auto view, m_latteViews) {
|
||||
for (const auto view : m_latteViews) {
|
||||
if (view && view->positioner()->currentScreenName() == scr->name()) {
|
||||
edges.removeOne(view->location());
|
||||
}
|
||||
@ -2010,7 +2010,7 @@ QList<Plasma::Types::Location> Layout::freeEdges(int screen) const
|
||||
|
||||
QScreen *scr = m_corona->screenPool()->screenForId(screen);
|
||||
|
||||
foreach (auto view, m_latteViews) {
|
||||
for (const auto view : m_latteViews) {
|
||||
if (view && scr && view->positioner()->currentScreenName() == scr->name()) {
|
||||
edges.removeOne(view->location());
|
||||
}
|
||||
@ -2025,7 +2025,7 @@ bool Layout::explicitDockOccupyEdge(int screen, Plasma::Types::Location location
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach (auto containment, m_containments) {
|
||||
for (const auto containment : m_containments) {
|
||||
if (isLatteContainment(containment)) {
|
||||
bool onPrimary = containment->config().readEntry("onPrimary", true);
|
||||
int id = containment->lastScreen();
|
||||
@ -2046,7 +2046,7 @@ bool Layout::primaryDockOccupyEdge(Plasma::Types::Location location) const
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach (auto containment, m_containments) {
|
||||
for (const auto containment : m_containments) {
|
||||
if (isLatteContainment(containment)) {
|
||||
bool onPrimary = containment->config().readEntry("onPrimary", true);
|
||||
Plasma::Types::Location contLocation = containment->location();
|
||||
@ -2081,7 +2081,7 @@ int Layout::viewsWithTasks() const
|
||||
|
||||
int result = 0;
|
||||
|
||||
foreach (auto view, m_latteViews) {
|
||||
for (const auto view : m_latteViews) {
|
||||
if (view->tasksPresent()) {
|
||||
result++;
|
||||
}
|
||||
@ -2100,7 +2100,7 @@ int Layout::viewsCount(int screen) const
|
||||
|
||||
int docks{0};
|
||||
|
||||
foreach (auto view, m_latteViews) {
|
||||
for (const auto view : m_latteViews) {
|
||||
if (view && view->screen() == scr && !view->containment()->destroyed()) {
|
||||
++docks;
|
||||
}
|
||||
@ -2117,7 +2117,7 @@ int Layout::viewsCount(QScreen *screen) const
|
||||
|
||||
int docks{0};
|
||||
|
||||
foreach (auto view, m_latteViews) {
|
||||
for (const auto view : m_latteViews) {
|
||||
if (view && view->screen() == screen && !view->containment()->destroyed()) {
|
||||
++docks;
|
||||
}
|
||||
@ -2134,7 +2134,7 @@ int Layout::viewsCount() const
|
||||
|
||||
int docks{0};
|
||||
|
||||
foreach (auto view, m_latteViews) {
|
||||
for (const auto view : m_latteViews) {
|
||||
if (view && view->containment() && !view->containment()->destroyed()) {
|
||||
++docks;
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ void LayoutManager::load()
|
||||
void LayoutManager::unload()
|
||||
{
|
||||
//! Unload all Layouts
|
||||
foreach (auto layout, m_activeLayouts) {
|
||||
for (const auto layout : m_activeLayouts) {
|
||||
if (memoryUsage() == Types::MultipleLayouts && layout->isOriginalLayout()) {
|
||||
layout->syncToLayoutFile(true);
|
||||
}
|
||||
@ -220,7 +220,7 @@ QStringList LayoutManager::menuLayouts() const
|
||||
if (!fixedMenuLayouts.contains(currentLayoutName()) && memoryUsage() == Types::SingleLayout) {
|
||||
fixedMenuLayouts.prepend(currentLayoutName());
|
||||
} else if (memoryUsage() == Types::MultipleLayouts) {
|
||||
foreach (auto layout, m_activeLayouts) {
|
||||
for (const auto layout : m_activeLayouts) {
|
||||
if (layout->isOriginalLayout() && !fixedMenuLayouts.contains(layout->name())) {
|
||||
fixedMenuLayouts.prepend(layout->name());
|
||||
}
|
||||
@ -254,7 +254,7 @@ QStringList LayoutManager::orphanedActivities()
|
||||
{
|
||||
QStringList orphans;
|
||||
|
||||
foreach (auto activity, activities()) {
|
||||
for (const auto &activity : activities()) {
|
||||
if (m_assignedLayouts[activity].isEmpty()) {
|
||||
orphans.append(activity);
|
||||
}
|
||||
@ -313,7 +313,7 @@ void LayoutManager::addView(Plasma::Containment *containment, bool forceLoading,
|
||||
|
||||
bool LayoutManager::latteViewExists(Latte::View *view) const
|
||||
{
|
||||
foreach (auto layout, m_activeLayouts) {
|
||||
for (const auto layout : m_activeLayouts) {
|
||||
for (auto it = layout->latteViews()->constBegin(), end = layout->latteViews()->constEnd(); it != end; ++it) {
|
||||
if (it.value() == view) {
|
||||
return true;
|
||||
@ -378,13 +378,13 @@ Layout *LayoutManager::currentLayout() const
|
||||
if (memoryUsage() == Types::SingleLayout) {
|
||||
return m_activeLayouts.at(0);
|
||||
} else {
|
||||
foreach (auto layout, m_activeLayouts) {
|
||||
for (auto layout : m_activeLayouts) {
|
||||
if (layout->activities().contains(m_corona->m_activityConsumer->currentActivity())) {
|
||||
return layout;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (auto layout, m_activeLayouts) {
|
||||
for (auto layout : m_activeLayouts) {
|
||||
if ((layout->name() != Layout::MultipleLayoutsName) && (layout->activities().isEmpty())) {
|
||||
return layout;
|
||||
}
|
||||
@ -396,7 +396,7 @@ Layout *LayoutManager::currentLayout() const
|
||||
|
||||
void LayoutManager::updateCurrentLayoutNameInMultiEnvironment()
|
||||
{
|
||||
foreach (auto layout, m_activeLayouts) {
|
||||
for (const auto layout : m_activeLayouts) {
|
||||
if (layout->isOriginalLayout() && layout->activities().contains(m_corona->activitiesConsumer()->currentActivity())) {
|
||||
m_currentLayoutNameInMultiEnvironment = layout->name();
|
||||
emit currentLayoutNameChanged();
|
||||
@ -404,7 +404,7 @@ void LayoutManager::updateCurrentLayoutNameInMultiEnvironment()
|
||||
}
|
||||
}
|
||||
|
||||
foreach (auto layout, m_activeLayouts) {
|
||||
for (const auto layout : m_activeLayouts) {
|
||||
if (layout->isOriginalLayout() && layout->activities().isEmpty()) {
|
||||
m_currentLayoutNameInMultiEnvironment = layout->name();
|
||||
emit currentLayoutNameChanged();
|
||||
@ -485,13 +485,13 @@ void LayoutManager::loadLayouts()
|
||||
filter.append(QString("*.layout.latte"));
|
||||
QStringList files = layoutDir.entryList(filter, QDir::Files | QDir::NoSymLinks);
|
||||
|
||||
foreach (auto layout, files) {
|
||||
for (const auto &layout : files) {
|
||||
Layout layoutSets(this, layoutDir.absolutePath() + "/" + layout);
|
||||
|
||||
QStringList validActivityIds = validActivities(layoutSets.activities());
|
||||
layoutSets.setActivities(validActivityIds);
|
||||
|
||||
foreach (auto activity, validActivityIds) {
|
||||
for (const auto &activity : validActivityIds) {
|
||||
m_assignedLayouts[activity] = layoutSets.name();
|
||||
}
|
||||
|
||||
@ -559,7 +559,7 @@ void LayoutManager::loadLatteLayout(QString layoutPath)
|
||||
|
||||
qDebug() << "TASKS WILL BE PRESENT AFTER LOADING ::: " << tasksWillBeLoaded;
|
||||
|
||||
foreach (auto containment, m_corona->containments()) {
|
||||
for (const auto containment : m_corona->containments()) {
|
||||
//! forceDockLoading is used when a latte configuration based on the
|
||||
//! current running screens does not provide a dock containing tasks.
|
||||
//! in such case the lowest latte containment containing tasks is loaded
|
||||
@ -582,7 +582,7 @@ void LayoutManager::cleanupOnStartup(QString path)
|
||||
|
||||
QStringList deprecatedActionGroup;
|
||||
|
||||
foreach (auto actId, actionGroups.groupList()) {
|
||||
for (const auto &actId : actionGroups.groupList()) {
|
||||
QString pluginId = actionGroups.group(actId).readEntry("RightButton;NoModifier", "");
|
||||
|
||||
if (pluginId == "org.kde.contextmenu") {
|
||||
@ -590,7 +590,7 @@ void LayoutManager::cleanupOnStartup(QString path)
|
||||
}
|
||||
}
|
||||
|
||||
foreach (auto pId, deprecatedActionGroup) {
|
||||
for (const auto &pId : deprecatedActionGroup) {
|
||||
qDebug() << "!!!!!!!!!!!!!!!! !!!!!!!!!!!! !!!!!!! REMOVING :::: " << pId;
|
||||
actionGroups.group(pId).deleteGroup();
|
||||
}
|
||||
@ -599,7 +599,7 @@ void LayoutManager::cleanupOnStartup(QString path)
|
||||
|
||||
QStringList removeContaimentsList;
|
||||
|
||||
foreach (auto cId, containmentGroups.groupList()) {
|
||||
for (const auto &cId : containmentGroups.groupList()) {
|
||||
QString pluginId = containmentGroups.group(cId).readEntry("plugin", "");
|
||||
|
||||
if (pluginId == "org.kde.desktopcontainment") { //!must remove ghost containments first
|
||||
@ -607,7 +607,7 @@ void LayoutManager::cleanupOnStartup(QString path)
|
||||
}
|
||||
}
|
||||
|
||||
foreach (auto cId, removeContaimentsList) {
|
||||
for (const auto &cId : removeContaimentsList) {
|
||||
containmentGroups.group(cId).deleteGroup();
|
||||
}
|
||||
|
||||
@ -629,7 +629,7 @@ void LayoutManager::importLatteLayout(QString layoutPath)
|
||||
|
||||
void LayoutManager::hideAllViews()
|
||||
{
|
||||
foreach (auto layout, m_activeLayouts) {
|
||||
for (const auto layout : m_activeLayouts) {
|
||||
if (layout->isOriginalLayout()) {
|
||||
emit currentLayoutIsSwitching(layout->name());
|
||||
}
|
||||
@ -671,7 +671,7 @@ bool LayoutManager::switchToLayout(QString layoutName, int previousMemoryUsage)
|
||||
//! send the layouts that will be changed. This signal creates the
|
||||
//! nice animation that hides these docks/panels
|
||||
if (previousMemoryUsage != -1) {
|
||||
foreach (auto layout, m_activeLayouts) {
|
||||
for (const auto layout : m_activeLayouts) {
|
||||
if (layout->isOriginalLayout()) {
|
||||
emit currentLayoutIsSwitching(layout->name());
|
||||
}
|
||||
@ -694,7 +694,7 @@ bool LayoutManager::switchToLayout(QString layoutName, int previousMemoryUsage)
|
||||
|
||||
Layout *activeForOrphans{nullptr};
|
||||
|
||||
foreach (auto fromLayout, m_activeLayouts) {
|
||||
for (const auto fromLayout : m_activeLayouts) {
|
||||
if (fromLayout->isOriginalLayout() && fromLayout->activities().isEmpty()) {
|
||||
activeForOrphans = fromLayout;
|
||||
break;
|
||||
@ -770,7 +770,7 @@ bool LayoutManager::switchToLayout(QString layoutName, int previousMemoryUsage)
|
||||
QStringList assignedActivities = orphanedLayout ? orphanedActivities() : layout.activities();
|
||||
|
||||
if (!orphanedLayout) {
|
||||
foreach (auto assignedActivity, assignedActivities) {
|
||||
for (const auto &assignedActivity : assignedActivities) {
|
||||
//! Starting the activities must be done asynchronous because otherwise
|
||||
//! the activity manager cant close multiple activities
|
||||
QTimer::singleShot(i * 1000, [this, assignedActivity, lastUsedActivity]() {
|
||||
@ -789,7 +789,7 @@ bool LayoutManager::switchToLayout(QString layoutName, int previousMemoryUsage)
|
||||
}
|
||||
} else {
|
||||
//! orphaned layout
|
||||
foreach (auto assignedActivity, assignedActivities) {
|
||||
for (const auto &assignedActivity : assignedActivities) {
|
||||
if (lastUsedActivity == assignedActivity) {
|
||||
lastUsedActivityFound = true;
|
||||
}
|
||||
@ -845,7 +845,7 @@ void LayoutManager::syncMultipleLayoutsToActivities(QString layoutForOrphans)
|
||||
layoutForOrphans = m_corona->universalSettings()->lastNonAssignedLayoutName();
|
||||
}
|
||||
|
||||
foreach (auto activity, runningActivities()) {
|
||||
for (const auto &activity : runningActivities()) {
|
||||
if (!m_assignedLayouts[activity].isEmpty()) {
|
||||
if (!layoutsToLoad.contains(m_assignedLayouts[activity])) {
|
||||
layoutsToLoad.append(m_assignedLayouts[activity]);
|
||||
@ -855,7 +855,7 @@ void LayoutManager::syncMultipleLayoutsToActivities(QString layoutForOrphans)
|
||||
}
|
||||
}
|
||||
|
||||
foreach (auto layout, m_activeLayouts) {
|
||||
for (const auto layout : m_activeLayouts) {
|
||||
QString tempLayoutName;
|
||||
|
||||
if (!layoutsToLoad.contains(layout->name()) && layout->name() != layoutForOrphans) {
|
||||
@ -871,7 +871,7 @@ void LayoutManager::syncMultipleLayoutsToActivities(QString layoutForOrphans)
|
||||
}
|
||||
|
||||
//! Unload no needed Layouts
|
||||
foreach (auto layoutName, layoutsToUnload) {
|
||||
for (const auto &layoutName : layoutsToUnload) {
|
||||
if (layoutName != Layout::MultipleLayoutsName) {
|
||||
Layout *layout = activeLayout(layoutName);
|
||||
int posLayout = activeLayoutPos(layoutName);
|
||||
@ -906,7 +906,7 @@ void LayoutManager::syncMultipleLayoutsToActivities(QString layoutForOrphans)
|
||||
}
|
||||
|
||||
//! Add needed Layouts based on Activities
|
||||
foreach (auto layoutName, layoutsToLoad) {
|
||||
for (const auto &layoutName : layoutsToLoad) {
|
||||
if (!activeLayout(layoutName)) {
|
||||
Layout *newLayout = new Layout(this, QString(layoutPath(layoutName)), layoutName);
|
||||
|
||||
@ -934,7 +934,7 @@ void LayoutManager::pauseLayout(QString layoutName)
|
||||
if (layout && !layout->activities().isEmpty()) {
|
||||
int i = 0;
|
||||
|
||||
foreach (auto activityId, layout->activities()) {
|
||||
for (const auto &activityId : layout->activities()) {
|
||||
//! Stopping the activities must be done asynchronous because otherwise
|
||||
//! the activity manager cant close multiple activities
|
||||
QTimer::singleShot(i * 1000, [this, activityId]() {
|
||||
@ -950,7 +950,7 @@ void LayoutManager::pauseLayout(QString layoutName)
|
||||
void LayoutManager::syncActiveLayoutsToOriginalFiles()
|
||||
{
|
||||
if (memoryUsage() == Types::MultipleLayouts) {
|
||||
foreach (auto layout, m_activeLayouts) {
|
||||
for (const auto layout : m_activeLayouts) {
|
||||
if (layout->isOriginalLayout()) {
|
||||
layout->syncToLayoutFile();
|
||||
}
|
||||
@ -966,7 +966,7 @@ void LayoutManager::clearUnloadedContainmentsFromLinkedFile(QStringList containm
|
||||
|
||||
auto containments = m_corona->config()->group("Containments");
|
||||
|
||||
foreach (auto conId, containmentsIds) {
|
||||
for (const auto &conId : containmentsIds) {
|
||||
qDebug() << "unloads ::: " << conId;
|
||||
KConfigGroup containment = containments.group(conId);
|
||||
containment.deleteGroup();
|
||||
@ -978,7 +978,7 @@ void LayoutManager::clearUnloadedContainmentsFromLinkedFile(QStringList containm
|
||||
|
||||
void LayoutManager::syncLatteViewsToScreens()
|
||||
{
|
||||
foreach (auto layout, m_activeLayouts) {
|
||||
for (const auto layout : m_activeLayouts) {
|
||||
layout->syncLatteViewsToScreens();
|
||||
}
|
||||
}
|
||||
@ -1013,7 +1013,7 @@ QString LayoutManager::newLayout(QString layoutName, QString preset)
|
||||
//! in it will be loaded taking into account also the screens are present.
|
||||
bool LayoutManager::heuresticForLoadingViewWithTasks(int *firstContainmentWithTasks)
|
||||
{
|
||||
foreach (auto containment, m_corona->containments()) {
|
||||
for (const auto containment : m_corona->containments()) {
|
||||
QString plugin = containment->pluginMetaData().pluginId();
|
||||
|
||||
if (plugin == "org.kde.latte.containment") {
|
||||
@ -1025,7 +1025,7 @@ bool LayoutManager::heuresticForLoadingViewWithTasks(int *firstContainmentWithTa
|
||||
|
||||
bool containsTasks = false;
|
||||
|
||||
foreach (auto applet, containment->applets()) {
|
||||
for (const auto applet : containment->applets()) {
|
||||
const auto &provides = KPluginMetaData::readStringList(applet->pluginMetaData().rawData(), QStringLiteral("X-Plasma-Provides"));
|
||||
|
||||
if (provides.contains(QLatin1String("org.kde.plasma.multitasking"))) {
|
||||
@ -1043,7 +1043,7 @@ bool LayoutManager::heuresticForLoadingViewWithTasks(int *firstContainmentWithTa
|
||||
if (lastScreen >= 0) {
|
||||
QString connector = m_corona->screenPool()->connector(lastScreen);
|
||||
|
||||
foreach (auto scr, qGuiApp->screens()) {
|
||||
for (const auto scr : qGuiApp->screens()) {
|
||||
if (scr && scr->name() == connector) {
|
||||
return true;
|
||||
break;
|
||||
@ -1120,7 +1120,7 @@ QStringList LayoutManager::validActivities(QStringList currentList)
|
||||
{
|
||||
QStringList validIds;
|
||||
|
||||
foreach (auto activity, currentList) {
|
||||
for (const auto &activity : currentList) {
|
||||
if (activities().contains(activity)) {
|
||||
validIds.append(activity);
|
||||
}
|
||||
@ -1172,7 +1172,7 @@ void LayoutManager::hideLatteSettingsDialog()
|
||||
|
||||
void LayoutManager::showInfoWindow(QString info, int duration, QStringList activities)
|
||||
{
|
||||
foreach (auto screen, qGuiApp->screens()) {
|
||||
for (const auto screen : qGuiApp->screens()) {
|
||||
InfoView *infoView = new InfoView(m_corona, info, screen);
|
||||
|
||||
infoView->show();
|
||||
|
@ -151,7 +151,7 @@ int main(int argc, char **argv)
|
||||
if (layouts.count() > 0) {
|
||||
qInfo() << i18n("Available layouts that can be used to start Latte:");
|
||||
|
||||
foreach (auto layout, layouts) {
|
||||
for (const auto &layout : layouts) {
|
||||
qInfo() << " " << layout;
|
||||
}
|
||||
} else {
|
||||
|
@ -75,7 +75,7 @@ void ScreenPool::load()
|
||||
|
||||
bool updated{false};
|
||||
|
||||
foreach (auto screenId, m_screensGroup.keyList()) {
|
||||
for (const auto &screenId : m_screensGroup.keyList()) {
|
||||
QString screenName = m_screensGroup.readEntry(screenId, QString());
|
||||
if (screenId != 0) {
|
||||
int scrId = screenId.toInt();
|
||||
@ -94,7 +94,7 @@ void ScreenPool::load()
|
||||
|
||||
if (updated) {
|
||||
qDebug() << "---------------- Plasma Screen Ids ------------------";
|
||||
foreach (auto id, m_connectorForId.keys()) {
|
||||
for (const auto &id : m_connectorForId.keys()) {
|
||||
qDebug() << id << " __ " << m_connectorForId[id];
|
||||
}
|
||||
qDebug() << "---------------- --------------- ------------------";
|
||||
|
@ -256,7 +256,7 @@ void Theme::updateReversedSchemeValues()
|
||||
KSharedConfigPtr reversedPtr = KSharedConfig::openConfig(m_reversedSchemePath);
|
||||
|
||||
if (originalPtr && reversedPtr) {
|
||||
foreach (auto groupName, reversedPtr->groupList()) {
|
||||
for (const auto &groupName : reversedPtr->groupList()) {
|
||||
if (groupName != "Colors:Button") {
|
||||
KConfigGroup reversedGroup(reversedPtr, groupName);
|
||||
|
||||
@ -579,7 +579,7 @@ void Theme::parseThemeSvgFiles()
|
||||
float opacity{1};
|
||||
float fillOpacity{1};
|
||||
|
||||
foreach (QString value, styleValues) {
|
||||
for (QString &value : styleValues) {
|
||||
if (value.startsWith("opacity:")) {
|
||||
opacity = value.remove(0,8).toFloat();
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ void ScreenPool::load()
|
||||
}
|
||||
|
||||
//restore the known ids to connector mappings
|
||||
foreach (const QString &key, m_configGroup.keyList()) {
|
||||
for (const QString &key : m_configGroup.keyList()) {
|
||||
QString connector = m_configGroup.readEntry(key, QString());
|
||||
qDebug() << "connector :" << connector << " - " << key;
|
||||
|
||||
@ -210,7 +210,7 @@ int ScreenPool::firstAvailableId() const
|
||||
|
||||
//find the first integer not stored in m_connectorForId
|
||||
//m_connectorForId is the only map, so the ids are sorted
|
||||
foreach (int existingId, m_connectorForId.keys()) {
|
||||
for (const int &existingId : m_connectorForId.keys()) {
|
||||
if (i != existingId) {
|
||||
return i;
|
||||
}
|
||||
@ -231,7 +231,7 @@ bool ScreenPool::screenExists(int id)
|
||||
if (id != -1 && knownIds().contains(id)) {
|
||||
QString scrName = connector(id);
|
||||
|
||||
foreach (auto scr, qGuiApp->screens()) {
|
||||
for (const auto scr : qGuiApp->screens()) {
|
||||
if (scr->name() == scrName) {
|
||||
return true;
|
||||
}
|
||||
@ -249,7 +249,7 @@ QScreen *ScreenPool::screenForId(int id)
|
||||
if (id != -1 && knownIds().contains(id)) {
|
||||
QString scrName = connector(id);
|
||||
|
||||
foreach (auto scr, screens) {
|
||||
for (const auto scr : screens) {
|
||||
if (scr->name() == scrName) {
|
||||
return scr;
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ QWidget *ActivityCmbBoxDelegate::createEditor(QWidget *parent, const QStyleOptio
|
||||
|
||||
QStringList shownActivities;
|
||||
|
||||
foreach (auto activity, activities) {
|
||||
for (const auto &activity : activities) {
|
||||
if (assignedActivities.contains(activity) || availableActivities.contains(activity)) {
|
||||
shownActivities.append(activity);
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ SettingsDialog::SettingsDialog(QWidget *parent, Latte::Corona *corona)
|
||||
QStringList files = layoutDir.entryList(filter, QDir::Files | QDir::NoSymLinks);
|
||||
QStringList colors;
|
||||
|
||||
foreach (auto file, files) {
|
||||
for (auto &file : files) {
|
||||
int colorEnd = file.lastIndexOf("print.jpg");
|
||||
QString color = file.remove(colorEnd, 9);
|
||||
colors.append(color);
|
||||
@ -249,7 +249,7 @@ SettingsDialog::~SettingsDialog()
|
||||
m_inMemoryButtons->deleteLater();
|
||||
m_mouseSensitivityButtons->deleteLater();
|
||||
|
||||
foreach (auto tempDir, m_tempDirectories) {
|
||||
for (const auto &tempDir : m_tempDirectories) {
|
||||
QDir tDir(tempDir);
|
||||
|
||||
if (tDir.exists() && tempDir.startsWith("/tmp/")) {
|
||||
@ -297,7 +297,7 @@ void SettingsDialog::on_newButton_clicked()
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
|
||||
//! find Default preset path
|
||||
foreach (auto preset, m_corona->layoutManager()->presetsPaths()) {
|
||||
for (const auto &preset : m_corona->layoutManager()->presetsPaths()) {
|
||||
QString presetName = Layout::layoutName(preset);
|
||||
|
||||
if (presetName == "Default") {
|
||||
@ -371,8 +371,8 @@ void SettingsDialog::on_downloadButton_clicked()
|
||||
bool layoutAdded{false};
|
||||
|
||||
if (!dialog.changedEntries().isEmpty() || !dialog.installedEntries().isEmpty()) {
|
||||
foreach (auto entry, dialog.installedEntries()) {
|
||||
foreach (auto entryFile, entry.installedFiles()) {
|
||||
for (const auto &entry : dialog.installedEntries()) {
|
||||
for (const auto &entryFile : entry.installedFiles()) {
|
||||
Importer::LatteFileVersion version = Importer::fileVersion(entryFile);
|
||||
|
||||
if (version == Importer::LayoutVersion2) {
|
||||
@ -533,7 +533,7 @@ bool SettingsDialog::importLayoutsFromV1ConfigFile(QString file)
|
||||
|
||||
const auto archiveRootDir = archive.directory();
|
||||
|
||||
foreach (auto &name, archiveRootDir->entries()) {
|
||||
for (const auto &name : archiveRootDir->entries()) {
|
||||
auto fileEntry = archiveRootDir->file(name);
|
||||
fileEntry->copyTo(tempDir.absolutePath());
|
||||
}
|
||||
@ -739,7 +739,7 @@ void SettingsDialog::restoreDefaults()
|
||||
|
||||
if (ui->tabWidget->currentIndex() == 0) {
|
||||
//! Default layouts missing from layouts list
|
||||
foreach (auto preset, m_corona->layoutManager()->presetsPaths()) {
|
||||
for (const auto &preset : m_corona->layoutManager()->presetsPaths()) {
|
||||
QString presetName = Layout::layoutName(preset);
|
||||
QByteArray presetNameChars = presetName.toUtf8();
|
||||
const char *prset_str = presetNameChars.data();
|
||||
@ -832,7 +832,7 @@ void SettingsDialog::loadSettings()
|
||||
m_corona->layoutManager()->syncActiveLayoutsToOriginalFiles();
|
||||
}
|
||||
|
||||
foreach (auto layout, m_corona->layoutManager()->layouts()) {
|
||||
for (const auto layout : m_corona->layoutManager()->layouts()) {
|
||||
QString layoutPath = QDir::homePath() + "/.config/latte/" + layout + ".layout.latte";
|
||||
m_initLayoutPaths.append(layoutPath);
|
||||
|
||||
@ -1190,7 +1190,7 @@ void SettingsDialog::updateApplyButtonsState()
|
||||
|
||||
bool layoutMissing{false};
|
||||
|
||||
foreach (auto preset, m_corona->layoutManager()->presetsPaths()) {
|
||||
for (const auto &preset : m_corona->layoutManager()->presetsPaths()) {
|
||||
QString presetName = Layout::layoutName(preset);
|
||||
QByteArray presetNameChars = presetName.toUtf8();
|
||||
const char *prset_str = presetNameChars.data();
|
||||
@ -1282,7 +1282,7 @@ void SettingsDialog::recalculateAvailableActivities()
|
||||
for (int i = 0; i < m_model->rowCount(); ++i) {
|
||||
QStringList assigned = m_model->data(m_model->index(i, ACTIVITYCOLUMN), Qt::UserRole).toStringList();
|
||||
|
||||
foreach (auto activity, assigned) {
|
||||
for (const auto &activity : assigned) {
|
||||
if (tempActivities.contains(activity)) {
|
||||
tempActivities.removeAll(activity);
|
||||
}
|
||||
@ -1368,7 +1368,7 @@ bool SettingsDialog::saveAllChanges()
|
||||
QHash<QString, Layout *> activeLayoutsToRename;
|
||||
|
||||
//! remove layouts that have been removed from the user
|
||||
foreach (auto initLayout, m_initLayoutPaths) {
|
||||
for (const auto &initLayout : m_initLayoutPaths) {
|
||||
if (!idExistsInModel(initLayout)) {
|
||||
QFile(initLayout).remove();
|
||||
|
||||
@ -1392,7 +1392,7 @@ bool SettingsDialog::saveAllChanges()
|
||||
QStringList cleanedActivities;
|
||||
|
||||
//!update only activities that are valid
|
||||
foreach (auto activity, lActivities) {
|
||||
for (const auto &activity : lActivities) {
|
||||
if (knownActivities.contains(activity)) {
|
||||
cleanedActivities.append(activity);
|
||||
}
|
||||
@ -1491,7 +1491,7 @@ bool SettingsDialog::saveAllChanges()
|
||||
QString orphanedLayout;
|
||||
|
||||
if (m_corona->layoutManager()->memoryUsage() == Types::MultipleLayouts) {
|
||||
foreach (auto newLayoutName, activeLayoutsToRename.keys()) {
|
||||
for (const auto &newLayoutName : activeLayoutsToRename.keys()) {
|
||||
qDebug() << " Active Layout Is Renamed From : " << activeLayoutsToRename[newLayoutName]->name() << " TO :: " << newLayoutName;
|
||||
Layout *layout = activeLayoutsToRename[newLayoutName];
|
||||
layout->renameLayout(newLayoutName);
|
||||
|
@ -229,7 +229,7 @@ void GlobalShortcuts::activateLauncherMenu()
|
||||
sortedViews = currentLayout->sortedLatteViews();
|
||||
}
|
||||
|
||||
foreach (auto view, sortedViews) {
|
||||
for (const auto view : sortedViews) {
|
||||
const auto applets = view->containment()->applets();
|
||||
|
||||
for (auto applet : applets) {
|
||||
@ -393,7 +393,7 @@ void GlobalShortcuts::activateEntry(int index, Qt::Key modifier)
|
||||
sortedViews = currentLayout->sortedLatteViews();
|
||||
}
|
||||
|
||||
foreach (auto view, sortedViews) {
|
||||
for (const auto view : sortedViews) {
|
||||
if (view->managedLayout()->preferredForShortcutsTouched() && !view->isPreferredForShortcuts()) {
|
||||
continue;
|
||||
}
|
||||
@ -627,7 +627,7 @@ void GlobalShortcuts::showViews()
|
||||
Latte::View *viewWithTasks{nullptr};
|
||||
Latte::View *viewWithMeta{nullptr};
|
||||
|
||||
foreach (auto view, sortedViews) {
|
||||
for(const auto view : sortedViews) {
|
||||
if (!viewWithTasks && (!view->managedLayout()->preferredForShortcutsTouched() || view->isPreferredForShortcuts()) && isCapableToShowShortcutBadges(view)) {
|
||||
viewWithTasks = view;
|
||||
break;
|
||||
@ -636,7 +636,7 @@ void GlobalShortcuts::showViews()
|
||||
|
||||
//! show Meta if it is not already shown for Tasks Latte View
|
||||
if (!viewWithTasks || applicationLauncherId(viewWithTasks->containment()) == -1) {
|
||||
foreach (auto view, sortedViews) {
|
||||
for(const auto view : sortedViews) {
|
||||
if (!viewWithMeta && m_corona->universalSettings()->metaForwardedToLatte() && applicationLauncherId(view->containment()) > -1) {
|
||||
viewWithMeta = view;
|
||||
break;
|
||||
@ -686,7 +686,7 @@ void GlobalShortcuts::showViews()
|
||||
viewFound = true;
|
||||
|
||||
if (!m_hideViewsTimer.isActive()) {
|
||||
foreach (auto view, viewsWithShortcuts) {
|
||||
for(const auto view : viewsWithShortcuts) {
|
||||
if (view != viewWithTasks && view != viewWithMeta) {
|
||||
if (invokeShowShortcuts(view->containment(), false, false)) {
|
||||
m_hideViews.append(view);
|
||||
@ -709,7 +709,7 @@ void GlobalShortcuts::showViews()
|
||||
|
||||
bool GlobalShortcuts::viewsToHideAreValid()
|
||||
{
|
||||
foreach (auto view, m_hideViews) {
|
||||
for(const auto view : m_hideViews) {
|
||||
if (!m_corona->layoutManager()->latteViewExists(view)) {
|
||||
return false;
|
||||
}
|
||||
@ -764,7 +764,7 @@ void GlobalShortcuts::hideViewsTimerSlot()
|
||||
m_lastInvokedAction = Q_NULLPTR;
|
||||
|
||||
if (viewsToHideAreValid()) {
|
||||
foreach (auto latteView, m_hideViews) {
|
||||
for(const auto latteView : m_hideViews) {
|
||||
latteView->visibility()->setBlockHiding(false);
|
||||
}
|
||||
|
||||
|
@ -99,7 +99,7 @@ void ModifierTracker::unblockModifierTracking(Qt::Key key)
|
||||
|
||||
bool ModifierTracker::noModifierPressed()
|
||||
{
|
||||
foreach(Qt::Key modifier, m_pressed.keys()) {
|
||||
for (const Qt::Key &modifier : m_pressed.keys()) {
|
||||
if ( m_pressed[modifier]) {
|
||||
return false;
|
||||
}
|
||||
@ -128,7 +128,7 @@ bool ModifierTracker::sequenceModifierPressed(const QKeySequence &seq)
|
||||
|
||||
bool ModifierTracker::singleModifierPressed(Qt::Key key)
|
||||
{
|
||||
foreach(Qt::Key modifier, m_pressed.keys()) {
|
||||
for (const Qt::Key &modifier : m_pressed.keys()) {
|
||||
if ( (modifier != key && m_pressed[modifier])
|
||||
|| (modifier == key && !m_pressed[modifier]) ) {
|
||||
return false;
|
||||
|
@ -156,7 +156,7 @@ void ShortcutsTracker::parseGlobalShortcuts()
|
||||
|
||||
m_basedOnPositionEnabled = (!m_badgesForActivate[0].isEmpty() && !m_badgesForActivate[1].isEmpty());
|
||||
|
||||
foreach(auto key, latteGroup.keyList()) {
|
||||
for(auto &key : latteGroup.keyList()) {
|
||||
if (key.startsWith(APPLETSHORTCUTKEY)) {
|
||||
QStringList records = latteGroup.readEntry(key, QStringList());
|
||||
int appletId = key.remove(APPLETSHORTCUTKEY).toInt();
|
||||
@ -176,7 +176,7 @@ void ShortcutsTracker::clearAllAppletShortcuts()
|
||||
{
|
||||
KConfigGroup latteGroup = KConfigGroup(m_shortcutsConfigPtr, "lattedock");
|
||||
|
||||
foreach(auto key, latteGroup.keyList()) {
|
||||
for(const auto &key : latteGroup.keyList()) {
|
||||
if (key.startsWith(APPLETSHORTCUTKEY)) {
|
||||
QAction *appletAction = new QAction(this);
|
||||
|
||||
|
@ -126,7 +126,7 @@ bool ContextMenu::mousePressEvent(QMouseEvent *event)
|
||||
updateAppletContainsMethod();
|
||||
}
|
||||
|
||||
foreach (Plasma::Applet *appletTemp, m_latteView->containment()->applets()) {
|
||||
for (const Plasma::Applet *appletTemp : m_latteView->containment()->applets()) {
|
||||
PlasmaQuick::AppletQuickItem *ai = appletTemp->property("_plasma_graphicObject").value<PlasmaQuick::AppletQuickItem *>();
|
||||
|
||||
bool appletContainsMouse = false;
|
||||
@ -153,7 +153,7 @@ bool ContextMenu::mousePressEvent(QMouseEvent *event)
|
||||
Plasma::Containment *cont = containmentById(systrayId.toInt());
|
||||
|
||||
if (cont) {
|
||||
foreach (Plasma::Applet *appletCont, cont->applets()) {
|
||||
for (const Plasma::Applet *appletCont : cont->applets()) {
|
||||
PlasmaQuick::AppletQuickItem *ai2 = appletCont->property("_plasma_graphicObject").value<PlasmaQuick::AppletQuickItem *>();
|
||||
|
||||
if (ai2 && ai2->isVisible() && ai2->contains(ai2->mapFromItem(m_latteView->contentItem(), event->pos()))) {
|
||||
@ -330,7 +330,7 @@ void ContextMenu::addAppletActions(QMenu *desktopMenu, Plasma::Applet *applet, Q
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (QAction *action, applet->contextualActions()) {
|
||||
for (QAction *action : applet->contextualActions()) {
|
||||
if (action) {
|
||||
desktopMenu->addAction(action);
|
||||
}
|
||||
@ -379,8 +379,8 @@ void ContextMenu::addAppletActions(QMenu *desktopMenu, Plasma::Applet *applet, Q
|
||||
if (enabled) {
|
||||
//if there is only one, don't create a submenu
|
||||
// if (enabled < 2) {
|
||||
foreach (QAction *action, containmentAction->menu()->actions()) {
|
||||
if (action->isVisible()) {
|
||||
for (QAction *action : containmentAction->menu()->actions()) {
|
||||
if (action && action->isVisible()) {
|
||||
desktopMenu->addAction(action);
|
||||
}
|
||||
}
|
||||
@ -439,7 +439,7 @@ void ContextMenu::addContainmentActions(QMenu *desktopMenu, QEvent *event)
|
||||
|
||||
QList<QAction *> actions = plugin->contextualActions();
|
||||
|
||||
foreach (auto act, actions) {
|
||||
for (const QAction *act : actions) {
|
||||
if (act->menu()) {
|
||||
//this is a workaround where Qt now creates the menu widget
|
||||
//in .exec before oxygen can polish it and set the following attribute
|
||||
@ -459,7 +459,7 @@ void ContextMenu::addContainmentActions(QMenu *desktopMenu, QEvent *event)
|
||||
|
||||
Plasma::Containment *ContextMenu::containmentById(uint id)
|
||||
{
|
||||
foreach (auto containment, m_latteView->corona()->containments()) {
|
||||
for (const auto containment : m_latteView->corona()->containments()) {
|
||||
if (id == containment->id()) {
|
||||
return containment;
|
||||
}
|
||||
|
@ -470,7 +470,7 @@ void PanelShadows::Private::freeX11Pixmaps()
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (const QPixmap &pixmap, m_shadowPixmaps) {
|
||||
for (const QPixmap &pixmap : m_shadowPixmaps) {
|
||||
if (!pixmap.isNull()) {
|
||||
XFreePixmap(display, reinterpret_cast<unsigned long>(createPixmap(pixmap)));
|
||||
}
|
||||
|
@ -155,7 +155,7 @@ bool Positioner::setCurrentScreen(const QString id)
|
||||
QScreen *nextScreen{qGuiApp->primaryScreen()};
|
||||
|
||||
if (id != "primary") {
|
||||
foreach (auto scr, qGuiApp->screens()) {
|
||||
for (const auto scr : qGuiApp->screens()) {
|
||||
if (scr && scr->name() == id) {
|
||||
nextScreen = scr;
|
||||
break;
|
||||
@ -237,14 +237,14 @@ void Positioner::reconsiderScreen()
|
||||
qDebug() << "reconsiderScreen() called...";
|
||||
qDebug() << " Delayer ";
|
||||
|
||||
foreach (auto scr, qGuiApp->screens()) {
|
||||
for (const auto scr : qGuiApp->screens()) {
|
||||
qDebug() << " D, found screen: " << scr->name();
|
||||
}
|
||||
|
||||
bool screenExists{false};
|
||||
|
||||
//!check if the associated screen is running
|
||||
foreach (auto scr, qGuiApp->screens()) {
|
||||
for (const auto scr : qGuiApp->screens()) {
|
||||
if (m_screenToFollowId == scr->name()
|
||||
|| (m_view->onPrimary() && scr == qGuiApp->primaryScreen())) {
|
||||
screenExists = true;
|
||||
@ -277,7 +277,7 @@ void Positioner::reconsiderScreen()
|
||||
//! 2.an explicit dock must be always on the correct associated screen
|
||||
//! there are cases that window manager misplaces the dock, this function
|
||||
//! ensures that this dock will return at its correct screen
|
||||
foreach (auto scr, qGuiApp->screens()) {
|
||||
for (const auto scr : qGuiApp->screens()) {
|
||||
if (scr && scr->name() == m_screenToFollowId) {
|
||||
qDebug() << "reached case 2: updating the explicit screen for dock...";
|
||||
setScreenToFollow(scr);
|
||||
|
@ -118,7 +118,7 @@ PrimaryConfigView::~PrimaryConfigView()
|
||||
|
||||
deleteSecondaryWindow();
|
||||
|
||||
foreach (auto var, connections) {
|
||||
for (const auto &var : connections) {
|
||||
QObject::disconnect(var);
|
||||
}
|
||||
|
||||
|
@ -94,7 +94,7 @@ SecondaryConfigView::~SecondaryConfigView()
|
||||
{
|
||||
qDebug() << "SecDockConfigView deleting ...";
|
||||
|
||||
foreach (auto var, connections) {
|
||||
for (const auto &var : connections) {
|
||||
QObject::disconnect(var);
|
||||
}
|
||||
|
||||
|
@ -915,7 +915,7 @@ void View::removeTasksPlasmoid()
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (Plasma::Applet *applet, containment()->applets()) {
|
||||
for (const Plasma::Applet *applet : containment()->applets()) {
|
||||
KPluginMetaData meta = applet->kPackage().metadata();
|
||||
|
||||
if (meta.pluginId() == "org.kde.latte.plasmoid") {
|
||||
@ -937,7 +937,7 @@ bool View::tasksPresent()
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach (Plasma::Applet *applet, this->containment()->applets()) {
|
||||
for (const Plasma::Applet *applet : this->containment()->applets()) {
|
||||
const auto &provides = KPluginMetaData::readStringList(applet->pluginMetaData().rawData(), QStringLiteral("X-Plasma-Provides"));
|
||||
|
||||
if (provides.contains(QLatin1String("org.kde.plasma.multitasking"))) {
|
||||
@ -959,7 +959,7 @@ bool View::mimeContainsPlasmoid(QMimeData *mimeData, QString name)
|
||||
QString data = mimeData->data(QStringLiteral("text/x-plasmoidservicename"));
|
||||
const QStringList appletNames = data.split('\n', QString::SkipEmptyParts);
|
||||
|
||||
foreach (const QString &appletName, appletNames) {
|
||||
for (const QString &appletName : appletNames) {
|
||||
if (appletName == name)
|
||||
return true;
|
||||
}
|
||||
@ -1064,7 +1064,7 @@ void View::deactivateApplets()
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (auto applet, containment()->applets()) {
|
||||
for (const auto applet : containment()->applets()) {
|
||||
PlasmaQuick::AppletQuickItem *ai = applet->property("_plasma_graphicObject").value<PlasmaQuick::AppletQuickItem *>();
|
||||
|
||||
if (ai) {
|
||||
@ -1079,7 +1079,7 @@ void View::toggleAppletExpanded(const int id)
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (auto applet, containment()->applets()) {
|
||||
for (const auto applet : containment()->applets()) {
|
||||
if (applet->id() == id) {
|
||||
PlasmaQuick::AppletQuickItem *ai = applet->property("_plasma_graphicObject").value<PlasmaQuick::AppletQuickItem *>();
|
||||
|
||||
@ -1118,7 +1118,7 @@ QVariantList View::containmentActions()
|
||||
plugin->restore(pluginConfig);
|
||||
}
|
||||
|
||||
foreach (QAction *ac, plugin->contextualActions()) {
|
||||
for (QAction *ac : plugin->contextualActions()) {
|
||||
actions << QVariant::fromValue<QAction *>(ac);
|
||||
}
|
||||
|
||||
|
@ -402,7 +402,7 @@ bool WindowsTracker::isTouchingViewEdge(const WindowInfoWrap &winfo)
|
||||
|
||||
void WindowsTracker::cleanupFaultyWindows()
|
||||
{
|
||||
foreach (auto key, m_windows.keys()) {
|
||||
for (const auto &key : m_windows.keys()) {
|
||||
auto winfo = m_windows[key];
|
||||
|
||||
//! garbage windows removing
|
||||
|
@ -428,7 +428,7 @@ bool WaylandInterface::isPlasmaDesktop(const KWayland::Client::PlasmaWindow *w)
|
||||
|
||||
bool hasScreenGeometry{false};
|
||||
|
||||
foreach(auto scr, qGuiApp->screens()) {
|
||||
for (const auto scr : qGuiApp->screens()) {
|
||||
if (!w->geometry().isEmpty() && w->geometry() == scr->geometry()) {
|
||||
hasScreenGeometry = true;
|
||||
break;
|
||||
|
@ -73,7 +73,7 @@ XWindowInterface::XWindowInterface(QObject *parent)
|
||||
, this, &XWindowInterface::currentActivityChanged);
|
||||
|
||||
// fill windows list
|
||||
foreach (const auto &wid, KWindowSystem::self()->windows()) {
|
||||
for (const auto &wid : KWindowSystem::self()->windows()) {
|
||||
addWindow(wid);
|
||||
}
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ QString standardPath(QString subPath, bool localfirst)
|
||||
QStringList paths = QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation);
|
||||
|
||||
if (localfirst) {
|
||||
foreach (auto pt, paths) {
|
||||
for (const auto &pt : paths) {
|
||||
QString ptF = pt + "/" +subPath;
|
||||
if (QFileInfo(ptF).exists()) {
|
||||
return ptF;
|
||||
|
@ -533,7 +533,7 @@ void IconItem::loadPixmap()
|
||||
// It is more efficient to do it here, as KIconLoader::drawOverlays()
|
||||
// assumes that an overlay will be drawn and has some additional
|
||||
// setup time.
|
||||
foreach (const QString &overlay, m_overlays) {
|
||||
for (const QString &overlay : m_overlays) {
|
||||
if (!overlay.isEmpty()) {
|
||||
// There is at least one overlay, draw all overlays above m_pixmap
|
||||
// and cancel the check
|
||||
|
@ -180,8 +180,8 @@ void BackgroundCache::reload()
|
||||
|
||||
m_initialized = true;
|
||||
|
||||
foreach (auto activity, updates.keys()) {
|
||||
foreach (auto screen, updates[activity]) {
|
||||
for (const auto &activity : updates.keys()) {
|
||||
for (const auto &screen : updates[activity]) {
|
||||
emit backgroundChanged(activity, screen);
|
||||
}
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ void ScreenPool::load()
|
||||
|
||||
bool updated{false};
|
||||
|
||||
foreach (auto screenId, m_screensGroup.keyList()) {
|
||||
for (const auto &screenId : m_screensGroup.keyList()) {
|
||||
QString screenName = m_screensGroup.readEntry(screenId, QString());
|
||||
if (screenId != 0) {
|
||||
int scrId = screenId.toInt();
|
||||
@ -94,7 +94,7 @@ void ScreenPool::load()
|
||||
|
||||
if (updated) {
|
||||
qDebug() << "---------------- Plasma Screen Ids ------------------";
|
||||
foreach (auto id, m_connectorForId.keys()) {
|
||||
for (const auto &id : m_connectorForId.keys()) {
|
||||
qDebug() << id << " __ " << m_connectorForId[id];
|
||||
}
|
||||
qDebug() << "---------------- --------------- ------------------";
|
||||
|
Loading…
x
Reference in New Issue
Block a user