[Sailfish] Icon based context menu
|
|
@ -82,7 +82,8 @@ ListItem {
|
|||
|
||||
function getUrlbyUrl(url){return cache.getUrlbyUrl(url)}
|
||||
|
||||
menu: last ? null : contextMenu
|
||||
menu: last ? null : settings.iconContextMenu ? iconContextMenu : contextMenu
|
||||
|
||||
contentHeight: last ?
|
||||
app.orientation==Orientation.Portrait ? app.panelHeightPortrait : app.panelHeightLandscape :
|
||||
daterow ? dateRowbox.height :
|
||||
|
|
@ -432,19 +433,106 @@ ListItem {
|
|||
}
|
||||
|
||||
Component {
|
||||
id: contextMenu
|
||||
ContextMenu {
|
||||
id: iconContextMenu
|
||||
IconContextMenu {
|
||||
id: menu
|
||||
IconMenuItem {
|
||||
text: root.read ? qsTr("Mark as unread") : qsTr("Mark as read")
|
||||
icon.source: root.read ? 'image://icons/unread' : 'image://icons/read'
|
||||
visible: enabled
|
||||
enabled: root.showMarkedAsRead
|
||||
onClicked: {
|
||||
if (root.read) {
|
||||
root.markedAsUnread();
|
||||
} else {
|
||||
root.markedAsRead();
|
||||
root.expanded = false;
|
||||
}
|
||||
//menu.hide();
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
}
|
||||
|
||||
IconMenuItem {
|
||||
text: qsTr("Mark above as read")
|
||||
icon.source: 'image://icons/read-aboved'
|
||||
visible: enabled
|
||||
enabled: root.showMarkedAsRead && root.index > 1
|
||||
onClicked: {
|
||||
root.markedAboveAsRead();
|
||||
root.expanded = false;
|
||||
menu.hide();
|
||||
}
|
||||
}
|
||||
|
||||
IconMenuItem {
|
||||
text: app.isNetvibes || app.isFeedly ?
|
||||
readlater ? qsTr("Unsave") : qsTr("Save") :
|
||||
readlater ? qsTr("Unstar") : qsTr("Star")
|
||||
icon.source: root.readlater ? 'image://theme/icon-m-favorite-selected' : 'image://theme/icon-m-favorite'
|
||||
//enabled: !likeItem.enabled
|
||||
//visible: enabled
|
||||
onClicked: {
|
||||
if (root.readlater) {
|
||||
root.unmarkedReadlater();
|
||||
} else {
|
||||
root.markedReadlater();
|
||||
}
|
||||
//menu.hide();
|
||||
}
|
||||
}
|
||||
|
||||
IconMenuItem {
|
||||
id: likeItem
|
||||
text: root.liked ? qsTr("Unlike") : qsTr("Like")
|
||||
icon.source: root.liked ? 'image://icons/like-selected' : 'image://icons/like'
|
||||
enabled: settings.showBroadcast && app.isOldReader
|
||||
visible: enabled
|
||||
onClicked: {
|
||||
if (root.liked) {
|
||||
root.unmarkedLike();
|
||||
} else {
|
||||
root.markedLike();
|
||||
}
|
||||
//menu.hide();
|
||||
}
|
||||
}
|
||||
|
||||
IconMenuItem {
|
||||
text: root.broadcast ? qsTr("Unshare") : qsTr("Share")
|
||||
icon.source: root.broadcast ? 'image://icons/unshare' : 'image://icons/share'
|
||||
enabled: settings.showBroadcast && app.isOldReader &&
|
||||
!root.friendStream
|
||||
visible: enabled
|
||||
onClicked: {
|
||||
if (root.broadcast) {
|
||||
root.unmarkedBroadcast();
|
||||
} else {
|
||||
root.markedBroadcast();
|
||||
}
|
||||
menu.hide();
|
||||
}
|
||||
}
|
||||
|
||||
IconMenuItem {
|
||||
text: qsTr("Open in browser")
|
||||
icon.source: 'image://icons/browser'
|
||||
visible: enabled
|
||||
enabled: !settings.openInBrowser
|
||||
onClicked: {
|
||||
root.openInBrowser();
|
||||
root.expanded = false;
|
||||
menu.hide();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: contextMenu
|
||||
ContextMenu {
|
||||
|
||||
MenuItem {
|
||||
text: read ? qsTr("Mark as unread") : qsTr("Mark as read")
|
||||
visible: enabled
|
||||
|
|
@ -509,19 +597,21 @@ ListItem {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
MenuItem {
|
||||
text: qsTr("Open in browser")
|
||||
visible: enabled
|
||||
enabled: !settings.openInBrowser
|
||||
onClicked: {
|
||||
root.openInBrowser();
|
||||
root.expanded = false;
|
||||
}
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
visible: box.expandable && root.expanded
|
||||
text: root.expanded ? qsTr("Collapse") : qsTr("Expand")
|
||||
onClicked: {
|
||||
|
||||
/*console.log("settings.showBroadcast",settings.showBroadcast);
|
||||
console.log("root.hidden",root.hidden);
|
||||
console.log("root.expanded",root.expanded);
|
||||
console.log("root.broadcast",root.broadcast);
|
||||
console.log("root.annotations \""+root.annotations+"\"");
|
||||
console.log("value",settings.showBroadcast && (!root.hidden || root.expanded) && (root.broadcast || root.annotations!=""));
|
||||
*/
|
||||
|
||||
root.expanded = !root.expanded;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
78
qml/sailfish/IconContextMenu.qml
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
/**
|
||||
*
|
||||
* gPodder QML UI Reference Implementation
|
||||
* Copyright (c) 2013, 2014, Thomas Perl <m@thp.io>
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
import QtQuick 2.0
|
||||
import Sailfish.Silica 1.0
|
||||
|
||||
ContextMenu {
|
||||
default property alias children: container.children
|
||||
property int size
|
||||
|
||||
Item {
|
||||
height: Theme.itemSizeMedium
|
||||
width: parent.width
|
||||
|
||||
// Right
|
||||
Rectangle {
|
||||
color: Theme.secondaryColor
|
||||
height: parent.height
|
||||
width: Theme.paddingSmall
|
||||
opacity: flick.contentX < (flick.contentWidth - flick.width - Theme.paddingLarge) ? 0.5 : 0.0
|
||||
visible: opacity > 0
|
||||
anchors.right: visible ? parent.right : undefined
|
||||
Behavior on opacity {
|
||||
FadeAnimation {}
|
||||
}
|
||||
}
|
||||
|
||||
// Left
|
||||
Rectangle {
|
||||
color: Theme.secondaryColor
|
||||
height: parent.height
|
||||
width: Theme.paddingSmall
|
||||
opacity: flick.contentX > Theme.paddingLarge ? 0.5 : 0.0
|
||||
visible: opacity > 0
|
||||
anchors.left: visible ? parent.left : undefined
|
||||
Behavior on opacity {
|
||||
FadeAnimation {}
|
||||
}
|
||||
}
|
||||
|
||||
Flickable {
|
||||
id: flick
|
||||
|
||||
height: parent.height
|
||||
width: parent.width
|
||||
contentWidth: container.width + 2 * Theme.paddingLarge
|
||||
contentHeight: height
|
||||
pixelAligned: true
|
||||
|
||||
Flow {
|
||||
id: container
|
||||
anchors {
|
||||
verticalCenter: parent.verticalCenter
|
||||
left: parent.left
|
||||
margins: Theme.paddingLarge
|
||||
}
|
||||
|
||||
spacing: Theme.paddingLarge
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
57
qml/sailfish/IconMenuItem.qml
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
/**
|
||||
*
|
||||
* gPodder QML UI Reference Implementation
|
||||
* Copyright (c) 2013, 2014, Thomas Perl <m@thp.io>
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
import QtQuick 2.0
|
||||
import Sailfish.Silica 1.0
|
||||
|
||||
Item {
|
||||
id: root
|
||||
property alias icon: iconButton.icon
|
||||
property alias enabled: iconButton.enabled
|
||||
property alias text: lbl.text
|
||||
|
||||
width: iconButton.width
|
||||
height: iconButton.height
|
||||
|
||||
signal clicked()
|
||||
|
||||
Label {
|
||||
id: lbl
|
||||
opacity: iconButton.down
|
||||
|
||||
Behavior on opacity {
|
||||
FadeAnimation {}
|
||||
}
|
||||
|
||||
anchors {
|
||||
verticalCenter: parent.top
|
||||
horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
|
||||
color: Theme.highlightColor
|
||||
font.pixelSize: Theme.fontSizeTiny
|
||||
wrapMode: Text.Wrap
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
}
|
||||
|
||||
IconButton {
|
||||
id: iconButton
|
||||
onClicked: root.clicked();
|
||||
}
|
||||
}
|
||||
|
|
@ -564,6 +564,21 @@ Page {
|
|||
|
||||
}
|
||||
|
||||
ComboBox {
|
||||
width: root.width
|
||||
label: qsTr("Context menu")
|
||||
currentIndex: settings.iconContextMenu ? 0 : 1
|
||||
|
||||
menu: ContextMenu {
|
||||
MenuItem { text: qsTr("Icons") }
|
||||
MenuItem { text: qsTr("Text") }
|
||||
}
|
||||
|
||||
onCurrentIndexChanged: {
|
||||
settings.iconContextMenu = (currentIndex == 0 ? true : false);
|
||||
}
|
||||
}
|
||||
|
||||
TextSwitch {
|
||||
text: qsTr("Show only unread articles")
|
||||
onCheckedChanged: {
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.3 KiB |
BIN
qml/sailfish/like-selected.png
Normal file
|
After Width: | Height: | Size: 923 B |
|
Before Width: | Height: | Size: 968 B After Width: | Height: | Size: 1.2 KiB |
BIN
qml/sailfish/read-aboved.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 928 B After Width: | Height: | Size: 1.7 KiB |
BIN
qml/sailfish/share.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
qml/sailfish/unread.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
qml/sailfish/unshare.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
|
|
@ -119,6 +119,19 @@ bool Settings::getShowOldestFirst()
|
|||
return settings.value("showoldestfirst", false).toBool();
|
||||
}
|
||||
|
||||
void Settings::setIconContextMenu(bool value)
|
||||
{
|
||||
if (getIconContextMenu() != value) {
|
||||
settings.setValue("iconcontextmenu", value);
|
||||
emit showOldestFirstChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool Settings::getIconContextMenu()
|
||||
{
|
||||
return settings.value("iconcontextmenu", true).toBool();
|
||||
}
|
||||
|
||||
void Settings::setShowBroadcast(bool value)
|
||||
{
|
||||
if (getShowBroadcast() != value) {
|
||||
|
|
|
|||
|
|
@ -71,6 +71,7 @@ class Settings: public QObject
|
|||
Q_PROPERTY (bool showOldestFirst READ getShowOldestFirst WRITE setShowOldestFirst NOTIFY showOldestFirstChanged)
|
||||
Q_PROPERTY (bool syncRead READ getSyncRead WRITE setSyncRead NOTIFY syncReadChanged)
|
||||
Q_PROPERTY (bool openInBrowser READ getOpenInBrowser WRITE setOpenInBrowser NOTIFY openInBrowserChanged)
|
||||
Q_PROPERTY (bool iconContextMenu READ getIconContextMenu WRITE setIconContextMenu NOTIFY iconContextMenuChanged)
|
||||
|
||||
public:
|
||||
static Settings* instance();
|
||||
|
|
@ -115,6 +116,9 @@ public:
|
|||
bool getShowBroadcast();
|
||||
void setShowBroadcast(bool value);
|
||||
|
||||
bool getIconContextMenu();
|
||||
void setIconContextMenu(bool value);
|
||||
|
||||
void setDashboardInUse(const QString &value);
|
||||
QString getDashboardInUse();
|
||||
|
||||
|
|
@ -251,6 +255,7 @@ signals:
|
|||
void showOldestFirstChanged();
|
||||
void syncReadChanged();
|
||||
void openInBrowserChanged();
|
||||
void iconContextMenuChanged();
|
||||
|
||||
/*
|
||||
501 - Unable create settings dir
|
||||
|
|
|
|||