[yast-commit] r41997 - /branches/tmp/sh/mod-ui/ncurses/src/pkg/NCPkgPopupTree.cc
Author: gs Date: Tue Nov 13 11:22:33 2007 New Revision: 41997 URL: http://svn.opensuse.org/viewcvs/yast?rev=41997&view=rev Log: get original rpm group item from currently selected item Modified: branches/tmp/sh/mod-ui/ncurses/src/pkg/NCPkgPopupTree.cc Modified: branches/tmp/sh/mod-ui/ncurses/src/pkg/NCPkgPopupTree.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/pkg/NCPkgPopupTree.cc?rev=41997&r1=41996&r2=41997&view=diff ============================================================================== --- branches/tmp/sh/mod-ui/ncurses/src/pkg/NCPkgPopupTree.cc (original) +++ branches/tmp/sh/mod-ui/ncurses/src/pkg/NCPkgPopupTree.cc Tue Nov 13 11:22:33 2007 @@ -30,7 +30,15 @@ #include "NCZypp.h" - +/////////////////////////////////////////////////////////////////// +// +// +// CLASS NAME : NCRpmGroupItem +// +// DESCRIPTION : class derived from YTreeItem with additional +// property to store the original rpm group item +// +// class NCRpmGroupItem : public YTreeItem { private: @@ -55,7 +63,7 @@ } - YStringTreeItem * getOrigItem() { return rpmGroupItem; } + YStringTreeItem * getOrigItem() const { return rpmGroupItem; } }; @@ -142,6 +150,8 @@ if ( !packager || !filterTree ) return postevent; + YStringTreeItem * origItem; + // get the currently selected rpm group and show the package list if ( postevent.detail == NCursesEvent::USERDEF ) { @@ -149,22 +159,27 @@ if ( item ) { - // get the data pointer - YStringTreeItem * origItem = (YStringTreeItem *) (item->data()); + const NCRpmGroupItem * rpmGroupItem = dynamic_cast<const NCRpmGroupItem *>(item); - if ( origItem ) + if ( rpmGroupItem ) { - string label = origItem->value().translation(); + // get the original rpm group item (YStringTreeItem) + origItem = rpmGroupItem->getOrigItem(); + + if ( origItem ) + { + string label = origItem->value().translation(); - // fill the package list - packager->fillPackageList( YCPString( label ), origItem ); + // fill the package list + packager->fillPackageList( YCPString( label ), origItem ); - NCMIL << "Selected RPM group: " << label << endl; + NCMIL << "Selected RPM group: " << label << endl; + } } } else { - NCERR << "No RPM group tree existing" << endl; + NCERR << "Current item not valid" << endl; } } -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
gs@svn.opensuse.org