Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

kdevplatform/interfaces: use std::array & range-based loop over manual code

parent e27b4b0a
......@@ -23,6 +23,7 @@
#include <KParts/ReadOnlyPart>
#include <KService>
#include <array>
namespace KDevelop {
......@@ -69,17 +70,15 @@ KPluginFactory* IPartController::findPartFactory ( const QString& mimetype, cons
KParts::Part* IPartController::createPart ( const QString& mimetype, const QString& prefName )
{
const uint length = 1;
static const char* const services[length] =
{
static const std::array<QString, 1> services = {
// Disable read/write parts until we can support them
/*"KParts/ReadWritePart",*/ "KParts/ReadOnlyPart"
/*"KParts/ReadWritePart",*/
QStringLiteral("KParts/ReadOnlyPart")
};
KParts::Part* part = nullptr;
for ( uint i = 0; i < length; ++i )
{
KPluginFactory* editorFactory = findPartFactory( mimetype, QString::fromLatin1(services[ i ]), prefName );
for (auto& service : services) {
KPluginFactory* editorFactory = findPartFactory(mimetype, service, prefName);
if ( editorFactory )
{
part = editorFactory->create<KParts::ReadOnlyPart>( nullptr, this );
......
Markdown is supported
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