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

0001 import QtQuick 
0002 import QtQuick.Layouts
0003 import QtQuick.Controls 
0004 
0005 import org.mauikit.controls 1.3 as Maui
0006 import org.mauikit.filebrowsing 1.3 as FB
0007 
0008 /**
0009  * @inherit org::mauikit::controls::InputDialog
0010  * @brief An input dialog to create one or multiple new tags.
0011  *
0012  * This control inherits from MauiKit InputDialog, to checkout its inherited properties refer to docs.
0013  * 
0014  * @note Multiple tags can be created at once by separating the entries by a comma.
0015  * 
0016  *@image html newtagdialog.png
0017  *
0018  * @code
0019  * Maui.Page
0020  * {
0021  *    Maui.Controls.showCSD: true
0022  *    anchors.fill: parent
0023  * 
0024  *    Button
0025  *    {
0026  *        anchors.centerIn: parent
0027  *        text: "New tag"
0028  *        onClicked: _tagDialog.open()
0029  *    }
0030  * 
0031  *    FB.NewTagDialog
0032  *    {
0033  *        id: _tagDialog
0034  *    }
0035  * }
0036  * @endcode
0037  *
0038  * <a href="https://invent.kde.org/maui/mauikit-filebrowser/examples/NewTagDialog.qml">You can find a more complete example at this link.</a>
0039  */
0040 Maui.InputDialog
0041 {
0042     id: control
0043     
0044     /**
0045      * @brief The current colors picked for the new tags.
0046      * @property color NewTagDialog::currentColor
0047      */
0048     readonly property alias currentColor : _colorsRow.currentColor
0049     
0050     /**
0051      * @brief The list of the default colors used for the Tagging system.
0052      * `["#4DD0E1", "#9575CD", "#F06292", "#DCE775", "#FFD54F", "#FF8A65", "#90A4AE"]`
0053      */
0054     readonly property var defaultColors : ["#4DD0E1", "#9575CD", "#F06292", "#DCE775", "#FFD54F", "#FF8A65", "#90A4AE"]
0055     
0056     title: i18nd("mauikitfilebrowsing", "New tags")
0057     message: i18nd("mauikitfilebrowsing", "Create new tags to organize your files. You can create multiple tags separated by a comma.")
0058     
0059     textEntry.placeholderText: i18n("New tags")    
0060     
0061     Maui.ColorsRow
0062     {
0063         id: _colorsRow
0064         Layout.fillWidth: true
0065         
0066         colors: control.defaultColors
0067         onColorPicked: currentColor = color
0068     }
0069     
0070     Flow
0071     {
0072         Layout.fillWidth: true
0073         
0074         visible: control.textEntry.text.length
0075         spacing: Maui.Style.defaultSpacing    
0076         
0077         Repeater
0078         {
0079             model: textEntry.text.split(",")
0080             
0081             delegate: Maui.Chip
0082             {
0083                 label.text: modelData
0084                 showCloseButton: false
0085                 color: control.currentColor
0086                 iconSource: "tag"
0087             }
0088         }       
0089     }
0090     
0091     onFinished: (text) =>
0092     {
0093         for(var tag of text.split(","))
0094         {
0095             FB.Tagging.tag(tag, control.currentColor, "")
0096         }    
0097     }
0098     
0099     onClosed:
0100     {
0101         control.currentColor = ""
0102     }
0103 }