当前位置: 首页>>代码示例>>C++>>正文


C++ List::end方法代码示例

本文整理汇总了C++中kservice::List::end方法的典型用法代码示例。如果您正苦于以下问题:C++ List::end方法的具体用法?C++ List::end怎么用?C++ List::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在kservice::List的用法示例。


在下文中一共展示了List::end方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: getViewer

KService::Ptr ArkViewer::getViewer(const QString &mimeType)
{
    // No point in even trying to find anything for application/octet-stream
    if (mimeType == QStringLiteral("application/octet-stream")) {
        return KService::Ptr();
    }

    // Try to get a read-only kpart for the internal viewer
    KService::List offers = KMimeTypeTrader::self()->query(mimeType, QStringLiteral("KParts/ReadOnlyPart"));

    auto arkPartIt = std::find_if(offers.begin(), offers.end(), [](KService::Ptr service) {
        return service->storageId() == QLatin1String("ark_part.desktop");
    });

    // Use the Ark part only when the mime type matches an archive type directly.
    // Many file types (e.g. Open Document) are technically just archives
    // but browsing their internals is typically not what the user wants.
    if (arkPartIt != offers.end()) {
        // Not using hasMimeType() as we're explicitly not interested in inheritance.
        if (!(*arkPartIt)->mimeTypes().contains(mimeType)) {
            offers.erase(arkPartIt);
        }
    }

    // If we can't find a kpart, try to get an external application
    if (offers.isEmpty()) {
        offers = KMimeTypeTrader::self()->query(mimeType, QStringLiteral("Application"));
    }

    if (!offers.isEmpty()) {
        return offers.first();
    } else {
        return KService::Ptr();
    }
}
开发者ID:aelog,项目名称:ark,代码行数:35,代码来源:arkviewer.cpp

示例2: match

