예제 #1
0
void Navigator::insertKCMDocs( const QString &name, NavigatorItem *topItem, const QString &type )
{
  kDebug(1400) << "Requested KCM documents for ID" << name;
  QString systemsettingskontrolconstraint = "[X-KDE-System-Settings-Parent-Category] != ''";
  QString konquerorcontrolconstraint = "[X-KDE-PluginKeyword] == 'khtml_general'\
                                     or [X-KDE-PluginKeyword] == 'performance'\
                                     or [X-KDE-PluginKeyword] == 'bookmarks'";
  QString filemanagercontrolconstraint = "[X-KDE-PluginKeyword] == 'behavior'\
                                       or [X-KDE-PluginKeyword] == 'dolphinviewmodes'\
                                       or [X-KDE-PluginKeyword] == 'dolphinnavigation'\
                                       or [X-KDE-PluginKeyword] == 'dolphinservices'\
                                       or [X-KDE-PluginKeyword] == 'dolphingeneral'\
                                       or [X-KDE-PluginKeyword] == 'trash'";
  QString browsercontrolconstraint = "[X-KDE-PluginKeyword] == 'khtml_behavior'\
                                   or [X-KDE-PluginKeyword] == 'proxy'\
                                   or [X-KDE-PluginKeyword] == 'khtml_appearance'\
                                   or [X-KDE-PluginKeyword] == 'khtml_filter'\
                                   or [X-KDE-PluginKeyword] == 'cache'\
                                   or [X-KDE-PluginKeyword] == 'cookie'\
                                   or [X-KDE-PluginKeyword] == 'useragent'\
                                   or [X-KDE-PluginKeyword] == 'khtml_java_js'\
                                   or [X-KDE-PluginKeyword] == 'khtml_plugins'";
/* missing in browsercontrolconstraint
History                 no X-KDE-PluginKeyword in kcmhistory.desktop
*/
  QString othercontrolconstraint = "[X-KDE-PluginKeyword] == 'cgi'";

  KService::List list;

  if ( type == QString("kcontrol") ) {
    list = KServiceTypeTrader::self()->query( "KCModule", systemsettingskontrolconstraint );
  } else if ( type == QString("konquerorcontrol") ) {
    list = KServiceTypeTrader::self()->query( "KCModule", konquerorcontrolconstraint );
  } else if ( type == QString("browsercontrol") ) {
    list = KServiceTypeTrader::self()->query( "KCModule", browsercontrolconstraint );
  } else if ( type == QString("filemanagercontrol") ) {
    list = KServiceTypeTrader::self()->query( "KCModule", filemanagercontrolconstraint );
  } else if ( type == QString("othercontrol") ) {
    list = KServiceTypeTrader::self()->query( "KCModule", othercontrolconstraint );
  } else if ( type == QString("kinfocenter") ) {
    list = KServiceTypeTrader::self()->query( "KCModule", "[X-KDE-ParentApp] == 'kinfocenter'" );
  }

  for ( KService::List::const_iterator it = list.constBegin(); it != list.constEnd(); ++it )
  {
    KService::Ptr s = (*it);
    KCModuleInfo m = KCModuleInfo(s);
    QString desktopFile = KStandardDirs::locate( "services", m.fileName() );
    createItemFromDesktopFile( topItem, desktopFile );
    }
    topItem->sortChildren( 0, Qt::AscendingOrder /* ascending */ );
}
예제 #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();
}