From 43aa73617d790b695aa14443d162ad001b9d315b Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Mon, 20 Feb 2017 17:04:23 +0100 Subject: Turn the mailviewer into a component as well --- components/mailviewer/qml/.directory | 4 -- components/mailviewer/qml/EmbededPart.qml | 54 ------------------- components/mailviewer/qml/EncryptionPart.qml | 75 --------------------------- components/mailviewer/qml/GREEN.png | Bin 153 -> 0 bytes components/mailviewer/qml/GREY.png | Bin 153 -> 0 bytes components/mailviewer/qml/HtmlContent.qml | 70 ------------------------- components/mailviewer/qml/MailDataModel.qml | 66 ----------------------- components/mailviewer/qml/MailPart.qml | 47 ----------------- components/mailviewer/qml/MailViewer.qml | 46 ---------------- components/mailviewer/qml/PURPLE.png | Bin 153 -> 0 bytes components/mailviewer/qml/RED.png | Bin 153 -> 0 bytes components/mailviewer/qml/SignaturePart.qml | 68 ------------------------ components/mailviewer/qml/TextContent.qml | 61 ---------------------- components/mailviewer/qml/YELLOW.png | Bin 153 -> 0 bytes components/mailviewer/qml/qmldir | 3 -- 15 files changed, 494 deletions(-) delete mode 100644 components/mailviewer/qml/.directory delete mode 100644 components/mailviewer/qml/EmbededPart.qml delete mode 100644 components/mailviewer/qml/EncryptionPart.qml delete mode 100644 components/mailviewer/qml/GREEN.png delete mode 100644 components/mailviewer/qml/GREY.png delete mode 100644 components/mailviewer/qml/HtmlContent.qml delete mode 100644 components/mailviewer/qml/MailDataModel.qml delete mode 100644 components/mailviewer/qml/MailPart.qml delete mode 100644 components/mailviewer/qml/MailViewer.qml delete mode 100644 components/mailviewer/qml/PURPLE.png delete mode 100644 components/mailviewer/qml/RED.png delete mode 100644 components/mailviewer/qml/SignaturePart.qml delete mode 100644 components/mailviewer/qml/TextContent.qml delete mode 100644 components/mailviewer/qml/YELLOW.png delete mode 100644 components/mailviewer/qml/qmldir (limited to 'components/mailviewer/qml') diff --git a/components/mailviewer/qml/.directory b/components/mailviewer/qml/.directory deleted file mode 100644 index 5dfa7480..00000000 --- a/components/mailviewer/qml/.directory +++ /dev/null @@ -1,4 +0,0 @@ -[Dolphin] -PreviewsShown=true -Timestamp=2016,11,5,15,10,37 -Version=3 diff --git a/components/mailviewer/qml/EmbededPart.qml b/components/mailviewer/qml/EmbededPart.qml deleted file mode 100644 index 8921ab6f..00000000 --- a/components/mailviewer/qml/EmbededPart.qml +++ /dev/null @@ -1,54 +0,0 @@ -/* - Copyright (C) 2016 Michael Bohlender, - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ - -import QtQuick 2.4 - -Item { - - height: mailPart.height - width: mailPart.width - - - Rectangle { - id: border - color: "lightgrey" - height: mailPart.height - width: 5 - } - - Text { - id: sender - - anchors { - left: border.right - leftMargin: 15 - } - - text: "sent by " + model.sender + " on " + model.date - color: "grey" - } - - MailPart { - id: mailPart - - anchors.top: sender.bottom - - } - -} - diff --git a/components/mailviewer/qml/EncryptionPart.qml b/components/mailviewer/qml/EncryptionPart.qml deleted file mode 100644 index 058c9af7..00000000 --- a/components/mailviewer/qml/EncryptionPart.qml +++ /dev/null @@ -1,75 +0,0 @@ -/* - Copyright (C) 2016 Michael Bohlender, - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ - -import QtQuick 2.4 - -Item { - id: encryption - property alias rootIndex: visualModel.rootIndex - property bool debug: true - height: partListView.height - width: parent.width - - MailDataModel { - id: visualModel - debug: encryption.debug - model: messageParser.newTree - } - - Column { - id: partListView - anchors { - top: parent.top - left: parent.left - } - width: parent.width - spacing: 5 - Text { - width: parent.width - visible: encryption.debug - text: model.type - } - Text { - visible: model.errorType || encryption.debug - text: model.errorType + ": " + model.errorString - } - BorderImage { - width: parent.width - height: childrenRect.height + 40 - border { left: 5; top: 5; right: 6; bottom: 6 } - horizontalTileMode: BorderImage.Round - verticalTileMode: BorderImage.Round - - source: /* "securityborders"+ */ model.securityLevel +".png" - ListView { - model: visualModel - anchors { - top: parent.top - left: parent.left - margins: 20 - } - height: contentHeight - width: parent.width - 40 - - spacing: 20 - - interactive: false - } - } - } -} diff --git a/components/mailviewer/qml/GREEN.png b/components/mailviewer/qml/GREEN.png deleted file mode 100644 index 60f8e10d..00000000 Binary files a/components/mailviewer/qml/GREEN.png and /dev/null differ diff --git a/components/mailviewer/qml/GREY.png b/components/mailviewer/qml/GREY.png deleted file mode 100644 index 146e8927..00000000 Binary files a/components/mailviewer/qml/GREY.png and /dev/null differ diff --git a/components/mailviewer/qml/HtmlContent.qml b/components/mailviewer/qml/HtmlContent.qml deleted file mode 100644 index 4fc694f9..00000000 --- a/components/mailviewer/qml/HtmlContent.qml +++ /dev/null @@ -1,70 +0,0 @@ -/* - Copyright (C) 2016 Michael Bohlender, - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ - -import QtQuick 2.4 -import QtQuick.Controls 1.3 -import QtWebEngine 1.3 - -Item { - id: root - property string content: model.content - //We have to give it a minimum size so the html content starts to expand - property int contentHeight: 10; - - height: contentHeight - width: partColumn.width - - WebEngineView { - id: htmlView - anchors.fill: parent - Component.onCompleted: loadHtml(content, "file:///") - onContentsSizeChanged: { - root.contentHeight = contentsSize.height; - } - onLoadingChanged: { - if (loadRequest.status === WebEngineView.LoadFailedStatus) { - console.warn("Failed to load html content."); - console.warn("Error is ", loadRequest.errorString); - } - } - settings { - webGLEnabled: false - touchIconsEnabled: false - spatialNavigationEnabled: false - screenCaptureEnabled: false - pluginsEnabled: false - localStorageEnabled: false - localContentCanAccessRemoteUrls: false - localContentCanAccessFileUrls: false - linksIncludedInFocusChain: false - javascriptEnabled: false - javascriptCanOpenWindows: false - javascriptCanAccessClipboard: false - hyperlinkAuditingEnabled: false - fullScreenSupportEnabled: false - errorPageEnabled: false - //defaultTextEncoding: ??? - autoLoadImages: false - autoLoadIconsForPage: false - accelerated2dCanvasEnabled: false - } - } - onContentChanged: { - htmlView.loadHtml(content, "file:///"); - } -} diff --git a/components/mailviewer/qml/MailDataModel.qml b/components/mailviewer/qml/MailDataModel.qml deleted file mode 100644 index e0e65c49..00000000 --- a/components/mailviewer/qml/MailDataModel.qml +++ /dev/null @@ -1,66 +0,0 @@ -/* - Copyright (C) 2016 Michael Bohlender, - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ - -import QtQuick 2.4 -import QtQml.Models 2.2 - -DelegateModel { - id: mailDataModel - property bool debug: true - delegate: Item { - id: partColumn - width: parent.width - height: childrenRect.height - Loader { - id: partLoader - anchors { - top: parent.top - left: parent.left - } - height: item? item.contentHeight : 0 - width: parent.width - } - Component.onCompleted: { - switch (model.type) { - case "PlainTextContent": - case "Content": - partLoader.source = "TextContent.qml" - partLoader.item.debug = mailDataModel.debug - return; - case "HtmlContent": - partLoader.source = "HtmlContent.qml" - return; - case "Signature": - partLoader.source = "SignaturePart.qml" - partLoader.item.rootIndex = mailDataModel.modelIndex(index) - partLoader.item.debug = mailDataModel.debug - return; - case "Encryption": - partLoader.source = "EncryptionPart.qml" - partLoader.item.rootIndex = mailDataModel.modelIndex(index) - partLoader.item.debug = mailDataModel.debug - return; - } - if (model.hasModelChildren) { - partLoader.source = "MailPart.qml" - partLoader.item.rootIndex = mailDataModel.modelIndex(index) - partLoader.item.debug = mailDataModel.debug - } - } - } -} diff --git a/components/mailviewer/qml/MailPart.qml b/components/mailviewer/qml/MailPart.qml deleted file mode 100644 index 30bf1ee0..00000000 --- a/components/mailviewer/qml/MailPart.qml +++ /dev/null @@ -1,47 +0,0 @@ -/* - Copyright (C) 2016 Michael Bohlender, - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ - -import QtQuick 2.4 - -Item { - id: root - property alias rootIndex: visualModel.rootIndex - property bool debug: true - height: partListView.height + 10 - width: parent.width - - MailDataModel { - id: visualModel - debug: root.debug - model: messageParser.newTree - } - - ListView { - id: partListView - model: visualModel - anchors { - top: parent.top - left: parent.left - margins: 5 - } - spacing: 5 - height: contentHeight - width: parent.width - 10 - interactive: false - } -} diff --git a/components/mailviewer/qml/MailViewer.qml b/components/mailviewer/qml/MailViewer.qml deleted file mode 100644 index 0f7efca2..00000000 --- a/components/mailviewer/qml/MailViewer.qml +++ /dev/null @@ -1,46 +0,0 @@ -/* - Copyright (C) 2016 Michael Bohlender, - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ - -import QtQuick 2.4 - -Item { - id: root - property alias rootIndex: visualModel.rootIndex - property bool debug: false - height: partListView.height - - MailDataModel { - id: visualModel - debug: root.debug - model: messageParser.newTree - } - - ListView { - id: partListView - model: visualModel - anchors { - top: parent.top - left: parent.left - margins: 5 - } - spacing: 5 - height: contentHeight - width: parent.width - 10 - interactive: false - } -} diff --git a/components/mailviewer/qml/PURPLE.png b/components/mailviewer/qml/PURPLE.png deleted file mode 100644 index 5ea1eda2..00000000 Binary files a/components/mailviewer/qml/PURPLE.png and /dev/null differ diff --git a/components/mailviewer/qml/RED.png b/components/mailviewer/qml/RED.png deleted file mode 100644 index 5bb547e2..00000000 Binary files a/components/mailviewer/qml/RED.png and /dev/null differ diff --git a/components/mailviewer/qml/SignaturePart.qml b/components/mailviewer/qml/SignaturePart.qml deleted file mode 100644 index 0a2fe525..00000000 --- a/components/mailviewer/qml/SignaturePart.qml +++ /dev/null @@ -1,68 +0,0 @@ -/* - Copyright (C) 2016 Michael Bohlender, - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ - -import QtQuick 2.4 - -Item { - id: signature - property alias rootIndex: visualModel.rootIndex - property bool debug: true - height: partListView.height - width: parent.width - - MailDataModel { - id: visualModel - debug: signature.debug - model: messageParser.newTree - } - Column { - id: partListView - anchors { - top: parent.top - left: parent.left - } - width: parent.width - spacing: 5 - Text { - width: parent.width - visible: signature.debug - text: model.type - } - BorderImage { - width: parent.width - height: childrenRect.height + 40 - border { left: 5; top: 5; right: 6; bottom: 6 } - horizontalTileMode: BorderImage.Round - verticalTileMode: BorderImage.Round - source: /* "securityborders"+ */ model.securityLevel +".png" - ListView { - model: visualModel - anchors { - top: parent.top - left: parent.left - margins: 20 - } - height: contentHeight - width: parent.width - 40 - - spacing: 20 - interactive: false - } - } - } -} diff --git a/components/mailviewer/qml/TextContent.qml b/components/mailviewer/qml/TextContent.qml deleted file mode 100644 index d3ae80f9..00000000 --- a/components/mailviewer/qml/TextContent.qml +++ /dev/null @@ -1,61 +0,0 @@ -/* - Copyright (C) 2016 Michael Bohlender, - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ - -import QtQuick 2.7 -import org.kde.kirigami 1.0 as Kirigami - -Item { - id: textItem - - property bool debug: true - - width: partColumn.width - height: textColumn.height - - Column { - id: textColumn - - anchors { - top: parent.top - left: parent.left - } - - width: parent.width - spacing: 5 - - TextEdit { - width: parent.width - - readOnly: true - selectByMouse: true - - text: model.content - wrapMode: Text.WordWrap - - color: model.embeded ? Kirigami.Theme.diabledTextColor : Kirigami.Theme.textColor - } - - //BEGIN debug - Text { - width: parent.width - visible: textItem.debug - text: model.type - } - //END debug - } -} diff --git a/components/mailviewer/qml/YELLOW.png b/components/mailviewer/qml/YELLOW.png deleted file mode 100644 index db629e35..00000000 Binary files a/components/mailviewer/qml/YELLOW.png and /dev/null differ diff --git a/components/mailviewer/qml/qmldir b/components/mailviewer/qml/qmldir deleted file mode 100644 index 0d87b779..00000000 --- a/components/mailviewer/qml/qmldir +++ /dev/null @@ -1,3 +0,0 @@ -module org.kube.mailviewer - -MailViewer 1.0 MailViewer.qml -- cgit v1.2.3