From 9f52832cc12250dc7e0ec5e6ec31b09f03f6a15b Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Fri, 10 Jul 2015 10:09:27 +0200 Subject: [client] always show main menu and popup login window if not logged in yet current check to see if the user needs to login is simply to try and get the sat token. If this returns null, then we pop up the login window. Currently this always happen. Maybe we'll later have a better way to check whether the user is logged in or not. --- .../main/java/org/openslx/dozmod/gui/window/LoginWindow.java | 6 ++++-- .../main/java/org/openslx/dozmod/gui/window/MainWindow.java | 11 ++++++++--- 2 files changed, 12 insertions(+), 5 deletions(-) (limited to 'dozentenmodul/src/main/java') diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LoginWindow.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LoginWindow.java index 1a497ffc..6896835a 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LoginWindow.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LoginWindow.java @@ -313,13 +313,15 @@ public class LoginWindow extends LoginWindowLayout { // TODO HACK HACK ThriftManager.setSatelliteAddress("132.230.8.113"); - MainWindow.setContent(new MainMenuWindow(getShell())); + // TODO set session stuff + // now read the config to see if the user already agreed to the disclaimer if (!Config.getDisclaimerAgreement()) MainWindow.openPopup(DisclaimerWindow.class, true); if (!Config.getVmwareLicenseAgreement()) MainWindow.openPopup(VirtualizerNoticeWindow.class, true); - // TODO: See MainWindowLayout comments + + this.getParent().dispose(); } diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/MainWindow.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/MainWindow.java index 75b37475..0dc6b5a7 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/MainWindow.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/MainWindow.java @@ -19,6 +19,7 @@ import org.eclipse.swt.widgets.MessageBox; import org.eclipse.swt.widgets.Monitor; import org.eclipse.swt.widgets.Shell; import org.openslx.dozmod.gui.helper.MessageType; +import org.openslx.dozmod.thrift.Session; import org.openslx.thrifthelper.ThriftManager; import org.openslx.thrifthelper.ThriftManager.ErrorCallback; @@ -143,8 +144,8 @@ public abstract class MainWindow { // Set layout for the mainshell, items added to the shell should get a gridData mainShell.setLayout(new GridLayout(1, true)); - // Add LoginWindow as the first window to be shown - setContent(new LoginWindow(mainShell)); + // always show the main menu + setContent(new MainMenuWindow(mainShell)); // center the window on the primary monitor Monitor primary = display.getPrimaryMonitor(); @@ -159,7 +160,11 @@ public abstract class MainWindow { mainShell.pack(); mainShell.open(); - LOGGER.info("GUI initialised."); + // here we can check for Session information + if (Session.getSatelliteToken() == null) { + // User did not login, show the login mask + openPopup(LoginWindow.class, true); + } while (!mainShell.isDisposed()) { if (!display.readAndDispatch()) -- cgit v1.2.3-55-g7522