📄 configsectionsecurity.java
字号:
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space
// Source File Name: ConfigSectionSecurity.java
package org.gudy.azureus2.ui.swt.views.configsections;
import com.aelitis.azureus.core.security.*;
import com.aelitis.azureus.ui.swt.UIFunctionsManagerSWT;
import com.aelitis.azureus.ui.swt.UIFunctionsSWT;
import com.aelitis.azureus.ui.swt.imageloader.ImageLoader;
import java.io.*;
import org.eclipse.swt.dnd.*;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.*;
import org.gudy.azureus2.core3.config.COConfigurationManager;
import org.gudy.azureus2.core3.internat.MessageText;
import org.gudy.azureus2.core3.security.SESecurityManager;
import org.gudy.azureus2.core3.util.Base32;
import org.gudy.azureus2.core3.util.Debug;
import org.gudy.azureus2.ui.swt.Messages;
import org.gudy.azureus2.ui.swt.Utils;
import org.gudy.azureus2.ui.swt.auth.CertificateCreatorWindow;
import org.gudy.azureus2.ui.swt.config.*;
import org.gudy.azureus2.ui.swt.mainwindow.Colors;
import org.gudy.azureus2.ui.swt.mainwindow.Cursors;
import org.gudy.azureus2.ui.swt.plugins.UISWTConfigSection;
public class ConfigSectionSecurity
implements UISWTConfigSection
{
public ConfigSectionSecurity()
{
}
public String configSectionGetParentSection()
{
return "root";
}
public String configSectionGetName()
{
return "security";
}
public void configSectionSave()
{
}
public void configSectionDelete()
{
ImageLoader imageLoader = ImageLoader.getInstance();
imageLoader.releaseImage("openFolderButton");
}
public int maxUserMode()
{
return 2;
}
public Composite configSectionCreate(final Composite parent)
{
int userMode = COConfigurationManager.getIntParameter("User Mode");
Composite gSecurity = new Composite(parent, 0);
GridData gridData = new GridData(272);
gSecurity.setLayoutData(gridData);
GridLayout layout = new GridLayout();
layout.numColumns = 3;
gSecurity.setLayout(layout);
Label cert_label = new Label(gSecurity, 0);
Messages.setLanguageText(cert_label, "ConfigView.section.tracker.createcert");
Button cert_button = new Button(gSecurity, 8);
Messages.setLanguageText(cert_button, "ConfigView.section.tracker.createbutton");
cert_button.addListener(13, new Listener() {
final ConfigSectionSecurity this$0;
public void handleEvent(Event event)
{
new CertificateCreatorWindow();
}
{
this$0 = ConfigSectionSecurity.this;
super();
}
});
new Label(gSecurity, 0);
Label info_label = new Label(gSecurity, 64);
Messages.setLanguageText(info_label, "ConfigView.section.security.toolsinfo");
info_label.setLayoutData(Utils.getWrappableLabelGridData(3, 0));
Label lStatsPath = new Label(gSecurity, 0);
Messages.setLanguageText(lStatsPath, "ConfigView.section.security.toolsdir");
ImageLoader imageLoader = ImageLoader.getInstance();
Image imgOpenFolder = imageLoader.getImage("openFolderButton");
gridData = new GridData();
gridData.widthHint = 150;
final StringParameter pathParameter = new StringParameter(gSecurity, "Security.JAR.tools.dir", "");
pathParameter.setLayoutData(gridData);
Button browse = new Button(gSecurity, 8);
browse.setImage(imgOpenFolder);
imgOpenFolder.setBackground(browse.getBackground());
browse.setToolTipText(MessageText.getString("ConfigView.button.browse"));
browse.addListener(13, new Listener() {
final Composite val$parent;
final StringParameter val$pathParameter;
final ConfigSectionSecurity this$0;
public void handleEvent(Event event)
{
DirectoryDialog dialog = new DirectoryDialog(parent.getShell(), 0x10000);
dialog.setFilterPath(pathParameter.getValue());
dialog.setText(MessageText.getString("ConfigView.section.security.choosetoolssavedir"));
String path = dialog.open();
if (path != null)
pathParameter.setValue(path);
}
{
this$0 = ConfigSectionSecurity.this;
parent = composite;
pathParameter = stringparameter;
super();
}
});
Label pw_label = new Label(gSecurity, 0);
Messages.setLanguageText(pw_label, "ConfigView.section.security.clearpasswords");
Button pw_button = new Button(gSecurity, 8);
Messages.setLanguageText(pw_button, "ConfigView.section.security.clearpasswords.button");
pw_button.addListener(13, new Listener() {
final ConfigSectionSecurity this$0;
public void handleEvent(Event event)
{
SESecurityManager.clearPasswords();
CryptoManagerFactory.getSingleton().clearPasswords();
}
{
this$0 = ConfigSectionSecurity.this;
super();
}
});
new Label(gSecurity, 0);
if (userMode >= 2)
{
final CryptoManager crypt_man = CryptoManagerFactory.getSingleton();
final Group crypto_group = new Group(gSecurity, 0);
gridData = new GridData(784);
gridData.horizontalSpan = 3;
crypto_group.setLayoutData(gridData);
layout = new GridLayout();
layout.numColumns = 3;
crypto_group.setLayout(layout);
Messages.setLanguageText(crypto_group, "ConfigView.section.security.group.crypto");
Label linkLabel = new Label(crypto_group, 0);
linkLabel.setText(MessageText.getString("ConfigView.label.please.visit.here"));
linkLabel.setData("http://www.azureuswiki.com/index.php?title=Public_Private_Keys");
linkLabel.setCursor(Cursors.handCursor);
linkLabel.setForeground(Colors.blue);
gridData = new GridData();
gridData.horizontalSpan = 3;
linkLabel.setLayoutData(gridData);
linkLabel.addMouseListener(new MouseAdapter() {
final ConfigSectionSecurity this$0;
public void mouseDoubleClick(MouseEvent arg0)
{
Utils.launch((String)((Label)arg0.widget).getData());
}
public void mouseDown(MouseEvent arg0)
{
Utils.launch((String)((Label)arg0.widget).getData());
}
{
this$0 = ConfigSectionSecurity.this;
super();
}
});
byte public_key[] = crypt_man.getECCHandler().peekPublicKey();
Label public_key_label = new Label(crypto_group, 0);
Messages.setLanguageText(public_key_label, "ConfigView.section.security.publickey");
final Label public_key_value = new Label(crypto_group, 0);
if (public_key == null)
Messages.setLanguageText(public_key_value, "ConfigView.section.security.publickey.undef");
else
public_key_value.setText(Base32.encode(public_key));
Messages.setLanguageText(public_key_value, "ConfigView.copy.to.clipboard.tooltip", true);
public_key_value.setCursor(Cursors.handCursor);
public_key_value.setForeground(Colors.blue);
public_key_value.addMouseListener(new MouseAdapter() {
final Composite val$parent;
final Label val$public_key_value;
final ConfigSectionSecurity this$0;
public void mouseDoubleClick(MouseEvent arg0)
{
copyToClipboard();
}
public void mouseDown(MouseEvent arg0)
{
copyToClipboard();
}
protected void copyToClipboard()
{
(new Clipboard(parent.getDisplay())).setContents(new Object[] {
public_key_value.getText()
}, new Transfer[] {
TextTransfer.getInstance()
});
}
{
this$0 = ConfigSectionSecurity.this;
parent = composite;
public_key_value = label;
super();
}
});
crypt_man.addKeyListener(new CryptoManagerKeyListener() {
final Label val$public_key_value;
final CryptoManager val$crypt_man;
final Group val$crypto_group;
final ConfigSectionSecurity this$0;
public void keyChanged(final CryptoHandler handler)
{
final CryptoManagerKeyListener me = this;
Utils.execSWTThread(new Runnable() {
final CryptoManagerKeyListener val$me;
final CryptoHandler val$handler;
final 6 this$1;
public void run()
{
if (public_key_value.isDisposed())
crypt_man.removeKeyListener(me);
else
if (handler.getType() == 1)
{
byte public_key[] = handler.peekPublicKey();
if (public_key == null)
Messages.setLanguageText(public_key_value, "ConfigView.section.security.publickey.undef");
else
public_key_value.setText(Base32.encode(public_key));
crypto_group.layout();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -