Class: Ruber::SaveModifiedFilesDlg
- Inherits:
-
KDE::Dialog
- Object
- KDE::Dialog
- Ruber::SaveModifiedFilesDlg
- Defined in:
- lib/ruber/main_window/save_modified_files_dlg.rb
Instance Attribute Summary (collapse)
-
- (Object) save
readonly
Returns the value of attribute save.
Instance Method Summary (collapse)
- - (Object) create_buttons private
- - (Object) fill_list private
-
- (SaveModifiedFilesDlg) initialize(docs, parent = nil)
constructor
A new instance of SaveModifiedFilesDlg.
- - (Object) to_save
Constructor Details
- (SaveModifiedFilesDlg) initialize(docs, parent = nil)
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. = "Save documents" self.modal = true self. = KDE::VBox.new self Qt::Label.new KDE.i18n("The following documents have been modified. Do you want to save them before closing?"), @document_list = Qt::TreeView.new 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
- (Object) save (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
- (Object) create_buttons (private)
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/ruber/main_window/save_modified_files_dlg.rb', line 56 def self. = Yes|No|Cancel save = KDE::StandardGuiItem.save save.text = KDE::i18n "&Save selected" Yes, save self.connect(SIGNAL('yesClicked()')) do @save = true done KDE::Dialog::Yes end No, KDE::StandardGuiItem.dont_save self.connect(SIGNAL('noClicked()')) do @save = false done KDE::Dialog::No end cancel = KDE::StandardGuiItem.cancel cancel.text = KDE::i18n "&Abort" Cancel, cancel end |
- (Object) fill_list (private)
78 79 80 81 82 83 84 85 |
# File 'lib/ruber/main_window/save_modified_files_dlg.rb', line 78 def fill_list @document_list.model.horizontal_header_labels = %w[Title Location] @docs.each do | d | row = [Qt::StandardItem.new(d.document_name), Qt::StandardItem.new(d.path)|| ''] row[0].checked = true @document_list.model.append_row row end end |
- (Object) to_save
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 |