mirror of
https://gitlab.com/comunic/comunicterm
synced 2024-12-26 05:28:54 +00:00
Add main application menu
This commit is contained in:
parent
81258de89d
commit
d7c8ee85d8
@ -51,6 +51,13 @@ bool AccountHelper::signedIn()
|
||||
return mToken1.length() > 0 && mToken2.length() > 0 && mUserID > 0;
|
||||
}
|
||||
|
||||
void AccountHelper::SignOut()
|
||||
{
|
||||
mToken1 = "";
|
||||
mToken2 = "";
|
||||
mUserID = -1;
|
||||
}
|
||||
|
||||
bool AccountHelper::refreshUserID()
|
||||
{
|
||||
// Get current user ID
|
||||
|
@ -26,6 +26,7 @@ public:
|
||||
|
||||
|
||||
static bool signedIn();
|
||||
static void SignOut();
|
||||
|
||||
static bool refreshUserID();
|
||||
static int userID();
|
||||
|
19
mainmenu.cpp
19
mainmenu.cpp
@ -6,6 +6,9 @@
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <helpers/accounthelper.h>
|
||||
|
||||
#include "loginscreen.h"
|
||||
#include "mainmenu.h"
|
||||
|
||||
using namespace std;
|
||||
@ -107,7 +110,21 @@ void showMainMenu()
|
||||
free_item(my_items[i]);
|
||||
endwin();
|
||||
|
||||
cout << action << endl;
|
||||
|
||||
/* Process requested action */
|
||||
int o = 0;
|
||||
|
||||
// Logout
|
||||
if(o++ == action) {
|
||||
AccountHelper::SignOut();
|
||||
LoginScreen().exec(true);
|
||||
}
|
||||
|
||||
// Quit application
|
||||
else {
|
||||
cout << "Good bye !" << endl;
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
void print_in_middle(WINDOW *win, int starty, int startx, int width, char *string, chtype color)
|
||||
|
Loading…
Reference in New Issue
Block a user