?? options.java.svn-base
字號:
/******************************************************************************* Jimm - Mobile Messaging - J2ME ICQ clone Copyright (C) 2003-08 Jimm Project This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ******************************************************************************* File: src/jimm/Options.java Version: ###VERSION### Date: ###DATE### Author(s): Manuel Linsmayer, Andreas Rossbacher, Artyomov Denis, Igor Palkin ******************************************************************************//******************************************************************************* Current record store format: Record #1: VERSION (UTF8) Record #2: OPTION KEY (BYTE) OPTION VALUE (Type depends on key) OPTION KEY (BYTE) OPTION VALUE (Type depends on key) OPTION KEY (BYTE) OPTION VALUE (Type depends on key) ... Option key Option value 0 - 63 (00XXXXXX) UTF8 64 - 127 (01XXXXXX) INTEGER 128 - 191 (10XXXXXX) BOOLEAN 192 - 224 (110XXXXX) LONG 225 - 255 (111XXXXX) SHORT, BYTE-ARRAY (scrambled String) ******************************************************************************/package jimm;import jimm.comm.Action;import jimm.comm.SearchAction;import jimm.comm.UpdateContactListAction;import jimm.comm.Util;import jimm.comm.Icq;import jimm.comm.RegisterNewUinAction;import jimm.util.ResourceBundle;//#sijapp cond.if target="MIDP2"|target="MOTOROLA"|target="RIM"#import javax.microedition.io.file.*;import javax.microedition.io.*;//#sijapp cond.elseif target="SIEMENS2"#//#import com.siemens.mp.io.file.FileConnection;//#import com.siemens.mp.io.file.FileSystemRegistry;//#import javax.microedition.io.Connector;//#sijapp cond.end#import java.io.*;import java.util.*;import DrawControls.*;import javax.microedition.lcdui.*;import javax.microedition.rms.RecordStore;import javax.microedition.rms.RecordStoreException;import DrawControls.VirtualList;public class Options{ /* Not stored in RMS */ public static final int OPTION_UIN = 254; public static final int OPTION_PASSWORD = 255; /* String */ static final int OPTION_UIN1 = 0; public static final int OPTION_SRV_HOST = 1; public static final int OPTION_SRV_PORT = 2; public static final int OPTION_UI_LANGUAGE = 3; public static final int OPTION_MESS_NOTIF_FILE = 4; public static final int OPTION_ONLINE_NOTIF_FILE = 5; public static final int OPTION_CURRENCY = 6; public static final int OPTION_STATUS_MESSAGE = 7; public static final int OPTION_PRX_SERV = 8; public static final int OPTION_PRX_PORT = 9; public static final int OPTION_AUTORETRY_COUNT = 10; public static final int OPTION_PRX_NAME = 11; public static final int OPTION_PRX_PASS = 12; public static final int OPTION_CONN_ALIVE_INVTERV = 13; static final int OPTION_UIN2 = 14; static final int OPTION_UIN3 = 15; public static final int OPTION_TYPING_FILE = 16; public static final int OPTION_HTTP_USER_AGENT = 17; public static final int OPTION_HTTP_WAP_PROFILE = 18; public static final int OPTION_ANTI_SPAM_QUESTION = 19; public static final int OPTION_ANTI_SPAM_ANS = 20; public static final int OPTION_BG_IMAGE_URL = 21; /* Passwords */ static final int OPTION_PASSWORD1 = 228; static final int OPTION_PASSWORD2 = 229; static final int OPTION_PASSWORD3 = 230; /* int */ public static final int OPTION_CONN_PROP = 64; public static final int OPTION_CL_SORT_BY = 65; public static final int OPTION_MESS_NOTIF_MODE = 66; public static final int OPTION_MESS_NOTIF_VOL = 67; public static final int OPTION_ONLINE_NOTIF_MODE = 68; public static final int OPTION_ONLINE_NOTIF_VOL = 69; public static final int OPTION_COST_PER_PACKET = 70; public static final int OPTION_COST_PER_DAY = 71; public static final int OPTION_COST_PACKET_LENGTH = 72; public static final int OPTION_COLOR_SCHEME = 73; public static final int OPTION_LIGHT_TIMEOUT = 74; public static final int OPTION_VIBRATOR = 75; public static final int OPTION_PRX_TYPE = 76; public static final int OPTION_EXT_CLKEY0 = 77; public static final int OPTION_EXT_CLKEYSTAR = 78; public static final int OPTION_EXT_CLKEY4 = 79; public static final int OPTION_EXT_CLKEY6 = 80; public static final int OPTION_EXT_CLKEYCALL = 81; public static final int OPTION_EXT_CLKEYPOUND = 82; public static final int OPTION_CONN_TYPE = 83; public static final int OPTION_VISIBILITY_ID = 85; public static final int OPTION_POPUP_WIN2 = 84; // This option is FREE static final int OPTION_CURR_ACCOUNT = 86; public static final int OPTION_GMT_OFFSET = 87; public static final int OPTION_TYPING_MODE = 88; public static final int OPTION_TYPING_VOL = 89; public static final int OPTION_LOCAL_OFFSET = 90; public static final int OPTION_RECONNECT_NUMBER = 91; public static final int OPTION_XSTATUS = 92; public static final int OPTION_DAYLIGHT_SAVING = 93; public static final int OPTION_FT_MODE = 94;// public static final int OPTION_CAMERA_LOCATOR = 95; public static final int OPTION_AUTOAWAY_TIME1 = 96; public static final int OPTION_AUTOAWAY_TIME2 = 97; public static final int OPTION_CAMERA_ENCODING = 98; public static final int OPTION_CAMERA_RES = 99; public static final int OPTION_CAPTION_OFFSET = 100; public static final int OPTION_BG_IMAGE = 101; public static final int OPTION_CURSOR_ALPHA = 102; public static final int OPTION_MENU_ALPHA = 103; public static final int OPTION_IMG_SCALE = 104; public static final int OPTION_BG_IMAGE_MODE = 105; /* boolean */ public static final int OPTION_KEEP_CONN_ALIVE = 128; public static final int OPTION_DISPLAY_DATE = 129; public static final int OPTION_CL_HIDE_OFFLINE = 130; public static final int OPTION_CP1251_HACK = 133; public static final int OPTION_CHAT_SMALL_FONT = 135; public static final int OPTION_USE_GROUPS = 136; public static final int OPTION_HISTORY = 137; public static final int OPTION_AUTO_CONNECT = 138; public static final int OPTION_SHADOW_CON = 139; public static final int OPTION_LIGHT_MANUAL = 140; public static final int OPTION_USE_SMILES = 141; public static final int OPTION_SHOW_LAST_MESS = 142; public static final int OPTION_MD5_LOGIN = 144; public static final int OPTION_FULL_SCREEN = 145; static final int OPTION_LANG_CHANGED = 148; public static final int OPTION_RECONNECT = 149; public static final int OPTION_SILENT_MODE = 150; public static final int OPTION_BRING_UP = 151; public static final int OPTION_CREEPING_LINE = 152; public static final int OPTION_SHOW_MESS_ICON = 153; public static final int OPTION_SHOW_NICK = 154; public static final int OPTION_SHOW_MESS_DATE = 155; public static final int OPTION_SHOW_MESS_CLRF = 156; public static final int OPTION_MESS_COLORED_TEXT = 157; public static final int OPTION_CL_CLIENTS = 158; public static final int OPTION_XSTATUSES = 159; public static final int OPTION_ASK_FOR_WEB_FT = 160; public static final int OPTION_USE_AUTOAWAY = 161; public static final int OPTION_DELIV_MES_INFO = 162; public static final int OPTION_MIRROR_MENU = 163; public static final int OPTION_SHOW_DELETED_CONT = 164; public static final int OPTION_SMALL_FONT = 165; public static final int OPTION_ANTI_SPAM = 166; public static final int OPTION_FULL_TEXTBOX = 167; public static final int OPTION_CL_HIDE_EMPTY = 168; public static final int OPTION_INIT_CAPS = 169; /* long */ public static final int OPTION_ONLINE_STATUS = 192; /* Filetransfer modes */ public static final int FS_MODE_WEB = 0; public static final int FS_MODE_NET = 1; /* Hotkey Actions */ public static final int HOTKEY_NONE = 0; public static final int HOTKEY_INFO = 2; public static final int HOTKEY_NEWMSG = 3; public static final int HOTKEY_ONOFF = 4; public static final int HOTKEY_OPTIONS = 5; public static final int HOTKEY_MENU = 6; public static final int HOTKEY_LOCK = 7; public static final int HOTKEY_HISTORY = 8; public static final int HOTKEY_MINIMIZE = 9; public static final int HOTKEY_CLI_INFO = 10; public static final int HOTKEY_FULLSCR = 11; public static final int HOTKEY_SOUNDOFF = 12; public static final int HOTKEY_USER_GROUPS = 13; public static final int HOTKEY_REQ_SM = 14; /* Constants for connection type */ public static final int CONN_TYPE_SOCKET = 0; public static final int CONN_TYPE_HTTP = 1; public static final int CONN_TYPE_PROXY = 2; /* Constants for method getSchemeColor to retrieving color from color scheme */ public static final int CLRSCHHEME_BACK = 1; // retrieving background color public static final int CLRSCHHEME_TEXT = 2; // retrieving text color public static final int CLRSCHHEME_OUTGOING = 3; // retrieving highlight color public static final int CLRSCHHEME_CURS = 4; // retrieving cursor background color public static final int CLRSCHHEME_CAP = 5; // retrieving caption background color public static final int CLRSCHHEME_INCOMING = 6; // retrieving highlight color public static final int CLRSCHHEME_CAP_TEXT = 7; // retrieving caption text color public static final int CLRSCHHEME_CURS_FRAME = 8; // retrieving cursor flame color public static final int BG_IMAGE_NONE = 0; public static final int BG_IMAGE_INT = 1; public static final int BG_IMAGE_EXT = 2; // Image placing modes public static final int BG_IMAGE_CENTER = 0; public static final int BG_IMAGE_STRETCH = 1; public static final int BG_IMAGE_PAVE = 2; /* Color schemes values */ final static private int[] colors = {// back text out text cursor caption in text cap text curs.brd. 0xFFFFFF, 0x000000, 0x0000FF, 0xE8E8FF, 0xF0F0F0, 0xFF0000, 0x000000, 0x6060A0, // Black on White 0x000000, 0xFFFFFF, 0x00FFFF, 0x0000C0, 0x505050, 0xFF0000, 0xFFFFFF, 0x0000FF, // White on Black 0x000080, 0xFFFFFF, 0x00FFFF, 0x0000D0, 0x0000B0, 0xFF0000, 0xFFFFFF, 0x0000FF, // White on Blue 0xFFA0C0, 0x000000, 0x4000C0, 0xFFE0D0, 0xFFE0D0, 0xC00040, 0x000000, 0xA02020, // Pink 0xE0FFE0, 0x000000, 0x008000, 0xC0FFC0, 0xB0FFB0, 0xFF0000, 0x000000, 0x00A000, // Green 0xF9F3EF, 0xD60000, 0x3A6793, 0xE3BFA1, 0xC37D3F, 0xDB8941, 0xFFFFF0, 0xD26464, // Sand 0x000000, 0x00D000, 0xD0D0D0, 0x005000, 0x007000, 0x00FF00, 0x80FF80, 0x008000, // Hacker 0xD5FDFD, 0x000000, 0x009090, 0xB0FFFF, 0x80FFFF, 0x0000FF, 0x000000, 0x00A0A0, // Aqua 0x8CB29C, 0x002250, 0x101080, 0xDBE1E7, 0x648C64, 0x801010, 0x8CFB6B, 0x5CCB3B, // Green Night 0xFFFFFF, 0x000000, 0x0000FF, 0xE8E8FF, 0xC00000, 0xFF0000, 0xFFFFFF, 0x9080C0, // A'la opera mini 0xCCCCCC, 0x000000, 0x336699, 0xC0C0C0, 0xA5AECC, 0x336633, 0x000000, 0x666666, // Ergonomic 0xBAB190, 0x000000, 0x930a0a, 0xCCCC99, 0xCC9966, 0x336633, 0xFFFFFF, 0x666666, // Bronze golem 0xFFFFFF, 0x175A85, 0x336699, 0xCCEBFF, 0x175A85, 0x336633, 0xFFFFFF, 0x97b7c7, // Snowy frost 0x292e31, 0xcaa452, 0xc8c8c8, 0x616560, 0x636771, 0x448844, 0xFFFFFF, 0x31333b, // WA Bento 0x000000, 0xFF0000, 0xFFF314, 0xFF5500, 0x000000, 0x448844, 0xFFFFFF, 0xFF0000, // Quake 0x003300, 0xDA6600, 0xFF0000, 0xFF5500, 0x003300, 0x448844, 0xFFFFFF, 0xFF0000, // Green2 0xCCCCCC, 0x000000, 0x000000, 0x425173, 0xCCCCCC, 0x336600, 0xFFFFFF, 0x425173, // Silver 0x2d2d00, 0xffc549, 0x00FFFF, 0x86006e, 0x00560a, 0x00ff1b, 0x30ff47, 0xff00d2, // Neon }; //#sijapp cond.if modules_DEBUGLOG is "true" # private static boolean checkKeys = false; //#sijapp cond.end # static int accountKeys[] = { Options.OPTION_UIN1, Options.OPTION_PASSWORD1, Options.OPTION_UIN2, Options.OPTION_PASSWORD2, Options.OPTION_UIN3, Options.OPTION_PASSWORD3, }; /**************************************************************************/ final public static String emptyString = new String(); // Hashtable containing all option key-value pairs static private Hashtable options; // Options form static OptionsForm optionsForm; public Options() { // Try to load option values from record store and construct options form try { options = new Hashtable(); //#sijapp cond.if modules_DEBUGLOG is "true"# checkKeys = true; setDefaults(); checkKeys = false; //#sijapp cond.else# //# Options.setDefaults(); //# resetLangDependedOpts(); //#sijapp cond.end # load(); if (getBoolean(OPTION_LANG_CHANGED)) { setBoolean(OPTION_LANG_CHANGED, false); resetLangDependedOpts(); //System.out.println("Options.resetLangDependedOpts()"); } } // Use default values if loading option values from record store failed catch (Exception e) { setDefaults(); resetLangDependedOpts(); } ResourceBundle.setCurrUiLanguage(getString(Options.OPTION_UI_LANGUAGE)); /* Default values for status strings */ setDefaultStatusStrings(statusStrings, StatusInfo.TYPE_STATUS); setDefaultStatusStrings(xStatusStrings, StatusInfo.TYPE_X_STATUS); String awayStatStr = ResourceBundle.getString("status_message_text"); setStatusString(StatusInfo.TYPE_STATUS, ContactList.STATUS_AWAY, awayStatStr); setStatusString(StatusInfo.TYPE_STATUS, ContactList.STATUS_DND, awayStatStr); setStatusString(StatusInfo.TYPE_STATUS, ContactList.STATUS_NA, awayStatStr); setStatusString(StatusInfo.TYPE_STATUS, ContactList.STATUS_OCCUPIED, awayStatStr); /* Load values for status strings */ loadStatusStrings(statusStrings, statusRmsName); loadStatusStrings(xStatusStrings, xStatusRmsName); } /* Set default values This is done before loading because older saves may not contain all new values */ static private void setDefaults() { setString(Options.OPTION_UIN1, emptyString); setString(Options.OPTION_PASSWORD1, emptyString); setString (Options.OPTION_SRV_HOST, "login.icq.com,login.oscar.aol.com,ibucp-vip-d.blue.aol.com"); setString(Options.OPTION_SRV_PORT, "5190"); setBoolean(Options.OPTION_KEEP_CONN_ALIVE, true); setBoolean(Options.OPTION_RECONNECT, true); setInt(Options.OPTION_RECONNECT_NUMBER, 10); setString(Options.OPTION_CONN_ALIVE_INVTERV, "120"); setInt(Options.OPTION_CONN_PROP, 0); setInt(Options.OPTION_CONN_TYPE, 0); //#sijapp cond.if target isnot "MOTOROLA"# setBoolean(Options.OPTION_SHADOW_CON, false); //#sijapp cond.end# setBoolean(Options.OPTION_MD5_LOGIN, true); setBoolean(Options.OPTION_AUTO_CONNECT, false); setString(Options.OPTION_HTTP_USER_AGENT, "unknown"); setString(Options.OPTION_HTTP_WAP_PROFILE, "unknown"); setString(Options.OPTION_UI_LANGUAGE, ResourceBundle.langAvailable[0]); setBoolean(Options.OPTION_DISPLAY_DATE, false); setInt(Options.OPTION_CL_SORT_BY, 0); setBoolean(Options.OPTION_CL_HIDE_OFFLINE, false); setBoolean(Options.OPTION_CL_HIDE_EMPTY, false); //#sijapp cond.if target="MIDP2" | target="SIEMENS2" | target="RIM"# setInt(Options.OPTION_MESS_NOTIF_MODE, 2); setString(Options.OPTION_MESS_NOTIF_FILE, "message.wav"); setInt(Options.OPTION_MESS_NOTIF_VOL, 50); setInt(Options.OPTION_ONLINE_NOTIF_MODE, 2); setString(Options.OPTION_ONLINE_NOTIF_FILE, "online.wav"); setInt(Options.OPTION_ONLINE_NOTIF_VOL, 50); setInt(Options.OPTION_TYPING_VOL, 50); setString(Options.OPTION_TYPING_FILE, "typing.wav"); //#sijapp cond.elseif target is "MOTOROLA"# setInt (Options.OPTION_MESS_NOTIF_MODE, 2); setString (Options.OPTION_MESS_NOTIF_FILE, "message.mp3"); setInt (Options.OPTION_MESS_NOTIF_VOL, 50); setInt (Options.OPTION_ONLINE_NOTIF_MODE, 2); setString (Options.OPTION_ONLINE_NOTIF_FILE, "online.mp3"); setInt (Options.OPTION_ONLINE_NOTIF_VOL, 50); setInt (Options.OPTION_TYPING_VOL, 50); setString (Options.OPTION_TYPING_FILE, "typing.mp3"); setBoolean(Options.OPTION_LIGHT_MANUAL, true); //#sijapp cond.end# //#sijapp cond.if target!="DEFAULT"# setInt(Options.OPTION_TYPING_MODE, 2);//#sijapp cond.end# //#sijapp cond.if target="MIDP2"# setBoolean(Options.OPTION_LIGHT_MANUAL, false); //#sijapp cond.end# //#sijapp cond.if target="MOTOROLA" | target="MIDP2"# setInt (Options.OPTION_LIGHT_TIMEOUT, 5); //#sijapp cond.end #
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -