mirror of https://github.com/zlatinb/muwire
context menu on the feed items table
parent
2ba81ccc84
commit
38a027c308
|
@ -573,6 +573,8 @@ class MainFrameController {
|
|||
return
|
||||
Feed f = model.core.getFeedManager().getFeed(items.get(0).getPublisher())
|
||||
items.each {
|
||||
if (!model.canDownload(it.getInfoHash()))
|
||||
return
|
||||
File target = new File(application.context.get("muwire-settings").downloadLocation, it.getName())
|
||||
model.core.eventBus.publish(new UIDownloadFeedItemEvent(item : it, target : target, sequential : f.isSequential()))
|
||||
}
|
||||
|
|
|
@ -892,6 +892,25 @@ class MainFrameView {
|
|||
model.viewFeedItemCertificatesButtonEnabled = item.getCertificates() > 0
|
||||
}
|
||||
})
|
||||
feedItemsTable.addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
List<FeedItem> selectedItems = selectedFeedItems()
|
||||
if (e.isPopupTrigger() || e.getButton() == MouseEvent.BUTTON3)
|
||||
showFeedItemsPopupMenu(e)
|
||||
else if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() == 2 &&
|
||||
selectedItems != null && selectedItems.size() == 1 &&
|
||||
model.canDownload(selectedItems.get(0).getInfoHash())) {
|
||||
mvcGroup.controller.downloadFeedItem()
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseReleased(MouseEvent e) {
|
||||
if (e.isPopupTrigger() || e.getButton() == MouseEvent.BUTTON3)
|
||||
showFeedItemsPopupMenu(e)
|
||||
}
|
||||
})
|
||||
|
||||
// subscription table
|
||||
def subscriptionTable = builder.getVariable("subscription-table")
|
||||
|
@ -1159,7 +1178,6 @@ class MainFrameView {
|
|||
Feed feed = selectedFeed()
|
||||
if (feed == null)
|
||||
return
|
||||
// TODO: finish
|
||||
JPopupMenu menu = new JPopupMenu()
|
||||
if (model.updateFileFeedButtonEnabled) {
|
||||
JMenuItem update = new JMenuItem("Update")
|
||||
|
@ -1178,6 +1196,30 @@ class MainFrameView {
|
|||
showPopupMenu(menu,e)
|
||||
}
|
||||
|
||||
void showFeedItemsPopupMenu(MouseEvent e) {
|
||||
List<FeedItem> items = selectedFeedItems()
|
||||
if (items == null || items.isEmpty())
|
||||
return
|
||||
// TODO: finish
|
||||
JPopupMenu menu = new JPopupMenu()
|
||||
if (model.downloadFeedItemButtonEnabled) {
|
||||
JMenuItem download = new JMenuItem("Download")
|
||||
download.addActionListener({mvcGroup.controller.downloadFeedItem()})
|
||||
menu.add(download)
|
||||
}
|
||||
if (model.viewFeedItemCommentButtonEnabled) {
|
||||
JMenuItem viewComment = new JMenuItem("View Comment")
|
||||
viewComment.addActionListener({mvcGroup.controller.viewFeedItemComment()})
|
||||
menu.add(viewComment)
|
||||
}
|
||||
if (model.viewFeedItemCertificatesButtonEnabled) {
|
||||
JMenuItem viewCertificates = new JMenuItem("View Certificates")
|
||||
viewCertificates.addActionListener({mvcGroup.controller.viewFeedItemCertificates()})
|
||||
menu.add(viewCertificates)
|
||||
}
|
||||
showPopupMenu(menu, e)
|
||||
}
|
||||
|
||||
def selectedUploader() {
|
||||
def uploadsTable = builder.getVariable("uploads-table")
|
||||
int selectedRow = uploadsTable.getSelectedRow()
|
||||
|
|
Loading…
Reference in New Issue