Commit bf693f77 authored by Dan Chapman's avatar Dan Chapman
Browse files

Fixes: #65 export attachments through content hub

parent e7f83fdb
......@@ -40,6 +40,7 @@ StyledItem {
h.startMultiSelect()
}
clip: true
// anchors.fill: parent
DekkoHeader {
id: h
......
......@@ -142,7 +142,7 @@ PopupBase {
}
}
AppListener {
enabled: dekko.isLargeFF
enabled: composer.isLargeFF
filter: ViewKeys.closeComposer
onDispatched: {
PopupUtils.close(base)
......
......@@ -29,7 +29,7 @@ import "../contacts"
PanelContainer {
id: sp
visible: width > 0
resizable: !dekko.isSmallFF
resizable: !composer.isSmallFF
minSize: units.gu(20)
maxSize: units.gu(30)
size: ComposerStore.sidePanelOpen ? units.gu(25) : 0
......
......@@ -8,8 +8,9 @@ import QuickFlux 1.0
import PlugMan 1.0
import Dekko.Ubuntu.Components 1.0
import Dekko.Ubuntu.Constants 1.0
import Dekko.Ubuntu.Helpers 1.0
Item {
ViewState {
id: composer
anchors.fill: parent
......
......@@ -31,7 +31,7 @@ ListItem {
target: model.qtObject
onReadyToOpen: {
if (isRunningOnMir) {
ContentActions.exportFile(url)
ContentActions.exportFile(dekko, url)
} else {
Qt.openUrlExternally(url)
}
......
......@@ -33,13 +33,22 @@ ListItemWithActions {
//---------------------------------
// PROPERTIES
//---------------------------------
property bool canLoad: false
property var msg
onMsgChanged: {
if (msg) {
canLoad = true
} else {
canLoad = false
}
}
property alias avatarVisible: inner_name.visible
property Action flagAction: Action {
id: flagAction
text: msg && msg.isImportant ? qsTr("Un-mark flagged") : qsTr("Mark flagged")
iconSource: msg && msg.isImportant ? Paths.actionIconUrl(Paths.UnStarredIcon) :
text: canLoad && msg.isImportant ? qsTr("Un-mark flagged") : qsTr("Mark flagged")
iconSource: canLoad && msg.isImportant ? Paths.actionIconUrl(Paths.UnStarredIcon) :
Paths.actionIconUrl(Paths.StarredIcon)
onTriggered: MessageActions.markMessageImportant(msg.messageId, !msg.isImportant)
......@@ -47,8 +56,8 @@ ListItemWithActions {
property Action readAction: Action {
id: markReadAction
text: msg && msg.isRead ? qsTr("Mark as un-read") : qsTr("Mark as read")
iconSource: msg && msg.isRead ? Paths.actionIconUrl(Paths.MailUnreadIcon) :
text: canLoad && msg.isRead ? qsTr("Mark as un-read") : qsTr("Mark as read")
iconSource: canLoad && msg.isRead ? Paths.actionIconUrl(Paths.MailUnreadIcon) :
Paths.actionIconUrl(Paths.MailReadIcon)
onTriggered: Client.markMessageRead(msg.messageId, !msg.isRead);
}
......@@ -86,19 +95,19 @@ ListItemWithActions {
ListItemLayout {
id: main
title.text: msg ? msg.from.name : ""
title.font.bold: msg && !msg.isRead
title.font.bold: canLoad && !msg.isRead
title.fontSize: "x-small"
title.elide: Text.ElideRight
title.wrapMode: Text.NoWrap
subtitle.text: msg ? msg.subject : ""
subtitle.font.bold: msg && !msg.isRead
subtitle.font.bold: canLoad && !msg.isRead
subtitle.fontSize: "medium"
subtitle.elide: Text.ElideRight
subtitle.wrapMode: Text.NoWrap
summary.maximumLineCount: PolicyManager.views.previewLines
summary.text: msg && msg.preview ? msg.preview : " "
summary.text: canLoad && msg.preview ? msg.preview : " "
summary.fontSize: "medium"
padding.top: units.gu(1)
......@@ -154,8 +163,8 @@ ListItemWithActions {
top: inner_timeLabel.bottom
topMargin: parent.iconsVerticalSpacing
}
name: msg && msg.isImportant ? Icons.StarredIcon : Icons.UnStarredIcon
color: msg && msg.isImportant ? "#f0e442" : "#888888"
name: canLoad && msg.isImportant ? Icons.StarredIcon : Icons.UnStarredIcon
color: canLoad && msg.isImportant ? "#f0e442" : "#888888"
MouseArea {
anchors.fill: parent
onClicked: MessageActions.markMessageImportant(msg.messageId, !msg.isImportant)
......@@ -172,7 +181,7 @@ ListItemWithActions {
top: inner_timeLabel.bottom
topMargin: parent.iconsVerticalSpacing
}
visible: msg && msg.hasAttachments
visible: canLoad && msg.hasAttachments
name: Icons.AttachmentIcon
color: UbuntuColors.ash
}
......
/* Copyright (C) 2016 - 2017 Dan Chapman <dpniel@ubuntu.com>
This file is part of Dekko email client for Ubuntu devices
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of
the License or (at your option) version 3
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.4
import Ubuntu.Components 1.3
import Ubuntu.Components.Popups 1.3
import Dekko.Mail.API 1.0
DialogBase {
id: confirmationDialog
property Action confirmAction: Action {
onTriggered: PopupActions.confirmationDialogConfirmed(id)
}
property Action cancelAction: Action {
onTriggered: PopupActions.confirmationDialogCancelled(id)
}
property string id: "default"
property alias confirmButtonText: confirmButton.text
property alias cancelButtonText: cancelButton.text
property alias confirmButton: confirmButton
property alias cancelButton: cancelButton
signal confirmClicked
signal cancelClicked
contents: [
Row {
anchors {left: parent.left; right: parent.right}
spacing: units.gu(1)
Button {
id: cancelButton
text: qsTr("Cancel")
color: UbuntuColors.red
width: parent.width / 2 - units.gu(0.5)
onClicked: {
if (cancelAction) {
cancelAction.triggered(cancelButton)
}
PopupUtils.close(confirmationDialog)
cancelClicked()
}
}
Button {
id: confirmButton
text: qsTr("Confirm")
color: UbuntuColors.green
width: parent.width / 2 - units.gu(0.5)
onClicked: {
if (confirmAction) {
confirmAction.triggered(confirmButton)
}
PopupUtils.close(confirmationDialog)
confirmClicked()
}
}
}
]
}
/* Copyright (C) 2014-2016 Dan Chapman <dpniel@ubuntu.com>
This file is part of Dekko email client for Ubuntu Devices/
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of
the License or (at your option) version 3
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.4
import Ubuntu.Components 1.3
import Ubuntu.Components.Popups 1.0 as Popups
import Ubuntu.Content 1.3
import Dekko.Ubuntu.Constants 1.0
Popups.PopupBase {
id: picker
z: 100
property bool isExport: true
// The url of the file to export, used to determine content type filter of peer picker
property string fileUrl
property var activeTransfer
property var selectedItems
property string downloadFilePath
signal complete();
signal filesImported(var files);
Rectangle {
anchors.fill: parent
ContentTransferHint {
anchors.fill: parent
activeTransfer: picker.activeTransfer
}
ContentPeerPicker {
id: peerPicker
anchors.fill: parent
visible: true
contentType: isExport ? Content.resolveType(fileUrl) : ContentType.All
handler: isExport ? ContentHandler.Destination : ContentHandler.Source
onPeerSelected: {
peer.selectionType = (isExport ? ContentTransfer.Single : ContentTransfer.Multiple)
picker.activeTransfer = peer.request()
stateChangeConnection.target = picker.activeTransfer
}
onCancelPressed: {
PopupUtils.close(picker)
picker.complete();
}
}
}
Connections {
id: stateChangeConnection
onStateChanged: {
if (isExport && picker.activeTransfer.state === ContentTransfer.InProgress) {
picker.activeTransfer.items = [transferComponent.createObject(dekko, {"url": fileUrl}) ]
picker.activeTransfer.state = ContentTransfer.Charged;
closeTimer.start();
} else if (!isExport && picker.activeTransfer.state === ContentTransfer.Charged){
picker.filesImported(picker.activeTransfer.items);
closeTimer.start();
}
}
}
Timer {
id: closeTimer
interval: 1000
repeat: false
onTriggered: {
PopupUtils.close(picker);
picker.complete();
}
}
Component {
id: transferComponent
ContentItem {}
}
}
/* Copyright (C) 2016 - 2017 Dan Chapman <dpniel@ubuntu.com>
This file is part of Dekko email client for Ubuntu devices
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of
the License or (at your option) version 3
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.4
import Ubuntu.Components 1.3
import Ubuntu.Components.Popups 1.3
Dialog {
signal closing()
Component.onDestruction: closing()
}
/* Copyright (C) 2016 - 2017 Dan Chapman <dpniel@ubuntu.com>
This file is part of Dekko email client for Ubuntu devices
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of
the License or (at your option) version 3
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.4
import QtQuick.Dialogs 1.2
FileDialog {
id: addAttachmentsDialog
title: qsTr("Add Attachment")
folder: shortcuts.home
onRejected: {
console.log("Canceled adding attachments")
close()
destroy()
}
selectMultiple: true
Component.onCompleted: visible = true
}
/* Copyright (C) 2016 - 2017 Dan Chapman <dpniel@ubuntu.com>
This file is part of Dekko email client for Ubuntu devices
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of
the License or (at your option) version 3
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.4
import Ubuntu.Components 1.3
import Ubuntu.Components.Popups 1.3
DialogBase {
id: dlg
title: qsTr("Version")
text: dekkoapp.applicationVersion
Button {
text: qsTr("Close")
color: UbuntuColors.green
onClicked: PopupUtils.close(dlg)
}
}
......@@ -252,10 +252,10 @@ DekkoPage {
}
}
add: DekkoAnimation.listViewAddTransition
addDisplaced: DekkoAnimation.listViewAddDisplacedTransition
remove: DekkoAnimation.listViewRemoveTransition
removeDisplaced: DekkoAnimation.listViewRemoveDisplacedTransition
// add: DekkoAnimation.listViewAddTransition
// addDisplaced: DekkoAnimation.listViewAddDisplacedTransition
// remove: DekkoAnimation.listViewRemoveTransition
// removeDisplaced: DekkoAnimation.listViewRemoveDisplacedTransition
highlight: !dekko.isSmallFF ? Style.highlightBar : null
highlightFollowsCurrentItem: true
......
......@@ -24,7 +24,7 @@ import com.canonical.Oxide 1.9 as Oxide
import Dekko.Components 1.0
import Dekko.Mail.Settings 1.0
import Dekko.Ubuntu.Components 1.0
import "../dialogs"
import Dekko.Ubuntu.Dialogs 1.0
WebView {
id: webview
......
......@@ -79,11 +79,21 @@ AppListener {
}
}
Component {
id: chp
ContentPickerDialog{}
}
// Component {
// id: fp
// FilePickerDialog{}
// }
Filter {
type: ContentKeys.openFilePicker
onDispatched: {
if (isRunningOnMir) {
var chPicker = PopupUtils.open(Qt.resolvedUrl("../views/dialogs/ContentPickerDialog.qml"), message.root, {isExport: false})
if (true) {
var chPicker = PopupUtils.open(chp, message.root, {isExport: false})
chPicker.filesImported.connect(function(files){
var imports = new Array()
for (var i in files) {
......@@ -93,7 +103,7 @@ AppListener {
ContentActions.filesSelected(imports)
})
} else {
var c = Qt.createComponent(Qt.resolvedUrl("../views/dialogs/FilePickerDialog.qml"))
var c = Qt.createComponent("")
var filePicker = c.createObject(message.root)
filePicker.accepted.connect(function(){
var files = new Array()
......@@ -151,7 +161,7 @@ AppListener {
Filter {
type: ContentKeys.exportFile
onDispatched: {
PopupUtils.open("qrc:/qml/views/dialogs/ContentPickerDialog.qml", dekko, {fileUrl: message.file})
PopupUtils.open(chp, message.root, {fileUrl: message.file})
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment