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/contents/ui/EmbededPart.qml | 54 +++++++++++++++ .../mailviewer/contents/ui/EncryptionPart.qml | 75 +++++++++++++++++++++ components/mailviewer/contents/ui/GREEN.png | Bin 0 -> 153 bytes components/mailviewer/contents/ui/GREY.png | Bin 0 -> 153 bytes components/mailviewer/contents/ui/HtmlContent.qml | 70 +++++++++++++++++++ .../mailviewer/contents/ui/MailDataModel.qml | 66 ++++++++++++++++++ components/mailviewer/contents/ui/MailPart.qml | 47 +++++++++++++ components/mailviewer/contents/ui/MailViewer.qml | 46 +++++++++++++ components/mailviewer/contents/ui/PURPLE.png | Bin 0 -> 153 bytes components/mailviewer/contents/ui/RED.png | Bin 0 -> 153 bytes .../mailviewer/contents/ui/SignaturePart.qml | 68 +++++++++++++++++++ components/mailviewer/contents/ui/TextContent.qml | 61 +++++++++++++++++ components/mailviewer/contents/ui/YELLOW.png | Bin 0 -> 153 bytes components/mailviewer/contents/ui/main.qml | 30 +++++++++ components/mailviewer/metadata.desktop | 8 +++ 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 - components/mailviewer/qmldir | 3 + 31 files changed, 528 insertions(+), 494 deletions(-) create mode 100644 components/mailviewer/contents/ui/EmbededPart.qml create mode 100644 components/mailviewer/contents/ui/EncryptionPart.qml create mode 100644 components/mailviewer/contents/ui/GREEN.png create mode 100644 components/mailviewer/contents/ui/GREY.png create mode 100644 components/mailviewer/contents/ui/HtmlContent.qml create mode 100644 components/mailviewer/contents/ui/MailDataModel.qml create mode 100644 components/mailviewer/contents/ui/MailPart.qml create mode 100644 components/mailviewer/contents/ui/MailViewer.qml create mode 100644 components/mailviewer/contents/ui/PURPLE.png create mode 100644 components/mailviewer/contents/ui/RED.png create mode 100644 components/mailviewer/contents/ui/SignaturePart.qml create mode 100644 components/mailviewer/contents/ui/TextContent.qml create mode 100644 components/mailviewer/contents/ui/YELLOW.png create mode 100644 components/mailviewer/contents/ui/main.qml create mode 100644 components/mailviewer/metadata.desktop 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 create mode 100644 components/mailviewer/qmldir (limited to 'components/mailviewer') diff --git a/components/mailviewer/contents/ui/EmbededPart.qml b/components/mailviewer/contents/ui/EmbededPart.qml new file mode 100644 index 00000000..8921ab6f --- /dev/null +++ b/components/mailviewer/contents/ui/EmbededPart.qml @@ -0,0 +1,54 @@ +/* + 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/contents/ui/EncryptionPart.qml b/components/mailviewer/contents/ui/EncryptionPart.qml new file mode 100644 index 00000000..058c9af7 --- /dev/null +++ b/components/mailviewer/contents/ui/EncryptionPart.qml @@ -0,0 +1,75 @@ +/* + 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/contents/ui/GREEN.png b/components/mailviewer/contents/ui/GREEN.png new file mode 100644 index 00000000..60f8e10d Binary files /dev/null and b/components/mailviewer/contents/ui/GREEN.png differ diff --git a/components/mailviewer/contents/ui/GREY.png b/components/mailviewer/contents/ui/GREY.png new file mode 100644 index 00000000..146e8927 Binary files /dev/null and b/components/mailviewer/contents/ui/GREY.png differ diff --git a/components/mailviewer/contents/ui/HtmlContent.qml b/components/mailviewer/contents/ui/HtmlContent.qml new file mode 100644 index 00000000..4fc694f9 --- /dev/null +++ b/components/mailviewer/contents/ui/HtmlContent.qml @@ -0,0 +1,70 @@ +/* + 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/contents/ui/MailDataModel.qml b/components/mailviewer/contents/ui/MailDataModel.qml new file mode 100644 index 00000000..e0e65c49 --- /dev/null +++ b/components/mailviewer/contents/ui/MailDataModel.qml @@ -0,0 +1,66 @@ +/* + 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/contents/ui/MailPart.qml b/components/mailviewer/contents/ui/MailPart.qml new file mode 100644 index 00000000..30bf1ee0 --- /dev/null +++ b/components/mailviewer/contents/ui/MailPart.qml @@ -0,0 +1,47 @@ +/* + 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/contents/ui/MailViewer.qml b/components/mailviewer/contents/ui/MailViewer.qml new file mode 100644 index 00000000..0f7efca2 --- /dev/null +++ b/components/mailviewer/contents/ui/MailViewer.qml @@ -0,0 +1,46 @@ +/* + 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/contents/ui/PURPLE.png b/components/mailviewer/contents/ui/PURPLE.png new file mode 100644 index 00000000..5ea1eda2 Binary files /dev/null and b/components/mailviewer/contents/ui/PURPLE.png differ diff --git a/components/mailviewer/contents/ui/RED.png b/components/mailviewer/contents/ui/RED.png new file mode 100644 index 00000000..5bb547e2 Binary files /dev/null and b/components/mailviewer/contents/ui/RED.png differ diff --git a/components/mailviewer/contents/ui/SignaturePart.qml b/components/mailviewer/contents/ui/SignaturePart.qml new file mode 100644 index 00000000..0a2fe525 --- /dev/null +++ b/components/mailviewer/contents/ui/SignaturePart.qml @@ -0,0 +1,68 @@ +/* + 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/contents/ui/TextContent.qml b/components/mailviewer/contents/ui/TextContent.qml new file mode 100644 index 00000000..d3ae80f9 --- /dev/null +++ b/components/mailviewer/contents/ui/TextContent.qml @@ -0,0 +1,61 @@ +/* + 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/contents/ui/YELLOW.png b/components/mailviewer/contents/ui/YELLOW.png new file mode 100644 index 00000000..db629e35 Binary files /dev/null and b/components/mailviewer/contents/ui/YELLOW.png differ diff --git a/components/mailviewer/contents/ui/main.qml b/components/mailviewer/contents/ui/main.qml new file mode 100644 index 00000000..e69dd5a2 --- /dev/null +++ b/components/mailviewer/contents/ui/main.qml @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2017 Christian Mollekopf, + * + * 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 QtQuick.Controls 2.0 as Controls2 + +Controls2.ApplicationWindow { + id: app + height: 900 + width: 1500 + + MailViewer { + visible: true + } +} diff --git a/components/mailviewer/metadata.desktop b/components/mailviewer/metadata.desktop new file mode 100644 index 00000000..c573ff89 --- /dev/null +++ b/components/mailviewer/metadata.desktop @@ -0,0 +1,8 @@ +[Desktop Entry] +Name=Kube Mailviewer +X-KDE-PluginInfo-Name=org.kube.components.mailviewer +Exec=kpackagelauncherqml -a org.kube.components.mailviewer +X-Plasma-MainScript=ui/main.qml +X-KDE-ServiceTypes=KPackage/GenericQML +Icon=kmail2 +Type=Service 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 diff --git a/components/mailviewer/qmldir b/components/mailviewer/qmldir new file mode 100644 index 00000000..0d87b779 --- /dev/null +++ b/components/mailviewer/qmldir @@ -0,0 +1,3 @@ +module org.kube.mailviewer + +MailViewer 1.0 MailViewer.qml -- cgit v1.2.3