Warning, /maui/mauikit-accounts/src/controls.5/AccountsMenuItem.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 
0021 import QtQuick 2.14
0022 
0023 import QtQuick.Controls 2.14
0024 import QtQuick.Layouts 1.3
0025 
0026 import org.mauikit.controls 1.3 as Maui
0027 import org.mauikit.accounts 1.0 as MA
0028 
0029 MenuItem
0030 {
0031     //implicitHeight: _accountLayout.implicitHeight + Maui.Style.space.medium
0032     //width: ListView.view.width
0033 
0034     MA.AccountsDialog
0035     {
0036         id: _accountsDialog
0037     }
0038 
0039     // background: null
0040 
0041     contentItem: ColumnLayout
0042     {
0043         id: _accountLayout
0044 
0045         spacing: Maui.Style.defaultSpacing
0046 
0047         Repeater
0048         {
0049             id: _accountsListing
0050 
0051             model: Maui.BaseModel
0052             {
0053                 list: MA.Accounts
0054             }
0055 
0056             delegate: MenuItem
0057             {
0058                 Layout.fillWidth: true
0059 
0060                 checked: MA.Accounts.currentAccountIndex === index
0061                 icon.name: "amarok_artist"
0062                 text: model.user
0063 
0064                 onClicked: MA.Accounts.currentAccountIndex = index
0065             }
0066 
0067             Component.onCompleted:
0068             {
0069                 if(_accountsListing.count > 0)
0070                     MA.Accounts.currentAccountIndex = 0
0071             }
0072         }
0073 
0074         Button
0075         {
0076             Layout.alignment: Qt.AlignCenter
0077             Layout.fillWidth: true
0078             text: i18nd("mauikitaccounts","Accounts")
0079             icon.name: "list-add-user"
0080             onClicked:
0081             {
0082                 _accountsDialog.open()
0083             }
0084         }
0085     }
0086 }
0087 
0088