-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a284cbc
commit e218d57
Showing
3 changed files
with
85 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
Yast.import "IP" | ||
|
||
require "cwm/common_widgets" | ||
|
||
module Y2Network | ||
module Widgets | ||
class Destination < CWM::InputField | ||
# @param route route object to get and store netmask value | ||
# TODO: I expect it will be useful on multiple places, so we need find way how to store it | ||
def initialize(route) | ||
textdomain "network" | ||
end | ||
|
||
def label | ||
_("&Destination") | ||
end | ||
|
||
def help | ||
# TODO: original also does not have help | ||
"" | ||
end | ||
|
||
def opt | ||
[:hstretch] | ||
end | ||
|
||
def init | ||
Yast::UI.ChangeWidget(Id(widget_id), :ValidChars, Yast::IP.ValidChars +"-/") | ||
# TODO: init from route object | ||
end | ||
|
||
def validate | ||
return true if valid_destination? | ||
|
||
Yast::Popup.Error(_("Destination is invalid.")) | ||
focus | ||
false | ||
end | ||
|
||
private | ||
|
||
# Validates user's input obtained from destination field | ||
def valid_destination? | ||
destination = value | ||
return true if destination == "default" | ||
|
||
ip = destination[/^[^/]+/] | ||
Yast::IP.Check(ip) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
Yast.import "Netmask" | ||
Yast.import "Label" | ||
|
||
require "cwm/common_widgets" | ||
|
||
module Y2Network | ||
module Widgets | ||
class RouteOptions < CWM::InputField | ||
# @param route route object to get and store netmask value | ||
# TODO: I expect it will be useful on multiple places, so we need find way how to store it | ||
def initialize(route) | ||
textdomain "network" | ||
end | ||
|
||
def label | ||
Yast::LAbel.Options | ||
end | ||
|
||
def help | ||
# TODO: original also does not have help | ||
"" | ||
end | ||
|
||
def opt | ||
[:hstretch] | ||
end | ||
|
||
def init | ||
# TODO: init from route object | ||
end | ||
end | ||
end | ||
end |