/
mocked.rb
136 lines (110 loc) · 2.37 KB
/
mocked.rb
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
require "yast"
require "cwm/widget"
# FIXME: these are mock only
# move this to: yast2-registration
module Widgets
class RegistrationCode < CWM::InputField
def initialize
textdomain "FIXME"
end
def label
_("Registration Code or SMT Server URL")
end
end
end
module Widgets
class Overview < CWM::CustomWidget
def contents
VBox(
Left(PushButton(Id(button_id), label)),
* items.map { |i| Left(Label(" * #{i}")) }
)
end
def label
d = Yast::WFM.CallFunction(proposal_client, ["Description", {}])
d["menu_title"]
end
def items
d = Yast::WFM.CallFunction(proposal_client,
[
"MakeProposal",
{"cramped_label_mode" => true}
])
d["label_proposal"]
end
def handle(_event)
Yast::WFM.CallFunction(proposal_client, ["AskUser", {}])
# FIXME: refresh the summary items
nil
end
private
def button_id
self.class.to_s
end
end
class PartitioningOverview < Overview
def initialize
textdomain "storage"
end
def proposal_client
"partitions_proposal"
end
def label
# FIXME: The storage subsystem is locked by an unknown app...
if ENV["FAKE_STORAGE"]
"&Partitioning"
else
super
end
end
def items
if ENV["FAKE_STORAGE"]
["Standard"]
else
super
end
end
end
class BootloaderOverview < Overview
def initialize
textdomain "bootloader"
Yast.import "Bootloader"
end
def proposal_client
"bootloader_proposal"
end
def label
_("Booting")
end
def items
# FIXME: it returns richtext
Yast::Bootloader.Summary
end
end
class NetworkOverview < Overview
def initialize
textdomain "network"
Yast.import "Lan"
end
def label
_("&Network")
end
def items
Yast::Lan.Summary("")
end
def handle(event)
Yast::WFM.CallFunction("inst_lan", [{"skip_detection" => true}])
# FIXME: refresh the summary items
nil
end
end
class KdumpOverview < Overview
def initialize
textdomain "kdump"
Yast.import "Kdump"
end
def proposal_client
"kdump_proposal"
end
end
end