fix contact subscriptions table which broke after recent redesign

reproducible
Zlatin Balevsky 2021-05-11 21:28:54 +01:00
parent 3c932608af
commit 9db10e23fc
No known key found for this signature in database
GPG Key ID: A72832072D525E41
2 changed files with 15 additions and 3 deletions

View File

@ -339,7 +339,7 @@ class MainFrameController {
}
private RemoteTrustList getSelectedTrustList() {
int row = view.getSelectedTrustTablesRow("subscription-table")
int row = view.getSelectedContactSubscriptionTableRow()
if (row < 0)
return null
model.subscriptions[row]

View File

@ -82,6 +82,7 @@ class MainFrameView {
def lastUploadsSortEvent
def lastSharedSortEvent
def lastContactsSortEvent
def lastContactsSubscriptionSortEvent
def expansionListener = new TreeExpansions()
def lastFeedsSortEvent
def lastFeedItemsSortEvent
@ -1109,12 +1110,12 @@ class MainFrameView {
// subscription table
def subscriptionTable = builder.getVariable("subscription-table")
subscriptionTable.setDefaultRenderer(Integer.class, centerRenderer)
subscriptionTable.rowSorter.addRowSorterListener({ evt -> trustTablesSortEvents["subscription-table"] = evt })
subscriptionTable.rowSorter.addRowSorterListener({ evt -> lastContactsSubscriptionSortEvent = evt })
subscriptionTable.rowSorter.setSortsOnUpdates(true)
selectionModel = subscriptionTable.getSelectionModel()
selectionModel.setSelectionMode(ListSelectionModel.SINGLE_SELECTION)
selectionModel.addListSelectionListener({
int selectedRow = getSelectedTrustTablesRow("subscription-table")
int selectedRow = getSelectedContactSubscriptionTableRow()
if (selectedRow < 0) {
model.reviewButtonEnabled = false
model.updateButtonEnabled = false
@ -1766,6 +1767,17 @@ class MainFrameView {
selectedRow
}
int getSelectedContactSubscriptionTableRow() {
def table = builder.getVariable("subscription-table")
int selectedRow = table.getSelectedRow()
if (selectedRow < 0)
return -1
if (lastContactsSubscriptionSortEvent != null)
selectedRow = table.rowSorter.convertRowIndexToModel(selectedRow)
selectedRow
}
public void refreshSharedFiles() {
def tree = builder.getVariable("shared-files-tree")
TreePath[] selectedPaths = tree.getSelectionPaths()