Class: Y2Remote::Widgets::RemoteSettings

Inherits:
CWM::CustomWidget
  • Object
show all
Defined in:
src/lib/y2remote/widgets/remote.rb

Instance Method Summary collapse

Constructor Details

#initializeRemoteSettings

Returns a new instance of RemoteSettings.



30
31
32
33
34
35
# File 'src/lib/y2remote/widgets/remote.rb', line 30

def initialize
  super
  textdomain "network"

  @allow_web ||= AllowWeb.new
end

Instance Method Details

#contentsObject



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'src/lib/y2remote/widgets/remote.rb', line 68

def contents
  RadioButtonGroup(
    VBox(
      # Small spacing (bsc#988904)
      VSpacing(0.3),
      # RadioButton label
      Left(
        RadioButton(
          Id(:allow_with_vncmanager),
          Opt(:notify),
          _("&Allow Remote Administration With Session Management"),
          remote.with_manager?
        )
      ),
      # RadioButton label
      Left(
        RadioButton(
          Id(:allow_without_vncmanager),
          Opt(:notify),
          _("&Allow Remote Administration Without Session Management"),
          remote.enabled? && !remote.with_manager?
        )
      ),
      # RadioButton label
      Left(
        RadioButton(
          Id(:disallow),
          Opt(:notify),
          _("&Do Not Allow Remote Administration"),
          remote.disabled?
        )
      ),
      VSpacing(1),
      Left(@allow_web)
    )
  )
end

#handle(event) ⇒ Object



45
46
47
48
49
50
51
52
53
54
# File 'src/lib/y2remote/widgets/remote.rb', line 45

def handle(event)
  case event["ID"]
  when :disallow
    @allow_web.disable
  when :allow_with_vncmanager, :allow_without_vncmanager
    @allow_web.enable
  end

  nil
end

#helpObject



106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'src/lib/y2remote/widgets/remote.rb', line 106

def help
  Yast::Builtins.sformat(
    _(
      "<p><b><big>Remote Administration Settings</big></b></p>\n" \
      "<p>If this feature is enabled, you can\n" \
      "administer this machine remotely from another machine. Use a VNC\n" \
      "client, such as krdc (connect to <tt>&lt;hostname&gt;:%1</tt>), or\n" \
      "a Java-capable Web browser (connect to " \
      "<tt>https://&lt;hostname&gt;:%2/</tt>).</p>\n" \
      "<p>Without Session Management, only one user can be connected\n"\
      "at a time to a session, and that session is terminated when the VNC client\n" \
      "disconnects.</p>" \
      "<p>With Session Management, multiple users can interact with a single\n" \
      "session, and the session may persist even if noone is connected.</p>"
    ),
    5901,
    5801
  )
end

#initObject



37
38
39
# File 'src/lib/y2remote/widgets/remote.rb', line 37

def init
  remote.disabled? ? @allow_web.disable : @allow_web.enable
end

#optObject



41
42
43
# File 'src/lib/y2remote/widgets/remote.rb', line 41

def opt
  [:notify]
end

#storeObject



56
57
58
59
60
61
62
63
64
65
66
# File 'src/lib/y2remote/widgets/remote.rb', line 56

def store
  remote.disable!

  return if disallow?

  allow_manager? ? remote.enable_manager! : remote.enable!

  remote.enable_web! if allow_web?

  nil
end