2021-05-24 04:01:26 -07:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2021 CutefishOS Team.
|
|
|
|
*
|
|
|
|
* Author: revenmartin <revenmartin@gmail.com>
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2021-03-29 01:51:34 -07:00
|
|
|
import QtQuick 2.12
|
|
|
|
import QtQuick.Controls 2.12
|
2021-03-30 19:40:38 -07:00
|
|
|
import QtQuick.Window 2.12
|
2021-03-29 01:51:34 -07:00
|
|
|
import QtQuick.Layouts 1.12
|
2021-04-09 07:49:19 -07:00
|
|
|
import FishUI 1.0 as FishUI
|
2021-03-29 01:51:34 -07:00
|
|
|
|
2021-03-30 19:40:38 -07:00
|
|
|
Window {
|
2021-03-29 01:51:34 -07:00
|
|
|
id: control
|
|
|
|
|
2021-04-04 13:06:24 -07:00
|
|
|
title: qsTr("New folder name")
|
2021-03-30 19:40:38 -07:00
|
|
|
flags: Qt.Dialog
|
|
|
|
visible: true
|
|
|
|
|
2021-04-09 07:49:19 -07:00
|
|
|
width: 400 + FishUI.Units.largeSpacing * 2
|
2021-06-13 06:50:13 -07:00
|
|
|
height: _mainLayout.implicitHeight + FishUI.Units.largeSpacing * 2
|
2021-03-30 19:40:38 -07:00
|
|
|
|
|
|
|
minimumWidth: width
|
|
|
|
minimumHeight: height
|
|
|
|
maximumWidth: width
|
|
|
|
maximumHeight: height
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
anchors.fill: parent
|
2021-07-19 01:11:42 -07:00
|
|
|
color: FishUI.Theme.secondBackgroundColor
|
2021-03-30 19:40:38 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
id: _mainLayout
|
|
|
|
anchors.fill: parent
|
2021-06-13 06:50:13 -07:00
|
|
|
anchors.margins: FishUI.Units.largeSpacing
|
2021-05-28 07:27:15 -07:00
|
|
|
spacing: FishUI.Units.largeSpacing
|
2021-03-30 19:40:38 -07:00
|
|
|
|
2021-07-10 06:39:34 -07:00
|
|
|
FishUI.ActionTextField {
|
2021-04-04 13:06:24 -07:00
|
|
|
id: _textField
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Keys.onEscapePressed: control.close()
|
|
|
|
text: qsTr("New folder")
|
|
|
|
focus: true
|
2021-03-30 19:40:38 -07:00
|
|
|
|
2021-04-16 09:17:18 -07:00
|
|
|
onAccepted: {
|
|
|
|
main.newFolder(_textField.text)
|
|
|
|
control.close()
|
|
|
|
}
|
|
|
|
|
2021-04-04 13:06:24 -07:00
|
|
|
Component.onCompleted: {
|
|
|
|
_textField.selectAll()
|
2021-03-30 19:40:38 -07:00
|
|
|
}
|
2021-07-10 06:39:34 -07:00
|
|
|
|
|
|
|
rightActions: [
|
|
|
|
Action {
|
|
|
|
icon.source: "image://icontheme/edit-clear"
|
|
|
|
onTriggered: {
|
|
|
|
_textField.text = ""
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
2021-03-30 19:40:38 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
RowLayout {
|
|
|
|
Button {
|
|
|
|
text: qsTr("Cancel")
|
|
|
|
Layout.fillWidth: true
|
|
|
|
onClicked: control.close()
|
|
|
|
}
|
|
|
|
|
|
|
|
Button {
|
|
|
|
text: qsTr("OK")
|
|
|
|
Layout.fillWidth: true
|
|
|
|
onClicked: {
|
|
|
|
main.newFolder(_textField.text)
|
|
|
|
control.close()
|
|
|
|
}
|
|
|
|
enabled: _textField.text
|
|
|
|
flat: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-03-29 01:51:34 -07:00
|
|
|
}
|