Class: SelectInstallVerDlg

Inherits:
Qt::Dialog
  • Object
show all
Includes:
InstallOption
Defined in:
lib/gemcmddlgs.rb

Overview


Instance Method Summary collapse

Methods included from InstallOption

#makeArgs

Constructor Details

#initialize(parent = nil) ⇒ SelectInstallVerDlg

Returns a new instance of SelectInstallVerDlg.



213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
# File 'lib/gemcmddlgs.rb', line 213

def initialize(parent=nil)
    super(parent)
    self.windowTitle = i18n('Install 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_installLatestFlag'
    @forceCheckBox = Qt::CheckBox.new(i18n('Force gem to install, bypassing dependency checks'))

    @optionsPage = InstallOptionsPage.new

    # layout
    lo = Qt::VBoxLayout.new do |l|
        l.addWidget(@msgLabel)
        l.addWidgets('Version :', @versionComboBox, @checkOtherVersion, nil)
        l.addWidget(@skipVersionCheck)
        l.addWidget(@forceCheckBox)
        l.addWidget(@optionsPage)
        l.addWidgets(nil, @okBtn, @cancelBtn)
    end
    setLayout(lo)
end

Instance Method Details

#checkOtherVersionObject



245
246
247
248
249
250
251
# File 'lib/gemcmddlgs.rb', line 245

def checkOtherVersion
    @versionComboBox.clear
    vers = @gem.availableVersions
    return unless vers
    @versionComboBox.addItems(vers)
    @versionComboBox.currentIndex = 0
end

#makeInstallArgs(localFlag) ⇒ Object



264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
# File 'lib/gemcmddlgs.rb', line 264

def makeInstallArgs(localFlag)
    Settings.updateSettings(self)

    args = [ 'install' ]
    if @versionComboBox.currentIndex != 0 then
        args.push( @gem.package )
        args.push( '-r' )
        args.push( '-v' )
        args.push( @versionComboBox.currentText )
    elsif localFlag then
        args.push( @gem.filePath )
    else
        args.push( @gem.package )
        args.push( '-r' )
    end
    if @forceCheckBox.checked then
        args.push( '--force' )
    else
        args.push( '--no-force' )
    end
    args += makeArgs
end

#selectVersion(gem) ⇒ Object



253
254
255
256
257
258
259
260
261
# File 'lib/gemcmddlgs.rb', line 253

def selectVersion(gem)
    @gem = gem
    @versionComboBox.clear
    @versionComboBox.addItem(gem.version)
    @msgLabel.text = 'Install gem ' + gem.name + ' (' + gem.version.strip + ')'
    Settings.updateWidgets(self)
    return true if @skipVersionCheck.checked
    exec == Qt::Dialog::Accepted
end