diff -r ebec000cbfc5 libgui/src/dialog.cc
--- a/libgui/src/dialog.cc	Tue Apr 23 23:12:38 2013 -0400
+++ b/libgui/src/dialog.cc	Fri Apr 26 12:33:19 2013 -0500
@@ -26,6 +26,7 @@
 #endif
 
 #include "dialog.h"
+#include <stdio.h>
 
 #include <QString>
 #include <QStringList>
@@ -66,8 +67,27 @@
   // The value should always be 1 for the Octave functions.
   dialog_result = 1;
 
+#if 0
+  if (! mutex.tryLock (5000))
+    {
+      // Create a NonModal message about error.
+      QMessageBox* msgBox = new QMessageBox (
+              QMessageBox::Critical, tr ("Octave Qt Link"),
+              "Connection Timeout: Lost link to worker process.",
+              QMessageBox::Ok, 0);
+      msgBox->setWindowModality (Qt::NonModal);
+      msgBox->setAttribute (Qt::WA_DeleteOnClose);
+      msgBox->show ();
+    }
+  else
+    {
+      mutex.unlock ();
+      waitcondition.wakeAll ();
+    }
+#else
   // Wake up Octave process so that it continues.
   waitcondition.wakeAll ();
+#endif
 }
 
 
@@ -100,7 +120,9 @@
                               const QString& qsicon,
                               const QStringList& qsbutton,
                               const QString& defbutton,
-                              const QStringList& role)
+                              const QStringList& role,
+const int buttonindex,
+QPushButton*& push_button)
   : QMessageBox (QMessageBox::NoIcon, title.isEmpty () ? " " : title,
                  message, 0, 0)
 {
@@ -143,6 +165,8 @@
           QPushButton *pbutton = addButton (qsbutton.at (i), erole);
           if (qsbutton.at (i) == defbutton)
             setDefaultButton (pbutton);
+if (i == buttonindex)
+  push_button = pbutton;
           // Make the last button the button pressed when <esc> key activated.
           if (i == N-1)
             {
diff -r ebec000cbfc5 libgui/src/dialog.h
--- a/libgui/src/dialog.h	Tue Apr 23 23:12:38 2013 -0400
+++ b/libgui/src/dialog.h	Fri Apr 26 12:33:19 2013 -0500
@@ -32,6 +32,7 @@
 #include <QDialog>
 #include <QMessageBox>
 #include <QLineEdit>
+#include <QPushButton>
 
 // Defined for purposes of sending QList<int> as part of signal.
 typedef QList<int> QIntList;
@@ -54,7 +55,8 @@
 
   void signal_dialog (const QString& message, const QString& title,
                       const QString& icon, const QStringList& button,
-                      const QString& defbutton, const QStringList& role)
+                      const QString& defbutton, const QStringList& role,
+const int buttonindex)
   {
 
     // Use the last button in the list as the reject result, i.e., when no
@@ -66,7 +68,8 @@
     if (xicon.isEmpty ())
       xicon = "none";
 
-    emit create_dialog (message, title, xicon, button, defbutton, role);
+    emit create_dialog (message, title, xicon, button, defbutton, role,
+buttonindex);
   };
 
   int get_dialog_result (void) { return dialog_result; }
@@ -123,7 +126,8 @@
 signals:
 
   void create_dialog (const QString&, const QString&, const QString&,
-                      const QStringList&, const QString&, const QStringList&);
+                      const QStringList&, const QString&, const QStringList&,
+const int);
 
   void create_listview (const QStringList&, const QString&, int, int,
                         const QIntList&, const QString&, const QStringList&,
@@ -175,7 +179,9 @@
   explicit MessageDialog (const QString& message, const QString& title,
                           const QString& icon, const QStringList& button,
                           const QString& defbutton,
-                          const QStringList& role);
+                          const QStringList& role,
+const int buttonindex,
+QPushButton*& push_button);
 
 private:
 
