/** Creates a new instance of AccountPicker */
  public AccountSelect(Display display, boolean enableQuit) {
    super();
    // this.display=display;

    setTitleItem(new Title(SR.MS_ACCOUNTS));

    accountList = new Vector();
    Account a;

    int index = 0;
    activeAccount = Config.getInstance().accountIndex;
    do {
      a = Account.createFromStorage(index);
      if (a != null) {
        accountList.addElement(a);
        a.active = (activeAccount == index);
        index++;
      }
    } while (a != null);
    if (accountList.isEmpty()) {
      a = Account.createFromJad();
      if (a != null) {
        // a.updateJidCache();
        accountList.addElement(a);
        rmsUpdate();
      }
    }
    attachDisplay(display);
    addCommand(cmdAdd);

    if (enableQuit) addCommand(cmdQuit);

    commandState();
    setCommandListener(this);
  }
 void commandState() {
   if (accountList.isEmpty()) {
     removeCommand(cmdEdit);
     removeCommand(cmdDel);
     removeCommand(cmdSelect);
     removeCommand(cmdLogin);
     removeCommand(cmdCancel);
   } else {
     addCommand(cmdEdit);
     addCommand(cmdDel);
     addCommand(cmdLogin);
     addCommand(cmdSelect);
     if (activeAccount >= 0) addCommand(cmdCancel); // нельзя выйти без активного аккаунта
   }
 }