Warning, /pim/kube/views/inbound/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                 {
0039                     id: "account2",
0040                     name: "Test Account2"
0041                 }
0042             ],
0043             identities: [{
0044                     account: "account1",
0045                     name: "Test Identity",
0046                     address: "identity@example.org"
0047                 }
0048             ],
0049             resources: [{
0050                     id: "resource1",
0051                     account: "account1",
0052                     type: "dummy"
0053                 },
0054                 {
0055                     id: "resource2",
0056                     account: "account1",
0057                     type: "mailtransport"
0058                 },
0059                 {
0060                     id: "resource3",
0061                     account: "account2",
0062                     type: "dummy"
0063                 },
0064                 {
0065                     id: "caldavresource",
0066                     account: "account1",
0067                     type: "caldav",
0068                 },
0069             ],
0070             folders: [{
0071                     resource: "resource1",
0072                     name: "Folder 1",
0073                     mails: [
0074                         {
0075                             resource: "resource1",
0076                             messageId: "<msg0@test.com>",
0077                             date: "2018-04-08T11:04:03",
0078                             subject: "subject",
0079                             body: "body",
0080                             to: ["to@example.org"],
0081                             cc: ["cc@example.org"],
0082                             bcc: ["bcc@example.org"],
0083                             unread: true
0084                         },
0085                         {
0086                             resource: "resource1",
0087                             messageId: "<msg1@test.com>",
0088                             date: "2017-07-24T15:46:29",
0089                             subject: "subject1",
0090                             body: "body",
0091                             to: ["to@example.org"],
0092                             cc: ["cc@example.org"],
0093                             bcc: ["bcc@example.org"],
0094                             unread: true
0095                         },
0096                         {
0097                             resource: "resource1",
0098                             inReplyTo: "<msg1@test.com>",
0099                             date: "2017-07-24T16:46:29",
0100                             subject: "subject2",
0101                             body: "body2",
0102                             to: ["to@example.org"],
0103                             unread: true
0104                         },
0105                         {
0106                             resource: "resource1",
0107                             inReplyTo: "<msg1@test.com>",
0108                             date: "2017-07-24T17:46:29",
0109                             subject: "subject3",
0110                             body: "body3\n\n\n\nfoo\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nThe End",
0111                             to: ["to@example.org"],
0112                             unread: true
0113                         },
0114                         {
0115                             resource: "resource1",
0116                             inReplyTo: "<msg1@test.com>",
0117                             date: "2017-07-24T18:46:29",
0118                             subject: "subject4",
0119                             body: "body4",
0120                             to: ["to@example.org"],
0121                             unread: false
0122                         },
0123                         {
0124                             resource: "resource1",
0125                             date: "2017-07-20T18:46:29",
0126                             subject: "UTF-8 Madness Umlauts:öüä Snowflake:❆ Heart:♥",
0127                             body: "UTF-8 Madness Umlauts:öüä Snowflake:❆ Heart:♥",
0128                             to: ["öüä@example.org"],
0129                             unread: true
0130                         },
0131                         {
0132                             resource: "resource1",
0133                             date: "2017-07-20T17:47:29",
0134                             subject: "PlainLongLine",
0135                             body: "Hi Mélanie,\n\nI'm sorry to start this on such late notice, but we'd like to get Foo and boo to woo next week, because the following weeks are unfortunately not possible for us.\n",
0136                             to: ["to@example.org"],
0137                             unread: true
0138                         },
0139                         {
0140                             resource: "resource1",
0141                             date: "2017-07-20T17:46:29",
0142                             subject: "HTMLLongLine preformatted",
0143                             body: "<pre>Hi Mélanie,\n\nI'm sorry to start this on such late notice, but we'd like to get Foo and boo to woo next week, because the following weeks are unfortunately not possible for us.\n<pre>",
0144                             bodyIsHtml: true,
0145                             to: ["to@example.org"],
0146                             unread: true
0147                         },
0148                         {
0149                             resource: "resource1",
0150                             date: "2017-07-20T17:46:29",
0151                             subject: "HTMLLongLine not preformatted",
0152                             body: "<div>Hi Mélanie,\n\nI'm sorry to start this on such late notice, but we'd like to get Foo and boo to woo next week, because the following weeks are unfortunately not possible for us.\n<div>",
0153                             bodyIsHtml: true,
0154                             to: ["to@example.org"],
0155                             unread: true
0156                         },
0157                         {
0158                             resource: "resource1",
0159                             date: "2017-07-20T17:46:29",
0160                             subject: "ComplexHTMLLongLine preformatted",
0161                             //We assume that @media trigger the complex html view
0162                             body: "<pre>Hi Mélanie,\n\nI'm sorry @media to start this on such late notice, but we'd like to get Foo and boo to woo next week, because the following weeks are unfortunately not possible for us.\n<pre>",
0163                             bodyIsHtml: true,
0164                             to: ["to@example.org"],
0165                             unread: true
0166                         },
0167                         {
0168                             resource: "resource1",
0169                             date: "2017-07-20T17:46:29",
0170                             subject: "ComplexHTMLLongLine not preformatted",
0171                             //We assume that @media trigger the complex html view
0172                             body: "<div>Hi Mélanie,\n\nI'm sorry @media to start this on such late notice, but we'd like to get Foo and boo to woo next week, because the following weeks are unfortunately not possible for us.\n<div>",
0173                             bodyIsHtml: true,
0174                             to: ["to@example.org"],
0175                             unread: true
0176                         },
0177                         {
0178                             resource: "resource1",
0179                             date: "2017-07-20T17:47:29",
0180                             subject: "WithAttachment",
0181                             body: "Hi Mélanie,\n\nI'm sorry to start this on such late notice, but we'd like to get Foo and boo to woo next week, because the following weeks are unfortunately not possible for us.\n",
0182                             to: ["to@example.org"],
0183                             unread: true,
0184                             attachments: [
0185                                 {
0186                                     name: "myImage.png",
0187                                     mimeType: "image/png",
0188                                     data: "no real data",
0189                                 }
0190                             ],
0191                         },
0192                         {
0193                             resource: "resource1",
0194                             date: "2017-07-20T17:47:29",
0195                             subject: "WithBadPKeyAttachment",
0196                             body: "Hi Mélanie,\n\nI'm sorry to start this on such late notice, but we'd like to get Foo and boo to woo next week, because the following weeks are unfortunately not possible for us.\n",
0197                             to: ["to@example.org"],
0198                             unread: true,
0199                             attachments: [
0200                                 {
0201                                     name: "myKey.asc",
0202                                     mimeType: "application/pgp-keys",
0203                                     data: "no real data",
0204                                 }
0205                             ],
0206                         },
0207                         {
0208                             resource: "resource1",
0209                             date: "2017-07-20T17:47:29",
0210                             subject: "WithGoodPKeyAttachment",
0211                             body: "Hi Mélanie,\n\nI'm sorry to start this on such late notice, but we'd like to get Foo and boo to woo next week, because the following weeks are unfortunately not possible for us.\n",
0212                             to: ["to@example.org"],
0213                             unread: true,
0214                             attachments: [
0215                                 {
0216                                     name: "myKey.asc",
0217                                     mimeType: "application/pgp-keys",
0218                                     data:
0219 "-----BEGIN PGP PUBLIC KEY BLOCK-----
0220 
0221 mQENBEr9ij4BCADaFvyhzV7IrCAr/sCvfoPerAd4dYIGTeCeBmInu3p4oEG0rXTB
0222 2zL2t9zd7jVwCmYLsqb0Y4+7UIulBTSVa/SxsFkxPIzQaGd+CYpIpCl2P7oXBQH/
0223 365i/gvng4UTb5CytBp9MToft2tUgqvK/LD30fBWbWVE1ohmuGYDviJesuqJGeRG
0224 KPOmjRk8LcXecZoNAnahy6y/rHPQzbC7LVazrWfdYCsZ1w202kwwLAPj0aNO6d4n
0225 M9NYo26/mB+5+odJ5gbxfdKWQQOFCha8UzEXbZzjJsRNFhUyuEDEd2gBlhDm3jrY
0226 ACT3u1adLJ1GsY6biN3u1IEUwi/7+uofZRPXABEBAAG0K3VuaXR0ZXN0IGtleSAo
0227 bm8gcGFzc3dvcmQpIDx0ZXN0QGtvbGFiLm9yZz6JATgE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1Gria0isRfwf/OxkV+KxA7qxX2bWOHS3noUAj7I43MJCvTuAP
0244 gTIgEfjdpx1C2Tv97SxoLZ4t6raztvmwqIyCQIuzukD0H9JGFjWT9bGY7obPl7hO
0245 Bvr+rojxTJ3X+pzb2LJQwJnALL/VdIF3yHtGu2//Yfu4oxGGA0M90KiW
0246 =an8Y
0247 -----END PGP PUBLIC KEY BLOCK-----
0248 ",
0249                                 }
0250                             ],
0251                         },
0252                         {
0253                             resource: "resource1",
0254                             date: "2017-07-20T17:47:29",
0255                             subject: "html content with blockquote",
0256                             bodyIsHtml: true,
0257                             body:
0258 "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">
0259 <html><head><title></title><style>
0260 body {
0261   overflow:hidden;
0262   font-family: \"Noto Sans\" ! important;
0263   color: #31363b ! important;
0264   background-color: #fcfcfc ! important
0265 }
0266 blockquote {
0267   border-left: 2px solid #bdc3c7 ! important;
0268 }
0269 </style></head>
0270 <body>
0271 <table><tr><td style=\"\">john added a comment.
0272 </td></tr></table><br /><div><div><blockquote style=\"border-left: 3px solid #a7b5bf; color: #464c5c; font-style: italic; margin: 4px 0 12px 0; padding: 4px 12px; background-color: #f8f9fc;\"><blockquote style=\"border-left: 3px solid #a7b5bf; color: #464c5c; font-style: italic; margin: 4px 0 12px 0; padding: 4px 12px; background-color: #f8f9fc;\"><p>This is some text that is quoted.</p></blockquote></blockquote>
0273 
0274 <p>I&#039;m afraid due to technical limitations of how connections from us are done that&#039;s not trivial.</p>
0275 
0276 <p>I would still suggest scheduling a meeting</p></div></div><br /><div><strong>TASK DETAIL</strong><div><a href=\"https://test.com/T336176\">https://test.com/T336176</a></div></div><br /><div><strong>EMAIL PREFERENCES</strong><div><a href=\"https://test.com/settings/panel/emailpreferences/\">https://test.com/settings/panel/emailpreferences/</a></div></div><br /><div><strong>To: </strong>mollekopf, john<br /><strong>Cc: </strong>john, test, Support<br /></div></body></html>",
0277                             to: ["to@example.org"],
0278                             unread: true,
0279                         },
0280                     ]
0281                 },
0282                 {
0283                     resource: "resource1",
0284                     name: "Folder 2",
0285                     folders: [
0286                         {
0287                             resource: "resource1",
0288                             name: "SubFolder 2",
0289                             folders: [
0290                                 {
0291                                     resource: "resource1",
0292                                     name: "SubSubFolder 2"
0293                                 }
0294                             ]
0295                         }
0296                     ]
0297                 },
0298                 {
0299                     resource: "resource1",
0300                     name: "Folder 3"
0301                 }
0302             ],
0303             calendars: [{
0304                 id: "calendar1",
0305                 resource: "caldavresource",
0306                 name: "Test Calendar",
0307                 color: "#af1a6a",
0308                 enabled: true,
0309                 events: [
0310                     {
0311                         resource: "caldavresource",
0312                         summary: "Today event",
0313                         starts: "2018-04-08T08:03:00",
0314                         organizer: "organizer@example.org",
0315                         attendees: [{email: "attendee1@example.org"}, {email: "identity@example.org"}]
0316                     },
0317                     {
0318                         resource: "caldavresource",
0319                         summary: "Short event1!",
0320                         starts: "2018-04-09T14:03:00",
0321                         organizer: "organizer@example.org",
0322                         attendees: [{email: "attendee1@example.org"}, {email: "identity@example.org"}]
0323                     },
0324                     {
0325                         resource: "caldavresource",
0326                         summary: "Short event3!",
0327                         starts: "2018-04-09T14:03:00",
0328                     },
0329                     {
0330                         resource: "caldavresource",
0331                         summary: "Test Event1 with a waaaaaaaay to long summary. Why don't you just use the description you fool!",
0332                         description: "This is test event #1",
0333                         starts: "2018-04-10T14:03:00",
0334                         ends:   "2018-04-10T16:03:00",
0335                     },
0336 
0337                     // Day-long events
0338                     {
0339                         resource: "caldavresource",
0340                         summary: "Test day-long event1",
0341                         description: "This is test day-long event #1",
0342                         starts: "2018-04-10T00:00:00",
0343                         ends:   "2018-04-14T00:00:00",
0344                         allDay: true,
0345                     },
0346                 ],
0347             },
0348             {
0349                 id: "calendar2",
0350                 resource: "caldavresource",
0351                 name: "Test Calendar2",
0352                 enabled: true,
0353                 color: "#00cc4b"
0354             }]
0355         }
0356         TestStore.setup(initialState)
0357         Kube.Context.autoUpdateDate = false
0358         Kube.Context.currentDate = "2018-04-11T13:04:03"
0359     }
0360     Shortcut {
0361         sequence: StandardKey.Refresh
0362         onActivated: {
0363             view.refresh()
0364         }
0365     }
0366     View {
0367         id: view
0368         anchors.fill: parent
0369     }
0370 }