-
-
Notifications
You must be signed in to change notification settings - Fork 118
/
Copy pathMoreNavBarButton.swift
91 lines (70 loc) · 2.04 KB
/
MoreNavBarButton.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
//
// MoreNavBarButton.swift
// Strongbox
//
// Created by Strongbox on 01/08/2024.
// Copyright © 2024 Mark McGuill. All rights reserved.
//
import SwiftUI
struct MoreNavBarButton: View {
@ObservedObject
var model: DatabaseHomeViewModel
var body: some View {
Menu {
Button(action: {
model.onAddEntry()
}, label: {
HStack {
Text("browse_context_menu_new_entry")
Image(systemName: "doc.badge.plus")
}
})
.disabled(model.database.isReadOnly)
Divider()
Button(action: {
model.presentSetMasterCredentials()
}, label: {
HStack {
Text("browse_context_menu_set_master_credentials")
Image(systemName: "ellipsis.rectangle")
}
})
.disabled(model.database.isReadOnly)
Divider()
Divider()
if !model.disableExport {
Button(action: {
model.exportDatabase()
}, label: {
HStack {
Text("generic_export_database")
Image(systemName: "square.and.arrow.up")
}
})
}
if !model.disablePrinting {
Button(action: {
model.printDatabase()
}, label: {
HStack {
Text("generic_print_database")
Image(systemName: "printer")
}
})
}
} label: {
Image(systemName: "ellipsis.circle")
}
}
}
#Preview {
NavigationView {
Text("Test")
.toolbar {
ToolbarItem(placement: .navigationBarTrailing) {
MoreNavBarButton(model: DatabaseHomeViewModel())
}
}
.navigationTitle("Testing")
}
}