Warning, /plasma-mobile/plasma-dialer/plasma-dialer/src/qml/DialerPage.qml is written in an unsupported language. File is not indexed.

0001 /*
0002  *   SPDX-FileCopyrightText: 2014 Aaron Seigo <aseigo@kde.org>
0003  *   SPDX-FileCopyrightText: 2014 Marco Martin <mart@kde.org>
0004  *
0005  *   SPDX-License-Identifier: LGPL-2.0-or-later
0006  */
0007 
0008 import QtQuick
0009 import QtQuick.Layouts
0010 import QtQuick.Controls as QQC2
0011 import org.kde.kirigami as Kirigami
0012 
0013 import org.kde.telephony
0014 
0015 import "call"
0016 import "dialpad"
0017 
0018 Kirigami.Page {
0019     id: dialerPage
0020 
0021     property alias numberEntryText: statusLabel.text
0022     property alias pad: dialPad
0023     
0024     // page animation
0025     property real yTranslate: 0
0026 
0027     title: i18n("Dialer")
0028     icon.name: "call-start"
0029 
0030     leftPadding: 0
0031     rightPadding: 0
0032     topPadding: 0
0033     bottomPadding: 0
0034 
0035     Connections {
0036         target: ActiveCallModel
0037         function onActiveChanged() {
0038             const callPage = getPage("Call")
0039             if (ActiveCallModel.active) {
0040                 applicationWindow().pageStack.layers.push(callPage, 1)
0041             } else {
0042                 if (pageStack.layers.currentItem === callPage) {
0043                     pageStack.layers.pop()
0044                     if (ScreenSaverUtils.getActive()) {
0045                         Qt.quit()
0046                     }
0047                 }
0048             }
0049         }
0050     }
0051 
0052     Kirigami.Action {
0053         id: settingsAction
0054         displayHint: Kirigami.DisplayHint.IconOnly
0055         visible: !applicationWindow().isWidescreen
0056         enabled: !applicationWindow().lockscreenMode
0057         text: i18n("Settings")
0058         onTriggered: applicationWindow().pageStack.push(applicationWindow().getPage("Settings"))
0059     }
0060 
0061     Component.onCompleted: {
0062         // dynamic check could be dropped with KF6-only versions
0063         // https://invent.kde.org/frameworks/kirigami/-/merge_requests/986
0064         if (dialerPage.mainAction !== undefined) {
0065             dialerPage.mainAction = settingsAction
0066         } else {
0067             dialerPage.actions = settingsAction
0068         }
0069 
0070         // https://invent.kde.org/frameworks/kirigami/-/merge_requests/942
0071         const name = "settings-configure"
0072         if (settingsAction.iconName !== undefined) {
0073             settingsAction.iconName = name
0074         } else {
0075             settingsAction.icon.name = name
0076         }
0077     }
0078 
0079     header: ColumnLayout {
0080         anchors.margins: Kirigami.Units.smallSpacing
0081         spacing: Kirigami.Units.smallSpacing
0082         Kirigami.InlineMessage {
0083             id: devicesError
0084             Layout.fillWidth: true
0085             Layout.leftMargin: Kirigami.Units.smallSpacing
0086             Layout.rightMargin: Kirigami.Units.smallSpacing
0087             type: Kirigami.MessageType.Error
0088             text: i18n("Modem devices are not found")
0089             visible: DeviceUtils.deviceUniList.length < 1
0090         }
0091         Kirigami.InlineMessage {
0092             id: voicemailError
0093             Layout.fillWidth: true
0094             Layout.leftMargin: Kirigami.Units.smallSpacing
0095             Layout.rightMargin: Kirigami.Units.smallSpacing
0096             type: Kirigami.MessageType.Error
0097             text: i18n("Voicemail number couldn't be found")
0098             visible: dialPad.voicemailFail
0099         }
0100 
0101         InCallInlineMessage {}
0102     }
0103 
0104     ColumnLayout {
0105         id: dialPadArea
0106         transform: Translate { y: yTranslate }
0107         anchors.fill: parent
0108         spacing: 0
0109 
0110         QQC2.ScrollView {
0111             id: scrollView
0112             contentWidth: -1 // no horizontal scrolling necessary
0113             Layout.minimumWidth: dialerPage.width
0114             Layout.maximumWidth: dialerPage.width
0115             Layout.preferredHeight: applicationWindow().smallMode ? implicitHeight : parent.height * 0.3
0116             
0117             QQC2.Label {
0118                 id: statusLabel
0119 
0120                 horizontalAlignment: Qt.AlignHCenter
0121                 verticalAlignment: implicitHeight > scrollView.height ? Qt.AlignTop : Qt.AlignVCenter
0122                 width: dialerPage.width
0123                 height: scrollView.height
0124                 font.pixelSize: applicationWindow().smallMode ? Kirigami.Units.gridUnit * 1.6 : Kirigami.Units.gridUnit * 2.3
0125                 font.weight: Font.Light
0126                 wrapMode: QQC2.Label.WrapAnywhere
0127 
0128                 text: CallUtils.formatNumber(dialPad.number)
0129             }
0130         }
0131 
0132         Kirigami.Separator {
0133             Layout.fillWidth: true
0134         }
0135 
0136         Rectangle {
0137             Layout.fillWidth: true
0138             Layout.fillHeight: true
0139             Kirigami.Theme.colorSet: Kirigami.Theme.View
0140             Kirigami.Theme.inherit: false
0141             color: Kirigami.Theme.backgroundColor
0142 
0143             Dialpad {
0144                 id: dialPad
0145                 anchors.fill: parent
0146                 anchors.bottomMargin: Kirigami.Units.largeSpacing * 2
0147                 anchors.topMargin: Kirigami.Units.largeSpacing * 2
0148                 anchors.leftMargin: Kirigami.Units.largeSpacing * 3
0149                 anchors.rightMargin: Kirigami.Units.largeSpacing * 3
0150                 focus: true
0151             }
0152         }
0153     }
0154 }