Warning, /maui/mauikit-accounts/src/controls.6/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 import QtQuick 0020 0021 import QtQuick.Controls 0022 import QtQuick.Layouts 0023 0024 import org.mauikit.controls 1.3 as Maui 0025 import org.mauikit.accounts 1.0 as MA 0026 0027 /** 0028 * @inherit QtQuick.Controls.MenuItem 0029 * @brief A MenuItem entry to list the available accounts and for launching the accounts dialog. 0030 * 0031 * @image html accountsmenuitem.png "Accounts menu entry" 0032 * 0033 * @code 0034 * Maui.Page 0035 * { 0036 * anchors.fill: parent 0037 * 0038 * Maui.Controls.showCSD: true 0039 * 0040 * headBar.leftContent: Maui.ToolButtonMenu 0041 * { 0042 * icon.name: "application-menu" 0043 * MA.AccountsMenuItem {} 0044 * 0045 * MenuSeparator {} 0046 * 0047 * MenuItem 0048 * { 0049 * text: "About" 0050 * onTriggered: root.about() 0051 * } 0052 * } 0053 * } 0054 * @endcode 0055 */ 0056 MenuItem 0057 { 0058 MA.AccountsDialog 0059 { 0060 id: _accountsDialog 0061 } 0062 0063 contentItem: ColumnLayout 0064 { 0065 id: _accountLayout 0066 0067 spacing: Maui.Style.defaultSpacing 0068 0069 Repeater 0070 { 0071 id: _accountsListing 0072 0073 model: Maui.BaseModel 0074 { 0075 list: MA.Accounts 0076 } 0077 0078 delegate: MenuItem 0079 { 0080 Layout.fillWidth: true 0081 0082 checked: MA.Accounts.currentAccountIndex === index 0083 icon.name: "amarok_artist" 0084 text: model.user 0085 0086 onClicked: MA.Accounts.currentAccountIndex = index 0087 } 0088 0089 Component.onCompleted: 0090 { 0091 if(_accountsListing.count > 0) 0092 MA.Accounts.currentAccountIndex = 0 0093 } 0094 } 0095 0096 Button 0097 { 0098 Layout.alignment: Qt.AlignCenter 0099 Layout.fillWidth: true 0100 text: i18nd("mauikitaccounts","Accounts") 0101 icon.name: "list-add-user" 0102 onClicked: 0103 { 0104 _accountsDialog.open() 0105 } 0106 } 0107 } 0108 } 0109 0110