Warning, /pim/kube/framework/qml/mailpartview/main.qml is written in an unsupported language. File is not indexed.

0001 /*
0002  * Copyright (C) 2017 Christian Mollekopf, <mollekopf@kolabsys.com>
0003  *
0004  * This program is free software; you can redistribute it and/or modify
0005  * it under the terms of the GNU General Public License as published by
0006  * the Free Software Foundation; either version 2 of the License, or
0007  * (at your option) any later version.
0008  *
0009  * This program is distributed in the hope that it will be useful,
0010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0012  * GNU General Public License for more details.
0013  *
0014  * You should have received a copy of the GNU General Public License along
0015  * with this program; if not, write to the Free Software Foundation, Inc.,
0016  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
0017  */
0018 
0019 import QtQuick 2.7
0020 import QtQuick.Controls 2.0
0021 import org.kube.framework 1.0 as Kube
0022 import org.kube.test 1.0
0023 
0024 ApplicationWindow {
0025     id: app
0026     height: 900
0027     width: 1500
0028     //Pass as --file=$filename argument
0029     property string filepath: ""
0030 
0031     Component.onCompleted: {
0032         app.filepath = Qt.application.arguments[2].replace("--file=", "")
0033         var initialState = {
0034             accounts: [
0035                 {
0036                     id: "account1",
0037                     name: "Test Account"
0038                 }
0039             ],
0040             identities: [{
0041                 account: "account1",
0042                 name: "Test Identity",
0043                 address: "identity@example.org"
0044             }],
0045             resources: [
0046                 {
0047                     id: "caldavresource",
0048                     account: "account1",
0049                     type: "caldav",
0050                 },
0051                 {
0052                     id: "caldavresource2",
0053                     account: "account2",
0054                     type: "caldav",
0055                 }
0056             ],
0057             calendars: [{
0058                 id: "calendar1",
0059                 resource: "caldavresource",
0060                 name: "Test Calendar",
0061                 color: "#af1a6a",
0062                 contentTypes: ["event"],
0063                 enabled: true
0064             },
0065             {
0066                 id: "calendar16",
0067                 resource: "caldavresource",
0068                 name: "Test Calendar16",
0069                 color: "#f67400",
0070                 contentTypes: ["event"],
0071                 enabled: true
0072             },
0073             {
0074                 id: "account2calendar",
0075                 resource: "caldavresource2",
0076                 name: "Account2Calendar",
0077                 color: "#f67400",
0078                 contentTypes: ["event"],
0079                 enabled: true
0080             }],
0081         }
0082         TestStore.setup(initialState)
0083         Kube.Context.currentAccountId = "account1"
0084     }
0085 
0086     Kube.File {
0087         id: file
0088         path: app.filepath
0089     }
0090     Kube.MessageParser {
0091         id: messageParser
0092         message: file.data
0093     }
0094 
0095     Flickable {
0096         id: flickable
0097         anchors.fill: parent
0098         ScrollBar.vertical: Kube.ScrollBar { }
0099         contentWidth: parent.width
0100         contentHeight: partView.height
0101         MailPartView {
0102             id: partView
0103             width: parent.width
0104             model: messageParser.parts
0105             Rectangle {
0106                 anchors.fill: parent
0107                 border.color: "blue"
0108                 border.width: 2
0109                 color: "transparent"
0110             }
0111         }
0112 
0113         Kube.ScrollHelper {
0114             id: scrollHelper
0115             flickable: flickable
0116             anchors.fill: parent
0117         }
0118 
0119         //Intercept all scroll events,
0120         //necessary due to the webengineview
0121         Kube.MouseProxy {
0122             anchors.fill: parent
0123             target: scrollHelper
0124             forwardWheelEvents: true
0125         }
0126     }
0127 }