Skip to content

Commit

Permalink
feat: adds setting for files and folders drag & drop
Browse files Browse the repository at this point in the history
Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
  • Loading branch information
pedrolamas committed Nov 10, 2024
1 parent 6cd1300 commit 7e29513
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/components/settings/FileBrowserSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,19 @@
:items="availableTextSortOrders"
/>
</app-setting>

<v-divider />

<app-setting
:title="$t('app.setting.label.drag_and_drop_functionality_for_files_and_folders')"
>
<v-switch
v-model="filesAndFoldersDragAndDrop"
hide-details
class="mb-5"
@click.native.stop
/>
</app-setting>
</v-card>
</div>
</template>
Expand Down Expand Up @@ -55,5 +68,17 @@ export default class FileEditorSettings extends Vue {
}
]
}
get filesAndFoldersDragAndDrop (): boolean {
return this.$store.state.config.uiSettings.general.filesAndFoldersDragAndDrop
}
set filesAndFoldersDragAndDrop (value: boolean) {
this.$store.dispatch('config/saveByPath', {
path: 'uiSettings.general.filesAndFoldersDragAndDrop',
value,
server: true
})
}
}
</script>
5 changes: 5 additions & 0 deletions src/components/widgets/filesystem/FileSystemBrowser.vue
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,10 @@ export default class FileSystemBrowser extends Mixins(FilesMixin) {
return this.$store.state.config.uiSettings.general.textSortOrder
}
get filesAndFoldersDragAndDrop (): boolean {
return this.$store.state.config.uiSettings.general.filesAndFoldersDragAndDrop
}
get draggedItems () {
if (this.dragItem) {
const filteredSelectedItems = this.selected
Expand Down Expand Up @@ -430,6 +434,7 @@ export default class FileSystemBrowser extends Mixins(FilesMixin) {
// Determines if a row is currently in a draggable state or not.
isItemDraggable (item: FileBrowserEntry) {
return (
this.filesAndFoldersDragAndDrop &&
item.name !== '..' &&
this.files.length > 0 &&
(
Expand Down
1 change: 1 addition & 0 deletions src/locales/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,7 @@ app:
date_format: Date format
time_format: Time format
text_sort_order: Text sort order
drag_and_drop_functionality_for_files_and_folders: Drag-and-drop functionality for files and folders
force_move_toggle_warning: Require confirm when activating FORCE_MOVE
show_manual_probe_dialog_automatically: Show Manual Probe dialog automatically
show_bed_screws_adjust_dialog_automatically: Show Bed Screws Adjust dialog automatically
Expand Down
1 change: 1 addition & 0 deletions src/store/config/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export const defaultState = (): ConfigState => {
timeFormat: 'iso',
enableKeyboardShortcuts: true,
textSortOrder: 'default',
filesAndFoldersDragAndDrop: true,
showRateOfChange: false,
showRelativeHumidity: true,
showBarometricPressure: true,
Expand Down
1 change: 1 addition & 0 deletions src/store/config/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export interface GeneralConfig {
timeFormat: string;
enableKeyboardShortcuts: boolean;
textSortOrder: TextSortOrder;
filesAndFoldersDragAndDrop: boolean;
showRateOfChange: boolean;
showRelativeHumidity: boolean;
showBarometricPressure: boolean;
Expand Down

0 comments on commit 7e29513

Please sign in to comment.