Warning, /plasma-mobile/calindori/src/contents/ui/MessageBoard.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 * SPDX-FileCopyrightText: 2021 Dimitris Kardarakos <dimkard@posteo.net> 0003 * 0004 * SPDX-License-Identifier: GPL-3.0-or-later 0005 */ 0006 0007 import QtQuick 2.7 0008 import org.kde.kirigami 2.6 as Kirigami 0009 import org.kde.calindori 0.1 as Calindori 0010 0011 Kirigami.InlineMessage { 0012 id: root 0013 0014 property var activeCalendar 0015 property string targetCalendarName 0016 property var targetFolder 0017 property int footerMode: MessageBoard.FooterMode.NoDisplay 0018 0019 enum FooterMode { 0020 StartImport, 0021 EndImportSuccess, 0022 EndImportFailure, 0023 EndExportSuccess, 0024 EndExportFailure, 0025 NoDisplay 0026 } 0027 0028 actions: [ 0029 Kirigami.Action { 0030 id: proceedAction 0031 icon.name: "dialog-ok" 0032 text: i18n("Proceed") 0033 0034 onTriggered: { 0035 root.footerMode = MessageBoard.FooterMode.NoDisplay; 0036 if( (targetCalendarName === "") || (activeCalendar && (activeCalendar.name === root.targetCalendarName)) ) { 0037 Calindori.CalendarController.importFromBuffer(activeCalendar); 0038 } 0039 else { 0040 Calindori.CalendarController.importFromBuffer(targetCalendarName); 0041 } 0042 } 0043 }, 0044 0045 Kirigami.Action { 0046 id: cancelAction 0047 icon.name: "dialog-cancel" 0048 text: i18n("Cancel") 0049 0050 onTriggered: { 0051 root.footerMode = MessageBoard.FooterMode.NoDisplay; 0052 Calindori.CalendarController.abortImporting(); 0053 } 0054 }, 0055 0056 Kirigami.Action { 0057 id: openFolderAction 0058 text: i18n("Open folder") 0059 icon.name: "folder-open" 0060 0061 onTriggered: { 0062 root.footerMode = MessageBoard.FooterMode.NoDisplay; 0063 Qt.openUrlExternally(root.targetFolder); 0064 } 0065 } 0066 ] 0067 0068 states: [ 0069 State { 0070 when: root.footerMode === MessageBoard.FooterMode.StartImport 0071 PropertyChanges { target: root; visible: true } 0072 PropertyChanges { target: root; type: Kirigami.MessageType.Information } 0073 PropertyChanges { target: root; showCloseButton: false } 0074 PropertyChanges { target: proceedAction; visible: true } 0075 PropertyChanges { target: cancelAction; visible: true } 0076 PropertyChanges { target: openFolderAction; visible: false } 0077 }, 0078 0079 State { 0080 when: root.footerMode === MessageBoard.FooterMode.EndImportSuccess 0081 PropertyChanges { target: root; visible: true } 0082 PropertyChanges { target: root; type: Kirigami.MessageType.Positive } 0083 PropertyChanges { target: root; showCloseButton: true } 0084 PropertyChanges { target: proceedAction; visible: false } 0085 PropertyChanges { target: cancelAction; visible: false } 0086 PropertyChanges { target: openFolderAction; visible: false } 0087 }, 0088 0089 State { 0090 when: root.footerMode === MessageBoard.FooterMode.EndImportFailure 0091 PropertyChanges { target: root; visible: true } 0092 PropertyChanges { target: root; type: Kirigami.MessageType.Warning } 0093 PropertyChanges { target: root; showCloseButton: true } 0094 PropertyChanges { target: proceedAction; visible: false } 0095 PropertyChanges { target: cancelAction; visible: false } 0096 PropertyChanges { target: openFolderAction; visible: false } 0097 }, 0098 0099 State { 0100 when: root.footerMode === MessageBoard.FooterMode.EndExportSuccess 0101 PropertyChanges { target: root; visible: true } 0102 PropertyChanges { target: root; type: Kirigami.MessageType.Positive } 0103 PropertyChanges { target: root; showCloseButton: true } 0104 PropertyChanges { target: proceedAction; visible: false } 0105 PropertyChanges { target: cancelAction; visible: false } 0106 PropertyChanges { target: openFolderAction; visible: true } 0107 }, 0108 0109 State { 0110 when: root.footerMode === MessageBoard.FooterMode.EndExportFailure 0111 PropertyChanges { target: root; visible: true } 0112 PropertyChanges { target: root; type: Kirigami.MessageType.Warning } 0113 PropertyChanges { target: root; showCloseButton: true } 0114 PropertyChanges { target: proceedAction; visible: false } 0115 PropertyChanges { target: cancelAction; visible: false } 0116 PropertyChanges { target: openFolderAction; visible: false } 0117 }, 0118 0119 State { 0120 when: root.footerMode === MessageBoard.FooterMode.NoDisplay 0121 PropertyChanges { target: root; visible: false } 0122 PropertyChanges { target: proceedAction; visible: false } 0123 PropertyChanges { target: cancelAction; visible: false } 0124 PropertyChanges { target: openFolderAction; visible: false } 0125 } 0126 0127 ] 0128 } 0129