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
KScreen
Commits
a0533d12
Verified
Commit
a0533d12
authored
May 19, 2022
by
ivan tkachenko
Browse files
plasmoid: Copy InhibitionHint from battery applet
parent
280b8537
Pipeline
#178164
passed with stage
in 1 minute and 59 seconds
Changes
2
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
plasmoid/package/contents/ui/InhibitionHint.qml
0 → 100644
View file @
a0533d12
/*
SPDX-FileCopyrightText: 2015 Kai Uwe Broulik <kde@privat.broulik.de>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
import
QtQuick
2.15
import
QtQuick
.
Layouts
1.15
import
org
.
kde
.
plasma
.
components
3.0
as
PlasmaComponents3
import
org
.
kde
.
plasma
.
core
2.1
as
PlasmaCore
// everything like in battery applet, but slightly bigger
RowLayout
{
property
alias
iconSource
:
iconItem
.
source
property
alias
text
:
label
.
text
spacing
:
PlasmaCore
.
Units
.
smallSpacing
*
2
PlasmaCore.IconItem
{
id
:
iconItem
Layout.preferredWidth
:
PlasmaCore
.
Units
.
iconSizes
.
medium
Layout.preferredHeight
:
PlasmaCore
.
Units
.
iconSizes
.
medium
visible
:
valid
}
PlasmaComponents3.Label
{
id
:
label
Layout.fillWidth
:
true
Layout.maximumWidth
:
Math
.
min
(
PlasmaCore
.
Units
.
gridUnit
*
20
,
implicitWidth
)
font
:
PlasmaCore
.
Theme
.
smallestFont
textFormat
:
Text
.
PlainText
wrapMode
:
Text
.
WordWrap
elide
:
Text
.
ElideRight
maximumLineCount
:
4
}
}
plasmoid/package/contents/ui/PresentationModeItem.qml
View file @
a0533d12
...
...
@@ -62,44 +62,29 @@ ColumnLayout {
wrapMode
:
Text
.
WordWrap
}
RowLayou
t
{
InhibitionHin
t
{
Layout.fillWidth
:
true
Layout.leftMargin
:
checkBox
.
indicator
.
width
+
checkBox
.
spacing
spacing
:
PlasmaCore
.
Units
.
smallSpacing
PlasmaCore.IconItem
{
Layout.preferredWidth
:
PlasmaCore
.
Units
.
iconSizes
.
medium
Layout.preferredHeight
:
PlasmaCore
.
Units
.
iconSizes
.
medium
source
:
pmSource
.
inhibitions
.
length
>
0
?
pmSource
.
inhibitions
[
0
].
Icon
||
""
:
""
visible
:
valid
}
PlasmaComponents3.Label
{
Layout.fillWidth
:
true
Layout.maximumWidth
:
Math
.
min
(
PlasmaCore
.
Units
.
gridUnit
*
20
,
implicitWidth
)
font
:
PlasmaCore
.
Theme
.
smallestFont
wrapMode
:
Text
.
WordWrap
elide
:
Text
.
ElideRight
textFormat
:
Text
.
PlainText
text
:
{
const
inhibitions
=
pmSource
.
inhibitions
;
const
inhibition
=
inhibitions
[
0
];
if
(
inhibitions
.
length
>
1
)
{
return
i18ncp
(
"
Some Application and n others enforce presentation mode
"
,
"
%2 and %1 other application are enforcing presentation mode.
"
,
"
%2 and %1 other applications are enforcing presentation mode.
"
,
inhibitions
.
length
-
1
,
inhibition
.
Name
)
// plural only works on %1
}
else
if
(
inhibitions
.
length
===
1
)
{
if
(
!
inhibition
.
Reason
)
{
return
i18nc
(
"
Some Application enforce presentation mode
"
,
"
%1 is enforcing presentation mode.
"
,
inhibition
.
Name
)
}
else
{
return
i18nc
(
"
Some Application enforce presentation mode: Reason provided by the app
"
,
"
%1 is enforcing presentation mode: %2
"
,
inhibition
.
Name
,
inhibition
.
Reason
)
}
iconSource
:
pmSource
.
inhibitions
.
length
>
0
?
pmSource
.
inhibitions
[
0
].
Icon
||
""
:
""
text
:
{
const
inhibitions
=
pmSource
.
inhibitions
;
const
inhibition
=
inhibitions
[
0
];
if
(
inhibitions
.
length
>
1
)
{
return
i18ncp
(
"
Some Application and n others enforce presentation mode
"
,
"
%2 and %1 other application are enforcing presentation mode.
"
,
"
%2 and %1 other applications are enforcing presentation mode.
"
,
inhibitions
.
length
-
1
,
inhibition
.
Name
)
// plural only works on %1
}
else
if
(
inhibitions
.
length
===
1
)
{
if
(
!
inhibition
.
Reason
)
{
return
i18nc
(
"
Some Application enforce presentation mode
"
,
"
%1 is enforcing presentation mode.
"
,
inhibition
.
Name
)
}
else
{
return
""
;
return
i18nc
(
"
Some Application enforce presentation mode: Reason provided by the app
"
,
"
%1 is enforcing presentation mode: %2
"
,
inhibition
.
Name
,
inhibition
.
Reason
)
}
}
else
{
return
""
;
}
}
}
...
...
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