Warning, /maui/mauikit-accounts/src/controls.6/CredentialsDialog.qml is written in an unsupported language. File is not indexed.

0001 /*
0002  *   Copyright 2018 Camilo Higuita <milo.h@aol.com>
0003  *
0004  *   This program is free software; you can redistribute it and/or modify
0005  *   it under the terms of the GNU Library General Public License as
0006  *   published by the Free Software Foundation; either version 2, or
0007  *   (at your option) any later version.
0008  *
0009  *   This program is distributed in the hope that it will be useful,
0010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
0011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0012  *   GNU General Public License for more details
0013  *
0014  *   You should have received a copy of the GNU Library General Public
0015  *   License along with this program; if not, write to the
0016  *   Free Software Foundation, Inc.,
0017  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
0018  */
0019 
0020 import QtQuick 
0021 import QtQuick.Controls
0022 import QtQuick.Layouts 
0023 import org.mauikit.controls 1.3 as Maui
0024 
0025 /**
0026  * @inherit org::mauikit::control::PopupPage
0027  * @brief A dialog for enetering the credentials for an online account. 
0028  * 
0029  * @image html credentialsdialog.png "Accounts dialog"
0030  * 
0031  * @code
0032  * 
0033  * @endcode
0034  */
0035 Maui.PopupPage
0036 {
0037     id: control
0038     
0039     maxWidth: 350
0040     
0041     title: i18nd("mauikitaccounts","New Account")
0042     
0043     /**
0044      * @brief customServer : bool
0045      */
0046     property bool customServer: false
0047     
0048     /**
0049      * @brief  serverField : TextField
0050      */
0051     readonly property alias serverField: _serverField
0052     
0053     /**
0054      * userField : TextField
0055      */
0056     readonly property alias userField: _userField
0057     
0058     /**
0059      * passwordField : TextField
0060      */
0061     readonly property alias passwordField: _passwordField
0062     
0063     signal accepted()
0064     
0065     actions: [
0066         Action
0067         {
0068             text: i18nd("mauikitaccounts","Sign up")
0069             enabled: !customServer
0070             onTriggered: Qt.openUrlExternally("https://www.opendesktop.org/register")
0071         },
0072         
0073         Action
0074         {
0075             text: i18nd("mauikitaccounts","Sign in")
0076             onTriggered: control.accepted()
0077         }
0078     ]
0079     
0080     Loader
0081     {
0082         asynchronous: true
0083         active: !customServer
0084         
0085         Layout.alignment: Qt.AlignCenter
0086         Layout.preferredWidth:  Maui.Style.iconSizes.huge
0087         Layout.preferredHeight: Maui.Style.iconSizes.huge
0088         Layout.margins: Maui.Style.space.medium
0089         
0090         sourceComponent:  Image
0091         {
0092             sourceSize.width: width
0093             sourceSize.height: height
0094             
0095             source: "qrc:/assets/opendesktop.png"
0096         }
0097     }
0098     
0099     Label
0100     {
0101         visible: !customServer
0102         Layout.fillWidth: true
0103         horizontalAlignment: Qt.AlignHCenter
0104         Layout.preferredHeight: Maui.Style.rowHeight
0105         text: "opendesktop.org"
0106         elide: Text.ElideNone
0107         wrapMode: Text.NoWrap
0108         font.weight: Font.Bold
0109         font.bold: true
0110         font.pointSize: Maui.Style.fontSizes.big
0111     }
0112     
0113     TextField
0114     {
0115         id: _userField
0116         Layout.fillWidth: true
0117         placeholderText: i18nd("mauikitaccounts","Username")
0118         icon.source: "im-user"
0119         inputMethodHints: Qt.ImhNoAutoUppercase | Qt.ImhSensitiveData
0120     }
0121     
0122     Maui.PasswordField
0123     {
0124         id: _passwordField
0125         Layout.fillWidth: true
0126         placeholderText: i18nd("mauikitaccounts","Password")
0127     }
0128     
0129     TextField
0130     {
0131         id: _serverField
0132         visible: customServer
0133         icon.source: "link"
0134         Layout.fillWidth: true
0135         placeholderText: i18nd("mauikitaccounts","Server address")
0136         inputMethodHints: Qt.ImhUrlCharactersOnly | Qt.ImhNoAutoUppercase
0137         text: customServer ? "" : "https://cloud.opendesktop.cc/cloud/remote.php/webdav/"
0138     }
0139     
0140     Button
0141     {
0142         Layout.fillWidth: true
0143         icon.name: "filename-space-amarok"
0144         text: customServer ? i18nd("mauikitaccounts","opendesktop") : i18nd("mauikitaccounts","Custom server")
0145         onClicked: customServer = !customServer
0146     }
0147 }