7pragma ComponentBehavior: Bound
 
   11import QtQuick.Templates as T
 
   12import org.kde.plasma.core as PlasmaCore
 
   13import org.kde.ksvg as KSvg
 
   14import org.kde.plasma.components as PlasmaComponents3
 
   15import org.kde.plasma.extras as PlasmaExtras
 
   16import org.kde.kirigami as Kirigami
 
   97    property alias icon: listItemIcon.source
 
  106    property alias iconEmblem: iconEmblem.source
 
  115    property alias title: listItemTitle.text
 
  124    property alias subtitle: listItemSubtitle.text
 
  133    property bool subtitleCanWrap: false
 
  142    property int subtitleMaximumLineCount: -1
 
  150    property alias subtitleColor: listItemSubtitle.color
 
  159    property bool allowStyledText: false
 
  167    property alias defaultActionButtonAction: defaultActionButton.action
 
  176    property bool defaultActionButtonVisible: true
 
  186    property bool showDefaultActionButtonWhenBusy: false
 
  217    property list<T.Action> contextualActions
 
  219    readonly 
property list<T.Action> __enabledContextualActions: contextualActions.
filter(action => action?.enabled ?? 
false)
 
  232    property Component customExpandedViewContent
 
  238    property alias customExpandedViewContentItem: customContentLoader.item
 
  247    property bool isBusy: 
false 
  258    property bool isDefault: 
false 
  266    readonly 
property alias 
expanded: expandedView.expanded
 
  274    readonly 
