?? options.java.svn-base
字號:
{ boolean ok; /* Test existsing option */ ok = Util.testSoundFile(getString(option)); if (ok) return; /* Test other extensions */ String[] exts = Util.explode("wav|mp3|amr|mid|midi|mmf", '|'); String testFile; for (int i = 0; i < exts.length; i++) { testFile = name + exts[i]; ok = Util.testSoundFile(testFile); if (ok) { setString(option, testFile); break; } } } //#sijapp cond.end# //#sijapp cond.if target!="DEFAULT"# private static void setBgImage(Image img, int placeMode) { if (placeMode == BG_IMAGE_STRETCH) img = ImageList.resizeImage(img, VirtualList.getCanvasWidth(), VirtualList.getCanvasHeight(), false); VirtualList.setBackImage(img, placeMode==BG_IMAGE_PAVE); } public static void setBackgroundImage(int mode, String value, final int placeMode) { switch (mode) { case Options.BG_IMAGE_INT : try { setBgImage(Image.createImage("/back.png"), placeMode); } catch (IOException e) {} // Do nothing break; //#sijapp cond.if modules_FILES="true"# case Options.BG_IMAGE_EXT : new Thread() { public void run () { FileConnection fileConnection = null; InputStream result = null; try { String filename = Options.getString (Options.OPTION_BG_IMAGE_URL); fileConnection = (FileConnection) Connector.open("file://"+filename,Connector.READ); result = fileConnection.openInputStream(); setBgImage(Image.createImage(result), placeMode); } catch (OutOfMemoryError me) { System.gc(); me.printStackTrace(); VirtualList.setBackImage(null, false); } catch (Exception e) { e.printStackTrace(); VirtualList.setBackImage(null, false); } finally { if (result != null) try { result.close(); } catch (Exception e) {} if (fileConnection != null) try { fileConnection.close(); } catch (Exception e) {} } } }.start(); break; //#sijapp cond.end# case Options.BG_IMAGE_NONE: VirtualList.setBackImage(null, false); break; } }//#sijapp cond.end# /*************************************/ /* */ /* Working with statuses strings */ /* */ /*************************************/ final private static Hashtable statusStrings = new Hashtable(); final private static Hashtable xStatusStrings = new Hashtable(); final private static int STATUS_STRINGS_VER = 1; final private static String statusRmsName = "JimmStatus"; final private static String xStatusRmsName = "JimmXStatus"; public static String getStatusString(int mode, int status) { switch (mode) { case StatusInfo.TYPE_STATUS: synchronized (statusStrings) { return (String)statusStrings.get(new Integer(status)); } case StatusInfo.TYPE_X_STATUS: synchronized (xStatusStrings) { return (String)xStatusStrings.get(new Integer(status)); } } return null; } public static void setStatusString(int mode, int status, String text) { switch (mode) { case StatusInfo.TYPE_STATUS: synchronized (statusStrings) { statusStrings.put(new Integer(status), text); } break; case StatusInfo.TYPE_X_STATUS: synchronized (xStatusStrings) { xStatusStrings.put(new Integer(status), text); } break; } } private static void setDefaultStatusStrings(Hashtable tbl, int type) { tbl.clear(); for (int i = 0; i < JimmUI.statusInfos.length; i++) { StatusInfo info = JimmUI.statusInfos[i]; if (info.getType() != type) continue; if (!info.testFlag(StatusInfo.FLAG_HAVE_DESCR)) continue; tbl.put(new Integer(info.getValue()), info.getText()); } } private static void saveStatusStrings(Hashtable tbl, String rmsName) { try { RecordStore rms = RecordStore.openRecordStore(rmsName, true); while (rms.getNumRecords() < 1) rms.addRecord(null, 0, 0); ByteArrayOutputStream baos = new ByteArrayOutputStream(); DataOutputStream dos = new DataOutputStream(baos); dos.writeInt(STATUS_STRINGS_VER); dos.writeInt(tbl.size()); Enumeration keys = tbl.keys(); while (keys.hasMoreElements()) { Integer statInt = (Integer)keys.nextElement(); int status = statInt.intValue(); String statDescr = (String)tbl.get(statInt); if (statDescr == null || statDescr.length() == 0) continue; dos.writeInt(status); dos.writeUTF(statDescr); } byte[] bytes = baos.toByteArray(); rms.setRecord(1, bytes, 0, bytes.length); } catch (Exception e) { //e.printStackTrace(); } } private static void loadStatusStrings(Hashtable tbl, String rmsName) { try { RecordStore rms = RecordStore.openRecordStore(rmsName, false); tbl.clear(); byte[] bytes = rms.getRecord(1); ByteArrayInputStream bais = new ByteArrayInputStream(bytes); DataInputStream dis = new DataInputStream(bais); int version = dis.readInt(); switch (version) { case 1: { int size = dis.readInt(); for (int i = 0; i < size; i++) { int status = dis.readInt(); String statDescr = dis.readUTF(); tbl.put(new Integer(status), statDescr); } } break; } } catch (Exception e) { //e.printStackTrace(); } } static void saveStatusStringsByType(int type) { switch (type) { case StatusInfo.TYPE_STATUS: saveStatusStrings(statusStrings, statusRmsName); break; case StatusInfo.TYPE_X_STATUS: saveStatusStrings(xStatusStrings, xStatusRmsName); break; } }}/**************************************************************************//**************************************************************************//* Form for editing option values */class OptionsForm implements CommandListener, ItemStateListener, VirtualListCommands, JimmScreen{//#sijapp cond.if (target!="DEFAULT")&(modules_FILES="true")# private class OptionsItems implements ItemCommandListener { public OptionsItems() { } public void commandAction(Command command, Item item) { if(command == cmdSelectBackImg) { try { fileSystem = new FileSystem2(); fileSystem.browse(null, _this, false); } catch (Exception e) { System.out.println (e.getMessage()); } } } }//#sijapp cond.end# private boolean lastGroupsUsed, lastHideOffline, lastHideEmpty; private int lastSortMethod; private int currentHour; private int currOptMode; private int currOptType; private String lastUILang; /* Options menu */ private TextList optionsMenu; /* Options form */ private Form optionsForm; private static final int RMS_ASK_RESULT_YES = 30000; private static final int RMS_ASK_RESULT_NO = 30001; private static final int TYPE_TOP_OPTIONS = 10000; private static final int TYPE_MCL_OPTIONS = 10001; // Constants for menu actios private static final int OPTIONS_ACCOUNT = 0; private static final int OPTIONS_NETWORK = 1; private static final int OPTIONS_PROXY = 2; private static final int OPTIONS_INTERFACE = 3; private static final int OPTIONS_BG_IMAGE = 4; private static final int OPTIONS_CAMERA = 5; private static final int OPTIONS_HOTKEYS = 6; private static final int OPTIONS_SIGNALING = 7; private static final int OPTIONS_TRAFFIC = 8; private static final int OPTIONS_TIMEZONE = 9; private static final int OPTIONS_COLOR_THEME = 10; private static final int OPTIONS_AUTOAWAY = 11; private static final int OPTIONS_MY_INFO = 12; private static final int OPTIONS_MANAGE_CL = 13; private static final int OPTIONS_RESET_RMS = 14; private static final int OPTIONS_ANTISPAM = 15; private static final int OPTIONS_TRANSP = 16; private static final int OPTIONS_STAT_STR = 17; private static final int OPTIONS_XSTAT_STR = 18; // Constants for contact list menu private static final int OPTIONS_ADD_USER = 100; private static final int OPTIONS_SEARCH_USER = 101; private static final int OPTIONS_ADD_GROUP = 102; private static final int OPTIONS_RENAME_GROUP = 103; private static final int OPTIONS_DELETE_GROUP = 104; private static final int OPTIONS_PRIVATE_LISTS = 105; // Options private TextField txtUIN; private TextField[] uinTextField; private TextField[] passwordTextField; private TextField srvHostTextField; private TextField srvPortTextField; private TextField httpUserAgendTextField; private TextField httpWAPProfileTextField; private ChoiceGroup keepConnAliveChoiceGroup; private TextField connAliveIntervTextField; private ChoiceGroup connPropChoiceGroup; private ChoiceGroup connTypeChoiceGroup; private ChoiceGroup autoConnectChoiceGroup; private TextField reconnectNumberTextField; private ChoiceGroup uiLanguageChoiceGroup; private ChoiceGroup choiceInterfaceMisc; private ChoiceGroup clSortByChoiceGroup; private ChoiceGroup chrgChat; private ChoiceGroup chrgMessFormat; private ChoiceGroup vibratorChoiceGroup; private ChoiceGroup chsBringUp; private ChoiceGroup chsFSMode; private ChoiceGroup choiceCurAccount; private ChoiceGroup chsTimeZone; private ChoiceGroup chsCurrTime; private ChoiceGroup chsDayLight;//#sijapp cond.if (target!="DEFAULT")&(modules_FILES="true")# // private ChoiceGroup clCamDevGroup; private ChoiceGroup camRes; private ChoiceGroup camEnc;//#sijapp cond.end#//#sijapp cond.if target isnot "DEFAULT"# private ChoiceGroup cursorAlpha; private ChoiceGroup menuAlpha; private ChoiceGroup messageNotificationModeChoiceGroup; private ChoiceGroup onlineNotificationModeChoiceGroup; private ChoiceGroup typingNotificationModeChoiceGroup; private TextField messageNotificationSoundfileTextField; private Gauge messageNotificationSoundVolume; private TextField onlineNotificationSoundfileTextField; private TextField typingNotificationSoundfileTextField; private Gauge onlineNotificationSoundVolume; private Gauge typingNotificationSoundVolume; private ChoiceGroup backImgGroup; private ChoiceGroup backImgModeGroup; //#sijapp cond.if modules_FILES="true"# private StringItem backImgFilename; private int backImgFilenameIndex = 0; //#sijapp cond.end#//#sijapp cond.end# //#sijapp cond.if target="MIDP2" | target="SIEMENS2"# private ChoiceGroup imagesScale;//#sijapp cond.end# //#sijapp cond.if modules_TRAFFIC is "true" # private TextField costPerPacketTextField; private TextField costPerDayTextField; private TextField costPacketLengthTextField; private TextField currencyTextField;//#sijapp cond.end# private ChoiceGroup choiceContactList;//#sijapp cond.if target="MOTOROLA" | target="MIDP2" # private TextField lightTimeout; private ChoiceGroup lightManual;//#sijapp cond.end# private TextField txtCapOffset; //#sijapp cond.if modules_PROXY is "true"# private ChoiceGroup srvProxyType; private TextField srvProxyHostTextField; private TextField srvProxyPortTextField; private TextField srvProxyLoginTextField; private TextField srvProxyPassTextField; private TextField connAutoRetryTextField;//#sijapp cond.end# //#sijapp cond.if modules_ANTISPAM="true"#
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -