Beispiel #1
0
  public SettingsView(ZimbraME midlet, Settings settings) {
    super(midlet);

    mSettings = settings;

    // #style SettingsView
    TabbedForm f =
        new TabbedForm(
            Locale.get("main.Settings"),
            new String[] {
              Locale.get("settings.General"),
              Locale.get("settings.Display"),
              // Locale.get("settings.Mail"),
              Locale.get("settings.Shortcuts")
            },
            null);

    // #if true
    // # mView = f;
    // #endif

    f.setItemStateListener(this);
    f.setTabbedFormListener(this);

    createGeneralTab();
    createDisplayTab();
    createShortcutsTab();

    f.addCommand(SAVE);
    f.setCommandListener(this);
    f.setItemStateListener(this);
  }
Beispiel #2
0
  private void createShortcutsTab() {
    TabbedForm f = null;
    // #if true
    // # f = (TabbedForm)mView;
    // #endif

    // #style ChoiceGroup
    mShortcutList = new de.enough.polish.ui.ListItem(null);
    Shortcut[] shortcuts = mSettings.getShortcuts();
    Shortcut firstUnused = null;
    for (int i = 0; i < shortcuts.length; i++) {
      if (!shortcuts[i].isConfigured()) {
        firstUnused = shortcuts[i];
        break;
      }
    }

    ChoiceItem ci = null;
    if (firstUnused != null) {
      // #style ChoiceItem
      ci = new ShortcutItem(Locale.get("settings.NewShortcut"), null, List.IMPLICIT, firstUnused);
      mShortcutList.append(ci);
    }
    for (int i = 0; i < shortcuts.length; i++) {
      if (!shortcuts[i].isConfigured()) continue;
      // #style ChoiceItem
      ci = new ShortcutItem(shortcuts[i].toString(), null, List.IMPLICIT, shortcuts[i]);
      mShortcutList.append(ci);
    }

    f.deleteAll(SHORTCUTS_TAB);
    f.removeCommand(OK);
    f.removeCommand(CANCEL);
    f.addCommand(SAVE);
    f.addCommand(DELETE);
    f.append(SHORTCUTS_TAB, mShortcutList);
    mShortcutList.setItemCommandListener(this);
    mShortcutList.setDefaultCommand(List.SELECT_COMMAND);
  }
Beispiel #3
0
  private void initTabContent(int tabIdx) {
    TabbedForm f = null;
    // #if true
    // # f = (TabbedForm)mView;
    // #endif

    switch (tabIdx) {
      case GENERAL_TAB:
        initGeneralTab();
        f.removeCommand(DELETE);
        break;
      case DISPLAY_TAB:
        initDisplayTab();
        f.removeCommand(DELETE);
        break;
      case SHORTCUTS_TAB:
        initShortcutsTab();
        f.addCommand(DELETE);
        break;
    }
  }
Beispiel #4
0
  private void createShortcutEditTab(ShortcutItem si) {
    TabbedForm f = null;
    // #if true
    // # f = (TabbedForm)mView;
    // #endif

    mSelectedShortcut = new ShortcutItem(si);
    int selectedIndex;
    switch (mSelectedShortcut.shortcut.action) {
      case Shortcut.ACTION_MOVE_TO_FOLDER:
      default:
        selectedIndex = SHORTCUT_FOLDER;
        break;
      case Shortcut.ACTION_TAG:
        selectedIndex = SHORTCUT_TAG;
        break;
      case Shortcut.ACTION_RUN_SAVED_SEARCH:
        selectedIndex = SHORTCUT_SEARCH;
        break;
    }

    mShortcutEditScreen = new de.enough.polish.ui.ListItem(Locale.get("settings.EditShortcut"));

    // #style SpanningLabel
    Item item = new StringItem(null, Locale.get("settings.Button"));
    mShortcutEditScreen.append(item);

    // #style ChoiceGroupPopup
    mShortcutButtonCG = new ChoiceGroup(null, Choice.POPUP);
    for (int i = 0; i < 10; i++) {
      // #style ChoiceItemPopup
      mShortcutButtonCG.append("# " + i, null);
    }

    mShortcutButtonCG.setSelectedIndex(mSelectedShortcut.shortcut.button, true);
    mShortcutEditScreen.append(mShortcutButtonCG);

    // #style SpanningLabel
    item = new StringItem(null, Locale.get("settings.Action"));
    mShortcutEditScreen.append(item);

    // #style ChoiceGroupIndented
    mShortcutActionCG = new ChoiceGroup(null, ChoiceGroup.EXCLUSIVE);
    // #style ChoiceItem
    mShortcutActionCG.append(
        mSelectedShortcut.shortcut.toString(false, Shortcut.ACTION_MOVE_TO_FOLDER), null);
    // #style ChoiceItem
    mShortcutActionCG.append(mSelectedShortcut.shortcut.toString(false, Shortcut.ACTION_TAG), null);
    // #style ChoiceItem
    mShortcutActionCG.append(
        mSelectedShortcut.shortcut.toString(false, Shortcut.ACTION_RUN_SAVED_SEARCH), null);
    mShortcutEditScreen.append(mShortcutActionCG);

    mShortcutActionCG.setSelectedIndex(selectedIndex, true);
    f.removeCommand(SAVE);
    f.removeCommand(DELETE);
    f.addCommand(OK);
    f.addCommand(CANCEL);
    f.deleteAll(SHORTCUTS_TAB);
    f.append(SHORTCUTS_TAB, mShortcutEditScreen);
  }