Merge branch 'develop' into b/group-tab-update

This commit is contained in:
Leon Hofmeister 2020-09-23 21:37:48 +02:00
commit 84d80982e5
Signed by: delvh
GPG Key ID: 3DECE05F6D9A647C
3 changed files with 13 additions and 20 deletions

View File

@ -2,8 +2,6 @@ package envoy.client.data;
import static java.util.function.Function.identity; import static java.util.function.Function.identity;
import java.io.File;
import envoy.data.Config; import envoy.data.Config;
/** /**
@ -34,7 +32,6 @@ public final class ClientConfig extends Config {
super(".envoy"); super(".envoy");
put("server", "s", identity()); put("server", "s", identity());
put("port", "p", Integer::parseInt); put("port", "p", Integer::parseInt);
put("localDB", "db", File::new);
put("localDBSaveInterval", "db-si", Integer::parseInt); put("localDBSaveInterval", "db-si", Integer::parseInt);
} }
@ -50,12 +47,6 @@ public final class ClientConfig extends Config {
*/ */
public Integer getPort() { return (Integer) items.get("port").get(); } public Integer getPort() { return (Integer) items.get("port").get(); }
/**
* @return the local database specific to the client user
* @since Envoy Client v0.1-alpha
*/
public File getLocalDB() { return (File) items.get("localDB").get(); }
/** /**
* @return the amount of minutes after which the local database should be saved * @return the amount of minutes after which the local database should be saved
* @since Envoy Client v0.2-beta * @since Envoy Client v0.2-beta

View File

@ -70,9 +70,9 @@ public final class Startup extends Application {
// Initialize the local database // Initialize the local database
try { try {
final var localDBDir = new File(config.getHomeDirectory(), config.getLocalDB().getPath()); var localDBFile = new File(config.getHomeDirectory(), config.getServer());
logger.info("Initializing LocalDB at " + localDBDir); logger.info("Initializing LocalDB at " + localDBFile);
localDB = new LocalDB(localDBDir); localDB = new LocalDB(localDBFile);
} catch (IOException | EnvoyException e) { } catch (IOException | EnvoyException e) {
logger.log(Level.SEVERE, "Could not initialize local database: ", e); logger.log(Level.SEVERE, "Could not initialize local database: ", e);
new Alert(AlertType.ERROR, "Could not initialize local database!\n" + e).showAndWait(); new Alert(AlertType.ERROR, "Could not initialize local database!\n" + e).showAndWait();

View File

@ -205,13 +205,15 @@ public class GroupCreationTab implements EventListener {
@Event @Event
private void onContactOperation(ContactOperation operation) { private void onContactOperation(ContactOperation operation) {
switch (operation.getOperationType()) { if (operation.get() instanceof User) Platform.runLater(() -> {
case ADD: switch (operation.getOperationType()) {
if (operation.get() instanceof User) Platform.runLater(() -> userList.getItems().add((User) operation.get())); case ADD:
break; userList.getItems().add((User) operation.get());
case REMOVE: break;
Platform.runLater(() -> userList.getItems().removeIf(u -> u.equals(operation.get()))); case REMOVE:
break; userList.getItems().removeIf(u -> u.equals(operation.get()));
} break;
}
});
} }
} }