summaryrefslogtreecommitdiff
path: root/wizard/network.cpp
blob: 9d45fc5e18c3bacc0d5ede72555eb6dc80df8813 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <QtGui>
#include "network.h"
#include "../listdelegate.h"
#include "../listitem.h"

wpNetwork::wpNetwork(QWidget *parent) : QWizardPage(parent)
{
  setupUi(this);
  connect(hostname, SIGNAL(textChanged(QString)), this, SLOT(updateStatus()));
  
  QValidator* hostnameValidator = new QRegExpValidator(QRegExp("[a-zA-Z0-9][a-zA-Z0-9.-]*[a-zA-Z0-9]"), this);
  hostname->setValidator( hostnameValidator );
  
  backend = Backend::instance();
}

void wpNetwork::initializePage()
{
  hostname->setText(backend->cfg("hostname"));
  updateStatus();
}

void wpNetwork::updateStatus()
{
  emit completeChanged();
}

bool wpNetwork::isComplete() const
{
  if(hostname->text().length()) return true;
  return false;
}

bool wpNetwork::validatePage()
{
  if(!isComplete()) return false;
  backend->cfg("hostname", hostname->text());
  return true;
}