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


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

def initialize
  textdomain "network"

  @allow_web ||= AllowWeb.new
end

Instance Method Details

#contentsObject


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
105
# File 'src/lib/y2remote/widgets/remote.rb', line 69

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


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

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


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 107

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


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

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

#optObject


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

def opt
  [:notify]
end

#storeObject


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

def store
  remote.disable!

  return if disallow?

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

  remote.enable_web! if allow_web?

  nil
end