| 1 |
/* Copyright (C) 2016 - 2017 Dan Chapman <[email protected]> |
| 2 |
|
| 3 |
This file is part of Dekko email client for Ubuntu devices |
| 4 |
|
| 5 |
This program is free software; you can redistribute it and/or |
| 6 |
modify it under the terms of the GNU General Public License as |
| 7 |
published by the Free Software Foundation; either version 2 of |
| 8 |
the License or (at your option) version 3 |
| 9 |
|
| 10 |
This program is distributed in the hope that it will be useful, |
| 11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
GNU General Public License for more details. |
| 14 |
|
| 15 |
You should have received a copy of the GNU General Public License |
| 16 |
along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 |
*/ |
| 18 |
import QtQuick 2.4 |
| 19 |
import QtQuick.Controls.Suru 2.2 |
| 20 |
import Lomiri.Components 1.3 |
| 21 |
import Lomiri.Components.Popups 1.3 |
| 22 |
import Dekko.Mail.API 1.0 |
| 23 |
|
| 24 |
DialogBase { |
| 25 |
id: confirmationDialog |
| 26 |
|
| 27 |
property Action confirmAction: Action { |
| 28 |
onTriggered: PopupActions.confirmationDialogConfirmed(id) |
| 29 |
} |
| 30 |
|
| 31 |
property Action cancelAction: Action { |
| 32 |
onTriggered: PopupActions.confirmationDialogCancelled(id) |
| 33 |
} |
| 34 |
property string id: "default" |
| 35 |
property alias confirmButtonText: confirmButton.text |
| 36 |
property alias cancelButtonText: cancelButton.text |
| 37 |
property alias confirmButton: confirmButton |
| 38 |
property alias cancelButton: cancelButton |
| 39 |
|
| 40 |
signal confirmClicked |
| 41 |
signal cancelClicked |
| 42 |
|
| 43 |
contents: [ |
| 44 |
|
| 45 |
Row { |
| 46 |
anchors {left: parent.left; right: parent.right} |
| 47 |
spacing: units.gu(1) |
| 48 |
|
| 49 |
Button { |
| 50 |
id: cancelButton |
| 51 |
text: qsTr("Cancel") |
| 52 |
width: parent.width / 2 - units.gu(0.5) |
| 53 |
onClicked: { |
| 54 |
if (cancelAction) { |
| 55 |
cancelAction.triggered(cancelButton) |
| 56 |
} |
| 57 |
PopupUtils.close(confirmationDialog) |
| 58 |
cancelClicked() |
| 59 |
} |
| 60 |
} |
| 61 |
Button { |
| 62 |
id: confirmButton |
| 63 |
text: qsTr("Confirm") |
| 64 |
Suru.highlightType: Suru.NegativeHighlight |
| 65 |
color: Suru.highlightColor |
| 66 |
width: parent.width / 2 - units.gu(0.5) |
| 67 |
onClicked: { |
| 68 |
if (confirmAction) { |
| 69 |
confirmAction.triggered(confirmButton) |
| 70 |
} |
| 71 |
PopupUtils.close(confirmationDialog) |
| 72 |
confirmClicked() |
| 73 |
} |
| 74 |
} |
| 75 |
} |
| 76 |
] |
| 77 |
} |