aboutsummaryrefslogtreecommitdiffstats
path: root/vncviewer
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2011-05-17 12:42:51 +0000
committerPierre Ossman <ossman@cendio.se>2011-05-17 12:42:51 +0000
commit34771ae5a793c71603b7eab7013a394795f454a3 (patch)
tree850972ecddc8154a4832f87d0d40aaafa91423f0 /vncviewer
parent20ae1c872632d3e426b8f6fdfa0f8ac517551166 (diff)
downloadtigervnc-34771ae5a793c71603b7eab7013a394795f454a3.tar.gz
tigervnc-34771ae5a793c71603b7eab7013a394795f454a3.zip
Implement dialog for when both username and password is needed.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4424 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'vncviewer')
-rw-r--r--vncviewer/UserDialog.cxx66
1 files changed, 62 insertions, 4 deletions
diff --git a/vncviewer/UserDialog.cxx b/vncviewer/UserDialog.cxx
index db722e7c..e94ab71f 100644
--- a/vncviewer/UserDialog.cxx
+++ b/vncviewer/UserDialog.cxx
@@ -20,7 +20,14 @@
#include <stdio.h>
#include <string.h>
+#include <FL/Fl.H>
#include <FL/fl_ask.H>
+#include <FL/Fl_Window.H>
+#include <FL/Fl_Box.H>
+#include <FL/Fl_Input.H>
+#include <FL/Fl_Secret_Input.H>
+#include <FL/Fl_Button.H>
+#include <FL/Fl_Return_Button.H>
#include <rfb/util.h>
#include <rfb/Password.h>
@@ -32,6 +39,13 @@
using namespace rfb;
+static int ret_val = 0;
+
+static void button_cb(Fl_Widget *widget, void *val) {
+ ret_val = (fl_intptr_t)val;
+ widget->window()->hide();
+}
+
UserDialog::UserDialog()
{
}
@@ -64,17 +78,61 @@ void UserDialog::getUserPasswd(char** user, char** password)
}
if (!user) {
- *password = strDup(fl_password(_("VNC authentication"), ""));
+ fl_message_title(_("VNC authentication"));
+ *password = strDup(fl_password(_("Password:"), ""));
if (!*password)
throw rfb::Exception(_("Authentication cancelled"));
return;
}
- fl_alert(_("NOT IMPLEMENTED!"));
+ // Largely copied from FLTK so that we get the same look and feel
+ // as the simpler password input.
+ Fl_Window *win = new Fl_Window(410, 145, _("VNC authentication"));
+ win->callback(button_cb,(void *)0);
+
+ Fl_Input *username = new Fl_Input(70, 25, 300, 25, _("Username:"));
+ username->align(FL_ALIGN_TOP_LEFT);
+
+ Fl_Secret_Input *passwd = new Fl_Secret_Input(70, 70, 300, 25, _("Password:"));
+ passwd->align(FL_ALIGN_TOP_LEFT);
+
+ Fl_Box *icon = new Fl_Box(10, 10, 50, 50, "?");
+ icon->box(FL_UP_BOX);
+ icon->labelfont(FL_TIMES_BOLD);
+ icon->labelsize(34);
+ icon->color(FL_WHITE);
+ icon->labelcolor(FL_BLUE);
+
+ Fl_Button *button;
+
+ button = new Fl_Return_Button(310, 110, 90, 25, fl_ok);
+ button->align(FL_ALIGN_INSIDE|FL_ALIGN_WRAP);
+ button->callback(button_cb, (void*)0);
+
+ button = new Fl_Button(210, 110, 90, 25, fl_cancel);
+ button->align(FL_ALIGN_INSIDE|FL_ALIGN_WRAP);
+ button->callback(button_cb, (void*)1);
+ button->shortcut(FL_Escape);
+
+ win->end();
+
+ win->set_modal();
+
+ ret_val = -1;
+
+ win->show();
+ while (win->shown()) Fl::wait();
+
+ if (ret_val == 0) {
+ *user = strDup(username->value());
+ *password = strDup(passwd->value());
+ } else {
+ *user = strDup("");
+ *password = strDup("");
+ }
- *user = strDup("");
- *password = strDup("");
+ delete win;
}
bool UserDialog::showMsgBox(int flags, const char* title, const char* text)