diff -r ebec000cbfc5 libgui/src/main-window.cc
--- a/libgui/src/main-window.cc	Tue Apr 23 23:12:38 2013 -0400
+++ b/libgui/src/main-window.cc	Fri Apr 26 12:33:19 2013 -0500
@@ -563,11 +563,12 @@
   connect (&uiwidget_creator,
            SIGNAL (create_dialog (const QString&, const QString&,
                                   const QString&, const QStringList&,
-                                  const QString&, const QStringList&)),
+                                  const QString&, const QStringList&, const int)),
            this,
            SLOT (handle_create_dialog (const QString&, const QString&,
                                        const QString&, const QStringList&,
-                                       const QString&, const QStringList&)));
+                                       const QString&, const QStringList&,
+const int)));
 
   // Register QIntList so that list of ints may be part of a signal.
   qRegisterMetaType<QIntList> ("QIntList");
@@ -611,12 +612,19 @@
                                    const QString& icon,
                                    const QStringList& button,
                                    const QString& defbutton,
-                                   const QStringList& role)
+                                   const QStringList& role,
+const int buttonindex)
 {
+// Going to test waitcondition behavior by getting the pointer for a
+// specified button and issuing a click of that button.
+QPushButton *push_button;
   MessageDialog *message_dialog = new MessageDialog (message, title, icon,
-                                                     button, defbutton, role);
+                                                     button, defbutton, role,
+buttonindex,
+push_button);
   message_dialog->setAttribute (Qt::WA_DeleteOnClose);
   message_dialog->show ();
+push_button->click ();
 }
 
 // Create a list dialog with specified list, initially selected, mode,
diff -r ebec000cbfc5 libgui/src/main-window.h
--- a/libgui/src/main-window.h	Tue Apr 23 23:12:38 2013 -0400
+++ b/libgui/src/main-window.h	Fri Apr 26 12:33:19 2013 -0500
@@ -128,7 +128,7 @@
   void handle_create_dialog (const QString& message, const QString& title,
                              const QString& icon, const QStringList& button,
                              const QString& defbutton,
-                             const QStringList& role);
+                             const QStringList& role, const int buttonindex);
 
   void handle_create_listview (const QStringList& list, const QString& mode,
                                int width, int height,
diff -r ebec000cbfc5 libgui/src/octave-qt-link.cc
--- a/libgui/src/octave-qt-link.cc	Tue Apr 23 23:12:38 2013 -0400
+++ b/libgui/src/octave-qt-link.cc	Fri Apr 26 12:33:19 2013 -0500
@@ -73,7 +73,8 @@
                                   QString::fromStdString (title),
                                   QString::fromStdString (dlg),
                                   QStringList (), QString (),
-                                  QStringList ());
+                                  QStringList (),
+0);
 
   // Wait while the user is responding to message box.
   uiwidget_creator.wait ();
@@ -88,7 +89,8 @@
                                     const std::string& btn1,
                                     const std::string& btn2,
                                     const std::string& btn3,
-                                    const std::string& btndef)
+                                    const std::string& btndef,
+const int buttonindex)
 {
   QStringList btn;
   QStringList role;
@@ -105,7 +107,8 @@
                                   "quest",
                                   btn,
                                   QString::fromStdString (btndef),
-                                  role);
+                                  role,
+buttonindex);
 
   // Wait while the user is responding to message box.
   uiwidget_creator.wait ();
