private void saveSettings() throws InvalidAttributeValueException { if (userForm.getNickname().isEmpty()) throw new InvalidAttributeValueException("Přezdívka musí být vyplněna"); else if (userForm.getUsername().isEmpty()) throw new InvalidAttributeValueException("Uživatelské jméno musí být vyplněno"); settings.setUserProperty("nickname", userForm.getNickname()); settings.setUserProperty("altnickname", userForm.getAltNickname()); settings.setUserProperty("username", userForm.getUsername()); settings.setUserProperty("realname", userForm.getRealname()); settings.setUserProperty("email", userForm.getEmail()); settings.setEventEnabled("log-chat", eventsForm.isLogChatChecked()); settings.setEventEnabled("rejoin-after-kick", eventsForm.isRejoinChecked()); settings.setEventEnabled("clickable-links", eventsForm.isClickableLinksChecked()); settings.setEventEnabled("ask-for-quit", eventsForm.isAskForQuitChecked()); settings.setViewEnabled("display-topic", viewForm.isDisplayTopicChecked()); settings.setViewEnabled("timestamp-enabled", viewForm.isTimestampEnabled()); settings.setViewTimestampFormat(viewForm.getTimestampFormat()); settings.setBlockedNicknames(blockedForm.getBlockedNicknames()); settings.store(); }
private void reloadSettings() { userForm.setNickname(settings.getUserProperty("nickname")); userForm.setAltNickname(settings.getUserProperty("altnickname")); userForm.setUsername(settings.getUserProperty("username")); userForm.setRealname(settings.getUserProperty("realname")); userForm.setEmail(settings.getUserProperty("email")); eventsForm.setLogChatChecked(settings.isEventEnabled("log-chat")); eventsForm.setRejoinChecked(settings.isEventEnabled("rejoin-after-kick")); eventsForm.setClickableLinksChecked(settings.isEventEnabled("clickable-links")); eventsForm.setAskForQuitChecked(settings.isEventEnabled("ask-for-quit")); viewForm.setDisplayTopicChecked(settings.isViewEnabled("display-topic")); viewForm.setTimestampEnabled(settings.isViewEnabled("timestamp-enabled")); viewForm.setTimestampFormat(settings.getViewTimestampFormat()); blockedForm.setBlockedNicknames(settings.getBlockedNicknames()); }