From 998d5857d831a5fa603ce3e8156f4b6065b4d7af Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Thu, 17 Aug 2017 21:06:39 -0600 Subject: Turned the debugview into a component that is created on demand --- framework/qml/MailViewer.qml | 189 ++++++++++++++++++++++--------------------- 1 file changed, 96 insertions(+), 93 deletions(-) diff --git a/framework/qml/MailViewer.qml b/framework/qml/MailViewer.qml index d16fde7c..329ef217 100644 --- a/framework/qml/MailViewer.qml +++ b/framework/qml/MailViewer.qml @@ -46,7 +46,7 @@ Rectangle { Shortcut { sequence: "V" - onActivated: debugPopup.open() + onActivated: debugPopupComponent.createObject(root).open() enabled: root.current } @@ -390,106 +390,109 @@ Rectangle { } } - Kube.Popup { - id: debugPopup - modal: true - parent: ApplicationWindow.overlay - closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent - x: (parent.width - width)/2 - y: Kube.Units.largeSpacing - width: parent.width / 2 - height: parent.height - Kube.Units.largeSpacing * 2 - clip: true - - Flickable { - id: flickable - anchors.fill: parent - ScrollBar.vertical: ScrollBar {} - contentHeight: content.height - contentWidth: parent.width - Column { - id: content - width: flickable.width - height: childrenRect.height - - TextEdit { - id: rawContent - width: parent.width - readOnly: true - selectByMouse: true - textFormat: TextEdit.PlainText - wrapMode: TextEdit.Wrap - height: implicitHeight - text: messageParser.rawContent - } - Rectangle { - color: "black" - height: 2 - } - Controls1.TreeView { - id: mailStructure - width: parent.width - height: implicitHeight - Controls1.TableViewColumn { - role: "type" - title: "Type" - } - Controls1.TableViewColumn { - role: "embeded" - title: "Embeded" - } - Controls1.TableViewColumn { - role: "securityLevel" - title: "SecurityLevel" + Component { + id: debugPopupComponent + Kube.Popup { + id: debugPopup + modal: true + parent: ApplicationWindow.overlay + closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent + x: (parent.width - width)/2 + y: Kube.Units.largeSpacing + width: parent.width / 2 + height: parent.height - Kube.Units.largeSpacing * 2 + clip: true + + Flickable { + id: flickable + anchors.fill: parent + ScrollBar.vertical: ScrollBar {} + contentHeight: content.height + contentWidth: parent.width + Column { + id: content + width: flickable.width + height: childrenRect.height + + TextEdit { + id: rawContent + width: parent.width + readOnly: true + selectByMouse: true + textFormat: TextEdit.PlainText + wrapMode: TextEdit.Wrap + height: implicitHeight + text: messageParser.rawContent } - Controls1.TableViewColumn { - role: "content" - title: "Content" + Rectangle { + color: "black" + height: 2 } - model: messageParser.parts - itemDelegate: Item { - property variant currentData: styleData.value - Text { - anchors.fill: parent - color: styleData.textColor - elide: Text.ElideRight - text: styleData.value ? styleData.value : "" - textFormat: Text.PlainText + Controls1.TreeView { + id: mailStructure + width: parent.width + height: implicitHeight + Controls1.TableViewColumn { + role: "type" + title: "Type" + } + Controls1.TableViewColumn { + role: "embeded" + title: "Embeded" + } + Controls1.TableViewColumn { + role: "securityLevel" + title: "SecurityLevel" } - MouseArea { - anchors.fill: parent - onClicked: { - textEdit.text = styleData.value + Controls1.TableViewColumn { + role: "content" + title: "Content" + } + model: messageParser.parts + itemDelegate: Item { + property variant currentData: styleData.value + Text { + anchors.fill: parent + color: styleData.textColor + elide: Text.ElideRight + text: styleData.value ? styleData.value : "" + textFormat: Text.PlainText + } + MouseArea { + anchors.fill: parent + onClicked: { + textEdit.text = styleData.value + } } } } - } - Controls1.TreeView { - id: attachmentsTree - width: parent.width - height: implicitHeight - Controls1.TableViewColumn { - role: "type" - title: "Type" - } - Controls1.TableViewColumn { - role: "name" - title: "Name" + Controls1.TreeView { + id: attachmentsTree + width: parent.width + height: implicitHeight + Controls1.TableViewColumn { + role: "type" + title: "Type" + } + Controls1.TableViewColumn { + role: "name" + title: "Name" + } + Controls1.TableViewColumn { + role: "size" + title: "Size" + } + model: messageParser.attachments } - Controls1.TableViewColumn { - role: "size" - title: "Size" + TextEdit { + id: textEdit + width: parent.width + readOnly: true + selectByMouse: true + textFormat: TextEdit.PlainText + wrapMode: TextEdit.Wrap + height: implicitHeight } - model: messageParser.attachments - } - TextEdit { - id: textEdit - width: parent.width - readOnly: true - selectByMouse: true - textFormat: TextEdit.PlainText - wrapMode: TextEdit.Wrap - height: implicitHeight } } } -- cgit v1.2.3