123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- /****************************************************************************
- **
- ** Copyright (C) 2012 Róbert Márki
- **
- ** This file is part of Web Feeds.
- **
- ** Web Feeds 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 3 of the License, or
- ** (at your option) any later version.
- **
- ** Web Feeds 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 Web Feeds. If not, see <http://www.gnu.org/licenses/>.
- ****************************************************************************/
- import QtQuick 1.1
- import com.nokia.meego 1.0
- import WebFeeds 1.0
- import NewsBlur 1.0
- import "../../../../shared/qml" as Shared
- import "../../../../shared/qml/UIConstants.js" as UIConstants
- CommonNewsBlurSheet {
- id: root
- acceptButtonText: qsTr("Add")
- rejectButtonText: qsTr("Cancel")
- title: qsTr("Add folder")
- busyText: qsTr("Adding folder")
- function updateAcceptButtonStatus() {
- root.acceptButton.enabled = nameField.text.length;
- }
- Connections {
- target: root.service
- onFolderAddingFinished: root.onFolderAddingFinished(result)
- }
- function onFolderAddingFinished(result) {
- if((result == NewsBlurEnum.SreNoError)
- || (result == NewsBlurEnum.SreAborted)) {
- root.close();
- return;
- }
- root.busy = false;
- if(result == NewsBlurEnum.SreNetworkError)
- root.showMessage(qsTr("Network error"));
- else
- root.showMessage(qsTr("Failed to add the folder"));
- }
- onAccepted: {
- root.busy = true;
- root.open();
- root.service.addFolder(root.pageItem, nameField.text);
- }
- onRejected: {
- if(root.busy) {
- root.open();
- root.service.abortAddFolder(root.pageItem);
- }
- }
- contentItem: Column {
- anchors.fill: parent
- anchors.leftMargin: UIConstants.DEFAULT_MARGIN
- anchors.rightMargin: UIConstants.DEFAULT_MARGIN
- spacing: UIConstants.DEFAULT_HALF_MARGIN
- Label {
- text: qsTr("Name")
- font.family: UIConstants.FONT_FAMILY_LIGHT
- }
- Shared.TextField {
- id: nameField
- width: parent.width
- onTextChanged: {
- root.updateAcceptButtonStatus();
- }
- platformSipAttributes: SipAttributes {
- actionKeyEnabled: root.acceptButton.enabled
- actionKeyLabel: root.acceptButtonText
- actionKeyHighlighted: true
- }
- Keys.onReturnPressed: {
- if(root.acceptButton.enabled)
- root.accept();
- }
- }
- Connections {
- target: root
- onStatusChanged: {
- if(root.status == DialogStatus.Open) {
- nameField.forceActiveFocus();
- nameField.platformOpenSoftwareInputPanel();
- }
- }
- }
- }
- }
|