Warning, /maui/mauikit-filebrowsing/src/controls.5/OpenWithDialog.qml is written in an unsupported language. File is not indexed.

0001 /*
0002  * <one line to give the program's name and a brief idea of what it does.>
0003  * Copyright (C) 2020  camilo <chiguitar@unal.edu.co>
0004  *
0005  * This program is free software: you can redistribute it and/or modify
0006  * it under the terms of the GNU General Public License as published by
0007  * the Free Software Foundation, either version 3 of the License, or
0008  * (at your option) any later version.
0009  *
0010  * This program is distributed in the hope that it will be useful,
0011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0013  * GNU General Public License for more details.
0014  *
0015  * You should have received a copy of the GNU General Public License
0016  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
0017  */
0018 
0019 import QtQuick 2.14
0020 import QtQuick.Layouts 1.3
0021 
0022 import org.mauikit.controls 1.2 as Maui
0023 import org.mauikit.filebrowsing 1.3 as FB
0024 
0025 
0026 /**
0027  * OpenWithDialog
0028  * A dialog with a list of services associated to the list of URLs.
0029  *
0030  * The services listed can open the file type of the file URLs.
0031  *
0032  *
0033  *
0034  *
0035  */
0036 Maui.PopupPage
0037 {
0038     id: control
0039 
0040     /**
0041       * urls : var
0042       * List of file URLs to look for associated services.
0043       */
0044     property alias urls : _openWithList.urls
0045 
0046     widthHint: 0.9
0047     page.padding: 0
0048     maxHeight: Math.min(_list.contentHeight + (page.padding * 2.5) + headBar.height + Maui.Style.space.huge, 500)
0049     maxWidth: 350
0050     persistent: false
0051 
0052     page.title: i18nd("mauikitfilebrowsing", "Open with")
0053     headBar.visible: true
0054     
0055     stack: Maui.ListBrowser
0056     {
0057         id: _list
0058         Layout.fillWidth: true
0059         Layout.fillHeight: true
0060         
0061         model: Maui.BaseModel
0062         {
0063             id: _appsModel
0064             list: FB.OpenWithModel
0065             {
0066                 id: _openWithList
0067             }
0068         }
0069         
0070         delegate: Maui.ListBrowserDelegate
0071         {
0072             width: ListView.view.width
0073             //height: Maui.Style.rowHeight * 2
0074             hoverEnabled: true
0075             
0076             label1.text: model.label
0077                 label2.text: model.comment
0078                 iconSource: model.icon
0079                 iconSizeHint: Maui.Style.iconSizes.big
0080 
0081             onClicked:
0082             {
0083                 _list.currentIndex = index
0084                 triggerService(index)
0085             }
0086         }
0087     }  
0088 
0089     /**
0090       *
0091       */
0092     function triggerService(index)
0093     {
0094         _openWithList.openWith(index)
0095         close()
0096     }
0097 }