@@ -68,6 +68,7 @@ Kirigami.FormLayout {
6868 property bool showVideosList: false
6969 property var isLockScreenSettings: null
7070 property alias cfg_MuteMode: muteModeCombo .currentValue
71+ property int editingIndex: - 1
7172
7273 Components .Header {
7374 Layout .leftMargin : Kirigami .Units .mediumSpacing
@@ -116,6 +117,7 @@ Kirigami.FormLayout {
116117 icon .name : " folder-videos-symbolic"
117118 text: i18n (" Add new videos" )
118119 onClicked: {
120+ root .editingIndex = - 1 ;
119121 fileDialog .open ();
120122 }
121123 }
@@ -158,6 +160,16 @@ Kirigami.FormLayout {
158160 Utils .updateConfig ();
159161 }
160162 }
163+ Button {
164+ icon .name : " document-open"
165+ ToolTip .delay : 1000
166+ ToolTip .visible : hovered
167+ ToolTip .text : " Pick a file"
168+ onClicked: {
169+ editingIndex = index;
170+ fileDialog .open ();
171+ }
172+ }
161173 RowLayout {
162174 enabled: vidEnabled .checked
163175 // SpinBox {
@@ -738,18 +750,23 @@ Kirigami.FormLayout {
738750
739751 FileDialog {
740752 id: fileDialog
741- fileMode: FileDialog .OpenFiles
753+ fileMode: root . editingIndex === - 1 ? FileDialog .OpenFiles : FileDialog . OpenFile
742754 title: i18n (" Pick a video file" )
743755 nameFilters: [i18n (" Video files" ) + " (*.mp4 *.mpg *.ogg *.mov *.webm *.flv *.matroska *.avi *wmv *.gif)" , i18n (" All files" ) + " (*)" ]
744756 onAccepted: {
745- let currentFiles = cfg_VideoUrls .trim ().split (" \n " );
757+ let currentFiles = root . cfg_VideoUrls .trim ().split (" \n " );
746758 for (let file of fileDialog .selectedFiles ) {
747759 console .log (file);
748- if (videosConfig .filter (video => video .filename === file).length === 0 ) {
749- videosConfig .push (new Utils.createVideo (file));
760+ if (root .videosConfig .filter (video => video .filename === file).length === 0 ) {
761+ if (root .editingIndex !== - 1 ) {
762+ root .videosConfig [root .editingIndex ] = Utils .createVideo (file);
763+ root .editingIndex = - 1 ;
764+ } else {
765+ root .videosConfig .push (Utils .createVideo (file));
766+ }
750767 }
751768 }
752- console .log (JSON .stringify (videosConfig));
769+ console .log (JSON .stringify (root . videosConfig ));
753770 Utils .updateConfig ();
754771 }
755772 }
0 commit comments