Class: Ruber::SaveModifiedFilesDlg

Inherits:
KDE::Dialog
  • Object
show all
Defined in:
lib/ruber/main_window/save_modified_files_dlg.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(docs, parent = nil) ⇒ SaveModifiedFilesDlg

Returns a new instance of SaveModifiedFilesDlg.



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/ruber/main_window/save_modified_files_dlg.rb', line 26

def initialize docs, parent = nil
  super parent
  @save = true
  @docs = docs
  self.caption = "Save documents"
  self.modal = true
  create_buttons
  self.main_widget = KDE::VBox.new self
  Qt::Label.new KDE.i18n("The following documents have been modified. Do you want to save them before closing?"), main_widget
  @document_list = Qt::TreeView.new main_widget
  m = Qt::StandardItemModel.new @document_list
  def m.flags idx
    Qt::ItemIsSelectable|Qt::ItemIsEnabled|Qt::ItemIsUserCheckable
  end
  @document_list.model = m
  @document_list.root_is_decorated = false
  fill_list
end

Instance Attribute Details

#saveObject (readonly)

Returns the value of attribute save.



25
26
27
# File 'lib/ruber/main_window/save_modified_files_dlg.rb', line 25

def save
  @save
end

Instance Method Details

#to_saveObject



45
46
47
48
49
50
51
52
# File 'lib/ruber/main_window/save_modified_files_dlg.rb', line 45

def to_save
  res = []
  m = @document_list.model
  @docs.each_with_index do |d, i|
    res << d if m.item(i, 0).checked?
  end
  res
end