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


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

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


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

示例1: queryButtonClicked

void AdminDatabase::queryButtonClicked()
{
	if ( ! m_listView->currentItem() )
		return;
	
	QVBox *widget = new QVBox(this);

	KTrader::OfferList offers = KTrader::self()->query("text/plain", "'KParts/ReadOnlyPart' in ServiceTypes");
	
	KLibFactory *factory = 0;

	KTrader::OfferList::Iterator it(offers.begin());
	for( ; it != offers.end(); ++it)
	{
		KService::Ptr ptr = (*it);
		factory = KLibLoader::self()->factory( ptr->library() );
		if (factory)
		{
			m_part = static_cast<KParts::ReadOnlyPart *>(factory->create(widget, ptr->name(), "KParts::ReadOnlyPart"));
			m_part->openURL("file://"+m_dumpDir->absPath()+"/"+m_listView->getText(0)+".sql");
			break;
		}
	}
	
	if (!factory)
	{
		KMessageBox::error(this, i18n("Could not find a suitable  component"));
		return;
	}
	
	emit sendWidget(widget,i18n("View dump")); 
}
开发者ID:BackupTheBerlios,项目名称:kludoteca-svn,代码行数:32,代码来源:admindatabase.cpp

示例2: KaffeineDVBsection

DVBevents::DVBevents( QString devType, int anum, int tnum, const QString &charset, EventTable *table )
	: KaffeineDVBsection( anum, tnum, charset )
{
	events = table;
	KaffeineEpgPlugin *plug;
	QString plugName;
	int error;

	KTrader::OfferList offers = KTrader::self()->query("KaffeineEpgPlugin");
	KTrader::OfferList::Iterator end( offers.end() );
	for ( KTrader::OfferList::Iterator it=offers.begin(); it!=end; ++it ) {
		error = 0;
		KService::Ptr ptr = (*it);
		if ( !ptr->name().contains(devType) )
			continue;
		plug = KParts::ComponentFactory::createPartInstanceFromService<KaffeineEpgPlugin>(ptr, 0, ptr->name().ascii(), 0, 0, 0, &error );
		plugName = ptr->desktopEntryName();
		if (error > 0) {
			fprintf( stderr, "Loading of EPG plugin %s failed: %s\n", plugName.ascii(), KLibLoader::self()->lastErrorMessage().ascii() );
			plug = NULL;
		}
		else {
			plugs.append( plug );
			plug->setTable( table );
			plug->initSection( anum, tnum, charset );
			plugNames.append( plugName );
		}
	}
	fprintf( stderr, "%d EPG plugins loaded for device %d:%d.\n", plugs.count(), anum, tnum );
}
开发者ID:iegor,项目名称:kdesktop,代码行数:30,代码来源:dvbevents.cpp

示例3: load

void CfgComponent::load(KConfig *cfg)
{

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

    QString ServiceTypeToConfigure = cfg->readEntry("ServiceTypeToConfigure");

    QString MimeTypeOfInterest = cfg->readEntry("MimeTypeOfInterest");
    KTrader::OfferList offers = KTrader::self()->query(MimeTypeOfInterest, "'" + ServiceTypeToConfigure + "' in ServiceTypes");

    for(KTrader::OfferList::Iterator tit = offers.begin(); tit != offers.end(); ++tit)
    {
        ComponentSelector->insertItem((*tit)->name());
        m_lookupDict.insert((*tit)->name(), new QString((*tit)->desktopEntryName()));
        m_revLookupDict.insert((*tit)->desktopEntryName(), new QString((*tit)->name()));
    }

    KConfig *store = new KConfig(cfg->readPathEntry("storeInFile", "null"));
    store->setGroup(cfg->readEntry("valueSection"));
    QString setting = store->readEntry(cfg->readEntry("valueName", "kcm_componenchooser_null"));
    delete store;
    if(setting.isEmpty())
        setting = cfg->readEntry("defaultImplementation");
    QString *tmp = m_revLookupDict[setting];
    if(tmp)
        for(int i = 0; i < ComponentSelector->count(); i++)
            if((*tmp) == ComponentSelector->text(i))
            {
                ComponentSelector->setCurrentItem(i);
                break;
            }
    emit changed(false);
}
开发者ID:serghei,项目名称:kde3-kdebase,代码行数:35,代码来源:componentchooser.cpp

