Class: Y2Network::Widgets::RemoteIP

Inherits:
CWM::InputField
  • Object
show all
Defined in:
src/lib/y2network/widgets/remote_ip.rb

Instance Method Summary collapse

Constructor Details

#initialize(settings) ⇒ RemoteIP

Returns a new instance of RemoteIP.


28
29
30
31
32
# File 'src/lib/y2network/widgets/remote_ip.rb', line 28

def initialize(settings)
  textdomain "network"

  @settings = settings
end

Instance Method Details

#helpObject


38
39
40
41
42
43
44
45
# File 'src/lib/y2network/widgets/remote_ip.rb', line 38

def help
  _(
    "<p>Enter the <b>IP Address</b> (for example: <tt>192.168.100.99</tt>) " \
    "for your computer, and the \n" \
    " <b>Remote IP Address</b> (for example: <tt>192.168.100.254</tt>)\n" \
    "for your peer.</p>\n"
  )
end

#initObject


47
48
49
# File 'src/lib/y2network/widgets/remote_ip.rb', line 47

def init
  self.value = @settings.remote_ip
end

#labelObject


34
35
36
# File 'src/lib/y2network/widgets/remote_ip.rb', line 34

def label
  _("R&emote IP Address")
end

#storeObject


51
52
53
# File 'src/lib/y2network/widgets/remote_ip.rb', line 51

def store
  @settings.remote_ip = value
end

#validateObject


55
56
57
58
59
# File 'src/lib/y2network/widgets/remote_ip.rb', line 55

def validate
  return true if Yast::IP.Check(value)

  Yast::Popup.Error(_("The remote IP address is invalid.") + "\n" + Yast::IP.Valid4)
end