コード例 #1
0
  /** 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);
  }
コード例 #2
0
ファイル: Util.java プロジェクト: kryukov/jimm-multi
 public static boolean hasURL(String msg) {
   if (null == msg) return false;
   Vector<String> result = new Vector<String>();
   parseForUrl(result, msg, '.', URL_CHAR_PREV, URL_CHAR_OTHER, 1);
   parseForUrl(result, msg, ':', URL_CHAR_PROTOCOL, URL_CHAR_OTHER, 1);
   parseForUrl(result, msg, '+', URL_CHAR_NONE, URL_CHAR_DIGIT, 1);
   parseForUrl(result, msg, '@', URL_CHAR_PREV, URL_CHAR_OTHER, 1);
   return !result.isEmpty();
 }
コード例 #3
0
ファイル: Util.java プロジェクト: kryukov/jimm-multi
 public static Vector parseMessageForURL(String msg) {
   if (null == msg) return null;
   // we are parsing 100 links only
   final int MAX_LINK_COUNT = 100;
   Vector<String> result = new Vector<String>();
   parseForUrl(result, msg, '.', URL_CHAR_PREV, URL_CHAR_OTHER, MAX_LINK_COUNT);
   parseForUrl(result, msg, ':', URL_CHAR_PROTOCOL, URL_CHAR_OTHER, MAX_LINK_COUNT);
   parseForUrl(result, msg, '+', URL_CHAR_NONE, URL_CHAR_DIGIT, MAX_LINK_COUNT);
   parseForUrl(result, msg, '@', URL_CHAR_PREV, URL_CHAR_OTHER, MAX_LINK_COUNT);
   return result.isEmpty() ? null : result;
 }
コード例 #4
0
 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); // нельзя выйти без активного аккаунта
   }
 }