示例4: createViewFactories

void ViewManager::createViewFactories()
{
    const KTrader::OfferList plugins = KTrader::self()->query("KAddressBook/View",
                                       QString("[X-KDE-KAddressBook-ViewPluginVersion] == %1").arg(KAB_VIEW_PLUGIN_VERSION));
    KTrader::OfferList::ConstIterator it;
    for(it = plugins.begin(); it != plugins.end(); ++it)
    {
        if(!(*it)->hasServiceType("KAddressBook/View"))
            continue;

        KLibFactory *factory = KLibLoader::self()->factory((*it)->library().latin1());

        if(!factory)
        {
            kdDebug(5720) << "ViewManager::createViewFactories(): Factory creation failed" << endl;
            continue;
        }

        ViewFactory *viewFactory = static_cast<ViewFactory *>(factory);

        if(!viewFactory)
        {
            kdDebug(5720) << "ViewManager::createViewFactories(): Cast failed" << endl;
            continue;
        }

        mViewFactoryDict.insert(viewFactory->type(), viewFactory);
    }
}
开发者ID:serghei,项目名称:kde3-kdepim,代码行数:29,代码来源:viewmanager.cpp

示例5: QWidget

ksimoptsView::ksimoptsView(QWidget *parent)
    : QWidget(parent),
      DCOPObject("ksimoptsIface")
{
    // setup our layout manager to automatically add our widgets
    QHBoxLayout *top_layout = new QHBoxLayout(this);
    top_layout->setAutoAdd(true);

    // we want to look for all components that satisfy our needs.  the
    // trader will actually search through *all* registered KDE
    // applications and components -- not just KParts.  So we have to
    // specify two things: a service type and a constraint
    //
    // the service type is like a mime type.  we say that we want all
    // applications and components that can handle HTML -- 'text/html'
    //
    // however, by itself, this will return such things as Netscape..
    // not what we wanted.  so we constrain it by saying that the
    // string 'KParts/ReadOnlyPart' must be found in the ServiceTypes
    // field.  with this, only components of the type we want will be
    // returned.
    KTrader::OfferList offers = KTrader::self()->query("text/html", "'KParts/ReadWritePart' in ServiceTypes");

    KLibFactory *factory = 0;
    // in theory, we only care about the first one.. but let's try all
    // offers just in case the first can't be loaded for some reason
    KTrader::OfferList::Iterator it(offers.begin());
    for( ; it != offers.end(); ++it)
    {
        KService::Ptr ptr = (*it);

        // we now know that our offer can handle HTML and is a part.
        // since it is a part, it must also have a library... let's try to
        // load that now
        factory = KLibLoader::self()->factory( ptr->library() );
        if (factory)
        {
            m_html = static_cast<KParts::ReadWritePart *>(factory->create(this, ptr->name(), "KParts::ReadWritePart"));
            break;
        }
    }

    // if our factory is invalid, then we never found our component
    // and we might as well just exit now
    if (!factory)
    {
        KMessageBox::error(this, i18n("Could not find a suitable HTML component"));
        return;
    }

    connect(m_html, SIGNAL(setWindowCaption(const QString&)),
            this,   SLOT(slotSetTitle(const QString&)));
    connect(m_html, SIGNAL(setStatusBarText(const QString&)),
            this,   SLOT(slotOnURL(const QString&)));

}
开发者ID:BackupTheBerlios,项目名称:ksimopts-svn,代码行数:56,代码来源:ksimoptsview.cpp

示例6: displayPluginList

void ImportWizard::displayPluginList()
{
  KTrader::OfferList plugins = KFTPAPI::getInstance()->pluginManager()->getImportPlugins();

  KTrader::OfferList::ConstIterator end(plugins.end());
  for (KTrader::OfferList::ConstIterator i(plugins.begin()); i != end; ++i) {
    KService::Ptr service = *i;

    new PluginListItem(m_pluginList, service);
  }
}
开发者ID:netrunner-debian-kde-extras,项目名称:kftpgrabber,代码行数:11,代码来源:importwizard.cpp

示例7: init

