diff --git a/touch/PodcastsPage.qml b/touch/PodcastsPage.qml index ca70e8e..c26695a 100644 --- a/touch/PodcastsPage.qml +++ b/touch/PodcastsPage.qml @@ -54,7 +54,14 @@ SlidePage { { label: 'Add new podcast', callback: function () { - pgst.loadPage('Subscribe.qml'); + var ctx = { py: py }; + pgst.loadPage('TextInputDialog.qml', { + buttonText: 'Subscribe', + placeholderText: 'Feed URL', + callback: function (url) { + ctx.py.call('main.subscribe', [url]); + } + }); }, }, { @@ -82,6 +89,46 @@ SlidePage { delegate: PodcastItem { onClicked: pgst.loadPage('EpisodesPage.qml', {'podcast_id': id, 'title': title}); + onPressAndHold: { + pgst.showSelection([ + { + label: 'Unsubscribe', + callback: function () { + var ctx = { py: py, id: id }; + pgst.showConfirmation('Unsubscribe', Icons.trash, function () { + ctx.py.call('main.unsubscribe', [ctx.id]); + }); + } }, + { + label: 'Rename', + callback: function () { + var ctx = { py: py, id: id }; + pgst.loadPage('TextInputDialog.qml', { + buttonText: 'Rename', + placeholderText: 'New name', + text: title, + callback: function (new_title) { + ctx.py.call('main.rename_podcast', [ctx.id, new_title]); + } + }); + } + }, + { + label: 'Change section', + callback: function () { + var ctx = { py: py, id: id }; + pgst.loadPage('TextInputDialog.qml', { + buttonText: 'Change section', + placeholderText: 'New section', + text: section, + callback: function (new_section) { + ctx.py.call('main.change_section', [ctx.id, new_section]); + } + }); + } + }, + ], title); + } } } } diff --git a/touch/Subscribe.qml b/touch/TextInputDialog.qml similarity index 66% rename from touch/Subscribe.qml rename to touch/TextInputDialog.qml index 4238533..f780b2b 100644 --- a/touch/Subscribe.qml +++ b/touch/TextInputDialog.qml @@ -2,7 +2,7 @@ /** * * gPodder QML UI Reference Implementation - * Copyright (c) 2013, Thomas Perl + * Copyright (c) 2014, Thomas Perl * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -23,17 +23,18 @@ import QtQuick 2.0 import 'common/constants.js' as Constants Dialog { - id: subscribe + id: textInputDialog + + property string buttonText + property string placeholderText + property string text + property var callback contentHeight: contentColumn.height - function accepted() { - loading.visible = true; - button.visible = false; - input.visible = false; - py.call('main.subscribe', [input.text], function () { - subscribe.closePage(); - }); + function accept() { + textInputDialog.callback(input.text); + textInputDialog.closePage(); } Column { @@ -44,9 +45,10 @@ Dialog { PTextField { id: input - width: subscribe.width *.8 - placeholderText: 'Feed URL' - onAccepted: subscribe.accepted(); + width: textInputDialog.width *.8 + placeholderText: textInputDialog.placeholderText + text: textInputDialog.text + onAccepted: textInputDialog.accept(); } ButtonArea { @@ -56,16 +58,10 @@ Dialog { PLabel { anchors.centerIn: parent - text: 'Subscribe' + text: textInputDialog.buttonText } - onClicked: subscribe.accepted(); - } - - PBusyIndicator { - id: loading - visible: false - anchors.horizontalCenter: parent.horizontalCenter + onClicked: textInputDialog.accept(); } } }