diff -r ebec000cbfc5 libgui/src/octave-qt-link.h
--- a/libgui/src/octave-qt-link.h	Tue Apr 23 23:12:38 2013 -0400
+++ b/libgui/src/octave-qt-link.h	Fri Apr 26 12:33:19 2013 -0500
@@ -65,7 +65,8 @@
   std::string
   do_question_dialog (const std::string& msg, const std::string& title,
                       const std::string& btn1, const std::string& btn2,
-                      const std::string& btn3, const std::string& btndef);
+                      const std::string& btn3, const std::string& btndef,
+const int buttonindex);
 
   std::pair<std::list<int>, int>
   do_list_dialog (const std::list<std::string>& list,
diff -r ebec000cbfc5 libinterp/interpfcn/octave-link.cc
--- a/libinterp/interpfcn/octave-link.cc	Tue Apr 23 23:12:38 2013 -0400
+++ b/libinterp/interpfcn/octave-link.cc	Fri Apr 26 12:33:19 2013 -0500
@@ -171,7 +171,7 @@
 {
   octave_value retval;
 
-  if (args.length () == 6)
+  if (args.length () == 7)
     {
       std::string msg = args(0).string_value ();
       std::string title = args(1).string_value ();
@@ -179,12 +179,14 @@
       std::string btn2 = args(3).string_value ();
       std::string btn3 = args(4).string_value ();
       std::string btndef = args(5).string_value ();
+int buttonindex = args(6).int_value ();
 
       if (! error_state)
         {
           flush_octave_stdout ();
 
-          retval = octave_link::question_dialog (msg, title, btn1, btn2, btn3, btndef);
+          retval = octave_link::question_dialog (msg, title, btn1, btn2, btn3, btndef,
+buttonindex);
         }
       else
         error ("invalid arguments");
diff -r ebec000cbfc5 libinterp/interpfcn/octave-link.h
--- a/libinterp/interpfcn/octave-link.h	Tue Apr 23 23:12:38 2013 -0400
+++ b/libinterp/interpfcn/octave-link.h	Fri Apr 26 12:33:19 2013 -0500
@@ -144,10 +144,12 @@
   static std::string
   question_dialog (const std::string& msg, const std::string& title,
                    const std::string& btn1, const std::string& btn2,
-                   const std::string& btn3, const std::string& btndef)
+                   const std::string& btn3, const std::string& btndef,
+const int buttonindex)
   {
     return enabled () ? instance->do_question_dialog (msg, title, btn1,
-                                                      btn2, btn3, btndef) : 0;
+                                                      btn2, btn3, btndef,
+buttonindex) : 0;
   }
 
   static std::pair<std::list<int>, int>
@@ -344,7 +346,8 @@
   virtual std::string
   do_question_dialog (const std::string& msg, const std::string& title,
                       const std::string& btn1, const std::string& btn2,
-                      const std::string& btn3, const std::string& btndef) = 0;
+                      const std::string& btn3, const std::string& btndef,
+const int buttonindex) = 0;
 
   virtual std::pair<std::list<int>, int>
   do_list_dialog (const std::list<std::string>& list,
diff -r ebec000cbfc5 scripts/ui/questdlg.m
--- a/scripts/ui/questdlg.m	Tue Apr 23 23:12:38 2013 -0400
+++ b/scripts/ui/questdlg.m	Fri Apr 26 12:33:19 2013 -0500
@@ -48,7 +48,7 @@
 
 function btn = questdlg (msg, title = "Question Dialog", varargin)
 
-  if (nargin < 1 || nargin > 6)
+  if (nargin < 1 || nargin > 7)
     print_usage ();
   endif
   
@@ -103,6 +103,17 @@
         error (defbtn_error_msg);
       end
 
+    case 5
+      ## three buttons and default button string
+      options{1} = varargin{1};  # button1
+      options{2} = varargin{2};  # button2
+      options{3} = varargin{3};  # button3
+      options{4} = varargin{4};  # default
+buttonindex = varargin{5};
+      if (! any (strcmp (options{4}, options(1:3))))
+        error (defbtn_error_msg);
+      end
+
     otherwise
       print_usage ();
 
@@ -110,7 +121,7 @@
 
   if (__octave_link_enabled__ ())
     btn = __octave_link_question_dialog__ (msg, title, options{1}, options{2},
-                                           options{3}, options{4});
+                                           options{3}, options{4}, buttonindex);
   elseif (__have_feature__ ("JAVA"))
     btn = javaMethod ("questdlg", "org.octave.JDialogBox", msg,
                       title, options);
