Class: KDE::ActionCollection
Instance Method Summary collapse
-
#addNew(name, parent = self.parent, options = {}) ⇒ Object
: KDE::Action.
Instance Method Details
#addNew(name, parent = self.parent, options = {}) ⇒ Object
Returns : KDE::Action.
227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 |
# File 'lib/mylibs.rb', line 227 def addNew(name, parent=self.parent, = {}) text = [:text] || name icon = [:icon] if icon then action = KDE::Action.new(KDE::Icon.new(icon), text, parent) else action = KDE::Action.new(text, parent) end shortCut = [:shortCut] if shortCut then action.setShortcut(KDE::Shortcut.new(shortCut)) end self.addAction(action.text, action) slot = [:triggered] if slot then if slot.kind_of? Array then self.connect(action, SIGNAL(:triggered), slot[0], \ SLOT(slot[1])) else self.connect(action, SIGNAL(:triggered), parent, \ SLOT(slot)) end end action end |