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

0001 /*
0002  * Copyright (C) 2018 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 QtQuick.Window 2.0
0022 
0023 import org.kube.framework 1.0 as Kube
0024 import org.kube.test 1.0
0025 import "qml"
0026 
0027 ApplicationWindow {
0028     id: app
0029     height: Screen.desktopAvailableHeight * 0.8
0030     width: Screen.desktopAvailableWidth * 0.8
0031 
0032     Component.onCompleted: {
0033         var initialState = {
0034             accounts: [{
0035                     id: "account1",
0036                     name: "Test Account"
0037                 }],
0038             identities: [{
0039                     account: "account1",
0040                     name: "Test Identity",
0041                     address: "identity@example.org"
0042                 }],
0043             resources: [{
0044                     id: "resource1",
0045                     account: "account1",
0046                     type: "dummy"
0047                 },
0048                 {
0049                     id: "resource2",
0050                     account: "account1",
0051                     type: "mailtransport"
0052                 }],
0053             folders: [{
0054                     id: "folder1",
0055                     resource: "resource1",
0056                     name: "Folder 1",
0057                     specialpurpose: ["drafts"],
0058                     mails: [{
0059                             resource: "resource1",
0060                             messageId: "<msg1@test.com>",
0061                             date: "2017-07-24T15:46:29",
0062                             subject: "subject1",
0063                             body: "body",
0064                             to: ["to@example.org"],
0065                             cc: ["cc@example.org"],
0066                             bcc: ["bcc@example.org"],
0067                             draft: true
0068                         },
0069                         {
0070                             resource: "resource1",
0071                             messageId: "<msg2@test.com>",
0072                             date: "2017-07-23T15:46:29",
0073                             subject: "LooooooooooooooooooooooooooooooooooooooooooooooooooooooooonggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggEnd",
0074                             body: "LooooooooooooooooooooooooooooooooooooooooooooooooooooooooonggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggEnd\nbody\nbody\n\n\nbody\n\n\nbody\n\n\nbody\n\n\nbody\nbody\n\n\nbody\n\n\nbody\n\n\nbody\n\n\nbody\n\n\n\n\n\n\n\n\nbody\nbody\n\n\nbody\n\n\nbody\n\n\nbody\n\n\nbody\n\n\nbody",
0075                             to: ["toLoooooooooooooooooooooooooooooooooooooooooooooooooong@example.org"],
0076                             cc: ["ccLoooooooooooooooooooooooooooooooooooooooooooooooooong@example.org"],
0077                             bcc: ["bccLoooooooooooooooooooooooooooooooooooooooooooooooooong@example.org"],
0078                             draft: true
0079                         }
0080                     ]
0081                 }],
0082         }
0083         TestStore.setup(initialState)
0084         Kube.Fabric.postMessage(
0085             Kube.Messages.notification,
0086             {
0087                 "type": Kube.Notifications.error,
0088                 "subtype": Kube.Notifications.loginError,
0089                 message: "Failed to login",
0090                 resource: "resource1",
0091                 entities: []
0092             }
0093         );
0094         Kube.Fabric.postMessage(
0095             Kube.Messages.notification,
0096             {
0097                 "type": Kube.Notifications.error,
0098                 "subtype": Kube.Notifications.hostNotFoundError,
0099                 message: "Host Not Found",
0100                 resource: "resource1",
0101                 entities: []
0102             }
0103         )
0104         Kube.Fabric.postMessage(
0105             Kube.Messages.notification,
0106             {
0107                 "type": Kube.Notifications.error,
0108                 "subtype": Kube.Notifications.connectionError,
0109                 message: "connection error",
0110                 resource: "resource1",
0111                 entities: []
0112             }
0113         )
0114         var mail = TestStore.load("mail", {messageId: "msg1@test.com"})
0115         var mail_uid = TestStore.read(mail).uid
0116         Kube.Fabric.postMessage(
0117             Kube.Messages.notification,
0118             {
0119                 "type": Kube.Notifications.error,
0120                 "subtype": Kube.Notifications.transmissionError,
0121                 message: "transmission error with mail uid",
0122                 resource: "resource1",
0123                 entities: [mail_uid]
0124             }
0125         )
0126         var mail2 = TestStore.load("mail", {messageId: "msg2@test.com"})
0127         var mail2_uid = TestStore.read(mail2).uid
0128         Kube.Fabric.postMessage(
0129             Kube.Messages.notification,
0130             {
0131                 "type": Kube.Notifications.error,
0132                 "subtype": Kube.Notifications.transmissionError,
0133                 message: "transmission error with another mail uid",
0134                 resource: "resource1",
0135                 entities: [mail2_uid]
0136             }
0137         )
0138         Kube.Fabric.postMessage(
0139             Kube.Messages.notification,
0140             {
0141                 "type": Kube.Notifications.error,
0142                 "subtype": "customSubType",
0143                 message: "custom subtype error",
0144                 resource: "resource1",
0145                 entities: []
0146             }
0147         )
0148     }
0149 
0150     View {
0151         anchors.fill: parent
0152     }
0153 }