gui browse/feed/chat actions from upload table
This commit is contained in:
@ -33,6 +33,7 @@ import com.muwire.core.filecert.UICreateCertificateEvent
|
||||
import com.muwire.core.filefeeds.Feed
|
||||
import com.muwire.core.filefeeds.FeedItem
|
||||
import com.muwire.core.filefeeds.UIDownloadFeedItemEvent
|
||||
import com.muwire.core.filefeeds.UIFeedConfigurationEvent
|
||||
import com.muwire.core.filefeeds.UIFeedDeletedEvent
|
||||
import com.muwire.core.filefeeds.UIFeedUpdateEvent
|
||||
import com.muwire.core.filefeeds.UIFilePublishedEvent
|
||||
@ -356,6 +357,47 @@ class MainFrameController {
|
||||
startChat(p)
|
||||
view.showChatWindow.call()
|
||||
}
|
||||
|
||||
@ControllerAction
|
||||
void browseFromUpload() {
|
||||
Uploader u = view.selectedUploader()
|
||||
if (u == null)
|
||||
return
|
||||
Persona p = u.getDownloaderPersona()
|
||||
|
||||
String groupId = p.getHumanReadableName() + "-browse"
|
||||
def params = [:]
|
||||
params['host'] = p
|
||||
params['core'] = model.core
|
||||
mvcGroup.createMVCGroup("browse",groupId,params)
|
||||
}
|
||||
|
||||
@ControllerAction
|
||||
void subscribeFromUpload() {
|
||||
Uploader u = view.selectedUploader()
|
||||
if (u == null)
|
||||
return
|
||||
Persona p = u.getDownloaderPersona()
|
||||
|
||||
Feed feed = new Feed(p)
|
||||
feed.setAutoDownload(core.muOptions.defaultFeedAutoDownload)
|
||||
feed.setSequential(core.muOptions.defaultFeedSequential)
|
||||
feed.setItemsToKeep(core.muOptions.defaultFeedItemsToKeep)
|
||||
feed.setUpdateInterval(core.muOptions.defaultFeedUpdateInterval)
|
||||
|
||||
core.eventBus.publish(new UIFeedConfigurationEvent(feed : feed, newFeed : true))
|
||||
view.showFeedsWindow.call()
|
||||
}
|
||||
|
||||
@ControllerAction
|
||||
void chatFromUpload() {
|
||||
Uploader u = view.selectedUploader()
|
||||
if (u == null)
|
||||
return
|
||||
Persona p = u.getDownloaderPersona()
|
||||
startChat(p)
|
||||
view.showChatWindow.call()
|
||||
}
|
||||
|
||||
void unshareSelectedFile() {
|
||||
def sf = view.selectedSharedFiles()
|
||||
|
@ -44,6 +44,8 @@ import com.muwire.core.filefeeds.FeedFetchStatus
|
||||
import com.muwire.core.filefeeds.FeedItem
|
||||
import com.muwire.core.files.FileSharedEvent
|
||||
import com.muwire.core.trust.RemoteTrustList
|
||||
import com.muwire.core.upload.Uploader
|
||||
|
||||
import java.awt.BorderLayout
|
||||
import java.awt.CardLayout
|
||||
import java.awt.FlowLayout
|
||||
@ -782,18 +784,14 @@ class MainFrameView {
|
||||
|
||||
selectionModel = uploadsTable.getSelectionModel()
|
||||
selectionModel.setSelectionMode(ListSelectionModel.SINGLE_SELECTION)
|
||||
JPopupMenu uploadsTableMenu = new JPopupMenu()
|
||||
JMenuItem showInLibrary = new JMenuItem("Show in library")
|
||||
showInLibrary.addActionListener({mvcGroup.controller.showInLibrary()})
|
||||
uploadsTableMenu.add(showInLibrary)
|
||||
uploadsTable.addMouseListener(new MouseAdapter() {
|
||||
public void mouseReleased(MouseEvent e) {
|
||||
if (e.isPopupTrigger())
|
||||
showPopupMenu(uploadsTableMenu, e)
|
||||
if (e.isPopupTrigger() || e.button == MouseEvent.BUTTON3)
|
||||
showUploadsMenu(e)
|
||||
}
|
||||
public void mousePressed(MouseEvent e) {
|
||||
if (e.isPopupTrigger())
|
||||
showPopupMenu(uploadsTableMenu, e)
|
||||
if (e.isPopupTrigger() || e.button == MouseEvent.BUTTON3)
|
||||
showUploadsMenu()
|
||||
}
|
||||
})
|
||||
|
||||
@ -1205,7 +1203,6 @@ class MainFrameView {
|
||||
List<FeedItem> items = selectedFeedItems()
|
||||
if (items == null || items.isEmpty())
|
||||
return
|
||||
// TODO: finish
|
||||
JPopupMenu menu = new JPopupMenu()
|
||||
if (model.downloadFeedItemButtonEnabled) {
|
||||
JMenuItem download = new JMenuItem("Download")
|
||||
@ -1255,6 +1252,37 @@ class MainFrameView {
|
||||
}
|
||||
}
|
||||
|
||||
void showUploadsMenu(MouseEvent e) {
|
||||
Uploader uploader = selectedUploader()
|
||||
if (uploader == null)
|
||||
return
|
||||
|
||||
JPopupMenu uploadsTableMenu = new JPopupMenu()
|
||||
JMenuItem showInLibrary = new JMenuItem("Show in library")
|
||||
showInLibrary.addActionListener({mvcGroup.controller.showInLibrary()})
|
||||
uploadsTableMenu.add(showInLibrary)
|
||||
|
||||
if (uploader.isBrowseEnabled()) {
|
||||
JMenuItem browseItem = new JMenuItem("Browse Host")
|
||||
browseItem.addActionListener({mvcGroup.controller.browseFromUpload()})
|
||||
uploadsTableMenu.add(browseItem)
|
||||
}
|
||||
|
||||
if (uploader.isFeedEnabled() && mvcGroup.controller.core.feedManager.getFeed(uploader.getDownloaderPersona()) == null) {
|
||||
JMenuItem feedItem = new JMenuItem("Subscribe")
|
||||
feedItem.addActionListener({mvcGroup.controller.subscribeFromUpload()})
|
||||
uploadsTableMenu.add(feedItem)
|
||||
}
|
||||
|
||||
if (uploader.isChatEnabled() && !mvcGroup.controller.core.chatManager.isConnected(uploader.getDownloaderPersona())) {
|
||||
JMenuItem chatItem = new JMenuItem("Chat")
|
||||
chatItem.addActionListener({mvcGroup.controller.chatFromUpload()})
|
||||
uploadsTableMenu.add(chatItem)
|
||||
}
|
||||
|
||||
showPopupMenu(uploadsTableMenu, e)
|
||||
}
|
||||
|
||||
void showRestoreOrEmpty() {
|
||||
def searchWindow = builder.getVariable("search window")
|
||||
String id
|
||||
|
Reference in New Issue
Block a user