void KJiebaRunner::match(Plasma::RunnerContext &context)
{
    const QString term = context.query();
    QList<Plasma::QueryMatch> matches;
    QSet<QString> seen;

    if (term.length() > 1) {
#if DEBUG
        qDebug() << "DEBUG:" << __PRETTY_FUNCTION__ << term;
#endif
        KService::List services = KServiceTypeTrader::self()->query("Application");
        services.erase(std::remove_if(services.begin(),
                                      services.end(),
                                      [=](QExplicitlySharedDataPointer<KService> it) {
            return it->exec().isEmpty() ||
                   (!kjiebaPtr->query(it->genericName()).contains(term)             &&
                    !kjiebaPtr->topinyin(it->genericName()).contains(term)          &&
                    !kjiebaPtr->topinyin(it->genericName(), false).contains(term)   &&
                    !kjiebaPtr->query(it->name()).contains(term)                    &&
                    !kjiebaPtr->topinyin(it->name()).contains(term)                 &&
                    !kjiebaPtr->topinyin(it->name(), false).contains(term));
        }), services.end());

		if (!services.isEmpty()) {
            Q_FOREACH (const KService::Ptr &service, services) {
                if (!service->noDisplay() &&
                    service->property(QStringLiteral("NotShowIn"), QVariant::String) != "KDE") {
                    Plasma::QueryMatch match(this);
                    match.setType(Plasma::QueryMatch::ExactMatch);

					const QString name = service->name();
#if DEBUG
                    qDebug() << "DEBUG:" << name;
#endif
                    match.setText(name);
                    match.setData(service->storageId());

                    if (!service->genericName().isEmpty() && service->genericName() != name)
                        match.setSubtext(service->genericName());
                    else if (!service->comment().isEmpty())
                        match.setSubtext(service->comment());
                   
                    if (!service->icon().isEmpty())
                        match.setIcon(QIcon::fromTheme(service->icon()));

                    match.setRelevance(1);
                    matches << match;
                    seen.insert(service->storageId());
                    seen.insert(service->exec());
                }
            }
        }
开发者ID:isoft-linux,项目名称:kjieba,代码行数:52,代码来源:kjiebarunner.cpp

示例3: load

void CfgComponent::load(KConfig *cfg) {

	ComponentSelector->clear();
	m_lookupDict.clear();
	m_revLookupDict.clear();

	const KConfigGroup mainGroup = cfg->group(QByteArray());
	const QString serviceTypeToConfigure = mainGroup.readEntry("ServiceTypeToConfigure");

	const KService::List offers = KServiceTypeTrader::self()->query(serviceTypeToConfigure);

	for (KService::List::const_iterator tit = offers.begin(); tit != offers.end(); ++tit) {
		ComponentSelector->addItem((*tit)->name());
		m_lookupDict.insert((*tit)->name(), (*tit)->desktopEntryName());
		m_revLookupDict.insert((*tit)->desktopEntryName(), (*tit)->name());
	}

	KConfig store(mainGroup.readPathEntry("storeInFile","null"));
        const KConfigGroup group(&store, mainGroup.readEntry("valueSection"));
	QString setting = group.readEntry(mainGroup.readEntry("valueName","kcm_componenchooser_null"), QString());

	if (setting.isEmpty())
            setting = mainGroup.readEntry("defaultImplementation", QString());
	QString tmp = m_revLookupDict.value(setting);
	if (!tmp.isEmpty()) {
		for (int i=0;i<ComponentSelector->count();i++)
			if (tmp==ComponentSelector->itemText(i))
			{
				ComponentSelector->setCurrentIndex(i);
				break;
			}
        }
	emit changed(false);
}
开发者ID:mafrez,项目名称:plasma-desktop,代码行数:34,代码来源:componentchooser.cpp

示例4: slotFixOpenWithMenu

void KateFileTree::slotFixOpenWithMenu()
{
  QMenu *menu = (QMenu*)sender();
  menu->clear();
  
   KTextEditor::Document *doc = model()->data(m_indexContextMenu, KateFileTreeModel::DocumentRole).value<KTextEditor::Document *>();
  if (!doc) return;

  // get a list of appropriate services.
  KMimeType::Ptr mime = KMimeType::mimeType(doc->mimeType());
  //kDebug(13001) << "mime type: " << mime->name();

  QAction *a = 0;
  KService::List offers = KMimeTypeTrader::self()->query(mime->name(), "Application");
  // for each one, insert a menu item...
  for(KService::List::Iterator it = offers.begin(); it != offers.end(); ++it)
  {
    KService::Ptr service = *it;
    if (service->name() == "Kate") continue;
    a = menu->addAction(KIcon(service->icon()), service->name());
    a->setData(service->entryPath());
  }
  // append "Other..." to call the KDE "open with" dialog.
  a = menu->addAction(i18n("&Other..."));
  a->setData(QString());
}
开发者ID:azat-archive,项目名称:kate,代码行数:26,代码来源:katefiletree.cpp

示例5: QLabel

KServiceSelectDlg::KServiceSelectDlg(const QString & /*serviceType*/, const QString & /*value*/, QWidget *parent)
    : KDialogBase(parent, "serviceSelectDlg", true, i18n("Add Service"), Ok | Cancel, Ok)
{
    QVBox *vbox = new QVBox(this);

    vbox->setSpacing(KDialog::spacingHint());
    new QLabel(i18n("Select service:"), vbox);
    m_listbox = new KListBox(vbox);

    // Can't make a KTrader query since we don't have a servicetype to give,
    // we want all services that are not applications.......
    // So we have to do it the slow way
    // ### Why can't we query for KParts/ReadOnlyPart as the servicetype? Should work fine!
    KService::List allServices = KService::allServices();
    QValueListIterator< KService::Ptr > it(allServices.begin());
    for(; it != allServices.end(); ++it)
        if((*it)->hasServiceType("KParts/ReadOnlyPart"))
        {
            m_listbox->insertItem(new KServiceListItem((*it), KServiceListWidget::SERVICELIST_SERVICES));
        }

    m_listbox->sort();
    m_listbox->setMinimumHeight(350);
    m_listbox->setMinimumWidth(300);
    connect(m_listbox, SIGNAL(doubleClicked(QListBoxItem *)), SLOT(slotOk()));
    setMainWidget(vbox);
}
开发者ID:serghei,项目名称:kde3-kdebase,代码行数:27,代码来源:kserviceselectdlg.cpp

示例6: registeredToDCOP

void KIMProxy::registeredToDCOP( const TQCString& appId )
{
	//kdDebug( 790 ) << k_funcinfo << " appId '" << appId << "'" << endl;
	// check that appId implements our service
	// if the appId ends with a number, i.e. a pid like in foobar-12345,
	if ( appId.isEmpty() )
		return;

	bool newApp = false;
	// get an up to date list of offers in case a new app was installed
	// and check each of the offers that implement the service type we're looking for,
	// to see if any of them are the app that just registered
	const KService::List offers = KServiceType::offers( IM_SERVICE_TYPE );
	KService::List::const_iterator it;
	for ( it = offers.begin(); it != offers.end(); ++it )
	{
		TQCString dcopObjectId = "KIMIface";
		TQCString dcopService = (*it)->property("X-DCOP-ServiceName").toString().latin1();
		if ( appId.left( dcopService.length() ) == dcopService )
		{
			// if it's not already known, insert it
			if ( !m_im_client_stubs.find( appId ) )
			{
				newApp = true;
				kdDebug( 790 ) << "App: " << appId << ", dcopService: " << dcopService << " started, using it for presence info."<< endl;
				m_im_client_stubs.insert( appId, new KIMIface_stub( d->dc, appId, dcopObjectId ) );
			}
		}
		//else
		//	kdDebug( 790 ) << "App doesn't implement our ServiceType" << endl;
	}
	//if ( newApp )
	//	emit sigPresenceInfoExpired();
}
开发者ID:Fat-Zer,项目名称:tdelibs,代码行数:34,代码来源:tdeimproxy.cpp

示例7: QObject

ToggleViewGUIClient::ToggleViewGUIClient( KonqMainWindow *mainWindow )
: QObject( mainWindow )
{
  m_mainWindow = mainWindow;

  KService::List offers = KServiceTypeTrader::self()->query( "Browser/View" );
  KService::List::Iterator it = offers.begin();
  while ( it != offers.end() )
  {
    QVariant prop = (*it)->property( "X-KDE-BrowserView-Toggable" );
    QVariant orientation = (*it)->property( "X-KDE-BrowserView-ToggableView-Orientation" );

    if ( !prop.isValid() || !prop.toBool() ||
         !orientation.isValid() || orientation.toString().isEmpty() )
    {
      offers.erase( it );
      it = offers.begin();
    }
    else
      ++it;
  }

  m_empty = ( offers.count() == 0 );

  if ( m_empty )
    return;

  KService::List::ConstIterator cIt = offers.constBegin();
  KService::List::ConstIterator cEnd = offers.constEnd();
  for (; cIt != cEnd; ++cIt )
  {
    QString description = i18n( "Show %1" ,  (*cIt)->name() );
    QString name = (*cIt)->desktopEntryName();
    //kDebug() << "ToggleViewGUIClient: name=" << name;
    KToggleAction *action = new KToggleAction( description, this );
    mainWindow->actionCollection()->addAction( name.toLatin1(), action );

    // HACK
    if ( (*cIt)->icon() != "unknown" )
      action->setIcon( KIcon((*cIt)->icon()) );

    connect( action, SIGNAL(toggled(bool)),
             this, SLOT(slotToggleView(bool)) );

    m_actions.insert( name, action );

    QVariant orientation = (*cIt)->property( "X-KDE-BrowserView-ToggableView-Orientation" );
    bool horizontal = orientation.toString().toLower() == "horizontal";
    m_mapOrientation.insert( name, horizontal );
  }

  connect( m_mainWindow, SIGNAL(viewAdded(KonqView*)),
           this, SLOT(slotViewAdded(KonqView*)) );
  connect( m_mainWindow, SIGNAL(viewRemoved(KonqView*)),
           this, SLOT(slotViewRemoved(KonqView*)) );
}
开发者ID:blue-shell,项目名称:folderview,代码行数:56,代码来源:konqguiclients.cpp

示例8: loadExtension

void ExtensionMgr::loadExtension(const QString& name) {
  KService::List sl = KServiceType::offers("Kst Extension");
  for (KService::List::ConstIterator it = sl.begin(); it != sl.end(); ++it) {
    KService::Ptr service = *it;
    if (name == service->property("Name").toString()) {
      loadExtension(service);
      return;
    }
  }
}
开发者ID:Kst-plot,项目名称:kst-subversion-archive,代码行数:10,代码来源:extensionmgr.cpp

示例9: info

QList<KPluginInfo> KPluginInfo::fromServices(const KService::List &services, const KConfigGroup &config)
{
    QList<KPluginInfo> infolist;
    for( KService::List::ConstIterator it = services.begin();
            it != services.end(); ++it )
    {
        KPluginInfo info(*it);
        info.setConfig(config);
        infolist += info;
    }
    return infolist;
}
开发者ID:crayonink,项目名称:calligra-2,代码行数:12,代码来源:kplugininfo.cpp

示例10: mimeTypes

MainWindow::OfferType MainWindow::ExternalPopup::appInfos(const DB::FileNameList& files )
{
    StringSet types = mimeTypes( files );
    OfferType res;
    for ( StringSet::const_iterator mimeTypeIt = types.begin(); mimeTypeIt != types.end(); ++mimeTypeIt ) {
        KService::List offers = KMimeTypeTrader::self()->query( *mimeTypeIt, QLatin1String( "Application" ));
        for(KService::List::Iterator offerIt = offers.begin(); offerIt != offers.end(); ++offerIt) {
            res.insert( qMakePair( (*offerIt)->name(), (*offerIt)->icon() ) );
            _appToMimeTypeMap[(*offerIt)->name()].insert( *mimeTypeIt );
        }
    }
    return res;
}
开发者ID:Df458,项目名称:kphotoalbum-multitags-branch,代码行数:13,代码来源:ExternalPopup.cpp

示例11: initialize

bool KIMProxy::initialize()
{
	if ( !m_initialized )
	{
		m_initialized = true; // we should only do this once, as registeredToDCOP() will catch any new starts
		// So there is no error from a failed query when using tdelibs 3.2, which don't have this servicetype
		if ( KServiceType::serviceType( IM_SERVICE_TYPE ) ) 
		{
			//kdDebug( 790 ) << k_funcinfo << endl;
			TQCString dcopObjectId = "KIMIface";
	
			// see what apps implementing our service type are out there
			KService::List offers = KServiceType::offers( IM_SERVICE_TYPE );
			KService::List::iterator offer;
			typedef TQValueList<TQCString> QCStringList;
			QCStringList registeredApps = d->dc->registeredApplications();
			QCStringList::iterator app;
			const QCStringList::iterator end = registeredApps.end();
			// for each registered app
			for ( app = registeredApps.begin(); app != end; ++app )
			{
				//kdDebug( 790 ) << " considering: " << *app << endl;
				//for each offer
				for ( offer = offers.begin(); offer != offers.end(); ++offer )
				{
					TQCString dcopService = (*offer)->property("X-DCOP-ServiceName").toString().latin1();
					if ( !dcopService.isEmpty() )
					{
						//kdDebug( 790 ) << " is it: " << dcopService << "?" << endl;
						// get the application name ( minus any process ID )
						TQCString instanceName =  (*app).left( dcopService.length() );
						// if the application implements the dcop service, add it 
						if ( instanceName == dcopService )
						{
							m_apps_available = true;
							//kdDebug( 790 ) << " app name: " << (*offer)->name() << ", has instance " << *app << ", dcopService: " << dcopService << endl;
							if ( !m_im_client_stubs.find( dcopService ) )
							{
								kdDebug( 790 ) << "App " << *app << ", dcopObjectId " << dcopObjectId << " found, using it for presence info." << endl;
								m_im_client_stubs.insert( *app, new KIMIface_stub( d->dc, *app, dcopObjectId ) );
								pollApp( *app );
							}
						}
					}
				}
			}
		}
	}
	return !m_im_client_stubs.isEmpty();
}
开发者ID:Fat-Zer,项目名称:tdelibs,代码行数:50,代码来源:tdeimproxy.cpp

示例12: servicesForOpenWith

KService::List FileOperation::servicesForOpenWith(const QList<QUrl>& urls)
{
    // This code is inspired by KonqMenuActions:
    // kdebase/apps/lib/konq/konq_menuactions.cpp

    QStringList    mimeTypes;
    KService::List offers;

    foreach(const QUrl& item, urls)
    {
        const QString mimeType = QMimeDatabase().mimeTypeForFile(item.path(), QMimeDatabase::MatchExtension).name();

        if (!mimeTypes.contains(mimeType))
        {
            mimeTypes << mimeType;
        }
    }

    if (!mimeTypes.isEmpty())
    {
        // Query trader
        const QString firstMimeType      = mimeTypes.takeFirst();
        const QString constraintTemplate = QLatin1String("'%1' in ServiceTypes");
        QStringList constraints;

        foreach(const QString& mimeType, mimeTypes)
        {
            constraints << constraintTemplate.arg(mimeType);
        }

        offers = KMimeTypeTrader::self()->query(firstMimeType, QLatin1String("Application"), constraints.join(QLatin1String(" and ")));

        // remove duplicate service entries
        QSet<QString> seenApps;

        for (KService::List::iterator it = offers.begin(); it != offers.end();)
        {
            const QString appName((*it)->name());

            if (!seenApps.contains(appName))
            {
                seenApps.insert(appName);
                ++it;
            }
            else
            {
                it = offers.erase(it);
            }
        }
    }
开发者ID:swatilodha,项目名称:digikam,代码行数:50,代码来源:fileoperation.cpp

示例13: addPlugins

void KonqPopupMenuPrivate::addPlugins()
{
    QString commonMimeType = m_popupItemProperties.mimeType();
    if (commonMimeType.isEmpty()) {
        commonMimeType = QLatin1String("application/octet-stream");
    }
    const KService::List konqPlugins = KMimeTypeTrader::self()->query(commonMimeType, "KonqPopupMenu/Plugin", "exist Library");

    if (!konqPlugins.isEmpty()) {
        m_popupMenuInfo.setItemListProperties(m_popupItemProperties);
        m_popupMenuInfo.setParentWidget(m_parentWidget);
        KService::List::ConstIterator iterator = konqPlugins.begin();
        const KService::List::ConstIterator end = konqPlugins.end();
        for(; iterator != end; ++iterator) {
            //kDebug() << (*iterator)->name() << (*iterator)->library();
            KonqPopupMenuPlugin *plugin = (*iterator)->createInstance<KonqPopupMenuPlugin>(q);
            if (!plugin)
                continue;
            plugin->setParent(q);
            plugin->setup(&m_ownActionCollection, m_popupMenuInfo, q);
        }
    }

    const KService::List fileItemPlugins = KMimeTypeTrader::self()->query(commonMimeType, "KFileItemAction/Plugin", "exist Library");
    if (!fileItemPlugins.isEmpty()) {
        const KConfig config("kservicemenurc", KConfig::NoGlobals);
        const KConfigGroup showGroup = config.group("Show");

        foreach (const KSharedPtr<KService>& service, fileItemPlugins) {
            if (!showGroup.readEntry(service->desktopEntryName(), true)) {
                // The plugin has been disabled
                continue;
            }

            // Old API (kdelibs-4.6.0 only)
            KFileItemActionPlugin* plugin = service->createInstance<KFileItemActionPlugin>();
            if (plugin) {
                plugin->setParent(q);
                q->addActions(plugin->actions(m_popupItemProperties, m_parentWidget));
            }
            // New API (kdelibs >= 4.6.1)
            KAbstractFileItemActionPlugin* abstractPlugin = service->createInstance<KAbstractFileItemActionPlugin>();
            if (abstractPlugin) {
                abstractPlugin->setParent(q);
                q->addActions(abstractPlugin->actions(m_popupItemProperties, m_parentWidget));
            }
        }
    }
}
开发者ID:blue-shell,项目名称:folderview,代码行数:49,代码来源:konq_popupmenu.cpp

示例14: loadPlugins

void PluginManager::loadPlugins()
{
    DEBUG_FUNC_NAME
    KConfigGroup group = KGlobal::config()->group( "Plugins" );
    KService::List offers = KServiceTypeTrader::self()->query(
                                QString::fromLatin1( "GluonCreator/Plugin" ),
                                QString( "[X-KDE-GluonCreatorPluginVersion] == %1" ).arg( GLUONCREATOR_PLUGIN_VERSION ) );

    KService::List::const_iterator iter;
    for( iter = offers.begin(); iter < offers.end(); ++iter )
    {
        QString error;
        KService::Ptr service = *iter;

        QString serviceName = service->desktopEntryName();
        bool loadPlugin = group.readEntry<bool>( QString( "%1Enabled" ).arg( serviceName ), true );

        if( !d->loadedPlugins.contains( serviceName ) && loadPlugin )
        {
            KPluginFactory* factory = KPluginLoader( service->library() ).factory();

            if( !factory )
            {
                DEBUG_TEXT( QString( "KPluginFactory could not load the plugin: %1" ).arg( service->library() ) );
                continue;
            }

            Plugin* plugin = factory->create<Plugin>( this );

            if( plugin )
            {
                DEBUG_TEXT( QString( "Load plugin: %1" ).arg( service->name() ) );
                plugin->load( d->mainWindow );
                d->loadedPlugins.insert( serviceName, plugin );
            }
            else
            {
                DEBUG_TEXT( error );
            }
        }
        else if( !loadPlugin && d->loadedPlugins.contains( serviceName ) )
        {
            Plugin* plugin = d->loadedPlugins.value( serviceName );
            plugin->unload( d->mainWindow );
            delete plugin;
            d->loadedPlugins.remove( serviceName );
        }
    }
}
开发者ID:pranavrc,项目名称:example-gluon,代码行数:49,代码来源:pluginmanager.cpp

示例15: loadServices

void BackendSelection::loadServices(const KService::List &offers)
{
    m_services.clear();
    m_select->clear();

    KService::List::const_iterator it = offers.begin();
    const KService::List::const_iterator end = offers.end();
    for (; it != end; ++it)
    {
        KService::Ptr service = *it;
        m_select->addItem(service->name());
        m_services[service->name()] = service;
    }
    m_select->setItemSelected(m_select->item(0), true);
}
开发者ID:KDE,项目名称:kde-runtime,代码行数:15,代码来源:backendselection.cpp


注:本文中的kservice::List::end方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。