Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F1039638
ActionItem.qml
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
ActionItem.qml
View Options
/*
* This file is part of kazv.
* SPDX-FileCopyrightText: 2020-2022 Tusooa Zhu <tusooa@kazv.moe>
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
import
QtQuick
2.15
import
QtQuick
.
Controls
2.15
import
QtQuick
.
Layouts
1.15
import
org
.
kde
.
kirigami
2.13
as
Kirigami
import
'.'
as
KazvShortcuts
Kirigami
.
BasicListItem
{
id: actionItem
property
var
action
icon:
action
.
iconName
||
action
.
iconSource
label:
action
.
text
subtitle:
l10n
.
get
(
'action-settings-shortcut-prompt'
,
{
shortcut:
action
.
shortcut
||
l10n
.
get
(
'action-settings-shortcut-none'
)
}
)
property
var
sheet:
Kirigami
.
OverlaySheet
{
id: popup
property
var
shortcut:
''
property
var
conflictsName:
[]
property
var
conflictingActions:
[]
title:
l10n
.
get
(
'action-settings-shortcut-conflict-modal-title'
)
ColumnLayout
{
Label
{
text:
l10n
.
get
(
'action-settings-shortcut-conflict'
,
{
shortcut:
popup
.
shortcut
,
conflictingAction:
popup
.
conflictsName
.
join
(
'<br>'
),
})
Layout.fillWidth:
true
}
RowLayout
{
Button
{
text:
l10n
.
get
(
'action-settings-shortcut-conflict-continue'
)
onClicked:
{
actionItem
.
setShortcut
(
popup
.
shortcut
);
actionSettings
.
purgeShortcutForActions
(
popup
.
conflictingActions
);
popup
.
close
();
}
}
Button
{
text:
l10n
.
get
(
'action-settings-shortcut-conflict-cancel'
)
onClicked:
{
popup
.
close
();
}
}
}
}
}
RowLayout
{
Button
{
id: editButton
text:
checked
?
shortcutInput.partialResult :
l10n
.
get
(
'action-settings-shortcut-edit-action'
)
checkable:
true
onClicked:
{
if
(
checked
)
{
shortcutInput
.
startRecording
();
}
else
{
shortcutInput
.
cancel
();
}
}
}
Button
{
text:
l10n
.
get
(
'action-settings-shortcut-remove-action'
)
onClicked:
{
setShortcut
(
""
);
}
}
}
KazvShortcuts
.
ShortcutInput
{
id: shortcutInput
onFinalResult:
{
editButton
.
checked
=
false
;
const
conflicts
=
actionSettings
.
findConflicts
(
sequence
)
.
filter
(
a
=>
a
.
objectName
!==
action
.
objectName
);
if
(
!
conflicts
.
length
)
{
setShortcut
(
sequence
);
}
else
{
popup
.
shortcut
=
sequence
;
popup
.
conflictingActions
=
conflicts
;
popup
.
conflictsName
=
conflicts
.
map
(
a
=>
a
.
text
);
popup
.
open
();
}
}
}
function
setShortcut
(
shortcut
)
{
actionSettings
.
setShortcutFor
(
action
,
shortcut
);
}
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, May 14, 11:00 AM (1 d, 19 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
92805
Default Alt Text
ActionItem.qml (2 KB)
Attached To
Mode
rK kazv
Attached
Detach File
Event Timeline
Log In to Comment