Class: Ruber::ChoosePluginsDlg

Inherits:
KDE::Dialog
  • Object
show all
Defined in:
lib/ruber/main_window/choose_plugins_dlg.rb

Overview

Dialog where the user can choose the plugins to load and the directories where to look for plugins.

The main functionality is provided by the main widget, of class ChoosePluginsWidget.

Instance Method Summary (collapse)

Constructor Details

- (ChoosePluginsDlg) initialize(parent = nil)

Creates a new ChoosePluginsDlg and initializes it using both the settings in the configuration file and the loaded plugins.



40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/ruber/main_window/choose_plugins_dlg.rb', line 40

def initialize parent = nil
  super
  self.caption = "Choose plugins"
  self.buttons = Ok | Cancel | Apply | Default | Reset
  self.main_widget = ChoosePluginsWidget.new
  enable_button_apply false
  main_widget.connect(SIGNAL('plugins_changed()')){enable_button_apply true}
  main_widget.connect(SIGNAL('directories_changed()')){enable_button_apply true}
  connect self, SIGNAL(:applyClicked), self, SLOT(:write_settings)
  connect self, SIGNAL(:okClicked), self, SLOT(:write_settings)
  connect self, SIGNAL(:defaultClicked), main_widget, SLOT(:apply_defaults)
end

Instance Method Details

- (Object) plugins

See ChoosePluginsWidget#plugins



54
55
56
# File 'lib/ruber/main_window/choose_plugins_dlg.rb', line 54

def plugins
  main_widget.plugins
end

- (Object) slotButtonClicked(btn) (private)

Override the default behaviour when the user presses the Ok or Apply buttons and there are problems with dependencies (unresolved dependencies or circular dependencies). In this case, it displays a message box where the user can choose whether he truly wants to save the settings or not. If he chooses to write the settings, the usual behaviour is followed. Otherwise, the method does nothing.



75
76
77
78
79
80
81
82
83
84
# File 'lib/ruber/main_window/choose_plugins_dlg.rb', line 75

def slotButtonClicked btn
  if btn == Ok || btn == Apply and !main_widget.deps_satisfied?
    msg = "There are dependencies problems among plugins. Are you sure you want to accept these settings?"
    if KDE::MessageBox.question_yes_no(nil, msg) == KDE::MessageBox::Yes
      super
    else return
    end
  else super
  end
end

- (Object) write_settings (private)

Writes the settings to the configuration file and disables the Apply button



63
64
65
66
# File 'lib/ruber/main_window/choose_plugins_dlg.rb', line 63

def write_settings
  main_widget.write_settings
  enable_button_apply false
end

Slot Signature:

write_settings()