Changeset 544 for trunk/src/org/expeditee/gui/FrameUtils.java
- Timestamp:
- 11/27/13 15:29:04 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/gui/FrameUtils.java
r542 r544 709 709 } else if (attribute.equals("proxy")) { 710 710 proxySetup(item); 711 } else if (attribute.equals("settings")) { 712 generalSetup(item); 711 713 } else if (attribute.equals("fillcolorwheel")) { 712 714 Item.FILL_COLOR_WHEEL = getColorWheel(item); … … 736 738 return errors; 737 739 } 740 741 /** 742 * Loads general config from a frame 743 * @author jts21 744 */ 745 private static void generalSetup(Item item) { 746 try { 747 Frame child = item.getChild(); 748 String str, strLower; 749 String searchEngine = ""; 750 // gather all the settings 751 for(Item config : child.getAllItems()) { 752 if(config instanceof Text) { 753 str = config.getText().trim(); 754 strLower = str.toLowerCase(); 755 if(strLower.startsWith("searchengine:")) { 756 searchEngine = str.substring(13).trim(); 757 } 758 } 759 } 760 // set all the settings to their defined values or their defaults 761 if(searchEngine.length() == 0 || searchEngine.toLowerCase().equals("default")) { 762 UserSettings.searchEngine = UserSettings.defaultSearchEngine; 763 MessageBay.displayMessage("Defaulted search engine to " + UserSettings.searchEngine); 764 } else { 765 UserSettings.searchEngine = searchEngine; 766 MessageBay.displayMessage("Set search engine to " + UserSettings.searchEngine); 767 } 768 } catch(Exception e) { 769 System.err.println("Failed to load config"); 770 e.printStackTrace(); 771 } 772 } 738 773 739 774 /** … … 748 783 for(Item config : child.getAllItems()) { 749 784 if(config instanceof Text) { 750 String str = config.getText().trim().toLowerCase(); 751 if(str.startsWith("host:")) { 785 String str = config.getText().trim(); 786 String strLower = str.toLowerCase(); 787 if(strLower.startsWith("host:")) { 752 788 if(host != null) { 753 789 MessageBay.displayMessage("host was defined multiple times!", Color.ORANGE); 754 790 } 755 791 host = str.substring(5).trim(); 756 } else if(str .startsWith("port:")) {792 } else if(strLower.startsWith("port:")) { 757 793 if(port!= null) { 758 794 MessageBay.displayMessage("port was defined multiple times!", Color.ORANGE); 759 795 } 760 796 port = str.substring(5).trim(); 761 } else if(str .startsWith("user:")) {797 } else if(strLower.startsWith("user:")) { 762 798 if(user != null) { 763 799 MessageBay.displayMessage("user was defined multiple times!", Color.ORANGE); 764 800 } 765 801 user = str.substring(6).trim(); 766 } else if(str .startsWith("pass:")) { // unencrypted password802 } else if(strLower.startsWith("pass:")) { // unencrypted password 767 803 if(pass != null) { 768 804 MessageBay.displayMessage("pass was defined multiple times!", Color.ORANGE); 769 805 } 770 806 pass = str.substring(6).trim(); 771 } else if(str .startsWith("@iw:")) { // widget807 } else if(strLower.startsWith("@iw:")) { // widget 772 808 // check if it's a password widget 773 if(str .substring(4).trim().startsWith("org.expeditee.items.widgets.password")) {809 if(strLower.substring(4).trim().startsWith("org.expeditee.items.widgets.password")) { 774 810 if(passwordWidget == null) { 775 811 try {
Note:
See TracChangeset
for help on using the changeset viewer.