void PluginSelectDialog::init( )
{
	const QValueList<KDevPlugin*> loadedPlugins = PluginController::getInstance()->loadedPlugins();
	QStringList loadedPluginDesktopNames;
	QValueList<KDevPlugin*>::ConstIterator it = loadedPlugins.begin();
	while( it != loadedPlugins.end() )
	{
		loadedPluginDesktopNames << (*it)->instance()->instanceName();
		++it;
	}

	kdDebug(9000) << " *** loadedPluginDesktopNames: " << loadedPluginDesktopNames << endl;

	KTrader::OfferList localOffers;
	if ( ProjectManager::getInstance()->projectLoaded() )
	{
		localOffers = PluginController::getInstance()->engine().offers(
			PluginController::getInstance()->currentProfile(), ProfileEngine::Project );
	}

	KTrader::OfferList globalOffers = PluginController::getInstance()->engine().offers(
		PluginController::getInstance()->currentProfile(), ProfileEngine::Global);

	KTrader::OfferList offers = localOffers + globalOffers;
	for (KTrader::OfferList::ConstIterator it = offers.begin(); it != offers.end(); ++it)
	{
		// parse out any existing url to make it clickable
		QString Comment = (*it)->comment();
		QRegExp re("\\bhttp://[\\S]*");
		re.search( Comment );
		Comment.replace( re, "" );

		QString url;
		if ( re.pos() > -1 )
		{
			url = re.cap();
		}

		PluginItem *item = new PluginItem( plugin_list, (*it)->desktopEntryName(), (*it)->genericName(), Comment, url );
		item->setOn( loadedPluginDesktopNames.contains( (*it)->desktopEntryName() ) );

		kdDebug(9000) << (*it)->desktopEntryName() << " : " << (loadedPluginDesktopNames.contains( (*it)->desktopEntryName() ) ? "YES" : "NO" ) << endl;
	}

	QListViewItem * first = plugin_list->firstChild();
	if ( first )
	{
		plugin_list->setSelected( first, true );
	}
}
开发者ID:serghei,项目名称:kde3-kdevelop,代码行数:50,代码来源:pluginselectdialog.cpp

示例8: QWidget

EditorChooser::EditorChooser(QWidget *parent, const char *name) : QWidget(parent, name)
{
    d = new PrivateEditorChooser();

    // sizemanagment
    QGridLayout *grid = new QGridLayout(this, 1, 1);


    d->chooser = new EditorChooser_UI(this, name);

    grid->addWidget(d->chooser, 0, 0);


    KTrader::OfferList offers = KTrader::self()->query("text/plain", "'KTextEditor/Document' in ServiceTypes");
    KConfig *config = new KConfig("default_components");
    config->setGroup("KTextEditor");
    QString editor = config->readPathEntry("embeddedEditor");

    if(editor.isEmpty())
        editor = "katepart";

    for(KTrader::OfferList::Iterator it = offers.begin(); it != offers.end(); ++it)
    {
        if((*it)->desktopEntryName().contains(editor))
        {
            d->chooser->editorCombo->insertItem(i18n("System Default (%1)").arg((*it)->name()));
            break;
        }
    }

    for(KTrader::OfferList::Iterator it = offers.begin(); it != offers.end(); ++it)
    {
        d->chooser->editorCombo->insertItem((*it)->name());
        d->elements.append((*it)->desktopEntryName());
    }
    d->chooser->editorCombo->setCurrentItem(0);
}
开发者ID:serghei,项目名称:kde3-kdelibs,代码行数:37,代码来源:editorchooser.cpp

示例9: insertOpenWithMenu

