Class: Ruber::Rake::ConfigWidget::AddQuickActionDlg

Inherits:
KDE::Dialog
  • Object
show all
Defined in:
plugins/rake/rake_widgets.rb

Overview

Dialog used by the configuration widget to have the user choose a quick task, that is associate a shortcut with a name (which is supposed to correspond to a task in the rakefile)

Instance Method Summary (collapse)

Constructor Details

- (AddQuickActionDlg) initialize(parent = Ruber[:main_window])

A new instance of AddQuickActionDlg

Parameters:

  • the (Qt::Widget, nil)

    parent widget



214
215
216
217
218
219
220
221
222
223
224
225
# File 'plugins/rake/rake_widgets.rb', line 214

def initialize parent = Ruber[:main_window]
  super
  @ui = Ui::RakeAddQuickTaskWidget.new
  @ui.setupUi main_widget
  collections = Ruber[:main_window].factory.clients.map{|cl| cl.action_collection}
  @ui.shortcut.check_action_collections = collections
  connect @ui.shortcut, SIGNAL('stealShortcut(QKeySequence, KAction*)'), @ui.shortcut, SLOT(:applyStealShortcut)
  enable_button_ok false
  @ui.task.set_focus
  connect @ui.task, SIGNAL('textChanged(QString)'), self, SLOT(:change_ok_state)
  connect @ui.shortcut, SIGNAL('keySequenceChanged(QKeySequence)'), self, SLOT(:change_ok_state)
end

Instance Method Details

- (nil) change_ok_state (private)

Enables or disables the Ok button depending on whether both the task name and the corresponding shortcut have been chosen

Returns:

  • (nil)


250
251
252
253
# File 'plugins/rake/rake_widgets.rb', line 250

def change_ok_state
  enable_button_ok !(@ui.task.text.empty? || @ui.shortcut.key_sequence.empty?)
  nil
end

Slot Signature:

change_ok_state()

- (String) shortcut

The shortcut chosen by the user

Returns:

  • (String)

    the shortcut chosen by the user



239
240
241
# File 'plugins/rake/rake_widgets.rb', line 239

def shortcut
  @ui.shortcut.key_sequence.to_string
end

- (String) task

The name chosen by the user

Returns:

  • (String)

    the name chosen by the user



231
232
233
# File 'plugins/rake/rake_widgets.rb', line 231

def task
  @ui.task.text
end