1
0
mirror of https://gitlab.com/comunic/comunicterm synced 2024-10-04 22:12:44 +00:00

Improve main menu

This commit is contained in:
Pierre HUBERT 2020-01-10 16:14:28 +01:00
parent d7c8ee85d8
commit 72e37b6242

View File

@ -18,17 +18,21 @@ using namespace std;
#define CTRLD 4 #define CTRLD 4
static char *choices[] = { static char *choices[] = {
"Conversations",
"Logout", "Logout",
"Quit" "Quit",
nullptr
}; };
void print_in_middle(WINDOW *win, int starty, int startx, int width, char *string, chtype color); void print_in_middle(WINDOW *win, int starty, int startx, int width, char *string, chtype color);
void showMainMenu() void showMainMenu()
{ ITEM **my_items; {
while(true) {
ITEM **my_items;
int c; int c;
MENU *my_menu; MENU *my_menu;
WINDOW *my_menu_win; WINDOW *my_menu_win;
int n_choices, i; int n_choices, i;
/* Initialize curses */ /* Initialize curses */
initscr(); initscr();
@ -114,10 +118,16 @@ void showMainMenu()
/* Process requested action */ /* Process requested action */
int o = 0; int o = 0;
// Logout // Open user conversations
if(o++ == action) { if(o++ == action) {
cerr << "TODO : implement conversations" << endl;
exit(-1);
}
// Logout
else if(o++ == action) {
AccountHelper::SignOut(); AccountHelper::SignOut();
LoginScreen().exec(true); LoginScreen().exec(false);
} }
// Quit application // Quit application
@ -125,6 +135,8 @@ void showMainMenu()
cout << "Good bye !" << endl; cout << "Good bye !" << endl;
exit(0); exit(0);
} }
}
} }
void print_in_middle(WINDOW *win, int starty, int startx, int width, char *string, chtype color) void print_in_middle(WINDOW *win, int starty, int startx, int width, char *string, chtype color)