hi,

unless there is some comment, i'll commit this patch
for http://bugzilla.lyx.org/show_bug.cgi?id=5430 .
i reviewd the GuiAlert::askForText function and found out that
except vcs backend nobody else uses it.

pavel
diff --git a/src/LyXVC.cpp b/src/LyXVC.cpp
index 7f5beea..770706c 100644
--- a/src/LyXVC.cpp
+++ b/src/LyXVC.cpp
@@ -132,12 +132,12 @@ void LyXVC::registrer()
        docstring response;
        bool ok = Alert::askForText(response, _("LyX VC: Initial description"),
                        _("(no initial description)"));
-       if (!ok || response.empty()) {
-               // should we insist on checking response.empty()?
+       if (!ok) {
                LYXERR(Debug::LYXVC, "LyXVC: user cancelled");
                return;
        }
-
+       if (response.empty())
+               response = _("(no initial description)");
        vcs->registrer(to_utf8(response));
 }
 
diff --git a/src/frontends/alert.h b/src/frontends/alert.h
index 004a179..b4e1237 100644
--- a/src/frontends/alert.h
+++ b/src/frontends/alert.h
@@ -54,7 +54,10 @@ void error(docstring const & title, docstring const & 
message);
  */
 void information(docstring const & title, docstring const & message);
 
-/// Asks for a text. DO NOT USE !!
+/**
+ * Asks for a text. Returns true for OK. Obtained message is in response
+ * (even empty string). dflt stands for default message in the dialog.
+ */
 bool askForText(docstring & response, docstring const & msg,
        docstring const & dflt = docstring());
 
diff --git a/src/frontends/qt4/GuiAlert.cpp b/src/frontends/qt4/GuiAlert.cpp
index 75da5ee..e399835 100644
--- a/src/frontends/qt4/GuiAlert.cpp
+++ b/src/frontends/qt4/GuiAlert.cpp
@@ -236,7 +236,7 @@ bool askForText(docstring & response, docstring const & msg,
                QLineEdit::Normal,
                toqstr(dflt), &ok);
 
-       if (ok && !text.isEmpty()) {
+       if (ok) {
                response = qstring_to_ucs4(text);
                return true;
        }

Reply via email to