diff --git a/gemini/qml/welcomepages/WelcomePageCloud.qml b/gemini/qml/welcomepages/WelcomePageCloud.qml index 926cc9d3f13..6f0c337470a 100644 --- a/gemini/qml/welcomepages/WelcomePageCloud.qml +++ b/gemini/qml/welcomepages/WelcomePageCloud.qml @@ -1,256 +1,231 @@ /* This file is part of the KDE project * Copyright (C) 2014 Dan Leinir Turthra Jensen * * This program 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 2 of the License, or * (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import QtQuick 2.0 import QtQuick.Layouts 1.11 as QtLayouts import QtQuick.Controls 2.2 as QtControls import org.kde.kirigami 2.7 as Kirigami import Calligra.Gemini.Dropbox 1.0 import org.calligra 1.0 import "../components" import "cloud" Kirigami.ScrollablePage { id: base; objectName: "WelcomePageCloud"; title: "Open from the Cloud"; /* ListModel { id: cloudAccounts; ListElement { text: "Dropbox"; selected: false; accountType: "DropBox"; stackComponent: "accountsPageDropbox"; accountDetails: [ ListElement { userkey: "asfdoijfdshaloiuhs" } ] } ListElement { text: "ownCloud"; selected: false; accountType: "WebDav"; stackComponent: "accountsPageWebdav"; accountDetails: [ ListElement { username: "lala" } ] } ListElement { text: "bitbucket"; selected: false; accountType: "Git"; stackComponent: "accountsPageGit"; accountDetails: [ ListElement { localrepo: "C:\\Users\\danjensen\\Documents\\nohnas" } ] } ListElement { text: "github"; selected: false; accountType: "Git"; stackComponent: "accountsPageGit"; accountDetails: [ ListElement { localrepo: "C:\\dev\\documentation" } ] } }*/ function showAccount(index, stackComponent, accountDetails) { cloudAccounts.selectIndex(index); pageStack.push(elementFromName(stackComponent)); pageStack.currentItem.accountDetails = accountDetails; } CloudAccountsModel { id: cloudAccounts; } actions { main: Kirigami.Action { } } Connections { target: controllerMIT; onNeedAuthenticateChanged: { if(controllerMIT.needAuthenticate) { cloudAccounts.removeAccountByName("Dropbox"); } else { cloudAccounts.addAccount("Dropbox", "DropBox", "accountsPageDropbox", 0, true); } } } Component.onCompleted: { if(!controllerMIT.needAuthenticate) { cloudAccounts.addAccount("Dropbox", "DropBox", "accountsPageDropbox", 0, true); } } ListView { id: accountsView; model: cloudAccounts; footer: Item { anchors { left: parent.left; right: parent.right; margins: Kirigami.Units.largeSpacing; } height: bottomButtonRow.height + Kirigami.Units.largeSpacing * 2; QtControls.Label { anchors.fill: parent; text: "Add new account:"; horizontalAlignment: Text.AlignLeft; verticalAlignment: Text.AlignVCenter; } Row { id: bottomButtonRow; anchors { verticalCenter: parent.verticalCenter; right: parent.right; } height: childrenRect.height; spacing: Kirigami.Units.largeSpacing; Repeater { model: ListModel { ListElement { text: "Dropbox"; accountType: "DropBox"; serviceName: "dropbox"; } ListElement { text: "WebDav"; accountType: "WebDav"; serviceName: ""; } //ListElement { text: "ownCloud"; accountType: "WebDav"; serviceName: "ownCloud"; } ListElement { text: "Git"; accountType: "Git"; serviceName: ""; } //ListElement { text: "GitHub"; accountType: "Git"; serviceName: "github"; } //ListElement { text: "bitbucket (git)"; accountType: "Git"; serviceName: "bitbucket"; } } QtControls.Button { text: model.text onClicked: { - dlgStack.replace(base.addComponentFromName(model.accountType)); - dlgStack.currentPage.serviceName = model.serviceName; + dlgLoader.sourceComponent = base.addComponentFromName(model.accountType); + dlgLoader.item.serviceName = model.serviceName; + dlgLoader.item.open(); } } } } } delegate: Kirigami.SwipeListItem { QtLayouts.RowLayout { Item { QtLayouts.Layout.preferredHeight: Kirigami.Units.iconSizes.huge - Kirigami.Units.smallSpacing * 2; QtLayouts.Layout.minimumWidth: Kirigami.Units.iconSizes.huge; QtLayouts.Layout.maximumWidth: Kirigami.Units.iconSizes.huge; Kirigami.Icon { anchors { fill: parent; margins: Kirigami.Units.smallSpacing; } source: "document"; } } QtLayouts.ColumnLayout { QtLayouts.Layout.fillWidth: true QtLayouts.Layout.fillHeight: true Item { QtLayouts.Layout.fillWidth: true QtLayouts.Layout.fillHeight: true } Kirigami.Heading { id: nameText QtLayouts.Layout.fillWidth: true text: model.text } QtControls.Label { id: descriptionText QtLayouts.Layout.fillWidth: true text: model.accountType === "DropBox" ? "" : model.accountType elide: Text.ElideRight wrapMode: Text.Wrap } Item { QtLayouts.Layout.fillWidth: true QtLayouts.Layout.fillHeight: true } } } onClicked: base.showAccount(model.index, model.stackComponent, model.accountDetails); actions: [ Kirigami.Action { text: (model.accountType === "DropBox") ? "Sign Out" : "Edit Account"; icon.name: (model.accountType === "DropBox") ? "leave" : "document-edit" onTriggered: { - dlgStack.replace(base.editComponentFromName(model.accountType)); - if(dlgStack.currentPage.accountIndex !== undefined) { - dlgStack.currentPage.accountIndex = index; - dlgStack.currentPage.text = model.text; + dlgLoader.sourceComponent = base.editComponentFromName(model.accountType); + if(dlgLoader.item.accountIndex !== undefined) { + dlgLoader.item.accountIndex = index; + dlgLoader.item.text = model.text; } + dlgLoader.item.open(); } }, Kirigami.Action { text: "Remove"; icon.name: "remove" visible: model.accountType !== "DropBox"; onTriggered: { - dlgStack.replace(removeAccountDlg); - if(dlgStack.currentPage.accountIndex !== undefined) { - dlgStack.currentPage.accountIndex = index; - dlgStack.currentPage.text = model.text; + dlgLoader.sourceComponent = removeAccountDlg; + dlgLoader.item.open(); + if(dlgLoader.item.accountIndex !== undefined) { + dlgLoader.item.accountIndex = index; + dlgLoader.item.text = model.text; } } } ] } QtControls.Label { anchors.fill: accountsView; text: "You have no cloud accounts defined. Please add one by clicking on your service of choice below."; horizontalAlignment: Text.AlignHCenter; verticalAlignment: Text.AlignVCenter; opacity: cloudAccounts.count === 0 ? 1 : 0; Behavior on opacity { NumberAnimation { duration: Kirigami.Units.shortDuration; } } } - PageStack { - id: dlgStack; - anchors { - fill: parent; - margins: -Settings.theme.adjustedPixel(8); - } - initialPage: addEmptyComp; + Loader { + id: dlgLoader + anchors.fill: parent; } } function addComponentFromName(name) { var elements = { "DropBox": addDropBox, "WebDav": addWebDav, "Git": addGit }; return elements[name]; } - Component { - id: addEmptyComp; - Item {} - } - Component { - id: addDropBox; - AddDropbox { addEmpty: addEmptyComp; } - } - Component { - id: addWebDav; - AddWebdav { addEmpty: addEmptyComp; } - } - Component { - id: addGit; - AddGit { addEmpty: addEmptyComp; } - } + Component { id: addDropBox; AddDropbox { } } + Component { id: addWebDav; AddWebdav { } } + Component { id: addGit; AddGit { } } + function editComponentFromName(name) { var elements = { "DropBox": editDropBox, "WebDav": editWebDav, "Git": editGit }; return elements[name]; } - Component { - id: editDropBox; - AddDropbox { addEmpty: addEmptyComp; } - } - Component { - id: editWebDav; - EditDetailsBase { addEmpty: addEmptyComp; } - } - Component { - id: editGit; - EditGit { addEmpty: addEmptyComp; } - } + Component { id: editDropBox; AddDropbox { } } + Component { id: editWebDav; EditDetailsBase { } } + Component { id: editGit; EditGit { } } - Component { - id: removeAccountDlg; - RemoveAccountDlg { addEmpty: addEmptyComp; } - } + Component { id: removeAccountDlg; RemoveAccountDlg { } } function elementFromName(name) { var elements = { "accountsPageDropbox": accountsPageDropbox, "accountsPageWebdav": accountsPageWebdav, "accountsPageGit": accountsPageGit }; return elements[name]; } Component { id: accountsPageDropbox; Dropbox { } } Component { id: accountsPageWebdav; Webdav { } } Component { id: accountsPageGit; Git { } } } diff --git a/gemini/qml/welcomepages/cloud/AddDropbox.qml b/gemini/qml/welcomepages/cloud/AddDropbox.qml index 6d5cb1f59c2..047c2af1ac7 100644 --- a/gemini/qml/welcomepages/cloud/AddDropbox.qml +++ b/gemini/qml/welcomepages/cloud/AddDropbox.qml @@ -1,55 +1,33 @@ /* This file is part of the KDE project * Copyright (C) 2014 Dan Leinir Turthra Jensen * * This program 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 2 of the License, or * (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import QtQuick 2.0 -import org.calligra 1.0 +import QtQuick 2.11 import QtQuick.Controls 2.2 as QtControls +import org.kde.kirigami 2.7 as Kirigami +import org.calligra 1.0 import "dropbox" as Dropbox -Rectangle { - anchors.fill: parent; - anchors.margins: Settings.theme.adjustedPixel(16); +Kirigami.OverlaySheet { + id: component property string serviceName: ""; - property Component addEmpty; - radius: Settings.theme.adjustedPixel(8); - color: "white"; - Rectangle { - anchors { - fill: parent; - margins: -Settings.theme.adjustedPixel(16); - topMargin: -(Settings.theme.adjustedPixel(8) + Constants.GridHeight * 1.5); - } - opacity: 0.5; - color: "white"; - MouseArea { anchors.fill: parent; onClicked: { /*nothing */ } } - SimpleTouchArea { anchors.fill: parent; onTouched: { /*nothing */ } } + header: Kirigami.Heading { + text: "Add DropBox Account" } Dropbox.SetupPage { - anchors.fill: parent; - anchors.margins: Settings.theme.adjustedPixel(8); - } - QtControls.Button { - anchors { - bottom: parent.bottom; - right: parent.right; - margins: Settings.theme.adjustedPixel(8); - } - text: "Close"; - onClicked: dlgStack.replace(addEmpty); } } diff --git a/gemini/qml/welcomepages/cloud/AddGit.qml b/gemini/qml/welcomepages/cloud/AddGit.qml index 8108065a011..17fe3c5bf0e 100644 --- a/gemini/qml/welcomepages/cloud/AddGit.qml +++ b/gemini/qml/welcomepages/cloud/AddGit.qml @@ -1,62 +1,34 @@ /* This file is part of the KDE project * Copyright (C) 2014 Dan Leinir Turthra Jensen * * This program 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 2 of the License, or * (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import QtQuick 2.0 -import org.calligra 1.0 -import QtQuick.Controls 2.2 as QtControls +import QtQuick 2.11 +import QtQuick.Controls 2.5 as QtControls import org.kde.kirigami 2.7 as Kirigami +import org.calligra 1.0 +import "git" -Rectangle { - anchors.fill: parent; - anchors.margins: Kirigami.Units.largeSpacing * 2; +Kirigami.OverlaySheet { + id: component property string serviceName: ""; - property Component addEmpty; - radius: Kirigami.Units.largeSpacing; - color: "white"; - Rectangle { - anchors { - fill: parent; - margins: -Kirigami.Units.largeSpacing * 2; - topMargin: -(Kirigami.Units.largeSpacing + Kirigami.Units.gridUnit * 1.5); - } - opacity: 0.5; - color: "white"; - MouseArea { anchors.fill: parent; onClicked: { /*nothing */ } } - SimpleTouchArea { anchors.fill: parent; onTouched: { /*nothing */ } } - } - Loader { - anchors { - top: parent.top; - left: parent.left; - right: parent.right; - bottom: closeButton.top; - margins: Kirigami.Units.largeSpacing; - } - source: "git/createCheckoutContainer.qml"; + header: Kirigami.Heading { + text: "Add Git Account" + width: component.width / 2 } - QtControls.Button { - id: closeButton; - anchors { - bottom: parent.bottom; - right: parent.right; - margins: Kirigami.Units.largeSpacing; - } - text: "Close"; - onClicked: dlgStack.replace(addEmpty); + CreateCheckout { } } diff --git a/gemini/qml/welcomepages/cloud/AddWebdav.qml b/gemini/qml/welcomepages/cloud/AddWebdav.qml index 18ba42273ba..79e2532fe04 100644 --- a/gemini/qml/welcomepages/cloud/AddWebdav.qml +++ b/gemini/qml/welcomepages/cloud/AddWebdav.qml @@ -1,55 +1,45 @@ /* This file is part of the KDE project * Copyright (C) 2014 Dan Leinir Turthra Jensen * * This program 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 2 of the License, or * (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import QtQuick 2.0 +import QtQuick 2.11 +import QtQuick.Controls 2.5 as QtControls +import org.kde.kirigami 2.7 as Kirigami import org.calligra 1.0 -import QtQuick.Controls 2.2 as QtControls -Rectangle { - anchors.fill: parent; - anchors.margins: Settings.theme.adjustedPixel(16); +Kirigami.OverlaySheet { + id: component; property string serviceName: ""; - property Component addEmpty; - radius: Settings.theme.adjustedPixel(8); - color: "white"; - Rectangle { - anchors { - fill: parent; - margins: -Settings.theme.adjustedPixel(16); - topMargin: -(Settings.theme.adjustedPixel(8) + Constants.GridHeight * 1.5); - } - opacity: 0.5; - color: "white"; - MouseArea { anchors.fill: parent; onClicked: { /*nothing */ } } - SimpleTouchArea { anchors.fill: parent; onTouched: { /*nothing */ } } - } - QtControls.Label { - anchors.fill: parent; - horizontalAlignment: Text.AlignHCenter; - text: "Sorry, support for WebDav is not yet implemented."; + + header: Kirigami.Heading { + text: "Add WebDav Account" + width: component.width / 2 } - QtControls.Button { - anchors { - bottom: parent.bottom; - right: parent.right; - margins: Settings.theme.adjustedPixel(8); + + Kirigami.FormLayout { + QtControls.Label { + horizontalAlignment: Text.AlignHCenter; + text: "Sorry, support for WebDav is not yet implemented."; + } + Kirigami.Separator { + } + QtControls.Button { + text: "Close"; + onClicked: component.close(); } - text: "Close"; - onClicked: dlgStack.replace(addEmpty); } } diff --git a/gemini/qml/welcomepages/cloud/Dropbox.qml b/gemini/qml/welcomepages/cloud/Dropbox.qml index b51d3496337..c223bbf11bf 100644 --- a/gemini/qml/welcomepages/cloud/Dropbox.qml +++ b/gemini/qml/welcomepages/cloud/Dropbox.qml @@ -1,33 +1,32 @@ /* This file is part of the KDE project * Copyright (C) 2014 Dan Leinir Turthra Jensen * * This program 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 2 of the License, or * (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import QtQuick 2.0 import org.calligra 1.0 import org.kde.kirigami 2.7 as Kirigami import "dropbox" as Dropbox import "../../components" -Kirigami.Page { +Kirigami.ScrollablePage { id: base; property string pageName: "accountsPageDropbox"; property QtObject accountDetails; title: "DropBox"; Dropbox.FileNavigator { - anchors.fill: parent; } } diff --git a/gemini/qml/welcomepages/cloud/EditDetailsBase.qml b/gemini/qml/welcomepages/cloud/EditDetailsBase.qml index 3d85fe4840d..a2364582ad8 100644 --- a/gemini/qml/welcomepages/cloud/EditDetailsBase.qml +++ b/gemini/qml/welcomepages/cloud/EditDetailsBase.qml @@ -1,79 +1,63 @@ /* This file is part of the KDE project * Copyright (C) 2014 Dan Leinir Turthra Jensen * * This program 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 2 of the License, or * (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import QtQuick 2.0 +import QtQuick 2.11 +import QtQuick.Controls 2.5 as QtControls +import org.kde.kirigami 2.7 as Kirigami import org.calligra 1.0 -import QtQuick.Controls 1.4 as QtControls import "../../components" -Rectangle { - anchors.fill: parent; - anchors.margins: Settings.theme.adjustedPixel(16); +Kirigami.OverlaySheet { + id: component; property int accountIndex: -1; property string text; onTextChanged: { nameField.text = text; } - property Component addEmpty; - radius: Settings.theme.adjustedPixel(8); - color: "white"; - Rectangle { - anchors { - fill: parent; - margins: -Settings.theme.adjustedPixel(16); - topMargin: -(Settings.theme.adjustedPixel(8) + Constants.GridHeight * 1.5); - } - opacity: 0.5; - color: "white"; - MouseArea { anchors.fill: parent; onClicked: { /*nothing */ } } - SimpleTouchArea { anchors.fill: parent; onTouched: { /*nothing */ } } - } - TextField { - id: nameField; - anchors { - verticalCenter: parent.verticalCenter; - left: parent.left; - right: parent.right; - margins: Settings.theme.adjustedPixel(16); - } - placeholder: "Account Name"; + property alias headerTitle: headerItem.text + + header: Kirigami.Heading { + id: headerItem + text: "Edit Account" + width: component.width / 2 } - QtControls.Button { - id: okButton; - anchors { - bottom: parent.bottom; - right: cancelButton.left; - margins: Settings.theme.adjustedPixel(8); + + Kirigami.FormLayout { + QtControls.TextField { + id: nameField; + anchors { + verticalCenter: parent.verticalCenter; + left: parent.left; + right: parent.right; + margins: Settings.theme.adjustedPixel(16); + } + Kirigami.FormData.label: "Account Name"; } - text: "Save"; - onClicked: { - cloudAccounts.renameAccount(base.accountIndex, nameField.text); - dlgStack.replace(addEmpty); + + Kirigami.Separator { } - } - QtControls.Button { - id: cancelButton; - anchors { - bottom: parent.bottom; - right: parent.right; - margins: Settings.theme.adjustedPixel(8); + + QtControls.Button { + text: "Save"; + onClicked: { + cloudAccounts.renameAccount(base.accountIndex, nameField.text); + component.close(); + } } - text: "Cancel"; - onClicked: dlgStack.replace(addEmpty); } } diff --git a/gemini/qml/welcomepages/cloud/EditGit.qml b/gemini/qml/welcomepages/cloud/EditGit.qml index 0e50067dfbd..0b028e089ff 100644 --- a/gemini/qml/welcomepages/cloud/EditGit.qml +++ b/gemini/qml/welcomepages/cloud/EditGit.qml @@ -1,113 +1,101 @@ /* This file is part of the KDE project * Copyright (C) 2014 Dan Leinir Turthra Jensen * * This program 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 2 of the License, or * (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import QtQuick 2.0 -import QtQuick.Controls 1.4 as QtControls +import QtQuick 2.11 +import QtQuick.Controls 2.5 as QtControls +import org.kde.kirigami 2.7 as Kirigami import org.calligra 1.0 import "../../components" +import "git" -Rectangle { - id: base; - anchors.fill: parent; - anchors.margins: Settings.theme.adjustedPixel(16); +Kirigami.OverlaySheet { + id: component; property int accountIndex: -1; onAccountIndexChanged: { accountDetails = cloudAccounts.accountDetails(accountIndex); } property string text; onTextChanged: { nameField.text = text; } property QtObject accountDetails; - property Component addEmpty; - radius: Settings.theme.adjustedPixel(8); - color: "white"; - Rectangle { - anchors { - fill: parent; - margins: -Settings.theme.adjustedPixel(16); - topMargin: -(Settings.theme.adjustedPixel(8) + Constants.GridHeight * 1.5); - } - opacity: 0.5; - color: "white"; - MouseArea { anchors.fill: parent; onClicked: { /*nothing */ } } - SimpleTouchArea { anchors.fill: parent; onTouched: { /*nothing */ } } - } - QtControls.TextField { - id: nameField; - anchors { - verticalCenter: parent.verticalCenter; - left: parent.left; - right: parent.right; - margins: Settings.theme.adjustedPixel(16); - } - placeholderText: "Account Name"; + + header: Kirigami.Heading { + text: "Edit Git Account" + width: component.width / 2 } - QtControls.Button { - id: credentialsButton; - anchors { - top: nameField.bottom; - right: parent.right; - margins: Settings.theme.adjustedPixel(8); + + Kirigami.FormLayout { + QtControls.TextField { + id: nameField; + Kirigami.FormData.label: "Account Name"; } - text: "Edit User Credentials"; - onClicked: { - dlgStack.push(userCredentials.item); - if(accountDetails.readProperty("userForRemote") !== undefined) { - dlgStack.currentPage.userForRemote = accountDetails.readProperty("userForRemote"); - } - if(accountDetails.readProperty("privateKeyFile") !== undefined) { - dlgStack.currentPage.privateKeyFile = accountDetails.readProperty("privateKeyFile"); - } - if(accountDetails.readProperty("publicKeyFile") !== undefined) { - dlgStack.currentPage.publicKeyFile = accountDetails.readProperty("publicKeyFile"); - } - if(accountDetails.readProperty("needsPrivateKeyPassphrase") !== undefined) { - dlgStack.currentPage.needsPrivateKeyPassphrase = accountDetails.readProperty("needsPrivateKeyPassphrase"); + + QtControls.Button { + onClicked: { + dlgLoader.item.close(); + userCredentials.open(); + if(accountDetails.readProperty("userForRemote") !== undefined) { + credentialsGetter.userForRemote = accountDetails.readProperty("userForRemote"); + } + if(accountDetails.readProperty("privateKeyFile") !== undefined) { + credentialsGetter.privateKeyFile = accountDetails.readProperty("privateKeyFile"); + } + if(accountDetails.readProperty("publicKeyFile") !== undefined) { + credentialsGetter.publicKeyFile = accountDetails.readProperty("publicKeyFile"); + } + if(accountDetails.readProperty("needsPrivateKeyPassphrase") !== undefined) { + credentialsGetter.needsPrivateKeyPassphrase = accountDetails.readProperty("needsPrivateKeyPassphrase"); + } } + text: "Edit User Credentials"; + Kirigami.FormData.label: "User Credentials" } - } - QtControls.Button { - id: okButton; - anchors { - bottom: parent.bottom; - right: cancelButton.left; - margins: Settings.theme.adjustedPixel(8); - } - text: "Save"; - onClicked: { - cloudAccounts.renameAccount(base.accountIndex, nameField.text); - dlgStack.replace(addEmpty); + + Kirigami.Separator { } - } - QtControls.Button { - id: cancelButton; - anchors { - bottom: parent.bottom; - right: parent.right; - margins: Settings.theme.adjustedPixel(8); + + QtControls.Button { + text: "Save"; + onClicked: { + cloudAccounts.renameAccount(component.accountIndex, nameField.text); + dlgLoader.item.close(); + } } - text: "Cancel"; - onClicked: dlgStack.replace(addEmpty); - } - Loader { - id: userCredentials; - source: "git/userCredentialsContainer.qml" + Kirigami.OverlaySheet { + id: userCredentials; + header: Kirigami.Heading { text: "User Credentials" } + GetUserCredentials { + id: credentialsGetter + onAccepted: { + component.userForRemote = userForRemote; + component.privateKeyFile = privateKeyFile; + component.publicKeyFile = publicKeyFile; + component.needsPrivateKeyPassphrase = needsPrivateKeyPassphrase; + userCredentials.close(); + } + } + onSheetOpenChanged: { + if (sheetOpen === false) { + dlgLoader.item.open(); + } + } + } } } diff --git a/gemini/qml/welcomepages/cloud/Git.qml b/gemini/qml/welcomepages/cloud/Git.qml index aa3a64dba1a..8d72ef3fd95 100644 --- a/gemini/qml/welcomepages/cloud/Git.qml +++ b/gemini/qml/welcomepages/cloud/Git.qml @@ -1,33 +1,33 @@ /* This file is part of the KDE project * Copyright (C) 2014 Dan Leinir Turthra Jensen * * This program 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 2 of the License, or * (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import QtQuick 2.0 import org.calligra 1.0 import org.kde.kirigami 2.7 as Kirigami import "../../components" Kirigami.Page { id: base; property string pageName: "accountsPageGit"; - title: accountDetails.readProperty("text"); + title: accountDetails === null ? "" : accountDetails.readProperty("text"); property QtObject accountDetails: null; Loader { anchors.fill: parent; source: "git/repositoryContentContainer.qml" } } diff --git a/gemini/qml/welcomepages/cloud/RemoveAccountDlg.qml b/gemini/qml/welcomepages/cloud/RemoveAccountDlg.qml index a29ccc73ffb..24c40d69726 100644 --- a/gemini/qml/welcomepages/cloud/RemoveAccountDlg.qml +++ b/gemini/qml/welcomepages/cloud/RemoveAccountDlg.qml @@ -1,104 +1,57 @@ /* This file is part of the KDE project * Copyright (C) 2014 Dan Leinir Turthra Jensen * * This program 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 2 of the License, or * (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import QtQuick 2.0 -import QtQuick.Controls 2.2 as QtControls +import QtQuick 2.11 +import QtQuick.Controls 2.5 as QtControls +import QtQuick.Layouts 1.5 as QtLayouts +import org.kde.kirigami 2.7 as Kirigami import org.calligra 1.0 -Rectangle { - id: base; - anchors.fill: parent; - anchors.margins: Settings.theme.adjustedPixel(16); +Kirigami.OverlaySheet { + id: component; property int accountIndex: -1; property string text; - onTextChanged: { - nameField.text = text; - } - property Component addEmpty; - radius: Settings.theme.adjustedPixel(8); - color: "white"; - Rectangle { - anchors { - fill: parent; - margins: -Settings.theme.adjustedPixel(16); - topMargin: -(Settings.theme.adjustedPixel(8) + Constants.GridHeight * 1.5); - } - opacity: 0.5; - color: "white"; - MouseArea { anchors.fill: parent; onClicked: { /*nothing */ } } - SimpleTouchArea { anchors.fill: parent; onTouched: { /*nothing */ } } - } - QtControls.Label { - anchors { - bottom: parent.verticalCenter; - left: parent.left; - right: parent.right; - margins: Settings.theme.adjustedPixel(16); - } - verticalAlignment: Text.AlignVCenter; - horizontalAlignment: Text.AlignHCenter; - text: "Do you wish to remove this account?"; - } - QtControls.Label { - id: nameField; - anchors { - top: parent.verticalCenter; - left: parent.left; - right: parent.right; - margins: Settings.theme.adjustedPixel(16); - } - verticalAlignment: Text.AlignVCenter; - horizontalAlignment: Text.AlignHCenter; - } - QtControls.Label { - anchors { - top: nameField.bottom; - left: parent.left; - right: parent.right; - margins: Settings.theme.adjustedPixel(16); - } - verticalAlignment: Text.AlignVCenter; - horizontalAlignment: Text.AlignHCenter; - text: "(removing the account will leave all files in place, this only removes it from Calligra Gemini's list)"; + + header: Kirigami.Heading { + id: headerItem + text: "Edit Account" + width: component.width / 2 } - QtControls.Button { - id: okButton; - anchors { - bottom: parent.bottom; - right: cancelButton.left; - margins: Settings.theme.adjustedPixel(8); + + Kirigami.FormLayout { + QtControls.Label { + verticalAlignment: Text.AlignVCenter; + horizontalAlignment: Text.AlignHCenter; + text: "Do you wish to remove this account?\n\n" + component.text + "\n\n(removing the account will leave all files in place, this only removes it from Calligra Gemini's list)"; } - text: "Remove Account"; - onClicked: { - cloudAccounts.removeAccount(base.accountIndex); - dlgStack.replace(addEmpty); + + Kirigami.Separator { } - } - QtControls.Button { - id: cancelButton; - anchors { - bottom: parent.bottom; - right: parent.right; - margins: Settings.theme.adjustedPixel(8); + + QtControls.Button { + id: okButton; + text: "Remove Account"; + QtLayouts.Layout.alignment: Qt.AlignHCenter + onClicked: { + cloudAccounts.removeAccount(component.accountIndex); + component.close(); + } } - text: "Cancel"; - onClicked: dlgStack.replace(addEmpty); } } - diff --git a/gemini/qml/welcomepages/cloud/dropbox/DropboxWebView.qml b/gemini/qml/welcomepages/cloud/dropbox/DropboxWebView.qml index 9f4bb7aa584..e3fda022583 100644 --- a/gemini/qml/welcomepages/cloud/dropbox/DropboxWebView.qml +++ b/gemini/qml/welcomepages/cloud/dropbox/DropboxWebView.qml @@ -1,55 +1,54 @@ /* This file is part of the KDE project * Copyright (C) 2014 Dan Leinir Turthra Jensen * * This program 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 2 of the License, or * (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import QtQuick 2.0 +import QtQuick 2.11 +import QtQuick.Controls 2.5 as QtControls import QtWebEngine 1.5 -import org.kde.kirigami 2.1 as Kirigami -import QtQuick.Controls 1.4 as QtControls WebEngineView { id: webView anchors.fill: parent // experimental.userAgent: "Mozilla/5.0 (Linux; U; like Android 4.0.3; ko-kr; Jolla Build/Alpha) AppleWebkit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30" onLoadingChanged: { if(loadRequest.status == WebEngineView.LoadSucceededStatus) { tryingText.visible = false; if(loadRequest.url.toString().length === 48) { controllerMIT.oauth_v1_access_token() } // if(loadRequest.url.toString().length === 140) experimental.test.touchTap(webView, 100, 150) } } - Kirigami.Label { + QtControls.Label { id: tryingText anchors.centerIn: parent; text: "Trying to load login page..." color: "Grey" z: 10 QtControls.BusyIndicator { id: b_indicator anchors { top: parent.verticalCenter topMargin: parent.font.pixelSize; horizontalCenter: parent.horizontalCenter } running: parent.visible; } } } diff --git a/gemini/qml/welcomepages/cloud/dropbox/FileNavigator.qml b/gemini/qml/welcomepages/cloud/dropbox/FileNavigator.qml index 669c4e5c041..827b83934b0 100644 --- a/gemini/qml/welcomepages/cloud/dropbox/FileNavigator.qml +++ b/gemini/qml/welcomepages/cloud/dropbox/FileNavigator.qml @@ -1,514 +1,464 @@ /* This file is part of the KDE project * Copyright (C) 2014 Dan Leinir Turthra Jensen * * This program 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 2 of the License, or * (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import QtQuick 2.0 +import QtQuick 2.11 +import QtQuick.Controls 2.5 as QtControls +import org.kde.kirigami 2.7 as Kirigami import org.calligra 1.0 import Calligra.Gemini.Dropbox 1.0 -import QtQuick.Controls 1.4 as QtControls -import org.kde.kirigami 2.1 as Kirigami import "../../../components" -Item { - id: page; - property QtObject model: folderListModel; +GridView { + id: component; property string title: ""; property string errorText: ""; property bool have_checked: false; property string currentDir: "/"; property bool downloadWasRequested: false; property string fileMimetype; property string fileName; property QtObject provider; QtObject { id: fakeTheme; property int itemSizeLarge: Settings.theme.adjustedPixel(64); property int paddingLarge: Settings.theme.adjustedPixel(8); property int paddingSmall: Settings.theme.adjustedPixel(8); property int fontSizeLarge: Settings.theme.adjustedPixel(28); property int fontSizeSmall: Settings.theme.adjustedPixel(18); property color secondaryColor: "black"; property color highlightColor: "grey"; } - InfoBanner { id: i_infobanner; } + cellWidth: width / 4; + cellHeight: cellWidth + Settings.theme.font("templateLabel").pixelSize; + model: folderListModel; + delegate: itemDelegate; + cacheBuffer: 1000 + header: Item { + id: pageHeader; + height: currentDir !== "/" ? backToRootButton.height : 0; + width: component.width; + QtControls.Button { + id: backToRootButton; + anchors { + top: parent.top; + margins: fakeTheme.paddingSmall + } + width: component.width; + height: Settings.theme.adjustedPixel(64); + opacity: currentDir !== "/" ? 1 : 0; + Behavior on opacity{ PropertyAnimation{ duration: Constants.AnimationDuration; } } + icon.source: Settings.theme.icon("SVG-Icon-MenuBack-1"); + text: "Back to parent folder" + onClicked: { + controllerMIT.backtoRootDir() + controllerMIT.getlistoffolder() + } + } + } + Component { id: itemDelegate; - MouseArea { - width: folderListView.cellWidth; - height: folderListView.cellHeight; + DocumentTile { enabled: model.is_dir ? true : Settings.mimeTypeToDocumentClass(model.mime_type) !== DocumentListModel.UnknownType; - Rectangle { - anchors.fill: parent; - opacity: parent.enabled ? 1 : 0.3 - } - - Image { - id: icon; - anchors { - top: parent.top; - left: parent.left; - right: parent.right; - margins: Constants.DefaultMargin / 2; + imageUrl: model.is_dir ? Settings.theme.icon("layer_group-black") : iconFromDocumentClass(Settings.mimeTypeToDocumentClass(model.mime_type)); + title: { + var nameof = model.path.split("/") + var nameof1 = nameof[nameof.length - 1] + if(model.is_dir) { + return nameof1; } - height: parent.width; - fillMode: Image.PreserveAspectFit; - smooth: true; - asynchronous: true; - function iconFromDocumentClass(documentClass) { - switch(documentClass) { - case DocumentListModel.PresentationType: - return Settings.theme.icon("SVG-Icon-NewPresentation-1"); - break; - case DocumentListModel.TextDocumentType: - return Settings.theme.icon("SVG-Icon-NewDocument-1"); - break; - case DocumentListModel.SpreadsheetType: - return Settings.theme.icon("SVG-Icon-NewSpreadsheet-1"); - break; - default: - return Settings.theme.icon("SVG-Icon-Cloud-1"); - break; - } - } - source: model.is_dir ? Settings.theme.icon("layer_group-black") : iconFromDocumentClass(Settings.mimeTypeToDocumentClass(model.mime_type)); - sourceSize.width: width; - sourceSize.height: height; - } - Kirigami.Label { - id: lblName; - anchors { - left: parent.left; - right: parent.right; - bottom: parent.bottom; - margins: Constants.DefaultMargin; - bottomMargin: Constants.DefaultMargin * 2; - } - height: font.pixelSize + Constants.DefaultMargin * 2; - horizontalAlignment: Text.AlignHCenter; - verticalAlignment: Text.AlignVCenter; - text:{ - var nameof = model.path.split("/") - var nameof1 = nameof[nameof.length - 1] - if(model.is_dir) { - return nameof1; - } - return "%1 (%2)".arg(nameof1).arg(model.size); - } - elide: Text.ElideMiddle; - font: Settings.theme.font("templateLabel"); - color: "#5b6573"; + return "%1 (%2)".arg(nameof1).arg(model.size); } onClicked: { - if(model.is_dir) - { + if (model.is_dir) { controllerMIT.setFolderRoot(model.path) controllerMIT.getlistoffolder() - } - else - { + } else { controllerMIT.setCheck(index, true); controllerMIT.downloadSelectedFiles(); var nameof = model.path.split("/"); - page.downloadWasRequested = true; - page.fileName = nameof[nameof.length - 1]; - page.fileMimetype = model.mime_type; - pageStack.push(downloadStatus); + component.downloadWasRequested = true; + component.fileName = nameof[nameof.length - 1]; + component.fileMimetype = model.mime_type; + applicationWindow().pageStack.push(downloadStatus); controllerMIT.start_transfer_process(); } } + function iconFromDocumentClass(documentClass) { + switch(documentClass) { + case DocumentListModel.PresentationType: + return Settings.theme.icon("SVG-Icon-NewPresentation-1"); + break; + case DocumentListModel.TextDocumentType: + return Settings.theme.icon("SVG-Icon-NewDocument-1"); + break; + case DocumentListModel.SpreadsheetType: + return Settings.theme.icon("SVG-Icon-NewSpreadsheet-1"); + break; + default: + return Settings.theme.icon("SVG-Icon-Cloud-1"); + break; + } + } + Rectangle { + anchors.fill: parent; + opacity: parent.enabled ? 0 : 0.7 + color: Kirigami.Theme.backgroundColor + } } } - Page { + Component { id: downloadStatus; - ListView { - id: filestransferListView - anchors { - fill: parent - topMargin: Settings.theme.adjustedPixel(64); - } - model: filesTransferModel - delegate: Item { - width: downloadStatus.width - height: is_finished ? 0 : childrenRect.height; - clip: true; - - Column { - id:rec_main - spacing: Constants.DefaultMargin; - height: childrenRect.height; - width: parent.width; - - Image { - id: i_fstatus - anchors.horizontalCenter: parent.horizontalCenter; - source: Settings.theme.icon("SVG-Icon-Cloud-1"); //is_download ? Settings.theme.image("SVG-Icon-Cloud-1") : "image://theme/icon-s-cloud-upload" - } - Item { + Kirigami.ScrollablePage { + id: downloadStatusPage + title: "DropBox Download Status" + ListView { + id: filestransferListView + model: filesTransferModel + delegate: Item { + width: ListView.view.width + height: is_finished ? 0 : childrenRect.height; + clip: true; + + Column { + id:rec_main + spacing: Constants.DefaultMargin; + height: childrenRect.height; width: parent.width; - height: Constants.DefaultMargin; - } - Kirigami.Label { - id: l_name - anchors.horizontalCenter: parent.horizontalCenter; - height: font.pixelSize; - text: { - var filename1 = model.filename.split("/"); - var filename2 = filename1[filename1.length-1]; - return filename2; + Image { + id: i_fstatus + anchors.horizontalCenter: parent.horizontalCenter; + source: Settings.theme.icon("SVG-Icon-Cloud-1"); //is_download ? Settings.theme.image("SVG-Icon-Cloud-1") : "image://theme/icon-s-cloud-upload" + } + Item { + width: parent.width; + height: Constants.DefaultMargin; } - } - QtControls.ProgressBar { - id: pb_updown - anchors.horizontalCenter: parent.horizontalCenter; - visible: !is_finished && !in_queue - width: parent.width - 120 - height: 18 - value: progressing - } + QtControls.Label { + id: l_name + anchors.horizontalCenter: parent.horizontalCenter; + height: font.pixelSize; + text: { + var filename1 = model.filename.split("/"); + var filename2 = filename1[filename1.length-1]; + return filename2; + } + } - Kirigami.Label { - id: lb_updown_total - anchors.horizontalCenter: parent.horizontalCenter; - height: visible ? font.pixelSize : 0; - visible: !is_finished && !in_queue - text:"" - } + QtControls.ProgressBar { + id: pb_updown + anchors.horizontalCenter: parent.horizontalCenter; + visible: !is_finished && !in_queue + width: parent.width - 120 + height: 18 + value: progressing + } + + QtControls.Label { + id: lb_updown_total + anchors.horizontalCenter: parent.horizontalCenter; + height: visible ? font.pixelSize : 0; + visible: !is_finished && !in_queue + text:"" + } - Connections { - target: controllerMIT - onProgressBarChanged : { - pb_updown.progress = percent - if (sent_received || speed){ - lb_updown_total.text = (is_download?"Received: ":"Sent: ")+__sent_received_calculate(sent_received) + " | Speed: " +__speed_calculate(speed) - }else { - console.debug(lb_updown_total.text); + Connections { + target: controllerMIT + onProgressBarChanged : { + pb_updown.progress = percent + if (sent_received || speed){ + lb_updown_total.text = (is_download?"Received: ":"Sent: ")+__sent_received_calculate(sent_received) + " | Speed: " +__speed_calculate(speed) + }else { + console.debug(lb_updown_total.text); + } } } } + } //end filestransferDeligate + onCountChanged: { + filestransferListView.visible = (filestransferListView.model.count !== 0) + //no_transfers.visible = !filestransferListView.model.count } - } //end filestransferDeligate - onCountChanged: { - filestransferListView.visible = (filestransferListView.model.count !== 0) - //no_transfers.visible = !filestransferListView.model.count - } - } //end ListView - } - - GridView { - id: folderListView - visible:false - clip: true; - contentWidth: width; - anchors.fill: parent; - cellWidth: width / 4 - Constants.DefaultMargin; - cellHeight: cellWidth + Settings.theme.font("templateLabel").pixelSize + Constants.DefaultMargin * 4; - model: folderListModel; - delegate: itemDelegate; - //section.property: "section" - cacheBuffer: 1000 - header: Item { - id: pageHeader; - height: currentDir !== "/" ? backToRootButton.height : 0; - width: page.width; - QtControls.Button { - id: backToRootButton; - anchors { - top: parent.top; - margins: fakeTheme.paddingSmall - } - width: page.width; - height: Settings.theme.adjustedPixel(64); - opacity: currentDir !== "/" ? 1 : 0; - Behavior on opacity{ PropertyAnimation{ duration: Constants.AnimationDuration; } } - iconSource: Settings.theme.icon("SVG-Icon-MenuBack-1"); - text: "Back to parent folder" - onClicked: { - controllerMIT.backtoRootDir() - controllerMIT.getlistoffolder() - } - } + } //end ListView } - ScrollDecorator { flickableItem: folderListView; } } Item { id:this_folder_is_empty visible: false anchors.fill: parent - Kirigami.Label { + QtControls.Label { anchors.centerIn: parent text:"This Folder is Empty" color: "grey" } } Item { id:r_networkerror visible: false anchors.centerIn: parent width: parent.width - fakeTheme.paddingLarge height: r_label_x.height + r_button_x.height; - Kirigami.Label { + QtControls.Label { id: r_label_x anchors { bottom: r_button_x.top; left: parent.left; right: parent.right; margins: fakeTheme.paddingLarge; } height: paintedHeight; - text: "There was a problem loading your Dropbox. It could be lost connection or a slow network. Check your connection or try again later. The reported error was: " + errorText; + text: "There was a problem loading your Dropbox. It could be lost connection or a slow network. Check your connection or try again later. The reported error was:\n" + errorText; + horizontalAlignment: Text.AlignHCenter wrapMode: Text.Wrap; } QtControls.Button { id:r_button_x text:"Retry" anchors { horizontalCenter: parent.horizontalCenter; bottom: parent.bottom; } onClicked: { r_networkerror.visible = false b_indicator.visible = true b_indicator_wrap.visible=true controllerMIT.refresh_current_folder() } } } QtControls.BusyIndicator { id: b_indicator anchors.centerIn: parent running: b_indicator.visible; } MouseArea { id: b_indicator_wrap anchors.fill: parent visible: true } Connections { target: controllerMIT onFolderfinished : { r_networkerror.visible = false - folderListView.visible = true b_indicator.visible = false; b_indicator_wrap.visible=false; //tb_back.enabled = !controllerMIT.isRootDir() //f_fastscroll.test() //top_banner.havemenu = true currentDir = controllerMIT.getcurrentdir() changeCurrentDir() this_folder_is_empty.visible = folderListModel.count ? false : true - //folderListView.visible = folderListModel.count ? true : false - folderListView.visible = folderListModel.count ? true : true folderListView.positionViewAtBeginning(); } onNetwork_error : { //error //top_banner.havemenu = false b_indicator.visible = false; b_indicator_wrap.visible=false; - folderListView.visible = false errorText = error; r_networkerror.visible = true } onNotification : { - i_infobanner.show(notification); + applicationWindow().showPassiveNotification(notification); console.log("notification:"+ notification) } onDelete_selected_items_finished: { b_indicator.visible = false; b_indicator_wrap.visible=false; - i_infobanner.show(result); + applicationWindow().showPassiveNotification(result); console.log("onDelete_selected_items_finished:" + result); } onEnable_download_and_delete_button: { console.log("onEnable_download_and_delete_button") //top_banner.deleteVisible = have_checked //top_banner.addDownloadVisible = have_checked //top_banner.moveVisible = have_checked - page.have_checked = have_checked + component.have_checked = have_checked } onStopTransfer: { if (!controllerMIT.is_push_notification()){ - i_infobanner.show("Files transfer completed"); + applicationWindow().showPassiveNotification("Files transfer completed"); } - if(page.downloadWasRequested) { - page.downloadWasRequested = false; - var filePath = controllerMIT.dropboxFolder() + "/" + page.fileName; - var docClass = Settings.mimeTypeToDocumentClass(page.fileMimetype); + if(component.downloadWasRequested) { + component.downloadWasRequested = false; + var filePath = controllerMIT.dropboxFolder() + "/" + component.fileName; + var docClass = Settings.mimeTypeToDocumentClass(component.fileMimetype); if(docClass !== DocumentListModel.UnknownType) { pageStack.pop(); openFile(filePath, controllerMIT.uploadMostRecentAction()); } else { - console.log("Unknown file format " + docClass + " for file " + filePath + " with stated mimetype " + page.fileMimetype); + console.log("Unknown file format " + docClass + " for file " + filePath + " with stated mimetype " + component.fileMimetype); } } refreshDir(); // switch(docClass) { // case DocumentListModel.TextDocument: -// pageStack.push(pages.textDocument, { title: page.fileName, path: filePath, mimeType: page.fileMimetype }); +// pageStack.push(pages.textDocument, { title: component.fileName, path: filePath, mimeType: component.fileMimetype }); // break; // case DocumentListModel.SpreadSheetDocument: -// pageStack.push(pages.spreadsheet, { title: page.fileName, path: filePath, mimeType: page.fileMimetype }); +// pageStack.push(pages.spreadsheet, { title: component.fileName, path: filePath, mimeType: component.fileMimetype }); // break; // case DocumentListModel.PresentationDocument: -// pageStack.push(pages.presentation, { title: page.fileName, path: filePath, mimeType: page.fileMimetype }); +// pageStack.push(pages.presentation, { title: component.fileName, path: filePath, mimeType: component.fileMimetype }); // break; // case DocumentListModel.PDFDocument: -// pageStack.push(pages.pdf, { title: page.fileName, path: filePath, mimeType: page.fileMimetype }); +// pageStack.push(pages.pdf, { title: component.fileName, path: filePath, mimeType: component.fileMimetype }); // break; // default: -// console.log("Unknown file format " + docClass + " for file " + filePath + " with stated mimetype " + page.fileMimetype); +// console.log("Unknown file format " + docClass + " for file " + filePath + " with stated mimetype " + component.fileMimetype); // break; // } } onCreate_folder_finished: { b_indicator.visible = false; b_indicator_wrap.visible=false; - i_infobanner.show(result); + applicationWindow().showPassiveNotification(result); console.log("onCreate_folder_finished:" + result) } onRename_folder_finished: { b_indicator.visible = false; b_indicator_wrap.visible=false; - i_infobanner.show(result); + applicationWindow().showPassiveNotification(result); } onMove_files_folders_finished: { b_indicator.visible = false; b_indicator_wrap.visible=false; m_is_move = false m_is_copy = false toolicon_show(true); - i_infobanner.show(result); + applicationWindow().showPassiveNotification(result); } onShares_finished:{ //result b_indicator.visible = false; b_indicator_wrap.visible=false; if (!result){ - i_infobanner.show("Could not create share link, try again later."); + applicationWindow().showPassiveNotification("Could not create share link, try again later."); } } onShares_metadata:{ //url, expire sharemetadatadlg.url = url pageStack.push(sharemetadatadlg) } onAccountinfo_finished: { //result b_indicator.visible = false; b_indicator_wrap.visible=false; } onAccountinfo_metadata: { //result var val=[] for(var i=0; i<6;i++){ if (i==0) val.push(result['display_name']) else if(i==1) val.push(result['email']) else if(i==2) val.push(result['uid']) else if(i==3) val.push(__convertToMB(result['quota_info']['shared'])) else if(i==4) val.push(__convertToMB(result['quota_info']['quota'])) else val.push(__convertToMB(result['quota_info']['normal'])) } accountinfodlg.m_data = val pageStack.push(accountinfodlg) } } Component.onCompleted: { controllerMIT.need_authenticate() controllerMIT.getlistoffolder() } // CohereButton { // id:tb_back // anchors { -// bottom: page.bottom; -// right: page.right; +// bottom: component.bottom; +// right: component.right; // } // enabled: !controllerMIT.isRootDir() // onClicked: { // controllerMIT.backtoRootDir() // controllerMIT.getlistoffolder() // } // text: "Back"; // textColor: "#5b6573"; // textSize: Settings.theme.adjustedPixel(18); // color: "#D2D4D5"; // } function changeCurrentDir(){ var maxlength = 30 - if (page.width > page.height) + if (component.width > component.height) maxlength = 70 if (!currentDir.length) currentDir = "/" if (currentDir.length >= maxlength) currentDir = currentDir.substring(0,maxlength-10) + " ... " + currentDir.substring(currentDir.length-10,currentDir.length) } function refreshDir(){ b_indicator.visible = true; b_indicator_wrap.visible=true; controllerMIT.refresh_current_folder() } function toFixed(value, precision) { var power = Math.pow(10, precision || 0); return String(Math.round(value * power) / power); } function __sent_received_calculate(bytes){ if (bytes < 1024) return toFixed(bytes,2)+ " bytes" else if (bytes < 1024*1024) return toFixed((bytes/1024),2)+ " KB" else return toFixed(((bytes/1024)/1024),2) + " MB" } function __speed_calculate(bytes){ if (bytes < 1024) return toFixed(bytes,2) + " bps" else if(bytes < 1024*1024) return toFixed((bytes/1024),2) + " Kbps" else return toFixed(((bytes/1024)/1024),2) + " Mbps" } } diff --git a/gemini/qml/welcomepages/cloud/dropbox/LoginPage.qml b/gemini/qml/welcomepages/cloud/dropbox/LoginPage.qml index 2ce94cc15e6..d6a9a59e8a5 100644 --- a/gemini/qml/welcomepages/cloud/dropbox/LoginPage.qml +++ b/gemini/qml/welcomepages/cloud/dropbox/LoginPage.qml @@ -1,58 +1,57 @@ /* This file is part of the KDE project * Copyright (C) 2014 Dan Leinir Turthra Jensen * * This program 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 2 of the License, or * (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import QtQuick 2.0 +import QtQuick 2.11 +import org.kde.kirigami 2.7 as Kirigami import "../../../components" -Page { - anchors.fill: parent +Kirigami.Page { + title: "DropBox Login" property string urlString : "https://www.dropbox.com/1/oauth/authorize?display=mobile&oauth_token="+ controllerMIT.oauth_token Component.onCompleted: { controllerMIT.oauth_v1_request_token() } Loader { id: webView anchors.fill: parent source: "DropboxWebView.qml" onStatusChanged: { if(status === Loader.Error) { - i_infobanner.show("Failed to load Web View component."); + applicationWindow().showPassiveNotification("Failed to load Web View component."); } } } - InfoBanner { id: i_infobanner; } - Connections { target: controllerMIT onNetwork_error : { - i_infobanner.show(error); + applicationWindow().showPassiveNotification("Network error while loading DropBox:\n" + error); console.debug("Network error while loading DropBox:\n" + error); } onAuthenticate_finished : { pageStack.pop(); } onOpen_oauth_authorize_page : { webView.item.url = "https://www.dropbox.com/1/oauth/authorize?display=mobile&oauth_token="+oauth_token } } } // TODO Handle error() code 3 (dns resolution error) and other no-network situations diff --git a/gemini/qml/welcomepages/cloud/dropbox/SetupPage.qml b/gemini/qml/welcomepages/cloud/dropbox/SetupPage.qml index c24d0430359..ba92b224871 100644 --- a/gemini/qml/welcomepages/cloud/dropbox/SetupPage.qml +++ b/gemini/qml/welcomepages/cloud/dropbox/SetupPage.qml @@ -1,132 +1,64 @@ /* This file is part of the KDE project * Copyright (C) 2014 Dan Leinir Turthra Jensen * * This program 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 2 of the License, or * (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import QtQuick 2.0 +import QtQuick 2.11 +import QtQuick.Controls 2.5 as QtControls +import org.kde.kirigami 2.7 as Kirigami import Calligra.Gemini.Dropbox 1.0 -import QtQuick.Controls 1.4 as QtControls -import org.kde.kirigami 2.1 as Kirigami import "../../../components" -Item { - anchors.fill: parent; - clip: true; - Rectangle { - anchors.fill: parent; - opacity: 0.6; +Kirigami.FormLayout { + id: component + QtControls.Label { + visible: !controllerMIT.needAuthenticate; + wrapMode: Text.Wrap; + text: "You are already signed into DropBox, and we only support one DropBox account. To sign in as another user, please click on the button above to sign out of your current account first."; } - Item { - id: header; - anchors { - top: parent.top; - left: parent.left; - right: parent.right; - } - height: Settings.theme.adjustedPixel(64); + Kirigami.Separator { + visible: !controllerMIT.needAuthenticate; + Kirigami.FormData.isSection: true } - Item { - anchors { - left: parent.left; - right: parent.right; - top: header.bottom; + QtControls.Button { + visible: !controllerMIT.needAuthenticate; + Kirigami.FormData.label: "Log out of DropBox?" + text: "Log Out" + onClicked: { + if (!controllerMIT.is_transfer()) { + controllerMIT.logout(); + } else { + applicationWindow().showPassiveNotification("Please complete the upload/download tasks in Files Transfer before Sign out."); + dlgLoader.item.close(); + } } - height: Constants.GridHeight; + } - CohereButton { - anchors.centerIn: parent; - textColor: "#5b6573"; - textSize: Settings.theme.adjustedPixel(18); - color: "#D2D4D5"; - text: controllerMIT.needAuthenticate ? "Log in to DropBox" : "Log out of DropBox"; - onClicked: { - if(controllerMIT.needAuthenticate) { - pageStack.push( loginPage ); - } - else { - signOutNow(); - } - } - Kirigami.Label { - anchors { - top: parent.bottom; - topMargin: Settings.theme.adjustedPixel(16); - horizontalCenter: parent.horizontalCenter; - } - visible: !controllerMIT.needAuthenticate; - width: parent.parent.width / 2; - height: font.pixelSize * 6; - horizontalAlignment: Text.AlignHCenter; - verticalAlignment: Text.AlignTop; - wrapMode: Text.Wrap; - text: "You are already signed into DropBox, and we only support one DropBox account. To sign in as another user, please click on the button above to sign out of your current account first."; - } + QtControls.Button { + visible: controllerMIT.needAuthenticate + text: "Log in to DropBox"; + onClicked: { + dlgLoader.item.close(); + pageStack.push(loginPage); } } Component { id: loginPage; LoginPage { } } - Page { - id: signoutconfirmationDlg - //PageHeader { title: "Log Out" } - Rectangle { - anchors.fill: parent; - anchors.margins: Settings.theme.adjustedPixel(16); - radius: Settings.theme.adjustedPixel(8); - color: "white"; - Kirigami.Label { - anchors { - bottom: signoutButtonsRow.top; - left: parent.left; - right: parent.right; - margins: Constants.DefaultMargin; - } - wrapMode: Text.Wrap - horizontalAlignment: Text.AlignHCenter - text: "Do you really want to log out of DropBox?" - } - Row { - id: signoutButtonsRow; - anchors.centerIn: parent; - width: childrenRect.width; - spacing: Settings.theme.adjustedPixel(8); - QtControls.Button { - text: "Yes" - onClicked: { - controllerMIT.logout() - pageStack.pop() - } - } - QtControls.Button { - text: "No" - onClicked: { - pageStack.pop() - } - } - } - } - } InfoBanner { id: i_infobanner; } - function signOutNow(){ - if (!controllerMIT.is_transfer()){ - pageStack.push(signoutconfirmationDlg) - }else{ - i_infobanner.show("Please complete the upload/download tasks in Files Transfer before Sign out."); - } - } } diff --git a/gemini/qml/welcomepages/cloud/git/CreateCheckout.qml b/gemini/qml/welcomepages/cloud/git/CreateCheckout.qml index cca3397af2c..5eba0faefef 100644 --- a/gemini/qml/welcomepages/cloud/git/CreateCheckout.qml +++ b/gemini/qml/welcomepages/cloud/git/CreateCheckout.qml @@ -1,209 +1,165 @@ /* This file is part of the KDE project * Copyright (C) 2014 Dan Leinir Turthra Jensen * * This program 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 2 of the License, or * (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import QtQuick 2.0 +import QtQuick 2.11 +import QtQuick.Layouts 1.11 as QtLayouts +import QtQuick.Controls 2.11 as QtControls +import org.kde.kirigami 2.7 as Kirigami import org.calligra 1.0 import Calligra.Gemini.Git 1.0 -import QtQuick.Controls 1.4 as QtControls -import org.kde.kirigami 2.1 as Kirigami import "../../../components" -Item { +Kirigami.FormLayout { id: base; property string userForRemote; property string privateKeyFile; property string publicKeyFile; property bool needsPrivateKeyPassphrase; Component { id: accountComp; QtObject { property string localrepo: checkoutDir.text; property string userForRemote: base.userForRemote; property string privateKeyFile: base.privateKeyFile; property string publicKeyFile: base.publicKeyFile; property bool needsPrivateKeyPassphrase: base.needsPrivateKeyPassphrase; } } - Column { - width: parent.width; - height: childrenRect.height; - Kirigami.Heading { - text: "Add Git Account" - width: parent.width; + QtLayouts.ColumnLayout { + id: typeChooser; + spacing: Kirigami.Units.smallSpacing + Kirigami.FormData.label: "Type of repository:"; + Kirigami.FormData.buddyFor: existingCheckoutSelector + QtControls.RadioButton { + id: existingCheckoutSelector; + text: "Existing Clone"; + checked: true; } - Text { - id: typeChooser; - anchors.right: parent.right; - width: parent.width - (height / 2); - height: existingCheckoutSelector.height + Settings.theme.adjustedPixel(16); - verticalAlignment: Text.AlignVCenter - font: Settings.theme.font("application"); - text: "Type of repository:"; - CohereButton { - id: existingCheckoutSelector; - anchors { - right: newCheckoutSelector.left; - verticalCenter: parent.verticalCenter; - } - text: "Existing Clone"; - textColor: "#5b6573"; - textSize: Settings.theme.adjustedPixel(18); - checkedColor: "#D2D4D5"; - checked: true; - onClicked: { - if(!checked) { - checked = true; - newCheckoutSelector.checked = false; - } - } + QtControls.RadioButton { + id: newCheckoutSelector; + text: "New Clone"; + } + } + + QtControls.TextField { + id: checkoutName; + Kirigami.FormData.label: "Short name for this account"; + } + + QtControls.TextField { + id: checkoutDir; + Kirigami.FormData.label: "Local clone location"; + QtControls.Button { + id: checkoutBrowse; + anchors { + top: checkoutDir.top; + right: parent.right; + bottom: checkoutDir.bottom; } - CohereButton { - id: newCheckoutSelector; - anchors{ - right: parent.right; - verticalCenter: parent.verticalCenter; - } - text: "New Clone"; - textColor: "#5b6573"; - textSize: Settings.theme.adjustedPixel(18); - checkedColor: "#D2D4D5"; - onClicked: { - if(!checked) { - checked = true; - existingCheckoutSelector.checked = false; - } + text: "Browse..."; + onClicked: { + var newDir = GitCheckoutCreator.getDir(); + if(newDir !== "") { + checkoutDir.text = newDir; } } } - QtControls.TextField { - id: checkoutName; - width: parent.width; - placeholderText: "Short name for this account"; - } - Item { - width: parent.width; - height: checkoutDir.height; - QtControls.TextField { - id: checkoutDir; - anchors { - left: parent.left; - right: checkoutBrowse.left; - } - placeholderText: "Local clone location"; + } + + QtControls.TextField { + id: newCheckoutServer; + opacity: newCheckoutSelector.checked ? 1 : 0; + Behavior on opacity { NumberAnimation { duration: Kirigami.Units.shortDuration; } } + visible: opacity > 0 + Kirigami.FormData.label: "Clone URL (https or git)"; + } + + QtControls.Button { + onClicked: { dlgLoader.item.close(); userCredentials.open(); } + text: "Set User Credentials"; + Kirigami.FormData.label: "User Credentials" + } + + QtControls.Label { + id: errorLabel; + visible: text !== "" + color: "red"; + } + QtControls.Button { + id: cloneAdd; + text: "Add Now"; + onClicked: { + if(checkoutName.text.length < 1) { + errorLabel.text = "You need to enter a name for the account." + return; + } + if(checkoutDir.text.length < 1) { + errorLabel.text = "You must select a location." + return; } - QtControls.Button { - id: checkoutBrowse; - anchors { - top: checkoutDir.top; - right: parent.right; - bottom: checkoutDir.bottom; + if(base.userForRemote.length < 1 || base.privateKeyFile.length < 1 || base.publicKeyFile.length < 1) { + errorLabel.text = "You need to enter your credentials."; + return; + } + var createAccount = true; + if(newCheckoutSelector.checked) { + if(newCheckoutServer.text.length < 1) { + errorLabel.text = "You have to enter a remote server location for the clone."; + return; } - text: "Browse..."; - onClicked: { - var newDir = GitCheckoutCreator.getDir(); - if(newDir !== "") { - checkoutDir.text = newDir; - } + var repoDir = GitCheckoutCreator.createClone(checkoutName.text, newCheckoutServer.text, checkoutDir.text, accountComp.createObject(cloudAccounts)); + if(repoDir.length > 0) { + checkoutDir.text = repoDir; } - } - } - QtControls.TextField { - id: newCheckoutServer; - width: parent.width; - height: newCheckoutSelector.checked ? Constants.GridHeight : 0; - Behavior on height { NumberAnimation { duration: Kirigami.Units.shortDuration; easing.type: Easing.InOutQuad; } } - opacity: height === 0 ? 0 : 1; - Behavior on opacity { NumberAnimation { duration: Kirigami.Units.shortDuration; } } - placeholderText: "Clone URL (https or git)"; - } - QtControls.Button { - anchors.right: parent.right; - onClicked: dlgStack.push(userCredentials); - text: "Set User Credentials"; - } - QtControls.Label { - id: errorLabel; - width: parent.width; - height: cloneAdd.height + Settings.theme.adjustedPixel(16); - verticalAlignment: Text.AlignVCenter - color: "red"; - QtControls.Button { - id: cloneAdd; - anchors { - verticalCenter: parent.verticalCenter; - right: parent.right; + else { + createAccount = false; } - text: "Add Now"; - onClicked: { - if(checkoutName.text.length < 1) { - errorLabel.text = "You need to enter a name for the account." - return; - } - if(checkoutDir.text.length < 1) { - errorLabel.text = "You must select a location." - return; - } - if(base.userForRemote.length < 1 || base.privateKeyFile.length < 1 || base.publicKeyFile.length < 1) { - errorLabel.text = "You need to enter your credentials."; - return; - } - var createAccount = true; - if(newCheckoutSelector.checked) { - if(newCheckoutServer.text.length < 1) { - errorLabel.text = "You have to enter a remote server location for the clone."; - return; - } - var repoDir = GitCheckoutCreator.createClone(checkoutName.text, newCheckoutServer.text, checkoutDir.text, accountComp.createObject(cloudAccounts)); - if(repoDir.length > 0) { - checkoutDir.text = repoDir; - } - else { - createAccount = false; - } - } - else { - if(!GitCheckoutCreator.isGitDir(checkoutDir.text)) { - errorLabel.text = "You must select a location which is actually a git repository." - return; - } - } - if(createAccount) { - cloudAccounts.addAccount(checkoutName.text, "Git", "accountsPageGit", accountComp.createObject(cloudAccounts)); - dlgStack.replace(addEmpty); - } + } + else { + if(!GitCheckoutCreator.isGitDir(checkoutDir.text)) { + errorLabel.text = "You must select a location which is actually a git repository." + return; } } + if(createAccount) { + cloudAccounts.addAccount(checkoutName.text, "Git", "accountsPageGit", accountComp.createObject(cloudAccounts)); + dlgLoader.item.close(); + } } } - Component { + + Kirigami.OverlaySheet { id: userCredentials; + header: Kirigami.Heading { text: "User Credentials" } GetUserCredentials { onAccepted: { base.userForRemote = userForRemote; base.privateKeyFile = privateKeyFile; base.publicKeyFile = publicKeyFile; base.needsPrivateKeyPassphrase = needsPrivateKeyPassphrase; - dlgStack.pop(); + userCredentials.close(); } - onCancelled: { - dlgStack.pop(); + } + onSheetOpenChanged: { + if (sheetOpen === false) { + dlgLoader.item.open(); } } } } diff --git a/gemini/qml/welcomepages/cloud/git/GetUserCredentials.qml b/gemini/qml/welcomepages/cloud/git/GetUserCredentials.qml index cfe076e63fe..f097ad198e1 100644 --- a/gemini/qml/welcomepages/cloud/git/GetUserCredentials.qml +++ b/gemini/qml/welcomepages/cloud/git/GetUserCredentials.qml @@ -1,176 +1,93 @@ /* This file is part of the KDE project * Copyright (C) 2014 Dan Leinir Turthra Jensen * * This program 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 2 of the License, or * (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import QtQuick 2.0 +import QtQuick 2.11 +import QtQuick.Layouts 1.11 as QtLayouts +import QtQuick.Controls 2.11 as QtControls +import org.kde.kirigami 2.7 as Kirigami import org.calligra 1.0 import Calligra.Gemini.Git 1.0 -import QtQuick.Controls 1.4 as QtControls import "../../../components" -Item { +Kirigami.FormLayout { id: base; signal accepted(); signal cancelled(); property alias userForRemote: userName.text; property alias privateKeyFile: privateKey.text; property alias needsPrivateKeyPassphrase: needsPassphrase.checked; property alias publicKeyFile: publicKey.text; - anchors.margins: Settings.theme.adjustedPixel(32); - Rectangle { - anchors { - fill: parent; - margins: -Settings.theme.adjustedPixel(48); - } - opacity: 0.7; - color: "white"; - MouseArea { anchors.fill: parent; onClicked: { /*nothing */ } } - SimpleTouchArea { anchors.fill: parent; onTouched: { /*nothing */ } } + + QtControls.TextField { + id: userName; + Kirigami.FormData.label: "Username"; } - Text { - id: pageTitle; - anchors { - left: parent.left; - right: parent.right - bottom: pageContent.top; - bottomMargin: Settings.theme.adjustedPixel(8); - } - height: font.pixelHeight + Settings.theme.adjustedPixel(16); - font: Settings.theme.font("pageHeader"); - verticalAlignment: Text.AlignVCenter; - horizontalAlignment: Text.AlignHCenter; - text: "User Credentials"; - Rectangle { + + QtControls.TextField { + id: privateKey; + Kirigami.FormData.label: "Private Key File"; + QtControls.Button { + id: privateKeyBrowse; anchors { - left: parent.left; + verticalCenter: privateKey.verticalCenter; right: parent.right; - bottom: parent.bottom; } - height: 1; - color: "black"; - opacity: 0.1; + text: "Browse..."; + onClicked: { + var newFile = GitCheckoutCreator.getFile("Private Key File", "*", ".ssh"); + if(newFile !== "") { + privateKey.text = newFile; + } + } } } - Item { - id: pageContent; - anchors { - left: parent.left; - right: parent.right; - verticalCenter: parent.verticalCenter; - } - height: contentColumn.height; - Column { - id: contentColumn; + + QtControls.TextField { + id: publicKey; + Kirigami.FormData.label: "Public Key File"; + QtControls.Button { + id: publicKeyBrowse; anchors { - verticalCenter: parent.verticalCenter; - left: parent.left; + verticalCenter: publicKey.verticalCenter; right: parent.right; } - height: childrenRect.height; - QtControls.TextField { - id: userName; - width: parent.width; - placeholderText: "Username"; - } - Item { - height: privateKey.height; - width: parent.width; - QtControls.TextField { - id: privateKey; - width: parent.width - privateKeyBrowse.width; - anchors.right: privateKeyBrowse.left; - placeholderText: "Private Key File"; - } - QtControls.Button { - id: privateKeyBrowse; - anchors { - verticalCenter: privateKey.verticalCenter; - right: parent.right; - } - text: "Browse..."; - onClicked: { - var newFile = GitCheckoutCreator.getFile("Private Key File", "*", ".ssh"); - if(newFile !== "") { - privateKey.text = newFile; - } - } - } - } - Item { - height: publicKey.height; - width: parent.width; - QtControls.TextField { - id: publicKey; - width: parent.width - privateKeyBrowse.width; - anchors.right: publicKeyBrowse.left; - placeholderText: "Public Key File"; - } - QtControls.Button { - id: publicKeyBrowse; - anchors { - verticalCenter: publicKey.verticalCenter; - right: parent.right; - } - text: "Browse..."; - onClicked: { - var newFile = GitCheckoutCreator.getFile("Public Key File", "*.pub", ".ssh"); - if(newFile !== "") { - publicKey.text = newFile; - } - } + text: "Browse..."; + onClicked: { + var newFile = GitCheckoutCreator.getFile("Public Key File", "*.pub", ".ssh"); + if(newFile !== "") { + publicKey.text = newFile; } } - CheckBox { - id: needsPassphrase; - width: parent.width; - text: "Does the private key require a password to unlock it?"; - } - } - Rectangle { - anchors { - left: parent.left; - right: parent.right; - bottom: parent.bottom; - } - height: 1; - color: "black"; - opacity: 0.1; } } + QtControls.CheckBox { + id: needsPassphrase; + Kirigami.FormData.label: "Does the private key require a password to unlock it?"; + } + + Kirigami.Separator { + } + QtControls.Button { id: acceptButton; - anchors { - top: pageContent.bottom; - right: cancelButton.left; - margins: Settings.theme.adjustedPixel(8); - } text: "Accept"; onClicked: base.accepted(); } - QtControls.Button { - id: cancelButton; - anchors { - top: pageContent.bottom; - right: parent.right; - margins: Settings.theme.adjustedPixel(8); - } - text: "Cancel"; - onClicked: base.cancelled(); - } } diff --git a/gemini/qml/welcomepages/cloud/git/createCheckoutContainer.qml b/gemini/qml/welcomepages/cloud/git/createCheckoutContainer.qml index 8d95db5d33a..860cfdecc08 100644 --- a/gemini/qml/welcomepages/cloud/git/createCheckoutContainer.qml +++ b/gemini/qml/welcomepages/cloud/git/createCheckoutContainer.qml @@ -1,25 +1,24 @@ /* This file is part of the KDE project * Copyright (C) 2014 Dan Leinir Turthra Jensen * * This program 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 2 of the License, or * (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import QtQuick 2.0 import org.calligra 1.0 import "../../../components" CreateCheckout { - anchors.fill: parent; } diff --git a/gemini/qml/welcomepages/cloud/git/userCredentialsContainer.qml b/gemini/qml/welcomepages/cloud/git/userCredentialsContainer.qml deleted file mode 100644 index 4f6e29055d8..00000000000 --- a/gemini/qml/welcomepages/cloud/git/userCredentialsContainer.qml +++ /dev/null @@ -1,35 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2014 Dan Leinir Turthra Jensen - * - * This program 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 2 of the License, or - * (at your option) any later version. - * - * This program 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 this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -import QtQuick 2.0 -import org.calligra 1.0 -import "../../../components" - -GetUserCredentials { - onAccepted: { - base.accountDetails.writeProperty("userForRemote", userForRemote); - base.accountDetails.writeProperty("privateKeyFile", privateKeyFile); - base.accountDetails.writeProperty("publicKeyFile", publicKeyFile); - base.accountDetails.writeProperty("needsPrivateKeyPassphrase", needsPrivateKeyPassphrase); - cloudAccounts.setAccountDetails(base.accountIndex, base.accountDetails); - dlgStack.pop(); - } - onCancelled: { - dlgStack.pop(); - } -}