20#include <KoPartSelectDia.h>
22#include <kiconloader.h>
24#include <tqlistview.h>
35 listview = new TQListView( this );
36 listview->addColumn( i18n( "Object" ) );
37 listview->addColumn( i18n( "Comment" ) );
38 listview->setAllColumnsShowFocus( true );
39 listview->setShowSortIndicator( true );
41 connect( listview, TQ_SIGNAL( doubleClicked( TQListViewItem * ) ),
42 this, TQ_SLOT( slotOk() ) );
43 connect( listview, TQ_SIGNAL( selectionChanged( TQListViewItem * ) ),
44 this, TQ_SLOT( selectionChanged( TQListViewItem * ) ) );
48 TQValueList<KoDocumentEntry>::Iterator it = m_lstEntries.begin();
49 for( ; it != m_lstEntries.end(); ++it ) {
50 KService::Ptr serv = (*it).service();
51 if (!serv->genericName().isEmpty()) {
52 TQListViewItem *item = new TQListViewItem( listview, serv->name(), serv->genericName() );
53 item->setPixmap( 0, SmallIcon( serv->icon() ) );
57 selectionChanged( 0 );
59 resize( listview->sizeHint().width() + 20, 300 );
62void KoPartSelectDia::selectionChanged( TQListViewItem *item )
69 if ( listview->currentItem() ) {
70 TQValueList<KoDocumentEntry>::Iterator it = m_lstEntries.begin();
71 for ( ; it != m_lstEntries.end(); ++it ) {
72 if ( ( *it ).service()->name() == listview->currentItem()->text( 0 ) )
85 if (dlg->exec() == TQDialog::Accepted)
93#include <KoPartSelectDia.moc>
void setMainWidget(TQWidget *widget)
void enableButtonOK(bool state)
KDialogBase(TQWidget *parent=0, const char *name=0, bool modal=true, const TQString &caption=TQString::null, int buttonMask=Ok|Apply|Cancel, ButtonCode defaultButton=Ok, bool separator=false, const KGuiItem &user1=KGuiItem(), const KGuiItem &user2=KGuiItem(), const KGuiItem &user3=KGuiItem())
Represents an available KOffice component that supports the document interface.
static TQValueList< KoDocumentEntry > query(const TQString &_constr=TQString()) This function will query tdesycoca to find all available components.
KoPartSelectDia(TQWidget *parent=0, const char *name=0) Constructor.
KoDocumentEntry entry() Retrieves the result of the part selection.
static KoDocumentEntry selectPart(TQWidget *parent=0L) Convenience function for using the dialog.
|