void BaseTreeView::insertOpenWithMenu(KPopupMenu *menu, int position)
{
  if (m_openWithMenuId != -1)
    menu->removeItem(m_openWithMenuId);
  for (uint i = 0; i < m_openWithActions.count(); i++)
  {
    KAction *action = m_openWithActions[i];
    delete action;
  }
  m_openWithActions.clear();
  KURL urlToOpen = currentURL();
  QString mimeType = KMimeType::findByURL(urlToOpen, 0, true, true)->name();
  KTrader::OfferList offers = KTrader::self()->query(mimeType, "Type == 'Application'");
  QDict<QuantaPlugin> plugins = QuantaPluginInterface::ref()->plugins();   
  m_pluginIds.clear();

  if (offers.count() > 0 || plugins.count() > 0)
  {
    m_openWithMenu = new KPopupMenu(this);
    if (offers.count() > 0) 
    {
      KTrader::OfferList::Iterator it;
      for (it = offers.begin(); it != offers.end(); ++it)
      {
        KAction *action = new KAction((*it)->name(), (*it)->icon(), 0, 0, QFile::encodeName((*it)->desktopEntryPath()).data());
        connect(action, SIGNAL(activated()), this, SLOT(slotOpenWithApplication()));
        action->plug(m_openWithMenu);
        m_openWithActions.append(action);
      }
      m_openWithMenu->insertSeparator();
    }
    if (plugins.count() > 0)
    {
      m_openWithMenu->insertTitle(i18n("Plugins"));
      QDictIterator<QuantaPlugin> it2(plugins);
      for(;it2.current();++it2)
      {
        int id = m_openWithMenu->insertItem(KGlobal::iconLoader()->loadIconSet(it2.current()->icon(),KIcon::Small), it2.current()->name());
        m_pluginIds[id] = it2.current();
      }
      connect(m_openWithMenu, SIGNAL(activated(int)), SLOT(slotOpenWithActivated(int)));    
      m_openWithMenu->insertSeparator();
    }
    m_openWithMenu->insertItem(i18n("&Other..."), this, SLOT(slotOpenWith()));
    m_openWithMenuId = menu->insertItem(i18n("Open &With"), m_openWithMenu, -1, position);
  } else
    m_openWithMenuId = menu->insertItem(i18n("Open &With..."), this, SLOT(slotOpenWith()), 0, -1, position);
}
开发者ID:serghei,项目名称:kde3-kdewebdev,代码行数:48,代码来源:basetreeview.cpp

示例10: searchExtParts

void KDiffTextEdit::searchExtParts()
{
  // only execute once
  static bool init = false;
  if ( init )
    return;
  init = true;

  // search all parts that can handle text/x-diff
  KTrader::OfferList offers = KTrader::self()->query("text/x-diff", "('KParts/ReadOnlyPart' in ServiceTypes) and ('text/x-diff' in ServiceTypes) and (DesktopEntryName != 'katepart')");
  KTrader::OfferList::const_iterator it;
  for ( it = offers.begin(); it != offers.end(); ++it ) {
    KService::Ptr ptr = (*it);
    extPartsTranslated << ptr->name();
    extParts << ptr->desktopEntryName();
  }
  return;
}
开发者ID:serghei,项目名称:kde3-kdevelop,代码行数:18,代码来源:diffwidget.cpp

示例11: loadPlugins

void XXPortManager::loadPlugins()
{
    mXXPortObjects.clear();

    const KTrader::OfferList plugins = KTrader::self()->query("KAddressBook/XXPort",
                                       QString("[X-KDE-KAddressBook-XXPortPluginVersion] == %1").arg(KAB_XXPORT_PLUGIN_VERSION));
    KTrader::OfferList::ConstIterator it;
    for(it = plugins.begin(); it != plugins.end(); ++it)
    {
        if(!(*it)->hasServiceType("KAddressBook/XXPort"))
            continue;

        KLibFactory *factory = KLibLoader::self()->factory((*it)->library().latin1());
        if(!factory)
        {
            kdDebug(5720) << "XXPortManager::loadExtensions(): Factory creation failed" << endl;
            continue;
        }

        KAB::XXPortFactory *xxportFactory = static_cast<KAB::XXPortFactory *>(factory);

        if(!xxportFactory)
        {
            kdDebug(5720) << "XXPortManager::loadExtensions(): Cast failed" << endl;
            continue;
        }

        KAB::XXPort *obj = xxportFactory->xxportObject(mCore->addressBook(), mCore->widget());
        if(obj)
        {
            if(mCore->guiClient())
                mCore->guiClient()->insertChildClient(obj);

            mXXPortObjects.insert(obj->identifier(), obj);
            connect(obj, SIGNAL(exportActivated(const QString &, const QString &)),
                    this, SLOT(slotExport(const QString &, const QString &)));
            connect(obj, SIGNAL(importActivated(const QString &, const QString &)),
                    this, SLOT(slotImport(const QString &, const QString &)));

            obj->setKApplication(kapp);
        }
    }
}
开发者ID:serghei,项目名称:kde3-kdepim,代码行数:43,代码来源:xxportmanager.cpp

