[PC-BSD Commits] r786 - pcbsd/trunk/NetworkManager
svn at pcbsd.org
svn at pcbsd.org
Thu Oct 11 06:34:36 PDT 2007
Author: tim
Date: 2007-10-11 06:34:36 -0700 (Thu, 11 Oct 2007)
New Revision: 786
Modified:
pcbsd/trunk/NetworkManager/networkman.ui
pcbsd/trunk/NetworkManager/networkman.ui.h
Log:
Implemented enchancement #11 - Fixed the hack r622 implemented properly. Also fixed the checkPPOE checkGlobalText connection.
Modified: pcbsd/trunk/NetworkManager/networkman.ui
===================================================================
--- pcbsd/trunk/NetworkManager/networkman.ui 2007-10-11 13:30:41 UTC (rev 785)
+++ pcbsd/trunk/NetworkManager/networkman.ui 2007-10-11 13:34:36 UTC (rev 786)
@@ -824,6 +824,7 @@
<include location="local" impldecl="in declaration">kcmodule.h</include>
<include location="local" impldecl="in declaration">kaboutdata.h</include>
<include location="local" impldecl="in declaration">kpopupmenu.h</include>
+ <include location="global" impldecl="in declaration">qregexp.h</include>
<include location="local" impldecl="in implementation">networkman.ui.h</include>
</includes>
<variables>
@@ -846,6 +847,8 @@
<variable access="private">KPopupMenu *popup;</variable>
<variable access="private">QString DevsUp[100];</variable>
<variable access="private">bool Changed;</variable>
+ <variable access="private">QColor colourWhite;</variable>
+ <variable access="private">QColor colourRed;</variable>
</variables>
<signals>
<signal>changed(bool)</signal>
@@ -859,7 +862,7 @@
<slot access="private">refreshDevices()</slot>
<slot access="private">slotSysTray()</slot>
<slot>save()</slot>
- <slot access="private">slotCheckGlobalText()</slot>
+ <slot>slotCheckGlobalText()</slot>
<slot access="private">slotDoubleClick( QListBoxItem * item )</slot>
<slot>slotPPPOECheckBox()</slot>
<slot access="private">slotPPPOEChanged()</slot>
Modified: pcbsd/trunk/NetworkManager/networkman.ui.h
===================================================================
--- pcbsd/trunk/NetworkManager/networkman.ui.h 2007-10-11 13:30:41 UTC (rev 785)
+++ pcbsd/trunk/NetworkManager/networkman.ui.h 2007-10-11 13:34:36 UTC (rev 786)
@@ -17,6 +17,8 @@
{
Changed = FALSE;
+ colourWhite = QColor(255, 255, 255);
+ colourRed = QColor(255, 78, 78);
// Set tray icon disabled, since we may be running under root mode
checkSysTray->setEnabled(FALSE);
@@ -32,7 +34,7 @@
connect(listNetDev, SIGNAL(selectionChanged()), this, SLOT(DevSelectionChanged()) );
connect(pushConfigure, SIGNAL(clicked()), this, SLOT(PropertiesSlot()) );
connect(checkSysTray, SIGNAL(clicked()), this, SLOT(slotSysTray()) );
- connect(checkPPPOE, SIGNAL(clicked()), this, SLOT(slotCheckGlobalText( "")) );
+ connect(checkPPPOE, SIGNAL(clicked()), this, SLOT(slotCheckGlobalText()) );
connect(listNetDev, SIGNAL(doubleClicked( QListBoxItem *) ), this, SLOT(slotDoubleClick(QListBoxItem *) ) );
// Connect the slots to determine if we need to enable the apply button
@@ -890,8 +892,10 @@
void NetworkMan::slotCheckGlobalText()
{
+ QRegExp hostnameRegExp("^(([a-z0-9][a-z0-9-]*[a-z0-9])|([a-z0-9]+))$");
+ textGlobalError->setText("");
+ lineHostname->setBackgroundColor(colourWhite);
-
if ( lineDNS1->text() != "..." && ! checkRange(lineDNS1->text() ) ) {
QMessageBox::warning( this, tr("Warning"),
tr("DNS #1 is out of range! (") + lineDNS1->text() + tr(") Fields must be between 0-255.") );
@@ -911,8 +915,18 @@
return;
}
- //TODO - Warn about invalid hostnames and regexp their validity. Since we're in an interface freeze right now, we'll just have to strip out whitespace instead.
- lineHostname->setText(lineHostname->text().remove(" "));
+ /**
+ Hostnames must:
+ - Contain only a-z, 0-9, and hyphens (-)
+ - Not have a hyphen as the first or last character
+ **/
+ lineHostname->setText(lineHostname->text().lower());
+ if (lineHostname->text().isEmpty()) textGlobalError->setText(tr("Please enter a hostname"));
+ else if (hostnameRegExp.search(lineHostname->text()) == -1)
+ {
+ textGlobalError->setText(tr("Hostname may only contain letters and numbers"));
+ lineHostname->setBackgroundColor(colourRed);
+ }
Changed=TRUE;
emit changed(TRUE);
More information about the Commits
mailing list