Module: Yast::PartitioningEpLoopInclude

Defined in:
../../src/include/partitioning/ep-loop.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) CreateLoopMainPanel(user_data)



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
# File '../../src/include/partitioning/ep-loop.rb', line 76

def CreateLoopMainPanel(user_data)
  user_data = deep_copy(user_data)
  _Predicate = lambda do |disk, partition|
    disk = deep_copy(disk)
    partition = deep_copy(partition)
    StorageFields.PredicateDiskType(disk, partition, [:CT_LOOP])
  end

  fields = StorageSettings.FilterTable(
    [:device, :size, :fs_type, :label, :mount_point]
  )

  target_map = Storage.GetTargetMap

  table_header = StorageFields.TableHeader(fields)
  table_contents = StorageFields.TableContents(
    fields,
    target_map,
    fun_ref(_Predicate, "symbol (map, map)")
  )

  UI.ReplaceWidget(
    :tree_panel,
    Greasemonkey.Transform(
      VBox(
        HStretch(),
        # heading
        term(:IconAndHeading, _("Crypt Files"), StorageIcons.loop_icon),
        Table(
          Id(:table),
          Opt(:keepSorting, :notify, :notifyContextMenu),
          table_header,
          table_contents
        ),
        HBox(
          # push button text
          PushButton(Id(:add), Opt(:key_F3), _("Add Crypt File...")),
          LoopButtonBox(),
          HStretch()
        )
      )
    )
  )

  # helptext
  helptext = _("<p>This view shows all crypt files.</p>")

  Wizard.RestoreHelp(Ops.add(helptext, StorageFields.TableHelptext(fields)))

  nil
end

- (Object) CreateLoopPanel(user_data)



147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
# File '../../src/include/partitioning/ep-loop.rb', line 147

def CreateLoopPanel(user_data)
  user_data = deep_copy(user_data)
  part_device = Convert.to_string(user_data)

  target_map = Storage.GetTargetMap

  fields = StorageSettings.FilterOverview(
    [
      :heading_device,
      :device,
      :size,
      :file_path,
      :heading_filesystem,
      :fs_type,
      :mount_point
    ]
  )

  UI.ReplaceWidget(
    :tree_panel,
    Greasemonkey.Transform(
      VBox(
        # heading
        term(
          :IconAndHeading,
          Builtins.sformat(_("Crypt File: %1"), part_device),
          StorageIcons.loop_icon
        ),
        HStretch(),
        StorageFields.Overview(fields, target_map, part_device),
        HBox(LoopButtonBox(), HStretch())
      )
    )
  )

  # helptext
  helptext = _(
    "<p>This view shows detailed information of the\nselected crypt file.</p>"
  )

  Wizard.RestoreHelp(
    Ops.add(helptext, StorageFields.OverviewHelptext(fields))
  )

  nil
end

- (Object) EpContextMenuLoop(device)



35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File '../../src/include/partitioning/ep-loop.rb', line 35

def EpContextMenuLoop(device)
  widget = ContextMenu.Simple(
    [Item(Id(:edit), _("Edit")), Item(Id(:delete), _("Delete"))]
  )

  case widget
    when :edit
      EpEditLoop(device)
    when :delete
      EpDeleteLoop(device)
  end

  nil
end

- (Object) HandleLoopButtons(part_device, event)



61
62
63
64
65
66
67
68
69
70
71
72
73
# File '../../src/include/partitioning/ep-loop.rb', line 61

def HandleLoopButtons(part_device, event)
  event = deep_copy(event)
  case Event.IsWidgetActivated(event)
    when :add
      EpCreateLoop()
    when :edit
      EpEditLoop(part_device)
    when :delete
      EpDeleteLoop(part_device)
  end

  nil
end

- (Object) HandleLoopMainPanel(user_data, event)



129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# File '../../src/include/partitioning/ep-loop.rb', line 129

def HandleLoopMainPanel(user_data, event)
  user_data = deep_copy(user_data)
  event = deep_copy(event)
  device = Convert.to_string(UI.QueryWidget(Id(:table), :CurrentItem))

  HandleLoopButtons(device, event)

  case Event.IsWidgetContextMenuActivated(event)
    when :table
      EpContextMenuDevice(device)
  end

  UI.SetFocus(Id(:table))

  nil
end

- (Object) HandleLoopPanel(user_data, event)



195
196
197
198
199
200
201
202
203
204
205
# File '../../src/include/partitioning/ep-loop.rb', line 195

def HandleLoopPanel(user_data, event)
  user_data = deep_copy(user_data)
  event = deep_copy(event)
  part_device = Convert.to_string(user_data)

  HandleLoopButtons(part_device, event)

  UI.SetFocus(Id(:text))

  nil
end

- (Object) initialize_partitioning_ep_loop(include_target)



28
29
30
31
32
33
# File '../../src/include/partitioning/ep-loop.rb', line 28

def initialize_partitioning_ep_loop(include_target)
  textdomain "storage"

  Yast.include include_target, "partitioning/ep-loop-dialogs.rb"
  Yast.include include_target, "partitioning/ep-loop-lib.rb"
end

- (Object) LoopButtonBox



51
52
53
54
55
56
57
58
# File '../../src/include/partitioning/ep-loop.rb', line 51

def LoopButtonBox
  HBox(
    # push button text
    PushButton(Id(:edit), Opt(:key_F4), _("Edit...")),
    # push button text
    PushButton(Id(:delete), Opt(:key_F5), _("Delete..."))
  )
end