Podcasts list: Rename podcasts and change sections

This commit is contained in:
Thomas Perl 2014-01-30 21:19:51 +01:00
parent da2f38a6fa
commit c4253df569
4 changed files with 96 additions and 2 deletions

@ -1 +1 @@
Subproject commit 3579f4bfe2891852bbd357dc786a4ee6783fded9
Subproject commit d267582aa0b16cae1ead227b141b0e707e702a67

View file

@ -35,6 +35,37 @@ ListItem {
});
}
}
MenuItem {
text: 'Rename'
onClicked: {
var ctx = { py: py, id: id };
pageStack.push('RenameDialog.qml', {
activityName: 'Rename podcast',
affirmativeAction: 'Rename',
inputLabel: 'Podcast name',
initialValue: title,
callback: function (new_title) {
ctx.py.call('main.rename_podcast', [ctx.id, new_title]);
}
});
}
}
MenuItem {
text: 'Change section'
onClicked: {
var ctx = { py: py, id: id };
pageStack.push('RenameDialog.qml', {
activityName: 'Change section',
affirmativeAction: 'Move',
inputLabel: 'Section',
initialValue: section,
callback: function (new_section) {
ctx.py.call('main.change_section', [ctx.id, new_section]);
}
});
}
}
}
}

View file

@ -107,7 +107,7 @@ Page {
}
ViewPlaceholder {
enabled: podcastList.count == 0
enabled: podcastListModel.count == 0 && pgst.ready
text: 'No subscriptions'
}
}

63
qml/RenameDialog.qml Normal file
View file

@ -0,0 +1,63 @@
/**
*
* 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
Dialog {
id: rename
property string activityName
property string affirmativeAction
property string inputLabel
property string initialValue
property var callback
canAccept: input.text != ''
SubscribeProgress {
id: progress
}
onAccepted: {
rename.callback(input.text)
//py.call('main.rename', [ername, input.text], function () {
// // TODO
//});
}
Column {
anchors.fill: parent
DialogHeader {
title: rename.activityName
acceptText: rename.affirmativeAction
}
TextField {
id: input
width: parent.width
label: rename.inputLabel
placeholderText: label
text: initialValue
//inputMethodHints: Qt.ImhUrlCharactersOnly | Qt.ImhNoPredictiveText | Qt.ImhNoAutoUppercase
EnterKey.onClicked: rename.accept()
}
}
}