Class: SelectDownloadVerDlg
Overview
Instance Method Summary collapse
- #checkOtherVersion ⇒ Object
-
#initialize(parent = nil) ⇒ SelectDownloadVerDlg
constructor
A new instance of SelectDownloadVerDlg.
- #makeDownloadArgs ⇒ Object
- #selectVersion(gem) ⇒ Object
Constructor Details
#initialize(parent = nil) ⇒ SelectDownloadVerDlg
Returns a new instance of SelectDownloadVerDlg.
294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 |
# File 'lib/gemcmddlgs.rb', line 294 def initialize(parent=nil) super(parent) self.windowTitle = i18n('Download Ruby Gem') @msgLabel = Qt::Label.new @msgLabel.wordWrap = true @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)) @checkOtherVersion = KDE::PushButton.new(i18n("Check Other Version's Availability")) connect(@checkOtherVersion , SIGNAL(:clicked), self, SLOT(:checkOtherVersion)) @versionComboBox = Qt::ComboBox.new @skipVersionCheck = Qt::CheckBox.new(i18n('Always Accept Latest Version to Skip This Dialog')) @skipVersionCheck.objectName = 'kcfg_downloadLatestFlag' # layout lo = Qt::VBoxLayout.new do |l| l.addWidget(@msgLabel) l.addWidgets('Version :', @versionComboBox, @checkOtherVersion, nil) l.addWidget(@skipVersionCheck) l.addWidgets(nil, @okBtn, @cancelBtn) end setLayout(lo) end |
Instance Method Details
#checkOtherVersion ⇒ Object
321 322 323 324 325 326 327 |
# File 'lib/gemcmddlgs.rb', line 321 def checkOtherVersion @versionComboBox.clear vers = @gem.availableVersions return unless vers @versionComboBox.addItems(vers) @versionComboBox.currentIndex = 0 end |
#makeDownloadArgs ⇒ Object
339 340 341 342 343 344 345 346 347 348 349 |
# File 'lib/gemcmddlgs.rb', line 339 def makeDownloadArgs Settings.updateSettings(self) args = [ 'fetch' ] args.push( @gem.package ) if @versionComboBox.currentIndex != 0 then args.push( '-v' ) args.push( @versionComboBox.currentText ) end args end |
#selectVersion(gem) ⇒ Object
329 330 331 332 333 334 335 336 337 |
# File 'lib/gemcmddlgs.rb', line 329 def selectVersion(gem) @gem = gem @versionComboBox.clear @versionComboBox.addItem(gem.version) @msgLabel.text = 'Download gem ' + gem.name + ' (' + gem.version.strip + ')' Settings.updateWidgets(self) return true if @skipVersionCheck.checked exec == Qt::Dialog::Accepted end |