From kde-commits Sun Sep 11 00:35:40 2005 From: Ian Reinhart Geiser Date: Sun, 11 Sep 2005 00:35:40 +0000 To: kde-commits Subject: KDE/kdebindings/kjsembed Message-Id: <1126398940.527148.20407.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=112639895429640 SVN commit 459471 by geiseri: For some reason QListBox::removeItem(...) was in the enums but not in the exported methods. This should fix that and now you can remove items from the listbox. CCMAIL: Matej Cepl M +19 -0 customobject_imp.cpp M +2 -1 customobject_imp.h --- trunk/KDE/kdebindings/kjsembed/customobject_imp.cpp #459470:459471 @@ -130,6 +130,8 @@ if ( listbox ) { obj = new CustomObjectImp( exec, ListBoxInsertItem, proxy ); object.put( exec, "insertItem", KJS::Object(obj) ); + obj = new CustomObjectImp( exec, ListBoxRemoveItem, proxy ); + object.put( exec, "removeItem", KJS::Object(obj) ); } QListView *listview = dynamic_cast( widget ); @@ -339,6 +341,10 @@ listBoxInsertItem( exec, self, args ); return KJS::Value(); break; + case ListBoxRemoveItem: + listBoxRemoveItem( exec, self, args ); + return KJS::Value(); + break; case ListViewAddColumn: listViewAddColumn( exec, self, args ); return KJS::Value(); @@ -626,6 +632,19 @@ lb->insertItem( s ); } +void CustomObjectImp::listBoxRemoveItem( KJS::ExecState *exec, KJS::Object &, const KJS::List &args ) +{ + if ( args.size() != 1 ) + return; + + QListBox *lb = dynamic_cast( proxy->object() ); + if ( !lb ) + return; + + int itm = extractInt( exec, args, 0 ); + lb->removeItem( itm ); +} + void CustomObjectImp::listViewAddColumn( KJS::ExecState *exec, KJS::Object &, const KJS::List &args ) { if ( args.size() != 1 ) --- trunk/KDE/kdebindings/kjsembed/customobject_imp.h #459470:459471 @@ -136,7 +136,8 @@ void widgetDrawText( KJS::ExecState *exec, KJS::Object &, const KJS::List &args ); void listBoxInsertItem( KJS::ExecState *exec, KJS::Object &, const KJS::List &args ); - + void listBoxRemoveItem( KJS::ExecState *exec, KJS::Object &, const KJS::List &args ); + void listViewAddColumn( KJS::ExecState *exec, KJS::Object &, const KJS::List &args ); void listViewInsertItem( KJS::ExecState *exec, KJS::Object &, const KJS::List &args ); KJS::Value listViewSelectedItem( KJS::ExecState *exec, KJS::Object &, const KJS::List & );