Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Plasma
Plasma Desktop
Commits
66b159ff
Commit
66b159ff
authored
Oct 21, 2020
by
Ahmad Samir
Browse files
Port foreach (deprecated) to range-for
kcms/formats kcms/touchpad
parent
c416ec4f
Changes
7
Hide whitespace changes
Inline
Side-by-side
kcms/formats/kcmformats.cpp
View file @
66b159ff
...
...
@@ -74,13 +74,13 @@ void KCMFormats::load()
{
QList
<
QLocale
>
allLocales
=
QLocale
::
matchingLocales
(
QLocale
::
AnyLanguage
,
QLocale
::
AnyScript
,
QLocale
::
AnyCountry
);
std
::
sort
(
allLocales
.
begin
(),
allLocales
.
end
(),
countryLessThan
);
for
each
(
QComboBox
*
combo
,
m_combos
)
{
for
(
QComboBox
*
combo
:
qAsConst
(
m_combos
)
)
{
initCombo
(
combo
,
allLocales
);
}
readConfig
();
for
each
(
QComboBox
*
combo
,
m_combos
)
{
for
(
QComboBox
*
combo
:
qAsConst
(
m_combos
)
)
{
connectCombo
(
combo
);
}
...
...
@@ -100,8 +100,8 @@ void KCMFormats::initCombo(QComboBox *combo, const QList<QLocale> & allLocales)
combo
->
clear
();
const
QString
clabel
=
i18n
(
"No change"
);
combo
->
addItem
(
clabel
,
QString
());
for
each
(
const
QL
ocale
&
l
,
allLocales
)
{
addLocaleToCombo
(
combo
,
l
);
for
(
const
auto
&
l
ocale
:
allLocales
)
{
addLocaleToCombo
(
combo
,
l
ocale
);
}
}
...
...
kcms/touchpad/backends/x11/xlibtouchpad.cpp
View file @
66b159ff
...
...
@@ -30,7 +30,7 @@ bool XlibTouchpad::applyConfig(const QVariantHash& p)
m_props
.
clear
();
bool
error
=
false
;
Q_FOREACH
(
const
QString
&
name
,
m_supported
)
{
for
(
const
QString
&
name
:
qAsConst
(
m_supported
)
)
{
QVariantHash
::
ConstIterator
i
=
p
.
find
(
name
);
if
(
i
==
p
.
end
())
{
continue
;
...
...
@@ -85,7 +85,7 @@ bool XlibTouchpad::getConfig(QVariantHash& p)
m_props
.
clear
();
bool
error
=
false
;
Q_FOREACH
(
const
QString
&
name
,
m_supported
)
{
for
(
const
QString
&
name
:
qAsConst
(
m_supported
)
)
{
const
Parameter
*
par
=
findParameter
(
name
);
if
(
!
par
)
{
continue
;
...
...
@@ -161,7 +161,7 @@ QVariant XlibTouchpad::getParameter(const Parameter* par)
void
XlibTouchpad
::
flush
()
{
Q_FOREACH
(
const
QLatin1String
&
name
,
m_changed
)
{
for
(
const
QLatin1String
&
name
:
qAsConst
(
m_changed
)
)
{
m_props
[
name
].
set
();
}
m_changed
.
clear
();
...
...
kcms/touchpad/kcm/xlib/customconfigdialogmanager.cpp
View file @
66b159ff
...
...
@@ -36,7 +36,8 @@ CustomConfigDialogManager::CustomConfigDialogManager(QWidget *parent,
{
static
const
QString
kcfgPrefix
(
"kcfg_"
);
Q_FOREACH
(
KConfigSkeletonItem
*
i
,
conf
->
items
())
{
const
auto
itemList
=
conf
->
items
();
for
(
KConfigSkeletonItem
*
i
:
itemList
)
{
QString
name
(
i
->
name
());
QWidget
*
child
=
parent
->
findChild
<
QWidget
*>
(
kcfgPrefix
+
name
);
...
...
@@ -60,14 +61,9 @@ CustomConfigDialogManager::CustomConfigDialogManager(QWidget *parent,
}
QStringList
choiceList
;
Q_FOREACH
(
const
KCoreConfigSkeleton
::
ItemEnum
::
Choice
&
c
,
asEnum
->
choices
())
{
if
(
c
.
label
.
isEmpty
())
{
choiceList
.
append
(
c
.
name
);
}
else
{
choiceList
.
append
(
c
.
label
);
}
const
auto
asEnumChoices
=
asEnum
->
choices
();
for
(
const
auto
&
choice
:
asEnumChoices
)
{
choiceList
.
append
(
!
choice
.
label
.
isEmpty
()
?
choice
.
label
:
choice
.
name
);
}
KComboBox
*
asComboBox
=
qobject_cast
<
KComboBox
*>
(
child
);
...
...
kcms/touchpad/kcm/xlib/touchpadconfigxlib.cpp
View file @
66b159ff
...
...
@@ -73,7 +73,8 @@ static void copyHelpFromBuddy(QObject *root)
asLabel
->
setWhatsThis
(
asLabel
->
buddy
()
->
whatsThis
());
}
}
Q_FOREACH
(
QObject
*
child
,
root
->
children
())
{
const
auto
childList
=
root
->
children
();
for
(
QObject
*
child
:
childList
)
{
copyHelpFromBuddy
(
child
);
}
}
...
...
@@ -239,8 +240,7 @@ void TouchpadConfigXlib::gotReplyFromDaemon(QDBusPendingCallWatcher *watch)
void
TouchpadConfigXlib
::
updateMouseList
()
{
QStringList
mouses
(
m_backend
->
listMouses
(
m_daemonSettings
.
mouseBlacklist
()));
const
QStringList
mouses
(
m_backend
->
listMouses
(
m_daemonSettings
.
mouseBlacklist
()));
for
(
int
i
=
0
;
i
<
m_mouseCombo
->
count
();
)
{
if
(
!
mouses
.
contains
(
m_mouseCombo
->
itemText
(
i
)))
{
...
...
@@ -250,9 +250,9 @@ void TouchpadConfigXlib::updateMouseList()
}
}
Q_FOREACH
(
const
QString
&
i
,
mouses
)
{
if
(
!
m_mouseCombo
->
contains
(
i
))
{
m_mouseCombo
->
addItem
(
i
);
for
(
const
QString
&
device
:
mouses
)
{
if
(
!
m_mouseCombo
->
contains
(
device
))
{
m_mouseCombo
->
addItem
(
device
);
}
}
}
...
...
kcms/touchpad/kcm/xlib/touchpadparametersbase.cpp
View file @
66b159ff
...
...
@@ -45,8 +45,9 @@ TouchpadParametersBase::TouchpadParametersBase(const QString &configname,
QVariantHash
TouchpadParametersBase
::
values
()
const
{
QVariantHash
r
;
Q_FOREACH
(
const
KConfigSkeletonItem
*
i
,
items
())
{
r
[
i
->
name
()]
=
i
->
property
();
const
auto
itemList
=
items
();
for
(
const
KConfigSkeletonItem
*
skel
:
itemList
)
{
r
[
skel
->
name
()]
=
skel
->
property
();
}
return
r
;
}
...
...
kcms/touchpad/kded/kded.cpp
View file @
66b159ff
...
...
@@ -101,8 +101,9 @@ void TouchpadDisabler::serviceNameFetchFinished(QDBusPendingCallWatcher *callWat
return
;
}
QStringList
allServices
=
reply
.
value
();
Q_FOREACH
(
const
QString
&
service
,
m_dependencies
.
watchedServices
())
{
const
QStringList
allServices
=
reply
.
value
();
const
QStringList
watchedList
=
m_dependencies
.
watchedServices
();
for
(
const
QString
&
service
:
watchedList
)
{
if
(
allServices
.
contains
(
service
))
{
serviceRegistered
(
service
);
}
...
...
kcms/touchpad/kded/kdedactions.cpp
View file @
66b159ff
...
...
@@ -56,7 +56,8 @@ TouchpadGlobalActions::TouchpadGlobalActions(bool isConfiguration, QObject *pare
qWarning
()
<<
"Couldn't set global shortcut to Qt::Key_TouchpadToggle. There's another program using it, otherwise file a bug against kcm_touchpad"
;
}
Q_FOREACH
(
QAction
*
act
,
actions
())
{
const
auto
actionsList
=
actions
();
for
(
QAction
*
act
:
actionsList
)
{
KActionCollection
::
setShortcutsConfigurable
(
act
,
true
);
if
(
isConfiguration
)
{
act
->
setProperty
(
"isConfigurationAction"
,
true
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment