if ( engine instanceof WebEngine ){
final WebEngine we = (WebEngine)engine;
UISWTInputReceiver entry = new SimpleTextEntryWindow();
String[] req = we.getRequiredCookies();
String req_str = "";
for ( String r:req ){
req_str += (req_str.length()==0?"":";") + r + "=?";
}
entry.setPreenteredText( req_str, true );
entry.maintainWhitespace(false);
entry.allowEmptyInput( false );
entry.setTitle("general.enter.cookies");
entry.prompt(new UIInputReceiverListener() {
public void UIInputReceiverClosed(UIInputReceiver entry) {
if (!entry.hasSubmittedInput()){
return;
}
try {
String input = entry.getSubmittedInput().trim();
if ( input.length() > 0 ){
we.setCookies( input );
subs.getManager().getScheduler().downloadAsync(subs, true);
}
}catch( Throwable e ){
Debug.printStackTrace(e);
}
}
});
}
}catch( Throwable e ){
Debug.printStackTrace(e);
}
}
});
}
}
}catch( Throwable e ){
Debug.printStackTrace(e);
}
// sep
menuManager.addMenuItem("sidebar." + key,"s1").setStyle( MenuItem.STYLE_SEPARATOR );
// category
menuItem = menuManager.addMenuItem("sidebar." + key, "MyTorrentsView.menu.setCategory");
menuItem.setStyle( MenuItem.STYLE_MENU );
menuItem.addFillListener(
new MenuItemFillListener()
{
public void
menuWillBeShown(
MenuItem menu,
Object data )
{
addCategorySubMenu( menuManager, menu );
}
});
if ( subs.isUpdateable()){
menuItem = menuManager.addMenuItem("sidebar." + key,"MyTorrentsView.menu.rename");
menuItem.addListener(new SubsMenuItemListener() {
public void selected(MdiEntry info, final Subscription subs) {
UISWTInputReceiver entry = new SimpleTextEntryWindow();
entry.setPreenteredText(subs.getName(), false );
entry.maintainWhitespace(false);
entry.allowEmptyInput( false );
entry.setLocalisedTitle(MessageText.getString("label.rename",
new String[] {
subs.getName()
}));
entry.prompt(new UIInputReceiverListener() {
public void UIInputReceiverClosed(UIInputReceiver entry) {
if (!entry.hasSubmittedInput()){
return;
}
String input = entry.getSubmittedInput().trim();
if ( input.length() > 0 ){
try{
subs.setName( input );