예제 #1
0
파일: ticonview.cpp 프로젝트: Tayyib/uludag
void TIconView::setCategory( const QString& path )
{
    this->clear();

    QPixmap _icon = DesktopIcon(  "go",  KIcon::SizeMedium ); // defaultIcon

    KServiceGroup::Ptr category = KServiceGroup::group( path );
    if ( !category || !category->isValid() )
        return;

    KServiceGroup::List list = category->entries(  true,  true );
    KServiceGroup::List::ConstIterator it = list.begin();
    for (  ; it != list.end(); ++it )
    {
        KSycocaEntry *p = (  *it );
        if (  p->isType(  KST_KService ) )
        {
            // KCModuleInfo(KService*)
            KCModuleInfo *minfo = new KCModuleInfo(
                static_cast<KService*>(  p ) );

            if (  minfo->icon() )
                _icon = DesktopIcon(  minfo->icon(),  KIcon::SizeLarge );
            TIconViewItem* _item = new TIconViewItem( this,
                                                   minfo->moduleName(),
                                                   _icon, minfo );

            connect( this, SIGNAL( executed( QIconViewItem* ) ),
                     this, SLOT( slotItemSelected( QIconViewItem* ) ) );
        } // ignore second level subGroups!
    }
예제 #2
0
void TIconView::setCategory( const QString& path )
{
    clear();

    QPixmap _icon = DesktopIcon( "go", KIcon::SizeMedium ); // defaultIcon

    KServiceGroup::Ptr category = KServiceGroup::group( path );
    if ( !category || !category->isValid() )
        return;

    TIconViewItem *_item;
    KServiceGroup::List list = category->entries(  true,  true );
    KServiceGroup::List::ConstIterator it = list.begin();
    KServiceGroup::List::ConstIterator end = list.end();
    for (  ; it != end; ++it )
    {
        KSycocaEntry *p = (  *it );
        if (  p->isType(  KST_KService ) )
        {
            // KCModuleInfo(KService*)
            KCModuleInfo *minfo = new KCModuleInfo(
                static_cast<KService*>(  p ) );

            if (showExtras == false)
            {
                KSimpleConfig cfg(minfo->fileName());

                cfg.setDesktopGroup();
                if ( cfg.readEntry("Categories").contains("X-KDE-tasma-extra") )
                    continue;
            }

            if (  minfo->icon() )
                _icon = DesktopIcon(  minfo->icon(),  KIcon::SizeLarge );
            _item = new TIconViewItem( this,
                                       minfo->moduleName(),
                                       _icon, minfo , minfo->comment());
        } // ignore second level subGroups!
    }
    list.clear();
}