Add the Create Channel dialog
The official client creates and edits channels with one dialog, so ChannelEditDialog becomes ChannelDialog with two entry points. Creating starts from caller-chosen defaults instead of a channelinfo and sends a channelcreate carrying only what deviates from a plain new channel — TeamSpeak checks a create permission per property that is present. The server row now has a context menu with "Create Channel" and "Create Spacer" (pre-filled with the lowest free [spacerN], since channel names must be unique), and a channel's menu offers "Create Channel" and "Create Sub-Channel", both starting out temporary. Verified against the test server: a temporary channel is created, and a permanent one a guest may not create reports the server's refusal. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.ts3client.ui;
|
||||
|
||||
import com.ts3client.net.ChannelNode;
|
||||
import com.ts3client.net.ChannelSettings;
|
||||
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JPopupMenu;
|
||||
@@ -20,6 +21,14 @@ final class ChannelMenu {
|
||||
join.addActionListener(a -> actions.joinChannel(channel.id));
|
||||
menu.add(join);
|
||||
menu.addSeparator();
|
||||
// Both start out temporary: a channel made from another channel's menu is
|
||||
// usually a throwaway one, and a permanent channel is a deliberate choice.
|
||||
JMenuItem create = new JMenuItem("Create Channel", Icons.of("CHANNEL_CREATE"));
|
||||
create.addActionListener(a -> actions.createChannel(null, ChannelSettings.Type.TEMPORARY));
|
||||
menu.add(create);
|
||||
JMenuItem createSub = new JMenuItem("Create Sub-Channel", Icons.of("CHANNEL_CREATE_SUB"));
|
||||
createSub.addActionListener(a -> actions.createChannel(channel, ChannelSettings.Type.TEMPORARY));
|
||||
menu.add(createSub);
|
||||
JMenuItem edit = new JMenuItem("Edit Channel", Icons.of("CHANNEL_EDIT"));
|
||||
edit.addActionListener(a -> actions.editChannel(channel));
|
||||
menu.add(edit);
|
||||
|
||||
Reference in New Issue
Block a user