mirror of
https://github.com/nomic-ai/gpt4all.git
synced 2025-07-01 01:31:59 +00:00
Enable the add button always, but show an error in placeholder text.
This commit is contained in:
parent
a0f80453e5
commit
1b5aa4617f
@ -63,6 +63,12 @@ Item {
|
|||||||
Accessible.role: Accessible.EditableText
|
Accessible.role: Accessible.EditableText
|
||||||
Accessible.name: collection.text
|
Accessible.name: collection.text
|
||||||
Accessible.description: ToolTip.text
|
Accessible.description: ToolTip.text
|
||||||
|
function showError() {
|
||||||
|
collection.placeholderTextColor = theme.textErrorColor
|
||||||
|
}
|
||||||
|
onTextChanged: {
|
||||||
|
collection.placeholderTextColor = theme.mutedTextColor
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MyDirectoryField {
|
MyDirectoryField {
|
||||||
@ -77,6 +83,12 @@ Item {
|
|||||||
placeholderTextColor: theme.mutedTextColor
|
placeholderTextColor: theme.mutedTextColor
|
||||||
ToolTip.text: qsTr("Folder path to documents (Required)")
|
ToolTip.text: qsTr("Folder path to documents (Required)")
|
||||||
ToolTip.visible: hovered
|
ToolTip.visible: hovered
|
||||||
|
function showError() {
|
||||||
|
folderEdit.placeholderTextColor = theme.textErrorColor
|
||||||
|
}
|
||||||
|
onTextChanged: {
|
||||||
|
folderEdit.placeholderTextColor = theme.mutedTextColor
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MyButton {
|
MyButton {
|
||||||
@ -95,11 +107,21 @@ Item {
|
|||||||
text: qsTr("Add")
|
text: qsTr("Add")
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
enabled: root.collection !== "" && root.folder_path !== "" && folderEdit.isValid
|
|
||||||
Accessible.role: Accessible.Button
|
Accessible.role: Accessible.Button
|
||||||
Accessible.name: text
|
Accessible.name: text
|
||||||
Accessible.description: qsTr("Add button")
|
Accessible.description: qsTr("Add button")
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
var isError = false;
|
||||||
|
if (root.collection === "") {
|
||||||
|
isError = true;
|
||||||
|
collection.showError();
|
||||||
|
}
|
||||||
|
if (root.folder_path === "" || !folderEdit.isValid) {
|
||||||
|
isError = true;
|
||||||
|
folderEdit.showError();
|
||||||
|
}
|
||||||
|
if (isError)
|
||||||
|
return;
|
||||||
LocalDocs.addFolder(root.collection, root.folder_path)
|
LocalDocs.addFolder(root.collection, root.folder_path)
|
||||||
root.collection = ""
|
root.collection = ""
|
||||||
root.folder_path = ""
|
root.folder_path = ""
|
||||||
|
Loading…
Reference in New Issue
Block a user