add validator for prefix
diff --git a/settingdialog.cpp b/settingdialog.cpp
index be0bb42..d9640dc 100644
--- a/settingdialog.cpp
+++ b/settingdialog.cpp
@@ -1,4 +1,6 @@
 #include "settingdialog.h"
+#include <QRegExp>
+#include <QValidator>
 
 SettingDialog::SettingDialog(QWidget *parent, QString nick, QString chatroom, QString prefix)
   : QDialog(parent)
@@ -7,6 +9,14 @@
   nickEdit->setPlaceholderText(nick);
   roomEdit->setPlaceholderText(chatroom);
   prefixEdit->setPlaceholderText(prefix);
+
+  // simple validator for ccnx prefix
+  QRegExp rx("(^(/[^/]+)+$)|(^/$)");
+  QValidator *validator = new QRegExpValidator(rx, this);
+  prefixEdit->setValidator(validator);
+
+  cancelButton->setDefault(true);
+
   connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
   connect(okButton, SIGNAL(clicked()), this, SLOT(update()));
 }
@@ -17,3 +27,15 @@
   emit updated(nickEdit->text(), roomEdit->text(), prefixEdit->text()); 
   accept();
 }
+
+void
+SettingDialog::keyPressEvent(QKeyEvent *e)
+{
+  switch(e->key()) {
+    case Qt::Key_Enter:
+      update();
+      break;
+    default:
+      QDialog::keyPressEvent(e);
+  }
+}