Skip to content

Commit

Permalink
Allow to search by download directory (#733)
Browse files Browse the repository at this point in the history
  • Loading branch information
6c65726f79 committed Feb 13, 2022
1 parent 5de2019 commit 441134d
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/services/TransmissionRPC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,8 @@ class TRPC {
'sizeWhenDone',
'eta',
'recheckProgress',
'queuePosition'
'queuePosition',
'downloadDir'
]
}
if(refresh) {
Expand Down
4 changes: 3 additions & 1 deletion src/services/UserSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ const defaultSettings: Record<string,any> = {
useBits:true,
expandMenu:true,
ipFlags:false,
openMagnetLinks:false
openMagnetLinks:false,
searchByName:true,
searchByDirectory:true
}

export const UserSettings = {
Expand Down
11 changes: 9 additions & 2 deletions src/views/List.vue
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,16 @@ export default defineComponent({
// Filter list by search value
if(this.privateState.search!=""){
const search=this.privateState.search.toLowerCase();
const search=this.privateState.search.toLowerCase().replace('.',' ');
list = _.filter(list, function(o) {
return o.name.toLowerCase().indexOf(search) >= 0;
let include=false;
if(UserSettings.state.searchByName){
include=o.name.toLowerCase().replace('.',' ').indexOf(search) >= 0;
}
if(UserSettings.state.searchByDirectory && !include){
include=o.downloadDir.toLowerCase().indexOf(search) >= 0;
}
return include;
});
}
Expand Down
24 changes: 22 additions & 2 deletions src/views/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,24 @@
</ion-item>
</ion-list>

<ion-list>
<ion-list-header>
<ion-label>
{{ Locale.searchBy }}
</ion-label>
</ion-list-header>

<ion-item>
<ion-label>{{ Locale.name }}</ion-label>
<ion-checkbox slot="start" v-model.boolean="sharedState.searchByName"></ion-checkbox>
</ion-item>

<ion-item>
<ion-label>{{ Locale.downloadDir }}</ion-label>
<ion-checkbox slot="start" v-model.boolean="sharedState.searchByDirectory"></ion-checkbox>
</ion-item>
</ion-list>

<ion-list>
<ion-list-header>
<ion-label>
Expand Down Expand Up @@ -164,7 +182,8 @@ import {
IonInput,
IonBackButton,
IonToggle,
isPlatform
isPlatform,
IonCheckbox
} from '@ionic/vue';
import {
saveOutline,
Expand Down Expand Up @@ -235,7 +254,8 @@ export default defineComponent({
IonPage,
IonInput,
IonBackButton,
IonToggle
IonToggle,
IonCheckbox
},
computed: {
bookmarkletEnabled(): boolean {
Expand Down

0 comments on commit 441134d

Please sign in to comment.