MCPcopy Create free account
hub / github.com/KDE/kdevelop / enableProviders

Method enableProviders

plugins/quickopen/quickopenmodel.cpp:99–146  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

97}
98
99void QuickOpenModel::enableProviders(const QStringList& _items, const QStringList& _scopes)
100{
101 const QSet<QString> items(_items.begin(), _items.end());
102 const QSet<QString> scopes(_scopes.begin(), _scopes.end());
103 if (m_enabledItems == items && m_enabledScopes == scopes && !items.isEmpty() && !scopes.isEmpty()) {
104 return;
105 }
106 m_enabledItems = items;
107 m_enabledScopes = scopes;
108 qCDebug(PLUGIN_QUICKOPEN) << "params " << items << " " << scopes;
109
110 //We use 2 iterations here: In the first iteration, all providers that implement QuickOpenFileSetInterface are initialized, then the other ones.
111 //The reason is that the second group can refer to the first one.
112 for (auto& provider : m_providers) {
113 if (!qobject_cast<QuickOpenFileSetInterface*>(provider.provider)) {
114 continue;
115 }
116 qCDebug(PLUGIN_QUICKOPEN) << "comparing" << provider.scopes << provider.types;
117 if ((scopes.isEmpty() || !(scopes & provider.scopes).isEmpty()) && (!(items & provider.types).isEmpty() || items.isEmpty())) {
118 qCDebug(PLUGIN_QUICKOPEN) << "enabling " << provider.types << " " << provider.scopes;
119 provider.enabled = true;
120 provider.provider->enableData(_items, _scopes);
121 } else {
122 qCDebug(PLUGIN_QUICKOPEN) << "disabling " << provider.types << " " << provider.scopes;
123 provider.enabled = false;
124 if ((scopes.isEmpty() || !(scopes & provider.scopes).isEmpty())) {
125 provider.provider->enableData(_items, _scopes); //The provider may still provide files
126 }
127 }
128 }
129
130 for (auto & provider : m_providers) {
131 if (qobject_cast<QuickOpenFileSetInterface*>(provider.provider)) {
132 continue;
133 }
134 qCDebug(PLUGIN_QUICKOPEN) << "comparing" << provider.scopes << provider.types;
135 if ((scopes.isEmpty() || !(scopes & provider.scopes).isEmpty()) && (!(items & provider.types).isEmpty() || items.isEmpty())) {
136 qCDebug(PLUGIN_QUICKOPEN) << "enabling " << provider.types << " " << provider.scopes;
137 provider.enabled = true;
138 provider.provider->enableData(_items, _scopes);
139 } else {
140 qCDebug(PLUGIN_QUICKOPEN) << "disabling " << provider.types << " " << provider.scopes;
141 provider.enabled = false;
142 }
143 }
144
145 restart(true);
146}
147
148void QuickOpenModel::textChanged(const QString& str)
149{

Callers 1

updateProvidersMethod · 0.80

Calls 4

beginMethod · 0.45
endMethod · 0.45
isEmptyMethod · 0.45
enableDataMethod · 0.45

Tested by

no test coverage detected