Skip to content

Commit a4c2206

Browse files
committed
[native] enh: Allow selecting up down sync by long press on sync button
fixes #1716 Signed-off-by: Marcel Klehr <[email protected]>
1 parent 954252b commit a4c2206

File tree

1 file changed

+58
-12
lines changed

1 file changed

+58
-12
lines changed

src/ui/views/native/Tree.vue

Lines changed: 58 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,45 @@
2626
hide-details
2727
@input="onSearch" />
2828
<v-spacer />
29-
<v-btn
30-
icon
31-
:disabled="!currentAccount"
32-
:color="syncing || scheduled? 'primary' : ''"
33-
@click="onTriggerSync">
34-
<v-icon
35-
:class="{'sync--active': Boolean(syncing)}">
36-
{{ scheduled ? 'mdi-timer-sync-outline' : 'mdi-sync' }}
37-
</v-icon>
38-
</v-btn>
29+
<v-menu
30+
bottom
31+
left
32+
open-on-hover
33+
:open-delay="450"
34+
:disabled="Boolean(syncing) || !currentAccount">
35+
<template #activator="{ on, attrs }">
36+
<v-btn
37+
icon
38+
:disabled="!currentAccount"
39+
:color="syncing || scheduled? 'primary' : ''"
40+
v-bind="attrs"
41+
v-on="on"
42+
@click="onTriggerSync" :class="{'sync-dropdown-hint': !Boolean(syncing)}">
43+
<v-icon
44+
:class="{'sync--active': Boolean(syncing)}">
45+
{{ scheduled ? 'mdi-timer-sync-outline' : 'mdi-sync' }}
46+
</v-icon>
47+
</v-btn>
48+
</template>
49+
<v-list>
50+
<v-list-item @click="onTriggerSync('up')">
51+
<v-list-item-avatar>
52+
<v-icon>mdi-arrow-up-bold</v-icon>
53+
</v-list-item-avatar>
54+
<v-list-item-title>
55+
{{ t('LabelSyncUpOnce') }}
56+
</v-list-item-title>
57+
</v-list-item>
58+
<v-list-item @click="onTriggerSync('down')">
59+
<v-list-item-avatar>
60+
<v-icon>mdi-arrow-down-bold</v-icon>
61+
</v-list-item-avatar>
62+
<v-list-item-title>
63+
{{ t('LabelSyncDownOnce') }}
64+
</v-list-item-title>
65+
</v-list-item>
66+
</v-list>
67+
</v-menu>
3968
<v-menu
4069
bottom
4170
left>
@@ -572,12 +601,21 @@ export default {
572601
shareBookmark(item) {
573602
this.$store.dispatch(actions.SHARE_BOOKMARK, new Bookmark(item))
574603
},
575-
onTriggerSync() {
604+
onTriggerSync(direction) {
576605
if (this.syncing || this.scheduled) {
577606
return
578607
}
579608
this.currentAccount.data.syncing = 0.0001 // faaast
580-
this.$store.dispatch(actions.TRIGGER_SYNC, this.id)
609+
switch (direction) {
610+
case 'down':
611+
this.$store.dispatch(actions.TRIGGER_SYNC_DOWN, this.id)
612+
break
613+
case 'up':
614+
this.$store.dispatch(actions.TRIGGER_SYNC_UP, this.id)
615+
break
616+
default:
617+
this.$store.dispatch(actions.TRIGGER_SYNC, this.id)
618+
}
581619
},
582620
}
583621
}
@@ -600,4 +638,12 @@ export default {
600638
transform: rotate(0deg);
601639
}
602640
}
641+
642+
.sync-dropdown-hint::after {
643+
content: '';
644+
position: absolute;
645+
font-size: 0.45em;
646+
top: 30px;
647+
left: 30px;
648+
}
603649
</style>

0 commit comments

Comments
 (0)