Skip to content

Instantly share code, notes, and snippets.

@llelectronics
Created September 28, 2017 12:55
Show Gist options
  • Select an option

  • Save llelectronics/aff0c4de59d27241567336871341c30a to your computer and use it in GitHub Desktop.

Select an option

Save llelectronics/aff0c4de59d27241567336871341c30a to your computer and use it in GitHub Desktop.
diff --git a/pages/AccountList.qml b/pages/AccountList.qml
index c05e0b8..6de56c4 100644
--- a/pages/AccountList.qml
+++ b/pages/AccountList.qml
@@ -21,15 +21,13 @@ Column {
Label {
id: unreadCountLabel
+ z: accountIcon.z + 1
color: highlighted ? Theme.highlightColor : Theme.primaryColor
text: unreadCount ? unreadCount : ""
- font.pixelSize: Theme.fontSizeLarge
+ font.pixelSize: Theme.fontSizeHuge
+ font.bold: true
anchors {
- left: accountItem.contentItem.left
- leftMargin: Screen.sizeCategory >= Screen.Large ? Theme.horizontalPageMargin : 0
- right: accountIcon.left
- rightMargin: Theme.paddingLarge
- verticalCenter: parent.verticalCenter
+ centerIn: accountIcon
}
horizontalAlignment: Text.AlignRight
}
@@ -38,10 +36,15 @@ Column {
id: accountIcon
property string fixedIconPath: iconPath
+
+ anchors {
+ left: parent.left
+ leftMargin: Theme.paddingMedium
+ }
- x: Screen.sizeCategory >= Screen.Large
- ? 6 * Theme.paddingLarge
- : 5 * Theme.paddingLarge
+// x: Screen.sizeCategory >= Screen.Large
+// ? 6 * Theme.paddingLarge
+// : 5 * Theme.paddingLarge
width: Screen.sizeCategory >= Screen.Large
? 90 * Theme.pixelRatio
: Screen.width / 5
@@ -49,6 +52,7 @@ Column {
sourceSize.width: width
sourceSize.height: height
anchors.verticalCenter: parent.verticalCenter
+ opacity: unreadCountLabel.text != "" ? 0.6 : 1.0
source: fixedIconPath !== "" ? fixedIconPath : "image://theme/graphic-service-generic-mail"
onStatusChanged: if (accountIcon.status == Image.Error) fixedIconPath = "image://theme/graphic-service-generic-mail"
diff --git a/pages/AccountListPage.qml b/pages/AccountListPage.qml
new file mode 100644
index 0000000..e510e42
--- /dev/null
+++ b/pages/AccountListPage.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+import Sailfish.Silica 1.0
+import org.nemomobile.email 0.1
+
+Page {
+ PageHeader {
+ id: accountListHeader
+ title: qsTr("Inboxes")
+ }
+ AccountList {
+ id: accountList
+ anchors.top: accountListHeader.bottom
+ anchors.topMargin: Theme.paddingMedium
+ }
+}
diff --git a/pages/CombinedInbox.qml b/pages/CombinedInbox.qml
index c508f81..23ad59a 100644
--- a/pages/CombinedInbox.qml
+++ b/pages/CombinedInbox.qml
@@ -10,6 +10,7 @@ Page {
onStatusChanged: {
if (status === PageStatus.Active) {
app.coverMode = "mainView"
+ pageStack.pushAttached(Qt.resolvedUrl("AccountListPage.qml"))
}
}
@@ -87,6 +88,16 @@ Page {
app.showAccountsCreationDialog()
}
}
+
+ MenuItem {
+ //: Show all Inboxes from Accounts
+ //% "Show Inboxes"
+ text: qsTr("Show Inboxes")
+ visible: app.numberOfAccounts != 0
+ onClicked: {
+ pageStack.push(Qt.resolvedUrl("AccountListPage.qml"))
+ }
+ }
}
header: Column {
@@ -97,9 +108,9 @@ Page {
//% "Mail"
title: qsTrId("email-he-email")
}
- AccountList {
- id: accountList
- }
+// AccountList {
+// id: accountList
+// }
Item {
height: Theme.itemSizeLarge
width: parent.width
@@ -122,7 +133,7 @@ Page {
}
Item {
height: Math.max(emptyStateText.height + Theme.paddingLarge,
- messageListView.height - accountList.height - pageHeader.height - Theme.paddingLarge)
+ messageListView.height - pageHeader.height - Theme.paddingLarge)
width: parent.width
visible: messageListView.count === 0 && app.numberOfAccounts > 0
Text {
diff --git a/pages/MessageItem.qml b/pages/MessageItem.qml
index a32fd6d..28a4d61 100644
--- a/pages/MessageItem.qml
+++ b/pages/MessageItem.qml
@@ -28,6 +28,10 @@ ListItem {
emailAgent.deleteMessage(model.messageId)
})
}
+
+ function _openComposer(action) {
+ pageStack.push(Qt.resolvedUrl("ComposerPage.qml"), {popDestination: previousPage, action: action, originalMessageId: model.messageId})
+ }
onClicked: {
if (!selectMode) {
@@ -153,25 +157,39 @@ ListItem {
}
truncationMode: TruncationMode.Fade
}
-
- Label {
- text: model.preview != "" ? Theme.highlightText(model.preview, (highlightBody ? searchString : ""),
- Theme.highlightColor)
- : // it should not show empty preview when preview is not retrived yet, first sync for e.g
- //: Empty preview
- //% "(Empty preview)"
- qsTrId("jolla-email-la-no_preview")
- textFormat: Text.StyledText
- font.pixelSize: Theme.fontSizeSmall
- color: messageItem.labelColor
- opacity: model.readStatus ? 0.6 : 1.0
-
- maximumLineCount: Screen.sizeCategory >= Screen.Large ? 1 : 2
- lineHeight: subjectText.height - Math.round(Theme.paddingSmall/2)
- lineHeightMode: Text.FixedHeight
- width: parent.width
- wrapMode: Text.Wrap
- elide: Text.ElideRight
+ Row {
+ id: actionIcons
+ spacing: Theme.paddingMedium
+ IconButton {
+ icon.source: model.readStatus ? "image://theme/icon-m-mail-open" : "image://theme/icon-m-mail"
+ onClicked: {
+ console.log("Toggle between read/unread mail")
+ if (!model.readStatus) emailAgent.markMessageAsRead(model.messageId)
+ else emailAgent.markMessageAsUnread(model.messageId)
+ }
+ }
+ IconButton {
+ icon.source: "image://theme/icon-m-rotate-left"
+ onClicked: _openComposer('reply')
+ }
+ IconButton {
+ icon.source: "image://theme/icon-m-rotate-left"
+ onClicked: _openComposer('replyAll')
+ Image {
+ source: "image://theme/icon-m-rotate-left"
+ anchors.top: parent.top
+ anchors.left: parent.left
+ anchors.leftMargin: Theme.paddingMedium
+ }
+ }
+ IconButton {
+ icon.source: "image://theme/icon-m-forward"
+ onClicked: _openComposer('forward')
+ }
+ IconButton {
+ icon.source: "image://theme/icon-m-delete"
+ onClicked: messageItem.remove()
+ }
}
}
diff --git a/pages/MessageViewHeader.qml b/pages/MessageViewHeader.qml
index 84d8f25..12fa1e9 100644
--- a/pages/MessageViewHeader.qml
+++ b/pages/MessageViewHeader.qml
@@ -57,6 +57,21 @@ Column {
source: email ? app.priorityIcon(email.priority) : ""
}
}
+
+ Label {
+ id: mailSubject
+ font.family: Theme.fontFamilyHeading
+ color: Theme.highlightColor
+ text: email.subject
+ maximumLineCount: 3
+ wrapMode: Text.WordWrap
+ truncationMode: TruncationMode.Elide
+ anchors {
+ left: parent.left
+ right: parent.right
+ margins: Theme.horizontalPageMargin
+ }
+ }
Row {
width: parent.width
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment