Skip to content
GitLab
Menu
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
c191821b
Commit
c191821b
authored
Oct 23, 2020
by
Alexander Lohnau
💬
Browse files
Fix clazy warnings in keyboard KCM
parent
4e2f4a67
Changes
7
Hide whitespace changes
Inline
Side-by-side
containments/desktop/plugins/folder/previewpluginsmodel.cpp
View file @
c191821b
...
...
@@ -103,7 +103,7 @@ void PreviewPluginsModel::setCheckedPlugins(const QStringList &list)
m_checkedRows
=
QVector
<
bool
>
(
m_plugins
.
size
(),
false
);
for
(
const
QString
&
name
:
plugins
)
{
for
(
const
QString
&
name
:
qAsConst
(
plugins
)
)
{
const
int
row
=
indexOfPlugin
(
name
);
if
(
row
!=
-
1
)
{
m_checkedRows
[
row
]
=
true
;
...
...
kcms/keyboard/tastenbrett/key.cpp
View file @
c191821b
...
...
@@ -130,7 +130,7 @@ static QString keySymToString(KeySym keysym) {
if
(
static_cast
<
KeySym
>
(
xkbKeysym
)
==
keysym
)
{
str
=
xkbKeysymToUtf8
(
xkbKeysym
);
for
(
const
auto
&
c
:
str
)
{
for
(
const
auto
&
c
:
qAsConst
(
str
)
)
{
if
(
!
c
.
isPrint
()
&&
!
c
.
isNull
())
{
str
=
""
;
break
;
...
...
kcms/keyboard/x11_helper.cpp
View file @
c191821b
...
...
@@ -351,11 +351,11 @@ bool XEventNotifier::processXkbEvents(xcb_generic_event_t* event)
_xkb_event
*
xkbevt
=
reinterpret_cast
<
_xkb_event
*>
(
event
);
if
(
XEventNotifier
::
isGroupSwitchEvent
(
xkbevt
)
)
{
// qDebug() << "group switch event";
emit
(
layoutChanged
());
Q_EMIT
emit
(
layoutChanged
());
}
else
if
(
XEventNotifier
::
isLayoutSwitchEvent
(
xkbevt
)
)
{
// qDebug() << "layout switch event";
emit
(
layoutMapChanged
());
Q_EMIT
emit
(
layoutMapChanged
());
}
return
true
;
}
...
...
kcms/keyboard/xinput_helper.cpp
View file @
c191821b
...
...
@@ -80,11 +80,11 @@ bool XInputEventNotifier::processOtherEvents(xcb_generic_event_t* event)
{
int
newDeviceType
=
getNewDeviceEventType
(
event
);
if
(
newDeviceType
==
DEVICE_KEYBOARD
)
{
emit
(
newKeyboardDevice
());
Q_EMIT
emit
(
newKeyboardDevice
());
}
else
if
(
newDeviceType
==
DEVICE_POINTER
)
{
emit
(
newPointerDevice
());
emit
(
newKeyboardDevice
());
// arghhh, looks like X resets xkb map even when only pointer device is connected
Q_EMIT
emit
(
newPointerDevice
());
Q_EMIT
emit
(
newKeyboardDevice
());
// arghhh, looks like X resets xkb map even when only pointer device is connected
}
return
true
;
}
...
...
kcms/keys/globalaccelmodel.cpp
View file @
c191821b
...
...
@@ -191,7 +191,7 @@ void GlobalAccelModel::save()
void
GlobalAccelModel
::
exportToConfig
(
const
KConfigBase
&
config
)
{
for
(
const
auto
&
component
:
m_components
)
{
for
(
const
auto
&
component
:
qAsConst
(
m_components
)
)
{
if
(
component
.
checked
)
{
KConfigGroup
mainGroup
(
&
config
,
component
.
id
);
KConfigGroup
group
(
&
mainGroup
,
"Global Shortcuts"
);
...
...
@@ -205,7 +205,8 @@ void GlobalAccelModel::exportToConfig(const KConfigBase &config)
void
GlobalAccelModel
::
importConfig
(
const
KConfigBase
&
config
)
{
for
(
const
auto
componentGroupName
:
config
.
groupList
())
{
const
auto
groupList
=
config
.
groupList
();
for
(
const
auto
&
componentGroupName
:
groupList
)
{
auto
component
=
std
::
find_if
(
m_components
.
begin
(),
m_components
.
end
(),
[
&
]
(
const
Component
&
c
)
{
return
c
.
id
==
componentGroupName
;
});
...
...
@@ -219,7 +220,8 @@ void GlobalAccelModel::importConfig(const KConfigBase &config)
continue
;
}
KConfigGroup
shortcutsGroup
(
&
componentGroup
,
"Global Shortcuts"
);
for
(
const
auto
&
key
:
shortcutsGroup
.
keyList
())
{
const
QStringList
keys
=
shortcutsGroup
.
keyList
();
for
(
const
auto
&
key
:
keys
)
{
auto
action
=
std
::
find_if
(
component
->
actions
.
begin
(),
component
->
actions
.
end
(),
[
&
]
(
const
Action
&
a
)
{
return
a
.
id
==
key
;
});
...
...
@@ -268,10 +270,10 @@ void GlobalAccelModel::addApplication(const QString &desktopFileName, const QStr
return
;
}
qCDebug
(
KCMKEYS
)
<<
"inserting at "
<<
pos
-
m_components
.
begin
();
emit
beginInsertRows
(
QModelIndex
(),
pos
-
m_components
.
begin
(),
pos
-
m_components
.
begin
());
beginInsertRows
(
QModelIndex
(),
pos
-
m_components
.
begin
(),
pos
-
m_components
.
begin
());
auto
c
=
loadComponent
(
infoReply
.
value
());
m_components
.
insert
(
pos
,
c
);
emit
endInsertRows
();
endInsertRows
();
});
});
}
...
...
kcms/keys/kcm_keys.cpp
View file @
c191821b
...
...
@@ -237,6 +237,7 @@ void KCMKeys::requestKeySequence(QQuickItem *context, const QModelIndex &index,
:
i18n
(
"Shortcut %1 is already assigned to action '%2' of %3.
\n
Do you want to reassign it?"
,
keysString
,
actionName
,
componentName
);
const
QString
title
=
i18nc
(
"@title:window"
,
"Found conflict"
);
auto
dialog
=
new
QDialog
;
dialog
->
setWindowTitle
(
title
);
if
(
context
&&
context
->
window
())
{
dialog
->
winId
();
// so it creates windowHandle
dialog
->
windowHandle
()
->
setTransientParent
(
QQuickRenderControl
::
renderWindowFor
(
context
->
window
()));
...
...
@@ -247,7 +248,7 @@ void KCMKeys::requestKeySequence(QQuickItem *context, const QModelIndex &index,
QMessageBox
::
Question
,
message
,
{},
QString
(),
nullptr
,
KMessageBox
::
NoExec
);
dialog
->
show
();
connect
(
dialog
,
&
QDialog
::
finished
,
this
,
[
this
,
index
,
conflict
,
newSequence
,
oldSequence
]
(
int
result
)
{
connect
(
dialog
,
&
QDialog
::
finished
,
this
,
[
index
,
conflict
,
newSequence
,
oldSequence
]
(
int
result
)
{
auto
model
=
const_cast
<
BaseModel
*>
(
static_cast
<
const
BaseModel
*>
(
index
.
model
()));
if
(
result
!=
QDialogButtonBox
::
Yes
)
{
// Also emit if we are not changing anything, to force the frontend to update and be consistent
...
...
kcms/keys/keysdata.cpp
View file @
c191821b
...
...
@@ -32,6 +32,8 @@ constexpr int dbusTimeout = 5; //milliseconds
KeysData
::
KeysData
(
QObject
*
parent
,
const
QVariantList
&
args
)
{
Q_UNUSED
(
parent
)
Q_UNUSED
(
args
)
}
bool
KeysData
::
isDefaults
()
const
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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