示例12:

void
EditorSelection::readConfig()
{
    m_editorsCombo->clear();

    KTrader::OfferList editors = KTrader::self()->query(
                                     QString::fromLatin1("Komposer/Editor"));
    KTrader::OfferList::ConstIterator it;
    int i = 0;
    for(it = editors.begin(); it != editors.end(); ++it, ++i)
    {
        if(!(*it)->hasServiceType(QString::fromLatin1("Komposer/Editor")))
            continue;

        QString name = (*it)->property("X-KDE-KomposerIdentifier").toString();
        m_editorsCombo->insertItem(name);
        if(m_reference.contains(name))
            m_editorsCombo->setCurrentItem(i);
    }
}
开发者ID:serghei,项目名称:kde3-kdepim,代码行数:20,代码来源:prefsmodule.cpp

示例13: reload

void ContactEditorWidgetManager::reload()
{
    mFactories.clear();
    kdDebug(5720) << "ContactEditorWidgetManager::reload()" << endl;
    const KTrader::OfferList plugins = KTrader::self()->query("KAddressBook/ContactEditorWidget",
                                       QString("[X-KDE-KAddressBook-CEWPluginVersion] == %1").arg(KAB_CEW_PLUGIN_VERSION));

    KTrader::OfferList::ConstIterator it;
    for(it = plugins.begin(); it != plugins.end(); ++it)
    {
        KLibFactory *factory = KLibLoader::self()->factory((*it)->library().latin1());
        if(!factory)
        {
            kdDebug(5720) << "ContactEditorWidgetManager::reload(): Factory creation failed" << endl;
            continue;
        }

        KAB::ContactEditorWidgetFactory *pageFactory =
            static_cast<KAB::ContactEditorWidgetFactory *>(factory);

        if(!pageFactory)
        {
            kdDebug(5720) << "ContactEditorWidgetManager::reload(): Cast failed" << endl;
            continue;
        }

        mFactories.append(pageFactory);
    }

    // add all non-plugin contact editor factories
    mFactories.append(new FreeBusyWidgetFactory);
    mFactories.append(new ImageWidgetFactory);
    mFactories.append(new SoundWidgetFactory);
    mFactories.append(new GeoWidgetFactory);
    mFactories.append(new CustomFieldsWidgetFactory);
}
开发者ID:serghei,项目名称:kde3-kdepim,代码行数:36,代码来源:contacteditorwidgetmanager.cpp

示例14: kgitViewbase

kgitView::kgitView(QWidget *parent)
    : kgitViewbase(parent),
    DCOPObject("kgitIface")
{
  // setup our layout manager to automatically add our widgets
  QHBoxLayout *top_layout = new QHBoxLayout(this);
  top_layout->setAutoAdd(true);

  // we want to look for all components that satisfy our needs.  the
  // trader will actually search through *all* registered KDE
  // applications and components -- not just KParts.  So we have to
  // specify two things: a service type and a constraint
  //
  // the service type is like a mime type.  we say that we want all
  // applications and components that can handle HTML -- 'text/html'
  //
  // however, by itself, this will return such things as Netscape..
  // not what we wanted.  so we constrain it by saying that the
  // string 'KParts/ReadOnlyPart' must be found in the ServiceTypes
  // field.  with this, only components of the type we want will be
  // returned.
  KTrader::OfferList offers = KTrader::self()->query("text/plain", "'KParts/ReadWritePart' in ServiceTypes");

  KLibFactory *factory = 0;
  // in theory, we only care about the first one.. but let's try all
  // offers just in case the first can't be loaded for some reason
  KTrader::OfferList::Iterator it(offers.begin());
  for( ; it != offers.end(); ++it)
  {
    KService::Ptr ptr = (*it);

    // we now know that our offer can handle HTML and is a part.
    // since it is a part, it must also have a library... let's try to
    // load that now
    factory = KLibLoader::self()->factory( ptr->library() );
    if (factory)
    {
      m_html = static_cast<KParts::ReadWritePart *>(factory->create(this/*(QWidget *)layout4->parent()*/, ptr->name(), "KParts::ReadWritePart"));
      break;
    }
  }

  // if our factory is invalid, then we never found our component
  // and we might as well just exit now
  if (!factory)
  {
    KMessageBox::error(this, i18n("Could not find a suitable HTML component"));
    return;
  }

  //layout4->addWidget(m_html->widget());
  m_html->widget()->hide();
  connect(m_html, SIGNAL(setWindowCaption(const QString&)),
          this,   SLOT(slotSetTitle(const QString&)));
  connect(m_html, SIGNAL(setStatusBarText(const QString&)),
          this,   SLOT(slotOnURL(const QString&)));

	gitProc = new KProcIO;

	connect((QObject *)CommitButton,SIGNAL(clicked()),this,SLOT(slotCommitCurrent()));	
	connect((QObject *)DiscardChangesButton,SIGNAL(clicked()),this,SLOT(slotDiscardChanges()));	
	connect((QObject *)UndoCommitButton,SIGNAL(clicked()),this,SLOT(slotUndoLastCommit()));	
	connect((QObject *)RevertCommitButton,SIGNAL(clicked()),this,SLOT(slotRevertCommit()));	
	connect((QObject *)CherryPickFromOtherButton,SIGNAL(clicked()),this,SLOT(slotCherryPickFromOther()));	
	connect((QObject *)SendPatchButton,SIGNAL(clicked()),this,SLOT(slotSendPatch()));	
	
	connect(comboBoxBranches, SIGNAL(activated(const QString&)),this,SLOT(slotGitChangeBranch(const QString&)));

	connect(ShortLogList, SIGNAL(doubleClicked( QListViewItem *, const QPoint &, int ) ),this,SLOT(slotGitShowCommitDiff()));
	ShortLogList->setSorting(-1);

	connect(RepoTreeList, SIGNAL(selectionChanged()),this,SLOT(slotUpdateFilesToCommit()));
	connect(FileListFilterText, SIGNAL(textChanged ( const QString & )),this,SLOT(slotFileFilter(const QString &)));
	
	commit_files = new QStringList;
	branches = new QStringList;

	busyWaiting=0;
}
开发者ID:fredollinger,项目名称:kscope-kde4,代码行数:79,代码来源:kgitview.cpp

示例15: CollectionSetup

AmarokConfigDialog::AmarokConfigDialog( QWidget *parent, const char* name, KConfigSkeleton *config )
        : KConfigDialog( parent, name, config )
        , m_engineConfig( 0 )
        , m_opt4( 0 )
{
    setWFlags( WDestructiveClose );

    // IMPORTANT Don't simply change the page names, they are used as identifiers in other parts of the app.
            m_opt1 = new Options1( 0, "General" );
            m_opt2 = new Options2( 0, "Appearance" );
            m_opt4 = new Options4( 0, "Playback" );
    Options5 *opt5 = new Options5( 0, "OSD" );
    QVBox    *opt6 = new QVBox;
            m_opt7 = new Options7( 0, "Collection" );
    Options8 *opt8 = new Options8( 0, "Scrobbler" );
    QVBox    *opt9 = new QVBox;

    // Sound System
    opt6->setName( "Engine" );
    opt6->setSpacing( KDialog::spacingHint() );
    QWidget *groupBox, *aboutEngineButton;
    groupBox            = new QGroupBox( 2, Qt::Horizontal, i18n("Sound System"), opt6 );
    m_engineConfigFrame = new QGroupBox( 1, Qt::Horizontal, opt6 );
    m_soundSystem       = new QComboBox( false, groupBox );
    aboutEngineButton   = new QPushButton( i18n("About"), groupBox );

    QToolTip::add( m_soundSystem, i18n("Click to select the sound system to use for playback.") );
    QToolTip::add( aboutEngineButton, i18n("Click to get the plugin information.") );

    /// Populate the engine selection combo box
    KTrader::OfferList offers = PluginManager::query( "[X-KDE-amaroK-plugintype] == 'engine'" );
    KTrader::OfferList::ConstIterator end( offers.end() );
    for( KTrader::OfferList::ConstIterator it = offers.begin(); it != end; ++it ) {
        // Don't list the <no engine> (void engine) entry if it's not currenty active,
        // cause there's no point in choosing this engine (it's a dummy, after all).
        if( (*it)->property( "X-KDE-amaroK-name" ).toString() == "void-engine"
            && AmarokConfig::soundSystem() != "void-engine" ) continue;

        m_soundSystem->insertItem( (*it)->name() );
        // Save name properties in QMap for lookup
        m_pluginName[(*it)->name()] = (*it)->property( "X-KDE-amaroK-name" ).toString();
        m_pluginAmarokName[(*it)->property( "X-KDE-amaroK-name" ).toString()] = (*it)->name();
    }

    // Collection
#if !defined(USE_MYSQL) && !defined(USE_POSTGRESQL)
    m_opt7->databaseBox->hide();
#endif

#ifndef USE_MYSQL
    //FIXME we do this because this widget breaks the Apply button (always enabled).
    //It breaks because it is set to type="password" in the .kcfg file. Setting to
    //type="string" also fixes this bug, but means the password is stored in plain
    //text. This is a temporary fix so that the majority of users get a fixed Apply
    //button.
    delete m_opt7->dbSetupFrame->kcfg_MySqlPassword2;
#endif
    m_opt7->collectionFoldersBox->setColumns( 1 );
    new CollectionSetup( m_opt7->collectionFoldersBox ); //TODO this widget doesn't update the apply/ok buttons

    // Media Devices
    opt9->setName( "Media Devices" );
    opt9->setSpacing( KDialog::spacingHint() );
    QVBox *topbox = new QVBox( opt9 );
    topbox->setSpacing( KDialog::spacingHint() );
    QGroupBox *mediaBox  = new QGroupBox( 2, Qt::Horizontal, i18n("Media Devices"), topbox );
    mediaBox->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum );
    QVBox *vbox = new QVBox( mediaBox );
    vbox->setSpacing( KDialog::spacingHint() );
    m_deviceManager = new MediumPluginManager( vbox );

    QHBox *hbox = new QHBox( topbox );
    hbox->setSpacing( KDialog::spacingHint() );
    hbox->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum );
    KPushButton *autodetect = new KPushButton( i18n( "Autodetect Devices" ), hbox );
    autodetect->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
    connect( autodetect, SIGNAL(clicked()), m_deviceManager, SLOT(redetectDevices()) );
    KPushButton *add = new KPushButton( i18n( "Add Device..." ), hbox );
    add->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
    connect( add, SIGNAL(clicked()), m_deviceManager, SLOT(newDevice()) );

    QFrame *frame = new QFrame( topbox );
    frame->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );

    // add pages
    addPage( m_opt1, i18n( "General" ), "misc", i18n( "Configure General Options" ) );
    addPage( m_opt2, i18n( "Appearance" ), "colors", i18n( "Configure amaroK's Appearance" ) );
    addPage( m_opt4, i18n( "Playback" ), "kmix", i18n( "Configure Playback" ) );
    addPage( opt5,   i18n( "OSD" ), "tv", i18n( "Configure On-Screen-Display" ) );
    addPage( opt6,   i18n( "Engine" ), "amarok", i18n( "Configure Engine" ) );
    addPage( m_opt7, i18n( "Collection" ), amaroK::icon( "collection" ), i18n( "Configure Collection" ) );
    addPage( opt8,   i18n( "last.fm" ), "audioscrobbler", i18n( "Configure last.fm Support" ) );
    addPage( opt9,   i18n( "Media Devices" ), amaroK::icon( "device" ), i18n( "Configure Portable Player Support" ) );

    // Show information labels (must be done after insertions)
    QObjectList *list = queryList( "QLabel", "infoPixmap" );
    for( QObject *label = list->first(); label; label = list->next() )
        static_cast<QLabel*>(label)->setPixmap( QMessageBox::standardIcon( QMessageBox::Information ) );
    delete list;

//.........这里部分代码省略.........
开发者ID:tmarques,项目名称:waheela,代码行数:101,代码来源:configdialog.cpp


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