[Kst] kdeextragear-2/kst/kst

Rick Chern rchern at interchange.ubc.ca
Tue Aug 17 23:19:44 CEST 2004


CVS commit by rchern: 

Don't allow blank window names, and strip beginning/ending whitespace from names (prevents two windows with names of "window" and "window  ").
Also explain why the window keeps on popping up when duplicate name is entered.


  M +8 -1      kst.cpp   1.212


--- kdeextragear-2/kst/kst/kst.cpp  #1.211:1.212
@@ -28,4 +28,6 @@
 #include <qprogressbar.h>
 #include <qpushbutton.h>
+#include <qregexp.h>
+#include <qvalidator.h>
 #include <qtimer.h>
 
@@ -1436,5 +1438,7 @@ QString KstApp::newWindow(bool prompt) {
   do {
     if (prompt) {
-      name = KLineEditDlg::getText(i18n("Enter a name for the new window:"), name, &ok, 0L);
+      QRegExp exp("\\S+.*");
+      QRegExpValidator val(exp, 0L);
+      name = KLineEditDlg::getText(i18n("Enter a name for the new window:"), name, &ok, 0L, &val).stripWhiteSpace();
     } else {
       name = KST::suggestWinName();
@@ -1448,4 +1452,7 @@ QString KstApp::newWindow(bool prompt) {
       return QString::null;
     }
+    if (prompt) {
+      KMessageBox::sorry(this, i18n("A window with the same name already exists.  Please enter a unique window name."));
+    }
   } while(true);
 





More information about the Kst mailing list