indicate ability to browse collections in search results

pull/53/head
Zlatin Balevsky 2020-11-02 17:25:14 +00:00
parent 94d38c55e2
commit f382540a6d
No known key found for this signature in database
GPG Key ID: A72832072D525E41
7 changed files with 29 additions and 6 deletions

View File

@ -101,6 +101,10 @@ class ResultsParser {
if (json.browse != null)
browse = json.browse
boolean browseCollections = false
if (json.browseCollections != null)
browseCollections = json.browseCollections
int certificates = 0
if (json.certificates != null)
certificates = json.certificates
@ -121,6 +125,7 @@ class ResultsParser {
sources : sources,
comment : comment,
browse : browse,
browseCollections : browseCollections,
uuid: uuid,
certificates : certificates,
collections : collections)

View File

@ -90,6 +90,7 @@ class ResultsSender {
pieceSize : pieceSize,
uuid : uuid,
browse : settings.browseFiles,
browseCollections : settings.browseFiles,
sources : suggested,
comment : comment,
certificates : certificates,
@ -197,6 +198,7 @@ class ResultsSender {
obj.comment = sf.getComment()
obj.browse = browseFiles
obj.browseCollections = browseFiles
obj.certificates = certificates
obj.collections = collections.collect { Base64.encode(it.getRoot()) }
obj

View File

@ -16,6 +16,7 @@ class UIResultEvent extends Event {
int pieceSize
String comment
boolean browse
boolean browseCollections
int certificates
boolean chat
boolean feed

View File

@ -109,6 +109,11 @@ class SearchTabController {
mvcGroup.createMVCGroup("browse", groupId, params)
}
@ControllerAction
void browseCollections() {
}
@ControllerAction
void subscribe() {
def sender = view.selectedSender()

View File

@ -226,7 +226,8 @@ DISTRUST_SEARCHER=Distrust searcher
# Uploads popup menu
SHOW_IN_LIBRARY=Show in library
BROWSE_HOST=Browse Host
BROWSE_HOST=Browse Files
BROWSE_COLLECTIONS=Browse Collections
# Share files prompt
SELECT_FILES_OR_DIRECTORIES_TO_SHARE=Select files or folders to share

View File

@ -22,6 +22,7 @@ class SearchTabModel {
@Observable boolean downloadActionEnabled
@Observable boolean trustButtonsEnabled
@Observable boolean browseActionEnabled
@Observable boolean browseCollectionsActionEnabled
@Observable boolean viewCommentActionEnabled
@Observable boolean viewCertificatesActionEnabled
@Observable boolean chatActionEnabled

View File

@ -75,6 +75,7 @@ class SearchTabView {
closureColumn(header : trans("SENDER"), preferredWidth : 500, type: String, read : {row -> row.getHumanReadableName()})
closureColumn(header : trans("RESULTS"), preferredWidth : 20, type: Integer, read : {row -> model.sendersBucket[row].size()})
closureColumn(header : trans("BROWSE"), preferredWidth : 20, type: Boolean, read : {row -> model.sendersBucket[row].first().browse})
closureColumn(header : trans("COLLECTIONS"), preferredWidth : 20, type: Boolean, read : {row -> model.sendersBucket[row].first().browseCollections})
closureColumn(header : trans("FEED"), preferredWidth : 20, type : Boolean, read : {row -> model.sendersBucket[row].first().feed})
closureColumn(header : trans("CHAT"), preferredWidth : 20, type : Boolean, read : {row -> model.sendersBucket[row].first().chat})
closureColumn(header : trans("TRUST_NOUN"), preferredWidth : 50, type: String, read : { row ->
@ -87,6 +88,7 @@ class SearchTabView {
gridLayout(rows: 1, cols : 2)
panel (border : etchedBorder()){
button(text : trans("BROWSE_HOST"), enabled : bind {model.browseActionEnabled}, browseAction)
button(text : trans("BROWSE_COLLECTIONS"), enabled : bind {model.browseCollectionsActionEnabled}, browseCollectionsAction)
button(text : trans("SUBSCRIBE"), enabled : bind {model.subscribeActionEnabled}, subscribeAction)
button(text : trans("CHAT"), enabled : bind{model.chatActionEnabled}, chatAction)
}
@ -223,11 +225,12 @@ class SearchTabView {
panel (border : etchedBorder()) {
gridBagLayout()
button(text : trans("BROWSE_HOST"), enabled : bind {model.browseActionEnabled}, constraints : gbc(gridx : 0, gridy : 0), browseAction)
button(text : trans("SUBSCRIBE"), enabled : bind {model.subscribeActionEnabled}, constraints : gbc(gridx : 1, gridy : 0), subscribeAction)
button(text : trans("CHAT"), enabled : bind{model.chatActionEnabled}, constraints : gbc(gridx : 2, gridy : 0), chatAction)
button(text : trans("VIEW_COMMENT"), enabled : bind {model.viewCommentActionEnabled}, constraints : gbc(gridx : 3, gridy : 0), showCommentAction)
button(text : trans("VIEW_CERTIFICATES"), enabled : bind {model.viewCertificatesActionEnabled}, constraints : gbc(gridx : 4, gridy : 0), viewCertificatesAction)
button(text : trans("VIEW_COLLECTIONS"), enabled : bind {model.viewCollectionsActionEnabled}, constraints : gbc(gridx : 5, gridy : 0), viewCollectionsAction)
button(text : trans("BROWSE_COLLECTIONS"), enabled : bind {model.browseCollectionsActionEnabled}, constraints : gbc(gridx : 1, gridy : 0), browseCollectionsAction)
button(text : trans("SUBSCRIBE"), enabled : bind {model.subscribeActionEnabled}, constraints : gbc(gridx : 2, gridy : 0), subscribeAction)
button(text : trans("CHAT"), enabled : bind{model.chatActionEnabled}, constraints : gbc(gridx : 3, gridy : 0), chatAction)
button(text : trans("VIEW_COMMENT"), enabled : bind {model.viewCommentActionEnabled}, constraints : gbc(gridx : 4, gridy : 0), showCommentAction)
button(text : trans("VIEW_CERTIFICATES"), enabled : bind {model.viewCertificatesActionEnabled}, constraints : gbc(gridx : 5, gridy : 0), viewCertificatesAction)
button(text : trans("VIEW_COLLECTIONS"), enabled : bind {model.viewCollectionsActionEnabled}, constraints : gbc(gridx : 6, gridy : 0), viewCollectionsAction)
}
panel (border : etchedBorder()) {
button(text : trans("TRUST_VERB"), enabled: bind {model.trustButtonsEnabled }, trustAction)
@ -355,10 +358,12 @@ class SearchTabView {
model.trustButtonsEnabled = false
model.browseActionEnabled = false
model.subscribeActionEnabled = false
model.browseCollectionsActionEnabled = false
return
} else {
Persona sender = model.senders[row]
model.browseActionEnabled = model.sendersBucket[sender].first().browse
model.browseCollectionsActionEnabled = model.sendersBucket[sender].first().browseCollections
model.chatActionEnabled = model.sendersBucket[sender].first().chat
model.subscribeActionEnabled = model.sendersBucket[sender].first().feed &&
model.core.feedManager.getFeed(sender) == null
@ -381,6 +386,7 @@ class SearchTabView {
if (e == null) {
model.trustButtonsEnabled = false
model.browseActionEnabled = false
model.browseCollectionsActionEnabled = false
model.chatActionEnabled = false
model.viewCertificatesActionEnabled = false
model.viewCollectionsActionEnabled = false
@ -416,6 +422,7 @@ class SearchTabView {
int row = selectedSenderRow()
if (row < 0 || model.senders2[row] == null) {
model.browseActionEnabled = false
model.browseCollectionsActionEnabled = false
model.chatActionEnabled = false
model.subscribeActionEnabled = false
model.viewCertificatesActionEnabled = false
@ -426,6 +433,7 @@ class SearchTabView {
}
UIResultEvent e = model.senders2[row]
model.browseActionEnabled = e.browse
model.browseCollectionsActionEnabled = e.browseCollections
model.chatActionEnabled = e.chat
model.subscribeActionEnabled = e.feed && model.core.feedManager.getFeed(e.getSender()) == null
model.trustButtonsEnabled = true