SVN commit 1090228 by rdale: * Special case the constructors of the new Plasma widgets so that they can be passed a PlasmaScripting::Applet as parent * Fixed the dialog handling so that it uses the standardConfigurationDialog() and addStandardConfigurationPages() methods M +7 -0 ChangeLog M +29 -20 applet.rb --- branches/KDE/4.4/kdebase/workspace/plasma/generic/scriptengines/ruby/ChangeLog #1090227:1090228 @@ -1,3 +1,10 @@ +2010-02-14 Richard Dale + +* Special case the constructors of the new Plasma widgets so that they can be +passed a PlasmaScripting::Applet as parent +* Fixed the dialog handling so that it uses the standardConfigurationDialog() +and addStandardConfigurationPages() methods + 2009-08-07 Richard Dale * Fixed typo in the type signature of the initExtenderItem() slot. Thanks to David Palacio for reporting the bug --- branches/KDE/4.4/kdebase/workspace/plasma/generic/scriptengines/ruby/applet.rb #1090227:1090228 @@ -1,5 +1,5 @@ =begin - * Copyright 2008 by Richard Dale + * Copyright 2008-2010 by Richard Dale * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -72,7 +72,7 @@ end def initExtenderItem(item) - puts "Missing implementation of initExtenderItem in the applet " \ + puts "Missing implementation of initExtenderItem in the applet " \ "#{item.config.readEntry('SourceAppletPluginName', '')}" \ "!\n Any applet that uses extenders should implement initExtenderItem to " \ "instantiate a widget." @@ -109,20 +109,6 @@ end def showConfigurationInterface - dialogId = "#{@applet_script.applet.id}settings#{@applet_script.applet.name}" - windowTitle = KDE::i18nc("@title:window", "%s Settings" % @applet_script.applet.name) - @nullManager = KDE::ConfigSkeleton.new(nil) - @dialog = KDE::ConfigDialog.new(nil, dialogId, @nullManager) - @dialog.faceType = KDE::PageDialog::Auto - @dialog.windowTitle = windowTitle - @dialog.setAttribute(Qt::WA_DeleteOnClose, true) - createConfigurationInterface(@dialog) - # TODO: would be nice to not show dialog if there are no pages added? - # Don't connect to the deleteLater() slot in Ruby as it causes crashes - # connect(@dialog, SIGNAL(:finished), @nullManager, SLOT(:deleteLater)) - # TODO: Apply button does not correctly work for now, so do not show it - @dialog.showButton(KDE::Dialog::Apply, false) - @dialog.show end def dataEngine(engine) @@ -220,7 +206,10 @@ end def showConfigurationInterface - @applet_script.showConfigurationInterface + dialog = standardConfigurationDialog() + @applet_script.createConfigurationInterface(dialog) + addStandardConfigurationPages(dialog) + dialog.show end protected @@ -416,6 +405,16 @@ end end + class ItemBackground < Qt::Base + def initialize(parent = nil) + if parent.kind_of?(PlasmaScripting::Applet) + super(parent.applet_script.applet) + else + super + end + end + end + class Label < Qt::Base def initialize(parent = nil) if parent.kind_of?(PlasmaScripting::Applet) @@ -486,6 +485,16 @@ end end + class Separator < Qt::Base + def initialize(parent = nil, wFlags = 0) + if parent.kind_of?(PlasmaScripting::Applet) + super(parent.applet_script.applet, wFlags) + else + super + end + end + end + class SignalPlotter < Qt::Base def initialize(parent = nil) if parent.kind_of?(PlasmaScripting::Applet) @@ -577,7 +586,7 @@ end end end - + class ToolTipManager < Qt::Base def setContent(widget, data) if widget.kind_of?(PlasmaScripting::Applet) @@ -658,7 +667,7 @@ end end - class WebView < Qt::Base + class VideoWidget < Qt::Base def initialize(parent = nil) if parent.kind_of?(PlasmaScripting::Applet) super(parent.applet_script.applet) @@ -668,7 +677,7 @@ end end - class VideoWidget < Qt::Base + class WebView < Qt::Base def initialize(parent = nil) if parent.kind_of?(PlasmaScripting::Applet) super(parent.applet_script.applet)