本文整理汇总了C++中kservice::List::constEnd方法的典型用法代码示例。如果您正苦于以下问题:C++ List::constEnd方法的具体用法?C++ List::constEnd怎么用?C++ List::constEnd使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kservice::List
的用法示例。
在下文中一共展示了List::constEnd方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc,char **argv)
{
KAboutData aboutData("korgplugins", 0,ki18n("KOrgPlugins"),"0.1");
KCmdLineArgs::init(argc,argv,&aboutData);
KApplication app;
KService::List plugins = KOCore::self()->availablePlugins();
KService::List::ConstIterator it;
for(it = plugins.constBegin(); it != plugins.constEnd(); ++it) {
kDebug() << "Plugin:" << (*it)->desktopEntryName() << "("
<< (*it)->name() << ")";
KOrg::Plugin *p = KOCore::self()->loadPlugin(*it);
if (!p) {
kDebug() << "Plugin loading failed.";
} else {
kDebug() << "PLUGIN INFO:" << p->info();
}
}
#ifndef KORG_NOPRINTER
plugins = KOCore::self()->availablePrintPlugins();
for(it = plugins.constBegin(); it != plugins.constEnd(); ++it) {
kDebug() << "Print plugin:" << (*it)->desktopEntryName() << "("
<< (*it)->name() << ")";
KOrg::PrintPlugin *p = KOCore::self()->loadPrintPlugin(*it);
if (!p) {
kDebug() << "Print plugin loading failed.";
} else {
kDebug() << "PRINT PLUGIN INFO:" << p->info();
}
}
#endif
plugins = KOCore::self()->availableParts();
for(it = plugins.constBegin(); it != plugins.constEnd(); ++it) {
kDebug() << "Part:" << (*it)->desktopEntryName() << "("
<< (*it)->name() << ")";
KOrg::Part *p = KOCore::self()->loadPart(*it,0);
if (!p) {
kDebug() << "Part loading failed.";
} else {
kDebug() << "PART INFO:" << p->info();
}
}
plugins = KOCore::self()->availableCalendarDecorations();
for(it = plugins.constBegin(); it != plugins.constEnd(); ++it) {
kDebug() << "CalendarDecoration:" << (*it)->desktopEntryName() << "("
<< (*it)->name() << ")";
KOrg::CalendarDecoration::Decoration *p = KOCore::self()->loadCalendarDecoration(*it);
if (!p) {
kDebug() << "Calendar decoration loading failed.";
} else {
kDebug() << "CALENDAR DECORATION INFO:" << p->info();
}
}
}
示例2: loadPlugins
void PluginManager::loadPlugins()
{
KService::List offers = KServiceTypeTrader::self()->query(QLatin1String("KTpAccountsKCM/AccountUiPlugin"));
KService::List::const_iterator iter;
for (iter = offers.constBegin(); iter < offers.constEnd(); ++iter) {
QString error;
KService::Ptr service = *iter;
KPluginFactory *factory = KPluginLoader(service->library()).factory();
if (!factory) {
qWarning() << "KPluginFactory could not load the plugin:" << service->library();
continue;
}
AbstractAccountUiPlugin *plugin = factory->create<AbstractAccountUiPlugin>(this);
if (plugin) {
qDebug() << "Loaded plugin:" << service->name();
m_plugins.append(plugin);
} else {
qDebug() << error;
}
}
}
示例3: findPartFactory
KParts::Factory* IPartController::findPartFactory ( const QString& mimetype, const QString& parttype, const QString& preferredName )
{
// parttype may be a interface type not derived from KParts/ReadOnlyPart
const KService::List offers = KMimeTypeTrader::self()->query( mimetype,
QString::fromLatin1( "KParts/ReadOnlyPart" ),
QString::fromLatin1( "'%1' in ServiceTypes" ).arg( parttype ) );
if ( ! offers.isEmpty() )
{
KService::Ptr ptr;
// if there is a preferred plugin we'll take it
if ( !preferredName.isEmpty() )
{
KService::List::ConstIterator it;
for ( it = offers.constBegin(); it != offers.constEnd(); ++it )
{
if ( ( *it ) ->desktopEntryName() == preferredName )
{
ptr = ( *it );
break;
}
}
}
// else we just take the first in the list
if ( !ptr )
{
ptr = offers.first();
}
KPluginLoader loader( QFile::encodeName( ptr->library() ) );
return static_cast<KParts::Factory*>( loader.factory() );
}
return 0;
}
示例4:
PluginLoader::PluginLoader()
{
KService::List offers = KServiceTypeTrader::self()->query("KdeConnect/Plugin");
for(KService::List::const_iterator iter = offers.constBegin(); iter != offers.constEnd(); ++iter) {
KService::Ptr service = *iter;
plugins[service->library()] = service;
}
}
示例5: 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*)) );
}
示例6: insertKCMDocs
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 */ );
}
示例7: main
int main( int argc, char **argv )
{
QCoreApplication app(argc, argv);
KLocalizedString::setApplicationDomain("ktraderclient");
KAboutData aboutData(QLatin1String("ktraderclient"), i18n("KTraderClient"), QLatin1String(PROJECT_VERSION));
aboutData.addAuthor(i18n("David Faure"), QString(), "[email protected]");
aboutData.setShortDescription(i18n("A command-line tool for querying the KDE trader system"));
QCommandLineParser parser;
KAboutData::setApplicationData(aboutData);
parser.addVersionOption();
parser.addHelpOption();
aboutData.setupCommandLine(&parser);
parser.addOption(QCommandLineOption(QStringList() << QLatin1String("mimetype"), i18n("A mimetype"), QLatin1String("mimetype")));
parser.addOption(QCommandLineOption(QStringList() << QLatin1String("servicetype"), i18n("A servicetype, like KParts/ReadOnlyPart or KMyApp/Plugin"), QLatin1String("servicetype")));
parser.addOption(QCommandLineOption(QStringList() << QLatin1String("constraint"), i18n("A constraint expressed in the trader query language"), QLatin1String("constraint")));
parser.addOption(QCommandLineOption(QStringList() << QLatin1String("short"), i18n("Output only paths to desktop files")));
parser.process(app);
aboutData.processCommandLine(&parser);
const QString mimetype = parser.value("mimetype");
QString servicetype = parser.value("servicetype");
const QString constraint = parser.value("constraint");
const bool outputProperties = !parser.isSet("short");
if ( mimetype.isEmpty() && servicetype.isEmpty() )
parser.showHelp();
if ( !mimetype.isEmpty() )
printf( "mimetype is : %s\n", qPrintable( mimetype ) );
if ( !servicetype.isEmpty() )
printf( "servicetype is : %s\n", qPrintable( servicetype ) );
if ( !constraint.isEmpty() )
printf( "constraint is : %s\n", qPrintable( constraint ) );
KService::List offers;
if ( !mimetype.isEmpty() ) {
if ( servicetype.isEmpty() )
servicetype = "Application";
offers = KMimeTypeTrader::self()->query( mimetype, servicetype, constraint );
}
else
offers = KServiceTypeTrader::self()->query( servicetype, constraint );
printf("got %d offers.\n", offers.count());
int i = 0;
KService::List::ConstIterator it = offers.constBegin();
const KService::List::ConstIterator end = offers.constEnd();
for (; it != end; ++it, ++i )
{
if (outputProperties) {
printf("---- Offer %d ----\n", i);
QStringList props = (*it)->propertyNames();
QStringList::ConstIterator propIt = props.constBegin();
QStringList::ConstIterator propEnd = props.constEnd();
for (; propIt != propEnd; ++propIt )
{
QVariant prop = (*it)->property( *propIt );
if ( !prop.isValid() )
{
printf("Invalid property %s\n", (*propIt).toLocal8Bit().data());
continue;
}
QString outp = *propIt;
outp += " : '";
switch ( prop.type() )
{
case QVariant::StringList:
outp += prop.toStringList().join(" - ");
break;
case QVariant::Bool:
outp += prop.toBool() ? "TRUE" : "FALSE";
break;
default:
outp += prop.toString();
break;
}
if ( !outp.isEmpty() )
printf("%s'\n", outp.toLocal8Bit().constData());
}
} else {
printf("%s\n", (*it)->entryPath().toLocal8Bit().constData());
}
}
return 0;
}
示例8: main
int main( int argc, char **argv )
{
KCmdLineArgs::init( argc, argv, "ktraderclient", 0, ki18n("KTraderClient"), "0.0" , ki18n("A command-line tool for querying the KDE trader system"));
KCmdLineOptions options;
options.add("mimetype <mimetype>", ki18n("A mimetype"));
options.add("servicetype <servicetype>", ki18n("A servicetype, like KParts/ReadOnlyPart or KMyApp/Plugin"));
options.add("constraint <constraint>", ki18n("A constraint expressed in the trader query language"));
KCmdLineArgs::addCmdLineOptions( options );
KApplication app( false ); // no GUI
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
const QString mimetype = args->getOption( "mimetype" );
QString servicetype = args->getOption( "servicetype" );
const QString constraint = args->getOption( "constraint" );
if ( mimetype.isEmpty() && servicetype.isEmpty() )
KCmdLineArgs::usage();
if ( !mimetype.isEmpty() )
printf( "mimetype is : %s\n", qPrintable( mimetype ) );
if ( !servicetype.isEmpty() )
printf( "servicetype is : %s\n", qPrintable( servicetype ) );
if ( !constraint.isEmpty() )
printf( "constraint is : %s\n", qPrintable( constraint ) );
KService::List offers;
if ( !mimetype.isEmpty() ) {
if ( servicetype.isEmpty() )
servicetype = "Application";
offers = KMimeTypeTrader::self()->query( mimetype, servicetype, constraint );
}
else
offers = KServiceTypeTrader::self()->query( servicetype, constraint );
printf("got %d offers.\n", offers.count());
int i = 0;
KService::List::ConstIterator it = offers.constBegin();
const KService::List::ConstIterator end = offers.constEnd();
for (; it != end; ++it, ++i )
{
printf("---- Offer %d ----\n", i);
QStringList props = (*it)->propertyNames();
QStringList::ConstIterator propIt = props.constBegin();
QStringList::ConstIterator propEnd = props.constEnd();
for (; propIt != propEnd; ++propIt )
{
QVariant prop = (*it)->property( *propIt );
if ( !prop.isValid() )
{
printf("Invalid property %s\n", (*propIt).toLocal8Bit().data());
continue;
}
QString outp = *propIt;
outp += " : '";
switch ( prop.type() )
{
case QVariant::StringList:
outp += prop.toStringList().join(" - ");
break;
case QVariant::Bool:
outp += prop.toBool() ? "TRUE" : "FALSE";
break;
default:
outp += prop.toString();
break;
}
if ( !outp.isEmpty() )
printf("%s'\n", outp.toLocal8Bit().data());
}
}
return 0;
}