Class: UpdateDlg
- Includes:
- InstallOption
- Defined in:
- lib/gemcmddlgs.rb
Overview
Instance Method Summary collapse
- #confirmUpdateAll ⇒ Object
-
#initialize(parent = nil) ⇒ UpdateDlg
constructor
A new instance of UpdateDlg.
- #makeUpdateArgs ⇒ Object
- #selectOption(gem) ⇒ Object
Methods included from InstallOption
Constructor Details
#initialize(parent = nil) ⇒ UpdateDlg
Returns a new instance of UpdateDlg.
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 |
# File 'lib/gemcmddlgs.rb', line 58 def initialize(parent=nil) super(parent) self.windowTitle = i18n('Update Gem') @msgLabel = Qt::Label.new(i18n('Update Gem')) @okBtn = KDE::PushButton.new(KDE::Icon.new('dialog-ok'), 'OK') @cancelBtn = KDE::PushButton.new(KDE::Icon.new('dialog-cancel'), 'Cancel') connect(@okBtn, SIGNAL(:clicked), self, SLOT(:accept)) connect(@cancelBtn, SIGNAL(:clicked), self, SLOT(:reject)) @versionComboBox = Qt::ComboBox.new @allCheckBox = Qt::CheckBox.new(i18n('Update all')) @forceCheckBox = Qt::CheckBox.new(i18n('Force gem to install, bypassing dependency checks')) @optionsPage = InstallOptionsPage.new # layout @versionWidget = HBoxLayoutWidget.new do |l| l.addWidgets('Version :', @versionComboBox, nil) end @versionEnabled = true @mainLayout = Qt::VBoxLayout.new do |l| l.addWidget(@msgLabel) l.addWidget(@versionWidget) l.addWidget(@allCheckBox) l.addWidget(@forceCheckBox) l.addWidget(@optionsPage) l.addWidgets(nil, @okBtn, @cancelBtn) end setLayout(@mainLayout) end |
Instance Method Details
#confirmUpdateAll ⇒ Object
108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/gemcmddlgs.rb', line 108 def confirmUpdateAll @allCheckBox.checked = true @allCheckBox.enabled = false @versionWidget.visible = false self.windowTitle = @msgLabel.text = i18n('Update All Gems') Settings.updateWidgets(self) @optionsPage.installInSystemVisible = false ret = exec == Qt::Dialog::Accepted @optionsPage.installInSystemVisible = true ret end |
#makeUpdateArgs ⇒ Object
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
# File 'lib/gemcmddlgs.rb', line 124 def makeUpdateArgs Settings.updateSettings(self) args = [ 'update' ] unless @allCheckBox.checked then args.push( @gem.package ) args.push( '-r' ) if @versionComboBox.currentIndex != @gem.nowVersion then args.shift args.unshift( 'install' ) args.push( '-v' ) args.push( @versionComboBox.currentText ) end end if @forceCheckBox.checked then args.push( '--force' ) else args.push( '--no-force' ) end args += makeArgs end |
#selectOption(gem) ⇒ Object
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/gemcmddlgs.rb', line 90 def selectOption(gem) @allCheckBox.checked = false @allCheckBox.enabled = true @versionWidget.visible = true @gem = gem @versionComboBox.clear self.windowTitle = @msgLabel.text = i18n('Update Gem %s') % gem.name vers = gem.availableVersions return unless vers @versionComboBox.addItems(vers) @versionComboBox.currentIndex = 0 Settings.updateWidgets(self) @optionsPage.installInSystemVisible = false ret = exec == Qt::Dialog::Accepted @optionsPage.installInSystemVisible = true ret end |