property bool hasExpandableContent: customExpandedViewContent !== null || __enabledContextualActions.length > 0
 
  281        if (!listItem.hasExpandableContent) {
 
  284        expandedView.expanded = 
true 
  285        listItem.itemExpanded()
 
  292    function collapse() {
 
  293        if (!listItem.hasExpandableContent) {
 
  296        expandedView.expanded = 
false 
  297        listItem.itemCollapsed()
 
  304    function toggleExpanded() {
 
  305        if (!listItem.hasExpandableContent) {
 
  308        expandedView.expanded ? listItem.collapse() : listItem.expand()
 
 
  311    signal itemExpanded()
 
  312    signal itemCollapsed()
 
  314    width: parent ? parent.width : undefined 
 
  315    height: mainLayout.height
 
  318        enabled: listItem.ListView.view.highlightResizeDuration > 0
 
  321            duration: listItem.ListView.view.highlightResizeDuration || -1
 
  322            velocity: listItem.ListView.view.highlightResizeVelocity
 
  323            easing.type: Easing.InOutCubic
 
  326    clip: heightAnimation.running || expandedItemOpacityFade.running
 
  328    onEnabledChanged: 
if (!listItem.enabled) { collapse() }
 
  330    Keys.onPressed: event => {
 
  331        if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) {
 
  332            if (defaultActionButtonAction) {
 
  333                defaultActionButtonAction.trigger()
 
  337            event.accepted = true;
 
  338        } 
else if (
event.key === 
Qt.Key_Escape) {
 
  339            if (expandedView.expanded) {
 
  341                event.accepted = true;
 
  344        } 
else if (
event.key === 
Qt.Key_Space) {
 
  346            event.accepted = true;
 
  350    KeyNavigation.tab: defaultActionButtonVisible ? defaultActionButton : expandToggleButton
 
  351    KeyNavigation.right: defaultActionButtonVisible ? defaultActionButton : expandToggleButton
 
  352    KeyNavigation.down: expandToggleButton.KeyNavigation.down
 
  353    Keys.onDownPressed: 
event => {
 
  354        if (!actionsListLoader.item || ListView.view.currentIndex < 0) {
 
  355            ListView.view.incrementCurrentIndex();
 
  356            const item = ListView.view.currentItem;
 
  358                item.forceActiveFocus(
Qt.TabFocusReason);
 
  360            event.accepted = 
true;
 
  363        event.accepted = 
false; 
 
  365    Keys.onUpPressed: 
event => {
 
  366        if (ListView.view.currentIndex === 0) {
 
  367            event.accepted = 
false;
 
  369            ListView.view.decrementCurrentIndex();
 
  370            const item = ListView.view.currentItem;
 
  372                item.forceActiveFocus(
Qt.BacktabFocusReason);
 
  374            event.accepted = 
true;
 
  378    Accessible.role: Accessible.Button
 
  379    Accessible.name: title
 
  380    Accessible.description: subtitle
 
  382    PlasmaComponents3.ToolTip {
 
  383        text: listItem.title + (listItem.subtitle.length > 0 ? 
"\n" + listItem.subtitle : 
"")
 
  384        visible: mouseArea.containsMouse && (listItemTitle.truncated || listItemSubtitle.truncated)
 
  385        textFormat: listItem.allowStyledText ? Text.StyledText : Text.
PlainText 
  391        enabled: listItem.hasExpandableContent
 
  393        acceptedPointerTypes: PointerDevice.Generic | PointerDevice.Finger
 
  396            listItem.ListView.view.currentIndex = index
 
  397            listItem.toggleExpanded()
 
  407        acceptedButtons: 
Qt.NoButton
 
  416            if (parent.y - listItem.ListView.view.contentY >= 0 && parent.y - listItem.ListView.view.contentY + parent.height  + 1  < listItem.ListView.view.height) {
 
  417                listItem.ListView.view.currentIndex = (containsMouse ? index : -1)
 
  420        onExited: 
if (listItem.ListView.view.currentIndex === index) {
 
  421            listItem.ListView.view.currentIndex = -1;
 
  427            anchors.top: parent.top
 
  428            anchors.left: parent.left
 
  429            anchors.right: parent.right
 
  436                Layout.fillWidth: 
true 
  437                Layout.margins: 
Kirigami.Units.smallSpacing
 
  439                Layout.minimumHeight: defaultActionButton.height
 
  445                    implicitWidth: 
Kirigami.Units.iconSizes.medium
 
  446                    implicitHeight: 
Kirigami.Units.iconSizes.medium
 
  453                        anchors.right: parent.right
 
  454                        anchors.bottom: parent.bottom
 
  456                        implicitWidth: 
Kirigami.Units.iconSizes.small
 
  457                        implicitHeight: 
Kirigami.Units.iconSizes.small
 
  463                    Layout.fillWidth: 
true 
  464                    Layout.alignment: 
Qt.AlignVCenter
 
  471                        visible: text.length > 0
 
  473                        Layout.fillWidth: 
true 
  477                        textFormat: listItem.allowStyledText ? Text.StyledText : Text.PlainText
 
  478                        elide: Text.ElideRight
 
  484                        font.weight: listItem.isDefault && listItem.ListView.view.
count > 1
 
  489                    PlasmaComponents3.Label {
 
  492                        visible: text.length > 0
 
  496                        opacity: color === 
Kirigami.Theme.textColor ? 0.7 : 1.0
 
  498                        Layout.fillWidth: 
true 
  500                        textFormat: listItem.allowStyledText ? Text.StyledText : Text.PlainText
 
  501                        elide: Text.ElideRight
 
  502                        maximumLineCount: subtitleCanWrap ? (subtitleMaximumLineCount === -1 ? undefined : subtitleMaximumLineCount) : 1
 
  503                        wrapMode: subtitleCanWrap ? Text.WordWrap : Text.NoWrap
 
  508                PlasmaComponents3.BusyIndicator {
 
  511                    visible: listItem.isBusy
 
  514                    Layout.maximumHeight: defaultActionButton.implicitHeight
 
  515                    Layout.maximumWidth: Layout.maximumHeight
 
  519                PlasmaComponents3.ToolButton {
 
  520                    id: defaultActionButton
 
  522                    visible: defaultActionButtonAction
 
  523                            && listItem.defaultActionButtonVisible
 
  524                            && (!busyIndicator.visible || listItem.showDefaultActionButtonWhenBusy)
 
  526                    KeyNavigation.tab: expandToggleButton
 
  527                    KeyNavigation.
right: expandToggleButton
 
  528                    KeyNavigation.down: expandToggleButton.KeyNavigation.down
 
  529                    Keys.onUpPressed: 
event => listItem.Keys.upPressed(
event)
 
  531                    Accessible.
name: action !== null ? action.text : 
"" 
  535                PlasmaComponents3.ToolButton {
 
  536                    id: expandToggleButton
 
  537                    visible: listItem.hasExpandableContent
 
  539                    display: PlasmaComponents3.AbstractButton.IconOnly
 
  540                    text: expandedView.expanded ? 
i18ndc(
"libplasma6", 
"@action:button", 
"Collapse") : 
i18ndc(
"libplasma6", 
"@action:button", 
"Expand")
 
  541                    icon.
name: expandedView.expanded ? 
"collapse" : 
"expand" 
  543                    Keys.onUpPressed: 
event => listItem.Keys.upPressed(
event)
 
  545                    onClicked: listItem.toggleExpanded()
 
  547                    PlasmaComponents3.ToolTip {
 
  557                property bool expanded: false
 
  559                Layout.preferredHeight: expanded ?
 
  560                    expandedViewLayout.implicitHeight + expandedViewLayout.anchors.topMargin + expandedViewLayout.anchors.bottomMargin : 0
 
  561                Layout.fillWidth: true
 
  563                opacity: expanded ? 1 : 0
 
  564                Behavior on opacity {
 
  565                    enabled: listItem.ListView.view.highlightResizeDuration > 0
 
  567                        id: expandedItemOpacityFade
 
  568                        duration: listItem.ListView.view.highlightResizeDuration || -1
 
  570                        velocity: listItem.ListView.view.highlightResizeVelocity / 200
 
  571                        easing.
type: Easing.InOutCubic
 
  577                    id: expandedViewLayout
 
  585                        id: actionsListLoader
 
  587                        visible: 
status === Loader.Ready
 
  588                        active: expandedView.visible && listItem.__enabledContextualActions.length > 0
 
  590                        Layout.fillWidth: true
 
  592                        sourceComponent: 
Item {
 
  593                            height: childrenRect.height
 
  594                            width: actionsListLoader.width 
 
  597                                anchors.top: parent.top
 
  608                                    model: listItem.__enabledContextualActions
 
  610                                    delegate: PlasmaComponents3.ToolButton {
 
  611                                        required property int index
 
  612                                        required property T.
Action modelData
 
  614                                        Layout.fillWidth: true
 
  619                                        KeyNavigation.
up: index > 0 ? actionRepeater.itemAt(index - 1) : expandToggleButton
 
  620                                        Keys.onDownPressed: 
event => {
 
  621                                            if (index === actionRepeater.count - 1) {
 
  622                                                event.accepted = true;
 
  623                                                listItem.ListView.view.incrementCurrentIndex();
 
  624                                                listItem.ListView.view.currentItem.forceActiveFocus(Qt.TabFocusReason);
 
  626                                                event.accepted = false; 
 
  642                        Layout.fillWidth: 
true 
  643                        imagePath: 
"widgets/line" 
  644                        elementId: 
"horizontal-line" 
  645                        visible: actionsListLoader.visible && customContentLoader.visible
 
  650                        id: customContentLoader
 
  651                        visible: 
status === Loader.Ready
 
  653                        Layout.fillWidth: 
true 
  655                        active: expandedView.visible
 
  657                        sourceComponent: listItem.customExpandedViewContent
 
bool hasExpandableContent
 
alias expanded
expanded: bool Whether the expanded view is visible.
 
Q_SCRIPTABLE CaptureState status()
 
QString i18ndc(const char *domain, const char *context, const char *text, const TYPE &arg...)
 
AKONADI_CALENDAR_EXPORT KCalendarCore::Event::Ptr event(const Akonadi::Item &item)
 
Type type(const QSqlDatabase &db)
 
QStringView level(QStringView ifopt)
 
QString name(StandardAction id)
 
const QList< QKeySequence > & up()
 
QStringList filter(QStringView str, Qt::CaseSensitivity cs) const const
 
qsizetype count(QChar ch, Qt::CaseSensitivity cs) const const
 
QTextStream & left(QTextStream &stream)
 
QTextStream & right(QTextStream &stream)