making newItem and deleteItem functions work
This commit is contained in:
parent
5cc531f046
commit
3dbecf2301
2 changed files with 25 additions and 17 deletions
|
@ -37,16 +37,18 @@ Item {
|
||||||
headerLabel: "Songs"
|
headerLabel: "Songs"
|
||||||
itemIcon: "folder-music-symbolic"
|
itemIcon: "folder-music-symbolic"
|
||||||
itemSubtitle: "hi"
|
itemSubtitle: "hi"
|
||||||
newItemFuntion: (function() {
|
newItemFunction: (function() {
|
||||||
songProxyModel.setFilterRegularExpression("");
|
songProxyModel.setFilterRegularExpression("");
|
||||||
songProxyModel.songModel.newSong();
|
songProxyModel.songModel.newSong();
|
||||||
songLibraryList.currentIndex = songProxyModel.songModel.rowCount() - 1;
|
libraryList.currentIndex = songProxyModel.songModel.rowCount() - 1;
|
||||||
if (!editMode)
|
if (!editMode)
|
||||||
editMode = true;
|
editMode = true;
|
||||||
editType = "song";
|
editType = "song";
|
||||||
editSwitch(songLibraryList.currentIndex);
|
editSwitch(libraryList.currentIndex);
|
||||||
|
})
|
||||||
|
deleteItemFunction: (function(index) {
|
||||||
|
songProxyModel.deleteSong(index)
|
||||||
})
|
})
|
||||||
deleteItemFuntion: songProxyModel.deleteSong(index)
|
|
||||||
|
|
||||||
Component.onCompleted: selectedLibrary = "song";
|
Component.onCompleted: selectedLibrary = "song";
|
||||||
}
|
}
|
||||||
|
@ -67,10 +69,10 @@ Item {
|
||||||
else
|
else
|
||||||
"file is missing"
|
"file is missing"
|
||||||
}
|
}
|
||||||
newItemFuntion: (function() {
|
newItemFunction: (function() {
|
||||||
videoProxyModel.setFilterRegularExpression("");
|
videoProxyModel.setFilterRegularExpression("");
|
||||||
})
|
})
|
||||||
deleteItemFuntion: videoProxyModel.deleteVideo(index)
|
deleteItemFunction: videoProxyModel.deleteVideo(index)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,10 +92,10 @@ Item {
|
||||||
else
|
else
|
||||||
"file is missing"
|
"file is missing"
|
||||||
}
|
}
|
||||||
newItemFuntion: (function() {
|
newItemFunction: (function() {
|
||||||
imageProxyModel.setFilterRegularExpression("");
|
imageProxyModel.setFilterRegularExpression("");
|
||||||
})
|
})
|
||||||
deleteItemFuntion: imageProxyModel.deleteImage(index)
|
deleteItemFunction: imageProxyModel.deleteImage(index)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,10 +115,10 @@ Item {
|
||||||
else
|
else
|
||||||
"file is missing"
|
"file is missing"
|
||||||
}
|
}
|
||||||
newItemFuntion: (function() {
|
newItemFunction: (function() {
|
||||||
presProxyModel.setFilterRegularExpression("");
|
presProxyModel.setFilterRegularExpression("");
|
||||||
})
|
})
|
||||||
deleteItemFuntion: presProxyModel.deletePresentation(index)
|
deleteItemFunction: presProxyModel.deletePresentation(index)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,8 +17,9 @@ ColumnLayout {
|
||||||
property string itemLabel
|
property string itemLabel
|
||||||
property string itemSubtitle
|
property string itemSubtitle
|
||||||
property string itemIcon
|
property string itemIcon
|
||||||
property var newItemFuntion
|
property var newItemFunction
|
||||||
property var deleteItemFuntion
|
property var deleteItemFunction
|
||||||
|
property ListView libraryList: libraryList
|
||||||
|
|
||||||
states: [
|
states: [
|
||||||
State {
|
State {
|
||||||
|
@ -138,7 +139,7 @@ ColumnLayout {
|
||||||
icon.name: "document-new"
|
icon.name: "document-new"
|
||||||
text: "New " + libraryType
|
text: "New " + libraryType
|
||||||
tooltip: "Add a new " + libraryType
|
tooltip: "Add a new " + libraryType
|
||||||
onTriggered: newItemFuntion
|
onTriggered: newItemFunction()
|
||||||
},
|
},
|
||||||
|
|
||||||
Kirigami.Action {
|
Kirigami.Action {
|
||||||
|
@ -216,7 +217,12 @@ ColumnLayout {
|
||||||
|
|
||||||
property bool rightMenu: false
|
property bool rightMenu: false
|
||||||
property bool selected: selectionModel.isSelected(proxyModel.idx(index))
|
property bool selected: selectionModel.isSelected(proxyModel.idx(index))
|
||||||
property bool fileValidation: fileHelper.validate(filePath)
|
property bool fileValidation: {
|
||||||
|
if (filePath)
|
||||||
|
fileHelper.validate(filePath)
|
||||||
|
else
|
||||||
|
false
|
||||||
|
}
|
||||||
|
|
||||||
implicitWidth: libraryList.width
|
implicitWidth: libraryList.width
|
||||||
height: selectedLibrary == libraryType ? 50 : 0
|
height: selectedLibrary == libraryType ? 50 : 0
|
||||||
|
@ -318,7 +324,7 @@ ColumnLayout {
|
||||||
libraryList.selectSongs(index);
|
libraryList.selectSongs(index);
|
||||||
} else {
|
} else {
|
||||||
selectionModel.select(proxyModel.idx(index),
|
selectionModel.select(proxyModel.idx(index),
|
||||||
ItemselectionModel.ClearAndSelect);
|
ItemSelectionModel.ClearAndSelect);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -327,7 +333,7 @@ ColumnLayout {
|
||||||
if (!editMode)
|
if (!editMode)
|
||||||
editMode = true;
|
editMode = true;
|
||||||
editType = libraryType;
|
editType = libraryType;
|
||||||
editSwitch(id);
|
editSwitch(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -338,7 +344,7 @@ ColumnLayout {
|
||||||
y: clickHandler.mouseY + 10
|
y: clickHandler.mouseY + 10
|
||||||
Kirigami.Action {
|
Kirigami.Action {
|
||||||
text: "delete"
|
text: "delete"
|
||||||
onTriggered: deleteItemFunction
|
onTriggered: root.deleteItemFunction(index)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue