Commit 03caed91 authored by Stefano Crocco's avatar Stefano Crocco
Browse files

Remove typedef for QVector<KPluginMetaData>

parent 8f50baf2
......@@ -66,7 +66,7 @@ KonqExtensionManager::KonqExtensionManager(QWidget *parent, KonqMainWindow *main
d->activePart = activePart;
auto addPluginForId = [this](const QString &pluginId) {
PluginMetaDataVector metaDataList = KPluginMetaData::findPlugins(pluginId + QStringLiteral("/kpartplugins"));
QVector<KPluginMetaData> metaDataList = KPluginMetaData::findPlugins(pluginId + QStringLiteral("/kpartplugins"));
d->pluginSelector->addPlugins(metaDataList, i18n("Extensions"));
};
if (activePart) {
......
......@@ -74,7 +74,7 @@ static KonqViewFactory tryLoadingService(const KPluginMetaData &data)
KonqViewFactory KonqFactory::createView(const QString &serviceType,
const QString &serviceName,
KPluginMetaData *serviceImpl,
PluginMetaDataVector *partServiceOffers,
QVector<KPluginMetaData> *partServiceOffers,
KService::List *appServiceOffers,
bool forceAutoEmbed)
{
......@@ -82,7 +82,7 @@ KonqViewFactory KonqFactory::createView(const QString &serviceType,
qCDebug(KONQUEROR_LOG) << "Trying to create view for" << serviceType << serviceName;
// We need to get those in any case
PluginMetaDataVector offers;
QVector<KPluginMetaData> offers;
KService::List appOffers;
// Query the plugins
......@@ -171,7 +171,7 @@ KonqViewFactory KonqFactory::createView(const QString &serviceType,
return viewFactory;
}
void KonqFactory::getOffers(const QString &serviceType, PluginMetaDataVector *partServiceOffers, KService::List *appServiceOffers)
void KonqFactory::getOffers(const QString &serviceType, QVector<KPluginMetaData> *partServiceOffers, KService::List *appServiceOffers)
{
#ifdef __GNUC__
#warning Temporary hack -- must separate mimetypes and servicetypes better
......@@ -183,13 +183,13 @@ void KonqFactory::getOffers(const QString &serviceType, PluginMetaDataVector *pa
}
if (partServiceOffers) {
PluginMetaDataVector offers = KParts::PartLoader::partsForMimeType(serviceType);
QVector<KPluginMetaData> offers = KParts::PartLoader::partsForMimeType(serviceType);
//If a part has both JSON metadata and a .desktop file, partsForMimeType return the plugin twice. To avoid this, we remove the duplicate entries
//We can't use std::unique because it requires the vector to be sorted but we can't do that because the entries are sorted according to user
//preferences (we only keep the first entry for each plugin).
//TODO: remove when .desktop files for parts aren't supported anymore (KF6)
PluginMetaDataVector uniqueOffers;
QVector<KPluginMetaData> uniqueOffers;
for (const KPluginMetaData &md : offers) {
if (!std::any_of(uniqueOffers.constBegin(), uniqueOffers.constEnd(), [md](const KPluginMetaData &md2){return md.pluginId() == md2.pluginId();})) {
uniqueOffers.append(md);
......
......@@ -67,11 +67,11 @@ public:
KonqViewFactory createView(const QString &serviceType,
const QString &serviceName = QString(),
KPluginMetaData *serviceImpl = nullptr,
PluginMetaDataVector *partServiceOffers = nullptr,
QVector<KPluginMetaData> *partServiceOffers = nullptr,
KService::List *appServiceOffers = nullptr,
bool forceAutoEmbed = false);
static void getOffers(const QString& serviceType, PluginMetaDataVector *partServiceOffers = nullptr, KService::List* appServiceOffers = nullptr);
static void getOffers(const QString& serviceType, QVector<KPluginMetaData> *partServiceOffers = nullptr, KService::List* appServiceOffers = nullptr);
};
#endif
......@@ -23,7 +23,7 @@
#include "konqframestatusbar.h"
#include "konqviewmanager.h"
PopupMenuGUIClient::PopupMenuGUIClient(const PluginMetaDataVector &embeddingServices,
PopupMenuGUIClient::PopupMenuGUIClient(const QVector<KPluginMetaData> &embeddingServices,
KonqPopupMenu::ActionGroupMap &actionGroups,
QAction *showMenuBar, QAction *stopFullScreen)
: m_actionCollection(this),
......@@ -51,8 +51,8 @@ PopupMenuGUIClient::PopupMenuGUIClient(const PluginMetaDataVector &embeddingServ
QAction *act = addEmbeddingService(0, i18n("Preview &in %1", service.name()), service);
previewActions.append(act);
} else if (embeddingServices.count() > 1) {
PluginMetaDataVector::ConstIterator it = embeddingServices.begin();
const PluginMetaDataVector::ConstIterator end = embeddingServices.end();
QVector<KPluginMetaData>::ConstIterator it = embeddingServices.begin();
const QVector<KPluginMetaData>::ConstIterator end = embeddingServices.end();
int idx = 0;
for (; it != end; ++it, ++idx) {
QAction *act = addEmbeddingService(idx, (*it).name(), *it);
......
......@@ -30,7 +30,7 @@ class PopupMenuGUIClient : public QObject
Q_OBJECT
public:
// The action groups are inserted into @p actionGroups
PopupMenuGUIClient(const PluginMetaDataVector &embeddingServices,
PopupMenuGUIClient(const QVector<KPluginMetaData> &embeddingServices,
KonqPopupMenu::ActionGroupMap &actionGroups,
QAction *showMenuBar, QAction *stopFullScreen);
~PopupMenuGUIClient() override;
......@@ -50,7 +50,7 @@ private:
QAction *addEmbeddingService(int idx, const QString &name, const KPluginMetaData &service);
KActionCollection m_actionCollection;
PluginMetaDataVector m_embeddingServices;
QVector<KPluginMetaData> m_embeddingServices;
};
class ToggleViewGUIClient : public QObject
......
......@@ -770,7 +770,7 @@ bool KonqMainWindow::openView(QString mimeType, const QUrl &_url, KonqView *chil
}
// Do we even have a part to embed? Otherwise don't ask, since we'd ask twice.
if (!forceAutoEmbed) {
PluginMetaDataVector partServiceOffers;
QVector<KPluginMetaData> partServiceOffers;
KonqFactory::getOffers(mimeType, &partServiceOffers);
if (partServiceOffers.isEmpty()) {
qCDebug(KONQUEROR_LOG) << "No part available for" << mimeType;
......@@ -4372,12 +4372,12 @@ void KonqMainWindow::slotPopupMenu(const QPoint &global, const KFileItemList &it
!isIntoTrash && !devicesFile &&
(itemFlags & KParts::BrowserExtension::ShowTextSelectionItems) == 0;
PluginMetaDataVector embeddingServices;
QVector<KPluginMetaData> embeddingServices;
if (showEmbeddingServices) {
const QString currentServiceName = currentView->service().pluginId();
// List of services for the "Preview In" submenu.
PluginMetaDataVector allEmbeddingServices = KParts::PartLoader::partsForMimeType(m_popupMimeType);
QVector<KPluginMetaData> allEmbeddingServices = KParts::PartLoader::partsForMimeType(m_popupMimeType);
auto filter = [currentServiceName](const KPluginMetaData &md) {
return md.value(QLatin1String("X-KDE-BrowserView-HideFromMenus"),false) && md.pluginId() != currentServiceName;
};
......@@ -4689,7 +4689,7 @@ void KonqMainWindow::updateViewModeActions()
delete m_viewModeMenu;
m_viewModeMenu = nullptr;
const PluginMetaDataVector services = m_currentView->partServiceOffers();
const QVector<KPluginMetaData> services = m_currentView->partServiceOffers();
if (services.count() <= 1) {
return;
}
......@@ -5426,7 +5426,7 @@ void KonqMainWindow::updateProxyForWebEngine(bool updateProtocolManager)
KProtocolManager::reparseConfiguration();
}
PluginMetaDataVector parts = KParts::PartLoader::partsForMimeType(QStringLiteral("text/html"));
QVector<KPluginMetaData> parts = KParts::PartLoader::partsForMimeType(QStringLiteral("text/html"));
KPluginMetaData part = !parts.isEmpty() ? parts.first() : KPluginMetaData();
Q_ASSERT(part.isValid());
const bool webengineIsDefault = part.pluginId() == QStringLiteral("webenginepart");
......
......@@ -57,7 +57,7 @@ KonqView::KonqView(KonqViewFactory &viewFactory,
KonqFrame *viewFrame,
KonqMainWindow *mainWindow,
const KPluginMetaData &service,
const PluginMetaDataVector &partServiceOffers,
const QVector<KPluginMetaData> &partServiceOffers,
const KService::List &appServiceOffers,
const QString &serviceType,
bool passiveMode
......@@ -321,7 +321,7 @@ bool KonqView::changePart(const QString &mimeType,
return false; // we can't do that if our view mode is locked
}
PluginMetaDataVector partServiceOffers;
QVector<KPluginMetaData> partServiceOffers;
KService::List appServiceOffers;
KPluginMetaData service;
KonqFactory konqFactory;
......
......@@ -84,7 +84,7 @@ public:
KonqFrame *viewFrame,
KonqMainWindow *mainWindow,
const KPluginMetaData &service,
const PluginMetaDataVector &partServiceOffers,
const QVector<KPluginMetaData> &partServiceOffers,
const KService::List &appServiceOffers,
const QString &serviceType,
bool passiveMode);
......@@ -433,7 +433,7 @@ public:
return m_caption;
}
PluginMetaDataVector partServiceOffers()
QVector<KPluginMetaData> partServiceOffers()
{
return m_partServiceOffers;
}
......@@ -645,7 +645,7 @@ private:
uint m_bURLDropHandling: 1;
uint m_bDisableScrolling: 1;
uint m_bErrorURL: 1;
PluginMetaDataVector m_partServiceOffers;
QVector<KPluginMetaData> m_partServiceOffers;
KService::List m_appServiceOffers;
KPluginMetaData m_service;
QString m_serviceType;
......
......@@ -60,7 +60,7 @@ KonqView *KonqViewManager::createFirstView(const QString &mimeType, const QStrin
{
//qCDebug(KONQUEROR_LOG) << serviceName;
KPluginMetaData service;
PluginMetaDataVector partServiceOffers;
QVector<KPluginMetaData> partServiceOffers;
KService::List appServiceOffers;
KonqViewFactory newViewFactory = createView(mimeType, serviceName, service, partServiceOffers, appServiceOffers, true /*forceAutoEmbed*/);
if (newViewFactory.isNull()) {
......@@ -95,7 +95,7 @@ KonqView *KonqViewManager::splitView(KonqView *currentView,
const QString serviceType = currentView->serviceType();
KPluginMetaData service;
PluginMetaDataVector partServiceOffers;
QVector<KPluginMetaData> partServiceOffers;
KService::List appServiceOffers;
KonqViewFactory newViewFactory = createView(serviceType, currentView->service().pluginId(), service, partServiceOffers, appServiceOffers, forceAutoEmbed);
......@@ -165,7 +165,7 @@ KonqView *KonqViewManager::splitMainContainer(KonqView *currentView,
//qCDebug(KONQUEROR_LOG);
KPluginMetaData service;
PluginMetaDataVector partServiceOffers;
QVector<KPluginMetaData> partServiceOffers;
KService::List appServiceOffers;
KonqViewFactory newViewFactory = createView(serviceType, serviceName, service, partServiceOffers, appServiceOffers);
......@@ -210,7 +210,7 @@ KonqView *KonqViewManager::addTab(const QString &serviceType, const QString &ser
#endif
KPluginMetaData service;
PluginMetaDataVector partServiceOffers;
QVector<KPluginMetaData> partServiceOffers;
KService::List appServiceOffers;
Q_ASSERT(!serviceType.isEmpty());
......@@ -783,7 +783,7 @@ KonqView *KonqViewManager::chooseNextView(KonqView *view)
KonqViewFactory KonqViewManager::createView(const QString &serviceType,
const QString &serviceName,
KPluginMetaData &service,
PluginMetaDataVector &partServiceOffers,
QVector<KPluginMetaData> &partServiceOffers,
KService::List &appServiceOffers,
bool forceAutoEmbed)
{
......@@ -813,7 +813,7 @@ KonqViewFactory KonqViewManager::createView(const QString &serviceType,
KonqView *KonqViewManager::setupView(KonqFrameContainerBase *parentContainer,
KonqViewFactory &viewFactory,
const KPluginMetaData &service,
const PluginMetaDataVector &partServiceOffers,
const QVector<KPluginMetaData> &partServiceOffers,
const KService::List &appServiceOffers,
const QString &serviceType,
bool passiveMode,
......@@ -1135,7 +1135,7 @@ void KonqViewManager::loadItem(const KConfigGroup &cfg, KonqFrameContainerBase *
//qCDebug(KONQUEROR_LOG) << "serviceType" << serviceType << serviceName;
KPluginMetaData service;
PluginMetaDataVector partServiceOffers;
QVector<KPluginMetaData> partServiceOffers;
KService::List appServiceOffers;
KonqFactory konqFactory;
......
......@@ -323,7 +323,7 @@ private:
KonqViewFactory createView(const QString &serviceType, /* can be servicetype or mimetype */
const QString &serviceName,
KPluginMetaData &service,
PluginMetaDataVector &partServiceOffers,
QVector<KPluginMetaData> &partServiceOffers,
KService::List &appServiceOffers,
bool forceAutoEmbed = false);
......@@ -334,7 +334,7 @@ private:
KonqView *setupView(KonqFrameContainerBase *parentContainer,
KonqViewFactory &viewFactory,
const KPluginMetaData &service,
const PluginMetaDataVector &partServiceOffers,
const QVector<KPluginMetaData> &partServiceOffers,
const KService::List &appServiceOffers,
const QString &serviceType,
bool passiveMode, bool openAfterCurrentPage = false, int pos = -1);
......
......@@ -22,10 +22,10 @@ QDebug operator<<(QDebug debug, const KPluginMetaData& md)
return debug;
}
QDebug operator<<(QDebug debug, const PluginMetaDataVector& vec)
QDebug operator<<(QDebug debug, const QVector<KPluginMetaData>& vec)
{
QDebugStateSaver saver(debug);
debug.nospace() << "PluginMetaDataVector {\n";
debug.nospace() << "QVector<KPluginMetaData> {\n";
for (const KPluginMetaData &md : vec) {
debug << '\t' << md << ",\n";
}
......
......@@ -14,10 +14,8 @@
#include <QDebug>
using PluginMetaDataVector = QVector<KPluginMetaData>;
KPluginMetaData findPartById(const QString &id);
QDebug operator<<(QDebug debug, const KPluginMetaData &md);
QDebug operator<<(QDebug debug, const PluginMetaDataVector &vec);
QDebug operator<<(QDebug debug, const QVector<KPluginMetaData> &vec);
......@@ -34,7 +34,7 @@
#include <QFileDialog>
static KPluginMetaData preferredPart(const QString &mimeType) {
PluginMetaDataVector plugins = KParts::PartLoader::partsForMimeType(mimeType);
QVector<KPluginMetaData> plugins = KParts::PartLoader::partsForMimeType(mimeType);
if (!plugins.isEmpty()) {
return plugins.first();
} else {
......@@ -201,9 +201,9 @@ bool UrlLoader::decideEmbedOrSave()
* the option to open or save, instead.
*/
if (m_dontPassToWebEnginePart && m_part.pluginId() == webEngineName) {
PluginMetaDataVector parts = KParts::PartLoader::partsForMimeType(m_mimeType);
QVector<KPluginMetaData> parts = KParts::PartLoader::partsForMimeType(m_mimeType);
auto findPart = [webEngineName](const KPluginMetaData &md){return md.pluginId() != webEngineName;};
PluginMetaDataVector::const_iterator partToUse = std::find_if(parts.constBegin(), parts.constEnd(), findPart);
QVector<KPluginMetaData>::const_iterator partToUse = std::find_if(parts.constBegin(), parts.constEnd(), findPart);
if (partToUse != parts.constEnd()) {
m_part = *partToUse;
} else {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment