Remove going-to-be-broken plugin "kde provider"

https://projects.kde.org/kde_projects.xml is removed in the next weeks
as part of the reorganization happening in the move to gitlab by KDE.

Wanted: someone writing a replacement using gitlab, which then would
also be usable for other gitlab servers.
parent 028a7755
Pipeline #21039 passed with stage
in 41 minutes and 37 seconds
......@@ -136,7 +136,6 @@ add_subdirectory(scratchpad)
ecm_optional_add_subdirectory(classbrowser)
ecm_optional_add_subdirectory(executeplasmoid)
ecm_optional_add_subdirectory(ghprovider)
ecm_optional_add_subdirectory(kdeprovider)
ecm_optional_add_subdirectory(konsole)
if (Qt5QuickWidgets_FOUND)
add_subdirectory(welcomepage)
......
add_definitions(-DTRANSLATION_DOMAIN=\"kdevkdeprovider\")
if(BUILD_TESTING)
add_subdirectory(tests)
endif()
set(kdevkdeprovider_PART_SRCS kdeprojectsmodel.cpp
filterproxysearchline.cpp
kdeproviderwidget.cpp
kdeproviderplugin.cpp
kdeprojectsmodel.cpp
kdeprojectsreader.cpp
)
kconfig_add_kcfg_files(kdevkdeprovider_PART_SRCS kdeconfig.kcfgc)
ki18n_wrap_ui(kdevkdeprovider_PART_SRCS kdeconfig.ui)
kdevplatform_add_plugin(kdevkdeprovider JSON kdevkdeprovider.json SOURCES ${kdevkdeprovider_PART_SRCS})
target_link_libraries(kdevkdeprovider
KDev::Interfaces
KDev::Sublime
KDev::Vcs
)
#!/bin/sh
$EXTRACTRC *.ui >> rc.cpp
$XGETTEXT *.cpp -o $podir/kdevkdeprovider.pot
rm -f rc.cpp
/*
* This file is part of KDevelop
*
* Copyright 2018 Friedrich W. H. Kossebau <kossebau@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "filterproxysearchline.h"
// KF
#include <KLocalizedString>
// Qt
#include <QTimer>
#include <QSortFilterProxyModel>
FilterProxySearchLine::FilterProxySearchLine(QWidget *parent)
: QLineEdit(parent)
, m_delayTimer(new QTimer(this))
{
setClearButtonEnabled(true);
setPlaceholderText(i18n("Search"));
m_delayTimer->setSingleShot(true);
m_delayTimer->setInterval(300);
connect(m_delayTimer, &QTimer::timeout,
this, &FilterProxySearchLine::updateFilter);
connect(this, &FilterProxySearchLine::textChanged,
m_delayTimer, QOverload<>::of(&QTimer::start));
}
void FilterProxySearchLine::setFilterProxyModel(QSortFilterProxyModel* filterProxyModel)
{
m_filterProxyModel = filterProxyModel;
}
void FilterProxySearchLine::updateFilter()
{
if (!m_filterProxyModel) {
return;
}
m_filterProxyModel->setFilterFixedString(text());
}
/*
* This file is part of KDevelop
*
* Copyright 2018 Friedrich W. H. Kossebau <kossebau@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KDEPROVIDER_FILTERPROXYSEARCHLINE_H
#define KDEPROVIDER_FILTERPROXYSEARCHLINE_H
// Qt
#include <QLineEdit>
class QTimer;
class QSortFilterProxyModel;
class FilterProxySearchLine : public QLineEdit
{
Q_OBJECT
public:
explicit FilterProxySearchLine(QWidget* parent = nullptr);
public:
void setFilterProxyModel(QSortFilterProxyModel* filterProxyModel);
private:
void updateFilter();
private:
QTimer* m_delayTimer;
QSortFilterProxyModel* m_filterProxyModel = nullptr;
};
#endif
<?xml version="1.0" encoding="UTF-8"?>
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd">
<kcfgfile name="kdeproviderpluginconfig" />
<group name="KDE">
<entry name="gitProtocol" type="String">
<default>git</default>
</entry>
</group>
</kcfg>
File=kdeconfig.kcfg
ClassName=KDEProviderSettings
Singleton=true
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>KDEConfig</class>
<widget class="QWidget" name="KDEConfig">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>658</width>
<height>300</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>git.kde.org protocol:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="kcfg_gitProtocol">
<item>
<property name="text">
<string>git</string>
</property>
</item>
<item>
<property name="text">
<string>http</string>
</property>
</item>
<item>
<property name="text">
<string>ssh</string>
</property>
</item>
<item>
<property name="text">
<string>kde:</string>
</property>
</item>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="label_2">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;URL to clone the protocol from, like:&lt;br/&gt;git clone git://anongit.kde.org/kdevelop&lt;br/&gt;git clone kde:kdevelop&lt;/p&gt;&lt;p&gt;For more information go &lt;a href=&quot;https://community.kde.org/Sysadmin/GitKdeOrgManual#Overview_of_repository_URL_schemes&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0057ae;&quot;&gt;here&lt;/span&gt;&lt;/a&gt;.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
/* This file is part of KDevelop
Copyright 2010 Aleix Pol Gonzalez <aleixpol@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "kdeprojectsmodel.h"
#include <QIcon>
#include <vcs/vcslocation.h>
using namespace KDevelop;
SourceItem::SourceItem(const Source& s)
: QStandardItem(QIcon::fromTheme(s.icon), s.name), m_s(s)
{
Q_ASSERT(!m_s.name.isEmpty());
}
QVariant SourceItem::data(int role) const
{
switch(role)
{
case KDEProjectsModel::IdentifierRole:
return m_s.identifier;
case KDEProjectsModel::VcsLocationRole:
return QVariantMap(m_s.m_urls);
default:
return QStandardItem::data(role);
}
}
Source::Source(SourceType aType, const QString& anIcon, const QString& aName, const QPair<QString, QString>& aUrl)
: type(aType), name(aName), icon(anIcon)
{
m_urls[aUrl.first] = aUrl.second;
}
KDEProjectsModel::KDEProjectsModel(QObject* parent): QStandardItemModel(parent)
{}
/* This file is part of KDevelop
Copyright 2010 Aleix Pol Gonzalez <aleixpol@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KDEPROJECTSMODEL_H
#define KDEPROJECTSMODEL_H
#include <QStandardItemModel>
namespace KDevelop {
class VcsLocation;
}
struct Source
{
enum SourceType
{
Project,
Module
};
Source() {}
Source(SourceType aType, const QString& anIcon, const QString& aName, const QPair< QString, QString >& aUrl);
SourceType type = Project;
QString name;
QString icon;
QString identifier;
/** urls for protocol */
QVariantMap m_urls;
};
class SourceItem : public QStandardItem
{
public:
explicit SourceItem(const Source& s);
QVariant data(int role = Qt::UserRole + 1) const override;
private:
Source m_s;
};
class KDEProjectsModel : public QStandardItemModel
{
Q_OBJECT
public:
enum Role { VcsLocationRole = Qt::UserRole+1, IdentifierRole };
explicit KDEProjectsModel(QObject* parent = nullptr);
};
#endif // KDEPROJECTSMODEL_H
/* This file is part of KDevelop
Copyright 2010 Aleix Pol Gonzalez <aleixpol@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "kdeprojectsreader.h"
#include <QUrl>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QXmlStreamReader>
static const QUrl kdeProjectsUrl(QStringLiteral("https://projects.kde.org/kde_projects.xml"));
KDEProjectsReader::KDEProjectsReader(KDEProjectsModel* m, QObject* parent)
: QObject(parent)
, m_m(m) //donuts
{
auto *manager = new QNetworkAccessManager(this);
QNetworkReply* reply = manager->get(QNetworkRequest(kdeProjectsUrl));
connect(reply, QOverload<QNetworkReply::NetworkError>::of(&QNetworkReply::error),
this, &KDEProjectsReader::downloadError);
connect(manager,&QNetworkAccessManager::finished, this, &KDEProjectsReader::downloadFinished);
}
static QString readText(QXmlStreamReader* xml)
{
QString ret;
for(int opened=1; opened>0 && !xml->atEnd(); ) {
const auto token=xml->readNext();
if(token==QXmlStreamReader::StartElement)
opened++;
else if(token==QXmlStreamReader::EndElement)
opened--;
else if(token==QXmlStreamReader::Characters)
ret += xml->text();
}
return ret;
}
void KDEProjectsReader::downloadFinished(QNetworkReply* reply)
{
if(reply->error()!=QNetworkReply::NoError) {
m_errors += reply->errorString();
emit downloadDone();
return;
}
QByteArray data = reply->readAll();
QXmlStreamReader xml(data);
while (!xml.atEnd()) {
QXmlStreamReader::TokenType token = xml.readNext();
if(token==QXmlStreamReader::StartElement) {
QStringRef name = xml.name();
if (name == QLatin1String("project") || name == QLatin1String("module")) {
m_current.push(Source());
if (name == QLatin1String("project"))
m_current.top().type = Source::Project;
else if (name == QLatin1String("module"))
m_current.top().type = Source::Module;
m_current.top().identifier = xml.attributes().value(QStringLiteral("identifier")).toString();
}
else if(!m_current.isEmpty())
{
if(name == QLatin1String("name"))
m_current.top().name = readText(&xml);
else if(name == QLatin1String("url")) {
QString protocol = xml.attributes().value(QStringLiteral("protocol")).toString();
m_current.top().m_urls[protocol] = readText(&xml);
} else if(name == QLatin1String("icon"))
m_current.top().icon = readText(&xml);
}
} else if(token==QXmlStreamReader::EndElement) {
QStringRef name = xml.name();
if (name == QLatin1String("project") || name == QLatin1String("module")) {
Source p = m_current.pop();
if (name == QLatin1String("project"))
Q_ASSERT(p.type == Source::Project);
else if (name == QLatin1String("module"))
Q_ASSERT(p.type == Source::Module);
if(!p.m_urls.isEmpty()) {
auto* item = new SourceItem(p);
m_m->appendRow(item);
}
}
}
}
if (xml.hasError()) {
m_errors += xml.errorString();
}
emit downloadDone();
}
void KDEProjectsReader::downloadError(QNetworkReply::NetworkError error)
{
m_errors += QStringLiteral("error: %1").arg(error);
}
/* This file is part of KDevelop
Copyright 2010 Aleix Pol Gonzalez <aleixpol@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KDEPROJECTSREADER_H
#define KDEPROJECTSREADER_H
#include "kdeprojectsmodel.h"
#include <util/stack.h>
#include <QNetworkReply>
class KDEProjectsReader : public QObject
{
Q_OBJECT
public:
KDEProjectsReader(KDEProjectsModel* m, QObject* parent);
QStringList errors() const { return m_errors; }
bool hasErrors() { return !m_errors.isEmpty(); }
public Q_SLOTS:
void downloadFinished(QNetworkReply* reply);
void downloadError(QNetworkReply::NetworkError);
Q_SIGNALS:
void downloadDone();
private:
KDevelop::Stack<Source> m_current;
QStringList m_errors;
KDEProjectsModel* m_m;
};
#endif // KDEPROJECTSREADER_H
/*
* This file is part of KDevelop
* Copyright 2010 Aleix Pol Gonzalez <aleixpol@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "kdeproviderplugin.h"
#include <QVariantList>
#include <KPluginFactory>
#include <KLocalizedString>
#include "kdeproviderwidget.h"
using namespace KDevelop;
K_PLUGIN_FACTORY_WITH_JSON(KDevKDEProviderFactory, "kdevkdeprovider.json", registerPlugin<KDEProviderPlugin>(); )
KDEProviderPlugin::KDEProviderPlugin ( QObject* parent, const QVariantList& )
: IPlugin ( QStringLiteral("kdevkdeprovider"), parent )
{
}
KDEProviderPlugin::~KDEProviderPlugin()
{}
QString KDEProviderPlugin::name() const
{
return i18n("KDE");
}
KDevelop::IProjectProviderWidget* KDEProviderPlugin::providerWidget(QWidget* parent)
{
return new KDEProviderWidget(parent);
}
#include "kdeproviderplugin.moc"
/*
* This file is part of KDevelop
* Copyright 2009 Andreas Pakulat <apaku@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KDEPROVIDERPLUGIN_H
#define KDEPROVIDERPLUGIN_H
#include <interfaces/iplugin.h>
#include <interfaces/iprojectprovider.h>
class KDEProviderPlugin : public KDevelop::IPlugin, KDevelop::IProjectProvider
{
Q_OBJECT
Q_INTERFACES( KDevelop::IProjectProvider )
public:
KDEProviderPlugin ( QObject* parent, const QList<QVariant>& args );
~KDEProviderPlugin() override;
QString name() const override;
KDevelop::IProjectProviderWidget* providerWidget(QWidget* parent) override;
};
#endif // KDEPROVIDERPLUGIN_H
/*
* This file is part of KDevelop
* Copyright 2010 Aleix Pol Gonzalez <aleixpol@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "kdeproviderwidget.h"
#include <QVBoxLayout>
#include <QListView>
#include <QPushButton>
#include <KConfigDialog>
#include <interfaces/icore.h>
#include <interfaces/iplugincontroller.h>
#include <vcs/interfaces/ibasicversioncontrol.h>
#include <vcs/vcslocation.h>
#include "ui_kdeconfig.h"
#include "filterproxysearchline.h"
#include "kdeconfig.h"
#include "kdeprojectsmodel.h"
#include "kdeprojectsreader.h"
#include <QSortFilterProxyModel>
#include <KMessageBox>
#include <KLocalizedString>
using namespace KDevelop;
KDEProviderWidget::KDEProviderWidget(QWidget* parent)
: IProjectProviderWidget(parent)
{
auto* widgetLayout = new QVBoxLayout;
widgetLayout->setContentsMargins(0, 0, 0, 0);
setLayout(widgetLayout);
m_projects = new QListView(this);
auto* topLayout = new QHBoxLayout;
auto filterLine = new FilterProxySearchLine(this);
auto* model = new KDEProjectsModel(this);
auto* reader = new KDEProjectsReader(model, model);
connect(reader, &KDEProjectsReader::downloadDone, reader, &KDEProjectsReader::deleteLater);
connect(m_projects, &QListView::clicked, this, &KDEProviderWidget::projectIndexChanged);
topLayout->addWidget(filterLine);
auto* settings=new QPushButton(QIcon::fromTheme(QStringLiteral("configure")), i18n("Settings"), this);
settings->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed);