diff options
| author | Aleix Pol <aleixpol@kde.org> | 2015-11-06 17:46:08 (GMT) |
|---|---|---|
| committer | Aleix Pol <aleixpol@kde.org> | 2015-11-06 17:46:08 (GMT) |
| commit | b8bb3a144ee1b7bb560f09777d5c5966a3c9ac39 (patch) | |
| tree | d7612e6380fbda6f204d66f44e4e81db8fd0125f | |
| parent | 60e429d4e6d3b5a04a2a35fbd371b33a9bb053f0 (diff) | |
Remove discover
And the whole abstraction layer as it's being moved into a separate
repository.
With it, also the notifier plasmoid, updater and exporter.
395 files changed, 4 insertions, 39659 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 51e391c..919ccda 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,67 +23,19 @@ find_package(KF5 REQUIRED WidgetsAddons CoreAddons Solid Archive KIO IconThemes ItemViews) find_package(KF5TextWidgets REQUIRED) -find_package(QApt 3.0.0) -if(QApt_FOUND) - find_package(DebconfKDE 1.0.0 REQUIRED) -else() - find_package(AkabeiClient QUIET) - if(NOT AkabeiClient_FOUND) - find_package(packagekitqt5) - endif() - - if(packagekitqt5_FOUND OR AkabeiClient_FOUND) - find_package(AppstreamQt 0.8.4) - endif() -endif() -find_package(KF5Attica) -find_package(KF5NewStuff) -# find_package(BODEGA QUIET) +find_package(QApt 3.0.0 REQUIRED) +find_package(DebconfKDE 1.0.0 REQUIRED) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") set(MUON_VERSION ${PROJECT_VERSION}) configure_file(MuonVersion.h.in MuonVersion.h) -add_subdirectory(libmuon) -if(QApt_FOUND) - add_subdirectory(muon) -endif() -add_subdirectory(updater) -add_subdirectory(discover) -add_subdirectory(exporter) -add_subdirectory(notifier) +add_subdirectory(src) set_package_properties(QApt PROPERTIES DESCRIPTION "Qt wrapper around the libapt-pkg library" PURPOSE "Used to support apt-based distribution systems" - TYPE OPTIONAL) - -set_package_properties(KF5Attica PROPERTIES - DESCRIPTION "KDE Framework that implements the Open Collaboration Services API" - PURPOSE "Required to build the KNewStuff3 backend" - TYPE OPTIONAL) -set_package_properties(KF5NewStuff PROPERTIES - DESCRIPTION "Qt library that allows to interact with KNewStuff implementations" - PURPOSE "Required to build the KNS backend" - TYPE OPTIONAL) -set_package_properties(Bodega PROPERTIES - DESCRIPTION "Library that exposes Bodega resources" - PURPOSE "Required to build the Bodega backend" - TYPE OPTIONAL) -set_package_properties(AkabeiClient PROPERTIES - DESCRIPTION "Library that exposes Akabei resources" - PURPOSE "Required to build the Akabei backend (Supports Chakra distribution)" - TYPE OPTIONAL) -set_package_properties(packagekitqt5 PROPERTIES - DESCRIPTION "Library that exposes PackageKit resources" - URL "http://www.packagekit.org" - PURPOSE "Required to build the PackageKit backend" - TYPE OPTIONAL) -set_package_properties(AppstreamQt PROPERTIES - DESCRIPTION "Library that lists Appstream resources" - URL "http://www.freedesktop.org" - PURPOSE "Required to build the PackageKit backend" - TYPE OPTIONAL) + TYPE REQUIRED) feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/Messages.sh b/Messages.sh index a89d1c6..fc7e43e 100644 --- a/Messages.sh +++ b/Messages.sh @@ -1,14 +1,5 @@ #! /usr/bin/env bash $EXTRACTRC `find muon/ -name \*.rc -o -name \*.ui -o -name \*.kcfg` >> muonrc.cpp -$EXTRACTRC `find updater/ -name \*.rc -o -name \*.ui -o -name \*.kcfg` >> updaterrc.cpp -$EXTRACTRC --context="Category" --tag-group=none --tag=Name `find libmuon -name "*-categories.xml"` >> categoriesxml.cpp -$XGETTEXT categoriesxml.cpp `find libmuon -name \*.cpp` `find libmuonapt -name \*.cpp` -o $podir/libmuon.pot $XGETTEXT rc.cpp muonrc.cpp `find muon -name \*.cpp` -o $podir/muon.pot -$XGETTEXT rc.cpp updaterrc.cpp `find updater -name \*.cpp` -o $podir/muon-updater.pot -$XGETTEXT `find discover -name \*.cpp -o -name \*.qml -o -name \*.js` -o $podir/muon-discover.pot -$XGETTEXT `find exporter -name \*.cpp` -o $podir/muon-exporter.pot -$XGETTEXT `find notifier -name \*.cpp` -o $podir/muon-notifier.pot rm -f muonrc.cpp -rm -f updaterrc.cpp -rm -f categoriesxml.cpp diff --git a/discover/CMakeLists.txt b/discover/CMakeLists.txt deleted file mode 100644 index 02cd9c5..0000000 --- a/discover/CMakeLists.txt +++ /dev/null @@ -1,34 +0,0 @@ -add_subdirectory(icons) -add_subdirectory(muon-contenttheme) -add_subdirectory(autotests) - -include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/..) - -set(muon_discover_SRCS - main.cpp - MuonDiscoverMainWindow.cpp - - PaginateModel.cpp - SystemFonts.cpp - IconColors.cpp -) - -qt5_add_resources(muon_discover_SRCS resources.qrc) - -add_executable(muon-discover ${muon_discover_SRCS}) - -target_link_libraries(muon-discover LINK_PUBLIC KF5::KIOWidgets - KF5::Declarative - KF5::DBusAddons - KF5::I18n - KF5::ConfigWidgets - KF5::XmlGui - Qt5::QuickWidgets - MuonCommon -) - -install(TARGETS muon-discover ${INSTALL_TARGETS_DEFAULT_ARGS} ) - -install(PROGRAMS org.kde.discover.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} ) -install(FILES featured.json DESTINATION ${DATA_INSTALL_DIR}/muondiscover) -install(FILES muondiscoverui.rc DESTINATION ${KXMLGUI_INSTALL_DIR}/muondiscover) diff --git a/discover/IconColors.cpp b/discover/IconColors.cpp deleted file mode 100644 index 41894a2..0000000 --- a/discover/IconColors.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (C) 2015 Aleix Pol Gonzalez <aleixpol@blue-systems.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library/Lesser General Public License - * version 2, or (at your option) any later version, as published by the - * Free Software Foundation - * - * 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 Library/Lesser 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 "IconColors.h" -#include <QIcon> -#include <vector> -#include <QDebug> - -// #define OUTPUT_PIXMAP_DEBUG - -IconColors::IconColors(QObject* parent) - : QObject(parent) -{} - -QString IconColors::iconName() const -{ - return m_iconName; -} - -void IconColors::setIconName(const QString& name) -{ - if (m_iconName != name) { - m_iconName = name; - } -} - -QColor IconColors::dominantColor() const -{ - const QImage img = QIcon::fromTheme(m_iconName).pixmap({32, 32}).toImage(); - const int tolerance = 10; - QVector<uint> hue(360/tolerance, 0); - -#ifdef OUTPUT_PIXMAP_DEBUG - QImage thing(img.size()+QSize(0,1), QImage::Format_ARGB32); - thing.fill(Qt::white); -#endif - - for (int w=0, cw=img.width(); w<cw; ++w) { - for (int h=0, ch=img.height(); h<ch; ++h) { -#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) - const QColor c = img.pixelColor(w, h); -#else - const QColor c(img.pixel(w, h)); -#endif - - if (c.value()>150 && c.saturation()>20 && c.hue()>=0 && c.alpha()>200) { - hue[c.hue()/tolerance]++; - -#ifdef OUTPUT_PIXMAP_DEBUG -// qDebug() << "adopting" << w << "x" << h << c.name() << c.hue(); -// thing.setPixelColor(w, h, c); - thing.setPixelColor(w, h, QColor::fromHsv(tolerance*(c.hue()/tolerance), 220, 220)); -#endif - } - } - } - - uint dominantHue = 0, biggestAmount = 0; - for(int i=0; i<hue.size(); ++i) { - if (hue[i]>biggestAmount) { - biggestAmount = hue[i]; - dominantHue = i; - } - } - - QColor ret = QColor::fromHsv((dominantHue*tolerance + tolerance/2) % 360, 255, 255); - -#ifdef OUTPUT_PIXMAP_DEBUG - qDebug() << "dominant" << dominantHue << hue[dominantHue] << "~=" << ((100*hue[dominantHue])/(img.width()*img.height())) << "% " << m_iconName; - thing.setPixelColor(0, img.height(), ret); - thing.save("/tmp/"+m_iconName+".png"); -#endif - - return ret; -} diff --git a/discover/IconColors.h b/discover/IconColors.h deleted file mode 100644 index 2507299..0000000 --- a/discover/IconColors.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (C) 2015 Aleix Pol Gonzalez <aleixpol@blue-systems.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library/Lesser General Public License - * version 2, or (at your option) any later version, as published by the - * Free Software Foundation - * - * 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 Library/Lesser 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 ICONCOLORS_H -#define ICONCOLORS_H - -#include <QColor> -#include <QObject> - -class IconColors : public QObject -{ - Q_OBJECT - Q_PROPERTY(QString iconName READ iconName WRITE setIconName) - Q_PROPERTY(QColor dominantColor READ dominantColor NOTIFY dominantColorChanged STORED false) -public: - IconColors(QObject* parent = Q_NULLPTR); - - QString iconName() const; - void setIconName(const QString& name); - - QColor dominantColor() const; - -Q_SIGNALS: - void dominantColorChanged(const QColor &dominantColor); - -private: - QString m_iconName; -}; - -#endif // ICONCOLORS_H diff --git a/discover/MuonDiscoverMainWindow.cpp b/discover/MuonDiscoverMainWindow.cpp deleted file mode 100644 index 583efaa..0000000 --- a/discover/MuonDiscoverMainWindow.cpp +++ /dev/null @@ -1,286 +0,0 @@ -/* - * Copyright (C) 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library/Lesser General Public License - * version 2, or (at your option) any later version, as published by the - * Free Software Foundation - * - * 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 Library/Lesser 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 "MuonDiscoverMainWindow.h" -#include "PaginateModel.h" -#include "SystemFonts.h" -#include "IconColors.h" - -// Qt includes -#include <QDebug> -#include <QtQml/QQmlEngine> -#include <QtQml/QQmlContext> -#include <QtQml/QQmlApplicationEngine> -#include <QtQuick/QQuickItem> -#include <QTimer> -#include <QGraphicsObject> -#include <QToolButton> -#include <QLayout> -#include <qqml.h> -#include <QNetworkAccessManager> -#include <QNetworkDiskCache> -#include <QQmlNetworkAccessManagerFactory> -#include <QLineEdit> -#include <QMenu> -#include <QMenuBar> -#include <QQuickWidget> -#include <QScreen> - -// KDE includes -#include <KActionCollection> -#include <kdeclarative/kdeclarative.h> -#include <KLocalizedString> -#include <KMessageBox> -#include <KToolBar> -#include <KXMLGUIFactory> -#include <KIO/MetaData> -#include <KHelpMenu> -#include <KAboutData> - -// Libmuon includes -#include <libmuon/MuonDataSources.h> -#include <resources/ResourcesModel.h> -#include <resources/UIHelper.h> -#include <Category/Category.h> - -#include <cmath> - -MuonDiscoverMainWindow::MuonDiscoverMainWindow() - : KXmlGuiWindow() -{ - initialize(); - //TODO: reconsider for QtQuick2 -// m_view->setBackgroundRole(QPalette::AlternateBase); -// qreal bgGrayness = m_view->backgroundBrush().color().blackF(); - - m_view = new QQuickWidget(this); - m_view->setResizeMode(QQuickWidget::SizeRootObjectToView); - QQmlEngine* engine = m_view->engine(); - KDeclarative::KDeclarative kdeclarative; - kdeclarative.setDeclarativeEngine(engine); - //binds things like kconfig and icons - kdeclarative.setupBindings(); - - qmlRegisterType<PaginateModel>("org.kde.muon.discover", 1, 0, "PaginateModel"); - qmlRegisterType<IconColors>("org.kde.muon.discover", 1, 0, "IconColors"); - qmlRegisterSingletonType<SystemFonts>("org.kde.muon.discover", 1, 0, "SystemFonts", ([](QQmlEngine*, QJSEngine*) -> QObject* { return new SystemFonts; })); - qmlRegisterType<KXmlGuiWindow>(); - qmlRegisterType<QActionGroup>(); - qmlRegisterType<QAction>(); - - //Here we set up a cache for the screenshots - engine->rootContext()->setContextProperty("app", this); -// -// KConfigGroup window(KSharedConfig::openConfig(), "Window"); -// restoreGeometry(window.readEntry<QByteArray>("geometry", QByteArray())); -// restoreState(window.readEntry<QByteArray>("windowState", QByteArray())); - - m_view->setSource(QUrl("qrc:/qml/Main.qml")); - - if(!m_view->errors().isEmpty()) { - QString errors; - - Q_FOREACH (const QQmlError &error, m_view->errors()) { - errors.append(error.toString() + QLatin1String("\n")); - } - KMessageBox::detailedSorry(this, - i18n("Found some errors while setting up the GUI, the application can't proceed."), - errors, i18n("Initialization error")); - qDebug() << "errors: " << m_view->errors(); - exit(-1); - } - Q_ASSERT(m_view->errors().isEmpty()); - - setCentralWidget(m_view); - setupActions(); -} - -void MuonDiscoverMainWindow::initialize() -{ - ResourcesModel *m = ResourcesModel::global(); - m->integrateMainWindow(this); -} - -MuonDiscoverMainWindow::~MuonDiscoverMainWindow() -{ - delete m_view; -// KConfigGroup window(KSharedConfig::openConfig(), "Window"); -// window.writeEntry("geometry", saveGeometry()); -// window.writeEntry("windowState", saveState()); -// window.sync(); -} - -QStringList MuonDiscoverMainWindow::modes() const -{ - QStringList ret; - QObject* obj = m_view->rootObject(); - for(int i = obj->metaObject()->propertyOffset(); i<obj->metaObject()->propertyCount(); i++) { - QMetaProperty p = obj->metaObject()->property(i); - QByteArray name = p.name(); - if(name.startsWith("top") && name.endsWith("Comp")) { - name = name.mid(3); - name = name.left(name.length()-4); - name[0] = name[0] - 'A' + 'a'; - ret += name; - } - } - return ret; -} - -void MuonDiscoverMainWindow::openMode(const QByteArray& _mode) -{ - if(!modes().contains(_mode)) - qWarning() << "unknown mode" << _mode; - - QByteArray mode = _mode; - if(mode[0]>'Z') - mode[0] = mode[0]-'a'+'A'; - QObject* obj = m_view->rootObject(); - QByteArray propertyName = "top"+mode+"Comp"; - QVariant modeComp = obj->property(propertyName); - obj->setProperty("currentTopLevel", modeComp); -} - -void MuonDiscoverMainWindow::openMimeType(const QString& mime) -{ - emit listMimeInternal(mime); -} - -void MuonDiscoverMainWindow::openCategory(const QString& category) -{ - emit listCategoryInternal(category); -} - -void MuonDiscoverMainWindow::openApplication(const QString& app) -{ - m_view->rootObject()->setProperty("defaultStartup", false); - m_appToBeOpened = app; - triggerOpenApplication(); - if(!m_appToBeOpened.isEmpty()) - connect(ResourcesModel::global(), SIGNAL(rowsInserted(QModelIndex,int,int)), SLOT(triggerOpenApplication())); -} - -void MuonDiscoverMainWindow::triggerOpenApplication() -{ - AbstractResource* app = ResourcesModel::global()->resourceByPackageName(m_appToBeOpened); - if(app) { - emit openApplicationInternal(app); - m_appToBeOpened.clear(); - disconnect(ResourcesModel::global(), SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(triggerOpenApplication())); - } -} - -QSize MuonDiscoverMainWindow::sizeHint() const -{ - return QSize(800, 900); -} - -QUrl MuonDiscoverMainWindow::featuredSource() const -{ - return MuonDataSources::featuredSource(); -} - -QUrl MuonDiscoverMainWindow::prioritaryFeaturedSource() const -{ - return QUrl::fromLocalFile(QStandardPaths::locate(QStandardPaths::DataLocation, "featured.json")); -} - -bool MuonDiscoverMainWindow::isCompact() const -{ - if (!isVisible()) - return true; - - const qreal pixelDensity = windowHandle()->screen()->physicalDotsPerInch() / 25.4; - return (width()/pixelDensity)<100; //we'll use compact if the width of the window is less than 7cm -} - -qreal MuonDiscoverMainWindow::actualWidth() const -{ - return isCompact() ? width() : width()-std::pow(width()/70., 2); -} - -void MuonDiscoverMainWindow::resizeEvent(QResizeEvent * event) -{ - KXmlGuiWindow::resizeEvent(event); - Q_EMIT compactChanged(isCompact()); - Q_EMIT actualWidthChanged(actualWidth()); -} - -void MuonDiscoverMainWindow::showEvent(QShowEvent * event) -{ - KXmlGuiWindow::showEvent(event); - Q_EMIT compactChanged(isCompact()); - Q_EMIT actualWidthChanged(actualWidth()); -} - -void MuonDiscoverMainWindow::setupActions() -{ - setupGUI(StandardWindowOption(KXmlGuiWindow::Default & ~KXmlGuiWindow::StatusBar & ~KXmlGuiWindow::ToolBar)); - - QAction *quitAction = KStandardAction::quit(QCoreApplication::instance(), SLOT(quit()), actionCollection()); - actionCollection()->addAction("file_quit", quitAction); - - QAction* configureSourcesAction = new QAction(QIcon::fromTheme("repository"), i18n("Configure Sources"), this); - connect(configureSourcesAction, &QAction::triggered, this, &MuonDiscoverMainWindow::configureSources); - actionCollection()->addAction("configure_sources", configureSourcesAction); - - menuBar()->setVisible(false); - toolBar("discoverToolBar")->setVisible(false); - - m_moreMenu = new QMenu(this); - m_advancedMenu = new QMenu(i18n("Advanced..."), m_moreMenu); - configureMenu(); - - connect(ResourcesModel::global(), &ResourcesModel::allInitialized, this, &MuonDiscoverMainWindow::configureMenu); -} - -void MuonDiscoverMainWindow::configureMenu() -{ - m_advancedMenu->clear(); - m_moreMenu->clear(); - UIHelper::setupMessageActions(m_moreMenu, m_advancedMenu, ResourcesModel::global()->messageActions()); - - if (!m_moreMenu->isEmpty()) - m_moreMenu->addSeparator(); - - m_moreMenu->addAction(actionCollection()->action("configure_sources")); - m_moreMenu->addAction(actionCollection()->action("options_configure_keybinding")); - m_moreMenu->addSeparator(); - m_moreMenu->addMenu(m_advancedMenu); - m_moreMenu->addSeparator(); - m_moreMenu->addAction(actionCollection()->action("help_about_app")); - m_moreMenu->addAction(actionCollection()->action("help_about_kde")); - m_moreMenu->addAction(actionCollection()->action("help_report_bug")); -} - -void MuonDiscoverMainWindow::configureSources() -{ - openMode("Sources"); -} - -bool MuonDiscoverMainWindow::queryClose() -{ - return !ResourcesModel::global()->isBusy(); -} - -void MuonDiscoverMainWindow::showMenu(int x, int y) -{ - QPoint p = m_view->mapToGlobal(QPoint(x, y)); - m_moreMenu->exec(p); -} diff --git a/discover/MuonDiscoverMainWindow.h b/discover/MuonDiscoverMainWindow.h deleted file mode 100644 index 3dfcc4a..0000000 --- a/discover/MuonDiscoverMainWindow.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (C) 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library/Lesser General Public License - * version 2, or (at your option) any later version, as published by the - * Free Software Foundation - * - * 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 Library/Lesser 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 MUONDISCOVERMAINWINDOW_H -#define MUONDISCOVERMAINWINDOW_H - -#include <QtCore/QUrl> - -#include <KXmlGuiWindow> - -class QQmlEngine; -class QLineEdit; -class QAptIntegration; -class AbstractResource; -class Category; -class QQuickWidget; - -class MuonDiscoverMainWindow : public KXmlGuiWindow -{ - Q_OBJECT - Q_PROPERTY(QUrl prioritaryFeaturedSource READ prioritaryFeaturedSource CONSTANT) - Q_PROPERTY(QUrl featuredSource READ featuredSource CONSTANT) - Q_PROPERTY(bool isCompact READ isCompact NOTIFY compactChanged) - Q_PROPERTY(qreal actualWidth READ actualWidth NOTIFY actualWidthChanged) - public: - explicit MuonDiscoverMainWindow(); - ~MuonDiscoverMainWindow(); - - QSize sizeHint() const override; - - void initialize(); - QStringList modes() const; - void setupActions(); - - bool queryClose() Q_DECL_OVERRIDE; - - QUrl prioritaryFeaturedSource() const; - QUrl featuredSource() const; - - bool isCompact() const; - qreal actualWidth() const; - - void resizeEvent(QResizeEvent * event) override; - void showEvent(QShowEvent * event) override; - - public slots: - void openApplication(const QString& app); - void openMimeType(const QString& mime); - void openCategory(const QString& category); - void openMode(const QByteArray& mode); - void showMenu(int x, int y); - - private slots: - void triggerOpenApplication(); - - signals: - void openApplicationInternal(AbstractResource* app); - void listMimeInternal(const QString& mime); - void listCategoryInternal(const QString& name); - - void compactChanged(bool isCompact); - void actualWidthChanged(qreal actualWidth); - - private: - void configureSources(); - void configureMenu(); - - QString m_appToBeOpened; - QQuickWidget* m_view; - QMenu* m_moreMenu; - QMenu* m_advancedMenu; -}; - -#endif // MUONINSTALLERDECLARATIVEVIEW_H diff --git a/discover/PaginateModel.cpp b/discover/PaginateModel.cpp deleted file mode 100644 index ce1f420..0000000 --- a/discover/PaginateModel.cpp +++ /dev/null @@ -1,356 +0,0 @@ -/* - * Copyright (C) 2014 Aleix Pol Gonzalez <aleixpol@blue-systems.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library/Lesser General Public License - * version 2, or (at your option) any later version, as published by the - * Free Software Foundation - * - * 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 Library/Lesser 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 "PaginateModel.h" -#include <QDebug> - -PaginateModel::PaginateModel(QObject* object) - : QAbstractListModel(object) - , m_firstItem(0) - , m_pageSize(10) - , m_sourceModel(nullptr) -{ -} - -int PaginateModel::firstItem() const -{ - return m_firstItem; -} - -void PaginateModel::setFirstItem(int row) -{ - Q_ASSERT(row>=0 && row<m_sourceModel->rowCount()); - if (row!=m_firstItem) { - beginResetModel(); - m_firstItem = row; - endResetModel(); - emit firstItemChanged(); - } -} - -int PaginateModel::pageSize() const -{ - return m_pageSize; -} - -void PaginateModel::setPageSize(int count) -{ - if (count != m_pageSize) { - const int oldSize = rowsByPageSize(m_pageSize); - const int newSize = rowsByPageSize(count); - const int difference = newSize - oldSize; - if (difference==0) { - m_pageSize = count; - } else if(difference>0) { - beginInsertRows(QModelIndex(), m_pageSize, m_pageSize+difference); - m_pageSize = count; - endInsertRows(); - } else { - beginRemoveRows(QModelIndex(), m_pageSize+difference, m_pageSize); - m_pageSize = count; - endRemoveRows(); - } - emit pageSizeChanged(); - } -} - -QAbstractItemModel* PaginateModel::sourceModel() const -{ - return m_sourceModel; -} - -void PaginateModel::setSourceModel(QAbstractItemModel* model) -{ - if(m_sourceModel) { - disconnect(m_sourceModel, nullptr, this, nullptr); - } - - if(model!=m_sourceModel) { - beginResetModel(); - m_sourceModel = model; - if(model) { - connect(m_sourceModel, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)), SLOT(_k_sourceRowsAboutToBeInserted(QModelIndex,int,int))); - connect(m_sourceModel, SIGNAL(rowsInserted(QModelIndex,int,int)), SLOT(_k_sourceRowsInserted(QModelIndex,int,int))); - connect(m_sourceModel, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)), SLOT(_k_sourceRowsAboutToBeRemoved(QModelIndex,int,int))); - connect(m_sourceModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), SLOT(_k_sourceRowsRemoved(QModelIndex,int,int))); - connect(m_sourceModel, SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)), SLOT(_k_sourceRowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int))); - connect(m_sourceModel, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)), SLOT(_k_sourceRowsMoved(QModelIndex,int,int,QModelIndex,int))); - - connect(m_sourceModel, SIGNAL(columnsAboutToBeInserted(QModelIndex,int,int)), SLOT(_k_sourceColumnsAboutToBeInserted(QModelIndex,int,int))); - connect(m_sourceModel, SIGNAL(columnsInserted(QModelIndex,int,int)), SLOT(_k_sourceColumnsInserted(QModelIndex,int,int))); - connect(m_sourceModel, SIGNAL(columnsAboutToBeRemoved(QModelIndex,int,int)), SLOT(_k_sourceColumnsAboutToBeRemoved(QModelIndex,int,int))); - connect(m_sourceModel, SIGNAL(columnsRemoved(QModelIndex,int,int)), SLOT(_k_sourceColumnsRemoved(QModelIndex,int,int))); - connect(m_sourceModel, SIGNAL(columnsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)), SLOT(_k_sourceColumnsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int))); - connect(m_sourceModel, SIGNAL(columnsMoved(QModelIndex,int,int,QModelIndex,int)), SLOT(_k_sourceColumnsMoved(QModelIndex,int,int,QModelIndex,int))); - - connect(m_sourceModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), SLOT(_k_sourceDataChanged(QModelIndex,QModelIndex))); - connect(m_sourceModel, SIGNAL(headerDataChanged(Qt::Orientation,int,int)), SLOT(_k_sourceHeaderDataChanged(Qt::Orientation,int,int))); - - connect(m_sourceModel, SIGNAL(modelAboutToBeReset()), SLOT(_k_sourceModelAboutToBeReset())); - connect(m_sourceModel, SIGNAL(modelReset()), SLOT(_k_sourceModelReset())); - - connect(m_sourceModel, SIGNAL(rowsInserted(QModelIndex,int,int)), SIGNAL(pageCountChanged())); - connect(m_sourceModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), SIGNAL(pageCountChanged())); - connect(m_sourceModel, SIGNAL(modelReset()), SIGNAL(pageCountChanged())); - } - endResetModel(); - emit sourceModelChanged(); - } -} - -QHash< int, QByteArray > PaginateModel::roleNames() const -{ - return m_sourceModel ? m_sourceModel->roleNames() : QAbstractItemModel::roleNames(); -} - -int PaginateModel::rowsByPageSize(int size) const -{ - return !m_sourceModel ? 0 : qMin(m_sourceModel->rowCount()-m_firstItem, size); -} - -int PaginateModel::rowCount(const QModelIndex& parent) const -{ - return parent.isValid() ? 0 : rowsByPageSize(m_pageSize); -} - -QModelIndex PaginateModel::mapToSource(const QModelIndex& idx) const -{ - if(!m_sourceModel) - return QModelIndex(); - return m_sourceModel->index(idx.row()+m_firstItem, idx.column()); -} - -QModelIndex PaginateModel::mapFromSource(const QModelIndex& idx) const -{ - Q_ASSERT(idx.model() == m_sourceModel); - if(!m_sourceModel) - return QModelIndex(); - return index(idx.row()-m_firstItem, idx.column()); -} - -QVariant PaginateModel::data(const QModelIndex& index, int role) const -{ - if(!m_sourceModel) - return QVariant(); - QModelIndex idx = mapToSource(index); - return idx.data(role); -} - -void PaginateModel::firstPage() -{ - setFirstItem(0); -} - -void PaginateModel::lastPage() -{ - setFirstItem(pageCount()*m_pageSize); -} - -void PaginateModel::nextPage() -{ - setFirstItem(m_firstItem + m_pageSize); -} - -void PaginateModel::previousPage() -{ - setFirstItem(m_firstItem - m_pageSize); -} - -int PaginateModel::currentPage() const -{ - return m_firstItem/m_pageSize; -} - -int PaginateModel::pageCount() const -{ - if(!m_sourceModel) - return 0; - int r = (m_sourceModel->rowCount()%m_pageSize == 0) ? 1 : 0; - return m_sourceModel->rowCount()/m_pageSize - r; -} - -////////////////////////////// - -void PaginateModel::_k_sourceColumnsAboutToBeInserted(const QModelIndex& parent, int start, int end) -{ - Q_UNUSED(end) - if(parent.isValid() || start!=0) { - return; - } - beginResetModel(); -} - -void PaginateModel::_k_sourceColumnsAboutToBeMoved(const QModelIndex& sourceParent, int sourceStart, int sourceEnd, const QModelIndex& destParent, int dest) -{ - Q_UNUSED(sourceParent) - Q_UNUSED(sourceStart) - Q_UNUSED(sourceEnd) - Q_UNUSED(destParent) - Q_UNUSED(dest) - beginResetModel(); -} - -void PaginateModel::_k_sourceColumnsAboutToBeRemoved(const QModelIndex& parent, int start, int end) -{ - Q_UNUSED(end) - if(parent.isValid() || start!=0) { - return; - } - beginResetModel(); -} - -void PaginateModel::_k_sourceColumnsInserted(const QModelIndex& parent, int start, int end) -{ - Q_UNUSED(end) - if(parent.isValid() || start!=0) { - return; - } - endResetModel(); -} - -void PaginateModel::_k_sourceColumnsMoved(const QModelIndex& sourceParent, int sourceStart, int sourceEnd, const QModelIndex& destParent, int dest) -{ - Q_UNUSED(sourceParent) - Q_UNUSED(sourceStart) - Q_UNUSED(sourceEnd) - Q_UNUSED(destParent) - Q_UNUSED(dest) - endResetModel(); -} - -void PaginateModel::_k_sourceColumnsRemoved(const QModelIndex& parent, int start, int end) -{ - Q_UNUSED(end) - if(parent.isValid() || start!=0) { - return; - } - endResetModel(); -} - -void PaginateModel::_k_sourceDataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight) -{ - if(topLeft.parent().isValid() || bottomRight.row()<m_firstItem || topLeft.row()>m_firstItem+rowCount()) { - return; - } - - QModelIndex idxTop = mapFromSource(topLeft); - QModelIndex idxBottom = mapFromSource(bottomRight); - if(!idxTop.isValid()) - idxTop = index(0); - if(!idxBottom.isValid()) - idxBottom = index(rowCount()-1); - - emit dataChanged(idxTop, idxBottom); -} - -void PaginateModel::_k_sourceHeaderDataChanged(Qt::Orientation orientation, int first, int last) -{ - Q_UNUSED(last) - if(first==0) - emit headerDataChanged(orientation, 0, 0); -} - -void PaginateModel::_k_sourceModelAboutToBeReset() -{ - beginResetModel(); -} - -void PaginateModel::_k_sourceModelReset() -{ - endResetModel(); -} - -void PaginateModel::_k_sourceRowsAboutToBeInserted(const QModelIndex& parent, int start, int end) -{ - if(parent.isValid() || start>m_firstItem+m_pageSize) { - return; - } - - int insertedCount = end-start-1; - if(insertedCount > m_pageSize) { - beginResetModel(); - } else { - int newStart = qMax(start-m_firstItem, 0); - beginInsertRows(QModelIndex(), newStart, newStart+insertedCount); - } -} - -void PaginateModel::_k_sourceRowsAboutToBeMoved(const QModelIndex& sourceParent, int sourceStart, int sourceEnd, const QModelIndex& destParent, int dest) -{ - Q_UNUSED(sourceParent) - Q_UNUSED(sourceStart) - Q_UNUSED(sourceEnd) - Q_UNUSED(destParent) - Q_UNUSED(dest) - //TODO could optimize, unsure if it makes sense - beginResetModel(); -} - -void PaginateModel::_k_sourceRowsAboutToBeRemoved(const QModelIndex& parent, int start, int end) -{ - if(parent.isValid() || start>m_firstItem+m_pageSize) { - return; - } - - int removedCount = end-start; - if(removedCount > m_pageSize) { - beginResetModel(); - } else { - int newStart = qMax(start-m_firstItem, 0); - beginRemoveRows(QModelIndex(), newStart, newStart+removedCount); - } -} - -void PaginateModel::_k_sourceRowsInserted(const QModelIndex& parent, int start, int end) -{ - if(parent.isValid() || start>m_firstItem+m_pageSize) { - return; - } - - int insertedCount = end-start; - if(insertedCount > m_pageSize) { - endResetModel(); - } else { - endInsertRows(); - } -} - -void PaginateModel::_k_sourceRowsMoved(const QModelIndex& sourceParent, int sourceStart, int sourceEnd, const QModelIndex& destParent, int dest) -{ - Q_UNUSED(sourceParent) - Q_UNUSED(sourceStart) - Q_UNUSED(sourceEnd) - Q_UNUSED(destParent) - Q_UNUSED(dest) - endResetModel(); -} - -void PaginateModel::_k_sourceRowsRemoved(const QModelIndex& parent, int start, int end) -{ - if(parent.isValid() || start>m_firstItem+m_pageSize) { - return; - } - - int removedCount = end-start; - if(removedCount > m_pageSize) { - beginResetModel(); - } else { - endRemoveRows(); - } -} diff --git a/discover/PaginateModel.h b/discover/PaginateModel.h deleted file mode 100644 index 930c89e..0000000 --- a/discover/PaginateModel.h +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (C) 2014 Aleix Pol Gonzalez <aleixpol@blue-systems.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library/Lesser General Public License - * version 2, or (at your option) any later version, as published by the - * Free Software Foundation - * - * 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 Library/Lesser 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 PAGINATEMODEL_H -#define PAGINATEMODEL_H - -#include <QAbstractListModel> - -/** - * @class PaginateModel - * - * This class can be used to create representations of only a chunk of a model. - * - * With this component it will be possible to create views that only show a page - * of a model, instead of drawing all the elements in the model. - */ -class PaginateModel : public QAbstractListModel -{ - Q_OBJECT - Q_PROPERTY(int pageSize READ pageSize WRITE setPageSize NOTIFY pageSizeChanged) - Q_PROPERTY(int firstItem READ firstItem WRITE setFirstItem NOTIFY firstItemChanged) - Q_PROPERTY(QAbstractItemModel* sourceModel READ sourceModel WRITE setSourceModel NOTIFY sourceModelChanged) - Q_PROPERTY(int currentPage READ currentPage NOTIFY firstItemChanged) - Q_PROPERTY(int pageCount READ pageCount NOTIFY pageCountChanged) - - public: - PaginateModel(QObject* object = nullptr); - - int pageSize() const; - void setPageSize(int count); - - int firstItem() const; - void setFirstItem(int row); - - QAbstractItemModel* sourceModel() const; - void setSourceModel(QAbstractItemModel* model); - - QModelIndex mapToSource(const QModelIndex& idx) const; - QModelIndex mapFromSource(const QModelIndex& idx) const; - virtual int rowCount(const QModelIndex& parent = QModelIndex()) const override; - virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; - - int currentPage() const; - int pageCount() const; - virtual QHash<int, QByteArray> roleNames() const override; - - Q_SCRIPTABLE void firstPage(); - Q_SCRIPTABLE void nextPage(); - Q_SCRIPTABLE void previousPage(); - Q_SCRIPTABLE void lastPage(); - - private slots: - void _k_sourceRowsAboutToBeInserted(const QModelIndex &parent, int start, int end); - void _k_sourceRowsInserted(const QModelIndex &parent, int start, int end); - void _k_sourceRowsAboutToBeRemoved(const QModelIndex &parent, int start, int end); - void _k_sourceRowsRemoved(const QModelIndex &parent, int start, int end); - void _k_sourceRowsAboutToBeMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destParent, int dest); - void _k_sourceRowsMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destParent, int dest); - - void _k_sourceColumnsAboutToBeInserted(const QModelIndex &parent, int start, int end); - void _k_sourceColumnsInserted(const QModelIndex &parent, int start, int end); - void _k_sourceColumnsAboutToBeRemoved(const QModelIndex &parent, int start, int end); - void _k_sourceColumnsRemoved(const QModelIndex &parent, int start, int end); - void _k_sourceColumnsAboutToBeMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destParent, int dest); - void _k_sourceColumnsMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destParent, int dest); - - void _k_sourceDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight); - void _k_sourceHeaderDataChanged(Qt::Orientation orientation, int first, int last); - - void _k_sourceModelAboutToBeReset(); - void _k_sourceModelReset(); - - signals: - void pageSizeChanged(); - void firstItemChanged(); - void sourceModelChanged(); - void pageCountChanged(); - - private: - int rowsByPageSize(int size) const; - int m_firstItem; - int m_pageSize; - QAbstractItemModel* m_sourceModel; -}; - -#endif diff --git a/discover/SystemFonts.cpp b/discover/SystemFonts.cpp deleted file mode 100644 index e4af785..0000000 --- a/discover/SystemFonts.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (C) 2014 Aleix Pol Gonzalez <aleixpol@blue-systems.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library/Lesser General Public License - * version 2, or (at your option) any later version, as published by the - * Free Software Foundation - * - * 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 Library/Lesser 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 "SystemFonts.h" -#include <QFontDatabase> -#include <QGuiApplication> -#include <QDebug> - -SystemFonts::SystemFonts(QObject* parent) - : QObject(parent) -{ - QGuiApplication::instance()->installEventFilter(this); -} - -QFont SystemFonts::fixedFont() const -{ - return QFontDatabase::systemFont(QFontDatabase::FixedFont); -} - -QFont SystemFonts::generalFont() const -{ - return QFontDatabase::systemFont(QFontDatabase::GeneralFont); -} - -QFont SystemFonts::smallestReadableFont() const -{ - return QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont); -} - -QFont SystemFonts::titleFont() const -{ - return QFontDatabase::systemFont(QFontDatabase::TitleFont); -} - -bool SystemFonts::eventFilter(QObject* obj, QEvent* ev) -{ - if(ev->type() == QEvent::ApplicationFontChange) { - emit fontsChanged(); - } - return QObject::eventFilter(obj, ev); -} diff --git a/discover/SystemFonts.h b/discover/SystemFonts.h deleted file mode 100644 index 606975d..0000000 --- a/discover/SystemFonts.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (C) 2014 Aleix Pol Gonzalez <aleixpol@blue-systems.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library/Lesser General Public License - * version 2, or (at your option) any later version, as published by the - * Free Software Foundation - * - * 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 Library/Lesser 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 SYSTEMFONTS_H -#define SYSTEMFONTS_H - -#include <QObject> - -class SystemFonts : public QObject -{ - Q_OBJECT - Q_PROPERTY(QFont generalFont READ generalFont NOTIFY fontsChanged) - Q_PROPERTY(QFont fixedFont READ fixedFont NOTIFY fontsChanged) - Q_PROPERTY(QFont titleFont READ titleFont NOTIFY fontsChanged) - Q_PROPERTY(QFont smallestReadableFont READ smallestReadableFont NOTIFY fontsChanged) - public: - SystemFonts(QObject* parent = nullptr); - - QFont generalFont() const; - QFont fixedFont() const; - QFont titleFont() const; - QFont smallestReadableFont() const; - - virtual bool eventFilter(QObject* obj, QEvent* ev) override; - - Q_SIGNALS: - void fontsChanged(); -}; - -#endif // SYSTEMFONTS_H diff --git a/discover/autotests/CMakeLists.txt b/discover/autotests/CMakeLists.txt deleted file mode 100644 index b70c4c0..0000000 --- a/discover/autotests/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -add_executable(IconColorsTest IconColorsTest.cpp ../IconColors.cpp) -target_link_libraries(IconColorsTest Qt5::Test Qt5::Gui) diff --git a/discover/autotests/IconColorsTest.cpp b/discover/autotests/IconColorsTest.cpp deleted file mode 100644 index 3578c0a..0000000 --- a/discover/autotests/IconColorsTest.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (C) 2015 Aleix Pol Gonzalez <aleixpol@blue-systems.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library/Lesser General Public License - * version 2, or (at your option) any later version, as published by the - * Free Software Foundation - * - * 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 Library/Lesser 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 <QtTest> -#include "../IconColors.h" - -class IconColorsTest : public QObject -{ - Q_OBJECT -public: - IconColorsTest() {} - -private slots: - void testIcon_data() { - QTest::addColumn<QString>("iconName"); - QTest::addColumn<int>("hue"); - - QTest::newRow("akregator") << "akregator" << 15; - QTest::newRow("korganizer") << "korganizer" << 105; - } - - void testIcon() { - QFETCH(QString, iconName); - QFETCH(int, hue); - - IconColors colors; - colors.setIconName(iconName); - - QCOMPARE(colors.dominantColor().hue(), hue); - } -}; - -QTEST_MAIN( IconColorsTest ) - -#include "IconColorsTest.moc" diff --git a/discover/featured.json b/discover/featured.json deleted file mode 100644 index e2358a7..0000000 --- a/discover/featured.json +++ /dev/null @@ -1,17 +0,0 @@ -[ - { - "icon": "kde", - "image": "qrc:/qml/DefaultBanner.qml", - "text": "KDE", - "comment": "Awesomeness!", - "url": "http://kde.org", - "color": "blue" - }, - { - "icon": "kde", - "image": "http://kde.org/images/teaser/jointhegame.gif", - "text": "Support KDE", - "comment": "Join the Game!", - "url": "https://relate.kde.org/civicrm/contribute/transact?reset=1&id=5" - } -] diff --git a/discover/icons/128-apps-muondiscover.png b/discover/icons/128-apps-muondiscover.png Binary files differdeleted file mode 100644 index a20f474..0000000 --- a/discover/icons/128-apps-muondiscover.png +++ /dev/null diff --git a/discover/icons/16-apps-muondiscover.png b/discover/icons/16-apps-muondiscover.png Binary files differdeleted file mode 100644 index d5f39f2..0000000 --- a/discover/icons/16-apps-muondiscover.png +++ /dev/null diff --git a/discover/icons/22-apps-muondiscover.png b/discover/icons/22-apps-muondiscover.png Binary files differdeleted file mode 100644 index 8858e7f..0000000 --- a/discover/icons/22-apps-muondiscover.png +++ /dev/null diff --git a/discover/icons/32-apps-muondiscover.png b/discover/icons/32-apps-muondiscover.png Binary files differdeleted file mode 100644 index e6ba232..0000000 --- a/discover/icons/32-apps-muondiscover.png +++ /dev/null diff --git a/discover/icons/48-apps-muondiscover.png b/discover/icons/48-apps-muondiscover.png Binary files differdeleted file mode 100644 index 81d05b1..0000000 --- a/discover/icons/48-apps-muondiscover.png +++ /dev/null diff --git a/discover/icons/CMakeLists.txt b/discover/icons/CMakeLists.txt deleted file mode 100644 index ac883a6..0000000 --- a/discover/icons/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -ecm_install_icons( - ICONS - 128-apps-muondiscover.png - 16-apps-muondiscover.png - 22-apps-muondiscover.png - 32-apps-muondiscover.png - 48-apps-muondiscover.png - sc-apps-muondiscover.svgz - DESTINATION ${ICON_INSTALL_DIR} - THEME hicolor -) diff --git a/discover/icons/sc-apps-muondiscover.svgz b/discover/icons/sc-apps-muondiscover.svgz Binary files differdeleted file mode 100644 index b581cac..0000000 --- a/discover/icons/sc-apps-muondiscover.svgz +++ /dev/null diff --git a/discover/main.cpp b/discover/main.cpp deleted file mode 100644 index 99c1f72..0000000 --- a/discover/main.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (C) 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library/Lesser General Public License - * version 2, or (at your option) any later version, as published by the - * Free Software Foundation - * - * 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 Library/Lesser 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 <QApplication> -#include <KAboutData> -#include <KDBusService> -#include <KLocalizedString> -#include <QCommandLineParser> -#include <qwindow.h> -#include "MuonDiscoverMainWindow.h" -#include <MuonBackendsFactory.h> -#include "MuonVersion.h" - -int main(int argc, char** argv) -{ - QApplication app(argc, argv); - app.setWindowIcon(QIcon::fromTheme("muondiscover")); - app.setAttribute(Qt::AA_DontCreateNativeWidgetSiblings); - app.setAttribute(Qt::AA_UseHighDpiPixmaps, true); - KLocalizedString::setApplicationDomain("muon-discover"); - KAboutData about("muondiscover", i18n("Muon Discover"), version, i18n("An application explorer"), - KAboutLicense::GPL, i18n("© 2010-2014 Muon Development Team")); - about.addAuthor(i18n("Aleix Pol Gonzalez"), QString(), "aleixpol@blue-systems.com"); - about.addAuthor(i18n("Jonathan Thomas"), QString(), "echidnaman@kubuntu.org"); - about.setProductName("muon/discover"); - KAboutData::setApplicationData(about); - - KDBusService service(KDBusService::Unique); - MuonDiscoverMainWindow *mainWindow = nullptr; - { - QCommandLineParser parser; - parser.addOption(QCommandLineOption("application", i18n("Directly open the specified application by its package name."), "name")); - parser.addOption(QCommandLineOption("mime", i18n("Open with a program that can deal with the given mimetype."), "name")); - parser.addOption(QCommandLineOption("category", i18n("Display a list of entries with a category."), "name")); - parser.addOption(QCommandLineOption("mode", i18n("Open Muon Discover in a said mode. Modes correspond to the toolbar buttons."), "name")); - parser.addOption(QCommandLineOption("listmodes", i18n("List all the available modes."))); - parser.addPositionalArgument("urls", i18n("Supports appstream: url scheme (experimental)")); - MuonBackendsFactory::setupCommandLine(&parser); - about.setupCommandLine(&parser);parser.addHelpOption(); - parser.addVersionOption(); - parser.process(app); - about.processCommandLine(&parser); - MuonBackendsFactory::processCommandLine(&parser); - - mainWindow = new MuonDiscoverMainWindow; - QObject::connect(&app, SIGNAL(aboutToQuit()), mainWindow, SLOT(deleteLater())); - - if(parser.isSet("application")) - mainWindow->openApplication(parser.value("application")); - else if(parser.isSet("mime")) - mainWindow->openMimeType(parser.value("mime")); - else if(parser.isSet("category")) - mainWindow->openCategory(parser.value("category")); - else if(parser.isSet("mode")) - mainWindow->openMode(parser.value("mode").toLocal8Bit()); - else if(parser.isSet("listmodes")) { - fprintf(stdout, "%s", qPrintable(i18n("Available modes:\n"))); - foreach(const QString& mode, mainWindow->modes()) - fprintf(stdout, " * %s\n", qPrintable(mode)); - return 0; - } - - foreach(const QString &arg, parser.positionalArguments()) { - QUrl url(arg); - if (url.scheme() == QLatin1String("appstream")) { - mainWindow->openApplication(url.path()); - } - } - } - - mainWindow->show(); - QObject::connect(mainWindow->windowHandle(), &QWindow::visibleChanged, [](bool b){ - if(!b) - QCoreApplication::instance()->quit(); - }); - - return app.exec(); -} diff --git a/discover/muon-contenttheme/CMakeLists.txt b/discover/muon-contenttheme/CMakeLists.txt deleted file mode 100644 index 124e5c3..0000000 --- a/discover/muon-contenttheme/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ - -install(FILES metadata.desktop DESTINATION ${DATA_INSTALL_DIR}/desktoptheme/muon-contenttheme/) - -file(GLOB widgets widgets/*.svgz) -install( FILES ${widgets} DESTINATION ${DATA_INSTALL_DIR}/desktoptheme/muon-contenttheme/widgets/ ) - - diff --git a/discover/muon-contenttheme/metadata.desktop b/discover/muon-contenttheme/metadata.desktop deleted file mode 100644 index add545e..0000000 --- a/discover/muon-contenttheme/metadata.desktop +++ /dev/null @@ -1,105 +0,0 @@ -[Desktop Entry] -Name=Application dashboard -Name[ast]=Cuadru de mandos d'aplicaciones -Name[bs]=Aplikacijska kontrolna ploča -Name[ca]=Tauler d'aplicacions -Name[ca@valencia]=Tauler d'aplicacions -Name[cs]=Pracovní plocha aplikace -Name[da]=Programinstrumentbræt -Name[de]=Anwendungsübersicht -Name[el]=Πίνακας ελέγχου εφαρμογών -Name[en_GB]=Application dashboard -Name[es]=Tablero de mandos de la aplicación -Name[fi]=Sovelluskojelauta -Name[fr]=Tableau de bord des applications -Name[gl]=Cadro de control de programas -Name[hu]=Alkalmazásáttekintő -Name[id]=Dasbor aplikasi -Name[it]=Quadro delle applicazioni -Name[kk]=Қолданбаның аспаптар панелі -Name[ko]=프로그램 대시보드 -Name[lt]=Programų skydelis -Name[mr]=अनुप्रयोग डॅशबोर्ड -Name[nb]=Program-kontrollpult -Name[nds]=Programm-Klockpaneel -Name[nl]=Toepassingendashboard -Name[nn]=Programkontrollpult -Name[pa]=ਐਪਲੀਕੇਸ਼ਨ ਡੈਸ਼ਬੋਰਡ -Name[pl]=Tablica programów -Name[pt]=Painel da aplicação -Name[pt_BR]=Painel de aplicativos -Name[ro]=Tablou de bord cu aplicații -Name[ru]=Панель приложений -Name[sk]=Aplikačná prístrojová doska -Name[sl]=Nadzorna plošča s programi -Name[sr]=Инструмент-табла програма -Name[sr@ijekavian]=Инструмент-табла програма -Name[sr@ijekavianlatin]=Instrument-tabla programa -Name[sr@latin]=Instrument-tabla programa -Name[sv]=Instrumentpanel för program -Name[tr]=Uygulama paneli -Name[ug]=پروگرامما تىزگىن تاختىسى -Name[uk]=Панель приладів програм -Name[x-test]=xxApplication dashboardxx -Name[zh_CN]=应用程序部件板 -Name[zh_TW]=應用程式控制面板 -Comment=Intended as Application dashboard default -Comment[bs]=Planirano kao podrazumijevana aplikacijska kontrolna ploča -Comment[ca]=Proposat com a tauler d'aplicacions per defecte -Comment[ca@valencia]=Proposat com a tauler d'aplicacions per defecte -Comment[cs]=Zamýšleno jako výchozí pracovní plocha aplikace -Comment[da]=Tiltænkt som standard for programinstrumentbræt -Comment[de]=Als Voreinstellung für Anwendungsübersicht angedacht -Comment[el]=Πρόκετια για τον προκαθορισμένο πίνακα ελέγχου εφαρμογών -Comment[en_GB]=Intended as Application dashboard default -Comment[es]=Pensado como tablero de mandos por omisión de la aplicación -Comment[et]=Vaikimisi rakendustevaade -Comment[fi]=Tarkoitettu oletussovelluskojelaudaksi -Comment[fr]=Prévu comme tableau de bord par défaut des applications -Comment[gl]=Pretende ser o predeterminado do Cadro de control de programas -Comment[hu]=Alapértelmezésként alkalmazásáttekintőnek tervezett -Comment[id]=Direncanakan sebagai dasbor Aplikasi baku -Comment[it]=Inteso come quadro delle applicazioni predefinito -Comment[kk]=Қолданбаның аспаптар панелі болуға бағытталған -Comment[ko]=프로그램 대시보드 기본값으로 의도함 -Comment[lt]=Numatytas kaip pradinis programų skydelis -Comment[mr]=अनुप्रयोग डॅशबोर्ड ला अभिप्रेत मूलभूत -Comment[nb]=Ment å være standard kontrollpult for et Program -Comment[nds]=As Standard för dat Programm-Klockpaneel dacht -Comment[nl]=Bedoelt als standaard in het toepassingendashboard -Comment[nn]=Laga som standard programkontrollpult -Comment[pa]=ਐਪਲੀਕੇਸ਼ਨ ਡੈਸ਼ਬੋਰਡ ਡਿਫਾਲਟ ਵਜੋਂ -Comment[pl]=Przeznaczone do wykonywania zadania domyślnej tablicy programów -Comment[pt]=Pretendido como predefinição do painel da aplicação -Comment[pt_BR]=Pretende ser o painel de aplicativos padrão -Comment[ro]=Implicit pentru tabloul de bord cu aplicații -Comment[ru]=Панель приложений по умолчанию -Comment[sk]=Určené ako predvolená prístrojová doska aplikácie -Comment[sl]=Namenjena kot privzeta za nadzorno ploščo s programi -Comment[sr]=Замишљена као подразумевана инструмент-табла програма -Comment[sr@ijekavian]=Замишљена као подразумевана инструмент-табла програма -Comment[sr@ijekavianlatin]=Zamišljena kao podrazumevana instrument-tabla programa -Comment[sr@latin]=Zamišljena kao podrazumevana instrument-tabla programa -Comment[sv]=Avsett som förvald instrumentpanel för program -Comment[tr]=Uygulama paneli öntanımlıı olarak amaçlandı -Comment[ug]=پروگرامما تىزگىن تاختىنى كۆڭۈلدىكىگە تەڭشەيدۇ -Comment[uk]=Призначено бути типовою панеллю приладів програм -Comment[x-test]=xxIntended as Application dashboard defaultxx -Comment[zh_CN]=作为应用程序部件板的默认值 -Comment[zh_TW]=應用程式預設控制面板 - -NoDisplay=true - -X-KDE-PluginInfo-Author=Aleix Pol Gonzalez -X-KDE-PluginInfo-Email=aleixpol@kde.org -X-KDE-PluginInfo-Name=muon-contenttheme -X-KDE-PluginInfo-Version=0.1 -X-KDE-PluginInfo-Website=http://kde.org -X-KDE-PluginInfo-Category= -X-KDE-PluginInfo-Depends= -X-KDE-PluginInfo-License=GPL -X-KDE-PluginInfo-EnabledByDefault=true - -[Settings] -UseNativeWidgetStyle=true -FallbackTheme=default diff --git a/discover/muon-contenttheme/widgets/listitem.svgz b/discover/muon-contenttheme/widgets/listitem.svgz Binary files differdeleted file mode 100644 index c626864..0000000 --- a/discover/muon-contenttheme/widgets/listitem.svgz +++ /dev/null diff --git a/discover/muondiscoverui.rc b/discover/muondiscoverui.rc deleted file mode 100644 index 375c6d8..0000000 --- a/discover/muondiscoverui.rc +++ /dev/null @@ -1,10 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<gui name="muon-discover" - version="5" - xmlns="http://www.kde.org/standards/kxmlgui/1.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://www.kde.org/standards/kxmlgui/1.0 - http://www.kde.org/standards/kxmlgui/1.0/kxmlgui.xsd"> - <ToolBar name="mainToolBar" deleted="true"/> - <ToolBar name="discoverToolBar" deleted="true"/> -</gui> diff --git a/discover/org.kde.discover.desktop b/discover/org.kde.discover.desktop deleted file mode 100644 index d80af55..0000000 --- a/discover/org.kde.discover.desktop +++ /dev/null @@ -1,140 +0,0 @@ -[Desktop Entry] -Name=Muon Discover -Name[bg]=Muon Discover -Name[bs]=Muon otkrivač -Name[ca]=Muon Discover -Name[ca@valencia]=Muon Discover -Name[cs]=Muon Discover -Name[da]=Muon Discover -Name[de]=Muon-Discover -Name[el]=Muon Discover -Name[en_GB]=Muon Discover -Name[es]=Muon Discover -Name[et]=Muoni avastusretk -Name[fi]=Muon Discover -Name[fr]=Découvreur de Muon -Name[ga]=Aimsiú Muon -Name[gl]=Descubridor do Muon -Name[hu]=Muon Discover -Name[id]=Muon Discover -Name[it]=Muon Discover -Name[kk]=Muon тапқышы -Name[ko]=Muon 발견 -Name[lt]=Muon apžvalga -Name[mr]=म्युओन डिस्कव्हर -Name[nb]=Muon-oppdager -Name[nds]=Muon-Opdecken -Name[nl]=Muon-zoeken -Name[nn]=Muon Discover -Name[pa]=ਮੂਓਨ ਖੋਜ -Name[pl]=Odkrywca Muon -Name[pt]=Descoberta do Muon -Name[pt_BR]=Muon Discover -Name[ro]=Descoperire Muon -Name[ru]=Обзор программ Muon -Name[sk]=Muon Discover -Name[sl]=Odkritelj Muon -Name[sr]=Муонов откривач -Name[sr@ijekavian]=Муонов откривач -Name[sr@ijekavianlatin]=Muonov otkrivač -Name[sr@latin]=Muonov otkrivač -Name[sv]=Muon upptäckt -Name[tr]=Muon Keşfet -Name[uk]=Шукач Muon -Name[x-test]=xxMuon Discoverxx -Name[zh_CN]=Muon 发现者 -Name[zh_TW]=Muon 探詢器 -MimeType=x-scheme-handler/appstream -Exec=muon-discover %U -Icon=muondiscover -Type=Application -X-DocPath=muon/index.html -GenericName=Software Center -GenericName[ast]=Centru de software -GenericName[bg]=Софтуерен център -GenericName[bs]=Softverski centar -GenericName[ca]=Centre de programari -GenericName[ca@valencia]=Centre de programari -GenericName[cs]=Centrum softwaru -GenericName[da]=Softwarecenter -GenericName[de]=Programmverwaltung -GenericName[el]=Κέντρο λογισμικού -GenericName[en_GB]=Software Centre -GenericName[es]=Centro de software -GenericName[et]=Tarkvarakeskus -GenericName[fi]=Sovellusvalikoima -GenericName[fr]=Logithèque -GenericName[ga]=Lárionad Bogearraí -GenericName[gl]=Centro de Software -GenericName[hu]=Szoftverközpont -GenericName[id]=Pusat Perangkat Lunak -GenericName[it]=Software Center -GenericName[kk]=Бағдарлама орталығы -GenericName[ko]=소프트웨어 센터 -GenericName[lt]=Programų centras -GenericName[mr]=सॉफ़्टवेअर केंद्र -GenericName[nb]=Programvaresenter -GenericName[nds]=Software-Zentrum -GenericName[nl]=Softwarecentrum -GenericName[nn]=Programvaresenter -GenericName[pa]=ਸਾਫਟਵੇਅਰ ਸੈਂਟਰ -GenericName[pl]=Centrum oprogramowania -GenericName[pt]=Centro de Aplicações -GenericName[pt_BR]=Central de aplicativos -GenericName[ro]=Centrul de Aplicații -GenericName[ru]=Центр программ -GenericName[sk]=Softwareové centum -GenericName[sl]=Programsko središče -GenericName[sr]=Софтверски центар -GenericName[sr@ijekavian]=Софтверски центар -GenericName[sr@ijekavianlatin]=Softverski centar -GenericName[sr@latin]=Softverski centar -GenericName[sv]=Programvarucentral -GenericName[tr]=Yazılım Merkezi -GenericName[ug]=يۇمشاق دېتال مەركىزى -GenericName[uk]=Центр програм -GenericName[x-test]=xxSoftware Centerxx -GenericName[zh_CN]=软件中心 -GenericName[zh_TW]=軟體中心 -Categories=Qt;KDE;System; -Keywords=program;software;repository;package;install;remove;update;apps;applications; -Keywords[ast]=programa;software;repositoriu;paquete;instalar;desaniciar;anovar;apps;aplicaciones; -Keywords[bg]=програма;софтуер;хранилище;пакет;инсталиране;премахване;обновяване;приложение;приложения; -Keywords[ca]=programa;programari;repositori;paquet;instal·la;suprimeix;actualitza;apps;aplicacions; -Keywords[ca@valencia]=programa;programari;repositori;paquet;instal·la;suprimeix;actualitza;apps;aplicacions; -Keywords[cs]=program;software;repozitář;balíček;instalovat;odstranit;aktualizovat;programy;aplikace; -Keywords[da]=program;software;repository;softwarekilde;pakke;installere;fjerne;apps;applikationer;opdatere; -Keywords[de]=Programm;Software;Archiv;Repository;Paket;Installieren;Entfernen;Aktualisieren;deb;Programme;Anwendungen; -Keywords[el]=πρόγραμμα;λογισμικό;αποθετήριο;πακέτο;εγκατάσταση;αφαίρεση;ενημέρωση;εφαρμογές; -Keywords[en_GB]=program;software;repository;package;install;remove;update;apps;applications; -Keywords[es]=programa;software;repositorio;paquete;instalar;eliminar;actualizar;apps;aplicaciones; -Keywords[et]=programm,rakendus,tarkvara,hoidla,pakk,pakett,paigaldamine,installimine,eemaldamine,uuendamine,rakendused,deb -Keywords[fi]=program;software;repository;package;install;remove;update;apps;applications;ohjelma;ohjelmisto;ohjelmalähde;lähteet;arkisto;paketti;asenna;poista;päivitä;sovellukset; -Keywords[fr]=programme ; logiciel ; dépôt ; archive ; paquet ; installation ; suppression ; mise à jour ; deb -Keywords[gl]=aplicativo,software,repositorio,paquete,instalar,eliminar,actualizar,deb -Keywords[hu]=program;szoftver;tároló;csomag;telepítés;eltávolítás;frissítés;appok;alkalmazások; -Keywords[id]=program;perangkat lunak;repositori;paket;pasang;buang;perbarui;apl;aplikasi; -Keywords[it]=programma;software;deposito;pacchetto;installa;rimuovi;aggiorna;app;applicazioni; -Keywords[ko]=program,software,repository,archive,package,install,remove,update,deb,프로그램,소프트웨어,저장소,리포지토리,패키지,꾸러미,설치,삭제,업데이트 -Keywords[lt]=programos;programinė įranga;saugykla;archyvas;paketas;įdiegti;pašalinti;atnaujinti; -Keywords[nb]=program;programvare;pakkebrønn;pakke;installere;fjerne;oppdatere;app;apper; -Keywords[nds]=programm;software;repository;archiev,paket;installeren;wegmaken;opfrischen;update;apps;programmen; -Keywords[nl]=programma;software;opslagruimte;pakket;installeren;verwijderen;bijwerken;apps;toepassingen;applicaties; -Keywords[nn]=program;programvare;pakkebrønn;pakke;pakkar;installera;installering;fjerna;fjerning;oppdatera;oppdatering;app;appar;applikasjonar; -Keywords[pl]=program;oprogramowanie;repozytorium;archiwum;pakiet;paczka;instaluj;zainstaluj;usuń;odinstaluj;uaktualnij;aktualizuj;programy;aplikacje;deb; -Keywords[pt]=programa;software;repositório;arquivo;pacote;instalar;remover;actualizar;deb;aplicações; -Keywords[pt_BR]=programa;software;repositório;pacote;instalar;instalação;remover;atualizar;aplicativos;apps;aplicações; -Keywords[ro]=program;software;depozit;arhivă;pachet;instalare;elimină;actualizare;aplicații; -Keywords[ru]=program;software;repository;package;install;remove;update;apps;applications;программа;приложение;репозиторий;пакет;установка;удаление;deb; -Keywords[sk]=program;softvér;repozitár;archív;balík;inštalácia;odstránenie;appky;aplikácie;aktualizácia; -Keywords[sl]=program;programska oprema;skladišče;paket;namesti;odstrani;posodobi;programi; -Keywords[sr]=program;software;repository;package;install;remove;update;apps;applications;програм;софтвер;ризница;пакет;инсталирати;уклонити;ажурирати; -Keywords[sr@ijekavian]=program;software;repository;package;install;remove;update;apps;applications;програм;софтвер;ризница;пакет;инсталирати;уклонити;ажурирати; -Keywords[sr@ijekavianlatin]=program;software;repository;package;install;remove;update;apps;applications;program;softver;riznica;paket;instalirati;ukloniti;ažurirati; -Keywords[sr@latin]=program;software;repository;package;install;remove;update;apps;applications;program;softver;riznica;paket;instalirati;ukloniti;ažurirati; -Keywords[sv]=program;programvara;arkiv;paket;installera;ta bort;uppdatera;appar;program; -Keywords[tr]=uygulama;yazılım;depo;paket;kur;kaldır;güncelle;uygulamalar;yüklemeler; -Keywords[uk]=program;software;repository;package;install;remove;update;app;apps;applications;програма;програмне забезпечення;сховище;архів;пакунок;встановити;встановлення;вилучити;вилучення;оновлення;оновити; -Keywords[x-test]=xxprogramxx;xxsoftwarexx;xxrepositoryxx;xxpackagexx;xxinstallxx;xxremovexx;xxupdatexx;xxappsxx;xxapplicationsxx; -Keywords[zh_CN]=program;software;repository;package;install;remove;update;apps;applications;程序;软件;软件源;包;安装;移除;升级;应用程序; -Keywords[zh_TW]=program;software;repository;package;install;remove;update;apps;applications; diff --git a/discover/qml/AddSourceDialog.qml b/discover/qml/AddSourceDialog.qml deleted file mode 100644 index 9cb936e..0000000 --- a/discover/qml/AddSourceDialog.qml +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (C) 2014 Aleix Pol Gonzalez <aleixpol@blue-systems.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library/Lesser General Public License - * version 2, or (at your option) any later version, as published by the - * Free Software Foundation - * - * 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 Library/Lesser 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. - */ - -import QtQuick 2.1 -import QtQuick.Controls 1.1 -import QtQuick.Dialogs 1.2 -import QtQuick.Layouts 1.1 - -Dialog { - id: newSourceDialog - title: i18n("Specify the new source for %1", source.name) - standardButtons: StandardButton.Ok | StandardButton.Close - property QtObject source - - ColumnLayout { - id: info - anchors { - left: parent.left - right: parent.right - } - - Label { - id: description - Layout.fillWidth: true - Layout.fillHeight: true - wrapMode: Text.WordWrap - textFormat: Text.PlainText - text: source.idDescription - } - - TextField { - id: repository - Layout.fillWidth: true - Keys.onEnterPressed: newSourceDialog.accept() - focus: true - } - } - onAccepted: source.addSource(repository.text) -} diff --git a/discover/qml/AddonsView.qml b/discover/qml/AddonsView.qml deleted file mode 100644 index 8e2b16a..0000000 --- a/discover/qml/AddonsView.qml +++ /dev/null @@ -1,85 +0,0 @@ -import QtQuick 2.1 -import QtQuick.Controls 1.1 -import org.kde.muon 1.0 -import org.kde.kquickcontrolsaddons 2.0 - -Column -{ - id: addonsView - property alias application: addonsModel.application - property bool isInstalling: false - property alias isEmpty: addonsModel.isEmpty - enabled: !addonsView.isInstalling - visible: !addonsView.isEmpty - - Repeater - { - model: ApplicationAddonsModel { id: addonsModel } - - delegate: Item { - height: (description.height + name.height)*1.2 - width: addonsView.width - Row { - id: componentsRow - height: parent.height - spacing: 10 - CheckBox { - enabled: !addonsView.isInstalling - anchors.verticalCenter: parent.verticalCenter - checked: model.checked - onClicked: addonsModel.changeState(display, checked) - } - QIconItem { - icon: "applications-other" - height: parent.height*0.9 - width: height - smooth: true - opacity: addonsView.isInstalling ? 0.3 : 1 - } - } - Label { - id: name - anchors { - top: parent.top - left: componentsRow.right - right: parent.right - } - elide: Text.ElideRight - text: display - } - Label { - id: description - anchors { - bottom: parent.bottom - left: componentsRow.right - right: parent.right - } - elide: Text.ElideRight - font.italic: true - text: toolTip - } - } - } - - Row { - enabled: addonsModel.hasChanges && !addonsView.isInstalling - spacing: 5 - - Button { - height: parent.enabled ? implicitHeight : 0 - visible: height!=0 - iconName: "dialog-ok" - text: i18n("Apply Changes") - onClicked: addonsModel.applyChanges() - Behavior on height { NumberAnimation { duration: 100 } } - } - Button { - height: parent.enabled ? implicitHeight : 0 - visible: height!=0 - iconName: "document-revert" - text: i18n("Discard") - onClicked: addonsModel.discardChanges() - Behavior on height { NumberAnimation { duration: 100 } } - } - } -} diff --git a/discover/qml/ApplicationDescription.qml b/discover/qml/ApplicationDescription.qml deleted file mode 100644 index 51ddbaf..0000000 --- a/discover/qml/ApplicationDescription.qml +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Copyright (C) 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library/Lesser General Public License - * version 2, or (at your option) any later version, as published by the - * Free Software Foundation - * - * 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 Library/Lesser 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. - */ - -import QtQuick 2.1 -import QtQuick.Controls 1.1 -import QtQuick.Layouts 1.1 -import org.kde.kquickcontrolsaddons 2.0 -import org.kde.muon 1.0 -import org.kde.muon.discover 1.0 as Discover -import "navigation.js" as Navigation - -Column -{ - id: desc - property QtObject application: null - property alias isInstalling: addonsView.isInstalling - - Item {width: 10; height: 5} - - Item { - anchors { - left: parent.left - right: parent.right - margins: 10 - } - height: icon.height - QIconItem { - id: icon - anchors { - top: header.top - left: parent.left - } - height: 64 - width: height - - icon: application.icon - } - - ColumnLayout { - id: header - height: parent.height - anchors { - top: parent.top - left: icon.right - right: parent.right - bottom: icon.bottom - leftMargin: 5 - bottomMargin: 5 - } - - Heading { - id: heading - text: application.name - Layout.fillWidth: true - elide: Text.ElideRight - font.bold: true - } - Label { - Layout.fillWidth: true - text: application.comment - wrapMode: Text.WordWrap - elide: Text.ElideRight - maximumLineCount: 2 -// verticalAlignment: Text.AlignVCenter - } - Rating { - rating: application.rating.rating - } - } - } - Item {width: 10; height: 20} - Heading { text: i18n("Description") } - Label { - id: info - anchors { - left: parent.left - right: parent.right - margins: 5 - } - horizontalAlignment: Text.AlignJustify - wrapMode: Text.WordWrap - text: application.longDescription - } - Item {width: 10; height: 20} - - Heading { - text: i18n("Addons") - visible: addonsView.visible - } - AddonsView { - id: addonsView - application: parent.application - width: parent.width - } - - Item {width: 10; height: 20} - Heading { - text: i18n("Comments") - visible: reviewsView.visible - } - Repeater { - id: reviewsView - visible: count>0 - - delegate: ReviewDelegate { - width: parent.width - onMarkUseful: reviewsModel.markUseful(index, useful) - } - - model: Discover.PaginateModel { - pageSize: 3 - sourceModel: ReviewsModel { - id: reviewsModel - resource: application - } - } - } - Row { - anchors.horizontalCenter: parent.horizontalCenter - spacing: 5 - property QtObject rating: desc.application.rating - - Button { - visible: reviewsView.visible - text: i18n("More comments (%1)...", parent.rating ? parent.rating.ratingCount : 0) - onClicked: Navigation.openReviews(application, reviewsModel) - } - Button { - property QtObject reviewsBackend: application.backend.reviewsBackend - visible: reviewsBackend != null && application.isInstalled - text: i18n("Review") - onClicked: reviewDialog.visible = true - - ReviewDialog { - id: reviewDialog - application: desc.application - onAccepted: application.backend.reviewsBackend.submitReview(application, summary, review, rating) - } - } - } - Item { height: 10; width: 5 } //margin by the end -} diff --git a/discover/qml/ApplicationDetails.qml b/discover/qml/ApplicationDetails.qml deleted file mode 100644 index 6abe972..0000000 --- a/discover/qml/ApplicationDetails.qml +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (C) 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library/Lesser General Public License - * version 2, or (at your option) any later version, as published by the - * Free Software Foundation - * - * 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 Library/Lesser 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. - */ - -import QtQuick 2.1 -import QtQuick.Controls 1.1 -import QtQuick.Layouts 1.1 -import QtQuick.Window 2.1 -import org.kde.muon.discover 1.0 as Discover -import org.kde.muon 1.0 - -ColumnLayout -{ - property alias isInstalling: installButton.isActive - property alias application: installButton.application - spacing: 10 - - InstallApplicationButton { - id: installButton - anchors.horizontalCenter: parent.horizontalCenter - additionalItem: Rating { - property QtObject ratingInstance: application.rating - visible: ratingInstance!=null - rating: ratingInstance==null ? 0 : ratingInstance.rating - } - } - - Grid { - Layout.fillWidth: true - columns: 2 - spacing: 0 - Label { text: i18n("Total Size: "); horizontalAlignment: Text.AlignRight; width: parent.width/2; font.weight: Font.Bold } - Label { text: application.sizeDescription; width: parent.width/2; elide: Text.ElideRight } - Label { text: i18n("Version: "); horizontalAlignment: Text.AlignRight; width: parent.width/2; font.weight: Font.Bold } - Label { text: application.packageName+" "+(application.isInstalled ? application.installedVersion : application.availableVersion); width: parent.width/2; elide: Text.ElideRight } - Label { text: i18n("Homepage: "); horizontalAlignment: Text.AlignRight; width: parent.width/2; font.weight: Font.Bold } - Label { - text: application.homepage - MouseArea { - anchors.fill: parent - onClicked: Qt.openUrlExternally(application.homepage); - } - SystemPalette { id: palette } - color: palette.highlight - font.underline: true - width: parent.width/2 - elide: Text.ElideRight - } - Label { text: i18n("License: "); horizontalAlignment: Text.AlignRight; width: parent.width/2; font.weight: Font.Bold } - Label { text: application.license; width: parent.width/2; elide: Text.ElideRight } - } - Button { - anchors.horizontalCenter: parent.horizontalCenter - visible: application.isInstalled && application.canExecute - text: i18n("Launch") - onClicked: application.invokeApplication() - } -} diff --git a/discover/qml/ApplicationIndicator.qml b/discover/qml/ApplicationIndicator.qml deleted file mode 100644 index 0d4f600..0000000 --- a/discover/qml/ApplicationIndicator.qml +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library/Lesser General Public License - * version 2, or (at your option) any later version, as published by the - * Free Software Foundation - * - * 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 Library/Lesser 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. - */ - -import QtQuick 2.1 - -Rectangle { - id: root - state: "none" - - states: [ - State { - name: "none" - PropertyChanges { target: root; color: "transparent" } - }, - State { - name: "installed" - PropertyChanges { target: root; color: "#090" } - }, - State { - name: "upgradeable" - PropertyChanges { target: root; color: "#339" } - } - ] -} diff --git a/discover/qml/ApplicationPage.qml b/discover/qml/ApplicationPage.qml deleted file mode 100644 index 5266cb1..0000000 --- a/discover/qml/ApplicationPage.qml +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (C) 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library/Lesser General Public License - * version 2, or (at your option) any later version, as published by the - * Free Software Foundation - * - * 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 Library/Lesser 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. - */ - -import QtQuick 2.1 -import QtQuick.Controls 1.1 -import QtQuick.Window 2.1 -import QtQuick.Layouts 1.1 - -Item { - id: appInfo - property QtObject application: null - clip: true - - property var icon: application.icon - property string title: application.name - - ConditionalLoader { - anchors.fill: parent - condition: app.isCompact - - componentFalse: Item { - ScrollView { - id: overviewContentsFlickable - width: 2*parent.width/3 - anchors { - top: parent.top - bottom: parent.bottom - right: parent.right - } - ApplicationDescription { - width: overviewContentsFlickable.viewport.width - application: appInfo.application - } - } - - ApplicationDetails { - anchors { - top: parent.verticalCenter - right: overviewContentsFlickable.left - left: parent.left - topMargin: 10 - margins: 5 - } - application: appInfo.application - } - - ApplicationScreenshots { - application: appInfo.application - initialGeometry: Qt.rect(5,5, overviewContentsFlickable.x-10, appInfo.height/2) - } - } - componentTrue: ScrollView { - id: scroll - ColumnLayout { - width: scroll.viewport.width - - ApplicationDetails { - Layout.fillWidth: true - application: appInfo.application - } - - Item { - Layout.fillWidth: true - Layout.minimumHeight: 100 - - ApplicationScreenshots { - application: appInfo.application - initialGeometry: Qt.rect(0, 0, parent.width, parent.height) - fullGeometry: Qt.rect(-parent.x, -parent.y, scroll.viewport.width, scroll.viewport.height) - } - } - - ApplicationDescription { - Layout.fillWidth: true - - application: appInfo.application - z: -1 - } - } - } - } -} diff --git a/discover/qml/ApplicationScreenshots.qml b/discover/qml/ApplicationScreenshots.qml deleted file mode 100644 index 407286f..0000000 --- a/discover/qml/ApplicationScreenshots.qml +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (C) 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library/Lesser General Public License - * version 2, or (at your option) any later version, as published by the - * Free Software Foundation - * - * 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 Library/Lesser 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. - */ - - -import QtQuick 2.1 -import QtQuick.Controls 1.1 -import org.kde.muon 1.0 - -Item { - id: shadow - state: "thumbnail" - property alias application: screenshotsModel.application - property rect initialGeometry: Qt.rect(5, 5, 200, 200) - property rect fullGeometry: Qt.rect(0, 0, parent.width, parent.height) - - Rectangle { - id: shadowItem - anchors.fill: parent - color: "black" - Behavior on opacity { NumberAnimation { duration: 1000 } } - } - - Image { - id: screenshot - anchors.centerIn: parent - height: sourceSize ? Math.min(parent.height-5, sourceSize.height) : parent.height - width: sourceSize ? Math.min(parent.width-5, sourceSize.width) : parent.width - - asynchronous: true - fillMode: Image.PreserveAspectFit - source: thumbnailsView.currentIndex>=0 ? screenshotsModel.screenshotAt(thumbnailsView.currentIndex) : "image://icon/image-missing" - smooth: true - visible: screenshot.status == Image.Ready - - onStatusChanged: if(status==Image.Error) { - sourceSize.width = sourceSize.height = 200 - source="image://icon/image-missing" - } - } - BusyIndicator { - id: busy - width: 128 - height: 128 - anchors.centerIn: parent - running: visible - visible: screenshot.status == Image.Loading - } - - states: [ - State { name: "thumbnail" - PropertyChanges { target: shadowItem; opacity: 0.1 } - PropertyChanges { target: shadow; width: initialGeometry.width } - PropertyChanges { target: shadow; height: initialGeometry.height } - PropertyChanges { target: shadow; x: initialGeometry.x } - PropertyChanges { target: shadow; y: initialGeometry.y } - PropertyChanges { target: thumbnailsView; opacity: 1 } - }, - State { name: "full" - PropertyChanges { target: shadowItem; opacity: 0.7 } - PropertyChanges { target: shadow; x: fullGeometry.x } - PropertyChanges { target: shadow; y: fullGeometry.y } - PropertyChanges { target: shadow; height: fullGeometry.height } - PropertyChanges { target: shadow; width: fullGeometry.width } - PropertyChanges { target: thumbnailsView; opacity: 0.3 } - } - ] - transitions: Transition { - SequentialAnimation { - PropertyAction { target: screenshot; property: "smooth"; value: false } - NumberAnimation { properties: "x,y,width,height"; easing.type: Easing.OutQuad; duration: 500 } - PropertyAction { target: screenshot; property: "smooth"; value: true } - } - } - - MouseArea { - anchors.fill: parent - onClicked: { shadow.state = shadow.state == "thumbnail" ? "full" : "thumbnail" } - } - - GridView { - id: thumbnailsView - cellHeight: 45 - cellWidth: 45 - interactive: false - visible: screenshotsModel.count>1 - - anchors { - fill: shadow - bottomMargin: 5 - } - - onCountChanged: currentIndex=0 - - model: ScreenshotsModel { - id: screenshotsModel - } - highlight: Rectangle { color: "white"; opacity: 0.5 } - - delegate: Image { - source: small_image_url - anchors.top: parent.top - height: 40; width: 40 - fillMode: Image.PreserveAspectFit - smooth: true - MouseArea { anchors.fill: parent; onClicked: thumbnailsView.currentIndex=index} - } - Behavior on opacity { NumberAnimation { easing.type: Easing.OutQuad; duration: 500 } } - } -} diff --git a/discover/qml/ApplicationsGridDelegate.qml b/discover/qml/ApplicationsGridDelegate.qml deleted file mode 100644 index 918e147..0000000 --- a/discover/qml/ApplicationsGridDelegate.qml +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright (C) 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library/Lesser General Public License - * version 2, or (at your option) any later version, as published by the - * Free Software Foundation - * - * 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 Library/Lesser 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. - */ - -import QtQuick 2.1 -import QtQuick.Layouts 1.1 -import QtQuick.Controls 1.1 -import org.kde.kquickcontrolsaddons 2.0 -import org.kde.muon.discover 1.0 -import "navigation.js" as Navigation - -GridItem { - id: delegateRoot - clip: true - property bool allInstalled: false - enabled: true - onClicked: { - Navigation.openApplication(application) - } - internalMargin: 0 - - SystemPalette { id: sys } - Rectangle { - id: artwork - gradient: Gradient { - GradientStop { position: 0.0; color: Qt.darker(colors.dominantColor) } - GradientStop { position: 0.5; color: "black" } - } - - width: parent.width - height: parent.height*0.65 - property bool hasThumbnail: model.application.thumbnailUrl!="" - - IconColors { - id: colors - iconName: model.application.icon - } - - Image { - id: screen - anchors { - verticalCenter: parent.verticalCenter - right: parent.right - rightMargin: parent.width*0.1 - } - - source: model.application.thumbnailUrl - height: parent.height*0.9 - fillMode: Image.PreserveAspectFit - smooth: false - cache: false - asynchronous: true - onStatusChanged: { - if(status==Image.Error) { - artwork.hasThumbnail=false - } - } - } - Image { - anchors { - centerIn: parent - horizontalCenterOffset: artwork.hasThumbnail ? -50 : 0 - } - - id: smallIcon - width: 64 - height: width - smooth: true - asynchronous: true - sourceSize: Qt.size(width, width) - source: model.application.icon.length==0 ? "" - : model.application.icon[0] == "/" ? "file://"+model.application.icon - : "image://icon/"+model.application.icon - } - } - RowLayout { - anchors { - topMargin: artwork.height+2 - bottomMargin: 8 - margins: 5 - fill: parent - } - - ColumnLayout { - Layout.fillWidth: true - Label { - Layout.fillWidth: true - elide: Text.ElideRight - text: name - } - Label { - Layout.fillWidth: true - elide: Text.ElideRight - text: comment - opacity: 0.6 - } - } - ConditionalLoader { - Layout.minimumWidth: parent.width/3 - Layout.fillHeight: true - - condition: delegateRoot.containsMouse - componentFalse: Rating { - rating: 5 - } - - componentTrue: InstallApplicationButton { - application: model.application - canUpgrade: false - } - } - } - - ApplicationIndicator { - id: indicator - state: canUpgrade ? "upgradeable" : (isInstalled ? "installed" : "none") - height: 5 - width: parent.width - anchors.bottom: parent.bottom - } -} diff --git a/discover/qml/ApplicationsList.qml b/discover/qml/ApplicationsList.qml deleted file mode 100644 index 923343c..0000000 --- a/discover/qml/ApplicationsList.qml +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright (C) 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library/Lesser General Public License - * version 2, or (at your option) any later version, as published by the - * Free Software Foundation - * - * 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 Library/Lesser 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. - */ - -import QtQuick 2.1 -import QtQuick.Controls 1.1 -import QtQuick.Layouts 1.1 -import org.kde.kquickcontrolsaddons 2.0 -import QtQuick.Window 2.1 -import org.kde.kcoreaddons 1.0 -import "navigation.js" as Navigation - -ScrollView { - id: parentItem - property alias count: view.count - property alias header: view.header - property alias section: view.section - property alias model: view.model - readonly property real proposedMargin: app.isCompact ? 0 : (width-app.actualWidth)/2 - - ListView - { - id: view - snapMode: ListView.SnapToItem - currentIndex: -1 - spacing: -1 //this should be the same as -GridItem.border.width - - delegate: GridItem { - id: delegateArea -// checked: view.currentIndex==index - width: Math.min(app.actualWidth, parentItem.viewport.width) - x: parentItem.proposedMargin - property real contHeight: height*0.8 - height: lowLayout.implicitHeight - internalMargin: 0 - - onClicked: { - view.currentIndex = index - Navigation.openApplication(application) - } - - RowLayout { - id: lowLayout - anchors { - leftMargin: 2 - left: parent.left - right: parent.right - } - - QIconItem { - id: resourceIcon - icon: model.icon - Layout.minimumWidth: contHeight - Layout.minimumHeight: contHeight - anchors.verticalCenter: parent.verticalCenter - } - - ColumnLayout { - Layout.fillWidth: true - Layout.fillHeight: true - - Item { height: 3; width: 3 } - - Label { - Layout.fillWidth: true - id: nameLabel - elide: Text.ElideRight - text: name - } - Label { - id: commentLabel - Layout.fillWidth: true - - elide: Text.ElideRight - text: comment - font.italic: true - opacity: delegateArea.containsMouse ? 1 : 0.5 - maximumLineCount: 1 - clip: true - } - - Item { height: 3; width: 3 } - } - - Label { - text: i18n("(%1)", ratingPoints) - } - - Rating { - id: ratingsItem - height: app.isCompact ? contHeight*.6 : contHeight*.4 - rating: model.rating - } - - - Label { - text: category[0] - } - - Item { - Layout.fillHeight: true - width: Math.max(installInfo.width, installButton.width) - - InstallApplicationButton { - id: installButton - anchors.verticalCenter: parent.verticalCenter - application: model.application - canUpgrade: false - visible: delegateArea.containsMouse - } - LabelBackground { - id: installInfo - anchors.centerIn: parent - visible: !delegateArea.containsMouse - text: Format.formatByteSize(size) - } - } - - ApplicationIndicator { - id: indicator - state: canUpgrade ? "upgradeable" : isInstalled && view.model.stateFilter!=2 ? "installed" : "none" - width: 5 - height: parent.height - anchors.right: parent.right - } - } - } - } -} diff --git a/discover/qml/ApplicationsListPage.qml b/discover/qml/ApplicationsListPage.qml deleted file mode 100644 index a8107e4..0000000 --- a/discover/qml/ApplicationsListPage.qml +++ /dev/null @@ -1,261 +0,0 @@ -/* - * Copyright (C) 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library/Lesser General Public License - * version 2, or (at your option) any later version, as published by the - * Free Software Foundation - * - * 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 Library/Lesser 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. - */ - -import QtQuick 2.1 -import QtQuick.Controls 1.1 -import QtQuick.Layouts 1.1 -import QtQuick.Window 2.2 -import "navigation.js" as Navigation -import org.kde.muon.discover 1.0 -import org.kde.muon 1.0 - -Item { - id: page - readonly property var model: appsModel - property alias category: appsModel.filteredCategory - property alias sortRole: appsModel.stringSortRole - property alias sortOrder: appsModel.sortOrder - property alias originFilter: appsModel.originFilter - property alias mimeTypeFilter: appsModel.mimeTypeFilter - property alias stateFilter: appsModel.stateFilter - property alias search: appsModel.search - property alias shouldShowTechnical: appsModel.isShowingTechnical - property string sectionProperty: "" - property Component sectionDelegate: null - property bool preferList: false - readonly property real proposedMargin: (width-app.actualWidth)/2 - property Component header: category==null ? null : categoryHeaderComponent - property Component extendedToolBar: null - property var icon: category ? category.icon : "go-home" - property string title: category ? category.name : "" - - onSearchChanged: appsModel.sortOrder = Qt.AscendingOrder - - function searchFor(text) { - appsModel.search = text - } - - ApplicationProxyModel { - id: appsModel - stringSortRole: "ratingPoints" - sortOrder: Qt.DescendingOrder - isShowingTechnical: category && category.shouldShowTechnical - - Component.onCompleted: sortModel() - } - - function changeSorting(role, sorting, section) { - appsModel.stringSortRole = role - appsModel.sortOrder=sorting - page.sectionProperty = section - page.sectionDelegate = role=="canUpgrade" ? installedSectionDelegate : defaultSectionDelegate - } - - ExclusiveGroup { id: sortActionGroup } - readonly property string currentSortAction: sortActionGroup.current.text - readonly property Menu sortMenu: Menu { - MenuItem { - text: i18n("Name") - onTriggered: page.changeSorting("name", Qt.AscendingOrder, "") - checked: appsModel.stringSortRole=="name" - checkable: true - exclusiveGroup: sortActionGroup - } - MenuItem { - text: i18n("Popularity") - onTriggered: page.changeSorting("sortableRating", Qt.DescendingOrder, "") - checked: appsModel.stringSortRole=="sortableRating" - checkable: true - exclusiveGroup: sortActionGroup - } - MenuItem { - text: i18n("Buzz") - onTriggered: page.changeSorting("ratingPoints", Qt.DescendingOrder, "") - checked: appsModel.stringSortRole=="ratingPoints" - checkable: true - exclusiveGroup: sortActionGroup - } - MenuItem { - text: i18n("Origin") - onTriggered: page.changeSorting("origin", Qt.DescendingOrder, "origin") - checked: appsModel.stringSortRole=="origin" - checkable: true - exclusiveGroup: sortActionGroup - } - MenuItem { - text: i18n("Installed") - onTriggered: page.changeSorting("canUpgrade", Qt.DescendingOrder, "canUpgrade") - checked: appsModel.stringSortRole=="canUpgrade" - checkable: true - exclusiveGroup: sortActionGroup - } - MenuItem { - text: i18n("Size") - onTriggered: page.changeSorting("size", Qt.DescendingOrder, "") - checked: appsModel.stringSortRole=="size" - checkable: true - exclusiveGroup: sortActionGroup - } - } - - property Component tools: RowLayout { - visible: page.visible - spacing: 3 - - Loader { - width: item ? item.width : 0 - sourceComponent: page.extendedToolBar - } - - ToolButton { - id: sortButton - iconName: "view-sort-ascending" - onClicked: menu.popup() - - menu: sortMenu - } - ToolButton { - id: listViewShown - iconName: "tools-wizard" - onClicked: shownMenu.popup() - - ExclusiveGroup { id: shownActionGroup } - menu: Menu { - id: shownMenu - MenuItem { - id: itemList - property string viewType: "list" - text: i18n("List") - checkable: true - checked: page.state==viewType - onTriggered: page.state=viewType - exclusiveGroup: shownActionGroup - } - MenuItem { - id: itemGrid - property string viewType: "grid2" - text: i18n("Grid") - checkable: true - checked: page.state==viewType - onTriggered: page.state=viewType - exclusiveGroup: shownActionGroup - } - MenuSeparator {} - MenuItem { - checkable: true - checked: appsModel.shouldShowTechnical - onTriggered: { - appsModel.shouldShowTechnical = !appsModel.shouldShowTechnical; - appsModel.sortModel(); - } - text: i18n("Show technical packages") - } - } - } - } - - Component { - id: categoryHeaderComponent - CategoryDisplay { - id: categoryHeader - category: page.category - width: app.actualWidth - height: implicitHeight - spacing: 10 - maxtopwidth: viewLoader.sourceComponent == listComponent ? 100 : viewLoader.item.cellWidth - x: viewLoader.sourceComponent == listComponent ? page.proposedMargin : 0 - } - } - - Loader { - id: viewLoader - anchors.fill: parent - } - - Component { - id: listComponent - ApplicationsList { - id: apps - anchors.fill: parent - section.property: page.sectionProperty - section.delegate: page.sectionDelegate - - header: page.header - model: appsModel - } - } - - Component { - id: defaultSectionDelegate - Label { - text: section - anchors { - right: parent.right - rightMargin: page.proposedMargin - } - } - } - - Component { - id: installedSectionDelegate - Label { - text: (section=="true" ? i18n("Update") : - section=="false" ? i18n("Installed") : - section) - anchors { - right: parent.right - rightMargin: page.proposedMargin - } - } - } - - Component { - id: gridComponent - ScrolledAwesomeGrid { - id: theGrid - model: appsModel - header: page.header - minCellWidth: 200 - - section: RowLayout { - Label { text: i18n("All") } - Item { Layout.fillWidth: true } - Label { text: i18n("%1 items", theGrid.count) } - } - - delegate: ApplicationsGridDelegate { - height: width/1.618 //tau - width: theGrid.cellWidth - allInstalled: appsModel.stateFilter!=2 - } - } - } - - state: preferList || app.isCompact ? "list" : "grid2" - states: [ - State { - name: "list" - PropertyChanges { target: viewLoader; sourceComponent: listComponent } - }, - State { - name: "grid2" - PropertyChanges { target: viewLoader; sourceComponent: gridComponent } - } - ] -} diff --git a/discover/qml/ApplicationsTop.qml b/discover/qml/ApplicationsTop.qml deleted file mode 100644 index 614c1d2..0000000 --- a/discover/qml/ApplicationsTop.qml +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (C) 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library/Lesser General Public License - * version 2, or (at your option) any later version, as published by the - * Free Software Foundation - * - * 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 Library/Lesser 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. - */ - -import QtQuick 2.1 -import QtQuick.Controls 1.1 -import QtQuick.Layouts 1.1 -import org.kde.muon 1.0 -import org.kde.muon.discover 1.0 -import org.kde.kquickcontrolsaddons 2.0 -import "navigation.js" as Navigation - -ColumnLayout { - id: topView - property alias sortRole: appsModel.stringSortRole - property alias filteredCategory: appsModel.filteredCategory - property Component roleDelegate: null - property string title: "" - property bool extended: false - readonly property alias titleHeight: title.height - - Label { - id: title - text: topView.title - Layout.fillWidth: true - font.weight: Font.Bold - Layout.minimumHeight: paintedHeight*1.5 - } - spacing: -1 //GridItem.border.width - Repeater { - id: rep - model: PaginateModel { - pageSize: 5 - sourceModel: ApplicationProxyModel { - id: appsModel - sortOrder: Qt.DescendingOrder -// onRowsInserted: sortModel() - } - } - delegate: GridItem { - Layout.fillWidth: true - Layout.minimumHeight: title.paintedHeight*(topView.extended ? 3.5 : 2.5) - - RowLayout { - id: layo - anchors { - fill: parent - margins: 2 - } - QIconItem { - Layout.fillHeight: true - Layout.minimumWidth: height - icon: model.icon - } - ColumnLayout { - Layout.fillHeight: true - Layout.fillWidth: true - - Label { - id: nameItem - Layout.fillWidth: true - text: name - elide: Text.ElideRight - verticalAlignment: Text.AlignVCenter - } - Label { - Layout.preferredWidth: nameItem.Layout.preferredWidth - visible: topView.extended - text: category[0] - elide: Text.ElideRight - verticalAlignment: Text.AlignVCenter - opacity: 0.6 - } - } - Loader { - Layout.fillHeight: true - Layout.minimumWidth: item.width - sourceComponent: topView.roleDelegate - onItemChanged: item.model=model - } - } - onClicked: Navigation.openApplication(application) - } - } -} diff --git a/discover/qml/AwesomeGrid.qml b/discover/qml/AwesomeGrid.qml deleted file mode 100644 index 9728bf6..0000000 --- a/discover/qml/AwesomeGrid.qml +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (C) 2012-2013 Aleix Pol Gonzalez <aleixpol@blue-systems.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library/Lesser General Public License - * version 2, or (at your option) any later version, as published by the - * Free Software Foundation - * - * 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 Library/Lesser 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. - */ - -import QtQuick 2.1 -import QtQuick.Window 2.2 - -Flickable { - readonly property int columnCount: app.isCompact ? 1 : Math.max(Math.floor(app.actualWidth/minCellWidth), 1) - readonly property real cellWidth: (app.actualWidth-(columnCount-1)*dataFlow.spacing)/columnCount - readonly property alias count: dataRepeater.count - property int minCellWidth: 130 - property alias header: headerLoader.sourceComponent - property alias footer: footerLoader.sourceComponent - property alias delegate: dataRepeater.delegate - property alias model: dataRepeater.model - property alias section: sectionLoader.sourceComponent - contentHeight: conts.height - - Column { - id: conts - width: app.actualWidth - anchors.horizontalCenter: parent.horizontalCenter - spacing: 10 - Loader { - id: headerLoader - width: parent.width - } - Loader { - id: sectionLoader - width: parent.width - } - - Flow { - id: dataFlow - width: parent.width - spacing: 10 - Repeater { - id: dataRepeater - } - } - - Loader { - id: footerLoader - width: parent.width - } - } -} diff --git a/discover/qml/Breadcrumbs.qml b/discover/qml/Breadcrumbs.qml deleted file mode 100644 index 2a96727..0000000 --- a/discover/qml/Breadcrumbs.qml +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (C) 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library/Lesser General Public License - * version 2, or (at your option) any later version, as published by the - * Free Software Foundation - * - * 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 Library/Lesser 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. - */ - -import QtQuick 2.1 -import QtQuick.Controls 1.0 -import QtQuick.Layouts 1.0 -import org.kde.kquickcontrolsaddons 2.0 - -Item { - id: bread - readonly property int count: pageStack.depth - property StackView pageStack: null - Layout.minimumHeight: theLayout.Layout.minimumHeight - Layout.preferredHeight: theLayout.Layout.preferredHeight - - RowLayout { - id: theLayout - spacing: 0 - anchors { - top: parent.top - bottom: parent.bottom - } - Repeater - { - model: bread.pageStack.depth - delegate: RowLayout { - spacing: 0 - QIconItem { - visible: index > 0 - width: 16 - height: width - icon: "arrow-right" - } - MuonToolButton { - Layout.fillHeight: true - Layout.minimumHeight: implicitHeight - - property var currentPage: bread.pageStack.get(modelData, false) - - iconName: currentPage.icon - onClicked: theLayout.doClick(index) - text: currentPage.title - enabled: bread.pageStack.depth!=(modelData+1) - checkable: checked - } - } - } - function doClick(index) { - var pos = bread.pageStack.depth - for(; pos>(index+1); --pos) { - bread.pageStack.pop(pos>index) - } - } - } -} diff --git a/discover/qml/BrowsingPage.qml b/discover/qml/BrowsingPage.qml deleted file mode 100644 index bba48f0..0000000 --- a/discover/qml/BrowsingPage.qml +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (C) 2015 Aleix Pol Gonzalez <aleixpol@blue-systems.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library/Lesser General Public License - * version 2, or (at your option) any later version, as published by the - * Free Software Foundation - * - * 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 Library/Lesser 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. - */ - -import QtQuick 2.1 -import QtQuick.Controls 1.1 -import QtQuick.Layouts 1.1 -import org.kde.muon 1.0 -import org.kde.kquickcontrolsaddons 2.0 -import "navigation.js" as Navigation - -Item { - id: top - readonly property string title: "" - readonly property string icon: "go-home" - readonly property real proposedMargin: (width-app.actualWidth)/2 - clip: true - - function searchFor(text) { - Navigation.openApplicationList("edit-find", i18n("Search..."), null, text) - } - - ScrollView { - id: view - anchors.fill: parent - - ColumnLayout - { - x: top.proposedMargin - width: Math.min(app.actualWidth, view.viewport.width) - - FeaturedBanner { - Layout.fillWidth: true - Layout.preferredHeight: 310 - } - - CategoryDisplay { - Layout.fillWidth: true - } - Item { - height: 5 - } - } - } -} diff --git a/discover/qml/CategoryDisplay.qml b/discover/qml/CategoryDisplay.qml deleted file mode 100644 index 7bfb77c..0000000 --- a/discover/qml/CategoryDisplay.qml +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Copyright (C) 2012-2015 Aleix Pol Gonzalez <aleixpol@blue-systems.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library/Lesser General Public License - * version 2, or (at your option) any later version, as published by the - * Free Software Foundation - * - * 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 Library/Lesser 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. - */ - -import QtQuick 2.1 -import QtQuick.Controls 1.1 -import QtQuick.Layouts 1.1 -import org.kde.muon 1.0 -import org.kde.kquickcontrolsaddons 2.0 -import "navigation.js" as Navigation - -ConditionalLoader -{ - id: page - property QtObject category: null - property real spacing: 3 - property real maxtopwidth: 250 - - CategoryModel { - id: categoryModel - displayedCategory: page.category - } - - condition: !app.isCompact - componentTrue: RowLayout { - id: gridRow - readonly property bool extended: !app.isCompact && view.count>5 - spacing: page.spacing - - ApplicationsTop { - id: top - Layout.fillHeight: true - Layout.fillWidth: true - sortRole: "sortableRating" - filteredCategory: categoryModel.displayedCategory - title: i18n("Most Popular") - extended: gridRow.extended - roleDelegate: Item { - width: bg.width - property variant model - LabelBackground { - id: bg - anchors.centerIn: parent - text: model.sortableRating.toFixed(2) - } - } - Layout.preferredWidth: page.maxtopwidth - } - ApplicationsTop { - id: top2 - Layout.preferredWidth: page.maxtopwidth - Layout.fillHeight: true - Layout.fillWidth: true - sortRole: "ratingPoints" - filteredCategory: categoryModel.displayedCategory - title: i18n("Best Rating") - extended: gridRow.extended - roleDelegate: Rating { - property variant model - rating: model.rating - height: 12 - } - } - - ColumnLayout { - Layout.fillWidth: true - Layout.fillHeight: true - Layout.preferredWidth: page.width/2 - Layout.maximumHeight: top.height - - spacing: -1 - - Label { - text: i18n("Categories") - Layout.fillWidth: true - font.weight: Font.Bold - Layout.minimumHeight: paintedHeight*1.5 - visible: view.count>0 - } - - CategoryView { - id: view - visible: view.count>0 - model: categoryModel - Layout.fillWidth: true - Layout.fillHeight: true - } - } - } - - componentFalse: ColumnLayout { - Layout.minimumHeight: 5000 - - ApplicationsTop { - id: top - Layout.fillHeight: true - Layout.fillWidth: true - sortRole: "sortableRating" - filteredCategory: categoryModel.displayedCategory - title: i18n("Most Popular") - roleDelegate: Item { - width: bg.width - property variant model - LabelBackground { - id: bg - anchors.centerIn: parent - text: model.sortableRating.toFixed(2) - } - } - } - Label { - text: i18n("Categories") - Layout.fillWidth: true - font.weight: Font.Bold - Layout.minimumHeight: paintedHeight*1.5 - } - - Repeater { - id: view - Layout.fillWidth: true - model: categoryModel - - delegate: GridItem { - height: 40 - Layout.fillWidth: true - RowLayout { - QIconItem { - icon: decoration - width: 32 - height: width - } - Label { - text: display - Layout.fillWidth: true - wrapMode: Text.WordWrap - - maximumLineCount: 2 - } - } - onClicked: Navigation.openCategory(category) - } - } - } -} diff --git a/discover/qml/CategoryView.qml b/discover/qml/CategoryView.qml deleted file mode 100644 index cd98af2..0000000 --- a/discover/qml/CategoryView.qml +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (C) 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library/Lesser General Public License - * version 2, or (at your option) any later version, as published by the - * Free Software Foundation - * - * 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 Library/Lesser 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. - */ - -import QtQuick 2.1 -import QtQuick.Controls 1.1 -import QtQuick.Layouts 1.1 -import org.kde.muon 1.0 -import org.kde.kquickcontrolsaddons 2.0 -import "navigation.js" as Navigation - -GridItem -{ - property alias model: grid.model - readonly property alias count: grid.count - hoverEnabled: false - - ScrollView { - anchors { - margins: -3 - fill: parent - } - - GridView { - id: grid - - cellWidth: app.isCompact ? width : width/Math.floor(width/100) - cellHeight: app.isCompact ? 35 : 60 - boundsBehavior: Flickable.StopAtBounds - header: Item { height: 10; width: 10 } - footer: header - - delegate: MouseArea { - id: categoryItem - enabled: true - - width: grid.cellWidth - height: grid.cellHeight-2 - hoverEnabled: true - - ColumnLayout { - id: layout - - anchors.top: parent.top - width: parent.width - spacing: 5 - Item { - Layout.fillWidth: true - Layout.preferredWidth: 32 - Layout.preferredHeight: Layout.preferredWidth - opacity: categoryItem.containsMouse ? 0.5 : 1 - - QIconItem { - icon: decoration - width: 32 - height: width - anchors.centerIn: parent - } - } - Label { - id: nameLabel - text: display - Layout.fillWidth: true - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - wrapMode: Text.WordWrap - - maximumLineCount: 2 - } - } - onClicked: Navigation.openCategory(category) - } - } - } -} diff --git a/discover/qml/ConditionalLoader.qml b/discover/qml/ConditionalLoader.qml deleted file mode 100644 index 5f11241..0000000 --- a/discover/qml/ConditionalLoader.qml +++ /dev/null @@ -1,32 +0,0 @@ -/*************************************************************************** - * Copyright © 2015 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -import QtQuick 2.1 - -Loader -{ - id: root - - property Component componentTrue - property Component componentFalse - property bool condition - - sourceComponent: condition ? componentTrue : componentFalse -} diff --git a/discover/qml/DefaultBanner.qml b/discover/qml/DefaultBanner.qml deleted file mode 100644 index fb2f6d7..0000000 --- a/discover/qml/DefaultBanner.qml +++ /dev/null @@ -1,33 +0,0 @@ -import QtQuick 2.1 -import QtQuick.Controls 1.1 -import org.kde.kquickcontrolsaddons 2.0 - -Rectangle -{ - color: "white" - QIconItem { - id: icon - icon: "kde" - anchors.verticalCenter: parent.verticalCenter - width: parent.width/3 - height: width - } - - Label { - text: i18n("Welcome to\nMuon Discover!") - anchors { - right: parent.right - top: parent.top - bottom: parent.bottom - left: icon.right - rightMargin: 20 - } - - font.pixelSize: 72 - minimumPixelSize: 10 - verticalAlignment: Text.AlignVCenter - - horizontalAlignment: Text.AlignHCenter - fontSizeMode: Text.Fit - } -} diff --git a/discover/qml/FeaturedBanner.qml b/discover/qml/FeaturedBanner.qml deleted file mode 100644 index d8ccb09..0000000 --- a/discover/qml/FeaturedBanner.qml +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (C) 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library/Lesser General Public License - * version 2, or (at your option) any later version, as published by the - * Free Software Foundation - * - * 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 Library/Lesser 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. - */ - -import QtQuick 2.1 -import QtQuick.Controls 1.1 -import QtQuick.Layouts 1.1 -import QtGraphicalEffects 1.0 -import org.kde.kquickcontrolsaddons 2.0 -import "navigation.js" as Navigation - -Information { - id: info - - model: FeaturedModel {} - - delegate: MouseArea { - readonly property QtObject modelData: model - readonly property real size: PathView.itemScale - enabled: modelData.package!="" - width: 400 * size - height: 250 * size - - onClicked: { - if(modelData.packageName!=null) - Navigation.openApplication(ResourcesModel.resourceByPackageName(modelData.packageName)) - else - Qt.openUrlExternally(modelData.url) - } - - z: PathView.isCurrentItem && !PathView.view.moving ? 1 : -1 - id: itemDelegate - - Loader { - id: flick - anchors.fill: parent - - function endsWith(str, suffix) { - return str.indexOf(suffix, str.length - suffix.length) !== -1; - } - - source: endsWith(modelData.image, ".qml") ? modelData.image : "qrc:/qml/FeaturedImage.qml" - } - - Rectangle { - anchors.fill: titleBar - color: palette.midlight - opacity: 0.7 - z: 20 - } - - SystemPalette { id: palette } - - RowLayout { - id: titleBar - height: description.paintedHeight*1.2 - z: 23 - spacing: 10 - property variant modelData: info.model.get(Math.min(info.currentIndex, info.model.count)) - anchors { - left: parent.left - right: parent.right - bottom: parent.bottom - } - - QIconItem { - Layout.fillHeight: true - Layout.fillWidth: true - icon: titleBar.modelData ? titleBar.modelData.icon : "kde" - } - - Label { - id: description - Layout.fillWidth: true - anchors.verticalCenter: parent.verticalCenter - - text: titleBar.modelData ? i18n("<b>%1</b><br/>%2", titleBar.modelData.text, titleBar.modelData.comment) : "" - } - } - - DropShadow { - anchors.fill: flick - horizontalOffset: 3 - verticalOffset: 3 - radius: 8.0 - samples: 16 - color: "#80000000" - source: flick - } - - Desaturate { - anchors.fill: flick - source: flick - desaturation: parent.PathView.isCurrentItem ? 0 : 0.8 - - Behavior on desaturation { - NumberAnimation { - duration: 500 - easing.type: Easing.InQuad - } - } - } - } -} diff --git a/discover/qml/FeaturedImage.qml b/discover/qml/FeaturedImage.qml deleted file mode 100644 index a7fb230..0000000 --- a/discover/qml/FeaturedImage.qml +++ /dev/null @@ -1,56 +0,0 @@ -import QtQuick 2.1 - -Flickable { - id: flick - - clip: true - contentY: 0 - interactive: false - contentWidth: Math.max(image.width, width) - contentHeight: Math.max(image.height, height) - property bool isCurrentItem: itemDelegate.PathView.isCurrentItem - - states: [ - State { - name: "shownSmall" - when: image.status==Image.Ready && image.height<(flick.height-titleBar.height) - PropertyChanges { target: flick; contentY: (flick.contentHeight+titleBar.height)/2-flick.height/2 } - }, - State { - name: "shownIdeal" - when: image.status==Image.Ready && image.height<flick.height - PropertyChanges { target: flick; contentY: image.height-height } - }, - State { - name: "shownBig" - when: flick.isCurrentItem - PropertyChanges { target: flick; contentY: (flick.contentHeight-flick.height)/2 } - }, - State { - name: "notShown" - when: !flick.isCurrentItem - PropertyChanges { target: flick; contentY: 0 } - } - ] - transitions: [ - Transition { - from: "notShown"; to: "shownBig" - NumberAnimation { - properties: "contentY" - duration: info.slideDuration - easing.type: Easing.InOutQuad - } - } - ] - - onIsCurrentItemChanged: { - if (flick.isCurrentItem && image.status==Image.Error) - info.next(); - } - - Image { - id: image - source: modelData.image - x: -(image.width-flick.width)/2 - } -} diff --git a/discover/qml/FeaturedModel.qml b/discover/qml/FeaturedModel.qml deleted file mode 100644 index c745ba2..0000000 --- a/discover/qml/FeaturedModel.qml +++ /dev/null @@ -1,77 +0,0 @@ -import QtQuick 2.1 -import org.kde.muon 1.0 - -ListModel -{ - id: model - Component.onCompleted: { - fetchSource(app.prioritaryFeaturedSource) - fetchSource(app.featuredSource) - } - - property variant fu: Connections { - target: ResourcesModel - onRowsInserted: initFeatured() - } - - function fetchSource(source) - { - if(source=="") - return - var xhr = new XMLHttpRequest; - xhr.open("GET", source); - xhr.onreadystatechange = function() { - if (xhr.readyState == XMLHttpRequest.DONE) { - try { - getFeatured(JSON.parse(xhr.responseText)) - } catch (e) { - console.log("json error", e, xhr.responseText) - } - } - } - xhr.send(); - } - - function initFeatured() { - for(var row=0; row<model.count; row++) { - var data = model.get(row) - if(data.packageName) { - var appl = ResourcesModel.resourceByPackageName(data.packageName) - if(appl==null) { -// console.log("application ", data.packageName, " not found") - continue - } - if(data.image==null) - data.image = appl.screenshotUrl - data.text = appl.name - data.icon = appl.icon - data.comment = appl.comment - } - model.set(row, data) - } - } - - function alternateIfNull(valueA, valueB) - { - return valueA!=null ? valueA : valueB; - } - - function getFeatured(data) { - if(data==null) - return - - for(var packageName in data) { - var currentData = data[packageName] - model.append({ - "text": alternateIfNull(currentData.text, currentData.package), - "color": alternateIfNull(currentData.color, "red"), - "image": currentData.image, - "icon": alternateIfNull(currentData.icon, "kde"), - "comment": alternateIfNull(currentData.comment, " "), - "packageName": currentData.package, - "url": currentData.url - }) - } - initFeatured() - } -} diff --git a/discover/qml/GridItem.qml b/discover/qml/GridItem.qml deleted file mode 100644 index 984e6e0..0000000 --- a/discover/qml/GridItem.qml +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2014 Aleix Pol Gonzalez <aleixpol@blue-systems.com> - * - * 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, 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 Library General Public License for more details - * - * You should have received a copy of the GNU Library 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. - */ - -///This is a fork of ListItem so that it can be used for GridView - -import QtQuick 2.1 - -MouseArea { - id: listItem - - default property alias content: paddingItem.data - - property int internalMargin: 5 - readonly property color highlightColor: Qt.lighter(palette.highlight) - - hoverEnabled: true - - SystemPalette { - id: palette - } - Rectangle { - anchors.fill: parent - color: listItem.containsMouse || listItem.pressed ? listItem.highlightColor : palette.button - border.color: palette.mid - border.width: 1 - } - - Item { - id: paddingItem - anchors { - fill: parent - leftMargin: listItem.internalMargin - topMargin: listItem.internalMargin - rightMargin: listItem.internalMargin - bottomMargin: listItem.internalMargin - } - } - -} diff --git a/discover/qml/Heading.qml b/discover/qml/Heading.qml deleted file mode 100644 index d396d13..0000000 --- a/discover/qml/Heading.qml +++ /dev/null @@ -1,6 +0,0 @@ -import QtQuick.Controls 1.1 -import org.kde.muon.discover 1.0 - -Label { - font.pointSize: SystemFonts.titleFont.pointSize*1.5 -} diff --git a/discover/qml/Information.qml b/discover/qml/Information.qml deleted file mode 100644 index 02165eb..0000000 --- a/discover/qml/Information.qml +++ /dev/null @@ -1,38 +0,0 @@ -import QtQuick 2.1 - -PathView { - id: viewItem - interactive: false - pathItemCount: 3 - cacheItemCount: count - highlightMoveDuration: 500 - readonly property real oriX: viewItem.width/2 - readonly property real oriY: viewItem.height/2 - property alias slideDuration: timer.interval - - path: Path { - startX: oriX; startY: oriY - PathAttribute { name: "itemScale"; value: 1. } - PathLine { x: oriX-500; y: oriY } - PathAttribute { name: "itemScale"; value: .7 } - PathPercent { value: 0.5 } - PathLine { x: oriX-800; y: oriY-1900 } - PathLine { x: oriX+800; y: oriY-1900 } - PathLine { x: oriX+500; y: oriY } - PathAttribute { name: "itemScale"; value: .7 } - PathPercent { value: 0.5 } - PathLine { x: oriX; y: oriY } - PathAttribute { name: "itemScale"; value: 1 } - PathPercent { value: 1 } - } - - function next() { incrementCurrentIndex() } - function previous() { decrementCurrentIndex() } - - onCurrentIndexChanged: timer.restart() - Timer { - id: timer - interval: 5000; running: viewItem.visible - onTriggered: viewItem.next() - } -} diff --git a/discover/qml/InstallApplicationButton.qml b/discover/qml/InstallApplicationButton.qml deleted file mode 100644 index c844168..0000000 --- a/discover/qml/InstallApplicationButton.qml +++ /dev/null @@ -1,58 +0,0 @@ -import QtQuick 2.1 -import QtQuick.Controls 1.1 -import QtQuick.Layouts 1.1 -import org.kde.muon 1.0 - -ConditionalLoader -{ - id: root - property alias application: listener.resource - readonly property alias isActive: listener.isActive - property Component additionalItem: null - property bool canUpgrade: true - - TransactionListener { - id: listener - } - - condition: listener.isActive - componentTrue: RowLayout { - Label { - Layout.fillHeight: true - Layout.fillWidth: true - text: listener.statusText - verticalAlignment: Text.AlignVCenter - } - - Button { - Layout.fillHeight: true - iconName: "dialog-cancel" - enabled: listener.isCancellable - onClicked: ResourcesModel.cancelTransaction(application) - } - } - - componentFalse: RowLayout { - Button { - enabled: !ResourcesModel.isFetching - text: !application.isInstalled ? i18n("Install") : i18n("Remove") - - onClicked: { - if(application.isInstalled) - ResourcesModel.removeApplication(application); - else - ResourcesModel.installApplication(application); - } - } - Loader { - Component { - id: updateButton - Button { - text: i18n("Update") - onClicked: ResourcesModel.installApplication(application) - } - } - sourceComponent: (root.canUpgrade && application.canUpgrade) ? updateButton : root.additionalItem - } - } -} diff --git a/discover/qml/InstalledPage.qml b/discover/qml/InstalledPage.qml deleted file mode 100644 index 6336740..0000000 --- a/discover/qml/InstalledPage.qml +++ /dev/null @@ -1,44 +0,0 @@ -import QtQuick 2.1 -import QtQuick.Controls 1.1 -import QtQuick.Layouts 1.1 -import org.kde.muon 1.0 - -ApplicationsListPage { - id: page - stateFilter: 2 - preferList: true - - Component.onCompleted: { - page.changeSorting("size", Qt.DescendingOrder, "") - } - - readonly property var icon: "applications-other" - readonly property string title: i18n("Installed") - - header: PageHeader { - width: app.actualWidth - x: page.proposedMargin - - RowLayout { - anchors.fill: parent - - LabelBackground { - text: page.model.count - } - Label { - text: i18n("items installed") - } - Item { Layout.fillWidth: true } - Label { - visible: TransactionModel.count>0 - text: i18n("%1 jobs pending...", TransactionModel.count) - } - Item { Layout.fillWidth: true } - Label { text: i18n("Sort by ") } - Button { - text: page.currentSortAction - menu: page.sortMenu - } - } - } -} diff --git a/discover/qml/LabelBackground.qml b/discover/qml/LabelBackground.qml deleted file mode 100644 index a201f01..0000000 --- a/discover/qml/LabelBackground.qml +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library/Lesser General Public License - * version 2, or (at your option) any later version, as published by the - * Free Software Foundation - * - * 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 Library/Lesser 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. - */ - -import QtQuick 2.1 -import QtQuick.Controls 1.1 -import QtQuick.Layouts 1.1 - -Rectangle -{ - property alias text: theLabel.text - color: pal.highlight - radius: 5 - width: theLabel.implicitWidth + 10 - height: theLabel.implicitHeight + 10 - - SystemPalette { - id: pal - } - - Label { - id: theLabel - anchors.centerIn: parent - color: pal.highlightedText - } -} diff --git a/discover/qml/Main.qml b/discover/qml/Main.qml deleted file mode 100644 index 0714768..0000000 --- a/discover/qml/Main.qml +++ /dev/null @@ -1,189 +0,0 @@ -/*************************************************************************** - * Copyright © 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -import QtQuick 2.1 -import QtQuick.Controls 1.1 -import QtQuick.Layouts 1.1 -import QtQuick.Window 2.1 -import org.kde.muon 1.0 -import org.kde.muon.discover 1.0 -import "navigation.js" as Navigation - -Rectangle -{ - id: window - property Component applicationListComp: Qt.createComponent("qrc:/qml/ApplicationsListPage.qml") - property Component applicationComp: Qt.createComponent("qrc:/qml/ApplicationPage.qml") - property Component categoryComp: Qt.createComponent("qrc:/qml/ApplicationsListPage.qml") - property Component reviewsComp: Qt.createComponent("qrc:/qml/ReviewsPage.qml") - - //toplevels - property Component topBrowsingComp: Qt.createComponent("qrc:/qml/BrowsingPage.qml") - property Component topInstalledComp: Qt.createComponent("qrc:/qml/InstalledPage.qml") - property Component topUpdateComp: Qt.createComponent("qrc:/qml/UpdatesPage.qml") - property Component topSourcesComp: Qt.createComponent("qrc:/qml/SourcesPage.qml") - property Component currentTopLevel: defaultStartup ? topBrowsingComp : loadingComponent - property bool defaultStartup: true - property bool navigationEnabled: true - - visible: true - - SystemPalette { id: palette } - color: palette.base - - function clearSearch() { - if (toolbar.search) - toolbar.search.text="" - } - - Component { - id: loadingComponent - Item { - Label { - text: i18n("Loading...") - font.pointSize: 52 - anchors.centerIn: parent - } - } - } - - onCurrentTopLevelChanged: { - if(currentTopLevel==null) - return - window.clearSearch() - if(currentTopLevel.status==Component.Error) { - console.log("status error: "+currentTopLevel.errorString()) - } - while(stackView.depth>1) { - var obj = stackView.pop() - if(obj) - obj.destroy(2000) - } - if(stackView.currentItem) { - stackView.currentItem.destroy(100) - } - var page; - try { - page = currentTopLevel.createObject(stackView) -// console.log("created ", currentTopLevel) - } catch (e) { - console.log("error: "+e) - console.log("comp error: "+currentTopLevel.errorString()) - } - stackView.replace(page, {}, window.status!=Component.Ready) - } - - property list<Action> awesome: [ - TopLevelPageData { - iconName: "tools-wizard" - text: i18n("Discover") - component: topBrowsingComp - objectName: "discover" - shortcut: "Alt+D" - }, - TopLevelPageData { - iconName: "applications-other" - text: TransactionModel.count == 0 ? i18n("Installed") : i18n("Installing...") - component: topInstalledComp - objectName: "installed" - shortcut: "Alt+I" - }, - TopLevelPageData { - iconName: "system-software-update" - text: ResourcesModel.updatesCount==0 ? i18n("No Updates") : i18n("Update (%1)", ResourcesModel.updatesCount) - enabled: ResourcesModel.updatesCount>0 - component: topUpdateComp - objectName: "update" - shortcut: "Alt+U" - } - ] - - Connections { - target: app - onOpenApplicationInternal: Navigation.openApplication(app) - onListMimeInternal: Navigation.openApplicationMime(mime) - onListCategoryInternal: Navigation.openCategoryByName(name) - } - - Rectangle { - gradient: Gradient { - GradientStop { position: 0.0; color: "darkGray" } - GradientStop { position: 1.0; color: "transparent" } - } - height: parent.height/5 - anchors { - topMargin: toolbar.height - top: parent.top - left: parent.left - right: parent.right - } - visible: !fu.visible - } - - ColumnLayout { - spacing: 0 - anchors.fill: parent - - MuonToolbar { - Layout.fillWidth: true - id: toolbar - } - - Item { - Layout.fillWidth: true - Layout.preferredHeight: rep.count>0 ? msgColumn.height : 0 - - ColumnLayout { - width: parent.width - id: msgColumn - - Repeater { - id: rep - model: MessageActionsModel { - filterPriority: QAction.HighPriority - } - delegate: MessageAction { - width: msgColumn.width - Layout.fillWidth: true - theAction: action - } - } - } - } - - Breadcrumbs { - id: fu - Layout.fillWidth: true - visible: count>1 - - pageStack: stackView - } - - StackView { - id: stackView - Layout.fillWidth: true - Layout.fillHeight: true - - onDepthChanged: { - window.clearSearch() - } - } - } -} diff --git a/discover/qml/MessageAction.qml b/discover/qml/MessageAction.qml deleted file mode 100644 index 7ce1dd0..0000000 --- a/discover/qml/MessageAction.qml +++ /dev/null @@ -1,58 +0,0 @@ -/*************************************************************************** - * Copyright © 2014 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -import QtQuick 2.1 -import QtQuick.Controls 1.1 -import QtQuick.Layouts 1.1 - -Rectangle { - id: msg - property QtObject theAction: null - Layout.minimumHeight: row.Layout.minimumHeight - - visible: theAction.enabled - SystemPalette { - id: palette - } - color: palette.highlight - - RowLayout { - id: row - anchors { - fill: parent - leftMargin: 5 - rightMargin: 5 - } - - Label { - Layout.fillWidth: true - text: theAction.whatsThis - color: palette.highlightedText - } - Button { - text: theAction.text - onClicked: theAction.trigger() - } - Button { - iconName: "dialog-close" - onClicked: msg.visible = false - } - } -} diff --git a/discover/qml/MuonToolButton.qml b/discover/qml/MuonToolButton.qml deleted file mode 100644 index 785f0b1..0000000 --- a/discover/qml/MuonToolButton.qml +++ /dev/null @@ -1,55 +0,0 @@ -import QtQuick 2.1 -import QtQuick.Controls 1.1 -import QtQuick.Layouts 1.1 -import org.kde.kquickcontrolsaddons 2.0 - -/** - * The reason for this shitty component is that it isn't possible to have QtQuick.Controls.ToolButton - * show both text and icon. - */ - -Item -{ - id: root - property alias text: label.text - property alias iconName: icon.icon - property alias tooltip: button.tooltip - property alias checkable: button.checkable - property alias checked: button.checked - property alias exclusiveGroup: button.exclusiveGroup - Layout.minimumWidth: layout.Layout.minimumWidth - implicitHeight: layout.Layout.preferredHeight - - clip: true - - signal clicked() - - ToolButton { - id: button - anchors.fill: parent - enabled: root.enabled - onClicked: { root.clicked() } - - RowLayout { - id: layout - anchors { - fill: parent - margins: 3 - } - - Layout.preferredHeight: 32 - QIconItem { - id: icon - Layout.alignment: Qt.AlignVCenter - anchors.verticalCenter: parent.verticalCenter - Layout.minimumWidth: layout.Layout.preferredHeight*0.8 - height: Layout.minimumWidth - } - Label { - id: label - Layout.fillWidth: true - Layout.minimumWidth: text == "" ? 0 : (10+label.implicitWidth) - } - } - } -} diff --git a/discover/qml/MuonToolbar.qml b/discover/qml/MuonToolbar.qml deleted file mode 100644 index 49a1dec..0000000 --- a/discover/qml/MuonToolbar.qml +++ /dev/null @@ -1,133 +0,0 @@ -/*************************************************************************** - * Copyright © 2015 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -import QtQuick 2.1 -import QtQuick.Controls 1.1 -import QtQuick.Layouts 1.1 - -ToolBar -{ - id: root - property Item search: app.isCompact ? compactSearch : null - Layout.preferredHeight: layout.Layout.preferredHeight - - ExclusiveGroup { - id: appTabs - } - Timer { - id: searchTimer - running: false - repeat: false - interval: 200 - onTriggered: { stackView.currentItem.searchFor(root.search.text) } - } - - ColumnLayout { - id: layout - anchors.fill: parent - spacing: 0 - - RowLayout { - spacing: 1 - anchors.fill: parent - Layout.alignment: Qt.AlignVCenter - - ToolButton { - id: backAction - objectName: "back" - visible: !app.isCompact - Layout.alignment: Qt.AlignVCenter - action: Action { - shortcut: "Alt+Up" - iconName: "go-previous" - enabled: window.navigationEnabled && stackView.depth>1 - tooltip: i18n("Back") - onTriggered: { stackView.pop() } - } - } - - Repeater { - model: window.awesome - delegate: MuonToolButton { - enabled: modelData.enabled - checkable: modelData.checkable - checked: modelData.checked - onClicked: modelData.trigger(); - iconName: modelData.iconName - text: app.isCompact ? "" : modelData.text - tooltip: i18n("%1 (%2)", modelData.text, modelData.shortcut) - exclusiveGroup: appTabs - } - } - - Item { - Layout.fillWidth: true - Layout.fillHeight: true - } - ConditionalLoader { - condition: app.isCompact - enabled: stackView.currentItem!=null && stackView.currentItem.searchFor!=null - - componentTrue: Button { - iconName: "search" - checkable: true - onCheckedChanged: { - compactSearch.visible = checked - compactSearch.focus = true - } - } - componentFalse: TextField { - id: searchWidget - Component.onCompleted: { - root.search = searchWidget - } - focus: true - - placeholderText: i18n("Search...") - onTextChanged: searchTimer.running = true - onEditingFinished: if(text == "" && backAction.enabled) { - backAction.trigger() - } - } - - } - ToolButton { - id: button - iconName: "application-menu" - tooltip: i18n("Configure and learn about Muon Discover") - onClicked: { - var pos = mapToItem(window, 0, height); - app.showMenu(pos.x, pos.y); - } - } - } - TextField { - id: compactSearch - visible: false - Layout.fillWidth: true - - placeholderText: i18n("Search...") - onTextChanged: searchTimer.running = true - onEditingFinished: if(text == "" && backAction.enabled) { - backAction.trigger() - } - } - } -} diff --git a/discover/qml/PageHeader.qml b/discover/qml/PageHeader.qml deleted file mode 100644 index cada7a8..0000000 --- a/discover/qml/PageHeader.qml +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (C) 2015 Aleix Pol Gonzalez <aleixpol@blue-systems.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library/Lesser General Public License - * version 2, or (at your option) any later version, as published by the - * Free Software Foundation - * - * 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 Library/Lesser 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. - */ - -import QtQuick 2.0 - -Item { - id: root - property real internalMargin: 5 - default property alias content: paddingItem.data - height: 50 + item.anchors.topMargin - - GridItem - { - id: item - anchors { - fill: parent - topMargin: 20 - } - hoverEnabled: false - - Item { - id: paddingItem - anchors { - fill: parent - margins: root.internalMargin - topMargin: 0 - bottomMargin: 0 - } - } - } -} diff --git a/discover/qml/PresentUpdatesPage.qml b/discover/qml/PresentUpdatesPage.qml deleted file mode 100644 index 98627ac..0000000 --- a/discover/qml/PresentUpdatesPage.qml +++ /dev/null @@ -1,141 +0,0 @@ -import QtQuick.Controls 1.4 -import QtQuick.Layouts 1.1 -import QtQuick 2.1 -import org.kde.muon 1.0 -import "navigation.js" as Navigation -import org.kde.kquickcontrolsaddons 2.0 - -ScrollView -{ - id: page - property real proposedMargin: 0 - - function start() { - resourcesUpdatesModel.prepare() - resourcesUpdatesModel.updateAll() - } - - ColumnLayout - { - x: proposedMargin - width: Math.min(app.actualWidth, page.viewport.width) - - PageHeader { - Layout.fillWidth: true - - ConditionalLoader { - anchors.fill: parent - - condition: resourcesUpdatesModel.isProgressing - componentFalse: RowLayout { - LabelBackground { - text: updateModel.toUpdateCount - } - Label { - text: i18n("updates selected") - } - LabelBackground { - id: unselectedItem - readonly property int unselected: (updateModel.totalUpdatesCount - updateModel.toUpdateCount) - text: unselected - visible: unselected>0 - } - Label { - text: i18n("updates not selected") - visible: unselectedItem.visible - } - Item { Layout.fillWidth: true} - Button { - id: startButton - text: i18n("Update") - onClicked: page.start() - } - } - componentTrue: ColumnLayout { - Label { - Layout.fillWidth: true - horizontalAlignment: Text.AlignHCenter - text: resourcesUpdatesModel.remainingTime - } - ProgressBar { - id: pbar - anchors.centerIn: parent - minimumValue: 0 - maximumValue: 100 - - // Workaround for bug in Qt - // https://bugreports.qt.io/browse/QTBUG-48598 - Connections { - target: resourcesUpdatesModel - onProgressChanged: pbar.value = resourcesUpdatesModel.progress - } - } - } - } - } - - Repeater { - id: rep - model: updateModel - - delegate: ColumnLayout { - id: col - spacing: -1 - readonly property var currentRow: index - RowLayout { - Layout.minimumHeight: 32 - Layout.leftMargin: 5 //GridItem.internalMargin - Layout.rightMargin: 5 //GridItem.internalMargin - anchors.margins: 100 - Label { - Layout.fillWidth: true - text: display - } - LabelBackground { - text: size - Layout.minimumWidth: 90 - } - } - Repeater { - model: ColumnProxyModel { - rootIndex: updateModel.index(col.currentRow, 0) - } - delegate: GridItem { - Layout.fillWidth: true - height: 32 - RowLayout { - enabled: !resourcesUpdatesModel.isProgressing - anchors.fill: parent - CheckBox { - anchors.verticalCenter: parent.verticalCenter - checked: model.checked - onClicked: model.checked = !model.checked - } - - QIconItem { - Layout.fillHeight: true - anchors.verticalCenter: parent.verticalCenter - width: 30 - icon: decoration - } - - Label { - id: label - Layout.fillWidth: true - text: i18n("%1 (%2)", display, version) - elide: Text.ElideRight - } - - LabelBackground { - Layout.minimumWidth: 90 - text: size - } - } - - onClicked: Navigation.openApplication(resource) - } - } - } - } - } -} diff --git a/discover/qml/ProgressView.qml b/discover/qml/ProgressView.qml deleted file mode 100644 index 57a0d1d..0000000 --- a/discover/qml/ProgressView.qml +++ /dev/null @@ -1,135 +0,0 @@ -import QtQuick 2.1 -import QtQuick.Controls 1.1 -import QtQuick.Layouts 1.1 -import org.kde.kquickcontrolsaddons 2.0 -import org.kde.muon 1.0 -import "navigation.js" as Navigation - -Item { - id: page - property bool active: enabled && progressModel.count>0 - Layout.minimumHeight: active ? contents.height : 0 - Layout.maximumHeight: Layout.minimumHeight - - Behavior on Layout.maximumHeight { - NumberAnimation { duration: 250; easing.type: Easing.InOutQuad } - } - - Connections { - target: TransactionModel - onTransactionAdded: { - if(page.enabled && progressModel.appAt(trans.resource)<0) - progressModel.append({'app': trans.resource}) - } - - onTransactionCancelled: { - var id = progressModel.appAt(trans.resource) - if(id>=0) - progressModel.remove(id) - } - } - - ListModel { - id: progressModel - function appAt(app) { - for(var i=0; i<progressModel.count; i++) { - if(progressModel.get(i).app==app) { - return i - } - } - return -1 - } - } - - ListView { - id: contents - anchors { - left: parent.left - right: closeButton.left - top: parent.top - margins: 3 - } - - spacing: 3 - height: 30 - orientation: ListView.Horizontal - - model: progressModel - - delegate: Button { - width: launcherRow.implicitWidth+launcherRow.anchors.margins*2 - height: contents.height - - onClicked: Navigation.openApplication(model.app) - TransactionListener { - id: listener - resource: model.app - onCancelled: model.remove(index) - } - - Behavior on width { NumberAnimation { duration: 250 } } - - RowLayout { - id: launcherRow - anchors { - fill: parent - margins: 5 - } - spacing: 2 - QIconItem { - anchors.verticalCenter: parent.verticalCenter - icon: model.app.icon - Layout.preferredHeight: parent.height*0.5 - width: height - } - Label { - anchors.verticalCenter: parent.verticalCenter - Layout.fillWidth: true - elide: Text.ElideRight - text: model.app.name + (listener.isActive ? " "+listener.statusText : "") - } - ToolButton { - anchors.verticalCenter: parent.verticalCenter - iconName: "dialog-cancel" - visible: listener.isCancellable - onClicked: ResourcesModel.cancelTransaction(app) - } - ToolButton { - anchors.verticalCenter: parent.verticalCenter - iconName: "system-run" - visible: model.app.isInstalled && !listener.isActive && model.app.canExecute - onClicked: { - model.app.invokeApplication() - model.remove(index) - } - } - } - Rectangle { - anchors { - bottom: parent.bottom - left: parent.left - bottomMargin: 3 - leftMargin: 3 - rightMargin: 3 - } - width: (parent.width - anchors.leftMargin - anchors.rightMargin)*(listener.progress/100) - SystemPalette { id: palette } - color: palette.buttonText - height: 1 - opacity: 0.5 - visible: listener.isActive - } - } - } - ToolButton { - id: closeButton - visible: parent.active //otherwise it shows. even if parent.height==0, parent.visible is true - anchors { - verticalCenter: parent.verticalCenter - right: parent.right - } - enabled: parent.active - iconName: "window-close" - onClicked: progressModel.clear() - } -} diff --git a/discover/qml/Rating.qml b/discover/qml/Rating.qml deleted file mode 100644 index 4ecf68c..0000000 --- a/discover/qml/Rating.qml +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (C) 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library/Lesser General Public License - * version 2, or (at your option) any later version, as published by the - * Free Software Foundation - * - * 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 Library/Lesser 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. - */ - -import QtQuick 2.1 -import org.kde.kquickcontrolsaddons 2.0 - -Item { - id: view - property bool editable: false - property int max: 10 - property real rating: 2 - property real starSize: Math.min(view.height, (view.width-theRepeater.model*theRow.spacing)/theRepeater.model) - visible: rating>=0 - clip: true - height: (width/5)-theRow.spacing - width: 20*5 - - Row { - id: theRow - height: parent.height - anchors.right: parent.right - - Component { - id: del - QIconItem { - anchors.verticalCenter: parent.verticalCenter - height: view.starSize - width: view.starSize - icon: "rating" - opacity: (mouse.containsMouse ? 0.7 - : (view.max/theRepeater.count*index)>view.rating ? 0.2 - : 1) - - MouseArea { - id: mouse - enabled: editable - hoverEnabled: editable - - anchors.fill: parent - onClicked: rating = (max/theRepeater.model*index) - - } - } - } - - Repeater { - id: theRepeater - model: 5 - delegate: del - } - } -} diff --git a/discover/qml/ReviewDelegate.qml b/discover/qml/ReviewDelegate.qml deleted file mode 100644 index d796451..0000000 --- a/discover/qml/ReviewDelegate.qml +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (C) 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library/Lesser General Public License - * version 2, or (at your option) any later version, as published by the - * Free Software Foundation - * - * 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 Library/Lesser 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. - */ - -import QtQuick 2.1 -import QtQuick.Controls 1.1 -import org.kde.muon 1.0 - -Item -{ - id: item - visible: model.shouldShow - height: content.height+10 - - signal markUseful(bool useful) - - function usefulnessToString(favorable, total) - { - return total==0 - ? i18n("<em>Tell us about this review!</em>") - : i18n("<em>%1 out of %2 people found this review useful</em>", favorable, total) - } - MouseArea { - id: delegateArea - hoverEnabled: true - width: parent.width - height: content.height - - Label { - anchors { - left: parent.left - right: rating.left - } - - id: content - text: i18n("<p style='margin: 0 0 0 0'><b>%1</b> by %2</p><p style='margin: 0 0 0 0'>%3</p><p style='margin: 0 0 0 0'>%4</p>", summary, reviewer, - display, usefulnessToString(usefulnessFavorable, usefulnessTotal)) - wrapMode: Text.WordWrap - } - - Label { - anchors { - right: parent.right - bottom: parent.bottom - bottomMargin: -5 - } - opacity: delegateArea.containsMouse ? 1 : 0.2 - - text: { - switch(usefulChoice) { - case ReviewsModel.Yes: - i18n("<em>Useful? <a href='true'><b>Yes</b></a>/<a href='false'>No</a></em>") - break; - case ReviewsModel.No: - i18n("<em>Useful? <a href='true'>Yes</a>/<a href='false'><b>No</b></a></em>") - break; - default: - i18n("<em>Useful? <a href='true'>Yes</a>/<a href='false'>No</a></em>") - break; - } - } - onLinkActivated: item.markUseful(link=='true') - } - - Rating { - id: rating - anchors.top: parent.top - anchors.right: parent.right - rating: model.rating - height: content.font.pixelSize - } - } -} diff --git a/discover/qml/ReviewDialog.qml b/discover/qml/ReviewDialog.qml deleted file mode 100644 index 91e995e..0000000 --- a/discover/qml/ReviewDialog.qml +++ /dev/null @@ -1,43 +0,0 @@ -import QtQuick 2.3 -import QtQuick.Controls 1.2 -import QtQuick.Dialogs 1.2 -import QtQuick.Layouts 1.1 -import QtQuick.Window 2.0 - -Dialog -{ - id: reviewDialog - - property QtObject application - property alias rating: ratingInput.rating - property alias summary: summaryInput.text - property alias review: reviewInput.text - title: i18n("Reviewing %1", application.name) - modality: Qt.WindowModal - width: 500 - - ColumnLayout { - width: parent.width - - Label { text: i18n("Rating:") } - Rating { - id: ratingInput - editable: true - } - - Label { text: i18n("Summary:") } - TextField { - id: summaryInput - Layout.fillWidth: true - placeholderText: i18n("Short summary...") - } - - TextArea { - id: reviewInput - Layout.fillWidth: true - Layout.fillHeight: true - } - } - - standardButtons: StandardButton.Ok | StandardButton.Close -} diff --git a/discover/qml/ReviewsPage.qml b/discover/qml/ReviewsPage.qml deleted file mode 100644 index 5982246..0000000 --- a/discover/qml/ReviewsPage.qml +++ /dev/null @@ -1,45 +0,0 @@ -/*************************************************************************** - * Copyright © 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -import QtQuick 2.1 -import QtQuick.Controls 1.1 -import org.kde.muon 1.0 - -ScrollView { - id: page - property alias model: reviewsView.model - readonly property real proposedMargin: (width-app.actualWidth)/2 - property var icon - property string title - - ListView { - id: reviewsView - - clip: true - visible: count>0 - spacing: 5 - - delegate: ReviewDelegate { - x: page.proposedMargin - width: page.actualWidth - onMarkUseful: page.model.markUseful(index, useful) - } - } -} diff --git a/discover/qml/ScrolledAwesomeGrid.qml b/discover/qml/ScrolledAwesomeGrid.qml deleted file mode 100644 index 7db90dc..0000000 --- a/discover/qml/ScrolledAwesomeGrid.qml +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (C) 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library/Lesser General Public License - * version 2, or (at your option) any later version, as published by the - * Free Software Foundation - * - * 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 Library/Lesser 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. - */ - -import QtQuick 2.1 -import QtQuick.Controls 1.1 - -ScrollView { - property alias count: gridRepeater.count - property alias header: gridRepeater.header - property alias footer: gridRepeater.footer - property alias delegate: gridRepeater.delegate - property alias model: gridRepeater.model - property alias cellWidth: gridRepeater.cellWidth - property alias minCellWidth: gridRepeater.minCellWidth - property alias columnCount: gridRepeater.columnCount - property alias section: gridRepeater.section - - AwesomeGrid { - id: gridRepeater - } -} diff --git a/discover/qml/SourcesPage.qml b/discover/qml/SourcesPage.qml deleted file mode 100644 index 87d8587..0000000 --- a/discover/qml/SourcesPage.qml +++ /dev/null @@ -1,135 +0,0 @@ -import QtQuick 2.1 -import QtQuick.Controls 1.1 -import QtQuick.Layouts 1.1 -import org.kde.muon 1.0 -import org.kde.kquickcontrolsaddons 2.0 -import "navigation.js" as Navigation - -Item { - id: page - clip: true - readonly property real proposedMargin: (width-app.actualWidth)/2 - readonly property string title: i18n("Sources") - readonly property string icon: "view-filter" - - Menu { - id: sourcesMenu - } - - ScrollView { - id: view - anchors.fill: parent - ListView { - width: parent.width - - model: SourcesModel - - header: PageHeader { - x: page.proposedMargin - width: Math.min(app.actualWidth, view.viewport.width) - - RowLayout { - anchors.verticalCenter: parent.verticalCenter - ToolButton { - iconName: "list-add" - text: i18n("Add Source") - - tooltip: text - menu: sourcesMenu - } - Repeater { - model: SourcesModel.actions - - delegate: RowLayout{ - QIconItem { - icon: modelData.icon - } - ToolButton { - height: parent.height - action: Action { - property QtObject action: modelData - text: action.text - onTriggered: action.trigger() - enabled: action.enabled - } - } - } - } - } - } - - delegate: ColumnLayout { - id: sourceDelegate - x: page.proposedMargin - width: Math.min(app.actualWidth, view.viewport.width) - spacing: -1 - - property QtObject sourceBackend: model.sourceBackend - AddSourceDialog { - id: addSourceDialog - source: sourceDelegate.sourceBackend - } - - MenuItem { - id: menuItem - text: model.display - onTriggered: { - try { - addSourceDialog.open() - addSourceDialog.visible = true - } catch (e) { - console.log("error loading dialog:", e) - } - } - } - - Component.onCompleted: { - sourcesMenu.insertItem(0, menuItem) - } - - Label { text: sourceBackend.name } - Repeater { - model: sourceBackend.sources - - delegate: GridItem { - Layout.fillWidth: true - height: browseOrigin.implicitHeight*1.4 - enabled: browseOrigin.enabled - onClicked: Navigation.openApplicationListSource(model.display) - - RowLayout { - Layout.alignment: Qt.AlignVCenter - anchors.fill: parent - - CheckBox { - id: enabledBox - enabled: false //TODO: implement the application of this change - checked: model.checked != Qt.Unchecked - } - Label { - Layout.fillWidth: true - elide: Text.ElideRight - text: model.display - } - Label { - text: model.toolTip - } - Button { - id: browseOrigin - enabled: display!="" - iconName: "view-filter" - tooltip: i18n("Browse the origin's resources") - onClicked: Navigation.openApplicationListSource(model.display) - } - Button { - iconName: "edit-delete" - onClicked: sourceDelegate.sourceBackend.removeSource(model.display) - tooltip: i18n("Delete the origin") - } - } - } - } - } - } - } -} diff --git a/discover/qml/TopLevelPageData.qml b/discover/qml/TopLevelPageData.qml deleted file mode 100644 index 61b61ea..0000000 --- a/discover/qml/TopLevelPageData.qml +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library/Lesser General Public License - * version 2, or (at your option) any later version, as published by the - * Free Software Foundation - * - * 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 Library/Lesser 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. - */ - -import QtQuick 2.1 -import QtQuick.Controls 1.2 -import "navigation.js" as Navigation - -Action { - property string overlay - property Component component - checkable: true - checked: window.currentTopLevel==component - enabled: window.navigationEnabled - - onTriggered: { - if(window.currentTopLevel!=component) - window.currentTopLevel=component - } -} diff --git a/discover/qml/UpdatesPage.qml b/discover/qml/UpdatesPage.qml deleted file mode 100644 index d5e61ff..0000000 --- a/discover/qml/UpdatesPage.qml +++ /dev/null @@ -1,107 +0,0 @@ -import QtQuick 2.0 -import QtQuick.Layouts 1.2 -import QtQuick.Controls 1.2 -import org.kde.muon 1.0 -import org.kde.kquickcontrolsaddons 2.0 -import org.kde.kcoreaddons 1.0 - -ConditionalLoader -{ - id: page - - readonly property var icon: "system-software-update" - readonly property string title: i18n("System Update") - readonly property real proposedMargin: (width-app.actualWidth)/2 - - ResourcesUpdatesModel { - id: resourcesUpdatesModel - - onFinished: page.Stack.view.pop() - } - - UpdateModel { - id: updateModel - backend: resourcesUpdatesModel - } - - condition: updateModel.hasUpdates || resourcesUpdatesModel.isProgressing - componentTrue: PresentUpdatesPage { - proposedMargin: page.proposedMargin - } - - componentFalse: Item { - ColumnLayout { - width: app.actualWidth - anchors.centerIn: parent - BusyIndicator { - id: busy - visible: false - enabled: visible - anchors.horizontalCenter: parent.horizontalCenter - width: icon.width - height: icon.height - } - QIconItem { - anchors.horizontalCenter: parent.horizontalCenter - - id: icon - width: 128 - height: 128 - } - Label { - id: title - Layout.fillWidth: true - horizontalAlignment: Text.AlignHCenter - font.pointSize: description.font.pointSize*1.5 - } - Label { - id: description - Layout.fillWidth: true - horizontalAlignment: Text.AlignHCenter - } - } - - readonly property var secSinceUpdate: resourcesUpdatesModel.secsToLastUpdate - - state: ( ResourcesModel.isFetching ? "fetching" - : secSinceUpdate < 0 ? "unknown" - : secSinceUpdate < 1000 * 60 * 60 * 24 ? "uptodate" - : secSinceUpdate < 1000 * 60 * 60 * 24 * 7 ? "medium" - : "low" - ) - - states: [ - State { - name: "fetching" - PropertyChanges { target: icon; visible: false } - PropertyChanges { target: busy; visible: true } - PropertyChanges { target: title; text: i18nc("@info", "Loading...") } - PropertyChanges { target: description; text: "" } - }, - State { - name: "uptodate" - PropertyChanges { target: icon; icon: "security-high" } - PropertyChanges { target: title; text: i18nc("@info", "The software on this computer is up to date.") } - PropertyChanges { target: description; text: i18nc("@info", "Last checked %1 ago.", Format.formatDecimalDuration(secSinceUpdate*1000, 0)) } - }, - State { - name: "medium" - PropertyChanges { target: icon; icon: "security-medium" } - PropertyChanges { target: title; text: i18nc("@info", "No updates are available.") } - PropertyChanges { target: description; text: i18nc("@info", "Last checked %1 ago.", Format.formatDecimalDuration(secSinceUpdate*1000, 0)) } - }, - State { - name: "low" - PropertyChanges { target: icon; icon: "security-low" } - PropertyChanges { target: title; text: i18nc("@info", "The last check for updates was over a week ago.") } - PropertyChanges { target: description; text: i18nc("@info", "Last checked %1 ago.", Format.formatDecimalDuration(secSinceUpdate*1000, 0)) } - }, - State { - name: "unknown" - PropertyChanges { target: icon; icon: "security-low" } - PropertyChanges { target: title; text: i18nc("@info", "It is unknown when the last check for updates was.") } - PropertyChanges { target: description; text: i18nc("@info", "Please click <em>Check for Updates</em> to check.") } - } - ] - } -} diff --git a/discover/qml/navigation.js b/discover/qml/navigation.js deleted file mode 100644 index 72191d9..0000000 --- a/discover/qml/navigation.js +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (C) 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library/Lesser General Public License - * version 2, or (at your option) any later version, as published by the - * Free Software Foundation - * - * 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 Library/Lesser 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. - */ - -function openApplicationList(cat, search) { - openPage(applicationListComp, { category: cat, search: search, preferList: search!="" }) -} - -function openApplicationListSource(origin) { - openPage(applicationListComp, { originFilter: origin, preferList: true, title: origin, icon: "view-filter" }) -} - -function openApplicationMime(mime) { - openPage(applicationListComp, { mimeTypeFilter: mime , icon: "document-open-data", title: i18n("Resources for '%1'", mime) }) -} - -function openCategoryByName(catname) { - currentTopLevel = topBrowsingComp - openCategory(stackView.currentItem.categories.findCategoryByName(catname)) -} - -function openCategory(cat) { - if(cat.hasSubCategories) - openPage(categoryComp, { category: cat }) - else - openApplicationList(cat, "") -} - -function openApplication(app) { - openPage(applicationComp, { application: app }) -} - -function openReviews(app, reviews) { - openPage(reviewsComp, { model: reviews, title: i18n("Ratings for %1", app.name), icon: "rating" }) -} - -function openPage(component, props) { - var obj - try { - obj = component.createObject(stackView.currentItem, props) - stackView.push(obj); - if (!obj) - console.log("error opening", name, obj, component.errorString()) - } catch (e) { - console.log("error: "+e) - console.log("comp error: "+component.errorString()) - } - return obj -} diff --git a/discover/resources.qrc b/discover/resources.qrc deleted file mode 100644 index 93c3cb8..0000000 --- a/discover/resources.qrc +++ /dev/null @@ -1,48 +0,0 @@ -<!DOCTYPE RCC><RCC version="1.0"> - <qresource> - <file>qml/Main.qml</file> - <file>qml/TopLevelPageData.qml</file> - <file>qml/CategoryView.qml</file> - <file>qml/CategoryDisplay.qml</file> - <file>qml/ApplicationsTop.qml</file> - <file>qml/FeaturedBanner.qml</file> - <file>qml/ApplicationsListPage.qml</file> - <file>qml/ApplicationPage.qml</file> - <file>qml/ReviewsPage.qml</file> - <file>qml/AddonsView.qml</file> - <file>qml/ApplicationsList.qml</file> - <file>qml/ApplicationsGridDelegate.qml</file> - <file>qml/Breadcrumbs.qml</file> - <file>qml/InstallApplicationButton.qml</file> - <file>qml/Rating.qml</file> - <file>qml/UpdatesPage.qml</file> - <file>qml/ReviewDialog.qml</file> - <file>qml/ProgressView.qml</file> - <file>qml/BrowsingPage.qml</file> - <file>qml/InstalledPage.qml</file> - <file>qml/PresentUpdatesPage.qml</file> - <file>qml/Information.qml</file> - <file>qml/SourcesPage.qml</file> - <file>qml/FeaturedModel.qml</file> - <file>qml/DefaultBanner.qml</file> - <file>qml/FeaturedImage.qml</file> - <file>qml/GridItem.qml</file> - <file>qml/AwesomeGrid.qml</file> - <file>qml/ReviewDelegate.qml</file> - <file>qml/ScrolledAwesomeGrid.qml</file> - <file>qml/ApplicationDescription.qml</file> - <file>qml/Heading.qml</file> - <file>qml/AddSourceDialog.qml</file> - <file>qml/MessageAction.qml</file> - <file>qml/ConditionalLoader.qml</file> - <file>qml/MuonToolbar.qml</file> - <file>qml/MuonToolButton.qml</file> - <file>qml/ApplicationDetails.qml</file> - <file>qml/ApplicationScreenshots.qml</file> - <file>qml/ApplicationIndicator.qml</file> - <file>qml/LabelBackground.qml</file> - <file>qml/PageHeader.qml</file> - - <file>qml/navigation.js</file> - </qresource> -</RCC> diff --git a/exporter/CMakeLists.txt b/exporter/CMakeLists.txt deleted file mode 100644 index 663d31e..0000000 --- a/exporter/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}) - -add_executable(muon-exporter main.cpp MuonExporter.cpp) - -target_link_libraries(muon-exporter MuonCommon KF5::CoreAddons KF5::I18n) - -if(MUON_INSTALL_EXPORTER) - install(TARGETS muon-exporter ${INSTALL_TARGETS_DEFAULT_ARGS}) -endif() diff --git a/exporter/MuonExporter.cpp b/exporter/MuonExporter.cpp deleted file mode 100644 index ef9eaf2..0000000 --- a/exporter/MuonExporter.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (C) 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library/Lesser General Public License - * version 2, or (at your option) any later version, as published by the - * Free Software Foundation - * - * 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 Library/Lesser 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 "MuonExporter.h" -#include <resources/AbstractResourcesBackend.h> -#include <resources/ResourcesModel.h> -#include <resources/AbstractResource.h> -#include <QFile> -#include <QDebug> -#include <QTimer> -#include <QMetaProperty> -#include <qjsondocument.h> - -MuonExporter::MuonExporter() - : QObject(nullptr) -{ - m_startExportingTimer = new QTimer(this); - m_startExportingTimer->setInterval(200); - m_startExportingTimer->setSingleShot(true); - connect(m_startExportingTimer, SIGNAL(timeout()), SLOT(exportModel())); - - m_exculdedProperties += "executables"; - m_exculdedProperties += "canExecute"; - connect(ResourcesModel::global(), SIGNAL(allInitialized()), SLOT(allBackendsInitialized())); -} - -MuonExporter::~MuonExporter() -{} - -void MuonExporter::allBackendsInitialized() -{ - m_startExportingTimer->start(); - connect(ResourcesModel::global(), SIGNAL(rowsInserted(QModelIndex,int,int)), m_startExportingTimer, SLOT(start())); -} - -void MuonExporter::setExportPath(const QUrl& url) -{ - m_path = url; -} - -QVariantMap itemDataToMap(const AbstractResource* res, const QSet<QString>& excluded) -{ - QVariantMap ret; - int propsCount = res->metaObject()->propertyCount(); - for(int i = 0; i<propsCount; i++) { - QMetaProperty prop = res->metaObject()->property(i); - if(prop.type() == QVariant::UserType || excluded.contains(prop.name())) - continue; - QVariant val = res->property(prop.name()); - - if(val.isNull()) - continue; - - ret.insert(prop.name(), val); - } - return ret; -} - -void MuonExporter::exportModel() -{ - QVariantList data; - ResourcesModel* m = ResourcesModel::global(); - - for(int i = 0; i<m->rowCount(); i++) { - QModelIndex idx = m->index(i, 0); - AbstractResource* res = qobject_cast<AbstractResource*>(m->data(idx, ResourcesModel::ApplicationRole).value<QObject*>()); - Q_ASSERT(res); - data += itemDataToMap(res, m_exculdedProperties); - } - - QJsonDocument doc = QJsonDocument::fromVariant(data); - if(doc.isNull()) { - qWarning() << "Could not completely export the data to " << m_path; - return; - } - - QFile f(m_path.toLocalFile()); - if(f.open(QIODevice::WriteOnly|QIODevice::Text)) { - int w = f.write(doc.toJson(QJsonDocument::Indented)); - if(w<=0) - qWarning() << "Could not completely export the data to " << m_path; - } else { - qWarning() << "Could not write to " << m_path; - } - qDebug() << "exported items: " << data.count() << " to " << m_path; - emit exportDone(); -} diff --git a/exporter/MuonExporter.h b/exporter/MuonExporter.h deleted file mode 100644 index e67351d..0000000 --- a/exporter/MuonExporter.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (C) 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library/Lesser General Public License - * version 2, or (at your option) any later version, as published by the - * Free Software Foundation - * - * 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 Library/Lesser 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 MUONEXPORTER_H -#define MUONEXPORTER_H - -#include <QUrl> -#include <QSet> -#include <QTimer> - -class MuonExporter : public QObject -{ - Q_OBJECT - public: - explicit MuonExporter(); - ~MuonExporter(); - - void setExportPath(const QUrl& url); - - public slots: - void exportModel(); - void allBackendsInitialized(); - - signals: - void exportDone(); - - private: - QUrl m_path; - QTimer* m_startExportingTimer; - QSet<QString> m_exculdedProperties; -}; - -#endif // MUONEXPORTER_H diff --git a/exporter/main.cpp b/exporter/main.cpp deleted file mode 100644 index e4f772b..0000000 --- a/exporter/main.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (C) 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library/Lesser General Public License - * version 2, or (at your option) any later version, as published by the - * Free Software Foundation - * - * 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 Library/Lesser 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 <QApplication> -#include <QCommandLineParser> -#include <klocalizedstring.h> -#include <KAboutData> -#include <QIcon> -#include "MuonExporter.h" -#include <MuonBackendsFactory.h> -#include "MuonVersion.h" - -static const char description[] = I18N_NOOP("An application exporterer"); - -int main(int argc, char** argv) -{ - QApplication app(argc, argv); - KLocalizedString::setApplicationDomain("muon-exporter"); - KAboutData about("muonexporter", i18n("Muon Exporter"), version, i18n(description), - KAboutLicense::GPL, i18n("©2013 Aleix Pol Gonzalez"), QString(), nullptr); - about.addAuthor(i18n("Jonathan Thomas"), QString(), "echidnaman@kubuntu.org"); - about.addAuthor(i18n("Aleix Pol Gonzalez"), QString(), "aleixpol@blue-systems.com"); - about.setProductName("muon/exporter"); - - MuonExporter exp; - { - QCommandLineParser parser; - parser.addOption(QCommandLineOption("backends", i18n("List all the backends we'll want to have loaded, separated by coma ','."), "names")); - parser.addPositionalArgument("file", i18n("File to which we'll export")); - MuonBackendsFactory::setupCommandLine(&parser); - about.setupCommandLine(&parser); - parser.addHelpOption(); - parser.addVersionOption(); - parser.process(app); - about.processCommandLine(&parser); - MuonBackendsFactory::processCommandLine(&parser); - - if(parser.positionalArguments().count() != 1) { - parser.showHelp(1); - } - exp.setExportPath(QUrl::fromUserInput(parser.positionalArguments().first(), QString(), QUrl::AssumeLocalFile)); - } - - QObject::connect(&exp, SIGNAL(exportDone()), &app, SLOT(quit())); - - return app.exec(); -} diff --git a/libmuon/ApplicationAddonsModel.cpp b/libmuon/ApplicationAddonsModel.cpp deleted file mode 100644 index bb1f8ce..0000000 --- a/libmuon/ApplicationAddonsModel.cpp +++ /dev/null @@ -1,150 +0,0 @@ -/*************************************************************************** - * Copyright © 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "ApplicationAddonsModel.h" -#include <resources/ResourcesModel.h> -#include <resources/PackageState.h> -#include <resources/AbstractResource.h> -#include <Transaction/TransactionModel.h> -#include <QDebug> - -ApplicationAddonsModel::ApplicationAddonsModel(QObject* parent) - : QAbstractListModel(parent) - , m_app(nullptr) -{ -// new ModelTest(this, this); - - connect(TransactionModel::global(), &TransactionModel::transactionRemoved, this, &ApplicationAddonsModel::transactionOver); -} - -QHash< int, QByteArray > ApplicationAddonsModel::roleNames() const -{ - QHash<int, QByteArray> roles = QAbstractItemModel::roleNames(); - roles.insert(Qt::CheckStateRole, "checked"); - return roles; -} - -void ApplicationAddonsModel::setApplication(AbstractResource* app) -{ - if (app == m_app) - return; - - if (m_app) - disconnect(m_app, nullptr, this, nullptr); - - m_app = app; - resetState(); - emit applicationChanged(); -} - -void ApplicationAddonsModel::resetState() -{ - Q_ASSERT(m_app); - beginResetModel(); - m_state.clear(); - m_initial = m_app->addonsInformation(); - endResetModel(); - - emit stateChanged(); -} - -AbstractResource* ApplicationAddonsModel::application() const -{ - return m_app; -} - -int ApplicationAddonsModel::rowCount(const QModelIndex& parent) const -{ - return parent.isValid()? 0 : m_initial.size(); -} - -QVariant ApplicationAddonsModel::data(const QModelIndex& index, int role) const -{ - if(!index.isValid() || index.row()>=m_initial.size()) - return QVariant(); - - switch(role) { - case Qt::DisplayRole: - return m_initial[index.row()].name(); - case Qt::ToolTipRole: - return m_initial[index.row()].description(); - case Qt::CheckStateRole: { - PackageState init = m_initial[index.row()]; - AddonList::State state = m_state.addonState(init.name()); - if(state == AddonList::None) { - return init.isInstalled(); - } else { - return state == AddonList::ToInstall ? Qt::Checked : Qt::Unchecked; - } - } - } - - return QVariant(); -} - -void ApplicationAddonsModel::discardChanges() -{ - //dataChanged should suffice, but it doesn't - beginResetModel(); - m_state.clear(); - emit stateChanged(); - endResetModel(); -} - -void ApplicationAddonsModel::applyChanges() -{ - ResourcesModel::global()->installApplication(m_app, m_state); -} - -void ApplicationAddonsModel::changeState(const QString& packageName, bool installed) -{ - auto it = m_initial.constBegin(); - for(; it != m_initial.constEnd(); ++it) { - if(it->name()==packageName) - break; - } - - bool restored = it->isInstalled()==installed; - - if(restored) - m_state.resetAddon(packageName); - else - m_state.addAddon(packageName, installed); - - emit stateChanged(); -} - -bool ApplicationAddonsModel::hasChanges() const -{ - return !m_state.isEmpty(); -} - -bool ApplicationAddonsModel::isEmpty() const -{ - return m_initial.isEmpty(); -} - -void ApplicationAddonsModel::transactionOver(Transaction* t) -{ - if (t->resource() != m_app) - return; - - resetState(); -} diff --git a/libmuon/ApplicationAddonsModel.h b/libmuon/ApplicationAddonsModel.h deleted file mode 100644 index 132a1ae..0000000 --- a/libmuon/ApplicationAddonsModel.h +++ /dev/null @@ -1,69 +0,0 @@ -/*************************************************************************** - * Copyright © 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef APPLICATIONADDONSMODEL_H -#define APPLICATIONADDONSMODEL_H - -#include <QAbstractListModel> -#include <resources/PackageState.h> -#include "Transaction/AddonList.h" - -#include "libMuonCommon_export.h" - -class Transaction; -class AbstractResource; - -class MUONCOMMON_EXPORT ApplicationAddonsModel : public QAbstractListModel -{ - Q_OBJECT - Q_PROPERTY(AbstractResource* application READ application WRITE setApplication NOTIFY applicationChanged) - Q_PROPERTY(bool hasChanges READ hasChanges NOTIFY stateChanged) - Q_PROPERTY(bool isEmpty READ isEmpty NOTIFY applicationChanged) - public: - explicit ApplicationAddonsModel(QObject* parent = nullptr); - - AbstractResource* application() const; - void setApplication(AbstractResource* app); - bool hasChanges() const; - - virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; - virtual int rowCount(const QModelIndex& parent = QModelIndex()) const override; - virtual QHash<int, QByteArray> roleNames() const override; - bool isEmpty() const; - - public slots: - void discardChanges(); - void applyChanges(); - void changeState(const QString& packageName, bool installed); - - signals: - void stateChanged(); - void applicationChanged(); - - private: - void transactionOver(Transaction* t); - void resetState(); - - AbstractResource* m_app; - QList<PackageState> m_initial; - AddonList m_state; -}; - -#endif // APPLICATIONADDONSMODEL_H diff --git a/libmuon/CMakeLists.txt b/libmuon/CMakeLists.txt deleted file mode 100644 index dcfb533..0000000 --- a/libmuon/CMakeLists.txt +++ /dev/null @@ -1,61 +0,0 @@ -add_definitions(-DTRANSLATION_DOMAIN=\"libmuon\") - -add_subdirectory(backends) -add_subdirectory(declarative) -add_subdirectory(notifiers) - -set(muon_LIB_SRCS - Category/Category.cpp - Category/CategoryModel.cpp - Category/CategoriesReader.cpp - ReviewsBackend/AbstractReviewsBackend.cpp - ReviewsBackend/Rating.cpp - ReviewsBackend/Review.cpp - ReviewsBackend/AbstractLoginBackend.cpp - ReviewsBackend/ReviewsModel.cpp - Transaction/AddonList.cpp - Transaction/Transaction.cpp - Transaction/TransactionListener.cpp - Transaction/TransactionModel.cpp - UpdateModel/UpdateItem.cpp - UpdateModel/UpdateModel.cpp - resources/ResourcesModel.cpp - resources/ResourcesProxyModel.cpp - resources/PackageState.cpp - resources/ResourcesUpdatesModel.cpp - resources/StandardBackendUpdater.cpp - resources/SourcesModel.cpp - resources/AbstractResourcesBackend.cpp - resources/AbstractResource.cpp - resources/AbstractBackendUpdater.cpp - resources/AbstractSourcesBackend.cpp - resources/UIHelper.cpp - MessageActionsModel - MuonBackendsFactory.cpp - ScreenshotsModel.cpp - ApplicationAddonsModel.cpp -) - -kconfig_add_kcfg_files(muon_LIB_SRCS GENERATE_MOC MuonDataSources.kcfgc) -add_library(MuonCommon ${muon_LIB_SRCS}) - -target_link_libraries(MuonCommon -LINK_PUBLIC - Qt5::Core - Qt5::Widgets - KF5::I18n -LINK_PRIVATE - Qt5::Xml - KF5::Notifications - KF5::XmlGui - KF5::ItemViews - KF5::KIOWidgets - KF5::IconThemes -) - -generate_export_header(MuonCommon EXPORT_FILE_NAME libMuonCommon_export.h) - -target_include_directories(MuonCommon PRIVATE ${PHONON_INCLUDES} PUBLIC ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) - -install(TARGETS MuonCommon ${INSTALL_TARGETS_DEFAULT_ARGS}) -install(FILES resources/muonabstractnotifier.notifyrc DESTINATION ${KNOTIFYRC_INSTALL_DIR}) diff --git a/libmuon/Category/CategoriesReader.cpp b/libmuon/Category/CategoriesReader.cpp deleted file mode 100644 index 566c258..0000000 --- a/libmuon/Category/CategoriesReader.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/*************************************************************************** - * Copyright © 2013 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "CategoriesReader.h" -#include "Category.h" -#include <QDomNode> -#include <QFile> -#include <QDebug> -#include <qstandardpaths.h> - -#include <MuonBackendsFactory.h> -#include <resources/AbstractResourcesBackend.h> - -QList<Category*> CategoriesReader::loadCategoriesFile(const QString& name) -{ - QList<Category *> ret; - QString path = QStandardPaths::locate(QStandardPaths::GenericDataLocation, "libmuon/categories/"+name+"-categories.xml"); - if (path.isEmpty()) { - qWarning() << "Couldn't find a category for " << name; - return ret; - } - - QFile menuFile(path); - if (!menuFile.open(QIODevice::ReadOnly)) { - // Broken install or broken FS - return ret; - } - - QDomDocument menuDocument; - QString error; - int line; - bool correct = menuDocument.setContent(&menuFile, &error, &line); - if(!correct) - qWarning() << "error while parsing the categories file:" << error << " at: " << path << ':' << line; - - QDomElement root = menuDocument.documentElement(); - - QDomNode node = root.firstChild(); - while(!node.isNull()) - { - ret << new Category( {name} ); - ret.last()->parseData(path, node, true); - - node = node.nextSibling(); - } - return ret; -} - -static bool categoryLessThan(Category *c1, const Category *c2) -{ - return (QString::localeAwareCompare(c1->name(), c2->name()) < 0); -} - -QList<Category*> CategoriesReader::populateCategories() -{ - MuonBackendsFactory f; - QStringList backendNames = f.allBackendNames(); - - QList<Category*> ret; - Q_FOREACH (const QString& name, backendNames) { - QList<Category*> cats = loadCategoriesFile(name); - - if(ret.isEmpty()) { - ret += cats; - } else { - Q_FOREACH (Category* c, cats) - Category::addSubcategory(ret, c); - } - } - qSort(ret.begin(), ret.end(), categoryLessThan); - return ret; -} diff --git a/libmuon/Category/CategoriesReader.h b/libmuon/Category/CategoriesReader.h deleted file mode 100644 index 168ab20..0000000 --- a/libmuon/Category/CategoriesReader.h +++ /dev/null @@ -1,35 +0,0 @@ -/*************************************************************************** - * Copyright © 2013 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef CATEGORIESREADER_H -#define CATEGORIESREADER_H -#include <QList> - -class Category; -class CategoriesReader -{ - public: - QList<Category*> populateCategories(); - - private: - QList<Category*> loadCategoriesFile(const QString& path); -}; - -#endif // CATEGORIESREADER_H diff --git a/libmuon/Category/Category.cpp b/libmuon/Category/Category.cpp deleted file mode 100644 index 3cc4865..0000000 --- a/libmuon/Category/Category.cpp +++ /dev/null @@ -1,198 +0,0 @@ -/*************************************************************************** - * Copyright © 2010 Jonathan Thomas <echidnaman@kubuntu.org> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "Category.h" - -#include <QtXml/QDomNode> - -#include <klocalizedstring.h> -#include <QFile> -#include <QDebug> - -Category::Category(QSet<QString> pluginName, QObject* parent) - : QObject(parent) - , m_iconString("applications-other") - , m_showTechnical(false) - , m_plugins(std::move(pluginName)) -{} - -Category::~Category() -{} - -void Category::parseData(const QString& path, const QDomNode& data, bool canHaveChildren) -{ - if(!canHaveChildren) { - m_name = i18nc("@label The label used for viewing all members of this category", "All"); - } - - for(QDomNode node = data.firstChild(); !node.isNull(); node = node.nextSibling()) - { - if(!node.isElement()) { - if(!node.isComment()) - qWarning() << "unknown node found at " << QStringLiteral("%1:%2").arg(path).arg(node.lineNumber()); - continue; - } - QDomElement tempElement = node.toElement(); - - if (canHaveChildren) { - if (tempElement.tagName() == QLatin1String("Name")) { - m_name = i18nc("Category", tempElement.text().toUtf8()); - } else if (tempElement.tagName() == QLatin1String("Menu")) { - m_subCategories << new Category(m_plugins, this); - m_subCategories.last()->parseData(path, node, true); - } - } - - if (tempElement.tagName() == QLatin1String("Icon") && tempElement.hasChildNodes()) { - m_iconString = tempElement.text(); - } else if (tempElement.tagName() == QLatin1String("ShowTechnical")) { - m_showTechnical = true; - } else if (tempElement.tagName() == QLatin1String("Include")) { - parseIncludes(tempElement); - } - } - - if (!m_subCategories.isEmpty()) { - m_subCategories << new Category(m_plugins, this); - m_subCategories.last()->parseData(path, data, false); - } -} - -QList<QPair<FilterType, QString> > Category::parseIncludes(const QDomNode &data) -{ - QDomNode node = data.firstChild(); - QList<QPair<FilterType, QString> > filter; - while(!node.isNull()) - { - QDomElement tempElement = node.toElement(); - - if (tempElement.tagName() == QLatin1String("And")) { - // Parse children - m_andFilters.append(parseIncludes(node)); - } else if (tempElement.tagName() == QLatin1String("Or")) { - m_orFilters.append(parseIncludes(node)); - } else if (tempElement.tagName() == QLatin1String("Not")) { - m_notFilters.append(parseIncludes(node)); - } else if (tempElement.tagName() == QLatin1String("PkgSection")) { - QPair<FilterType, QString> pkgSectionFilter; - pkgSectionFilter.first = PkgSectionFilter; - pkgSectionFilter.second = tempElement.text(); - filter.append(pkgSectionFilter); - } else if (tempElement.tagName() == QLatin1String("Category")) { - QPair<FilterType, QString> categoryFilter; - categoryFilter.first = CategoryFilter; - categoryFilter.second = tempElement.text(); - filter.append(categoryFilter); - } else if (tempElement.tagName() == QLatin1String("PkgWildcard")) { - QPair<FilterType, QString> wildcardFilter; - wildcardFilter.first = PkgWildcardFilter; - wildcardFilter.second = tempElement.text(); - filter.append(wildcardFilter); - } else if (tempElement.tagName() == QLatin1String("PkgName")) { - QPair<FilterType, QString> nameFilter; - nameFilter.first = PkgNameFilter; - nameFilter.second = tempElement.text(); - filter.append(nameFilter); - } - node = node.nextSibling(); - } - - return filter; -} - -QString Category::name() const -{ - return m_name; -} - -QString Category::icon() const -{ - return m_iconString; -} - -QList<QPair<FilterType, QString> > Category::andFilters() const -{ - return m_andFilters; -} - -QList<QPair<FilterType, QString> > Category::orFilters() const -{ - return m_orFilters; -} - -QList<QPair<FilterType, QString> > Category::notFilters() const -{ - return m_notFilters; -} - -bool Category::hasSubCategories() const -{ - return !m_subCategories.isEmpty(); -} - -bool Category::shouldShowTechnical() const -{ - return m_showTechnical; -} - -QList<Category *> Category::subCategories() const -{ - return m_subCategories; -} - -//TODO: maybe it would be interesting to apply some rules to a said backend... -void Category::addSubcategory(QList< Category* >& list, Category* newcat) -{ - Q_FOREACH (Category* c, list) { - if(c->name() == newcat->name()) { - if(c->icon() != newcat->icon() - || c->shouldShowTechnical() != newcat->shouldShowTechnical() - || c->m_andFilters != newcat->andFilters()) - { - qWarning() << "the following categories seem to be the same but they're not entirely" - << c->name() << newcat->name(); - break; - } else { - c->m_orFilters += newcat->orFilters(); - c->m_notFilters += newcat->notFilters(); - c->m_plugins.unite(newcat->m_plugins); - Q_FOREACH (Category* nc, newcat->subCategories()) - addSubcategory(c->m_subCategories, nc); - delete newcat; - return; - } - } - } - list << newcat; -} - -bool Category::blacklistPlugins(const QSet<QString>& pluginNames) -{ - for(QList<Category*>::iterator it = m_subCategories.begin(), itEnd = m_subCategories.end(); it!=itEnd; ) { - if ((*it)->blacklistPlugins(pluginNames)) { - delete *it; - it = m_subCategories.erase(it); - } else - ++it; - } - m_plugins.subtract(pluginNames); - - return m_plugins.isEmpty(); -} diff --git a/libmuon/Category/Category.h b/libmuon/Category/Category.h deleted file mode 100644 index e85e43f..0000000 --- a/libmuon/Category/Category.h +++ /dev/null @@ -1,78 +0,0 @@ -/*************************************************************************** - * Copyright © 2010 Jonathan Thomas <echidnaman@kubuntu.org> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef CATEGORY_H -#define CATEGORY_H - -#include <QtCore/QList> -#include <QtCore/QPair> -#include <QtCore/QObject> -#include <QtCore/QSet> - -#include "libMuonCommon_export.h" - -class QDomNode; - -enum FilterType { - InvalidFilter, - CategoryFilter, - PkgSectionFilter, - PkgWildcardFilter, - PkgNameFilter -}; - -class MUONCOMMON_EXPORT Category : public QObject -{ -Q_OBJECT -public: - Q_PROPERTY(QString name READ name CONSTANT) - Q_PROPERTY(QString icon READ icon CONSTANT) - Q_PROPERTY(bool hasSubCategories READ hasSubCategories CONSTANT) - Q_PROPERTY(bool shouldShowTechnical READ shouldShowTechnical CONSTANT) - explicit Category(QSet<QString> pluginNames, QObject* parent = nullptr); - ~Category(); - - QString name() const; - QString icon() const; - QList<QPair<FilterType, QString> > andFilters() const; - QList<QPair<FilterType, QString> > orFilters() const; - QList<QPair<FilterType, QString> > notFilters() const; - bool hasSubCategories() const; - bool shouldShowTechnical() const; - QList<Category *> subCategories() const; - - static void addSubcategory(QList<Category*>& list, Category* cat); - void parseData(const QString& path, const QDomNode& data, bool canHaveChildren); - bool blacklistPlugins(const QSet<QString>& pluginName); - -private: - QString m_name; - QString m_iconString; - QList<QPair<FilterType, QString> > m_andFilters; - QList<QPair<FilterType, QString> > m_orFilters; - QList<QPair<FilterType, QString> > m_notFilters; - bool m_showTechnical; - QList<Category *> m_subCategories; - - QList<QPair<FilterType, QString> > parseIncludes(const QDomNode &data); - QSet<QString> m_plugins; -}; - -#endif diff --git a/libmuon/Category/CategoryModel.cpp b/libmuon/Category/CategoryModel.cpp deleted file mode 100644 index ea3f6fe..0000000 --- a/libmuon/Category/CategoryModel.cpp +++ /dev/null @@ -1,131 +0,0 @@ -/*************************************************************************** - * Copyright © 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -// Own includes -#include "CategoryModel.h" -#include "Category.h" -#include "CategoriesReader.h" - -// KDE includes -#include <KCategorizedSortFilterProxyModel> - -Q_GLOBAL_STATIC_WITH_ARGS(QList<Category*>, s_categories, (CategoriesReader().populateCategories())) - -CategoryModel::CategoryModel(QObject* parent) - : QStandardItemModel(parent) - , m_currentCategory(nullptr) -{ -} - -QHash< int, QByteArray > CategoryModel::roleNames() const -{ - QHash< int, QByteArray > names = QAbstractItemModel::roleNames(); - names[CategoryRole] = "category"; - return names; -} - -void CategoryModel::setCategories(const QList<Category *> &categoryList, const QString &rootName) -{ - clear(); - - invisibleRootItem()->removeRows(0, invisibleRootItem()->rowCount()); - foreach (Category *category, categoryList) { - QStandardItem *categoryItem = new QStandardItem; - categoryItem->setText(category->name()); - categoryItem->setIcon(QIcon::fromTheme(category->icon())); - categoryItem->setEditable(false); - categoryItem->setData(rootName, KCategorizedSortFilterProxyModel::CategoryDisplayRole); - categoryItem->setData(qVariantFromValue<QObject*>(category), CategoryRole); - connect(category, &QObject::destroyed, this, &CategoryModel::categoryDeleted); - - appendRow(categoryItem); - } -} - -void CategoryModel::categoryDeleted(QObject* cat) -{ - for(int i=0; i<rowCount(); ++i) { - if (cat == item(i)->data(CategoryRole).value<QObject*>()) { - removeRow(i); - } - } -} - -Category* CategoryModel::categoryForRow(int row) -{ - return qobject_cast<Category*>(item(row)->data(CategoryRole).value<QObject*>()); -} - -void CategoryModel::setDisplayedCategory(Category* c) -{ - if (m_currentCategory == c && (c || rowCount()>0)) - return; - - m_currentCategory = c; - if(c) - setCategories(c->subCategories(), c->name()); - else - setCategories(*s_categories, QString()); - - categoryChanged(c); -} - -Category* CategoryModel::displayedCategory() const -{ - return m_currentCategory; -} - -static Category* recFindCategory(Category* root, const QString& name) -{ - if(root->name()==name) - return root; - else if(root->hasSubCategories()) { - const QList<Category*> subs = root->subCategories(); - Q_FOREACH (Category* c, subs) { - Category* ret = recFindCategory(c, name); - if(ret) - return ret; - } - } - return nullptr; -} - -Category* CategoryModel::findCategoryByName(const QString& name) -{ - const QList<Category*> cats = *s_categories; - Q_FOREACH (Category* cat, cats) { - Category* ret = recFindCategory(cat, name); - if(ret) - return ret; - } - return nullptr; -} - -void CategoryModel::blacklistPlugin(const QString& name) -{ - const QSet<QString> plugins = {name}; - for(QList<Category*>::iterator it = s_categories->begin(), itEnd = s_categories->end(); it!=itEnd; ) { - if ((*it)->blacklistPlugins(plugins)) { - delete *it; - it = s_categories->erase(it); - } else - ++it; - } -} diff --git a/libmuon/Category/CategoryModel.h b/libmuon/Category/CategoryModel.h deleted file mode 100644 index 3adb6e5..0000000 --- a/libmuon/Category/CategoryModel.h +++ /dev/null @@ -1,70 +0,0 @@ -/*************************************************************************** - * Copyright © 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef CATEGORYMODEL_H -#define CATEGORYMODEL_H - -#include <QStandardItemModel> - -#include "libMuonCommon_export.h" - -class Category; - -class MUONCOMMON_EXPORT CategoryModel : public QStandardItemModel -{ - Q_OBJECT - Q_PROPERTY(Category* displayedCategory READ displayedCategory WRITE setDisplayedCategory NOTIFY categoryChanged) - public: - enum CategoryModelRole { - CategoryRole = Qt::UserRole + 1 - }; - - enum CatViewType { - /// An invalid type - InvalidType = 0, - /// An AppView since there are no sub-cats - CategoryType = 1, - /// A SubCategoryView - SubCatType = 2 - }; - Q_ENUMS(CatViewType); - - explicit CategoryModel(QObject* parent = nullptr); - - Category* categoryForRow(int row); - - void setDisplayedCategory(Category* c); - Category* displayedCategory() const; - virtual QHash< int, QByteArray > roleNames() const override; - - Q_SCRIPTABLE static Category* findCategoryByName(const QString& name); - static void blacklistPlugin(const QString& name); - - Q_SIGNALS: - void categoryChanged(Category* displayedCategory); - - private: - void categoryDeleted(QObject* cat); - void setCategories(const QList<Category *> &categoryList, const QString &rootName); - - Category* m_currentCategory; -}; - -#endif // CATEGORYMODEL_H diff --git a/libmuon/MessageActionsModel.cpp b/libmuon/MessageActionsModel.cpp deleted file mode 100644 index 9e5b748..0000000 --- a/libmuon/MessageActionsModel.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/*************************************************************************** - * Copyright © 2014 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "MessageActionsModel.h" -#include "resources/ResourcesModel.h" -#include <QAction> - -MessageActionsModel::MessageActionsModel(QObject* parent) - : QAbstractListModel(parent) - , m_actions(ResourcesModel::global()->messageActions()) - , m_priority(-1) -{ - connect(ResourcesModel::global(), &ResourcesModel::backendsChanged, this, &MessageActionsModel::reload); -} - -QHash< int, QByteArray > MessageActionsModel::roleNames() const -{ - return { { Qt::UserRole, "action" }}; -} - -QVariant MessageActionsModel::data(const QModelIndex& index, int role) const -{ - if(!index.isValid() || role!=Qt::UserRole) - return QVariant(); - return QVariant::fromValue<QObject*>(m_actions[index.row()]); -} - -int MessageActionsModel::rowCount(const QModelIndex& parent) const -{ - return parent.isValid() ? 0 : m_actions.count(); -} - - -#include <QDebug> - -void MessageActionsModel::reload() -{ - beginResetModel(); - m_actions = ResourcesModel::global()->messageActions(); - if (m_priority>=0) { - for(auto it=m_actions.begin(); it!=m_actions.end(); ) { - if ((*it)->priority() == m_priority) { - ++it; - } else - it = m_actions.erase(it); - } - } - endResetModel(); -} - -int MessageActionsModel::filterPriority() const -{ - return m_priority; -} - -void MessageActionsModel::setFilterPriority(int p) -{ - m_priority = p; - reload(); -} diff --git a/libmuon/MessageActionsModel.h b/libmuon/MessageActionsModel.h deleted file mode 100644 index 7a1c6d4..0000000 --- a/libmuon/MessageActionsModel.h +++ /dev/null @@ -1,50 +0,0 @@ -/*************************************************************************** - * Copyright © 2014 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef MESSAGEACTIONSMODEL_H -#define MESSAGEACTIONSMODEL_H - -#include <QAbstractListModel> -#include "libMuonCommon_export.h" - -class QAction; - -class MUONCOMMON_EXPORT MessageActionsModel : public QAbstractListModel -{ - Q_OBJECT - Q_PROPERTY(int filterPriority READ filterPriority WRITE setFilterPriority) - public: - MessageActionsModel(QObject* parent = nullptr); - - virtual QHash<int, QByteArray> roleNames() const override; - virtual QVariant data(const QModelIndex& index, int role) const override; - virtual int rowCount(const QModelIndex& parent = QModelIndex()) const override; - - void setFilterPriority(int p); - int filterPriority() const; - - private: - void reload(); - - QList<QAction*> m_actions; - int m_priority; -}; - -#endif diff --git a/libmuon/MuonBackendsFactory.cpp b/libmuon/MuonBackendsFactory.cpp deleted file mode 100644 index 4fae941..0000000 --- a/libmuon/MuonBackendsFactory.cpp +++ /dev/null @@ -1,131 +0,0 @@ -/*************************************************************************** - * Copyright © 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "MuonBackendsFactory.h" -#include "resources/AbstractResourcesBackend.h" -#include "resources/ResourcesModel.h" -#include <QPluginLoader> -#include <QDebug> -#include <QStandardPaths> -#include <QDir> -#include <QCommandLineParser> -#include <KSharedConfig> -#include <KConfigGroup> -#include <KDesktopFile> -#include <KLocalizedString> - -Q_GLOBAL_STATIC(QStringList, s_requestedBackends) - -MuonBackendsFactory::MuonBackendsFactory() -{} - -AbstractResourcesBackend* MuonBackendsFactory::backend(const QString& name) const -{ - if (QDir::isAbsolutePath(name) && QStandardPaths::isTestModeEnabled()) { - QString path = name; - return backendForFile(path, QFileInfo(name).fileName()); - } else { - QString path = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("libmuon/backends/%1.desktop").arg(name)); - return backendForFile(path, name); - } -} - -AbstractResourcesBackend* MuonBackendsFactory::backendForFile(const QString& path, const QString& name) const -{ - Q_ASSERT(!path.isEmpty()); - KDesktopFile cfg(path); - KConfigGroup group = cfg.group("Desktop Entry"); - QString libname = group.readEntry("X-KDE-Library", QString()); - QPluginLoader* loader = new QPluginLoader("muon/"+libname, ResourcesModel::global()); - - // qDebug() << "trying to load plugin:" << loader->fileName(); - AbstractResourcesBackendFactory* f = qobject_cast<AbstractResourcesBackendFactory*>(loader->instance()); - if(!f) { - qWarning() << "error loading" << path << loader->errorString() << loader->metaData(); - return nullptr; - } - AbstractResourcesBackend* instance = f->newInstance(ResourcesModel::global()); - if(!instance) { - qWarning() << "Couldn't find the backend: " << path << "among" << allBackendNames(false) << "because" << loader->errorString(); - } - instance->setName(name); - instance->setMetaData(path); - - return instance; -} - -QStringList MuonBackendsFactory::allBackendNames(bool whitelist) const -{ - if (whitelist) { - QStringList whitelist = *s_requestedBackends; - if (!whitelist.isEmpty()) - return whitelist; - } - - QStringList ret; - QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("libmuon/backends/"), QStandardPaths::LocateDirectory); - foreach (const QString& dir, dirs) { - QDir d(dir); - foreach(const QFileInfo& file, d.entryInfoList(QDir::Files)) { - if (file.baseName()!="muon-dummy-backend") { - ret.append(file.baseName()); - } - } - } - - return ret; -} - -QList<AbstractResourcesBackend*> MuonBackendsFactory::allBackends() const -{ - QList<AbstractResourcesBackend*> ret; - QStringList names = allBackendNames(); - foreach(const QString& name, names) - ret += backend(name); - - ret.removeAll(nullptr); - - if(ret.isEmpty()) - qWarning() << "Didn't find any muon backend!"; - return ret; -} - -int MuonBackendsFactory::backendsCount() const -{ - return allBackendNames().count(); -} - -void MuonBackendsFactory::setupCommandLine(QCommandLineParser* parser) -{ - parser->addOption(QCommandLineOption("listbackends", i18n("List all the available backends."))); - parser->addOption(QCommandLineOption("backends", i18n("List all the backends we'll want to have loaded, separated by coma ','."), "names")); -} - -void MuonBackendsFactory::processCommandLine(QCommandLineParser* parser) -{ - *s_requestedBackends = parser->value("backends").split(',', QString::SkipEmptyParts); - if(parser->isSet("listbackends")) { - fprintf(stdout, "%s", qPrintable(i18n("Available backends:\n"))); - MuonBackendsFactory f; - foreach(const QString& name, f.allBackendNames(false)) - fprintf(stdout, " * %s\n", qPrintable(name)); - qApp->exit(0); - } -} diff --git a/libmuon/MuonBackendsFactory.h b/libmuon/MuonBackendsFactory.h deleted file mode 100644 index c3f6ff5..0000000 --- a/libmuon/MuonBackendsFactory.h +++ /dev/null @@ -1,46 +0,0 @@ -/*************************************************************************** - * Copyright © 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef MUONBACKENDSFACTORY_H -#define MUONBACKENDSFACTORY_H -#include "libMuonCommon_export.h" -#include <QList> - -class QCommandLineParser; -class QStringList; -class KPluginInfo; -class AbstractResourcesBackend; - -class MUONCOMMON_EXPORT MuonBackendsFactory -{ -public: - MuonBackendsFactory(); - - AbstractResourcesBackend* backendForFile(const QString& path, const QString& name) const; - AbstractResourcesBackend* backend(const QString& name) const; - QList<AbstractResourcesBackend*> allBackends() const; - QStringList allBackendNames(bool whitelist = true) const; - int backendsCount() const; - - static void setupCommandLine(QCommandLineParser* parser); - static void processCommandLine(QCommandLineParser* parser); -}; - -#endif // MUONBACKENDSFACTORY_H diff --git a/libmuon/MuonDataSources.kcfgc b/libmuon/MuonDataSources.kcfgc deleted file mode 100644 index 125fa63..0000000 --- a/libmuon/MuonDataSources.kcfgc +++ /dev/null @@ -1,6 +0,0 @@ -File=muondatasources.kcfg -ClassName=MuonDataSources -Singleton=true -Mutators=false -IncludeFiles=\"libMuonCommon_export.h\" -Visibility=MUONCOMMON_EXPORT diff --git a/libmuon/ReviewsBackend/AbstractLoginBackend.cpp b/libmuon/ReviewsBackend/AbstractLoginBackend.cpp deleted file mode 100644 index a90e543..0000000 --- a/libmuon/ReviewsBackend/AbstractLoginBackend.cpp +++ /dev/null @@ -1,25 +0,0 @@ -/*************************************************************************** - * Copyright © 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "AbstractLoginBackend.h" - -AbstractLoginBackend::AbstractLoginBackend(QObject* parent) - : QObject(parent) -{} diff --git a/libmuon/ReviewsBackend/AbstractLoginBackend.h b/libmuon/ReviewsBackend/AbstractLoginBackend.h deleted file mode 100644 index f59327d..0000000 --- a/libmuon/ReviewsBackend/AbstractLoginBackend.h +++ /dev/null @@ -1,48 +0,0 @@ -/*************************************************************************** - * Copyright © 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef ABSTRACTLOGINBACKEND_H -#define ABSTRACTLOGINBACKEND_H - -#include <QObject> -#include "libMuonCommon_export.h" - -class MUONCOMMON_EXPORT AbstractLoginBackend : public QObject -{ - Q_OBJECT - public: - AbstractLoginBackend(QObject* parent=nullptr); - virtual bool hasCredentials() const = 0; - virtual QString displayName() const = 0; - - public slots: - virtual void login() = 0; - virtual void registerAndLogin() = 0; - virtual void logout() = 0; - virtual QByteArray token() const = 0; - virtual QByteArray tokenSecret() const = 0; - virtual QByteArray consumerKey() const = 0; - virtual QByteArray consumerSecret() const = 0; - - signals: - void connectionStateChanged(); -}; - -#endif // ABSTRACTLOGINBACKEND_H diff --git a/libmuon/ReviewsBackend/AbstractReviewsBackend.cpp b/libmuon/ReviewsBackend/AbstractReviewsBackend.cpp deleted file mode 100644 index 401f85b..0000000 --- a/libmuon/ReviewsBackend/AbstractReviewsBackend.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/*************************************************************************** - * Copyright © 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "AbstractReviewsBackend.h" - -AbstractReviewsBackend::AbstractReviewsBackend(QObject* parent) - : QObject(parent) -{} - -bool AbstractReviewsBackend::isReviewable() const -{ - return true; -} - -QString AbstractReviewsBackend::errorMessage() const -{ - return QString(); -} diff --git a/libmuon/ReviewsBackend/AbstractReviewsBackend.h b/libmuon/ReviewsBackend/AbstractReviewsBackend.h deleted file mode 100644 index 257602c..0000000 --- a/libmuon/ReviewsBackend/AbstractReviewsBackend.h +++ /dev/null @@ -1,65 +0,0 @@ -/*************************************************************************** - * Copyright © 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef ABSTRACTREVIEWSBACKEND_H -#define ABSTRACTREVIEWSBACKEND_H - -#include <QObject> - -#include "libMuonCommon_export.h" - -class Rating; -class AbstractResource; -class Review; - -class MUONCOMMON_EXPORT AbstractReviewsBackend : public QObject -{ - Q_OBJECT - Q_PROPERTY(bool isReviewable READ isReviewable CONSTANT) - Q_PROPERTY(bool hasCredentials READ hasCredentials NOTIFY loginStateChanged) - Q_PROPERTY(QString name READ userName NOTIFY loginStateChanged) - public: - explicit AbstractReviewsBackend(QObject* parent = nullptr); - - virtual QString userName() const = 0; - virtual bool hasCredentials() const = 0; - - Q_SCRIPTABLE virtual Rating *ratingForApplication(AbstractResource *app) const = 0; - Q_INVOKABLE virtual QString errorMessage() const; - public slots: - virtual void login() = 0; - virtual void registerAndLogin() = 0; - virtual void logout() = 0; - virtual void submitUsefulness(Review* r, bool useful) = 0; - virtual void submitReview(AbstractResource* app, const QString& summary, - const QString& review_text, const QString& rating) = 0; - virtual void deleteReview(Review* r) = 0; - virtual void flagReview(Review* r, const QString& reason, const QString &text) = 0; - virtual bool isFetching() const = 0; - virtual void fetchReviews(AbstractResource* app, int page=1) = 0; - virtual bool isReviewable() const; - - Q_SIGNALS: - void reviewsReady(AbstractResource *app, QList<Review *>); - void ratingsReady(); - void loginStateChanged(); -}; - -#endif // ABSTRACTREVIEWSBACKEND_H diff --git a/libmuon/ReviewsBackend/Rating.cpp b/libmuon/ReviewsBackend/Rating.cpp deleted file mode 100644 index 2181f8a..0000000 --- a/libmuon/ReviewsBackend/Rating.cpp +++ /dev/null @@ -1,200 +0,0 @@ -/*************************************************************************** - * Copyright © 2011 Jonathan Thomas <echidnaman@kubuntu.org> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "Rating.h" -#include <QStringList> -#include <QDebug> -#include <qmath.h> - -inline double fastPow(double a, double b) { - union { - double d; - int x[2]; - } u = { a }; - -#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN - u.x[1] = (int)(b * (u.x[1] - 1072632447) + 1072632447); - u.x[0] = 0; -#else - u.x[1] = 0; - u.x[0] = (int)(b * (u.x[1] - 1072632447) + 1072632447); -#endif - - return u.d; -} - -// Converted from a Ruby example, returns an inverse normal distribution -double pnormaldist(double qn) -{ - double b[] = {1.570796288, 0.03706987906, -0.8364353589e-3, -0.2250947176e-3, 0.6841218299e-5, 0.5824238515e-5, -0.104527497e-5, 0.8360937017e-7, -0.3231081277e-8, 0.3657763036e-10, 0.6936233982e-12}; - - if(qn < 0.0 || 1.0 < qn) - return 0.0; - - if(qn == 0.5) - return 0.0; - - double w1 = qn; - if(qn > 0.5) - w1 = 1.0 - w1; - double w3 = -qLn(4.0 * w1 * (1.0 - w1)); - w1 = b[0]; - - for(int i = 1; i < 11; i++) - w1 += b[i] * fastPow(w3,i); - - if(qn > 0.5) - return qSqrt(w1*w3); - return -qSqrt(w1*w3); -} - -double wilson_score(int pos, int n, double power = 0.2) -{ - if (n == 0) - return 0; - - double z = pnormaldist(1 - power / 2); - double phat = 1.0 * pos / n; - return (phat + z * z / (2 * n) - z * qSqrt( - (phat * (1 - phat) + z * z / (4 * n)) / n)) / (1 + z * z / n); -} - -double dampenedRating(const QVector<int> &ratings, double power = 0.1) -{ - if (ratings.count() != 5) - return 0; - - int tot_ratings = 0; - Q_FOREACH (const int rating, ratings) - tot_ratings = rating + tot_ratings; - - double sum_scores = 0.0; - - for (int i = 0; i < ratings.count(); i++) { - const int rating = ratings.at(i); - double ws = wilson_score(rating, tot_ratings, power); - sum_scores = sum_scores + float((i + 1) - 3) * ws; - } - - return sum_scores + 3; -} - -Rating::Rating(const QVariantMap &data) - : QObject() -{ - init(data.value("package_name").toString(), data.value("app_name").toString(), - data.value("ratings_total").toULongLong(), data.value("ratings_average").toDouble() * 2, data.value("histogram").toString()); -} - -Rating::Rating(const QString& packageName, const QString& appName, int ratingCount, int rating, const QString& histogram) - : QObject() -{ - init(packageName, appName, ratingCount, rating, histogram); -} - -Rating::Rating(const QString& packageName, QStringList histogram) - : QObject() -{ - debInit(packageName,histogram); -} - -void Rating::init(const QString& packageName, const QString& appName, int ratingCount, int rating, const QString& histogram) -{ - m_packageName = packageName; - m_appName = appName; - m_ratingCount = ratingCount; - m_rating = rating; - m_ratingPoints = 0; - m_sortableRating = 0; - - QStringList histo = histogram.mid(1,histogram.size()-2).split(", "); - QVector<int> spread = QVector<int>(); - - for(int i=0; i<histo.size(); ++i) { - int points = histo[i].toInt(); - m_ratingPoints += (i+1)*points; - spread.append(points); - } - - m_sortableRating = dampenedRating(spread) * 2; -} - -void Rating::debInit(const QString& packageName, QStringList histogram) -{ - int installed = 0; - m_packageName = packageName; - m_sortableRating = 0; - //inst, vote, old, recent, no-files - QVector<int> values = QVector<int>(); - histogram.removeDuplicates(); - for(int i=1; i<histogram.count(); ++i) { - int points = histogram[i].toInt(); - installed+=points; - values.append(points); - } - m_sortableRating = values[0]; - m_ratingCount = installed; - - if (installed) { - m_rating = values[0]/(m_ratingCount*1.0)*10; - } else { - m_rating = 0; - } - - if (values[0]-values[1]) { - m_ratingPoints = (values[2]*1.0)/(values[0]-values[1]); - } else { - m_ratingPoints = 0; - } -} - -Rating::~Rating() -{ -} - -QString Rating::packageName() const -{ - return m_packageName; -} - -QString Rating::applicationName() const -{ - return m_appName; -} - -quint64 Rating::ratingCount() const -{ - return m_ratingCount; -} - -int Rating::rating() const -{ - return m_rating; -} - -int Rating::ratingPoints() const -{ - return m_ratingPoints; -} - -double Rating::sortableRating() const -{ - return m_sortableRating; -} diff --git a/libmuon/ReviewsBackend/Rating.h b/libmuon/ReviewsBackend/Rating.h deleted file mode 100644 index 8a26a15..0000000 --- a/libmuon/ReviewsBackend/Rating.h +++ /dev/null @@ -1,62 +0,0 @@ -/*************************************************************************** - * Copyright © 2011 Jonathan Thomas <echidnaman@kubuntu.org> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef RATING_H -#define RATING_H - -#include <QtCore/QObject> -#include <QtCore/QVariant> - -#include "libMuonCommon_export.h" - -class MUONCOMMON_EXPORT Rating : public QObject -{ -Q_OBJECT -Q_PROPERTY(double sortableRating READ sortableRating CONSTANT) -Q_PROPERTY(int rating READ rating CONSTANT) -Q_PROPERTY(int ratingPoints READ ratingPoints CONSTANT) -Q_PROPERTY(quint64 ratingCount READ ratingCount CONSTANT) -public: - explicit Rating(const QVariantMap &data); - explicit Rating(const QString& packageName, const QString& appName, int ratingCount, int rating, const QString& histogram); - explicit Rating(const QString& packageName, QStringList histogram); - ~Rating(); - - QString packageName() const; - QString applicationName() const; - quint64 ratingCount() const; - // 0.0 - 10.0 ranged rating multiplied by two and rounded for KRating* - Q_SCRIPTABLE int rating() const; - int ratingPoints() const; - // Returns a dampened rating calculated with the Wilson Score Interval algorithm - double sortableRating() const; - -private: - void init(const QString& packageName, const QString& appName, int ratingCount, int rating, const QString& histogram); - void debInit(const QString& packageName,QStringList histogram); - QString m_packageName; - QString m_appName; - quint64 m_ratingCount; - int m_rating; - int m_ratingPoints; - double m_sortableRating; -}; - -#endif diff --git a/libmuon/ReviewsBackend/Review.cpp b/libmuon/ReviewsBackend/Review.cpp deleted file mode 100644 index bd526c4..0000000 --- a/libmuon/ReviewsBackend/Review.cpp +++ /dev/null @@ -1,130 +0,0 @@ -/*************************************************************************** - * Copyright © 2011 Jonathan Thomas <echidnaman@kubuntu.org> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "Review.h" -#include <resources/ResourcesModel.h> - -Review::Review(QString name, QString pkgName, QString language, QString summary, - QString reviewText, QString userName, const QDateTime& date, bool show, quint64 id, - int rating, int usefulTotal, int usefulFavorable, QString packageVersion) - : m_appName(std::move(name)) - , m_creationDate(date) - , m_shouldShow(show) - , m_id(id) - , m_language(std::move(language)) - , m_packageName(std::move(pkgName)) - , m_rating(rating) - , m_reviewText(std::move(reviewText)) - , m_reviewer(std::move(userName)) - , m_usefulnessTotal(usefulTotal) - , m_usefulnessFavorable(usefulFavorable) - , m_usefulChoice(ReviewsModel::None) - , m_summary(std::move(summary)) - , m_packageVersion(std::move(packageVersion)) -{} - -Review::~Review() -{ -} - -bool Review::operator<(const Review &other) const -{ - return m_creationDate < other.m_creationDate; -} - -bool Review::operator>(const Review &other) const -{ - return m_creationDate > other.m_creationDate; -} - -QString Review::applicationName() const -{ - return m_appName; -} - -QString Review::packageName() const -{ - return m_packageName; -} - -QString Review::packageVersion() const -{ - return m_packageVersion; -} - -QString Review::language() const -{ - return m_language; -} - -QString Review::summary() const -{ - return m_summary; -} - -QString Review::reviewText() const -{ - return m_reviewText; -} - -QString Review::reviewer() const -{ - return m_reviewer; -} - -QDateTime Review::creationDate() const -{ - return m_creationDate; -} - -bool Review::shouldShow() const -{ - return m_shouldShow; -} - -quint64 Review::id() const -{ - return m_id; -} - -int Review::rating() const -{ - return m_rating; -} - -int Review::usefulnessTotal() const -{ - return m_usefulnessTotal; -} - -int Review::usefulnessFavorable() const -{ - return m_usefulnessFavorable; -} - -ReviewsModel::UserChoice Review::usefulChoice() const -{ - return m_usefulChoice; -} - -void Review::setUsefulChoice(ReviewsModel::UserChoice useful) -{ - m_usefulChoice = useful; -} diff --git a/libmuon/ReviewsBackend/Review.h b/libmuon/ReviewsBackend/Review.h deleted file mode 100644 index 494fc03..0000000 --- a/libmuon/ReviewsBackend/Review.h +++ /dev/null @@ -1,77 +0,0 @@ -/*************************************************************************** - * Copyright © 2011 Jonathan Thomas <echidnaman@kubuntu.org> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef REVIEW_H -#define REVIEW_H - -#include <QtCore/QDateTime> -#include <QtCore/QVariant> - -#include "ReviewsModel.h" -#include "libMuonCommon_export.h" - -class AbstractResource; - -class MUONCOMMON_EXPORT Review -{ -public: - Review(QString name, QString pkgName, QString language, QString summary, - QString reviewText, QString userName, const QDateTime& date, bool show, quint64 id, - int rating, int usefulTotal, int usefulFavorable, QString packageVersion); - ~Review(); - - // Creation date determines greater than/less than - bool operator<(const Review &rhs) const; - bool operator>(const Review &rhs) const; - - QString applicationName() const; - QString packageName() const; - QString packageVersion() const; - QString language() const; - QString summary() const; - QString reviewText() const; - QString reviewer() const; - QDateTime creationDate() const; - bool shouldShow() const; - quint64 id() const; - int rating() const; - int usefulnessTotal() const; - int usefulnessFavorable() const; - ReviewsModel::UserChoice usefulChoice() const; - void setUsefulChoice(ReviewsModel::UserChoice useful); - -private: - QString m_appName; - QDateTime m_creationDate; - bool m_shouldShow; - quint64 m_id; - QString m_language; - QString m_packageName; - int m_rating; - QString m_reviewText; - QString m_reviewer; - int m_usefulnessTotal; - int m_usefulnessFavorable; - ReviewsModel::UserChoice m_usefulChoice; - QString m_summary; - QString m_packageVersion; -}; - -#endif diff --git a/libmuon/ReviewsBackend/ReviewsModel.cpp b/libmuon/ReviewsBackend/ReviewsModel.cpp deleted file mode 100644 index 6b948b0..0000000 --- a/libmuon/ReviewsBackend/ReviewsModel.cpp +++ /dev/null @@ -1,181 +0,0 @@ -/*************************************************************************** - * Copyright © 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "ReviewsModel.h" -#include <ReviewsBackend/AbstractReviewsBackend.h> -#include <ReviewsBackend/Review.h> -#include <resources/ResourcesModel.h> -#include <resources/AbstractResourcesBackend.h> -#include <resources/AbstractResource.h> -#include <QDebug> - -ReviewsModel::ReviewsModel(QObject* parent) - : QAbstractListModel(parent) - , m_app(nullptr) - , m_backend(nullptr) - , m_lastPage(0) - , m_canFetchMore(true) -{} - -QHash< int, QByteArray > ReviewsModel::roleNames() const -{ - QHash<int, QByteArray> roles = QAbstractItemModel::roleNames(); - roles.insert(ShouldShow, "shouldShow"); - roles.insert(Reviewer, "reviewer"); - roles.insert(CreationDate, "date"); - roles.insert(UsefulnessTotal, "usefulnessTotal"); - roles.insert(UsefulnessFavorable, "usefulnessFavorable"); - roles.insert(UsefulChoice, "usefulChoice"); - roles.insert(Rating, "rating"); - roles.insert(Summary, "summary"); - return roles; -} - -QVariant ReviewsModel::data(const QModelIndex& index, int role) const -{ - if(!index.isValid()) - return QVariant(); - switch(role) { - case Qt::DisplayRole: - return m_reviews.at(index.row())->reviewText(); - case ShouldShow: - return m_reviews.at(index.row())->shouldShow(); - case Reviewer: - return m_reviews.at(index.row())->reviewer(); - case CreationDate: - return m_reviews.at(index.row())->creationDate(); - case UsefulnessTotal: - return m_reviews.at(index.row())->usefulnessTotal(); - case UsefulnessFavorable: - return m_reviews.at(index.row())->usefulnessFavorable(); - case UsefulChoice: - return m_reviews.at(index.row())->usefulChoice(); - case Rating: - return m_reviews.at(index.row())->rating(); - case Summary: - return m_reviews.at(index.row())->summary(); - } - return QVariant(); -} - -int ReviewsModel::rowCount(const QModelIndex& parent) const -{ - if(parent.isValid()) - return 0; - return m_reviews.count(); -} - -AbstractResource* ReviewsModel::resource() const -{ - return m_app; -} - -AbstractReviewsBackend* ReviewsModel::backend() const -{ - return m_backend; -} - -void ReviewsModel::setResource(AbstractResource* app) -{ - if(m_app!=app) { - beginResetModel(); - m_reviews.clear(); - m_lastPage = 0; - endResetModel(); - - if(m_backend) { - disconnect(m_backend, SIGNAL(reviewsReady(AbstractResource*,QList<Review*>)), - this, SLOT(addReviews(AbstractResource*,QList<Review*>))); - } - m_app = app; - m_backend = app->backend()->reviewsBackend(); - if(m_backend) { - connect(m_backend, SIGNAL(reviewsReady(AbstractResource*,QList<Review*>)), - this, SLOT(addReviews(AbstractResource*,QList<Review*>))); - - QMetaObject::invokeMethod(this, "restartFetching", Qt::QueuedConnection); - } - emit rowsChanged(); - } -} - -void ReviewsModel::restartFetching() -{ - if(!m_app || !m_backend) - return; - - m_canFetchMore=true; - m_lastPage = 0; - fetchMore(); - emit rowsChanged(); -} - -void ReviewsModel::fetchMore(const QModelIndex& parent) -{ - if(!m_backend || !m_app || m_app->backend()->isFetching() || m_backend->isFetching() || parent.isValid() || !m_canFetchMore) - return; - - m_lastPage++; - m_backend->fetchReviews(m_app, m_lastPage); -// qDebug() << "fetching reviews... " << m_lastPage; -} - -void ReviewsModel::addReviews(AbstractResource* app, const QList<Review*>& reviews) -{ - if(app!=m_app) - return; - - m_canFetchMore=!reviews.isEmpty(); -// qDebug() << "reviews arrived..." << m_lastPage << reviews.size(); - - if(!reviews.isEmpty()) { - beginInsertRows(QModelIndex(), rowCount(), rowCount()+reviews.size()-1); - m_reviews += reviews; - endInsertRows(); - emit rowsChanged(); - } -} - -bool ReviewsModel::canFetchMore(const QModelIndex&) const -{ - return m_canFetchMore; -} - -void ReviewsModel::markUseful(int row, bool useful) -{ - Review* r = m_reviews[row]; - r->setUsefulChoice(useful ? Yes : No); -// qDebug() << "submitting usefulness" << r->applicationName() << r->id() << useful; - m_backend->submitUsefulness(r, useful); - const QModelIndex ind = index(row, 0, QModelIndex()); - emit dataChanged(ind, ind); -} - -void ReviewsModel::deleteReview(int row) -{ - Review* r = m_reviews[row]; - m_backend->deleteReview(r); -} - -void ReviewsModel::flagReview(int row, const QString& reason, const QString& text) -{ - Review* r = m_reviews[row]; - m_backend->flagReview(r, reason, text); -} diff --git a/libmuon/ReviewsBackend/ReviewsModel.h b/libmuon/ReviewsBackend/ReviewsModel.h deleted file mode 100644 index ba3a260..0000000 --- a/libmuon/ReviewsBackend/ReviewsModel.h +++ /dev/null @@ -1,85 +0,0 @@ -/*************************************************************************** - * Copyright © 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef REVIEWSMODEL_H -#define REVIEWSMODEL_H - -#include <QModelIndex> -#include "libMuonCommon_export.h" - -class Review; -class AbstractResource; -class AbstractReviewsBackend; -class MUONCOMMON_EXPORT ReviewsModel : public QAbstractListModel -{ - Q_OBJECT - Q_PROPERTY(AbstractReviewsBackend* backend READ backend) - Q_PROPERTY(AbstractResource* resource READ resource WRITE setResource) - Q_PROPERTY(int count READ rowCount NOTIFY rowsChanged) - Q_ENUMS(UserChoice); - public: - enum Roles { - ShouldShow=Qt::UserRole+1, - Reviewer, - CreationDate, - UsefulnessTotal, - UsefulnessFavorable, - UsefulChoice, - Rating, - Summary - }; - enum UserChoice { - None, - Yes, - No - }; - explicit ReviewsModel(QObject* parent = nullptr); - virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; - virtual int rowCount(const QModelIndex& parent = QModelIndex()) const override; - - AbstractReviewsBackend* backend() const; - void setResource(AbstractResource* app); - AbstractResource* resource() const; - virtual void fetchMore(const QModelIndex& parent=QModelIndex()) override; - virtual bool canFetchMore(const QModelIndex&) const override; - virtual QHash<int, QByteArray> roleNames() const override; - - public slots: - void deleteReview(int row); - void flagReview(int row, const QString& reason, const QString& text); - void markUseful(int row, bool useful); - - private slots: - void addReviews(AbstractResource* app, const QList<Review*>& reviews); - void restartFetching(); - - signals: - void rowsChanged(); - - private: - AbstractResource* m_app; - AbstractReviewsBackend* m_backend; - QList<Review*> m_reviews; - int m_lastPage; - bool m_canFetchMore; -}; - -#endif // REVIEWSMODEL_H - diff --git a/libmuon/ScreenshotsModel.cpp b/libmuon/ScreenshotsModel.cpp deleted file mode 100644 index 2849824..0000000 --- a/libmuon/ScreenshotsModel.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/*************************************************************************** - * Copyright © 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "ScreenshotsModel.h" -#include <resources/AbstractResource.h> -#include <QDebug> -// #include <tests/modeltest.h> - -ScreenshotsModel::ScreenshotsModel(QObject* parent) - : QAbstractListModel(parent) - , m_resource(nullptr) -{} - -QHash< int, QByteArray > ScreenshotsModel::roleNames() const -{ - QHash<int, QByteArray> roles = QAbstractItemModel::roleNames(); - roles.insert(ThumbnailUrl, "small_image_url"); - roles.insert(ScreenshotUrl, "large_image_url"); - return roles; -} - -void ScreenshotsModel::setResource(AbstractResource* res) -{ - if(res == m_resource) - return; - - if(m_resource) { - disconnect(m_resource, SIGNAL(screenshotsFetched(QList<QUrl>,QList<QUrl>)), this, - SLOT(screenshotsFetched(QList<QUrl>,QList<QUrl>))); - } - m_resource = res; - - if(res) { - connect(m_resource, SIGNAL(screenshotsFetched(QList<QUrl>,QList<QUrl>)), - SLOT(screenshotsFetched(QList<QUrl>,QList<QUrl>))); - res->fetchScreenshots(); - } else - qWarning() << "empty resource!"; -} - -AbstractResource* ScreenshotsModel::resource() const -{ - return m_resource; -} - -void ScreenshotsModel::screenshotsFetched(const QList< QUrl >& thumbnails, const QList< QUrl >& screenshots) -{ - Q_ASSERT(thumbnails.count()==screenshots.count()); - if (thumbnails.size() == 0) - return; - - beginInsertRows(QModelIndex(), m_thumbnails.size(), m_thumbnails.size()+thumbnails.size()-1); - m_thumbnails += thumbnails; - m_screenshots += screenshots; - endInsertRows(); - emit countChanged(); -} - -QVariant ScreenshotsModel::data(const QModelIndex& index, int role) const -{ - if(!index.isValid() || index.parent().isValid()) - return QVariant(); - - switch(role) { - case ThumbnailUrl: return m_thumbnails[index.row()]; - case ScreenshotUrl: return m_screenshots[index.row()]; - } - - return QVariant(); -} - -int ScreenshotsModel::rowCount(const QModelIndex& parent) const -{ - return !parent.isValid() ? m_screenshots.count() : 0; -} - -QUrl ScreenshotsModel::screenshotAt(int row) const -{ - return m_screenshots[row]; -} - -int ScreenshotsModel::count() const -{ - return m_screenshots.count(); -} diff --git a/libmuon/ScreenshotsModel.h b/libmuon/ScreenshotsModel.h deleted file mode 100644 index ec34899..0000000 --- a/libmuon/ScreenshotsModel.h +++ /dev/null @@ -1,62 +0,0 @@ -/*************************************************************************** - * Copyright © 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef SCREENSHOTSMODEL_H -#define SCREENSHOTSMODEL_H - -#include <QModelIndex> -#include <QUrl> -#include "libMuonCommon_export.h" - -class AbstractResource; - -class MUONCOMMON_EXPORT ScreenshotsModel : public QAbstractListModel -{ - Q_OBJECT - Q_PROPERTY(AbstractResource* application READ resource WRITE setResource) - Q_PROPERTY(int count READ count NOTIFY countChanged) - public: - enum Roles { ThumbnailUrl=Qt::UserRole+1, ScreenshotUrl }; - - ScreenshotsModel(QObject* parent = nullptr); - virtual QHash<int, QByteArray> roleNames() const override; - - AbstractResource* resource() const; - void setResource(AbstractResource* res); - - virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; - virtual int rowCount(const QModelIndex& parent = QModelIndex()) const override; - Q_SCRIPTABLE QUrl screenshotAt(int row) const; - int count() const; - - private slots: - void screenshotsFetched(const QList<QUrl>& thumbnails, const QList<QUrl>& screenshots); - - signals: - void countChanged(); - - private: - AbstractResource* m_resource; - QList<QUrl> m_thumbnails; - QList<QUrl> m_screenshots; - -}; - -#endif // SCREENSHOTSMODEL_H diff --git a/libmuon/Transaction/AddonList.cpp b/libmuon/Transaction/AddonList.cpp deleted file mode 100644 index af72726..0000000 --- a/libmuon/Transaction/AddonList.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/*************************************************************************** - * Copyright © 2012 Jonathan Thomas <echidnaman@kubuntu.org> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "AddonList.h" - -AddonList::AddonList() -{} - -AddonList::AddonList(const AddonList &other) - : m_toInstall(other.m_toInstall) - , m_toRemove(other.m_toRemove) -{ -} - -bool AddonList::isEmpty() const -{ - return m_toInstall.isEmpty() && m_toRemove.isEmpty(); -} - -QStringList AddonList::addonsToInstall() const -{ - return m_toInstall; -} - -QStringList AddonList::addonsToRemove() const -{ - return m_toRemove; -} - -void AddonList::addAddon(const QString &addon, bool toInstall) -{ - if (toInstall) { - m_toInstall.append(addon); - m_toRemove.removeAll(addon); - } else { - m_toInstall.removeAll(addon); - m_toRemove.append(addon); - } -} - -void AddonList::resetAddon(const QString &addon) -{ - m_toInstall.removeAll(addon); - m_toRemove.removeAll(addon); -} - -void AddonList::clear() -{ - m_toInstall.clear(); - m_toRemove.clear(); -} - -AddonList::State AddonList::addonState(const QString& addonName) const -{ - if(m_toInstall.contains(addonName)) - return ToInstall; - else if(m_toRemove.contains(addonName)) - return ToRemove; - else - return None; -} diff --git a/libmuon/Transaction/AddonList.h b/libmuon/Transaction/AddonList.h deleted file mode 100644 index bd0cdce..0000000 --- a/libmuon/Transaction/AddonList.h +++ /dev/null @@ -1,54 +0,0 @@ -/*************************************************************************** - * Copyright © 2012 Jonathan Thomas <echidnaman@kubuntu.org> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef ADDONLIST_H -#define ADDONLIST_H - -#include <QStringList> -#include <QtCore/QVector> - -#include "libMuonCommon_export.h" - -class MUONCOMMON_EXPORT AddonList -{ -public: - enum State { - None, - ToInstall, - ToRemove - }; - AddonList(); - AddonList(const AddonList &other); - - bool isEmpty() const; - QStringList addonsToInstall() const; - QStringList addonsToRemove() const; - State addonState(const QString& addonName) const; - - void addAddon(const QString &addon, bool toInstall); - void resetAddon(const QString &addon); - void clear(); - -private: - QStringList m_toInstall; - QStringList m_toRemove; -}; - -#endif // ADDONLIST_H diff --git a/libmuon/Transaction/Transaction.cpp b/libmuon/Transaction/Transaction.cpp deleted file mode 100644 index cae2cf8..0000000 --- a/libmuon/Transaction/Transaction.cpp +++ /dev/null @@ -1,108 +0,0 @@ -/*************************************************************************** - * Copyright © 2012 Jonathan Thomas <echidnaman@kubuntu.org> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "Transaction.h" - -#include "TransactionModel.h" - -Transaction::Transaction(QObject *parent, AbstractResource *resource, - Role role) - : QObject(parent) - , m_resource(resource) - , m_role(role) - , m_status(CommittingStatus) - , m_isCancellable(true) - , m_progress(0) -{ -} - -Transaction::Transaction(QObject *parent, AbstractResource *resource, - Role role, AddonList addons) - : QObject(parent) - , m_resource(resource) - , m_role(role) - , m_status(CommittingStatus) - , m_addons(addons) - , m_isCancellable(true) - , m_progress(0) -{ -} - -AbstractResource *Transaction::resource() const -{ - return m_resource; -} - -Transaction::Role Transaction::role() const -{ - return m_role; -} - -Transaction::Status Transaction::status() const -{ - return m_status; -} - -AddonList Transaction::addons() const -{ - return m_addons; -} - -bool Transaction::isCancellable() const -{ - return m_isCancellable; -} - -int Transaction::progress() const -{ - return m_progress; -} - -void Transaction::setStatus(Status status) -{ - if(m_status != status) { - m_status = status; - emit statusChanged(m_status); - } -} - -void Transaction::setCancellable(bool isCancellable) -{ - if(m_isCancellable != isCancellable) { - m_isCancellable = isCancellable; - emit cancellableChanged(m_isCancellable); - } -} - -void Transaction::setProgress(int progress) -{ - if(m_progress != progress) { - m_progress = progress; - emit progressChanged(m_progress); - } -} - -void Transaction::cancel() -{ - if (!m_isCancellable) - return; - - TransactionModel::global()->cancelTransaction(this); -} diff --git a/libmuon/Transaction/Transaction.h b/libmuon/Transaction/Transaction.h deleted file mode 100644 index 34b8899..0000000 --- a/libmuon/Transaction/Transaction.h +++ /dev/null @@ -1,150 +0,0 @@ -/*************************************************************************** - * Copyright © 2012 Jonathan Thomas <echidnaman@kubuntu.org> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef TRANSACTION_H -#define TRANSACTION_H - -// Qt includes -#include <QtCore/QObject> - -// Own includes -#include "AddonList.h" - -#include "libMuonCommon_export.h" - -class AbstractResource; - -/** - * \class Transaction Transaction.h "Transaction.h" - * - * \brief This is the base class of all transactions. - * - * When there are transactions running inside Muon, the backends should - * provide the corresponding Transaction objects with proper information. - */ -class MUONCOMMON_EXPORT Transaction : public QObject -{ - Q_OBJECT - - Q_PROPERTY(AbstractResource* resource READ resource CONSTANT) - Q_PROPERTY(Role role READ role CONSTANT) - Q_PROPERTY(Status status READ status NOTIFY statusChanged) - Q_PROPERTY(bool isCancellable READ isCancellable NOTIFY cancellableChanged) - Q_PROPERTY(int progress READ progress NOTIFY progressChanged) - -public: - enum Status { - /// Not queued, newly created - SetupStatus = 0, - /// Queued, but not yet run - QueuedStatus, - /// Transaction is in the downloading phase - DownloadingStatus, - /// Transaction is doing an installation/removal - CommittingStatus, - /// Transaction is done - DoneStatus - }; - Q_ENUMS(Status) - - enum Role { - ///The transaction is going to install a resource - InstallRole = 0, - ///The transaction is going to remove a resource - RemoveRole, - ///The transaction is going to change the addons of a resource - ChangeAddonsRole - }; - Q_ENUMS(Role) - - Transaction(QObject *parent, AbstractResource *resource, - Transaction::Role role); - Transaction(QObject *parent, AbstractResource *resource, - Transaction::Role role, AddonList addons); - - /** - * @returns the AbstractResource which this transaction works with - */ - AbstractResource *resource() const; - /** - * @returns the role which this transaction executes - */ - Role role() const; - /** - * @returns the current status - */ - Status status() const; - /** - * @returns the addons which this transaction works on - */ - AddonList addons() const; - /** - * @returns true when the transaction can be canceled - */ - bool isCancellable() const; - /** - * @returns a percentage of how much the transaction is already done - */ - int progress() const; - - /** - * Sets the status of the transaction - * @param status the new status - */ - void setStatus(Status status); - /** - * Sets whether the transaction can be canceled or not - * @param isCancellable should be true if the transaction can be canceled - */ - void setCancellable(bool isCancellable); - /** - * Sets the progress of the transaction - * @param progress this should be a percentage of how much of the transaction is already done - */ - void setProgress(int progress); - /** - * Cancels the transaction - */ - void cancel(); - -private: - AbstractResource *m_resource; - Role m_role; - Status m_status; - AddonList m_addons; - bool m_isCancellable; - int m_progress; - -signals: - /** - * This gets emitted when the status of the transaction changed - */ - void statusChanged(Transaction::Status status); - /** - * This gets emitted when the ability to cancel the transaction or not changed - */ - void cancellableChanged(bool cancellable); - /** - * This gets emitted when the transaction changed the percentage of how much of it is already done - */ - void progressChanged(int progress); -}; - -#endif // TRANSACTION_H diff --git a/libmuon/Transaction/TransactionListener.cpp b/libmuon/Transaction/TransactionListener.cpp deleted file mode 100644 index e9f949a..0000000 --- a/libmuon/Transaction/TransactionListener.cpp +++ /dev/null @@ -1,170 +0,0 @@ -/*************************************************************************** - * Copyright © 2010 Jonathan Thomas <echidnaman@kubuntu.org> * - * Copyright © 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "TransactionListener.h" - -#include "TransactionModel.h" -#include <QMetaProperty> -#include <QDebug> - -TransactionListener::TransactionListener(QObject *parent) - : QObject(parent) - , m_resource(nullptr) - , m_transaction(nullptr) -{ - connect(TransactionModel::global(), SIGNAL(transactionAdded(Transaction*)), - this, SLOT(transactionAdded(Transaction*))); - connect(TransactionModel::global(), SIGNAL(transactionRemoved(Transaction*)), - this, SLOT(transactionRemoved(Transaction*))); - connect(TransactionModel::global(), SIGNAL(transactionCancelled(Transaction*)), - this, SLOT(transactionCancelled(Transaction*))); -} - -AbstractResource *TransactionListener::resource() const -{ - return m_resource; -} - -bool TransactionListener::isCancellable() const -{ - return m_transaction && m_transaction->isCancellable(); -} - -bool TransactionListener::isActive() const -{ - return m_transaction && m_transaction->status() != Transaction::SetupStatus; -} - -QString TransactionListener::statusText() const -{ - QModelIndex index = TransactionModel::global()->indexOf(m_resource); - - return index.data(TransactionModel::StatusTextRole).toString(); -} - -void TransactionListener::setResource(AbstractResource *resource) -{ - if (m_resource == resource) - return; - - m_resource = resource; - - // Catch already-started transactions - setTransaction(TransactionModel::global()->transactionFromResource(resource)); - - emit resourceChanged(); -} - -void TransactionListener::transactionAdded(Transaction *trans) -{ - if (trans->resource() != m_resource) - return; - - setTransaction(trans); -} - -class CheckChange -{ -public: - CheckChange(QObject* obj, const QByteArray& prop) - : m_object(obj) - , m_prop(obj->metaObject()->property(obj->metaObject()->indexOfProperty(prop))) - , m_oldValue(m_prop.read(obj)) - { - Q_ASSERT(obj->metaObject()->indexOfProperty(prop)>=0); - } - - ~CheckChange() { - const QVariant newValue = m_prop.read(m_object); - if (newValue != m_oldValue) { - QMetaMethod m = m_prop.notifySignal(); - m.invoke(m_object, Qt::DirectConnection); - } - } - -private: - QObject* m_object; - QMetaProperty m_prop; - QVariant m_oldValue; -}; - -void TransactionListener::setTransaction(Transaction* trans) -{ - Q_ASSERT(!trans || trans->resource()==m_resource); - if (m_transaction == trans) { - return; - } - - if(m_transaction) { - disconnect(m_transaction, nullptr, this, nullptr); - } - - CheckChange change1(this, "isCancellable"); - CheckChange change2(this, "isActive"); - CheckChange change3(this, "statusText"); - CheckChange change4(this, "progress"); - - m_transaction = trans; - if(m_transaction) { - connect(m_transaction, SIGNAL(cancellableChanged(bool)), - this, SIGNAL(cancellableChanged())); - connect(m_transaction, SIGNAL(statusChanged(Transaction::Status)), - this, SLOT(transactionStatusChanged(Transaction::Status))); - connect(m_transaction, SIGNAL(progressChanged(int)), - this, SIGNAL(progressChanged())); - } -} - -void TransactionListener::transactionStatusChanged(Transaction::Status status) -{ - switch (status) { - case Transaction::DoneStatus: - setTransaction(nullptr); - break; - case Transaction::QueuedStatus: - emit runningChanged(); - break; - default: - break; - } - - emit statusTextChanged(); -} - -void TransactionListener::transactionRemoved(Transaction* trans) -{ - if(m_transaction == trans) { - setTransaction(nullptr); - } -} - -void TransactionListener::transactionCancelled(Transaction* trans) -{ - if(m_transaction == trans) { - setTransaction(nullptr); - } - emit cancelled(); -} - -int TransactionListener::progress() const -{ - return m_transaction ? m_transaction->progress() : 0; -} diff --git a/libmuon/Transaction/TransactionListener.h b/libmuon/Transaction/TransactionListener.h deleted file mode 100644 index 8f5e0c2..0000000 --- a/libmuon/Transaction/TransactionListener.h +++ /dev/null @@ -1,72 +0,0 @@ -/*************************************************************************** - * Copyright © 2010 Jonathan Thomas <echidnaman@kubuntu.org> * - * Copyright © 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef TRANSACTIONLISTENER_H -#define TRANSACTIONLISTENER_H - -#include <QtCore/QObject> - -#include "Transaction.h" -#include "libMuonCommon_export.h" - -class AbstractResource; - -class MUONCOMMON_EXPORT TransactionListener : public QObject -{ - Q_OBJECT - Q_PROPERTY(AbstractResource* resource READ resource WRITE setResource NOTIFY resourceChanged) - Q_PROPERTY(bool isCancellable READ isCancellable NOTIFY cancellableChanged) - Q_PROPERTY(bool isActive READ isActive NOTIFY runningChanged) - Q_PROPERTY(QString statusText READ statusText NOTIFY statusTextChanged) - Q_PROPERTY(int progress READ progress NOTIFY progressChanged) -public: - explicit TransactionListener(QObject *parent = nullptr); - - AbstractResource *resource() const; - bool isCancellable() const; - bool isActive() const; - QString statusText() const; - int progress() const; - - void setResource(AbstractResource* resource); - -private: - void setTransaction(Transaction *trans); - - AbstractResource *m_resource; - Transaction *m_transaction; - -private slots: - void transactionAdded(Transaction *trans); - void transactionRemoved(Transaction* trans); - void transactionCancelled(Transaction* trans); - void transactionStatusChanged(Transaction::Status status); - -signals: - void resourceChanged(); - void cancellableChanged(); - void runningChanged(); - void statusTextChanged(); - void cancelled(); - void progressChanged(); -}; - -#endif // TRANSACTIONLISTENER_H diff --git a/libmuon/Transaction/TransactionModel.cpp b/libmuon/Transaction/TransactionModel.cpp deleted file mode 100644 index a181a06..0000000 --- a/libmuon/Transaction/TransactionModel.cpp +++ /dev/null @@ -1,223 +0,0 @@ -/*************************************************************************** - * Copyright © 2012 Jonathan Thomas <echidnaman@kubuntu.org> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "TransactionModel.h" - -// Qt includes -#include <QtCore/QMetaProperty> -#include <klocalizedstring.h> - -// Own includes -#include "resources/AbstractResource.h" - -Q_GLOBAL_STATIC(TransactionModel, globalTransactionModel) - -TransactionModel *TransactionModel::global() -{ - return globalTransactionModel; -} - -TransactionModel::TransactionModel(QObject *parent) - : QAbstractListModel(parent) -{ - connect(this, &QAbstractItemModel::rowsInserted, this, &TransactionModel::countChanged); - connect(this, &QAbstractItemModel::rowsRemoved, this, &TransactionModel::countChanged); -} - -QHash< int, QByteArray > TransactionModel::roleNames() const -{ - QHash<int, QByteArray> roles = QAbstractItemModel::roleNames(); - roles[TransactionRoleRole] = "transactionRole"; - roles[TransactionStatusRole] = "status"; - roles[CancellableRole] = "cancellable"; - roles[ProgressRole] = "progress"; - roles[StatusTextRole] = "statusText"; - roles[ResourceRole] = "resource"; - return roles; -} - -int TransactionModel::rowCount(const QModelIndex &parent) const -{ - // Root element parents all children - if (!parent.isValid()) - return m_transactions.size(); - - // Child elements have no children themselves - return 0; -} - -QVariant TransactionModel::data(const QModelIndex &index, int role) const -{ - if (!index.isValid()) - return QVariant(); - - Transaction *trans = transactionFromIndex(index); - switch (role) { - case TransactionRoleRole: - return trans->role(); - case TransactionStatusRole: - return trans->status(); - case CancellableRole: - return trans->isCancellable(); - case ProgressRole: - return trans->progress(); - case StatusTextRole: - switch (trans->status()) { - case Transaction::SetupStatus: - return i18nc("@info:status", "Starting"); - case Transaction::QueuedStatus: - return i18nc("@info:status", "Waiting"); - case Transaction::DownloadingStatus: - return i18nc("@info:status", "Downloading"); - case Transaction::CommittingStatus: - switch (trans->role()) { - case Transaction::InstallRole: - return i18nc("@info:status", "Installing"); - case Transaction::RemoveRole: - return i18nc("@info:status", "Removing"); - case Transaction::ChangeAddonsRole: - return i18nc("@info:status", "Changing Addons"); - } - break; - case Transaction::DoneStatus: - return i18nc("@info:status", "Done"); - } - break; - case ResourceRole: - - return qVariantFromValue<QObject*>(trans->resource()); - } - - return QVariant(); -} - -Transaction *TransactionModel::transactionFromIndex(const QModelIndex &index) const -{ - Transaction *trans = nullptr; - - if (index.row() < m_transactions.size()) - trans = m_transactions.at(index.row()); - - return trans; -} - -Transaction *TransactionModel::transactionFromResource(AbstractResource *resource) const -{ - Transaction *ret = nullptr; - - Q_FOREACH (Transaction *trans, m_transactions) { - if (trans->resource() == resource) { - ret = trans; - break; - } - } - - return ret; -} - -QModelIndex TransactionModel::indexOf(Transaction *trans) const -{ - int row = m_transactions.indexOf(trans); - QModelIndex ret = index(row); - Q_ASSERT(!trans || ret.isValid()); - return ret; -} - -QModelIndex TransactionModel::indexOf(AbstractResource *res) const -{ - Transaction *trans = transactionFromResource(res); - - return indexOf(trans); -} - -void TransactionModel::addTransaction(Transaction *trans) -{ - if (m_transactions.contains(trans)) - return; - - if (m_transactions.isEmpty()) - emit startingFirstTransaction(); - - // Connect all notify signals to our transactionChanged slot - const QMetaObject *meta = trans->metaObject(); - const QMetaMethod notifySlot = metaObject()->method(metaObject()->indexOfSlot("transactionChanged()")); - for (int i = 0; i < meta->propertyCount(); ++i) { - QMetaProperty prop = meta->property(i); - - if (prop.notifySignalIndex() == -1) - continue; - - const QMetaMethod notifySignal = prop.notifySignal(); - connect(trans, notifySignal, this, notifySlot); - } - - int before = m_transactions.size(); - beginInsertRows(QModelIndex(), before, before + 1); - m_transactions.append(trans); - endInsertRows(); - emit transactionAdded(trans); -} - -void TransactionModel::cancelTransaction(Transaction *trans) -{ - removeTransaction(trans); - - emit transactionCancelled(trans); -} - -void TransactionModel::removeTransaction(Transaction *trans) -{ - int r = indexOf(trans).row(); - beginRemoveRows(QModelIndex(), r, r); - m_transactions.removeAt(r); - endRemoveRows(); - emit transactionRemoved(trans); - if (m_transactions.isEmpty()) - emit lastTransactionFinished(); -} - -bool TransactionModel::removeRows(int row, int count, const QModelIndex &parent) -{ - if(parent.isValid()) - return false; - - for(; count>0; ++row, --count) { - QModelIndex child = index(row); - Transaction *trans = transactionFromIndex(child); - if(!trans) - continue; - - beginRemoveRows(parent, row, row); - int c = m_transactions.removeAll(trans); - Q_ASSERT(c==1); - endRemoveRows(); - emit transactionRemoved(trans); - } - if (m_transactions.isEmpty()) - emit lastTransactionFinished(); - return true; -} - -void TransactionModel::transactionChanged() -{ - Transaction *trans = qobject_cast<Transaction *>(sender()); - QModelIndex transIdx = indexOf(trans); - emit dataChanged(transIdx, transIdx); -} diff --git a/libmuon/Transaction/TransactionModel.h b/libmuon/Transaction/TransactionModel.h deleted file mode 100644 index 2a6c9e3..0000000 --- a/libmuon/Transaction/TransactionModel.h +++ /dev/null @@ -1,77 +0,0 @@ -/*************************************************************************** - * Copyright © 2012 Jonathan Thomas <echidnaman@kubuntu.org> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef TRANSACTIONMODEL_H -#define TRANSACTIONMODEL_H - -#include <QAbstractListModel> - -#include "Transaction.h" - -#include "libMuonCommon_export.h" - -class MUONCOMMON_EXPORT TransactionModel : public QAbstractListModel -{ - Q_OBJECT - Q_PROPERTY(int count READ rowCount NOTIFY countChanged) -public: - enum Roles { - TransactionRoleRole = Qt::UserRole, - TransactionStatusRole, - CancellableRole, - ProgressRole, - StatusTextRole, - ResourceRole - }; - - explicit TransactionModel(QObject *parent = nullptr); - static TransactionModel *global(); - - // Reimplemented from QAbstractListModel - int rowCount(const QModelIndex &parent = QModelIndex()) const override; - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; - bool removeRows(int row, int count, const QModelIndex &parent) override; - virtual QHash<int, QByteArray> roleNames() const override; - - Transaction *transactionFromIndex(const QModelIndex &index) const; - Q_SCRIPTABLE Transaction *transactionFromResource(AbstractResource *resource) const; - QModelIndex indexOf(Transaction *trans) const; - QModelIndex indexOf(AbstractResource *res) const; - - void addTransaction(Transaction *trans); - void cancelTransaction(Transaction *trans); - void removeTransaction(Transaction *trans); - -private: - QVector<Transaction *> m_transactions; - -signals: - void startingFirstTransaction(); - void lastTransactionFinished(); - void transactionAdded(Transaction *trans); - void transactionCancelled(Transaction *trans); - void transactionRemoved(Transaction* trans); - void countChanged(); - -private slots: - void transactionChanged(); -}; - -#endif // TRANSACTIONMODEL_H diff --git a/libmuon/UpdateModel/UpdateItem.cpp b/libmuon/UpdateModel/UpdateItem.cpp deleted file mode 100644 index 0ac84b3..0000000 --- a/libmuon/UpdateModel/UpdateItem.cpp +++ /dev/null @@ -1,230 +0,0 @@ -/*************************************************************************** - * Copyright © 2011 Jonathan Thomas <echidnaman@kubuntu.org> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "UpdateItem.h" -#include <resources/AbstractResource.h> -#include <resources/AbstractResourcesBackend.h> -#include <resources/AbstractBackendUpdater.h> - -#include <QtCore/QStringBuilder> -#include <KLocalizedString> -#include <QDebug> - -UpdateItem::UpdateItem() - : m_app(nullptr) - , m_parent(nullptr) - , m_type(ItemType::RootItem) -{ -} - -UpdateItem::UpdateItem(QString categoryName, - QIcon categoryIcon) - : m_app(nullptr) - , m_parent(nullptr) - , m_type(ItemType::CategoryItem) - , m_categoryName(std::move(categoryName)) - , m_categoryIcon(std::move(categoryIcon)) -{ -} - -UpdateItem::UpdateItem(AbstractResource *app, UpdateItem *parent) - : m_app(app) - , m_parent(parent) - , m_type(ItemType::ApplicationItem) -{ -} - -UpdateItem::~UpdateItem() -{ - qDeleteAll(m_children); -} - -UpdateItem *UpdateItem::parent() const -{ - return m_parent; -} - -void UpdateItem::setParent(UpdateItem *parent) -{ - m_parent = parent; -} - -void UpdateItem::appendChild(UpdateItem *child) -{ - if(!m_children.contains(child)) { - child->setParent(this); - m_children.append(child); - } -} - -bool UpdateItem::removeChildren(int position, int count) -{ - if (position < 0 || position > m_children.size()) - return false; - - for (int row = 0; row < count; ++row) - delete m_children.takeAt(position); - - return true; -} - -QList<UpdateItem *> UpdateItem::children() const -{ - return m_children; -} - -UpdateItem *UpdateItem::child(int row) const -{ - return m_children.value(row); -} - -int UpdateItem::childCount() const -{ - return m_children.count(); -} - -bool UpdateItem::isEmpty() const -{ - return m_children.isEmpty(); -} - -int UpdateItem::row() const -{ - if (m_parent) - return m_parent->m_children.indexOf(const_cast<UpdateItem*>(this)); - - return 0; -} - -void UpdateItem::sort() -{ - qSort(m_children.begin(), m_children.end(), - [](UpdateItem *a, UpdateItem *b) { return a->name() < b->name(); }); -} - -AbstractResource *UpdateItem::app() const -{ - return m_app; -} - -QString UpdateItem::name() const -{ - switch (type()) { - case ItemType::CategoryItem: - return m_categoryName; - case ItemType::ApplicationItem: - return m_app->name(); - default: - break; - } - - return QString(); -} - -QString UpdateItem::version() const -{ - switch (type()) { - case ItemType::ApplicationItem: - return m_app->availableVersion(); - case ItemType::CategoryItem: - default: - break; - } - - return QString(); -} - -QIcon UpdateItem::icon() const -{ - switch (type()) { - case ItemType::CategoryItem: - return m_categoryIcon; - case ItemType::ApplicationItem: - return QIcon::fromTheme(m_app->icon()); - default: - return QIcon(); - } - - return QIcon(); -} - -qint64 UpdateItem::size() const -{ - ItemType itemType = type(); - int size = 0; - - if (itemType == ItemType::ApplicationItem) { - size = m_app->size(); - } else if (itemType == ItemType::CategoryItem) { - foreach (UpdateItem *item, m_children) { - size += item->app()->size(); - } - } - - return size; -} - -static bool isMarked(AbstractResource* res) -{ - return res->backend()->backendUpdater()->isMarked(res); -} - -Qt::CheckState UpdateItem::checked() const -{ - Qt::CheckState ret = Qt::Unchecked; - - switch (type()) { - case ItemType::CategoryItem: { - int checkedCount = 0; - foreach(UpdateItem* child, children()) { - checkedCount += isMarked(child->app()); - } - ret = checkedCount==0 ? Qt::Unchecked : - checkedCount==childCount() ? Qt::Checked : Qt::PartiallyChecked; - } break; - case ItemType::ApplicationItem: - Q_ASSERT(app()); - ret = isMarked(app()) ? Qt::Checked : Qt::Unchecked; - break; - case ItemType::RootItem: - case ItemType::InvalidItem: - break; - } - - return ret; -} - -UpdateItem::ItemType UpdateItem::type() const -{ - return m_type; -} - -int UpdateItem::checkedItems() const -{ - if (m_app) - return checked()!=Qt::Unchecked ? 1 : 0; - else { - int ret = 0; - foreach(UpdateItem* item, children()) { - ret += item->checkedItems(); - } - return ret; - } -} diff --git a/libmuon/UpdateModel/UpdateItem.h b/libmuon/UpdateModel/UpdateItem.h deleted file mode 100644 index b88d946..0000000 --- a/libmuon/UpdateModel/UpdateItem.h +++ /dev/null @@ -1,82 +0,0 @@ -/*************************************************************************** - * Copyright © 2011 Jonathan Thomas <echidnaman@kubuntu.org> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef UPDATEITEM_H -#define UPDATEITEM_H - -// Qt includes -#include <QtCore/QList> -#include <QtCore/QString> -#include "libMuonCommon_export.h" - -#include <QIcon> - -class AbstractResource; -class MUONCOMMON_EXPORT UpdateItem -{ -public: - enum class ItemType : quint8 { - InvalidItem = 0, - RootItem, - CategoryItem, - ApplicationItem - }; - - UpdateItem(); - UpdateItem(QString categoryName, - QIcon categoryIcon); - explicit UpdateItem(AbstractResource *app, UpdateItem *parent = nullptr); - - ~UpdateItem(); - - UpdateItem *parent() const; - void setParent(UpdateItem *parent); - - void appendChild(UpdateItem *child); - bool removeChildren(int position, int count); - QList<UpdateItem *> children() const; - UpdateItem *child(int row) const; - int childCount() const; - int row() const; - void sort(); - bool isEmpty() const; - - AbstractResource *app() const; - QString name() const; - QString version() const; - QIcon icon() const; - qint64 size() const; - Qt::CheckState checked() const; - ItemType type() const; - - int checkedItems() const; - AbstractResource* resource() const { return m_app; } - -private: - AbstractResource *m_app; - - UpdateItem *m_parent; - ItemType m_type; - QList<UpdateItem *> m_children; - QString m_categoryName; - QIcon m_categoryIcon; -}; - -#endif // UPDATEITEM_H diff --git a/libmuon/UpdateModel/UpdateModel.cpp b/libmuon/UpdateModel/UpdateModel.cpp deleted file mode 100644 index f666a36..0000000 --- a/libmuon/UpdateModel/UpdateModel.cpp +++ /dev/null @@ -1,338 +0,0 @@ -/*************************************************************************** - * Copyright © 2011 Jonathan Thomas <echidnaman@kubuntu.org> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "UpdateModel.h" - -// Qt includes -#include <QFont> -#include <QApplication> -#include <QDebug> - -// KDE includes -#include <KIconLoader> -#include <KFormat> -#include <KLocalizedString> - -// Own includes -#include "UpdateItem.h" -#include <resources/AbstractResource.h> -#include <resources/ResourcesUpdatesModel.h> -#include <resources/ResourcesModel.h> - -UpdateModel::UpdateModel(QObject *parent) - : QAbstractItemModel(parent) - , m_updates(nullptr) - , m_updatesCount(0) -{ - m_rootItem = new UpdateItem(); - - connect(ResourcesModel::global(), &ResourcesModel::fetchingChanged, this, &UpdateModel::activityChanged); - connect(ResourcesModel::global(), &ResourcesModel::updatesCountChanged, this, &UpdateModel::activityChanged); -} - -UpdateModel::~UpdateModel() -{ - delete m_rootItem; -} - -QHash<int,QByteArray> UpdateModel::roleNames() const -{ - return QAbstractItemModel::roleNames().unite({ - { Qt::CheckStateRole, "checked" }, - { ResourceRole, "resource" }, - { SizeRole, "size" }, - { VersionRole, "version" } - } ); -} - -void UpdateModel::setBackend(ResourcesUpdatesModel* updates) -{ - if (m_updates) { - disconnect(m_updates, nullptr, this, nullptr); - } - - m_updates = updates; - - connect(m_updates, &ResourcesUpdatesModel::progressingChanged, this, &UpdateModel::activityChanged); - - activityChanged(); -} - -void UpdateModel::activityChanged() -{ - if(ResourcesModel::global()->isFetching()) { - setResources(QList<AbstractResource*>()); - } else if(!m_updates->isProgressing()) { - m_updates->prepare(); - setResources(m_updates->toUpdate()); - } -} - -QVariant UpdateModel::data(const QModelIndex &index, int role) const -{ - if (!index.isValid()) { - return QVariant(); - } - - UpdateItem *item = static_cast<UpdateItem*>(index.internalPointer()); - int column = index.column(); - - switch (role) { - case Qt::DisplayRole: - switch (column) { - case NameColumn: - return item->name(); - case VersionColumn: - return item->version(); - case SizeColumn: - return KFormat().formatByteSize(item->size()); - } - break; - case Qt::DecorationRole: - if (column == NameColumn) { - return item->icon(); - } - break; - case Qt::FontRole: { - QFont font; - if ((item->type() == UpdateItem::ItemType::CategoryItem) && column == SizeColumn) { - font.setBold(true); - return font; - } - return font; - } - case Qt::CheckStateRole: - if (column == NameColumn) { - return item->checked(); - } - break; - case VersionRole: - return item->version(); - case SizeRole: - return KFormat().formatByteSize(item->size()); - case ResourceRole: - return QVariant::fromValue<QObject*>(item->resource()); - default: - break; - } - - return QVariant(); -} - -void UpdateModel::checkResources(const QList<AbstractResource*>& resource, bool checked) -{ - if (resource.size() > 1) { - QApplication::setOverrideCursor(Qt::WaitCursor); - } - if(checked) - m_updates->addResources(resource); - else - m_updates->removeResources(resource); - QApplication::restoreOverrideCursor(); -} - -QVariant UpdateModel::headerData(int section, Qt::Orientation orientation, - int role) const -{ - if (orientation == Qt::Horizontal && role == Qt::DisplayRole) - { - switch (section) { - case NameColumn: - return i18nc("@label Column label", "Updates"); - case VersionColumn: - return i18nc("@label Column label", "Version"); - case SizeColumn: - return i18nc("@label Column label", "Download Size"); - } - } - - return QVariant(); -} - -Qt::ItemFlags UpdateModel::flags(const QModelIndex &index) const -{ - if (!index.isValid()) - return nullptr; - - return Qt::ItemIsEnabled | Qt::ItemIsSelectable; -} - -QModelIndex UpdateModel::index(int row, int column, const QModelIndex &index) const -{ - // Bounds checks - if (!m_rootItem || row < 0 || column < 0 || column > 3 || - (index.isValid() && index.column() != 0)) { - return QModelIndex(); - } - - if (UpdateItem *parent = itemFromIndex(index)) { - if (UpdateItem *childItem = parent->child(row)) - return createIndex(row, column, childItem); - } - - return QModelIndex(); -} - -QModelIndex UpdateModel::parent(const QModelIndex &index) const -{ - if (!index.isValid()) { - return QModelIndex(); - } - - UpdateItem *childItem = itemFromIndex(index); - UpdateItem *parentItem = childItem->parent(); - - if (parentItem == m_rootItem) { - return QModelIndex(); - } - - return createIndex(parentItem->row(), 0, parentItem); -} - -int UpdateModel::rowCount(const QModelIndex &parent) const -{ - if (parent.isValid() && parent.column() != 0) - return 0; - - UpdateItem *parentItem = itemFromIndex(parent); - - return parentItem ? parentItem->childCount() : 0; -} - -int UpdateModel::columnCount(const QModelIndex &parent) const -{ - Q_UNUSED(parent); - return 3; -} - -UpdateItem* UpdateModel::itemFromIndex(const QModelIndex &index) const -{ - if (index.isValid()) - return static_cast<UpdateItem*>(index.internalPointer()); - return m_rootItem; -} - -bool UpdateModel::setData(const QModelIndex &idx, const QVariant &value, int role) -{ - if (role == Qt::CheckStateRole) { - UpdateItem *item = static_cast<UpdateItem*>(idx.internalPointer()); - bool newValue = value.toBool(); - UpdateItem::ItemType type = item->type(); - - QList<AbstractResource *> apps; - if (type == UpdateItem::ItemType::CategoryItem) { - // Collect items to (un)check - foreach (UpdateItem *child, item->children()) { - apps << child->app(); - } - } else if (type == UpdateItem::ItemType::ApplicationItem) { - apps << item->app(); - } - - checkResources(apps, newValue); - emit dataChanged(idx, idx); - if (type == UpdateItem::ItemType::ApplicationItem) { - QModelIndex parentIndex = idx.parent(); - emit dataChanged(parentIndex, parentIndex); - } else { - emit dataChanged(index(0,0, idx), index(item->childCount()-1, 0, idx)); - } - - Q_EMIT toUpdateChanged(); - - return true; - } - - return false; -} - -void UpdateModel::setResources(const QList< AbstractResource* >& resources) -{ - beginResetModel(); - delete m_rootItem; - m_rootItem = new UpdateItem; - - UpdateItem *securityItem = new UpdateItem(i18nc("@item:inlistbox", "Important Security Updates"), - QIcon::fromTheme("security-medium")); - - UpdateItem *appItem = new UpdateItem(i18nc("@item:inlistbox", "Application Updates"), - QIcon::fromTheme("applications-other")); - - UpdateItem *systemItem = new UpdateItem(i18nc("@item:inlistbox", "System Updates"), - QIcon::fromTheme("applications-system")); - - foreach(AbstractResource* res, resources) { - UpdateItem *updateItem = new UpdateItem(res); - if (res->isFromSecureOrigin()) { - securityItem->appendChild(updateItem); - } else if(!res->isTechnical()) { - appItem->appendChild(updateItem); - } else { - systemItem->appendChild(updateItem); - } - } - - // Add populated items to the model - if (securityItem->childCount()) { - securityItem->sort(); - m_rootItem->appendChild(securityItem); - } else { - delete securityItem; - } - - if (appItem->childCount()) { - appItem->sort(); - m_rootItem->appendChild(appItem); - } else { - delete appItem; - } - - if (systemItem->childCount()) { - systemItem->sort(); - m_rootItem->appendChild(systemItem); - } else { - delete systemItem; - } - endResetModel(); - - m_updatesCount = resources.count(); - - Q_EMIT hasUpdatesChanged(!resources.isEmpty()); -} - -bool UpdateModel::hasUpdates() const -{ - return rowCount() > 0; -} - -ResourcesUpdatesModel* UpdateModel::backend() const -{ - return m_updates; -} - -int UpdateModel::totalUpdatesCount() const -{ - return m_updatesCount; -} - -int UpdateModel::toUpdateCount() const -{ - return m_rootItem->checkedItems(); -} diff --git a/libmuon/UpdateModel/UpdateModel.h b/libmuon/UpdateModel/UpdateModel.h deleted file mode 100644 index 74d685b..0000000 --- a/libmuon/UpdateModel/UpdateModel.h +++ /dev/null @@ -1,97 +0,0 @@ -/*************************************************************************** - * Copyright © 2011 Jonathan Thomas <echidnaman@kubuntu.org> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef UPDATEMODEL_H -#define UPDATEMODEL_H - -#include <QtCore/QAbstractItemModel> -#include "libMuonCommon_export.h" - -class ResourcesUpdatesModel; -class AbstractResource; -class UpdateItem; - -class MUONCOMMON_EXPORT UpdateModel : public QAbstractItemModel -{ - Q_OBJECT - Q_PROPERTY(ResourcesUpdatesModel* backend READ backend WRITE setBackend) - Q_PROPERTY(bool hasUpdates READ hasUpdates NOTIFY hasUpdatesChanged) - Q_PROPERTY(int toUpdateCount READ toUpdateCount NOTIFY toUpdateChanged) - Q_PROPERTY(int totalUpdatesCount READ totalUpdatesCount NOTIFY hasUpdatesChanged) -public: - - enum Roles { - VersionRole = Qt::UserRole + 1, - SizeRole, - ResourceRole - }; - - explicit UpdateModel(QObject *parent = nullptr); - ~UpdateModel(); - - QVariant data(const QModelIndex &index, int role) const override; - QVariant headerData(int section, Qt::Orientation orientation, - int role) const override; - Qt::ItemFlags flags(const QModelIndex &index) const override; - QModelIndex index(int row, int column, - const QModelIndex &parent = QModelIndex()) const override; - QModelIndex parent(const QModelIndex &index) const override; - int rowCount(const QModelIndex &parent = QModelIndex()) const override; - int columnCount(const QModelIndex &parent = QModelIndex()) const override; - - bool setData(const QModelIndex &index, const QVariant &value, int role) override; - void setResources(const QList<AbstractResource*>& res); - UpdateItem *itemFromIndex(const QModelIndex &index) const; - - void checkResources(const QList< AbstractResource* >& resource, bool checked); - QHash<int,QByteArray> roleNames() const override; - - bool hasUpdates() const; - - ///all upgradeable packages - int totalUpdatesCount() const; - - ///packages marked to upgrade - int toUpdateCount() const; - - enum Columns { - NameColumn = 0, - VersionColumn, - SizeColumn - }; - ResourcesUpdatesModel* backend() const; - -public Q_SLOTS: - void setBackend(ResourcesUpdatesModel* updates); - -Q_SIGNALS: - void hasUpdatesChanged(bool hasUpdates); - void toUpdateChanged(); - -private: - void activityChanged(); - - void addResource(AbstractResource* res); - UpdateItem *m_rootItem; - ResourcesUpdatesModel* m_updates; - int m_updatesCount; -}; - -#endif // UPDATEMODEL_H diff --git a/libmuon/backends/AkabeiBackend/AkabeiBackend.cpp b/libmuon/backends/AkabeiBackend/AkabeiBackend.cpp deleted file mode 100644 index 392c9cd..0000000 --- a/libmuon/backends/AkabeiBackend/AkabeiBackend.cpp +++ /dev/null @@ -1,209 +0,0 @@ -/*************************************************************************** - * Copyright © 2013 Lukas Appelhans <boom1992@chakra-project.org> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ -#include "AkabeiBackend.h" -#include "AkabeiResource.h" -#include "AkabeiTransaction.h" -#include "AppAkabeiResource.h" -#include "AppstreamUtils.h" -#include <Transaction/TransactionModel.h> -#include <akabeiclient/akabeiclientbackend.h> -#include <akabeicore/akabeidatabase.h> -#include <akabeicore/akabeiconfig.h> - -#include <QQueue> - -#include <KPluginFactory> -#include <KLocalizedString> -#include <KAboutData> -#include <KDebug> - -MUON_BACKEND_PLUGIN(AkabeiBackend); - -AkabeiBackend::AkabeiBackend(QObject* parent) - : AbstractResourcesBackend(parent), m_updater(new AkabeiUpdater(this)), m_isFetching(false) -{ - m_transactionQueue.clear(); - kDebug() << "CONSTRUCTED"; - connect(AkabeiClient::Backend::instance(), SIGNAL(statusChanged(Akabei::Backend::Status)), SLOT(statusChanged(Akabei::Backend::Status))); - - /* Used to determine whether debugging prints are to be displayed later */ - Akabei::Config::instance()->setDebug(true); - - QLocale systemLocale = QLocale::system(); - AkabeiClient::Backend::instance()->setLocale( systemLocale.name() ); - AkabeiClient::Backend::instance()->initialize(); -} - -AkabeiBackend::~AkabeiBackend() -{ - Akabei::Backend::instance()->deInit(); -} - -void AkabeiBackend::statusChanged(Akabei::Backend::Status status) -{ - kDebug() << "Status changed to" << status; - if (status == Akabei::Backend::StatusReady && m_packages.isEmpty()) { - reload(); - } -} - -void AkabeiBackend::reload() -{ - m_isFetching = true; - emit fetchingChanged(); - m_appdata = AppstreamUtils::fetchAppData("/usr/share/app-info/appdata.xml"); - kDebug() << "get packages"; - connect(Akabei::Backend::instance(), SIGNAL(queryPackagesCompleted(QUuid,QList<Akabei::Package*>)), SLOT(queryComplete(QUuid,QList<Akabei::Package*>))); - Akabei::Backend::instance()->packages(); -} - -void AkabeiBackend::queryComplete(QUuid,QList<Akabei::Package*> packages) -{ - disconnect(Akabei::Backend::instance(), SIGNAL(queryPackagesCompleted(QUuid,QList<Akabei::Package*>)), this, SLOT(queryComplete(QUuid,QList<Akabei::Package*>))); - kDebug() << "Got" << packages.count() << "packages"; - QHash<QString, AbstractResource*> pkgs; - foreach (Akabei::Package * pkg, packages) { - if (pkgs.contains(pkg->name())) { - qobject_cast<AkabeiResource*>(pkgs[pkg->name()])->addPackage(pkg); - } else if (m_packages.contains(pkg->name())) { - AkabeiResource * res = qobject_cast<AkabeiResource*>(m_packages[pkg->name()]); - res->clearPackages(); - res->addPackage(pkg); - pkgs.insert(pkg->name(), res); - } else { - if (m_appdata.contains(pkg->name())) { - pkgs.insert(pkg->name(), new AppAkabeiResource(m_appdata[pkg->name()], pkg, this)); - } else { - pkgs.insert(pkg->name(), new AkabeiResource(pkg, this)); - } - } - } - m_packages = pkgs; - m_isFetching = false; - emit fetchingChanged(); - if (m_transactionQueue.count() >= 1) { - AkabeiTransaction * trans = m_transactionQueue.first(); - trans->start(); - } -} - -bool AkabeiBackend::isValid() const -{ - return Akabei::Backend::instance()->status() != Akabei::Backend::StatusBroken; -} - -AbstractReviewsBackend* AkabeiBackend::reviewsBackend() const -{ - return nullptr; -} - -AbstractResource* AkabeiBackend::resourceByPackageName(const QString& name) const -{ - return m_packages[name]; -} - -int AkabeiBackend::updatesCount() const -{ - int count = 0; - Q_FOREACH (AbstractResource * res, m_packages.values()) { - if (!res->isTechnical() && res->canUpgrade()) - count++; - } - return count; -} - -QVector< AbstractResource* > AkabeiBackend::allResources() const -{ - return m_packages.values().toVector(); -} - -QList< AbstractResource* > AkabeiBackend::searchPackageName(const QString& searchText) -{ - QList<AbstractResource*> result; - Q_FOREACH (AbstractResource * res, m_packages.values()) { - if (res->name().contains(searchText, Qt::CaseInsensitive) || res->comment().contains(searchText, Qt::CaseInsensitive)) - result << res; - } - return result; -} - -void AkabeiBackend::installApplication(AbstractResource* app, AddonList addons) -{ - Transaction::Role role = Transaction::InstallRole; - if (app->isInstalled() && !app->canUpgrade()) { - role = Transaction::ChangeAddonsRole; - } - AkabeiTransaction * trans = new AkabeiTransaction(this, app, role, addons); - TransactionModel::global()->addTransaction(trans); - m_transactionQueue.enqueue(trans); - if (m_transactionQueue.count() <= 1) - trans->start(); -} - -void AkabeiBackend::installApplication(AbstractResource* app) -{ - AkabeiTransaction * trans = new AkabeiTransaction(this, app, Transaction::InstallRole); - TransactionModel::global()->addTransaction(trans); - m_transactionQueue.enqueue(trans); - if (m_transactionQueue.count() <= 1) - trans->start(); -} - -void AkabeiBackend::removeApplication(AbstractResource* app) -{ - AkabeiTransaction * trans = new AkabeiTransaction(this, app, Transaction::RemoveRole); - TransactionModel::global()->addTransaction(trans); - m_transactionQueue.enqueue(trans); - if (m_transactionQueue.count() <= 1) - trans->start(); -} - -void AkabeiBackend::removeFromQueue(AkabeiTransaction* trans) -{ - m_transactionQueue.removeAll(trans); - TransactionModel::global()->removeTransaction(trans); - reload(); -} - -bool AkabeiBackend::isTransactionRunning() const -{ - return !m_transactionQueue.isEmpty(); -} - -void AkabeiBackend::cancelTransaction(AbstractResource* app) -{ - -} - -AbstractBackendUpdater* AkabeiBackend::backendUpdater() const -{ - return m_updater; -} - -QList< AbstractResource* > AkabeiBackend::upgradeablePackages() const -{ - QList<AbstractResource*> resources; - Q_FOREACH (AbstractResource * res, m_packages.values()) { - if (!res->isTechnical() && res->canUpgrade()) - resources << res; - } - return resources; -} - diff --git a/libmuon/backends/AkabeiBackend/AkabeiBackend.h b/libmuon/backends/AkabeiBackend/AkabeiBackend.h deleted file mode 100644 index 1db9dae..0000000 --- a/libmuon/backends/AkabeiBackend/AkabeiBackend.h +++ /dev/null @@ -1,90 +0,0 @@ -/*************************************************************************** - * Copyright © 2013 Lukas Appelhans <boom1992@chakra-project.org> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef MUONAKABEIBACKEND_H -#define MUONAKABEIBACKEND_H - -#include <libMuonCommon_export.h> -#include "resources/AbstractResourcesBackend.h" -#include "AkabeiUpdater.h" -#include <QVariantList> -#include <QUuid> -#include <QQueue> -#include <akabeicore/akabeibackend.h> - -class AkabeiTransaction; - -struct ApplicationData -{ - QString pkgname; - QString id; - QHash<QString, QString> name; - QHash<QString, QString> summary; - QString icon; - QString url; - QHash<QString, QStringList> keywords; - QStringList appcategories; - QStringList mimetypes; -}; - -class MUONCOMMON_EXPORT AkabeiBackend : public AbstractResourcesBackend -{ - Q_OBJECT -public: - explicit AkabeiBackend(QObject *parent = 0); - ~AkabeiBackend(); - - bool isValid() const; - AbstractReviewsBackend *reviewsBackend() const; - Q_SCRIPTABLE AbstractResource* resourceByPackageName(const QString& name) const; - - int updatesCount() const; - - QVector< AbstractResource* > allResources() const; - QList<AbstractResource*> searchPackageName(const QString& searchText); - - void installApplication(AbstractResource *app, AddonList addons); - void installApplication(AbstractResource *app); - void removeApplication(AbstractResource *app); - void cancelTransaction(AbstractResource *app); - - AbstractBackendUpdater* backendUpdater() const; - virtual QList<AbstractResource*> upgradeablePackages() const; - - void removeFromQueue(AkabeiTransaction * trans); - - bool isTransactionRunning() const; - - virtual bool isFetching() const { return m_isFetching; } - -public slots: - void statusChanged(Akabei::Backend::Status); - void queryComplete(QUuid,QList<Akabei::Package*>); - void reload(); - -private: - QHash<QString, AbstractResource*> m_packages; - QQueue<AkabeiTransaction*> m_transactionQueue; - AkabeiUpdater * m_updater; - QHash<QString, ApplicationData> m_appdata; - bool m_isFetching; -}; - -#endif diff --git a/libmuon/backends/AkabeiBackend/AkabeiNotifier.cpp b/libmuon/backends/AkabeiBackend/AkabeiNotifier.cpp deleted file mode 100644 index 4c8b17b..0000000 --- a/libmuon/backends/AkabeiBackend/AkabeiNotifier.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright 2013 Lukas Appelhans <l.appelhans@gmx.de> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License or (at your option) version 3 or any later version - * accepted by the membership of KDE e.V. (or its successor approved - * by the membership of KDE e.V.), which shall act as a proxy - * defined in Section 14 of version 3 of the license. - * - * 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, see <http://www.gnu.org/licenses/>. - * - */ -#include "AkabeiNotifier.h" - -#include <QTimer> -#include <KPluginFactory> -#include <akabeiclientbackend.h> -#include <akabeiconfig.h> -#include <akabeihelpers.h> -#include <akabeidatabase.h> - -K_PLUGIN_FACTORY(MuonAkabeiNotifierFactory, - registerPlugin<AkabeiNotifier>(); - ) -K_EXPORT_PLUGIN(MuonAkabeiNotifierFactory("muon-akabei-notifier")) - -const int UPDATE_INTERVAL = 1000 * 60 * 30;//30 min - -AkabeiNotifier::AkabeiNotifier(QObject* parent, const QVariantList &) - : AbstractKDEDModule("akabei", "muondiscover", parent), - m_timer(new QTimer(this)) -{ - m_timer->setInterval(UPDATE_INTERVAL); - connect(m_timer, SIGNAL(timeout()), SLOT(recheckSystemUpdateNeeded())); - - QTimer::singleShot(10 * 1000, this, SLOT(init())); -} - -AkabeiNotifier::~AkabeiNotifier() -{ -} - -void AkabeiNotifier::init() -{ - connect(AkabeiClient::Backend::instance(), SIGNAL(statusChanged(Akabei::Backend::Status)), SLOT(backendStateChanged(Akabei::Backend::Status))); - - /* Used to determine whether debugging prints are to be displayed later */ - Akabei::Config::instance()->setDebug(true); - - AkabeiClient::Backend::instance()->initialize(); -} - -void AkabeiNotifier::backendStateChanged(Akabei::Backend::Status status) -{ - if (status == Akabei::Backend::StatusReady) { - Akabei::Package::List toBeUpgraded; - - foreach (Akabei::Package *p, Akabei::Backend::instance()->localDatabase()->packages()) { - Akabei::Package *latest = Akabei::Helpers::latestVersionOfPackage(p->name()); - - if (latest && (latest->version() > p->version())) { - toBeUpgraded.append(latest); - } - } - - if (!toBeUpgraded.isEmpty()) { - setSystemUpToDate(false, toBeUpgraded.count()); - } else { - setSystemUpToDate(true); - } - m_timer->start(); - } -} - -void AkabeiNotifier::recheckSystemUpdateNeeded() -{ - m_timer->stop(); - AkabeiClient::Backend::instance()->updateDatabase(); -} - diff --git a/libmuon/backends/AkabeiBackend/AkabeiNotifier.h b/libmuon/backends/AkabeiBackend/AkabeiNotifier.h deleted file mode 100644 index adc3105..0000000 --- a/libmuon/backends/AkabeiBackend/AkabeiNotifier.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2013 Lukas Appelhans <l.appelhans@gmx.de> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License or (at your option) version 3 or any later version - * accepted by the membership of KDE e.V. (or its successor approved - * by the membership of KDE e.V.), which shall act as a proxy - * defined in Section 14 of version 3 of the license. - * - * 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, see <http://www.gnu.org/licenses/>. - * - */ - -#ifndef AKABEINOTIFIER_H -#define AKABEINOTIFIER_H - -#include <resources/AbstractKDEDModule.h> -#include <akabeibackend.h> -#include <QVariantList> - -class QTimer; - -class AkabeiNotifier : public AbstractKDEDModule -{ - Q_OBJECT - Q_CLASSINFO("D-Bus Interface", "org.kde.muon.akabei") -public: - AkabeiNotifier(QObject* parent, const QVariantList &); - ~AkabeiNotifier(); - -public slots: - virtual Q_SCRIPTABLE void recheckSystemUpdateNeeded(); - -private slots: - void backendStateChanged(Akabei::Backend::Status status); - void init(); - -private: - QTimer * m_timer; -}; - -#endif // AKABEINOTIFIER_H diff --git a/libmuon/backends/AkabeiBackend/AkabeiQuestion.cpp b/libmuon/backends/AkabeiBackend/AkabeiQuestion.cpp deleted file mode 100644 index d07ff4c..0000000 --- a/libmuon/backends/AkabeiBackend/AkabeiQuestion.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright 2013 Lukas Appelhans <l.appelhans@gmx.de> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License or (at your option) version 3 or any later version - * accepted by the membership of KDE e.V. (or its successor approved - * by the membership of KDE e.V.), which shall act as a proxy - * defined in Section 14 of version 3 of the license. - * - * 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, see <http://www.gnu.org/licenses/>. - * - */ - -#include "AkabeiQuestion.h" -#include <QBoxLayout> -#include <QLabel> -#include <QButtonGroup> -#include <qlayoutitem.h> -#include <KPushButton> -#include <KDebug> - -AkabeiQuestion::AkabeiQuestion(AkabeiClient::TransactionQuestion* question, QWidget* parent) - : KDialog(parent), - m_question(question), - m_buttonGroup(0) -{ - setButtons(KDialog::None); - - QWidget * mainWidget = new QWidget(this); - - QVBoxLayout * layout = new QVBoxLayout(mainWidget); - - QHBoxLayout * buttonLayout = new QHBoxLayout(); - - QLabel * quest = new QLabel(question->question(), mainWidget); - layout->addWidget(quest); - - m_buttonGroup = new QButtonGroup(this); - - buttonLayout->addSpacerItem(new QSpacerItem(50, 30, QSizePolicy::Expanding, QSizePolicy::Minimum)); - - foreach (const AkabeiClient::TransactionAnswer &answer, question->possibleAnswers()) { - KPushButton * button = new KPushButton(mainWidget); - button->setObjectName(answer.letter); - button->setText(answer.message); - if (question->suggestedAnswer() == answer) { - button->setFocus(); - } - buttonLayout->addWidget(button); - m_buttonGroup->addButton(button); - } - connect(m_buttonGroup, SIGNAL(buttonClicked(QAbstractButton*)), SLOT(buttonClicked(QAbstractButton*))); - layout->addItem(buttonLayout); - - setMainWidget(mainWidget); -} - -void AkabeiQuestion::buttonClicked(QAbstractButton* button) -{ - m_answer = button->objectName(); - accept(); -} - -QString AkabeiQuestion::ask() -{ - KDialog::exec(); - return m_answer; -} diff --git a/libmuon/backends/AkabeiBackend/AkabeiQuestion.h b/libmuon/backends/AkabeiBackend/AkabeiQuestion.h deleted file mode 100644 index 7fb883c..0000000 --- a/libmuon/backends/AkabeiBackend/AkabeiQuestion.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * <one line to give the library's name and an idea of what it does.> - * Copyright 2013 Lukas Appelhans <l.appelhans@gmx.de> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License or (at your option) version 3 or any later version - * accepted by the membership of KDE e.V. (or its successor approved - * by the membership of KDE e.V.), which shall act as a proxy - * defined in Section 14 of version 3 of the license. - * - * 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, see <http://www.gnu.org/licenses/>. - * - */ - -#ifndef AKABEIQUESTION_H -#define AKABEIQUESTION_H - -#include <KDialog> -#include <akabeiclienttransactionhandler.h> - -class QAbstractButton; -class QButtonGroup; -class AkabeiQuestion : public KDialog -{ - Q_OBJECT -public: - AkabeiQuestion(AkabeiClient::TransactionQuestion * question, QWidget * parent = 0); - - QString ask(); - -private slots: - void buttonClicked(QAbstractButton * button); - -private: - AkabeiClient::TransactionQuestion * m_question; - QButtonGroup * m_buttonGroup; - QString m_answer; -}; - -#endif // AKABEIQUESTION_H diff --git a/libmuon/backends/AkabeiBackend/AkabeiResource.cpp b/libmuon/backends/AkabeiBackend/AkabeiResource.cpp deleted file mode 100644 index ea956c1..0000000 --- a/libmuon/backends/AkabeiBackend/AkabeiResource.cpp +++ /dev/null @@ -1,266 +0,0 @@ -/*************************************************************************** - * Copyright © 2013 Lukas Appelhans <boom1992@chakra-project.org> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ -#include "AkabeiResource.h" -#include "AkabeiBackend.h" -#include <QtCore/QStringList> -#include <QFile> -#include <qjson/parser.h>//FIXME: Search in CMakeLists.txt for it? -#include <akabeicore/akabeidatabase.h> -#include <akabeiquery.h> -#include <akabeigroup.h> -#include <kdebug.h> -#include <kstandarddirs.h> -#include <KIO/TransferJob> -#include <KIO/Job> -#include <MuonDataSources.h> - -AkabeiResource::AkabeiResource(Akabei::Package * pkg, AkabeiBackend * parent) - : AbstractResource(parent), - m_pkg(0), - m_installedPkg(0) -{ - addPackage(pkg); -} - -QString AkabeiResource::packageName() const -{ - return m_pkg->name(); -} - -QString AkabeiResource::name() -{ - return m_pkg->name(); -} - -QString AkabeiResource::comment() -{ - return m_pkg->description(); -} - -QString AkabeiResource::longDescription() -{ - return m_pkg->description(); -} - -QString AkabeiResource::icon() const -{ - return "akabei"; -} - -bool AkabeiResource::canExecute() const -{ - return false; -} - -void AkabeiResource::invokeApplication() const -{ -} - -void AkabeiResource::addPackage(Akabei::Package* pkg) -{ - if (pkg->database() == Akabei::Backend::instance()->localDatabase()) { - if (!m_installedPkg || m_installedPkg->version() <= pkg->version()) - m_installedPkg = pkg; - if (!m_pkg) - m_pkg = pkg; - } else if (!m_pkg || m_pkg->version() <= pkg->version()) { - m_pkg = pkg; - } - //if (s != state()) //FIXME: Save the old state before callin clearPackages - emit stateChanged(); -} - -void AkabeiResource::clearPackages() -{ - m_pkg = 0; - m_installedPkg = 0; -} - -AbstractResource::State AkabeiResource::state() -{ - if (m_installedPkg && m_installedPkg->version() >= m_pkg->version()) - return AbstractResource::Installed; - else if (m_installedPkg) - return AbstractResource::Upgradeable; - return AbstractResource::None; -} - -QStringList AkabeiResource::categories() -{ - return QStringList() << "Unknown";//We just rely on appstream for this until it's implemented in akabei -} - -QUrl AkabeiResource::homepage() -{ - return m_pkg->url(); -} - -bool AkabeiResource::isTechnical() const -{ - return true; -} - -QUrl AkabeiResource::thumbnailUrl() -{ - return KUrl(MuonDataSources::screenshotsSource(), "thumbnail/"+packageName()); -} - -QUrl AkabeiResource::screenshotUrl() -{ - if (m_pkg && !m_pkg->screenshot().isEmpty()) { - return m_pkg->screenshot(); - } - return KUrl(MuonDataSources::screenshotsSource(), "screenshot/"+packageName()); -} - -int AkabeiResource::size() -{ - return m_pkg->size(); -} - -QString AkabeiResource::license() -{ - return m_pkg->licenses().join(", "); -} - -QString AkabeiResource::installedVersion() const -{ - if (!m_installedPkg) - return QString(); - return m_installedPkg->version().toByteArray().data(); -} - -QString AkabeiResource::availableVersion() const -{ - return m_pkg->version().toByteArray().data(); -} - -QString AkabeiResource::origin() const -{ - return m_pkg->database()->name(); -} - -QString AkabeiResource::section() -{ - if (m_pkg->groups().isEmpty()) - return "unknown"; - return m_pkg->groups().first()->name();//FIXME: Probably add support for multiple sections? -} - -QStringList AkabeiResource::mimetypes() const -{ - return QStringList(); -} - -QList<PackageState> AkabeiResource::addonsInformation() -{ - QList<PackageState> states; - foreach (const QString &optdep, m_pkg->optionalDependencies()) { - QStringList split = optdep.split(':'); - if (split.count() >= 2) { - bool installed = !Akabei::Backend::instance()->localDatabase()->queryPackages(Akabei::Queries::selectPackages("name", "LIKE", split.first())).isEmpty(); - if (!installed) { - installed = !Akabei::Backend::instance()->localDatabase()->queryPackages("SELECT * FROM packages JOIN provides WHERE provides.provides LIKE \"" + split.first() + '\"').isEmpty(); - } - states.append(PackageState(split.first(), split.at(1), installed)); - } - } - return states; -} - -bool AkabeiResource::isFromSecureOrigin() const -{ - return true; -} - -QStringList AkabeiResource::executables() const -{ - return QStringList(); -} - -Akabei::Package * AkabeiResource::package() const -{ - return m_pkg; -} - -Akabei::Package * AkabeiResource::installedPackage() const -{ - return m_installedPkg; -} - -void AkabeiResource::fetchScreenshots() -{ - QString dest = "/tmp/screenshot." + packageName(); //KStandardDirs::locate("tmp", "screenshots." + packageName()); - - QFile f(dest); - if (f.exists()) - f.remove(); - KUrl packageUrl(MuonDataSources::screenshotsSource(), "/json/package/" + packageName()); - - KIO::Job* getJob = KIO::file_copy(packageUrl, KUrl(dest), -1, KIO::Overwrite | KIO::HideProgressInfo); - connect(getJob, SIGNAL(finished(KJob*)), SLOT(slotScreenshotsFetched(KJob*))); - getJob->start(); -} - -void AkabeiResource::slotScreenshotsFetched(KJob * job) -{ - if (job->error() != KJob::NoError) { - qWarning() << job->errorString(); - } - bool done = false; - QString dest = "/tmp/screenshot." + packageName(); //KStandardDirs::locate("tmp", "screenshots." + packageName()); - - QFile f(dest); - if (f.exists()) { - bool b = f.open(QIODevice::ReadOnly); - Q_ASSERT(b); - - QJson::Parser p; - bool ok; - QVariantMap values = p.parse(&f, &ok).toMap(); - if(ok) { - QVariantList screenshots = values["screenshots"].toList(); - - QList<QUrl> thumbnailUrls, screenshotUrls; - foreach(const QVariant& screenshot, screenshots) { - kDebug() << screenshot; - QVariantMap s = screenshot.toMap(); - thumbnailUrls += s["small_image_url"].toUrl(); - screenshotUrls += s["large_image_url"].toUrl(); - } - emit screenshotsFetched(thumbnailUrls, screenshotUrls); - done = true; - } - } - if(!done) { - QList<QUrl> thumbnails, screenshots; - if(!thumbnailUrl().isEmpty()) { - thumbnails += thumbnailUrl(); - screenshots += screenshotUrl(); - } - emit screenshotsFetched(thumbnails, screenshots); - } -} - -void AkabeiResource::fetchChangelog() -{ - emit changelogFetched(m_pkg->retrieveChangelog()); -} - diff --git a/libmuon/backends/AkabeiBackend/AkabeiResource.h b/libmuon/backends/AkabeiBackend/AkabeiResource.h deleted file mode 100644 index facfdaa..0000000 --- a/libmuon/backends/AkabeiBackend/AkabeiResource.h +++ /dev/null @@ -1,101 +0,0 @@ -/*************************************************************************** - * Copyright © 2013 Lukas Appelhans <boom1992@chakra-project.org> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ -#ifndef AKABEIRESOURCE_H -#define AKABEIRESOURCE_H - -#include <resources/AbstractResource.h> -#include <akabeicore/akabeipackage.h> - -class KJob; -class AkabeiBackend; - -class MUONCOMMON_EXPORT AkabeiResource : public AbstractResource -{ - Q_OBJECT - public: - AkabeiResource(Akabei::Package * pkg, AkabeiBackend * parent); - - ///used as internal identification of a resource - virtual QString packageName() const; - - ///resource name to be displayed - virtual QString name(); - - ///short description of the resource - virtual QString comment(); - - ///xdg-compatible icon name to represent the resource - virtual QString icon() const; - - ///@returns whether invokeApplication makes something - /// false if not overridden - virtual bool canExecute() const; - - ///executes the resource, if applies. - Q_SCRIPTABLE virtual void invokeApplication() const; - - virtual State state(); - - virtual QStringList categories(); - - ///@returns a URL that points to the content - virtual QUrl homepage(); - - virtual bool isTechnical() const; - - virtual QUrl thumbnailUrl(); - virtual QUrl screenshotUrl(); - - virtual int size(); - virtual QString license(); - - virtual QString installedVersion() const; - virtual QString availableVersion() const; - virtual QString longDescription(); - - virtual QString origin() const; - virtual QString section(); - - ///@returns what kind of mime types the resource can consume - virtual QStringList mimetypes() const; - - virtual QList<PackageState> addonsInformation(); - bool isFromSecureOrigin() const; - - virtual QStringList executables() const; - - Akabei::Package * package() const; - Akabei::Package * installedPackage() const; - - public slots: - virtual void fetchScreenshots(); - virtual void fetchChangelog(); - void addPackage(Akabei::Package * pkg); - void clearPackages(); - - private slots: - void slotScreenshotsFetched(KJob *); - - private: - Akabei::Package * m_pkg; - Akabei::Package * m_installedPkg; -}; - -#endif // ABSTRACTRESOURCE_H diff --git a/libmuon/backends/AkabeiBackend/AkabeiTransaction.cpp b/libmuon/backends/AkabeiBackend/AkabeiTransaction.cpp deleted file mode 100644 index 273e625..0000000 --- a/libmuon/backends/AkabeiBackend/AkabeiTransaction.cpp +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Copyright 2013 Lukas Appelhans <l.appelhans@gmx.de> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License or (at your option) version 3 or any later version - * accepted by the membership of KDE e.V. (or its successor approved - * by the membership of KDE e.V.), which shall act as a proxy - * defined in Section 14 of version 3 of the license. - * - * 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, see <http://www.gnu.org/licenses/>. - * - */ - -#include "AkabeiTransaction.h" -#include "AkabeiResource.h" -#include "AkabeiBackend.h" -#include "AkabeiQuestion.h" -#include <Transaction/TransactionModel.h> -#include <akabeiclientqueue.h> -#include <akabeiclientbackend.h> -#include <akabeiclienttransactionhandler.h> -#include <KDebug> -#include <KMessageBox> -#include <QButtonGroup> -#include <KDialog> -#include <akabeidatabase.h> -#include <akabeiquery.h> -#include <QLabel> -#include <QPushButton> -#include <QVBoxLayout> -//FIXME: Transaction messages? How to show them properly? - -AkabeiTransaction::AkabeiTransaction(AkabeiBackend* parent, AbstractResource* resource, Transaction::Role role) - : Transaction(parent, resource, role), - m_backend(parent), - m_transaction(0) -{ - setCancellable(false); - setStatus(Transaction::QueuedStatus); -} - -AkabeiTransaction::AkabeiTransaction(AkabeiBackend* parent, AbstractResource* resource, Transaction::Role role, AddonList addons) - : Transaction(parent, resource, role, addons), - m_backend(parent), - m_transaction(0) -{ - setCancellable(false); - setStatus(Transaction::QueuedStatus); -} - -AkabeiTransaction::~AkabeiTransaction() -{ - -} - -void AkabeiTransaction::start() -{ - AkabeiClient::Backend::instance()->queue()->clear(); - switch (role()) { - case Transaction::InstallRole: { - AkabeiResource * res = qobject_cast<AkabeiResource*>(resource()); - if (res->isInstalled()) { - finished(true); - return; - } - AkabeiClient::Backend::instance()->queue()->addPackage(res->package(), AkabeiClient::Install); - break; - } - case Transaction::RemoveRole: { - AkabeiResource * res = qobject_cast<AkabeiResource*>(resource()); - if (!res->isInstalled()) { - finished(true); - return; - } - AkabeiClient::Backend::instance()->queue()->addPackage(res->installedPackage(), AkabeiClient::Remove); - break; - } - case Transaction::ChangeAddonsRole: - break; - } - foreach (const QString &toRemove, addons().addonsToRemove()) { - AbstractResource * res = m_backend->resourceByPackageName(toRemove); - if (res) { - AkabeiClient::Backend::instance()->queue()->addPackage(qobject_cast<AkabeiResource*>(res)->installedPackage(), AkabeiClient::Remove); - } else { - Akabei::Package::List pkgs = Akabei::Backend::instance()->localDatabase()->queryPackages("SELECT * FROM packages JOIN provides WHERE provides.provides LIKE \"" + toRemove + '\"'); - foreach (Akabei::Package * p, pkgs) - AkabeiClient::Backend::instance()->queue()->addPackage(p, AkabeiClient::Remove); - } - } - foreach (const QString &toInstall, addons().addonsToInstall()) { - AbstractResource * res = m_backend->resourceByPackageName(toInstall); - if (res) { - AkabeiClient::Backend::instance()->queue()->addPackage(qobject_cast<AkabeiResource*>(res)->package(), AkabeiClient::Install); - } else { - Akabei::Package::List packages; - foreach (Akabei::Database * db, Akabei::Backend::instance()->databases()) { - packages << db->queryPackages("SELECT * FROM packages JOIN provides WHERE provides.provides LIKE \"" + toInstall + '\"'); - } //NOTE: Probably ask the user here, or rather create a method in akabei to resolve the provider for me - if (!packages.isEmpty()) - AkabeiClient::Backend::instance()->queue()->addPackage(packages.first(), AkabeiClient::Install); - } - } - connect(AkabeiClient::Backend::instance()->transactionHandler(), SIGNAL(transactionCreated(AkabeiClient::Transaction*)), SLOT(transactionCreated(AkabeiClient::Transaction*))); - connect(AkabeiClient::Backend::instance()->transactionHandler(), SIGNAL(validationFinished(bool)), SLOT(validationFinished(bool))); - connect(AkabeiClient::Backend::instance()->transactionHandler(), SIGNAL(finished(bool)), SLOT(finished(bool))); - connect(AkabeiClient::Backend::instance()->transactionHandler()->transactionProgress(), SIGNAL(phaseChanged(AkabeiClient::TransactionProgress::Phase)), SLOT(phaseChanged(AkabeiClient::TransactionProgress::Phase))); - connect(AkabeiClient::Backend::instance()->transactionHandler(), SIGNAL(newTransactionMessage(QString)), SLOT(transactionMessage(QString))); - - foreach (AkabeiClient::QueueItem * item, AkabeiClient::Backend::instance()->queue()->items()) - kDebug() << "QUEUE ITEM" << item->package()->name() << (item->action() == AkabeiClient::Install); - - m_transactionMessages.clear(); - AkabeiClient::Backend::instance()->transactionHandler()->start(Akabei::ProcessingOption::NoProcessingOption); -} - -void AkabeiTransaction::transactionMessage(const QString& message) -{ - m_transactionMessages.append(message); -} - -void AkabeiTransaction::phaseChanged(AkabeiClient::TransactionProgress::Phase phase) -{ - switch (phase) { - case AkabeiClient::TransactionProgress::Downloading: - setStatus(Transaction::DownloadingStatus); - break; - case AkabeiClient::TransactionProgress::Processing: - setStatus(Transaction::CommittingStatus); - break; - default: - break; - }; -} - -void AkabeiTransaction::transactionCreated(AkabeiClient::Transaction* transaction) -{ - kDebug() << "Transaction created"; - m_transaction = transaction; - foreach (AkabeiClient::TransactionQuestion * q, transaction->questions()) { - AkabeiQuestion question(q); - q->setAnswer(question.ask()); - } - if (!transaction->isValid()) { - finished(false); - return; - } else { - kDebug() << "Continue with transaction"; - AkabeiClient::Backend::instance()->transactionHandler()->validate(); - } -} - -void AkabeiTransaction::validationFinished(bool successful) -{ - if (!successful) { - finished(false); - return; - } - - AkabeiClient::Backend::instance()->transactionHandler()->process(); -} - -void AkabeiTransaction::finished(bool successful) -{ - kDebug() << "Finished" << successful; - if (!successful) { - QString err; - foreach (const Akabei::Error &error, m_transaction->errors()) { - err.append(' ' + error.description()); - } - if (err.isEmpty()) - err = i18n("Something went wrong!"); - KMessageBox::error(0, err, i18n("Error")); - } - if (!m_transactionMessages.isEmpty()) { - KMessageBox::informationList(0, i18n("There are a couple of transaction messages:"), m_transactionMessages, i18n("Transaction messages")); - } - setStatus(Transaction::DoneStatus); - disconnect(AkabeiClient::Backend::instance()->transactionHandler(), 0, this, 0); - disconnect(AkabeiClient::Backend::instance()->transactionHandler()->transactionProgress(), 0, this, 0); - m_backend->removeFromQueue(this); - deleteLater(); -} diff --git a/libmuon/backends/AkabeiBackend/AkabeiTransaction.h b/libmuon/backends/AkabeiBackend/AkabeiTransaction.h deleted file mode 100644 index c5d8138..0000000 --- a/libmuon/backends/AkabeiBackend/AkabeiTransaction.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2013 Lukas Appelhans <l.appelhans@gmx.de> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License or (at your option) version 3 or any later version - * accepted by the membership of KDE e.V. (or its successor approved - * by the membership of KDE e.V.), which shall act as a proxy - * defined in Section 14 of version 3 of the license. - * - * 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, see <http://www.gnu.org/licenses/>. - * - */ - -#ifndef AKABEITRANSACTION_H -#define AKABEITRANSACTION_H - -#include <Transaction/Transaction.h> -#include <akabeiclienttransactionhandler.h> - -class AkabeiBackend; -class AkabeiTransaction : public Transaction -{ - Q_OBJECT -public: - AkabeiTransaction(AkabeiBackend* parent, AbstractResource* resource, Transaction::Role role); - AkabeiTransaction(AkabeiBackend* parent, AbstractResource* resource, Transaction::Role role, AddonList addons); - ~AkabeiTransaction(); - -public slots: - void transactionCreated(AkabeiClient::Transaction * transaction); - void validationFinished(bool); - void finished(bool); - void phaseChanged(AkabeiClient::TransactionProgress::Phase); - void start(); - void transactionMessage(const QString &message); - -private: - QStringList m_transactionMessages; - AkabeiBackend * m_backend; - AkabeiClient::Transaction * m_transaction; -}; - -#endif // AKABEITRANSACTION_H diff --git a/libmuon/backends/AkabeiBackend/AkabeiUpdater.cpp b/libmuon/backends/AkabeiBackend/AkabeiUpdater.cpp deleted file mode 100644 index da4ba3f..0000000 --- a/libmuon/backends/AkabeiBackend/AkabeiUpdater.cpp +++ /dev/null @@ -1,266 +0,0 @@ -/* - * <one line to give the library's name and an idea of what it does.> - * Copyright 2013 Lukas Appelhans <l.appelhans@gmx.de> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License or (at your option) version 3 or any later version - * accepted by the membership of KDE e.V. (or its successor approved - * by the membership of KDE e.V.), which shall act as a proxy - * defined in Section 14 of version 3 of the license. - * - * 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, see <http://www.gnu.org/licenses/>. - * - */ -#include "AkabeiUpdater.h" -#include "AkabeiBackend.h" -#include "AkabeiResource.h" -#include "AkabeiQuestion.h" -#include <resources/AbstractResource.h> -#include <QDateTime> -#include <akabeiclientbackend.h> -#include <akabeiclienttransactionhandler.h> -#include <KDebug> -#include <KMessageBox> - -AkabeiUpdater::AkabeiUpdater(AkabeiBackend * parent) - : AbstractBackendUpdater(parent), - m_backend(parent), - m_transaction(0), - m_isProgressing(0), - m_downloadSpeed(0) -{ - -} - -AkabeiUpdater::~AkabeiUpdater() -{ - -} - -void AkabeiUpdater::prepare() -{ - kDebug(); - foreach (AbstractResource * res, m_backend->allResources()) { - if (res->canUpgrade()) { - m_marked.append(res); - } - } -} - -void AkabeiUpdater::start() -{ - if (m_backend->isTransactionRunning()) { - KMessageBox::error(0, i18n("Another transaction is still running!"), i18n("Error")); - return; - } - kDebug(); - m_isProgressing = true; - emit progressingChanged(m_isProgressing); - AkabeiClient::Queue * queue = AkabeiClient::Backend::instance()->queue(); - queue->clear(); - foreach (AbstractResource * res, m_marked) { - AkabeiResource * akabeiResource = qobject_cast<AkabeiResource*>(res); - queue->addPackage(akabeiResource->package(), AkabeiClient::Update); - } - connect(AkabeiClient::Backend::instance()->transactionHandler(), SIGNAL(transactionCreated(AkabeiClient::Transaction*)), SLOT(transactionCreated(AkabeiClient::Transaction*))); - connect(AkabeiClient::Backend::instance()->transactionHandler()->transactionProgress(), SIGNAL(downloadInformationChanged(Akabei::Package*,AkabeiClient::DownloadInformation)), SLOT(speedChanged(Akabei::Package*,AkabeiClient::DownloadInformation))); - //connect(AkabeiClient::Backend::instance()->transactionHandler()->transactionProgress(), SIGNAL(progressChanged(int)), SLOT(progressChanged(int)), Qt::QueuedConnection); - connect(AkabeiClient::Backend::instance()->transactionHandler()->transactionProgress(), SIGNAL(packageStarted(Akabei::Package*)), SLOT(packageStarted(Akabei::Package*))); - connect(AkabeiClient::Backend::instance()->transactionHandler()->transactionProgress(), SIGNAL(phaseChanged(AkabeiClient::TransactionProgress::Phase)), SLOT(phaseChanged(AkabeiClient::TransactionProgress::Phase))); - connect(AkabeiClient::Backend::instance()->transactionHandler(), SIGNAL(newTransactionMessage(QString)), SLOT(newTransactionMessage(QString))); - - AkabeiClient::Backend::instance()->transactionHandler()->start(Akabei::NoProcessingOption); -} - -void AkabeiUpdater::phaseChanged(AkabeiClient::TransactionProgress::Phase ) -{ - switch (AkabeiClient::Backend::instance()->transactionHandler()->transactionProgress()->phase()) { - case AkabeiClient::TransactionProgress::Downloading: - m_statusMessage = i18n("Started downloading packages..."); - emit statusMessageChanged(m_statusMessage); - return; - case AkabeiClient::TransactionProgress::Processing: - m_statusMessage = i18n("Started processing packages..."); - emit statusMessageChanged(m_statusMessage); - return; - default: - break; - }; -} - -void AkabeiUpdater::newTransactionMessage(const QString &message) -{ - m_statusMessage = message; - emit statusMessageChanged(message); -} - -void AkabeiUpdater::packageStarted(Akabei::Package* p) -{ - switch (AkabeiClient::Backend::instance()->transactionHandler()->transactionProgress()->phase()) { - case AkabeiClient::TransactionProgress::Downloading: - m_statusDetail = i18n("Started downloading %1...", p->name()); - emit statusDetailChanged(m_statusDetail); - return; - case AkabeiClient::TransactionProgress::Processing: - m_statusDetail = i18n("Started processing %1...", p->name()); - emit statusDetailChanged(m_statusDetail); - return; - default: - break; - }; -} - -void AkabeiUpdater::progressChanged(int progress) -{ - m_progress = progress; - emit progressChanged(m_progress); -} - -void AkabeiUpdater::speedChanged(Akabei::Package*, AkabeiClient::DownloadInformation ) -{ - m_downloadSpeed = 0; - foreach (AkabeiClient::DownloadInformation info, AkabeiClient::Backend::instance()->transactionHandler()->transactionProgress()->downloadInformation().values()) { - m_downloadSpeed += info.downloadSpeed(); - } - emit downloadSpeedChanged(m_downloadSpeed); -} - -void AkabeiUpdater::transactionCreated(AkabeiClient::Transaction* transaction) -{ - m_transaction = transaction; - disconnect(AkabeiClient::Backend::instance()->transactionHandler(), SIGNAL(transactionCreated(AkabeiClient::Transaction*)), this, SLOT(transactionCreated(AkabeiClient::Transaction*))); - connect(AkabeiClient::Backend::instance()->transactionHandler(), SIGNAL(validationFinished(bool)), SLOT(validationFinished(bool))); - - foreach (AkabeiClient::TransactionQuestion * q, transaction->questions()) { - AkabeiQuestion question(q); - q->setAnswer(question.ask()); - } - if (!transaction->isValid()) { - finished(false); - return; - } else { - kDebug() << "Continue with transaction"; - AkabeiClient::Backend::instance()->transactionHandler()->validate(); - } -} - -void AkabeiUpdater::validationFinished(bool success) -{ - kDebug(); - disconnect(AkabeiClient::Backend::instance()->transactionHandler(), SIGNAL(validationFinished(bool)), this, SLOT(validationFinished(bool))); - connect(AkabeiClient::Backend::instance()->transactionHandler(), SIGNAL(finished(bool)), SLOT(finished(bool))); - - if (!success) { - finished(false); - return; - } - - AkabeiClient::Backend::instance()->transactionHandler()->process(); -} - -void AkabeiUpdater::finished(bool success) -{ - kDebug(); - m_isProgressing = false; - emit progressingChanged(m_isProgressing); - - kDebug() << "Finished" << success; - if (!success) { - QString err; - foreach (const Akabei::Error &error, m_transaction->errors()) { - err.append(' ' + error.description()); - } - if (err.isEmpty()) - err = i18n("Something went wrong!"); - KMessageBox::error(0, err, i18n("Error")); - } - disconnect(AkabeiClient::Backend::instance()->transactionHandler(), 0, this, 0); - disconnect(AkabeiClient::Backend::instance()->transactionHandler()->transactionProgress(), 0, this, 0); - m_transaction = 0; - m_backend->reload(); -} - -QList< AbstractResource* > AkabeiUpdater::toUpdate() const -{ - return m_marked; -} - -void AkabeiUpdater::addResources(const QList< AbstractResource* >& apps) -{ - m_marked << apps; -} - -void AkabeiUpdater::removeResources(const QList< AbstractResource* >& apps) -{ - foreach (AbstractResource * res, apps) { - m_marked.removeAll(res); - } -} - -QList< QAction* > AkabeiUpdater::messageActions() const -{ - return QList<QAction*>(); -} - -quint64 AkabeiUpdater::downloadSpeed() const -{ - return m_downloadSpeed; -} - -QString AkabeiUpdater::statusDetail() const -{ - return m_statusDetail; -} - -QString AkabeiUpdater::statusMessage() const -{ - return m_statusMessage; -} - -bool AkabeiUpdater::isProgressing() const -{ - return m_isProgressing; -} - -bool AkabeiUpdater::isCancelable() const -{ - return false; -} - -bool AkabeiUpdater::isAllMarked() const -{ - return m_backend->updatesCount() == m_marked.size(); -} - -bool AkabeiUpdater::isMarked(AbstractResource* res) const -{ - return m_marked.contains(res); -} - -QDateTime AkabeiUpdater::lastUpdate() const -{ - return QDateTime::currentDateTime();//FIXME -} - -bool AkabeiUpdater::hasUpdates() const -{ - return m_backend->updatesCount() > 0; -} - -qreal AkabeiUpdater::progress() const -{ - return m_progress; -} - -long unsigned int AkabeiUpdater::remainingTime() const -{ - return AkabeiClient::Backend::instance()->transactionHandler()->transactionProgress()->estimatedTime().secsTo(QTime(0, 0, 0)); -} diff --git a/libmuon/backends/AkabeiBackend/AkabeiUpdater.h b/libmuon/backends/AkabeiBackend/AkabeiUpdater.h deleted file mode 100644 index 0e6012b..0000000 --- a/libmuon/backends/AkabeiBackend/AkabeiUpdater.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright 2013 Lukas Appelhans <l.appelhans@gmx.de> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License or (at your option) version 3 or any later version - * accepted by the membership of KDE e.V. (or its successor approved - * by the membership of KDE e.V.), which shall act as a proxy - * defined in Section 14 of version 3 of the license. - * - * 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, see <http://www.gnu.org/licenses/>. - * - */ - -#ifndef AKABEIUPDATER_H -#define AKABEIUPDATER_H - -#include <resources/AbstractBackendUpdater.h> -#include <akabeiclienttransactionhandler.h> - -class AkabeiBackend; - -namespace Akabei { - class Package; -}; - -class AkabeiUpdater : public AbstractBackendUpdater -{ - Q_OBJECT -public: - AkabeiUpdater(AkabeiBackend * parent); - ~AkabeiUpdater(); - - virtual QList< QAction* > messageActions() const; - virtual quint64 downloadSpeed() const; - virtual QString statusDetail() const; - virtual QString statusMessage() const; - virtual bool isProgressing() const; - virtual bool isCancelable() const; - virtual bool isAllMarked() const; - virtual bool isMarked(AbstractResource* res) const; - virtual QDateTime lastUpdate() const; - virtual QList< AbstractResource* > toUpdate() const; - virtual void addResources(const QList< AbstractResource* >& apps); - virtual void removeResources(const QList< AbstractResource* >& apps); - virtual long unsigned int remainingTime() const; - virtual qreal progress() const; - virtual bool hasUpdates() const; - virtual void prepare(); - -public slots: - virtual void start(); - void transactionCreated(AkabeiClient::Transaction*); - void validationFinished(bool); - void finished(bool); - void speedChanged(Akabei::Package*,AkabeiClient::DownloadInformation); - void progressChanged(int); - void packageStarted(Akabei::Package*); - void phaseChanged(AkabeiClient::TransactionProgress::Phase); - void newTransactionMessage(const QString &); - -private: - AkabeiBackend * m_backend; - QList<AbstractResource*> m_marked; - AkabeiClient::Transaction * m_transaction; - QString m_statusDetail; - QString m_statusMessage; - bool m_isProgressing; - quint64 m_downloadSpeed; - qreal m_progress; -}; - -#endif // AKABEIUPDATER_H diff --git a/libmuon/backends/AkabeiBackend/AppAkabeiResource.cpp b/libmuon/backends/AkabeiBackend/AppAkabeiResource.cpp deleted file mode 100644 index da68caa..0000000 --- a/libmuon/backends/AkabeiBackend/AppAkabeiResource.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/*************************************************************************** - * Copyright © 2013 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * Copyright © 2013 Lukas Appelhans <l.appelhans@gmx.de> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "AppAkabeiResource.h" -#include <KGlobal> -#include <KStandardDirs> -#include <KToolInvocation> -#include <QDebug> -#include <akabeipackage.h> - -AppAkabeiResource::AppAkabeiResource(const ApplicationData& data, - Akabei::Package * pkg, - AkabeiBackend* parent) - : AkabeiResource(pkg, parent) - , m_appdata(data) -{} - -QString AppAkabeiResource::name() -{ - QString ret = m_appdata.name.value(KGlobal::locale()->language()); - if(ret.isEmpty()) ret = m_appdata.name.value(QString()); - if(ret.isEmpty()) ret = m_appdata.pkgname; - if(ret.isEmpty()) ret = AkabeiResource::name(); - return ret; -} - -QString AppAkabeiResource::longDescription() -{ - QString ret = m_appdata.summary.value(KGlobal::locale()->language()); - if(ret.isEmpty()) ret = m_appdata.summary.value(QString()); - if(ret.isEmpty()) ret = AkabeiResource::longDescription(); - return ret; -} - -QString AppAkabeiResource::icon() const -{ - return m_appdata.icon; -} - -QStringList AppAkabeiResource::mimetypes() const -{ - return m_appdata.mimetypes; -} - -QStringList AppAkabeiResource::categories() -{ - return m_appdata.appcategories; -} - -QUrl AppAkabeiResource::homepage() -{ - return m_appdata.url.isEmpty() ? AkabeiResource::homepage() : m_appdata.url; -} - -bool AppAkabeiResource::isTechnical() const -{ - return false; -} - -QStringList AppAkabeiResource::executables() const -{ - QString desktopFile = KGlobal::dirs()->findResource("xdgdata-apps", m_appdata.id); - QStringList ret; - if(!desktopFile.isEmpty()) - ret += desktopFile; - return ret; -} - -void AppAkabeiResource::invokeApplication() const -{ - QStringList exes = executables(); - if(!exes.isEmpty()) - KToolInvocation::startServiceByDesktopPath(exes.first()); -} diff --git a/libmuon/backends/AkabeiBackend/AppAkabeiResource.h b/libmuon/backends/AkabeiBackend/AppAkabeiResource.h deleted file mode 100644 index 86aa06c..0000000 --- a/libmuon/backends/AkabeiBackend/AppAkabeiResource.h +++ /dev/null @@ -1,48 +0,0 @@ -/*************************************************************************** - * Copyright © 2013 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * Copyright © 2013 Lukas Appelhans <l.appelhans@gmx.de> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef APPPACKAGEKITRESOURCE_H -#define APPPACKAGEKITRESOURCE_H - -#include "AkabeiResource.h" -#include "AkabeiBackend.h" - -class AppAkabeiResource : public AkabeiResource -{ - Q_OBJECT - public: - explicit AppAkabeiResource(const ApplicationData& data, Akabei::Package * pkg, AkabeiBackend* parent); - virtual bool isTechnical() const; - virtual QString name(); - virtual QString icon() const; - virtual QStringList mimetypes() const; - virtual QStringList categories(); - virtual QString longDescription(); - virtual QUrl homepage(); - virtual bool canExecute() const { return true; } - virtual QStringList executables() const; - virtual void invokeApplication() const; - - private: - ApplicationData m_appdata; -}; - -#endif // APPPACKAGEKITRESOURCE_H diff --git a/libmuon/backends/AkabeiBackend/AppstreamUtils.cpp b/libmuon/backends/AkabeiBackend/AppstreamUtils.cpp deleted file mode 100644 index 253c00c..0000000 --- a/libmuon/backends/AkabeiBackend/AppstreamUtils.cpp +++ /dev/null @@ -1,109 +0,0 @@ -/*************************************************************************** - * Copyright © 2013 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "AppstreamUtils.h" -#include <qxmlstream.h> -#include <QFile> -#include <QDebug> - -namespace { - -QStringList joinLists(const QList<QStringList>& list) -{ - QStringList ret; - foreach(const QStringList& l, list) { - ret += l; - } - return ret; -} - -QHash<QString, QStringList> readElementList(QXmlStreamReader* reader, const QString& listedTagName) -{ - Q_UNUSED(listedTagName) - Q_ASSERT(reader->isStartElement()); - QHash<QString, QStringList> ret; - QStringRef startTag = reader->name(); - while(!(reader->isEndElement() && reader->name()==startTag)) { - reader->readNext(); - - if(reader->isStartElement()) { - Q_ASSERT(reader->name()==listedTagName); - ret[reader->attributes().value("lang").toString()] += reader->readElementText(); - } - } - return ret; -} - -ApplicationData readApplication(QXmlStreamReader* reader) -{ - Q_ASSERT(reader->isStartElement() && reader->name()=="application"); - ApplicationData ret; - while(!(reader->isEndElement() && reader->name()=="application")) { - reader->readNext(); - if(reader->isStartElement()) { - QStringRef name = reader->name(); - QString lang = reader->attributes().value("lang").toString(); - - if(name=="pkgname") ret.pkgname = reader->readElementText(); - else if(name=="id") ret.id = reader->readElementText(); - else if(name=="name") ret.name[lang] = reader->readElementText(); - else if(name=="summary") ret.summary[lang] = reader->readElementText(); - else if(name=="icon") ret.icon = reader->readElementText(); - else if(name=="url") ret.url = reader->readElementText(); - else if(name=="keywords") ret.keywords = readElementList(reader, "keyword"); - else if(name=="appcategories") ret.appcategories = joinLists(readElementList(reader, "appcategory").values()); - else if(name=="mimetypes") ret.mimetypes = joinLists(readElementList(reader, "mimetype").values()); - else { - qWarning() << "unrecognized element:" << reader->name(); - } - Q_ASSERT(reader->isEndElement()); - } else {; - Q_ASSERT(reader->isWhitespace() || (reader->isEndElement() && reader->name()=="application")); - } - } - return ret; -} - -} - -QHash<QString, ApplicationData> AppstreamUtils::fetchAppData(const QString& path) -{ - QHash<QString, ApplicationData> ret; - QFile f(path); - if (!f.open(QIODevice::ReadOnly)) { - qWarning() << "couldn't open" << path; - return ret; - } - - QXmlStreamReader reader(&f); - while (!reader.atEnd()) { - reader.readNext(); - if (reader.isStartElement() && reader.name() == "application") { - ApplicationData app = readApplication(&reader); - ret.insert(app.pkgname, app); - } - } - qDebug() << "got a number of appstream datasets:" << ret.size(); - - if (reader.hasError()) { - qWarning() << "error found while parsing" << path << ':' << reader.errorString(); - } - return ret; -} diff --git a/libmuon/backends/AkabeiBackend/AppstreamUtils.h b/libmuon/backends/AkabeiBackend/AppstreamUtils.h deleted file mode 100644 index 11f68bd..0000000 --- a/libmuon/backends/AkabeiBackend/AppstreamUtils.h +++ /dev/null @@ -1,30 +0,0 @@ -/*************************************************************************** - * Copyright © 2013 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef APPSTREAMUTILS_H -#define APPSTREAMUTILS_H -#include "AkabeiBackend.h" - -namespace AppstreamUtils -{ - QHash<QString, ApplicationData> fetchAppData(const QString& path); -}; - -#endif // APPSTREAMUTILS_H diff --git a/libmuon/backends/AkabeiBackend/CMakeLists.txt b/libmuon/backends/AkabeiBackend/CMakeLists.txt deleted file mode 100644 index cb3c090..0000000 --- a/libmuon/backends/AkabeiBackend/CMakeLists.txt +++ /dev/null @@ -1,32 +0,0 @@ -include_directories( -${AKABEICORE_INCLUDE_DIR} -${AKABEICLIENT_INCLUDE_DIR} -) - -set(akabeibackend_SRCS - AppstreamUtils.cpp - AppAkabeiResource.cpp - AkabeiUpdater.cpp - AkabeiQuestion.cpp - AkabeiBackend.cpp - AkabeiResource.cpp - AkabeiTransaction.cpp -) - -add_library(muon-akabeibackend ${akabeibackend_SRCS}) -target_link_libraries(muon-akabeibackend ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${KDE4_KDECORE_LIBS} ${KDE4_KDEUI_LIBS} ${KDE4_KIO_LIBS} ${qjson_LIBRARIES} ${AKABEICLIENT_LIBRARIES} ${AKABEICORE_LIBRARIES} MuonCommon) -install(TARGETS muon-akabeibackend DESTINATION ${PLUGIN_INSTALL_DIR}/muon) -install(FILES muon-akabei-backend.desktop DESTINATION ${DATA_INSTALL_DIR}/libmuon/backends) -install(FILES muon-akabei-backend-categories.xml DESTINATION ${DATA_INSTALL_DIR}/libmuon/categories) - -set(akabeinotifier_SRCS - AkabeiNotifier.cpp -) - -add_library(kded_muonakabeinotifier MODULE ${akabeinotifier_SRCS}) - -target_link_libraries(kded_muonakabeinotifier ${KDE4_KDECORE_LIBS} ${KDE4_KDEUI_LIBS} ${AKABEICLIENT_LIBRARIES} ${AKABEICORE_LIBRARIES} MuonCommon) - -install(TARGETS kded_muonakabeinotifier DESTINATION ${PLUGIN_INSTALL_DIR}) - -install(FILES muonakabeinotifier.desktop DESTINATION ${SERVICES_INSTALL_DIR}/kded) diff --git a/libmuon/backends/AkabeiBackend/muon-akabei-backend-categories.xml b/libmuon/backends/AkabeiBackend/muon-akabei-backend-categories.xml deleted file mode 100644 index aeb35bc..0000000 --- a/libmuon/backends/AkabeiBackend/muon-akabei-backend-categories.xml +++ /dev/null @@ -1,563 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<Menu> - - <Menu> - <Name>Accessories</Name> - <Icon>applications-utilities</Icon> - <Include> - <And> - <Category>Utility</Category> - <Not><Category>Accessibility</Category></Not> - </And> - </Include> - </Menu> - - <Menu> - <Name>Accessibility</Name> - <Icon>preferences-desktop-accessibility</Icon> - <Include> - <And> - <Category>Accessibility</Category> - <Not><Category>Settings</Category></Not> - </And> - </Include> - </Menu> - - <Menu> - <Name>Developer Tools</Name> - <Icon>applications-development</Icon> - <Include> - <Or> - <Category>Development</Category> - <PkgSection>devel</PkgSection> - <PkgSection>restricted/devel</PkgSection> - <PkgSection>universe/devel</PkgSection> - <PkgSection>multiverse/devel</PkgSection> - </Or> - <Filename>emacs.desktop</Filename> - </Include> - - - <Menu> - <Name>Debugging</Name> - <Icon>tools-report-bug</Icon> - <Include> - <And> - <Category>Debugger</Category> - </And> - </Include> - </Menu> - - <Menu> - <Name>Graphic Interface Design</Name> - <Include> - <And> - <Category>GUIDesigner</Category> - </And> - </Include> - </Menu> - - <Menu> - <Name>Haskell</Name> - <Icon>text-x-haskell</Icon> - <Include> - <Or> - <PkgSection>haskell</PkgSection> - <PkgSection>restricted/haskell</PkgSection> - <PkgSection>universe/haskell</PkgSection> - <PkgSection>multiverse/haskell</PkgSection> - </Or> - </Include> - </Menu> - - <Menu> - <Name>IDEs</Name> - <Include> - <And> - <Category>IDE</Category> - </And> - </Include> - </Menu> - - <Menu> - <Name>Java</Name> - <Icon>application-x-java</Icon> - <Include> - <Or> - <PkgSection>java</PkgSection> - <PkgSection>restricted/java</PkgSection> - <PkgSection>universe/java</PkgSection> - <PkgSection>multiverse/java</PkgSection> - </Or> - </Include> - </Menu> - - <Menu> - <Name>Localization</Name> - <Icon>preferences-desktop-locale</Icon> - <Include> - <And> - <Category>Translation</Category> - </And> - </Include> - </Menu> - - <Menu> - <Name>Perl</Name> - <Include> - <Or> - <PkgSection>perl</PkgSection> - <PkgSection>restricted/perl</PkgSection> - <PkgSection>universe/perl</PkgSection> - <PkgSection>multiverse/perl</PkgSection> - </Or> - </Include> - </Menu> - - <Menu> - <Name>Profiling</Name> - <Include> - <Or> - <Category>Profiling</Category> - </Or> - </Include> - </Menu> - - <Menu> - <Name>Python</Name> - <Icon>text-x-python</Icon> - <Include> - <Or> - <PkgSection>python</PkgSection> - <PkgSection>restricted/python</PkgSection> - <PkgSection>universe/python</PkgSection> - <PkgSection>multiverse/python</PkgSection> - </Or> - </Include> - </Menu> - - <Menu> - <Name>Version Control</Name> - <Icon>text-x-patch</Icon> - <Include> - <Or> - <PkgSection>vcs</PkgSection> - <PkgSection>restricted/vcs</PkgSection> - <PkgSection>universe/vcs</PkgSection> - <PkgSection>multiverse/vcs</PkgSection> - <Category>RevisionControl</Category> - </Or> - </Include> - </Menu> - - <Menu> - <Name>Web Development</Name> - <Include> - <And> - <Category>WebDevelopment</Category> - </And> - </Include> - <Icon>applications-internet</Icon> - </Menu> - - </Menu> - - - <Menu> - <Name>Education</Name> - <Icon>applications-education</Icon> - <Include> - <And> - <Category>Education</Category> - <Not> - <Category>Science</Category> - </Not> - </And> - </Include> - </Menu> - - - <Menu> - <Name>Science & Engineering</Name> - <Icon>applications-science</Icon> - <Include> - <Or> - <Category>Science</Category> - <Category>Engineering</Category> - </Or> - </Include> - <Menu> - <Name>Astronomy</Name> - <Include> - <And> - <Category>Astronomy</Category> - </And> - </Include> - </Menu> - <Menu> - <Name>Biology</Name> - <Include> - <And> - <Category>Biology</Category> - </And> - </Include> - </Menu> - <Menu> - <Name>Chemistry</Name> - <Icon>applications-science</Icon> - <Include> - <And> - <Category>Chemistry</Category> - </And> - </Include> - </Menu> - <Menu> - <Name>Computer Science & Robotics</Name> - <Icon>computer</Icon> - <Include> - <Or> - <Category>ArtificialIntelligence</Category> - <Category>ComputerScience</Category> - <Category>Robotics</Category> - </Or> - </Include> - </Menu> - <Menu> - <Name>Electronics</Name> - <Icon>audio-card</Icon> - <Include> - <And> - <Category>Electronics</Category> - </And> - </Include> - </Menu> - <Menu> - <Name>Engineering</Name> - <Icon>applications-engineering</Icon> - <Include> - <And> - <Category>Engineering</Category> - </And> - </Include> - </Menu> - <Menu> - <Name>Geography</Name> - <Include> - <And> - <Category>Geography</Category> - </And> - </Include> - </Menu> - <Menu> - <Name>Geology</Name> - <Include> - <Or> - <Category>Geology</Category> - <Category>Geoscience</Category> - </Or> - </Include> - </Menu> - <Menu> - <Name>Mathematics</Name> - <Icon>applications-education-mathematics</Icon> - <Include> - <Or> - <Category>DataVisualization</Category> - <Category>Math</Category> - <Category>NumericalAnalysis</Category> - <PkgSection>math</PkgSection> - <PkgSection>restricted/math</PkgSection> - <PkgSection>universe/math</PkgSection> - <PkgSection>multiverse/math</PkgSection> - <PkgSection>gnu-r</PkgSection> - <PkgSection>restricted/gnu-r</PkgSection> - <PkgSection>universe/gnu-r</PkgSection> - <PkgSection>multiverse/gnu-r</PkgSection> - </Or> - </Include> - </Menu> - <Menu> - <Name>Physics</Name> - <Icon>step</Icon> - <Include> - <And> - <Category>Physics</Category> - </And> - </Include> - </Menu> - </Menu> - - <Menu> - <Name>Fonts</Name> - <Icon>preferences-desktop-font</Icon> - <ShowTechnical>true</ShowTechnical> - <Include> - <Or> - <PkgWildcard>ttf-*</PkgWildcard> - <PkgWildcard>otf-*</PkgWildcard> - <PkgSection>fonts</PkgSection> - <PkgSection>restricted/fonts</PkgSection> - <PkgSection>universe/fonts</PkgSection> - <PkgSection>multiverse/fonts</PkgSection> - </Or> - </Include> - </Menu> - - <Menu> - <Name>Games</Name> - <Icon>applications-games</Icon> - <Include> - <And> - <Category>Game</Category> - </And> - </Include> - - <Menu> - <Name>Arcade</Name> - <Icon>applications-games-arcade</Icon> - <Include> - <And> - <Category>ArcadeGame</Category> - </And> - </Include> - </Menu> - <Menu> - <Name>Board Games</Name> - <Icon>applications-games-board</Icon> - <Include> - <And> - <Category>BoardGame</Category> - </And> - </Include> - </Menu> - <Menu> - <Name>Card Games</Name> - <Icon>applications-games-card</Icon> - <Include> - <And> - <Category>CardGame</Category> - </And> - </Include> - </Menu> - <Menu> - <Name>Puzzles</Name> - <Icon>applications-games</Icon> - <Include> - <And> - <Category>LogicGame</Category> - </And> - </Include> - </Menu> - <Menu> - <Name>Role Playing</Name> - <Icon>applications-games</Icon> - <Include> - <And> - <Category>RolePlaying</Category> - </And> - </Include> - </Menu> - <Menu> - <Name>Simulation</Name> - <Icon>applications-games-strategy</Icon> - <Include> - <And> - <Category>Simulation</Category> - </And> - </Include> - </Menu> - <Menu> - <Name>Sports</Name> - <Icon>applications-games</Icon> - <Include> - <And> - <Category>SportsGame</Category> - </And> - </Include> - </Menu> - - </Menu> - - - <Menu> - <Name>Graphics</Name> - <Icon>applications-graphics</Icon> - <Include> - <And> - <Category>Graphics</Category> - </And> - </Include> - <Menu> - <Name>3D</Name> - <Include> - <And> - <Category>3DGraphics</Category> - </And> - </Include> - </Menu> - <Menu> - <Name>Drawing</Name> - <Icon>draw-freehand</Icon> - <Include> - <And> - <Category>VectorGraphics</Category> - <Not> - <Category>Viewer</Category> - </Not> - </And> - </Include> - </Menu> - <Menu> - <Name>Painting & Editing</Name> - <Icon>draw-brush</Icon> - <Include> - <And> - <Category>RasterGraphics</Category> - <Not> - <Category>Viewer</Category> - <Category>Scanning</Category> - </Not> - </And> - </Include> - </Menu> - <Menu> - <Name>Photography</Name> - <Icon>image-x-generic</Icon> - <Include> - <And> - <Category>Photography</Category> - </And> - </Include> - </Menu> - <Menu> - <Name>Publishing</Name> - <Icon>document-export</Icon> - <Include> - <And> - <Category>Publishing</Category> - </And> - </Include> - </Menu> - <Menu> - <Name>Scanning & OCR</Name> - <Icon>scanner</Icon> - <Include> - <Or> - <Category>Scanning</Category> - <Category>OCR</Category> - </Or> - </Include> - </Menu> - <Menu> - <Name>Viewers</Name> - <Icon>graphics-viewer-document</Icon> - <Include> - <And> - <Category>Viewer</Category> - </And> - </Include> - </Menu> - </Menu> - - - <Menu> - <Name>Internet</Name> - <Icon>applications-internet</Icon> - <Include> - <And> - <Category>Network</Category> - </And> - </Include> - <Menu> - <Name>Chat</Name> - <Icon>kopete</Icon> - <Include> - <Or> - <Category>InstantMessaging</Category> - <Category>IRCClient</Category> - </Or> - </Include> - </Menu> - <Menu> - <Name>File Sharing</Name> - <Icon>ktorrent</Icon> - <Include> - <And> - <Category>FileTransfer</Category> - </And> - </Include> - </Menu> - <Menu> - <Name>Mail</Name> - <Icon>internet-mail</Icon> - <Include> - <And> - <Category>Email</Category> - </And> - </Include> - </Menu> - <Menu> - <Name>Web Browsers</Name> - <Icon>internet-web-browser</Icon> - <Include> - <And> - <Category>WebBrowser</Category> - </And> - </Include> - </Menu> - </Menu> - - - <Menu> - <Name>Multimedia</Name> - <Icon>applications-multimedia</Icon> - <Include> - <And> - <Category>AudioVideo</Category> - </And> - </Include> - </Menu> - - - <Menu> - <Name>Office</Name> - <Icon>applications-office</Icon> - <Include> - <And> - <Category>Office</Category> - </And> - </Include> - </Menu> - - <Menu> - <Name>System & Settings</Name> - <Icon>preferences-system</Icon> - <Include> - <Or> - <Category>Settings</Category> - <Category>System</Category> - </Or> - </Include> - </Menu> - - <Menu> - <Name>Plasma Desktop Widgets</Name> - <Icon>plasma</Icon> - <Include> - <Or> - <PkgWildcard>plasma-widget-*</PkgWildcard> - </Or> - </Include> - </Menu> - - <Menu> - <Name>Unknown</Name> - <Icon>unknown</Icon> - <Include> - <Or> - <Category>Unknown</Category> - </Or> - </Include> - </Menu> - -</Menu> diff --git a/libmuon/backends/AkabeiBackend/muon-akabei-backend.desktop b/libmuon/backends/AkabeiBackend/muon-akabei-backend.desktop deleted file mode 100644 index 423a2a9..0000000 --- a/libmuon/backends/AkabeiBackend/muon-akabei-backend.desktop +++ /dev/null @@ -1,132 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=Muon/Backend -Exec=blubb -Icon=applications-other -Comment=Install and browse applications in Chakra -Comment[ast]=Instala y restola aplicaciones en Chakra -Comment[bg]=Инсталиране и разглеждане на приложения в Chakra -Comment[bs]=Instaliraj i pregledaj aplikacije u Chakra -Comment[ca]=Instal·la i mostra aplicacions a Chakra -Comment[ca@valencia]=Instal·la i mostra aplicacions a Chakra -Comment[cs]=Instalujte a prohlížejte aplikace v Chakra -Comment[da]=Installér og gennemse programmer i Chakra -Comment[de]=Anwendungen in Chakra Installieren und durchsuchen -Comment[el]=Εγκαταστήστε και περιηγηθείτε σε εφαρμογές στο Chakra -Comment[en_GB]=Install and browse applications in Chakra -Comment[es]=Instalar y examinar aplicaciones en Chakra -Comment[et]=Rakenduste paigaldamine ja sirvimine Chakras -Comment[fi]=Asenna ja selaa Chakran välityksellä tarjolla olevia sovelluksia -Comment[fr]=Installer et parcourir des applications dans Chakra -Comment[gl]=Instalar e buscar aplicacións en Chakra -Comment[hu]=Alkalmazások telepítése és böngészése Chakra programban -Comment[id]=Pasang dan melihat-lihat aplikasi di dalam Chakra -Comment[it]=Installa e sfoglia le applicazioni in Chakra -Comment[ko]=Chakra에서 프로그램을 찾고 설치하기 -Comment[lt]=Diegti ir naršyti programas Chakra sistemoje -Comment[nb]=Installer og bla i programmer i Chakra -Comment[nds]=Programmen binnen Chakra dörkieken un installeren -Comment[nl]=Installeer en blader door toepassingen in Chakra -Comment[nn]=Installer og bla gjennom program i Chakra -Comment[pl]=Wgrywaj i przeglądaj programy w Chakra -Comment[pt]=Instalar e navegar pelas aplicações no Chakra -Comment[pt_BR]=Instala e navega pelos aplicativos no Chakra -Comment[ro]=Instalează și răsfoiește aplicații în Chakra -Comment[ru]=Установка и обзор приложений в Chakra -Comment[sk]=Inštalácia a prehliadanie aplikácií v Chakra -Comment[sl]=Namestite in brskajte po programih v Chakri -Comment[sr]=Инсталирајте и прегледајте програме из Чакре -Comment[sr@ijekavian]=Инсталирајте и прегледајте програме из Чакре -Comment[sr@ijekavianlatin]=Instalirajte i pregledajte programe iz Chakre -Comment[sr@latin]=Instalirajte i pregledajte programe iz Chakre -Comment[sv]=Installera och bläddra bland program med Chakra -Comment[tr]=Uygulamalara Chakra içerisinde gözat ve yükle -Comment[uk]=Встановіть і перегляньте встановлені програми у Chakra -Comment[x-test]=xxInstall and browse applications in Chakraxx -Comment[zh_CN]=在 Chakra 中安装和浏览应用程序 -Comment[zh_TW]=在 Chakra 中安裝並瀏覽應用程式 -Name=Akabei Backend -Name[bs]=Akabei pozadina -Name[ca]=Dorsal Akabei -Name[ca@valencia]=Dorsal Akabei -Name[cs]=Podpůrná vrstva Akabei -Name[da]=Akabei-backend -Name[de]=Akabei-Backend -Name[el]=Σύστημα υποστήριξης Akabei -Name[en_GB]=Akabei Backend -Name[es]=Motor de Akabei -Name[et]=Akabei taustaprogramm -Name[fi]=Akabei-taustajärjestelmä -Name[fr]=Moteur de Akabei -Name[gl]=Infraestrutura de Akabei -Name[hu]=Akabei háttérprogram -Name[id]=Backend Akabei -Name[it]=Motore Akabei -Name[ko]=Akabei 백엔드 -Name[lt]=Akabei galinė sąsaja -Name[nb]=Akabei bakgrunnsmotor -Name[nds]=Hülpprogramm Akabei -Name[nl]=Backend van Akabei -Name[nn]=Akabei bakgrunnsmotor -Name[pl]=Silnik Akabei -Name[pt]=Infra-Estrutura do Akabei -Name[pt_BR]=Infraestrutura Akabei -Name[ro]=Suport Akabei -Name[ru]=Модуль Akabei -Name[sk]=Backend Akabei -Name[sl]=Zaledje Akabei -Name[sr]=Позадина за Акабеј -Name[sr@ijekavian]=Позадина за Акабеј -Name[sr@ijekavianlatin]=Pozadina za Akabei -Name[sr@latin]=Pozadina za Akabei -Name[sv]=Akabei-gränssnitt -Name[tr]=Akabei Arka Ucu -Name[uk]=Модуль Akabei -Name[x-test]=xxAkabei Backendxx -Name[zh_CN]=Akabei 后端 -Name[zh_TW]=Akabei 後端介面 -GenericName=Chakra Support -GenericName[ast]=Sofitu de Chakra -GenericName[bg]=Поддръжка на Chakra -GenericName[bs]=Chakra podrška -GenericName[ca]=Implementació a Chakra -GenericName[ca@valencia]=Implementació a Chakra -GenericName[cs]=Podpora Chakra -GenericName[da]=Chakra-understøttelse -GenericName[de]=Unterstützung für Chakra -GenericName[el]=Υποστήριξη Chakra -GenericName[en_GB]=Chakra Support -GenericName[es]=Implementación de Chakra -GenericName[et]=Chakra toetus -GenericName[fi]=Chakra-tuki -GenericName[fr]=Prise en charge de Chakra -GenericName[gl]=Compatibilidade con Chakra -GenericName[hu]=Chakra támogatás -GenericName[id]=Dukungan Chakra -GenericName[it]=Supporto Chakra -GenericName[ko]=Chakra 지원 -GenericName[lt]=Chakra palaikymas -GenericName[nb]=Chakra-støtte -GenericName[nds]=Chakra-Ünnerstütten -GenericName[nl]=Ondersteuning van Chakra -GenericName[nn]=Chakra-støtte -GenericName[pl]=Obsługa Chakra -GenericName[pt]=Suporte para o Chakra -GenericName[pt_BR]=Suporte para o Chakra -GenericName[ro]=Suport pentru Chakra -GenericName[ru]=Поддержка Chakra -GenericName[sk]=Podpora Chakra -GenericName[sl]=Podpora Chakri -GenericName[sr]=Подршка за Чакру -GenericName[sr@ijekavian]=Подршка за Чакру -GenericName[sr@ijekavianlatin]=Podrška za Chakru -GenericName[sr@latin]=Podrška za Chakru -GenericName[sv]=Stöd för Chakra -GenericName[tr]=Chakra Desteği -GenericName[uk]=Підтримка Chakra -GenericName[x-test]=xxChakra Supportxx -GenericName[zh_CN]=Chakra 支持 -GenericName[zh_TW]=Chakra 支援 -X-KDE-Library=muon-akabeibackend -X-KDE-PluginInfo-Name=muon-akabei-backend -X-KDE-PluginInfo-License=GPL diff --git a/libmuon/backends/AkabeiBackend/muonakabeinotifier.desktop b/libmuon/backends/AkabeiBackend/muonakabeinotifier.desktop deleted file mode 100644 index ba26ab7..0000000 --- a/libmuon/backends/AkabeiBackend/muonakabeinotifier.desktop +++ /dev/null @@ -1,48 +0,0 @@ -[Desktop Entry] -Name=Muon Akabei Notifier -Name[bs]=Muon Akabel notifikator -Name[ca]=Notificador Akabei del Muon -Name[ca@valencia]=Notificador Akabei del Muon -Name[cs]=Oznamování Akabei pro Muon -Name[da]=Muon Akabei-bekendtgørelser -Name[de]=Muon-Akabei-Benachrichtigung -Name[el]=Πρόγραμμα ειδοποιήσεων Muon Akabei -Name[en_GB]=Muon Akabei Notifier -Name[es]=Notificador de Akabei de Muon -Name[et]=Muoni Akabei märguanded -Name[fi]=Muonin Akabei-ilmoitukset -Name[fr]=Notifieur Akabei de Muon -Name[gl]=Notificador de Akabei para Muon -Name[hu]=Muon Akabei értesítő -Name[id]=Pemberitahu Akabei Muon -Name[it]=Notifiche Akabei di Muon -Name[ko]=Muon Akabei 알림이 -Name[lt]=Muon Akabei pranešėjas -Name[nb]=Muon Akabei-varsler -Name[nds]=Muon-Bescheden för Akabei -Name[nl]=Muon-melder van Akabei -Name[nn]=Muon Akabei-varslar -Name[pl]=Powiadamianie Akabei dla Muon -Name[pt]=Notificação do Akabei para o Muon -Name[pt_BR]=Notificador do Akabei para o Muon -Name[ro]=Notificare Muon Akabei -Name[ru]=Уведомления Muon Akabei -Name[sk]=Muon Akabei oznamovač -Name[sl]=Obvestilnik Akabei za Muon -Name[sr]=Муонов извештавач за Акабеј -Name[sr@ijekavian]=Муонов извјештавач за Акабеј -Name[sr@ijekavianlatin]=Muonov izvještavač za Akabei -Name[sr@latin]=Muonov izveštavač za Akabei -Name[sv]=Muon Akabei underrättelse -Name[tr]=Muon Akabei Bildirici -Name[uk]=Сповіщувач Muon для Akabei -Name[x-test]=xxMuon Akabei Notifierxx -Name[zh_CN]=Muon Akabei 通知器 -Name[zh_TW]=Muon Akabei 通知器 -Type=Service -X-KDE-ServiceTypes=KDEDModule -X-KDE-Library=muonakabeinotifier -X-KDE-FactoryName=muonakabeinotifier -X-KDE-DBus-ModuleName=muonakabeinotifier -X-KDE-Kded-autoload=true -X-KDE-Kded-phase=2 diff --git a/libmuon/backends/ApplicationBackend/Application.cpp b/libmuon/backends/ApplicationBackend/Application.cpp deleted file mode 100644 index 0bcedff..0000000 --- a/libmuon/backends/ApplicationBackend/Application.cpp +++ /dev/null @@ -1,640 +0,0 @@ -/*************************************************************************** - * Copyright © 2010-2011 Jonathan Thomas <echidnaman@kubuntu.org> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "Application.h" - -// Qt includes -#include <QFile> -#include <QJsonDocument> -#include <QStandardPaths> -#include <QStringList> -#include <QThread> -#include <QVector> - -// KDE includes -#include <KIconLoader> -#include <KService> -#include <KServiceGroup> -#include <KToolInvocation> -#include <KLocalizedString> -#include <KIO/Job> -#include <KConfigGroup> -#include <KFormat> - -// QApt includes -#include <QApt/Backend> -#include <QApt/Config> -#include <QApt/Changelog> -#include <qapt/qaptversion.h> - -#include <MuonDataSources.h> - -#include "ApplicationBackend.h" -#include "resources/PackageState.h" - -Application::Application(const QString& fileName, QApt::Backend* backend) - : AbstractResource(0) - , m_data(new KConfig(fileName, KConfig::SimpleConfig)) - , m_backend(backend) - , m_package(0) - , m_isValid(true) - , m_isTechnical(false) - , m_isExtrasApp(false) - , m_sourceHasScreenshot(true) -{ - static QByteArray currentDesktop = qgetenv("XDG_CURRENT_DESKTOP"); - - m_isTechnical = getField("NoDisplay").toLower() == "true" - || !hasField("Exec") - || getField("NotShowIn", QByteArray()).contains(currentDesktop) - || !getField("OnlyShowIn", currentDesktop).contains(currentDesktop); - m_packageName = getField("X-AppInstall-Package"); -} - -Application::Application(QApt::Package* package, QApt::Backend* backend) - : AbstractResource(0) - , m_backend(backend) - , m_package(package) - , m_isValid(true) - , m_isTechnical(true) - , m_isExtrasApp(false) -{ - m_packageName = m_package->name().latin1(); - - QString arch = m_package->architecture(); - if (arch != m_backend->nativeArchitecture() && arch != QLatin1String("all")) - m_packageName.append(QLatin1Char(':') + m_package->architecture().toLatin1()); - - if (m_package->origin() == QLatin1String("LP-PPA-app-review-board")) { - if (!m_package->controlField(QLatin1String("Appname")).isEmpty()) { - m_isExtrasApp = true; - m_isTechnical = false; - } - } -} - -QString Application::name() -{ - QString name; - if (!m_isTechnical) - name = i18n(untranslatedName().toUtf8()); - else - name = untranslatedName(); - - if (package() && m_package->isForeignArch()) - name = i18n("%1 (%2)", name, m_package->architecture()); - return name; -} - -QString Application::untranslatedName() -{ - QString name = QString::fromUtf8(getField("Name")).trimmed(); - if (name.isEmpty() && package()) { - // extras.ubuntu.com packages can have this - if (m_isExtrasApp) - name = m_package->controlField(QLatin1String("Appname")); - else - name = m_package->name(); - } - - return name; -} - -QString Application::comment() -{ - QString comment = getField("Comment"); - if (comment.isEmpty()) { - // Sometimes GenericName is used instead of Comment - comment = getField("GenericName"); - if (comment.isEmpty()) { - return package()->shortDescription(); - } - } - - return i18n(comment.toUtf8()); -} - -QString Application::packageName() const -{ - return m_packageName; -} - -QApt::Package *Application::package() -{ - if (!m_package && m_backend) { - m_package = m_backend->package(packageName()); - emit stateChanged(); - } - - // Packages removed from archive will remain in app-install-data until the - // next refresh, so we can have valid .desktops with no package - if (!m_package) { - m_isValid = false; - } - - return m_package; -} - -QString Application::icon() const -{ - return getField("Icon", "applications-other"); -} - -QStringList Application::mimetypes() const -{ - return QString(getField("MimeType")).split(';'); -} - -QString Application::menuPath() -{ - QString path; - QString arrow(QString::fromUtf8(" ➜ ")); - - // Take the file name and remove the .desktop ending - QVector<KService::Ptr> execs = findExecutables(); - if(execs.isEmpty()) - return path; - - KService::Ptr service = execs.first(); - QVector<QPair<QString, QString> > ret; - - if (service) { - ret = locateApplication(QString(), service->menuId()); - } - - if (!ret.isEmpty()) { - path.append(QStringLiteral("<img width=\"16\" height=\"16\"src=\"%1\"/>") - .arg(KIconLoader::global()->iconPath("kde", KIconLoader::Small))); - path.append(QStringLiteral(" %1 <img width=\"16\" height=\"16\" src=\"%2\"/> %3") - .arg(arrow) - .arg(KIconLoader::global()->iconPath("applications-other", KIconLoader::Small)) - .arg(i18n("Applications"))); - for (int i = 0; i < ret.size(); i++) { - path.append(QStringLiteral(" %1 <img width=\"16\" height=\"16\" src=\"%2\"/> %3") - .arg(arrow) - .arg(KIconLoader::global()->iconPath(ret.at(i).second, KIconLoader::Small)) - .arg(ret.at(i).first)); - } - } - - return path; -} - -QVector<QPair<QString, QString> > Application::locateApplication(const QString &_relPath, const QString &menuId) const -{ - QVector<QPair<QString, QString> > ret; - KServiceGroup::Ptr root = KServiceGroup::group(_relPath); - - if (!root || !root->isValid()) { - return ret; - } - - const KServiceGroup::List list = root->entries(false /* sorted */, - true /* exclude no display entries */, - false /* allow separators */); - - for (KServiceGroup::List::ConstIterator it = list.constBegin(); it != list.constEnd(); ++it) { - const KSycocaEntry::Ptr p = (*it); - - // Static cast to specific classes according to isType(). - if (p->isType(KST_KService)) { - const KService::Ptr service = - KService::Ptr(static_cast<KService *>(p.data())); - - if (service->noDisplay()) { - continue; - } - - if (service->menuId() == menuId) { - QPair<QString, QString> pair; - pair.first = service->name(); - pair.second = service->icon(); - ret << pair; - return ret; - } - } else if (p->isType(KST_KServiceGroup)) { - const KServiceGroup::Ptr serviceGroup = - KServiceGroup::Ptr(static_cast<KServiceGroup *>(p.data())); - - if (serviceGroup->noDisplay() || serviceGroup->childCount() == 0) { - continue; - } - - QVector<QPair<QString, QString> > found; - found = locateApplication(serviceGroup->relPath(), menuId); - if (!found.isEmpty()) { - QPair<QString, QString> pair; - pair.first = serviceGroup->caption(); - pair.second = serviceGroup->icon(); - ret << pair; - ret << found; - return ret; - } - } else { - continue; - } - } - - return ret; -} - -QStringList Application::categories() -{ - QStringList categories = QString(getField("Categories")).split(';', QString::SkipEmptyParts); - - if (categories.isEmpty()) { - // extras.ubuntu.com packages can have this field - if (m_isExtrasApp) - categories = package()->controlField(QLatin1String("Category")).split(';'); - } - return categories; -} - -QUrl Application::thumbnailUrl() -{ - QUrl url(package()->controlField(QLatin1String("Thumbnail-Url"))); - if(m_sourceHasScreenshot) { - url = QUrl(MuonDataSources::screenshotsSource().toString() + "/thumbnail/" + packageName()); - } - return url; -} - -QUrl Application::screenshotUrl() -{ - QUrl url(package()->controlField(QLatin1String("Screenshot-Url"))); - if(m_sourceHasScreenshot) { - url = QUrl(MuonDataSources::screenshotsSource().toString() + "/screenshot/" + packageName()); - } - return url; -} - -QString Application::license() -{ - QString component = package()->component(); - if (component == "main" || component == "universe") { - return i18nc("@info license", "Open Source"); - } else if (component == "restricted") { - return i18nc("@info license", "Proprietary"); - } else { - return i18nc("@info license", "Unknown"); - } -} - -QApt::PackageList Application::addons() -{ - QApt::PackageList addons; - - QApt::Package *pkg = package(); - if (!pkg) { - return addons; - } - - QStringList tempList; - // Only add recommends or suggests to the list if they aren't already going to be - // installed - if (!m_backend->config()->readEntry("APT::Install-Recommends", true)) { - tempList << m_package->recommendsList(); - } - if (!m_backend->config()->readEntry("APT::Install-Suggests", false)) { - tempList << m_package->suggestsList(); - } - tempList << m_package->enhancedByList(); - - QStringList languagePackages; - QFile l10nFilterFile("/usr/share/language-selector/data/pkg_depends"); - - if (l10nFilterFile.open(QFile::ReadOnly)) { - QString contents = l10nFilterFile.readAll(); - - foreach (const QString &line, contents.split('\n')) { - if (line.startsWith(QLatin1Char('#'))) { - continue; - } - languagePackages << line.split(':').last(); - } - - languagePackages.removeAll(""); - } - - foreach (const QString &addon, tempList) { - bool shouldShow = true; - QApt::Package *package = m_backend->package(addon); - - if (!package || QString(package->section()).contains("lib") || addons.contains(package)) { - continue; - } - - foreach (const QString &langpack, languagePackages) { - if (addon.contains(langpack)) { - shouldShow = false; - break; - } - } - - if (shouldShow) { - addons << package; - } - } - - return addons; -} - -QList<PackageState> Application::addonsInformation() -{ - QList<PackageState> ret; - QApt::PackageList pkgs = addons(); - foreach(QApt::Package* p, pkgs) { - ret += PackageState(p->name(), p->shortDescription(), p->isInstalled()); - } - return ret; -} - -bool Application::isValid() const -{ - return m_isValid; -} - -bool Application::isTechnical() const -{ - return m_isTechnical; -} - -QByteArray Application::getField(const char* field, const QByteArray& defaultvalue) const -{ - if(m_data) { - KConfigGroup group = m_data->group("Desktop Entry"); - return group.readEntry(field, defaultvalue); - } else - return defaultvalue; - -} - -bool Application::hasField(const char* field) const -{ - return m_data && m_data->group("Desktop Entry").hasKey(field); -} - -QUrl Application::homepage() -{ - if(!m_package) return QString(); - return m_package->homepage(); -} - -QString Application::origin() const -{ - if(!m_package) return QString(); - return m_package->origin(); -} - -QString Application::longDescription() -{ - if(!m_package) return QString(); - return m_package->longDescription(); -} - -QString Application::availableVersion() const -{ - if(!m_package) return QString(); - return m_package->availableVersion(); -} - -QString Application::installedVersion() const -{ - if(!m_package) return QString(); - return m_package->installedVersion(); -} - -QString Application::sizeDescription() -{ - KFormat f; - if (!isInstalled()) { - return i18nc("@info app size", "%1 to download, %2 on disk", - f.formatByteSize(package()->downloadSize()), - f.formatByteSize(package()->availableInstalledSize())); - } else { - return i18nc("@info app size", "%1 on disk", - f.formatByteSize(package()->currentInstalledSize())); - } -} - -int Application::size() -{ - return m_package->downloadSize(); -} - -void Application::clearPackage() -{ - m_package = 0; -} - -QVector<KService::Ptr> Application::findExecutables() const -{ - QVector<KService::Ptr> ret; - if (!m_package) { - qWarning() << "trying to find the executables for an uninitialized package!" << packageName(); - return ret; - } - - foreach (const QString &desktop, m_package->installedFilesList().filter(QRegExp(".+\\.desktop$", Qt::CaseSensitive))) { - // Important to use serviceByStorageId to ensure we get a service even - // if the KSycoca database doesn't have our .desktop file yet. - KService::Ptr service = KService::serviceByStorageId(desktop); - if (service && - service->isApplication() && - !service->noDisplay() && - !service->exec().isEmpty()) - { - ret << service; - } - } - return ret; -} - -void Application::emitStateChanged() -{ - emit stateChanged(); -} - -void Application::invokeApplication() const -{ - QVector< KService::Ptr > execs = findExecutables(); - Q_ASSERT(!execs.isEmpty()); - KToolInvocation::startServiceByDesktopName(execs.first()->desktopEntryName()); -} - -bool Application::canExecute() const -{ - return !findExecutables().isEmpty(); -} - -QString Application::section() -{ - return package()->section(); -} - -AbstractResource::State Application::state() -{ - if (!package()) - return Broken; - - int s = package()->state(); - - if (s & QApt::Package::Upgradeable) { -#if QAPT_VERSION >= QT_VERSION_CHECK(3, 1, 0) - if (package()->isInUpdatePhase()) - return Upgradeable; -#else - return Upgradeable; -#endif - } - - if (s & QApt::Package::Installed) { - return Installed; - } - - return None; // Actually: none of interest to us here in muon-discover. -} - -void Application::fetchScreenshots() -{ - if(!m_sourceHasScreenshot) - return; - - QString dest = QStandardPaths::locate(QStandardPaths::TempLocation, "screenshots."+m_packageName); - const QUrl packageUrl(MuonDataSources::screenshotsSource().toString() + "/json/package/"+m_packageName); - KIO::StoredTransferJob* job = KIO::storedGet(packageUrl, KIO::NoReload, KIO::HideProgressInfo); - connect(job, SIGNAL(finished(KJob*)), SLOT(downloadingScreenshotsFinished(KJob*))); -} - -void Application::downloadingScreenshotsFinished(KJob* j) -{ - KIO::StoredTransferJob* job = qobject_cast< KIO::StoredTransferJob* >(j); - bool done = false; - if(job) { - QJsonParseError error; - QJsonDocument doc = QJsonDocument::fromJson(job->data(), &error); - if(error.error != QJsonParseError::NoError) { - QVariantMap values = doc.toVariant().toMap(); - QVariantList screenshots = values["screenshots"].toList(); - - QList<QUrl> thumbnailUrls, screenshotUrls; - foreach(const QVariant& screenshot, screenshots) { - QVariantMap s = screenshot.toMap(); - thumbnailUrls += s["small_image_url"].toUrl(); - screenshotUrls += s["large_image_url"].toUrl(); - } - emit screenshotsFetched(thumbnailUrls, screenshotUrls); - done = true; - } - } - if(!done) { - QList<QUrl> thumbnails, screenshots; - if(!thumbnailUrl().isEmpty()) { - thumbnails += thumbnailUrl(); - screenshots += screenshotUrl(); - } - emit screenshotsFetched(thumbnails, screenshots); - } - -} - -void Application::setHasScreenshot(bool has) -{ - m_sourceHasScreenshot = has; -} - -QStringList Application::executables() const -{ - QStringList ret; - const QVector<KService::Ptr> exes = findExecutables(); - for(KService::Ptr exe : exes) { - ret += exe->exec(); - } - return ret; -} - -bool Application::isFromSecureOrigin() const -{ - Q_FOREACH (const QString &archive, m_package->archives()) { - if (archive.contains(QLatin1String("security"))) { - return true; - } - } - return false; -} - -void Application::fetchChangelog() -{ - KIO::StoredTransferJob* getJob = KIO::storedGet(m_package->changelogUrl(), KIO::NoReload, KIO::HideProgressInfo); - connect(getJob, SIGNAL(result(KJob*)), - this, SLOT(processChangelog(KJob*))); -} - -void Application::processChangelog(KJob* j) -{ - KIO::StoredTransferJob* job = qobject_cast<KIO::StoredTransferJob*>(j); - if (!m_package || !job) { - return; - } - - QString changelog; - if(j->error()==0) - changelog = buildDescription(job->data(), m_package->sourcePackage()); - - if (changelog.isEmpty()) { - if (m_package->origin() == QStringLiteral("Ubuntu")) { - changelog = xi18nc("@info/rich", "The list of changes is not yet available. " - "Please use <link url='%1'>Launchpad</link> instead.", - QStringLiteral("http://launchpad.net/ubuntu/+source/") + m_package->sourcePackage()); - } else { - changelog = xi18nc("@info", "The list of changes is not yet available."); - } - } - emit changelogFetched(changelog); -} - -QString Application::buildDescription(const QByteArray& data, const QString& source) -{ - QApt::Changelog changelog(data, source); - QString description; - - QApt::ChangelogEntryList entries = changelog.newEntriesSince(m_package->installedVersion()); - - if (entries.size() < 1) { - return description; - } - - foreach(const QApt::ChangelogEntry &entry, entries) { - description += i18nc("@info:label Refers to a software version, Ex: Version 1.2.1:", - "Version %1:", entry.version()); - - KFormat f; - QString issueDate = entry.issueDateTime().toString(Qt::DefaultLocaleShortDate); - description += QLatin1String("<p>") + - i18nc("@info:label", "This update was issued on %1", issueDate) + - QLatin1String("</p>"); - - QString updateText = entry.description(); - updateText.replace('\n', QLatin1String("<br/>")); - description += QLatin1String("<p><pre>") + updateText + QLatin1String("</pre></p>"); - } - - return description; -} diff --git a/libmuon/backends/ApplicationBackend/Application.h b/libmuon/backends/ApplicationBackend/Application.h deleted file mode 100644 index 0a3de3b..0000000 --- a/libmuon/backends/ApplicationBackend/Application.h +++ /dev/null @@ -1,118 +0,0 @@ -/*************************************************************************** - * Copyright © 2010-2011 Jonathan Thomas <echidnaman@kubuntu.org> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef APPLICATION_H -#define APPLICATION_H - -#include <QtCore/QByteArray> -#include <QtCore/QHash> -#include <QtCore/QStringList> - -#include <KService> - -#include <QApt/Package> - -#include "libMuonCommon_export.h" -#include "resources/AbstractResource.h" - -class KJob; -class KConfig; -namespace QApt { - class Backend; -} - -class MUONCOMMON_EXPORT Application : public AbstractResource -{ -Q_OBJECT -Q_PROPERTY(QString menuPath READ menuPath CONSTANT) -public: - explicit Application(const QString &fileName, QApt::Backend *backend); - explicit Application(QApt::Package *package, QApt::Backend *backend); - - QString name(); - QString untranslatedName(); - QString comment(); - QApt::Package *package(); - QString icon() const; - QStringList mimetypes() const; - QString menuPath(); - QStringList categories(); - QString license(); - QUrl screenshotUrl(); - QUrl thumbnailUrl(); - virtual QList< PackageState > addonsInformation(); - bool isValid() const; - bool isTechnical() const; - QString packageName() const; - - //QApt::Package forwarding - QUrl homepage(); - QString longDescription(); - QString installedVersion() const; - QString availableVersion() const; - QString sizeDescription(); - QString origin() const; - int size(); - - bool hasScreenshot() const { return m_sourceHasScreenshot; } - void setHasScreenshot(bool has); - - void clearPackage(); - QVector<KService::Ptr> findExecutables() const; - virtual QStringList executables() const; - - /** Used to trigger the stateChanged signal from the ApplicationBackend */ - void emitStateChanged(); - - void invokeApplication() const; - - bool canExecute() const; - QString section(); - - virtual State state(); - virtual void fetchScreenshots(); - virtual void fetchChangelog(); - - bool isFromSecureOrigin() const; - QByteArray getField(const char* field, const QByteArray& defaultvalue = QByteArray()) const; - -private slots: - void processChangelog(KJob*); - void downloadingScreenshotsFinished(KJob*); - -private: - QString buildDescription(const QByteArray& data, const QString& source); - - QSharedPointer<KConfig> m_data; - QApt::Backend *m_backend; - QApt::Package *m_package; - QByteArray m_packageName; - - bool m_isValid; - bool m_isTechnical; - bool m_isExtrasApp; - bool m_sourceHasScreenshot; - - QApt::PackageList addons(); - QVector<QPair<QString, QString> > locateApplication(const QString &_relPath, const QString &menuId) const; - bool hasField(const char* field) const; -}; - -#endif diff --git a/libmuon/backends/ApplicationBackend/ApplicationBackend.cpp b/libmuon/backends/ApplicationBackend/ApplicationBackend.cpp deleted file mode 100644 index 5892027..0000000 --- a/libmuon/backends/ApplicationBackend/ApplicationBackend.cpp +++ /dev/null @@ -1,685 +0,0 @@ -/*************************************************************************** - * Copyright © 2010 Jonathan Thomas <echidnaman@kubuntu.org> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "ApplicationBackend.h" - -// Qt includes -#include <QtConcurrentRun> -#include <QtCore/QDir> -#include <QtCore/QStringBuilder> -#include <QtCore/QStringList> -#include <QtCore/QUuid> -#include <QTimer> -#include <QSignalMapper> -#include <QJsonDocument> -#include <QAction> - -// KDE includes -#include <KLocalizedString> -#include <KMessageBox> -#include <KProcess> -#include <KProtocolManager> -#include <KIO/Job> -#include <KActionCollection> -#include <KIconLoader> -#include <KXmlGuiWindow> - -// QApt/DebconfKDE includes -#include <QApt/Backend> -#include <QApt/Transaction> -#include <DebconfGui.h> - -//libmuonapt includes -#include "MuonStrings.h" -#include "ChangesDialog.h" -#include "QAptActions.h" - -// Own includes -#include "AptSourcesBackend.h" -#include "Application.h" -#include "ReviewsBackend.h" -#include "Transaction/Transaction.h" -#include "Transaction/TransactionModel.h" -#include "ApplicationUpdates.h" -#include <resources/SourcesModel.h> -#include <MuonDataSources.h> - -// static const KCatalogLoader loader("app-install-data"); //FIXME port - -MUON_BACKEND_PLUGIN(ApplicationBackend); - -ApplicationBackend::ApplicationBackend(QObject* parent) - : AbstractResourcesBackend(parent) - , m_backend(new QApt::Backend(this)) - , m_reviewsBackend(new ReviewsBackend(this)) - , m_isFetching(true) - , m_currentTransaction(nullptr) - , m_backendUpdater(new ApplicationUpdates(this)) - , m_aptify(nullptr) - , m_aptBackendInitialized(false) -{ - KIconLoader::global()->reconfigure(QString(), QStringList(QStringLiteral("/usr/share/app-install/icons/"))); - - m_watcher = new QFutureWatcher<QVector<Application*> >(this); - connect(m_watcher, SIGNAL(finished()), this, SLOT(setApplications())); - connect(m_reviewsBackend, SIGNAL(ratingsReady()), SIGNAL(allDataChanged())); - - QTimer::singleShot(10, this, SLOT(initBackend())); -} - -ApplicationBackend::~ApplicationBackend() -{ - qDeleteAll(m_appList); -} - -QVector<Application *> init(QApt::Backend *backend, QThread* thread) -{ - QVector<Application *> appList; - QDir appDir("/usr/share/app-install/desktop/"); - QStringList fileList = appDir.entryList(QStringList("*.desktop"), QDir::Files); - - QList<Application *> tempList; - QSet<QString> packages; - foreach(const QString &fileName, fileList) { - Application *app = new Application(appDir.filePath(fileName), backend); - packages.insert(app->packageName()); - tempList << app; - } - - foreach (QApt::Package *package, backend->availablePackages()) { - //Don't create applications twice - if(packages.contains(package->name())) - continue; - - if (package->isMultiArchDuplicate()) - continue; - - Application *app = new Application(package, backend); - tempList << app; - } - - // To be added an Application must have a package that: - // a) exists - // b) is not on the blacklist - // c) if not downloadable, then it must already be installed - Q_FOREACH (Application *app, tempList) { - bool added = false; - QApt::Package *pkg = app->package(); - if (app->isValid() && pkg) - { - appList << app; - app->moveToThread(thread); - added = true; - } - - if(!added) - delete app; - } - - return appList; -} - -void ApplicationBackend::setApplications() -{ - m_appList = m_watcher->future().result(); - Q_FOREACH (Application* app, m_appList) - app->setParent(this); - - KIO::StoredTransferJob* job = KIO::storedGet(QUrl(MuonDataSources::screenshotsSource().toString() + "/json/packages"),KIO::NoReload, KIO::DefaultFlags|KIO::HideProgressInfo); - connect(job, SIGNAL(finished(KJob*)), SLOT(initAvailablePackages(KJob*))); - - if (m_aptify) - QAptActions::self()->setCanExit(true); - setFetching(false); -} - -void ApplicationBackend::reload() -{ - if(isFetching()) { - qWarning() << "Reloading while already reloading... Please report."; - return; - } - setFetching(true); - if (m_aptify) - QAptActions::self()->setCanExit(false); - foreach(Application* app, m_appList) - app->clearPackage(); - qDeleteAll(m_transQueue); - m_transQueue.clear(); - m_reviewsBackend->stopPendingJobs(); - - if (!m_backend->reloadCache()) - QAptActions::self()->initError(); - - foreach(Application* app, m_appList) - app->package(); - - if (m_aptify) - QAptActions::self()->setCanExit(true); - setFetching(false); -} - -bool ApplicationBackend::isFetching() const -{ - return m_isFetching; -} - -bool ApplicationBackend::isValid() const -{ - // ApplicationBackend will force an application quit if it is invalid, so - // if it has not done that, the backend is valid. - return true; -} - -void ApplicationBackend::aptTransactionsChanged(QString active) -{ - // Find the newly-active QApt transaction in our list - QApt::Transaction *trans = nullptr; - - Q_FOREACH (QApt::Transaction *t, m_transQueue) { - if (t->transactionId() == active) { - trans = t; - break; - } - } - - if (!trans || m_transQueue.key(trans) == m_currentTransaction) - return; - - m_currentTransaction = m_transQueue.key(trans); - connect(trans, SIGNAL(statusChanged(QApt::TransactionStatus)), - this, SLOT(transactionEvent(QApt::TransactionStatus))); - connect(trans, SIGNAL(errorOccurred(QApt::ErrorCode)), - this, SLOT(errorOccurred(QApt::ErrorCode))); - connect(trans, SIGNAL(progressChanged(int)), - this, SLOT(updateProgress(int))); - // FIXME: untrusted packages, conf file prompt, media change -} - -void ApplicationBackend::transactionEvent(QApt::TransactionStatus status) -{ - auto iter = m_transQueue.find(m_currentTransaction); - if (iter == m_transQueue.end()) - return; - - TransactionModel *transModel = TransactionModel::global(); - - switch (status) { - case QApt::SetupStatus: - case QApt::AuthenticationStatus: - case QApt::WaitingStatus: - case QApt::WaitingLockStatus: - case QApt::WaitingMediumStatus: - case QApt::WaitingConfigFilePromptStatus: - case QApt::LoadingCacheStatus: - m_currentTransaction->setStatus(Transaction::SetupStatus); - break; - case QApt::RunningStatus: - m_currentTransaction->setStatus(Transaction::QueuedStatus); - break; - case QApt::DownloadingStatus: - m_currentTransaction->setStatus(Transaction::DownloadingStatus); - m_currentTransaction->setCancellable(false); - break; - case QApt::CommittingStatus: - m_currentTransaction->setStatus(Transaction::CommittingStatus); - - // Set up debconf - m_debconfGui = new DebconfKde::DebconfGui(iter.value()->debconfPipe()); - m_debconfGui->connect(m_debconfGui, SIGNAL(activated()), m_debconfGui, SLOT(show())); - m_debconfGui->connect(m_debconfGui, SIGNAL(deactivated()), m_debconfGui, SLOT(hide())); - break; - case QApt::FinishedStatus: - m_currentTransaction->setStatus(Transaction::DoneStatus); - - // Clean up manually created debconf pipe - QApt::Transaction *trans = iter.value(); - if (!trans->debconfPipe().isEmpty()) - QFile::remove(trans->debconfPipe()); - - // Cleanup - trans->deleteLater(); - transModel->removeTransaction(m_currentTransaction); - m_transQueue.remove(iter.key()); - - qobject_cast<Application*>(m_currentTransaction->resource())->emitStateChanged(); - delete m_currentTransaction; - m_currentTransaction = nullptr; - - if (m_transQueue.isEmpty()) - reload(); - break; - } -} - -void ApplicationBackend::errorOccurred(QApt::ErrorCode error) -{ - if (m_transQueue.isEmpty()) // Shouldn't happen - return; - - if( error == QApt::AuthError){ - m_currentTransaction->cancel(); - m_transQueue.remove(m_currentTransaction); - m_currentTransaction->deleteLater(); - m_currentTransaction = nullptr; - } - QAptActions::self()->displayTransactionError(error, m_transQueue.value(m_currentTransaction)); -} - -void ApplicationBackend::updateProgress(int percentage) -{ - if(!m_currentTransaction) { - qDebug() << "missing transaction"; - return; - } - m_currentTransaction->setProgress(percentage); -} - -bool ApplicationBackend::confirmRemoval(QApt::StateChanges changes) -{ - const QApt::PackageList removeList = changes.value(QApt::Package::ToRemove); - if (removeList.isEmpty()) - return true; - - QApt::StateChanges removals; - removals[QApt::Package::ToRemove] = removeList; - - QPointer<ChangesDialog> dialog = new ChangesDialog(mainWindow(), removals); - bool ret = dialog->exec() == QDialog::Accepted; - delete dialog; - return ret; -} - -void ApplicationBackend::markTransaction(Transaction *transaction) -{ - Application *app = qobject_cast<Application*>(transaction->resource()); - - switch (transaction->role()) { - case Transaction::InstallRole: - app->package()->setInstall(); - markLangpacks(transaction); - break; - case Transaction::RemoveRole: - app->package()->setRemove(); - break; - default: - break; - } - - AddonList addons = transaction->addons(); - - Q_FOREACH (const QString &pkgStr, addons.addonsToInstall()) { - QApt::Package *package = m_backend->package(pkgStr); - package->setInstall(); - } - - Q_FOREACH (const QString &pkgStr, addons.addonsToRemove()) { - QApt::Package *package = m_backend->package(pkgStr); - package->setRemove(); - } -} - -void ApplicationBackend::markLangpacks(Transaction *transaction) -{ - QString prog = QStandardPaths::findExecutable("check-language-support"); - if (prog.isEmpty()){ - prog = QStandardPaths::locate(QStandardPaths::GenericDataLocation, "muon/scripts/check-language-support"); - if ( prog.isEmpty()){ - return; - } - } - - QString language = QLocale().name(); - QString pkgName = transaction->resource()->packageName(); - - QStringList args; - args << prog << QLatin1String("-l") << language << QLatin1String("-p") << pkgName; - - KProcess proc; - proc.setOutputChannelMode(KProcess::OnlyStdoutChannel); - proc.setProgram(args); - proc.start(); - proc.waitForFinished(); - - QString res = proc.readAllStandardOutput(); - res.remove(QString()); - - m_backend->setCompressEvents(true); - foreach(const QString &pkg, res.split(' ')) - { - QApt::Package *langPack = m_backend->package(pkg.trimmed()); - - if (langPack) - langPack->setInstall(); - } - m_backend->setCompressEvents(false); -} - -void ApplicationBackend::addTransaction(Transaction *transaction) -{ - if(!transaction){ - return; - } - QApt::CacheState oldCacheState = m_backend->currentCacheState(); - m_backend->saveCacheState(); - - markTransaction(transaction); - - // Find changes due to markings - QApt::PackageList excluded; - excluded.append(qobject_cast<Application*>(transaction->resource())->package()); - // Exclude addons being marked - Q_FOREACH (const QString &pkgStr, transaction->addons().addonsToInstall()) { - QApt::Package *addon = m_backend->package(pkgStr); - - if (addon) - excluded.append(addon); - } - - Q_FOREACH (const QString &pkgStr, transaction->addons().addonsToRemove()) { - QApt::Package *addon = m_backend->package(pkgStr); - - if (addon) - excluded.append(addon); - } - - QApt::StateChanges changes = m_backend->stateChanges(oldCacheState, excluded); - - if (!confirmRemoval(changes)) { - m_backend->restoreCacheState(oldCacheState); - transaction->deleteLater(); - return; - } - - Application *app = qobject_cast<Application*>(transaction->resource()); - - if (app->package()->wouldBreak()) { - m_backend->restoreCacheState(oldCacheState); - //TODO Notify of error - } - - QApt::Transaction *aptTrans = m_backend->commitChanges(); - setupTransaction(aptTrans); - TransactionModel::global()->addTransaction(transaction); - m_transQueue.insert(transaction, aptTrans); - aptTrans->run(); - m_backend->restoreCacheState(oldCacheState); // Undo temporary simulation marking - - if (m_transQueue.count() == 1) { - aptTransactionsChanged(aptTrans->transactionId()); - m_currentTransaction = transaction; - } -} - -void ApplicationBackend::cancelTransaction(AbstractResource* app) -{ - for (auto iter = m_transQueue.begin(); iter != m_transQueue.end(); ++iter) { - Transaction* t = iter.key(); - QApt::Transaction *aptTrans = iter.value(); - - if (t->resource() == app) { - if (t->isCancellable()) { - aptTrans->cancel(); - } - break; - } - } - // Emitting the cancellation occurs when the QApt trans is finished -} - -QApt::Backend* ApplicationBackend::backend() const -{ - return m_backend; -} - -AbstractReviewsBackend *ApplicationBackend::reviewsBackend() const -{ - return m_reviewsBackend; -} - -QVector<AbstractResource*> ApplicationBackend::allResources() const -{ - QVector<AbstractResource*> ret; - - Q_FOREACH (Application* app, m_appList) { - ret += app; - } - return ret; -} - -void ApplicationBackend::installApplication(AbstractResource* res, AddonList addons) -{ - Application* app = qobject_cast<Application*>(res); - Transaction::Role role = app->package()->isInstalled() ? Transaction::ChangeAddonsRole : Transaction::InstallRole; - addTransaction(new Transaction(this, res, role, addons)); -} - -void ApplicationBackend::installApplication(AbstractResource* app) -{ - addTransaction(new Transaction(this, app, Transaction::InstallRole)); -} - -void ApplicationBackend::removeApplication(AbstractResource* app) -{ - addTransaction(new Transaction(this, app, Transaction::RemoveRole)); -} - -int ApplicationBackend::updatesCount() const -{ - if(m_isFetching) - return 0; - - int count = 0; - foreach(Application* app, m_appList) { - count += app->canUpgrade(); - } - return count; -} - -AbstractResource* ApplicationBackend::resourceByPackageName(const QString& name) const -{ - foreach(Application* app, m_appList) { - if(app->packageName()==name) - return app; - } - return 0; -} - -QList<AbstractResource*> ApplicationBackend::searchPackageName(const QString& searchText) -{ - QList<AbstractResource*> resources; - if(m_isFetching) { - qWarning() << "searching while fetching!!!"; - return resources; - } - - QSet<QApt::Package*> packages = m_backend->search(searchText).toSet(); - - foreach(Application* a, m_appList) { - if(packages.contains(a->package())) { - resources += a; - } - } - return resources; -} - -AbstractBackendUpdater* ApplicationBackend::backendUpdater() const -{ - return m_backendUpdater; -} - -void ApplicationBackend::integrateMainWindow(KXmlGuiWindow* w) -{ - m_aptify = w; - QAptActions* apt = QAptActions::self(); - apt->setMainWindow(w); - if(!m_aptBackendInitialized) - connect(this, SIGNAL(aptBackendInitialized(QApt::Backend*)), apt, SLOT(setBackend(QApt::Backend*))); - if (apt->reloadWhenSourcesEditorFinished()) - connect(apt, SIGNAL(sourcesEditorClosed(bool)), SLOT(reload())); - QAction* updateAction = w->actionCollection()->addAction("update"); - updateAction->setIcon(QIcon::fromTheme("system-software-update")); - updateAction->setText(i18nc("@action Checks the Internet for updates", "Check for Updates")); - updateAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_R)); - updateAction->setEnabled(apt->isConnected()); - connect(updateAction, SIGNAL(triggered()), SLOT(checkForUpdates())); - connect(apt, SIGNAL(shouldConnect(bool)), updateAction, SLOT(setEnabled(bool))); -} - -QWidget* ApplicationBackend::mainWindow() const -{ - return QAptActions::self()->mainWindow(); -} - -void ApplicationBackend::initBackend() -{ - setFetching(true); - if (m_aptify) { - QAptActions::self()->setCanExit(false); - QAptActions::self()->setReloadWhenEditorFinished(true); - } - - QAptActions::self()->setBackend(m_backend); - if (m_backend->xapianIndexNeedsUpdate()) - m_backend->updateXapianIndex(); - - m_aptBackendInitialized = true; - emit aptBackendInitialized(m_backend); - - m_backend->setUndoRedoCacheSize(1); - m_reviewsBackend->setAptBackend(m_backend); - m_backendUpdater->setBackend(m_backend); - - QFuture<QVector<Application*> > future = QtConcurrent::run(init, m_backend, QThread::currentThread()); - m_watcher->setFuture(future); - connect(m_backend, SIGNAL(transactionQueueChanged(QString,QStringList)), - this, SLOT(aptTransactionsChanged(QString))); - connect(m_backend, SIGNAL(xapianUpdateFinished()), - this, SIGNAL(searchInvalidated())); - - SourcesModel::global()->addSourcesBackend(new AptSourcesBackend(this)); -} - -void ApplicationBackend::setupTransaction(QApt::Transaction *trans) -{ - // Provide proxy/locale to the transaction - if (KProtocolManager::proxyType() == KProtocolManager::ManualProxy) { - trans->setProxy(KProtocolManager::proxyFor("http")); - } - - trans->setLocale(QLatin1String(setlocale(LC_MESSAGES, 0))); - - // Debconf - QString uuid = QUuid::createUuid().toString(); - uuid.remove('{').remove('}').remove('-'); - QFile pipe(QDir::tempPath() % QLatin1String("/qapt-sock-") % uuid); - pipe.open(QFile::ReadWrite); - pipe.close(); - trans->setDebconfPipe(pipe.fileName()); -} - -void ApplicationBackend::sourcesEditorClosed() -{ - reload(); - emit sourcesEditorFinished(); -} - -void ApplicationBackend::initAvailablePackages(KJob* j) -{ - KIO::StoredTransferJob* job = qobject_cast<KIO::StoredTransferJob*>(j); - Q_ASSERT(job); - - QJsonParseError error; - QJsonDocument doc = QJsonDocument::fromJson(job->data(), &error); - if(error.error != QJsonParseError::NoError) - qWarning() << "errors!" << error.errorString(); - else { - QVariantList data = doc.toVariant().toMap().value("packages").toList(); - Q_ASSERT(!m_appList.isEmpty()); - QSet<QString> packages; - foreach(const QVariant& v, data) { - packages += v.toMap().value("name").toString(); - } - Q_ASSERT(packages.count()==data.count()); - Q_FOREACH (Application* a, m_appList) { - a->setHasScreenshot(packages.contains(a->packageName())); - } - } -} - -QList< AbstractResource* > ApplicationBackend::upgradeablePackages() const -{ - QList<AbstractResource*> ret; - foreach(AbstractResource* r, m_appList) { - if(r->state()==AbstractResource::Upgradeable) - ret+=r; - } - return ret; -} - -void ApplicationBackend::checkForUpdates() -{ - QApt::Transaction* transaction = backend()->updateCache(); - m_backendUpdater->setupTransaction(transaction); - transaction->run(); - m_backendUpdater->setProgressing(true); - connect(transaction, SIGNAL(finished(QApt::ExitStatus)), SLOT(updateFinished(QApt::ExitStatus))); -} - -void ApplicationBackend::updateFinished(QApt::ExitStatus status) -{ - if(status != QApt::ExitSuccess) { - qWarning() << "updating was not successful"; - } - m_backendUpdater->setProgressing(false); -} - -void ApplicationBackend::setFetching(bool f) -{ - if(m_isFetching != f) { - m_isFetching = f; - emit fetchingChanged(); - if(!m_isFetching) { - emit searchInvalidated(); - emit updatesCountChanged(); - } - } -} - -QList<QAction*> ApplicationBackend::messageActions() const -{ - QList<QAction*> ret; - //high priority - ret += QAptActions::self()->actionCollection()->action("dist-upgrade"); - - //normal priority - ret += QAptActions::self()->actionCollection()->action("update"); - - //low priority - ret += QAptActions::self()->actionCollection()->action("software_properties"); - ret += QAptActions::self()->actionCollection()->action("load_archives"); - ret += QAptActions::self()->actionCollection()->action("save_package_list"); - ret += QAptActions::self()->actionCollection()->action("download_from_list"); - ret += QAptActions::self()->actionCollection()->action("history"); - Q_ASSERT(!ret.contains(nullptr)); - return ret; -} - -#include "ApplicationBackend.moc" diff --git a/libmuon/backends/ApplicationBackend/ApplicationBackend.h b/libmuon/backends/ApplicationBackend/ApplicationBackend.h deleted file mode 100644 index 4885cc2..0000000 --- a/libmuon/backends/ApplicationBackend/ApplicationBackend.h +++ /dev/null @@ -1,128 +0,0 @@ -/*************************************************************************** - * Copyright © 2010 Jonathan Thomas <echidnaman@kubuntu.org> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef APPLICATIONBACKEND_H -#define APPLICATIONBACKEND_H - -#include <QFutureWatcher> -#include <QtCore/QObject> -#include <QtCore/QQueue> -#include <QtCore/QSet> -#include <QtCore/QStringList> -#include <QtCore/QVector> - -#include <QApt/Package> -#include <QApt/Backend> - -#include "resources/AbstractResourcesBackend.h" - -namespace QApt { - class Backend; - class Transaction; -} -namespace DebconfKde { - class DebconfGui; -} - -class Application; -class ApplicationUpdates; -class ReviewsBackend; -class Transaction; -class QAptActions; -class KJob; - -class ApplicationBackend : public AbstractResourcesBackend -{ - Q_OBJECT - Q_PROPERTY(QObject* backend READ backend) -public: - explicit ApplicationBackend(QObject *parent = 0); - ~ApplicationBackend(); - - bool isValid() const; - AbstractReviewsBackend *reviewsBackend() const; - Q_SCRIPTABLE AbstractResource* resourceByPackageName(const QString& name) const; - QApt::Backend* backend() const; - - int updatesCount() const; - - bool confirmRemoval(QApt::StateChanges changes); - bool isFetching() const; - void markTransaction(Transaction *transaction); - void markLangpacks(Transaction *transaction); - - QVector< AbstractResource* > allResources() const; - QList<AbstractResource*> searchPackageName(const QString& searchText); - - void installApplication(AbstractResource *app, AddonList addons); - void installApplication(AbstractResource *app); - void removeApplication(AbstractResource *app); - void cancelTransaction(AbstractResource *app); - - AbstractBackendUpdater* backendUpdater() const; - void integrateMainWindow(KXmlGuiWindow* w); - QWidget* mainWindow() const; - virtual QList<AbstractResource*> upgradeablePackages() const; - virtual QList<QAction*> messageActions() const; - -private: - void setFetching(bool f); - - QApt::Backend *m_backend; - ReviewsBackend *m_reviewsBackend; - bool m_isFetching; - - QFutureWatcher<QVector<Application*> >* m_watcher; - QVector<Application *> m_appList; - - // Transactions - QHash<Transaction *, QApt::Transaction *> m_transQueue; - Transaction *m_currentTransaction; - - DebconfKde::DebconfGui *m_debconfGui; - ApplicationUpdates* m_backendUpdater; - KXmlGuiWindow *m_aptify; - bool m_aptBackendInitialized; - -public Q_SLOTS: - void reload(); - void addTransaction(Transaction *transaction); - //helper functions - void initAvailablePackages(KJob*); - -private Q_SLOTS: - void setApplications(); - void aptTransactionsChanged(QString active); - void transactionEvent(QApt::TransactionStatus status); - void errorOccurred(QApt::ErrorCode error); - void updateProgress(int percentage); - void initBackend(); - void setupTransaction(QApt::Transaction *trans); - void sourcesEditorClosed(); - void checkForUpdates(); - void updateFinished(QApt::ExitStatus); - -Q_SIGNALS: - void startingFirstTransaction(); - void sourcesEditorFinished(); - void aptBackendInitialized(QApt::Backend* backend); -}; - -#endif diff --git a/libmuon/backends/ApplicationBackend/ApplicationNotifier.cpp b/libmuon/backends/ApplicationBackend/ApplicationNotifier.cpp deleted file mode 100644 index fa4d8b0..0000000 --- a/libmuon/backends/ApplicationBackend/ApplicationNotifier.cpp +++ /dev/null @@ -1,165 +0,0 @@ -/*************************************************************************** - * Copyright © 2013 Lukas Appelhans <l.appelhans@gmx.de> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ -#include "ApplicationNotifier.h" - -// Qt includes -#include <QtCore/QFile> -#include <QtCore/QTimer> -#include <QtCore/QDebug> -#include <QtCore/QStandardPaths> -#include <QtCore/QProcess> -#include <QtGui/QIcon> - -// KDE includes -#include <KDirWatch> -#include <KLocalizedString> -#include <KPluginFactory> -#include <KNotification> -#include <KIconLoader> - -ApplicationNotifier::ApplicationNotifier(QObject* parent) - : BackendNotifierModule(parent) - , m_checkerProcess(Q_NULLPTR) - , m_updateCheckerProcess(Q_NULLPTR) - , m_securityUpdates(0) - , m_normalUpdates(0) -{ - KDirWatch *stampDirWatch = new KDirWatch(this); - stampDirWatch->addFile("/var/lib/update-notifier/dpkg-run-stamp"); - connect(stampDirWatch, &KDirWatch::dirty, this, &ApplicationNotifier::distUpgradeEvent); - - stampDirWatch = new KDirWatch(this); - stampDirWatch->addDir("/var/lib/apt/lists/"); - stampDirWatch->addDir("/var/lib/apt/lists/partial/"); - stampDirWatch->addFile("/var/lib/update-notifier/updates-available"); - stampDirWatch->addFile("/var/lib/update-notifier/dpkg-run-stamp"); - connect(stampDirWatch, &KDirWatch::dirty, this, &ApplicationNotifier::recheckSystemUpdateNeeded); - - //check in 2 minutes - QTimer::singleShot(2 * 60 * 1000, this, &ApplicationNotifier::recheckSystemUpdateNeeded); - - init(); -} - -ApplicationNotifier::~ApplicationNotifier() -{ -} - -void ApplicationNotifier::init() -{ - recheckSystemUpdateNeeded(); - distUpgradeEvent(); -} - -void ApplicationNotifier::distUpgradeEvent() -{ - QString checkerFile = QStandardPaths::locate(QStandardPaths::GenericDataLocation, "libmuon/applicationsbackend/releasechecker"); - if (checkerFile.isEmpty()) { - qWarning() << "Couldn't find the releasechecker" << checkerFile << QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation); - return; - } - m_checkerProcess = new QProcess(this); - connect(m_checkerProcess, SIGNAL(finished(int)), - this, SLOT(checkUpgradeFinished(int))); - m_checkerProcess->start("/usr/bin/python3", QStringList() << checkerFile); -} - -void ApplicationNotifier::checkUpgradeFinished(int exitStatus) -{ - if (exitStatus == 0) { - KNotification *n = KNotification::event("DistUpgrade", - i18n("System update available!"), - i18nc("Notification when a new version of Kubuntu is available", - "A new version of Kubuntu is available"), - QStringLiteral("system-software-update"), - nullptr, - KNotification::CloseOnTimeout, - "muonapplicationnotifier"); - n->setActions(QStringList() << i18n("Upgrade")); - connect(n, &KNotification::action1Activated, this, &ApplicationNotifier::upgradeActivated); - } - - m_checkerProcess->deleteLater(); - m_checkerProcess = nullptr; -} - -void ApplicationNotifier::upgradeActivated() -{ - const QString kdesu = QFile::decodeName(CMAKE_INSTALL_FULL_LIBEXECDIR_KF5 "/kdesu"); - QProcess::startDetached(kdesu, { "--", "do-release-upgrade", "-m", "desktop", "-f", "DistUpgradeViewKDE" }); -} - -void ApplicationNotifier::recheckSystemUpdateNeeded() -{ - if (m_updateCheckerProcess->state() == QProcess::Running) - return; - - m_updateCheckerProcess = new QProcess(this); - connect(m_updateCheckerProcess, static_cast<void(QProcess::*)(int)>(&QProcess::finished), this, &ApplicationNotifier::parseUpdateInfo); - m_updateCheckerProcess->start("/usr/lib/update-notifier/apt-check"); -} - -void ApplicationNotifier::parseUpdateInfo() -{ -#warning why does this parse stdout and not use qapt, wtf... - m_securityUpdates = 0; - m_normalUpdates = 0; - // Weirdly enough, apt-check gives output on stderr - QByteArray line = m_updateCheckerProcess->readAllStandardError(); - m_updateCheckerProcess->deleteLater(); - m_updateCheckerProcess = nullptr; - - // Format updates;security - int eqpos = line.indexOf(';'); - - if (eqpos > 0) { - QByteArray updatesString = line.left(eqpos); - QByteArray securityString = line.right(line.size() - eqpos - 1); - - int securityUpdates = securityString.toInt(); - setUpdates(updatesString.toInt() - securityUpdates, securityUpdates); - } -} - -void ApplicationNotifier::setUpdates(int normal, int security) -{ - if (m_normalUpdates != normal || security != m_securityUpdates) { - m_normalUpdates = normal; - m_securityUpdates = security; - emit foundUpdates(); - } -} - -bool ApplicationNotifier::isSystemUpToDate() const -{ - return (m_securityUpdates+m_normalUpdates)==0; -} - -uint ApplicationNotifier::securityUpdatesCount() -{ - return m_securityUpdates; -} - -uint ApplicationNotifier::updatesCount() -{ - return m_normalUpdates; -} - -#include "ApplicationNotifier.moc" diff --git a/libmuon/backends/ApplicationBackend/ApplicationNotifier.h b/libmuon/backends/ApplicationBackend/ApplicationNotifier.h deleted file mode 100644 index 3f575f1..0000000 --- a/libmuon/backends/ApplicationBackend/ApplicationNotifier.h +++ /dev/null @@ -1,60 +0,0 @@ -/*************************************************************************** - * Copyright © 2013 Lukas Appelhans <l.appelhans@gmx.de> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ -#ifndef APPLICATIONNOTIFIER_H -#define APPLICATIONNOTIFIER_H - -#include <BackendNotifierModule.h> -#include <QVariantList> - -class DistUpgradeEvent; -class UpdateEvent; -class QProcess; - -class ApplicationNotifier : public BackendNotifierModule -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID "org.kde.muon.BackendNotifierModule") - Q_INTERFACES(BackendNotifierModule) -public: - ApplicationNotifier(QObject* parent = 0); - virtual ~ApplicationNotifier(); - - bool isSystemUpToDate() const Q_DECL_OVERRIDE Q_DECL_FINAL; - uint securityUpdatesCount() Q_DECL_OVERRIDE Q_DECL_FINAL; - uint updatesCount() Q_DECL_OVERRIDE Q_DECL_FINAL; - -private slots: - void checkUpgradeFinished(int exitStatus); - void distUpgradeEvent(); - void recheckSystemUpdateNeeded() Q_DECL_OVERRIDE Q_DECL_FINAL; - void parseUpdateInfo(); - void upgradeActivated(); - void init(); - -private: - void setUpdates(int normal, int security); - - QProcess *m_checkerProcess; - QProcess *m_updateCheckerProcess; - int m_securityUpdates; - int m_normalUpdates; -}; - -#endif diff --git a/libmuon/backends/ApplicationBackend/ApplicationUpdates.cpp b/libmuon/backends/ApplicationBackend/ApplicationUpdates.cpp deleted file mode 100644 index 61034b1..0000000 --- a/libmuon/backends/ApplicationBackend/ApplicationUpdates.cpp +++ /dev/null @@ -1,469 +0,0 @@ -/*************************************************************************** - * Copyright © 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "ApplicationUpdates.h" - -// Qt includes -#include <QIcon> -#include <QAction> - -// KDE includes -#include <KProtocolManager> -#include <KMessageBox> -#include <KActionCollection> -#include <KLocalizedString> -#include <KXmlGuiWindow> - -// Own includes -#include <QApt/Transaction> - -#include <ChangesDialog.h> -#include <MuonStrings.h> -#include <QAptActions.h> - -#include "Application.h" -#include "ApplicationBackend.h" - -ApplicationUpdates::ApplicationUpdates(ApplicationBackend* parent) - : AbstractBackendUpdater(parent) - , m_aptBackend(nullptr) - , m_appBackend(parent) - , m_lastRealProgress(0) - , m_eta(0) - , m_progressing(false) -{ - connect(m_appBackend, SIGNAL(fetchingChanged()), SLOT(fetchingChanged())); -} - -bool ApplicationUpdates::hasUpdates() const -{ - return m_appBackend->updatesCount()>0; -} - -qreal ApplicationUpdates::progress() const -{ - return m_lastRealProgress; -} - -long unsigned int ApplicationUpdates::remainingTime() const -{ - return m_eta; -} - -void ApplicationUpdates::setBackend(QApt::Backend* backend) -{ - Q_ASSERT(!m_aptBackend || m_aptBackend==backend); - m_aptBackend = backend; - // FIXME: Debconf support was lost during the port - QApt::FrontendCaps caps = (QApt::FrontendCaps)(QApt::MediumPromptCap | - QApt::ConfigPromptCap | QApt::UntrustedPromptCap); - m_aptBackend->setFrontendCaps(caps); -} - -QList<AbstractResource*> ApplicationUpdates::toUpdate() const -{ - return m_toUpdate; -} - -void ApplicationUpdates::restoreToCleanCache() -{ - if(!m_updatesCache.isEmpty()) - m_aptBackend->restoreCacheState(m_updatesCache); - else { - //this is my best bet for retrieving a clean cache, I'm unsure if there's a better way - m_updatesCache = m_aptBackend->currentCacheState(); - } - Q_ASSERT(m_aptBackend->markedPackages().isEmpty()); -} - -void ApplicationUpdates::prepare() -{ - restoreToCleanCache(); - - m_aptBackend->markPackagesForDistUpgrade(); - calculateUpdates(); -} - -void ApplicationUpdates::start() -{ - Q_ASSERT(!m_updatesCache.isEmpty()); - auto changes = m_aptBackend->stateChanges(m_updatesCache, QApt::PackageList()); - if(changes.isEmpty()) { - qWarning() << "couldn't find any apt updates"; - setProgressing(false); - return; - } - for(auto it=changes.begin(); it!=changes.end(); ) { - if(it.key()&QApt::Package::ToUpgrade) { - it = changes.erase(it); - } else { - ++it; - } - } - // Confirm additional changes beyond upgrading the files - if(!changes.isEmpty()) { - ChangesDialog d(m_appBackend->mainWindow(), changes); - if(d.exec()==QDialog::Rejected) { - setProgressing(false); - return; - } - } - - // Create and run the transaction - setupTransaction(m_aptBackend->commitChanges()); - m_trans->run(); - setProgressing(true); -} - -void ApplicationUpdates::addResources(const QList<AbstractResource*>& apps) -{ - QList<QApt::Package*> packages; - foreach(AbstractResource* res, apps) { - Application* app = qobject_cast<Application*>(res); - Q_ASSERT(app); - packages += app->package(); - } - m_aptBackend->markPackages(packages, QApt::Package::ToInstall); -} - -void ApplicationUpdates::removeResources(const QList<AbstractResource*>& apps) -{ - QList<QApt::Package*> packages; - foreach(AbstractResource* res, apps) { - Application* app = qobject_cast<Application*>(res); - Q_ASSERT(app); - packages += app->package(); - } - m_aptBackend->markPackages(packages, QApt::Package::ToKeep); -} - -void ApplicationUpdates::setProgress(int progress) -{ - if (progress > 100) - return; - - if (progress > m_lastRealProgress || progress<0) { - m_lastRealProgress = progress; - emit progressChanged((qreal)progress); - } -} - -void ApplicationUpdates::etaChanged(quint64 eta) -{ - if(m_eta != eta) { - m_eta = eta; - emit remainingTimeChanged(); - } -} - -void ApplicationUpdates::installMessage(const QString& msg) -{ - setStatusMessage(msg); -} - -void ApplicationUpdates::errorOccurred(QApt::ErrorCode error) -{ - if(error!=QApt::Success) { - QAptActions::self()->displayTransactionError(error, m_trans); - setProgressing(false); - } -} - -void ApplicationUpdates::setupTransaction(QApt::Transaction *trans) -{ - Q_ASSERT(trans); - m_trans = trans; - - // Provide proxy/locale to the transaction - if (KProtocolManager::proxyType() == KProtocolManager::ManualProxy) { - trans->setProxy(KProtocolManager::proxyFor("http")); - } - - trans->setLocale(QLatin1String(setlocale(LC_MESSAGES, 0))); - - connect(trans, SIGNAL(errorOccurred(QApt::ErrorCode)), - SLOT(errorOccurred(QApt::ErrorCode))); - connect(trans, SIGNAL(progressChanged(int)), SLOT(setProgress(int))); - connect(trans, SIGNAL(statusDetailsChanged(QString)), SLOT(installMessage(QString))); - connect(trans, SIGNAL(cancellableChanged(bool)), SIGNAL(cancelableChanged(bool))); - connect(trans, SIGNAL(finished(QApt::ExitStatus)), trans, SLOT(deleteLater())); - connect(trans, SIGNAL(statusChanged(QApt::TransactionStatus)), - this, SLOT(statusChanged(QApt::TransactionStatus))); - connect(trans, SIGNAL(mediumRequired(QString,QString)), - this, SLOT(provideMedium(QString,QString))); - connect(trans, SIGNAL(promptUntrusted(QStringList)), - this, SLOT(untrustedPrompt(QStringList))); - connect(trans, SIGNAL(configFileConflict(QString,QString)), - this, SLOT(configFileConflict(QString,QString))); - connect(trans, SIGNAL(downloadSpeedChanged(quint64)), - this, SIGNAL(downloadSpeedChanged(quint64))); - connect(trans, SIGNAL(finished(QApt::ExitStatus)), - this, SLOT(transactionFinished(QApt::ExitStatus))); -} - -void ApplicationUpdates::transactionFinished(QApt::ExitStatus ) -{ - m_lastRealProgress = 0; - m_updatesCache.clear(); - m_toUpdate.clear(); - m_appBackend->reload(); - setProgressing(false); -} - - -bool ApplicationUpdates::isAllMarked() const -{ - QApt::PackageList upgradeable = m_aptBackend->upgradeablePackages(); - int markedCount = m_aptBackend->packageCount(QApt::Package::ToUpgrade); - return markedCount >= upgradeable.count(); -} - -QDateTime ApplicationUpdates::lastUpdate() const -{ - return m_aptBackend->timeCacheLastUpdated(); -} - -bool ApplicationUpdates::isCancelable() const -{ - return m_trans && m_trans->isCancellable(); -} - -bool ApplicationUpdates::isProgressing() const -{ - return m_progressing; -} - -void ApplicationUpdates::provideMedium(const QString &label, const QString &medium) -{ - QString title = i18nc("@title:window", "Media Change Required"); - QString text = xi18nc("@label", "Please insert %1 into <filename>%2</filename>", - label, medium); - - KMessageBox::information(QAptActions::self()->mainWindow(), text, title); - m_trans->provideMedium(medium); -} - -void ApplicationUpdates::untrustedPrompt(const QStringList &untrustedPackages) -{ - QString title = i18nc("@title:window", "Warning - Unverified Software"); - QString text = xi18ncp("@label", - "The following piece of software cannot be verified. " - "<warning>Installing unverified software represents a " - "security risk, as the presence of unverifiable software " - "can be a sign of tampering.</warning> Do you wish to continue?", - "The following pieces of software cannot be verified. " - "<warning>Installing unverified software represents a " - "security risk, as the presence of unverifiable software " - "can be a sign of tampering.</warning> Do you wish to continue?", - untrustedPackages.size()); - int result = KMessageBox::warningContinueCancelList(QAptActions::self()->mainWindow(), - text, untrustedPackages, title); - - bool installUntrusted = (result == KMessageBox::Continue); - m_trans->replyUntrustedPrompt(installUntrusted); -} - -void ApplicationUpdates::configFileConflict(const QString ¤tPath, const QString &newPath) -{ - QString title = i18nc("@title:window", "Configuration File Changed"); - QString text = xi18nc("@label Notifies a config file change", - "A new version of the configuration file " - "<filename>%1</filename> is available, but your version has " - "been modified. Would you like to keep your current version " - "or install the new version?", currentPath); - - KGuiItem useNew(i18nc("@action Use the new config file", "Use New Version")); - KGuiItem useOld(i18nc("@action Keep the old config file", "Keep Old Version")); - - // TODO: diff current and new paths - Q_UNUSED(newPath) - - int ret = KMessageBox::questionYesNo(QAptActions::self()->mainWindow(), text, title, useNew, useOld); - - m_trans->resolveConfigFileConflict(currentPath, (ret == KMessageBox::Yes)); -} - -void ApplicationUpdates::statusChanged(QApt::TransactionStatus status) -{ - switch (status) { - case QApt::SetupStatus: - setProgressing(true); - setStatusMessage(i18nc("@info Status info, widget title", - "Starting")); - setProgress(-1); - break; - case QApt::AuthenticationStatus: - setStatusMessage(i18nc("@info Status info, widget title", - "Waiting for Authentication")); - setProgress(-1); - break; - case QApt::WaitingStatus: - setStatusMessage(i18nc("@info Status information, widget title", - "Waiting")); - setStatusDetail(i18nc("@info Status info", - "Waiting for other transactions to finish")); - setProgress(-1); - break; - case QApt::WaitingLockStatus: - setStatusMessage(i18nc("@info Status information, widget title", - "Waiting")); - setStatusDetail(i18nc("@info Status info", - "Waiting for other software managers to quit")); - setProgress(-1); - break; - case QApt::WaitingMediumStatus: - setStatusMessage(i18nc("@info Status information, widget title", - "Waiting")); - setStatusDetail(i18nc("@info Status info", - "Waiting for required medium")); - setProgress(-1); - break; - case QApt::WaitingConfigFilePromptStatus: - setStatusMessage(i18nc("@info Status information, widget title", - "Waiting")); - setStatusDetail(i18nc("@info Status info", - "Waiting for configuration file")); - setProgress(-1); - break; - case QApt::RunningStatus: - setStatusMessage(QString()); - setStatusDetail(QString()); - break; - case QApt::LoadingCacheStatus: - setStatusDetail(QString()); - setStatusMessage(i18nc("@info Status info", - "Loading Software List")); - break; - case QApt::DownloadingStatus: - switch (m_trans->role()) { - case QApt::UpdateCacheRole: - setStatusMessage(i18nc("@info Status information, widget title", - "Updating software sources")); - break; - case QApt::DownloadArchivesRole: - case QApt::CommitChangesRole: - setStatusMessage(i18nc("@info Status information, widget title", - "Downloading Packages")); - break; - default: - break; - } - break; - case QApt::CommittingStatus: - emit downloadSpeedChanged(-1); - setStatusMessage(i18nc("@info Status information, widget title", - "Applying Changes")); - setStatusDetail(QString()); - break; - case QApt::FinishedStatus: - setProgress(100); - setStatusMessage(i18nc("@info Status information, widget title", - "Finished")); - break; - } -} - -void ApplicationUpdates::setProgressing(bool progressing) -{ - if(progressing!=m_progressing) { - m_progressing = progressing; - emit progressingChanged(progressing); - - if(m_progressing) - setProgress(-1); - else - restoreToCleanCache(); - } -} - -void ApplicationUpdates::setStatusDetail(const QString& msg) -{ - if(m_statusDetail!=msg) { - m_statusDetail = msg; - emit statusDetailChanged(msg); - } -} - -void ApplicationUpdates::setStatusMessage(const QString& msg) -{ - if(m_statusMessage!=msg) { - m_statusMessage = msg; - emit statusMessageChanged(msg); - } -} - -QString ApplicationUpdates::statusDetail() const -{ - return m_statusDetail; -} - -QString ApplicationUpdates::statusMessage() const -{ - return m_statusMessage; -} - -void ApplicationUpdates::cancel() -{ - Q_ASSERT(m_trans->isCancellable()); - m_trans->cancel(); -} - -quint64 ApplicationUpdates::downloadSpeed() const -{ - return m_trans->downloadSpeed(); -} - -void ApplicationUpdates::fetchingChanged() -{ - if(m_appBackend && m_appBackend->isFetching()) - return; - - calculateUpdates(); - setProgressing(false); -} - -void ApplicationUpdates::calculateUpdates() -{ - m_toUpdate.clear(); - auto changes = m_aptBackend->stateChanges(m_updatesCache, QApt::PackageList()); - Q_FOREACH (const auto &pkgList, changes) { - Q_FOREACH (QApt::Package* it, pkgList) { - AbstractResource* res = m_appBackend->resourceByPackageName(it->name()); - if(!res) //If we couldn't find it by its name, try with - res = m_appBackend->resourceByPackageName(QStringLiteral("%1:%2").arg(it->name()).arg(it->architecture())); - - if(res) { - if (res->state() == Application::Upgradeable) - m_toUpdate += res; - } else { - qWarning() << "Couldn't find the package:" << it->name(); - } - Q_ASSERT(res); - } - } -} - -bool ApplicationUpdates::isMarked(AbstractResource* res) const -{ - Q_ASSERT(!res->backend()->isFetching()); - Application* app = qobject_cast<Application*>(res); - Q_ASSERT(app); - return app->package()->state() & QApt::Package::ToInstall; -} diff --git a/libmuon/backends/ApplicationBackend/ApplicationUpdates.h b/libmuon/backends/ApplicationBackend/ApplicationUpdates.h deleted file mode 100644 index aeb44eb..0000000 --- a/libmuon/backends/ApplicationBackend/ApplicationUpdates.h +++ /dev/null @@ -1,98 +0,0 @@ -/*************************************************************************** - * Copyright © 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef APPLICATIONUPDATES_H -#define APPLICATIONUPDATES_H - -// Qt includes -#include <QtCore/QObject> -#include <QPointer> - -// QApt includes -#include <QApt/Globals> - -// Own includes -#include "resources/AbstractBackendUpdater.h" - -namespace QApt { - class Backend; - class Transaction; -} - -class ApplicationBackend; - -class ApplicationUpdates : public AbstractBackendUpdater -{ - Q_OBJECT -public: - explicit ApplicationUpdates(ApplicationBackend* parent); - - bool hasUpdates() const; - qreal progress() const; - void start(); - void setBackend(QApt::Backend* b); - long unsigned int remainingTime() const; - virtual void addResources(const QList<AbstractResource*>& apps); - virtual void removeResources(const QList<AbstractResource*>& apps); - virtual QList<AbstractResource*> toUpdate() const; - virtual bool isAllMarked() const; - virtual QDateTime lastUpdate() const; - virtual bool isCancelable() const; - virtual bool isProgressing() const; - virtual QString statusDetail() const; - virtual QString statusMessage() const; - virtual void cancel(); - virtual quint64 downloadSpeed() const; - void prepare(); - void setupTransaction(QApt::Transaction *trans); - virtual bool isMarked(AbstractResource* res) const; - void setProgressing(bool progressing); - -private: - void restoreToCleanCache(); - - QPointer<QApt::Transaction> m_trans; - QApt::Backend* m_aptBackend; - ApplicationBackend* m_appBackend; - int m_lastRealProgress; - long unsigned int m_eta; - QApt::CacheState m_updatesCache; - bool m_progressing; - QString m_statusMessage; - QString m_statusDetail; - QList<AbstractResource*> m_toUpdate; - -private slots: - void errorOccurred(QApt::ErrorCode error); - void setProgress(int progress); - void etaChanged(quint64 eta); - void installMessage(const QString& message); - void provideMedium(const QString &label, const QString &medium); - void untrustedPrompt(const QStringList &untrustedPackages); - void configFileConflict(const QString ¤tPath, const QString &newPath); - void statusChanged(QApt::TransactionStatus status); - void setStatusMessage(const QString& msg); - void setStatusDetail(const QString& msg); - void fetchingChanged(); - void calculateUpdates(); - void transactionFinished(QApt::ExitStatus); -}; - -#endif // APPLICATIONUPDATES_H diff --git a/libmuon/backends/ApplicationBackend/AptSourcesBackend.cpp b/libmuon/backends/ApplicationBackend/AptSourcesBackend.cpp deleted file mode 100644 index da7c7cb..0000000 --- a/libmuon/backends/ApplicationBackend/AptSourcesBackend.cpp +++ /dev/null @@ -1,241 +0,0 @@ -/*************************************************************************** - * Copyright © 2014 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "AptSourcesBackend.h" -#include "ApplicationBackend.h" -#include <QAptActions.h> -#include <qapt/sourceentry.h> -#include <kauthexecutejob.h> -#include <KActionCollection> -#include <KLocalizedString> -#include <KMessageWidget> -#include <KMessageBox> -#include <QProcess> - -class EntryItem : public QStandardItem -{ -public: - EntryItem(const QApt::SourceEntry &sEntry) - : m_sEntry(sEntry) - {} - QApt::SourceEntry& sourceEntry() { return m_sEntry; } - -private: - QApt::SourceEntry m_sEntry; -}; - -class SourceItem : public QStandardItem -{ -public: - SourceItem(const QUrl& uri) - : m_uri(uri) - {} - - virtual QVariant data(int role = Qt::UserRole + 1) const; - QUrl uri() const { return m_uri; } - -private: - QUrl m_uri; -}; - -AptSourcesBackend::AptSourcesBackend(ApplicationBackend* backend) - : AbstractSourcesBackend(backend) - , m_sources(new QStandardItemModel(this)) -{ - connect(backend, SIGNAL(fetchingChanged()), SLOT(load()), Qt::UniqueConnection); - if (!backend->isFetching()) { - load(); - } -} - -void AptSourcesBackend::load() -{ - m_sources->clear(); - - Q_FOREACH (const QApt::SourceEntry &sEntry, m_sourcesList.entries()) { - if (!sEntry.isValid()) - continue; - - SourceItem* newSource = sourceForUri(sEntry.uri()); - EntryItem* entry = new EntryItem(sEntry); - newSource->appendRow(entry); - } -} - -SourceItem* AptSourcesBackend::sourceForUri(const QString& uri) -{ - for(int r = 0, c = m_sources->rowCount(); r<c; ++r) { - SourceItem* s = static_cast<SourceItem*>(m_sources->item(r)); - if(s->uri()==uri) - return s; - } - SourceItem* s = new SourceItem(uri); - s->setData(uri, UriRole); - m_sources->appendRow(s); - return s; -} - -QAbstractItemModel* AptSourcesBackend::sources() -{ - return m_sources; -} - -bool AptSourcesBackend::removeSource(const QString& repository) -{ - KAuth::Action readAction("org.kde.muon.repo.modify"); - readAction.setHelperId("org.kde.muon.repo"); - QVariantMap args = { - { "repository", repository }, - { "action", QStringLiteral("remove") } - }; - readAction.setArguments(args); - qDebug() << "removing..." << args; - KAuth::ExecuteJob* reply = readAction.execute(); - removalDone(reply->error()); - return true; -} - -bool AptSourcesBackend::addSource(const QString& repository) -{ - KAuth::Action readAction("org.kde.muon.repo.modify"); - readAction.setHelperId("org.kde.muon.repo"); - QVariantMap args = { - { "repository", repository }, - { "action", QStringLiteral("add") } - }; - readAction.setArguments(args); - qDebug() << "adding..." << args; - KAuth::ExecuteJob* reply = readAction.execute(); - additionDone(reply->error()); - return true; -} - -void AptSourcesBackend::additionDone(int processErrorCode) -{ - if(processErrorCode==0) { - load(); - QMetaObject::invokeMethod(appsBackend(), "reload"); - } else { - QProcess* p = qobject_cast<QProcess*>(sender()); - Q_ASSERT(p); - QByteArray errorMessage = p->readAllStandardOutput(); - if(!errorMessage.isEmpty()) - KMessageBox::error(0, errorMessage, i18n("Adding Origins...")); - } -} - -void AptSourcesBackend::removalDone(int processErrorCode) -{ - if(processErrorCode==0) { - load(); - QMetaObject::invokeMethod(appsBackend(), "reload"); - } else { - QProcess* p = qobject_cast<QProcess*>(sender()); - Q_ASSERT(p); - QByteArray errorMessage = p->readAllStandardOutput(); - if(!errorMessage.isEmpty()) - KMessageBox::error(0, errorMessage, i18n("Removing Origins...")); - } -} - -ApplicationBackend* AptSourcesBackend::appsBackend() const -{ - return qobject_cast<ApplicationBackend*>(parent()); -} - -QVariant SourceItem::data(int role) const -{ - switch(role) { - case Qt::DisplayRole: { -// modelData.name=="" ? modelData.uri : i18n("%1. %2", modelData.name, modelData.uri) - QApt::Backend* backend = qobject_cast<AptSourcesBackend*>(model()->parent())->appsBackend()->backend(); - QStringList origins = !m_uri.host().isEmpty() ? backend->originsForHost(m_uri.host()) : QStringList(); - - if(origins.size()==1) - return origins.first(); - else if(origins.size()==0) - return m_uri.toDisplayString(); - else { - QString path = m_uri.path(); - int firstSlash = path.indexOf('/', 1); - int secondSlash = path.indexOf('/', firstSlash+1); - QString launchpadifyUri = path.mid(1,secondSlash-1).replace('/', '-'); - QStringList results = origins.filter(launchpadifyUri, Qt::CaseInsensitive); - if(results.isEmpty()) { - launchpadifyUri = path.mid(1,firstSlash-1).replace('/', '-'); - results = origins.filter(launchpadifyUri, Qt::CaseInsensitive); - } - return results.isEmpty() ? QString() : results.first(); - } - } - case Qt::ToolTipRole: { - QMap<QString, int> vals; - for(int i=0, c=rowCount(); i<c; ++i) { - EntryItem* entry = static_cast<EntryItem*>(child(i)); - - QString suite = entry->sourceEntry().dist(); - if(!vals.contains(suite)) - vals[suite]=0; - - bool hasSource = entry->sourceEntry().type() == QLatin1String("deb-src"); - if(hasSource) - vals[suite] += 2; - else - vals[suite] += 1; - } - QStringList ret; - Q_FOREACH (const QString& e, vals.keys()) { - if(vals[e]>1) - ret.append(e); - else - ret.append(i18n("%1 (Binary)", e)); - } - - return ret.join(", "); - } - default: - return QStandardItem::data(role); - } -} - -QString AptSourcesBackend::idDescription() -{ - return i18n( "<sourceline> - The apt repository source line to add. This is one of:\n" - " a complete apt line, \n" - " a repo url and areas (areas defaults to 'main')\n" - " a PPA shortcut.\n\n" - - " Examples:\n" - " deb http://myserver/path/to/repo stable myrepo\n" - " http://myserver/path/to/repo myrepo\n" - " https://packages.medibuntu.org free non-free\n" - " http://extras.ubuntu.com/ubuntu\n" - " ppa:user/repository"); -} - -QString AptSourcesBackend::name() const -{ - return i18n("Software Management"); -} - -QList<QAction*> AptSourcesBackend::actions() const -{ - return QList<QAction*>() << QAptActions::self()->actionCollection()->action("software_properties"); -} diff --git a/libmuon/backends/ApplicationBackend/AptSourcesBackend.h b/libmuon/backends/ApplicationBackend/AptSourcesBackend.h deleted file mode 100644 index f586162..0000000 --- a/libmuon/backends/ApplicationBackend/AptSourcesBackend.h +++ /dev/null @@ -1,60 +0,0 @@ -/*************************************************************************** - * Copyright © 2014 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef APTSOURCESBACKEND_H -#define APTSOURCESBACKEND_H - -#include <QStandardItemModel> -#include <resources/AbstractSourcesBackend.h> -#include <QApt/SourcesList> - -class ApplicationBackend; -class SourceItem; - -class AptSourcesBackend : public AbstractSourcesBackend -{ -Q_OBJECT -public: - enum Roles { - UriRole - }; - - AptSourcesBackend(ApplicationBackend* backend); - virtual QAbstractItemModel* sources(); - virtual bool removeSource(const QString& uri); - virtual bool addSource(const QString& uri); - virtual QString idDescription(); - virtual QString name() const; - ApplicationBackend* appsBackend() const; - virtual QList<QAction*> actions() const; - -private slots: - void load(); - void removalDone(int processErrorCode); - void additionDone(int processErrorCode); - -private: - SourceItem* sourceForUri(const QString& uri); - - QStandardItemModel* m_sources; - QApt::SourcesList m_sourcesList; -}; - -#endif // APTSOURCESBACKEND_H diff --git a/libmuon/backends/ApplicationBackend/CMakeLists.txt b/libmuon/backends/ApplicationBackend/CMakeLists.txt deleted file mode 100644 index 19a006f..0000000 --- a/libmuon/backends/ApplicationBackend/CMakeLists.txt +++ /dev/null @@ -1,42 +0,0 @@ -# we will have our own fork of the library now, because they haven't still made their mind out of Qt5 -# find_package(QtOAuth REQUIRED) -add_subdirectory(qoauth) -add_subdirectory(libmuonapt) - -include_directories(.) - -add_subdirectory(tests) - -set(appsbackend_SRCS - ApplicationBackend.cpp - Application.cpp - ApplicationUpdates.cpp - ReviewsBackend.cpp #TODO: rename to AptReviewsBackend - UbuntuLoginBackend.cpp - AptSourcesBackend.cpp -) - -qt5_add_dbus_interface(appsbackend_SRCS ubuntu_sso_dbus_interface.xml ubuntu_sso OPTIONS -i "LoginMetaTypes.h") - -add_library(muon-applications-backend MODULE ${appsbackend_SRCS}) -target_link_libraries(muon-applications-backend Qt5::Widgets Qt5::DBus Qt5::Concurrent - KF5::Archive KF5::KIOWidgets KF5::XmlGui DebconfKDE::Main KF5::IconThemes - Muon::QOAuth QApt::Main MuonCommon MuonApt -) - -install(TARGETS muon-applications-backend DESTINATION ${PLUGIN_INSTALL_DIR}/muon) -install(FILES muon-applications-backend.desktop DESTINATION ${DATA_INSTALL_DIR}/libmuon/backends) -install(FILES muon-applications-backend-categories.xml DESTINATION ${DATA_INSTALL_DIR}/libmuon/categories) -install(FILES distupgradeevent/releasechecker DESTINATION ${DATA_INSTALL_DIR}/libmuon/applicationsbackend/ - PERMISSIONS - OWNER_EXECUTE OWNER_READ OWNER_WRITE - GROUP_EXECUTE GROUP_READ - WORLD_EXECUTE WORLD_READ -) - -add_library(MuonApplicationNotifier MODULE ApplicationNotifier.cpp) -target_compile_definitions(MuonApplicationNotifier PRIVATE -DCMAKE_INSTALL_FULL_LIBEXECDIR_KF5=\"${CMAKE_INSTALL_FULL_LIBEXECDIR_KF5}\") -target_link_libraries(MuonApplicationNotifier KF5::CoreAddons KF5::I18n KF5::Notifications KF5::IconThemes MuonNotifiers) - -install(TARGETS MuonApplicationNotifier DESTINATION ${PLUGIN_INSTALL_DIR}/muon-notifier) -install(FILES muonapplicationnotifier.notifyrc DESTINATION ${KNOTIFYRC_INSTALL_DIR}) diff --git a/libmuon/backends/ApplicationBackend/ReviewsBackend.cpp b/libmuon/backends/ApplicationBackend/ReviewsBackend.cpp deleted file mode 100644 index 29fd8db..0000000 --- a/libmuon/backends/ApplicationBackend/ReviewsBackend.cpp +++ /dev/null @@ -1,436 +0,0 @@ -/*************************************************************************** - * Copyright © 2011 Jonathan Thomas <echidnaman@kubuntu.org> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "ReviewsBackend.h" - -#include <QtCore/QStringBuilder> -#include <QtCore/QLocale> -#include <QDebug> -#include <QJsonDocument> -#include <QTemporaryFile> -#include <QStandardPaths> -#include <QFileInfo> -#include <QDir> - -#include <KIO/Job> -#include <KLocalizedString> -#include <KCompressionDevice> - -#include <QApt/Backend> - -#include <qoauth/src/interface.h> - -#include <Application.h> -#include <ReviewsBackend/Rating.h> -#include <ReviewsBackend/Review.h> -#include <ReviewsBackend/AbstractLoginBackend.h> -#include "UbuntuLoginBackend.h" -#include <resources/AbstractResourcesBackend.h> -#include <MuonDataSources.h> - -static QString getCodename(const QString& value) -{ - QString ret; - QFile f("/etc/os-release"); - if(f.open(QIODevice::ReadOnly|QIODevice::Text)) { - QRegExp rx(QStringLiteral("%1=(.+)\n").arg(value)); - while(!f.atEnd()) { - QByteArray line = f.readLine(); - if(rx.exactMatch(line)) { - ret = rx.cap(1); - break; - } - } - } - return ret; -} - -ReviewsBackend::ReviewsBackend(QObject *parent) - : AbstractReviewsBackend(parent) - , m_aptBackend(0) - , m_serverBase(MuonDataSources::rnRSource()) -{ - m_distId = getCodename("ID"); - m_loginBackend = new UbuntuLoginBackend(this); - connect(m_loginBackend, SIGNAL(connectionStateChanged()), SIGNAL(loginStateChanged())); - connect(m_loginBackend, SIGNAL(connectionStateChanged()), SLOT(refreshConsumerKeys())); - m_oauthInterface = new QOAuth::Interface(this); - - QMetaObject::invokeMethod(this, "fetchRatings", Qt::QueuedConnection); -} - -ReviewsBackend::~ReviewsBackend() -{} - -void ReviewsBackend::refreshConsumerKeys() -{ - if(m_loginBackend->hasCredentials()) { - m_oauthInterface->setConsumerKey(m_loginBackend->consumerKey()); - m_oauthInterface->setConsumerSecret(m_loginBackend->consumerSecret()); - - QList<QPair<QString, QVariantMap> >::const_iterator it, itEnd; - for(it=m_pendingRequests.constBegin(), itEnd=m_pendingRequests.constEnd(); it!=itEnd; ++it) { - postInformation(it->first, it->second); - } - m_pendingRequests.clear(); - } -} - -void ReviewsBackend::setAptBackend(QApt::Backend *aptBackend) -{ - m_aptBackend = aptBackend; -} - -// void ReviewsBackend::clearReviewCache() -// { -// foreach (QList<Review *> reviewList, m_reviewsCache) { -// qDeleteAll(reviewList); -// } -// -// m_reviewsCache.clear(); -// } - -void ReviewsBackend::fetchRatings() -{ - QString ratingsCache = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)+"/libmuon/ratings.txt"; - QFileInfo file(ratingsCache); - QDir::temp().mkpath(file.dir().path()); - QUrl ratingsUrl(m_serverBase.toString()+"review-stats/"); - //default to popcon if not using ubuntu - if(m_distId.toLower() == QLatin1String("ubuntu")){ - refreshConsumerKeys(); - // First, load our old ratings cache in case we don't have net connectivity - loadRatingsFromFile(); - // Try to fetch the latest ratings from the internet - } else { - ratingsUrl = QUrl("http://popcon.debian.org/all-popcon-results.gz"); - } - KIO::FileCopyJob *getJob = KIO::file_copy(ratingsUrl, QUrl::fromLocalFile(ratingsCache), -1, - KIO::Overwrite | KIO::HideProgressInfo); - connect(getJob, SIGNAL(result(KJob*)), SLOT(ratingsFetched(KJob*))); -} - -void ReviewsBackend::ratingsFetched(KJob *job) -{ - if (job->error()) { - qWarning() << "Couldn't fetch the ratings" << job->errorString(); - return; - } - - loadRatingsFromFile(); -} - -void ReviewsBackend::loadRatingsFromFile() -{ - QString ratingsCache = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)+"/libmuon/ratings.txt"; - QScopedPointer<QIODevice> dev(new KCompressionDevice(ratingsCache, KCompressionDevice::GZip)); - if (!dev->open(QIODevice::ReadOnly)) { - qWarning() << "Couldn't open ratings.txt" << ratingsCache; - return; - } - if(m_distId.toLower() == QLatin1String("ubuntu")) { - QJsonParseError error; - QJsonDocument doc = QJsonDocument::fromJson(dev->readAll(), &error); - - if (error.error != QJsonParseError::NoError) { - qDebug() << "error while parsing ratings: " << ratingsCache; - return; - } - - QVariant ratings = doc.toVariant(); - qDeleteAll(m_ratings); - m_ratings.clear(); - foreach (const QVariant &data, ratings.toList()) { - Rating *rating = new Rating(data.toMap()); - if (!rating->ratingCount()) { - delete rating; - continue; - } - rating->setParent(this); - m_ratings[rating->packageName()] = rating; - } - } else { - if(dev->open(QIODevice::ReadOnly)) { - while(!dev->atEnd()) { - QString line(dev->readLine()); - QStringList lineContent = line.split(' '); - if(lineContent.first() != QLatin1String("Package:") || lineContent.isEmpty()) { - continue; - } - QString pkgName = lineContent.at(1); - lineContent.removeFirst(); - lineContent.removeFirst(); - - Rating *rating = new Rating(pkgName,lineContent); - if (!rating->ratingCount()) { - delete rating; - continue; - } - rating->setParent(this); - m_ratings[rating->packageName()] = rating; - } - } - } - emit ratingsReady(); -} - -Rating *ReviewsBackend::ratingForApplication(AbstractResource* app) const -{ - return m_ratings.value(app->packageName()); -} - -void ReviewsBackend::stopPendingJobs() -{ - for(auto it = m_jobHash.constBegin(); it != m_jobHash.constEnd(); ++it) { - disconnect(it.key(), SIGNAL(result(KJob*)), this, SLOT(changelogFetched(KJob*))); - } - m_jobHash.clear(); -} - -void ReviewsBackend::fetchReviews(AbstractResource* res, int page) -{ - Q_ASSERT(!res->backend()->isFetching()); - Application* app = qobject_cast<Application*>(res); - // Check our cache before fetching from the 'net - QString hashName = app->package()->name() + app->untranslatedName(); - - QList<Review*> revs = m_reviewsCache.value(hashName); - if (revs.size()>(page*10)) { //there are 10 reviews per page - emit reviewsReady(app, revs.mid(page*10, 10)); - return; - } - - QString lang = getLanguage(); - QString origin = app->package()->origin().toLower(); - - QString version = QLatin1String("any"); - QString packageName = app->package()->name(); - QString appName = app->name(); - // Replace spaces with %2B for the url - appName.replace(' ', QLatin1String("%2B")); - - // Figuring out how this damn Django url was put together took more - // time than figuring out QJson... - // But that could be because the Ubuntu Software Center (which I used to - // figure it out) is written in python, so you have to go hunting to where - // a variable was initially initialized with a primitive to figure out its type. - QUrl reviewsUrl(m_serverBase.toString() + QLatin1String("/reviews/filter/") % lang % '/' - % origin % '/' % QLatin1String("any") % '/' % version % '/' % packageName - % ';' % appName % '/' % QLatin1String("page") % '/' % QString::number(page)); - - KIO::StoredTransferJob* getJob = KIO::storedGet(reviewsUrl, KIO::NoReload, KIO::Overwrite | KIO::HideProgressInfo); - m_jobHash[getJob] = app; - connect(getJob, SIGNAL(result(KJob*)), - this, SLOT(reviewsFetched(KJob*))); -} - -static Review* constructReview(const QVariantMap& data) -{ - QString reviewUsername = data.value("reviewer_username").toString(); - QString reviewDisplayName = data.value("reviewer_displayname").toString(); - QString reviewer = reviewDisplayName.isEmpty() ? reviewUsername : reviewDisplayName; - return new Review( - data.value("app_name").toString(), - data.value("package_name").toString(), - data.value("language").toString(), - data.value("summary").toString(), - data.value("review_text").toString(), - reviewer, - QDateTime::fromString(data.value("date_created").toString(), "yyyy-MM-dd HH:mm:ss"), - !data.value("hide").toBool(), - data.value("id").toULongLong(), - data.value("rating").toInt() * 2, - data.value("usefulness_total").toInt(), - data.value("usefulness_favorable").toInt(), - data.value("version").toString()); -} - -void ReviewsBackend::reviewsFetched(KJob *j) -{ - KIO::StoredTransferJob* job = qobject_cast<KIO::StoredTransferJob*>(j); - Application *app = m_jobHash.take(job); - if (job->error() || !app) { - return; - } - - QJsonParseError error; - QJsonDocument doc = QJsonDocument::fromJson(job->data(), &error); - - if (error.error != QJsonParseError::NoError) { - return; - } - QVariant reviews = doc.toVariant(); - - QList<Review *> reviewsList; - foreach (const QVariant &data, reviews.toList()) { - reviewsList << constructReview(data.toMap()); - } - - m_reviewsCache[app->package()->name() + app->name()].append(reviewsList); - - emit reviewsReady(app, reviewsList); -} - -QString ReviewsBackend::getLanguage() -{ - QStringList fullLangs; - // The reviews API abbreviates all langs past the _ char except these - fullLangs << "pt_BR" << "zh_CN" << "zh_TW"; - - QString language = QLocale().bcp47Name(); - - if (fullLangs.contains(language)) { - return language; - } - - return language.split('_').first(); -} - -void ReviewsBackend::submitUsefulness(Review* r, bool useful) -{ - QVariantMap data = { { "useful", useful } }; - - postInformation(QStringLiteral("reviews/%1/recommendations/").arg(r->id()), data); -} - -void ReviewsBackend::submitReview(AbstractResource* application, const QString& summary, - const QString& review_text, const QString& rating) -{ - Application* app = qobject_cast<Application*>(application); - - QVariantMap data = { - { "app_name", app->name() }, - { "package_name", app->packageName() }, - { "summary", summary }, - { "version", app->package()->version() }, - { "review_text", review_text }, - { "rating", rating }, - { "language", getLanguage() }, - { "origin", app->package()->origin() } - }; - - QString distroSeries = getCodename("VERSION"); - if(!distroSeries.isEmpty()){ - data["distroseries"] = distroSeries.split(' ').last().remove('(').remove(')'); - }else{ - data["distroseries"] = getCodename("PRETTY_NAME").split(' ').last(); - } - data["arch_tag"] = app->package()->architecture(); - - postInformation("reviews/", data); -} - -void ReviewsBackend::deleteReview(Review* r) -{ - postInformation(QStringLiteral("reviews/delete/%1/").arg(r->id()), QVariantMap()); -} - -void ReviewsBackend::flagReview(Review* r, const QString& reason, const QString& text) -{ - QVariantMap data = { - { "reason", reason }, - { "text", text } - }; - - postInformation(QStringLiteral("reviews/%1/flags/").arg(r->id()), data); -} - -QByteArray authorization(QOAuth::Interface* oauth, const QUrl& url, AbstractLoginBackend* login) -{ - return oauth->createParametersString(url.url(), QOAuth::POST, login->token(), login->tokenSecret(), - QOAuth::HMAC_SHA1, QOAuth::ParamMap(), QOAuth::ParseForHeaderArguments); -} - -void ReviewsBackend::postInformation(const QString& path, const QVariantMap& data) -{ - if(!hasCredentials()) { - m_pendingRequests += qMakePair(path, data); - login(); - return; - } - - QUrl url(m_serverBase.toString() +'/'+ path); - url.setScheme("https"); - - KIO::StoredTransferJob* job = KIO::storedHttpPost(QJsonDocument::fromVariant(data).toJson(), url, KIO::Overwrite | KIO::HideProgressInfo); //TODO port to QJsonDocument - job->addMetaData("content-type", "Content-Type: application/json" ); - job->addMetaData("customHTTPHeader", "Authorization: " + authorization(m_oauthInterface, url, m_loginBackend)); - connect(job, SIGNAL(result(KJob*)), this, SLOT(informationPosted(KJob*))); - job->start(); -} - -void ReviewsBackend::informationPosted(KJob* j) -{ - KIO::StoredTransferJob* job = qobject_cast<KIO::StoredTransferJob*>(j); - if(job->error()==0) { - qDebug() << "success" << job->data(); - } else { - qDebug() << "error..." << job->error() << job->errorString() << job->errorText(); - } -} - -bool ReviewsBackend::isFetching() const -{ - return !m_jobHash.isEmpty(); -} - -bool ReviewsBackend::hasCredentials() const -{ - return m_loginBackend->hasCredentials(); -} - -QString ReviewsBackend::userName() const -{ - Q_ASSERT(m_loginBackend->hasCredentials()); - return m_loginBackend->displayName(); -} - -void ReviewsBackend::login() -{ - Q_ASSERT(!m_loginBackend->hasCredentials()); - m_loginBackend->login(); -} - -void ReviewsBackend::registerAndLogin() -{ - Q_ASSERT(!m_loginBackend->hasCredentials()); - m_loginBackend->registerAndLogin(); -} - -void ReviewsBackend::logout() -{ - Q_ASSERT(m_loginBackend->hasCredentials()); - m_loginBackend->logout(); -} - -QString ReviewsBackend::errorMessage() const -{ - return i18n("No reviews available for Debian."); -} - -bool ReviewsBackend::isReviewable() const -{ - QString m_distId = getCodename(QLatin1String("ID")); - if(m_distId == QLatin1String("ubuntu")){ - return true; - } - return false; -} - diff --git a/libmuon/backends/ApplicationBackend/ReviewsBackend.h b/libmuon/backends/ApplicationBackend/ReviewsBackend.h deleted file mode 100644 index 5f6678d..0000000 --- a/libmuon/backends/ApplicationBackend/ReviewsBackend.h +++ /dev/null @@ -1,102 +0,0 @@ -/*************************************************************************** - * Copyright © 2011 Jonathan Thomas <echidnaman@kubuntu.org> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef REVIEWSBACKEND_H -#define REVIEWSBACKEND_H - -#include <QtCore/QString> -#include <QtCore/QUrl> -#include <QtCore/QVariant> - -#include "libMuonCommon_export.h" -#include <ReviewsBackend/AbstractReviewsBackend.h> - -namespace QOAuth { - class Interface; -} - -class KJob; -class KTemporaryFile; - -namespace QApt { - class Backend; -} - -class AbstractLoginBackend; -class Application; -class Rating; -class Review; - -class MUONCOMMON_EXPORT ReviewsBackend : public AbstractReviewsBackend -{ - Q_OBJECT -public: - ReviewsBackend(QObject *parent); - ~ReviewsBackend(); - - Rating *ratingForApplication(AbstractResource *app) const; - - void setAptBackend(QApt::Backend *aptBackend); - void fetchReviews(AbstractResource* app, int page=1); -// void clearReviewCache(); - void stopPendingJobs(); - bool isFetching() const; - - QString userName() const; - bool hasCredentials() const; - QString errorMessage() const; - bool isReviewable() const; - -private: - QApt::Backend *m_aptBackend; - - QString m_distId; - const QUrl m_serverBase; - QHash<QString, Rating *> m_ratings; - // cache key is package name + app name, since both by their own may not be unique - QHash<QString, QList<Review *> > m_reviewsCache; - QHash<KJob *, Application *> m_jobHash; - - void loadRatingsFromFile(); - QString getLanguage(); - AbstractLoginBackend* m_loginBackend; - QOAuth::Interface* m_oauthInterface; - QList<QPair<QString, QVariantMap> > m_pendingRequests; - -private Q_SLOTS: - void ratingsFetched(KJob *job); - void reviewsFetched(KJob *job); - void informationPosted(KJob* job); - void postInformation(const QString& path, const QVariantMap& data); - void fetchRatings(); - -public slots: - void login(); - void registerAndLogin(); - void logout(); - void submitUsefulness(Review* r, bool useful); - void submitReview(AbstractResource* app, const QString& summary, - const QString& review_text, const QString& rating); - void deleteReview(Review* r); - void flagReview(Review* r, const QString& reason, const QString &text); - void refreshConsumerKeys(); -}; - -#endif diff --git a/libmuon/backends/ApplicationBackend/UbuntuLoginBackend.cpp b/libmuon/backends/ApplicationBackend/UbuntuLoginBackend.cpp deleted file mode 100644 index 91168fc..0000000 --- a/libmuon/backends/ApplicationBackend/UbuntuLoginBackend.cpp +++ /dev/null @@ -1,147 +0,0 @@ -/*************************************************************************** - * Copyright © 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "UbuntuLoginBackend.h" -#include <QDebug> -#include <QDBusMetaType> -#include <QApplication> -#include <QWidget> -#include <KLocalizedString> -#include "ubuntu_sso.h" - -//NOTE: this is needed because the method is called register. see the xml file for more info -struct HackedComUbuntuSsoCredentialsManagementInterface : public ComUbuntuSsoCredentialsManagementInterface -{ - HackedComUbuntuSsoCredentialsManagementInterface(const QString& service, const QString& path, const QDBusConnection& connection, QObject* parent = 0) - : ComUbuntuSsoCredentialsManagementInterface(service, path, connection, parent) - {} - - inline QDBusPendingReply<> register_hack(const QString &app_name, const QMap<QString,QString>& args) - { - QList<QVariant> argumentList; - argumentList << QVariant::fromValue(app_name) << QVariant::fromValue(args); - return asyncCallWithArgumentList(QLatin1String("register"), argumentList); - } -}; - -UbuntuLoginBackend::UbuntuLoginBackend(QObject* parent) - : AbstractLoginBackend(parent) -{ - qDBusRegisterMetaType< QMap<QString,QString> >(); - m_interface = new HackedComUbuntuSsoCredentialsManagementInterface( "com.ubuntu.sso", "/com/ubuntu/sso/credentials", QDBusConnection::sessionBus(), this); - connect(m_interface, SIGNAL(CredentialsError(QString,QMap<QString,QString>)), SLOT(credentialsError(QString,QMap<QString,QString>))); - connect(m_interface, SIGNAL(AuthorizationDenied(QString)), SLOT(authorizationDenied(QString))); - connect(m_interface, SIGNAL(CredentialsFound(QString,QMap<QString,QString>)), this, SLOT(successfulLogin(QString,QMap<QString,QString>))); - - m_interface->find_credentials(appname(), QMap<QString,QString>()); -} - -void UbuntuLoginBackend::login() -{ - QMap<QString,QString> data; - data["help_text"] = i18n("Log in to the Ubuntu SSO service"); - data["window_id"] = winId(); - QDBusPendingReply< void > ret = m_interface->login(appname(), data); -} - -void UbuntuLoginBackend::registerAndLogin() -{ - QMap<QString,QString> data; - data["help_text"] = i18n("Log in to the Ubuntu SSO service"); - data["window_id"] = winId(); - m_interface->register_hack(appname(), data); -} - -QString UbuntuLoginBackend::displayName() const -{ - return m_credentials["name"]; -} - -bool UbuntuLoginBackend::hasCredentials() const -{ - return !m_credentials.isEmpty(); -} - -void UbuntuLoginBackend::successfulLogin(const QString& app, const QMap<QString,QString>& credentials) -{ -// qDebug() << "logged in" << appname() << app << credentials; - if(app==appname()) { - m_credentials = credentials; - emit connectionStateChanged(); - } -} - -QString UbuntuLoginBackend::appname() const -{ - return QCoreApplication::instance()->applicationName(); -} - -QString UbuntuLoginBackend::winId() const -{ - QString windowId; - QApplication *app = qobject_cast<QApplication*>(qApp); - - if (app->activeWindow()) - windowId = QString::number(app->activeWindow()->winId()); - - return windowId; -} - -void UbuntuLoginBackend::authorizationDenied(const QString& app) -{ - qDebug() << "denied" << app; - if(app==appname()) - emit connectionStateChanged(); -} - -void UbuntuLoginBackend::credentialsError(const QString& app, const QMap<QString,QString>& a) -{ - //TODO: provide error message? - qDebug() << "error" << app << a; - if(app==appname()) - emit connectionStateChanged(); -} - -void UbuntuLoginBackend::logout() -{ - m_interface->clear_credentials(appname(), QMap<QString,QString>()); - m_credentials.clear(); - emit connectionStateChanged(); -} - -QByteArray UbuntuLoginBackend::token() const -{ - return m_credentials["token"].toLatin1(); -} - -QByteArray UbuntuLoginBackend::tokenSecret() const -{ - return m_credentials["token_secret"].toLatin1(); -} - -QByteArray UbuntuLoginBackend::consumerKey() const -{ - return m_credentials["consumer_key"].toLatin1(); -} - -QByteArray UbuntuLoginBackend::consumerSecret() const -{ - return m_credentials["consumer_secret"].toLatin1(); -} diff --git a/libmuon/backends/ApplicationBackend/UbuntuLoginBackend.h b/libmuon/backends/ApplicationBackend/UbuntuLoginBackend.h deleted file mode 100644 index 4454e14..0000000 --- a/libmuon/backends/ApplicationBackend/UbuntuLoginBackend.h +++ /dev/null @@ -1,57 +0,0 @@ -/*************************************************************************** - * Copyright © 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef UBUNTULOGINBACKEND_H -#define UBUNTULOGINBACKEND_H - -#include <ReviewsBackend/AbstractLoginBackend.h> -#include <QVariant> - -class HackedComUbuntuSsoCredentialsManagementInterface; -class UbuntuLoginBackend : public AbstractLoginBackend -{ - Q_OBJECT - public: - UbuntuLoginBackend(QObject* parent=0); - - void login(); - void registerAndLogin(); - void logout(); - QString displayName() const; - bool hasCredentials() const; - - QByteArray token() const; - QByteArray tokenSecret() const; - QByteArray consumerKey() const; - QByteArray consumerSecret() const; - - private slots: - void credentialsError(const QString& app, const QMap<QString,QString>& a); - void authorizationDenied(const QString& app); - void successfulLogin(const QString& app, const QMap<QString,QString>& credentials); - - private: - QString appname() const; - QString winId() const; - HackedComUbuntuSsoCredentialsManagementInterface* m_interface; - QMap<QString,QString> m_credentials; -}; - -#endif // UBUNTULOGINBACKEND_H diff --git a/libmuon/backends/ApplicationBackend/distupgradeevent/releasechecker b/libmuon/backends/ApplicationBackend/distupgradeevent/releasechecker deleted file mode 100644 index d045f37..0000000 --- a/libmuon/backends/ApplicationBackend/distupgradeevent/releasechecker +++ /dev/null @@ -1,46 +0,0 @@ -#! /usr/bin/python3 - -# releasechecker.py -# -# Copyright (c) 2010 Jonathan Thomas <echidnaman@kubuntu.org> -# -# Author: Jonathan Thomas <echidnaman@kubuntu.org> -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License or (at your option) version 3 or any later version -# accepted by the membership of KDE e.V. (or its successor approved -# by the membership of KDE e.V.), which shall act as a proxy -# defined in Section 14 of version 3 of the license. -# -# 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, see <http://www.gnu.org/licenses/>. - -import sys, time -sys.path.insert(0, '/usr/lib/python3/dist-packages/') - -from UpdateManager.Core.MetaRelease import MetaReleaseCore -from UpdateManager.Core.utils import init_proxy - -if __name__ == "__main__": - """ check for updates, if there are any say so """ - - init_proxy() - #FIXME: implement command line options for MetaReleaseCore args - metaRelease = MetaReleaseCore(False, False) - while metaRelease.downloading: - time.sleep(0.5) - new_dist = metaRelease.new_dist - - if new_dist is not None: - print("Found a release") - sys.exit(0) - else: - sys.exit(1) - diff --git a/libmuon/backends/ApplicationBackend/libmuonapt/AddRepositoryHelper.cpp b/libmuon/backends/ApplicationBackend/libmuonapt/AddRepositoryHelper.cpp deleted file mode 100644 index fe78f4d..0000000 --- a/libmuon/backends/ApplicationBackend/libmuonapt/AddRepositoryHelper.cpp +++ /dev/null @@ -1,41 +0,0 @@ -#include "AddRepositoryHelper.h" -#include <QProcess> -#include <QDebug> -#include <unistd.h> -#include <stdlib.h> -#include <kauthhelpersupport.h> - -ActionReply AddRepositoryHelper::modify(QVariantMap args) -{ - ActionReply reply = ActionReply::SuccessReply(); - if(args["repository"].isNull() || args["action"].isNull()) { - reply.setErrorDescription("Invalid action arguments."); - reply = ActionReply::HelperErrorReply(); - return reply; - } - QProcess *p = new QProcess(this); - p->setProcessChannelMode(QProcess::MergedChannels); - QString modRepo("apt-add-repository"); - QStringList arguments; - if(args["action"].toString()==QStringLiteral("add")) { - arguments.append(QStringLiteral("-y")); - arguments.append(args["repository"].toString()); - } else { - if(args["action"]=="remove") - { - arguments.append(QStringLiteral("--remove")); - arguments.append(QStringLiteral("-y")); - arguments.append(args["repository"].toString()); - } - } - p->start(modRepo,arguments); - p->waitForFinished(); - if(p->exitCode()) { - reply.setErrorDescription("Could not modify source."); - reply= ActionReply::HelperErrorReply(); - } - p->deleteLater(); - return reply; -} - -KAUTH_HELPER_MAIN("org.kde.muon.repo", AddRepositoryHelper) diff --git a/libmuon/backends/ApplicationBackend/libmuonapt/AddRepositoryHelper.h b/libmuon/backends/ApplicationBackend/libmuonapt/AddRepositoryHelper.h deleted file mode 100644 index 15d9506..0000000 --- a/libmuon/backends/ApplicationBackend/libmuonapt/AddRepositoryHelper.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef ADDREPOSITORYHELPER_H -#define ADDREPOSITORYHELPER_H - -#include <kauthactionreply.h> - -using namespace KAuth; - -class AddRepositoryHelper : public QObject -{ - Q_OBJECT -public slots: - ActionReply modify(QVariantMap args); -}; - -#endif //ADDREPOSITORYHELPER_H
\ No newline at end of file diff --git a/libmuon/backends/ApplicationBackend/libmuonapt/CMakeLists.txt b/libmuon/backends/ApplicationBackend/libmuonapt/CMakeLists.txt deleted file mode 100644 index 8bcf603..0000000 --- a/libmuon/backends/ApplicationBackend/libmuonapt/CMakeLists.txt +++ /dev/null @@ -1,26 +0,0 @@ -add_definitions(-DTRANSLATION_DOMAIN=\"libmuon\") - -add_library(MuonApt STATIC ChangesDialog.cpp - MuonStrings.cpp - QAptActions.cpp - HistoryView/HistoryProxyModel.cpp - HistoryView/HistoryView.cpp) - -target_link_libraries(MuonApt Qt5::Core - KF5::Solid KF5::KIOWidgets KF5::XmlGui - QApt::Main KF5::I18n -) - -target_compile_definitions(MuonApt PRIVATE -DCMAKE_INSTALL_FULL_LIBEXECDIR_KF5=\"${CMAKE_INSTALL_FULL_LIBEXECDIR_KF5}\") - -target_include_directories(MuonApt PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) - -add_executable(muon_repo_helper AddRepositoryHelper.cpp) -target_link_libraries(muon_repo_helper Qt5::Core KF5::Auth) - -install(TARGETS muon_repo_helper DESTINATION ${LIBEXEC_INSTALL_DIR}) -kauth_install_actions(org.kde.muon.repo policies/org.kde.muon.repo.action) -kauth_install_helper_files(muon_repo_helper org.kde.muon.repo root) - -install(TARGETS MuonApt ${INSTALL_TARGETS_DEFAULT_ARGS}) - diff --git a/libmuon/backends/ApplicationBackend/libmuonapt/ChangesDialog.cpp b/libmuon/backends/ApplicationBackend/libmuonapt/ChangesDialog.cpp deleted file mode 100644 index 11b3426..0000000 --- a/libmuon/backends/ApplicationBackend/libmuonapt/ChangesDialog.cpp +++ /dev/null @@ -1,118 +0,0 @@ -/*************************************************************************** - * Copyright © 2011 Jonathan Thomas <echidnaman@kubuntu.org> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "ChangesDialog.h" - -// Qt includes -#include <QtWidgets/QLabel> -#include <QtWidgets/QPushButton> -#include <QtWidgets/QTreeView> -#include <QtWidgets/QVBoxLayout> - -// KDE includes -#include <KLocalizedString> -#include <KStandardGuiItem> - -// Own includes -#include "../libmuonapt/MuonStrings.h" - -ChangesDialog::ChangesDialog(QWidget *parent, const QApt::StateChanges &changes) - : QDialog(parent) -{ - setWindowTitle(i18nc("@title:window", "Confirm Additional Changes")); - QVBoxLayout *layout = new QVBoxLayout(this); - setLayout(layout); - - QLabel *headerLabel = new QLabel(this); - headerLabel->setText(i18nc("@info", "<h2>Mark additional changes?</h2>")); - - int count = countChanges(changes); - QLabel *label = new QLabel(this); - label->setText(i18np("This action requires a change to another package:", - "This action requires changes to other packages:", - count)); - - QTreeView *packageView = new QTreeView(this); - packageView->setHeaderHidden(true); - packageView->setRootIsDecorated(false); - - QWidget *bottomBox = new QWidget(this); - QHBoxLayout *bottomLayout = new QHBoxLayout(bottomBox); - bottomLayout->setSpacing(0); - bottomLayout->setMargin(0); - bottomBox->setLayout(bottomLayout); - - QWidget *bottomSpacer = new QWidget(bottomBox); - bottomSpacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum); - - QPushButton *okButton = new QPushButton(bottomBox); - KGuiItem okItem = KStandardGuiItem::ok(); - okButton->setText(okItem.text()); - okButton->setIcon(okItem.icon()); - connect(okButton, SIGNAL(clicked()), this, SLOT(accept())); - - QPushButton *cancelButton = new QPushButton(bottomBox); - KGuiItem cancelItem = KStandardGuiItem::cancel(); - cancelButton->setText(cancelItem.text()); - cancelButton->setIcon(cancelItem.icon()); - connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject())); - - bottomLayout->addWidget(bottomSpacer); - bottomLayout->addWidget(okButton); - bottomLayout->addWidget(cancelButton); - - m_model = new QStandardItemModel(this); - packageView->setModel(m_model); - addPackages(changes); - packageView->expandAll(); - packageView->setEditTriggers(QAbstractItemView::NoEditTriggers); - - layout->addWidget(headerLabel); - layout->addWidget(label); - layout->addWidget(packageView); - layout->addWidget(bottomBox); -} - -void ChangesDialog::addPackages(const QApt::StateChanges &changes) -{ - for (auto i = changes.constBegin(); i != changes.constEnd(); ++i) { - QStandardItem *root = new QStandardItem; - root->setText(MuonStrings::global()->packageStateName(i.key())); - - QFont font = root->font(); - font.setBold(true); - root->setFont(font); - - Q_FOREACH (QApt::Package *package, *i) { - root->appendRow(new QStandardItem(QIcon::fromTheme("muon"), package->name())); - } - - m_model->appendRow(root); - } -} - -int ChangesDialog::countChanges(const QApt::StateChanges &changes) -{ - int count = 0; - foreach (const QApt::PackageList& pkgs, changes) { - count += pkgs.size(); - } - return count; -} diff --git a/libmuon/backends/ApplicationBackend/libmuonapt/ChangesDialog.h b/libmuon/backends/ApplicationBackend/libmuonapt/ChangesDialog.h deleted file mode 100644 index ed17c46..0000000 --- a/libmuon/backends/ApplicationBackend/libmuonapt/ChangesDialog.h +++ /dev/null @@ -1,45 +0,0 @@ -/*************************************************************************** - * Copyright © 2011 Jonathan Thomas <echidnaman@kubuntu.org> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef CHANGESDIALOG_H -#define CHANGESDIALOG_H - -// Qt includes -#include <QStandardItemModel> -#include <QDialog> - -// QApt includes -#include <QApt/Package> - -class QStandardItemModel; - -class ChangesDialog : public QDialog -{ -public: - ChangesDialog(QWidget *parent, const QApt::StateChanges &changes); - -private: - QStandardItemModel *m_model; - - void addPackages(const QApt::StateChanges &changes); - int countChanges(const QApt::StateChanges &changes); -}; - -#endif // CHANGESDIALOG_H diff --git a/libmuon/backends/ApplicationBackend/libmuonapt/HistoryView/HistoryProxyModel.cpp b/libmuon/backends/ApplicationBackend/libmuonapt/HistoryView/HistoryProxyModel.cpp deleted file mode 100644 index 96f9fac..0000000 --- a/libmuon/backends/ApplicationBackend/libmuonapt/HistoryView/HistoryProxyModel.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/*************************************************************************** - * Copyright © 2010 Jonathan Thomas <echidnaman@kubuntu.org> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "HistoryProxyModel.h" - -#include <QStandardItemModel> -#include <QStandardItem> - -HistoryProxyModel::HistoryProxyModel(QObject *parent) - : QSortFilterProxyModel(parent) - , m_stateFilter((QApt::Package::State)0) -{ -} - -HistoryProxyModel::~HistoryProxyModel() -{ -} - -void HistoryProxyModel::search(const QString &searchText) -{ - m_searchText = searchText; - invalidate(); -} - -void HistoryProxyModel::setStateFilter(QApt::Package::State state) -{ - m_stateFilter = state; - invalidate(); -} - -bool HistoryProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const -{ - QModelIndex sourceIndex = sourceModel()->index(sourceRow, 0, sourceParent); - for(int i = 0 ; i < sourceModel()->rowCount(sourceIndex); i++) { - if (filterAcceptsRow(i, sourceIndex)) { - return true; - } - } - - //Our "main"-method - QStandardItem *item = static_cast<QStandardItemModel *>(sourceModel())->itemFromIndex(sourceModel()->index(sourceRow, 0, sourceParent)); - - if (!item) { - return false; - } - - if (!m_stateFilter == 0) { - if ((bool)(item->data(HistoryActionRole).toInt() & m_stateFilter) == false) { - return false; - } - } - - if (!m_searchText.isEmpty()) { - if ((bool)(item->data(Qt::DisplayRole).toString().contains(m_searchText)) == false) { - return false; - } - } - - return true; -} - -bool HistoryProxyModel::lessThan(const QModelIndex &left, const QModelIndex &right) const -{ - QStandardItemModel *parentModel = static_cast<QStandardItemModel *>(sourceModel()); - - QStandardItem *leftItem = parentModel->itemFromIndex(left); - QStandardItem *rightItem = parentModel->itemFromIndex(right); - - return (leftItem->data(HistoryDateRole).toDateTime() > rightItem->data(HistoryDateRole).toDateTime()); -} diff --git a/libmuon/backends/ApplicationBackend/libmuonapt/HistoryView/HistoryProxyModel.h b/libmuon/backends/ApplicationBackend/libmuonapt/HistoryView/HistoryProxyModel.h deleted file mode 100644 index a5fc1e7..0000000 --- a/libmuon/backends/ApplicationBackend/libmuonapt/HistoryView/HistoryProxyModel.h +++ /dev/null @@ -1,52 +0,0 @@ -/*************************************************************************** - * Copyright © 2010 Jonathan Thomas <echidnaman@kubuntu.org> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef HISTORYPROXYMODEL_H -#define HISTORYPROXYMODEL_H - -#include <QSortFilterProxyModel> - -#include <QApt/Package> - -class HistoryProxyModel : public QSortFilterProxyModel -{ - Q_OBJECT -public: - enum { - HistoryDateRole = Qt::UserRole + 1, - HistoryActionRole = Qt::UserRole + 2 - }; - HistoryProxyModel(QObject *parent); - ~HistoryProxyModel(); - - void search(const QString &searchText); - void setStateFilter(QApt::Package::State state); - - bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const; - -protected: - bool lessThan(const QModelIndex &left, const QModelIndex &right) const; - -private: - QString m_searchText; - QApt::Package::State m_stateFilter; -}; - -#endif diff --git a/libmuon/backends/ApplicationBackend/libmuonapt/HistoryView/HistoryView.cpp b/libmuon/backends/ApplicationBackend/libmuonapt/HistoryView/HistoryView.cpp deleted file mode 100644 index 33d5e5d..0000000 --- a/libmuon/backends/ApplicationBackend/libmuonapt/HistoryView/HistoryView.cpp +++ /dev/null @@ -1,233 +0,0 @@ -/*************************************************************************** - * Copyright © 2010 Jonathan Thomas <echidnaman@kubuntu.org> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "HistoryView.h" - -#include <QtCore/QTimer> -#include <QtWidgets/QLabel> -#include <QListView> -#include <QtWidgets/QTreeView> -#include <QtWidgets/QVBoxLayout> -#include <QtWidgets/QLineEdit> -#include <QtWidgets/QComboBox> -#include <QStandardItemModel> - -#include <KLocalizedString> - -#include <QApt/History> - -#include "HistoryProxyModel.h" - -HistoryView::HistoryView(QWidget *parent) - : QWidget(parent) -{ - setLayout(new QVBoxLayout(this)); - m_history = new QApt::History(this); - - QWidget *headerWidget = new QWidget(this); - QHBoxLayout *headerLayout = new QHBoxLayout(headerWidget); - - QLabel *headerLabel = new QLabel(headerWidget); - headerLabel->setText(xi18nc("@info", "<title>History</title>")); - - QWidget *headerSpacer = new QWidget(headerWidget); - headerSpacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); - - m_searchEdit = new QLineEdit(headerWidget); - m_searchEdit->setPlaceholderText(i18nc("@label Line edit click message", "Search")); - m_searchEdit->setClearButtonEnabled(true); - - m_searchTimer = new QTimer(this); - m_searchTimer->setInterval(300); - m_searchTimer->setSingleShot(true); - connect(m_searchTimer, SIGNAL(timeout()), this, SLOT(startSearch())); - connect(m_searchEdit, SIGNAL(textChanged(QString)), m_searchTimer, SLOT(start())); - - m_filterBox = new QComboBox(headerWidget); - m_filterBox->insertItem(AllChangesItem, QIcon::fromTheme("bookmark-new-list"), - i18nc("@item:inlistbox Filters all changes in the history view", - "All changes"), - 0); - m_filterBox->insertItem(InstallationsItem, QIcon::fromTheme("download"), - i18nc("@item:inlistbox Filters installations in the history view", - "Installations"), - QApt::Package::ToInstall); - m_filterBox->insertItem(UpdatesItem, QIcon::fromTheme("system-software-update"), - i18nc("@item:inlistbox Filters updates in the history view", - "Updates"), - QApt::Package::ToUpgrade); - m_filterBox->insertItem(RemovalsItem, QIcon::fromTheme("edit-delete"), - i18nc("@item:inlistbox Filters removals in the history view", - "Removals"), - (QApt::Package::State)(QApt::Package::ToRemove | QApt::Package::ToPurge)); - connect(m_filterBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setStateFilter(int))); - - headerLayout->addWidget(headerLabel); - headerLayout->addWidget(headerSpacer); - headerLayout->addWidget(m_searchEdit); - headerLayout->addWidget(m_filterBox); - - m_historyModel = new QStandardItemModel(this); - m_historyModel->setColumnCount(1); - m_historyModel->setHeaderData(0, Qt::Horizontal, i18nc("@title:column", "Date")); - m_historyView = new QTreeView(this); - - QIcon itemIcon(QIcon::fromTheme("applications-other")); - - QHash<QString, QString> categoryHash; - - QHash<PastActions, QString> actionHash; - actionHash[InstalledAction] = i18nc("@info:status describes a past-tense action", "Installed"); - actionHash[UpgradedAction] = i18nc("@info:status describes a past-tense action", "Upgraded"); - actionHash[DowngradedAction] = i18nc("@status describes a past-tense action", "Downgraded"); - actionHash[RemovedAction] = i18nc("@status describes a past-tense action", "Removed"); - actionHash[PurgedAction] = i18nc("@status describes a past-tense action", "Purged"); - - Q_FOREACH (const QApt::HistoryItem &item, m_history->historyItems()) { - QDateTime startDateTime = item.startDate(); - QString formattedTime = startDateTime.toString(); - QString category; - - QString date = startDateTime.date().toString(); - if (categoryHash.contains(date)) { - category = categoryHash.value(date); - } else { - category = startDateTime.date().toString(Qt::DefaultLocaleShortDate); - categoryHash[date] = category; - } - - QStandardItem *parentItem = 0; - - if (!m_categoryHash.contains(category)) { - parentItem = new QStandardItem; - parentItem->setEditable(false); - parentItem->setText(category); - parentItem->setData(startDateTime, HistoryProxyModel::HistoryDateRole); - - m_historyModel->appendRow(parentItem); - m_categoryHash[category] = parentItem; - } else { - parentItem = m_categoryHash.value(category); - } - - foreach (const QString &package, item.installedPackages()) { - QStandardItem *historyItem = new QStandardItem; - historyItem->setEditable(false); - historyItem->setIcon(itemIcon); - - QString action = actionHash.value(InstalledAction); - QString text = i18nc("@item example: muon installed at 16:00", "%1 %2 at %3", - package, action, formattedTime); - historyItem->setText(text); - historyItem->setData(startDateTime, HistoryProxyModel::HistoryDateRole); - historyItem->setData(QApt::Package::ToInstall, HistoryProxyModel::HistoryActionRole); - - parentItem->appendRow(historyItem); - } - - foreach (const QString &package, item.upgradedPackages()) { - QStandardItem *historyItem = new QStandardItem; - historyItem->setEditable(false); - historyItem->setIcon(itemIcon); - - QString action = actionHash.value(UpgradedAction); - QString text = i18nc("@item example: muon installed at 16:00", "%1 %2 at %3", - package, action, formattedTime); - historyItem->setText(text); - historyItem->setData(startDateTime, HistoryProxyModel::HistoryDateRole); - historyItem->setData(QApt::Package::ToUpgrade, HistoryProxyModel::HistoryActionRole); - - parentItem->appendRow(historyItem); - } - - foreach (const QString &package, item.downgradedPackages()) { - QStandardItem *historyItem = new QStandardItem; - historyItem->setEditable(false); - historyItem->setIcon(itemIcon); - - QString action = actionHash.value(DowngradedAction); - QString text = i18nc("@item example: muon installed at 16:00", "%1 %2 at %3", - package, action, formattedTime); - historyItem->setText(text); - historyItem->setData(startDateTime, HistoryProxyModel::HistoryDateRole); - historyItem->setData(QApt::Package::ToDowngrade, HistoryProxyModel::HistoryActionRole); - - parentItem->appendRow(historyItem); - } - - foreach (const QString &package, item.removedPackages()) { - QStandardItem *historyItem = new QStandardItem; - historyItem->setEditable(false); - historyItem->setIcon(itemIcon); - - QString action = actionHash.value(RemovedAction); - QString text = i18nc("@item example: muon installed at 16:00", "%1 %2 at %3", - package, action, formattedTime); - historyItem->setText(text); - historyItem->setData(startDateTime, HistoryProxyModel::HistoryDateRole); - historyItem->setData(QApt::Package::ToRemove, HistoryProxyModel::HistoryActionRole); - - parentItem->appendRow(historyItem); - } - - foreach (const QString &package, item.purgedPackages()) { - QStandardItem *historyItem = new QStandardItem; - historyItem->setEditable(false); - historyItem->setIcon(itemIcon); - - QString action = actionHash.value(PurgedAction); - QString text = i18nc("@item example: muon installed at 16:00", "%1 %2 at %3", - package, action, formattedTime); - historyItem->setText(text); - historyItem->setData(startDateTime, HistoryProxyModel::HistoryDateRole); - historyItem->setData(QApt::Package::ToPurge, HistoryProxyModel::HistoryActionRole); - - parentItem->appendRow(historyItem); - } - } - - m_historyView->setMouseTracking(true); - m_historyView->setVerticalScrollMode(QListView::ScrollPerPixel); - - m_proxyModel = new HistoryProxyModel(this); - m_proxyModel->setSourceModel(m_historyModel); - m_proxyModel->sort(0); - - m_historyView->setModel(m_proxyModel); - - setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); -} - -QSize HistoryView::sizeHint() const -{ - return QWidget::sizeHint().expandedTo(QSize(500, 500)); -} - -void HistoryView::setStateFilter(int index) -{ - QApt::Package::State state = (QApt::Package::State)m_filterBox->itemData(index).toInt(); - m_proxyModel->setStateFilter(state); -} - -void HistoryView::startSearch() -{ - m_proxyModel->search(m_searchEdit->text()); -} - diff --git a/libmuon/backends/ApplicationBackend/libmuonapt/HistoryView/HistoryView.h b/libmuon/backends/ApplicationBackend/libmuonapt/HistoryView/HistoryView.h deleted file mode 100644 index f63b85b..0000000 --- a/libmuon/backends/ApplicationBackend/libmuonapt/HistoryView/HistoryView.h +++ /dev/null @@ -1,79 +0,0 @@ -/*************************************************************************** - * Copyright © 2010 Jonathan Thomas <echidnaman@kubuntu.org> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef HISTORYVIEW_H -#define HISTORYVIEW_H - -#include <QtCore/QHash> - -#include <QWidget> - -class QStandardItem; -class QStandardItemModel; -class QTimer; -class QTreeView; -class QLineEdit; -class QComboBox; - -namespace QApt { - class History; -} - -class HistoryProxyModel; - -class HistoryView : public QWidget -{ - Q_OBJECT -public: - enum ComboItems { - AllChangesItem = 0, - InstallationsItem = 1, - UpdatesItem = 2, - RemovalsItem = 3 - }; - enum PastActions { - InvalidAction = 0, - InstalledAction = 1, - UpgradedAction = 2, - DowngradedAction = 3, - RemovedAction = 4, - PurgedAction = 5 - }; - HistoryView(QWidget *parent); - - QSize sizeHint() const; - -private: - QApt::History *m_history; - QStandardItemModel *m_historyModel; - HistoryProxyModel *m_proxyModel; - QHash<QString, QStandardItem *> m_categoryHash; - - QLineEdit *m_searchEdit; - QTimer *m_searchTimer; - QComboBox *m_filterBox; - QTreeView *m_historyView; - -private Q_SLOTS: - void setStateFilter(int index); - void startSearch(); -}; - -#endif diff --git a/libmuon/backends/ApplicationBackend/libmuonapt/MuonStrings.cpp b/libmuon/backends/ApplicationBackend/libmuonapt/MuonStrings.cpp deleted file mode 100644 index 1138610..0000000 --- a/libmuon/backends/ApplicationBackend/libmuonapt/MuonStrings.cpp +++ /dev/null @@ -1,337 +0,0 @@ -/*************************************************************************** - * Copyright © 2010 Jonathan Thomas <echidnaman@kubuntu.org> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "MuonStrings.h" - -#include <KLocalizedString> -#include <QDebug> - -#include <QApt/Transaction> - -Q_GLOBAL_STATIC_WITH_ARGS(MuonStrings, globalMuonStrings, (0)) - -using namespace QApt; - -MuonStrings *MuonStrings::global() -{ - return globalMuonStrings; -} - -MuonStrings::MuonStrings(QObject *parent) - : QObject(parent) - , m_groupHash(groupHash()) - , m_stateHash(stateHash()) - , m_archHash(archHash()) -{ -} - -QHash<QString, QString> MuonStrings::groupHash() -{ - QHash<QString, QString> hash; - hash["admin"] = i18nc("@item:inlistbox Human-readable name for the Debian package section \"admin\"", - "System Administration"); - hash["base"] = i18nc("@item:inlistbox Human-readable name for the Debian package section \"base\"", - "Base System"); - hash["cli-mono"] = i18nc("@item:inlistbox Human-readable name for the Debian package section \"cli-mono\"", - "Mono/CLI Infrastructure"); - hash["comm"] = i18nc("@item:inlistbox Human-readable name for the Debian package section \"comm\"", - "Communication"); - hash["database"] = i18nc("@item:inlistbox Human-readable name for the Debian package section \"database\"", - "Databases"); - hash["devel"] = i18nc("@item:inlistbox Human-readable name for the Debian package section \"devel\"", - "Development"); - hash["doc"] = i18nc("@item:inlistbox Human-readable name for the Debian package section \"doc\"", - "Documentation"); - hash["debug"] = i18nc("@item:inlistbox Human-readable name for the Debian package section \"debug\"", - "Debug"); - hash["editors"] = i18nc("@item:inlistbox Human-readable name for the Debian package section \"editors\"", - "Editors"); - hash["electronics"] = i18nc("@item:inlistbox Human-readable name for the Debian package section \"electronics\"", - "Electronics"); - hash["embedded"] = i18nc("@item:inlistbox Human-readable name for the Debian package section \"embedded\"", - "Embedded Devices"); - hash["fonts"] = i18nc("@item:inlistbox Human-readable name for the Debian package section \"fonts\"", - "Fonts"); - hash["games"] = i18nc("@item:inlistbox Human-readable name for the Debian package section \"games\"", - "Games and Amusement"); - hash["gnome"] = i18nc("@item:inlistbox Human-readable name for the Debian package section \"gnome\"", - "GNOME Desktop Environment"); - hash["graphics"] = i18nc("@item:inlistbox Human-readable name for the Debian package section \"graphics\"", - "Graphics"); - hash["gnu-r"] = i18nc("@item:inlistbox Human-readable name for the Debian package section \"gnu-r\"", - "GNU R Statistical System"); - hash["gnustep"] = i18nc("@item:inlistbox Human-readable name for the Debian package section \"gnustep\"", - "Gnustep Desktop Environment"); - hash["hamradio"] = i18nc("@item:inlistbox Human-readable name for the Debian package section \"hamradio\"", - "Amateur Radio"); - hash["haskell"] = i18nc("@item:inlistbox Human-readable name for the Debian package section \"haskell\"", - "Haskell Programming Language"); - hash["httpd"] = i18nc("@item:inlistbox Human-readable name for the Debian package section \"httpd\"", - "Web Servers"); - hash["interpreters"] = i18nc("@item:inlistbox Human-readable name for the Debian package section \"interpreters\"", - "Interpreted Computer Languages"); - hash["java"] = i18nc("@item:inlistbox Human-readable name for the Debian package section \"java\"", - "Java Programming Language"); - hash["kde"] = i18nc("@item:inlistbox Human-readable name for the Debian package section \"kde\"", - "KDE Software Compilation"); - hash["kernel"] = i18nc("@item:inlistbox Human-readable name for the Debian package section \"kernel\"", - "Kernel and Modules"); - hash["libdevel"] = i18nc("@item:inlistbox Human-readable name for the Debian package section \"libdevel\"", - "Libraries - Development"); - hash["libs"] = i18nc("@item:inlistbox Human-readable name for the Debian package section \"libs\"", - "Libraries"); - hash["lisp"] = i18nc("@item:inlistbox Human-readable name for the Debian package section \"lisp\"", - "Lisp Programming Language"); - hash["localization"] = i18nc("@item:inlistbox Human-readable name for the Debian package section \"localization\"", - "Localization"); - hash["mail"] = i18nc("@item:inlistbox Human-readable name for the Debian package section \"mail\"", - "Email"); - hash["math"] = i18nc("@item:inlistbox Human-readable name for the Debian package section \"math\"", - "Mathematics"); - hash["misc"] = i18nc("@item:inlistbox Human-readable name for the Debian package section \"misc\"", - "Miscellaneous - Text-based"); - hash["net"] = i18nc("@item:inlistbox Human-readable name for the Debian package section \"net\"", - "Networking"); - hash["news"] = i18nc("@item:inlistbox Human-readable name for the Debian package section \"news\"", - "Newsgroups"); - hash["ocaml"] = i18nc("@item:inlistbox Human-readable name for the Debian package section \"ocaml\"", - "OCaml Programming Language"); - hash["oldlibs"] = i18nc("@item:inlistbox Human-readable name for the Debian package section \"oldlibs\"", - "Libraries - Old"); - hash["otherosfs"] = i18nc("@item:inlistbox Human-readable name for the Debian package section \"otherosfs\"", - "Cross Platform"); - hash["perl"] = i18nc("@item:inlistbox Human-readable name for the Debian package section \"perl\"", - "Perl Programming Language"); - hash["php"] = i18nc("@item:inlistbox Human-readable name for the Debian package section \"php\"", - "PHP Programming Language"); - hash["python"] = i18nc("@item:inlistbox Human-readable name for the Debian package section \"python\"", - "Python Programming Language"); - hash["ruby"] = i18nc("@item:inlistbox Human-readable name for the Debian package section \"ruby\"", - "Ruby Programming Language"); - hash["science"] = i18nc("@item:inlistbox Human-readable name for the Debian package section \"science\"", - "Science"); - hash["shells"] = i18nc("@item:inlistbox Human-readable name for the Debian package section \"shells\"", - "Shells"); - hash["sound"] = i18nc("@item:inlistbox Human-readable name for the Debian package section \"sound\"", - "Multimedia"); - hash["tex"] = i18nc("@item:inlistbox Human-readable name for the Debian package section \"tex\"", - "TeX Authoring"); - hash["text"] = i18nc("@item:inlistbox Human-readable name for the Debian package section \"text\"", - "Word Processing"); - hash["utils"] = i18nc("@item:inlistbox Human-readable name for the Debian package section \"utils\"", - "Utilities"); - hash["vcs"] = i18nc("@item:inlistbox Human-readable name for the Debian package section \"vcs\"", - "Version Control Systems"); - hash["video"] = i18nc("@item:inlistbox Human-readable name for the Debian package section \"video\"", - "Video Software"); - hash["web"] = i18nc("@item:inlistbox Human-readable name for the Debian package section \"web\"", - "Internet"); - hash["x11"] = i18nc("@item:inlistbox Human-readable name for the Debian package section \"x11\"", - "Miscellaneous - Graphical"); - hash["xfce"] = i18nc("@item:inlistbox Human-readable name for the Debian package section \"xfce\"", - "Xfce Desktop Environment"); - hash["zope"] = i18nc("@item:inlistbox Human-readable name for the Debian package section \"zope\"", - "Zope/Plone Environment"); - hash["unknown"] = i18nc("@item:inlistbox Human-readable name for the Debian package section \"unknown\"", - "Unknown"); - hash["alien"] = i18nc("@item:inlistbox Human-readable name for the Debian package section \"alien\"", - "Converted from RPM by Alien"); - hash["translations"] = i18nc("@item:inlistbox Human-readable name for the Debian package section \"translations\"", - "Internationalization and Localization"); - hash["metapackages"] = i18nc("@item:inlistbox Human-readable name for the Debian package section \"metapackages\"", - "Meta Packages"); - hash["non-us"] = i18nc("@item:inlistbox Debian package section \"non-US\", for packages that cannot be shipped in the US", - "Restricted On Export"); - hash["non-free"] = i18nc("@item:inlistbox Human-readable name for the Debian package section \"non-free\"", - "Non-free"); - hash["contrib"] = i18nc("@item:inlistbox Human-readable name for the Debian package section \"contrib\"", - "Contrib"); - hash["education"] = i18nc("@item:inlistbox Human-readable name for the Debian package section \"education\"", - "Education"); - hash["introspection"] = i18nc("@item:inlistbox Human-readable name for the Debian package section \"introspection\"", - "GObject Introspection Data"); - return hash; -} - -QString MuonStrings::groupName(const QString &name) const -{ - QString suffix; - - if (name.contains('/')) { - QStringList split = name.split('/'); - suffix = split.at(1); - - return m_groupHash.value(suffix); - } else { - return m_groupHash.value(name); - } -} - -QString MuonStrings::groupKey(const QString &text) const -{ - return m_groupHash.key(text); -} - -QHash<int, QString> MuonStrings::stateHash() -{ - QHash<int, QString> hash; - hash[Package::ToKeep] = i18nc("@info:status Package state", "No Change"); - hash[Package::ToInstall] = i18nc("@info:status Requested action", "Install"); - hash[Package::NewInstall] = i18nc("@info:status Requested action", "Install"); - hash[Package::ToReInstall] = i18nc("@info:status Requested action", "Reinstall"); - hash[Package::ToUpgrade] = i18nc("@info:status Requested action", "Upgrade"); - hash[Package::ToDowngrade] = i18nc("@info:status Requested action", "Downgrade"); - hash[Package::ToRemove] = i18nc("@info:status Requested action", "Remove"); - hash[Package::Held] = i18nc("@info:status Package state" , "Held"); - hash[Package::Installed] = i18nc("@info:status Package state", "Installed"); - hash[Package::Upgradeable] = i18nc("@info:status Package state", "Upgradeable"); - hash[Package::NowBroken] = i18nc("@info:status Package state", "Broken"); - hash[Package::InstallBroken] = i18nc("@info:status Package state", "Install Broken"); - hash[Package::Orphaned] = i18nc("@info:status Package state", "Orphaned"); - hash[Package::Pinned] = i18nc("@info:status Package state", "Locked"); - hash[Package::New] = i18nc("@info:status Package state", "New in repository"); - hash[Package::ResidualConfig] = i18nc("@info:status Package state", "Residual Configuration"); - hash[Package::NotDownloadable] = i18nc("@info:status Package state", "Not Downloadable"); - hash[Package::ToPurge] = i18nc("@info:status Requested action", "Purge"); - hash[Package::IsImportant] = i18nc("@info:status Package state", "Important for base install"); - hash[Package::OverrideVersion] = i18nc("@info:status Package state", "Version overridden"); - hash[Package::IsAuto] = i18nc("@info:status Package state", "Required by other packages"); - hash[Package::IsGarbage] = i18nc("@info:status Package state", "Installed (auto-removable)"); - hash[Package::NowPolicyBroken] = i18nc("@info:status Package state", "Policy Broken"); - hash[Package::InstallPolicyBroken] = i18nc("@info:status Package state", "Policy Broken"); - hash[Package::NotInstalled] = i18nc("@info:status Package state" , "Not Installed"); - hash[Package::IsPinned] = i18nc("@info:status Package locked at a certain version", - "Locked"); - hash[Package::IsManuallyHeld] = i18nc("@info:status Package state", "Manually held back"); - - return hash; -} - -QString MuonStrings::packageStateName(Package::State state) const -{ - return m_stateHash.value(state); -} - -QString MuonStrings::packageChangeStateName(Package::State state) const -{ - int ns = state & (Package::ToKeep | Package::ToInstall | Package::ToReInstall | Package::NewInstall - | Package::ToUpgrade | Package::ToRemove - | Package::ToPurge | Package::ToDowngrade); - return m_stateHash.value(ns); -} - -QHash<QString, QString> MuonStrings::archHash() -{ - QHash<QString, QString> hash; - hash["all"] = i18nc("@item:inlistbox", "Common"); - hash["i386"] = i18nc("@item:inlistbox CPU architecture", "32-bit"); - hash["amd64"] = i18nc("@item:inlistbox CPU architecture", "64-bit"); - hash["powerpc"] = i18nc("@item:inlistbox PU architecture", "Power PC"); - - return hash; -} - -QString MuonStrings::archString(const QString &arch) const -{ - QString str = m_archHash.value(arch); - - if (str.isEmpty()) - str = arch; - - return str; -} - -QString MuonStrings::errorTitle(ErrorCode error) const -{ - switch (error) { - case InitError: - return i18nc("@title:window", "Initialization Error"); - case LockError: - return i18nc("@title:window", "Unable to Obtain Package System Lock"); - case DiskSpaceError: - return i18nc("@title:window", "Low Disk Space"); - case FetchError: - case CommitError: - return i18nc("@title:window", "Failed to Apply Changes"); - case AuthError: - return i18nc("@title:window", "Authentication error"); - case WorkerDisappeared: - return i18nc("@title:window", "Unexpected Error"); - case UntrustedError: - return i18nc("@title:window", "Untrusted Packages"); - case UnknownError: - default: - return i18nc("@title:window", "Unknown Error"); - } -} - -QString MuonStrings::errorText(ErrorCode error, Transaction *trans) const -{ - QString text; - - switch (error) { - case InitError: - text = i18nc("@label", "The package system could not be initialized, your " - "configuration may be broken."); - break; - case LockError: - text = i18nc("@label", - "Another application seems to be using the package " - "system at this time. You must close all other package " - "managers before you will be able to install or remove " - "any packages."); - break; - case DiskSpaceError: - text = i18nc("@label", - "You do not have enough disk space in the directory " - "at %1 to continue with this operation.", trans->errorDetails()); - break; - case FetchError: - text = i18nc("@label", "Could not download packages"); - break; - case CommitError: - text = i18nc("@label", "An error occurred while applying changes:"); - break; - case AuthError: - text = i18nc("@label", - "This operation cannot continue since proper " - "authorization was not provided"); - break; - case WorkerDisappeared: - text = i18nc("@label", "It appears that the QApt worker has either crashed " - "or disappeared. Please report a bug to the QApt maintainers"); - break; - case UntrustedError: - text = i18ncp("@label", - "The following package has not been verified by its author. " - "Downloading untrusted packages has been disallowed " - "by your current configuration.", - "The following packages have not been verified by " - "their authors. " - "Downloading untrusted packages has " - "been disallowed by your current configuration.", - trans->untrustedPackages().size()); - break; - default: - break; - } - - return text; -} diff --git a/libmuon/backends/ApplicationBackend/libmuonapt/MuonStrings.h b/libmuon/backends/ApplicationBackend/libmuonapt/MuonStrings.h deleted file mode 100644 index 1a0f13d..0000000 --- a/libmuon/backends/ApplicationBackend/libmuonapt/MuonStrings.h +++ /dev/null @@ -1,64 +0,0 @@ -/*************************************************************************** - * Copyright © 2010 Jonathan Thomas <echidnaman@kubuntu.org> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef MUONSTRINGS_H -#define MUONSTRINGS_H - -#include <QtCore/QHash> - -#include <QApt/Package> - -namespace QApt { - class Transaction; -} - -class MuonStrings : public QObject -{ - Q_OBJECT -public: - explicit MuonStrings(QObject *parent); - - static MuonStrings* global(); - - QString groupName(const QString &name) const; - QString groupKey(const QString &text) const; - - /** @returns the state name for a given @p state, for displaying it to the user */ - QString packageStateName(QApt::Package::State state) const; - - /** @returns the state name for the given @p state changes, for displaying it to the user - * This means, the flags that are related to a state change, like ToInstall, ToUpgrade, etc - */ - QString packageChangeStateName(QApt::Package::State state) const; - QString archString(const QString &arch) const; - QString errorTitle(QApt::ErrorCode error) const; - QString errorText(QApt::ErrorCode error, QApt::Transaction *trans) const; - -private: - const QHash<QString, QString> m_groupHash; - const QHash<int, QString> m_stateHash; - const QHash<QString, QString> m_archHash; - - QHash<QString, QString> groupHash(); - QHash<int, QString> stateHash(); - QHash<QString, QString> archHash(); -}; - -#endif diff --git a/libmuon/backends/ApplicationBackend/libmuonapt/QAptActions.cpp b/libmuon/backends/ApplicationBackend/libmuonapt/QAptActions.cpp deleted file mode 100644 index 12d79cd..0000000 --- a/libmuon/backends/ApplicationBackend/libmuonapt/QAptActions.cpp +++ /dev/null @@ -1,535 +0,0 @@ -/*************************************************************************** - * Copyright © 2012 Jonathan Thomas <echidnaman@kubuntu.org> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "QAptActions.h" -#include "MuonStrings.h" -#include "HistoryView/HistoryView.h" - -// Qt includes -#include <QtCore/QDir> -#include <QtCore/QStringBuilder> -#include <QAction> -#include <QDebug> -#include <QDialog> -#include <QFileDialog> -#include <QStandardPaths> -#include <QDialogButtonBox> -#include <QLayout> -#include <QNetworkConfigurationManager> - -// KDE includes -#include <KActionCollection> -#include <KConfigGroup> -#include <KLocalizedString> -#include <KMessageBox> -#include <KProcess> -#include <KStandardAction> -#include <KSharedConfig> -#include <KXmlGuiWindow> -#include <KWindowConfig> - -// QApt includes -#include <QApt/Backend> -#include <QApt/DebFile> -#include <QApt/Transaction> - -QAptActions::QAptActions() - : QObject(nullptr) - , m_backend(nullptr) - , m_actionsDisabled(false) - , m_mainWindow(nullptr) - , m_reloadWhenEditorFinished(false) - , m_historyDialog(nullptr) - , m_distUpgradeAvailable(false) - , m_config(new QNetworkConfigurationManager(this)) -{ - connect(m_config, &QNetworkConfigurationManager::onlineStateChanged, this, &QAptActions::shouldConnect); -} - -QAptActions* QAptActions::self() -{ - static QPointer<QAptActions> self; - if(!self) { - self = new QAptActions; - } - return self; -} - -void QAptActions::setMainWindow(KXmlGuiWindow* w) -{ - setParent(w); - m_mainWindow = w; - - setupActions(); -} - -KXmlGuiWindow* QAptActions::mainWindow() const -{ - return m_mainWindow; -} - -void QAptActions::setBackend(QApt::Backend* backend) -{ - if(backend == m_backend) - return; - m_backend = backend; - if (!m_backend->init()) - initError(); - - connect(m_backend, SIGNAL(packageChanged()), this, SLOT(setActionsEnabled())); - - setOriginalState(m_backend->currentCacheState()); - - setReloadWhenEditorFinished(true); - // Some actions need an initialized backend to be able to set their enabled state - setActionsEnabled(true); - checkDistUpgrade(); -} - -void QAptActions::setupActions() -{ - QAction* undoAction = KStandardAction::undo(this, SLOT(undo()), actionCollection()); - actionCollection()->addAction("undo", undoAction); - m_actions.append(undoAction); - - QAction* redoAction = KStandardAction::redo(this, SLOT(redo()), actionCollection()); - actionCollection()->addAction("redo", redoAction); - m_actions.append(redoAction); - - QAction* revertAction = actionCollection()->addAction("revert"); - revertAction->setIcon(QIcon::fromTheme("document-revert")); - revertAction->setText(i18nc("@action Reverts all potential changes to the cache", "Unmark All")); - connect(revertAction, SIGNAL(triggered()), this, SLOT(revertChanges())); - m_actions.append(revertAction); - - QAction* softwarePropertiesAction = actionCollection()->addAction("software_properties"); - softwarePropertiesAction->setPriority(QAction::LowPriority); - softwarePropertiesAction->setIcon(QIcon::fromTheme("configure")); - softwarePropertiesAction->setText(i18nc("@action Opens the software sources configuration dialog", "Configure Software Sources")); - connect(softwarePropertiesAction, SIGNAL(triggered()), this, SLOT(runSourcesEditor())); - m_actions.append(softwarePropertiesAction); - - QAction* loadSelectionsAction = actionCollection()->addAction("open_markings"); - loadSelectionsAction->setIcon(QIcon::fromTheme("document-open")); - loadSelectionsAction->setText(i18nc("@action", "Read Markings...")); - connect(loadSelectionsAction, SIGNAL(triggered()), this, SLOT(loadSelections())); - m_actions.append(loadSelectionsAction); - - QAction* saveSelectionsAction = actionCollection()->addAction("save_markings"); - saveSelectionsAction->setIcon(QIcon::fromTheme("document-save-as")); - saveSelectionsAction->setText(i18nc("@action", "Save Markings As...")); - connect(saveSelectionsAction, SIGNAL(triggered()), this, SLOT(saveSelections())); - m_actions.append(saveSelectionsAction); - - QAction* createDownloadListAction = actionCollection()->addAction("save_download_list"); - createDownloadListAction->setPriority(QAction::LowPriority); - createDownloadListAction->setIcon(QIcon::fromTheme("document-save-as")); - createDownloadListAction->setText(i18nc("@action", "Save Package Download List...")); - connect(createDownloadListAction, SIGNAL(triggered()), this, SLOT(createDownloadList())); - m_actions.append(createDownloadListAction); - - QAction* downloadListAction = actionCollection()->addAction("download_from_list"); - downloadListAction->setPriority(QAction::LowPriority); - downloadListAction->setIcon(QIcon::fromTheme("download")); - downloadListAction->setText(i18nc("@action", "Download Packages From List...")); - connect(downloadListAction, SIGNAL(triggered()), this, SLOT(downloadPackagesFromList())); - downloadListAction->setEnabled(isConnected()); - connect(this, SIGNAL(shouldConnect(bool)), downloadListAction, SLOT(setEnabled(bool))); - m_actions.append(downloadListAction); - - QAction* loadArchivesAction = actionCollection()->addAction("load_archives"); - loadArchivesAction->setPriority(QAction::LowPriority); - loadArchivesAction->setIcon(QIcon::fromTheme("document-open")); - loadArchivesAction->setText(i18nc("@action", "Add Downloaded Packages")); - connect(loadArchivesAction, SIGNAL(triggered()), this, SLOT(loadArchives())); - m_actions.append(loadArchivesAction); - - QAction* saveInstalledAction = actionCollection()->addAction("save_package_list"); - saveInstalledAction->setPriority(QAction::LowPriority); - saveInstalledAction->setIcon(QIcon::fromTheme("document-save-as")); - saveInstalledAction->setText(i18nc("@action", "Save Installed Packages List...")); - connect(saveInstalledAction, SIGNAL(triggered()), this, SLOT(saveInstalledPackagesList())); - - QAction* historyAction = actionCollection()->addAction("history"); - historyAction->setPriority(QAction::LowPriority); - historyAction->setIcon(QIcon::fromTheme("view-history")); - historyAction->setText(i18nc("@action::inmenu", "History...")); - actionCollection()->setDefaultShortcut(historyAction, QKeySequence(Qt::CTRL + Qt::Key_H)); - connect(historyAction, SIGNAL(triggered()), this, SLOT(showHistoryDialog())); - - QAction *distUpgradeAction = actionCollection()->addAction("dist-upgrade"); - distUpgradeAction->setIcon(QIcon::fromTheme("system-software-update")); - distUpgradeAction->setText(i18nc("@action", "Upgrade")); - distUpgradeAction->setPriority(QAction::HighPriority); - distUpgradeAction->setWhatsThis(i18nc("Notification when a new version of Kubuntu is available", - "A new version of Kubuntu is available.")); - distUpgradeAction->setEnabled(m_distUpgradeAvailable); - connect(distUpgradeAction, SIGNAL(triggered(bool)), SLOT(launchDistUpgrade())); - - m_actions.append(saveInstalledAction); -} - -void QAptActions::setActionsEnabled(bool enabled) -{ - m_actionsDisabled = !enabled; - - Q_FOREACH (QAction *action, m_actions) { - action->setEnabled(enabled); - } - - if (!enabled || !m_mainWindow || !actionCollection()) - return; - - actionCollection()->action("update")->setEnabled(isConnected() && enabled); - - actionCollection()->action("undo")->setEnabled(m_backend && !m_backend->isUndoStackEmpty()); - actionCollection()->action("redo")->setEnabled(m_backend && !m_backend->isRedoStackEmpty()); - actionCollection()->action("revert")->setEnabled(m_backend && !m_backend->isUndoStackEmpty()); - - actionCollection()->action("save_download_list")->setEnabled(isConnected()); - - bool changesPending = m_backend && m_backend->areChangesMarked(); - actionCollection()->action("save_markings")->setEnabled(changesPending); - actionCollection()->action("save_download_list")->setEnabled(changesPending); - actionCollection()->action("dist-upgrade")->setEnabled(m_distUpgradeAvailable); -} - -bool QAptActions::reloadWhenSourcesEditorFinished() const -{ - return m_reloadWhenEditorFinished; -} - -bool QAptActions::isConnected() const -{ - return m_config->isOnline(); -} - -bool QAptActions::saveSelections() -{ - QString filename = QFileDialog::getSaveFileName(m_mainWindow, i18nc("@title:window", "Save Markings As")); - - if (filename.isEmpty()) { - return false; - } - - if (!m_backend->saveSelections(filename)) { - QString text = xi18nc("@label", "The document could not be saved, as it " - "was not possible to write to " - "<filename>%1</filename>\n\nCheck " - "that you have write access to this file " - "or that enough disk space is available.", - filename); - KMessageBox::error(m_mainWindow, text, QString()); - return false; - } - - return true; -} - -bool QAptActions::saveInstalledPackagesList() -{ - QString filename; - - filename = QFileDialog::getSaveFileName(m_mainWindow, - i18nc("@title:window", "Save Installed Packages List As")); - - if (filename.isEmpty()) { - return false; - } - - if (!m_backend->saveInstalledPackagesList(filename)) { - QString text = xi18nc("@label", "The document could not be saved, as it " - "was not possible to write to " - "<filename>%1</filename>\n\nCheck " - "that you have write access to this file " - "or that enough disk space is available.", - filename); - KMessageBox::error(m_mainWindow, text, QString()); - return false; - } - - return true; -} - -bool QAptActions::createDownloadList() -{ - QString filename; - filename = QFileDialog::getSaveFileName(m_mainWindow, - i18nc("@title:window", "Save Download List As")); - - if (filename.isEmpty()) { - return false; - } - - if (!m_backend->saveDownloadList(filename)) { - QString text = xi18nc("@label", "The document could not be saved, as it " - "was not possible to write to " - "<filename>%1</filename>\n\nCheck " - "that you have write access to this file " - "or that enough disk space is available.", - filename); - KMessageBox::error(m_mainWindow, text, QString()); - return false; - } - - return true; -} - -void QAptActions::downloadPackagesFromList() -{ - QString filename = QFileDialog::getOpenFileName(m_mainWindow, i18nc("@title:window", "Open File")); - - if (filename.isEmpty()) { - return; - } - - QString dirName = filename.left(filename.lastIndexOf('/')); - - setActionsEnabled(false); - QApt::Transaction *trans = m_backend->downloadArchives(filename, dirName % QLatin1String("/packages")); - - if (trans) - emit downloadArchives(trans); -} - -void QAptActions::loadSelections() -{ - QString filename = QFileDialog::getOpenFileName(m_mainWindow, i18nc("@title:window", "Open File")); - - if (filename.isEmpty()) { - return; - } - - m_backend->saveCacheState(); - if (!m_backend->loadSelections(filename)) { - QString text = i18nc("@label", "Could not mark changes. Please make sure " - "that the file is a markings file created by " - "either the Muon Package Manager or the " - "Synaptic Package Manager."); - KMessageBox::error(m_mainWindow, text, QString()); - } -} - -void QAptActions::loadArchives() -{ - QString dirName = QFileDialog::getExistingDirectory(m_mainWindow, - i18nc("@title:window", "Choose a Directory")); - - if (dirName.isEmpty()) { - // User canceled - return; - } - - QDir dir(dirName); - QStringList archiveFiles = dir.entryList(QDir::Files, QDir::Name); - - int successCount = 0; - foreach (const QString &archiveFile, archiveFiles) { - const QApt::DebFile debFile(dirName % '/' % archiveFile); - - if (debFile.isValid()) { - if (m_backend->addArchiveToCache(debFile)) { - successCount++; - } - } - } - - if (successCount) { - QString message = i18ncp("@label", - "%1 package was successfully added to the cache", - "%1 packages were successfully added to the cache", - successCount); - KMessageBox::information(m_mainWindow, message, QString()); - } else { - QString message = i18nc("@label", - "No valid packages could be found in this directory. " - "Please make sure the packages are compatible with your " - "computer and are at the latest version."); - KMessageBox::error(m_mainWindow, message, i18nc("@title:window", - "Packages Could Not be Found")); - } -} - -void QAptActions::undo() -{ - m_backend->undo(); -} - -void QAptActions::redo() -{ - m_backend->redo(); -} - -void QAptActions::revertChanges() -{ - m_backend->restoreCacheState(m_originalState); - emit changesReverted(); -} - -void QAptActions::runSourcesEditor() -{ - KProcess *proc = new KProcess(this); - QStringList arguments; - int winID = m_mainWindow->effectiveWinId(); - - const QString kdesu = QFile::decodeName(CMAKE_INSTALL_FULL_LIBEXECDIR_KF5 "/kdesu"); - const QString editor = QStandardPaths::findExecutable("software-properties-kde"); - - arguments << kdesu << "--" << editor << QStringLiteral("--attach") << QString::number(winID); - if (m_reloadWhenEditorFinished) { - arguments << QStringLiteral("--dont-update"); - } - - proc->setProgram(arguments); - m_mainWindow->find(winID)->setEnabled(false); - proc->start(); - connect(proc, SIGNAL(finished(int,QProcess::ExitStatus)), - this, SLOT(sourcesEditorFinished(int))); -} - -void QAptActions::sourcesEditorFinished(int exitStatus) -{ - bool reload = (exitStatus != 0); - m_mainWindow->find(m_mainWindow->effectiveWinId())->setEnabled(true); - if (m_reloadWhenEditorFinished && reload) { - actionCollection()->action("update")->trigger(); - } - - emit sourcesEditorClosed(reload); -} - -KActionCollection* QAptActions::actionCollection() -{ - return m_mainWindow->actionCollection(); -} - -void QAptActions::setOriginalState(QApt::CacheState state) -{ - m_originalState = state; -} - -void QAptActions::setReloadWhenEditorFinished(bool reload) -{ - m_reloadWhenEditorFinished = reload; -} - -void QAptActions::initError() -{ - QString details = m_backend->initErrorMessage(); - - MuonStrings *muonStrings = MuonStrings::global(); - - QString title = muonStrings->errorTitle(QApt::InitError); - QString text = muonStrings->errorText(QApt::InitError, nullptr); - - KMessageBox::detailedError(m_mainWindow, text, details, title); - exit(-1); -} - -void QAptActions::displayTransactionError(QApt::ErrorCode error, QApt::Transaction* trans) -{ - if (error == QApt::Success) - return; - - MuonStrings *muonStrings = MuonStrings::global(); - - QString title = muonStrings->errorTitle(error); - QString text = muonStrings->errorText(error, trans); - - switch (error) { - case QApt::InitError: - case QApt::FetchError: - case QApt::CommitError: - KMessageBox::detailedError(QAptActions::self()->mainWindow(), text, trans->errorDetails(), title); - break; - default: - KMessageBox::error(QAptActions::self()->mainWindow(), text, title); - break; - } -} - -void QAptActions::showHistoryDialog() -{ - if (!m_historyDialog) { - m_historyDialog = new QDialog(mainWindow()); - m_historyDialog->setLayout(new QVBoxLayout(m_historyDialog)); - - KConfigGroup dialogConfig(KSharedConfig::openConfig("muonrc"), "HistoryDialog"); - KWindowConfig::restoreWindowSize(m_historyDialog->windowHandle(), dialogConfig); - - - connect(m_historyDialog, SIGNAL(finished()), SLOT(closeHistoryDialog())); - HistoryView *historyView = new HistoryView(m_historyDialog); - m_historyDialog->layout()->addWidget(historyView); - m_historyDialog->setWindowTitle(i18nc("@title:window", "Package History")); - m_historyDialog->setWindowIcon(QIcon::fromTheme("view-history")); - - QDialogButtonBox* box = new QDialogButtonBox(m_historyDialog); - box->setStandardButtons(QDialogButtonBox::Close); - connect(box, SIGNAL(accepted()), m_historyDialog, SLOT(accept())); - connect(box, SIGNAL(rejected()), m_historyDialog, SLOT(reject())); - m_historyDialog->layout()->addWidget(box); - - m_historyDialog->show(); - } else { - m_historyDialog->raise(); - } -} - -void QAptActions::closeHistoryDialog() -{ - KConfigGroup dialogConfig(KSharedConfig::openConfig("muonrc"), "HistoryDialog"); - KWindowConfig::restoreWindowSize(m_historyDialog->windowHandle(), dialogConfig); - m_historyDialog->deleteLater(); - m_historyDialog = nullptr; -} - -void QAptActions::launchDistUpgrade() -{ - const QString kdesu = QFile::decodeName(CMAKE_INSTALL_FULL_LIBEXECDIR_KF5 "/kdesu"); - QProcess::startDetached(kdesu, {"--", "do-release-upgrade", "-m", "desktop", "-f", "DistUpgradeViewKDE"}); -} - -void QAptActions::checkDistUpgrade() -{ - if(!QFile::exists("/usr/lib/python3/dist-packages/DistUpgrade/DistUpgradeFetcherKDE.py")) { - qWarning() << "Couldn't find the /usr/lib/python3/dist-packages/DistUpgrade/DistUpgradeFetcherKDE.py file"; - return; - } - QString checkerFile = QStandardPaths::locate(QStandardPaths::GenericDataLocation, "libmuon/applicationsbackend/releasechecker"); - if(checkerFile.isEmpty()) { - qWarning() << "Couldn't find the releasechecker script" << QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation); - return; - } - - KProcess* checkerProcess = new KProcess(this); - checkerProcess->setProgram(QStringList() << "/usr/bin/python3" << checkerFile); - connect(checkerProcess, SIGNAL(finished(int)), this, SLOT(checkerFinished(int))); - connect(checkerProcess, SIGNAL(finished(int)), checkerProcess, SLOT(deleteLater())); - checkerProcess->start(); -} - -void QAptActions::checkerFinished(int res) -{ - m_distUpgradeAvailable = (res == 0); - if (!m_mainWindow) - return; - actionCollection()->action("dist-upgrade")->setEnabled(m_distUpgradeAvailable); -} diff --git a/libmuon/backends/ApplicationBackend/libmuonapt/QAptActions.h b/libmuon/backends/ApplicationBackend/libmuonapt/QAptActions.h deleted file mode 100644 index a739e3b..0000000 --- a/libmuon/backends/ApplicationBackend/libmuonapt/QAptActions.h +++ /dev/null @@ -1,109 +0,0 @@ -/*************************************************************************** - * Copyright © 2012 Jonathan Thomas <echidnaman@kubuntu.org> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef QAPTACTIONS_H -#define QAPTACTIONS_H - -#include <QtCore/QObject> -#include <QPointer> - -#include <QApt/Globals> - -class KXmlGuiWindow; -class KDialog; -class KXmlGuiWindow; -class KActionCollection; -class QAction; -class QDialog; -class QNetworkConfigurationManager; - -namespace QApt { - class Backend; - class Transaction; -} - -class QAptActions : public QObject -{ - Q_OBJECT -public: - static QAptActions* self(); - void setMainWindow(KXmlGuiWindow* w); - KXmlGuiWindow* mainWindow() const; - - bool reloadWhenSourcesEditorFinished() const; - bool isConnected() const; - void setOriginalState(QApt::CacheState state); - void setReloadWhenEditorFinished(bool reload); - void initError(); - void displayTransactionError(QApt::ErrorCode error, QApt::Transaction* trans); - KActionCollection* actionCollection(); - - void setCanExit(bool e) { m_canExit = e; } - bool canExit() const { return m_canExit; } - -signals: - void shouldConnect(bool isConnected); - void changesReverted(); - void sourcesEditorClosed(bool reload); - void downloadArchives(QApt::Transaction *trans); - -public slots: - void setBackend(QApt::Backend *backend); - void setupActions(); - - // KAction slots - bool saveSelections(); - bool saveInstalledPackagesList(); - void loadSelections(); - bool createDownloadList(); - void downloadPackagesFromList(); - void loadArchives(); - void undo(); - void redo(); - void revertChanges(); - void runSourcesEditor(); - void sourcesEditorFinished(int exitStatus); - void showHistoryDialog(); - void setActionsEnabled(bool enabled = true); - -private slots: - void closeHistoryDialog(); - void checkDistUpgrade(); - void launchDistUpgrade(); - void checkerFinished(int res); - -private: - QAptActions(); - - QApt::Backend *m_backend; - QApt::CacheState m_originalState; - bool m_actionsDisabled; - KXmlGuiWindow* m_mainWindow; - bool m_reloadWhenEditorFinished; - - QPointer<QDialog> m_historyDialog; - QList<QAction *> m_actions; - bool m_distUpgradeAvailable; - QNetworkConfigurationManager* m_config; - bool m_canExit; - -}; - -#endif // QAPTACTIONS_H diff --git a/libmuon/backends/ApplicationBackend/libmuonapt/policies/org.kde.muon.repo.action b/libmuon/backends/ApplicationBackend/libmuonapt/policies/org.kde.muon.repo.action deleted file mode 100644 index dd6ad20..0000000 --- a/libmuon/backends/ApplicationBackend/libmuonapt/policies/org.kde.muon.repo.action +++ /dev/null @@ -1,5 +0,0 @@ -[org.kde.muon.repo.modify] -Name=Add Repo -Description=The system is attempting to modify the sources -Policy=auth_admin -Persistence=session
\ No newline at end of file diff --git a/libmuon/backends/ApplicationBackend/muon-applications-backend-categories.xml b/libmuon/backends/ApplicationBackend/muon-applications-backend-categories.xml deleted file mode 100644 index b3fb80b..0000000 --- a/libmuon/backends/ApplicationBackend/muon-applications-backend-categories.xml +++ /dev/null @@ -1,554 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<Menu> - - <Menu> - <Name>Accessories</Name> - <Icon>applications-utilities</Icon> - <Include> - <And> - <Category>Utility</Category> - <Not><Category>Accessibility</Category></Not> - </And> - </Include> - </Menu> - - <Menu> - <Name>Accessibility</Name> - <Icon>preferences-desktop-accessibility</Icon> - <Include> - <And> - <Category>Accessibility</Category> - <Not><Category>Settings</Category></Not> - </And> - </Include> - </Menu> - - <Menu> - <Name>Developer Tools</Name> - <Icon>applications-development</Icon> - <Include> - <Or> - <Category>Development</Category> - <PkgSection>devel</PkgSection> - <PkgSection>restricted/devel</PkgSection> - <PkgSection>universe/devel</PkgSection> - <PkgSection>multiverse/devel</PkgSection> - </Or> - <Filename>emacs.desktop</Filename> - </Include> - - - <Menu> - <Name>Debugging</Name> - <Icon>tools-report-bug</Icon> - <Include> - <And> - <Category>Debugger</Category> - </And> - </Include> - </Menu> - - <Menu> - <Name>Graphic Interface Design</Name> - <Include> - <And> - <Category>GUIDesigner</Category> - </And> - </Include> - </Menu> - - <Menu> - <Name>Haskell</Name> - <Icon>text-x-haskell</Icon> - <Include> - <Or> - <PkgSection>haskell</PkgSection> - <PkgSection>restricted/haskell</PkgSection> - <PkgSection>universe/haskell</PkgSection> - <PkgSection>multiverse/haskell</PkgSection> - </Or> - </Include> - </Menu> - - <Menu> - <Name>IDEs</Name> - <Include> - <And> - <Category>IDE</Category> - </And> - </Include> - </Menu> - - <Menu> - <Name>Java</Name> - <Icon>application-x-java</Icon> - <Include> - <Or> - <PkgSection>java</PkgSection> - <PkgSection>restricted/java</PkgSection> - <PkgSection>universe/java</PkgSection> - <PkgSection>multiverse/java</PkgSection> - </Or> - </Include> - </Menu> - - <Menu> - <Name>Localization</Name> - <Icon>preferences-desktop-locale</Icon> - <Include> - <And> - <Category>Translation</Category> - </And> - </Include> - </Menu> - - <Menu> - <Name>Perl</Name> - <Include> - <Or> - <PkgSection>perl</PkgSection> - <PkgSection>restricted/perl</PkgSection> - <PkgSection>universe/perl</PkgSection> - <PkgSection>multiverse/perl</PkgSection> - </Or> - </Include> - </Menu> - - <Menu> - <Name>Profiling</Name> - <Include> - <Or> - <Category>Profiling</Category> - </Or> - </Include> - </Menu> - - <Menu> - <Name>Python</Name> - <Icon>text-x-python</Icon> - <Include> - <Or> - <PkgSection>python</PkgSection> - <PkgSection>restricted/python</PkgSection> - <PkgSection>universe/python</PkgSection> - <PkgSection>multiverse/python</PkgSection> - </Or> - </Include> - </Menu> - - <Menu> - <Name>Version Control</Name> - <Icon>text-x-patch</Icon> - <Include> - <Or> - <PkgSection>vcs</PkgSection> - <PkgSection>restricted/vcs</PkgSection> - <PkgSection>universe/vcs</PkgSection> - <PkgSection>multiverse/vcs</PkgSection> - <Category>RevisionControl</Category> - </Or> - </Include> - </Menu> - - <Menu> - <Name>Web Development</Name> - <Include> - <And> - <Category>WebDevelopment</Category> - </And> - </Include> - <Icon>applications-internet</Icon> - </Menu> - - </Menu> - - - <Menu> - <Name>Education</Name> - <Icon>applications-education</Icon> - <Include> - <And> - <Category>Education</Category> - <Not> - <Category>Science</Category> - </Not> - </And> - </Include> - </Menu> - - - <Menu> - <Name>Science & Engineering</Name> - <Icon>applications-science</Icon> - <Include> - <Or> - <Category>Science</Category> - <Category>Engineering</Category> - </Or> - </Include> - <Menu> - <Name>Astronomy</Name> - <Include> - <And> - <Category>Astronomy</Category> - </And> - </Include> - </Menu> - <Menu> - <Name>Biology</Name> - <Include> - <And> - <Category>Biology</Category> - </And> - </Include> - </Menu> - <Menu> - <Name>Chemistry</Name> - <Icon>applications-science</Icon> - <Include> - <And> - <Category>Chemistry</Category> - </And> - </Include> - </Menu> - <Menu> - <Name>Computer Science & Robotics</Name> - <Icon>computer</Icon> - <Include> - <Or> - <Category>ArtificialIntelligence</Category> - <Category>ComputerScience</Category> - <Category>Robotics</Category> - </Or> - </Include> - </Menu> - <Menu> - <Name>Electronics</Name> - <Icon>audio-card</Icon> - <Include> - <And> - <Category>Electronics</Category> - </And> - </Include> - </Menu> - <Menu> - <Name>Engineering</Name> - <Icon>applications-engineering</Icon> - <Include> - <And> - <Category>Engineering</Category> - </And> - </Include> - </Menu> - <Menu> - <Name>Geography</Name> - <Include> - <And> - <Category>Geography</Category> - </And> - </Include> - </Menu> - <Menu> - <Name>Geology</Name> - <Include> - <Or> - <Category>Geology</Category> - <Category>Geoscience</Category> - </Or> - </Include> - </Menu> - <Menu> - <Name>Mathematics</Name> - <Icon>applications-education-mathematics</Icon> - <Include> - <Or> - <Category>DataVisualization</Category> - <Category>Math</Category> - <Category>NumericalAnalysis</Category> - <PkgSection>math</PkgSection> - <PkgSection>restricted/math</PkgSection> - <PkgSection>universe/math</PkgSection> - <PkgSection>multiverse/math</PkgSection> - <PkgSection>gnu-r</PkgSection> - <PkgSection>restricted/gnu-r</PkgSection> - <PkgSection>universe/gnu-r</PkgSection> - <PkgSection>multiverse/gnu-r</PkgSection> - </Or> - </Include> - </Menu> - <Menu> - <Name>Physics</Name> - <Icon>step</Icon> - <Include> - <And> - <Category>Physics</Category> - </And> - </Include> - </Menu> - </Menu> - - <Menu> - <Name>Fonts</Name> - <Icon>preferences-desktop-font</Icon> - <ShowTechnical>true</ShowTechnical> - <Include> - <Or> - <PkgWildcard>ttf-*</PkgWildcard> - <PkgWildcard>otf-*</PkgWildcard> - <PkgSection>fonts</PkgSection> - <PkgSection>restricted/fonts</PkgSection> - <PkgSection>universe/fonts</PkgSection> - <PkgSection>multiverse/fonts</PkgSection> - </Or> - </Include> - </Menu> - - <Menu> - <Name>Games</Name> - <Icon>applications-games</Icon> - <Include> - <And> - <Category>Game</Category> - </And> - </Include> - - <Menu> - <Name>Arcade</Name> - <Icon>applications-games-arcade</Icon> - <Include> - <And> - <Category>ArcadeGame</Category> - </And> - </Include> - </Menu> - <Menu> - <Name>Board Games</Name> - <Icon>applications-games-board</Icon> - <Include> - <And> - <Category>BoardGame</Category> - </And> - </Include> - </Menu> - <Menu> - <Name>Card Games</Name> - <Icon>applications-games-card</Icon> - <Include> - <And> - <Category>CardGame</Category> - </And> - </Include> - </Menu> - <Menu> - <Name>Puzzles</Name> - <Icon>applications-games</Icon> - <Include> - <And> - <Category>LogicGame</Category> - </And> - </Include> - </Menu> - <Menu> - <Name>Role Playing</Name> - <Icon>applications-games</Icon> - <Include> - <And> - <Category>RolePlaying</Category> - </And> - </Include> - </Menu> - <Menu> - <Name>Simulation</Name> - <Icon>applications-games-strategy</Icon> - <Include> - <And> - <Category>Simulation</Category> - </And> - </Include> - </Menu> - <Menu> - <Name>Sports</Name> - <Icon>applications-games</Icon> - <Include> - <And> - <Category>SportsGame</Category> - </And> - </Include> - </Menu> - - </Menu> - - - <Menu> - <Name>Graphics</Name> - <Icon>applications-graphics</Icon> - <Include> - <And> - <Category>Graphics</Category> - </And> - </Include> - <Menu> - <Name>3D</Name> - <Include> - <And> - <Category>3DGraphics</Category> - </And> - </Include> - </Menu> - <Menu> - <Name>Drawing</Name> - <Icon>draw-freehand</Icon> - <Include> - <And> - <Category>VectorGraphics</Category> - <Not> - <Category>Viewer</Category> - </Not> - </And> - </Include> - </Menu> - <Menu> - <Name>Painting & Editing</Name> - <Icon>draw-brush</Icon> - <Include> - <And> - <Category>RasterGraphics</Category> - <Not> - <Category>Viewer</Category> - <Category>Scanning</Category> - </Not> - </And> - </Include> - </Menu> - <Menu> - <Name>Photography</Name> - <Icon>image-x-generic</Icon> - <Include> - <And> - <Category>Photography</Category> - </And> - </Include> - </Menu> - <Menu> - <Name>Publishing</Name> - <Icon>document-export</Icon> - <Include> - <And> - <Category>Publishing</Category> - </And> - </Include> - </Menu> - <Menu> - <Name>Scanning & OCR</Name> - <Icon>scanner</Icon> - <Include> - <Or> - <Category>Scanning</Category> - <Category>OCR</Category> - </Or> - </Include> - </Menu> - <Menu> - <Name>Viewers</Name> - <Icon>graphics-viewer-document</Icon> - <Include> - <And> - <Category>Viewer</Category> - </And> - </Include> - </Menu> - </Menu> - - - <Menu> - <Name>Internet</Name> - <Icon>applications-internet</Icon> - <Include> - <And> - <Category>Network</Category> - </And> - </Include> - <Menu> - <Name>Chat</Name> - <Icon>kopete</Icon> - <Include> - <Or> - <Category>InstantMessaging</Category> - <Category>IRCClient</Category> - </Or> - </Include> - </Menu> - <Menu> - <Name>File Sharing</Name> - <Icon>ktorrent</Icon> - <Include> - <And> - <Category>FileTransfer</Category> - </And> - </Include> - </Menu> - <Menu> - <Name>Mail</Name> - <Icon>internet-mail</Icon> - <Include> - <And> - <Category>Email</Category> - </And> - </Include> - </Menu> - <Menu> - <Name>Web Browsers</Name> - <Icon>internet-web-browser</Icon> - <Include> - <And> - <Category>WebBrowser</Category> - </And> - </Include> - </Menu> - </Menu> - - - <Menu> - <Name>Multimedia</Name> - <Icon>applications-multimedia</Icon> - <Include> - <And> - <Category>AudioVideo</Category> - </And> - </Include> - </Menu> - - - <Menu> - <Name>Office</Name> - <Icon>applications-office</Icon> - <Include> - <And> - <Category>Office</Category> - </And> - </Include> - </Menu> - - <Menu> - <Name>System & Settings</Name> - <Icon>preferences-system</Icon> - <Include> - <Or> - <Category>Settings</Category> - <Category>System</Category> - </Or> - </Include> - </Menu> - - <Menu> - <Name>Plasma Desktop Widgets</Name> - <Icon>plasma</Icon> - <ShowTechnical>true</ShowTechnical> <!-- needs to be like this as plasmoids don't get a appinstall file for some reason. --> - <Include> - <Or> - <PkgWildcard>plasma-widget-*</PkgWildcard> - </Or> - </Include> - </Menu> - -</Menu> diff --git a/libmuon/backends/ApplicationBackend/muon-applications-backend.desktop b/libmuon/backends/ApplicationBackend/muon-applications-backend.desktop deleted file mode 100644 index 9597545..0000000 --- a/libmuon/backends/ApplicationBackend/muon-applications-backend.desktop +++ /dev/null @@ -1,141 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=Muon/Backend -Exec=blubb -Icon=applications-other -Comment=Install and browse applications in APT -Comment[ast]=Instala y restola aplicaciones n'APT -Comment[bg]=Инсталиране и разглеждане на приложения в APT -Comment[bs]=Instaliraj i pregledaj aplikacije u APT -Comment[ca]=Instal·la i mostra aplicacions en l'APT -Comment[ca@valencia]=Instal·la i mostra aplicacions en l'APT -Comment[cs]=Instalujte a prohlížejte aplikace v APT -Comment[da]=Installér og gennemse programmer i APT -Comment[de]=Anwendungen in APT Installieren und durchsuchen -Comment[el]=Εγκαταστήστε και περιηγηθείτε σε εφαρμογές με το APT -Comment[en_GB]=Install and browse applications in APT -Comment[es]=Instalar y examinar aplicaciones en APT -Comment[et]=Rakenduste paigaldamine ja sirvimine APT-is -Comment[fi]=Asenna ja selaa APT:n välityksellä tarjolla olevia sovelluksia -Comment[fr]=Installer et parcourir des applications dans « APT » -Comment[gl]=Instalar e buscar aplicacións en APT -Comment[hu]=Alkalmazások telepítése és böngészése APT-ban -Comment[id]=Pasang dan melihat-lihat aplikasi di dalam APT -Comment[it]=Installa e sfoglia le applicazioni in APT -Comment[kk]=APT-де бағдарламаларды орнату мен шолу -Comment[ko]=APT에서 프로그램을 찾고 설치하기 -Comment[lt]=Diegti ir naršyti programas per APT -Comment[mr]=APT मध्ये अनुप्रयोग प्रतिष्ठापीत व संचारण करा -Comment[nb]=Installer og bla i programmer i APT -Comment[nds]=Programmen binnen APT dörkieken un installeren -Comment[nl]=Installeer en blader door toepassingen in APT -Comment[nn]=Installer og bla gjennom program i APT -Comment[pl]=Wgrywaj i przeglądaj programy w APT -Comment[pt]=Instalar e navegar pelas aplicações no APT -Comment[pt_BR]=Instala e navega pelos aplicativos no APT -Comment[ro]=Instalează și răsfoiește aplicații în APT -Comment[ru]=Установка и обзор приложений в APT -Comment[sk]=Inštalácia a prehliadanie aplikácií v APT -Comment[sl]=Namestite in brskajte po programih v APT -Comment[sr]=Инсталирајте и прегледајте програме из АПТ‑а -Comment[sr@ijekavian]=Инсталирајте и прегледајте програме из АПТ‑а -Comment[sr@ijekavianlatin]=Instalirajte i pregledajte programe iz APT‑a -Comment[sr@latin]=Instalirajte i pregledajte programe iz APT‑a -Comment[sv]=Installera och bläddra bland program med APT -Comment[tr]=Uygulamalara APT içerisinde gözat ve yükle -Comment[uk]=Встановіть і перегляньте встановлені програми у APT -Comment[x-test]=xxInstall and browse applications in APTxx -Comment[zh_CN]=在 APT 中安装和浏览应用程序 -Comment[zh_TW]=在 APT 內安裝並瀏覽應用程式 -Name=Applications Backend -Name[bs]=Pozadina aplikacija -Name[ca]=Dorsal d'aplicacions -Name[ca@valencia]=Dorsal d'aplicacions -Name[cs]=Podpůrná vrstva aplikace -Name[da]=Programmotor -Name[de]=Dienstprogramm für Anwendungen -Name[el]=Σύστημα υποστήριξης εφαρμογών -Name[en_GB]=Applications Backend -Name[es]=Motor de aplicaciones -Name[et]=Rakenduste taustaprogramm -Name[fi]=Sovellukset-taustajärjestelmä -Name[fr]=Moteur des applications -Name[gl]=Motor de aplicativos -Name[hu]=Alkalmazások modul -Name[id]=Backend Aplikasi -Name[it]=Motore applicazioni -Name[kk]=Қолданбалар тетігі -Name[ko]=프로그램 백엔드 -Name[lt]=Programų posistemė -Name[mr]=अनुप्रयोग बॅकएन्ड -Name[nb]=Program-bakgrunnsmotor -Name[nds]=Programmen-Hülpprogramm -Name[nl]=Backend van toepassing -Name[nn]=Program-bakgrunnsmotor -Name[pa]=ਐਪਲੀਕੇਸ਼ਨ ਬੈਕਐਂਡ -Name[pl]=Silnik programów -Name[pt]=Infra-Estrutura de Aplicações -Name[pt_BR]=Infraestrutura de aplicativos -Name[ro]=Platformă de aplicații -Name[ru]=Модуль приложений -Name[sk]=Backend aplikácií -Name[sl]=Zaledje programov -Name[sr]=Позадина за програме -Name[sr@ijekavian]=Позадина за програме -Name[sr@ijekavianlatin]=Pozadina za programe -Name[sr@latin]=Pozadina za programe -Name[sv]=Programgränssnitt -Name[tr]=Uygulama Arka uçları -Name[ug]=پروگراممالىرنىڭ ئارقا ئۇچى -Name[uk]=Модуль програм -Name[x-test]=xxApplications Backendxx -Name[zh_CN]=应用程序后端 -Name[zh_TW]=應用程式後端介面 -GenericName=APT Support -GenericName[ast]=Sofitu d'APT -GenericName[bg]=Поддръжка на APT -GenericName[bs]=APT podrška -GenericName[ca]=Implementació de l'APT -GenericName[ca@valencia]=Implementació de l'APT -GenericName[cs]=Podpora APT -GenericName[da]=APT-understøttelse -GenericName[de]=Unterstützung für APT -GenericName[el]=Υποστήριξη APT -GenericName[en_GB]=APT Support -GenericName[es]=Implementación de APT -GenericName[et]=APT toetus -GenericName[fi]=APT-tuki -GenericName[fr]=Prise en charge de « APT » -GenericName[gl]=Soporte para APT -GenericName[hu]=APT támogatás -GenericName[id]=Dukungan APT -GenericName[it]=Supporto APT -GenericName[kk]=APT қолдауы -GenericName[ko]=APT 지원 -GenericName[lt]=APT palaikymas -GenericName[mr]=APT समर्थन -GenericName[nb]=APT-støtte -GenericName[nds]=APT-Ünnerstütten -GenericName[nl]=Ondersteuning van APT -GenericName[nn]=APT-støtte -GenericName[pa]=APT ਸਹਿਯੋਗ -GenericName[pl]=Obsługa APT -GenericName[pt]=Suporte para o APT -GenericName[pt_BR]=Suporte ao APT -GenericName[ro]=Suport pentru APT -GenericName[ru]=Поддержка APT -GenericName[sk]=Podpora APT -GenericName[sl]=Podpora APT -GenericName[sr]=Подршка за АПТ -GenericName[sr@ijekavian]=Подршка за АПТ -GenericName[sr@ijekavianlatin]=Podrška za APT -GenericName[sr@latin]=Podrška za APT -GenericName[sv]=Stöd för APT -GenericName[tr]=APT Desteği -GenericName[uk]=Підтримка APT -GenericName[x-test]=xxAPT Supportxx -GenericName[zh_CN]=APT 支持 -GenericName[zh_TW]=APT 支援 -X-KDE-Library=muon-applications-backend -X-KDE-PluginInfo-Name=muon-applications-backend -X-KDE-PluginInfo-License=GPL diff --git a/libmuon/backends/ApplicationBackend/muonapplicationnotifier.notifyrc b/libmuon/backends/ApplicationBackend/muonapplicationnotifier.notifyrc deleted file mode 100644 index 9ab1f72..0000000 --- a/libmuon/backends/ApplicationBackend/muonapplicationnotifier.notifyrc +++ /dev/null @@ -1,139 +0,0 @@ -[Global] -IconName=muondiscover -Comment=Muon Application Backend Notifier -Comment[bs]=Pozadinski obavještavač za Muon aplikacije -Comment[ca]=Notificador del dorsal d'aplicacions del Muon -Comment[ca@valencia]=Notificador del dorsal d'aplicacions del Muon -Comment[cs]=Podpůrná vrstva upozorňování pro Muon -Comment[da]=Backend-bekendtgørelser for programmet Muon -Comment[de]=Muon-Dienstprogramm für Anwendungs-Benachrichtigungen -Comment[el]=Πρόγραμμα ειδοποιήσεων εφαρμογών υποστήριξης Muon -Comment[en_GB]=Muon Application Backend Notifier -Comment[es]=Motor del notificador de aplicaciones de Muon -Comment[et]=Muoni rakenduste taustaprogrammi märguanded -Comment[fi]=Muonin sovellustaustajärjestelmän ilmoitukset -Comment[fr]=Notifieur du moteur de l'application Muon -Comment[gl]=Motor de notificacións de aplicacións de Muon -Comment[hu]=Muon alkalmazás háttérprogram értesítő -Comment[id]=Pemberitahu Backend Aplikasi Muon -Comment[it]=Notifiche motore applicazioni di Muon -Comment[ko]=Muon 프로그램 백엔드 알림이 -Comment[lt]=Muon programos galinės sąsajos pranešėjas -Comment[nb]=Muon varsler for program-bakgrunnsmotor -Comment[nds]=Muon-Programm-Hülpprogramm-Bescheden -Comment[nl]=Muon backend van melder van toepassingen -Comment[nn]=Muon-varslar for program-bakgrunnsmotor -Comment[pl]=Silnik powiadamiania o programach Muon -Comment[pt]=Notificador da Infra-Estrutura de Aplicações do Muon -Comment[pt_BR]=Notificador da Infraestrutura de Aplicativos do Muon -Comment[ro]=Platformă pentru notificare de aplicații Muon -Comment[ru]=Модуль уведомлений Muon -Comment[sk]=Backendový oznamovač aplikácií Muon -Comment[sl]=Zaledja obvestilnika za programe Muon -Comment[sr]=Муонова позадина за извештавање о програмима -Comment[sr@ijekavian]=Муонова позадина за извештавање о програмима -Comment[sr@ijekavianlatin]=Muonova pozadina za izveštavanje o programima -Comment[sr@latin]=Muonova pozadina za izveštavanje o programima -Comment[sv]=Muon programgränssnittsunderrättelser -Comment[tr]=Muon Uygulama Arka Uç Bildirici -Comment[uk]=Сповіщувач модуля програми Muon -Comment[x-test]=xxMuon Application Backend Notifierxx -Comment[zh_CN]=Muon 应用程序后端通知器 -Comment[zh_TW]=Muon 應用程式後端介面通知器 - -[Event/DistUpgrade] -Name=Upgrade Available -Name[ast]=Anovamientu disponible -Name[bg]=Налично е надграждане -Name[bs]=Nadogradnja dostupna -Name[ca]=Hi ha una actualització disponible -Name[ca@valencia]=Hi ha una actualització disponible -Name[cs]=Dostupná aktualizace distribuce -Name[da]=Opgradering tilgængelig -Name[de]=Paketaktualisierung verfügbar -Name[el]=Διαθέσιμη αναβάθμιση -Name[en_GB]=Upgrade Available -Name[es]=Disponible actualización -Name[et]=Saadaval on uuendus -Name[fi]=Versiopäivitys saatavilla -Name[fr]=Mise à niveau disponible -Name[ga]=Nuashonrú Le Fáil -Name[gl]=Dispoñíbel unha actualización -Name[hu]=Disztribúciófrissítés érhető el -Name[id]=Peningkatan Tersedia -Name[it]=Aggiornamento disponibile -Name[kk]=Жаңартуы бар -Name[ko]=업그레이드 사용 가능 -Name[lt]=Galimas atnaujinimas -Name[mr]=अद्ययावत सॉफ़्टवेअर उपलब्ध आहे -Name[nb]=Oppgradering tilgjengelig -Name[nds]=Opgraderen verföögbor -Name[nl]=Opwaardering beschikbaar -Name[nn]=Oppgradering tilgjengeleg -Name[pa]=ਅੱਪਡੇਟ ਉਪਲੱਬਧ -Name[pl]=Dostępne uaktualnienie -Name[pt]=Actualização Disponível -Name[pt_BR]=Atualização disponível -Name[ro]=Actualizare disponibilă -Name[ru]=Доступно обновление дистрибутива -Name[sk]=Dostupné vylepšenia systému -Name[sl]=Na voljo je nadgradnja -Name[sr]=Доступна надоградња -Name[sr@ijekavian]=Доступна надоградња -Name[sr@ijekavianlatin]=Dostupna nadogradnja -Name[sr@latin]=Dostupna nadogradnja -Name[sv]=Uppgradering tillgänglig -Name[tr]=Dağıtım Yükseltmesi Var -Name[ug]=يۈكسەلدۈرگىلى بولىدۇ -Name[uk]=Доступне оновлення дистрибутива -Name[x-test]=xxUpgrade Availablexx -Name[zh_CN]=升级可用 -Name[zh_TW]=有可用的更新 -Comment=A new version of Kubuntu is available -Comment[ast]=Ta disponible una versión nueva de Kubuntu -Comment[bg]=Налична е нова версия на Кубунту -Comment[bs]=Nova verzija Kubuntu je dostupna -Comment[ca]=Hi ha disponible una nova versió del Kubuntu -Comment[ca@valencia]=Hi ha disponible una nova versió del Kubuntu -Comment[cs]=Je dostupná nová verze Kubuntu -Comment[da]=En ny version af Kubuntu er tilgængelig -Comment[de]=Eine neue Version von Kubuntu ist verfügbar -Comment[el]=Μια νέα έκδοση του Kubuntu είναι διαθέσιμη -Comment[en_GB]=A new version of Kubuntu is available -Comment[es]=Está disponible una nueva versión de Kubuntu -Comment[et]=Saadaval on Kubuntu uus versioon -Comment[fi]=Uusi Kubuntun versio on saatavilla -Comment[fr]=Une nouvelle version de Kubuntu est disponible -Comment[ga]=Tá leagan nua de Kubuntu ar fáil -Comment[gl]=Está dispoñíbel unha nova versión de Kubuntu -Comment[hu]=Új Kubuntu kiadás érhető el -Comment[id]=Sebuah versi baru Kubuntu telah tersedia -Comment[it]=È disponibile una nuova versione di Kubuntu -Comment[kk]=Жаңа Kubuntu нұсқасы бар -Comment[ko]=Kubuntu 새 버전 사용 가능 -Comment[lt]=Nauja Kubuntu versija pasiekiama -Comment[mr]=कुबुन्टुची नवीन आवृत्ती उपलब्ध आहे -Comment[nb]=En ny versjon av Kubuntu er tilgjengelig -Comment[nds]=En nieg Verschoon vun Kubuntu is verföögbor. -Comment[nl]=Er is een nieuwe versie van Kubuntu beschikbaar -Comment[nn]=Ein ny versjon av Kubuntu er tilgjengeleg -Comment[pa]=ਕੂਬਤੂੰ ਦਾ ਨਵਾਂ ਵਰਜਨ ਉਪਲੱਬਧ ਹੈ -Comment[pl]=Dostępna jest nowa wersja Kubuntu -Comment[pt]=Está disponível uma nova versão do Kubuntu -Comment[pt_BR]=Está disponível uma nova versão do Kubuntu -Comment[ro]=Este disponibilă o nouă versiune de Kubuntu -Comment[ru]=Доступна новая версия Kubuntu -Comment[sk]=Nová verzia Kubuntu je dostupná -Comment[sl]=Na voljo je nova različica Kubuntu -Comment[sr]=Доступно је ново издање Кубунтуа -Comment[sr@ijekavian]=Доступно је ново издање Кубунтуа -Comment[sr@ijekavianlatin]=Dostupno je novo izdanje Kubuntua -Comment[sr@latin]=Dostupno je novo izdanje Kubuntua -Comment[sv]=En ny version av Kubuntu är tillgänglig -Comment[tr]=Kubuntu'nun yeni sürümü var -Comment[ug]=يېڭى نەشردىكى كۇبۇنتۇ بار -Comment[uk]=Доступна нова версія Kubuntu -Comment[x-test]=xxA new version of Kubuntu is availablexx -Comment[zh_CN]=有新版本的 Kubuntu -Comment[zh_TW]=已經有新版本的 Kubuntu -Action=Popup diff --git a/libmuon/backends/ApplicationBackend/qoauth/CMakeLists.txt b/libmuon/backends/ApplicationBackend/qoauth/CMakeLists.txt deleted file mode 100644 index 06c858a..0000000 --- a/libmuon/backends/ApplicationBackend/qoauth/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -find_package(Qca-qt5 REQUIRED) - -add_library(MuonQOAuth STATIC src/interface.cpp) -target_link_libraries(MuonQOAuth PUBLIC Qt5::Network qca-qt5) -add_library(Muon::QOAuth ALIAS MuonQOAuth) diff --git a/libmuon/backends/ApplicationBackend/qoauth/src/interface.cpp b/libmuon/backends/ApplicationBackend/qoauth/src/interface.cpp deleted file mode 100644 index 6f2fc24..0000000 --- a/libmuon/backends/ApplicationBackend/qoauth/src/interface.cpp +++ /dev/null @@ -1,1085 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2009 by Dominik Kapusta <d@ayoy.net> * - * * - * This library is free software; you can redistribute it and/or modify * - * it under the terms of the GNU Lesser General Public License as * - * published by the Free Software Foundation; either version 2.1 of * - * the License, or (at your option) any later version. * - * * - * 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 * - * Lesser General Public License for more details. * - * * - * You should have received a copy of the GNU Lesser General Public * - * License along with this library; if not, write to * - * the Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ - - -#include "interface.h" -#include "interface_p.h" - -#include <QtCrypto> - -#include <QNetworkAccessManager> -#include <QNetworkRequest> -#include <QNetworkReply> -#include <QUrl> -#include <QDateTime> -#include <QtDebug> -#include <QEventLoop> -#include <QTimer> -#include <QFileInfo> - -/*! - \mainpage - - \section sec_what What is the purpose of QOAuth? - - The main motivation to create this library was to provide an interface to OAuth - protocol for (Qt-based) C++ applications in an easy way. This is very early version - of the library, and it lacks some functionality, but in the same time it is capable - of sending OAuth authorization requests as well as preparing requests for accessing - User's Protected Resources. - - \section sec_lic License and Authors - - The project is licensed under <a href=http://www.gnu.org/licenses/lgpl-2.1.html>GNU LGPL - license</a> version 2.1 or later. The work is done by Dominik Kapusta (d at ayoy dot net). - - \section sec_inst How to install? - - \subsection ssec_deps Dependencies - - There are a few things necessary to get OAuth library working: - - <ol> - <li>Qt libraries, version 4.4 or higher,</li> - <li>QCA (Qt Cryptographic Architecture), available from - <a href=http://delta.affinix.com/qca>Delta XMPP Project</a>, version 2.0.0 - or higher,</li> - <li>OpenSSL plugin to QCA (qca-ossl), available from QCA page, and requiring OpenSSL.</li> - </ol> - - \b Note: KDE4 users meet all the requirements out of the box. - - \subsection ssec_inst Installation - - The source code repository is hosted on <a href=http://github.com/ayoy/qoauth>GitHub</a> - and the code can be checked out from there easily using git: - \verbatim - $ git clone git://github.com/ayoy/qoauth.git \endverbatim - - To compile the code, follow the simple procedure: - - \verbatim - $ qmake - $ make - $ sudo make install \endverbatim - - \subsection ssec_use Usage - - Configuring your project to work with QOAuth library is extremely simple. Firstly, - append a line to your project file: - \verbatim - CONFIG += oauth \endverbatim - - Then include the following header in your code: - \verbatim - #include <QtOAuth> \endverbatim - - \b Note: This follows the Qt scheme, i.e. <tt>QT += xml ==> #include <QtXml></tt>, etc. - - \section sec_bugs Bugs and issues - - Please file all the bug reports to the QOAuth bug tracking system at - <a href="http://ayoy.lighthouseapp.com/projects/32547-qoauth/tickets?q=all"> - lighthouseapp.com</a>. If you wish to contribute, you're extremely welcome - to fork a <a href=http://github.com/ayoy/qoauth>GitHub</a> repository and - add your input there. - -*/ - -/*! - \class QOAuth::Interface interface.h <QtOAuth> - \brief This class provides means for interaction with network services supporting - OAuth authorization scheme. - - The QOAuth::Interface class is meant to enable OAuth support in applications in as simple way - as possible. It provides 4 basic methods, two of which serve for authorization purposes: - \li \ref requestToken(), - \li \ref accessToken(), - - and the other two help with creation of requests for accessing Protected Resources: - \li \ref createParametersString(), - \li \ref inlineParameters(). - - \section sec_auth_scheme OAuth authorization scheme - - According to <a href=http://oauth.net/core/1.0/#consumer_req_param> - OAuth 1.0 Core specification</a>, <em>the OAuth protocol enables websites or applications - (Consumers) to access Protected Resources from a web service (Service Provider) via an - API, without requiring Users to disclose their Service Provider credentials to the - Consumers</em>. Simply, OAuth is a way of connecting an application to the Service - Provider's API without needing to provide User's login or password. The authorization - is based on an exchange of a Token (user-specific) together with a Consumer Key - (application-specific), encrypted with a combination of so called Token Secret and - Customer Secret. Getting access to Protected Resources consists in three basic steps: - <ol> - <li>obtaining an unauthorized Request Token from the Service Provider,</li> - <li>asking the User to authorize the Request Token,</li> - <li>exchanging the Request Token for the Access Token.</li> - </ol> - Details are covered in <a href=http://oauth.net/core/1.0/#anchor9>Section 6</a> of the - OAuth 1.0 Core Specification. As the authorization procedure is quite complex, the QOAuth - library helps to simplify it by doing all the dirty work behind the scenes. - - \section sec_req_token OAuth authorization with QOAuth - - First step of OAuth authorization can be done in one line using QOAuth library. - Consult the example: - - \include requestToken.cpp - - Once the unauthorized Request Token is received, User has to authorize it using - Service Provider-defined method. This is beyond the scope of this library. Once User - authorizes the Request Token, it can be exchanged for an Access Token that authorizes the - application to access User's Protected Resources. This can be done with another one line: - - \include accessToken.cpp - - Once the Access Token is received, the application is authorized. - - \section sec_acc_res Requesting Protected Resources with QOAuth - - In order to access Protected Resources, the application has to send a request containing - arguments including Customer Key and Access Token, and encrypt them with Customer Secret - and Token Secret. The process of constructing such a request can be reduced to another - one-line call with QOAuth::Interface. The example code for inlining all request parameters - (both User-specific and OAuth-related): - - \include getResources.cpp - - If Service Provider requires the OAuth authorization to be done in the <tt>Authorization</tt> - header field, then only User-specific parameters should be inlined with the URL: - - \include getResources2.cpp - - \section sec_capabilities Capabilities - - QOAuth library works with all 3 signature methods supported by the OAuth protocol, namely - HMAC-SHA1, RSA-SHA1 and PLAINTEXT. Hovewer, RSA-SHA1 and (especially) PLAINTEXT - methods may still need additional testing for various input conditions. -*/ - - -QByteArray QOAuth::supportedOAuthVersion() -{ - return InterfacePrivate::OAuthVersion; -} - -QByteArray QOAuth::tokenParameterName() -{ - return InterfacePrivate::ParamToken; -} - -QByteArray QOAuth::tokenSecretParameterName() -{ - return InterfacePrivate::ParamTokenSecret; -} - - -//! \brief The supported OAuth scheme version. -const QByteArray QOAuth::InterfacePrivate::OAuthVersion = "1.0"; - -//! \brief The <em>token</em> request parameter string -const QByteArray QOAuth::InterfacePrivate::ParamToken = "oauth_token"; -//! \brief The <em>token secret</em> request parameter string -const QByteArray QOAuth::InterfacePrivate::ParamTokenSecret = "oauth_token_secret"; - -//! \brief The <em>consumer key</em> request parameter string -const QByteArray QOAuth::InterfacePrivate::ParamConsumerKey = "oauth_consumer_key"; -//! \brief The <em>nonce</em> request parameter string -const QByteArray QOAuth::InterfacePrivate::ParamNonce = "oauth_nonce"; -//! \brief The <em>signature</em> request parameter string -const QByteArray QOAuth::InterfacePrivate::ParamSignature = "oauth_signature"; -//! \brief The <em>signature method</em> request parameter string -const QByteArray QOAuth::InterfacePrivate::ParamSignatureMethod = "oauth_signature_method"; -//! \brief The <em>timestamp</em> request parameter string -const QByteArray QOAuth::InterfacePrivate::ParamTimestamp = "oauth_timestamp"; -//! \brief The <em>version</em> request parameter string -const QByteArray QOAuth::InterfacePrivate::ParamVersion = "oauth_version"; - -QOAuth::InterfacePrivate::InterfacePrivate() : - privateKeySet( false ), - consumerKey( QByteArray() ), - consumerSecret( QByteArray() ), - manager(0), - loop(0), - requestTimeout(0), - error( NoError ) -{ -} - -void QOAuth::InterfacePrivate::init() -{ - Q_Q(QOAuth::Interface); - - ignoreSslErrors = false; - loop = new QEventLoop(q); - setupNetworkAccessManager(); - - q->connect( &eventHandler, SIGNAL(eventReady(int,QCA::Event)), SLOT(_q_setPassphrase(int,QCA::Event)) ); - eventHandler.start(); -} - -void QOAuth::InterfacePrivate::setupNetworkAccessManager() -{ - Q_Q(QOAuth::Interface); - - if (manager == 0) - manager = new QNetworkAccessManager; - - manager->setParent(q); - q->connect( manager, SIGNAL(finished(QNetworkReply*)), loop, SLOT(quit()) ); - q->connect( manager, SIGNAL(finished(QNetworkReply*)), SLOT(_q_parseReply(QNetworkReply*)) ); - q->connect( manager, SIGNAL(sslErrors(QNetworkReply*,QList<QSslError>)), - SLOT(_q_handleSslErrors(QNetworkReply*,QList<QSslError>)) ); -} - -QByteArray QOAuth::InterfacePrivate::httpMethodToString( HttpMethod method ) -{ - switch ( method ) { - case GET: - return "GET"; - case POST: - return "POST"; - case HEAD: - return "HEAD"; - case PUT: - return "PUT"; -#ifndef Q_WS_WIN - case DELETE: - return "DELETE"; -#endif - default: - qWarning() << __FUNCTION__ << "- Unrecognized method"; - return QByteArray(); - } -} - -QByteArray QOAuth::InterfacePrivate::signatureMethodToString( SignatureMethod method ) -{ - switch ( method ) { - case HMAC_SHA1: - return "HMAC-SHA1"; - case RSA_SHA1: - return "RSA-SHA1"; - case PLAINTEXT: - return "PLAINTEXT"; - default: - qWarning() << __FUNCTION__ << "- Unrecognized method"; - return QByteArray(); - } -} - -QOAuth::ParamMap QOAuth::InterfacePrivate::replyToMap( const QByteArray &data ) -{ - // split reply to name=value strings - QList<QByteArray> replyParams = data.split( '&' ); - // we'll store them in a map - ParamMap parameters; - - QByteArray replyParam; - QByteArray key; - int separatorIndex; - - // iterate through name=value pairs - Q_FOREACH ( replyParam, replyParams ) { - // find occurrence of '=' - separatorIndex = replyParam.indexOf( '=' ); - // key is on the left - key = replyParam.left( separatorIndex ); - // value is on the right - parameters.insert( key , replyParam.right( replyParam.length() - separatorIndex - 1 ) ); - } - - return parameters; -} - -void QOAuth::InterfacePrivate::_q_parseReply( QNetworkReply *reply ) -{ - int returnCode = reply->attribute( QNetworkRequest::HttpStatusCodeAttribute ).toInt(); - - switch ( returnCode ) { - case NoError: - replyParams = replyToMap( reply->readAll() ); - if ( !replyParams.contains( InterfacePrivate::ParamToken ) ) { - qWarning() << __FUNCTION__ << "- oauth_token not present in reply!"; - } - if ( !replyParams.contains( InterfacePrivate::ParamTokenSecret ) ) { - qWarning() << __FUNCTION__ << "- oauth_token_secret not present in reply!"; - } - - case BadRequest: - case Unauthorized: - case Forbidden: - error = returnCode; - break; - default: - error = OtherError; - } - - reply->close(); -} - -void QOAuth::InterfacePrivate::_q_handleSslErrors(QNetworkReply *reply, const QList<QSslError> &errors) -{ - Q_UNUSED(errors); - - if (ignoreSslErrors) - reply->ignoreSslErrors(); -} - -QByteArray QOAuth::InterfacePrivate::paramsToString( const ParamMap ¶meters, ParsingMode mode ) -{ - QByteArray middleString; - QByteArray endString; - QByteArray prependString; - - switch ( mode ) { - case ParseForInlineQuery: - prependString = "?"; - case ParseForRequestContent: - case ParseForSignatureBaseString: - middleString = "="; - endString = "&"; - break; - case ParseForHeaderArguments: - prependString = "OAuth "; - middleString = "=\""; - endString = "\","; - break; - default: - qWarning() << __FUNCTION__ << "- Unrecognized mode"; - return QByteArray(); - } - - QByteArray parameter; - QByteArray parametersString; - - Q_FOREACH( parameter, parameters.uniqueKeys() ) { - QList<QByteArray> values = parameters.values( parameter ); - if ( values.size() > 1 ) { - qSort( values.begin(), values.end() ); - } - QByteArray value; - Q_FOREACH ( value, values ) { - parametersString.append( parameter ); - parametersString.append( middleString ); - parametersString.append( value ); - parametersString.append( endString ); - } - } - - // remove the trailing end character (comma or ampersand) - parametersString.chop(1); - - // prepend with the suitable string (or none) - parametersString.prepend( prependString ); - - return parametersString; -} - - -/*! - \brief Creates a new QOAuth::Interface class instance with the given \a parent -*/ - -QOAuth::Interface::Interface( QObject *parent ) : - QObject( parent ), - d_ptr( new InterfacePrivate ) -{ - Q_D(Interface); - - d->q_ptr = this; - d->init(); -} - -/*! - \brief Creates a new QOAuth::Interface class instance with the given \a parent, - using \a manager for network connections. - - Use this constructor if you want to use your custom network access manager to - handle network connections needed by the interface. - - /sa setNetworkAccessManager() -*/ - -QOAuth::Interface::Interface(QNetworkAccessManager *manager, QObject *parent) : - QObject( parent ), - d_ptr( new InterfacePrivate ) -{ - Q_D(Interface); - - d->q_ptr = this; - d->manager = manager; - d->init(); -} - -/*! - \brief Destroys the QOAuth::Interface object -*/ - -QOAuth::Interface::~Interface() -{ - delete d_ptr; -} - -/*! - \brief Returns the network access manager used by the interface. -*/ -QNetworkAccessManager* QOAuth::Interface::networkAccessManager() const -{ - Q_D(const Interface); - - return d->manager; -} - -/*! - \brief Sets \a manager to be the network access manager used by the interface. - - The interface class takes ownership of the manager. If there already is a manager, - it's being deleted. - - /sa networkAccessManager() -*/ -void QOAuth::Interface::setNetworkAccessManager(QNetworkAccessManager* manager) -{ - Q_D(Interface); - - if (d->manager) - delete d->manager; - - d->manager = manager; - d->setupNetworkAccessManager(); -} - -/*! - \property QOAuth::Interface::ignoreSslErrors - \brief This property is used to control SSL errors handling. - - The default value is false, meaning that the interface will fail upon an SSL error. - Set it to true if you want to disregard any SSL errors encountered - during the authorization process. - - Access functions: - \li <b>bool ignoreSslErrors() const</b> - \li <b>void setIgnoreSslErrors( bool enabled )</b> -*/ - -bool QOAuth::Interface::ignoreSslErrors() const -{ - Q_D(const QOAuth::Interface); - - return d->ignoreSslErrors; -} - -void QOAuth::Interface::setIgnoreSslErrors(bool enabled) -{ - Q_D(QOAuth::Interface); - - d->ignoreSslErrors = enabled; -} - - -/*! - \property QOAuth::Interface::consumerKey - \brief This property holds the consumer key - - The consumer key is used by the application to identify itself to the Service Provider. - - Access functions: - \li <b>QByteArray consumerKey() const</b> - \li <b>void setConsumerKey( const QByteArray &consumerKey )</b> -*/ - -QByteArray QOAuth::Interface::consumerKey() const -{ - Q_D(const Interface); - - return d->consumerKey; -} - -void QOAuth::Interface::setConsumerKey( const QByteArray &consumerKey ) -{ - Q_D(Interface); - - d->consumerKey = consumerKey; -} - -/*! - \property QOAuth::Interface::consumerSecret - \brief This property holds the consumer secret - - The consumerSecret is used by the application for signing outgoing requests. - - Access functions: - \li <b>QByteArray consumerSecret() const</b> - \li <b>void setConsumerSecret( const QByteArray &consumerSecret )</b> -*/ - -QByteArray QOAuth::Interface::consumerSecret() const -{ - Q_D(const Interface); - - return d->consumerSecret; -} - -void QOAuth::Interface::setConsumerSecret( const QByteArray &consumerSecret ) -{ - Q_D(Interface); - - d->consumerSecret = consumerSecret; -} - -/*! - \property QOAuth::Interface::requestTimeout - \brief This property holds the timeout value in milliseconds for issued network requests. - - The QOAuth::Interface class can send network requests when asked to do so by calling either - requestToken() or accessToken() method. By defining the \a requestTimeout, requests - can have the time constraint applied, after which they fail, setting \ref error to - \ref Timeout. The \a requestTimeout value is initially set to \c 0, which in this - case means that no timeout is applied to outgoing requests. - - Access functions: - \li <b>uint requestTimeout() const</b> - \li <b>void setRequestTimeout( uint requestTimeout )</b> -*/ - -uint QOAuth::Interface::requestTimeout() const -{ - Q_D(const Interface); - - return d->requestTimeout; -} - -void QOAuth::Interface::setRequestTimeout( uint msec ) -{ - Q_D(Interface); - - d->requestTimeout = msec; -} - - -/*! - \property QOAuth::Interface::error - \brief This property holds the error code - - The error code is initially set to \ref NoError, and its value is updated with every - method that can cause errors. - - Access functions: - \li <b>int error() const</b> - - \sa ErrorCode -*/ - -int QOAuth::Interface::error() const -{ - Q_D(const Interface); - - return d->error; -} - - -/*! - This method is useful when using OAuth with RSA-SHA1 signing algorithm. It reads the RSA - private key from the string given as \a key, and stores it internally. If the key is - secured by a passphrase, it should be passed as the second argument. - - The provided string is decoded into a private RSA key, optionally using the \a passphrase. - If \a key contains a valid RSA private key, this method returns true. If any problems were - encountered during decoding (either the key or the passphrase are invalid), false is - returned and the error code is set to QOAuth::RSADecodingError. - - \sa setRSAPrivateKeyFromFile() -*/ - -// bool QOAuth::Interface::setRSAPrivateKey( const QString &key, const QCA::SecureArray &passphrase ) -// { -// Q_D(Interface); -// -// d->setPrivateKey( key, passphrase, InterfacePrivate::KeyFromString ); -// -// return ( d->error == NoError ); -// } - -/*! - This method is useful when using OAuth with RSA-SHA1 signing algorithm. It reads the RSA - private key from the given \a file, and stores it internally. If the key is secured by - a passphrase, it should be passed as the second argument. - - The provided file is read and decoded into a private RSA key, optionally using the \a passphrase. - If it contains a valid RSA private key, this method returns true. If any problems were - encountered during decoding, false is returned and the appropriate error code is set: - \li <tt>QOAuth::RSAKeyFileError</tt> - when the key file doesn't exist or is unreadable - \li <tt>QOAuth::RSADecodingError</tt> - if problems occurred during encoding (either the key - and/or password are invalid). - - \sa setRSAPrivateKey() -*/ - -// bool QOAuth::Interface::setRSAPrivateKeyFromFile( const QString &filename, const QCA::SecureArray &passphrase ) -// { -// Q_D(Interface); -// -// if ( ! QFileInfo( filename ).exists() ) { -// d->error = RSAKeyFileError; -// qWarning() << __FUNCTION__ << "- the given file does not exist..."; -// } else { -// d->setPrivateKey( filename, passphrase, InterfacePrivate::KeyFromFile ); -// } -// -// return ( d->error == NoError ); -// } - -void QOAuth::InterfacePrivate::setPrivateKey( const QString &source, - const QCA::SecureArray &passphrase, KeySource from ) -{ - - if( !QCA::isSupported( "pkey" ) || - !QCA::PKey::supportedIOTypes().contains( QCA::PKey::RSA ) ) { - qFatal( "RSA is not supported!" ); - } - - privateKeySet = false; - this->passphrase = passphrase; - - QCA::KeyLoader keyLoader; - QEventLoop localLoop; - QObject::connect( &keyLoader, SIGNAL(finished()), &localLoop, SLOT(quit()) ); - - switch (from) { - case KeyFromString: - keyLoader.loadPrivateKeyFromPEM( source ); - break; - case KeyFromFile: - keyLoader.loadPrivateKeyFromPEMFile( source ); - break; - } - - QTimer::singleShot( 3000, &localLoop, SLOT(quit()) ); - localLoop.exec(); - - readKeyFromLoader( &keyLoader ); -} - -void QOAuth::InterfacePrivate::readKeyFromLoader( QCA::KeyLoader *keyLoader ) -{ - QCA::ConvertResult result = keyLoader->convertResult(); - if ( result == QCA::ConvertGood ) { - error = NoError; - privateKey = keyLoader->privateKey(); - privateKeySet = true; - } else if ( result == QCA::ErrorDecode ) { - error = RSADecodingError; - // this one seems to never be set .... - // } else if ( result == QCA::ErrorPassphrase ) { - // error = RSAPassphraseError; - } else if ( result == QCA::ErrorFile ) { - error = RSAKeyFileError; - } -} - -void QOAuth::InterfacePrivate::_q_setPassphrase( int id, const QCA::Event &event ) -{ - if ( event.isNull() ) { - return; - } - - // we're looking only for the passphrase for the RSA key - if ( event.type() == QCA::Event::Password && - event.passwordStyle() == QCA::Event::StylePassphrase ) { - // set the passphrase to the one provided with QOAuth::Interface::setRSAPrivateKey{,FromFile}() - eventHandler.submitPassword( id, passphrase ); - } else { - eventHandler.reject( id ); - } -} - -/*! - This method constructs and sends a request for obtaining an unauthorized Request Token - from the Service Provider. This is the first step of the OAuth authentication flow, - according to <a href=http://oauth.net/core/1.0/#anchor9>OAuth 1.0 Core specification</a>. - The PLAINTEXT signature method uses Customer Secret and (if provided) Token Secret to - sign a request. For the HMAC-SHA1 and RSA-SHA1 signature methods the - <a href=http://oauth.net/core/1.0/#anchor14>Signature Base String</a> is created - using the given \a requestUrl and \a httpMethod. The optional request parameters - specified by the Service Provider can be passed in the \a params ParamMap. - - The Signature Base String contains the \ref consumerKey and uses \ref consumerSecret - for encrypting the message, so it's necessary to provide them both before issuing this - request. The method will check if both \ref consumerKey and \ref consumerSecret are - provided, and fail if any of them is missing. - - When the signature is created, the appropriate request is sent to the Service Provider - (namely, the \a requestUrl). Depending on the type of the request, the parameters are - passed according to the <a href=http://oauth.net/core/1.0/#consumer_req_param> - Consumer Request Parametes</a> section of the OAuth specification, i.e.: - \li for GET requests, in the HTTP Authorization header, as defined in - <a href=http://oauth.net/core/1.0/#auth_header>OAuth HTTP Authorization Scheme</a>, - \li for POST requests, as a request body with \c content-type set to - \c application/x-www-form-urlencoded. - - Once the request is sent, a local event loop is executed and set up to wait for the request - to complete. If the \ref requestTimeout property is set to a non-zero value, its vaue - is applied as a request timeout, after which the request is aborted. - - \returns If request succeded, the method returns all the data passed in the Service - Provider response (including a Request Token and Token Secret), formed in a ParamMap. - If request fails, the \ref error property is set to an appropriate value, and an empty - ParamMap is returned. - - \sa accessToken(), error -*/ - -QOAuth::ParamMap QOAuth::Interface::requestToken( const QString &requestUrl, HttpMethod httpMethod, - SignatureMethod signatureMethod, const ParamMap ¶ms ) -{ - Q_D(Interface); - - return d->sendRequest( requestUrl, httpMethod, signatureMethod, - QByteArray(), QByteArray(), params ); -} - -/*! - This method constructs and sends a request for exchanging a Request Token (obtained - previously with a call to \ref requestToken()) for an Access Token, that authorizes the - application to access Protected Resources. This is the third step of the OAuth - authentication flow, according to <a href=http://oauth.net/core/1.0/#anchor9>OAuth 1.0 - Core specification</a>. The PLAINTEXT signature method uses Customer Secret and (if - provided) Token Secret to sign a request. For the HMAC-SHA1 and RSA-SHA1 - signature methods the <a href=http://oauth.net/core/1.0/#anchor14>Signature Base String</a> - is created using the given \a requestUrl, \a httpMethod, \a token and \a tokenSecret. - The optional request parameters specified by the Service Provider can be passed in the - \a params ParamMap. - - The Signature Base String contains the \ref consumerKey and uses \ref consumerSecret - for encrypting the message, so it's necessary to provide them both before issuing - this request. The method will check if both \ref consumerKey and \ref consumerSecret - are provided, and fail if any of them is missing. - - When the signature is created, the appropriate request is sent to the Service Provider - (namely, the \a requestUrl). Depending on the type of the request, the parameters are - passed according to the <a href=http://oauth.net/core/1.0/#consumer_req_param> - Consumer Request Parametes</a> section of the OAuth specification, i.e.: - \li for GET requests, in the HTTP Authorization header, as defined in - <a href=http://oauth.net/core/1.0/#auth_header>OAuth HTTP Authorization Scheme</a>, - \li for POST requests, as a request body with \c content-type set to - \c application/x-www-form-urlencoded. - - Once the request is sent, a local event loop is executed and set up to wait for the request - to complete. If the \ref requestTimeout property is set to a non-zero value, its vaue - is applied as a request timeout, after which the request is aborted. - - \returns If request succeded, the method returns all the data passed in the Service - Provider response (including an authorized Access Token and Token Secret), formed in - a ParamMap. This request ends the authorization process, and the obtained Access Token - and Token Secret should be kept by the application and provided with every future request - authorized by OAuth, e.g. using \ref createParametersString(). If request fails, the - \ref error property is set to an appropriate value, and an empty ParamMap is returned. - - \sa requestToken(), createParametersString(), error -*/ - -QOAuth::ParamMap QOAuth::Interface::accessToken( const QString &requestUrl, HttpMethod httpMethod, const QByteArray &token, - const QByteArray &tokenSecret, SignatureMethod signatureMethod, - const ParamMap ¶ms ) -{ - Q_D(Interface); - - return d->sendRequest( requestUrl, httpMethod, signatureMethod, - token, tokenSecret, params ); - -} - -/*! - This method generates a parameters string required to access Protected Resources using - OAuth authorization. According to <a href=http://oauth.net/core/1.0/#anchor13>OAuth 1.0 - Core specification</a>, every outgoing request for accessing Protected Resources must - contain information like the Consumer Key and Access Token, and has to be signed using one - of the supported signature methods. - - The PLAINTEXT signature method uses Customer Secret and (if provided) Token Secret to - sign a request. For the HMAC-SHA1 and RSA-SHA1 signature methods the - <a href=http://oauth.net/core/1.0/#anchor14>Signature Base String</a> is created using - the given \a requestUrl, \a httpMethod, \a token and \a tokenSecret. The optional - request parameters specified by the Service Provider can be passed in the \a params - \ref ParamMap. - - The Signature Base String contains the \ref consumerKey and uses \ref consumerSecret - for encrypting the message, so it's necessary to provide them both before issuing - this request. The method will check if both \ref consumerKey and \ref consumerSecret - are provided, and fail if any of them is missing. - - The \a mode parameter specifies the format of the parameter string. - - \returns The parsed parameters string, that depending on \a mode and \a httpMethod is: - - <table> - <tr><td>\b \a mode </td> <td>\b outcome </td></tr> - <tr><td><tt>QOAuth::ParseForRequestContent</tt></td> <td>ready to be posted as a request body</td></tr> - <tr><td><tt>QOAuth::ParseForInlineQuery</tt></td> <td>prepended with a <em>'?'</em> and ready to be appended to the \a requestUrl</td></tr> - <tr><td><tt>QOAuth::ParseForHeaderArguments</tt></td> <td>ready to be set as an argument for the \c Authorization HTTP header</td></tr> - <tr><td><tt>QOAuth::ParseForSignatureBaseString</tt></td> <td><em>meant for internal use</em></td></tr> - </table> - - \sa inlineParameters() -*/ - -QByteArray QOAuth::Interface::createParametersString( const QString &requestUrl, HttpMethod httpMethod, const QByteArray &token, - const QByteArray &tokenSecret, SignatureMethod signatureMethod, - const ParamMap ¶ms, ParsingMode mode ) -{ - Q_D(Interface); - - d->error = NoError; - - // copy parameters to a writeable object - ParamMap parameters = params; - // calculate the signature - QByteArray signature = d->createSignature( requestUrl, httpMethod, signatureMethod, - token, tokenSecret, ¶meters ); - - // return an empty bytearray when signature wasn't created - if ( d->error != NoError ) { - return QByteArray(); - } - - // append it to parameters - parameters.insert( InterfacePrivate::ParamSignature, signature ); - // convert the map to bytearray, according to requested mode - QByteArray parametersString = d->paramsToString( parameters, mode ); - - return parametersString; -} - -/*! - This method is provided for convenience. It generates an inline query string out of - given parameter map. The resulting string can be either sent in an HTTP POST request - as a request content, or appended directly to an HTTP GET request's URL as a query string. - When using this method for preparing an HTTP GET query string you can set the \a mode - to ParseForInlineQuery to have the string prepended with a question mark (separating - the URL path from the query string). Modes other than QOAuth::ParseForRequestContent and - QOAuth::ParseForInlineQuery produce an empty byte array. - - Use this method together with createParametersString(), when you request a header - parameters string (QOAuth::ParseForHeaderArguments) together with HTTP GET method. - In such case, apart from header arguments, you must provide a query string containing - custom request parameters (i.e. not OAuth-related). Pass the custom parameters map - to this method to receive a query string to be appended to the URL. - - \sa createParametersString() -*/ - -QByteArray QOAuth::Interface::inlineParameters( const ParamMap ¶ms, ParsingMode mode ) -{ - Q_D(Interface); - - QByteArray query; - - switch (mode) { - case ParseForInlineQuery: - case ParseForRequestContent: - query = d->paramsToString( params, mode ); - break; - case ParseForHeaderArguments: - case ParseForSignatureBaseString: - break; - } - - return query; -} - -QOAuth::ParamMap QOAuth::InterfacePrivate::sendRequest( const QString &requestUrl, HttpMethod httpMethod, - SignatureMethod signatureMethod, const QByteArray &token, - const QByteArray &tokenSecret, const ParamMap ¶ms ) -{ - if ( httpMethod != GET && httpMethod != POST ) { - qWarning() << __FUNCTION__ << "- requestToken() and accessToken() accept only GET and POST methods"; - error = UnsupportedHttpMethod; - return ParamMap(); - } - - error = NoError; - - ParamMap parameters = params; - - // create signature - QByteArray signature = createSignature( requestUrl, httpMethod, signatureMethod, - token, tokenSecret, ¶meters ); - - // if signature wasn't created, return an empty map - if ( error != NoError ) { - return ParamMap(); - } - - // add signature to parameters - parameters.insert( InterfacePrivate::ParamSignature, signature ); - - QByteArray authorizationHeader; - QNetworkRequest request; - - if ( httpMethod == GET ) { - authorizationHeader = paramsToString( parameters, ParseForHeaderArguments ); - // create the authorization header - request.setRawHeader( "Authorization", authorizationHeader ); - } else if ( httpMethod == POST ) { - authorizationHeader = paramsToString( parameters, ParseForRequestContent ); - // create a network request - request.setHeader( QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded" ); - } - - request.setUrl( QUrl( requestUrl ) ); - - // fire up a single shot timer if timeout was specified - if ( requestTimeout > 0 ) { - QTimer::singleShot( requestTimeout, loop, SLOT(quit()) ); - // if the request finishes on time, the error value is overriden - // if not, it remains equal to QOAuth::Interface::Timeout - error = Timeout; - } - - // clear the reply container and send the request - replyParams.clear(); - QNetworkReply *reply; - if ( httpMethod == GET ) { - reply = manager->get( request ); - } else if ( httpMethod == POST ) { - reply = manager->post( request, authorizationHeader ); - } - - // start the event loop and wait for the response - loop->exec(); - - // if request completed successfully, error is different than QOAuth::Interface::Timeout - // if it failed, we have to abort the request - if ( error == Timeout ) { - reply->abort(); - } - - return replyParams; -} - -QByteArray QOAuth::InterfacePrivate::createSignature( const QString &requestUrl, HttpMethod httpMethod, - SignatureMethod signatureMethod, const QByteArray &token, - const QByteArray &tokenSecret, ParamMap *params ) -{ - if ( ( signatureMethod == HMAC_SHA1 || - signatureMethod == RSA_SHA1 ) && - consumerKey.isEmpty() ) { - qWarning() << __FUNCTION__ << "- consumer key is empty, make sure that you set it" - "with QOAuth::Interface::setConsumerKey()"; - error = ConsumerKeyEmpty; - return QByteArray(); - } - if ( consumerSecret.isEmpty() ) { - qWarning() << __FUNCTION__ << "- consumer secret is empty, make sure that you set it" - "with QOAuth::Interface::setConsumerSecret()"; - error = ConsumerSecretEmpty; - return QByteArray(); - } - - if ( signatureMethod == RSA_SHA1 && - privateKey.isNull() ) { - qWarning() << __FUNCTION__ << "- RSA private key is empty, make sure that you provide it" - "with QOAuth::Interface::setRSAPrivateKey{,FromFile}()"; - error = RSAPrivateKeyEmpty; - return QByteArray(); - } - - // create nonce - QCA::InitializationVector iv( 16 ); - QByteArray nonce = iv.toByteArray().toHex(); - - // create timestamp - uint time = QDateTime::currentDateTime().toTime_t(); - QByteArray timestamp = QByteArray::number( time ); - - // create signature base string - // 1. create the method string - QByteArray httpMethodString = httpMethodToString( httpMethod ); - // 2. prepare percent-encoded request URL - QByteArray percentRequestUrl = requestUrl.toLatin1().toPercentEncoding(); - // 3. prepare percent-encoded parameters string - params->insert( InterfacePrivate::ParamConsumerKey, consumerKey ); - params->insert( InterfacePrivate::ParamNonce, nonce ); - params->insert( InterfacePrivate::ParamSignatureMethod, - signatureMethodToString( signatureMethod ) ); - params->insert( InterfacePrivate::ParamTimestamp, timestamp ); - params->insert( InterfacePrivate::ParamVersion, InterfacePrivate::OAuthVersion ); - // append token only if it is defined (requestToken() doesn't use a token at all) - if ( !token.isEmpty() ) { - params->insert( InterfacePrivate::ParamToken, token ); - } - - QByteArray parametersString = paramsToString( *params, ParseForSignatureBaseString ); - QByteArray percentParametersString = parametersString.toPercentEncoding(); - - QByteArray digest; - - // PLAINTEXT doesn't use the Signature Base String - if ( signatureMethod == PLAINTEXT ) { - digest = createPlaintextSignature( tokenSecret ); - } else { - // 4. create signature base string - QByteArray signatureBaseString; - signatureBaseString.append( httpMethodString + '&' ); - signatureBaseString.append( percentRequestUrl + '&' ); - signatureBaseString.append( percentParametersString ); - - - if ( signatureMethod == HMAC_SHA1 ) { - if( !QCA::isSupported( "hmac(sha1)" ) ) { - qFatal( "HMAC(SHA1) is not supported!" ); - } - // create key for HMAC-SHA1 hashing - QByteArray key( consumerSecret.toPercentEncoding() + '&' + tokenSecret.toPercentEncoding() ); - - // create HMAC-SHA1 digest in Base64 - QCA::MessageAuthenticationCode hmac( "hmac(sha1)", QCA::SymmetricKey( key ) ); - QCA::SecureArray array( signatureBaseString ); - hmac.update( array ); - QCA::SecureArray resultArray = hmac.final(); - digest = resultArray.toByteArray().toBase64(); - - } else if ( signatureMethod == RSA_SHA1 ) { - // sign the Signature Base String with the RSA key - digest = privateKey.signMessage( QCA::MemoryRegion( signatureBaseString ), - QCA::EMSA3_SHA1 ).toBase64(); - } - } - - // percent-encode the digest - QByteArray signature = digest.toPercentEncoding(); - return signature; -} - -QByteArray QOAuth::InterfacePrivate::createPlaintextSignature( const QByteArray &tokenSecret ) -{ - if ( consumerSecret.isEmpty() ) { - qWarning() << __FUNCTION__ << "- consumer secret is empty, make sure that you set it" - "with QOAuth::Interface::setConsumerSecret()"; - error = ConsumerSecretEmpty; - return QByteArray(); - } - - // get percent encoded consumer secret and token secret, join and return - return consumerSecret.toPercentEncoding() + '&' + tokenSecret.toPercentEncoding(); -} - -#include "moc_interface.cpp" diff --git a/libmuon/backends/ApplicationBackend/qoauth/src/interface.h b/libmuon/backends/ApplicationBackend/qoauth/src/interface.h deleted file mode 100644 index b34f060..0000000 --- a/libmuon/backends/ApplicationBackend/qoauth/src/interface.h +++ /dev/null @@ -1,116 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2009 by Dominik Kapusta <d@ayoy.net> * - * * - * This library is free software; you can redistribute it and/or modify * - * it under the terms of the GNU Lesser General Public License as * - * published by the Free Software Foundation; either version 2.1 of * - * the License, or (at your option) any later version. * - * * - * 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 * - * Lesser General Public License for more details. * - * * - * You should have received a copy of the GNU Lesser General Public * - * License along with this library; if not, write to * - * the Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ - - -/*! - \file interface.h - - This file is a part of libqoauth. You should not include it directly in your - application. Instead please use <tt>\#include <QtOAuth></tt>. -*/ - -#ifndef INTERFACE_H -#define INTERFACE_H - -#include <QObject> - -// #include <QtCrypto> - -#include "qoauth_global.h" -#include "qoauth_namespace.h" - -class QNetworkAccessManager; -class QNetworkReply; - -namespace QOAuth { - -class InterfacePrivate; - -class QOAUTH_EXPORT Interface : public QObject -{ - Q_OBJECT - - Q_PROPERTY( QByteArray consumerKey READ consumerKey WRITE setConsumerKey ) - Q_PROPERTY( QByteArray consumerSecret READ consumerSecret WRITE setConsumerSecret ) - Q_PROPERTY( uint requestTimeout READ requestTimeout WRITE setRequestTimeout ) - Q_PROPERTY( bool ignoreSslErrors READ ignoreSslErrors WRITE setIgnoreSslErrors ) - Q_PROPERTY( int error READ error ) - -public: - Interface( QObject *parent = 0 ); - Interface( QNetworkAccessManager *manager, QObject *parent = 0 ); - virtual ~Interface(); - - QNetworkAccessManager* networkAccessManager() const; - void setNetworkAccessManager(QNetworkAccessManager *manager); - - bool ignoreSslErrors() const; - void setIgnoreSslErrors(bool enabled); - - QByteArray consumerKey() const; - void setConsumerKey( const QByteArray &consumerKey ); - - QByteArray consumerSecret() const; - void setConsumerSecret( const QByteArray &consumerSecret ); - - uint requestTimeout() const; - void setRequestTimeout( uint msec ); - - int error() const; - -// bool setRSAPrivateKey( const QString &key, -// const QCA::SecureArray &passphrase = QCA::SecureArray() ); -// bool setRSAPrivateKeyFromFile( const QString &filename, -// const QCA::SecureArray &passphrase = QCA::SecureArray() ); - - - ParamMap requestToken( const QString &requestUrl, HttpMethod httpMethod, - SignatureMethod signatureMethod = HMAC_SHA1, const ParamMap ¶ms = ParamMap() ); - - ParamMap accessToken( const QString &requestUrl, HttpMethod httpMethod, const QByteArray &token, - const QByteArray &tokenSecret, SignatureMethod signatureMethod = HMAC_SHA1, - const ParamMap ¶ms = ParamMap() ); - - QByteArray createParametersString( const QString &requestUrl, HttpMethod httpMethod, - const QByteArray &token, const QByteArray &tokenSecret, - SignatureMethod signatureMethod, const ParamMap ¶ms, ParsingMode mode ); - - QByteArray inlineParameters( const ParamMap ¶ms, ParsingMode mode = ParseForRequestContent ); - - -protected: - InterfacePrivate * const d_ptr; - -private: - Q_DISABLE_COPY(Interface) - Q_DECLARE_PRIVATE(Interface) - Q_PRIVATE_SLOT(d_func(), void _q_parseReply(QNetworkReply *reply)) - Q_PRIVATE_SLOT(d_func(), void _q_setPassphrase(int id, const QCA::Event &event)) - Q_PRIVATE_SLOT(d_func(), void _q_handleSslErrors( QNetworkReply *reply, - const QList<QSslError> &errors )) - -#ifdef UNIT_TEST - friend class Ut_Interface; - friend class Ft_Interface; -#endif -}; - -} // namespace QOAuth - -#endif // INTERFACE_H diff --git a/libmuon/backends/ApplicationBackend/qoauth/src/interface_p.h b/libmuon/backends/ApplicationBackend/qoauth/src/interface_p.h deleted file mode 100644 index e37c171..0000000 --- a/libmuon/backends/ApplicationBackend/qoauth/src/interface_p.h +++ /dev/null @@ -1,127 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2009 by Dominik Kapusta <d@ayoy.net> * - * * - * This library is free software; you can redistribute it and/or modify * - * it under the terms of the GNU Lesser General Public License as * - * published by the Free Software Foundation; either version 2.1 of * - * the License, or (at your option) any later version. * - * * - * 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 * - * Lesser General Public License for more details. * - * * - * You should have received a copy of the GNU Lesser General Public * - * License along with this library; if not, write to * - * the Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ - - -/*! - \file interface_p.h - - This file is a part of libqoauth and is considered strictly internal. You should not - include it in your application. Instead please use <tt>\#include <QtOAuth></tt>. -*/ - -#ifndef QOAUTH_P_H -#define QOAUTH_P_H - -#include "interface.h" -#include <QPointer> -#include <QNetworkAccessManager> -#include <QtCrypto> - -class QNetworkReply; -class QEventLoop; - -namespace QOAuth { - -class Interface; - - -class QOAUTH_EXPORT InterfacePrivate -{ - Q_DECLARE_PUBLIC(Interface) - -public: - enum Operation { - RequestToken, - Authorize, - Authenticate, - AccessToken - }; - - enum KeySource { - KeyFromString, - KeyFromFile - }; - - static const QByteArray OAuthVersion; - static const QByteArray ParamToken; - static const QByteArray ParamTokenSecret; - - static const QByteArray ParamConsumerKey; - static const QByteArray ParamNonce; - static const QByteArray ParamSignature; - static const QByteArray ParamSignatureMethod; - static const QByteArray ParamTimestamp; - static const QByteArray ParamVersion; - - - InterfacePrivate(); - void init(); - void setupNetworkAccessManager(); - - QByteArray httpMethodToString( HttpMethod method ); - QByteArray signatureMethodToString( SignatureMethod method ); - ParamMap replyToMap( const QByteArray &data ); - QByteArray paramsToString( const ParamMap ¶meters, ParsingMode mode ); - - QByteArray createSignature( const QString &requestUrl, HttpMethod httpMethod, - SignatureMethod signatureMethod, const QByteArray &token, - const QByteArray &tokenSecret, ParamMap *params ); - - // for PLAINTEXT only - QByteArray createPlaintextSignature( const QByteArray &tokenSecret ); - - ParamMap sendRequest( const QString &requestUrl, HttpMethod httpMethod, SignatureMethod signatureMethod, - const QByteArray &token, const QByteArray &tokenSecret, const ParamMap ¶ms ); - - // RSA-SHA1 stuff - void setPrivateKey( const QString &source, const QCA::SecureArray &passphrase, KeySource from ); - void readKeyFromLoader( QCA::KeyLoader *keyLoader ); - - bool privateKeySet; - - QCA::Initializer initializer; - QCA::PrivateKey privateKey; - QCA::SecureArray passphrase; - QCA::EventHandler eventHandler; - // end of RSA-SHA1 stuff - - bool ignoreSslErrors; - QByteArray consumerKey; - QByteArray consumerSecret; - - ParamMap replyParams; - - QPointer<QNetworkAccessManager> manager; - QEventLoop *loop; - - uint requestTimeout; - int error; - -protected: - Interface *q_ptr; - -public: - void _q_parseReply( QNetworkReply *reply ); - void _q_setPassphrase( int id, const QCA::Event &event ); - void _q_handleSslErrors( QNetworkReply *reply, const QList<QSslError> &errors ); -}; - -} // namespace QOAuth - -#endif // INTERFACE_P_H diff --git a/libmuon/backends/ApplicationBackend/qoauth/src/qoauth_global.h b/libmuon/backends/ApplicationBackend/qoauth/src/qoauth_global.h deleted file mode 100644 index 66c0d5b..0000000 --- a/libmuon/backends/ApplicationBackend/qoauth/src/qoauth_global.h +++ /dev/null @@ -1,39 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2009 by Dominik Kapusta <d@ayoy.net> * - * * - * This library is free software; you can redistribute it and/or modify * - * it under the terms of the GNU Lesser General Public License as * - * published by the Free Software Foundation; either version 2.1 of * - * the License, or (at your option) any later version. * - * * - * 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 * - * Lesser General Public License for more details. * - * * - * You should have received a copy of the GNU Lesser General Public * - * License along with this library; if not, write to * - * the Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ - - -/*! - \file qoauth_global.h - - This file is a part of libqoauth and is considered strictly internal. You should not - include it in your application. Instead please use <tt>\#include <QtOAuth></tt>. -*/ - -#ifndef QOAUTH_GLOBAL_H -#define QOAUTH_GLOBAL_H - -#include <QtCore/qglobal.h> - -#if defined(QOAUTH) -# define QOAUTH_EXPORT Q_DECL_EXPORT -#else -# define QOAUTH_EXPORT Q_DECL_IMPORT -#endif - -#endif // QOAUTH_GLOBAL_H diff --git a/libmuon/backends/ApplicationBackend/qoauth/src/qoauth_namespace.h b/libmuon/backends/ApplicationBackend/qoauth/src/qoauth_namespace.h deleted file mode 100644 index fb2270b..0000000 --- a/libmuon/backends/ApplicationBackend/qoauth/src/qoauth_namespace.h +++ /dev/null @@ -1,180 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2009 by Dominik Kapusta <d@ayoy.net> * - * * - * This library is free software; you can redistribute it and/or modify * - * it under the terms of the GNU Lesser General Public License as * - * published by the Free Software Foundation; either version 2.1 of * - * the License, or (at your option) any later version. * - * * - * 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 * - * Lesser General Public License for more details. * - * * - * You should have received a copy of the GNU Lesser General Public * - * License along with this library; if not, write to * - * the Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ - - -/*! - \file qoauth_namespace.h - - This file is a part of libqoauth. You should not include it directly in your - application. Instead please use <tt>\#include <QtOAuth></tt>. -*/ - -#ifndef QOAUTH_NAMESPACE_H -#define QOAUTH_NAMESPACE_H - -#include <QMultiMap> -#include <QByteArray> - -#include "qoauth_global.h" - -/*! - \namespace QOAuth - \brief This namespace encapsulates all classes and definitions provided by libqoauth. -*/ -namespace QOAuth { - - /*! - \typedef ParamMap - \brief A typedef for the data structure for storing request parameters - */ - typedef QMultiMap<QByteArray,QByteArray> ParamMap; - - /*! - \enum SignatureMethod - \brief This enum type describes the signature method used by the request. - - There are 3 different signature methods defined by the - <a href=http://oauth.net/core/1.0/#signing_process>OAuth protocol</a>. This enum - is used to specify the method used by a specific request. Hence, one of its values - must be passed as a parameter in any of the \ref QOAuth::Interface::requestToken(), - \ref QOAuth::Interface::accessToken() or \ref QOAuth::Interface::createParametersString() - method. - */ - enum SignatureMethod { - HMAC_SHA1, //!< Sets the signature method to HMAC-SHA1 - RSA_SHA1, //!< Sets the signature method to RSA-SHA1 (not implemented yet) - PLAINTEXT //!< Sets the signature method to PLAINTEXT (not implemented yet) - }; - - /*! - \enum HttpMethod - \brief This enum type specifies the HTTP method used for creating - a <a href=http://oauth.net/core/1.0/#anchor14>Signature Base String</a> - and/or sending a request. - - The HTTP method has to be specified in QOAuth class for two reasons: - \li to know what type of request should be prepared and sent - (\ref QOAuth::Interface::requestToken() and \ref QOAuth::Interface::accessToken()), - \li to prepare a correct signature, as the Signature Base String contains a parameter - specifying the HTTP method used for request (\ref QOAuth::Interface::createParametersString()). - - \note For \ref QOAuth::Interface::requestToken() and \ref QOAuth::Interface::accessToken() methods - only \ref GET and \ref POST methods are allowed. - */ - enum HttpMethod { - GET, //!< Sets the HTTP method to GET - POST, //!< Sets the HTTP method to POST - HEAD, //!< Sets the HTTP method to HEAD - PUT //!< Sets the HTTP method to PUT -#ifndef Q_WS_WIN - , DELETE //!< Sets the HTTP method to DELETE -#endif - }; - - /*! - \enum ParsingMode - \brief This enum type specifies the method of parsing parameters into - a parameter string. - - When creating a parameters string for a custom request using - \ref QOAuth::Interface::createParametersString() the parsing mode must be defined in order - to prepare the string correctly. - - According to what is stated in <a href=http://oauth.net/core/1.0/#consumer_req_param> - OAuth 1.0 Core specification</a>, parameters can be passed in a request to - the Service Provider in 3 different ways. When using \ref QOAuth::Interface::createParametersString(), - choose the one that suits you by setting \a ParsingMode appropriatelly. - - \sa QOAuth::Interface::createParametersString() - */ - enum ParsingMode { - ParseForRequestContent, //!< Inline query format (<tt>foo=bar&bar=baz&baz=foo ...</tt>), suitable for POST requests - ParseForInlineQuery, /*!< Same as ParseForRequestContent, but prepends the string with a question mark - - suitable for GET requests (appending parameters to the request URL) */ - ParseForHeaderArguments, //!< HTTP request header format (parameters to be put inside a request header) - ParseForSignatureBaseString //!< <a href=http://oauth.net/core/1.0/#anchor14>Signature Base String</a> format, meant for internal use. - }; - - /*! - \enum ErrorCode - \brief This enum type defines error types that are assigned to the - \ref QOAuth::Interface::error property - - This error codes collection contains both network-related errors and those that - can occur when incorrect arguments are provided to any of the class's methods. - - \sa QOAuth::Interface::error - */ - enum ErrorCode { - NoError = 200, //!< No error occured (so far :-) ) - BadRequest = 400, //!< Represents HTTP status code \c 400 (Bad Request) - Unauthorized = 401, //!< Represents HTTP status code \c 401 (Unauthorized) - Forbidden = 403, //!< Represents HTTP status code \c 403 (Forbidden) - Timeout = 1001, //!< Represents a request timeout error - ConsumerKeyEmpty, //!< Consumer key has not been provided - ConsumerSecretEmpty, //!< Consumer secret has not been provided - UnsupportedHttpMethod, /*!< The HTTP method is not supported by the request. - \note \ref QOAuth::Interface::requestToken() and - \ref QOAuth::Interface::accessToken() - accept only HTTP GET and POST requests. */ - - RSAPrivateKeyEmpty = 1101, //!< RSA private key has not been provided - // RSAPassphraseError, //!< RSA passphrase is incorrect (or has not been provided) - RSADecodingError, /*!< There was a problem decoding the RSA private key - (the key is invalid or the provided passphrase is incorrect)*/ - RSAKeyFileError, //!< The provided key file either doesn't exist or is unreadable. - OtherError //!< A network-related error not specified above - }; - - - /*! - \brief Returns the supported OAuth protocol version - */ - QOAUTH_EXPORT QByteArray supportedOAuthVersion(); - - /*! - \brief Returns the name of the Access Token argument parameter (<tt>oauth_token</tt> in - current implementation) - - Useful when reading Service Provider's reply for \ref QOAuth::Interface::accessToken() request, e.g: - \code - QOAuth::Interface qoauth; - QByteArray requestToken = "token"; - QByteArray requestTokenSecret = "secret"; - QOAuth::ParamMap reply = qoauth.accessToken( "http://example.com/access_token", QOAuth::POST, - token, tokenSecret, QOAuth::HMAC_SHA1 ); - - if ( qoauth.error() == QOAuth::NoError ) { - token = reply.value( QOAuth::tokenParameterName() ); - tokenSecret = reply.value( QOAuth::tokenSecretParameterName() ); - } - \endcode - */ - QOAUTH_EXPORT QByteArray tokenParameterName(); - - /*! - \brief Returns the name of the Token Secret argument parameter (<tt>oauth_token_secret</tt> in - current implementation) - \sa QOAuth::tokenParameterName() - */ - QOAUTH_EXPORT QByteArray tokenSecretParameterName(); - -} // namespace QOAuth - -#endif // QOAUTH_NAMESPACE_H diff --git a/libmuon/backends/ApplicationBackend/tests/ApplicationBackendTest.cpp b/libmuon/backends/ApplicationBackend/tests/ApplicationBackendTest.cpp deleted file mode 100644 index 6447fc3..0000000 --- a/libmuon/backends/ApplicationBackend/tests/ApplicationBackendTest.cpp +++ /dev/null @@ -1,158 +0,0 @@ -/*************************************************************************** - * Copyright © 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "ApplicationBackendTest.h" -#include <QStringList> -#include <QAction> -#include <QFile> -#include <KProtocolManager> -#include <KActionCollection> -#include <qtest.h> - -#include "modeltest.h" -#include <ApplicationBackend.h> -#include <resources/ResourcesModel.h> -#include <resources/ResourcesProxyModel.h> -#include <resources/AbstractBackendUpdater.h> -#include <Category/Category.h> -#include <Category/CategoryModel.h> -#include <MuonBackendsFactory.h> -#include <KXmlGuiWindow> -#include <QAptActions.h> - -QTEST_MAIN( ApplicationBackendTest ) - -QString getCodename(const QString& value) -{ - QString ret; - QFile f("/etc/os-release"); - if(f.open(QIODevice::ReadOnly|QIODevice::Text)){ - QRegExp rx(QStringLiteral("%1=(.+)\n").arg(value)); - while(!f.atEnd()) { - QByteArray line = f.readLine(); - if(rx.exactMatch(line)) { - ret = rx.cap(1); - break; - } - } - } - return ret; -} - -AbstractResourcesBackend* backendByName(ResourcesModel* m, const QString& name) -{ - QVector<AbstractResourcesBackend*> backends = m->backends(); - foreach(AbstractResourcesBackend* backend, backends) { - if(backend->metaObject()->className()==name) { - return backend; - } - } - return nullptr; -} - -ApplicationBackendTest::ApplicationBackendTest() -{ - QString ratingsDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)+"/libmuon/ratings.txt"; - QFile testRatings("~/.kde-unit-test/share/apps/libmuon/ratings.txt"); - QFile ratings(ratingsDir); - QString codeName = getCodename("ID"); - if(!testRatings.exists()) { - if(ratings.exists()) { - ratings.copy(testRatings.fileName()); - } else { - ratings.close(); - if(codeName.toLower() == QLatin1String("ubuntu")) { - ratingsDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)+"/libmuon/rnrtestratings.txt"; - } else { - ratingsDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)+"/libmuon/popcontestratings.txt"; - } - ratings.setFileName(ratingsDir); - if(ratings.exists()) { - ratings.copy(testRatings.fileName()); - } - } - testRatings.close(); - ratings.close(); - } - ResourcesModel* m = new ResourcesModel("muon-applications-backend", this); - m_window = new KXmlGuiWindow; - m->integrateMainWindow(m_window); - new ModelTest(m,m); - m_appBackend = backendByName(m, "ApplicationBackend"); - QVERIFY(m_appBackend); //TODO: test all backends - QSignalSpy s(m, SIGNAL(allInitialized())); - QVERIFY(s.wait()); -} - -ApplicationBackendTest::~ApplicationBackendTest() -{ - delete m_window; -} - -void ApplicationBackendTest::testReload() -{ - ResourcesModel* model = ResourcesModel::global(); - QVector<AbstractResource*> apps = m_appBackend->allResources(); - QCOMPARE(apps.count(), model->rowCount()); - - QVector<QVariant> appNames(apps.size()); - for(int i=0; i<model->rowCount(); ++i) { - AbstractResource* app = apps[i]; - appNames[i]=app->property("packageName"); - } - - bool b = QMetaObject::invokeMethod(m_appBackend, "reload"); - Q_ASSERT(b); - m_appBackend->updatesCount(); - QCOMPARE(apps, m_appBackend->allResources() ); - - QVERIFY(!apps.isEmpty()); - QCOMPARE(apps.count(), model->rowCount()); - - for(int i=0; i<model->rowCount(); ++i) { - AbstractResource* app = apps[i]; - QCOMPARE(appNames[i], app->property("packageName")); -// QCOMPARE(m_model->data(m_model->index(i), ResourcesModel::NameRole).toString(), app->name()); - } -} - -void ApplicationBackendTest::testCategories() -{ - ResourcesModel* m = ResourcesModel::global(); - ResourcesProxyModel* proxy = new ResourcesProxyModel(m); - proxy->setSourceModel(m); - CategoryModel* categoryModel = new CategoryModel(proxy); - categoryModel->setDisplayedCategory(nullptr); - for(int i=0; i<categoryModel->rowCount(); ++i) { - Category* cat = categoryModel->categoryForRow(i); - proxy->setFiltersFromCategory(cat); - } -} - -void ApplicationBackendTest::testRefreshUpdates() -{ - ResourcesModel* m = ResourcesModel::global(); - - QSignalSpy spy(m, SIGNAL(fetchingChanged())); - QAptActions::self()->actionCollection()->action("update")->trigger(); -// QTest::kWaitForSignal(m, SLOT(fetchingChanged())); - QVERIFY(!m->isFetching()); - qDebug() << spy.count(); -} diff --git a/libmuon/backends/ApplicationBackend/tests/ApplicationBackendTest.h b/libmuon/backends/ApplicationBackend/tests/ApplicationBackendTest.h deleted file mode 100644 index 7267ce2..0000000 --- a/libmuon/backends/ApplicationBackend/tests/ApplicationBackendTest.h +++ /dev/null @@ -1,45 +0,0 @@ -/*************************************************************************** - * Copyright © 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef RESOURCESMODELTEST_H -#define RESOURCESMODELTEST_H - -#include <QtTest/QtTest> - -class KXmlGuiWindow; -class AbstractResourcesBackend; -class ApplicationBackendTest : public QObject -{ - Q_OBJECT - public: - ApplicationBackendTest(); - virtual ~ApplicationBackendTest(); - - private slots: - void testReload(); - void testCategories(); - void testRefreshUpdates(); - - private: - AbstractResourcesBackend* m_appBackend; - KXmlGuiWindow* m_window; -}; - -#endif diff --git a/libmuon/backends/ApplicationBackend/tests/CMakeLists.txt b/libmuon/backends/ApplicationBackend/tests/CMakeLists.txt deleted file mode 100644 index c4e46e2..0000000 --- a/libmuon/backends/ApplicationBackend/tests/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -include_directories(..) - -macro(libmuon_add_unit_test name) - add_executable(${name} modeltest.cpp ${ARGN}) - add_test(${name} ${name}) - ecm_mark_as_test(${name}) - target_link_libraries(${name} - MuonCommon MuonApt - - Qt5::Test Qt5::Core - KF5::KIOWidgets KF5::XmlGui QApt::Main) -endmacro(libmuon_add_unit_test) - -install(FILES rnrtestratings.txt DESTINATION ${DATA_INSTALL_DIR}/libmuon) -install(FILES popcontestratings.txt DESTINATION ${DATA_INSTALL_DIR}/libmuon) - -libmuon_add_unit_test(applicationbackendtest ApplicationBackendTest.cpp) -libmuon_add_unit_test(reviewstest ReviewsTest.cpp) -libmuon_add_unit_test(sourcestest SourcesTest.cpp) diff --git a/libmuon/backends/ApplicationBackend/tests/ReviewsTest.cpp b/libmuon/backends/ApplicationBackend/tests/ReviewsTest.cpp deleted file mode 100644 index 31b6ae5..0000000 --- a/libmuon/backends/ApplicationBackend/tests/ReviewsTest.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/*************************************************************************** - * Copyright © 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "ReviewsTest.h" -#include "modeltest.h" -#include <ReviewsBackend/ReviewsModel.h> -#include <qapt/backend.h> -#include <KProtocolManager> -#include <qtest.h> -#include <ReviewsBackend/AbstractReviewsBackend.h> -#include <MuonBackendsFactory.h> -#include <resources/AbstractResourcesBackend.h> -#include <resources/ResourcesModel.h> -#include <KXmlGuiWindow> -#include <QSignalSpy> - -QTEST_MAIN( ReviewsTest ) - -AbstractResourcesBackend* backendByName(ResourcesModel* m, const QString& name) -{ - QVector<AbstractResourcesBackend*> backends = m->backends(); - foreach(AbstractResourcesBackend* backend, backends) { - if(backend->metaObject()->className()==name) { - return backend; - } - } - return nullptr; -} - -ReviewsTest::ReviewsTest(QObject* parent): QObject(parent) -{ - ResourcesModel* m = new ResourcesModel("muon-applications-backend", this); - m_window = new KXmlGuiWindow; - m->integrateMainWindow(m_window); - m_appBackend = backendByName(m, "ApplicationBackend"); - QVERIFY(QSignalSpy(m, SIGNAL(allInitialized())).wait()); - m_revBackend = m_appBackend->reviewsBackend(); -} - -void ReviewsTest::testReviewsFetch() -{ - if(m_revBackend->isFetching()) - QSignalSpy(m_revBackend, SIGNAL(ratingsReady())).wait(); - QVERIFY(!m_revBackend->isFetching()); -} - -void ReviewsTest::testReviewsModel_data() -{ - QTest::addColumn<QString>( "application" ); - QTest::newRow( "python" ) << "python"; - QTest::newRow( "gedit" ) << "gedit"; -} - -void ReviewsTest::testReviewsModel() -{ - QFETCH(QString, application); - ReviewsModel* model = new ReviewsModel(this); - new ModelTest(model, model); - - AbstractResource* app = m_appBackend->resourceByPackageName(application); - QVERIFY(app); - model->setResource(app); - QSignalSpy(model, SIGNAL(rowsInserted(QModelIndex,int,int))).wait(2000); - - QModelIndex root; - while(model->canFetchMore(root)) { - model->fetchMore(root); - bool arrived = QSignalSpy(model, SIGNAL(rowsInserted(QModelIndex,int,int))).wait(2000); - QCOMPARE(arrived, model->canFetchMore(root)); - } - - delete model; -} diff --git a/libmuon/backends/ApplicationBackend/tests/ReviewsTest.h b/libmuon/backends/ApplicationBackend/tests/ReviewsTest.h deleted file mode 100644 index 6378703..0000000 --- a/libmuon/backends/ApplicationBackend/tests/ReviewsTest.h +++ /dev/null @@ -1,52 +0,0 @@ -/*************************************************************************** - * Copyright © 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef REVIEWSTEST_H -#define REVIEWSTEST_H - -#include <QtCore/QObject> - -class KXmlGuiWindow; -class AbstractResourcesBackend; -class AbstractReviewsBackend; -namespace QApt { -class Backend; -} - -class ReviewsTest : public QObject -{ - Q_OBJECT - public: - explicit ReviewsTest(QObject* parent = 0); - - private slots: - void testReviewsFetch(); - - void testReviewsModel_data(); - void testReviewsModel(); - - private: - AbstractReviewsBackend* m_revBackend; - AbstractResourcesBackend* m_appBackend; - KXmlGuiWindow* m_window; - -}; - -#endif // REVIEWSTEST_H diff --git a/libmuon/backends/ApplicationBackend/tests/SourcesTest.cpp b/libmuon/backends/ApplicationBackend/tests/SourcesTest.cpp deleted file mode 100644 index dbed500..0000000 --- a/libmuon/backends/ApplicationBackend/tests/SourcesTest.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/*************************************************************************** - * Copyright © 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "SourcesTest.h" -#include "modeltest.h" -#include <ReviewsBackend/ReviewsModel.h> -#include <qapt/backend.h> -#include <KProtocolManager> -#include <KXmlGuiWindow> -#include <qtest.h> -#include <ReviewsBackend/AbstractReviewsBackend.h> -#include <MuonBackendsFactory.h> -#include <resources/AbstractResourcesBackend.h> -#include <resources/ResourcesModel.h> -#include <resources/SourcesModel.h> -#include <resources/AbstractSourcesBackend.h> -#include <QSignalSpy> - -QTEST_MAIN( SourcesTest ) - -AbstractResourcesBackend* backendByName(ResourcesModel* m, const QString& name) -{ - QVector<AbstractResourcesBackend*> backends = m->backends(); - foreach(AbstractResourcesBackend* backend, backends) { - if(backend->metaObject()->className()==name) { - return backend; - } - } - return nullptr; -} - -SourcesTest::SourcesTest(QObject* parent): QObject(parent) -{ - ResourcesModel* m = new ResourcesModel("muon-applications-backend", this); - m_window = new KXmlGuiWindow; - m->integrateMainWindow(m_window); - m_appBackend = backendByName(m, "ApplicationBackend"); - QVERIFY(QSignalSpy(m, SIGNAL(allInitialized())).wait()); - - SourcesModel* sources = SourcesModel::global(); - QVERIFY(sources->rowCount() == 1); - QVERIFY(!backend()->name().isEmpty()); -} - -AbstractSourcesBackend* SourcesTest::backend() const -{ - SourcesModel* sources = SourcesModel::global(); - QObject* l = sources->data(sources->index(0), SourcesModel::SourceBackend).value<QObject*>(); - return qobject_cast<AbstractSourcesBackend*>(l); -} - - -void SourcesTest::testSourcesFetch() -{ - QAbstractItemModel* aptSources = backend()->sources(); - - for(int i = 0, c=aptSources->rowCount(); i<c; ++i) { - QVERIFY(aptSources); - QModelIndex idx = aptSources->index(i, 0); - QVERIFY(idx.data(Qt::DisplayRole).toString() != QString()); - } -} - -void SourcesTest::testResourcesMatchSources() -{ - QAbstractItemModel* aptSources = backend()->sources(); - QSet<QString> allSources; - for (int i=0, c=aptSources->rowCount(); i<c; ++i) { - QModelIndex idx = aptSources->index(i, 0); - allSources += idx.data(Qt::DisplayRole).toString(); - } - - ResourcesModel* rmodel = ResourcesModel::global(); - for (int i=0, c=rmodel->rowCount(); i<c; ++i) { - QModelIndex idx = rmodel->index(i, 0); - QString origin = idx.data(ResourcesModel::OriginRole).toString(); - bool found = allSources.contains(origin); - if (!found) { - qDebug() << "couldn't find" << origin << "for" << idx.data(ResourcesModel::NameRole).toString() << "@" << i << "/" << c << "in" << allSources; - QEXPECT_FAIL("", "I need to ask the Kubuntu guys, I don't understand", Continue); - } - QVERIFY(found); - } -} diff --git a/libmuon/backends/ApplicationBackend/tests/SourcesTest.h b/libmuon/backends/ApplicationBackend/tests/SourcesTest.h deleted file mode 100644 index 4d1bff3..0000000 --- a/libmuon/backends/ApplicationBackend/tests/SourcesTest.h +++ /dev/null @@ -1,48 +0,0 @@ -/*************************************************************************** - * Copyright © 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef SOURCESTEST_H -#define SOURCESTEST_H - -#include <QtCore/QObject> - -class KXmlGuiWindow; -class AbstractSourcesBackend; -class AbstractResourcesBackend; - -class SourcesTest : public QObject -{ - Q_OBJECT - public: - explicit SourcesTest(QObject* parent = 0); - - private slots: - void testSourcesFetch(); - void testResourcesMatchSources(); - - private: - AbstractSourcesBackend* backend() const; - - AbstractResourcesBackend* m_appBackend; - KXmlGuiWindow* m_window; - -}; - -#endif // REVIEWSTEST_H diff --git a/libmuon/backends/ApplicationBackend/tests/modeltest.cpp b/libmuon/backends/ApplicationBackend/tests/modeltest.cpp deleted file mode 100644 index a5467f6..0000000 --- a/libmuon/backends/ApplicationBackend/tests/modeltest.cpp +++ /dev/null @@ -1,567 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - - -#include <QtGui> - -#include "modeltest.h" - -#include <QtTest/QtTest> -#include <QVariant> -#undef Q_ASSERT -#define Q_ASSERT QVERIFY - -Q_DECLARE_METATYPE ( QModelIndex ) - -/*! - Connect to all of the models signals. Whenever anything happens recheck everything. -*/ -ModelTest::ModelTest ( QAbstractItemModel *_model, QObject *parent ) : QObject ( parent ), model ( _model ), fetchingMore ( false ) -{ - Q_ASSERT ( model ); - - connect ( model, SIGNAL (columnsAboutToBeInserted(QModelIndex,int,int)), - this, SLOT (runAllTests()) ); - connect ( model, SIGNAL (columnsAboutToBeRemoved(QModelIndex,int,int)), - this, SLOT (runAllTests()) ); - connect ( model, SIGNAL (columnsInserted(QModelIndex,int,int)), - this, SLOT (runAllTests()) ); - connect ( model, SIGNAL (columnsRemoved(QModelIndex,int,int)), - this, SLOT (runAllTests()) ); - connect ( model, SIGNAL (dataChanged(QModelIndex,QModelIndex)), - this, SLOT (runAllTests()) ); - connect ( model, SIGNAL (headerDataChanged(Qt::Orientation,int,int)), - this, SLOT (runAllTests()) ); - connect ( model, SIGNAL (layoutAboutToBeChanged()), this, SLOT (runAllTests()) ); - connect ( model, SIGNAL (layoutChanged()), this, SLOT (runAllTests()) ); - connect ( model, SIGNAL (modelReset()), this, SLOT (runAllTests()) ); - connect ( model, SIGNAL (rowsAboutToBeInserted(QModelIndex,int,int)), - this, SLOT (runAllTests()) ); - connect ( model, SIGNAL (rowsAboutToBeRemoved(QModelIndex,int,int)), - this, SLOT (runAllTests()) ); - connect ( model, SIGNAL (rowsInserted(QModelIndex,int,int)), - this, SLOT (runAllTests()) ); - connect ( model, SIGNAL (rowsRemoved(QModelIndex,int,int)), - this, SLOT (runAllTests()) ); - - // Special checks for inserting/removing - connect ( model, SIGNAL (layoutAboutToBeChanged()), - this, SLOT (layoutAboutToBeChanged()) ); - connect ( model, SIGNAL (layoutChanged()), - this, SLOT (layoutChanged()) ); - - connect ( model, SIGNAL (rowsAboutToBeInserted(QModelIndex,int,int)), - this, SLOT (rowsAboutToBeInserted(QModelIndex,int,int)) ); - connect ( model, SIGNAL (rowsAboutToBeRemoved(QModelIndex,int,int)), - this, SLOT (rowsAboutToBeRemoved(QModelIndex,int,int)) ); - connect ( model, SIGNAL (rowsInserted(QModelIndex,int,int)), - this, SLOT (rowsInserted(QModelIndex,int,int)) ); - connect ( model, SIGNAL (rowsRemoved(QModelIndex,int,int)), - this, SLOT (rowsRemoved(QModelIndex,int,int)) ); - - runAllTests(); -} - -void ModelTest::runAllTests() -{ - if ( fetchingMore ) - return; - nonDestructiveBasicTest(); - rowCount(); - columnCount(); - hasIndex(); - index(); - parent(); - data(); -} - -/*! - nonDestructiveBasicTest tries to call a number of the basic functions (not all) - to make sure the model doesn't outright segfault, testing the functions that makes sense. -*/ -void ModelTest::nonDestructiveBasicTest() -{ - Q_ASSERT ( model->buddy ( QModelIndex() ) == QModelIndex() ); - model->canFetchMore ( QModelIndex() ); - Q_ASSERT ( model->columnCount ( QModelIndex() ) >= 0 ); - Q_ASSERT ( model->data ( QModelIndex() ) == QVariant() ); - fetchingMore = true; - model->fetchMore ( QModelIndex() ); - fetchingMore = false; - Qt::ItemFlags flags = model->flags ( QModelIndex() ); - Q_ASSERT ( flags == Qt::ItemIsDropEnabled || flags == 0 ); - model->hasChildren ( QModelIndex() ); - model->hasIndex ( 0, 0 ); - model->headerData ( 0, Qt::Horizontal ); - model->index ( 0, 0 ); - model->itemData ( QModelIndex() ); - QVariant cache; - model->match ( QModelIndex(), -1, cache ); - model->mimeTypes(); - Q_ASSERT ( model->parent ( QModelIndex() ) == QModelIndex() ); - Q_ASSERT ( model->rowCount() >= 0 ); - QVariant variant; - model->setData ( QModelIndex(), variant, -1 ); - model->setHeaderData ( -1, Qt::Horizontal, QVariant() ); - model->setHeaderData ( 999999, Qt::Horizontal, QVariant() ); - QMap<int, QVariant> roles; - model->sibling ( 0, 0, QModelIndex() ); - model->span ( QModelIndex() ); - model->supportedDropActions(); -} - -/*! - Tests model's implementation of QAbstractItemModel::rowCount() and hasChildren() - - Models that are dynamically populated are not as fully tested here. - */ -void ModelTest::rowCount() -{ -// qDebug() << "rc"; - // check top row - QModelIndex topIndex = model->index ( 0, 0, QModelIndex() ); - int rows = model->rowCount ( topIndex ); - Q_ASSERT ( rows >= 0 ); - if ( rows > 0 ) - Q_ASSERT ( model->hasChildren ( topIndex ) == true ); - - QModelIndex secondLevelIndex = model->index ( 0, 0, topIndex ); - if ( secondLevelIndex.isValid() ) { // not the top level - // check a row count where parent is valid - rows = model->rowCount ( secondLevelIndex ); - Q_ASSERT ( rows >= 0 ); - if ( rows > 0 ) - Q_ASSERT ( model->hasChildren ( secondLevelIndex ) == true ); - } - - // The models rowCount() is tested more extensively in checkChildren(), - // but this catches the big mistakes -} - -/*! - Tests model's implementation of QAbstractItemModel::columnCount() and hasChildren() - */ -void ModelTest::columnCount() -{ - // check top row - QModelIndex topIndex = model->index ( 0, 0, QModelIndex() ); - Q_ASSERT ( model->columnCount ( topIndex ) >= 0 ); - - // check a column count where parent is valid - QModelIndex childIndex = model->index ( 0, 0, topIndex ); - if ( childIndex.isValid() ) - Q_ASSERT ( model->columnCount ( childIndex ) >= 0 ); - - // columnCount() is tested more extensively in checkChildren(), - // but this catches the big mistakes -} - -/*! - Tests model's implementation of QAbstractItemModel::hasIndex() - */ -void ModelTest::hasIndex() -{ -// qDebug() << "hi"; - // Make sure that invalid values returns an invalid index - Q_ASSERT ( model->hasIndex ( -2, -2 ) == false ); - Q_ASSERT ( model->hasIndex ( -2, 0 ) == false ); - Q_ASSERT ( model->hasIndex ( 0, -2 ) == false ); - - int rows = model->rowCount(); - int columns = model->columnCount(); - - // check out of bounds - Q_ASSERT ( model->hasIndex ( rows, columns ) == false ); - Q_ASSERT ( model->hasIndex ( rows + 1, columns + 1 ) == false ); - - if ( rows > 0 ) - Q_ASSERT ( model->hasIndex ( 0, 0 ) == true ); - - // hasIndex() is tested more extensively in checkChildren(), - // but this catches the big mistakes -} - -/*! - Tests model's implementation of QAbstractItemModel::index() - */ -void ModelTest::index() -{ -// qDebug() << "i"; - // Make sure that invalid values returns an invalid index - Q_ASSERT ( model->index ( -2, -2 ) == QModelIndex() ); - Q_ASSERT ( model->index ( -2, 0 ) == QModelIndex() ); - Q_ASSERT ( model->index ( 0, -2 ) == QModelIndex() ); - - int rows = model->rowCount(); - int columns = model->columnCount(); - - if ( rows == 0 ) - return; - - // Catch off by one errors - Q_ASSERT ( model->index ( rows, columns ) == QModelIndex() ); - Q_ASSERT ( model->index ( 0, 0 ).isValid() == true ); - - // Make sure that the same index is *always* returned - QModelIndex a = model->index ( 0, 0 ); - QModelIndex b = model->index ( 0, 0 ); - Q_ASSERT ( a == b ); - - // index() is tested more extensively in checkChildren(), - // but this catches the big mistakes -} - -/*! - Tests model's implementation of QAbstractItemModel::parent() - */ -void ModelTest::parent() -{ -// qDebug() << "p"; - // Make sure the model wont crash and will return an invalid QModelIndex - // when asked for the parent of an invalid index. - Q_ASSERT ( model->parent ( QModelIndex() ) == QModelIndex() ); - - if ( model->rowCount() == 0 ) - return; - - // Column 0 | Column 1 | - // QModelIndex() | | - // \- topIndex | topIndex1 | - // \- childIndex | childIndex1 | - - // Common error test #1, make sure that a top level index has a parent - // that is a invalid QModelIndex. - QModelIndex topIndex = model->index ( 0, 0, QModelIndex() ); - Q_ASSERT ( model->parent ( topIndex ) == QModelIndex() ); - - // Common error test #2, make sure that a second level index has a parent - // that is the first level index. - if ( model->rowCount ( topIndex ) > 0 ) { - QModelIndex childIndex = model->index ( 0, 0, topIndex ); - Q_ASSERT ( model->parent ( childIndex ) == topIndex ); - } - - // Common error test #3, the second column should NOT have the same children - // as the first column in a row. - // Usually the second column shouldn't have children. - QModelIndex topIndex1 = model->index ( 0, 1, QModelIndex() ); - if ( model->rowCount ( topIndex1 ) > 0 ) { - QModelIndex childIndex = model->index ( 0, 0, topIndex ); - QModelIndex childIndex1 = model->index ( 0, 0, topIndex1 ); - Q_ASSERT ( childIndex != childIndex1 ); - } - - // Full test, walk n levels deep through the model making sure that all - // parent's children correctly specify their parent. - checkChildren ( QModelIndex() ); -} - -/*! - Called from the parent() test. - - A model that returns an index of parent X should also return X when asking - for the parent of the index. - - This recursive function does pretty extensive testing on the whole model in an - effort to catch edge cases. - - This function assumes that rowCount(), columnCount() and index() already work. - If they have a bug it will point it out, but the above tests should have already - found the basic bugs because it is easier to figure out the problem in - those tests then this one. - */ -void ModelTest::checkChildren ( const QModelIndex &parent, int currentDepth ) -{ - // First just try walking back up the tree. - QModelIndex p = parent; - while ( p.isValid() ) - p = p.parent(); - - // For models that are dynamically populated - if ( model->canFetchMore ( parent ) ) { - fetchingMore = true; - model->fetchMore ( parent ); - fetchingMore = false; - } - - int rows = model->rowCount ( parent ); - int columns = model->columnCount ( parent ); - - if ( rows > 0 ) - Q_ASSERT ( model->hasChildren ( parent ) ); - - // Some further testing against rows(), columns(), and hasChildren() - Q_ASSERT ( rows >= 0 ); - Q_ASSERT ( columns >= 0 ); - if ( rows > 0 ) - Q_ASSERT ( model->hasChildren ( parent ) == true ); - - //qDebug() << "parent:" << model->data(parent).toString() << "rows:" << rows - // << "columns:" << columns << "parent column:" << parent.column(); - - Q_ASSERT ( model->hasIndex ( rows + 1, 0, parent ) == false ); - for ( int r = 0; r < rows; ++r ) { - if ( model->canFetchMore ( parent ) ) { - fetchingMore = true; - model->fetchMore ( parent ); - fetchingMore = false; - } - Q_ASSERT ( model->hasIndex ( r, columns + 1, parent ) == false ); - for ( int c = 0; c < columns; ++c ) { - Q_ASSERT ( model->hasIndex ( r, c, parent ) == true ); - QModelIndex index = model->index ( r, c, parent ); - // rowCount() and columnCount() said that it existed... - Q_ASSERT ( index.isValid() == true ); - - // index() should always return the same index when called twice in a row - QModelIndex modifiedIndex = model->index ( r, c, parent ); - Q_ASSERT ( index == modifiedIndex ); - - // Make sure we get the same index if we request it twice in a row - QModelIndex a = model->index ( r, c, parent ); - QModelIndex b = model->index ( r, c, parent ); - Q_ASSERT ( a == b ); - - // Some basic checking on the index that is returned - Q_ASSERT ( index.model() == model ); - Q_ASSERT ( index.row() == r ); - Q_ASSERT ( index.column() == c ); - // While you can technically return a QVariant usually this is a sign - // of an bug in data() Disable if this really is ok in your model. -// Q_ASSERT ( model->data ( index, Qt::DisplayRole ).isValid() == true ); - - // If the next test fails here is some somewhat useful debug you play with. - - if (model->parent(index) != parent) { - qDebug() << r << c << currentDepth << model->data(index).toString() - << model->data(parent).toString(); - qDebug() << index << parent << model->parent(index); -// And a view that you can even use to show the model. -// QTreeView view; -// view.setModel(model); -// view.show(); - } - - // Check that we can get back our real parent. -// qDebug() << model->parent ( index ) << parent ; - Q_ASSERT ( model->parent ( index ) == parent ); - - // recursively go down the children - if ( model->hasChildren ( index ) && currentDepth < 10 ) { - //qDebug() << r << c << "has children" << model->rowCount(index); - checkChildren ( index, ++currentDepth ); - }/* else { if (currentDepth >= 10) qDebug() << "checked 10 deep"; };*/ - - // make sure that after testing the children that the index doesn't change. - QModelIndex newerIndex = model->index ( r, c, parent ); - Q_ASSERT ( index == newerIndex ); - } - } -} - -/*! - Tests model's implementation of QAbstractItemModel::data() - */ -void ModelTest::data() -{ - // Invalid index should return an invalid qvariant - Q_ASSERT ( !model->data ( QModelIndex() ).isValid() ); - - if ( model->rowCount() == 0 ) - return; - - // A valid index should have a valid QVariant data - Q_ASSERT ( model->index ( 0, 0 ).isValid() ); - - // shouldn't be able to set data on an invalid index - Q_ASSERT ( model->setData ( QModelIndex(), QLatin1String ( "foo" ), Qt::DisplayRole ) == false ); - - // General Purpose roles that should return a QString - QVariant variant = model->data ( model->index ( 0, 0 ), Qt::ToolTipRole ); - if ( variant.isValid() ) { - Q_ASSERT ( variant.canConvert<QString>() ); - } - variant = model->data ( model->index ( 0, 0 ), Qt::StatusTipRole ); - if ( variant.isValid() ) { - Q_ASSERT ( variant.canConvert<QString>() ); - } - variant = model->data ( model->index ( 0, 0 ), Qt::WhatsThisRole ); - if ( variant.isValid() ) { - Q_ASSERT ( variant.canConvert<QString>() ); - } - - // General Purpose roles that should return a QSize - variant = model->data ( model->index ( 0, 0 ), Qt::SizeHintRole ); - if ( variant.isValid() ) { - Q_ASSERT ( variant.canConvert<QSize>() ); - } - - // General Purpose roles that should return a QFont - QVariant fontVariant = model->data ( model->index ( 0, 0 ), Qt::FontRole ); - if ( fontVariant.isValid() ) { - Q_ASSERT ( fontVariant.canConvert<QFont>() ); - } - - // Check that the alignment is one we know about - QVariant textAlignmentVariant = model->data ( model->index ( 0, 0 ), Qt::TextAlignmentRole ); - if ( textAlignmentVariant.isValid() ) { - int alignment = textAlignmentVariant.toInt(); - Q_ASSERT ( alignment == ( alignment & ( Qt::AlignHorizontal_Mask | Qt::AlignVertical_Mask ) ) ); - } - - // General Purpose roles that should return a QColor - QVariant colorVariant = model->data ( model->index ( 0, 0 ), Qt::BackgroundColorRole ); - if ( colorVariant.isValid() ) { - Q_ASSERT ( colorVariant.canConvert<QColor>() ); - } - - colorVariant = model->data ( model->index ( 0, 0 ), Qt::TextColorRole ); - if ( colorVariant.isValid() ) { - Q_ASSERT ( colorVariant.canConvert<QColor>() ); - } - - // Check that the "check state" is one we know about. - QVariant checkStateVariant = model->data ( model->index ( 0, 0 ), Qt::CheckStateRole ); - if ( checkStateVariant.isValid() ) { - int state = checkStateVariant.toInt(); - Q_ASSERT ( state == Qt::Unchecked || - state == Qt::PartiallyChecked || - state == Qt::Checked ); - } -} - -/*! - Store what is about to be inserted to make sure it actually happens - - \sa rowsInserted() - */ -void ModelTest::rowsAboutToBeInserted ( const QModelIndex &parent, int start, int /*end*/ ) -{ -// Q_UNUSED(end); -// qDebug() << "rowsAboutToBeInserted" << "start=" << start << "end=" << end << "parent=" << model->data ( parent ).toString() -// << "current count of parent=" << model->rowCount ( parent ); // << "display of last=" << model->data( model->index(start-1, 0, parent) ); -// qDebug() << model->index(start-1, 0, parent) << model->data( model->index(start-1, 0, parent) ); - Changing c; - c.parent = parent; - c.oldSize = model->rowCount ( parent ); - c.last = model->data ( model->index ( start - 1, 0, parent ) ); - c.next = model->data ( model->index ( start, 0, parent ) ); - insert.push ( c ); -} - -/*! - Confirm that what was said was going to happen actually did - - \sa rowsAboutToBeInserted() - */ -void ModelTest::rowsInserted ( const QModelIndex & parent, int start, int end ) -{ - Changing c = insert.pop(); - Q_ASSERT ( c.parent == parent ); -// qDebug() << "rowsInserted" << "start=" << start << "end=" << end << "oldsize=" << c.oldSize -// << "parent=" << model->data ( parent ).toString() << "current rowcount of parent=" << model->rowCount ( parent ); - -// for (int ii=start; ii <= end; ii++) -// { -// qDebug() << "itemWasInserted:" << ii << model->data ( model->index ( ii, 0, parent )); -// } -// qDebug(); - - Q_ASSERT ( c.oldSize + ( end - start + 1 ) == model->rowCount ( parent ) ); - Q_ASSERT ( c.last == model->data ( model->index ( start - 1, 0, c.parent ) ) ); - - if (c.next != model->data(model->index(end + 1, 0, c.parent))) { - qDebug() << start << end; - for (int i=0; i < model->rowCount(); ++i) - qDebug() << model->index(i, 0).data().toString(); - qDebug() << c.next << model->data(model->index(end + 1, 0, c.parent)); - } - - Q_ASSERT ( c.next == model->data ( model->index ( end + 1, 0, c.parent ) ) ); -} - -void ModelTest::layoutAboutToBeChanged() -{ - for ( int i = 0; i < qBound ( 0, model->rowCount(), 100 ); ++i ) - changing.append ( QPersistentModelIndex ( model->index ( i, 0 ) ) ); -} - -void ModelTest::layoutChanged() -{ - for ( int i = 0; i < changing.count(); ++i ) { - QPersistentModelIndex p = changing[i]; - Q_ASSERT ( p == model->index ( p.row(), p.column(), p.parent() ) ); - } - changing.clear(); -} - -/*! - Store what is about to be inserted to make sure it actually happens - - \sa rowsRemoved() - */ -void ModelTest::rowsAboutToBeRemoved ( const QModelIndex &parent, int start, int end ) -{ -qDebug() << "ratbr" << parent << start << end; - Changing c; - c.parent = parent; - c.oldSize = model->rowCount ( parent ); - c.last = model->data ( model->index ( start - 1, 0, parent ) ); - c.next = model->data ( model->index ( end + 1, 0, parent ) ); - remove.push ( c ); -} - -/*! - Confirm that what was said was going to happen actually did - - \sa rowsAboutToBeRemoved() - */ -void ModelTest::rowsRemoved ( const QModelIndex & parent, int start, int end ) -{ - qDebug() << "rr" << parent << start << end; - Changing c = remove.pop(); - Q_ASSERT ( c.parent == parent ); - Q_ASSERT ( c.oldSize - ( end - start + 1 ) == model->rowCount ( parent ) ); - Q_ASSERT ( c.last == model->data ( model->index ( start - 1, 0, c.parent ) ) ); - Q_ASSERT ( c.next == model->data ( model->index ( start, 0, c.parent ) ) ); -} - - diff --git a/libmuon/backends/ApplicationBackend/tests/modeltest.h b/libmuon/backends/ApplicationBackend/tests/modeltest.h deleted file mode 100644 index 09b02a3..0000000 --- a/libmuon/backends/ApplicationBackend/tests/modeltest.h +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - - -#ifndef MODELTEST_H -#define MODELTEST_H - -#include <QtCore/QObject> -#include <QtCore/QAbstractItemModel> -#include <QtCore/QStack> - -class ModelTest : public QObject -{ - Q_OBJECT - -public: - ModelTest( QAbstractItemModel *model, QObject *parent = nullptr ); - -private Q_SLOTS: - void nonDestructiveBasicTest(); - void rowCount(); - void columnCount(); - void hasIndex(); - void index(); - void parent(); - void data(); - -protected Q_SLOTS: - void runAllTests(); - void layoutAboutToBeChanged(); - void layoutChanged(); - void rowsAboutToBeInserted( const QModelIndex &parent, int start, int end ); - void rowsInserted( const QModelIndex & parent, int start, int end ); - void rowsAboutToBeRemoved( const QModelIndex &parent, int start, int end ); - void rowsRemoved( const QModelIndex & parent, int start, int end ); - -private: - void checkChildren( const QModelIndex &parent, int currentDepth = 0 ); - - QAbstractItemModel *model; - - struct Changing { - QModelIndex parent; - int oldSize; - QVariant last; - QVariant next; - }; - QStack<Changing> insert; - QStack<Changing> remove; - - bool fetchingMore; - - QList<QPersistentModelIndex> changing; -}; - -#endif diff --git a/libmuon/backends/ApplicationBackend/tests/popcontestratings.txt b/libmuon/backends/ApplicationBackend/tests/popcontestratings.txt Binary files differdeleted file mode 100644 index 4266691..0000000 --- a/libmuon/backends/ApplicationBackend/tests/popcontestratings.txt +++ /dev/null diff --git a/libmuon/backends/ApplicationBackend/tests/rnrtestratings.txt b/libmuon/backends/ApplicationBackend/tests/rnrtestratings.txt deleted file mode 100644 index edddb7a..0000000 --- a/libmuon/backends/ApplicationBackend/tests/rnrtestratings.txt +++ /dev/null @@ -1,6253 +0,0 @@ -[ - { - "ratings_total": 13, - "ratings_average": "3.77", - "app_name": "", - "package_name": "gnome-hearts", - "histogram": "[1, 1, 1, 7, 3]" - }, - { - "ratings_total": 6, - "ratings_average": "5.00", - "app_name": "", - "package_name": "openssh-server", - "histogram": "[0, 0, 0, 0, 6]" - }, - { - "ratings_total": 3, - "ratings_average": "2.33", - "app_name": "", - "package_name": "hdd-ranger", - "histogram": "[1, 1, 0, 1, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "4.00", - "app_name": "", - "package_name": "gnome-sushi-common", - "histogram": "[0, 0, 0, 1, 0]" - }, - { - "ratings_total": 2, - "ratings_average": "4.00", - "app_name": "", - "package_name": "gtalk", - "histogram": "[0, 0, 1, 0, 1]" - }, - { - "ratings_total": 6, - "ratings_average": "3.67", - "app_name": "", - "package_name": "chemtool", - "histogram": "[0, 2, 0, 2, 2]" - }, - { - "ratings_total": 1, - "ratings_average": "4.00", - "app_name": "", - "package_name": "g++-multilib", - "histogram": "[0, 0, 0, 1, 0]" - }, - { - "ratings_total": 0, - "ratings_average": "0.00", - "app_name": "", - "package_name": "comentariosweb", - "histogram": "[0, 0, 0, 0, 0]" - }, - { - "ratings_total": 7, - "ratings_average": "2.43", - "app_name": "", - "package_name": "driftnet", - "histogram": "[3, 1, 1, 1, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "1.00", - "app_name": "", - "package_name": "myminesweeper", - "histogram": "[1, 0, 0, 0, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "4.00", - "app_name": "", - "package_name": "lunar", - "histogram": "[0, 0, 0, 1, 0]" - }, - { - "ratings_total": 2, - "ratings_average": "5.00", - "app_name": "", - "package_name": "vagrant", - "histogram": "[0, 0, 0, 0, 2]" - }, - { - "ratings_total": 9, - "ratings_average": "3.67", - "app_name": "", - "package_name": "xpenguins", - "histogram": "[2, 0, 2, 0, 5]" - }, - { - "ratings_total": 3, - "ratings_average": "3.67", - "app_name": "", - "package_name": "triplane", - "histogram": "[1, 0, 0, 0, 2]" - }, - { - "ratings_total": 89, - "ratings_average": "4.81", - "app_name": "", - "package_name": "bastion", - "histogram": "[2, 0, 2, 5, 80]" - }, - { - "ratings_total": 1, - "ratings_average": "1.00", - "app_name": "", - "package_name": "gdpc", - "histogram": "[1, 0, 0, 0, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "wordnet", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 2, - "ratings_average": "4.00", - "app_name": "", - "package_name": "calligra-data", - "histogram": "[0, 0, 0, 2, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "3.00", - "app_name": "", - "package_name": "nodejs-dev", - "histogram": "[0, 0, 1, 0, 0]" - }, - { - "ratings_total": 10, - "ratings_average": "3.70", - "app_name": "", - "package_name": "ltris", - "histogram": "[0, 3, 1, 2, 4]" - }, - { - "ratings_total": 5, - "ratings_average": "2.40", - "app_name": "", - "package_name": "anonmail", - "histogram": "[3, 0, 0, 1, 1]" - }, - { - "ratings_total": 2, - "ratings_average": "3.00", - "app_name": "", - "package_name": "xabacus", - "histogram": "[1, 0, 0, 0, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "iasl", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 4, - "ratings_average": "3.00", - "app_name": "", - "package_name": "gnome-dictionary", - "histogram": "[1, 1, 0, 1, 1]" - }, - { - "ratings_total": 6, - "ratings_average": "4.00", - "app_name": "", - "package_name": "cont4-contl", - "histogram": "[1, 0, 0, 2, 3]" - }, - { - "ratings_total": 9, - "ratings_average": "2.33", - "app_name": "", - "package_name": "flumotion", - "histogram": "[4, 2, 0, 2, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "1.00", - "app_name": "", - "package_name": "ipod", - "histogram": "[1, 0, 0, 0, 0]" - }, - { - "ratings_total": 5, - "ratings_average": "4.00", - "app_name": "", - "package_name": "eiskaltdcpp-qt", - "histogram": "[1, 0, 0, 1, 3]" - }, - { - "ratings_total": 3, - "ratings_average": "4.33", - "app_name": "", - "package_name": "fdupes", - "histogram": "[0, 0, 0, 2, 1]" - }, - { - "ratings_total": 2, - "ratings_average": "5.00", - "app_name": "", - "package_name": "avahi-discover", - "histogram": "[0, 0, 0, 0, 2]" - }, - { - "ratings_total": 12, - "ratings_average": "3.25", - "app_name": "", - "package_name": "maps", - "histogram": "[1, 2, 4, 3, 2]" - }, - { - "ratings_total": 19, - "ratings_average": "1.16", - "app_name": "", - "package_name": "egoboo", - "histogram": "[17, 1, 1, 0, 0]" - }, - { - "ratings_total": 16, - "ratings_average": "2.12", - "app_name": "", - "package_name": "balazarbrothers", - "histogram": "[5, 7, 2, 1, 1]" - }, - { - "ratings_total": 17, - "ratings_average": "4.59", - "app_name": "", - "package_name": "ttf-aenigma", - "histogram": "[0, 0, 0, 7, 10]" - }, - { - "ratings_total": 1, - "ratings_average": "4.00", - "app_name": "", - "package_name": "page-crunch", - "histogram": "[0, 0, 0, 1, 0]" - }, - { - "ratings_total": 7, - "ratings_average": "3.71", - "app_name": "", - "package_name": "bubbros", - "histogram": "[2, 0, 0, 1, 4]" - }, - { - "ratings_total": 7, - "ratings_average": "4.86", - "app_name": "", - "package_name": "latexdraw", - "histogram": "[0, 0, 0, 1, 6]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "gutenprint-doc", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 3, - "ratings_average": "4.33", - "app_name": "", - "package_name": "gimp-plugin-registry", - "histogram": "[0, 0, 1, 0, 2]" - }, - { - "ratings_total": 32, - "ratings_average": "3.56", - "app_name": "", - "package_name": "stormcloud", - "histogram": "[4, 6, 2, 8, 12]" - }, - { - "ratings_total": 6, - "ratings_average": "5.00", - "app_name": "", - "package_name": "nethogs", - "histogram": "[0, 0, 0, 0, 6]" - }, - { - "ratings_total": 45, - "ratings_average": "4.04", - "app_name": "", - "package_name": "kmymoney", - "histogram": "[4, 4, 2, 11, 24]" - }, - { - "ratings_total": 7, - "ratings_average": "3.71", - "app_name": "", - "package_name": "kodos", - "histogram": "[0, 1, 1, 4, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "qmidiroute", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 11, - "ratings_average": "3.27", - "app_name": "", - "package_name": "dvd95", - "histogram": "[2, 2, 1, 3, 3]" - }, - { - "ratings_total": 1, - "ratings_average": "4.00", - "app_name": "", - "package_name": "nspluginwrapper", - "histogram": "[0, 0, 0, 1, 0]" - }, - { - "ratings_total": 65, - "ratings_average": "4.66", - "app_name": "", - "package_name": "musescore", - "histogram": "[0, 1, 2, 15, 47]" - }, - { - "ratings_total": 25, - "ratings_average": "4.96", - "app_name": "", - "package_name": "git", - "histogram": "[0, 0, 0, 1, 24]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "contrapuntnum1", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 13, - "ratings_average": "4.31", - "app_name": "", - "package_name": "clusterssh", - "histogram": "[0, 2, 0, 3, 8]" - }, - { - "ratings_total": 2, - "ratings_average": "2.50", - "app_name": "", - "package_name": "avahi-ui-utils", - "histogram": "[1, 0, 0, 1, 0]" - }, - { - "ratings_total": 3, - "ratings_average": "3.33", - "app_name": "", - "package_name": "nvclock", - "histogram": "[0, 1, 1, 0, 1]" - }, - { - "ratings_total": 21, - "ratings_average": "4.19", - "app_name": "", - "package_name": "usb-imagewriter", - "histogram": "[2, 1, 0, 6, 12]" - }, - { - "ratings_total": 2, - "ratings_average": "5.00", - "app_name": "", - "package_name": "midisport-firmware", - "histogram": "[0, 0, 0, 0, 2]" - }, - { - "ratings_total": 3, - "ratings_average": "3.67", - "app_name": "", - "package_name": "tribute", - "histogram": "[1, 0, 0, 0, 2]" - }, - { - "ratings_total": 3, - "ratings_average": "4.33", - "app_name": "", - "package_name": "devilspie", - "histogram": "[0, 0, 1, 0, 2]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "partclone", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 13, - "ratings_average": "3.31", - "app_name": "", - "package_name": "prepaid-manager-applet", - "histogram": "[4, 0, 2, 2, 5]" - }, - { - "ratings_total": 7, - "ratings_average": "4.86", - "app_name": "", - "package_name": "chromium-codecs-ffmpeg-extra", - "histogram": "[0, 0, 0, 1, 6]" - }, - { - "ratings_total": 6, - "ratings_average": "4.33", - "app_name": "", - "package_name": "ubuntu-edu-preschool", - "histogram": "[1, 0, 0, 0, 5]" - }, - { - "ratings_total": 106, - "ratings_average": "3.35", - "app_name": "", - "package_name": "epiphany-browser", - "histogram": "[18, 14, 17, 27, 30]" - }, - { - "ratings_total": 2, - "ratings_average": "3.50", - "app_name": "", - "package_name": "gpe-contacts", - "histogram": "[0, 1, 0, 0, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "nfs-kernel-server", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "1.00", - "app_name": "", - "package_name": "debian-installer-launcher", - "histogram": "[1, 0, 0, 0, 0]" - }, - { - "ratings_total": 4, - "ratings_average": "5.00", - "app_name": "", - "package_name": "joe", - "histogram": "[0, 0, 0, 0, 4]" - }, - { - "ratings_total": 4, - "ratings_average": "2.75", - "app_name": "", - "package_name": "fldiff", - "histogram": "[2, 0, 0, 1, 1]" - }, - { - "ratings_total": 48, - "ratings_average": "4.10", - "app_name": "", - "package_name": "gnome-commander", - "histogram": "[4, 2, 4, 13, 25]" - }, - { - "ratings_total": 13, - "ratings_average": "2.77", - "app_name": "", - "package_name": "gnome-font-viewer", - "histogram": "[6, 0, 1, 3, 3]" - }, - { - "ratings_total": 63, - "ratings_average": "4.54", - "app_name": "", - "package_name": "steelstorm-episode2", - "histogram": "[0, 1, 4, 18, 40]" - }, - { - "ratings_total": 4, - "ratings_average": "4.00", - "app_name": "", - "package_name": "gogglesmm", - "histogram": "[0, 1, 0, 1, 2]" - }, - { - "ratings_total": 61, - "ratings_average": "3.84", - "app_name": "", - "package_name": "dvdstyler", - "histogram": "[10, 5, 2, 12, 32]" - }, - { - "ratings_total": 12, - "ratings_average": "2.33", - "app_name": "", - "package_name": "simdock", - "histogram": "[6, 2, 1, 0, 3]" - }, - { - "ratings_total": 3, - "ratings_average": "3.67", - "app_name": "", - "package_name": "kde-runtime", - "histogram": "[0, 1, 0, 1, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "4.00", - "app_name": "", - "package_name": "jockey-common", - "histogram": "[0, 0, 0, 1, 0]" - }, - { - "ratings_total": 2, - "ratings_average": "2.00", - "app_name": "", - "package_name": "qv4l2", - "histogram": "[1, 0, 1, 0, 0]" - }, - { - "ratings_total": 4, - "ratings_average": "3.50", - "app_name": "", - "package_name": "ecryptfs-utils", - "histogram": "[1, 0, 1, 0, 2]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "ktikz", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 3, - "ratings_average": "3.33", - "app_name": "", - "package_name": "pybik", - "histogram": "[1, 0, 0, 1, 1]" - }, - { - "ratings_total": 4, - "ratings_average": "4.75", - "app_name": "", - "package_name": "btresourcesearch", - "histogram": "[0, 0, 0, 1, 3]" - }, - { - "ratings_total": 6, - "ratings_average": "3.33", - "app_name": "", - "package_name": "freedroid", - "histogram": "[1, 0, 2, 2, 1]" - }, - { - "ratings_total": 9, - "ratings_average": "1.11", - "app_name": "", - "package_name": "zhone", - "histogram": "[8, 1, 0, 0, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "2.00", - "app_name": "", - "package_name": "pongaronga", - "histogram": "[0, 1, 0, 0, 0]" - }, - { - "ratings_total": 3, - "ratings_average": "1.00", - "app_name": "", - "package_name": "jaxe", - "histogram": "[3, 0, 0, 0, 0]" - }, - { - "ratings_total": 3, - "ratings_average": "3.33", - "app_name": "", - "package_name": "libreoffice-presentation-minimizer", - "histogram": "[1, 0, 0, 1, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "3.00", - "app_name": "", - "package_name": "nautilus-sendto", - "histogram": "[0, 0, 1, 0, 0]" - }, - { - "ratings_total": 3, - "ratings_average": "3.67", - "app_name": "", - "package_name": "pathogen", - "histogram": "[0, 1, 0, 1, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "4.00", - "app_name": "", - "package_name": "gvb", - "histogram": "[0, 0, 0, 1, 0]" - }, - { - "ratings_total": 4, - "ratings_average": "3.00", - "app_name": "", - "package_name": "bluewho", - "histogram": "[2, 0, 0, 0, 2]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "learnmysqlintamil-ebook", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 2, - "ratings_average": "5.00", - "app_name": "", - "package_name": "cowsay", - "histogram": "[0, 0, 0, 0, 2]" - }, - { - "ratings_total": 4, - "ratings_average": "3.50", - "app_name": "", - "package_name": "korganizer-mobile", - "histogram": "[0, 2, 0, 0, 2]" - }, - { - "ratings_total": 18, - "ratings_average": "4.06", - "app_name": "", - "package_name": "sylpheed", - "histogram": "[2, 0, 1, 7, 8]" - }, - { - "ratings_total": 3, - "ratings_average": "1.33", - "app_name": "", - "package_name": "wavesurfer", - "histogram": "[2, 1, 0, 0, 0]" - }, - { - "ratings_total": 4, - "ratings_average": "4.50", - "app_name": "", - "package_name": "fnfxd", - "histogram": "[0, 0, 1, 0, 3]" - }, - { - "ratings_total": 2, - "ratings_average": "3.00", - "app_name": "", - "package_name": "goattracker", - "histogram": "[0, 1, 0, 1, 0]" - }, - { - "ratings_total": 3, - "ratings_average": "1.00", - "app_name": "", - "package_name": "xvattr", - "histogram": "[3, 0, 0, 0, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "3.00", - "app_name": "", - "package_name": "madwimax", - "histogram": "[0, 0, 1, 0, 0]" - }, - { - "ratings_total": 21, - "ratings_average": "2.52", - "app_name": "", - "package_name": "gtklick", - "histogram": "[11, 1, 1, 3, 5]" - }, - { - "ratings_total": 5, - "ratings_average": "2.60", - "app_name": "", - "package_name": "lyricue", - "histogram": "[1, 2, 1, 0, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "2.00", - "app_name": "", - "package_name": "ndiswrapper-dkms", - "histogram": "[0, 1, 0, 0, 0]" - }, - { - "ratings_total": 2, - "ratings_average": "5.00", - "app_name": "", - "package_name": "libsfml-dev", - "histogram": "[0, 0, 0, 0, 2]" - }, - { - "ratings_total": 1, - "ratings_average": "1.00", - "app_name": "", - "package_name": "xmms2-plugin-flv", - "histogram": "[1, 0, 0, 0, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "linux-shell-01", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 3, - "ratings_average": "2.67", - "app_name": "", - "package_name": "cbrpager", - "histogram": "[1, 0, 1, 1, 0]" - }, - { - "ratings_total": 4, - "ratings_average": "4.75", - "app_name": "", - "package_name": "kde-standard", - "histogram": "[0, 0, 0, 1, 3]" - }, - { - "ratings_total": 9, - "ratings_average": "3.67", - "app_name": "", - "package_name": "bloboats", - "histogram": "[2, 0, 0, 4, 3]" - }, - { - "ratings_total": 18, - "ratings_average": "4.28", - "app_name": "", - "package_name": "ghex", - "histogram": "[1, 0, 1, 7, 9]" - }, - { - "ratings_total": 7, - "ratings_average": "1.86", - "app_name": "", - "package_name": "gnomecatalog", - "histogram": "[4, 0, 3, 0, 0]" - }, - { - "ratings_total": 7, - "ratings_average": "3.14", - "app_name": "", - "package_name": "glom", - "histogram": "[1, 3, 0, 0, 3]" - }, - { - "ratings_total": 22, - "ratings_average": "3.86", - "app_name": "", - "package_name": "fritzing", - "histogram": "[3, 2, 2, 3, 12]" - }, - { - "ratings_total": 10, - "ratings_average": "2.80", - "app_name": "", - "package_name": "libnb-platform12-java", - "histogram": "[5, 0, 1, 0, 4]" - }, - { - "ratings_total": 1, - "ratings_average": "4.00", - "app_name": "", - "package_name": "dash", - "histogram": "[0, 0, 0, 1, 0]" - }, - { - "ratings_total": 6, - "ratings_average": "3.83", - "app_name": "", - "package_name": "kphotoalbum", - "histogram": "[1, 1, 0, 0, 4]" - }, - { - "ratings_total": 3, - "ratings_average": "1.00", - "app_name": "", - "package_name": "recover", - "histogram": "[3, 0, 0, 0, 0]" - }, - { - "ratings_total": 2, - "ratings_average": "4.50", - "app_name": "", - "package_name": "pdfstudio7", - "histogram": "[0, 0, 0, 1, 1]" - }, - { - "ratings_total": 19, - "ratings_average": "3.84", - "app_name": "", - "package_name": "searchmonkey", - "histogram": "[2, 1, 4, 3, 9]" - }, - { - "ratings_total": 2, - "ratings_average": "3.00", - "app_name": "", - "package_name": "telepathy-butterfly", - "histogram": "[1, 0, 0, 0, 1]" - }, - { - "ratings_total": 2, - "ratings_average": "5.00", - "app_name": "", - "package_name": "wesnoth", - "histogram": "[0, 0, 0, 0, 2]" - }, - { - "ratings_total": 51, - "ratings_average": "3.35", - "app_name": "", - "package_name": "alarm-clock", - "histogram": "[8, 10, 6, 10, 17]" - }, - { - "ratings_total": 1, - "ratings_average": "3.00", - "app_name": "", - "package_name": "quark", - "histogram": "[0, 0, 1, 0, 0]" - }, - { - "ratings_total": 6, - "ratings_average": "2.83", - "app_name": "", - "package_name": "gpxviewer", - "histogram": "[1, 2, 1, 1, 1]" - }, - { - "ratings_total": 11, - "ratings_average": "3.36", - "app_name": "", - "package_name": "lxinput", - "histogram": "[2, 2, 1, 2, 4]" - }, - { - "ratings_total": 1, - "ratings_average": "1.00", - "app_name": "", - "package_name": "tuxpaint-config", - "histogram": "[1, 0, 0, 0, 0]" - }, - { - "ratings_total": 7, - "ratings_average": "4.57", - "app_name": "", - "package_name": "menulibre", - "histogram": "[0, 1, 0, 0, 6]" - }, - { - "ratings_total": 2, - "ratings_average": "2.50", - "app_name": "", - "package_name": "zram-config", - "histogram": "[1, 0, 0, 1, 0]" - }, - { - "ratings_total": 73, - "ratings_average": "4.27", - "app_name": "", - "package_name": "flare", - "histogram": "[2, 5, 7, 16, 43]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "kthesaurus", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 2, - "ratings_average": "1.50", - "app_name": "", - "package_name": "telegnome", - "histogram": "[1, 1, 0, 0, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "smtm", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "3.00", - "app_name": "", - "package_name": "beast", - "histogram": "[0, 0, 1, 0, 0]" - }, - { - "ratings_total": 29, - "ratings_average": "2.10", - "app_name": "", - "package_name": "gnome-phone-manager", - "histogram": "[16, 3, 4, 3, 3]" - }, - { - "ratings_total": 3, - "ratings_average": "1.00", - "app_name": "", - "package_name": "miniponga", - "histogram": "[3, 0, 0, 0, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "python3-all", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 117, - "ratings_average": "4.55", - "app_name": "", - "package_name": "gnome-mplayer", - "histogram": "[4, 4, 5, 15, 89]" - }, - { - "ratings_total": 4, - "ratings_average": "3.00", - "app_name": "", - "package_name": "xmille", - "histogram": "[0, 1, 2, 1, 0]" - }, - { - "ratings_total": 10, - "ratings_average": "4.70", - "app_name": "", - "package_name": "shotwell-common", - "histogram": "[0, 0, 0, 3, 7]" - }, - { - "ratings_total": 69, - "ratings_average": "3.83", - "app_name": "", - "package_name": "clipit", - "histogram": "[8, 4, 7, 23, 27]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "glassfish-appserv", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 21, - "ratings_average": "4.24", - "app_name": "", - "package_name": "git-cola", - "histogram": "[0, 2, 0, 10, 9]" - }, - { - "ratings_total": 127, - "ratings_average": "3.85", - "app_name": "", - "package_name": "ubuntuone-control-panel-gtk", - "histogram": "[12, 14, 14, 28, 59]" - }, - { - "ratings_total": 1, - "ratings_average": "4.00", - "app_name": "", - "package_name": "libtiff-tools", - "histogram": "[0, 0, 0, 1, 0]" - }, - { - "ratings_total": 7, - "ratings_average": "4.14", - "app_name": "", - "package_name": "parley", - "histogram": "[0, 1, 1, 1, 4]" - }, - { - "ratings_total": 3, - "ratings_average": "5.00", - "app_name": "", - "package_name": "cron", - "histogram": "[0, 0, 0, 0, 3]" - }, - { - "ratings_total": 18, - "ratings_average": "3.17", - "app_name": "", - "package_name": "gisomount", - "histogram": "[7, 0, 1, 3, 7]" - }, - { - "ratings_total": 2, - "ratings_average": "4.50", - "app_name": "", - "package_name": "tinyca", - "histogram": "[0, 0, 0, 1, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "4.00", - "app_name": "", - "package_name": "pandora", - "histogram": "[0, 0, 0, 1, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "1.00", - "app_name": "", - "package_name": "charmap.app", - "histogram": "[1, 0, 0, 0, 0]" - }, - { - "ratings_total": 4, - "ratings_average": "3.50", - "app_name": "", - "package_name": "ktimer", - "histogram": "[1, 0, 1, 0, 2]" - }, - { - "ratings_total": 15, - "ratings_average": "4.93", - "app_name": "", - "package_name": "octave", - "histogram": "[0, 0, 0, 1, 14]" - }, - { - "ratings_total": 45, - "ratings_average": "3.40", - "app_name": "", - "package_name": "pq", - "histogram": "[11, 5, 4, 5, 20]" - }, - { - "ratings_total": 5, - "ratings_average": "2.60", - "app_name": "", - "package_name": "tictactoe-ng", - "histogram": "[2, 1, 0, 1, 1]" - }, - { - "ratings_total": 3, - "ratings_average": "3.00", - "app_name": "", - "package_name": "xjump", - "histogram": "[0, 1, 1, 1, 0]" - }, - { - "ratings_total": 22, - "ratings_average": "4.05", - "app_name": "", - "package_name": "clamav", - "histogram": "[1, 1, 4, 6, 10]" - }, - { - "ratings_total": 4, - "ratings_average": "3.50", - "app_name": "", - "package_name": "readpst", - "histogram": "[1, 0, 1, 0, 2]" - }, - { - "ratings_total": 102, - "ratings_average": "3.60", - "app_name": "", - "package_name": "sound-juicer", - "histogram": "[15, 16, 11, 13, 47]" - }, - { - "ratings_total": 7, - "ratings_average": "3.71", - "app_name": "", - "package_name": "yahtzeesharp", - "histogram": "[0, 1, 2, 2, 2]" - }, - { - "ratings_total": 1, - "ratings_average": "1.00", - "app_name": "", - "package_name": "defisheye", - "histogram": "[1, 0, 0, 0, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "fullcircle-it-issue-vm", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 12, - "ratings_average": "4.67", - "app_name": "", - "package_name": "hex-a-hop", - "histogram": "[0, 0, 0, 4, 8]" - }, - { - "ratings_total": 6, - "ratings_average": "2.17", - "app_name": "", - "package_name": "helena-the-3rd", - "histogram": "[3, 1, 1, 0, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "4.00", - "app_name": "", - "package_name": "gpe-othello", - "histogram": "[0, 0, 0, 1, 0]" - }, - { - "ratings_total": 4, - "ratings_average": "2.25", - "app_name": "", - "package_name": "pyracerz", - "histogram": "[1, 2, 0, 1, 0]" - }, - { - "ratings_total": 35, - "ratings_average": "3.83", - "app_name": "", - "package_name": "pdfchain", - "histogram": "[3, 3, 3, 14, 12]" - }, - { - "ratings_total": 2, - "ratings_average": "1.00", - "app_name": "", - "package_name": "lacheck", - "histogram": "[2, 0, 0, 0, 0]" - }, - { - "ratings_total": 9, - "ratings_average": "1.22", - "app_name": "", - "package_name": "notification-daemon", - "histogram": "[7, 2, 0, 0, 0]" - }, - { - "ratings_total": 3, - "ratings_average": "4.67", - "app_name": "", - "package_name": "new-orbit", - "histogram": "[0, 0, 0, 1, 2]" - }, - { - "ratings_total": 1, - "ratings_average": "1.00", - "app_name": "", - "package_name": "lirc", - "histogram": "[1, 0, 0, 0, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "2.00", - "app_name": "", - "package_name": "splatform", - "histogram": "[0, 1, 0, 0, 0]" - }, - { - "ratings_total": 9, - "ratings_average": "3.00", - "app_name": "", - "package_name": "keepnote", - "histogram": "[4, 0, 0, 2, 3]" - }, - { - "ratings_total": 2, - "ratings_average": "5.00", - "app_name": "", - "package_name": "packeth", - "histogram": "[0, 0, 0, 0, 2]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "xcowsay", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 13, - "ratings_average": "4.31", - "app_name": "", - "package_name": "nicotine", - "histogram": "[1, 0, 0, 5, 7]" - }, - { - "ratings_total": 7, - "ratings_average": "2.71", - "app_name": "", - "package_name": "nagstamon", - "histogram": "[3, 1, 0, 1, 2]" - }, - { - "ratings_total": 0, - "ratings_average": "0.00", - "app_name": "", - "package_name": "color-by-numbers-flowers", - "histogram": "[0, 0, 0, 0, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "xipmsg", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "3.00", - "app_name": "", - "package_name": "pod2pdf", - "histogram": "[0, 0, 1, 0, 0]" - }, - { - "ratings_total": 2, - "ratings_average": "4.50", - "app_name": "", - "package_name": "barrydesktop", - "histogram": "[0, 0, 0, 1, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "2.00", - "app_name": "", - "package_name": "gngb", - "histogram": "[0, 1, 0, 0, 0]" - }, - { - "ratings_total": 3, - "ratings_average": "5.00", - "app_name": "", - "package_name": "grabc", - "histogram": "[0, 0, 0, 0, 3]" - }, - { - "ratings_total": 5, - "ratings_average": "3.40", - "app_name": "", - "package_name": "im-switch", - "histogram": "[0, 1, 2, 1, 1]" - }, - { - "ratings_total": 3, - "ratings_average": "1.33", - "app_name": "", - "package_name": "topfeed", - "histogram": "[2, 1, 0, 0, 0]" - }, - { - "ratings_total": 4, - "ratings_average": "4.00", - "app_name": "", - "package_name": "xfce4-panel", - "histogram": "[1, 0, 0, 0, 3]" - }, - { - "ratings_total": 2, - "ratings_average": "4.00", - "app_name": "", - "package_name": "adobe-flash-properties-kde", - "histogram": "[0, 0, 1, 0, 1]" - }, - { - "ratings_total": 20, - "ratings_average": "3.25", - "app_name": "", - "package_name": "autokey-gtk", - "histogram": "[4, 4, 2, 3, 7]" - }, - { - "ratings_total": 2, - "ratings_average": "5.00", - "app_name": "", - "package_name": "alpine", - "histogram": "[0, 0, 0, 0, 2]" - }, - { - "ratings_total": 2, - "ratings_average": "5.00", - "app_name": "", - "package_name": "libgtest-dev", - "histogram": "[0, 0, 0, 0, 2]" - }, - { - "ratings_total": 6, - "ratings_average": "1.83", - "app_name": "", - "package_name": "wsjt", - "histogram": "[4, 0, 1, 1, 0]" - }, - { - "ratings_total": 4, - "ratings_average": "4.00", - "app_name": "", - "package_name": "asterisk", - "histogram": "[1, 0, 0, 0, 3]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "fullcircle-issue-70", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "myspell-ru", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 2, - "ratings_average": "2.50", - "app_name": "", - "package_name": "wiimap", - "histogram": "[1, 0, 0, 1, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "mp3splt", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 2, - "ratings_average": "3.00", - "app_name": "", - "package_name": "bash-completion", - "histogram": "[1, 0, 0, 0, 1]" - }, - { - "ratings_total": 4, - "ratings_average": "2.75", - "app_name": "", - "package_name": "pdfcrack", - "histogram": "[2, 0, 0, 1, 1]" - }, - { - "ratings_total": 7, - "ratings_average": "1.00", - "app_name": "", - "package_name": "volumecontrol.app", - "histogram": "[7, 0, 0, 0, 0]" - }, - { - "ratings_total": 6, - "ratings_average": "4.00", - "app_name": "", - "package_name": "qrencode", - "histogram": "[1, 0, 0, 2, 3]" - }, - { - "ratings_total": 8, - "ratings_average": "3.75", - "app_name": "", - "package_name": "muine", - "histogram": "[0, 1, 3, 1, 3]" - }, - { - "ratings_total": 9, - "ratings_average": "4.89", - "app_name": "", - "package_name": "kvirc", - "histogram": "[0, 0, 0, 1, 8]" - }, - { - "ratings_total": 1, - "ratings_average": "1.00", - "app_name": "", - "package_name": "gnome-themes-ubuntu", - "histogram": "[1, 0, 0, 0, 0]" - }, - { - "ratings_total": 19, - "ratings_average": "3.47", - "app_name": "", - "package_name": "yelp", - "histogram": "[3, 2, 3, 5, 6]" - }, - { - "ratings_total": 4, - "ratings_average": "3.00", - "app_name": "", - "package_name": "gargoyle-free", - "histogram": "[2, 0, 0, 0, 2]" - }, - { - "ratings_total": 12, - "ratings_average": "4.83", - "app_name": "", - "package_name": "ipython", - "histogram": "[0, 0, 0, 2, 10]" - }, - { - "ratings_total": 25, - "ratings_average": "4.20", - "app_name": "", - "package_name": "gnome-schedule", - "histogram": "[2, 1, 0, 9, 13]" - }, - { - "ratings_total": 3, - "ratings_average": "5.00", - "app_name": "", - "package_name": "units", - "histogram": "[0, 0, 0, 0, 3]" - }, - { - "ratings_total": 85, - "ratings_average": "4.65", - "app_name": "", - "package_name": "xchat", - "histogram": "[1, 0, 4, 18, 62]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "snmp", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 24, - "ratings_average": "4.42", - "app_name": "", - "package_name": "electricsheep", - "histogram": "[2, 1, 1, 1, 19]" - }, - { - "ratings_total": 3, - "ratings_average": "5.00", - "app_name": "", - "package_name": "idle", - "histogram": "[0, 0, 0, 0, 3]" - }, - { - "ratings_total": 102, - "ratings_average": "2.94", - "app_name": "", - "package_name": "gnome-gmail", - "histogram": "[34, 14, 10, 12, 32]" - }, - { - "ratings_total": 2, - "ratings_average": "3.50", - "app_name": "", - "package_name": "xawtv", - "histogram": "[0, 1, 0, 0, 1]" - }, - { - "ratings_total": 16, - "ratings_average": "4.25", - "app_name": "", - "package_name": "konsole", - "histogram": "[1, 0, 2, 4, 9]" - }, - { - "ratings_total": 2, - "ratings_average": "4.50", - "app_name": "", - "package_name": "perroquet", - "histogram": "[0, 0, 0, 1, 1]" - }, - { - "ratings_total": 20, - "ratings_average": "3.65", - "app_name": "", - "package_name": "scratch", - "histogram": "[4, 2, 0, 5, 9]" - }, - { - "ratings_total": 2, - "ratings_average": "1.00", - "app_name": "", - "package_name": "unity-webapps-amazoncloudreader", - "histogram": "[2, 0, 0, 0, 0]" - }, - { - "ratings_total": 114, - "ratings_average": "4.12", - "app_name": "", - "package_name": "pithos", - "histogram": "[15, 6, 3, 16, 74]" - }, - { - "ratings_total": 3, - "ratings_average": "2.33", - "app_name": "", - "package_name": "alsa-tools-gui", - "histogram": "[2, 0, 0, 0, 1]" - }, - { - "ratings_total": 2, - "ratings_average": "4.50", - "app_name": "", - "package_name": "rsnapshot", - "histogram": "[0, 0, 0, 1, 1]" - }, - { - "ratings_total": 7, - "ratings_average": "4.86", - "app_name": "", - "package_name": "emacs24", - "histogram": "[0, 0, 0, 1, 6]" - }, - { - "ratings_total": 19, - "ratings_average": "2.63", - "app_name": "", - "package_name": "stopmotion", - "histogram": "[7, 2, 4, 3, 3]" - }, - { - "ratings_total": 3, - "ratings_average": "2.33", - "app_name": "", - "package_name": "printer-driver-c2esp", - "histogram": "[2, 0, 0, 0, 1]" - }, - { - "ratings_total": 30, - "ratings_average": "3.87", - "app_name": "", - "package_name": "vym", - "histogram": "[2, 3, 3, 11, 11]" - }, - { - "ratings_total": 1, - "ratings_average": "4.00", - "app_name": "", - "package_name": "lunar-applet", - "histogram": "[0, 0, 0, 1, 0]" - }, - { - "ratings_total": 22, - "ratings_average": "4.82", - "app_name": "", - "package_name": "verbiste-gnome", - "histogram": "[0, 0, 1, 2, 19]" - }, - { - "ratings_total": 16, - "ratings_average": "4.56", - "app_name": "", - "package_name": "gnome-specimen", - "histogram": "[0, 1, 1, 2, 12]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "aft", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 2, - "ratings_average": "3.00", - "app_name": "", - "package_name": "nagios3", - "histogram": "[1, 0, 0, 0, 1]" - }, - { - "ratings_total": 15, - "ratings_average": "3.20", - "app_name": "", - "package_name": "bzflag", - "histogram": "[5, 2, 0, 1, 7]" - }, - { - "ratings_total": 3, - "ratings_average": "3.67", - "app_name": "", - "package_name": "iesabel", - "histogram": "[0, 1, 0, 1, 1]" - }, - { - "ratings_total": 30, - "ratings_average": "1.33", - "app_name": "", - "package_name": "slimrat", - "histogram": "[25, 2, 2, 0, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "4.00", - "app_name": "", - "package_name": "wine1.3-gecko", - "histogram": "[0, 0, 0, 1, 0]" - }, - { - "ratings_total": 2, - "ratings_average": "3.00", - "app_name": "", - "package_name": "spacezero", - "histogram": "[0, 1, 0, 1, 0]" - }, - { - "ratings_total": 14, - "ratings_average": "4.64", - "app_name": "", - "package_name": "blockout2", - "histogram": "[0, 0, 0, 5, 9]" - }, - { - "ratings_total": 3, - "ratings_average": "5.00", - "app_name": "", - "package_name": "cmake-qt-gui", - "histogram": "[0, 0, 0, 0, 3]" - }, - { - "ratings_total": 1, - "ratings_average": "4.00", - "app_name": "", - "package_name": "cherokee", - "histogram": "[0, 0, 0, 1, 0]" - }, - { - "ratings_total": 5, - "ratings_average": "4.80", - "app_name": "", - "package_name": "aptitude", - "histogram": "[0, 0, 0, 1, 4]" - }, - { - "ratings_total": 2, - "ratings_average": "2.50", - "app_name": "", - "package_name": "freqtweak", - "histogram": "[1, 0, 0, 1, 0]" - }, - { - "ratings_total": 3, - "ratings_average": "4.33", - "app_name": "", - "package_name": "wordpress", - "histogram": "[0, 0, 0, 2, 1]" - }, - { - "ratings_total": 2, - "ratings_average": "4.50", - "app_name": "", - "package_name": "gcc-mingw32", - "histogram": "[0, 0, 0, 1, 1]" - }, - { - "ratings_total": 17, - "ratings_average": "4.41", - "app_name": "", - "package_name": "scantailor", - "histogram": "[1, 1, 0, 3, 12]" - }, - { - "ratings_total": 52, - "ratings_average": "4.21", - "app_name": "", - "package_name": "ogmrip", - "histogram": "[4, 3, 4, 8, 33]" - }, - { - "ratings_total": 5, - "ratings_average": "3.20", - "app_name": "", - "package_name": "thinkfan", - "histogram": "[2, 0, 0, 1, 2]" - }, - { - "ratings_total": 1, - "ratings_average": "4.00", - "app_name": "", - "package_name": "libavformat-extra-52", - "histogram": "[0, 0, 0, 1, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "mapivi", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 8, - "ratings_average": "2.38", - "app_name": "", - "package_name": "gnome-documents", - "histogram": "[1, 3, 4, 0, 0]" - }, - { - "ratings_total": 122, - "ratings_average": "4.37", - "app_name": "", - "package_name": "libreoffice", - "histogram": "[5, 3, 8, 32, 74]" - }, - { - "ratings_total": 44, - "ratings_average": "4.43", - "app_name": "", - "package_name": "preload", - "histogram": "[2, 3, 1, 6, 32]" - }, - { - "ratings_total": 1, - "ratings_average": "1.00", - "app_name": "", - "package_name": "qjackrcd", - "histogram": "[1, 0, 0, 0, 0]" - }, - { - "ratings_total": 12, - "ratings_average": "2.58", - "app_name": "", - "package_name": "nautilus-clamscan", - "histogram": "[6, 1, 0, 2, 3]" - }, - { - "ratings_total": 1, - "ratings_average": "4.00", - "app_name": "", - "package_name": "ubuntu-practical-guide", - "histogram": "[0, 0, 0, 1, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "gkdebconf", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 587, - "ratings_average": "3.64", - "app_name": "", - "package_name": "rhythmbox", - "histogram": "[95, 54, 76, 105, 257]" - }, - { - "ratings_total": 2, - "ratings_average": "4.50", - "app_name": "", - "package_name": "apocalypze", - "histogram": "[0, 0, 0, 1, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "toshset", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 8, - "ratings_average": "4.88", - "app_name": "", - "package_name": "puzzle-moppet", - "histogram": "[0, 0, 0, 1, 7]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "xfce4-notes-plugin", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "1.00", - "app_name": "", - "package_name": "kmail-mobile", - "histogram": "[1, 0, 0, 0, 0]" - }, - { - "ratings_total": 31, - "ratings_average": "4.13", - "app_name": "", - "package_name": "swordandsworcery", - "histogram": "[1, 2, 5, 7, 16]" - }, - { - "ratings_total": 32, - "ratings_average": "2.00", - "app_name": "", - "package_name": "pacman", - "histogram": "[14, 9, 5, 3, 1]" - }, - { - "ratings_total": 2, - "ratings_average": "5.00", - "app_name": "", - "package_name": "openrocket", - "histogram": "[0, 0, 0, 0, 2]" - }, - { - "ratings_total": 1, - "ratings_average": "3.00", - "app_name": "", - "package_name": "honeyd", - "histogram": "[0, 0, 1, 0, 0]" - }, - { - "ratings_total": 6, - "ratings_average": "3.83", - "app_name": "", - "package_name": "harpia", - "histogram": "[1, 0, 0, 3, 2]" - }, - { - "ratings_total": 5, - "ratings_average": "3.40", - "app_name": "", - "package_name": "nautilus-script-collection-svn", - "histogram": "[1, 0, 1, 2, 1]" - }, - { - "ratings_total": 3, - "ratings_average": "1.00", - "app_name": "", - "package_name": "ragz", - "histogram": "[3, 0, 0, 0, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "ifuse", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 0, - "ratings_average": "0.00", - "app_name": "", - "package_name": "alleyoop", - "histogram": "[0, 0, 0, 0, 0]" - }, - { - "ratings_total": 9, - "ratings_average": "5.00", - "app_name": "", - "package_name": "gimp-resynthesizer", - "histogram": "[0, 0, 0, 0, 9]" - }, - { - "ratings_total": 1, - "ratings_average": "2.00", - "app_name": "", - "package_name": "lxdm", - "histogram": "[0, 1, 0, 0, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "4.00", - "app_name": "", - "package_name": "net-tools", - "histogram": "[0, 0, 0, 1, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "4.00", - "app_name": "", - "package_name": "pavumeter", - "histogram": "[0, 0, 0, 1, 0]" - }, - { - "ratings_total": 11, - "ratings_average": "2.55", - "app_name": "", - "package_name": "gnome-control-center", - "histogram": "[4, 3, 1, 0, 3]" - }, - { - "ratings_total": 2, - "ratings_average": "5.00", - "app_name": "", - "package_name": "jalali-calendar", - "histogram": "[0, 0, 0, 0, 2]" - }, - { - "ratings_total": 3, - "ratings_average": "5.00", - "app_name": "", - "package_name": "gedit-developer-plugins", - "histogram": "[0, 0, 0, 0, 3]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "md5deep", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "2.00", - "app_name": "", - "package_name": "lcrt", - "histogram": "[0, 1, 0, 0, 0]" - }, - { - "ratings_total": 3, - "ratings_average": "3.33", - "app_name": "", - "package_name": "scndgen", - "histogram": "[0, 1, 0, 2, 0]" - }, - { - "ratings_total": 18, - "ratings_average": "2.89", - "app_name": "", - "package_name": "outreel", - "histogram": "[8, 1, 1, 1, 7]" - }, - { - "ratings_total": 186, - "ratings_average": "4.08", - "app_name": "", - "package_name": "pinta", - "histogram": "[13, 12, 17, 49, 95]" - }, - { - "ratings_total": 35, - "ratings_average": "2.37", - "app_name": "", - "package_name": "ristretto", - "histogram": "[14, 9, 2, 5, 5]" - }, - { - "ratings_total": 5, - "ratings_average": "4.60", - "app_name": "", - "package_name": "libreoffice-presenter-console", - "histogram": "[0, 0, 0, 2, 3]" - }, - { - "ratings_total": 9, - "ratings_average": "5.00", - "app_name": "", - "package_name": "basex", - "histogram": "[0, 0, 0, 0, 9]" - }, - { - "ratings_total": 2, - "ratings_average": "2.50", - "app_name": "", - "package_name": "fairmat-academic", - "histogram": "[1, 0, 0, 1, 0]" - }, - { - "ratings_total": 6, - "ratings_average": "3.50", - "app_name": "", - "package_name": "angrydd", - "histogram": "[1, 1, 1, 0, 3]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "primer-generator", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 105, - "ratings_average": "4.25", - "app_name": "", - "package_name": "guvcview", - "histogram": "[11, 3, 3, 20, 68]" - }, - { - "ratings_total": 3, - "ratings_average": "5.00", - "app_name": "", - "package_name": "tkabber", - "histogram": "[0, 0, 0, 0, 3]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "cairo-dock-plug-ins-data", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "hercules", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 2, - "ratings_average": "5.00", - "app_name": "", - "package_name": "whois", - "histogram": "[0, 0, 0, 0, 2]" - }, - { - "ratings_total": 3, - "ratings_average": "5.00", - "app_name": "", - "package_name": "lskat", - "histogram": "[0, 0, 0, 0, 3]" - }, - { - "ratings_total": 1, - "ratings_average": "4.00", - "app_name": "", - "package_name": "viewvc", - "histogram": "[0, 0, 0, 1, 0]" - }, - { - "ratings_total": 2, - "ratings_average": "5.00", - "app_name": "", - "package_name": "zynjacku", - "histogram": "[0, 0, 0, 0, 2]" - }, - { - "ratings_total": 1, - "ratings_average": "4.00", - "app_name": "", - "package_name": "exifprobe", - "histogram": "[0, 0, 0, 1, 0]" - }, - { - "ratings_total": 11, - "ratings_average": "4.82", - "app_name": "", - "package_name": "osmos", - "histogram": "[0, 0, 0, 2, 9]" - }, - { - "ratings_total": 1, - "ratings_average": "1.00", - "app_name": "", - "package_name": "comgt", - "histogram": "[1, 0, 0, 0, 0]" - }, - { - "ratings_total": 4, - "ratings_average": "4.00", - "app_name": "", - "package_name": "transmission-qt", - "histogram": "[0, 0, 1, 2, 1]" - }, - { - "ratings_total": 9, - "ratings_average": "3.89", - "app_name": "", - "package_name": "hasciicam", - "histogram": "[1, 0, 1, 4, 3]" - }, - { - "ratings_total": 38, - "ratings_average": "4.45", - "app_name": "", - "package_name": "scite", - "histogram": "[0, 3, 4, 4, 27]" - }, - { - "ratings_total": 0, - "ratings_average": "0.00", - "app_name": "", - "package_name": "ubuntu-user-gy-issue-201101", - "histogram": "[0, 0, 0, 0, 0]" - }, - { - "ratings_total": 10, - "ratings_average": "2.60", - "app_name": "", - "package_name": "gnome-breakout", - "histogram": "[4, 0, 3, 2, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "xgraph", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 4, - "ratings_average": "2.75", - "app_name": "", - "package_name": "entangle", - "histogram": "[2, 0, 0, 1, 1]" - }, - { - "ratings_total": 5, - "ratings_average": "4.60", - "app_name": "", - "package_name": "glmark2", - "histogram": "[0, 0, 0, 2, 3]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "kde-l10n-fa", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 34, - "ratings_average": "4.50", - "app_name": "", - "package_name": "clamz", - "histogram": "[4, 0, 0, 1, 29]" - }, - { - "ratings_total": 3, - "ratings_average": "3.67", - "app_name": "", - "package_name": "unity-lens-photos", - "histogram": "[1, 0, 0, 0, 2]" - }, - { - "ratings_total": 2, - "ratings_average": "3.00", - "app_name": "", - "package_name": "cream", - "histogram": "[1, 0, 0, 0, 1]" - }, - { - "ratings_total": 37, - "ratings_average": "3.41", - "app_name": "", - "package_name": "rapidsvn", - "histogram": "[8, 5, 3, 6, 15]" - }, - { - "ratings_total": 12, - "ratings_average": "4.75", - "app_name": "", - "package_name": "kmahjongg", - "histogram": "[0, 0, 1, 1, 10]" - }, - { - "ratings_total": 1, - "ratings_average": "1.00", - "app_name": "", - "package_name": "gerstensaft", - "histogram": "[1, 0, 0, 0, 0]" - }, - { - "ratings_total": 3, - "ratings_average": "4.67", - "app_name": "", - "package_name": "ngspice", - "histogram": "[0, 0, 0, 1, 2]" - }, - { - "ratings_total": 1, - "ratings_average": "1.00", - "app_name": "", - "package_name": "transitionsdj", - "histogram": "[1, 0, 0, 0, 0]" - }, - { - "ratings_total": 6, - "ratings_average": "3.67", - "app_name": "", - "package_name": "overgod", - "histogram": "[1, 1, 0, 1, 3]" - }, - { - "ratings_total": 11, - "ratings_average": "3.36", - "app_name": "", - "package_name": "pyneighborhood", - "histogram": "[4, 0, 0, 2, 5]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "dmraid", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 9, - "ratings_average": "3.11", - "app_name": "", - "package_name": "a7xpg", - "histogram": "[3, 0, 2, 1, 3]" - }, - { - "ratings_total": 2, - "ratings_average": "3.50", - "app_name": "", - "package_name": "forceline", - "histogram": "[0, 1, 0, 0, 1]" - }, - { - "ratings_total": 130, - "ratings_average": "4.54", - "app_name": "", - "package_name": "guayadeque", - "histogram": "[5, 2, 7, 20, 96]" - }, - { - "ratings_total": 4, - "ratings_average": "3.75", - "app_name": "", - "package_name": "reinteract", - "histogram": "[1, 0, 0, 1, 2]" - }, - { - "ratings_total": 3, - "ratings_average": "2.00", - "app_name": "", - "package_name": "worker", - "histogram": "[2, 0, 0, 1, 0]" - }, - { - "ratings_total": 2, - "ratings_average": "5.00", - "app_name": "", - "package_name": "xsel", - "histogram": "[0, 0, 0, 0, 2]" - }, - { - "ratings_total": 2, - "ratings_average": "4.00", - "app_name": "", - "package_name": "memtester", - "histogram": "[0, 0, 1, 0, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "1.00", - "app_name": "", - "package_name": "gnome-panel-bonobo", - "histogram": "[1, 0, 0, 0, 0]" - }, - { - "ratings_total": 6, - "ratings_average": "3.33", - "app_name": "", - "package_name": "qgo", - "histogram": "[1, 0, 3, 0, 2]" - }, - { - "ratings_total": 2, - "ratings_average": "2.50", - "app_name": "", - "package_name": "openerp6.1-full", - "histogram": "[1, 0, 0, 1, 0]" - }, - { - "ratings_total": 11, - "ratings_average": "2.45", - "app_name": "", - "package_name": "kexi", - "histogram": "[5, 1, 2, 1, 2]" - }, - { - "ratings_total": 1, - "ratings_average": "4.00", - "app_name": "", - "package_name": "proftpd-basic", - "histogram": "[0, 0, 0, 1, 0]" - }, - { - "ratings_total": 2, - "ratings_average": "2.50", - "app_name": "", - "package_name": "timemachine", - "histogram": "[1, 0, 0, 1, 0]" - }, - { - "ratings_total": 4, - "ratings_average": "4.25", - "app_name": "", - "package_name": "rkhunter", - "histogram": "[0, 0, 1, 1, 2]" - }, - { - "ratings_total": 2, - "ratings_average": "3.00", - "app_name": "", - "package_name": "bittornado-gui", - "histogram": "[1, 0, 0, 0, 1]" - }, - { - "ratings_total": 6, - "ratings_average": "4.67", - "app_name": "", - "package_name": "lunar-commander", - "histogram": "[0, 0, 1, 0, 5]" - }, - { - "ratings_total": 32, - "ratings_average": "1.69", - "app_name": "", - "package_name": "qlix", - "histogram": "[25, 1, 0, 3, 3]" - }, - { - "ratings_total": 2, - "ratings_average": "1.00", - "app_name": "", - "package_name": "knotes-mobile", - "histogram": "[2, 0, 0, 0, 0]" - }, - { - "ratings_total": 3, - "ratings_average": "4.67", - "app_name": "", - "package_name": "wkhtmltopdf", - "histogram": "[0, 0, 0, 1, 2]" - }, - { - "ratings_total": 5, - "ratings_average": "1.60", - "app_name": "", - "package_name": "indicator-file-explorer", - "histogram": "[4, 0, 0, 1, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "mcabber", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "mellowmeadowslite", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 4, - "ratings_average": "2.75", - "app_name": "", - "package_name": "evolution-rss", - "histogram": "[0, 2, 1, 1, 0]" - }, - { - "ratings_total": 13, - "ratings_average": "4.23", - "app_name": "", - "package_name": "spirits", - "histogram": "[0, 1, 1, 5, 6]" - }, - { - "ratings_total": 1, - "ratings_average": "1.00", - "app_name": "", - "package_name": "mpdcon.app", - "histogram": "[1, 0, 0, 0, 0]" - }, - { - "ratings_total": 2, - "ratings_average": "5.00", - "app_name": "", - "package_name": "ns2", - "histogram": "[0, 0, 0, 0, 2]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "drush", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 2, - "ratings_average": "1.50", - "app_name": "", - "package_name": "gazpacho", - "histogram": "[1, 1, 0, 0, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "otf-yozvox-yozfont", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 2, - "ratings_average": "3.00", - "app_name": "", - "package_name": "handbrake-gtk", - "histogram": "[1, 0, 0, 0, 1]" - }, - { - "ratings_total": 5, - "ratings_average": "5.00", - "app_name": "", - "package_name": "aria2", - "histogram": "[0, 0, 0, 0, 5]" - }, - { - "ratings_total": 13, - "ratings_average": "5.00", - "app_name": "", - "package_name": "ia32-libs", - "histogram": "[0, 0, 0, 0, 13]" - }, - { - "ratings_total": 1, - "ratings_average": "1.00", - "app_name": "", - "package_name": "system-config-audit", - "histogram": "[1, 0, 0, 0, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "1.00", - "app_name": "", - "package_name": "cobra", - "histogram": "[1, 0, 0, 0, 0]" - }, - { - "ratings_total": 3, - "ratings_average": "3.67", - "app_name": "", - "package_name": "usb-modeswitch", - "histogram": "[1, 0, 0, 0, 2]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "xcompmgr", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 15, - "ratings_average": "1.80", - "app_name": "", - "package_name": "pornview", - "histogram": "[8, 5, 0, 1, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "4.00", - "app_name": "", - "package_name": "kanyremote", - "histogram": "[0, 0, 0, 1, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "4.00", - "app_name": "", - "package_name": "elisa", - "histogram": "[0, 0, 0, 1, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "1.00", - "app_name": "", - "package_name": "sysprof", - "histogram": "[1, 0, 0, 0, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "3.00", - "app_name": "", - "package_name": "mango-lassi", - "histogram": "[0, 0, 1, 0, 0]" - }, - { - "ratings_total": 2, - "ratings_average": "5.00", - "app_name": "", - "package_name": "context", - "histogram": "[0, 0, 0, 0, 2]" - }, - { - "ratings_total": 3, - "ratings_average": "5.00", - "app_name": "", - "package_name": "kcachegrind", - "histogram": "[0, 0, 0, 0, 3]" - }, - { - "ratings_total": 8, - "ratings_average": "3.12", - "app_name": "", - "package_name": "cowbell", - "histogram": "[2, 1, 2, 0, 3]" - }, - { - "ratings_total": 4, - "ratings_average": "4.50", - "app_name": "", - "package_name": "vmware-view-client", - "histogram": "[0, 0, 0, 2, 2]" - }, - { - "ratings_total": 2, - "ratings_average": "3.00", - "app_name": "", - "package_name": "ninepinbowling", - "histogram": "[1, 0, 0, 0, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "1.00", - "app_name": "", - "package_name": "buzztard", - "histogram": "[1, 0, 0, 0, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "3.00", - "app_name": "", - "package_name": "xconq", - "histogram": "[0, 0, 1, 0, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "1.00", - "app_name": "", - "package_name": "sword-language-pack-el", - "histogram": "[1, 0, 0, 0, 0]" - }, - { - "ratings_total": 39, - "ratings_average": "4.41", - "app_name": "", - "package_name": "gnome-subtitles", - "histogram": "[1, 2, 2, 9, 25]" - }, - { - "ratings_total": 1, - "ratings_average": "1.00", - "app_name": "", - "package_name": "freeaccount", - "histogram": "[1, 0, 0, 0, 0]" - }, - { - "ratings_total": 2, - "ratings_average": "3.00", - "app_name": "", - "package_name": "kayali", - "histogram": "[1, 0, 0, 0, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "1.00", - "app_name": "", - "package_name": "sugar-sliderpuzzle-activity", - "histogram": "[1, 0, 0, 0, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "gtkdiskfree", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 21, - "ratings_average": "3.67", - "app_name": "", - "package_name": "kamerka", - "histogram": "[3, 2, 2, 6, 8]" - }, - { - "ratings_total": 30, - "ratings_average": "3.63", - "app_name": "", - "package_name": "f-spot", - "histogram": "[4, 5, 2, 6, 13]" - }, - { - "ratings_total": 6, - "ratings_average": "4.33", - "app_name": "", - "package_name": "mutt", - "histogram": "[1, 0, 0, 0, 5]" - }, - { - "ratings_total": 17, - "ratings_average": "4.12", - "app_name": "", - "package_name": "bino", - "histogram": "[2, 1, 1, 2, 11]" - }, - { - "ratings_total": 1, - "ratings_average": "4.00", - "app_name": "", - "package_name": "source-highlight", - "histogram": "[0, 0, 0, 1, 0]" - }, - { - "ratings_total": 0, - "ratings_average": "0.00", - "app_name": "", - "package_name": "zqcert", - "histogram": "[0, 0, 0, 0, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "4.00", - "app_name": "", - "package_name": "libfaac0", - "histogram": "[0, 0, 0, 1, 0]" - }, - { - "ratings_total": 44, - "ratings_average": "4.66", - "app_name": "", - "package_name": "kid3-qt", - "histogram": "[2, 1, 1, 2, 38]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "gjacktransport", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 4, - "ratings_average": "1.00", - "app_name": "", - "package_name": "gtwitter", - "histogram": "[4, 0, 0, 0, 0]" - }, - { - "ratings_total": 3, - "ratings_average": "1.00", - "app_name": "", - "package_name": "treeviewx", - "histogram": "[3, 0, 0, 0, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "4.00", - "app_name": "", - "package_name": "qw-the-game", - "histogram": "[0, 0, 0, 1, 0]" - }, - { - "ratings_total": 6, - "ratings_average": "3.17", - "app_name": "", - "package_name": "njam", - "histogram": "[1, 2, 0, 1, 2]" - }, - { - "ratings_total": 4, - "ratings_average": "3.00", - "app_name": "", - "package_name": "yabause-qt", - "histogram": "[1, 1, 0, 1, 1]" - }, - { - "ratings_total": 5, - "ratings_average": "4.80", - "app_name": "", - "package_name": "lynx", - "histogram": "[0, 0, 0, 1, 4]" - }, - { - "ratings_total": 3, - "ratings_average": "4.67", - "app_name": "", - "package_name": "flamerobin", - "histogram": "[0, 0, 0, 1, 2]" - }, - { - "ratings_total": 4, - "ratings_average": "2.00", - "app_name": "", - "package_name": "filecrypter", - "histogram": "[3, 0, 0, 0, 1]" - }, - { - "ratings_total": 0, - "ratings_average": "0.00", - "app_name": "", - "package_name": "r-cran-foreign", - "histogram": "[0, 0, 0, 0, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "abrowser", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "2.00", - "app_name": "", - "package_name": "openarena-data", - "histogram": "[0, 1, 0, 0, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "php5-mysqlnd", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 34, - "ratings_average": "4.94", - "app_name": "", - "package_name": "vim", - "histogram": "[0, 0, 0, 2, 32]" - }, - { - "ratings_total": 2, - "ratings_average": "4.00", - "app_name": "", - "package_name": "mtr", - "histogram": "[0, 0, 1, 0, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "4.00", - "app_name": "", - "package_name": "tilp2", - "histogram": "[0, 0, 0, 1, 0]" - }, - { - "ratings_total": 119, - "ratings_average": "4.33", - "app_name": "", - "package_name": "assaultcube", - "histogram": "[3, 3, 13, 33, 67]" - }, - { - "ratings_total": 38, - "ratings_average": "4.50", - "app_name": "", - "package_name": "marble", - "histogram": "[1, 2, 1, 7, 27]" - }, - { - "ratings_total": 2, - "ratings_average": "3.00", - "app_name": "", - "package_name": "crazyblox", - "histogram": "[0, 1, 0, 1, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "1.00", - "app_name": "", - "package_name": "zekr-quran-translations-en", - "histogram": "[1, 0, 0, 0, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "man-db", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 2, - "ratings_average": "4.00", - "app_name": "", - "package_name": "maitreya", - "histogram": "[0, 0, 0, 2, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "3.00", - "app_name": "", - "package_name": "simplyhtml", - "histogram": "[0, 0, 1, 0, 0]" - }, - { - "ratings_total": 3, - "ratings_average": "5.00", - "app_name": "", - "package_name": "fonts-liberation", - "histogram": "[0, 0, 0, 0, 3]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "caca-utils", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "bc", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "banshee-extension-alarm", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "bochs", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "4.00", - "app_name": "", - "package_name": "plymouth-theme-edubuntu", - "histogram": "[0, 0, 0, 1, 0]" - }, - { - "ratings_total": 2, - "ratings_average": "5.00", - "app_name": "", - "package_name": "clisp", - "histogram": "[0, 0, 0, 0, 2]" - }, - { - "ratings_total": 1, - "ratings_average": "1.00", - "app_name": "", - "package_name": "libgmp3-dev", - "histogram": "[1, 0, 0, 0, 0]" - }, - { - "ratings_total": 4, - "ratings_average": "4.00", - "app_name": "", - "package_name": "seamonkey", - "histogram": "[1, 0, 0, 0, 3]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "vlc-data", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 2, - "ratings_average": "4.00", - "app_name": "", - "package_name": "netcat", - "histogram": "[0, 0, 0, 2, 0]" - }, - { - "ratings_total": 8, - "ratings_average": "4.50", - "app_name": "", - "package_name": "seq24", - "histogram": "[1, 0, 0, 0, 7]" - }, - { - "ratings_total": 2, - "ratings_average": "4.00", - "app_name": "", - "package_name": "light-themes", - "histogram": "[0, 0, 0, 2, 0]" - }, - { - "ratings_total": 5, - "ratings_average": "2.40", - "app_name": "", - "package_name": "alsamixergui", - "histogram": "[2, 1, 0, 2, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "1.00", - "app_name": "", - "package_name": "tfdocgen", - "histogram": "[1, 0, 0, 0, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "1.00", - "app_name": "", - "package_name": "viewmol", - "histogram": "[1, 0, 0, 0, 0]" - }, - { - "ratings_total": 2, - "ratings_average": "5.00", - "app_name": "", - "package_name": "thegravedigger-demo", - "histogram": "[0, 0, 0, 0, 2]" - }, - { - "ratings_total": 3, - "ratings_average": "3.67", - "app_name": "", - "package_name": "texlive-xetex", - "histogram": "[1, 0, 0, 0, 2]" - }, - { - "ratings_total": 21, - "ratings_average": "4.62", - "app_name": "", - "package_name": "minitunes", - "histogram": "[0, 0, 1, 6, 14]" - }, - { - "ratings_total": 16, - "ratings_average": "2.06", - "app_name": "", - "package_name": "kshutdown", - "histogram": "[10, 1, 1, 2, 2]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "poppler-data", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 3, - "ratings_average": "3.00", - "app_name": "", - "package_name": "clamav-freshclam", - "histogram": "[1, 0, 0, 2, 0]" - }, - { - "ratings_total": 5, - "ratings_average": "4.00", - "app_name": "", - "package_name": "python-matplotlib", - "histogram": "[0, 0, 2, 1, 2]" - }, - { - "ratings_total": 2, - "ratings_average": "5.00", - "app_name": "", - "package_name": "libsdl1.2-dev", - "histogram": "[0, 0, 0, 0, 2]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "dirdiff", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "1.00", - "app_name": "", - "package_name": "sixpack", - "histogram": "[1, 0, 0, 0, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "goplay", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 6, - "ratings_average": "4.50", - "app_name": "", - "package_name": "xfig", - "histogram": "[0, 0, 0, 3, 3]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "libsdl-gfx1.2-dev", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "1.00", - "app_name": "", - "package_name": "pygmy", - "histogram": "[1, 0, 0, 0, 0]" - }, - { - "ratings_total": 2, - "ratings_average": "3.00", - "app_name": "", - "package_name": "gobby-0.5", - "histogram": "[1, 0, 0, 0, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "3.00", - "app_name": "", - "package_name": "gtablix", - "histogram": "[0, 0, 1, 0, 0]" - }, - { - "ratings_total": 11, - "ratings_average": "1.64", - "app_name": "", - "package_name": "asoundconf-gtk", - "histogram": "[9, 0, 0, 1, 1]" - }, - { - "ratings_total": 3, - "ratings_average": "4.67", - "app_name": "", - "package_name": "kiki-the-nano-bot", - "histogram": "[0, 0, 0, 1, 2]" - }, - { - "ratings_total": 12, - "ratings_average": "4.58", - "app_name": "", - "package_name": "pioneers", - "histogram": "[0, 0, 1, 3, 8]" - }, - { - "ratings_total": 2, - "ratings_average": "4.50", - "app_name": "", - "package_name": "ksystemlog", - "histogram": "[0, 0, 0, 1, 1]" - }, - { - "ratings_total": 13, - "ratings_average": "4.08", - "app_name": "", - "package_name": "dosemu", - "histogram": "[2, 0, 1, 2, 8]" - }, - { - "ratings_total": 11, - "ratings_average": "3.27", - "app_name": "", - "package_name": "gworldclock", - "histogram": "[1, 1, 4, 4, 1]" - }, - { - "ratings_total": 15, - "ratings_average": "2.40", - "app_name": "", - "package_name": "sacred-gold", - "histogram": "[7, 1, 2, 4, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "1.00", - "app_name": "", - "package_name": "kmenuedit", - "histogram": "[1, 0, 0, 0, 0]" - }, - { - "ratings_total": 3, - "ratings_average": "3.00", - "app_name": "", - "package_name": "kmousetool", - "histogram": "[1, 0, 1, 0, 1]" - }, - { - "ratings_total": 18, - "ratings_average": "3.78", - "app_name": "", - "package_name": "freedoom", - "histogram": "[3, 2, 0, 4, 9]" - }, - { - "ratings_total": 5, - "ratings_average": "5.00", - "app_name": "", - "package_name": "fonts-droid", - "histogram": "[0, 0, 0, 0, 5]" - }, - { - "ratings_total": 1, - "ratings_average": "1.00", - "app_name": "", - "package_name": "webcamd", - "histogram": "[1, 0, 0, 0, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "incron", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 3, - "ratings_average": "1.67", - "app_name": "", - "package_name": "musickeys", - "histogram": "[2, 0, 1, 0, 0]" - }, - { - "ratings_total": 3, - "ratings_average": "4.67", - "app_name": "", - "package_name": "fonts-hosny-thabit", - "histogram": "[0, 0, 0, 1, 2]" - }, - { - "ratings_total": 2, - "ratings_average": "5.00", - "app_name": "", - "package_name": "redis-server", - "histogram": "[0, 0, 0, 0, 2]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "language-pack-gnome-ug-base", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 2, - "ratings_average": "5.00", - "app_name": "", - "package_name": "cclive", - "histogram": "[0, 0, 0, 0, 2]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "rinse", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 3, - "ratings_average": "5.00", - "app_name": "", - "package_name": "ninvaders", - "histogram": "[0, 0, 0, 0, 3]" - }, - { - "ratings_total": 1, - "ratings_average": "1.00", - "app_name": "", - "package_name": "arcad3d-c1", - "histogram": "[1, 0, 0, 0, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "python3-pip", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "2.00", - "app_name": "", - "package_name": "ibam", - "histogram": "[0, 1, 0, 0, 0]" - }, - { - "ratings_total": 22, - "ratings_average": "4.14", - "app_name": "", - "package_name": "arandr", - "histogram": "[2, 2, 2, 1, 15]" - }, - { - "ratings_total": 8, - "ratings_average": "4.50", - "app_name": "", - "package_name": "openlp", - "histogram": "[0, 0, 1, 2, 5]" - }, - { - "ratings_total": 3, - "ratings_average": "2.33", - "app_name": "", - "package_name": "terminatorx", - "histogram": "[2, 0, 0, 0, 1]" - }, - { - "ratings_total": 2, - "ratings_average": "5.00", - "app_name": "", - "package_name": "graphviz", - "histogram": "[0, 0, 0, 0, 2]" - }, - { - "ratings_total": 7, - "ratings_average": "2.71", - "app_name": "", - "package_name": "framingham", - "histogram": "[4, 0, 0, 0, 3]" - }, - { - "ratings_total": 47, - "ratings_average": "3.26", - "app_name": "", - "package_name": "plexmediaserver", - "histogram": "[12, 4, 8, 6, 17]" - }, - { - "ratings_total": 9, - "ratings_average": "3.44", - "app_name": "", - "package_name": "bkchem", - "histogram": "[3, 0, 0, 2, 4]" - }, - { - "ratings_total": 1, - "ratings_average": "4.00", - "app_name": "", - "package_name": "xdm", - "histogram": "[0, 0, 0, 1, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "4.00", - "app_name": "", - "package_name": "python-gdata", - "histogram": "[0, 0, 0, 1, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "4.00", - "app_name": "", - "package_name": "pcsc-tools", - "histogram": "[0, 0, 0, 1, 0]" - }, - { - "ratings_total": 33, - "ratings_average": "3.67", - "app_name": "", - "package_name": "qutim", - "histogram": "[5, 3, 5, 5, 15]" - }, - { - "ratings_total": 2, - "ratings_average": "4.50", - "app_name": "", - "package_name": "openssl", - "histogram": "[0, 0, 0, 1, 1]" - }, - { - "ratings_total": 12, - "ratings_average": "4.33", - "app_name": "", - "package_name": "mangler", - "histogram": "[1, 1, 0, 1, 9]" - }, - { - "ratings_total": 3, - "ratings_average": "4.00", - "app_name": "", - "package_name": "uair", - "histogram": "[0, 1, 0, 0, 2]" - }, - { - "ratings_total": 1, - "ratings_average": "1.00", - "app_name": "", - "package_name": "organ-trail", - "histogram": "[1, 0, 0, 0, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "2.00", - "app_name": "", - "package_name": "unity-scope-dribbble", - "histogram": "[0, 1, 0, 0, 0]" - }, - { - "ratings_total": 6, - "ratings_average": "3.33", - "app_name": "", - "package_name": "mm3", - "histogram": "[1, 1, 0, 3, 1]" - }, - { - "ratings_total": 5, - "ratings_average": "3.40", - "app_name": "", - "package_name": "tasks", - "histogram": "[1, 1, 0, 1, 2]" - }, - { - "ratings_total": 1, - "ratings_average": "4.00", - "app_name": "", - "package_name": "greed", - "histogram": "[0, 0, 0, 1, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "e2fsprogs", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "1.00", - "app_name": "", - "package_name": "dyndns", - "histogram": "[1, 0, 0, 0, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "lubuntu-restricted-addons", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "2.00", - "app_name": "", - "package_name": "banshee-extension-magnatune", - "histogram": "[0, 1, 0, 0, 0]" - }, - { - "ratings_total": 5, - "ratings_average": "4.00", - "app_name": "", - "package_name": "gdevilspie", - "histogram": "[1, 0, 0, 1, 3]" - }, - { - "ratings_total": 4, - "ratings_average": "5.00", - "app_name": "", - "package_name": "pentobi", - "histogram": "[0, 0, 0, 0, 4]" - }, - { - "ratings_total": 4, - "ratings_average": "4.25", - "app_name": "", - "package_name": "terminal.app", - "histogram": "[0, 0, 0, 3, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "dx", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 3, - "ratings_average": "3.00", - "app_name": "", - "package_name": "ebumeter", - "histogram": "[1, 0, 0, 2, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "4.00", - "app_name": "", - "package_name": "gtkballs", - "histogram": "[0, 0, 0, 1, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "sshuttle", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "3.00", - "app_name": "", - "package_name": "breakout", - "histogram": "[0, 0, 1, 0, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "python-unity-singlet", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "ltp", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "ttf-kacst", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "1.00", - "app_name": "", - "package_name": "miro-data", - "histogram": "[1, 0, 0, 0, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "rootstock-gtk", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 69, - "ratings_average": "3.14", - "app_name": "", - "package_name": "flightgear", - "histogram": "[19, 8, 9, 10, 23]" - }, - { - "ratings_total": 2, - "ratings_average": "3.50", - "app_name": "", - "package_name": "gvfs-backends", - "histogram": "[0, 1, 0, 0, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "language-pack-zh-hans-base", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "1.00", - "app_name": "", - "package_name": "brother-cups-wrapper-mfc9420cn", - "histogram": "[1, 0, 0, 0, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "autodock", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 4, - "ratings_average": "4.00", - "app_name": "", - "package_name": "gksu", - "histogram": "[1, 0, 0, 0, 3]" - }, - { - "ratings_total": 1, - "ratings_average": "4.00", - "app_name": "", - "package_name": "theorur", - "histogram": "[0, 0, 0, 1, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "4.00", - "app_name": "", - "package_name": "streamer", - "histogram": "[0, 0, 0, 1, 0]" - }, - { - "ratings_total": 7, - "ratings_average": "2.14", - "app_name": "", - "package_name": "screenie-qt", - "histogram": "[5, 0, 0, 0, 2]" - }, - { - "ratings_total": 1, - "ratings_average": "2.00", - "app_name": "", - "package_name": "karts-1000", - "histogram": "[0, 1, 0, 0, 0]" - }, - { - "ratings_total": 2, - "ratings_average": "1.00", - "app_name": "", - "package_name": "gpsdrive", - "histogram": "[2, 0, 0, 0, 0]" - }, - { - "ratings_total": 5, - "ratings_average": "3.20", - "app_name": "", - "package_name": "gwc", - "histogram": "[2, 0, 0, 1, 2]" - }, - { - "ratings_total": 7, - "ratings_average": "3.29", - "app_name": "", - "package_name": "terminal-tng", - "histogram": "[1, 1, 2, 1, 2]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "p3nfs", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 5, - "ratings_average": "4.20", - "app_name": "", - "package_name": "openbox", - "histogram": "[1, 0, 0, 0, 4]" - }, - { - "ratings_total": 14, - "ratings_average": "4.79", - "app_name": "", - "package_name": "tellico", - "histogram": "[0, 0, 1, 1, 12]" - }, - { - "ratings_total": 2, - "ratings_average": "5.00", - "app_name": "", - "package_name": "tomboy-latex", - "histogram": "[0, 0, 0, 0, 2]" - }, - { - "ratings_total": 1, - "ratings_average": "4.00", - "app_name": "", - "package_name": "qrfcview", - "histogram": "[0, 0, 0, 1, 0]" - }, - { - "ratings_total": 3, - "ratings_average": "3.67", - "app_name": "", - "package_name": "tcpdump", - "histogram": "[1, 0, 0, 0, 2]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "linkchecker", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "linux-image-generic-pae", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 2, - "ratings_average": "5.00", - "app_name": "", - "package_name": "xfce4-goodies", - "histogram": "[0, 0, 0, 0, 2]" - }, - { - "ratings_total": 2, - "ratings_average": "5.00", - "app_name": "", - "package_name": "daa2iso", - "histogram": "[0, 0, 0, 0, 2]" - }, - { - "ratings_total": 2, - "ratings_average": "5.00", - "app_name": "", - "package_name": "fullcircle-issue-56", - "histogram": "[0, 0, 0, 0, 2]" - }, - { - "ratings_total": 2, - "ratings_average": "1.00", - "app_name": "", - "package_name": "nuapplet", - "histogram": "[2, 0, 0, 0, 0]" - }, - { - "ratings_total": 2, - "ratings_average": "3.00", - "app_name": "", - "package_name": "vlc-plugin-pulse", - "histogram": "[1, 0, 0, 0, 1]" - }, - { - "ratings_total": 5, - "ratings_average": "4.20", - "app_name": "", - "package_name": "fcitx-googlepinyin", - "histogram": "[1, 0, 0, 0, 4]" - }, - { - "ratings_total": 24, - "ratings_average": "1.71", - "app_name": "", - "package_name": "resapplet", - "histogram": "[16, 2, 4, 1, 1]" - }, - { - "ratings_total": 2, - "ratings_average": "5.00", - "app_name": "", - "package_name": "shiki-colors", - "histogram": "[0, 0, 0, 0, 2]" - }, - { - "ratings_total": 1, - "ratings_average": "4.00", - "app_name": "", - "package_name": "gpppon", - "histogram": "[0, 0, 0, 1, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "libopenscenegraph-dev", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "4.00", - "app_name": "", - "package_name": "xfonts-100dpi", - "histogram": "[0, 0, 0, 1, 0]" - }, - { - "ratings_total": 5, - "ratings_average": "4.20", - "app_name": "", - "package_name": "corebreach", - "histogram": "[0, 0, 1, 2, 2]" - }, - { - "ratings_total": 1, - "ratings_average": "1.00", - "app_name": "", - "package_name": "pskmail", - "histogram": "[1, 0, 0, 0, 0]" - }, - { - "ratings_total": 24, - "ratings_average": "4.25", - "app_name": "", - "package_name": "dia", - "histogram": "[1, 0, 2, 10, 11]" - }, - { - "ratings_total": 2, - "ratings_average": "4.50", - "app_name": "", - "package_name": "ibus-pinyin", - "histogram": "[0, 0, 0, 1, 1]" - }, - { - "ratings_total": 197, - "ratings_average": "3.94", - "app_name": "", - "package_name": "simple-scan", - "histogram": "[25, 11, 18, 39, 104]" - }, - { - "ratings_total": 2, - "ratings_average": "2.00", - "app_name": "", - "package_name": "libapache2-modsecurity", - "histogram": "[1, 0, 1, 0, 0]" - }, - { - "ratings_total": 12, - "ratings_average": "2.50", - "app_name": "", - "package_name": "rutilt", - "histogram": "[5, 2, 1, 2, 2]" - }, - { - "ratings_total": 27, - "ratings_average": "3.11", - "app_name": "", - "package_name": "wifi-radar", - "histogram": "[9, 2, 3, 3, 10]" - }, - { - "ratings_total": 1, - "ratings_average": "4.00", - "app_name": "", - "package_name": "sonic", - "histogram": "[0, 0, 0, 1, 0]" - }, - { - "ratings_total": 2, - "ratings_average": "5.00", - "app_name": "", - "package_name": "revista-espirito-livre-1", - "histogram": "[0, 0, 0, 0, 2]" - }, - { - "ratings_total": 35, - "ratings_average": "4.06", - "app_name": "", - "package_name": "gtkorphan", - "histogram": "[5, 0, 3, 7, 20]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "coccinelle", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "gsl-bin", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 7, - "ratings_average": "4.00", - "app_name": "", - "package_name": "numix-gtk3-dark-theme", - "histogram": "[0, 0, 2, 3, 2]" - }, - { - "ratings_total": 8, - "ratings_average": "2.88", - "app_name": "", - "package_name": "wallpaperchanger", - "histogram": "[3, 0, 2, 1, 2]" - }, - { - "ratings_total": 55, - "ratings_average": "4.82", - "app_name": "", - "package_name": "baobab", - "histogram": "[0, 0, 1, 8, 46]" - }, - { - "ratings_total": 6, - "ratings_average": "1.83", - "app_name": "", - "package_name": "opencity", - "histogram": "[3, 2, 0, 1, 0]" - }, - { - "ratings_total": 74, - "ratings_average": "3.38", - "app_name": "", - "package_name": "screenlets", - "histogram": "[11, 9, 14, 21, 19]" - }, - { - "ratings_total": 10, - "ratings_average": "2.90", - "app_name": "", - "package_name": "stallion", - "histogram": "[3, 2, 1, 1, 3]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "trafshow", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 3, - "ratings_average": "5.00", - "app_name": "", - "package_name": "kicad-common", - "histogram": "[0, 0, 0, 0, 3]" - }, - { - "ratings_total": 3, - "ratings_average": "2.33", - "app_name": "", - "package_name": "xqf", - "histogram": "[2, 0, 0, 0, 1]" - }, - { - "ratings_total": 0, - "ratings_average": "0.00", - "app_name": "", - "package_name": "evtest", - "histogram": "[0, 0, 0, 0, 0]" - }, - { - "ratings_total": 6, - "ratings_average": "4.50", - "app_name": "", - "package_name": "openbravo-3", - "histogram": "[0, 0, 1, 1, 4]" - }, - { - "ratings_total": 1, - "ratings_average": "4.00", - "app_name": "", - "package_name": "python-webkit", - "histogram": "[0, 0, 0, 1, 0]" - }, - { - "ratings_total": 48, - "ratings_average": "3.15", - "app_name": "", - "package_name": "gl-117", - "histogram": "[12, 6, 5, 13, 12]" - }, - { - "ratings_total": 2, - "ratings_average": "3.50", - "app_name": "", - "package_name": "totem-xine", - "histogram": "[0, 0, 1, 1, 0]" - }, - { - "ratings_total": 2, - "ratings_average": "1.00", - "app_name": "", - "package_name": "rainy-day", - "histogram": "[2, 0, 0, 0, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "pngcrush", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 2, - "ratings_average": "3.00", - "app_name": "", - "package_name": "braindump", - "histogram": "[1, 0, 0, 0, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "gzrt", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "comixcursors-righthanded", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 3, - "ratings_average": "2.33", - "app_name": "", - "package_name": "yatzy", - "histogram": "[1, 0, 2, 0, 0]" - }, - { - "ratings_total": 2, - "ratings_average": "4.00", - "app_name": "", - "package_name": "python-visual", - "histogram": "[0, 0, 1, 0, 1]" - }, - { - "ratings_total": 92, - "ratings_average": "4.42", - "app_name": "", - "package_name": "blueman", - "histogram": "[5, 3, 7, 10, 67]" - }, - { - "ratings_total": 318, - "ratings_average": "3.85", - "app_name": "", - "package_name": "gtk-recordmydesktop", - "histogram": "[33, 25, 40, 79, 141]" - }, - { - "ratings_total": 118, - "ratings_average": "4.69", - "app_name": "", - "package_name": "openttd", - "histogram": "[2, 0, 6, 16, 94]" - }, - { - "ratings_total": 1, - "ratings_average": "3.00", - "app_name": "", - "package_name": "fullcircle-issue-57", - "histogram": "[0, 0, 1, 0, 0]" - }, - { - "ratings_total": 3, - "ratings_average": "4.33", - "app_name": "", - "package_name": "hfsplus", - "histogram": "[0, 0, 0, 2, 1]" - }, - { - "ratings_total": 41, - "ratings_average": "3.93", - "app_name": "", - "package_name": "xcfa", - "histogram": "[7, 1, 4, 5, 24]" - }, - { - "ratings_total": 129, - "ratings_average": "2.93", - "app_name": "", - "package_name": "usb-creator-gtk", - "histogram": "[52, 8, 9, 17, 43]" - }, - { - "ratings_total": 15, - "ratings_average": "2.67", - "app_name": "", - "package_name": "zeitgeist", - "histogram": "[6, 2, 1, 3, 3]" - }, - { - "ratings_total": 5, - "ratings_average": "3.20", - "app_name": "", - "package_name": "musictube", - "histogram": "[1, 1, 1, 0, 2]" - }, - { - "ratings_total": 1, - "ratings_average": "2.00", - "app_name": "", - "package_name": "ia32-libs-multiarch", - "histogram": "[0, 1, 0, 0, 0]" - }, - { - "ratings_total": 38, - "ratings_average": "3.18", - "app_name": "", - "package_name": "nvidia-current", - "histogram": "[11, 2, 7, 5, 13]" - }, - { - "ratings_total": 30, - "ratings_average": "2.87", - "app_name": "", - "package_name": "hotot-gtk", - "histogram": "[12, 3, 2, 3, 10]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "octave-optim", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 0, - "ratings_average": "0.00", - "app_name": "", - "package_name": "2vcard", - "histogram": "[0, 0, 0, 0, 0]" - }, - { - "ratings_total": 29, - "ratings_average": "3.21", - "app_name": "", - "package_name": "gresistor", - "histogram": "[9, 1, 4, 5, 10]" - }, - { - "ratings_total": 789, - "ratings_average": "4.69", - "app_name": "", - "package_name": "clementine", - "histogram": "[17, 10, 29, 89, 644]" - }, - { - "ratings_total": 2, - "ratings_average": "5.00", - "app_name": "", - "package_name": "gem", - "histogram": "[0, 0, 0, 0, 2]" - }, - { - "ratings_total": 91, - "ratings_average": "4.15", - "app_name": "", - "package_name": "wine1.4", - "histogram": "[6, 5, 11, 16, 53]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "libdrm2", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "1.00", - "app_name": "", - "package_name": "gzip", - "histogram": "[1, 0, 0, 0, 0]" - }, - { - "ratings_total": 10, - "ratings_average": "2.70", - "app_name": "", - "package_name": "ktoon", - "histogram": "[3, 3, 0, 2, 2]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "iverilog", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "4.00", - "app_name": "", - "package_name": "gadmin-dhcpd", - "histogram": "[0, 0, 0, 1, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "steghide", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 10, - "ratings_average": "2.30", - "app_name": "", - "package_name": "xword", - "histogram": "[6, 0, 1, 1, 2]" - }, - { - "ratings_total": 5, - "ratings_average": "4.00", - "app_name": "", - "package_name": "sozi", - "histogram": "[1, 0, 0, 1, 3]" - }, - { - "ratings_total": 3, - "ratings_average": "4.33", - "app_name": "", - "package_name": "yui-compressor", - "histogram": "[0, 0, 1, 0, 2]" - }, - { - "ratings_total": 1, - "ratings_average": "4.00", - "app_name": "", - "package_name": "python-glade2", - "histogram": "[0, 0, 0, 1, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "browser-plugin-gnash", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 5, - "ratings_average": "2.40", - "app_name": "", - "package_name": "spider", - "histogram": "[2, 1, 1, 0, 1]" - }, - { - "ratings_total": 2, - "ratings_average": "4.00", - "app_name": "", - "package_name": "ttf-goudybookletter", - "histogram": "[0, 0, 1, 0, 1]" - }, - { - "ratings_total": 44, - "ratings_average": "3.84", - "app_name": "", - "package_name": "planner", - "histogram": "[4, 4, 5, 13, 18]" - }, - { - "ratings_total": 1, - "ratings_average": "3.00", - "app_name": "", - "package_name": "qmk-groundstation", - "histogram": "[0, 0, 1, 0, 0]" - }, - { - "ratings_total": 95, - "ratings_average": "3.65", - "app_name": "", - "package_name": "network-manager-gnome", - "histogram": "[9, 10, 20, 22, 34]" - }, - { - "ratings_total": 1, - "ratings_average": "4.00", - "app_name": "", - "package_name": "ttf-adf-baskervald", - "histogram": "[0, 0, 0, 1, 0]" - }, - { - "ratings_total": 4, - "ratings_average": "3.75", - "app_name": "", - "package_name": "lonesurvivor", - "histogram": "[0, 1, 0, 2, 1]" - }, - { - "ratings_total": 6, - "ratings_average": "2.17", - "app_name": "", - "package_name": "unace", - "histogram": "[3, 1, 0, 2, 0]" - }, - { - "ratings_total": 30, - "ratings_average": "3.67", - "app_name": "", - "package_name": "korganizer", - "histogram": "[4, 3, 4, 7, 12]" - }, - { - "ratings_total": 0, - "ratings_average": "0.00", - "app_name": "", - "package_name": "wbritish", - "histogram": "[0, 0, 0, 0, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "irpas", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 26, - "ratings_average": "4.23", - "app_name": "", - "package_name": "bum", - "histogram": "[0, 1, 4, 9, 12]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "libjnr-x86asm-java", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 7, - "ratings_average": "1.00", - "app_name": "", - "package_name": "gosmore", - "histogram": "[7, 0, 0, 0, 0]" - }, - { - "ratings_total": 4, - "ratings_average": "2.00", - "app_name": "", - "package_name": "fancontrol", - "histogram": "[2, 1, 0, 1, 0]" - }, - { - "ratings_total": 11, - "ratings_average": "3.64", - "app_name": "", - "package_name": "implosion", - "histogram": "[1, 1, 4, 0, 5]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "nbtscan", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "unity-scope-clementine", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "cone", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "4.00", - "app_name": "", - "package_name": "freeglut3", - "histogram": "[0, 0, 0, 1, 0]" - }, - { - "ratings_total": 21, - "ratings_average": "4.43", - "app_name": "", - "package_name": "mkvtoolnix-gui", - "histogram": "[2, 0, 0, 4, 15]" - }, - { - "ratings_total": 4, - "ratings_average": "4.50", - "app_name": "", - "package_name": "libdvdread4", - "histogram": "[0, 0, 1, 0, 3]" - }, - { - "ratings_total": 1, - "ratings_average": "4.00", - "app_name": "", - "package_name": "exif", - "histogram": "[0, 0, 0, 1, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "1.00", - "app_name": "", - "package_name": "wmdrawer", - "histogram": "[1, 0, 0, 0, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "ubuntuone-control-panel", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "1.00", - "app_name": "", - "package_name": "libckyapplet1", - "histogram": "[1, 0, 0, 0, 0]" - }, - { - "ratings_total": 2, - "ratings_average": "1.00", - "app_name": "", - "package_name": "kx11grab", - "histogram": "[2, 0, 0, 0, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "ht", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "3.00", - "app_name": "", - "package_name": "openoffice.org-pdfimport", - "histogram": "[0, 0, 1, 0, 0]" - }, - { - "ratings_total": 19, - "ratings_average": "4.26", - "app_name": "", - "package_name": "uqm", - "histogram": "[1, 1, 3, 1, 13]" - }, - { - "ratings_total": 2, - "ratings_average": "1.00", - "app_name": "", - "package_name": "btrfs-tools", - "histogram": "[2, 0, 0, 0, 0]" - }, - { - "ratings_total": 5, - "ratings_average": "2.60", - "app_name": "", - "package_name": "gwenrename", - "histogram": "[2, 0, 2, 0, 1]" - }, - { - "ratings_total": 5, - "ratings_average": "3.40", - "app_name": "", - "package_name": "gnome-boxes", - "histogram": "[0, 2, 0, 2, 1]" - }, - { - "ratings_total": 2, - "ratings_average": "4.50", - "app_name": "", - "package_name": "pomidor", - "histogram": "[0, 0, 0, 1, 1]" - }, - { - "ratings_total": 5, - "ratings_average": "3.80", - "app_name": "", - "package_name": "thunderbird-locale-fr", - "histogram": "[1, 0, 1, 0, 3]" - }, - { - "ratings_total": 17, - "ratings_average": "4.76", - "app_name": "", - "package_name": "firmware-b43-installer", - "histogram": "[0, 1, 0, 1, 15]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "sanduhr", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "pidgin-mra-dbg", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "jigdo-file", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 3, - "ratings_average": "4.67", - "app_name": "", - "package_name": "type-fu", - "histogram": "[0, 0, 0, 1, 2]" - }, - { - "ratings_total": 4, - "ratings_average": "4.00", - "app_name": "", - "package_name": "manage-launcher", - "histogram": "[1, 0, 0, 0, 3]" - }, - { - "ratings_total": 4, - "ratings_average": "2.00", - "app_name": "", - "package_name": "gxmms2", - "histogram": "[2, 1, 0, 1, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "harden-remoteaudit", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 4, - "ratings_average": "4.00", - "app_name": "", - "package_name": "pandoc", - "histogram": "[0, 0, 2, 0, 2]" - }, - { - "ratings_total": 12, - "ratings_average": "2.83", - "app_name": "", - "package_name": "gadmin-samba", - "histogram": "[4, 2, 1, 2, 3]" - }, - { - "ratings_total": 2, - "ratings_average": "5.00", - "app_name": "", - "package_name": "mrpt-apps", - "histogram": "[0, 0, 0, 0, 2]" - }, - { - "ratings_total": 1, - "ratings_average": "4.00", - "app_name": "", - "package_name": "x-tile", - "histogram": "[0, 0, 0, 1, 0]" - }, - { - "ratings_total": 5, - "ratings_average": "4.00", - "app_name": "", - "package_name": "xfce4-taskmanager", - "histogram": "[1, 0, 0, 1, 3]" - }, - { - "ratings_total": 7, - "ratings_average": "4.00", - "app_name": "", - "package_name": "wipe", - "histogram": "[1, 0, 0, 3, 3]" - }, - { - "ratings_total": 18, - "ratings_average": "3.67", - "app_name": "", - "package_name": "tuxpuck", - "histogram": "[1, 2, 3, 8, 4]" - }, - { - "ratings_total": 3, - "ratings_average": "5.00", - "app_name": "", - "package_name": "dnsmasq", - "histogram": "[0, 0, 0, 0, 3]" - }, - { - "ratings_total": 2, - "ratings_average": "1.50", - "app_name": "", - "package_name": "simon", - "histogram": "[1, 1, 0, 0, 0]" - }, - { - "ratings_total": 34, - "ratings_average": "3.59", - "app_name": "", - "package_name": "modem-manager-gui", - "histogram": "[4, 6, 4, 6, 14]" - }, - { - "ratings_total": 8, - "ratings_average": "3.75", - "app_name": "", - "package_name": "fontypython", - "histogram": "[1, 1, 1, 1, 4]" - }, - { - "ratings_total": 13, - "ratings_average": "3.77", - "app_name": "", - "package_name": "retext", - "histogram": "[2, 2, 0, 2, 7]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "gnome-do-plugins", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 3, - "ratings_average": "3.67", - "app_name": "", - "package_name": "libavcodec-extra-53", - "histogram": "[1, 0, 0, 0, 2]" - }, - { - "ratings_total": 4, - "ratings_average": "4.75", - "app_name": "", - "package_name": "mandelbulber", - "histogram": "[0, 0, 0, 1, 3]" - }, - { - "ratings_total": 5, - "ratings_average": "2.80", - "app_name": "", - "package_name": "goldencube", - "histogram": "[1, 2, 0, 1, 1]" - }, - { - "ratings_total": 124, - "ratings_average": "4.30", - "app_name": "", - "package_name": "alarm-clock-applet", - "histogram": "[8, 7, 3, 28, 78]" - }, - { - "ratings_total": 6, - "ratings_average": "1.83", - "app_name": "", - "package_name": "cortina", - "histogram": "[3, 2, 0, 1, 0]" - }, - { - "ratings_total": 4, - "ratings_average": "3.00", - "app_name": "", - "package_name": "buggyrace", - "histogram": "[1, 1, 0, 1, 1]" - }, - { - "ratings_total": 151, - "ratings_average": "4.52", - "app_name": "", - "package_name": "nexuiz", - "histogram": "[4, 5, 11, 20, 111]" - }, - { - "ratings_total": 4, - "ratings_average": "3.50", - "app_name": "", - "package_name": "tanglet", - "histogram": "[0, 0, 2, 2, 0]" - }, - { - "ratings_total": 51, - "ratings_average": "4.08", - "app_name": "", - "package_name": "glchess", - "histogram": "[3, 5, 5, 10, 28]" - }, - { - "ratings_total": 2, - "ratings_average": "5.00", - "app_name": "", - "package_name": "ubuntistas-14", - "histogram": "[0, 0, 0, 0, 2]" - }, - { - "ratings_total": 7, - "ratings_average": "3.43", - "app_name": "", - "package_name": "ktron", - "histogram": "[2, 0, 0, 3, 2]" - }, - { - "ratings_total": 3, - "ratings_average": "5.00", - "app_name": "", - "package_name": "fonts-linuxlibertine", - "histogram": "[0, 0, 0, 0, 3]" - }, - { - "ratings_total": 10, - "ratings_average": "1.40", - "app_name": "", - "package_name": "xsddiagram", - "histogram": "[8, 0, 2, 0, 0]" - }, - { - "ratings_total": 14, - "ratings_average": "4.79", - "app_name": "", - "package_name": "mediainfo-gui", - "histogram": "[0, 0, 1, 1, 12]" - }, - { - "ratings_total": 4, - "ratings_average": "3.25", - "app_name": "", - "package_name": "hostapd", - "histogram": "[0, 2, 0, 1, 1]" - }, - { - "ratings_total": 2, - "ratings_average": "4.50", - "app_name": "", - "package_name": "gmrun", - "histogram": "[0, 0, 0, 1, 1]" - }, - { - "ratings_total": 29, - "ratings_average": "4.86", - "app_name": "", - "package_name": "bpython", - "histogram": "[0, 0, 1, 2, 26]" - }, - { - "ratings_total": 7, - "ratings_average": "2.00", - "app_name": "", - "package_name": "mydesktopcalendar", - "histogram": "[4, 1, 0, 2, 0]" - }, - { - "ratings_total": 29, - "ratings_average": "4.52", - "app_name": "", - "package_name": "lingot", - "histogram": "[1, 1, 2, 3, 22]" - }, - { - "ratings_total": 1, - "ratings_average": "3.00", - "app_name": "", - "package_name": "libdevel-ptkdb-perl", - "histogram": "[0, 0, 1, 0, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "jython", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "libogre-dev", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "indicator-sound", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 5, - "ratings_average": "1.60", - "app_name": "", - "package_name": "dclock-java", - "histogram": "[4, 0, 0, 1, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "4.00", - "app_name": "", - "package_name": "libsdl1.2debian-all", - "histogram": "[0, 0, 0, 1, 0]" - }, - { - "ratings_total": 3, - "ratings_average": "5.00", - "app_name": "", - "package_name": "gperiodic", - "histogram": "[0, 0, 0, 0, 3]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "revista-espirito-livre-2", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 4, - "ratings_average": "3.50", - "app_name": "", - "package_name": "hotwire", - "histogram": "[1, 0, 1, 0, 2]" - }, - { - "ratings_total": 3, - "ratings_average": "3.67", - "app_name": "", - "package_name": "intone", - "histogram": "[0, 1, 0, 1, 1]" - }, - { - "ratings_total": 12, - "ratings_average": "3.58", - "app_name": "", - "package_name": "mp3diags", - "histogram": "[3, 0, 1, 3, 5]" - }, - { - "ratings_total": 1, - "ratings_average": "2.00", - "app_name": "", - "package_name": "wallpaper", - "histogram": "[0, 1, 0, 0, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "impressive", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 2, - "ratings_average": "3.50", - "app_name": "", - "package_name": "vala-terminal", - "histogram": "[0, 0, 1, 1, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "libgtkglextmm-x11-1.2-dev", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "4.00", - "app_name": "", - "package_name": "libphp-jpgraph", - "histogram": "[0, 0, 0, 1, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "1.00", - "app_name": "", - "package_name": "sineshaper", - "histogram": "[1, 0, 0, 0, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "thunderbird-locale-de", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "4.00", - "app_name": "", - "package_name": "xca", - "histogram": "[0, 0, 0, 1, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "php5-curl", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "libreoffice-java-common", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "ttf-tuffy", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 4, - "ratings_average": "5.00", - "app_name": "", - "package_name": "edubuntu-fonts", - "histogram": "[0, 0, 0, 0, 4]" - }, - { - "ratings_total": 1, - "ratings_average": "1.00", - "app_name": "", - "package_name": "bugs-everywhere", - "histogram": "[1, 0, 0, 0, 0]" - }, - { - "ratings_total": 5, - "ratings_average": "4.20", - "app_name": "", - "package_name": "gnome-utils", - "histogram": "[1, 0, 0, 0, 4]" - }, - { - "ratings_total": 4, - "ratings_average": "4.75", - "app_name": "", - "package_name": "wicd", - "histogram": "[0, 0, 0, 1, 3]" - }, - { - "ratings_total": 3, - "ratings_average": "3.67", - "app_name": "", - "package_name": "katoob", - "histogram": "[0, 1, 0, 1, 1]" - }, - { - "ratings_total": 8, - "ratings_average": "3.88", - "app_name": "", - "package_name": "scim", - "histogram": "[1, 0, 1, 3, 3]" - }, - { - "ratings_total": 11, - "ratings_average": "2.64", - "app_name": "", - "package_name": "ace-of-penguins", - "histogram": "[4, 2, 1, 2, 2]" - }, - { - "ratings_total": 2, - "ratings_average": "2.50", - "app_name": "", - "package_name": "festlex-oald", - "histogram": "[1, 0, 0, 1, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "4.00", - "app_name": "", - "package_name": "urth", - "histogram": "[0, 0, 0, 1, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "hwdata", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "2.00", - "app_name": "", - "package_name": "tovid", - "histogram": "[0, 1, 0, 0, 0]" - }, - { - "ratings_total": 5, - "ratings_average": "2.80", - "app_name": "", - "package_name": "fillmore", - "histogram": "[2, 0, 1, 1, 1]" - }, - { - "ratings_total": 9, - "ratings_average": "3.33", - "app_name": "", - "package_name": "tecnoballz", - "histogram": "[2, 0, 3, 1, 3]" - }, - { - "ratings_total": 2, - "ratings_average": "5.00", - "app_name": "", - "package_name": "zescrow-client", - "histogram": "[0, 0, 0, 0, 2]" - }, - { - "ratings_total": 3, - "ratings_average": "3.67", - "app_name": "", - "package_name": "foff", - "histogram": "[1, 0, 0, 0, 2]" - }, - { - "ratings_total": 1, - "ratings_average": "1.00", - "app_name": "", - "package_name": "gimp-flegita", - "histogram": "[1, 0, 0, 0, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "4.00", - "app_name": "", - "package_name": "haxe", - "histogram": "[0, 0, 0, 1, 0]" - }, - { - "ratings_total": 60, - "ratings_average": "3.97", - "app_name": "", - "package_name": "xmoto", - "histogram": "[6, 3, 6, 17, 28]" - }, - { - "ratings_total": 2, - "ratings_average": "3.50", - "app_name": "", - "package_name": "disksearch", - "histogram": "[0, 0, 1, 1, 0]" - }, - { - "ratings_total": 2, - "ratings_average": "4.50", - "app_name": "", - "package_name": "pype", - "histogram": "[0, 0, 0, 1, 1]" - }, - { - "ratings_total": 4, - "ratings_average": "3.75", - "app_name": "", - "package_name": "pidgin-sipe", - "histogram": "[0, 0, 2, 1, 1]" - }, - { - "ratings_total": 17, - "ratings_average": "3.94", - "app_name": "", - "package_name": "gespeaker", - "histogram": "[2, 0, 1, 8, 6]" - }, - { - "ratings_total": 91, - "ratings_average": "4.21", - "app_name": "", - "package_name": "pcsxr", - "histogram": "[6, 4, 7, 22, 52]" - }, - { - "ratings_total": 3, - "ratings_average": "1.33", - "app_name": "", - "package_name": "gadmin-openvpn-client", - "histogram": "[2, 1, 0, 0, 0]" - }, - { - "ratings_total": 25, - "ratings_average": "3.68", - "app_name": "", - "package_name": "qjackctl", - "histogram": "[4, 2, 2, 7, 10]" - }, - { - "ratings_total": 3, - "ratings_average": "5.00", - "app_name": "", - "package_name": "xyscan", - "histogram": "[0, 0, 0, 0, 3]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "grep", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 4, - "ratings_average": "2.50", - "app_name": "", - "package_name": "gigalomania", - "histogram": "[2, 0, 1, 0, 1]" - }, - { - "ratings_total": 38, - "ratings_average": "1.50", - "app_name": "", - "package_name": "aweather", - "histogram": "[27, 6, 3, 1, 1]" - }, - { - "ratings_total": 5, - "ratings_average": "2.40", - "app_name": "", - "package_name": "djplay", - "histogram": "[2, 1, 1, 0, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "libsdl-mixer1.2-dev", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 27, - "ratings_average": "2.59", - "app_name": "", - "package_name": "photoprint", - "histogram": "[12, 2, 3, 5, 5]" - }, - { - "ratings_total": 6, - "ratings_average": "1.67", - "app_name": "", - "package_name": "gromit", - "histogram": "[4, 0, 2, 0, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "2.00", - "app_name": "", - "package_name": "gnumail.app", - "histogram": "[0, 1, 0, 0, 0]" - }, - { - "ratings_total": 96, - "ratings_average": "4.05", - "app_name": "", - "package_name": "myunity", - "histogram": "[10, 4, 5, 29, 48]" - }, - { - "ratings_total": 3, - "ratings_average": "3.33", - "app_name": "", - "package_name": "gcc-avr", - "histogram": "[1, 0, 0, 1, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "3.00", - "app_name": "", - "package_name": "thunar-volman", - "histogram": "[0, 0, 1, 0, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "kdrill", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 2, - "ratings_average": "4.50", - "app_name": "", - "package_name": "dialog", - "histogram": "[0, 0, 0, 1, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "archmage", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "1.00", - "app_name": "", - "package_name": "magictouch", - "histogram": "[1, 0, 0, 0, 0]" - }, - { - "ratings_total": 29, - "ratings_average": "4.62", - "app_name": "", - "package_name": "ufraw", - "histogram": "[0, 1, 2, 4, 22]" - }, - { - "ratings_total": 1, - "ratings_average": "4.00", - "app_name": "", - "package_name": "xvile", - "histogram": "[0, 0, 0, 1, 0]" - }, - { - "ratings_total": 0, - "ratings_average": "0.00", - "app_name": "", - "package_name": "puppet", - "histogram": "[0, 0, 0, 0, 0]" - }, - { - "ratings_total": 29, - "ratings_average": "3.14", - "app_name": "", - "package_name": "dreamchess", - "histogram": "[6, 5, 5, 5, 8]" - }, - { - "ratings_total": 45, - "ratings_average": "4.11", - "app_name": "", - "package_name": "basket", - "histogram": "[0, 6, 5, 12, 22]" - }, - { - "ratings_total": 3, - "ratings_average": "5.00", - "app_name": "", - "package_name": "psi", - "histogram": "[0, 0, 0, 0, 3]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "libmondrian-java", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 3, - "ratings_average": "3.33", - "app_name": "", - "package_name": "minirok", - "histogram": "[1, 0, 0, 1, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "1.00", - "app_name": "", - "package_name": "fonts-unfonts-core", - "histogram": "[1, 0, 0, 0, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "allegro-demo", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 5, - "ratings_average": "3.00", - "app_name": "", - "package_name": "grub-pc", - "histogram": "[1, 1, 1, 1, 1]" - }, - { - "ratings_total": 4, - "ratings_average": "2.50", - "app_name": "", - "package_name": "kgoldrunner", - "histogram": "[2, 0, 1, 0, 1]" - }, - { - "ratings_total": 2, - "ratings_average": "5.00", - "app_name": "", - "package_name": "kiten", - "histogram": "[0, 0, 0, 0, 2]" - }, - { - "ratings_total": 2, - "ratings_average": "5.00", - "app_name": "", - "package_name": "puredata-core", - "histogram": "[0, 0, 0, 0, 2]" - }, - { - "ratings_total": 11, - "ratings_average": "2.09", - "app_name": "", - "package_name": "nebula44", - "histogram": "[7, 0, 1, 2, 1]" - }, - { - "ratings_total": 13, - "ratings_average": "1.23", - "app_name": "", - "package_name": "nvclock-gtk", - "histogram": "[12, 0, 0, 1, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "4.00", - "app_name": "", - "package_name": "kuiviewer", - "histogram": "[0, 0, 0, 1, 0]" - }, - { - "ratings_total": 3, - "ratings_average": "4.00", - "app_name": "", - "package_name": "costume-quest-meta", - "histogram": "[0, 0, 1, 1, 1]" - }, - { - "ratings_total": 8, - "ratings_average": "4.38", - "app_name": "", - "package_name": "icedtea-7-plugin", - "histogram": "[0, 1, 1, 0, 6]" - }, - { - "ratings_total": 7, - "ratings_average": "3.29", - "app_name": "", - "package_name": "gwibber-service-sina", - "histogram": "[2, 0, 1, 2, 2]" - }, - { - "ratings_total": 20, - "ratings_average": "3.95", - "app_name": "", - "package_name": "ardentryst", - "histogram": "[1, 0, 5, 7, 7]" - }, - { - "ratings_total": 3, - "ratings_average": "4.67", - "app_name": "", - "package_name": "cpufrequtils", - "histogram": "[0, 0, 0, 1, 2]" - }, - { - "ratings_total": 1, - "ratings_average": "2.00", - "app_name": "", - "package_name": "openuniverse-common", - "histogram": "[0, 1, 0, 0, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "livemix", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "pyromaths", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 12, - "ratings_average": "3.92", - "app_name": "", - "package_name": "war-in-a-box-paper-tanks", - "histogram": "[2, 1, 0, 2, 7]" - }, - { - "ratings_total": 63, - "ratings_average": "2.43", - "app_name": "", - "package_name": "nautilus", - "histogram": "[24, 11, 12, 9, 7]" - }, - { - "ratings_total": 36, - "ratings_average": "3.19", - "app_name": "", - "package_name": "tuxcmd", - "histogram": "[12, 2, 2, 7, 13]" - }, - { - "ratings_total": 5, - "ratings_average": "4.20", - "app_name": "", - "package_name": "ancientrome2", - "histogram": "[0, 0, 1, 2, 2]" - }, - { - "ratings_total": 17, - "ratings_average": "2.71", - "app_name": "", - "package_name": "freeguide", - "histogram": "[7, 3, 0, 2, 5]" - }, - { - "ratings_total": 4, - "ratings_average": "3.00", - "app_name": "", - "package_name": "drfinance", - "histogram": "[2, 0, 0, 0, 2]" - }, - { - "ratings_total": 2, - "ratings_average": "2.50", - "app_name": "", - "package_name": "kplato", - "histogram": "[1, 0, 0, 1, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "jigl", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 2, - "ratings_average": "4.50", - "app_name": "", - "package_name": "biblatex", - "histogram": "[0, 0, 0, 1, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "4.00", - "app_name": "", - "package_name": "dbview", - "histogram": "[0, 0, 0, 1, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "4.00", - "app_name": "", - "package_name": "account-plugin-sina", - "histogram": "[0, 0, 0, 1, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "clive", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 3, - "ratings_average": "5.00", - "app_name": "", - "package_name": "woof", - "histogram": "[0, 0, 0, 0, 3]" - }, - { - "ratings_total": 3, - "ratings_average": "2.67", - "app_name": "", - "package_name": "cloudprint", - "histogram": "[1, 0, 1, 1, 0]" - }, - { - "ratings_total": 4, - "ratings_average": "3.75", - "app_name": "", - "package_name": "globs", - "histogram": "[0, 1, 1, 0, 2]" - }, - { - "ratings_total": 4, - "ratings_average": "4.50", - "app_name": "", - "package_name": "dynamitejack", - "histogram": "[0, 0, 0, 2, 2]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "printer-driver-pnm2ppa", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "4.00", - "app_name": "", - "package_name": "libtinyxml-dev", - "histogram": "[0, 0, 0, 1, 0]" - }, - { - "ratings_total": 2, - "ratings_average": "4.50", - "app_name": "", - "package_name": "fullcircle-issue-71", - "histogram": "[0, 0, 0, 1, 1]" - }, - { - "ratings_total": 6, - "ratings_average": "3.33", - "app_name": "", - "package_name": "ddd", - "histogram": "[1, 1, 1, 1, 2]" - }, - { - "ratings_total": 2, - "ratings_average": "5.00", - "app_name": "", - "package_name": "jp2a", - "histogram": "[0, 0, 0, 0, 2]" - }, - { - "ratings_total": 7, - "ratings_average": "1.29", - "app_name": "", - "package_name": "nepomuk-core-data", - "histogram": "[6, 0, 1, 0, 0]" - }, - { - "ratings_total": 2, - "ratings_average": "4.00", - "app_name": "", - "package_name": "backuppc", - "histogram": "[0, 0, 1, 0, 1]" - }, - { - "ratings_total": 8, - "ratings_average": "4.50", - "app_name": "", - "package_name": "owncloud", - "histogram": "[0, 0, 1, 2, 5]" - }, - { - "ratings_total": 29, - "ratings_average": "4.69", - "app_name": "", - "package_name": "gtkhash", - "histogram": "[0, 0, 1, 7, 21]" - }, - { - "ratings_total": 2, - "ratings_average": "2.00", - "app_name": "", - "package_name": "xresprobe", - "histogram": "[0, 2, 0, 0, 0]" - }, - { - "ratings_total": 18, - "ratings_average": "3.50", - "app_name": "", - "package_name": "icedtea-netx-common", - "histogram": "[4, 0, 5, 1, 8]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "kamera", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 3, - "ratings_average": "3.00", - "app_name": "", - "package_name": "pomodoro-applet", - "histogram": "[1, 0, 1, 0, 1]" - }, - { - "ratings_total": 8, - "ratings_average": "4.38", - "app_name": "", - "package_name": "nano", - "histogram": "[1, 0, 0, 1, 6]" - }, - { - "ratings_total": 1, - "ratings_average": "1.00", - "app_name": "", - "package_name": "xfonts-base", - "histogram": "[1, 0, 0, 0, 0]" - }, - { - "ratings_total": 12, - "ratings_average": "4.67", - "app_name": "", - "package_name": "qtqr", - "histogram": "[0, 0, 0, 4, 8]" - }, - { - "ratings_total": 4, - "ratings_average": "4.75", - "app_name": "", - "package_name": "flex", - "histogram": "[0, 0, 0, 1, 3]" - }, - { - "ratings_total": 3, - "ratings_average": "1.33", - "app_name": "", - "package_name": "xsol", - "histogram": "[2, 1, 0, 0, 0]" - }, - { - "ratings_total": 19, - "ratings_average": "4.47", - "app_name": "", - "package_name": "qalculate-gtk", - "histogram": "[1, 1, 0, 3, 14]" - }, - { - "ratings_total": 433, - "ratings_average": "4.67", - "app_name": "", - "package_name": "audacious", - "histogram": "[11, 4, 13, 60, 345]" - }, - { - "ratings_total": 2, - "ratings_average": "3.50", - "app_name": "", - "package_name": "libqtgui4", - "histogram": "[0, 0, 1, 1, 0]" - }, - { - "ratings_total": 75, - "ratings_average": "4.36", - "app_name": "", - "package_name": "fogger", - "histogram": "[0, 2, 7, 28, 38]" - }, - { - "ratings_total": 8, - "ratings_average": "3.25", - "app_name": "", - "package_name": "aseprite", - "histogram": "[2, 0, 2, 2, 2]" - }, - { - "ratings_total": 9, - "ratings_average": "3.89", - "app_name": "", - "package_name": "gambas3-ide", - "histogram": "[2, 0, 1, 0, 6]" - }, - { - "ratings_total": 10, - "ratings_average": "4.60", - "app_name": "", - "package_name": "fmit", - "histogram": "[0, 0, 1, 2, 7]" - }, - { - "ratings_total": 2, - "ratings_average": "4.50", - "app_name": "", - "package_name": "rig", - "histogram": "[0, 0, 0, 1, 1]" - }, - { - "ratings_total": 2, - "ratings_average": "2.50", - "app_name": "", - "package_name": "pgdesigner", - "histogram": "[1, 0, 0, 1, 0]" - }, - { - "ratings_total": 97, - "ratings_average": "4.31", - "app_name": "", - "package_name": "openjdk-7-jre", - "histogram": "[9, 2, 6, 13, 67]" - }, - { - "ratings_total": 9, - "ratings_average": "4.78", - "app_name": "", - "package_name": "likewise-open-gui", - "histogram": "[0, 0, 0, 2, 7]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "fsarchiver", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "indicator-power", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "1.00", - "app_name": "", - "package_name": "python3-examples", - "histogram": "[1, 0, 0, 0, 0]" - }, - { - "ratings_total": 4, - "ratings_average": "2.75", - "app_name": "", - "package_name": "banshee-extension-clutterflow", - "histogram": "[1, 0, 2, 1, 0]" - }, - { - "ratings_total": 3, - "ratings_average": "3.67", - "app_name": "", - "package_name": "fcrackzip", - "histogram": "[0, 0, 1, 2, 0]" - }, - { - "ratings_total": 37, - "ratings_average": "4.16", - "app_name": "", - "package_name": "ripperx", - "histogram": "[2, 2, 3, 11, 19]" - }, - { - "ratings_total": 1, - "ratings_average": "1.00", - "app_name": "", - "package_name": "libhdf5-serial-1.8.4", - "histogram": "[1, 0, 0, 0, 0]" - }, - { - "ratings_total": 22, - "ratings_average": "4.23", - "app_name": "", - "package_name": "ark", - "histogram": "[1, 2, 2, 3, 14]" - }, - { - "ratings_total": 11, - "ratings_average": "4.36", - "app_name": "", - "package_name": "biogenesis", - "histogram": "[0, 1, 1, 2, 7]" - }, - { - "ratings_total": 40, - "ratings_average": "1.98", - "app_name": "", - "package_name": "linthesia", - "histogram": "[26, 3, 1, 6, 4]" - }, - { - "ratings_total": 3, - "ratings_average": "5.00", - "app_name": "", - "package_name": "ttf-arabeyes", - "histogram": "[0, 0, 0, 0, 3]" - }, - { - "ratings_total": 3, - "ratings_average": "4.00", - "app_name": "", - "package_name": "default-jre", - "histogram": "[0, 1, 0, 0, 2]" - }, - { - "ratings_total": 62, - "ratings_average": "3.27", - "app_name": "", - "package_name": "cairo-clock", - "histogram": "[13, 8, 7, 17, 17]" - }, - { - "ratings_total": 4, - "ratings_average": "5.00", - "app_name": "", - "package_name": "viridian", - "histogram": "[0, 0, 0, 0, 4]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "jemboss", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 3, - "ratings_average": "3.00", - "app_name": "", - "package_name": "pyragua", - "histogram": "[1, 0, 1, 0, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "4.00", - "app_name": "", - "package_name": "libmojolicious-perl", - "histogram": "[0, 0, 0, 1, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "lxf161", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 7, - "ratings_average": "3.57", - "app_name": "", - "package_name": "memory-owl", - "histogram": "[1, 0, 2, 2, 2]" - }, - { - "ratings_total": 3, - "ratings_average": "5.00", - "app_name": "", - "package_name": "sqlite", - "histogram": "[0, 0, 0, 0, 3]" - }, - { - "ratings_total": 1, - "ratings_average": "1.00", - "app_name": "", - "package_name": "libreoffice-evolution", - "histogram": "[1, 0, 0, 0, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "3.00", - "app_name": "", - "package_name": "yersinia", - "histogram": "[0, 0, 1, 0, 0]" - }, - { - "ratings_total": 29, - "ratings_average": "4.41", - "app_name": "", - "package_name": "gambas2-ide", - "histogram": "[3, 0, 0, 5, 21]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "mosh", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 10, - "ratings_average": "2.70", - "app_name": "", - "package_name": "moserial", - "histogram": "[2, 4, 1, 1, 2]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "ttf-arphic-gbsn00lp", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 2, - "ratings_average": "3.00", - "app_name": "", - "package_name": "tuxinfo", - "histogram": "[1, 0, 0, 0, 1]" - }, - { - "ratings_total": 2, - "ratings_average": "2.50", - "app_name": "", - "package_name": "rovclock", - "histogram": "[1, 0, 0, 1, 0]" - }, - { - "ratings_total": 9, - "ratings_average": "2.78", - "app_name": "", - "package_name": "kdocker", - "histogram": "[5, 0, 0, 0, 4]" - }, - { - "ratings_total": 1, - "ratings_average": "1.00", - "app_name": "", - "package_name": "myspell-st", - "histogram": "[1, 0, 0, 0, 0]" - }, - { - "ratings_total": 16, - "ratings_average": "4.12", - "app_name": "", - "package_name": "solfege", - "histogram": "[2, 0, 0, 6, 8]" - }, - { - "ratings_total": 14, - "ratings_average": "2.79", - "app_name": "", - "package_name": "rapid-photo-downloader", - "histogram": "[6, 2, 0, 1, 5]" - }, - { - "ratings_total": 14, - "ratings_average": "4.50", - "app_name": "", - "package_name": "glob2", - "histogram": "[1, 0, 0, 3, 10]" - }, - { - "ratings_total": 4, - "ratings_average": "5.00", - "app_name": "", - "package_name": "umlet", - "histogram": "[0, 0, 0, 0, 4]" - }, - { - "ratings_total": 5, - "ratings_average": "2.80", - "app_name": "", - "package_name": "kabikaboo", - "histogram": "[2, 0, 1, 1, 1]" - }, - { - "ratings_total": 3, - "ratings_average": "4.00", - "app_name": "", - "package_name": "krecipes", - "histogram": "[0, 1, 0, 0, 2]" - }, - { - "ratings_total": 41, - "ratings_average": "4.83", - "app_name": "", - "package_name": "classicmenu-indicator", - "histogram": "[1, 0, 0, 3, 37]" - }, - { - "ratings_total": 2, - "ratings_average": "5.00", - "app_name": "", - "package_name": "network-manager-openconnect", - "histogram": "[0, 0, 0, 0, 2]" - }, - { - "ratings_total": 12, - "ratings_average": "4.08", - "app_name": "", - "package_name": "mousepad", - "histogram": "[0, 2, 0, 5, 5]" - }, - { - "ratings_total": 4, - "ratings_average": "3.00", - "app_name": "", - "package_name": "jclic", - "histogram": "[1, 0, 2, 0, 1]" - }, - { - "ratings_total": 26, - "ratings_average": "4.23", - "app_name": "", - "package_name": "unison-gtk", - "histogram": "[1, 2, 2, 6, 15]" - }, - { - "ratings_total": 22, - "ratings_average": "4.23", - "app_name": "", - "package_name": "gpick", - "histogram": "[0, 2, 3, 5, 12]" - }, - { - "ratings_total": 0, - "ratings_average": "0.00", - "app_name": "", - "package_name": "virtualbox-ose", - "histogram": "[0, 0, 0, 0, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "4.00", - "app_name": "", - "package_name": "ibus-table-cangjie-big", - "histogram": "[0, 0, 0, 1, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "ibus-array", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "libnet-telnet-cisco-perl", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 77, - "ratings_average": "4.34", - "app_name": "", - "package_name": "wine1.3", - "histogram": "[2, 2, 10, 17, 46]" - }, - { - "ratings_total": 3, - "ratings_average": "2.33", - "app_name": "", - "package_name": "invaders-3d", - "histogram": "[2, 0, 0, 0, 1]" - }, - { - "ratings_total": 2, - "ratings_average": "4.50", - "app_name": "", - "package_name": "vnc4server", - "histogram": "[0, 0, 0, 1, 1]" - }, - { - "ratings_total": 2, - "ratings_average": "3.50", - "app_name": "", - "package_name": "bibledit", - "histogram": "[0, 0, 1, 1, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "4.00", - "app_name": "", - "package_name": "tpb", - "histogram": "[0, 0, 0, 1, 0]" - }, - { - "ratings_total": 8, - "ratings_average": "1.12", - "app_name": "", - "package_name": "twitux", - "histogram": "[7, 1, 0, 0, 0]" - }, - { - "ratings_total": 2, - "ratings_average": "3.00", - "app_name": "", - "package_name": "unity-place-files", - "histogram": "[1, 0, 0, 0, 1]" - }, - { - "ratings_total": 17, - "ratings_average": "4.82", - "app_name": "", - "package_name": "kalzium", - "histogram": "[0, 0, 0, 3, 14]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "python-django-doc", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 5, - "ratings_average": "5.00", - "app_name": "", - "package_name": "clang", - "histogram": "[0, 0, 0, 0, 5]" - }, - { - "ratings_total": 48, - "ratings_average": "1.33", - "app_name": "", - "package_name": "tencentqq", - "histogram": "[42, 1, 2, 1, 2]" - }, - { - "ratings_total": 187, - "ratings_average": "4.50", - "app_name": "", - "package_name": "gedit", - "histogram": "[8, 4, 11, 27, 137]" - }, - { - "ratings_total": 5, - "ratings_average": "4.20", - "app_name": "", - "package_name": "gpscorrelate-gui", - "histogram": "[0, 1, 0, 1, 3]" - }, - { - "ratings_total": 5, - "ratings_average": "4.80", - "app_name": "", - "package_name": "ppa-purge", - "histogram": "[0, 0, 0, 1, 4]" - }, - { - "ratings_total": 11, - "ratings_average": "1.73", - "app_name": "", - "package_name": "conglomerate", - "histogram": "[6, 2, 3, 0, 0]" - }, - { - "ratings_total": 3, - "ratings_average": "2.67", - "app_name": "", - "package_name": "yojigsaw", - "histogram": "[1, 1, 0, 0, 1]" - }, - { - "ratings_total": 6, - "ratings_average": "4.33", - "app_name": "", - "package_name": "nvidia-glx-185", - "histogram": "[0, 1, 0, 1, 4]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "sfst", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 4, - "ratings_average": "1.25", - "app_name": "", - "package_name": "synce-trayicon", - "histogram": "[3, 1, 0, 0, 0]" - }, - { - "ratings_total": 5, - "ratings_average": "4.80", - "app_name": "", - "package_name": "edge", - "histogram": "[0, 0, 0, 1, 4]" - }, - { - "ratings_total": 9, - "ratings_average": "5.00", - "app_name": "", - "package_name": "tagainijisho", - "histogram": "[0, 0, 0, 0, 9]" - }, - { - "ratings_total": 99, - "ratings_average": "4.26", - "app_name": "", - "package_name": "file-roller", - "histogram": "[4, 4, 9, 27, 55]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "picmi", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "keytouch", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 3, - "ratings_average": "3.00", - "app_name": "", - "package_name": "ttf-indic-fonts-core", - "histogram": "[1, 0, 1, 0, 1]" - }, - { - "ratings_total": 7, - "ratings_average": "4.71", - "app_name": "", - "package_name": "idle3", - "histogram": "[0, 0, 1, 0, 6]" - }, - { - "ratings_total": 5, - "ratings_average": "3.20", - "app_name": "", - "package_name": "alsaplayer-common", - "histogram": "[1, 0, 2, 1, 1]" - }, - { - "ratings_total": 9, - "ratings_average": "4.56", - "app_name": "", - "package_name": "bibus", - "histogram": "[0, 0, 1, 2, 6]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "vncsnapshot", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 24, - "ratings_average": "3.46", - "app_name": "", - "package_name": "ripoff", - "histogram": "[2, 6, 4, 3, 9]" - }, - { - "ratings_total": 1, - "ratings_average": "1.00", - "app_name": "", - "package_name": "julius-voxforge", - "histogram": "[1, 0, 0, 0, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "linux-firmware-nonfree", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 14, - "ratings_average": "4.43", - "app_name": "", - "package_name": "kalgebra", - "histogram": "[0, 0, 3, 2, 9]" - }, - { - "ratings_total": 71, - "ratings_average": "3.73", - "app_name": "", - "package_name": "minetest", - "histogram": "[6, 5, 17, 17, 26]" - }, - { - "ratings_total": 87, - "ratings_average": "2.82", - "app_name": "", - "package_name": "xsensors", - "histogram": "[24, 13, 20, 15, 15]" - }, - { - "ratings_total": 7, - "ratings_average": "3.71", - "app_name": "", - "package_name": "cdcat", - "histogram": "[1, 0, 0, 5, 1]" - }, - { - "ratings_total": 22, - "ratings_average": "4.09", - "app_name": "", - "package_name": "gnome-nettool", - "histogram": "[1, 1, 3, 7, 10]" - }, - { - "ratings_total": 22, - "ratings_average": "4.50", - "app_name": "", - "package_name": "jabref", - "histogram": "[0, 0, 1, 9, 12]" - }, - { - "ratings_total": 2, - "ratings_average": "5.00", - "app_name": "", - "package_name": "revista-espirito-livre-5", - "histogram": "[0, 0, 0, 0, 2]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "kic", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 7, - "ratings_average": "3.57", - "app_name": "", - "package_name": "k3d", - "histogram": "[2, 0, 0, 2, 3]" - }, - { - "ratings_total": 1, - "ratings_average": "1.00", - "app_name": "", - "package_name": "awstats", - "histogram": "[1, 0, 0, 0, 0]" - }, - { - "ratings_total": 28, - "ratings_average": "4.75", - "app_name": "", - "package_name": "sqliteman", - "histogram": "[0, 0, 0, 7, 21]" - }, - { - "ratings_total": 1, - "ratings_average": "2.00", - "app_name": "", - "package_name": "travel-trial", - "histogram": "[0, 1, 0, 0, 0]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "pidgin-facebookchat", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 35, - "ratings_average": "4.69", - "app_name": "", - "package_name": "wxmaxima", - "histogram": "[1, 0, 1, 5, 28]" - }, - { - "ratings_total": 1, - "ratings_average": "5.00", - "app_name": "", - "package_name": "fourorless", - "histogram": "[0, 0, 0, 0, 1]" - }, - { - "ratings_total": 1, - "ratings_average": "4.00", - "app_name": "", - "package_name": "adduser", - "histogram": "[0, 0, 0, 1, 0]" - }, - { - "ratings_total": 3, - "ratings_average": "2.67", - "app_name": "", - "package_name": "xpn", - "histogram": "[1, 1, 0, 0, 1]" - }, - { - "ratings_total": 2, - "ratings_average": "5.00", - "app_name": "", - "package_name": "netgen", - "histogram": "[0, 0, 0, 0, 2]" - }, - { - "ratings_total": 2, - "ratings_average": "2.00", - "app_name": "", - "package_name": "holdingnuts", - "histogram": "[0, 2, 0, 0, 0]" - }, - { - "ratings_total": 8, - "ratings_average": "4.25", - "app_name": "", - "package_name": "parsec47", - "histogram": "[0, 0, 1, 4, 3]" - }, - { - "ratings_total": 15, - "ratings_average": "4.53", - "app_name": "", - "package_name": "blobwars", - "histogram": "[1, 0, 0, 3, 11]" - }, - { - "ratings_total": 49, - "ratings_average": "3.53", - "app_name": "", - "package_name": "visualboyadvance-gtk", - "histogram": "[9, 5, 9, 3, 23]" - } -]
\ No newline at end of file diff --git a/libmuon/backends/ApplicationBackend/ubuntu_sso_dbus_interface.xml b/libmuon/backends/ApplicationBackend/ubuntu_sso_dbus_interface.xml deleted file mode 100644 index cb8dd3c..0000000 --- a/libmuon/backends/ApplicationBackend/ubuntu_sso_dbus_interface.xml +++ /dev/null @@ -1,73 +0,0 @@ -<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" -"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"> -<node name="/com/ubuntu/sso/credentials"> - <interface name="com.ubuntu.sso.CredentialsManagement"> - <signal name="CredentialsError"> - <arg type="s" name="app_name" /> - <arg type="a{ss}" name="error_dict" /> - <annotation name="com.trolltech.QtDBus.QtTypeName.In1" value="QMap<QString,QString>"/> - </signal> - <signal name="CredentialsStored"> - <arg type="s" name="app_name" /> - </signal> - <signal name="CredentialsNotFound"> - <arg type="s" name="app_name" /> - </signal> - <signal name="AuthorizationDenied"> - <arg type="s" name="app_name" /> - </signal> -<!-- - NOTE: this is commented out because the method is called register and it's a c++ reserved keyword and it doesn't work - <method name="register"> - <arg direction="in" type="s" name="app_name" /> - <arg direction="in" type="a{ss}" name="args" /> - <annotation name="com.trolltech.QtDBus.QtTypeName.In1" value="QMap<QString,QString>"/> - </method>--> - <method name="find_credentials_sync"> - <arg direction="in" type="s" name="app_name" /> - <arg direction="in" type="a{ss}" name="args" /> - <annotation name="com.trolltech.QtDBus.QtTypeName.In1" value="QMap<QString,QString>"/> - <arg direction="out" type="a{ss}" /> - <annotation name="com.trolltech.QtDBus.QtTypeName.Out0" value="QMap<QString,QString>"/> - </method> - <method name="find_credentials"> - <arg direction="in" type="s" name="app_name" /> - <arg direction="in" type="a{ss}" name="args" /> - <annotation name="com.trolltech.QtDBus.QtTypeName.In1" value="QMap<QString,QString>"/> - </method> - <signal name="CredentialsCleared"> - <arg type="s" name="app_name" /> - </signal> - <method name="clear_credentials"> - <arg direction="in" type="s" name="app_name" /> - <arg direction="in" type="a{ss}" name="args" /> - <annotation name="com.trolltech.QtDBus.QtTypeName.In1" value="QMap<QString,QString>"/> - </method> - <signal name="CredentialsFound"> - <arg type="s" name="app_name" /> - <arg type="a{ss}" name="credentials" /> - <annotation name="com.trolltech.QtDBus.QtTypeName.In1" value="QMap<QString,QString>"/> - </signal> - <method name="login"> - <arg direction="in" type="s" name="app_name" /> - <arg direction="in" type="a{ss}" name="args" /> - <annotation name="com.trolltech.QtDBus.QtTypeName.In1" value="QMap<QString,QString>"/> - </method> - <method name="login_email_password"> - <arg direction="in" type="s" name="app_name" /> - <arg direction="in" type="a{ss}" name="args" /> - <annotation name="com.trolltech.QtDBus.QtTypeName.In1" value="QMap<QString,QString>"/> - </method> - <method name="store_credentials"> - <arg direction="in" type="s" name="app_name" /> - <arg direction="in" type="a{ss}" name="args" /> - <annotation name="com.trolltech.QtDBus.QtTypeName.In1" value="QMap<QString,QString>"/> - </method> - </interface> - <interface name="org.freedesktop.DBus.Introspectable"> - <method name="Introspect"> - <arg direction="out" type="s" /> - </method> - </interface> -</node> - diff --git a/libmuon/backends/BodegaBackend/BodegaBackend.cpp b/libmuon/backends/BodegaBackend/BodegaBackend.cpp deleted file mode 100644 index a5b20bc..0000000 --- a/libmuon/backends/BodegaBackend/BodegaBackend.cpp +++ /dev/null @@ -1,253 +0,0 @@ -/*************************************************************************** - * Copyright © 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "BodegaBackend.h" -#include "BodegaResource.h" -#include <Transaction/Transaction.h> -#include <Transaction/TransactionModel.h> -#include <bodega/session.h> -#include <bodega/channelsjob.h> -#include <bodega/signonjob.h> -#include <bodega/installjob.h> -#include <bodega/uninstalljob.h> -#include <kwallet.h> -#include <KDebug> -#include <KAboutData> -#include <KPluginFactory> -#include <KPasswordDialog> -#include <KDesktopFile> -#include <QDebug> - -MUON_BACKEND_PLUGIN(BodegaBackend) - -QMap<QString,QString> retrieveCredentials(const QString& folderName) -{ - QMap<QString,QString> ret; - KWallet::Wallet *wallet = KWallet::Wallet::openWallet(KWallet::Wallet::NetworkWallet(), 0, KWallet::Wallet::Synchronous); - if (wallet && wallet->isOpen()) { - bool folderExists = wallet->setFolder(folderName); - if (folderExists) { - QMap<QString, QString> map; - - if (wallet->readMap("credentials", map) == 0 && map.contains("username") && map.contains("password")) { - ret["username"] = map.value("username"); - ret["password"] = map.value("password"); - } else { - qWarning() << "Unable to read credentials from wallet"; - } - } - - if (ret.isEmpty()) { - QPointer<KPasswordDialog> dialog(new KPasswordDialog(0, KPasswordDialog::ShowKeepPassword|KPasswordDialog::ShowUsernameLine)); - dialog->setPrompt(i18n("Enter %1 credentials for MakePlayLive (http://makeplaylive.com)", folderName)); - dialog->exec(); - ret["username"] = dialog->username(); - ret["password"] = dialog->password(); - if(dialog->keepPassword()) { - folderExists = (folderExists || wallet->createFolder(folderName)) && - wallet->setFolder(folderName) && - wallet->writeMap("credentials", ret)==0; - } - delete dialog; - } - } else { - qWarning() << "Unable to open wallet"; - } - - return ret; -} - -BodegaBackend::BodegaBackend(QObject* parent) - : AbstractResourcesBackend(parent) - , m_fetching(false) -{} - -BodegaBackend::~BodegaBackend() -{} - -void BodegaBackend::setMetaData(const QString& path) -{ - KDesktopFile cfg(path); - KConfigGroup service = cfg.group("Desktop File"); - - m_icon = service.readEntry("Icon", QString()); - QUrl url = service.readEntry("X-Muon-Arguments", QString()); - m_channel = url.queryItemValue("channel"); - QString storeId = url.queryItemValue("storeId"); - QMap<QString,QString> credentials = retrieveCredentials(url.queryItemValue("credentials")); - url.setQueryItems(QList<QPair<QString,QString> >()); - - m_session = new Bodega::Session(this); - m_session->setUserName(credentials["username"]); - m_session->setPassword(credentials["password"]); - m_session->setBaseUrl(url); - m_session->setStoreId(storeId); - connect(m_session, SIGNAL(authenticated(bool)), SLOT(resetResources())); - m_session->signOn(); -} - -void BodegaBackend::resetResources() -{ - if(!m_session->isAuthenticated()) { - qDebug() << "not authenticated!" << m_session->userName(); - return; - } - - Bodega::ChannelsJob* job = m_session->channels(); - connect(job, SIGNAL(jobFinished(Bodega::NetworkJob*)), SLOT(channelsRetrieved(Bodega::NetworkJob*))); -} - -void BodegaBackend::channelsRetrieved(Bodega::NetworkJob* job) -{ - qDebug() << "channels received"; - Bodega::ChannelsJob* ballotsJob = qobject_cast<Bodega::ChannelsJob*>(job); - QList<Bodega::ChannelInfo> channels = ballotsJob->channels(); - - foreach(const Bodega::ChannelInfo& c, channels) { - if(c.name == m_channel) { - Bodega::ChannelsJob* wallpapersChannel = m_session->channels(c.id); - connect(wallpapersChannel, SIGNAL(jobFinished(Bodega::NetworkJob*)), SLOT(dataReceived(Bodega::NetworkJob*))); - } - } -} - -void BodegaBackend::dataReceived(Bodega::NetworkJob* job) -{ - Bodega::ChannelsJob* cjob = qobject_cast<Bodega::ChannelsJob*>(job); - QList<Bodega::AssetInfo> assets = cjob->assets(); - - setFetching(true); - foreach(const Bodega::AssetInfo& a, assets) { - m_resourcesByName.insert(a.name, new BodegaResource(a, this)); - } - setFetching(false); -} - -QVector<AbstractResource*> BodegaBackend::allResources() const -{ - return m_resourcesByName.values().toVector(); -} - -QList<AbstractResource*> BodegaBackend::searchPackageName(const QString& searchText){ - QList<AbstractResource*> ret; - foreach(AbstractResource* r, m_resourcesByName) { - if(r->name().contains(searchText, Qt::CaseInsensitive) || r->comment().contains(searchText, Qt::CaseInsensitive)) - ret += r; - } - return ret; -} - -AbstractResource* BodegaBackend::resourceByPackageName(const QString& name) const -{ - return m_resourcesByName.value(name); -} - -AbstractBackendUpdater* BodegaBackend::backendUpdater() const -{ return 0; } - -void BodegaBackend::installApplication(AbstractResource* app, AddonList addons) -{ - Q_ASSERT(m_transactions.count()==0); - Q_ASSERT(addons.isEmpty()); - BodegaResource* res = qobject_cast<BodegaResource*>(app); - Transaction* t = new Transaction(this, res, Transaction::InstallRole); - TransactionModel *transModel = TransactionModel::global(); - transModel->addTransaction(t); - m_transactions.append(t); - t->setStatus(Transaction::CommittingStatus); - - Bodega::InstallJob* job = m_session->install(res->assetOperations()); - t->setProperty("job", qVariantFromValue<QObject*>(job)); - connect(job, SIGNAL(jobFinished(Bodega::NetworkJob*)), SLOT(removeTransaction(Bodega::NetworkJob*))); -} - -void BodegaBackend::removeApplication(AbstractResource* app) -{ - Q_ASSERT(m_transactions.count()==0); - BodegaResource* res = qobject_cast<BodegaResource*>(app); - Transaction* t = new Transaction(this, res, Transaction::RemoveRole); - TransactionModel *transModel = TransactionModel::global(); - transModel->addTransaction(t); - m_transactions.append(t); - t->setStatus(Transaction::CommittingStatus); - - Bodega::UninstallJob* job = m_session->uninstall(res->assetOperations()); - t->setProperty("job", qVariantFromValue<QObject*>(job)); - connect(job, SIGNAL(jobFinished(Bodega::UninstallJob*)), SLOT(removeTransaction(Bodega::UninstallJob*))); -} - -void BodegaBackend::removeTransaction(Bodega::NetworkJob* job) { removeTransactionGeneric(job); } -void BodegaBackend::removeTransaction(Bodega::UninstallJob* job) { removeTransactionGeneric(job); } - -void BodegaBackend::removeTransactionGeneric(QObject* job) -{ - Q_ASSERT(m_transactions.count()==1); - if(job->property("failed").toBool()) { - qDebug() << "job failed" << job->metaObject()->className() << job->property("error").value<Bodega::Error>().title(); - } - - qDebug() << "finished" << job; - TransactionModel *transModel = TransactionModel::global(); - foreach(Transaction* t, m_transactions) { - if(t->property("job").value<QObject*>() == job) { - t->setStatus(Transaction::DoneStatus); - transModel->removeTransaction(t); - m_transactions.removeAll(t); - delete t; - break; - } - } -} - -void BodegaBackend::cancelTransaction(AbstractResource* app) -{ - foreach(Transaction* t, m_transactions) { - if(t->resource() == app) { - Bodega::NetworkJob* job = qobject_cast<Bodega::NetworkJob*>(t->property("job").value<QObject*>()); - job->reply()->abort(); - m_transactions.removeAll(t); - TransactionModel::global()->cancelTransaction(t); - delete t; - break; - } - } -} - -AbstractReviewsBackend* BodegaBackend::reviewsBackend() const { return nullptr; } - -int BodegaBackend::updatesCount() const { return upgradeablePackages().count(); } - -QList<AbstractResource*> BodegaBackend::upgradeablePackages() const -{ - QList<AbstractResource*> ret; - foreach(AbstractResource* res, m_resourcesByName.values()) { - if(res->state()==AbstractResource::Upgradeable) - ret += res; - } - return ret; -} - -void BodegaBackend::setFetching(bool f) -{ - if(f!=m_fetching) { - m_fetching = f; - emit fetchingChanged(); - } -} diff --git a/libmuon/backends/BodegaBackend/BodegaBackend.h b/libmuon/backends/BodegaBackend/BodegaBackend.h deleted file mode 100644 index 40b2149..0000000 --- a/libmuon/backends/BodegaBackend/BodegaBackend.h +++ /dev/null @@ -1,83 +0,0 @@ -/*************************************************************************** - * Copyright © 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef BODEGABACKEND_H -#define BODEGABACKEND_H - -#include <resources/AbstractResourcesBackend.h> -#include "libMuonCommon_export.h" -#include <Transaction/AddonList.h> -#include <Transaction/Transaction.h> -#include <QHash> -#include <QVariantList> - -class BodegaResource; -namespace Bodega { - class Session; - class NetworkJob; - class UninstallJob; -} - -class MUONCOMMON_EXPORT BodegaBackend : public AbstractResourcesBackend -{ -Q_OBJECT -public: - explicit BodegaBackend(QObject* parent = 0); - virtual ~BodegaBackend(); - - virtual void setMetaData(const QString& path); - virtual void cancelTransaction(AbstractResource* app); - virtual void removeApplication(AbstractResource* app); - virtual void installApplication(AbstractResource* app, AddonList addons); - virtual void installApplication(AbstractResource* app) { installApplication(app, AddonList()); } - virtual AbstractResource* resourceByPackageName(const QString& name) const; - virtual int updatesCount() const; - virtual AbstractReviewsBackend* reviewsBackend() const; - virtual QList<AbstractResource*> searchPackageName(const QString& searchText); - virtual QVector< AbstractResource* > allResources() const; - virtual AbstractBackendUpdater* backendUpdater() const; - virtual bool isFetching() const { return m_fetching; } - virtual bool isValid() const { return true; } // No external file dependencies that could cause runtime errors - - QList<AbstractResource*> upgradeablePackages() const; - - Bodega::Session* session() const { return m_session; } - QString icon() const { return m_icon; } - -public slots: - void channelsRetrieved(Bodega::NetworkJob*); - void resetResources(); - void dataReceived(Bodega::NetworkJob*); - void removeTransaction(Bodega::NetworkJob* job); - void removeTransaction(Bodega::UninstallJob* job); - void removeTransactionGeneric(QObject* job); - -private: - void setFetching(bool f); - - Bodega::Session* m_session; - QHash<QString, AbstractResource*> m_resourcesByName; - QList<Transaction*> m_transactions; - QString m_channel; - QString m_icon; - bool m_fetching; -}; - -#endif // BODEGABACKEND_H diff --git a/libmuon/backends/BodegaBackend/BodegaResource.cpp b/libmuon/backends/BodegaBackend/BodegaResource.cpp deleted file mode 100644 index ff9163f..0000000 --- a/libmuon/backends/BodegaBackend/BodegaResource.cpp +++ /dev/null @@ -1,108 +0,0 @@ -/*************************************************************************** - * Copyright © 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "BodegaResource.h" -#include "BodegaBackend.h" -#include <bodega/session.h> -#include <bodega/assetoperations.h> -#include <KLocalizedString> -#include <KGlobal> -#include <KLocalizedString> -#include <QDebug> - -BodegaResource::BodegaResource(const Bodega::AssetInfo& info, AbstractResourcesBackend* parent) - : AbstractResource(parent) - , m_info(info) - , m_assetOperations(0) -{} - -BodegaBackend* BodegaResource::backend() const -{ - return qobject_cast<BodegaBackend*>(parent()); -} - -QUrl BodegaResource::screenshotUrl() -{ - return m_info.images.value(Bodega::ImageLarge, - m_info.images.value(Bodega::ImageHuge, - m_info.images.value(Bodega::ImageMedium))); -} - -QUrl BodegaResource::thumbnailUrl() -{ - return m_info.images.value(Bodega::ImageMedium); -} - -AbstractResource::State BodegaResource::state() -{ - Bodega::AssetOperations* ops = assetOperations(); - if(!ops->isReady()) - return AbstractResource::Broken; - return ops->isInstalled() ? AbstractResource::Installed : AbstractResource::None; -} - -QString BodegaResource::icon() const -{ - return backend()->icon(); -} - -Bodega::AssetOperations* BodegaResource::assetOperations() -{ - if(!m_assetOperations) { - Bodega::Session* session = backend()->session(); - m_assetOperations = session->assetOperations(m_info.id); - connect(m_assetOperations, SIGNAL(installedChanged()), SIGNAL(stateChanged())); - } - return m_assetOperations; -} - -QStringList BodegaResource::categories() -{ - return QStringList(assetOperations()->assetTags().value("mimetype")); -} - -int BodegaResource::size() -{ - //TODO - return 0; -} - -void BodegaResource::fetchChangelog() -{ - Bodega::ChangeLog log = assetOperations()->changeLog(); - QString description; - - for(QMap<QString, Bodega::ChangeLog::Entry>::const_iterator it=log.entries.constBegin(), itEnd=log.entries.constEnd(); - it!=itEnd; ++it) - { - description += i18nc("@info:label Refers to a software version, Ex: Version 1.2.1:", "Version %1:", it.key()); - - QString issueDate = KGlobal::locale()->formatDateTime(QDateTime(it->timestamp), KLocale::ShortDate); - description += QLatin1String("<p>") + - i18nc("@info:label", "This update was issued on %1", issueDate) + - QLatin1String("</p>"); - - QString updateText = it->changes; - updateText.replace('\n', QLatin1String("<br/>")); - description += QLatin1String("<p><pre>") + updateText + QLatin1String("</pre></p>"); - } - - emit changelogFetched(description); -} diff --git a/libmuon/backends/BodegaBackend/BodegaResource.h b/libmuon/backends/BodegaBackend/BodegaResource.h deleted file mode 100644 index d043127..0000000 --- a/libmuon/backends/BodegaBackend/BodegaResource.h +++ /dev/null @@ -1,68 +0,0 @@ -/*************************************************************************** - * Copyright © 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef BODEGARESOURCE_H -#define BODEGARESOURCE_H - -#include <resources/AbstractResource.h> -#include <bodega/globals.h> - -class BodegaBackend; -namespace Bodega { - class AssetInfo; - class AssetOperations; -} - -class BodegaResource : public AbstractResource -{ - Q_OBJECT - public: - explicit BodegaResource(const Bodega::AssetInfo& info, AbstractResourcesBackend* parent); - - virtual QUrl homepage() { return QUrl(); } - virtual QString section() { return "123"; } - virtual QString installedVersion() const { return "only"; } - virtual QString origin() const { return "fuuu"; } - - virtual QStringList categories(); - virtual QList<PackageState> addonsInformation() { return QList<PackageState>(); } - virtual QString name() { return m_info.name; } - virtual QString availableVersion() const { return m_info.version; } - virtual QString comment() { return m_info.description; } //TODO: figure out difference. add author - virtual QString longDescription() { return m_info.description; } - virtual QString packageName() const { return m_info.id; } - virtual QString license() { return m_info.license; } - virtual int size(); - virtual void fetchChangelog(); - virtual QUrl screenshotUrl(); - virtual QUrl thumbnailUrl(); - virtual State state(); - virtual QString icon() const; - - QString assetId() const { return m_info.id; } - Bodega::AssetOperations* assetOperations(); - - private: - BodegaBackend* backend() const; - Bodega::AssetInfo m_info; - Bodega::AssetOperations* m_assetOperations; -}; - -#endif // BODEGARESOURCE_H diff --git a/libmuon/backends/BodegaBackend/CMakeLists.txt b/libmuon/backends/BodegaBackend/CMakeLists.txt deleted file mode 100644 index f8cf034..0000000 --- a/libmuon/backends/BodegaBackend/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -set(bodegabackend_SRCS - BodegaBackend.cpp - BodegaResource.cpp -) - -add_library(muon-bodegabackend MODULE ${bodegabackend_SRCS}) -target_link_libraries(muon-bodegabackend MuonCommon Qt5::Core ${KDE4_KDEUI_LIBS} ${BODEGA_LIBRARIES}) - -install(TARGETS muon-bodegabackend DESTINATION ${PLUGIN_INSTALL_DIR}/muon) -install(FILES muon-bodegawallpapers-backend.desktop DESTINATION ${DATA_INSTALL_DIR}/libmuon/backends) - -install(FILES muon-bodegawallpapers-backend-categories.xml DESTINATION ${DATA_INSTALL_DIR}/libmuon/categories) diff --git a/libmuon/backends/BodegaBackend/muon-bodegawallpapers-backend-categories.xml b/libmuon/backends/BodegaBackend/muon-bodegawallpapers-backend-categories.xml deleted file mode 100644 index 46b2c18..0000000 --- a/libmuon/backends/BodegaBackend/muon-bodegawallpapers-backend-categories.xml +++ /dev/null @@ -1,14 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<Menu> - - <Menu> - <Name>Wallpapers</Name> - <Icon>plasma</Icon> - <Include> - <Or> - <Category>application/x-desktop-wallpaper</Category> - </Or> - </Include> - </Menu> - -</Menu>
\ No newline at end of file diff --git a/libmuon/backends/BodegaBackend/muon-bodegawallpapers-backend.desktop b/libmuon/backends/BodegaBackend/muon-bodegawallpapers-backend.desktop deleted file mode 100644 index 562ba06..0000000 --- a/libmuon/backends/BodegaBackend/muon-bodegawallpapers-backend.desktop +++ /dev/null @@ -1,144 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=Muon/Backend -Exec=blubb -Icon=preferences-desktop-wallpaper -Name=Bodega Wallpapers -Name[ast]=Fondos de pantalla Bodega -Name[bs]=Bodega pozadinske slike -Name[ca]=Fons d'escriptori del Bodega -Name[ca@valencia]=Fons d'escriptori del Bodega -Name[cs]=Tapety Bodega -Name[da]=Bodega-baggrundsbilleder -Name[de]=Bodega-Hintergrundbilder -Name[el]=Ταπετσαρίες Bodega -Name[en_GB]=Bodega Wallpapers -Name[es]=Fondos de escritorio de Bodega -Name[et]=Bodega taustapildid -Name[fi]=Bodega-taustakuvat -Name[fr]=Papiers peints de « Bodega » -Name[gl]=Fondos de escritorio Bodega -Name[hu]=Bodega háttérképek -Name[id]=Wallpaper Bodega -Name[it]=Sfondi Bodega -Name[kk]=Bodega тұсқағаздары -Name[ko]=Bodega 배경 그림 -Name[lt]=Bodega darbastalio paveikslėliai -Name[mr]=बोडेगा वॉलपेपर्स -Name[nb]=Bodega tapeter -Name[nds]=Bodega-Achtergrundbiller -Name[nl]=Bodega-bureaubladachtergronden -Name[nn]=Bodega-bakgrunnsbilete -Name[pl]=Tapety Bodega -Name[pt]=Papéis de Parede do Bodega -Name[pt_BR]=Papéis de parede do Bodega -Name[ro]=Tapete Bodega -Name[ru]=Обои Bodega -Name[sk]=Tapety Bodega -Name[sl]=Slike ozadja Bodega -Name[sr]=Бодегини тапети -Name[sr@ijekavian]=Бодегини тапети -Name[sr@ijekavianlatin]=Bodegini tapeti -Name[sr@latin]=Bodegini tapeti -Name[sv]=Bodega skrivbordsunderlägg -Name[tr]=Bodega Duvar Kağıtları -Name[uk]=Шпалери Bodega -Name[x-test]=xxBodega Wallpapersxx -Name[zh_CN]=Bodega 壁纸 -Name[zh_TW]=Bodega 桌布 -GenericName=Wallpapers -GenericName[ast]=Fondos de pantalla -GenericName[bg]=Тапети -GenericName[bs]=Pozadinske slike -GenericName[ca]=Fons d'escriptori -GenericName[ca@valencia]=Fons d'escriptori -GenericName[cs]=Tapety -GenericName[da]=Baggrundsbilleder -GenericName[de]=Hintergrundbilder -GenericName[el]=Ταπετσαρίες -GenericName[en_GB]=Wallpapers -GenericName[es]=Fondos de escritorio -GenericName[et]=Taustapildid -GenericName[fi]=Taustakuvat -GenericName[fr]=Papiers peints -GenericName[gl]=Fondos de escritorio -GenericName[hu]=Háttérképek -GenericName[id]=Wallpaper -GenericName[it]=Sfondi -GenericName[kk]=Тұсқағаздар -GenericName[ko]=배경 그림 -GenericName[lt]=Darbastalio paveikslėliai -GenericName[mr]=वॉलपेपर्स -GenericName[nb]=Tapeter -GenericName[nds]=Achtergrundbiller -GenericName[nl]=Bureaubladachtergronden -GenericName[nn]=Bakgrunnsbilete -GenericName[pa]=ਵਾਲਪੇਪਰ -GenericName[pl]=Tapety -GenericName[pt]=Papéis de Parede -GenericName[pt_BR]=Papéis de parede -GenericName[ro]=Tapete -GenericName[ru]=Обои -GenericName[sk]=Tapety -GenericName[sl]=Slike ozadja -GenericName[sr]=Тапети -GenericName[sr@ijekavian]=Тапети -GenericName[sr@ijekavianlatin]=Tapeti -GenericName[sr@latin]=Tapeti -GenericName[sv]=Skrivbordsunderlägg -GenericName[tr]=Duvar Kağıtları -GenericName[ug]=تام قەغەزلىرى -GenericName[uk]=Шпалери -GenericName[x-test]=xxWallpapersxx -GenericName[zh_CN]=壁纸 -GenericName[zh_TW]=桌布 -Comment=Install new, awesome wallpapers for your KDE! -Comment[ast]=¡Instala fondos de pantalla nuevos y ablucantes pal to KDE! -Comment[bg]=Инсталирайте нови, прекрасни тапети за вашата среда! -Comment[bs]=Instalirajte nove, lijepe pozadinske slike za vaš KDE -Comment[ca]=Instal·leu fons d'escriptori nous i fantàstics pel vostre KDE! -Comment[ca@valencia]=Instal·leu fons d'escriptori nous i fantàstics pel vostre KDE! -Comment[cs]=Nainstalovat nové skvělé tapety pro vaše KDE. -Comment[da]=Installér nye lækre baggrundsbilleder til din KDE! -Comment[de]=Installiert neue fantastische Hintergrundbilder für Ihr KDE-System. -Comment[el]=Εγκαταστήστε νέες, εκπληκτικές ταπετσαρίες για το δικό σας KDE! -Comment[en_GB]=Install new, awesome wallpapers for your KDE! -Comment[es]=¡Instale nuevos y geniales fondos de escritorio en su KDE! -Comment[et]=KDE uue vaimustava taustapildi paigaldamine -Comment[fi]=Asenna uusia ja mahtavia taustakuvia KDE:hesi! -Comment[fr]=Installez de nouveaux et magnifiques papiers peints pour votre environnement KDE ! -Comment[gl]=Instalar novos e xeniais fondos de escritorio para a túa KDE! -Comment[hu]=Telepítsen új, lélegzetelállító háttérképeket asztalához! -Comment[id]=Pasang baru, wallpaper mengagumkan pada KDE anda! -Comment[it]=Installa nuovi, strabilianti sfondi per il tuo KDE! -Comment[kk]=kDE-ге жаңа, ғажайып тұсқағаздарды орнатыңыз! -Comment[ko]=KDE에 새로운 배경 그림을 설치하십시오! -Comment[lt]=Įdiegti naujus, nuostabius darbastalio paveikslus Jūsų KDE! -Comment[mr]=तुमच्या केडीई करिता नवीन वॉलपेपर्स प्रतिष्ठापीत करा! -Comment[nb]=Installer nye, praktfulle tapeter for din KDE! -Comment[nds]=Nieg smuck Achtergrundbiller för KDE installeren! -Comment[nl]=Installeer nieuwe, geweldige bureaubladachtergronden voor uw KDE! -Comment[nn]=Installer nye, praktfulle bakgrunnsbilete for KDE! -Comment[pl]=Pobierz nowe, wspaniałe tapety dla twojego KDE! -Comment[pt]=Instalar papéis de parede novos e espectaculares para o seu KDE! -Comment[pt_BR]=Instalar papéis de parede novos e incríveis para o seu KDE! -Comment[ro]=Instalați tapete noi și minunate pentru KDE! -Comment[ru]=Новые замечательные обои для KDE! -Comment[sk]=Nainštalujte nové, úžasné tapety pre vaše KDE! -Comment[sl]=Namestite nova, čudovita ozadja namizja za vaš KDE! -Comment[sr]=Инсталирајте нове, фантастичне тапете -Comment[sr@ijekavian]=Инсталирајте нове, фантастичне тапете -Comment[sr@ijekavianlatin]=Instalirajte nove, fantastične tapete -Comment[sr@latin]=Instalirajte nove, fantastične tapete -Comment[sv]=Installera nya fantastiska skrivbordsunderlägg för KDE. -Comment[tr]=KDE'niz için yeni harika duvar kağıtları yükleyin! -Comment[uk]=Встановіть нові чудові шпалери для вашого KDE! -Comment[x-test]=xxInstall new, awesome wallpapers for your KDE!xx -Comment[zh_CN]=为您的 KDE 安装新的、精美的壁纸! -Comment[zh_TW]=為您的 KDE 安裝新的、美美的桌布! -X-KDE-Library=muon-bodegabackend -X-KDE-PluginInfo-Name=muon-bodegawallpapers-backend -X-KDE-PluginInfo-License=GPL - -#channel name -X-Muon-Arguments=http://addons.makeplaylive.com:3000/?channel=Wallpapers&credentials=MakePlayLive&storeId=VIVALDI-1 diff --git a/libmuon/backends/CMakeLists.txt b/libmuon/backends/CMakeLists.txt deleted file mode 100644 index 142cd67..0000000 --- a/libmuon/backends/CMakeLists.txt +++ /dev/null @@ -1,24 +0,0 @@ -if(AKABEICLIENT_FOUND) - add_subdirectory(AkabeiBackend)#TODO: Add checks -endif() - -if(KF5Attica_FOUND AND KF5NewStuff_FOUND) - add_subdirectory(KNSBackend) -endif() - -if(QApt_FOUND) - add_subdirectory(ApplicationBackend) -endif() - -if(BODEGA_FOUND) - add_subdirectory(BodegaBackend) -endif() - -if(packagekitqt5_FOUND AND AppstreamQt_FOUND) - add_subdirectory(PackageKitBackend) -endif() - -option(BUILD_DummyBackend "Build the DummyBackend" "OFF") -if(BUILD_DummyBackend) - add_subdirectory(DummyBackend) -endif() diff --git a/libmuon/backends/DummyBackend/CMakeLists.txt b/libmuon/backends/DummyBackend/CMakeLists.txt deleted file mode 100644 index 2a31ec1..0000000 --- a/libmuon/backends/DummyBackend/CMakeLists.txt +++ /dev/null @@ -1,21 +0,0 @@ -add_subdirectory(tests) - -set(dummy-backend_SRCS - DummyResource.cpp - DummyBackend.cpp - DummyReviewsBackend.cpp - DummyTransaction.cpp - DummySourcesBackend.cpp -) - -add_library(muon-dummy-backend MODULE ${dummy-backend_SRCS}) -target_link_libraries(muon-dummy-backend Qt5::Core Qt5::Widgets KF5::CoreAddons KF5::Service MuonCommon) - -install(TARGETS muon-dummy-backend DESTINATION ${PLUGIN_INSTALL_DIR}/muon) -install(FILES muon-dummy-backend.desktop DESTINATION ${DATA_INSTALL_DIR}/libmuon/backends) -install(FILES muon-dummy-backend-categories.xml DESTINATION ${DATA_INSTALL_DIR}/libmuon/categories) - -add_library(MuonDummyNotifier MODULE DummyNotifier.cpp) -target_link_libraries(MuonDummyNotifier MuonNotifiers) - -install(TARGETS MuonDummyNotifier DESTINATION ${PLUGIN_INSTALL_DIR}/muon-notifier) diff --git a/libmuon/backends/DummyBackend/DummyBackend.cpp b/libmuon/backends/DummyBackend/DummyBackend.cpp deleted file mode 100644 index 118be59..0000000 --- a/libmuon/backends/DummyBackend/DummyBackend.cpp +++ /dev/null @@ -1,202 +0,0 @@ -/*************************************************************************** - * Copyright © 2013 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "DummyBackend.h" -#include "DummyResource.h" -#include "DummyReviewsBackend.h" -#include "DummyTransaction.h" -#include "DummySourcesBackend.h" -#include <resources/StandardBackendUpdater.h> -#include <resources/SourcesModel.h> -#include <Transaction/Transaction.h> -#include <Transaction/TransactionModel.h> - -#include <KAboutData> -#include <KLocalizedString> -#include <KPluginFactory> -#include <KConfigGroup> -#include <KSharedConfig> -#include <QDebug> -#include <QThread> -#include <QTimer> -#include <QAction> - -MUON_BACKEND_PLUGIN(DummyBackend) - -DummyBackend::DummyBackend(QObject* parent) - : AbstractResourcesBackend(parent) - , m_updater(new StandardBackendUpdater(this)) - , m_reviews(new DummyReviewsBackend(this)) - , m_fetching(true) - , m_startElements(320) -{ - QTimer::singleShot(500, this, &DummyBackend::toggleFetching); - connect(m_reviews, &DummyReviewsBackend::ratingsReady, this, &DummyBackend::allDataChanged); -} - -void DummyBackend::setMetaData(const QString& path) -{ - Q_ASSERT(!path.isEmpty()); - KSharedConfig::Ptr cfg = KSharedConfig::openConfig(path); - KConfigGroup metadata = cfg->group(QStringLiteral("Desktop Entry")); - - populate(metadata.readEntry("Name", QString())); - if (!m_fetching) - m_reviews->initialize(); - - QAction* updateAction = new QAction(this); - updateAction->setIcon(QIcon::fromTheme("system-software-update")); - updateAction->setText(i18nc("@action Checks the Internet for updates", "Check for Updates")); - updateAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_R)); - connect(updateAction, SIGNAL(triggered()), SLOT(checkForUpdates())); - - QAction* randomAction = new QAction(this); - randomAction->setIcon(QIcon::fromTheme("kalarm")); - randomAction->setText(QStringLiteral("test bla bla")); - randomAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_T)); - randomAction->setPriority(QAction::LowPriority); - connect(randomAction, &QAction::triggered, this, [](){ qDebug() << "random action triggered"; }); - -// QAction* importantAction = new QAction(this); -// importantAction->setIcon(QIcon::fromTheme("kalarm")); -// importantAction->setText(QStringLiteral("Amaze!")); -// importantAction->setWhatsThis(QStringLiteral("Wo Wo I'm so important")); -// importantAction->setPriority(QAction::HighPriority); -// connect(importantAction, &QAction::triggered, this, [importantAction](){ -// importantAction->setEnabled(false); -// qDebug() << "important action triggered"; -// }); - - m_messageActions = QList<QAction*>() << updateAction << randomAction /*<< importantAction*/; - - SourcesModel::global()->addSourcesBackend(new DummySourcesBackend(this)); -} - -void DummyBackend::populate(const QString& n) -{ - int start = m_resources.count(); - for(int i=start; i<start+m_startElements; i++) { - QString name = n+' '+QString::number(i); - DummyResource* res = new DummyResource(name, false, this); - res->setState(AbstractResource::State(1+(i%3))); - m_resources.insert(name, res); - connect(res, SIGNAL(stateChanged()), SIGNAL(updatesCountChanged())); - } - - for(int i=start; i<start+m_startElements; i++) { - QString name = "techie"+QString::number(i); - DummyResource* res = new DummyResource(name, true, this); - res->setState(AbstractResource::State(1+(i%3))); - m_resources.insert(name, res); - connect(res, SIGNAL(stateChanged()), SIGNAL(updatesCountChanged())); - } -} - -void DummyBackend::toggleFetching() -{ - m_fetching = !m_fetching; - qDebug() << "fetching..." << m_fetching; - emit fetchingChanged(); - if (!m_fetching) - m_reviews->initialize(); -} - -QVector<AbstractResource*> DummyBackend::allResources() const -{ - Q_ASSERT(!m_fetching); - QVector<AbstractResource*> ret; - ret.reserve(m_resources.size()); - foreach(AbstractResource* res, m_resources) { - ret += res; - } - return ret; -} - -int DummyBackend::updatesCount() const -{ - return upgradeablePackages().count(); -} - -QList<AbstractResource*> DummyBackend::upgradeablePackages() const -{ - QList<AbstractResource*> updates; - foreach(AbstractResource* res, m_resources) { - if(res->state()==AbstractResource::Upgradeable) - updates += res; - } - return updates; -} - -AbstractResource* DummyBackend::resourceByPackageName(const QString& name) const -{ - return m_resources.value(name); -} - -QList<AbstractResource*> DummyBackend::searchPackageName(const QString& searchText) -{ - QList<AbstractResource*> ret; - foreach(AbstractResource* r, m_resources) { - if(r->name().contains(searchText, Qt::CaseInsensitive) || r->comment().contains(searchText, Qt::CaseInsensitive)) - ret += r; - } - return ret; -} - -AbstractBackendUpdater* DummyBackend::backendUpdater() const -{ - return m_updater; -} - -AbstractReviewsBackend* DummyBackend::reviewsBackend() const -{ - return m_reviews; -} - -void DummyBackend::installApplication(AbstractResource* app, AddonList addons) -{ - TransactionModel *transModel = TransactionModel::global(); - transModel->addTransaction(new DummyTransaction(qobject_cast<DummyResource*>(app), addons, Transaction::InstallRole)); -} - -void DummyBackend::installApplication(AbstractResource* app) -{ - TransactionModel *transModel = TransactionModel::global(); - transModel->addTransaction(new DummyTransaction(qobject_cast<DummyResource*>(app), Transaction::InstallRole)); -} - -void DummyBackend::removeApplication(AbstractResource* app) -{ - TransactionModel *transModel = TransactionModel::global(); - transModel->addTransaction(new DummyTransaction(qobject_cast<DummyResource*>(app), Transaction::RemoveRole)); -} - -void DummyBackend::cancelTransaction(AbstractResource*) -{} - -void DummyBackend::checkForUpdates() -{ - if(m_fetching) - return; - toggleFetching(); - populate("Moar"); - QTimer::singleShot(500, this, SLOT(toggleFetching())); -} - -#include "DummyBackend.moc" diff --git a/libmuon/backends/DummyBackend/DummyBackend.h b/libmuon/backends/DummyBackend/DummyBackend.h deleted file mode 100644 index 01d530f..0000000 --- a/libmuon/backends/DummyBackend/DummyBackend.h +++ /dev/null @@ -1,70 +0,0 @@ -/*************************************************************************** - * Copyright © 2013 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef DUMMYBACKEND_H -#define DUMMYBACKEND_H - -#include <resources/AbstractResourcesBackend.h> -#include <QVariantList> - -class QAction; -class DummyReviewsBackend; -class StandardBackendUpdater; -class DummyResource; -class DummyBackend : public AbstractResourcesBackend -{ -Q_OBJECT -Q_PROPERTY(int startElements MEMBER m_startElements) -public: - explicit DummyBackend(QObject* parent = nullptr); - - virtual void setMetaData(const QString& path) override; - virtual QList<AbstractResource*> upgradeablePackages() const override; - virtual AbstractResource* resourceByPackageName(const QString& name) const override; - virtual int updatesCount() const override; - virtual AbstractBackendUpdater* backendUpdater() const override; - virtual AbstractReviewsBackend* reviewsBackend() const override; - virtual QList<AbstractResource*> searchPackageName(const QString& searchText) override; - virtual QVector<AbstractResource*> allResources() const override; - virtual bool isValid() const override { return true; } // No external file dependencies that could cause runtime errors - virtual QList<QAction*> messageActions() const override { return m_messageActions; } - - virtual void cancelTransaction(AbstractResource* app) override; - virtual void installApplication(AbstractResource* app) override; - virtual void installApplication(AbstractResource* app, AddonList addons) override; - virtual void removeApplication(AbstractResource* app) override; - virtual bool isFetching() const override { return m_fetching; } - -public slots: - void checkForUpdates(); - void toggleFetching(); - -private: - void populate(const QString& name); - - QHash<QString, DummyResource*> m_resources; - StandardBackendUpdater* m_updater; - DummyReviewsBackend* m_reviews; - bool m_fetching; - int m_startElements; - QList<QAction*> m_messageActions; -}; - -#endif // DUMMYBACKEND_H diff --git a/libmuon/backends/DummyBackend/DummyNotifier.cpp b/libmuon/backends/DummyBackend/DummyNotifier.cpp deleted file mode 100644 index 1ac6a73..0000000 --- a/libmuon/backends/DummyBackend/DummyNotifier.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/*************************************************************************** - * Copyright © 2013 Lukas Appelhans <l.appelhans@gmx.de> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ -#include "DummyNotifier.h" - -#include <QDebug> - -DummyNotifier::DummyNotifier(QObject* parent) - : BackendNotifierModule(parent) -{ -} - -DummyNotifier::~DummyNotifier() -{ -} - -void DummyNotifier::recheckSystemUpdateNeeded() -{ - emit foundUpdates(); -} - -bool DummyNotifier::isSystemUpToDate() const -{ - return true; -} - -uint DummyNotifier::securityUpdatesCount() -{ - return 0; -} - -uint DummyNotifier::updatesCount() -{ - return 0; -} - -#include "DummyNotifier.moc" diff --git a/libmuon/backends/DummyBackend/DummyNotifier.h b/libmuon/backends/DummyBackend/DummyNotifier.h deleted file mode 100644 index 9426c01..0000000 --- a/libmuon/backends/DummyBackend/DummyNotifier.h +++ /dev/null @@ -1,40 +0,0 @@ -/*************************************************************************** - * Copyright © 2013 Lukas Appelhans <l.appelhans@gmx.de> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ -#ifndef DUMMYNOTIFIER_H -#define DUMMYNOTIFIER_H - -#include <BackendNotifierModule.h> - -class DummyNotifier : public BackendNotifierModule -{ -Q_OBJECT -Q_PLUGIN_METADATA(IID "org.kde.muon.BackendNotifierModule") -Q_INTERFACES(BackendNotifierModule) -public: - DummyNotifier(QObject* parent = nullptr); - virtual ~DummyNotifier(); - - virtual bool isSystemUpToDate() const Q_DECL_OVERRIDE; - virtual void recheckSystemUpdateNeeded() Q_DECL_OVERRIDE; - virtual uint securityUpdatesCount() Q_DECL_OVERRIDE; - virtual uint updatesCount() Q_DECL_OVERRIDE; -}; - -#endif diff --git a/libmuon/backends/DummyBackend/DummyResource.cpp b/libmuon/backends/DummyBackend/DummyResource.cpp deleted file mode 100644 index ca5ddfa..0000000 --- a/libmuon/backends/DummyBackend/DummyResource.cpp +++ /dev/null @@ -1,192 +0,0 @@ -/*************************************************************************** - * Copyright © 2013 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "DummyResource.h" -#include <Transaction/AddonList.h> -#include <krandom.h> -#include <QDesktopServices> -#include <QStringList> -#include <QTimer> - -static QVector<QString> s_icons = { "kdevelop", "kalgebra", "kmail", "akregator", "korganizer" }; - -DummyResource::DummyResource(QString name, bool isTechnical, AbstractResourcesBackend* parent) - : AbstractResource(parent) - , m_name(std::move(name)) - , m_state(State::Broken) - , m_addons({ PackageState("a", "aaaaaa", false), PackageState("b", "aaaaaa", false), PackageState("c", "aaaaaa", false)}) - , m_isTechnical(isTechnical) -{ - if(KRandom::random() % 2) { - m_screenshot = QUrl("http://screenshots.debian.net/screenshots/d/dolphin/9383_large.png"); - m_screenshotThumbnail = QUrl("http://screenshots.debian.net/screenshots/d/dolphin/9383_small.png"); - } - m_iconName = s_icons[KRandom::random() % s_icons.size()]; - -// if((KRandom::random() % 100) == 0) { -// enableStateChanges(); -// } -} - -void DummyResource::enableStateChanges() -{ - QTimer* t = new QTimer(this); - t->setSingleShot(false); - t->setInterval(500); - connect(t, &QTimer::timeout, this, [this](){ - int s = (m_state+1) % 4; - setState(State(s)); - }); - t->start(); -} - - -QList<PackageState> DummyResource::addonsInformation() -{ - return m_addons; -} - -QString DummyResource::availableVersion() const -{ - return "3.0"; -} - -QStringList DummyResource::categories() -{ - return QStringList("dummy"); -} - -QString DummyResource::comment() -{ - return "comment "+name()+"..."; -} - -int DummyResource::size() -{ - return 123; -} - -QUrl DummyResource::homepage() -{ - return QUrl("http://kde.org"); -} - -QString DummyResource::icon() const -{ - return isTechnical() ? "kalarm" : m_iconName; -} - -QString DummyResource::installedVersion() const -{ - return "2.3"; -} - -QString DummyResource::license() -{ - return "GPL"; -} - -QString DummyResource::longDescription() -{ - return "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur ultricies consequat nulla, ut vulputate nulla ultricies ac. Suspendisse lacinia commodo lacus, non tristique mauris dictum vitae. Sed adipiscing augue nec nisi aliquet viverra. Etiam sit amet nulla in tellus consectetur feugiat. Cras in sem tortor. Fusce a nulla at justo accumsan gravida. Maecenas dui felis, lacinia at ornare sed, aliquam et purus. Sed ut sagittis lacus. Etiam dictum pharetra rhoncus. Suspendisse auctor orci ipsum. Pellentesque vitae urna nec felis consequat lobortis dictum in urna. Phasellus a mi ac leo adipiscing varius eget a felis. Cras magna augue, commodo sed placerat vel, tempus vel ligula. In feugiat quam quis est lobortis sed accumsan nunc malesuada. Mauris quis massa sit amet felis tempus suscipit a quis diam.\n\n" - - "Aenean quis nulla erat, vel sagittis sem. Praesent vitae mauris arcu. Cras porttitor, ante at scelerisque sodales, nibh felis consectetur orci, ut hendrerit urna urna non urna. Duis eu magna id mi scelerisque adipiscing. Aliquam sed quam in eros sodales accumsan. Phasellus tempus sagittis suscipit. Aliquam rutrum dictum justo ut viverra. Nulla felis sem, molestie sed scelerisque non, consequat vitae nulla. Aliquam ullamcorper malesuada mi, vel vestibulum magna vulputate eget. In hac habitasse platea dictumst. Cras sed lacus dui, vel semper sem. Aenean sodales porta leo vel fringilla.\n\n" - - "Ut tempus massa et urna porta non mollis metus ultricies. Duis nec nulla ac metus auctor porta id et mi. Mauris aliquam nibh a ligula malesuada sed tincidunt nibh varius. Sed felis metus, porta et adipiscing non, faucibus id leo. Donec ipsum nibh, hendrerit eget aliquam nec, tempor ut mauris. Suspendisse potenti. Vestibulum scelerisque adipiscing libero tristique eleifend. Donec quis tortor eget elit mollis iaculis ac sit amet nisi. Proin non massa sed nunc rutrum pellentesque. Sed dui lectus, laoreet sed condimentum id, commodo sed urna.\n\n" - - "Praesent tincidunt mattis massa mattis porta. Nullam posuere neque at mauris vestibulum vitae elementum leo sodales. Quisque condimentum lectus in libero luctus egestas. Fusce tempor neque ac dui tincidunt eget viverra quam suscipit. In hac habitasse platea dictumst. Etiam metus mi, adipiscing nec suscipit id, aliquet sed sem. Duis urna ligula, ornare sed vestibulum vel, molestie ac nisi. Morbi varius iaculis ligula. Nunc in augue leo, sit amet aliquam elit. Suspendisse rutrum sem diam. Proin eu orci nisl. Praesent porttitor dignissim est, id fermentum arcu venenatis vitae.\n\n" - - "Integer in sapien eget quam vulputate lobortis. Morbi nibh elit, elementum vitae vehicula sed, consequat nec erat. Donec placerat porttitor est ut dapibus. Fusce augue orci, dictum et convallis vel, blandit eu tortor. Phasellus non eros nulla. In iaculis nulla fermentum nulla gravida eu mattis purus consectetur. Integer dui nunc, sollicitudin ac tincidunt nec, hendrerit bibendum nunc. Proin sit amet augue ac velit egestas varius. Sed eu ante quis orci vestibulum sagittis. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Phasellus vitae urna odio, at molestie leo. In convallis neque vel mi dictum convallis lobortis turpis sagittis.\n\n"; -} - -QString DummyResource::name() -{ - return m_name; -} - -QString DummyResource::origin() const -{ - return "DummySource1"; -} - -QString DummyResource::packageName() const -{ - return m_name; -} - -QUrl DummyResource::screenshotUrl() -{ - return m_screenshot; -} - -QUrl DummyResource::thumbnailUrl() -{ - return m_screenshotThumbnail; -} - -QString DummyResource::section() -{ - return "dummy"; -} - -AbstractResource::State DummyResource::state() -{ - return m_state; -} - -void DummyResource::fetchChangelog() -{ - QString log = longDescription(); - log.replace('\n', QStringLiteral("<br />")); - - emit changelogFetched(log); -} - -void DummyResource::setState(AbstractResource::State state) -{ - m_state = state; - emit stateChanged(); -} - -void DummyResource::setAddons(const AddonList& addons) -{ - Q_FOREACH (const QString& toInstall, addons.addonsToInstall()) { - setAddonInstalled(toInstall, true); - } - Q_FOREACH (const QString& toRemove, addons.addonsToRemove()) { - setAddonInstalled(toRemove, false); - } -} - -void DummyResource::setAddonInstalled(const QString& addon, bool installed) -{ - for(auto & elem : m_addons) { - if(elem.name() == addon) { - elem.setInstalled(installed); - } - } -} - - -void DummyResource::invokeApplication() const -{ - QDesktopServices d; - d.openUrl(QUrl("https://projects.kde.org/projects/extragear/sysadmin/muon")); -} diff --git a/libmuon/backends/DummyBackend/DummyResource.h b/libmuon/backends/DummyBackend/DummyResource.h deleted file mode 100644 index 8129df1..0000000 --- a/libmuon/backends/DummyBackend/DummyResource.h +++ /dev/null @@ -1,72 +0,0 @@ -/*************************************************************************** - * Copyright © 2013 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef DUMMYRESOURCE_H -#define DUMMYRESOURCE_H - -#include <resources/AbstractResource.h> - -class AddonList; -class DummyResource : public AbstractResource -{ -Q_OBJECT -public: - explicit DummyResource(QString name, bool isTechnical, AbstractResourcesBackend* parent); - - virtual QList<PackageState> addonsInformation() override; - virtual QString section() override; - virtual QString origin() const override; - virtual QString longDescription() override; - virtual QString availableVersion() const override; - virtual QString installedVersion() const override; - virtual QString license() override; - virtual int size() override; - virtual QUrl screenshotUrl() override; - virtual QUrl thumbnailUrl() override; - virtual QUrl homepage() override; - virtual QStringList categories() override; - virtual AbstractResource::State state() override; - virtual QString icon() const override; - virtual QString comment() override; - virtual QString name() override; - virtual QString packageName() const override; - virtual bool isTechnical() const override { return m_isTechnical; } - virtual bool canExecute() const override { return true; } - virtual void invokeApplication() const override; - virtual void fetchChangelog() override; - void setState(State state); - void setAddons(const AddonList& addons); - - void setAddonInstalled(const QString& addon, bool installed); - -public slots: - void enableStateChanges(); - -public: - QString m_name; - AbstractResource::State m_state; - QUrl m_screenshot; - QUrl m_screenshotThumbnail; - QString m_iconName; - QList<PackageState> m_addons; - bool m_isTechnical; -}; - -#endif // DUMMYRESOURCE_H diff --git a/libmuon/backends/DummyBackend/DummyReviewsBackend.cpp b/libmuon/backends/DummyBackend/DummyReviewsBackend.cpp deleted file mode 100644 index 36b46a8..0000000 --- a/libmuon/backends/DummyBackend/DummyReviewsBackend.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/*************************************************************************** - * Copyright © 2013 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "DummyReviewsBackend.h" -#include "DummyBackend.h" -#include <ReviewsBackend/Review.h> -#include <ReviewsBackend/Rating.h> -#include <resources/AbstractResource.h> -#include <QTimer> -#include <QDebug> - -DummyReviewsBackend::DummyReviewsBackend(DummyBackend* parent) - : AbstractReviewsBackend(parent) -{} - -void DummyReviewsBackend::fetchReviews(AbstractResource* app, int page) -{ - if (page>=5) - return; - - QList<Review*> review; - for(int i=0; i<33; i++) { - review += new Review(app->name(), app->packageName(), "en_US", "good morning", "the morning is very good", "dummy", - QDateTime(), true, page+i, i%5, 1, 1, app->packageName()); - } - emit reviewsReady(app, review); -} - -Rating* DummyReviewsBackend::ratingForApplication(AbstractResource* app) const -{ - return m_ratings[app]; -} - -void DummyReviewsBackend::initialize() -{ - DummyBackend* b = qobject_cast<DummyBackend*>(parent()); - foreach(AbstractResource* app, b->allResources()) { - if (m_ratings.contains(app)) - continue; - Rating* rating = new Rating(app->packageName(), app->name(), 15, qrand()%15, QStringLiteral("\"0, 0, 0, 4, %1\"").arg(qrand()%15)); - m_ratings.insert(app, rating); - } - emit ratingsReady(); -} - -void DummyReviewsBackend::submitUsefulness(Review* r, bool useful) -{ - qDebug() << "usefulness..." << r->applicationName() << r->reviewer() << useful; - r->setUsefulChoice(useful ? ReviewsModel::Yes : ReviewsModel::No); -} diff --git a/libmuon/backends/DummyBackend/DummyReviewsBackend.h b/libmuon/backends/DummyBackend/DummyReviewsBackend.h deleted file mode 100644 index 6b0b963..0000000 --- a/libmuon/backends/DummyBackend/DummyReviewsBackend.h +++ /dev/null @@ -1,55 +0,0 @@ -/*************************************************************************** - * Copyright © 2013 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef DUMMYREVIEWSBACKEND_H -#define DUMMYREVIEWSBACKEND_H - -#include <ReviewsBackend/AbstractReviewsBackend.h> -#include <ReviewsBackend/ReviewsModel.h> -#include <QMap> - -class DummyBackend; -class DummyReviewsBackend : public AbstractReviewsBackend -{ -Q_OBJECT -public: - explicit DummyReviewsBackend(DummyBackend* parent = nullptr); - - virtual QString userName() const override { return "dummy"; } - virtual void login() override {} - virtual void logout() override {} - virtual void registerAndLogin() override {} - - virtual Rating* ratingForApplication(AbstractResource* app) const override; - virtual bool hasCredentials() const override { return false; } - virtual void deleteReview(Review*) override {} - virtual void fetchReviews(AbstractResource* app, int page = 1) override; - virtual bool isFetching() const override { return false; } - virtual void submitReview(AbstractResource*, const QString&, const QString&, const QString&) override {} - virtual void flagReview(Review*, const QString&, const QString&) override {} - virtual void submitUsefulness(Review*, bool) override; - - void initialize(); - -private: - QHash<AbstractResource*, Rating*> m_ratings; -}; - -#endif // DUMMYREVIEWSBACKEND_H diff --git a/libmuon/backends/DummyBackend/DummySourcesBackend.cpp b/libmuon/backends/DummyBackend/DummySourcesBackend.cpp deleted file mode 100644 index 220e4c5..0000000 --- a/libmuon/backends/DummyBackend/DummySourcesBackend.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/*************************************************************************** - * Copyright © 2014 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "DummySourcesBackend.h" -#include <QDebug> -#include <QAction> - -DummySourcesBackend::DummySourcesBackend(QObject* parent) - : AbstractSourcesBackend(parent) - , m_sources(new QStandardItemModel(this)) - , m_testAction(new QAction(QIcon::fromTheme("kalgebra"), QStringLiteral("DummyAction"), this)) -{ - QHash<int, QByteArray> roles = m_sources->roleNames(); - roles.insert(Qt::CheckStateRole, "checked"); - m_sources->setItemRoleNames(roles); - - addSource("DummySource1"); - addSource("DummySource2"); - addSource("DummySource3"); - addSource("DummySource4"); - addSource("DummySource5"); - - connect(m_testAction, &QAction::triggered, [](){ qDebug() << "action triggered!"; }); -} - -QAbstractItemModel* DummySourcesBackend::sources() -{ - return m_sources; -} - -bool DummySourcesBackend::addSource(const QString& id) -{ - QStandardItem* it = new QStandardItem(id); - it->setData(QString(id+" "+id), Qt::ToolTipRole); - m_sources->appendRow(it); - return true; -} - -bool DummySourcesBackend::removeSource(const QString& id) -{ - QList<QStandardItem*> items = m_sources->findItems(id); - if (items.count()==1) { - m_sources->removeRow(items.first()->row()); - } else { - qWarning() << "couldn't find " << id << items; - } - return items.count()==1; -} - -QList<QAction*> DummySourcesBackend::actions() const -{ - return QList<QAction*>() << m_testAction; -} - diff --git a/libmuon/backends/DummyBackend/DummySourcesBackend.h b/libmuon/backends/DummyBackend/DummySourcesBackend.h deleted file mode 100644 index 6c7c1cd..0000000 --- a/libmuon/backends/DummyBackend/DummySourcesBackend.h +++ /dev/null @@ -1,44 +0,0 @@ -/*************************************************************************** - * Copyright © 2014 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef DUMMYSOURCESBACKEND_H -#define DUMMYSOURCESBACKEND_H - -#include <resources/AbstractSourcesBackend.h> -#include <QStandardItemModel> - -class DummySourcesBackend : public AbstractSourcesBackend -{ -public: - DummySourcesBackend(QObject* parent); - - virtual QAbstractItemModel* sources() override; - virtual bool addSource(const QString& id) override; - virtual bool removeSource(const QString& id) override; - virtual QString name() const override { return QStringLiteral("Dummy"); } - virtual QString idDescription() override { return QStringLiteral("Random weird text"); } - virtual QList<QAction*> actions() const override; - -private: - QStandardItemModel* m_sources; - QAction* m_testAction; -}; - -#endif // DUMMYSOURCESBACKEND_H diff --git a/libmuon/backends/DummyBackend/DummyTransaction.cpp b/libmuon/backends/DummyBackend/DummyTransaction.cpp deleted file mode 100644 index 42a8612..0000000 --- a/libmuon/backends/DummyBackend/DummyTransaction.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/*************************************************************************** - * Copyright © 2013 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "DummyTransaction.h" -#include "DummyBackend.h" -#include "DummyResource.h" -#include <Transaction/TransactionModel.h> -#include <QTimer> -#include <QDebug> -#include <KRandom> - -DummyTransaction::DummyTransaction(DummyResource* app, Role action) - : Transaction(app->backend(), app, action) - , m_app(app) -{ - iterateTransaction(); -} - -DummyTransaction::DummyTransaction(DummyResource* app, const AddonList& addons, Transaction::Role role) - : Transaction(app->backend(), app, role, addons) - , m_app(app) -{ - iterateTransaction(); -} - -void DummyTransaction::iterateTransaction() -{ - if(progress()<100) { - setProgress(progress()+(KRandom::random()%30)); - QTimer::singleShot(/*KRandom::random()%*/200, this, SLOT(iterateTransaction())); - } else - finishTransaction(); -} - -void DummyTransaction::finishTransaction() -{ - AbstractResource::State newState; - switch(role()) { - case InstallRole: - case ChangeAddonsRole: - newState = AbstractResource::Installed; - break; - case RemoveRole: - newState = AbstractResource::None; - break; - } - m_app->setState(newState); - m_app->setAddons(addons()); - TransactionModel::global()->removeTransaction(this); - deleteLater(); -} diff --git a/libmuon/backends/DummyBackend/DummyTransaction.h b/libmuon/backends/DummyBackend/DummyTransaction.h deleted file mode 100644 index bf237d3..0000000 --- a/libmuon/backends/DummyBackend/DummyTransaction.h +++ /dev/null @@ -1,42 +0,0 @@ -/*************************************************************************** - * Copyright © 2013 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef DUMMYTRANSACTION_H -#define DUMMYTRANSACTION_H - -#include <Transaction/Transaction.h> - -class DummyResource; -class DummyTransaction : public Transaction -{ - Q_OBJECT - public: - DummyTransaction(DummyResource* app, Role role); - DummyTransaction(DummyResource* app, const AddonList& list, Role role); - - private slots: - void iterateTransaction(); - void finishTransaction(); - - private: - DummyResource* m_app; -}; - -#endif // DUMMYTRANSACTION_H diff --git a/libmuon/backends/DummyBackend/muon-dummy-backend-categories.xml b/libmuon/backends/DummyBackend/muon-dummy-backend-categories.xml deleted file mode 100644 index 6010a46..0000000 --- a/libmuon/backends/DummyBackend/muon-dummy-backend-categories.xml +++ /dev/null @@ -1,111 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<Menu> - <Menu> - <Name>dummy</Name> - <Icon>kalarm</Icon> - <Include> - <Category>dummy</Category> - </Include> - </Menu> - <Menu> - <Name>dummy 1</Name> - <Icon>kontact</Icon> - <Include> - <Category>dummy</Category> - </Include> - </Menu> - <Menu> - <Name>dummy with stuff</Name> - <Icon>kmail</Icon> - <Include> - <Category>dummy</Category> - </Include> - - <Menu> - <Name>dummy 2.1</Name> - <Icon>kalgebra</Icon> - <Include> - <Category>dummy</Category> - </Include> - </Menu> - </Menu> - <Menu> - <Name>dummy with quite some stuff</Name> - <Icon>kmail</Icon> - <Include> - <Category>dummy</Category> - </Include> - - <Menu> - <Name>dummy 2.1</Name> - <Icon>kalgebra</Icon> - <Include> - <Category>dummy</Category> - </Include> - </Menu> - </Menu> - - <Menu> - <Name>dummy 3</Name> - <Icon>kig</Icon> - <Include> - <Category>dummy</Category> - </Include> - </Menu> - <Menu> - <Name>dummy 4</Name> - <Icon>kdeconnect</Icon> - <Include> - <Category>dummy</Category> - </Include> - </Menu> - <Menu> - <Name>dummy 5</Name> - <Icon>kdevelop</Icon> - <Include> - <Category>dummy</Category> - </Include> - </Menu> - <Menu> - <Name>dummy 6</Name> - <Icon>kate</Icon> - <Include> - <Category>dummy</Category> - </Include> - </Menu> - <Menu> - <Name>dummy 7</Name> - <Icon>firefox</Icon> - <Include> - <Category>dummy</Category> - </Include> - </Menu> - <Menu> - <Name>dummy 8</Name> - <Icon>konversation</Icon> - <Include> - <Category>dummy</Category> - </Include> - </Menu> - <Menu> - <Name>dummy 9</Name> - <Icon>chromium</Icon> - <Include> - <Category>dummy</Category> - </Include> - </Menu> - <Menu> - <Name>dummy 10</Name> - <Icon>ktorrent</Icon> - <Include> - <Category>dummy</Category> - </Include> - </Menu> - <Menu> - <Name>dummy 11</Name> - <Icon>akregator</Icon> - <Include> - <Category>dummy</Category> - </Include> - </Menu> -</Menu> diff --git a/libmuon/backends/DummyBackend/muon-dummy-backend.desktop b/libmuon/backends/DummyBackend/muon-dummy-backend.desktop deleted file mode 100644 index 1d21169..0000000 --- a/libmuon/backends/DummyBackend/muon-dummy-backend.desktop +++ /dev/null @@ -1,138 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=Muon/Backend -Exec=blubb -Icon=kalarm -Name=Dummy -Name[ast]=Maniquín -Name[bs]=Bezvezna -Name[ca]=Prova -Name[ca@valencia]=Prova -Name[cs]=Falešný -Name[da]=Attrap -Name[de]=Dummy -Name[el]=Πλασματικό -Name[en_GB]=Dummy -Name[es]=Vacío -Name[et]=Dummy -Name[fi]=Testi -Name[fr]=Factice -Name[gl]=Ensaio -Name[hu]=Névtelen -Name[id]=Tiruan -Name[it]=Fittizio -Name[kk]=Қалып -Name[ko]=더미 -Name[lt]=Butaforinis -Name[mr]=नकल्ल -Name[nb]=Attrapp -Name[nds]=Platzholler -Name[nl]=Dummy -Name[nn]=Eksempel -Name[pl]=Fikcyjny -Name[pt]=Testes -Name[pt_BR]=Teste -Name[ro]=Machetă -Name[ru]=Тестовый модуль -Name[sk]=Prázdne -Name[sl]=Preizkusno -Name[sr]=Лажна -Name[sr@ijekavian]=Лажна -Name[sr@ijekavianlatin]=Lažna -Name[sr@latin]=Lažna -Name[sv]=Test -Name[tr]=Dummy -Name[ug]=مەۋھۇم -Name[uk]=Тест -Name[x-test]=xxDummyxx -Name[zh_CN]=哑 -Name[zh_TW]=虛擬 -GenericName=Dummy -GenericName[ast]=Maniquín -GenericName[bs]=Bezvezna -GenericName[ca]=Prova -GenericName[ca@valencia]=Prova -GenericName[cs]=Falešný -GenericName[da]=Attrap -GenericName[de]=Dummy -GenericName[el]=Πλασματικό -GenericName[en_GB]=Dummy -GenericName[es]=Vacío -GenericName[et]=Dummy -GenericName[fi]=Testi -GenericName[fr]=Factice -GenericName[gl]=Ensaio -GenericName[hu]=Névtelen -GenericName[id]=Tiruan -GenericName[it]=Fittizio -GenericName[kk]=Қалып -GenericName[ko]=더미 -GenericName[lt]=Butaforinis -GenericName[mr]=नकल्ल -GenericName[nb]=Attrapp -GenericName[nds]=Platzholler -GenericName[nl]=Dummy -GenericName[nn]=Eksempel -GenericName[pl]=Fikcyjny -GenericName[pt]=Testes -GenericName[pt_BR]=Teste -GenericName[ro]=Machetă -GenericName[ru]=Тестовый модуль -GenericName[sk]=Prázdne -GenericName[sl]=Preizkusno -GenericName[sr]=Лажна -GenericName[sr@ijekavian]=Лажна -GenericName[sr@ijekavianlatin]=Lažna -GenericName[sr@latin]=Lažna -GenericName[sv]=Test -GenericName[tr]=Dummy -GenericName[ug]=مەۋھۇم -GenericName[uk]=Тест -GenericName[x-test]=xxDummyxx -GenericName[zh_CN]=哑 -GenericName[zh_TW]=虛擬 -Comment=It's some dummy backend for testing purposes -Comment[bs]=Bezvezna pozadina za potrebe testiranja -Comment[ca]=Són alguns dorsals falsos amb la finalitat de fer proves -Comment[ca@valencia]=Són alguns dorsals falsos amb la finalitat de fer proves -Comment[cs]=Falešná podpůrná vrstva pro testovací účely -Comment[da]=Det er en attrap-backend til testformål -Comment[de]=Ein Dummy-Backend zu Testzwecken -Comment[el]=Είναι ένα πλασματικό σύστημα υποστήριξης για δοκιμαστικούς σκοπούς -Comment[en_GB]=It's some dummy backend for testing purposes -Comment[es]=Se trata de un motor vacío pensado para hacer pruebas -Comment[et]=See on fiktiivne taustaprogramm testimiseks -Comment[fi]=Taustajärjestelmä testaustarkoituksiin -Comment[fr]=Ceci est un moteur factice pour des besoins de tests -Comment[gl]=É unha infraestrutura de probas -Comment[hu]=Ez néhány névtelen háttérprogram tesztelési célokra -Comment[id]=Ini adalah beberapa backend tiruan untuk tujuan pengujian -Comment[it]=È un motore fittizio creato a scopo di prova -Comment[kk]=Сынаққа арналған қалып тетігі -Comment[ko]=테스트를 위한 더미 백엔드 -Comment[lt]=Tai fiktyvi galinė sąsaja bandymo tikslais -Comment[mr]=चाचणी करिता डमी बॅकएन्ड -Comment[nb]=Det er en attrapp bakgrunnsmotor for testing -Comment[nds]=En Platzholl-Hülpprogramm för't Utproberen -Comment[nl]=Het is zo'n dummy backend voor testdoeleinden -Comment[nn]=Det er ein eksempelbakgrunnsmotor for testformål -Comment[pl]=Jest to rodzaj fikcyjnego silnika na potrzeby prób -Comment[pt]=É uma infra-estrutura de exemplo para testes -Comment[pt_BR]=Exemplo de infraestrutura para testes -Comment[ro]=Este o machetă de platformă pentru testare -Comment[ru]=Тестовый модуль -Comment[sk]=Je to nejaký prázdny backend na testovacie účely -Comment[sl]=To je preizkusno zaledje za namene preizkušanja -Comment[sr]=Лажна позадина за потребе испробавања -Comment[sr@ijekavian]=Лажна позадина за потребе испробавања -Comment[sr@ijekavianlatin]=Lažna pozadina za potrebe isprobavanja -Comment[sr@latin]=Lažna pozadina za potrebe isprobavanja -Comment[sv]=Ett bakgrundsprogram för KDE:s partitionshanterare i testsyfte -Comment[tr]=Test amaçları için bazı sahte arka uçları -Comment[uk]=Тестовий модуль -Comment[x-test]=xxIt's some dummy backend for testing purposesxx -Comment[zh_CN]=这是用于测试的哑后端 -Comment[zh_TW]=測試用的虛擬後端介面 -X-KDE-Library=muon-dummy-backend -X-KDE-PluginInfo-Name=muon-dummy-backend -X-KDE-PluginInfo-License=GPL diff --git a/libmuon/backends/DummyBackend/tests/CMakeLists.txt b/libmuon/backends/DummyBackend/tests/CMakeLists.txt deleted file mode 100644 index e20f5fe..0000000 --- a/libmuon/backends/DummyBackend/tests/CMakeLists.txt +++ /dev/null @@ -1,15 +0,0 @@ -include_directories(.. ../../ApplicationBackend/tests) - -macro(libmuon_add_unit_test name) - add_executable(${name} ../../ApplicationBackend/tests/modeltest.cpp ${ARGN}) - add_test(${name} ${name}) - ecm_mark_as_test(${name}) - target_link_libraries(${name} - MuonCommon - - Qt5::Test Qt5::Core - KF5::KIOWidgets) -endmacro(libmuon_add_unit_test) - -libmuon_add_unit_test(dummytest DummyTest.cpp) -libmuon_add_unit_test(updatedummytest UpdateDummyTest.cpp) diff --git a/libmuon/backends/DummyBackend/tests/DummyTest.cpp b/libmuon/backends/DummyBackend/tests/DummyTest.cpp deleted file mode 100644 index 35003fe..0000000 --- a/libmuon/backends/DummyBackend/tests/DummyTest.cpp +++ /dev/null @@ -1,194 +0,0 @@ -/*************************************************************************** - * Copyright © 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "DummyTest.h" -#include <resources/ResourcesUpdatesModel.h> -#include <UpdateModel/UpdateModel.h> -#include <modeltest.h> -#include <resources/ResourcesModel.h> -#include <resources/ResourcesProxyModel.h> -#include <resources/AbstractBackendUpdater.h> -#include <ApplicationAddonsModel.h> -#include <Transaction/TransactionModel.h> -#include <ReviewsBackend/ReviewsModel.h> -#include <qtest.h> - -#include <QtTest> -#include <QAction> - -QTEST_MAIN(DummyTest); - -AbstractResourcesBackend* backendByName(ResourcesModel* m, const QString& name) -{ - QVector<AbstractResourcesBackend*> backends = m->backends(); - foreach(AbstractResourcesBackend* backend, backends) { - if(backend->metaObject()->className()==name) { - return backend; - } - } - return nullptr; -} - -DummyTest::DummyTest(QObject* parent): QObject(parent) -{ - m_model = new ResourcesModel("muon-dummy-backend", this); - new ModelTest(m_model, m_model); - - m_appBackend = backendByName(m_model, "DummyBackend"); -} - -void DummyTest::init() -{ - QVERIFY(m_appBackend); - while(m_appBackend->isFetching()) { - QSignalSpy spy(m_appBackend, &AbstractResourcesBackend::fetchingChanged); - QVERIFY(spy.wait()); - } -} - -void DummyTest::testReadData() -{ - QBENCHMARK { - for(int i=0, c=m_model->rowCount(); i<c; i++) { - QModelIndex idx = m_model->index(i, 0); - QVERIFY(!m_model->data(idx, ResourcesModel::NameRole).isNull()); - } - QCOMPARE(m_appBackend->property("startElements").toInt()*2, m_model->rowCount()); - } -} - -void DummyTest::testProxy() -{ - ResourcesProxyModel pm; - pm.setSourceModel(m_model); - QCOMPARE(m_appBackend->property("startElements").toInt(), pm.rowCount()); - pm.setShouldShowTechnical(true); - QCOMPARE(m_appBackend->property("startElements").toInt()*2, pm.rowCount()); - pm.setSearch("techie"); - QCOMPARE(m_appBackend->property("startElements").toInt(), pm.rowCount()); - pm.setSearch(QString()); - QCOMPARE(m_appBackend->property("startElements").toInt()*2, pm.rowCount()); -} - -void DummyTest::testFetch() -{ - QCOMPARE(m_appBackend->property("startElements").toInt()*2, m_model->rowCount()); - - //fetches updates, adds new things - m_appBackend->messageActions().first()->trigger(); - QCOMPARE(m_model->rowCount(), 0); - QCOMPARE(m_model->isFetching(), true); - QSignalSpy spy(m_model, SIGNAL(allInitialized())); - QVERIFY(spy.wait(80000)); - QCOMPARE(m_model->isFetching(), false); - QCOMPARE(m_appBackend->property("startElements").toInt()*4, m_model->rowCount()); -} - -void DummyTest::testSort() -{ - ResourcesProxyModel pm; - pm.setSourceModel(m_model); - QCollator c; - QBENCHMARK_ONCE { - pm.setSortRole(ResourcesModel::NameRole); - pm.sort(0); - QString last; - for(int i = 0; i<pm.rowCount(); ++i) { - QString current = pm.index(i, 0).data(pm.sortRole()).toString(); - if (!last.isEmpty()) { - QCOMPARE(c.compare(last, current), -1); - } - last = current; - } - } - - QBENCHMARK_ONCE { - pm.setSortRole(ResourcesModel::SortableRatingRole); - pm.sort(0); - int last=-1; - for(int i = 0; i<pm.rowCount(); ++i) { - int current = pm.index(i, 0).data(pm.sortRole()).toInt(); - QVERIFY(last<=current); - last = current; - } - } -} - -void DummyTest::testInstallAddons() -{ - AbstractResource* res = m_model->resourceByPackageName("Dummy 1"); - QVERIFY(res); - - ApplicationAddonsModel m; - m.setApplication(res); - QCOMPARE(m.rowCount(), res->addonsInformation().count()); - QCOMPARE(res->addonsInformation().first().isInstalled(), false); - - QString firstAddonName = m.data(m.index(0,0)).toString(); - m.changeState(firstAddonName, true); - QVERIFY(m.hasChanges()); - - m.applyChanges(); - QSignalSpy sR(TransactionModel::global(), SIGNAL(transactionRemoved(Transaction* ))); - QVERIFY(sR.wait()); - QVERIFY(!m.hasChanges()); - - QCOMPARE(m.data(m.index(0,0)).toString(), firstAddonName); - QCOMPARE(res->addonsInformation().first().name(), firstAddonName); - QCOMPARE(res->addonsInformation().first().isInstalled(), true); -} - -void DummyTest::testReviewsModel() -{ - AbstractResource* res = m_model->resourceByPackageName("Dummy 1"); - QVERIFY(res); - - ReviewsModel m; - new ModelTest(&m, &m); - m.setResource(res); - m.fetchMore(); - - QVERIFY(m.rowCount()>0); - - QCOMPARE(ReviewsModel::UserChoice(m.data(m.index(0,0), ReviewsModel::UsefulChoice).toInt()), ReviewsModel::None); - m.markUseful(0, true); - QCOMPARE(ReviewsModel::UserChoice(m.data(m.index(0,0), ReviewsModel::UsefulChoice).toInt()), ReviewsModel::Yes); - m.markUseful(0, false); - QCOMPARE(ReviewsModel::UserChoice(m.data(m.index(0,0), ReviewsModel::UsefulChoice).toInt()), ReviewsModel::No); - - res = m_model->resourceByPackageName("Dummy 2"); - m.setResource(res); - m.fetchMore(); - - QSignalSpy spy(&m, &ReviewsModel::rowsChanged); - QVERIFY(m.rowCount()>0); -} - -void DummyTest::testUpdateModel() -{ - ResourcesUpdatesModel ruModel; - new ModelTest(&ruModel, &ruModel); - UpdateModel model; - new ModelTest(&model, &model); - model.setBackend(&ruModel); - - QCOMPARE(model.rowCount(), 2); - QCOMPARE(model.hasUpdates(), true); -} diff --git a/libmuon/backends/DummyBackend/tests/DummyTest.h b/libmuon/backends/DummyBackend/tests/DummyTest.h deleted file mode 100644 index f877955..0000000 --- a/libmuon/backends/DummyBackend/tests/DummyTest.h +++ /dev/null @@ -1,51 +0,0 @@ -/*************************************************************************** - * Copyright © 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef DUMMYTEST_H -#define DUMMYTEST_H - -#include <QObject> - -class ResourcesModel; -class AbstractResourcesBackend; - -class DummyTest : public QObject -{ - Q_OBJECT -public: - explicit DummyTest(QObject* parent = nullptr); - -private slots: - void init(); - - void testReadData(); - void testProxy(); - void testFetch(); - void testSort(); - void testInstallAddons(); - void testReviewsModel(); - void testUpdateModel(); - -private: - AbstractResourcesBackend* m_appBackend; - ResourcesModel* m_model; -}; - -#endif // DUMMYTEST_H diff --git a/libmuon/backends/DummyBackend/tests/UpdateDummyTest.cpp b/libmuon/backends/DummyBackend/tests/UpdateDummyTest.cpp deleted file mode 100644 index f310759..0000000 --- a/libmuon/backends/DummyBackend/tests/UpdateDummyTest.cpp +++ /dev/null @@ -1,117 +0,0 @@ -/*************************************************************************** - * Copyright © 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "DummyTest.h" -#include <modeltest.h> -#include <resources/ResourcesModel.h> -#include <resources/ResourcesProxyModel.h> -#include <resources/AbstractBackendUpdater.h> -#include <ApplicationAddonsModel.h> -#include <Transaction/TransactionModel.h> -#include <ReviewsBackend/ReviewsModel.h> -#include <UpdateModel/UpdateModel.h> -#include <resources/ResourcesUpdatesModel.h> - -#include <qtest.h> -#include <QtTest> -#include <QAction> - -class UpdateDummyTest - : public QObject -{ - Q_OBJECT -public: - AbstractResourcesBackend* backendByName(ResourcesModel* m, const QString& name) - { - QVector<AbstractResourcesBackend*> backends = m->backends(); - foreach(AbstractResourcesBackend* backend, backends) { - if(backend->metaObject()->className()==name) { - return backend; - } - } - return nullptr; - } - - UpdateDummyTest(QObject* parent = nullptr): QObject(parent) - { - m_model = new ResourcesModel("muon-dummy-backend", this); -// new ModelTest(m_model, m_model); - - m_appBackend = backendByName(m_model, "DummyBackend"); - } - -private slots: - void init() - { - QVERIFY(m_appBackend); - while(m_appBackend->isFetching()) { - QSignalSpy spy(m_appBackend, &AbstractResourcesBackend::fetchingChanged); - QVERIFY(spy.wait()); - } - } - - void testUpdate() - { - ResourcesUpdatesModel* rum = new ResourcesUpdatesModel(this); -// new ModelTest(rum, rum); - - UpdateModel* m = new UpdateModel(this); -// new ModelTest(m, m); - m->setBackend(rum); - - rum->prepare(); - QCOMPARE(m_appBackend->updatesCount(), 212); - QCOMPARE(m->hasUpdates(), true); - - QCOMPARE(m->index(0,0).child(0,0).data(Qt::CheckStateRole).toBool(), true); - m->setData(m->index(0,0).child(0,0), false, Qt::CheckStateRole); - QCOMPARE(m->index(0,0).child(0,0).data(Qt::CheckStateRole).toBool(), false); - - - rum->updateAll(); - - QSignalSpy spy(rum, &ResourcesUpdatesModel::progressingChanged); - QVERIFY(spy.wait()); - QCOMPARE(rum->isProgressing(), true); - QVERIFY(spy.wait()); - QCOMPARE(rum->isProgressing(), false); - - QCOMPARE(m_appBackend->updatesCount(), 1); - QCOMPARE(m->hasUpdates(), true); - - rum->prepare(); - rum->updateAll(); - QVERIFY(spy.wait()); - QCOMPARE(rum->isProgressing(), true); - QVERIFY(spy.wait()); - QCOMPARE(rum->isProgressing(), false); - - QCOMPARE(m_appBackend->updatesCount(), 0); - QCOMPARE(m->hasUpdates(), false); - } - -private: - ResourcesModel* m_model; - AbstractResourcesBackend* m_appBackend; -}; - -QTEST_MAIN(UpdateDummyTest); - -#include "UpdateDummyTest.moc" diff --git a/libmuon/backends/KNSBackend/CMakeLists.txt b/libmuon/backends/KNSBackend/CMakeLists.txt deleted file mode 100644 index 7246377..0000000 --- a/libmuon/backends/KNSBackend/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -include_directories(${LIBATTICA_INCLUDE_DIR}) - -add_subdirectory(tests) - -set(knsbackend_SRCS - KNSBackend.cpp - KNSResource.cpp - KNSReviews.cpp -) - -add_library(muon-knsbackend MODULE ${knsbackend_SRCS}) -target_link_libraries(muon-knsbackend MuonCommon - KF5::ConfigCore KF5::Attica KF5::NewStuff KF5::WidgetsAddons) - -install(TARGETS muon-knsbackend DESTINATION ${PLUGIN_INSTALL_DIR}/muon) -install(FILES muon-knscomics-backend.desktop DESTINATION ${DATA_INSTALL_DIR}/libmuon/backends) -install(FILES muon-knsplasmoids-backend.desktop DESTINATION ${DATA_INSTALL_DIR}/libmuon/backends) - -install(FILES muon-knsplasmoids-backend-categories.xml DESTINATION ${DATA_INSTALL_DIR}/libmuon/categories) -install(FILES muon-knscomics-backend-categories.xml DESTINATION ${DATA_INSTALL_DIR}/libmuon/categories) diff --git a/libmuon/backends/KNSBackend/KNSBackend.cpp b/libmuon/backends/KNSBackend/KNSBackend.cpp deleted file mode 100644 index 0eefe0d..0000000 --- a/libmuon/backends/KNSBackend/KNSBackend.cpp +++ /dev/null @@ -1,335 +0,0 @@ -/*************************************************************************** - * Copyright © 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -// Qt includes -#include <QDebug> -#include <QDir> -#include <QFileInfo> - -// Attica includes -#include <attica/content.h> -#include <attica/providermanager.h> - -// KDE includes -#include <kns3/downloadmanager.h> -#include <KConfigGroup> -#include <KDesktopFile> -#include <KLocalizedString> - -// Libmuon includes -#include "Transaction/Transaction.h" -#include "Transaction/TransactionModel.h" - -// Own includes -#include "KNSBackend.h" -#include "KNSResource.h" -#include "KNSReviews.h" -#include <resources/StandardBackendUpdater.h> - -MUON_BACKEND_PLUGIN(KNSBackend) - -QSharedPointer<Attica::ProviderManager> KNSBackend::m_atticaManager; - -void KNSBackend::initManager(KConfigGroup& group) -{ - if(!m_atticaManager) { - m_atticaManager = QSharedPointer<Attica::ProviderManager>(new Attica::ProviderManager); - QString entry = group.readEntry("ProvidersUrl", QString()); - if(!m_atticaManager->defaultProviderFiles().contains(entry)) - m_atticaManager->addProviderFileToDefaultProviders(entry); - m_atticaManager->loadDefaultProviders(); - } -} - -KNSBackend::KNSBackend(QObject* parent) - : AbstractResourcesBackend(parent) - , m_fetching(false) - , m_isValid(true) - , m_page(0) - , m_reviews(new KNSReviews(this)) - , m_updater(new StandardBackendUpdater(this)) -{} - -KNSBackend::~KNSBackend() -{} - -void KNSBackend::setMetaData(const QString& path) -{ - KDesktopFile cfg(path); - KConfigGroup service = cfg.group("Desktop Entry"); - - m_iconName = service.readEntry("Icon", QString()); - QString knsrc = service.readEntry("X-Muon-Arguments", QString()); - m_name = QStandardPaths::locate(QStandardPaths::GenericConfigLocation, knsrc); - if (m_name.isEmpty()) { - QString p = QFileInfo(path).dir().filePath(knsrc); - if (QFile::exists(p)) - m_name = p; - - } - - if (m_name.isEmpty()) { - m_isValid = false; - qWarning() << "Couldn't find knsrc file" << knsrc; - return; - } - KConfig conf(m_name); - KConfigGroup group; - - if (conf.hasGroup("KNewStuff3")) - group = conf.group("KNewStuff3"); - - if (!group.isValid()) { - m_isValid = false; - qWarning() << "Config group not found! Check your KNS3 installation."; - return; - } - - QStringList cats = group.readEntry("Categories", QStringList()); - initManager(group); - connect(m_atticaManager.data(), SIGNAL(defaultProvidersLoaded()), SLOT(startFetchingCategories())); - - foreach(const QString& c, cats) { - m_categories.insert(c, Attica::Category()); - } - - m_manager = new KNS3::DownloadManager(m_name, this); - connect(m_manager, SIGNAL(searchResult(KNS3::Entry::List)), SLOT(receivedEntries(KNS3::Entry::List))); - connect(m_manager, SIGNAL(entryStatusChanged(KNS3::Entry)), SLOT(statusChanged(KNS3::Entry))); - - if (!m_atticaManager->providers().isEmpty()) { - startFetchingCategories(); - } -} - -void KNSBackend::setFetching(bool f) -{ - if(m_fetching!=f) { - m_fetching = f; - emit fetchingChanged(); - } -} - -bool KNSBackend::isValid() const -{ - return m_isValid; -} - -void KNSBackend::startFetchingCategories() -{ - if (m_atticaManager->providers().isEmpty()) { - qWarning() << "no providers for" << m_name; - m_isValid = false; - setFetching(false); - return; - } - - setFetching(true); - m_provider = m_atticaManager->providers().first(); - - Attica::ListJob<Attica::Category>* job = m_provider.requestCategories(); - connect(job, SIGNAL(finished(Attica::BaseJob*)), SLOT(categoriesLoaded(Attica::BaseJob*))); - job->start(); -} - -void KNSBackend::categoriesLoaded(Attica::BaseJob* job) -{ - if(job->metadata().error() != Attica::Metadata::NoError) { - qWarning() << "Network error"; - setFetching(false); - return; - } - Attica::ListJob<Attica::Category>* j = static_cast<Attica::ListJob<Attica::Category>*>(job); - Attica::Category::List categoryList = j->itemList(); - - foreach(const Attica::Category& category, categoryList) { - if (m_categories.contains(category.name())) { -// qDebug() << "Adding category: " << category.name(); - m_categories[category.name()] = category; - } - } - - // Remove categories for which we got no matching category from the provider. - // Otherwise we'll fetch an empty category specificier which can return - // everything and the kitchen sink if the remote provider feels like it. - for (auto it = m_categories.begin(); it != m_categories.end();) { - if (!it.value().isValid()) { - qWarning() << "Found invalid category" << it.key(); - it = m_categories.erase(it); - } else - ++it; - } - if (m_categories.isEmpty()) { - m_isValid = false; - setFetching(false); - return; - } - - Attica::ListJob<Attica::Content>* jj = - m_provider.searchContents(m_categories.values(), QString(), Attica::Provider::Alphabetical, m_page, 100); - connect(jj, SIGNAL(finished(Attica::BaseJob*)), SLOT(receivedContents(Attica::BaseJob*))); - jj->start(); -} - -void KNSBackend::receivedContents(Attica::BaseJob* job) -{ - if(job->metadata().error() != Attica::Metadata::NoError) { - qWarning() << "Network error"; - setFetching(false); - return; - } - Attica::ListJob<Attica::Content>* listJob = static_cast<Attica::ListJob<Attica::Content>*>(job); - Attica::Content::List contents = listJob->itemList(); - - if(contents.isEmpty()) { - m_page = 0; - m_manager->search(); - return; - } - QString filename = QFileInfo(m_name).fileName(); - foreach(const Attica::Content& c, contents) { - KNSResource* r = new KNSResource(c, filename, m_iconName, this); - m_resourcesByName.insert(c.id(), r); - connect(r, SIGNAL(stateChanged()), SIGNAL(updatesCountChanged())); - } - m_page++; - Attica::ListJob<Attica::Content>* jj = - m_provider.searchContents(m_categories.values(), QString(), Attica::Provider::Alphabetical, m_page, 100); - connect(jj, SIGNAL(finished(Attica::BaseJob*)), SLOT(receivedContents(Attica::BaseJob*))); - jj->start(); -} - -void KNSBackend::receivedEntries(const KNS3::Entry::List& entries) -{ - if(entries.isEmpty()) { - setFetching(false); - return; - } - - foreach(const KNS3::Entry& entry, entries) { - KNSResource* r = qobject_cast<KNSResource*>(m_resourcesByName.value(entry.id())); - if (r) { - r->setEntry(entry); - } else - qWarning() << "Couldn't find a resource for" << entry.id() << entry.name(); - } - ++m_page; - m_manager->search(m_page); -} - -void KNSBackend::statusChanged(const KNS3::Entry& entry) -{ - KNSResource* r = qobject_cast<KNSResource*>(m_resourcesByName.value(entry.id())); - if(r) - r->setEntry(entry); - else - qWarning() << "unknown entry changed" << entry.id() << entry.name(); -} - -void KNSBackend::cancelTransaction(AbstractResource* app) -{ - Q_UNUSED(app) - - qWarning("KNS transaction canceling unsupported"); -} - -void KNSBackend::removeApplication(AbstractResource* app) -{ - Transaction* t = new Transaction(this, app, Transaction::RemoveRole); - TransactionModel *transModel = TransactionModel::global(); - transModel->addTransaction(t); - KNSResource* r = qobject_cast<KNSResource*>(app); - Q_ASSERT(r->entry()); - m_manager->uninstallEntry(*r->entry()); - transModel->removeTransaction(t); -} - -void KNSBackend::installApplication(AbstractResource* app) -{ - Transaction* t = new Transaction(this, app, Transaction::InstallRole); - TransactionModel *transModel = TransactionModel::global(); - transModel->addTransaction(t); - KNSResource* r = qobject_cast<KNSResource*>(app); - Q_ASSERT(r->entry()); - m_manager->installEntry(*r->entry()); - transModel->removeTransaction(t); -} - -void KNSBackend::installApplication(AbstractResource* app, AddonList) -{ - installApplication(app); -} - -AbstractResource* KNSBackend::resourceByPackageName(const QString& name) const -{ - return m_resourcesByName[name]; -} - -int KNSBackend::updatesCount() const -{ - int ret = 0; - foreach(AbstractResource* r, m_resourcesByName) { - if(r->state()==AbstractResource::Upgradeable) - ++ret; - } - return ret; -} - -QList<AbstractResource*> KNSBackend::upgradeablePackages() const -{ - QList<AbstractResource*> ret; - foreach(AbstractResource* r, m_resourcesByName) { - if(r->state()==AbstractResource::Upgradeable) - ret+=r; - } - return ret; -} - -AbstractReviewsBackend* KNSBackend::reviewsBackend() const -{ - return m_reviews; -} - -QList<AbstractResource*> KNSBackend::searchPackageName(const QString& searchText) -{ - QList<AbstractResource*> ret; - foreach(AbstractResource* r, m_resourcesByName) { - if(r->name().contains(searchText, Qt::CaseInsensitive) || r->comment().contains(searchText, Qt::CaseInsensitive)) - ret += r; - } - return ret; -} - -QVector< AbstractResource* > KNSBackend::allResources() const -{ - return m_resourcesByName.values().toVector(); -} - -bool KNSBackend::isFetching() const -{ - return m_fetching; -} - -AbstractBackendUpdater* KNSBackend::backendUpdater() const -{ - return m_updater; -} - -#include "KNSBackend.moc" diff --git a/libmuon/backends/KNSBackend/KNSBackend.h b/libmuon/backends/KNSBackend/KNSBackend.h deleted file mode 100644 index e3af33d..0000000 --- a/libmuon/backends/KNSBackend/KNSBackend.h +++ /dev/null @@ -1,95 +0,0 @@ -/*************************************************************************** - * Copyright © 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef KNSBACKEND_H -#define KNSBACKEND_H - -// KDE includes -#include <KNewStuff3/kns3/entry.h> - -// Attica includes -#include <attica/category.h> -#include <attica/provider.h> - -// Libmuon includes -#include <resources/AbstractResourcesBackend.h> -#include "Transaction/AddonList.h" - -#include "libMuonCommon_export.h" - -class KConfigGroup; -class KNSReviews; -namespace KNS3 { class DownloadManager; } -namespace Attica { - class ProviderManager; - class BaseJob; -} - -class MUONCOMMON_EXPORT KNSBackend : public AbstractResourcesBackend -{ -Q_OBJECT -public: - explicit KNSBackend(QObject* parent = nullptr); - virtual ~KNSBackend(); - - virtual void setMetaData(const QString& path) override; - virtual void cancelTransaction(AbstractResource* app) override; - virtual void removeApplication(AbstractResource* app) override; - virtual void installApplication(AbstractResource* app) override; - virtual void installApplication(AbstractResource* app, AddonList addons) override; - virtual AbstractResource* resourceByPackageName(const QString& name) const override; - virtual int updatesCount() const override; - virtual AbstractReviewsBackend* reviewsBackend() const override; - virtual QList<AbstractResource*> searchPackageName(const QString& searchText) override; - virtual QVector< AbstractResource* > allResources() const override; - virtual AbstractBackendUpdater* backendUpdater() const override; - virtual bool isFetching() const override; - virtual QList<QAction*> messageActions() const override { return QList<QAction*>(); } - - bool isValid() const override; - Attica::Provider* provider() { return &m_provider; } - QList<AbstractResource*> upgradeablePackages() const override; - -public slots: - void receivedEntries(const KNS3::Entry::List& entry); - void startFetchingCategories(); - void categoriesLoaded(Attica::BaseJob*); - void receivedContents(Attica::BaseJob*); - void statusChanged(const KNS3::Entry& entry); - -private: - static void initManager(KConfigGroup& group); - static QSharedPointer<Attica::ProviderManager> m_atticaManager; - void setFetching(bool f); - - bool m_fetching; - bool m_isValid; - KNS3::DownloadManager* m_manager; - QHash<QString, AbstractResource*> m_resourcesByName; - int m_page; - KNSReviews* m_reviews; - Attica::Provider m_provider; - QMap<QString, Attica::Category> m_categories; - QString m_name; - QString m_iconName; - AbstractBackendUpdater* m_updater; -}; - -#endif // KNSBACKEND_H diff --git a/libmuon/backends/KNSBackend/KNSResource.cpp b/libmuon/backends/KNSBackend/KNSResource.cpp deleted file mode 100644 index 8f573c5..0000000 --- a/libmuon/backends/KNSBackend/KNSResource.cpp +++ /dev/null @@ -1,193 +0,0 @@ -/*************************************************************************** - * Copyright © 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "KNSResource.h" -#include "KNSBackend.h" -#include <QDebug> -#include <knewstuff_version.h> - -KNSResource::KNSResource(const Attica::Content& c, QString category, QString icon, KNSBackend* parent) - : AbstractResource(parent) - , m_status(KNS3::Entry::Downloadable) - , m_content(c) - , m_category(std::move(category)) - , m_icon(std::move(icon)) - , m_entry(nullptr) -{} - -KNSResource::~KNSResource() -{ - delete m_entry; -} - -AbstractResource::State KNSResource::state() -{ - switch(m_status) { - case KNS3::Entry::Invalid: - return Broken; - case KNS3::Entry::Downloadable: - return None; - case KNS3::Entry::Installed: - return Installed; - case KNS3::Entry::Updateable: - return Upgradeable; - case KNS3::Entry::Deleted: - case KNS3::Entry::Installing: - case KNS3::Entry::Updating: - return None; - } - return None; -} - -void KNSResource::setStatus(KNS3::Entry::Status status) -{ - if(status!=m_status) { - m_status = status; - emit stateChanged(); - } -} - -QString KNSResource::icon() const -{ - return m_icon; -} - -QString KNSResource::comment() -{ - QString s = m_content.summary(); - if(s.isEmpty()) { - s = longDescription(); - int newLine = s.indexOf('\n'); - if(newLine>0) - s=s.left(newLine); - } - return s; -} - -QString KNSResource::name() -{ - return m_content.name(); -} - -QString KNSResource::packageName() const -{ - return m_content.id(); -} - -QStringList KNSResource::categories() -{ - return QStringList(m_category); -} - -QUrl KNSResource::homepage() -{ - return m_content.detailpage(); -} - -QUrl KNSResource::thumbnailUrl() -{ - return m_content.smallPreviewPicture(); -} - -QUrl KNSResource::screenshotUrl() -{ - return m_content.previewPicture(); -} - -const Attica::Content& KNSResource::content() -{ - return m_content; -} - -QString KNSResource::longDescription() -{ - QString ret = m_content.description(); - ret = ret.replace('\r', QString()); - return ret; -} - -void KNSResource::setEntry(const KNS3::Entry& entry) -{ - setStatus(entry.status()); - delete m_entry; - m_entry = new KNS3::Entry(entry); -} - -KNS3::Entry* KNSResource::entry() const -{ - return m_entry; -} - -QString KNSResource::license() -{ - return m_content.licenseName(); -} - -int KNSResource::size() -{ -#if KNEWSTUFF_VERSION_MINOR > 3 and KNEWSTUFF_VERSION_MAJOR == 5 - const -#endif - Attica::DownloadDescription desc = m_content.downloadUrlDescription(0); - return desc.size(); -} - -QString KNSResource::installedVersion() const -{ - return m_entry->version(); -} - -QString KNSResource::availableVersion() const -{ - return m_content.version(); -} - -QString KNSResource::origin() const -{ - return m_entry->providerId(); -} - -QString KNSResource::section() -{ -#if KNEWSTUFF_VERSION_MINOR > 3 and KNEWSTUFF_VERSION_MAJOR == 5 - const -#endif - Attica::DownloadDescription desc = m_content.downloadUrlDescription(0); - return desc.category(); -} - -void KNSResource::fetchScreenshots() -{ - QList<QUrl> thumbnails, screenshots; - for(int i=0; i<=3; i++) { - QString number = QString::number(i); - QString last = m_content.previewPicture(number); - if(!last.isEmpty()) { - thumbnails += QUrl(m_content.smallPreviewPicture(number)); - screenshots += QUrl(last); - } - } - emit screenshotsFetched(thumbnails, screenshots); -} - -void KNSResource::fetchChangelog() -{ - emit changelogFetched(m_content.changelog()); -} diff --git a/libmuon/backends/KNSBackend/KNSResource.h b/libmuon/backends/KNSBackend/KNSResource.h deleted file mode 100644 index 59d6bd8..0000000 --- a/libmuon/backends/KNSBackend/KNSResource.h +++ /dev/null @@ -1,72 +0,0 @@ -/*************************************************************************** - * Copyright © 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef KNSRESOURCE_H -#define KNSRESOURCE_H - -#include <resources/AbstractResource.h> -#include <kns3/entry.h> -#include <attica/content.h> - -#include "libMuonCommon_export.h" - -class KNSBackend; -class MUONCOMMON_EXPORT KNSResource : public AbstractResource -{ -Q_OBJECT -public: - explicit KNSResource(const Attica::Content& c, QString category, QString icon, KNSBackend* parent); - virtual ~KNSResource(); - - void setStatus(KNS3::Entry::Status status); - - virtual AbstractResource::State state() override; - virtual QString icon() const override; - virtual QString comment() override; - virtual QString name() override; - virtual QString packageName() const override; - virtual QStringList categories() override; - virtual QUrl homepage() override; - virtual QUrl thumbnailUrl() override; - virtual QUrl screenshotUrl() override; - virtual QString license() override; - virtual QString longDescription() override; - virtual QList<PackageState> addonsInformation() override { return QList<PackageState>(); } - virtual QString availableVersion() const override; - virtual QString installedVersion() const override; - virtual QString origin() const override; - virtual QString section() override; - virtual void fetchScreenshots() override; - virtual int size() override; - virtual void fetchChangelog() override; - - const Attica::Content& content(); - void setEntry(const KNS3::Entry& entry); - KNS3::Entry* entry() const; - -private: - KNS3::Entry::Status m_status; - const Attica::Content m_content; - const QString m_category; - const QString m_icon; - KNS3::Entry* m_entry; -}; - -#endif // KNSRESOURCE_H diff --git a/libmuon/backends/KNSBackend/KNSReviews.cpp b/libmuon/backends/KNSBackend/KNSReviews.cpp deleted file mode 100644 index 0305975..0000000 --- a/libmuon/backends/KNSBackend/KNSReviews.cpp +++ /dev/null @@ -1,162 +0,0 @@ -/*************************************************************************** - * Copyright © 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "KNSReviews.h" -#include "KNSBackend.h" -#include "KNSResource.h" -#include <ReviewsBackend/Rating.h> -#include <ReviewsBackend/Review.h> -#include <resources/AbstractResource.h> -#include <attica/provider.h> -#include <attica/providermanager.h> -#include <attica/content.h> -#include <KLocalizedString> -#include <KPasswordDialog> -#include <QDebug> -#include <QDesktopServices> - -Q_DECLARE_METATYPE(AbstractResource*) - -KNSReviews::KNSReviews(KNSBackend* backend) - : AbstractReviewsBackend(backend) - , m_backend(backend) - , m_fetching(0) -{ - if(m_backend->isFetching()) - connect(m_backend, SIGNAL(fetchingChanged()), SIGNAL(ratingsReady())); - else - QMetaObject::invokeMethod(this, "ratingsReady", Qt::QueuedConnection); -} - -Rating* KNSReviews::ratingForApplication(AbstractResource* app) const -{ - KNSResource *resource = qobject_cast<KNSResource*>(m_backend->resourceByPackageName(app->packageName())); - if (!resource) - { - qDebug() << app->packageName() << "<= couldn't find resource"; - return nullptr; - } - - Attica::Content c = resource->content(); - Q_ASSERT(c.rating()<=100); - QVariantMap data = { - { "package_name", app->packageName() }, - { "app_name", app->name() }, - { "ratings_total", c.numberOfComments() }, - { "ratings_average", c.rating()/20 }, - { "histogram", '['+QString::number(c.numberOfComments()*c.rating())+']' } - }; - return new Rating(data); -} - -void KNSReviews::fetchReviews(AbstractResource* app, int page) -{ - if(!m_backend->provider()->hasCommentService()) { - emit reviewsReady(app, QList<Review*>()); - return; - } - - Attica::ListJob< Attica::Comment >* job = - m_backend->provider()->requestComments(Attica::Comment::ContentComment, app->packageName(), "0", page, 10); - job->setProperty("app", qVariantFromValue<AbstractResource*>(app)); - connect(job, SIGNAL(finished(Attica::BaseJob*)), SLOT(commentsReceived(Attica::BaseJob*))); - job->start(); -} - -void KNSReviews::commentsReceived(Attica::BaseJob* j) -{ - Attica::ListJob<Attica::Comment>* job = static_cast<Attica::ListJob<Attica::Comment>*>(j); - Attica::Comment::List comments = job->itemList(); - - QList<Review*> reviews; - AbstractResource* app = job->property("app").value<AbstractResource*>(); - foreach(const Attica::Comment& comment, comments) { - //TODO: language lookup? - Review* r = new Review(app->name(), app->packageName(), "en", comment.subject(), comment.text(), comment.user(), - comment.date(), true, comment.id().toInt(), comment.score()/10, 0, 0, QString() - ); - reviews += r; - } - - emit reviewsReady(app, reviews); -} - -bool KNSReviews::isFetching() const -{ - return m_backend->isFetching(); -} - -void KNSReviews::flagReview(Review* , const QString& , const QString& ) -{ - qWarning() << "cannot flag reviews"; -} - -void KNSReviews::deleteReview(Review* ) -{ - qWarning() << "cannot delete comments"; -} - -void KNSReviews::submitReview(AbstractResource* app, const QString& summary, const QString& review_text, const QString& /*rating*/) -{ - m_backend->provider()->addNewComment(Attica::Comment::ContentComment, app->packageName(), QString(), QString(), summary, review_text); -} - -void KNSReviews::submitUsefulness(Review* r, bool useful) -{ - m_backend->provider()->voteForComment(QString::number(r->id()), useful*5); -} - -void KNSReviews::logout() -{ - bool b = m_backend->provider()->saveCredentials(QString(), QString()); - if (!b) - qWarning() << "couldn't log out"; -} - -void KNSReviews::registerAndLogin() -{ - QDesktopServices::openUrl(m_backend->provider()->baseUrl()); -} - -void KNSReviews::login() -{ - KPasswordDialog* dialog = new KPasswordDialog; - dialog->setPrompt(i18n("Log in information for %1", m_backend->provider()->name())); - connect(dialog, &KPasswordDialog::gotUsernameAndPassword, this, &KNSReviews::credentialsReceived); -} - -void KNSReviews::credentialsReceived(const QString& user, const QString& password) -{ - bool b = m_backend->provider()->saveCredentials(user, password); - if (!b) - qWarning() << "couldn't save" << user << "credentials for" << m_backend->provider()->name(); -} - -bool KNSReviews::hasCredentials() const -{ - return m_backend->provider()->hasCredentials(); -} - -QString KNSReviews::userName() const -{ - QString user, password; - m_backend->provider()->loadCredentials(user, password); - return user; -} diff --git a/libmuon/backends/KNSBackend/KNSReviews.h b/libmuon/backends/KNSBackend/KNSReviews.h deleted file mode 100644 index 3586e33..0000000 --- a/libmuon/backends/KNSBackend/KNSReviews.h +++ /dev/null @@ -1,65 +0,0 @@ -/*************************************************************************** - * Copyright © 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef KNSREVIEWS_H -#define KNSREVIEWS_H - -#include <ReviewsBackend/AbstractReviewsBackend.h> -#include <QMap> -#include <attica/content.h> - -class KNSBackend; -class QUrl; -namespace Attica { -class Provider; -class ProviderManager; -class BaseJob; -} - -class KNSReviews : public AbstractReviewsBackend -{ - Q_OBJECT - public: - explicit KNSReviews(KNSBackend* backend); - - virtual void fetchReviews(AbstractResource* app, int page = 1) override; - virtual bool isFetching() const override; - virtual void flagReview(Review* r, const QString& reason, const QString& text) override; - virtual void deleteReview(Review* r) override; - virtual void submitReview(AbstractResource* app, const QString& summary, const QString& review_text, const QString& rating) override; - virtual void submitUsefulness(Review* r, bool useful) override; - virtual void logout() override; - virtual void registerAndLogin() override; - virtual void login() override; - virtual Rating* ratingForApplication(AbstractResource* app) const override; - virtual bool hasCredentials() const override; - virtual QString userName() const override; - - private slots: - void commentsReceived(Attica::BaseJob* job); - void credentialsReceived(const QString& user, const QString& password); - - private: - KNSBackend* m_backend; - - int m_fetching; -}; - -#endif // KNSREVIEWS_H diff --git a/libmuon/backends/KNSBackend/muon-knscomics-backend-categories.xml b/libmuon/backends/KNSBackend/muon-knscomics-backend-categories.xml deleted file mode 100644 index bdefd03..0000000 --- a/libmuon/backends/KNSBackend/muon-knscomics-backend-categories.xml +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<Menu> - <Menu> - <Name>Comics</Name> - <Icon>face-smile-big</Icon> - <ShowTechnical>true</ShowTechnical> <!-- needs to be like this as the appsbackend counterpart needs it. --> - <Include> - <And> - <Category>comic.knsrc</Category> - </And> - </Include> - </Menu> -</Menu> diff --git a/libmuon/backends/KNSBackend/muon-knscomics-backend.desktop b/libmuon/backends/KNSBackend/muon-knscomics-backend.desktop deleted file mode 100644 index 3bf94be..0000000 --- a/libmuon/backends/KNSBackend/muon-knscomics-backend.desktop +++ /dev/null @@ -1,139 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=Muon/Backend -Exec=blubb -Icon=face-smile-big -Name=Comics -Name[ast]=Comics -Name[bg]=Комикси -Name[bs]=Strip -Name[ca]=Còmics -Name[ca@valencia]=Còmics -Name[cs]=Komiksy -Name[da]=Tegneserier -Name[de]=Comics -Name[el]=Κόμικς -Name[en_GB]=Comics -Name[es]=Cómics -Name[et]=Koomiksid -Name[fi]=Sarjakuvat -Name[fr]=Bandes dessinées -Name[gl]=Cómics -Name[hu]=Képregények -Name[id]=Komik -Name[it]=Fumetti -Name[kk]=Комикс -Name[ko]=만화 -Name[lt]=Komiksai -Name[mr]=कॉमिक्स -Name[nb]=Tegneserier -Name[nds]=Comics -Name[nl]=Stripverhalen -Name[nn]=Teikneseriar -Name[pl]=Komiksy -Name[pt]=Banda Desenhada -Name[pt_BR]=Tirinhas -Name[ro]=Benzi desenate -Name[ru]=Комиксы -Name[sk]=Komikx -Name[sl]=Stripi -Name[sr]=Стрипови -Name[sr@ijekavian]=Стрипови -Name[sr@ijekavianlatin]=Stripovi -Name[sr@latin]=Stripovi -Name[sv]=Serier -Name[tr]=Çizgi Romanlar -Name[uk]=Комікси -Name[x-test]=xxComicsxx -Name[zh_CN]=连环画 -Name[zh_TW]=漫畫 -GenericName=Comics -GenericName[ast]=Comics -GenericName[bg]=Комикси -GenericName[bs]=Strip -GenericName[ca]=Còmics -GenericName[ca@valencia]=Còmics -GenericName[cs]=Komiksy -GenericName[da]=Tegneserier -GenericName[de]=Comics -GenericName[el]=Κόμικς -GenericName[en_GB]=Comics -GenericName[es]=Cómics -GenericName[et]=Koomiksid -GenericName[fi]=Sarjakuvat -GenericName[fr]=Bandes dessinées -GenericName[gl]=Cómics -GenericName[hu]=Képregények -GenericName[id]=Komik -GenericName[it]=Fumetti -GenericName[kk]=Комикс -GenericName[ko]=만화 -GenericName[lt]=Komiksai -GenericName[mr]=कॉमिक्स -GenericName[nb]=Tegneserier -GenericName[nds]=Comics -GenericName[nl]=Stripverhalen -GenericName[nn]=Teikneseriar -GenericName[pl]=Komiksy -GenericName[pt]=Banda Desenhada -GenericName[pt_BR]=Tirinhas -GenericName[ro]=Benzi desenate -GenericName[ru]=Комиксы -GenericName[sk]=Komikx -GenericName[sl]=Stripi -GenericName[sr]=Стрипови -GenericName[sr@ijekavian]=Стрипови -GenericName[sr@ijekavianlatin]=Stripovi -GenericName[sr@latin]=Stripovi -GenericName[sv]=Serier -GenericName[tr]=Çizgi Romanlar -GenericName[uk]=Комікси -GenericName[x-test]=xxComicsxx -GenericName[zh_CN]=连环画 -GenericName[zh_TW]=漫畫 -Comment=Install comic stripes to be used from the comics plasmoid -Comment[bs]=Intaliranje stripa za plazmoid s strip pričama -Comment[ca]=Instal·la tires còmiques per utilitzar des del plasmoide de còmics -Comment[ca@valencia]=Instal·la tires còmiques per utilitzar des del plasmoide de còmics -Comment[da]=Installér tegneseriestriber til brug fra tegneserie-plasmoiden -Comment[de]=Installation von Comics, die vom gleichnamigen Plasmoid benutzt werden -Comment[el]=Εγκαταστήστε κόμικς για χρήση από το πλασμοειδές των κόμικς -Comment[en_GB]=Install comic stripes to be used from the comics plasmoid -Comment[es]=Instalar tiras de cómic para usar en el plasmoide de cómics -Comment[et]=Koomiksite paigaldamine koomiksite plasmoidi tarbeks -Comment[fi]=Asenna sarjakuvaplasmoidin käyttämiä sarjakuvastrippejä -Comment[fr]=Installez des bandes dessinées à utiliser depuis le composant graphique « Bandes dessinées » -Comment[gl]=Instalar as tiras de cómics para usar no plasmoid de cómic -Comment[hu]=Képregények telepítése a képregény plazmoidhoz -Comment[id]=Pasang jenis komik yang akan digunakan dari plasmoid komik -Comment[it]=Installa strisce di fumetti da usare col plasmoide dei fumetti -Comment[kk]=Комикс плазмоидтер қолданатын комикстерді орнату -Comment[ko]=만화 Plasmoid에서 사용하는 만화 데이터 설치 -Comment[lt]=Įdiegti juokingas juostas naudotinas iš komiksų plazmoido -Comment[mr]=कॉमिक्स प्लाज्मोइड मध्ये वापरल्या जाणाऱ्या कॉमिक स्ट्रीप्स प्रतिष्ठापीत करा -Comment[nb]=Installer tegneserier som skal brukes fra comics-plasmoiden -Comment[nds]=Comics för Plasma sien Comic-Lüttprogramm installeren -Comment[nl]=Installeer stripverhalen om te worden gebruikt vanaf de plasmoid voor stripverhalen -Comment[nn]=Installer teikneseriar for bruk i teikneserie-skjermeelementet -Comment[pl]=Pobieraj komiksy, a następnie przeglądaj je w plazmoidzie komiksów -Comment[pt]=Instalar as bandas desenhadas a usar no plasmóide de bandas desenhadas -Comment[pt_BR]=Instalar as tirinhas para serem usadas no plasmoide de tirinhas -Comment[ro]=Instalează benzi desenate pentru a fi folosite de către plasmoidul de benzi desenate -Comment[ru]=Комиксы, которые будут использованы в виджете «Комиксы» -Comment[sk]=Nainštalujte komiksové pruhy na použitie pre komiksový plazmoid -Comment[sl]=Namestite stripe, ki jih lahko uporabite z vašim plasmoidom za stripe -Comment[sr]=Инсталирајте стрипове за читање кроз плазмоид стрипова -Comment[sr@ijekavian]=Инсталирајте стрипове за читање кроз плазмоид стрипова -Comment[sr@ijekavianlatin]=Instalirajte stripove za čitanje kroz plazmoid stripova -Comment[sr@latin]=Instalirajte stripove za čitanje kroz plazmoid stripova -Comment[sv]=Installera serier att använda med serie-plasmoiden -Comment[tr]=Çizgi Romanları plasmoid'inde kullanılmak üzere çizgi roman şeritleri indirin -Comment[uk]=Встановіть стрічки коміксів, які буде використано у плазмоїді коміксів -Comment[x-test]=xxInstall comic stripes to be used from the comics plasmoidxx -Comment[zh_CN]=从连环画 plasmoid 安装要使用的连环画 -Comment[zh_TW]=安裝漫畫給漫畫小元件 - -X-KDE-Library=muon-knsbackend -X-KDE-PluginInfo-Name=muon-knscomics-backend -X-KDE-PluginInfo-License=GPL -X-Muon-Arguments=comic.knsrc diff --git a/libmuon/backends/KNSBackend/muon-knsplasmoids-backend-categories.xml b/libmuon/backends/KNSBackend/muon-knsplasmoids-backend-categories.xml deleted file mode 100644 index d3515c5..0000000 --- a/libmuon/backends/KNSBackend/muon-knsplasmoids-backend-categories.xml +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<Menu> - <Menu> - <Name>Plasma Desktop Widgets</Name> - <Icon>plasma</Icon> - <ShowTechnical>true</ShowTechnical> <!-- needs to be like this to be the same as the Plasmoid category over . --> - <Include> - <Or> - <Category>plasmoids.knsrc</Category> - </Or> - </Include> - </Menu> -</Menu> diff --git a/libmuon/backends/KNSBackend/muon-knsplasmoids-backend.desktop b/libmuon/backends/KNSBackend/muon-knsplasmoids-backend.desktop deleted file mode 100644 index 90f3ee8..0000000 --- a/libmuon/backends/KNSBackend/muon-knsplasmoids-backend.desktop +++ /dev/null @@ -1,141 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=Muon/Backend -Exec=blubb -Icon=plasma -Name=Plasmoids -Name[ast]=Plasmoides -Name[bg]=Плазмоиди -Name[bs]=Plazmoidi -Name[ca]=Plasmoides -Name[ca@valencia]=Plasmoides -Name[cs]=Plasmoidy -Name[da]=Plasmoids -Name[de]=Plasmoide -Name[el]=Πλασμοειδή -Name[en_GB]=Plasmoids -Name[es]=Plasmoides -Name[et]=Plasmoidid -Name[fi]=Plasmoidit -Name[fr]=Composants graphiques -Name[gl]=Plasmoids -Name[hu]=Plazmoidok -Name[id]=Plasmoids -Name[it]=Plasmoidi -Name[kk]=Плазмоидтер -Name[ko]=Plasmoid -Name[lt]=Plazmoidai -Name[mr]=प्लाज्मोइड्स -Name[nb]=Plasmoider -Name[nds]=Plasma-Lüttprogrammen -Name[nl]=Plasmoids -Name[nn]=Skjermelement -Name[pl]=Plazmoidy -Name[pt]=Plasmóides -Name[pt_BR]=Plasmoides -Name[ro]=Plasmoizi -Name[ru]=Виджеты Plasma -Name[sk]=Plazmoidy -Name[sl]=Plasmoidi -Name[sr]=Плазмоиди -Name[sr@ijekavian]=Плазмоиди -Name[sr@ijekavianlatin]=Plazmoidi -Name[sr@latin]=Plazmoidi -Name[sv]=Plasmoider -Name[tr]=Plasmoid'ler -Name[uk]=Плазмоїди -Name[x-test]=xxPlasmoidsxx -Name[zh_CN]=Plasmoids -Name[zh_TW]=小元件 -GenericName=Plasmoids -GenericName[ast]=Plasmoides -GenericName[bg]=Плазмоиди -GenericName[bs]=Plazmoidi -GenericName[ca]=Plasmoides -GenericName[ca@valencia]=Plasmoides -GenericName[cs]=Plasmoidy -GenericName[da]=Plasmoids -GenericName[de]=Plasmoide -GenericName[el]=Πλασμοειδή -GenericName[en_GB]=Plasmoids -GenericName[es]=Plasmoides -GenericName[et]=Plasmoidid -GenericName[fi]=Plasmoidit -GenericName[fr]=Composants graphiques -GenericName[gl]=Plasmoids -GenericName[hu]=Plazmoidok -GenericName[id]=Plasmoids -GenericName[it]=Plasmoidi -GenericName[kk]=Плазмоидтер -GenericName[ko]=Plasmoid -GenericName[lt]=Plazmoidai -GenericName[mr]=प्लाज्मोइड्स -GenericName[nb]=Plasmoider -GenericName[nds]=Plasma-Lüttprogrammen -GenericName[nl]=Plasmoids -GenericName[nn]=Skjermelement -GenericName[pl]=Plazmoidy -GenericName[pt]=Plasmóides -GenericName[pt_BR]=Plasmoides -GenericName[ro]=Plasmoizi -GenericName[ru]=Виджеты Plasma -GenericName[sk]=Plazmoidy -GenericName[sl]=Plasmoidi -GenericName[sr]=Плазмоиди -GenericName[sr@ijekavian]=Плазмоиди -GenericName[sr@ijekavianlatin]=Plazmoidi -GenericName[sr@latin]=Plazmoidi -GenericName[sv]=Plasmoider -GenericName[tr]=Plasmoid'ler -GenericName[uk]=Плазмоїди -GenericName[x-test]=xxPlasmoidsxx -GenericName[zh_CN]=Plasmoids -GenericName[zh_TW]=小元件 -Comment=Install plasmoids and raise the power of your workspace! -Comment[ast]=¡Instala plasmoides y fai medrar el poder de la to estaya de trabayu! -Comment[bg]=Инсталирайте плазмоиди и увеличете мощта на вашата работна среда! -Comment[bs]=Instalirajte plazmoide i pojačajte radni prostor! -Comment[ca]=Instal·leu plasmoides i augmenteu la potència de l'espai de treball! -Comment[ca@valencia]=Instal·leu plasmoides i augmenteu la potència de l'espai de treball! -Comment[da]=Installér plasmoids og gør dit skrivebord endnu stærkere! -Comment[de]=Installieren Sie Plasmoide und steigern Sie die Leistungsfähigkeit Ihrer Arbeitsumgebung. -Comment[el]=Εγκαταστήστε πλασμοειδή και αυξήστε την ισχύ του χώρου εργασίας σας! -Comment[en_GB]=Install plasmoids and raise the power of your workspace! -Comment[es]=¡Instale plasmoides y aumente la potencia de su área de trabajo! -Comment[et]=Plasmoidide paigaldamine ja töölauale võlu juurde andmine -Comment[fi]=Asenna plasmoideja ja lisää työtilasi tehoa! -Comment[fr]=Installez des composants graphiques et mettez au premier plan la puissance de votre espace de travail ! -Comment[gl]=Instala plasmoids e dálle pulo ao teu entorno de traballo! -Comment[hu]=Telepítsen plazmoidokat, hogy a legtöbbet hozhassa ki asztali környezetéből! -Comment[id]=Pasang plasmoids dan bangkitkan kekuatan ruang kerja anda! -Comment[it]=Installa plasmoidi e aumenta la potenza del tuo spazio di lavoro! -Comment[kk]=Плазмоидтерді орнатып жұмыс орынның қуаттылығын жетілдір! -Comment[ko]=작업 공간을 유용하게 하는 Plasmoid를 설치하십시오! -Comment[lt]=Diekite plazmuidus ir kelkite Jūsų darbo aplinkos galią! -Comment[mr]=तुमच्या कार्यक्षेत्राची क्षमता वाढवण्याकरिता प्लाज्मोइड्स प्रतिष्ठापीत करा! -Comment[nb]=Installer plasmoider og øk kraften i din arbeidsflate! -Comment[nds]=Plasma-Lüttprogrammen installeren un dat Könen vun Dien Schriefdisch verbetern! -Comment[nl]=Installeer plasmoids en verhoog de kracht van uw werkruimte! -Comment[nn]=Installer skjermeelement for ei meir funksjonell arbeidsflate! -Comment[pl]=Wgrywaj plazmoidy i zwiększ możliwości swojej przestrzeni roboczej! -Comment[pt]=Instalar plasmóides e elevar as potencialidades da sua área de trabalho! -Comment[pt_BR]=Instale plasmoides e aumente o poder do seu espaço de trabalho! -Comment[ro]=Instalați plasmoizi și măriți puterea spațiului de lucru! -Comment[ru]=Сделайте удобнее рабочий стол с виджетами Plasma! -Comment[sk]=Nainštalujte plazmoidy a zvýšte silu vašej pracovnej plochy! -Comment[sl]=Namestite plasmoide in povečajte moč vašega delovnega prostora! -Comment[sr]=Инсталирајте плазмоиде за обогаћивање радног простора -Comment[sr@ijekavian]=Инсталирајте плазмоиде за обогаћивање радног простора -Comment[sr@ijekavianlatin]=Instalirajte plazmoide za obogaćivanje radnog prostora -Comment[sr@latin]=Instalirajte plazmoide za obogaćivanje radnog prostora -Comment[sv]=Installera Plasmoider och öka arbetsytans möjligheter. -Comment[tr]=Plasmoid'ler yükleyerek çalışma alanınızın gücünü arttırın! -Comment[uk]=Встановіть плазмоїди і зробіть ваш робочий простір потужнішим! -Comment[x-test]=xxInstall plasmoids and raise the power of your workspace!xx -Comment[zh_CN]=安装 plasmoids,让您的工作区更强大! -Comment[zh_TW]=安裝小元件,提升您的工作空間的能量! - -X-KDE-Library=muon-knsbackend -X-KDE-PluginInfo-Name=muon-knsplasmoids-backend -X-KDE-PluginInfo-License=GPL -X-Muon-Arguments=plasmoids.knsrc diff --git a/libmuon/backends/KNSBackend/tests/CMakeLists.txt b/libmuon/backends/KNSBackend/tests/CMakeLists.txt deleted file mode 100644 index 4e1a6d0..0000000 --- a/libmuon/backends/KNSBackend/tests/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -include_directories(..) - -add_executable(knsbackendtest KNSBackendTest.cpp) -add_test(knsbackendtest knsbackendtest) -ecm_mark_as_test(knsbackendtest) -target_link_libraries(knsbackendtest - MuonCommon - - Qt5::Test Qt5::Core - KF5::NewStuff KF5::KIOWidgets KF5::Attica -) diff --git a/libmuon/backends/KNSBackend/tests/KNSBackendTest.cpp b/libmuon/backends/KNSBackend/tests/KNSBackendTest.cpp deleted file mode 100644 index 182b4e7..0000000 --- a/libmuon/backends/KNSBackend/tests/KNSBackendTest.cpp +++ /dev/null @@ -1,97 +0,0 @@ -/*************************************************************************** - * Copyright © 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "KNSBackendTest.h" -#include <KNSBackend.h> -#include <KXmlGuiWindow> -#include <resources/AbstractResource.h> -#include <resources/ResourcesModel.h> -#include <ReviewsBackend/AbstractReviewsBackend.h> -#include <ReviewsBackend/Rating.h> -#include <MuonBackendsFactory.h> -#include <QStandardPaths> - -#include <qtest.h> -#include <qsignalspy.h> - -QTEST_MAIN( KNSBackendTest ) - -KNSBackendTest::KNSBackendTest(QObject* parent) - : QObject(parent) - , m_r(nullptr) -{ - QStandardPaths::setTestModeEnabled(true); - ResourcesModel* model = new ResourcesModel(QFINDTESTDATA("muon-knscorrect-backend.desktop"), this); - Q_ASSERT(!model->backends().isEmpty()); - m_backend = model->backends().first(); - auto m_window = new KXmlGuiWindow(); - model->integrateMainWindow(m_window); - - if (!m_backend->isValid()) { - qWarning() << "couldn't run the test"; - exit(0); - } - - QSignalSpy s(model, SIGNAL(allInitialized())); - Q_ASSERT(s.wait(50000)); - connect(m_backend->reviewsBackend(), SIGNAL(reviewsReady(AbstractResource*,QList<Review*>)), - SLOT(reviewsArrived(AbstractResource*,QList<Review*>))); -} - -void KNSBackendTest::wrongBackend() -{ - MuonBackendsFactory f; - AbstractResourcesBackend* b = f.backendForFile(QFINDTESTDATA("muon-knswrong-backend.desktop"), "muon-knswrong-backend"); - QVERIFY(!b->isValid()); -} - -void KNSBackendTest::testRetrieval() -{ - ResourcesModel* model = ResourcesModel::global(); - QVector<AbstractResource*> resources = m_backend->allResources(); - QVERIFY(!resources.isEmpty()); - QCOMPARE(resources.count(), model->rowCount()); - - foreach(AbstractResource* res, resources) { - QVERIFY(!res->name().isEmpty()); - QVERIFY(!res->categories().isEmpty()); - QVERIFY(!res->origin().isEmpty()); - } -} - -void KNSBackendTest::testReviews() -{ - QVector<AbstractResource*> resources = m_backend->allResources(); - AbstractReviewsBackend* rev = m_backend->reviewsBackend(); - foreach(AbstractResource* res, resources) { - Rating* r = rev->ratingForApplication(res); - QVERIFY(r); - QCOMPARE(r->packageName(), res->packageName()); - QVERIFY(r->rating()>0 && r->rating()<=10); -// rev->fetchReviews(res); -// QTest::kWaitForSignal(rev, SIGNAL(reviewsReady(AbstractResource*,QList<Review*>))); - } -} - -void KNSBackendTest::reviewsArrived(AbstractResource* r, const QList< Review* >& revs) -{ - m_r = r; - m_revs = revs; -} diff --git a/libmuon/backends/KNSBackend/tests/KNSBackendTest.h b/libmuon/backends/KNSBackend/tests/KNSBackendTest.h deleted file mode 100644 index 6b6b482..0000000 --- a/libmuon/backends/KNSBackend/tests/KNSBackendTest.h +++ /dev/null @@ -1,50 +0,0 @@ -/*************************************************************************** - * Copyright © 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef KNSBACKENDTEST_H -#define KNSBACKENDTEST_H - -#include <QtCore/QObject> - -class AbstractResourcesBackend; -class AbstractResource; -class Review; - -class KNSBackendTest : public QObject -{ - Q_OBJECT - public: - explicit KNSBackendTest(QObject* parent = nullptr); - - private slots: - void wrongBackend(); - void testRetrieval(); - void testReviews(); - - public slots: - void reviewsArrived(AbstractResource *r, const QList<Review *>& revs); - - private: - AbstractResourcesBackend* m_backend; - AbstractResource* m_r; - QList<Review*> m_revs; -}; - -#endif // KNSBACKENDTEST_H diff --git a/libmuon/backends/KNSBackend/tests/muon-knscorrect-backend.desktop b/libmuon/backends/KNSBackend/tests/muon-knscorrect-backend.desktop deleted file mode 100644 index af05ef1..0000000 --- a/libmuon/backends/KNSBackend/tests/muon-knscorrect-backend.desktop +++ /dev/null @@ -1,43 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=Muon/Backend -Exec=blubb -Icon=plasma -Name=Correct -Name[ca]=Correcte -Name[ca@valencia]=Correcte -Name[cs]=Správně -Name[da]=Korrekt -Name[de]=Richtig -Name[en_GB]=Correct -Name[es]=Correcto -Name[fi]=Oikea -Name[fr]=Correct -Name[gl]=Correcto -Name[hu]=Helyes -Name[it]=Corretto -Name[ko]=올바름 -Name[nb]=Riktig -Name[nl]=Juist -Name[nn]=Rett -Name[pl]=Poprawny -Name[pt]=Correcto -Name[pt_BR]=Certo -Name[ru]=Верно -Name[sk]=Správne -Name[sl]=Popravi -Name[sr]=Тачно -Name[sr@ijekavian]=Тачно -Name[sr@ijekavianlatin]=Tačno -Name[sr@latin]=Tačno -Name[sv]=Riktig -Name[tr]=Doğru -Name[uk]=Правильно -Name[x-test]=xxCorrectxx -Name[zh_CN]=正确 -Name[zh_TW]=修正 - -X-KDE-Library=muon-knsbackend -X-KDE-PluginInfo-Name=muon-knscorrect-backend -X-KDE-PluginInfo-License=GPL -X-Muon-Arguments=testplasmoids.knsrc diff --git a/libmuon/backends/KNSBackend/tests/muon-knswrong-backend.desktop b/libmuon/backends/KNSBackend/tests/muon-knswrong-backend.desktop deleted file mode 100644 index d992809..0000000 --- a/libmuon/backends/KNSBackend/tests/muon-knswrong-backend.desktop +++ /dev/null @@ -1,46 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=Muon/Backend -Exec=blubb -Icon=plasma -Name=Wrong -Name[ca]=Erroni -Name[ca@valencia]=Erroni -Name[cs]=Špatně -Name[da]=Forkert -Name[de]=Falsch -Name[el]=Λάθος -Name[en_GB]=Wrong -Name[es]=Incorrecto -Name[fi]=Väärä -Name[fr]=Incorrect -Name[gl]=Incorrecto -Name[hu]=Hibás -Name[id]=Salah -Name[it]=Errato -Name[ko]=잘못됨 -Name[lt]=Klaidingai -Name[nb]=Feil -Name[nl]=Verkeerd -Name[nn]=Feil -Name[pl]=Niepoprawny -Name[pt]=Errado -Name[pt_BR]=Errado -Name[ru]=Неверно -Name[sk]=Zlé -Name[sl]=Wrong -Name[sr]=Погрешно -Name[sr@ijekavian]=Погрешно -Name[sr@ijekavianlatin]=Pogrešno -Name[sr@latin]=Pogrešno -Name[sv]=Felaktig -Name[tr]=Hatalı -Name[uk]=Помилка -Name[x-test]=xxWrongxx -Name[zh_CN]=错误 -Name[zh_TW]=錯誤 - -X-KDE-Library=muon-knsbackend -X-KDE-PluginInfo-Name=muon-knswrong-backend -X-KDE-PluginInfo-License=GPL -X-Muon-Arguments=wrong.knsrc diff --git a/libmuon/backends/KNSBackend/tests/testplasmoids.knsrc b/libmuon/backends/KNSBackend/tests/testplasmoids.knsrc deleted file mode 100644 index 19293b5..0000000 --- a/libmuon/backends/KNSBackend/tests/testplasmoids.knsrc +++ /dev/null @@ -1,6 +0,0 @@ -[KNewStuff3] -ProvidersUrl=http://download.kde.org/ocs/providers.xml -Categories=Plasma 5 Plasmoid -StandardResource=tmp -InstallationCommand=plasmapkg2 -i %f -UninstallCommand=plasmapkg2 -r %f diff --git a/libmuon/backends/PackageKitBackend/AppPackageKitResource.cpp b/libmuon/backends/PackageKitBackend/AppPackageKitResource.cpp deleted file mode 100644 index 2e545e4..0000000 --- a/libmuon/backends/PackageKitBackend/AppPackageKitResource.cpp +++ /dev/null @@ -1,144 +0,0 @@ -/*************************************************************************** - * Copyright © 2013 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "AppPackageKitResource.h" -#include <AppstreamQt/screenshot.h> -#include <AppstreamQt/image.h> -#include <KLocalizedString> -#include <KToolInvocation> -#include <QDebug> - -AppPackageKitResource::AppPackageKitResource(const Appstream::Component& data, PackageKitBackend* parent) - : PackageKitResource(data.packageNames().first(), QString(), parent) - , m_appdata(data) -{ - Q_ASSERT(data.isValid()); -} - -QString AppPackageKitResource::name() -{ - return m_appdata.name(); -} - -QString AppPackageKitResource::longDescription() -{ - return m_appdata.description(); -} - -QString AppPackageKitResource::icon() const -{ - QString anIcon = m_appdata.icon(); - if (anIcon.isEmpty()) { - QUrl iconUrl = m_appdata.iconUrl(QSize()); - if (iconUrl.isLocalFile()) - anIcon = iconUrl.toLocalFile(); - } - return anIcon; -} - -QString AppPackageKitResource::license() -{ - return m_appdata.projectLicense(); -} - -QStringList AppPackageKitResource::mimetypes() const -{ - return findProvides(Appstream::Provides::KindMimetype); -} - -QStringList AppPackageKitResource::categories() -{ - return m_appdata.categories(); -} - -QString AppPackageKitResource::comment() -{ - return m_appdata.summary(); -} - -QUrl AppPackageKitResource::homepage() -{ - QList< QUrl > urls = m_appdata.urls(Appstream::Component::UrlKindHomepage); - return urls.isEmpty() ? PackageKitResource::homepage() : urls.first(); -} - -bool AppPackageKitResource::isTechnical() const -{ - return false; -} - -QStringList AppPackageKitResource::executables() const -{ - return findProvides(Appstream::Provides::KindBinary); -} - -void AppPackageKitResource::invokeApplication() const -{ - QStringList exes = executables(); - if(!exes.isEmpty()) - KToolInvocation::startServiceByDesktopPath(exes.first()); -} - -QUrl screenshot(const Appstream::Component& comp, Appstream::Image::Kind kind) -{ - QUrl ret; - Q_FOREACH (const Appstream::Screenshot &s, comp.screenshots()) { - Q_FOREACH (const Appstream::Image &i, s.images()) { - if (i.kind() == kind) { - ret = i.url(); - } - } - if (s.isDefault() && !ret.isEmpty()) - break; - } - return ret; -} - -QUrl AppPackageKitResource::screenshotUrl() -{ - QUrl url = screenshot(m_appdata, Appstream::Image::Plain); - return url.isEmpty() ? PackageKitResource::screenshotUrl() : url; - -} - -QUrl AppPackageKitResource::thumbnailUrl() -{ - QUrl url = screenshot(m_appdata, Appstream::Image::Thumbnail); - return url.isEmpty() ? PackageKitResource::screenshotUrl() : url; -} - -bool AppPackageKitResource::canExecute() const -{ - return !executables().isEmpty(); -} - -QStringList AppPackageKitResource::findProvides(Appstream::Provides::Kind kind) const -{ - QStringList ret; - Q_FOREACH (Appstream::Provides p, m_appdata.provides()) - if (p.kind() == kind) - ret += p.value(); - return ret; -} - -QStringList AppPackageKitResource::allPackageNames() const -{ - return m_appdata.packageNames(); -} diff --git a/libmuon/backends/PackageKitBackend/AppPackageKitResource.h b/libmuon/backends/PackageKitBackend/AppPackageKitResource.h deleted file mode 100644 index 65ef3cf..0000000 --- a/libmuon/backends/PackageKitBackend/AppPackageKitResource.h +++ /dev/null @@ -1,55 +0,0 @@ -/*************************************************************************** - * Copyright © 2013 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef APPPACKAGEKITRESOURCE_H -#define APPPACKAGEKITRESOURCE_H - -#include "PackageKitResource.h" -#include "PackageKitBackend.h" - -class AppPackageKitResource : public PackageKitResource -{ - Q_OBJECT - public: - explicit AppPackageKitResource(const Appstream::Component& data, PackageKitBackend* parent); - - virtual bool isTechnical() const override; - virtual QString name() override; - virtual QString icon() const override; - virtual QStringList mimetypes() const override; - virtual QStringList categories() override; - virtual QString longDescription() override; - virtual QUrl homepage() override; - virtual bool canExecute() const override; - virtual QStringList executables() const override; - virtual void invokeApplication() const override; - virtual QString comment() override; - virtual QString license() override; - virtual QUrl screenshotUrl() override; - virtual QUrl thumbnailUrl() override; - virtual QStringList allPackageNames() const override; - - private: - QStringList findProvides(Appstream::Provides::Kind kind) const; - - Appstream::Component m_appdata; -}; - -#endif // APPPACKAGEKITRESOURCE_H diff --git a/libmuon/backends/PackageKitBackend/CMakeLists.txt b/libmuon/backends/PackageKitBackend/CMakeLists.txt deleted file mode 100644 index bb4716f..0000000 --- a/libmuon/backends/PackageKitBackend/CMakeLists.txt +++ /dev/null @@ -1,21 +0,0 @@ -set(pkbackend_SRCS - PackageKitBackend.cpp - PackageKitResource.cpp - AppPackageKitResource.cpp - PKTransaction.cpp - PackageKitUpdater.cpp - PackageKitMessages.cpp -) - -add_library(muon-pkbackend MODULE ${pkbackend_SRCS}) -target_link_libraries(muon-pkbackend PRIVATE MuonCommon Qt5::Core PK::packagekitqt5 KF5::ConfigGui KF5::Service AppstreamQt) - -install(TARGETS muon-pkbackend DESTINATION ${PLUGIN_INSTALL_DIR}/muon) -install(FILES muon-packagekit-backend.desktop DESTINATION ${DATA_INSTALL_DIR}/libmuon/backends) -install(FILES muon-packagekit-backend-categories.xml DESTINATION ${DATA_INSTALL_DIR}/libmuon/categories) - -#notifier -add_library(MuonPackageKitNotifier MODULE PackageKitNotifier.cpp) -target_link_libraries(MuonPackageKitNotifier PRIVATE PK::packagekitqt5 MuonNotifiers) - -install(TARGETS MuonPackageKitNotifier DESTINATION ${PLUGIN_INSTALL_DIR}/muon-notifier) diff --git a/libmuon/backends/PackageKitBackend/PKTransaction.cpp b/libmuon/backends/PackageKitBackend/PKTransaction.cpp deleted file mode 100644 index 37b4216..0000000 --- a/libmuon/backends/PackageKitBackend/PKTransaction.cpp +++ /dev/null @@ -1,156 +0,0 @@ -/*************************************************************************** - * Copyright © 2013 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "PKTransaction.h" -#include "PackageKitBackend.h" -#include "PackageKitResource.h" -#include "PackageKitMessages.h" -#include <resources/AbstractResource.h> -#include <Transaction/TransactionModel.h> -#include <QDebug> -#include <QMessageBox> -#include <KLocalizedString> -#include <PackageKit/Transaction> -#include <PackageKit/Daemon> - -PKTransaction::PKTransaction(AbstractResource* app, Transaction::Role role) - : Transaction(app, app, role), - m_trans(nullptr) -{ -} - -void PKTransaction::start() -{ - if (m_trans) - m_trans->deleteLater(); - - switch (role()) { - case Transaction::InstallRole: - m_trans = PackageKit::Daemon::installPackage(qobject_cast<PackageKitResource*>(resource())->availablePackageId()); - break; - case Transaction::RemoveRole: - //see bug #315063 - m_trans = PackageKit::Daemon::removePackage(qobject_cast<PackageKitResource*>(resource())->installedPackageId(), true /*allowDeps*/); - break; - case Transaction::ChangeAddonsRole: - qWarning() << "addons unsupported in PackageKit backend"; - break; - }; - Q_ASSERT(m_trans); - - connect(m_trans, SIGNAL(finished(PackageKit::Transaction::Exit,uint)), SLOT(cleanup(PackageKit::Transaction::Exit,uint))); - connect(m_trans, SIGNAL(errorCode(PackageKit::Transaction::Error,QString)), SLOT(errorFound(PackageKit::Transaction::Error,QString))); - connect(m_trans, SIGNAL(mediaChangeRequired(PackageKit::Transaction::MediaType,QString,QString)), - SLOT(mediaChange(PackageKit::Transaction::MediaType,QString,QString))); - connect(m_trans, SIGNAL(requireRestart(PackageKit::Transaction::Restart,QString)), - SLOT(requireRestart(PackageKit::Transaction::Restart,QString))); - connect(m_trans, SIGNAL(itemProgress(QString, PackageKit::Transaction::Status, uint)), SLOT(progressChanged(QString, PackageKit::Transaction::Status, uint))); - connect(m_trans, SIGNAL(eulaRequired(QString, QString, QString, QString)), SLOT(eulaRequired(QString, QString, QString, QString))); - connect(m_trans, SIGNAL(allowCancelChanged()), SLOT(cancellableChanged())); - - setCancellable(m_trans->allowCancel()); -} - -void PKTransaction::progressChanged(const QString &id, PackageKit::Transaction::Status status, uint percentage) -{ - Q_UNUSED(percentage); - PackageKitResource * res = qobject_cast<PackageKitResource*>(resource()); - if (id != res->availablePackageId() || id != res->installedPackageId()) - return; - - if (status == PackageKit::Transaction::StatusDownload) - setStatus(Transaction::DownloadingStatus); - else - setStatus(Transaction::CommittingStatus); -} - -void PKTransaction::cancellableChanged() -{ - setCancellable(m_trans->allowCancel()); -} - -void PKTransaction::cancel() -{ - m_trans->cancel(); -} - -void PKTransaction::cleanup(PackageKit::Transaction::Exit exit, uint runtime) -{ - Q_UNUSED(runtime) - if (exit == PackageKit::Transaction::ExitEulaRequired) - return; - - if (exit == PackageKit::Transaction::ExitCancelled) { - deleteLater(); - } else { - disconnect(m_trans, nullptr, this, nullptr); - m_trans = nullptr; - } - PackageKit::Transaction* t = PackageKit::Daemon::resolve(resource()->packageName(), PackageKit::Transaction::FilterArch); - connect(t, &PackageKit::Transaction::package, t, [t](PackageKit::Transaction::Info info, const QString& packageId) { - QMap<PackageKit::Transaction::Info, QStringList> packages = t->property("packages").value<QMap<PackageKit::Transaction::Info, QStringList>>(); - packages[info].append(packageId); - t->setProperty("packages", qVariantFromValue(packages)); - }); - - connect(t, &PackageKit::Transaction::finished, t, [t, this](PackageKit::Transaction::Exit status, uint runtime){ - QMap<PackageKit::Transaction::Info, QStringList> packages = t->property("packages").value<QMap<PackageKit::Transaction::Info, QStringList>>(); - qobject_cast<PackageKitResource*>(resource())->setPackages(packages); - setStatus(Transaction::DoneStatus); - qobject_cast<PackageKitBackend*>(resource()->backend())->removeTransaction(this); - }); -} - -PackageKit::Transaction* PKTransaction::transaction() -{ - return m_trans; -} - -void PKTransaction::eulaRequired(const QString& eulaID, const QString& packageID, const QString& vendor, const QString& licenseAgreement) -{ - int ret = QMessageBox::question(nullptr, i18n("Accept EULA"), i18n("The package %1 and its vendor %2 require that you accept their license:\n %3", - PackageKit::Daemon::packageName(packageID), vendor, licenseAgreement)); - if (ret == QMessageBox::Yes) { - PackageKit::Transaction* t = PackageKit::Daemon::acceptEula(eulaID); - connect(t, SIGNAL(finished(PackageKit::Transaction::Exit,uint)), this, SLOT(start())); - } else { - cleanup(PackageKit::Transaction::ExitCancelled, 0); - } -} - -void PKTransaction::errorFound(PackageKit::Transaction::Error err, const QString& error) -{ - Q_UNUSED(error); - if (err == PackageKit::Transaction::ErrorNoLicenseAgreement) - return; - qWarning() << "PackageKit error:" << err << PackageKitMessages::errorMessage(err); - QMessageBox::critical(nullptr, i18n("PackageKit Error"), PackageKitMessages::errorMessage(err)); -} - -void PKTransaction::mediaChange(PackageKit::Transaction::MediaType media, const QString& type, const QString& text) -{ - Q_UNUSED(media) - QMessageBox::information(nullptr, i18n("PackageKit media change"), i18n("Media Change of type '%1' is requested.\n%2", type, text)); -} - -void PKTransaction::requireRestart(PackageKit::Transaction::Restart restart, const QString& pkgid) -{ - QMessageBox::information(nullptr, i18n("PackageKit restart required"), PackageKitMessages::restartMessage(restart, pkgid)); -} diff --git a/libmuon/backends/PackageKitBackend/PKTransaction.h b/libmuon/backends/PackageKitBackend/PKTransaction.h deleted file mode 100644 index 30cb8c5..0000000 --- a/libmuon/backends/PackageKitBackend/PKTransaction.h +++ /dev/null @@ -1,52 +0,0 @@ -/*************************************************************************** - * Copyright © 2013 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef PKTRANSACTION_H -#define PKTRANSACTION_H - -#include <Transaction/Transaction.h> -#include <PackageKit/Transaction> - -class PKTransaction : public Transaction -{ - Q_OBJECT - public: - explicit PKTransaction(AbstractResource* app, Transaction::Role role); - PackageKit::Transaction* transaction(); - - void cancel(); - - public slots: - void start(); - - private slots: - void cleanup(PackageKit::Transaction::Exit, uint); - void errorFound(PackageKit::Transaction::Error err, const QString& error); - void mediaChange(PackageKit::Transaction::MediaType media, const QString& type, const QString& text); - void requireRestart(PackageKit::Transaction::Restart restart, const QString& p); - void progressChanged(const QString&, PackageKit::Transaction::Status, uint); - void eulaRequired(const QString &eulaID, const QString &packageID, const QString &vendor, const QString &licenseAgreement); - void cancellableChanged(); - - private: - PackageKit::Transaction* m_trans; -}; - -#endif // PKTRANSACTION_H diff --git a/libmuon/backends/PackageKitBackend/PackageKitBackend.cpp b/libmuon/backends/PackageKitBackend/PackageKitBackend.cpp deleted file mode 100644 index ea8cde2..0000000 --- a/libmuon/backends/PackageKitBackend/PackageKitBackend.cpp +++ /dev/null @@ -1,361 +0,0 @@ -/*************************************************************************** - * Copyright © 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * Copyright © 2013 Lukas Appelhans <l.appelhans@gmx.de> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "PackageKitBackend.h" -#include "PackageKitResource.h" -#include "PackageKitUpdater.h" -#include "AppPackageKitResource.h" -#include "PKTransaction.h" -#include <resources/AbstractResource.h> -#include <resources/StandardBackendUpdater.h> -#include <Transaction/TransactionModel.h> -#include <QStringList> -#include <QDebug> -#include <QTimer> -#include <QTimerEvent> -#include <PackageKit/Transaction> -#include <PackageKit/Daemon> -#include <PackageKit/Details> - -#include <KLocalizedString> -#include <QAction> - -MUON_BACKEND_PLUGIN(PackageKitBackend) - -PackageKitBackend::PackageKitBackend(QObject* parent) - : AbstractResourcesBackend(parent) - , m_updater(new PackageKitUpdater(this)) - , m_refresher(nullptr) - , m_isFetching(0) -{ - bool b = m_appdata.open(); - Q_ASSERT(b && "must be able to open the appstream database"); - if (!b) { - qWarning() << "Couldn't open the AppStream database"; - } - reloadPackageList(); - - QTimer* t = new QTimer(this); - connect(t, &QTimer::timeout, this, &PackageKitBackend::refreshDatabase); - t->setInterval(60 * 60 * 1000); - t->setSingleShot(false); - t->start(); - - QAction* updateAction = new QAction(this); - updateAction->setIcon(QIcon::fromTheme("system-software-update")); - updateAction->setText(i18nc("@action Checks the Internet for updates", "Check for Updates")); - updateAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_R)); - connect(updateAction, &QAction::triggered, this, &PackageKitBackend::refreshDatabase); - m_messageActions += updateAction; - - connect(PackageKit::Daemon::global(), &PackageKit::Daemon::updatesChanged, this, &PackageKitBackend::fetchUpdates); - connect(PackageKit::Daemon::global(), &PackageKit::Daemon::isRunningChanged, this, &PackageKitBackend::checkDaemonRunning); -} - -PackageKitBackend::~PackageKitBackend() -{ -} - -bool PackageKitBackend::isFetching() const -{ - return m_isFetching; -} - -void PackageKitBackend::acquireFetching(bool f) -{ - if (f) - m_isFetching++; - else - m_isFetching--; - - if ((!f && m_isFetching==0) || (f && m_isFetching==1)) { - emit fetchingChanged(); - } - Q_ASSERT(m_isFetching>=0); -} - -void PackageKitBackend::reloadPackageList() -{ - m_updatingPackages = m_packages; - m_updatingTranslationPackageToApp = m_translationPackageToApp; - - if (m_refresher) { - disconnect(m_refresher, SIGNAL(finished(PackageKit::Transaction::Exit,uint)), this, SLOT(reloadPackageList())); - } - - for(const Appstream::Component& component: m_appdata.allComponents()) { - m_updatingPackages[component.id()] = new AppPackageKitResource(component, this); - foreach (const QString& pkg, component.packageNames()) { - m_updatingTranslationPackageToApp[pkg] += component.id(); - } - } - - PackageKit::Transaction * t = PackageKit::Daemon::getPackages(); - connect(t, SIGNAL(finished(PackageKit::Transaction::Exit,uint)), this, SLOT(getPackagesFinished(PackageKit::Transaction::Exit))); - connect(t, SIGNAL(package(PackageKit::Transaction::Info, QString, QString)), SLOT(addPackage(PackageKit::Transaction::Info, QString, QString))); - connect(t, SIGNAL(errorCode(PackageKit::Transaction::Error,QString)), SLOT(transactionError(PackageKit::Transaction::Error,QString))); - acquireFetching(true); - - fetchUpdates(); -} - -void PackageKitBackend::fetchUpdates() -{ - m_updatesPackageId.clear(); - - PackageKit::Transaction * tUpdates = PackageKit::Daemon::getUpdates(); - connect(tUpdates, SIGNAL(finished(PackageKit::Transaction::Exit,uint)), this, SLOT(getUpdatesFinished(PackageKit::Transaction::Exit,uint))); - connect(tUpdates, SIGNAL(package(PackageKit::Transaction::Info, QString, QString)), SLOT(addPackageToUpdate(PackageKit::Transaction::Info,QString,QString))); - connect(tUpdates, SIGNAL(errorCode(PackageKit::Transaction::Error,QString)), SLOT(transactionError(PackageKit::Transaction::Error,QString))); - acquireFetching(true); -} - - -void PackageKitBackend::addPackage(PackageKit::Transaction::Info info, const QString &packageId, const QString &summary) -{ - const QString packageName = PackageKit::Daemon::packageName(packageId); - QVector<AbstractResource*> r = resourcesByPackageName(packageName, true); - if (r.isEmpty()) { - r += new PackageKitResource(packageName, summary, this); - m_updatingPackages[packageName] = r.last(); - } - foreach(const auto & res, r) - static_cast<PackageKitResource*>(res)->addPackageId(info, packageId, summary); -} - -void PackageKitBackend::getPackagesFinished(PackageKit::Transaction::Exit exit) -{ - Q_ASSERT(m_isFetching); - - if (exit != PackageKit::Transaction::ExitSuccess) { - qWarning() << "error while fetching details" << exit; - } - - for(auto it = m_updatingPackages.begin(); it != m_updatingPackages.end(); ) { - auto pkr = qobject_cast<PackageKitResource*>(it.value()); - if (pkr->packages().isEmpty()) { - qWarning() << "Failed to find package for" << it.key(); - it.value()->deleteLater(); - it = m_updatingPackages.erase(it); - } else - ++it; - } - - m_packages = m_updatingPackages; - m_translationPackageToApp = m_updatingTranslationPackageToApp; - acquireFetching(false); -} - -void PackageKitBackend::transactionError(PackageKit::Transaction::Error, const QString& message) -{ - qWarning() << "Transaction error: " << message << sender(); -} - -void PackageKitBackend::packageDetails(const PackageKit::Details& details) -{ - QVector<AbstractResource*> resources = resourcesByPackageName(PackageKit::Daemon::packageName(details.packageId()), false); - foreach(AbstractResource* res, resources) - qobject_cast<PackageKitResource*>(res)->setDetails(details); -} - -QVector<AbstractResource*> PackageKitBackend::resourcesByPackageName(const QString& name, bool updating) const -{ - const QHash<QString, QStringList> *dictionary = updating ? &m_updatingTranslationPackageToApp : &m_translationPackageToApp; - const QHash<QString, AbstractResource*> *pkgs = updating ? &m_updatingPackages : &m_packages; - - const QStringList names = dictionary->value(name, QStringList(name)); - QVector<AbstractResource*> ret; - ret.reserve(names.size()); - foreach(const QString& name, names) { - AbstractResource* res = pkgs->value(name); - if (res) - ret += res; - } - return ret; -} - -void PackageKitBackend::refreshDatabase() -{ - if (!m_refresher) { - m_refresher = PackageKit::Daemon::refreshCache(false); - connect(m_refresher, SIGNAL(finished(PackageKit::Transaction::Exit,uint)), SLOT(reloadPackageList())); - } else { - qWarning() << "already resetting"; - } -} - -QVector<AbstractResource*> PackageKitBackend::allResources() const -{ - return m_packages.values().toVector(); -} - -AbstractResource* PackageKitBackend::resourceByPackageName(const QString& name) const -{ - const QStringList ids = m_translationPackageToApp.value(name, QStringList(name)); - return ids.isEmpty() ? nullptr : m_packages[ids.first()]; -} - -QList<AbstractResource*> PackageKitBackend::searchPackageName(const QString& searchText) -{ - QList<AbstractResource*> ret; - Q_FOREACH (AbstractResource* res, m_packages.values()) { - if (res->name().contains(searchText, Qt::CaseInsensitive)) { - ret += res; - } - } - return ret; -} - -int PackageKitBackend::updatesCount() const -{ - return m_updatesPackageId.count(); -} - -void PackageKitBackend::removeTransaction(Transaction* t) -{ - qDebug() << "Remove transaction:" << t->resource()->packageName() << "with" << m_transactions.size() << "transactions running"; - int count = m_transactions.removeAll(t); - Q_ASSERT(count==1); - Q_UNUSED(count) - TransactionModel::global()->removeTransaction(t); -} - -void PackageKitBackend::installApplication(AbstractResource* app, AddonList ) -{ - installApplication(app); -} - -void PackageKitBackend::installApplication(AbstractResource* app) -{ - PKTransaction* t = new PKTransaction(app, Transaction::InstallRole); - m_transactions.append(t); - TransactionModel::global()->addTransaction(t); - t->start(); -} - -void PackageKitBackend::cancelTransaction(AbstractResource* app) -{ - Q_FOREACH (Transaction* t, m_transactions) { - PKTransaction* pkt = qobject_cast<PKTransaction*>(t); - if (pkt->resource() == app) { - if (pkt->transaction()->allowCancel()) { - pkt->transaction()->cancel(); - int count = m_transactions.removeAll(t); - Q_ASSERT(count==1); - Q_UNUSED(count) - //TransactionModel::global()->cancelTransaction(t); - } else { - qWarning() << "trying to cancel a non-cancellable transaction: " << app->name(); - } - break; - } - } -} - -void PackageKitBackend::removeApplication(AbstractResource* app) -{ - Q_ASSERT(!isFetching()); - PKTransaction* t = new PKTransaction(app, Transaction::RemoveRole); - m_transactions.append(t); - TransactionModel::global()->addTransaction(t); - t->start(); -} - -QList<AbstractResource*> PackageKitBackend::upgradeablePackages() const -{ - QVector<AbstractResource*> ret; - Q_FOREACH (const QString& pkgid, m_updatesPackageId) { - const QString pkgname = PackageKit::Daemon::packageName(pkgid); - ret += resourcesByPackageName(pkgname, false); - if (ret.isEmpty()) { - qWarning() << "couldn't find resource for" << pkgid; - } - } - return ret.toList(); -} - -void PackageKitBackend::addPackageToUpdate(PackageKit::Transaction::Info info, const QString& packageId, const QString& summary) -{ - if (info != PackageKit::Transaction::InfoBlocked) { - m_updatesPackageId += packageId; - addPackage(info, packageId, summary); - } -} - -void PackageKitBackend::getUpdatesFinished(PackageKit::Transaction::Exit, uint) -{ - if (!m_updatesPackageId.isEmpty()) { - acquireFetching(true); - PackageKit::Transaction* transaction = PackageKit::Daemon::getDetails(m_updatesPackageId.toList()); - connect(transaction, SIGNAL(details(PackageKit::Details)), SLOT(packageDetails(PackageKit::Details))); - connect(transaction, SIGNAL(errorCode(PackageKit::Transaction::Error,QString)), SLOT(transactionError(PackageKit::Transaction::Error,QString))); - connect(transaction, SIGNAL(finished(PackageKit::Transaction::Exit,uint)), SLOT(getUpdatesDetailsFinished(PackageKit::Transaction::Exit,uint))); - } - - acquireFetching(false); - emit updatesCountChanged(); -} - -void PackageKitBackend::getUpdatesDetailsFinished(PackageKit::Transaction::Exit exit, uint) -{ - if (exit != PackageKit::Transaction::ExitSuccess) { - qWarning() << "Couldn't figure out the updates on PackageKit backend" << exit; - } - acquireFetching(false); -} - -bool PackageKitBackend::isPackageNameUpgradeable(const PackageKitResource* res) const -{ - return !upgradeablePackageId(res).isEmpty(); -} - -QString PackageKitBackend::upgradeablePackageId(const PackageKitResource* res) const -{ - QString name = res->packageName(); - for (const QString& pkgid: m_updatesPackageId) { - if (PackageKit::Daemon::packageName(pkgid) == name) - return pkgid; - } - return QString(); -} - -void PackageKitBackend::checkDaemonRunning() -{ - if (!PackageKit::Daemon::isRunning()) { - qWarning() << "PackageKit stopped running!"; - } -} - -AbstractBackendUpdater* PackageKitBackend::backendUpdater() const -{ - return m_updater; -} - -QList<QAction*> PackageKitBackend::messageActions() const -{ - return m_messageActions; -} - - -//TODO -AbstractReviewsBackend* PackageKitBackend::reviewsBackend() const { return nullptr; } - -#include "PackageKitBackend.moc" diff --git a/libmuon/backends/PackageKitBackend/PackageKitBackend.h b/libmuon/backends/PackageKitBackend/PackageKitBackend.h deleted file mode 100644 index 64be4a8..0000000 --- a/libmuon/backends/PackageKitBackend/PackageKitBackend.h +++ /dev/null @@ -1,96 +0,0 @@ -/*************************************************************************** - * Copyright © 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef PACKAGEKITBACKEND_H -#define PACKAGEKITBACKEND_H - -#include "PackageKitResource.h" -#include <resources/AbstractResourcesBackend.h> -#include <QVariantList> -#include <QStringList> -#include <qpointer.h> -#include <QSet> -#include <PackageKit/Transaction> -#include <AppstreamQt/database.h> -#include <functional> - -class PackageKitUpdater; - -class MUONCOMMON_EXPORT PackageKitBackend : public AbstractResourcesBackend -{ - Q_OBJECT - public: - explicit PackageKitBackend(QObject* parent = nullptr); - ~PackageKitBackend(); - - virtual AbstractBackendUpdater* backendUpdater() const override; - virtual AbstractReviewsBackend* reviewsBackend() const override; - - virtual QVector< AbstractResource* > allResources() const override; - virtual AbstractResource* resourceByPackageName(const QString& name) const override; - virtual QList<AbstractResource*> searchPackageName(const QString& searchText) override; - virtual int updatesCount() const override; - - virtual void installApplication(AbstractResource* app) override; - virtual void installApplication(AbstractResource* app, AddonList addons) override; - virtual void removeApplication(AbstractResource* app) override; - virtual void cancelTransaction(AbstractResource* app) override; - virtual bool isValid() const override { return true; } - virtual QList<AbstractResource*> upgradeablePackages() const override; - virtual bool isFetching() const override; - virtual QList<QAction*> messageActions() const override; - - bool isPackageNameUpgradeable(const PackageKitResource* res) const; - QString upgradeablePackageId(const PackageKitResource* res) const; - QVector<AbstractResource*> resourcesByPackageName(const QString& name, bool updating) const; - - public slots: - void removeTransaction(Transaction* t); - void reloadPackageList(); - void refreshDatabase(); - - private slots: - void getPackagesFinished(PackageKit::Transaction::Exit exit); - void addPackage(PackageKit::Transaction::Info info, const QString &packageId, const QString &summary); - void packageDetails(const PackageKit::Details& details); - void transactionError(PackageKit::Transaction::Error, const QString& message); - void addPackageToUpdate(PackageKit::Transaction::Info, const QString& pkgid, const QString& summary); - void getUpdatesFinished(PackageKit::Transaction::Exit,uint); - void getUpdatesDetailsFinished(PackageKit::Transaction::Exit,uint); - - private: - void checkDaemonRunning(); - void fetchUpdates(); - void acquireFetching(bool f); - - QHash<QString, AbstractResource*> m_packages; - QHash<QString, AbstractResource*> m_updatingPackages; - Appstream::Database m_appdata; - QList<Transaction*> m_transactions; - PackageKitUpdater* m_updater; - QPointer<PackageKit::Transaction> m_refresher; - int m_isFetching; - QSet<QString> m_updatesPackageId; - QList<QAction*> m_messageActions; - QHash<QString, QStringList> m_translationPackageToApp; - QHash<QString, QStringList> m_updatingTranslationPackageToApp; -}; - -#endif // PACKAGEKITBACKEND_H diff --git a/libmuon/backends/PackageKitBackend/PackageKitMessages.cpp b/libmuon/backends/PackageKitBackend/PackageKitMessages.cpp deleted file mode 100644 index a952f97..0000000 --- a/libmuon/backends/PackageKitBackend/PackageKitMessages.cpp +++ /dev/null @@ -1,333 +0,0 @@ -/*************************************************************************** - * Copyright © 2012-2014 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * Copyright © 2013 Lukas Appelhans <l.appelhans@gmx.de> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "PackageKitMessages.h" -#include <PackageKit/Transaction> -#include <Daemon> -#include <KLocalizedString> - -namespace PackageKitMessages -{ - -QString errorMessage(PackageKit::Transaction::Error error) -{ - switch(error) { - case PackageKit::Transaction::ErrorOom: - return i18n("Out of memory"); - case PackageKit::Transaction::ErrorNoNetwork: - return i18n("No network connection available"); - case PackageKit::Transaction::ErrorNotSupported: - return i18n("Operation not supported"); - case PackageKit::Transaction::ErrorInternalError: - return i18n("Internal error"); - case PackageKit::Transaction::ErrorGpgFailure: - return i18n("GPG failure"); - case PackageKit::Transaction::ErrorPackageIdInvalid: - return i18n("PackageID invalid"); - case PackageKit::Transaction::ErrorPackageNotInstalled: - return i18n("Package not installed"); - case PackageKit::Transaction::ErrorPackageNotFound: - return i18n("Package not found"); - case PackageKit::Transaction::ErrorPackageAlreadyInstalled: - return i18n("Package is already installed"); - case PackageKit::Transaction::ErrorPackageDownloadFailed: - return i18n("Package download failed"); - case PackageKit::Transaction::ErrorGroupNotFound: - return i18n("Package group not found"); - case PackageKit::Transaction::ErrorGroupListInvalid: - return i18n("Package group list invalid"); - case PackageKit::Transaction::ErrorDepResolutionFailed: - return i18n("Dependency resolution failed"); - case PackageKit::Transaction::ErrorFilterInvalid: - return i18n("Filter invalid"); - case PackageKit::Transaction::ErrorCreateThreadFailed: - return i18n("Failed while creating a thread"); - case PackageKit::Transaction::ErrorTransactionError: - return i18n("Transaction failure"); - case PackageKit::Transaction::ErrorTransactionCancelled: - return i18n("Transaction canceled"); - case PackageKit::Transaction::ErrorNoCache: - return i18n("No Cache available"); - case PackageKit::Transaction::ErrorRepoNotFound: - return i18n("Cannot find repository"); - case PackageKit::Transaction::ErrorCannotRemoveSystemPackage: - return i18n("Cannot remove system package"); - case PackageKit::Transaction::ErrorProcessKill: - return i18n("The PackageKit daemon has crashed"); - case PackageKit::Transaction::ErrorFailedInitialization: - return i18n("Initialization failure"); - case PackageKit::Transaction::ErrorFailedFinalise: - return i18n("Failed to finalize transaction"); - case PackageKit::Transaction::ErrorFailedConfigParsing: - return i18n("Config parsing failed"); - case PackageKit::Transaction::ErrorCannotCancel: - return i18n("Cannot cancel transaction"); - case PackageKit::Transaction::ErrorCannotGetLock: - return i18n("Cannot obtain lock"); - case PackageKit::Transaction::ErrorNoPackagesToUpdate: - return i18n("No packages to update"); - case PackageKit::Transaction::ErrorCannotWriteRepoConfig: - return i18n("Cannot write repo config"); - case PackageKit::Transaction::ErrorLocalInstallFailed: - return i18n("Local install failed"); - case PackageKit::Transaction::ErrorBadGpgSignature: - return i18n("Bad GPG signature found"); - case PackageKit::Transaction::ErrorMissingGpgSignature: - return i18n("No GPG signature found"); - case PackageKit::Transaction::ErrorCannotInstallSourcePackage: - return i18n("Cannot install source package"); - case PackageKit::Transaction::ErrorRepoConfigurationError: - return i18n("Repo configuration error"); - case PackageKit::Transaction::ErrorNoLicenseAgreement: - return i18n("No license agreement"); - case PackageKit::Transaction::ErrorFileConflicts: - return i18n("File conflicts found"); - case PackageKit::Transaction::ErrorPackageConflicts: - return i18n("Package conflict found"); - case PackageKit::Transaction::ErrorRepoNotAvailable: - return i18n("Repo not available"); - case PackageKit::Transaction::ErrorInvalidPackageFile: - return i18n("Invalid package file"); - case PackageKit::Transaction::ErrorPackageInstallBlocked: - return i18n("Package install blocked"); - case PackageKit::Transaction::ErrorPackageCorrupt: - return i18n("Corrupt package found"); - case PackageKit::Transaction::ErrorAllPackagesAlreadyInstalled: - return i18n("All packages already installed"); - case PackageKit::Transaction::ErrorFileNotFound: - return i18n("File not found"); - case PackageKit::Transaction::ErrorNoMoreMirrorsToTry: - return i18n("No more mirrors available"); - case PackageKit::Transaction::ErrorNoDistroUpgradeData: - return i18n("No distro upgrade data"); - case PackageKit::Transaction::ErrorIncompatibleArchitecture: - return i18n("Incompatible architecture"); - case PackageKit::Transaction::ErrorNoSpaceOnDevice: - return i18n("No space on device left"); - case PackageKit::Transaction::ErrorMediaChangeRequired: - return i18n("A media change is required"); - case PackageKit::Transaction::ErrorNotAuthorized: - return i18n("You have no authorization to execute this operation"); - case PackageKit::Transaction::ErrorUpdateNotFound: - return i18n("Update not found"); - case PackageKit::Transaction::ErrorCannotInstallRepoUnsigned: - return i18n("Cannot install from unsigned repo"); - case PackageKit::Transaction::ErrorCannotUpdateRepoUnsigned: - return i18n("Cannot update from unsigned repo"); - case PackageKit::Transaction::ErrorCannotGetFilelist: - return i18n("Cannot get file list"); - case PackageKit::Transaction::ErrorCannotGetRequires: - return i18n("Cannot get requires"); - case PackageKit::Transaction::ErrorCannotDisableRepository: - return i18n("Cannot disable repository"); - case PackageKit::Transaction::ErrorRestrictedDownload: - return i18n("Restricted download detected"); - case PackageKit::Transaction::ErrorPackageFailedToConfigure: - return i18n("Package failed to configure"); - case PackageKit::Transaction::ErrorPackageFailedToBuild: - return i18n("Package failed to build"); - case PackageKit::Transaction::ErrorPackageFailedToInstall: - return i18n("Package failed to install"); - case PackageKit::Transaction::ErrorPackageFailedToRemove: - return i18n("Package failed to remove"); - case PackageKit::Transaction::ErrorUpdateFailedDueToRunningProcess: - return i18n("Update failed due to running process"); - case PackageKit::Transaction::ErrorPackageDatabaseChanged: - return i18n("The package database changed"); - case PackageKit::Transaction::ErrorProvideTypeNotSupported: - return i18n("The provided type is not supported"); - case PackageKit::Transaction::ErrorInstallRootInvalid: - return i18n("Install root is invalid"); - case PackageKit::Transaction::ErrorCannotFetchSources: - return i18n("Cannot fetch sources"); - case PackageKit::Transaction::ErrorCancelledPriority: - return i18n("Canceled priority"); - case PackageKit::Transaction::ErrorUnfinishedTransaction: - return i18n("Unfinished transaction"); - case PackageKit::Transaction::ErrorLockRequired: - return i18n("Lock required"); - case PackageKit::Transaction::ErrorUnknown: - default: { - int idx = PackageKit::Transaction::staticMetaObject.indexOfEnumerator("Error"); - QMetaEnum metaenum = PackageKit::Transaction::staticMetaObject.enumerator(idx); - return i18n("Unknown error %1.", metaenum.valueToKey(error)); - } - } -} - -QString restartMessage(PackageKit::Transaction::Restart restart, const QString& pkgid) -{ - switch (restart) { - case PackageKit::Transaction::RestartApplication: - return i18n("'%1' was changed and suggests to be restarted.", PackageKit::Daemon::packageName(pkgid)); - case PackageKit::Transaction::RestartSession: - return i18n("A change by '%1' suggests your session to be restarted.", PackageKit::Daemon::packageName(pkgid)); - case PackageKit::Transaction::RestartSecuritySession: - return i18n("'%1' was updated for security reasons, a restart of the session is recommended.", PackageKit::Daemon::packageName(pkgid)); - case PackageKit::Transaction::RestartSecuritySystem: - return i18n("'%1' was updated for security reasons, a restart of the system is recommended.", PackageKit::Daemon::packageName(pkgid)); - case PackageKit::Transaction::RestartSystem: - case PackageKit::Transaction::RestartUnknown: - case PackageKit::Transaction::RestartNone: - default: - return i18n("A change by '%1' suggests your system to be rebooted.", PackageKit::Daemon::packageName(pkgid)); - } -} - -QString restartMessage(PackageKit::Transaction::Restart restart) -{ - switch (restart) { - case PackageKit::Transaction::RestartApplication: - return i18n("The application will have to be restarted."); - case PackageKit::Transaction::RestartSession: - return i18n("The session will have to be restarted"); - case PackageKit::Transaction::RestartSystem: - return i18n("The system will have to be rebooted."); - case PackageKit::Transaction::RestartSecuritySession: - return i18n("For security, the session will have to be restarted."); - case PackageKit::Transaction::RestartSecuritySystem: - return i18n("For security, the system will have to be restarted."); - case PackageKit::Transaction::RestartUnknown: - case PackageKit::Transaction::RestartNone: - default: - return QString(); - } -} - -QString statusMessage(PackageKit::Transaction::Status status) -{ - switch (status) { - case PackageKit::Transaction::StatusWait: - return i18n("Waiting..."); - case PackageKit::Transaction::StatusRefreshCache: - return i18n("Refreshing Cache..."); - case PackageKit::Transaction::StatusSetup: - return i18n("Setup..."); - case PackageKit::Transaction::StatusRunning: - return i18n("Processing..."); - case PackageKit::Transaction::StatusRemove: - return i18n("Remove..."); - case PackageKit::Transaction::StatusDownload: - return i18n("Downloading..."); - case PackageKit::Transaction::StatusInstall: - return i18n("Installing..."); - case PackageKit::Transaction::StatusUpdate: - return i18n("Updating..."); - case PackageKit::Transaction::StatusCleanup: - return i18n("Cleaning up..."); -// case PackageKit::Transaction::StatusObsolete: - case PackageKit::Transaction::StatusDepResolve: - return i18n("Resolving dependencies..."); - case PackageKit::Transaction::StatusSigCheck: - return i18n("Checking signatures..."); - case PackageKit::Transaction::StatusTestCommit: - return i18n("Test committing..."); - case PackageKit::Transaction::StatusCommit: - return i18n("Committing..."); - //StatusRequest, - case PackageKit::Transaction::StatusFinished: - return i18n("Finished"); - case PackageKit::Transaction::StatusCancel: - return i18n("Canceled"); - case PackageKit::Transaction::StatusWaitingForLock: - return i18n("Waiting for lock..."); - case PackageKit::Transaction::StatusWaitingForAuth: - return i18n("Waiting for authorization..."); - //StatusScanProcessList, - //StatusCheckExecutableFiles, - //StatusCheckLibraries, - case PackageKit::Transaction::StatusCopyFiles: - return i18n("Copying files..."); - case PackageKit::Transaction::StatusUnknown: - default: - return i18n("Unknown Status"); - } -} - -QString statusDetail(PackageKit::Transaction::Status status) -{ - switch (status) { - case PackageKit::Transaction::StatusWait: - return i18n("We are waiting for something."); - case PackageKit::Transaction::StatusSetup: - return i18n("Setting up transaction..."); - case PackageKit::Transaction::StatusRunning: - return i18n("The transaction is currently working..."); - case PackageKit::Transaction::StatusRemove: - return i18n("The transaction is currently removing packages..."); - case PackageKit::Transaction::StatusDownload: - return i18n("The transaction is currently downloading packages..."); - case PackageKit::Transaction::StatusInstall: - return i18n("The transactions is currently installing packages..."); - case PackageKit::Transaction::StatusUpdate: - return i18n("The transaction is currently updating packages..."); - case PackageKit::Transaction::StatusCleanup: - return i18n("The transaction is currently cleaning up..."); - //case PackageKit::Transaction::StatusObsolete, - case PackageKit::Transaction::StatusDepResolve: - return i18n("The transaction is currently resolving the dependencies of the packages it will install..."); - case PackageKit::Transaction::StatusSigCheck: - return i18n("The transaction is currently checking the signatures of the packages..."); - case PackageKit::Transaction::StatusTestCommit: - return i18n("The transaction is currently testing the commit of this set of packages..."); - case PackageKit::Transaction::StatusCommit: - return i18n("The transaction is currently committing its set of packages..."); - //StatusRequest, - case PackageKit::Transaction::StatusFinished: - return i18n("The transaction has finished!"); - case PackageKit::Transaction::StatusCancel: - return i18n("The transaction was canceled"); - case PackageKit::Transaction::StatusWaitingForLock: - return i18n("The transaction is currently waiting for the lock..."); - case PackageKit::Transaction::StatusWaitingForAuth: - return i18n("Waiting for the user to authorize the transaction..."); - //StatusScanProcessList, - //StatusCheckExecutableFiles, - //StatusCheckLibraries, - case PackageKit::Transaction::StatusCopyFiles: - return i18n("The transaction is currently copying files..."); - case PackageKit::Transaction::StatusRefreshCache: - return i18n("Currently refreshing the repository cache..."); - case PackageKit::Transaction::StatusUnknown: - default: { - int idx = PackageKit::Transaction::staticMetaObject.indexOfEnumerator("Status"); - QMetaEnum metaenum = PackageKit::Transaction::staticMetaObject.enumerator(idx); - return i18n("Unknown status %1.", metaenum.valueToKey(status)); - } - } -} - -QString updateStateMessage(PackageKit::Transaction::UpdateState state) -{ - switch(state) { - case PackageKit::Transaction::UpdateStateUnknown: - return QString(); - case PackageKit::Transaction::UpdateStateStable: - return i18nc("update state", "Stable"); - case PackageKit::Transaction::UpdateStateUnstable: - return i18nc("update state", "Unstable"); - case PackageKit::Transaction::UpdateStateTesting: - return i18nc("update state", "Testing"); - } - return QString(); -} - -} diff --git a/libmuon/backends/PackageKitBackend/PackageKitMessages.h b/libmuon/backends/PackageKitBackend/PackageKitMessages.h deleted file mode 100644 index ad1b563..0000000 --- a/libmuon/backends/PackageKitBackend/PackageKitMessages.h +++ /dev/null @@ -1,36 +0,0 @@ -/*************************************************************************** - * Copyright © 2012-2014 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef PACKAGEKITMESSAGES_H -#define PACKAGEKITMESSAGES_H - -#include <PackageKit/Transaction> - -namespace PackageKitMessages -{ - QString errorMessage(PackageKit::Transaction::Error error); - QString restartMessage(PackageKit::Transaction::Restart restart, const QString& p); - QString restartMessage(PackageKit::Transaction::Restart restart); - QString statusMessage(PackageKit::Transaction::Status status); - QString statusDetail(PackageKit::Transaction::Status status); - QString updateStateMessage(PackageKit::Transaction::UpdateState state); -}; - -#endif // PACKAGEKITMESSAGES_H diff --git a/libmuon/backends/PackageKitBackend/PackageKitNotifier.cpp b/libmuon/backends/PackageKitBackend/PackageKitNotifier.cpp deleted file mode 100644 index f3954e9..0000000 --- a/libmuon/backends/PackageKitBackend/PackageKitNotifier.cpp +++ /dev/null @@ -1,113 +0,0 @@ -/*************************************************************************** - * Copyright © 2013 Lukas Appelhans <l.appelhans@gmx.de> * - * Copyright © 2015 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "PackageKitNotifier.h" - -#include <QTimer> -#include <PackageKit/Daemon> - -PackageKitNotifier::PackageKitNotifier(QObject* parent) - : BackendNotifierModule(parent) - , m_update(NoUpdate) - , m_securityUpdates(0) - , m_normalUpdates(0) -{ -if (PackageKit::Daemon::global()->isRunning()) { - recheckSystemUpdateNeeded(); - } - connect(PackageKit::Daemon::global(), &PackageKit::Daemon::networkStateChanged, this, &PackageKitNotifier::recheckSystemUpdateNeeded); - connect(PackageKit::Daemon::global(), &PackageKit::Daemon::updatesChanged, this, &PackageKitNotifier::recheckSystemUpdateNeeded); - connect(PackageKit::Daemon::global(), &PackageKit::Daemon::isRunningChanged, this, &PackageKitNotifier::recheckSystemUpdateNeeded); -} - -PackageKitNotifier::~PackageKitNotifier() -{ -} - -void PackageKitNotifier::configurationChanged() -{ - recheckSystemUpdateNeeded(); -} - -void PackageKitNotifier::recheckSystemUpdateNeeded() -{ - if (PackageKit::Daemon::global()->isRunning()) { - PackageKit::Transaction * trans = PackageKit::Daemon::getUpdates(); - trans->setProperty("normalUpdates", 0); - trans->setProperty("securityUpdates", 0); - trans->setProperty("update", NoUpdate); - connect(trans, &PackageKit::Transaction::package, this, &PackageKitNotifier::package); - connect(trans, &PackageKit::Transaction::finished, this, &PackageKitNotifier::finished); - } -} - -void PackageKitNotifier::package(PackageKit::Transaction::Info info, const QString &/*packageID*/, const QString &/*summary*/) -{ - PackageKit::Transaction * trans = qobject_cast<PackageKit::Transaction *>(sender()); - - switch (info) { - case PackageKit::Transaction::InfoBlocked: - break; //skip, we ignore blocked updates - case PackageKit::Transaction::InfoSecurity: - trans->setProperty("update", qMax<int>(Security, trans->property("update").toInt())); - trans->setProperty("securityUpdates", trans->property("securityUpdates").toInt()+1); - break; - default: - trans->setProperty("update", qMax<int>(Normal, trans->property("update").toInt())); - trans->setProperty("normalUpdates", trans->property("normalUpdates").toInt()+1); - break; - } -} - -void PackageKitNotifier::finished(PackageKit::Transaction::Exit /*exit*/, uint) -{ - const PackageKit::Transaction * trans = qobject_cast<PackageKit::Transaction *>(sender()); - - const uint normalUpdates = trans->property("normalUpdates").toInt(); - const uint securityUpdates = trans->property("securityUpdates").toInt(); - const Update update = Update(trans->property("update").toInt()); - - const bool changed = update != m_update || normalUpdates != m_normalUpdates || securityUpdates != m_securityUpdates; - - m_normalUpdates = normalUpdates; - m_securityUpdates = securityUpdates; - m_update = update; - - if (changed) { - Q_EMIT foundUpdates(); - } -} - -bool PackageKitNotifier::isSystemUpToDate() const -{ - return m_update == NoUpdate; -} - -uint PackageKitNotifier::securityUpdatesCount() -{ - return m_securityUpdates; -} - -uint PackageKitNotifier::updatesCount() -{ - return m_normalUpdates; -} - diff --git a/libmuon/backends/PackageKitBackend/PackageKitNotifier.h b/libmuon/backends/PackageKitBackend/PackageKitNotifier.h deleted file mode 100644 index da50bf2..0000000 --- a/libmuon/backends/PackageKitBackend/PackageKitNotifier.h +++ /dev/null @@ -1,62 +0,0 @@ -/*************************************************************************** - * Copyright © 2013 Lukas Appelhans <l.appelhans@gmx.de> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ -#ifndef PACKAGEKITNOTIFIER_H -#define PACKAGEKITNOTIFIER_H - -#include <BackendNotifierModule.h> -#include <QVariantList> -#include <PackageKit/Transaction> - -class QTimer; - -class PackageKitNotifier : public BackendNotifierModule -{ -Q_OBJECT -Q_PLUGIN_METADATA(IID "org.kde.muon.BackendNotifierModule") -Q_INTERFACES(BackendNotifierModule) -public: - enum Update { - NoUpdate, - Security, - Normal - }; - Q_ENUMS(Update); - PackageKitNotifier(QObject* parent = nullptr); - virtual ~PackageKitNotifier(); - - virtual bool isSystemUpToDate() const Q_DECL_OVERRIDE Q_DECL_FINAL; - virtual uint securityUpdatesCount() Q_DECL_OVERRIDE Q_DECL_FINAL; - virtual uint updatesCount() Q_DECL_OVERRIDE Q_DECL_FINAL; - -public slots: - virtual void configurationChanged(); - virtual void recheckSystemUpdateNeeded() Q_DECL_OVERRIDE Q_DECL_FINAL; - -private slots: - void package(PackageKit::Transaction::Info info, const QString &packageID, const QString &summary); - void finished(PackageKit::Transaction::Exit exit, uint); - -private: - Update m_update; - uint m_securityUpdates; - uint m_normalUpdates; -}; - -#endif diff --git a/libmuon/backends/PackageKitBackend/PackageKitResource.cpp b/libmuon/backends/PackageKitBackend/PackageKitResource.cpp deleted file mode 100644 index 07e873d..0000000 --- a/libmuon/backends/PackageKitBackend/PackageKitResource.cpp +++ /dev/null @@ -1,365 +0,0 @@ -/*************************************************************************** - * Copyright © 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * Copyright © 2013 Lukas Appelhans <l.appelhans@gmx.de> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "PackageKitResource.h" -#include "PackageKitBackend.h" -#include "PackageKitMessages.h" -#include <MuonDataSources.h> -#include <KLocalizedString> -#include <PackageKit/Details> -#include <PackageKit/Daemon> - -PackageKitResource::PackageKitResource(QString packageName, QString summary, PackageKitBackend* parent) - : AbstractResource(parent) - , m_summary(std::move(summary)) - , m_name(std::move(packageName)) -{ - setObjectName(m_name); -} - -QString PackageKitResource::name() -{ - return m_name; -} - -QString PackageKitResource::packageName() const -{ - return m_name; -} - -QStringList PackageKitResource::allPackageNames() const -{ - return QStringList(m_name); -} - -QString PackageKitResource::availablePackageId() const -{ - //First we check if it's upgradeable and use this version to display - const QString pkgid = backend()->upgradeablePackageId(this); - if (!pkgid.isEmpty()) - return pkgid; - - QMap<PackageKit::Transaction::Info, QStringList>::const_iterator it = m_packages.constFind(PackageKit::Transaction::InfoAvailable); - if (it != m_packages.constEnd()) - return it->first(); - return installedPackageId(); -} - -QString PackageKitResource::installedPackageId() const -{ - return m_packages[PackageKit::Transaction::InfoInstalled].first(); -} - -QString PackageKitResource::comment() -{ - return m_summary; -} - -QString PackageKitResource::longDescription() -{ - fetchDetails(); - return m_details.description(); -} - -QUrl PackageKitResource::homepage() -{ - fetchDetails(); - return m_details.url(); -} - -QString PackageKitResource::icon() const -{ - return QStringLiteral("applications-other"); -} - -QString PackageKitResource::license() -{ - fetchDetails(); - return m_details.license(); -} - -QList<PackageState> PackageKitResource::addonsInformation() -{ - return QList<PackageState>(); -} - -QString PackageKitResource::availableVersion() const -{ - return PackageKit::Daemon::packageVersion(availablePackageId()); -} - -QString PackageKitResource::installedVersion() const -{ - return PackageKit::Daemon::packageVersion(installedPackageId()); -} - -int PackageKitResource::size() -{ - fetchDetails(); - return m_details.size(); -} - -QString PackageKitResource::origin() const -{ - //TODO - return "PackageKit"; -} - -QString PackageKitResource::section() -{ - return QString(); -} - -QUrl PackageKitResource::screenshotUrl() -{ - return QUrl(MuonDataSources::screenshotsSource().toString() + "/screenshot/" + packageName()); -} - -QUrl PackageKitResource::thumbnailUrl() -{ - return QUrl(MuonDataSources::screenshotsSource().toString() + "/thumbnail/" + packageName()); -} - -AbstractResource::State PackageKitResource::state() -{ - if (backend()->isPackageNameUpgradeable(this)) - return Upgradeable; - else if(m_packages.contains(PackageKit::Transaction::InfoInstalled)) - return Installed; - else if(m_packages.contains(PackageKit::Transaction::InfoAvailable)) - return None; - else - return Broken; -} - -void PackageKitResource::setPackages(const QMap<PackageKit::Transaction::Info, QStringList> &packages) -{ - m_packages = packages; - emit stateChanged(); -} - -void PackageKitResource::addPackageId(PackageKit::Transaction::Info info, const QString &packageId, const QString &/*summary*/) -{ - m_packages[info].append(packageId); - emit stateChanged(); -} - -QStringList PackageKitResource::categories() -{ - /*fetchDetails(); - QStringList categories; - switch (m_group) { - case PackageKit::Transaction::GroupUnknown: - categories << "Unknown"; - break; - case PackageKit::Transaction::GroupAccessibility: - categories << "Accessibility"; - break; - case PackageKit::Transaction::GroupAccessories: - categories << "Utility"; - break; - case PackageKit::Transaction::GroupAdminTools: - categories << "System"; - break; - case PackageKit::Transaction::GroupCommunication: - categories << "Chat"; - break; - case PackageKit::Transaction::GroupDesktopGnome: - categories << "Unknown"; - break; - case PackageKit::Transaction::GroupDesktopKde: - categories << "Unknown"; - break; - case PackageKit::Transaction::GroupDesktopOther: - categories << "Unknown"; - break; - case PackageKit::Transaction::GroupDesktopXfce: - categories << "Unknown"; - break; - case PackageKit::Transaction::GroupEducation: - categories << "Science"; - break; - case PackageKit::Transaction::GroupFonts: - categories << "Fonts"; - break; - case PackageKit::Transaction::GroupGames: - categories << "Games"; - break; - case PackageKit::Transaction::GroupGraphics: - categories << "Graphics"; - break; - case PackageKit::Transaction::GroupInternet: - categories << "Internet"; - break; - case PackageKit::Transaction::GroupLegacy: - categories << "Unknown"; - break; - case PackageKit::Transaction::GroupLocalization: - categories << "Localization"; - break; - case PackageKit::Transaction::GroupMaps: - categories << "Geography"; - break; - case PackageKit::Transaction::GroupMultimedia: - categories << "Multimedia"; - break; - case PackageKit::Transaction::GroupNetwork: - categories << "Network"; - break; - case PackageKit::Transaction::GroupOffice: - categories << "Office"; - break; - case PackageKit::Transaction::GroupOther: - categories << "Unknown"; - break; - case PackageKit::Transaction::GroupPowerManagement: - categories << "System"; - break; - case PackageKit::Transaction::GroupProgramming: - categories << "Development"; - break; - case PackageKit::Transaction::GroupPublishing: - categories << "Publishing"; - break; - case PackageKit::Transaction::GroupRepos: - categories << "System"; - break; - case PackageKit::Transaction::GroupSecurity: - categories << "System"; - break; - case PackageKit::Transaction::GroupServers: - categories << "System"; - break; - case PackageKit::Transaction::GroupSystem: - categories << "System"; - break; - case PackageKit::Transaction::GroupVirtualization: - categories << "System"; - break; - case PackageKit::Transaction::GroupScience: - categories << "Science"; - break; - case PackageKit::Transaction::GroupDocumentation: - categories << "System"; - break; - case PackageKit::Transaction::GroupElectronics: - categories << "System"; - break; - case PackageKit::Transaction::GroupCollections: - categories << "System"; - break; - case PackageKit::Transaction::GroupVendor: - categories << "System"; - break; - case PackageKit::Transaction::GroupNewest: - categories << "System"; - break; - }; - return categories;*/ - return QStringList() << "Unknown"; - //NOTE: I commented the category fetching code, as it seems to get called even for non-technical items - //when selecting a category, and receiving details for all packages takes about 20 mins in my VirtualBox and probably not much less on real systems -} - -bool PackageKitResource::isTechnical() const -{ - return true;//!m_availablePackageId.startsWith("flash"); -} - -void PackageKitResource::fetchDetails() -{ - if (!m_details.isEmpty()) - return; - m_details.insert("fetching", true);//we add an entry so it's not re-fetched. - - PackageKit::Transaction* t = PackageKit::Daemon::getDetails(availablePackageId()); - connect(t, &PackageKit::Transaction::details, this, &PackageKitResource::setDetails); - connect(t, &PackageKit::Transaction::errorCode, this, [](PackageKit::Transaction::Error, const QString& msg){ qWarning() << "error fetching details" << msg; }); -} - -void PackageKitResource::setDetails(const PackageKit::Details & details) -{ - const bool ourDetails = details.packageId() == availablePackageId(); - if (!ourDetails) - return; - - m_details = details; - emit stateChanged(); - - backend()->allDataChanged(); -} - -void PackageKitResource::fetchChangelog() -{ - PackageKit::Transaction* t = PackageKit::Daemon::getUpdateDetail(availablePackageId()); - connect(t, &PackageKit::Transaction::updateDetail, this, &PackageKitResource::updateDetail); - connect(t, &PackageKit::Transaction::errorCode, this, [this](PackageKit::Transaction::Error err, const QString & error) { - qWarning() << "error fetching updates:" << err << error; - emit changelogFetched(QString()); - }); -} - -static void addIfNotEmpty(const QString& title, const QString& content, QString& where) -{ - if (!content.isEmpty()) - where += QStringLiteral("<p><b>") + title + QStringLiteral("</b> ") + content + QStringLiteral("</p>"); -} - -static QString joinPackages(const QStringList& pkgids) -{ - QStringList ret; - foreach(const QString& pkgid, pkgids) { - ret += i18nc("package-name (version)", "%1 (%2)", PackageKit::Daemon::packageName(pkgid), PackageKit::Daemon::packageVersion(pkgid)); - } - return ret.join(i18nc("comma separating package names", ", ")); -} - -static QStringList urlToLinks(const QStringList& urls) -{ - QStringList ret; - foreach(const QString& in, urls) - ret += QStringLiteral("<a href='%1'>%1</a>").arg(in); - return ret; -} - -void PackageKitResource::updateDetail(const QString& /*packageID*/, const QStringList& updates, const QStringList& obsoletes, const QStringList& vendorUrls, - const QStringList& /*bugzillaUrls*/, const QStringList& /*cveUrls*/, PackageKit::Transaction::Restart restart, const QString& updateText, - const QString& changelog, PackageKit::Transaction::UpdateState state, const QDateTime& /*issued*/, const QDateTime& /*updated*/) -{ - QString info; - addIfNotEmpty(i18n("Reason:"), updateText, info); - addIfNotEmpty(i18n("Obsoletes:"), joinPackages(obsoletes), info); - addIfNotEmpty(i18n("Updates:"), joinPackages(updates), info); - addIfNotEmpty(i18n("Change Log:"), changelog, info); - addIfNotEmpty(i18n("Update State:"), PackageKitMessages::updateStateMessage(state), info); - addIfNotEmpty(i18n("Restart:"), PackageKitMessages::restartMessage(restart), info); - - if (!vendorUrls.isEmpty()) - addIfNotEmpty(i18n("Vendor:"), urlToLinks(vendorUrls).join(QStringLiteral(", ")), info); - - emit changelogFetched(info); -} - -PackageKitBackend* PackageKitResource::backend() const -{ - return qobject_cast<PackageKitBackend*>(parent()); -} - diff --git a/libmuon/backends/PackageKitBackend/PackageKitResource.h b/libmuon/backends/PackageKitBackend/PackageKitResource.h deleted file mode 100644 index f0de11b..0000000 --- a/libmuon/backends/PackageKitBackend/PackageKitResource.h +++ /dev/null @@ -1,93 +0,0 @@ -/*************************************************************************** - * Copyright © 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef PACKAGEKITRESOURCE_H -#define PACKAGEKITRESOURCE_H - -#include <resources/AbstractResource.h> -#include <PackageKit/Transaction> -#include <PackageKit/Details> - -class PackageKitBackend; - -class PackageKitResource : public AbstractResource -{ - Q_OBJECT - public: - explicit PackageKitResource(QString packageName, QString summary, PackageKitBackend* parent); - virtual QString packageName() const override; - virtual QString name() override; - virtual QString comment() override; - virtual QString longDescription() override; - virtual QUrl homepage() override; - virtual QString icon() const override; - virtual QStringList categories() override; - virtual QString license() override; - virtual QString origin() const override; - virtual QString section() override; - virtual bool isTechnical() const override; - virtual int size() override; - virtual void fetchChangelog() override; - - virtual QList<PackageState> addonsInformation() override; - virtual State state() override; - - virtual QUrl screenshotUrl() override; - virtual QUrl thumbnailUrl() override; - - virtual QString installedVersion() const override; - virtual QString availableVersion() const override; - virtual QStringList allPackageNames() const; - QString installedPackageId() const; - QString availablePackageId() const; - - QMap<PackageKit::Transaction::Info, QStringList> packages() const { return m_packages; } - void setPackages(const QMap<PackageKit::Transaction::Info, QStringList> &packages); - - public slots: - void addPackageId(PackageKit::Transaction::Info info, const QString &packageId, const QString &summary); - void setDetails(const PackageKit::Details& details); - - private slots: - void updateDetail(const QString &packageID, - const QStringList &updates, - const QStringList &obsoletes, - const QStringList &vendorUrls, - const QStringList &bugzillaUrls, - const QStringList &cveUrls, - PackageKit::Transaction::Restart restart, - const QString &updateText, - const QString &changelog, - PackageKit::Transaction::UpdateState state, - const QDateTime &issued, - const QDateTime &updated); - - private: - /** fetches details individually, it's better if done in batch, like for updates */ - void fetchDetails(); - PackageKitBackend* backend() const; - - QMap<PackageKit::Transaction::Info, QStringList> m_packages; - const QString m_summary; - const QString m_name; - PackageKit::Details m_details; -}; - -#endif // PACKAGEKITRESOURCE_H diff --git a/libmuon/backends/PackageKitBackend/PackageKitUpdater.cpp b/libmuon/backends/PackageKitBackend/PackageKitUpdater.cpp deleted file mode 100644 index 3b68aa4..0000000 --- a/libmuon/backends/PackageKitBackend/PackageKitUpdater.cpp +++ /dev/null @@ -1,317 +0,0 @@ -/*************************************************************************** - * Copyright © 2013 Lukas Appelhans <l.appelhans@gmx.de> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ -#include "PackageKitUpdater.h" -#include "PackageKitMessages.h" - -#include <PackageKit/Daemon> -#include <QDebug> -#include <QMessageBox> -#include <QAction> -#include <QSet> - -#include <KLocalizedString> -#include <QIcon> - -PackageKitUpdater::PackageKitUpdater(PackageKitBackend * parent) - : AbstractBackendUpdater(parent), - m_transaction(nullptr), - m_backend(parent), - m_isCancelable(false), - m_isProgressing(false), - m_speed(0), - m_remainingTime(0), - m_percentage(0), - m_lastUpdate() -{ - m_updateAction = new QAction(this); - m_updateAction->setIcon(QIcon::fromTheme("system-software-update")); - m_updateAction->setText(i18nc("@action Checks the Internet for updates", "Check for Updates")); - m_updateAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_R)); - m_updateAction->setEnabled(PackageKit::Daemon::networkState() != PackageKit::Daemon::NetworkOffline); - connect(m_updateAction, SIGNAL(triggered()), parent, SLOT(refreshDatabase())); - - fetchLastUpdateTime(); -} - -PackageKitUpdater::~PackageKitUpdater() -{ - delete m_transaction; -} - -void PackageKitUpdater::prepare() -{ - Q_ASSERT(!m_transaction); - m_toUpgrade = m_backend->upgradeablePackages().toSet(); - m_allUpgradeable = m_toUpgrade; -} - -void PackageKitUpdater::setTransaction(PackageKit::Transaction* transaction) -{ - m_transaction = transaction; - m_isCancelable = transaction->allowCancel(); - - connect(m_transaction, SIGNAL(finished(PackageKit::Transaction::Exit,uint)), SLOT(finished(PackageKit::Transaction::Exit,uint))); - connect(m_transaction, SIGNAL(errorCode(PackageKit::Transaction::Error,QString)), this, SLOT(errorFound(PackageKit::Transaction::Error,QString))); - connect(m_transaction, SIGNAL(mediaChangeRequired(PackageKit::Transaction::MediaType,QString,QString)), - this, SLOT(mediaChange(PackageKit::Transaction::MediaType,QString,QString))); - connect(m_transaction, SIGNAL(requireRestart(PackageKit::Transaction::Restart,QString)), - this, SLOT(requireRestart(PackageKit::Transaction::Restart,QString))); - connect(m_transaction, SIGNAL(eulaRequired(QString, QString, QString, QString)), SLOT(eulaRequired(QString, QString, QString, QString))); - connect(m_transaction, SIGNAL(statusChanged()), this, SLOT(statusChanged())); - connect(m_transaction, SIGNAL(speedChanged()), this, SLOT(speedChanged())); - connect(m_transaction, SIGNAL(allowCancelChanged()), this, SLOT(cancellableChanged())); - connect(m_transaction, SIGNAL(remainingTimeChanged()), this, SLOT(remainingTimeChanged())); - connect(m_transaction, SIGNAL(percentageChanged()), this, SLOT(percentageChanged())); -} - -QSet<AbstractResource*> PackageKitUpdater::packagesForPackageId(const QSet<QString>& pkgids) const -{ - QSet<QString> packages; - foreach(const QString& pkgid, pkgids) { - packages += PackageKit::Daemon::packageName(pkgid); - } - - QSet<AbstractResource*> ret; - foreach (AbstractResource * res, m_allUpgradeable) { - PackageKitResource* pres = qobject_cast<PackageKitResource*>(res); - if (packages.contains(pres->allPackageNames().toSet())) { - ret.insert(res); - } - } - - return ret; -} - -QSet<QString> PackageKitUpdater::involvedPackages(const QSet<AbstractResource*>& packages) const -{ - QSet<QString> packageIds; - packageIds.reserve(packages.size()); - foreach (AbstractResource * res, packages) { - PackageKitResource * app = qobject_cast<PackageKitResource*>(res); - QString pkgid = m_backend->upgradeablePackageId(app); - packageIds.insert(pkgid); - } - return packageIds; -} - -void PackageKitUpdater::start() -{ - setTransaction(PackageKit::Daemon::updatePackages(involvedPackages(m_toUpgrade).toList())); - setProgressing(true); -} - -void PackageKitUpdater::finished(PackageKit::Transaction::Exit exit, uint ) -{ - if (exit == PackageKit::Transaction::ExitEulaRequired) - return; - disconnect(m_transaction, nullptr, this, nullptr); - m_transaction = nullptr; - - setProgressing(false); - m_backend->refreshDatabase(); - fetchLastUpdateTime(); -} - -void PackageKitUpdater::cancellableChanged() -{ - if (m_isCancelable != m_transaction->allowCancel()) { - m_isCancelable = m_transaction->allowCancel(); - emit cancelableChanged(m_isCancelable); - } -} - -void PackageKitUpdater::percentageChanged() -{ - if (m_percentage != m_transaction->percentage()) { - m_percentage = m_transaction->percentage(); - emit progressChanged(m_percentage); - } -} - -void PackageKitUpdater::remainingTimeChanged() -{ - if (m_remainingTime != m_transaction->remainingTime()) { - m_remainingTime = m_transaction->remainingTime(); - emit remainingTimeChanged(); - } -} - -void PackageKitUpdater::speedChanged() -{ - if (m_speed != m_transaction->speed()) { - m_speed = m_transaction->speed(); - emit downloadSpeedChanged(m_speed); - } -} - -void PackageKitUpdater::statusChanged() -{ - if (m_status != m_transaction->status()) { - m_status = m_transaction->status(); - m_statusMessage = PackageKitMessages::statusMessage(m_status); - m_statusDetail = PackageKitMessages::statusDetail(m_status); - - emit statusMessageChanged(m_statusMessage); - emit statusDetailChanged(m_statusDetail); - } -} - -bool PackageKitUpdater::hasUpdates() const -{ - return m_backend->updatesCount() > 0; -} - -qreal PackageKitUpdater::progress() const -{ - return m_percentage; -} - -/** proposed ETA in milliseconds */ -long unsigned int PackageKitUpdater::remainingTime() const -{ - return m_remainingTime; -} - -void PackageKitUpdater::removeResources(const QList<AbstractResource*>& apps) -{ - QSet<QString> pkgs = involvedPackages(apps.toSet()); - m_toUpgrade.subtract(packagesForPackageId(pkgs)); -} - -void PackageKitUpdater::addResources(const QList<AbstractResource*>& apps) -{ - QSet<QString> pkgs = involvedPackages(apps.toSet()); - m_toUpgrade.unite(packagesForPackageId(pkgs)); -} - -QList<AbstractResource*> PackageKitUpdater::toUpdate() const -{ - return m_toUpgrade.toList(); -} - -bool PackageKitUpdater::isMarked(AbstractResource* res) const -{ - return m_toUpgrade.contains(res); -} - -QDateTime PackageKitUpdater::lastUpdate() const -{ - return m_lastUpdate; -} - -bool PackageKitUpdater::isAllMarked() const -{ - return m_toUpgrade.count() >= m_backend->updatesCount(); -} - -bool PackageKitUpdater::isCancelable() const -{ - return m_transaction->allowCancel(); -} - -bool PackageKitUpdater::isProgressing() const -{ - return m_isProgressing; -} - -QString PackageKitUpdater::statusMessage() const -{ - return m_statusMessage; -} - -QString PackageKitUpdater::statusDetail() const -{ - return m_statusDetail; -} - -quint64 PackageKitUpdater::downloadSpeed() const -{ - return m_speed; -} - -QList<QAction*> PackageKitUpdater::messageActions() const -{ - return QList<QAction*>() << m_updateAction; -} - -void PackageKitUpdater::cancel() -{ - m_transaction->cancel(); -} - -void PackageKitUpdater::errorFound(PackageKit::Transaction::Error err, const QString& error) -{ - Q_UNUSED(error); - if (err == PackageKit::Transaction::ErrorNoLicenseAgreement) - return; - QMessageBox::critical(nullptr, i18n("PackageKit error found"), PackageKitMessages::errorMessage(err)); - qWarning() << "Error happened" << err << error; -} - -void PackageKitUpdater::mediaChange(PackageKit::Transaction::MediaType media, const QString& type, const QString& text) -{ - Q_UNUSED(media) - QMessageBox::information(nullptr, i18n("PackageKit media change"), i18n("Media Change of type '%1' is requested.\n%2", type, text)); -} - -void PackageKitUpdater::requireRestart(PackageKit::Transaction::Restart restart, const QString& pkgid) -{ - QMessageBox::information(nullptr, i18n("PackageKit restart required"), PackageKitMessages::restartMessage(restart, pkgid)); -} - -void PackageKitUpdater::eulaRequired(const QString& eulaID, const QString& packageID, const QString& vendor, const QString& licenseAgreement) -{ - QString packageName = PackageKit::Daemon::packageName(packageID); - int ret = QMessageBox::question(nullptr, i18n("%1 requires user to accept its license", packageName), i18n("The package %1 and its vendor %2 require that you accept their license:\n %3", - packageName, vendor, licenseAgreement), QMessageBox::Yes, QMessageBox::No); - if (ret == QMessageBox::Yes) { - PackageKit::Transaction* t = PackageKit::Daemon::acceptEula(eulaID); - connect(t, SIGNAL(finished(PackageKit::Transaction::Exit,uint)), this, SLOT(start())); - } else { - finished(PackageKit::Transaction::ExitCancelled, 0); - } -} - -void PackageKitUpdater::setProgressing(bool progressing) -{ - if (m_isProgressing != progressing) { - m_isProgressing = progressing; - emit progressingChanged(m_isProgressing); - } -} - -void PackageKitUpdater::fetchLastUpdateTime() -{ - QDBusPendingReply<uint> transaction = PackageKit::Daemon::global()->getTimeSinceAction(PackageKit::Transaction::RoleGetUpdates); - QDBusPendingCallWatcher* watcher = new QDBusPendingCallWatcher(transaction, this); - connect(watcher, &QDBusPendingCallWatcher::finished, this, &PackageKitUpdater::lastUpdateTimeReceived); -} - -void PackageKitUpdater::lastUpdateTimeReceived(QDBusPendingCallWatcher* w) -{ - QDBusPendingReply<uint> reply = w->reply(); - if (reply.isError()) { - qWarning() << "Error when fetching the last update time" << reply.error(); - } else { - m_lastUpdate = QDateTime::currentDateTime(); - m_lastUpdate.addSecs(-reply.value()); - } - w->deleteLater(); -} diff --git a/libmuon/backends/PackageKitBackend/PackageKitUpdater.h b/libmuon/backends/PackageKitBackend/PackageKitUpdater.h deleted file mode 100644 index 5348ca7..0000000 --- a/libmuon/backends/PackageKitBackend/PackageKitUpdater.h +++ /dev/null @@ -1,103 +0,0 @@ -/*************************************************************************** - * Copyright © 2013 Lukas Appelhans <l.appelhans@gmx.de> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ -#ifndef PACKAGEKITUPDATER_H -#define PACKAGEKITUPDATER_H - -#include <resources/AbstractBackendUpdater.h> -#include "PackageKitBackend.h" -#include <PackageKit/Transaction> - -class PackageKitUpdater : public AbstractBackendUpdater -{ - Q_OBJECT - public: - PackageKitUpdater(PackageKitBackend * parent = nullptr); - ~PackageKitUpdater(); - - virtual void prepare() override; - - virtual bool hasUpdates() const override; - virtual qreal progress() const override; - - /** proposed ETA in milliseconds */ - virtual long unsigned int remainingTime() const override; - - virtual void removeResources(const QList<AbstractResource*>& apps) override; - virtual void addResources(const QList<AbstractResource*>& apps) override; - virtual QList<AbstractResource*> toUpdate() const override; - virtual bool isMarked(AbstractResource* res) const override; - virtual QDateTime lastUpdate() const override; - virtual bool isAllMarked() const override; - virtual bool isCancelable() const override; - virtual bool isProgressing() const override; - - virtual QString statusMessage() const override; - virtual QString statusDetail() const override; - virtual quint64 downloadSpeed() const override; - - /** in muon-updater, actions with HighPriority will be shown in a KMessageWidget, - * normal priority will go right on top of the more menu, low priority will go - * to the advanced menu - */ - virtual QList<QAction*> messageActions() const; - - public slots: - ///must be implemented if ever isCancelable is true - virtual void cancel() override; - virtual void start() override; - - private slots: - void errorFound(PackageKit::Transaction::Error err, const QString& error); - void mediaChange(PackageKit::Transaction::MediaType media, const QString& type, const QString& text); - void requireRestart(PackageKit::Transaction::Restart restart, const QString& p); - void eulaRequired(const QString &eulaID, const QString &packageID, const QString &vendor, const QString &licenseAgreement); - void finished(PackageKit::Transaction::Exit exit, uint); - void statusChanged(); - void speedChanged(); - void cancellableChanged(); - void remainingTimeChanged(); - void percentageChanged(); - - private: - void fetchLastUpdateTime(); - void lastUpdateTimeReceived(QDBusPendingCallWatcher* w); - void setProgressing(bool progressing); - void setTransaction(PackageKit::Transaction* transaction); - QSet<QString> involvedPackages(const QSet<AbstractResource*>& packages) const; - QSet<AbstractResource*> packagesForPackageId(const QSet<QString>& packages) const; - - QPointer<PackageKit::Transaction> m_transaction; - PackageKitBackend * m_backend; - QSet<AbstractResource*> m_toUpgrade; - QSet<AbstractResource*> m_allUpgradeable; - bool m_isCancelable; - bool m_isProgressing; - PackageKit::Transaction::Status m_status; - QString m_statusMessage; - QString m_statusDetail; - quint64 m_speed; - long unsigned int m_remainingTime; - uint m_percentage; - QAction* m_updateAction; - QDateTime m_lastUpdate; -}; - - -#endif diff --git a/libmuon/backends/PackageKitBackend/muon-packagekit-backend-categories.xml b/libmuon/backends/PackageKitBackend/muon-packagekit-backend-categories.xml deleted file mode 100644 index 46dc1b2..0000000 --- a/libmuon/backends/PackageKitBackend/muon-packagekit-backend-categories.xml +++ /dev/null @@ -1,471 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<Menu> - - <Menu> - <Name>Accessories</Name> - <Icon>applications-utilities</Icon> - <Include> - <And> - <Category>Utility</Category> - <Not><Category>Accessibility</Category></Not> - </And> - </Include> - </Menu> - - <Menu> - <Name>Accessibility</Name> - <Icon>preferences-desktop-accessibility</Icon> - <Include> - <And> - <Category>Accessibility</Category> - <Not><Category>Settings</Category></Not> - </And> - </Include> - </Menu> - - <Menu> - <Name>Developer Tools</Name> - <Icon>applications-development</Icon> - <Include> - <Or> - <Category>Development</Category> - </Or> - <Filename>emacs.desktop</Filename> - </Include> - - - <Menu> - <Name>Debugging</Name> - <Icon>tools-report-bug</Icon> - <Include> - <And> - <Category>Debugger</Category> - </And> - </Include> - </Menu> - - <Menu> - <Name>Graphic Interface Design</Name> - <Include> - <And> - <Category>GUIDesigner</Category> - </And> - </Include> - </Menu> - - <Menu> - <Name>IDEs</Name> - <Include> - <And> - <Category>IDE</Category> - </And> - </Include> - </Menu> - - <Menu> - <Name>Localization</Name> - <Icon>preferences-desktop-locale</Icon> - <Include> - <And> - <Category>Translation</Category> - </And> - </Include> - </Menu> - - <Menu> - <Name>Profiling</Name> - <Include> - <Or> - <Category>Profiling</Category> - </Or> - </Include> - </Menu> - - <Menu> - <Name>Web Development</Name> - <Include> - <And> - <Category>WebDevelopment</Category> - </And> - </Include> - <Icon>applications-internet</Icon> - </Menu> - - </Menu> - - - <Menu> - <Name>Education</Name> - <Icon>applications-education</Icon> - <Include> - <And> - <Category>Education</Category> - <Not> - <Category>Science</Category> - </Not> - </And> - </Include> - </Menu> - - - <Menu> - <Name>Science & Engineering</Name> - <Icon>applications-science</Icon> - <Include> - <Or> - <Category>Science</Category> - <Category>Engineering</Category> - </Or> - </Include> - <Menu> - <Name>Astronomy</Name> - <Include> - <And> - <Category>Astronomy</Category> - </And> - </Include> - </Menu> - <Menu> - <Name>Biology</Name> - <Include> - <And> - <Category>Biology</Category> - </And> - </Include> - </Menu> - <Menu> - <Name>Chemistry</Name> - <Icon>applications-science</Icon> - <Include> - <And> - <Category>Chemistry</Category> - </And> - </Include> - </Menu> - <Menu> - <Name>Computer Science & Robotics</Name> - <Icon>computer</Icon> - <Include> - <Or> - <Category>ArtificialIntelligence</Category> - <Category>ComputerScience</Category> - <Category>Robotics</Category> - </Or> - </Include> - </Menu> - <Menu> - <Name>Electronics</Name> - <Icon>audio-card</Icon> - <Include> - <And> - <Category>Electronics</Category> - </And> - </Include> - </Menu> - <Menu> - <Name>Engineering</Name> - <Icon>applications-engineering</Icon> - <Include> - <And> - <Category>Engineering</Category> - </And> - </Include> - </Menu> - <Menu> - <Name>Geography</Name> - <Include> - <And> - <Category>Geography</Category> - </And> - </Include> - </Menu> - <Menu> - <Name>Geology</Name> - <Include> - <Or> - <Category>Geology</Category> - <Category>Geoscience</Category> - </Or> - </Include> - </Menu> - <Menu> - <Name>Mathematics</Name> - <Icon>applications-education-mathematics</Icon> - <Include> - <Or> - <Category>DataVisualization</Category> - <Category>Math</Category> - <Category>NumericalAnalysis</Category> - </Or> - </Include> - </Menu> - <Menu> - <Name>Physics</Name> - <Icon>step</Icon> - <Include> - <And> - <Category>Physics</Category> - </And> - </Include> - </Menu> - </Menu> - - <Menu> - <Name>Fonts</Name> - <Icon>preferences-desktop-font</Icon> - <ShowTechnical>true</ShowTechnical> - <Include> - <And> - <Category>Fonts</Category> - </And> - </Include> - </Menu> - - <Menu> - <Name>Games</Name> - <Icon>applications-games</Icon> - <Include> - <And> - <Category>Game</Category> - </And> - </Include> - - <Menu> - <Name>Arcade</Name> - <Icon>applications-games-arcade</Icon> - <Include> - <And> - <Category>ArcadeGame</Category> - </And> - </Include> - </Menu> - <Menu> - <Name>Board Games</Name> - <Icon>applications-games-board</Icon> - <Include> - <And> - <Category>BoardGame</Category> - </And> - </Include> - </Menu> - <Menu> - <Name>Card Games</Name> - <Icon>applications-games-card</Icon> - <Include> - <And> - <Category>CardGame</Category> - </And> - </Include> - </Menu> - <Menu> - <Name>Puzzles</Name> - <Icon>applications-games</Icon> - <Include> - <And> - <Category>LogicGame</Category> - </And> - </Include> - </Menu> - <Menu> - <Name>Role Playing</Name> - <Icon>applications-games</Icon> - <Include> - <And> - <Category>RolePlaying</Category> - </And> - </Include> - </Menu> - <Menu> - <Name>Simulation</Name> - <Icon>applications-games-strategy</Icon> - <Include> - <And> - <Category>Simulation</Category> - </And> - </Include> - </Menu> - <Menu> - <Name>Sports</Name> - <Icon>applications-games</Icon> - <Include> - <And> - <Category>SportsGame</Category> - </And> - </Include> - </Menu> - - </Menu> - - - <Menu> - <Name>Graphics</Name> - <Icon>applications-graphics</Icon> - <Include> - <And> - <Category>Graphics</Category> - </And> - </Include> - <Menu> - <Name>3D</Name> - <Include> - <And> - <Category>3DGraphics</Category> - </And> - </Include> - </Menu> - <Menu> - <Name>Drawing</Name> - <Icon>draw-freehand</Icon> - <Include> - <And> - <Category>VectorGraphics</Category> - <Not> - <Category>Viewer</Category> - </Not> - </And> - </Include> - </Menu> - <Menu> - <Name>Painting & Editing</Name> - <Icon>draw-brush</Icon> - <Include> - <And> - <Category>RasterGraphics</Category> - <Not> - <Category>Viewer</Category> - <Category>Scanning</Category> - </Not> - </And> - </Include> - </Menu> - <Menu> - <Name>Photography</Name> - <Icon>image-x-generic</Icon> - <Include> - <And> - <Category>Photography</Category> - </And> - </Include> - </Menu> - <Menu> - <Name>Publishing</Name> - <Icon>document-export</Icon> - <Include> - <And> - <Category>Publishing</Category> - </And> - </Include> - </Menu> - <Menu> - <Name>Scanning & OCR</Name> - <Icon>scanner</Icon> - <Include> - <Or> - <Category>Scanning</Category> - <Category>OCR</Category> - </Or> - </Include> - </Menu> - <Menu> - <Name>Viewers</Name> - <Icon>graphics-viewer-document</Icon> - <Include> - <And> - <Category>Viewer</Category> - </And> - </Include> - </Menu> - </Menu> - - - <Menu> - <Name>Internet</Name> - <Icon>applications-internet</Icon> - <Include> - <And> - <Category>Network</Category> - </And> - </Include> - <Menu> - <Name>Chat</Name> - <Icon>kopete</Icon> - <Include> - <Or> - <Category>InstantMessaging</Category> - <Category>IRCClient</Category> - </Or> - </Include> - </Menu> - <Menu> - <Name>File Sharing</Name> - <Icon>ktorrent</Icon> - <Include> - <And> - <Category>FileTransfer</Category> - </And> - </Include> - </Menu> - <Menu> - <Name>Mail</Name> - <Icon>internet-mail</Icon> - <Include> - <And> - <Category>Email</Category> - </And> - </Include> - </Menu> - <Menu> - <Name>Web Browsers</Name> - <Icon>internet-web-browser</Icon> - <Include> - <And> - <Category>WebBrowser</Category> - </And> - </Include> - </Menu> - </Menu> - - - <Menu> - <Name>Multimedia</Name> - <Icon>applications-multimedia</Icon> - <Include> - <And> - <Category>AudioVideo</Category> - </And> - </Include> - </Menu> - - - <Menu> - <Name>Office</Name> - <Icon>applications-office</Icon> - <Include> - <And> - <Category>Office</Category> - </And> - </Include> - </Menu> - - <Menu> - <Name>System & Settings</Name> - <Icon>preferences-system</Icon> - <Include> - <Or> - <Category>Settings</Category> - <Category>System</Category> - </Or> - </Include> - </Menu> - - <Menu> - <Name>Plasma Desktop Widgets</Name> - <Icon>plasma</Icon> - <Include> - <Or> - <PkgWildcard>plasma-widget-*</PkgWildcard> - </Or> - </Include> - </Menu> - -</Menu> diff --git a/libmuon/backends/PackageKitBackend/muon-packagekit-backend.desktop b/libmuon/backends/PackageKitBackend/muon-packagekit-backend.desktop deleted file mode 100644 index db392be..0000000 --- a/libmuon/backends/PackageKitBackend/muon-packagekit-backend.desktop +++ /dev/null @@ -1,132 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=Muon/Backend -Exec=blubb -Icon=applications-other -Comment=Install and browse applications in PackageKit -Comment[ast]=Instala y restola aplicaciones en PackageKit -Comment[bg]=Инсталиране и разглеждане на приложения в PackageKit -Comment[bs]=Instaliraj i pregledaj aplikacije u PackageKit -Comment[ca]=Instal·la i mostra aplicacions en el PackageKit -Comment[ca@valencia]=Instal·la i mostra aplicacions en el PackageKit -Comment[cs]=Instalujte a prohlížejte aplikace v PackageKit -Comment[da]=Installér og gennemse programmer i PackageKit -Comment[de]=Anwendungen in PackageKit Installieren und durchsuchen -Comment[el]=Εγκαταστήστε και περιηγηθείτε σε εφαρμογές στο PackageKit -Comment[en_GB]=Install and browse applications in PackageKit -Comment[es]=Instalar y examinar aplicaciones en PackageKit -Comment[et]=Rakenduste paigaldamine ja sirvimine PackageKitis -Comment[fi]=Asenna ja selaa PackageKitin välityksellä tarjolla olevia sovelluksia -Comment[fr]=Installer et parcourir des applications dans PackageKit -Comment[gl]=Instalar e buscar aplicacións en PackageKit -Comment[hu]=Alkalmazások telepítése és böngészése PackageKit programban -Comment[id]=Pasang dan melihat-lihat aplikasi di dalam PackageKit -Comment[it]=Installa e sfoglia le applicazioni in PackageKit -Comment[ko]=PackageKit에서 프로그램을 찾고 설치하기 -Comment[lt]=Diegti ir naršyti programas per PackageKit -Comment[nb]=Installer og bla i programmer i Packagekit -Comment[nds]=Programmen binnen PackageKit dörkieken un installeren -Comment[nl]=Installeer en blader door toepassingen in PackageKit -Comment[nn]=Installer og bla i program i PackageKit -Comment[pl]=Wgrywaj i przeglądaj przeglądaj programy w PackageKit -Comment[pt]=Instalar e navegar pelas aplicações no PackageKit -Comment[pt_BR]=Instala e navega pelos aplicativos no PackageKit -Comment[ro]=Instalează și răsfoiește aplicații în PackageKit -Comment[ru]=Установка и обзор приложений в PackageKit -Comment[sk]=Inštalácia a prehliadanie aplikácií v PackageKit -Comment[sl]=Namestite in brskajte po programih v PackageKit -Comment[sr]=Инсталирајте и прегледајте програме из Пакиџ‑кита -Comment[sr@ijekavian]=Инсталирајте и прегледајте програме из Пакиџ‑кита -Comment[sr@ijekavianlatin]=Instalirajte i pregledajte programe iz PackageKita -Comment[sr@latin]=Instalirajte i pregledajte programe iz PackageKita -Comment[sv]=Installera och bläddra bland program med PackageKit -Comment[tr]=Uygulamalara PackageKit içerisinde gözat ve yükle -Comment[uk]=Встановіть і перегляньте встановлені програми у PackageKit -Comment[x-test]=xxInstall and browse applications in PackageKitxx -Comment[zh_CN]=使用 PackageKit 安装和浏览应用程序 -Comment[zh_TW]=在 PackageKit 中安裝並瀏覽應用程式 -Name=PackageKit Support -Name[ast]=Sofitu de packageKit -Name[bg]=Поддръжка на PackageKit -Name[bs]=PackageKit podrška -Name[ca]=Implementació del PackageKit -Name[ca@valencia]=Implementació del PackageKit -Name[cs]=Podpora PackageKit -Name[da]=PackageKit-understøttelse -Name[de]=Unterstützung für PackageKit -Name[el]=Υποστήριξη PackageKit -Name[en_GB]=PackageKit Support -Name[es]=Implementación de PackageKit -Name[et]=PackageKiti toetus -Name[fi]=PackageKit-tuki -Name[fr]=Prise en charge de PackageKit -Name[gl]=Compatibilidade con PackageKit -Name[hu]=PackageKit támogatás -Name[id]=Dukungan PackageKit -Name[it]=Supporto PackageKit -Name[ko]=PackageKit 지원 -Name[lt]=PackageKit palaikymas -Name[nb]=PackageKit-støtte -Name[nds]=PackageKit-Ünnerstütten -Name[nl]=Ondersteuning van PackageKit -Name[nn]=PackageKit-støtte -Name[pl]=Obsługa PackageKit -Name[pt]=Suporte para o PackageKit -Name[pt_BR]=Suporte para o PackageKit -Name[ro]=Suport pentru PackageKit -Name[ru]=Поддержка PackageKit -Name[sk]=Podpora PackageKit -Name[sl]=Podpora PackageKit -Name[sr]=Подршка за Пакиџ‑кит -Name[sr@ijekavian]=Подршка за Пакиџ‑кит -Name[sr@ijekavianlatin]=Podrška za PackageKit -Name[sr@latin]=Podrška za PackageKit -Name[sv]=Stöd för PackageKit -Name[tr]=PackageKit Desteği -Name[uk]=Підтримка PackageKit -Name[x-test]=xxPackageKit Supportxx -Name[zh_CN]=PackageKit 支持 -Name[zh_TW]=PackageKit 支援 -GenericName=Applications Backend -GenericName[bs]=Pozadina aplikacija -GenericName[ca]=Dorsal d'aplicacions -GenericName[ca@valencia]=Dorsal d'aplicacions -GenericName[cs]=Podpůrná vrstva aplikace -GenericName[da]=Programmotor -GenericName[de]=Dienstprogramm für Anwendungen -GenericName[el]=Σύστημα υποστήριξης εφαρμογών -GenericName[en_GB]=Applications Backend -GenericName[es]=Motor de aplicaciones -GenericName[et]=Rakenduste taustaprogramm -GenericName[fi]=Sovellukset-taustajärjestelmä -GenericName[fr]=Moteur des applications -GenericName[gl]=Infraestrutura de programas -GenericName[hu]=Alkalmazások háttérprogram -GenericName[id]=Backend Aplikasi -GenericName[it]=Motore applicazioni -GenericName[ko]=프로그램 백엔드 -GenericName[lt]=Programų posistemė -GenericName[nb]=Program-bakgrunnsmotor -GenericName[nds]=Programmen-Hülpprogramm -GenericName[nl]=Backend van toepassing -GenericName[nn]=Program-bakgrunnsmotor -GenericName[pl]=Silnik programów -GenericName[pt]=Infra-Estrutura de Aplicações -GenericName[pt_BR]=Infraestrutura de aplicativos -GenericName[ro]=Platformă de aplicații -GenericName[ru]=Модуль приложений -GenericName[sk]=Backend aplikácií -GenericName[sl]=Zaledje programov -GenericName[sr]=Позадина за програме -GenericName[sr@ijekavian]=Позадина за програме -GenericName[sr@ijekavianlatin]=Pozadina za programe -GenericName[sr@latin]=Pozadina za programe -GenericName[sv]=Programgränssnitt -GenericName[tr]=Uygulama Arka Uçları -GenericName[uk]=Модуль програм -GenericName[x-test]=xxApplications Backendxx -GenericName[zh_CN]=应用程序后端 -GenericName[zh_TW]=應用程式後端介面 -X-KDE-Library=muon-pkbackend -X-KDE-PluginInfo-Name=muon-packagekit-backend -X-KDE-PluginInfo-License=GPL diff --git a/libmuon/declarative/ApplicationProxyModelHelper.cpp b/libmuon/declarative/ApplicationProxyModelHelper.cpp deleted file mode 100644 index caa87f4..0000000 --- a/libmuon/declarative/ApplicationProxyModelHelper.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (C) 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library/Lesser General Public License - * version 2, or (at your option) any later version, as published by the - * Free Software Foundation - * - * 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 Library/Lesser 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 "ApplicationProxyModelHelper.h" -#include <resources/ResourcesModel.h> -#include <QDebug> - -ApplicationProxyModelHelper::ApplicationProxyModelHelper(QObject* parent) - : ResourcesProxyModel(parent) -{ - connect(this, &QAbstractItemModel::rowsInserted, this, &ApplicationProxyModelHelper::countChanged); - connect(this, &QAbstractItemModel::rowsRemoved, this, &ApplicationProxyModelHelper::countChanged); -} - -QHash<int, QByteArray> ApplicationProxyModelHelper::roleNames() const -{ - return ResourcesModel::global()->roleNames(); -} - -void ApplicationProxyModelHelper::componentComplete() -{ - setSourceModel(ResourcesModel::global()); - - if(!m_sortRoleString.isEmpty()) - setStringSortRole_hack(m_sortRoleString); - setSearch(lastSearch()); - setDynamicSortFilter(true); -} - -void ApplicationProxyModelHelper::sortModel() -{ - QSortFilterProxyModel::sort(sortColumn(), sortOrder()); -} - -int ApplicationProxyModelHelper::stringToRole(const QByteArray& strRole) const -{ - return roleNames().key(strRole); -} - -QByteArray ApplicationProxyModelHelper::roleToString(int role) const -{ - return roleNames().value(role); -} - -void ApplicationProxyModelHelper::setSortRole_hack(int role) -{ - setSortRole(role); - emit sortRoleChanged(); -} - -void ApplicationProxyModelHelper::setSortOrder_hack(Qt::SortOrder order) -{ - sort(0, order); - emit sortOrderChanged(); -} - -void ApplicationProxyModelHelper::setStringSortRole_hack(const QString& role) -{ - setSortRole_hack(stringToRole(role.toUtf8())); - m_sortRoleString = role; -} - -QString ApplicationProxyModelHelper::stringSortRole() const -{ - return roleToString(sortRole()); -} diff --git a/libmuon/declarative/ApplicationProxyModelHelper.h b/libmuon/declarative/ApplicationProxyModelHelper.h deleted file mode 100644 index 57f8414..0000000 --- a/libmuon/declarative/ApplicationProxyModelHelper.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library/Lesser General Public License - * version 2, or (at your option) any later version, as published by the - * Free Software Foundation - * - * 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 Library/Lesser 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 APPLICATIONPROXYMODELHELPER_H -#define APPLICATIONPROXYMODELHELPER_H - -#include <resources/ResourcesProxyModel.h> -#include <QQmlParserStatus> - -class ApplicationProxyModelHelper : public ResourcesProxyModel, public QQmlParserStatus -{ - Q_OBJECT - Q_INTERFACES(QQmlParserStatus) - Q_PROPERTY(int sortRole READ sortRole WRITE setSortRole_hack NOTIFY sortRoleChanged) - Q_PROPERTY(QString stringSortRole READ stringSortRole WRITE setStringSortRole_hack NOTIFY sortRoleChanged) - Q_PROPERTY(Qt::SortOrder sortOrder READ sortOrder WRITE setSortOrder_hack NOTIFY sortOrderChanged) - Q_PROPERTY(int count READ rowCount NOTIFY countChanged) - public: - void setStateFilter_hack(int state); - explicit ApplicationProxyModelHelper(QObject* parent = nullptr); - - void setSortRole_hack(int role); - void setSortOrder_hack(Qt::SortOrder order); - void setStringSortRole_hack(const QString& role); - QString stringSortRole() const; - - virtual void classBegin() override {} - virtual void componentComplete() override; - virtual QHash<int, QByteArray> roleNames() const override; - - public slots: - void sortModel(); - - signals: - void sortRoleChanged(); - void sortOrderChanged(); - void countChanged(); - - private: - int stringToRole(const QByteArray& strRole) const; - QByteArray roleToString(int role) const; - - QString m_sortRoleString; -}; - -#endif // APPLICATIONPROXYMODELHELPER_H diff --git a/libmuon/declarative/CMakeLists.txt b/libmuon/declarative/CMakeLists.txt deleted file mode 100644 index c43bd67..0000000 --- a/libmuon/declarative/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -include_directories( ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ..) - -add_library(muondeclarativeplugin MuonDeclarativePlugin.cpp ApplicationProxyModelHelper.cpp) - -target_link_libraries(muondeclarativeplugin Qt5::Core Qt5::Qml MuonCommon) - -install(TARGETS muondeclarativeplugin DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/muon) -install(FILES qmldir DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/muon) diff --git a/libmuon/declarative/MuonDeclarativePlugin.cpp b/libmuon/declarative/MuonDeclarativePlugin.cpp deleted file mode 100644 index 6b7dab5..0000000 --- a/libmuon/declarative/MuonDeclarativePlugin.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (C) 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library/Lesser General Public License - * version 2, or (at your option) any later version, as published by the - * Free Software Foundation - * - * 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 Library/Lesser 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 "MuonDeclarativePlugin.h" -#include "ApplicationProxyModelHelper.h" -#include <Category/CategoryModel.h> -#include <Category/Category.h> -#include <Transaction/TransactionListener.h> -#include <Transaction/TransactionModel.h> -#include <Transaction/Transaction.h> -#include <resources/ResourcesUpdatesModel.h> -#include <resources/AbstractResource.h> -#include <resources/ResourcesModel.h> -#include <resources/SourcesModel.h> -#include <resources/AbstractSourcesBackend.h> -#include <ReviewsBackend/Rating.h> -#include <ReviewsBackend/AbstractReviewsBackend.h> -#include <ReviewsBackend/ReviewsModel.h> -#include <UpdateModel/UpdateModel.h> -#include <ScreenshotsModel.h> -#include <ApplicationAddonsModel.h> -#include <MessageActionsModel.h> -#include <qqml.h> -#include <QQmlEngine> -#include <QQmlContext> -#include <QAction> - -QML_DECLARE_TYPE(ResourcesModel) -QML_DECLARE_TYPE(AbstractResourcesBackend) - -void MuonDeclarativePlugin::initializeEngine(QQmlEngine* engine, const char* uri) -{ - engine->rootContext()->setContextProperty("ResourcesModel", ResourcesModel::global()); - engine->rootContext()->setContextProperty("TransactionModel", TransactionModel::global()); - engine->rootContext()->setContextProperty("SourcesModel", SourcesModel::global()); - QQmlExtensionPlugin::initializeEngine(engine, uri); -} - -void MuonDeclarativePlugin::registerTypes(const char*) -{ - qmlRegisterType<CategoryModel>("org.kde.muon", 1, 0, "CategoryModel"); - qmlRegisterType<TransactionListener>("org.kde.muon", 1, 0, "TransactionListener"); - qmlRegisterType<TransactionModel>(); - qmlRegisterType<ResourcesUpdatesModel>("org.kde.muon", 1, 0, "ResourcesUpdatesModel"); - - qmlRegisterType<ReviewsModel>("org.kde.muon", 1, 0, "ReviewsModel"); - qmlRegisterType<ApplicationAddonsModel>("org.kde.muon", 1, 0, "ApplicationAddonsModel"); - qmlRegisterType<ScreenshotsModel>("org.kde.muon", 1, 0, "ScreenshotsModel"); - qmlRegisterType<ApplicationProxyModelHelper>("org.kde.muon", 1, 0, "ApplicationProxyModel"); - qmlRegisterType<MessageActionsModel>("org.kde.muon", 1, 0, "MessageActionsModel"); - qmlRegisterType<UpdateModel>("org.kde.muon", 1, 0, "UpdateModel"); - - qmlRegisterUncreatableType<QAction>("org.kde.muon", 1, 0, "QAction", "Use QQC Action"); - qmlRegisterType<Rating>(); - qmlRegisterType<AbstractResource>(); - qmlRegisterType<AbstractSourcesBackend>(); - qmlRegisterType<AbstractResourcesBackend>(); - qmlRegisterType<AbstractReviewsBackend>(); - qmlRegisterType<Category>(); - qmlRegisterType<ResourcesModel>(); - qmlRegisterType<Transaction>(); -} diff --git a/libmuon/declarative/MuonDeclarativePlugin.h b/libmuon/declarative/MuonDeclarativePlugin.h deleted file mode 100644 index da8e46b..0000000 --- a/libmuon/declarative/MuonDeclarativePlugin.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (C) 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library/Lesser General Public License - * version 2, or (at your option) any later version, as published by the - * Free Software Foundation - * - * 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 Library/Lesser 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 MUONDECLARATIVEPLUGIN_H -#define MUONDECLARATIVEPLUGIN_H - -#include <QtQml/QQmlExtensionPlugin> - -class MuonDeclarativePlugin : public QQmlExtensionPlugin -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") - public: - virtual void initializeEngine(QQmlEngine* engine, const char* uri) override; - virtual void registerTypes(const char*) override; -}; - -#endif diff --git a/libmuon/declarative/qmldir b/libmuon/declarative/qmldir deleted file mode 100644 index 0bb0f93..0000000 --- a/libmuon/declarative/qmldir +++ /dev/null @@ -1,3 +0,0 @@ -module org.kde.muon - -plugin muondeclarativeplugin diff --git a/libmuon/muondatasources.kcfg b/libmuon/muondatasources.kcfg deleted file mode 100644 index 83a0cca..0000000 --- a/libmuon/muondatasources.kcfg +++ /dev/null @@ -1,12 +0,0 @@ -<?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="muondatasourcesrc"/> - <group name="muon"> - <entry name="RnRSource" type="Url"><default>https://reviews.ubuntu.com/reviews/api/1.0/</default><label>Server from which ratings and reviews are pulled.</label></entry> - <entry name="FeaturedSource" type="Url"><label>Location of the featured applications data.</label></entry> - <entry name="ScreenshotsSource" type="Url"><default>http://screenshots.debian.net/</default><label>Where we pull our screenshots from.</label></entry> - </group> -</kcfg> diff --git a/libmuon/notifiers/BackendNotifierModule.cpp b/libmuon/notifiers/BackendNotifierModule.cpp deleted file mode 100644 index c2e7adc..0000000 --- a/libmuon/notifiers/BackendNotifierModule.cpp +++ /dev/null @@ -1,30 +0,0 @@ -/*************************************************************************** - * Copyright © 2014 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "BackendNotifierModule.h" - -BackendNotifierModule::BackendNotifierModule(QObject* parent) - : QObject(parent) -{} - -BackendNotifierModule::~BackendNotifierModule() -{} - -#include "BackendNotifierModule.moc" diff --git a/libmuon/notifiers/BackendNotifierModule.h b/libmuon/notifiers/BackendNotifierModule.h deleted file mode 100644 index 5b6f54e..0000000 --- a/libmuon/notifiers/BackendNotifierModule.h +++ /dev/null @@ -1,56 +0,0 @@ -/*************************************************************************** - * Copyright © 2014 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef BACKENDNOTIFIERMODULE_H -#define BACKENDNOTIFIERMODULE_H - -#include <QObject> -#include "libMuonNotifiers_export.h" - -class MUONNOTIFIERS_EXPORT BackendNotifierModule : public QObject -{ -Q_OBJECT -public: - BackendNotifierModule(QObject* parent = nullptr); - virtual ~BackendNotifierModule(); - - /*** @returns \c true if there are any updates, \c false if not **/ - virtual bool isSystemUpToDate() const = 0; - - /*** Check for new updates. Emits @see foundUpdates when it finds something. **/ - virtual void recheckSystemUpdateNeeded() = 0; - - /*** @returns count of !security updates only. **/ - virtual uint updatesCount() = 0; - - /*** @returns count of security updates only. **/ - virtual uint securityUpdatesCount() = 0; - -Q_SIGNALS: - /** - * This signal is emitted when any new updates are available. - * @see recheckSystemUpdateNeeded - */ - void foundUpdates(); -}; - -Q_DECLARE_INTERFACE(BackendNotifierModule, "org.kde.muon.BackendNotifierModule") - -#endif diff --git a/libmuon/notifiers/CMakeLists.txt b/libmuon/notifiers/CMakeLists.txt deleted file mode 100644 index 282c99d..0000000 --- a/libmuon/notifiers/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -add_library(MuonNotifiers BackendNotifierModule.cpp) -target_link_libraries(MuonNotifiers - PUBLIC - Qt5::Core -) - -generate_export_header(MuonNotifiers EXPORT_FILE_NAME libMuonNotifiers_export.h) - -target_include_directories(MuonNotifiers PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) -install(TARGETS MuonNotifiers ${INSTALL_TARGETS_DEFAULT_ARGS}) diff --git a/libmuon/resources/AbstractBackendUpdater.cpp b/libmuon/resources/AbstractBackendUpdater.cpp deleted file mode 100644 index 74718af..0000000 --- a/libmuon/resources/AbstractBackendUpdater.cpp +++ /dev/null @@ -1,31 +0,0 @@ -/*************************************************************************** - * Copyright © 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "AbstractBackendUpdater.h" - -AbstractBackendUpdater::AbstractBackendUpdater(QObject* parent) - : QObject(parent) -{} - -void AbstractBackendUpdater::cancel() -{ - Q_ASSERT(isCancelable() && "only call cancel when cancelable"); - Q_ASSERT(false && "if it can be canceled, then ::cancel() must be implemented"); -} diff --git a/libmuon/resources/AbstractBackendUpdater.h b/libmuon/resources/AbstractBackendUpdater.h deleted file mode 100644 index 42a622b..0000000 --- a/libmuon/resources/AbstractBackendUpdater.h +++ /dev/null @@ -1,203 +0,0 @@ -/*************************************************************************** - * Copyright © 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef ABSTRACTBACKENDUPDATER_H -#define ABSTRACTBACKENDUPDATER_H - -#include <QObject> -#include "libMuonCommon_export.h" - -class QAction; -class QDateTime; -class QIcon; -class AbstractResource; - -/** - * \class AbstractBackendUpdater AbstractBackendUpdater.h "AbstractBackendUpdater.h" - * - * \brief This is the base class for all abstract classes, which handle system upgrades. - * - * While implementing this is not mandatory for all backends (you can also use the - * StandardBackendUpdater, which just uses the functions in the ResourcesBackend to - * update the packages), it is recommended for many. - * - * Before starting the update, the AbstractBackendUpdater will have to keep a list of - * packages, which are about to be upgraded. First, all packages have to be inserted - * into this list in the \prepare method and they can then be changed by the user through - * the \addResources and \removeResources functions. - * - * When \start is called, the AbstractBackendUpdater should start the update and report its - * progress through the rest of methods outlined in this API documentation. - * - * @see addResources - * @see removeResources - * @see start - * @see prepare - */ -class MUONCOMMON_EXPORT AbstractBackendUpdater : public QObject -{ - Q_OBJECT - Q_PROPERTY(qreal progress READ progress NOTIFY progressChanged) - Q_PROPERTY(bool isCancelable READ isCancelable NOTIFY cancelableChanged) - Q_PROPERTY(bool isProgressing READ isProgressing NOTIFY progressingChanged) - Q_PROPERTY(QString statusMessage READ statusMessage NOTIFY statusMessageChanged) - Q_PROPERTY(QString statusDetail READ statusDetail NOTIFY statusDetailChanged) - Q_PROPERTY(quint64 downloadSpeed READ downloadSpeed NOTIFY downloadSpeedChanged) - public: - /** - * Constructs an AbstractBackendUpdater - */ - explicit AbstractBackendUpdater(QObject* parent = nullptr); - - /** - * This method is called, when Muon switches to the updates view. - * Here the backend should mark all upgradeable packages as to be upgraded. - */ - virtual void prepare() = 0; - - /** - * @returns true if the backend contains packages which can be updated - */ - virtual bool hasUpdates() const = 0; - /** - * @returns the progress of the update in percent - */ - virtual qreal progress() const = 0; - - /** - * @returns the proposed ETA in milliseconds - */ - virtual long unsigned int remainingTime() const = 0; - - /** - * This method is used to remove resources from the list of packages - * marked to be upgraded. It will potentially be called before \start. - */ - virtual void removeResources(const QList<AbstractResource*>& apps) = 0; - /** - * This method is used to add resource to the list of packages marked to be upgraded. - * It will potentially be called before \start. - */ - virtual void addResources(const QList<AbstractResource*>& apps) = 0; - - /** - * @returns the list of updateable resources in the system - */ - virtual QList<AbstractResource*> toUpdate() const = 0; - - /** - * @returns the QDateTime when the last update happened - */ - virtual QDateTime lastUpdate() const = 0; - /** - * @returns true when upgradeable packages are marked be upgraded - */ - virtual bool isAllMarked() const = 0; - /** - * @returns whether the updater can currently be canceled or not - * @see cancelableChanged - */ - virtual bool isCancelable() const = 0; - /** - * @returns whether the updater is currently running or not - * this property decides, if there will be progress reporting in the GUI. - * This has to stay true during the whole transaction! - * @see progressingChanged - */ - virtual bool isProgressing() const = 0; - - /** - * @returns the string about the current status of the update - */ - virtual QString statusMessage() const = 0; - /** - * @returns a more detailled description of what is currently happening with the update - */ - virtual QString statusDetail() const = 0; - /** - * @returns the overall download speed during the downloading phase of the update - */ - virtual quint64 downloadSpeed() const = 0; - - /** - * @returns whether @p res is marked for update - */ - virtual bool isMarked(AbstractResource* res) const = 0; - - public slots: - /** - * If \isCancelable is true during the transaction, this method has - * to be implemented and will potentially be called when the user - * wants to cancel the update. - */ - virtual void cancel(); - /** - * This method starts the update. All packages which are in \toUpdate - * are going to be updated. - * - * From this moment on the AbstractBackendUpdater should continuously update - * the other methods to show its progress. - * - * @see progress - * @see progressChanged - * @see isProgressing - * @see progressingChanged - */ - virtual void start() = 0; - - signals: - /** - * The AbstractBackendUpdater should emit this signal when the progress changed. - * @see progress - */ - void progressChanged(qreal progress); - /** - * The AbstractBackendUpdater should emit this signal when the remaining time changed. - * @see remainingTime - */ - void remainingTimeChanged();//FIXME: API inconsistency here!! - /** - * The AbstractBackendUpdater should emit this signal when the cancelable property changed. - * @see isCancelable - */ - void cancelableChanged(bool cancelable); - /** - * The AbstractBackendUpdater should emit this signal when the progressing property changed. - * @see isProgressing - */ - void progressingChanged(bool progressing); - /** - * The AbstractBackendUpdater should emit this signal when the status detail changed. - * @see statusDetail - */ - void statusDetailChanged(const QString& msg); - /** - * The AbstractBackendUpdater should emit this signal when the status message changed. - * @see statusMessage - */ - void statusMessageChanged(const QString& msg); - /** - * The AbstractBackendUpdater should emit this signal when the download speed changed. - * @see downloadSpeed - */ - void downloadSpeedChanged(quint64); -}; - -#endif // ABSTRACTBACKENDUPDATER_H diff --git a/libmuon/resources/AbstractKDEDModule.cpp b/libmuon/resources/AbstractKDEDModule.cpp deleted file mode 100644 index e69de29..0000000 --- a/libmuon/resources/AbstractKDEDModule.cpp +++ /dev/null diff --git a/libmuon/resources/AbstractKDEDModule.h b/libmuon/resources/AbstractKDEDModule.h deleted file mode 100644 index e69de29..0000000 --- a/libmuon/resources/AbstractKDEDModule.h +++ /dev/null diff --git a/libmuon/resources/AbstractResource.cpp b/libmuon/resources/AbstractResource.cpp deleted file mode 100644 index ecc7838..0000000 --- a/libmuon/resources/AbstractResource.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/*************************************************************************** - * Copyright © 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "AbstractResource.h" -#include "AbstractResourcesBackend.h" -#include <ReviewsBackend/AbstractReviewsBackend.h> -#include <klocalizedstring.h> -#include <KFormat> - -AbstractResource::AbstractResource(AbstractResourcesBackend* parent) - : QObject(parent) -{ - if (parent && parent->reviewsBackend()) - connect(parent->reviewsBackend(), &AbstractReviewsBackend::ratingsReady, this, &AbstractResource::ratingFetched); -} - -bool AbstractResource::canExecute() const -{ - return false; -} - -void AbstractResource::invokeApplication() const -{} - -bool AbstractResource::isTechnical() const -{ - return false; -} - -bool AbstractResource::canUpgrade() -{ - return state() == Upgradeable; -} - -bool AbstractResource::isInstalled() -{ - return state() >= Installed; -} - -void AbstractResource::fetchScreenshots() -{ - QList<QUrl> thumbs, screens; - QUrl thumbnail = thumbnailUrl(); - if(!thumbnail.isEmpty()) { - thumbs << thumbnail; - screens << screenshotUrl(); - } - emit screenshotsFetched(thumbs, screens); -} - -QStringList AbstractResource::mimetypes() const -{ - return QStringList(); -} - -QStringList AbstractResource::executables() const -{ - return QStringList(); -} - -AbstractResourcesBackend* AbstractResource::backend() const -{ - return static_cast<AbstractResourcesBackend*>(parent()); -} - -QString AbstractResource::status() -{ - switch(state()) { - case Broken: return i18n("Broken"); - case None: return i18n("Available"); - case Installed: return i18n("Installed"); - case Upgradeable: return i18n("Upgradeable"); - } - return QString(); -} - -bool AbstractResource::isFromSecureOrigin() const -{ - return false; -} - -QString AbstractResource::sizeDescription() -{ - return KFormat().formatByteSize(size()); -} - -QCollatorSortKey AbstractResource::nameSortKey() -{ - if (!m_collatorKey) { - m_collatorKey.reset(new QCollatorSortKey(QCollator().sortKey(name()))); - } - return *m_collatorKey; -} - -Rating* AbstractResource::rating() const -{ - AbstractReviewsBackend* ratings = backend()->reviewsBackend(); - return ratings ? ratings->ratingForApplication(const_cast<AbstractResource*>(this)) : nullptr; -} diff --git a/libmuon/resources/AbstractResource.h b/libmuon/resources/AbstractResource.h deleted file mode 100644 index de8558b..0000000 --- a/libmuon/resources/AbstractResource.h +++ /dev/null @@ -1,189 +0,0 @@ -/*************************************************************************** - * Copyright © 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef ABSTRACTRESOURCE_H -#define ABSTRACTRESOURCE_H - -#include <QtCore/QObject> -#include <QUrl> -#include <QStringList> -#include <QScopedPointer> -#include <QCollatorSortKey> - -#include "libMuonCommon_export.h" -#include "PackageState.h" - -class Rating; -class AbstractResourcesBackend; - -/** - * \class AbstractResource AbstractResource.h "AbstractResource.h" - * - * \brief This is the base class of all resources. - * - * Each backend must reimplement its own resource class which needs to derive from this one. - */ -class MUONCOMMON_EXPORT AbstractResource : public QObject -{ - Q_OBJECT - Q_PROPERTY(QString name READ name CONSTANT) - Q_PROPERTY(QString packageName READ packageName CONSTANT) - Q_PROPERTY(QString comment READ comment CONSTANT) - Q_PROPERTY(QString icon READ icon CONSTANT) - Q_PROPERTY(bool canExecute READ canExecute CONSTANT) - Q_PROPERTY(State state READ state NOTIFY stateChanged) - Q_PROPERTY(QString status READ status NOTIFY stateChanged) - Q_PROPERTY(QStringList category READ categories CONSTANT) - Q_PROPERTY(bool isTechnical READ isTechnical CONSTANT) - Q_PROPERTY(QUrl homepage READ homepage CONSTANT) - Q_PROPERTY(QUrl thumbnailUrl READ thumbnailUrl CONSTANT) - Q_PROPERTY(QUrl screenshotUrl READ screenshotUrl CONSTANT) - Q_PROPERTY(bool canUpgrade READ canUpgrade NOTIFY stateChanged) - Q_PROPERTY(bool isInstalled READ isInstalled NOTIFY stateChanged) - Q_PROPERTY(QString license READ license CONSTANT) - Q_PROPERTY(QString longDescription READ longDescription CONSTANT) - Q_PROPERTY(QString origin READ origin CONSTANT) - Q_PROPERTY(int size READ size NOTIFY stateChanged) - Q_PROPERTY(QString sizeDescription READ sizeDescription NOTIFY stateChanged) - Q_PROPERTY(QString installedVersion READ installedVersion NOTIFY stateChanged) - Q_PROPERTY(QString availableVersion READ availableVersion NOTIFY stateChanged) - Q_PROPERTY(QString section READ section CONSTANT) - Q_PROPERTY(QStringList mimetypes READ mimetypes CONSTANT) - Q_PROPERTY(AbstractResourcesBackend* backend READ backend CONSTANT) - Q_PROPERTY(Rating* rating READ rating NOTIFY ratingFetched) - public: - /** - * This describes the state of the resource - */ - enum State { - /** - * When the resource is somehow broken - */ - Broken, - /** - * This means that the resource is neither installed nor broken - */ - None, - /** - * The resource is installed and up-to-date - */ - Installed, - /** - * The resource is installed and an update is available - */ - Upgradeable - }; - Q_ENUMS(State) - - /** - * Constructs the AbstractResource with its corresponding backend - */ - explicit AbstractResource(AbstractResourcesBackend* parent); - - ///used as internal identification of a resource - virtual QString packageName() const = 0; - - ///resource name to be displayed - virtual QString name() = 0; - - ///short description of the resource - virtual QString comment() = 0; - - ///xdg-compatible icon name to represent the resource - virtual QString icon() const = 0; - - ///@returns whether invokeApplication makes something - /// false if not overridden - virtual bool canExecute() const; - - ///executes the resource, if applies. - Q_SCRIPTABLE virtual void invokeApplication() const; - - virtual State state() = 0; - - virtual QStringList categories() = 0; - - ///@returns a URL that points to the content - virtual QUrl homepage() = 0; - - virtual bool isTechnical() const; - - virtual QUrl thumbnailUrl() = 0; - virtual QUrl screenshotUrl() = 0; - - virtual int size() = 0; - virtual QString sizeDescription(); - virtual QString license() = 0; - - virtual QString installedVersion() const = 0; - virtual QString availableVersion() const = 0; - virtual QString longDescription() = 0; - - virtual QString origin() const = 0; - virtual QString section() = 0; - - ///@returns what kind of mime types the resource can consume - virtual QStringList mimetypes() const; - - virtual QList<PackageState> addonsInformation() = 0; - bool isFromSecureOrigin() const; - - virtual QStringList executables() const; - - bool canUpgrade(); - bool isInstalled(); - - ///@returns a user-readable explaination of the resource status - ///by default, it will specify what state() is returning - virtual QString status(); - - AbstractResourcesBackend* backend() const; - - /** - * @returns a name sort key for faster sorting - */ - QCollatorSortKey nameSortKey(); - - /** - * Convenience method to fetch the resource's rating - * - * @returns the rating for the resource or null if not available - */ - Rating* rating() const; - - public slots: - virtual void fetchScreenshots(); - virtual void fetchChangelog() = 0; - - signals: - void stateChanged(); - void ratingFetched(); - - ///response to the fetchScreenshots method - ///@p thumbnails and @p screenshots should have the same number of elements - void screenshotsFetched(const QList<QUrl>& thumbnails, const QList<QUrl>& screenshots); - void changelogFetched(const QString& changelog); - - private: -// TODO: make it std::optional or make QCollatorSortKey() - QScopedPointer<QCollatorSortKey> m_collatorKey; -}; - -#endif // ABSTRACTRESOURCE_H diff --git a/libmuon/resources/AbstractResourcesBackend.cpp b/libmuon/resources/AbstractResourcesBackend.cpp deleted file mode 100644 index b82bd58..0000000 --- a/libmuon/resources/AbstractResourcesBackend.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/*************************************************************************** - * Copyright © 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "AbstractResourcesBackend.h" -#include <QHash> - -AbstractResourcesBackend::AbstractResourcesBackend(QObject* parent) - : QObject(parent) -{ -} - -void AbstractResourcesBackend::installApplication(AbstractResource* app) -{ - installApplication(app, AddonList()); -} - -void AbstractResourcesBackend::integrateMainWindow(KXmlGuiWindow*) -{} - -void AbstractResourcesBackend::setMetaData(const QString&) -{} - -void AbstractResourcesBackend::setName(const QString& name) -{ - m_name = name; -} - -QString AbstractResourcesBackend::name() const -{ - return m_name; -} diff --git a/libmuon/resources/AbstractResourcesBackend.h b/libmuon/resources/AbstractResourcesBackend.h deleted file mode 100644 index 6a73719..0000000 --- a/libmuon/resources/AbstractResourcesBackend.h +++ /dev/null @@ -1,233 +0,0 @@ -/*************************************************************************** - * Copyright © 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef ABSTRACTRESOURCESBACKEND_H -#define ABSTRACTRESOURCESBACKEND_H - -#include <QtCore/QObject> -#include <QtCore/QPair> -#include <QtCore/QVector> - -#include "Transaction/AddonList.h" - -#include "libMuonCommon_export.h" - -class QAction; -class Transaction; -class AbstractReviewsBackend; -class AbstractResource; -class AbstractBackendUpdater; -class KXmlGuiWindow; - -/** - * \class AbstractResourcesBackend AbstractResourcesBackend.h "AbstractResourcesBackend.h" - * - * \brief This is the base class of all resource backends. - * - * For writing basic new resource backends, we need to implement two classes: this and the - * AbstractResource one. Basic questions on how to build your plugin with those classes - * can be answered by looking at the dummy plugin. - * - * As this is the base class of a backend, we save all the created resources here and also - * accept calls to install and remove applications or to cancel transactions. - * - * To show resources in Muon, we need to initialize all resources we want to show beforehand, - * we should not create resources in the search function. When we reload the resources - * (e.g. when initializing), the backend needs change the fetching property throughout the - * processs. - */ -class MUONCOMMON_EXPORT AbstractResourcesBackend : public QObject -{ - Q_OBJECT - Q_PROPERTY(QString name READ name CONSTANT) - Q_PROPERTY(AbstractReviewsBackend* reviewsBackend READ reviewsBackend CONSTANT) - Q_PROPERTY(int updatesCount READ updatesCount NOTIFY updatesCountChanged) - Q_PROPERTY(bool isFetching READ isFetching NOTIFY fetchingChanged) - public: - /** - * Constructs an AbstractResourcesBackend - * @param parent the parent of the class (the object will be deleted when the parent gets deleted) - */ - explicit AbstractResourcesBackend(QObject* parent = nullptr); - - /** - * @returns true when the backend is in a valid state, which means it is able to work - * You must return true here if you want the backend to be loaded. - */ - virtual bool isValid() const = 0; - - /** - * @returns all resources of the backend - */ - virtual QVector<AbstractResource*> allResources() const = 0; - - /** - * In this method the backend should search in each resources name if it complies - * to the searchText and return those AbstractResources. - * @returns the list of resources whose name contains searchText - */ - virtual QList<AbstractResource*> searchPackageName(const QString &searchText) = 0;//FIXME: Probably provide a standard implementation?! - - /** - * @returns the reviews backend of this AbstractResourcesBackend (which handles all ratings and reviews of resources) - */ - virtual AbstractReviewsBackend* reviewsBackend() const = 0;//FIXME: Have a standard impl which returns 0? - - /** - * @returns the class which is used by muon to update the users system, if you are unsure what to do - * just return the StandardBackendUpdater - */ - virtual AbstractBackendUpdater* backendUpdater() const = 0;//FIXME: Standard impl returning the standard updater? - - /** - * @returns the number of resources for which an update is available, it should only count technical packages - */ - virtual int updatesCount() const = 0;//FIXME: Probably provide a standard implementation?! - - /** - * Gets a resource identified by the name - * @param name the name to search for - * @returns the resource with the provided name - */ - virtual AbstractResource* resourceByPackageName(const QString& name) const = 0;//FIXME: Even this could get a standard impl - - /** - * @returns all resources for which an update is available - */ - virtual QList<AbstractResource*> upgradeablePackages() const = 0;//FIXME: Do a standard impl as well - - /** - * This method gets called while initializing the GUI, in case the backend needs to - * integrate in a special way with the KXmlGuiWindow. - * @param w the KXmlGuiWindow the backend should integrate to - */ - virtual void integrateMainWindow(KXmlGuiWindow* w); - - /** - * Tells whether the backend is fetching resources - */ - virtual bool isFetching() const = 0; - - /** - * Receives a path with the plugin's desktop file - */ - virtual void setMetaData(const QString& path); - - /** - * This method is used to integrate advanced functions into the Muon GUI. - * - * In muon-updater, actions with HighPriority will be shown in a KMessageWidget, - * normal priority will go right on top of the more menu, low priority will go - * to the advanced menu. - */ - virtual QList<QAction*> messageActions() const = 0; - - /** @returns the plugin's name */ - QString name() const; - - /** @internal only to be used by the factory */ - void setName(const QString& name); - - public slots: - /** - * This gets called when the backend should install an application. - * The AbstractResourcesBackend should create a Transaction object, which - * will provide Muon with information like the status and progress of a transaction, - * and add it to the TransactionModel with the following line: - * \code - * TransactionModel::global()->addTransaction(transaction); - * \endcode - * where transaction is the newly created Transaction. - * @param app the application to be installed - * @param addons the addons which should be installed with the application - */ - virtual void installApplication(AbstractResource *app, AddonList addons) = 0; - - /** - * Overloaded function, which simply does the same, except not installing any addons. - */ - virtual void installApplication(AbstractResource *app); - - /** - * This gets called when the backend should remove an application. - * Like in the installApplication() method, the AbstractResourcesBackend should - * create a Transaction object and add it to the TransactionModel. - * @see installApplication - * @param app the application to be removed - */ - virtual void removeApplication(AbstractResource *app) = 0; - - /** - * This gets called when a transaction should get canceled and thus the backend - * should cancel the transaction and remove it from the TransactionModel: - * \code - * TransactionModel::global()->removeTransaction(t); - * \endcode - * @param app the application whose transaction is going to be canceled - */ - virtual void cancelTransaction(AbstractResource *app) = 0; - - signals: - /** - * Notify of a change in the backend - */ - void fetchingChanged(); - - /** - * This should be emitted when the number of upgradeable packages changed. - */ - void updatesCountChanged(); - /** - * This should be emitted when all data of the backends resources changed. Internally it will emit - * a signal in the model to show the view that all data of a certain backend changed. - */ - void allDataChanged(); - /** - * This should be emitted whenever there are new search results available, other than the ones returned previously, - * or the data set in which the backend searched changed. - */ - void searchInvalidated(); - - private: - QString m_name; -}; - - -/** - * @internal Workaround because QPluginLoader enforces 1 instance per plugin - */ -class MUONCOMMON_EXPORT AbstractResourcesBackendFactory : public QObject -{ -public: - virtual AbstractResourcesBackend* newInstance(QObject* parent) const = 0; -}; - -#define MUON_BACKEND_PLUGIN(ClassName)\ - class ClassName##Factory : public AbstractResourcesBackendFactory {\ - Q_OBJECT\ - Q_PLUGIN_METADATA(IID "org.kde.muon.AbstractResourcesBackendFactory")\ - Q_INTERFACES(AbstractResourcesBackendFactory)\ - public:\ - virtual AbstractResourcesBackend* newInstance(QObject* parent) const override { return new ClassName(parent); }\ - }; - -Q_DECLARE_INTERFACE( AbstractResourcesBackendFactory, "org.kde.muon.AbstractResourcesBackendFactory" ) - -#endif // ABSTRACTRESOURCESBACKEND_H diff --git a/libmuon/resources/AbstractSourcesBackend.cpp b/libmuon/resources/AbstractSourcesBackend.cpp deleted file mode 100644 index 18395f2..0000000 --- a/libmuon/resources/AbstractSourcesBackend.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/*************************************************************************** - * Copyright © 2014 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "AbstractSourcesBackend.h" - -AbstractSourcesBackend::AbstractSourcesBackend(QObject* parent) - : QObject(parent) -{} - -AbstractSourcesBackend::~AbstractSourcesBackend() -{} diff --git a/libmuon/resources/AbstractSourcesBackend.h b/libmuon/resources/AbstractSourcesBackend.h deleted file mode 100644 index 13b7e33..0000000 --- a/libmuon/resources/AbstractSourcesBackend.h +++ /dev/null @@ -1,49 +0,0 @@ -/*************************************************************************** - * Copyright © 2014 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef ABSTRACTSOURCESMANAGER_H -#define ABSTRACTSOURCESMANAGER_H - -#include <QObject> -#include "libMuonCommon_export.h" - -class QAction; -class QAbstractItemModel; -class MUONCOMMON_EXPORT AbstractSourcesBackend : public QObject -{ - Q_OBJECT - Q_PROPERTY(QAbstractItemModel* sources READ sources CONSTANT) - Q_PROPERTY(QString name READ name CONSTANT) - Q_PROPERTY(QString idDescription READ idDescription CONSTANT) - public: - AbstractSourcesBackend(QObject* parent); - ~AbstractSourcesBackend(); - - virtual QString name() const = 0; - virtual QString idDescription() = 0; - - Q_SCRIPTABLE virtual bool addSource(const QString& id) = 0; - Q_SCRIPTABLE virtual bool removeSource(const QString& id) = 0; - - virtual QAbstractItemModel* sources() = 0; - virtual QList<QAction*> actions() const = 0; -}; - -#endif // ABSTRACTRESOURCESBACKEND_H diff --git a/libmuon/resources/PackageState.cpp b/libmuon/resources/PackageState.cpp deleted file mode 100644 index 5e8deab..0000000 --- a/libmuon/resources/PackageState.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/*************************************************************************** - * Copyright © 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "PackageState.h" - -PackageState::PackageState(QString name, QString description, bool installed) - : m_name(std::move(name)) - , m_description(std::move(description)) - , m_installed(installed) -{} - -QString PackageState::name() const -{ - return m_name; -} - -QString PackageState::description() const -{ - return m_description; -} - -bool PackageState::isInstalled() const -{ - return m_installed; -} - -void PackageState::setInstalled(bool installed) -{ - m_installed = installed; -} diff --git a/libmuon/resources/PackageState.h b/libmuon/resources/PackageState.h deleted file mode 100644 index 4b80a7d..0000000 --- a/libmuon/resources/PackageState.h +++ /dev/null @@ -1,49 +0,0 @@ -/*************************************************************************** - * Copyright © 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef PACKAGESTATE_H -#define PACKAGESTATE_H - -#include <QString> -#include "libMuonCommon_export.h" - -/** - * The @class PackageState will be used to expose resources related to an @class AbstractResource. - * - * @see ApplicationAddonsModel - */ -class MUONCOMMON_EXPORT PackageState -{ - public: - PackageState(QString name, QString description, bool installed); - PackageState& operator=(const PackageState& other); - - QString name() const; - QString description() const; - bool isInstalled() const; - void setInstalled(bool installed); - - private: - QString m_name; - QString m_description; - bool m_installed; -}; - -#endif // PACKAGESTATE_H diff --git a/libmuon/resources/ResourcesModel.cpp b/libmuon/resources/ResourcesModel.cpp deleted file mode 100644 index 45d5d94..0000000 --- a/libmuon/resources/ResourcesModel.cpp +++ /dev/null @@ -1,432 +0,0 @@ -/*************************************************************************** - * Copyright © 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "ResourcesModel.h" - -#include "AbstractResource.h" -#include "resources/AbstractResourcesBackend.h" -#include <ReviewsBackend/Rating.h> -#include <ReviewsBackend/AbstractReviewsBackend.h> -#include <Transaction/Transaction.h> -#include <MuonBackendsFactory.h> -#include <KXmlGuiWindow> -#include "Transaction/TransactionModel.h" -#include "Category/CategoryModel.h" -#include <QDebug> -#include <QCoreApplication> -#include <QThread> -#include <QAction> - -// static const KCatalogLoader loader("libmuon");//FIXME port - -ResourcesModel *ResourcesModel::s_self = nullptr; - -ResourcesModel *ResourcesModel::global() -{ - if(!s_self) - s_self = new ResourcesModel; - return s_self; -} - -ResourcesModel::ResourcesModel(QObject* parent, bool load) - : QAbstractListModel(parent) - , m_initializingBackends(0) - , m_mainwindow(nullptr) - , m_roles(QAbstractItemModel::roleNames().unite({ - { NameRole, "name" }, - { IconRole, "icon" }, - { CommentRole, "comment" }, - { StateRole, "state" }, - { RatingRole, "rating" }, - { RatingPointsRole, "ratingPoints" }, - { SortableRatingRole, "sortableRating" }, - { ActiveRole, "active" }, - { InstalledRole, "isInstalled" }, - { ApplicationRole, "application" }, - { OriginRole, "origin" }, - { CanUpgrade, "canUpgrade" }, - { PackageNameRole, "packageName" }, - { IsTechnicalRole, "isTechnical" }, - { CategoryRole, "category" }, - { SectionRole, "section" }, - { MimeTypes, "mimetypes" }, - { SizeRole, "size" } - }) - ) -{ - init(load); - connect(this, SIGNAL(allInitialized()), SIGNAL(fetchingChanged())); -} - -void ResourcesModel::init(bool load) -{ - Q_ASSERT(!s_self); - Q_ASSERT(QCoreApplication::instance()->thread()==QThread::currentThread()); - - connect(TransactionModel::global(), SIGNAL(transactionAdded(Transaction*)), SLOT(resourceChangedByTransaction(Transaction*))); - connect(TransactionModel::global(), SIGNAL(transactionRemoved(Transaction*)), SLOT(resourceChangedByTransaction(Transaction*))); - if(load) - QMetaObject::invokeMethod(this, "registerAllBackends", Qt::QueuedConnection); -} - -ResourcesModel::ResourcesModel(const QString& backendName, QObject* parent) - : ResourcesModel(parent, false) -{ - s_self = this; - registerBackendByName(backendName); -} - -ResourcesModel::~ResourcesModel() -{ - qDeleteAll(m_backends); -} - -QHash<int, QByteArray> ResourcesModel::roleNames() const -{ - return m_roles; -} - -void ResourcesModel::addResourcesBackend(AbstractResourcesBackend* backend) -{ - Q_ASSERT(!m_backends.contains(backend)); - if(!backend->isValid()) { - qWarning() << "Discarding invalid backend" << backend->name(); - CategoryModel::blacklistPlugin(backend->name()); - backend->deleteLater(); - return; - } - - if(!backend->isFetching()) { - QVector<AbstractResource*> newResources = backend->allResources(); - int current = rowCount(); - beginInsertRows(QModelIndex(), current, current+newResources.size()); - m_backends += backend; - m_resources.append(newResources); - endInsertRows(); - emit updatesCountChanged(); - } else { - m_initializingBackends++; - m_backends += backend; - m_resources.append(QVector<AbstractResource*>()); - } - if(m_mainwindow) - backend->integrateMainWindow(m_mainwindow); - - connect(backend, SIGNAL(fetchingChanged()), SLOT(callerFetchingChanged())); - connect(backend, SIGNAL(allDataChanged()), SLOT(updateCaller())); - connect(backend, SIGNAL(updatesCountChanged()), SIGNAL(updatesCountChanged())); - connect(backend, SIGNAL(searchInvalidated()), SIGNAL(searchInvalidated())); - - emit backendsChanged(); - - if(m_initializingBackends==0) - emit allInitialized(); - else - emit fetchingChanged(); -} - -AbstractResource* ResourcesModel::resourceAt(int row) const -{ - for (auto it = m_resources.constBegin(); it != m_resources.constEnd(); ++it) { - if (it->size()<=row) - row -= it->size(); - else - return it->at(row); - } - return nullptr; -} - -QModelIndex ResourcesModel::resourceIndex(AbstractResource* res) const -{ - AbstractResourcesBackend* backend = res->backend(); - int row = 0, backends = m_backends.count(); - for(int i=0; i<backends; i++) { - if(m_backends[i]!=backend) - row += m_resources[i].size(); - else { - Q_ASSERT(!m_backends[i]->isFetching()); - int pos = m_resources[i].indexOf(res); - Q_ASSERT(pos>=0); - return index(row+pos); - } - } - - return QModelIndex(); -} - -QVariant ResourcesModel::data(const QModelIndex& index, int role) const -{ - if (!index.isValid()) { - return QVariant(); - } - - AbstractResource* resource = resourceAt(index.row()); - switch(role) { - case ActiveRole: - return TransactionModel::global()->transactionFromResource(resource) != nullptr; - case ApplicationRole: - return qVariantFromValue<QObject*>(resource); - case RatingPointsRole: - case RatingRole: - case SortableRatingRole: { - Rating* rating = resource->rating(); - return rating ? rating->property(roleNames().value(role)) : -1; - } - case Qt::DecorationRole: - case Qt::DisplayRole: - case Qt::StatusTipRole: - case Qt::ToolTipRole: - return QVariant(); - default: { - QByteArray roleText = roleNames().value(role); - const QMetaObject* m = resource->metaObject(); - int propidx = roleText.isEmpty() ? -1 : m->indexOfProperty(roleText); - - if(Q_UNLIKELY(propidx < 0)) { - qDebug() << "unknown role:" << role << roleText; - return QVariant(); - } else - return m->property(propidx).read(resource); - } - } -} - -int ResourcesModel::rowCount(const QModelIndex& parent) const -{ - if(parent.isValid()) - return 0; // Not the root element, and children don't have subchildren - - // The root element parents all resources from all backends - int ret = 0; - Q_FOREACH (const QVector<AbstractResource*>& resources, m_resources) - ret += resources.size(); - - return ret; -} - -int ResourcesModel::rowsBeforeBackend(AbstractResourcesBackend* backend, QVector<QVector<AbstractResource*>>::iterator& backendsResources) -{ - Q_ASSERT(backend); - int pos = m_backends.indexOf(backend); - Q_ASSERT(pos>=0); - backendsResources = m_resources.begin()+pos; - - int before = 0; - for(auto it = m_resources.constBegin(); - it != m_resources.constEnd() && it != backendsResources; - ++it) - { - before+= it->size(); - } - return before; -} - -void ResourcesModel::cleanBackend(AbstractResourcesBackend* backend) -{ - QVector<QVector<AbstractResource*>>::iterator backendsResources; - int before = rowsBeforeBackend(backend, backendsResources); - - if (backendsResources->isEmpty()) { - return; - } - - beginRemoveRows(QModelIndex(), before, before + backendsResources->count() - 1); - backendsResources->clear(); - endRemoveRows(); -} - -void ResourcesModel::callerFetchingChanged() -{ - AbstractResourcesBackend* backend = qobject_cast<AbstractResourcesBackend*>(sender()); - - if (!backend->isValid()) { - qWarning() << "Discarding invalid backend" << backend->name(); - cleanBackend(backend); - int idx = m_backends.indexOf(backend); - Q_ASSERT(idx>=0); - m_backends.removeAt(idx); - m_resources.removeAt(idx); - CategoryModel::blacklistPlugin(backend->name()); - backend->deleteLater(); - return; - } - - if(backend->isFetching()) { - m_initializingBackends++; - cleanBackend(backend); - emit fetchingChanged(); - } else { - resetBackend(backend); - } -} - -void ResourcesModel::resetBackend(AbstractResourcesBackend* backend) -{ - QVector<AbstractResource*> res = backend->allResources(); - - if(!res.isEmpty()) { - QVector<QVector<AbstractResource*>>::iterator backendsResources; - int before = rowsBeforeBackend(backend, backendsResources); - Q_ASSERT(backendsResources->isEmpty()); - - beginInsertRows(QModelIndex(), before, before+res.size()-1); - *backendsResources = res; - endInsertRows(); - emit updatesCountChanged(); - } - m_initializingBackends--; - if(m_initializingBackends==0) - emit allInitialized(); -} - -void ResourcesModel::updateCaller() -{ - AbstractResourcesBackend* backend = qobject_cast<AbstractResourcesBackend*>(sender()); - QVector<QVector<AbstractResource*>>::iterator backendsResources; - int before = rowsBeforeBackend(backend, backendsResources); - if (backendsResources->isEmpty()) - return; - - emit dataChanged(index(before), index(before+backendsResources->size()-1)); -} - -QVector< AbstractResourcesBackend* > ResourcesModel::backends() const -{ - return m_backends; -} - -AbstractResource* ResourcesModel::resourceByPackageName(const QString& name) -{ - foreach(AbstractResourcesBackend* backend, m_backends) - { - AbstractResource* res = backend->resourceByPackageName(name); - if(res) { - return res; - } - } - return nullptr; -} - -int ResourcesModel::updatesCount() const -{ - int ret = 0; - - foreach(AbstractResourcesBackend* backend, m_backends) { - ret += backend->updatesCount(); - } - - return ret; -} - -void ResourcesModel::installApplication(AbstractResource* app) -{ - Q_ASSERT(!isFetching()); - app->backend()->installApplication(app); -} - -void ResourcesModel::installApplication(AbstractResource* app, AddonList addons) -{ - Q_ASSERT(!isFetching()); - app->backend()->installApplication(app, addons); -} - -void ResourcesModel::removeApplication(AbstractResource* app) -{ - Q_ASSERT(!isFetching()); - app->backend()->removeApplication(app); -} - -void ResourcesModel::cancelTransaction(AbstractResource* app) -{ - Q_ASSERT(!isFetching()); - app->backend()->cancelTransaction(app); -} - -QMap<int, QVariant> ResourcesModel::itemData(const QModelIndex& index) const -{ - QMap<int, QVariant> ret; - QHash<int, QByteArray> names = roleNames(); - for (auto it = names.constBegin(); it != names.constEnd(); ++it) { - ret.insert(it.key(), data(index, it.key())); - } - return ret; -} - -void ResourcesModel::registerAllBackends() -{ - MuonBackendsFactory f; - QList<AbstractResourcesBackend*> backends = f.allBackends(); - if(m_initializingBackends==0 && backends.isEmpty()) { - qWarning() << "Couldn't find any backends"; - emit allInitialized(); - } else { - foreach(AbstractResourcesBackend* b, backends) { - addResourcesBackend(b); - } - } -} - -void ResourcesModel::registerBackendByName(const QString& name) -{ - MuonBackendsFactory f; - addResourcesBackend(f.backend(name)); -} - -void ResourcesModel::integrateMainWindow(KXmlGuiWindow* w) -{ - Q_ASSERT(w->thread()==thread()); - m_mainwindow = w; - setParent(w); - foreach(AbstractResourcesBackend* b, m_backends) { - b->integrateMainWindow(w); - } -} - -void ResourcesModel::resourceChangedByTransaction(Transaction* t) -{ - Q_ASSERT(!t->resource()->backend()->isFetching()); - QModelIndex idx = resourceIndex(t->resource()); - if(idx.isValid()) - emit dataChanged(idx, idx); -} - -bool ResourcesModel::isFetching() const -{ - foreach(AbstractResourcesBackend* b, m_backends) { - if(b->isFetching()) - return true; - } - return false; -} - -QList<QAction*> ResourcesModel::messageActions() const -{ - QList<QAction*> ret; - foreach(AbstractResourcesBackend* b, m_backends) { - ret += b->messageActions(); - } - Q_ASSERT(!ret.contains(nullptr)); - return ret; -} - -bool ResourcesModel::isBusy() const -{ - return TransactionModel::global()->rowCount() > 0; -} diff --git a/libmuon/resources/ResourcesModel.h b/libmuon/resources/ResourcesModel.h deleted file mode 100644 index ddb1464..0000000 --- a/libmuon/resources/ResourcesModel.h +++ /dev/null @@ -1,124 +0,0 @@ -/*************************************************************************** - * Copyright © 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef RESOURCESMODEL_H -#define RESOURCESMODEL_H - -#include <QtCore/QModelIndex> -#include <QVector> - -#include "libMuonCommon_export.h" -#include "AbstractResourcesBackend.h" - -class AbstractResource; -class AbstractResourcesBackend; - -class MUONCOMMON_EXPORT ResourcesModel : public QAbstractListModel -{ - Q_OBJECT - Q_PROPERTY(int updatesCount READ updatesCount NOTIFY updatesCountChanged) - Q_PROPERTY(bool isFetching READ isFetching NOTIFY fetchingChanged) - public: - enum Roles { - NameRole = Qt::UserRole, - IconRole, - CommentRole, - StateRole, - RatingRole, - RatingPointsRole, - SortableRatingRole, - ActiveRole, - InstalledRole, - ApplicationRole, - OriginRole, - CanUpgrade, - PackageNameRole, - IsTechnicalRole, - CategoryRole, - SectionRole, - MimeTypes, - SizeRole - }; - /** This constructor should be only used by unit tests. - * @p backendName defines what backend will be loaded when the backend is constructed. - */ - explicit ResourcesModel(const QString& backendName, QObject* parent = nullptr); - static ResourcesModel* global(); - virtual ~ResourcesModel(); - - virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; - virtual int rowCount(const QModelIndex& parent = QModelIndex()) const override; - - AbstractResource* resourceAt(int row) const; - QModelIndex resourceIndex(AbstractResource* res) const; - QVector< AbstractResourcesBackend* > backends() const; - int updatesCount() const; - virtual QMap< int, QVariant > itemData(const QModelIndex& index) const override; - - Q_SCRIPTABLE AbstractResource* resourceByPackageName(const QString& name); - - void integrateMainWindow(KXmlGuiWindow* w); - - bool isBusy() const; - bool isFetching() const; - QList<QAction*> messageActions() const; - - virtual QHash<int, QByteArray> roleNames() const override; - - public slots: - void installApplication(AbstractResource* app, AddonList addons); - void installApplication(AbstractResource* app); - void removeApplication(AbstractResource* app); - void cancelTransaction(AbstractResource* app); - - signals: - void fetchingChanged(); - void allInitialized(); - void backendsChanged(); - void updatesCountChanged(); - void searchInvalidated(); - - private slots: - void resetBackend(AbstractResourcesBackend* backend); - void cleanBackend(AbstractResourcesBackend* backend); - void callerFetchingChanged(); - void updateCaller(); - void registerAllBackends(); - void resourceChangedByTransaction(Transaction* t); - - private: - int rowsBeforeBackend(AbstractResourcesBackend* backend, QVector<QVector<AbstractResource*>>::iterator& backendsResources); - - ///@p initialize tells if all backends load will be triggered on construction - explicit ResourcesModel(QObject* parent=nullptr, bool initialize = true); - void init(bool initialize); - void addResourcesBackend(AbstractResourcesBackend* resources); - void registerBackendByName(const QString& name); - - QVector< AbstractResourcesBackend* > m_backends; - QVector< QVector<AbstractResource*> > m_resources; - int m_initializingBackends; - KXmlGuiWindow* m_mainwindow; - const QHash<int, QByteArray> m_roles; - - static ResourcesModel* s_self; -}; - -#endif // RESOURCESMODEL_H diff --git a/libmuon/resources/ResourcesProxyModel.cpp b/libmuon/resources/ResourcesProxyModel.cpp deleted file mode 100644 index fcc8e7a..0000000 --- a/libmuon/resources/ResourcesProxyModel.cpp +++ /dev/null @@ -1,308 +0,0 @@ -/*************************************************************************** - * Copyright © 2010 Jonathan Thomas <echidnaman@kubuntu.org> * - * Copyright © 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "ResourcesProxyModel.h" - -#include <QDebug> - -#include "ResourcesModel.h" -#include "AbstractResource.h" -#include "AbstractResourcesBackend.h" - -ResourcesProxyModel::ResourcesProxyModel(QObject *parent) - : QSortFilterProxyModel(parent) - , m_sortByRelevancy(false) - , m_filterBySearch(false) - , m_filteredCategory(nullptr) - , m_stateFilter(AbstractResource::Broken) -{ - setShouldShowTechnical(false); -} - -void ResourcesProxyModel::setSourceModel(QAbstractItemModel* source) -{ - ResourcesModel* model = qobject_cast<ResourcesModel*>(sourceModel()); - if(model) { - disconnect(model, SIGNAL(searchInvalidated()), this, SLOT(refreshSearch())); - } - - QSortFilterProxyModel::setSourceModel(source); - - ResourcesModel* newModel = qobject_cast<ResourcesModel*>(source); - if(newModel) { - connect(newModel, SIGNAL(searchInvalidated()), SLOT(refreshSearch())); - } else if(source) - qWarning() << "ResourcesProxyModel with " << source; -} - -void ResourcesProxyModel::setSearch(const QString &searchText) -{ - m_searchResults.clear(); - m_lastSearch = searchText; - ResourcesModel* model = qobject_cast<ResourcesModel*>(sourceModel()); - if(!model) { - return; - } - - // 1-character searches are painfully slow. >= 2 chars are fine, though - if (searchText.size() > 1) { - QVector< AbstractResourcesBackend* > backends= model->backends(); - foreach(AbstractResourcesBackend* backend, backends) - m_searchResults += backend->searchPackageName(searchText); - m_sortByRelevancy = true; - m_filterBySearch = true; - } else { - m_filterBySearch = false; - m_sortByRelevancy = false; - } - invalidateFilter(); - emit invalidated(); -} - -QString ResourcesProxyModel::lastSearch() const -{ - return m_lastSearch; -} - -void ResourcesProxyModel::refreshSearch() -{ - setSearch(lastSearch()); -} - -void ResourcesProxyModel::setOriginFilter(const QString &origin) -{ - if(origin.isEmpty()) - m_roleFilters.remove("origin"); - else - m_roleFilters.insert("origin", origin); - - invalidateFilter(); - emit invalidated(); -} - -QString ResourcesProxyModel::originFilter() const -{ - return m_roleFilters.value("origin").toString(); -} - -void ResourcesProxyModel::setFiltersFromCategory(Category *category) -{ - if(category==m_filteredCategory) - return; - - if(category) { - m_andFilters = category->andFilters(); - m_orFilters = category->orFilters(); - m_notFilters = category->notFilters(); - } else { - m_andFilters.clear(); - m_orFilters.clear(); - m_notFilters.clear(); - } - - m_filteredCategory = category; - invalidate(); - emit invalidated(); - emit categoryChanged(); -} - -void ResourcesProxyModel::setShouldShowTechnical(bool show) -{ - if(!show) - m_roleFilters.insert("isTechnical", false); - else - m_roleFilters.remove("isTechnical"); - emit showTechnicalChanged(); - invalidate(); - emit invalidated(); -} - -bool ResourcesProxyModel::shouldShowTechnical() const -{ - return !m_roleFilters.contains("isTechnical"); -} - -bool shouldFilter(AbstractResource* res, const QPair<FilterType, QString>& filter) -{ - bool ret = true; - switch (filter.first) { - case CategoryFilter: - ret = res->categories().contains(filter.second); - break; - case PkgSectionFilter: - ret = res->section() == filter.second; - break; - case PkgWildcardFilter: { - QString wildcard = filter.second; - wildcard.remove('*'); - ret = res->packageName().contains(wildcard); - } break; - case PkgNameFilter: // Only useful in the not filters - ret = res->packageName() == filter.second; - break; - case InvalidFilter: - break; - } - return ret; -} - -bool ResourcesProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const -{ - AbstractResource* res = qobject_cast<AbstractResource*>(sourceModel()->index(sourceRow, 0, sourceParent).data(ResourcesModel::ApplicationRole).value<QObject*>()); - if(!res) //assert? - return false; - - if(m_filterBySearch && !m_searchResults.contains(res)) { - return false; - } - - for(QHash<QByteArray, QVariant>::const_iterator it=m_roleFilters.constBegin(), itEnd=m_roleFilters.constEnd(); it!=itEnd; ++it) { - Q_ASSERT(AbstractResource::staticMetaObject.indexOfProperty(it.key())>=0); - if(res->property(it.key())!=it.value()) { - return false; - } - } - - if(res->state() < m_stateFilter) - return false; - - if(!m_filteredMimeType.isEmpty() && !res->mimetypes().contains(m_filteredMimeType)) { - return false; - } - - typedef QPair<FilterType, QString> FilterPair; - - { - bool orValue = m_orFilters.isEmpty(); - Q_FOREACH (const FilterPair& filter, m_orFilters) { - if(shouldFilter(res, filter)) { - orValue = true; - break; - } - } - if(!orValue) - return false; - } - - Q_FOREACH (const FilterPair &filter, m_andFilters) { - if(!shouldFilter(res, filter)) - return false; - } - - Q_FOREACH (const FilterPair &filter, m_notFilters) { - if(shouldFilter(res, filter)) - return false; - } - - return true; -} - -bool ResourcesProxyModel::lessThan(const QModelIndex &left, const QModelIndex &right) const -{ - if (m_sortByRelevancy) { - AbstractResource* leftPackage = qobject_cast<AbstractResource*>(left.data(ResourcesModel::ApplicationRole).value<QObject*>()); - AbstractResource* rightPackage = qobject_cast<AbstractResource*>(right.data(ResourcesModel::ApplicationRole).value<QObject*>()); - - // This is expensive for very large datasets. It takes about 3 seconds with 30,000 packages - // The order in m_packages is based on relevancy when returned by m_backend->search() - // Use this order to determine less than - Q_FOREACH (AbstractResource* res, m_searchResults) { - if(res == leftPackage) - return true; - else if(res == rightPackage) - return false; - } - } - - int theSortRole = sortRole(); - - bool invert = false; - //if we're comparing two equal values, we want the model sorted by application name - if(theSortRole != ResourcesModel::NameRole) { - QVariant leftValue = left.data(theSortRole); - QVariant rightValue = right.data(theSortRole); - if (leftValue == rightValue) { - theSortRole = ResourcesModel::NameRole; - invert = (sortOrder()==Qt::DescendingOrder); - } - } - - if(theSortRole == ResourcesModel::NameRole) { - AbstractResource* leftPackage = qobject_cast<AbstractResource*>(left.data(ResourcesModel::ApplicationRole).value<QObject*>()); - AbstractResource* rightPackage = qobject_cast<AbstractResource*>(right.data(ResourcesModel::ApplicationRole).value<QObject*>()); - - return (leftPackage->nameSortKey().compare(rightPackage->nameSortKey())<0) ^ invert; - } else if(theSortRole == ResourcesModel::CanUpgrade) { - QVariant leftValue = left.data(theSortRole); - return leftValue.toBool(); - } else { - return QSortFilterProxyModel::lessThan(left, right) ^ invert; - } -} - -Category* ResourcesProxyModel::filteredCategory() const -{ - return m_filteredCategory; -} - -void ResourcesProxyModel::setSortByRelevancy(bool sort) -{ - m_sortByRelevancy = sort; -} - -bool ResourcesProxyModel::sortingByRelevancy() const -{ - return m_sortByRelevancy; -} - -bool ResourcesProxyModel::isFilteringBySearch() const -{ - return m_filterBySearch; -} - -void ResourcesProxyModel::setStateFilter(AbstractResource::State s) -{ - m_stateFilter = s; - emit stateFilterChanged(); -} - -AbstractResource::State ResourcesProxyModel::stateFilter() const -{ - return m_stateFilter; -} - -QString ResourcesProxyModel::mimeTypeFilter() const -{ - return m_filteredMimeType; -} - -void ResourcesProxyModel::setMimeTypeFilter(const QString& mime) -{ - m_filteredMimeType = mime; -} - -void ResourcesProxyModel::setFilterActive(bool filter) -{ - if(filter) - m_roleFilters.insert("active", true); - else - m_roleFilters.remove("active"); -} diff --git a/libmuon/resources/ResourcesProxyModel.h b/libmuon/resources/ResourcesProxyModel.h deleted file mode 100644 index 6f92369..0000000 --- a/libmuon/resources/ResourcesProxyModel.h +++ /dev/null @@ -1,104 +0,0 @@ -/*************************************************************************** - * Copyright © 2010 Jonathan Thomas <echidnaman@kubuntu.org> * - * Copyright © 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef RESOURCESPROXYMODEL_H -#define RESOURCESPROXYMODEL_H - -#include <QtCore/QSortFilterProxyModel> -#include <QtCore/QString> -#include <QStringList> - -#include <Category/Category.h> - -#include "libMuonCommon_export.h" -#include "AbstractResource.h" - -namespace QApt { - class Backend; -} - -class Application; - -class MUONCOMMON_EXPORT ResourcesProxyModel : public QSortFilterProxyModel -{ - Q_OBJECT - Q_PROPERTY(QAbstractItemModel* sourceModel READ sourceModel WRITE setSourceModel) - Q_PROPERTY(bool shouldShowTechnical READ shouldShowTechnical WRITE setShouldShowTechnical NOTIFY showTechnicalChanged) - Q_PROPERTY(Category* filteredCategory READ filteredCategory WRITE setFiltersFromCategory NOTIFY categoryChanged) - Q_PROPERTY(QString originFilter READ originFilter WRITE setOriginFilter) - Q_PROPERTY(bool isShowingTechnical READ shouldShowTechnical WRITE setShouldShowTechnical NOTIFY showTechnicalChanged) - Q_PROPERTY(bool isSortingByRelevancy READ sortingByRelevancy WRITE setSortByRelevancy) - Q_PROPERTY(AbstractResource::State stateFilter READ stateFilter WRITE setStateFilter NOTIFY stateFilterChanged) - Q_PROPERTY(QString mimeTypeFilter READ mimeTypeFilter WRITE setMimeTypeFilter) - Q_PROPERTY(QString search READ lastSearch WRITE setSearch) -public: - explicit ResourcesProxyModel(QObject *parent=nullptr); - - void setSearch(const QString &text); - QString lastSearch() const; - void setOriginFilter(const QString &origin); - QString originFilter() const; - void setFiltersFromCategory(Category *category); - void setShouldShowTechnical(bool show); - bool shouldShowTechnical() const; - void setSortByRelevancy(bool sort); - bool sortingByRelevancy() const; - bool isFilteringBySearch() const; - void setStateFilter(AbstractResource::State s); - void setFilterActive(bool filter); - AbstractResource::State stateFilter() const; - - bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override; - Category* filteredCategory() const; - - QString mimeTypeFilter() const; - void setMimeTypeFilter(const QString& mime); - - virtual void setSourceModel(QAbstractItemModel *sourceModel) override; - -protected: - bool lessThan(const QModelIndex &left, const QModelIndex &right) const override; - -private Q_SLOTS: - void refreshSearch(); - -private: - QString m_lastSearch; - QList<AbstractResource*> m_searchResults; - QList<QPair<FilterType, QString> > m_andFilters; - QList<QPair<FilterType, QString> > m_orFilters; - QList<QPair<FilterType, QString> > m_notFilters; - QHash<QByteArray, QVariant> m_roleFilters; - - bool m_sortByRelevancy; - bool m_filterBySearch; - Category* m_filteredCategory; - AbstractResource::State m_stateFilter; - QString m_filteredMimeType; - -Q_SIGNALS: - void invalidated(); - void categoryChanged(); - void stateFilterChanged(); - void showTechnicalChanged(); -}; - -#endif diff --git a/libmuon/resources/ResourcesUpdatesModel.cpp b/libmuon/resources/ResourcesUpdatesModel.cpp deleted file mode 100644 index 6c8efa4..0000000 --- a/libmuon/resources/ResourcesUpdatesModel.cpp +++ /dev/null @@ -1,271 +0,0 @@ -/*************************************************************************** - * Copyright © 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "ResourcesUpdatesModel.h" -#include "ResourcesModel.h" -#include "AbstractBackendUpdater.h" -#include "AbstractResource.h" -#include <QDateTime> -#include <QDBusConnection> -#include <QDBusInterface> -#include <QDBusMessage> -#include <QDBusReply> -#include <QDebug> - -#include <KLocalizedString> -#include <KFormat> - -ResourcesUpdatesModel::ResourcesUpdatesModel(QObject* parent) - : QStandardItemModel(parent) - , m_resources(nullptr) - , m_lastIsProgressing(false) - , m_kded(nullptr) -{ - setResourcesModel(ResourcesModel::global()); -} - -void ResourcesUpdatesModel::setResourcesModel(ResourcesModel* model) -{ - Q_ASSERT(model); - m_resources = model; - m_updaters.clear(); - addNewBackends(); - connect(model, SIGNAL(backendsChanged()), SLOT(addNewBackends())); -} - -void ResourcesUpdatesModel::addNewBackends() -{ - QVector<AbstractResourcesBackend*> backends = ResourcesModel::global()->backends(); - foreach(AbstractResourcesBackend* b, backends) { - AbstractBackendUpdater* updater = b->backendUpdater(); - if(updater && !m_updaters.contains(updater)) { - connect(updater, SIGNAL(progressChanged(qreal)), SIGNAL(progressChanged())); - connect(updater, SIGNAL(statusMessageChanged(QString)), SIGNAL(statusMessageChanged(QString))); - connect(updater, SIGNAL(statusMessageChanged(QString)), SLOT(message(QString))); - connect(updater, SIGNAL(statusDetailChanged(QString)), SLOT(message(QString))); - connect(updater, SIGNAL(statusDetailChanged(QString)), SIGNAL(statusDetailChanged(QString))); - connect(updater, SIGNAL(remainingTimeChanged()), SIGNAL(etaChanged())); - connect(updater, SIGNAL(downloadSpeedChanged(quint64)), SIGNAL(downloadSpeedChanged())); - connect(updater, SIGNAL(progressingChanged(bool)), SLOT(slotProgressingChanged(bool))); - connect(updater, SIGNAL(cancelableChanged(bool)), SIGNAL(cancelableChanged())); - connect(updater, SIGNAL(destroyed(QObject*)), SLOT(updaterDestroyed(QObject*))); - m_updaters += updater; - } - } -} - -void ResourcesUpdatesModel::updaterDestroyed(QObject* obj) -{ -// TODO: use removeAll when build.kde.org doesn't complain about Qt 5.4 API usage... - int idx = m_updaters.indexOf(qobject_cast<AbstractBackendUpdater*>(obj)); - if (idx>=0) - m_updaters.remove(idx); -} - -void ResourcesUpdatesModel::slotProgressingChanged(bool progressing) -{ - Q_UNUSED(progressing); - const bool newProgressing = isProgressing(); - if (newProgressing != m_lastIsProgressing) { - m_lastIsProgressing = newProgressing; - if (!m_lastIsProgressing) { - if (!m_kded) - m_kded = new QDBusInterface("org.kde.kded", "/kded", - "org.kde.kded", QDBusConnection::sessionBus(), this); - QDBusReply<QStringList> lM = m_kded->call("loadedModules"); - QStringList services = lM.value(); - foreach (const QString &service, services) { - if (!service.startsWith("muon")) - continue; - - QDBusMessage message = QDBusMessage::createMethodCall("org.kde.kded", - "/modules/" + service, - "org.kde.kded.AbstractKDEDModule", - "recheckSystemUpdateNeeded"); - QDBusConnection::sessionBus().send(message); - } - } - emit progressingChanged(newProgressing); - - if (!newProgressing) { - Q_EMIT finished(); - } - } -} - -qreal ResourcesUpdatesModel::progress() const -{ - qreal total = 0; - foreach(AbstractBackendUpdater* updater, m_updaters) { - total += updater->progress(); - } - return total / m_updaters.count(); -} - -void ResourcesUpdatesModel::message(const QString& msg) -{ - if(msg.isEmpty()) - return; - - appendRow(new QStandardItem(msg)); -} - -void ResourcesUpdatesModel::prepare() -{ - foreach(AbstractBackendUpdater* upd, m_updaters) { - upd->prepare(); - } -} - -void ResourcesUpdatesModel::updateAll() -{ - Q_ASSERT(m_resources); - - if(m_updaters.isEmpty()) - emit progressingChanged(false); - else { - Q_FOREACH (AbstractBackendUpdater* upd, m_updaters) { - if (upd->hasUpdates()) - QMetaObject::invokeMethod(upd, "start", Qt::QueuedConnection); - } - } -} - - -QString ResourcesUpdatesModel::remainingTime() const -{ - long unsigned int maxEta = 0; - foreach(AbstractBackendUpdater* upd, m_updaters) { - maxEta = qMax(maxEta, upd->remainingTime()); - } - - // Ignore ETA if it's larger than 2 days. - if(maxEta > 2 * 24 * 60 * 60) - return QString(); - else if(maxEta==0) - return i18nc("@item:intext Unknown remaining time", "Updating..."); - else - return i18nc("@item:intext Remaining time", "%1 remaining", KFormat().formatDuration(maxEta)); -} - -bool ResourcesUpdatesModel::hasUpdates() const -{ - bool ret = false; - foreach(AbstractBackendUpdater* upd, m_updaters) { - ret |= upd->hasUpdates(); - } - return ret; -} - -quint64 ResourcesUpdatesModel::downloadSpeed() const -{ - quint64 ret = 0; - foreach(AbstractBackendUpdater* upd, m_updaters) { - ret += upd->downloadSpeed(); - } - return ret; -} - -bool ResourcesUpdatesModel::isCancelable() const -{ - bool cancelable = false; - foreach(AbstractBackendUpdater* upd, m_updaters) { - cancelable |= upd->isCancelable(); - } - return cancelable; -} - -bool ResourcesUpdatesModel::isProgressing() const -{ - bool progressing = false; - foreach(AbstractBackendUpdater* upd, m_updaters) { - progressing |= upd->isProgressing(); - } - return progressing; -} - -bool ResourcesUpdatesModel::isAllMarked() const -{ - bool allmarked = false; - foreach(AbstractBackendUpdater* upd, m_updaters) { - allmarked |= upd->isAllMarked(); - } - return allmarked; -} - -QList<AbstractResource*> ResourcesUpdatesModel::toUpdate() const -{ - QList<AbstractResource*> ret; - foreach(AbstractBackendUpdater* upd, m_updaters) { - ret += upd->toUpdate(); - } - return ret; -} - -void ResourcesUpdatesModel::addResources(const QList<AbstractResource*>& resources) -{ - QMap<AbstractResourcesBackend*, QList<AbstractResource*> > sortedResources; - foreach(AbstractResource* res, resources) { - sortedResources[res->backend()] += res; - } - - for(auto it=sortedResources.constBegin(), itEnd=sortedResources.constEnd(); it!=itEnd; ++it) { - it.key()->backendUpdater()->addResources(*it); - } -} - -void ResourcesUpdatesModel::removeResources(const QList< AbstractResource* >& resources) -{ - QMap<AbstractResourcesBackend*, QList<AbstractResource*> > sortedResources; - foreach(AbstractResource* res, resources) { - sortedResources[res->backend()] += res; - } - - for(auto it=sortedResources.constBegin(), itEnd=sortedResources.constEnd(); it!=itEnd; ++it) { - it.key()->backendUpdater()->removeResources(*it); - } -} - -QDateTime ResourcesUpdatesModel::lastUpdate() const -{ - QDateTime ret; - foreach(AbstractBackendUpdater* upd, m_updaters) { - QDateTime current = upd->lastUpdate(); - if(!ret.isValid() || (current.isValid() && current>ret)) { - ret = current; - } - } - return ret; -} - -void ResourcesUpdatesModel::cancel() -{ - foreach(AbstractBackendUpdater* upd, m_updaters) { - if(upd->isCancelable()) - upd->cancel(); - else - qWarning() << "tried to cancel " << upd->metaObject()->className() << "which is not cancelable"; - } -} - -qint64 ResourcesUpdatesModel::secsToLastUpdate() const -{ - return lastUpdate().secsTo(QDateTime::currentDateTime()); -} diff --git a/libmuon/resources/ResourcesUpdatesModel.h b/libmuon/resources/ResourcesUpdatesModel.h deleted file mode 100644 index eb7dca1..0000000 --- a/libmuon/resources/ResourcesUpdatesModel.h +++ /dev/null @@ -1,94 +0,0 @@ -/*************************************************************************** - * Copyright © 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef RESOURCESUPDATESMODEL_H -#define RESOURCESUPDATESMODEL_H - -#include <QStandardItemModel> -#include <QDateTime> -#include "libMuonCommon_export.h" - -class AbstractResourcesBackend; -class AbstractResource; -class QAction; -class AbstractBackendUpdater; -class ResourcesModel; -class QDBusInterface; - -class MUONCOMMON_EXPORT ResourcesUpdatesModel : public QStandardItemModel -{ - Q_OBJECT - Q_PROPERTY(qreal progress READ progress NOTIFY progressChanged); - Q_PROPERTY(QString remainingTime READ remainingTime NOTIFY etaChanged) - Q_PROPERTY(quint64 downloadSpeed READ downloadSpeed NOTIFY downloadSpeedChanged) - Q_PROPERTY(bool isCancelable READ isCancelable NOTIFY cancelableChanged) - Q_PROPERTY(bool isProgressing READ isProgressing NOTIFY progressingChanged) - Q_PROPERTY(QDateTime lastUpdate READ lastUpdate NOTIFY progressingChanged) - Q_PROPERTY(qint64 secsToLastUpdate READ secsToLastUpdate NOTIFY progressingChanged) - public: - explicit ResourcesUpdatesModel(QObject* parent = nullptr); - - qreal progress() const; - QString remainingTime() const; - bool hasUpdates() const; - quint64 downloadSpeed() const; - Q_SCRIPTABLE void prepare(); - - ///checks if any of them is cancelable - bool isCancelable() const; - bool isProgressing() const; - bool isAllMarked() const; - QList<AbstractResource*> toUpdate() const; - QDateTime lastUpdate() const; - void addResources(const QList<AbstractResource*>& resources); - void removeResources(const QList<AbstractResource*>& resources); - - qint64 secsToLastUpdate() const; - - signals: - void downloadSpeedChanged(); - void progressChanged(); - void etaChanged(); - void cancelableChanged(); - void progressingChanged(bool progressing); - void statusMessageChanged(const QString& message); - void statusDetailChanged(const QString& msg); - void finished(); - - public slots: - void cancel(); - void updateAll(); - - private slots: - void updaterDestroyed(QObject* obj); - void message(const QString& msg); - void addNewBackends(); - void slotProgressingChanged(bool progressing); - - private: - void setResourcesModel(ResourcesModel* model); - - ResourcesModel* m_resources; - QVector<AbstractBackendUpdater*> m_updaters; - bool m_lastIsProgressing; - QDBusInterface * m_kded; -}; - -#endif // RESOURCESUPDATESMODEL_H diff --git a/libmuon/resources/SourcesModel.cpp b/libmuon/resources/SourcesModel.cpp deleted file mode 100644 index 9216af8..0000000 --- a/libmuon/resources/SourcesModel.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/*************************************************************************** - * Copyright © 2014 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "SourcesModel.h" -#include <QtGlobal> -#include <QDebug> -#include <QAction> -#include "resources/AbstractSourcesBackend.h" - -Q_GLOBAL_STATIC(SourcesModel, s_sources) - -SourcesModel::SourcesModel(QObject* parent) - : QAbstractListModel(parent) -{} - -SourcesModel::~SourcesModel() -{} - -QHash<int, QByteArray> SourcesModel::roleNames() const -{ - QHash<int, QByteArray> roles = QAbstractItemModel::roleNames(); - roles[SourceBackend] = "sourceBackend"; - return roles; -} - -SourcesModel* SourcesModel::global() -{ - return s_sources; -} - -void SourcesModel::addSourcesBackend(AbstractSourcesBackend* sources) -{ - if (m_sources.contains(sources)) - return; - - beginInsertRows(QModelIndex(), m_sources.size(), m_sources.size()); - m_sources += sources; - endInsertRows(); - emit sourcesChanged(); -} - -QVariant SourcesModel::data(const QModelIndex& index, int role) const -{ - if(!index.isValid() || index.row()>=m_sources.count()) { - return QVariant(); - } - switch(role) { - case Qt::DisplayRole: - return m_sources[index.row()]->name(); - case SourceBackend: - return QVariant::fromValue<QObject*>(m_sources[index.row()]); - } - - return QVariant(); -} - -int SourcesModel::rowCount(const QModelIndex& parent) const -{ - return parent.isValid() ? 0 : m_sources.count(); -} - -QVariant SourcesModel::get(int row, const QByteArray& roleName) -{ - return data(index(row), roleNames().key(roleName)); -} - -QList<QObject*> SourcesModel::actions() const -{ - QList<QObject*> ret; - for(AbstractSourcesBackend* b: m_sources) { - for(QAction* action: b->actions()) - ret.append(action); - } - return ret; -} diff --git a/libmuon/resources/SourcesModel.h b/libmuon/resources/SourcesModel.h deleted file mode 100644 index 6de1c9c..0000000 --- a/libmuon/resources/SourcesModel.h +++ /dev/null @@ -1,60 +0,0 @@ -/*************************************************************************** - * Copyright © 2014 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef SOURCESMODEL_H -#define SOURCESMODEL_H - -#include <QAbstractListModel> -#include <QSet> -#include <QtQml/QQmlListProperty> -#include "libMuonCommon_export.h" - -class QAction; -class AbstractSourcesBackend; -class MUONCOMMON_EXPORT SourcesModel : public QAbstractListModel -{ - Q_OBJECT - Q_PROPERTY(int count READ rowCount NOTIFY sourcesChanged) - Q_PROPERTY(QList<QObject*> actions READ actions NOTIFY sourcesChanged) - public: - enum Roles { - SourceBackend = Qt::UserRole+1 - }; - SourcesModel(QObject* parent = nullptr); - ~SourcesModel(); - - static SourcesModel* global(); - - virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; - virtual int rowCount(const QModelIndex& parent = QModelIndex()) const override; - void addSourcesBackend(AbstractSourcesBackend* sources); - virtual QHash<int, QByteArray> roleNames() const override; - - QList<QObject*> actions() const; - Q_SCRIPTABLE QVariant get(int row, const QByteArray& roleName); - - Q_SIGNALS: - void sourcesChanged(); - - private: - QList<AbstractSourcesBackend*> m_sources; -}; - -#endif // SOURCESMODEL_H diff --git a/libmuon/resources/StandardBackendUpdater.cpp b/libmuon/resources/StandardBackendUpdater.cpp deleted file mode 100644 index 1d9dbe9..0000000 --- a/libmuon/resources/StandardBackendUpdater.cpp +++ /dev/null @@ -1,189 +0,0 @@ -/* - * Copyright (C) 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library/Lesser General Public License - * version 2, or (at your option) any later version, as published by the - * Free Software Foundation - * - * 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 Library/Lesser 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 <resources/StandardBackendUpdater.h> -#include <resources/AbstractResourcesBackend.h> -#include <resources/AbstractResource.h> -#include "ResourcesModel.h" -#include <Transaction/Transaction.h> -#include <Transaction/TransactionModel.h> -#include <KLocalizedString> -#include <QDateTime> -#include <QDebug> -#include <QTimer> -#include <QIcon> - -StandardBackendUpdater::StandardBackendUpdater(AbstractResourcesBackend* parent) - : AbstractBackendUpdater(parent) - , m_backend(parent) - , m_preparedSize(0) - , m_settingUp(false) - , m_progress(0) - , m_lastUpdate(QDateTime()) -{ - connect(TransactionModel::global(), - SIGNAL(transactionRemoved(Transaction*)), - SLOT(transactionRemoved(Transaction*))); -} - -bool StandardBackendUpdater::hasUpdates() const -{ - return m_backend->updatesCount() > 0; -} - -void StandardBackendUpdater::start() -{ - m_settingUp = true; - emit progressingChanged(true); - setProgress(-1); - foreach(AbstractResource* res, m_toUpgrade) { - m_pendingResources += res; - m_backend->installApplication(res); - } - m_settingUp = false; - emit statusMessageChanged(statusMessage()); - - if(m_pendingResources.isEmpty()) { - emit progressingChanged(false); - cleanup(); - } else { - setProgress(1); - } -} - -void StandardBackendUpdater::transactionRemoved(Transaction* t) -{ - bool found = t->resource()->backend()==m_backend && m_pendingResources.remove(t->resource()); - if(found && !m_settingUp) { - setStatusDetail(i18n("%1 has been updated", t->resource()->name())); - qreal p = 1-(qreal(m_pendingResources.size())/m_toUpgrade.size()); - setProgress(100*p); - if(m_pendingResources.isEmpty()) { - cleanup(); - emit progressingChanged(false); - } - } -} - -qreal StandardBackendUpdater::progress() const -{ - return m_progress; -} - -void StandardBackendUpdater::setProgress(qreal p) -{ - if(p>m_progress || p<0) { - m_progress = p; - emit progressChanged(p); - } -} - -long unsigned int StandardBackendUpdater::remainingTime() const -{ - return 0; -} - -void StandardBackendUpdater::prepare() -{ - m_lastUpdate = QDateTime::currentDateTime(); - m_toUpgrade = m_backend->upgradeablePackages().toSet(); - m_preparedSize = m_toUpgrade.size(); -} - -void StandardBackendUpdater::addResources(const QList< AbstractResource* >& apps) -{ - m_toUpgrade += apps.toSet(); -} - -void StandardBackendUpdater::removeResources(const QList< AbstractResource* >& apps) -{ - m_toUpgrade -= apps.toSet(); -} - -void StandardBackendUpdater::cleanup() -{ - m_lastUpdate = QDateTime::currentDateTime(); - m_toUpgrade.clear(); -} - -QList<AbstractResource*> StandardBackendUpdater::toUpdate() const -{ - return m_toUpgrade.toList(); -} - -bool StandardBackendUpdater::isMarked(AbstractResource* res) const -{ - return m_toUpgrade.contains(res); -} - -bool StandardBackendUpdater::isAllMarked() const -{ - //Maybe we should make this smarter... - return m_preparedSize>=m_toUpgrade.size(); -} - -QDateTime StandardBackendUpdater::lastUpdate() const -{ - return m_lastUpdate; -} - -bool StandardBackendUpdater::isCancelable() const -{ - //We don't really know when we can cancel, so we never let - return false; -} - -bool StandardBackendUpdater::isProgressing() const -{ - return m_settingUp || !m_pendingResources.isEmpty(); -} - -QString StandardBackendUpdater::statusDetail() const -{ - return m_statusDetail; -} - -void StandardBackendUpdater::setStatusDetail(const QString& msg) -{ - m_statusDetail = msg; - emit statusDetailChanged(msg); -} - -QString StandardBackendUpdater::statusMessage() const -{ - if(m_settingUp) - return i18n("Setting up for install..."); - else - return i18n("Installing..."); -} - -quint64 StandardBackendUpdater::downloadSpeed() const -{ - return 0; -} - -QList<QAction*> StandardBackendUpdater::messageActions() const -{ - return m_actions; -} - -void StandardBackendUpdater::setMessageActions(const QList<QAction*>& actions) -{ - m_actions = actions; -} diff --git a/libmuon/resources/StandardBackendUpdater.h b/libmuon/resources/StandardBackendUpdater.h deleted file mode 100644 index f619796..0000000 --- a/libmuon/resources/StandardBackendUpdater.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (C) 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library/Lesser General Public License - * version 2, or (at your option) any later version, as published by the - * Free Software Foundation - * - * 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 Library/Lesser 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 STANDARDBACKENDUPDATER_H -#define STANDARDBACKENDUPDATER_H - -#include "libMuonCommon_export.h" -#include <resources/AbstractBackendUpdater.h> -#include "AbstractResourcesBackend.h" -#include <QSet> -#include <QDateTime> - -class AbstractResourcesBackend; - -class MUONCOMMON_EXPORT StandardBackendUpdater : public AbstractBackendUpdater -{ - Q_OBJECT - public: - explicit StandardBackendUpdater(AbstractResourcesBackend* parent = nullptr); - - virtual bool hasUpdates() const override; - virtual qreal progress() const override; - virtual void start() override; - virtual long unsigned int remainingTime() const override; - - virtual QList<AbstractResource*> toUpdate() const override; - virtual void addResources(const QList<AbstractResource*>& apps) override; - virtual void removeResources(const QList<AbstractResource*>& apps) override; - virtual void prepare() override; - virtual bool isAllMarked() const override; - virtual QDateTime lastUpdate() const override; - virtual bool isCancelable() const override; - virtual bool isProgressing() const override; - virtual QString statusDetail() const override; - virtual QString statusMessage() const override; - virtual quint64 downloadSpeed() const override; - virtual QList<QAction*> messageActions() const; - virtual bool isMarked(AbstractResource* res) const override; - void setStatusDetail(const QString& message); - void setProgress(qreal p); - - void setMessageActions(const QList<QAction*>& actions); - - public slots: - void transactionRemoved(Transaction* t); - void cleanup(); - - private: - QSet<AbstractResource*> m_toUpgrade; - AbstractResourcesBackend* m_backend; - int m_preparedSize; - QSet<AbstractResource*> m_pendingResources; - bool m_settingUp; - QString m_statusDetail; - qreal m_progress; - QDateTime m_lastUpdate; - QList<QAction*> m_actions; -}; - -#endif // STANDARDBACKENDUPDATER_H - diff --git a/libmuon/resources/UIHelper.cpp b/libmuon/resources/UIHelper.cpp deleted file mode 100644 index ac79c56..0000000 --- a/libmuon/resources/UIHelper.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/*************************************************************************** - * Copyright © 2015 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "UIHelper.h" -#include <QAction> -#include <QMenu> - -namespace UIHelper -{ - -QList<QAction*> setupMessageActions(QMenu* main, QMenu* advanced, const QList<QAction*> &actions) -{ - advanced->setEnabled(false); - - QList<QAction*> ret; - foreach (QAction* action, actions) { - switch(action->priority()) { - case QAction::HighPriority: - ret += action; - break; - case QAction::NormalPriority: - main->addAction(action); - break; - case QAction::LowPriority: - default: - advanced->setEnabled(true); - advanced->addAction(action); - break; - } - } - return ret; -} - -} diff --git a/libmuon/resources/UIHelper.h b/libmuon/resources/UIHelper.h deleted file mode 100644 index b9b1fe5..0000000 --- a/libmuon/resources/UIHelper.h +++ /dev/null @@ -1,30 +0,0 @@ -/*************************************************************************** - * Copyright © 2015 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include <QList> -#include "libMuonCommon_export.h" - -class QAction; -class QMenu; - -namespace UIHelper -{ - MUONCOMMON_EXPORT QList<QAction*> setupMessageActions(QMenu* main, QMenu* advanced, const QList<QAction*> &actions); -} diff --git a/libmuon/resources/muonabstractnotifier.notifyrc b/libmuon/resources/muonabstractnotifier.notifyrc deleted file mode 100644 index 6a63b72..0000000 --- a/libmuon/resources/muonabstractnotifier.notifyrc +++ /dev/null @@ -1,142 +0,0 @@ -[Global] -IconName=applications-system -Comment=Muon -Comment[ast]=Muon -Comment[bg]=Muon -Comment[bs]=Muon -Comment[ca]=Muon -Comment[ca@valencia]=Muon -Comment[cs]=Muon -Comment[da]=Muon -Comment[de]=Muon -Comment[el]=Muon -Comment[en_GB]=Muon -Comment[es]=Muon -Comment[et]=Muon -Comment[fi]=Muon -Comment[fr]=Muon -Comment[gl]=Muon -Comment[hu]=Muon -Comment[id]=Muon -Comment[it]=Muon -Comment[ko]=Muon -Comment[lt]=Muon -Comment[nb]=Muon -Comment[nds]=Muon -Comment[nl]=Muon -Comment[nn]=Muon -Comment[pl]=Muon -Comment[pt]=Muon -Comment[pt_BR]=Muon -Comment[ro]=Muon -Comment[ru]=Muon -Comment[sk]=Muon -Comment[sl]=Muon -Comment[sr]=Муон -Comment[sr@ijekavian]=Муон -Comment[sr@ijekavianlatin]=Muon -Comment[sr@latin]=Muon -Comment[sv]=Muon -Comment[tr]=Muon -Comment[uk]=Muon -Comment[x-test]=xxMuonxx -Comment[zh_CN]=Muon -Comment[zh_TW]=Muon - -[Event/Update] -Name=Updates Are Available -Name[ast]=Tán disponibles anovamientos -Name[bg]=Има налични обновления -Name[bs]=Nadogradnje su dostupne -Name[ca]=Hi ha actualitzacions disponibles -Name[ca@valencia]=Hi ha actualitzacions disponibles -Name[cs]=Jsou dostupné aktualizace -Name[da]=Der er opdateringer tilgængelige -Name[de]=Es sind Aktualisierungen verfügbar -Name[el]=Διαθέσιμες ενημερώσεις -Name[en_GB]=Updates Are Available -Name[es]=Hay actualizaciones disponibles -Name[et]=Saadaval on uuendused -Name[fi]=Päivityksiä on saatavilla -Name[fr]=Des mises à jour sont disponibles -Name[ga]=Tá Nuashonruithe Le Fáil -Name[gl]=Hai actualizacións dispoñíbeis -Name[hu]=Frissítések érhetők el -Name[id]=Pembaruan Telah Tersedia -Name[it]=Sono disponibili aggiornamenti -Name[kk]=Жаңартулар бар -Name[ko]=업데이트 사용 가능 -Name[lt]=Atnaujinimai yra pasiekiami -Name[mr]=अद्ययावत सॉफ़्टवेअर उपलब्ध आहे -Name[nb]=Oppgraderinger er tilgjengelige -Name[nds]=Opfrischen verföögbor -Name[nl]=Bijwerken is beschikbaar -Name[nn]=Oppdateringar er tilgjengelege -Name[pa]=ਅੱਪਡੇਟ ਉਪਲੱਬਧ ਹਨ -Name[pl]=Uaktualnienia są dostępne -Name[pt]=Estão Disponíveis Actualizações -Name[pt_BR]=Atualizações estão disponíveis -Name[ro]=Sunt disponibile actualizări -Name[ru]=Доступны обновления -Name[sk]=Sú dostupné aktualizácie -Name[sl]=Na voljo so posodobitve -Name[sr]=Доступне допуне -Name[sr@ijekavian]=Доступне допуне -Name[sr@ijekavianlatin]=Dostupne dopune -Name[sr@latin]=Dostupne dopune -Name[sv]=Uppdateringar tillgängliga -Name[tr]=Güncelleştirmeler Var -Name[ug]=يېڭىلانما بار -Name[uk]=Доступні оновлення -Name[x-test]=xxUpdates Are Availablexx -Name[zh_CN]=更新可用 -Name[zh_TW]=有可用的更新 -Comment=Updates Available -Comment[ast]=Anovamientos disponibles -Comment[bg]=Налични са обновления -Comment[bs]=Nadogradnje dostupne -Comment[ca]=Actualitzacions disponibles -Comment[ca@valencia]=Actualitzacions disponibles -Comment[cs]=Jsou dostupné aktualizace -Comment[da]=Opdateringer tilgængelige -Comment[de]=Es sind Aktualisierungen verfügbar -Comment[el]=Διαθέσιμες ενημερώσεις -Comment[en_GB]=Updates Available -Comment[es]=Actualizaciones disponibles -Comment[et]=Saadaval on uuendused -Comment[fi]=Päivityksiä saatavilla -Comment[fr]=Mises à jour disponibles -Comment[ga]=Nuashonruithe Le Fáil -Comment[gl]=Actualizacións dispoñíbeis -Comment[hu]=Frissítések érhetők el -Comment[id]=Pembaruan Tersedia -Comment[it]=Aggiornamenti disponibili -Comment[kk]=Жаңартулар бар -Comment[ko]=업데이트 사용 가능 -Comment[lt]=Atnaujinimai yra pasiekiami -Comment[mr]=अद्ययावत सॉफ़्टवेअर उपलब्ध आहे -Comment[nb]=Oppgraderinger tilgjengelige -Comment[nds]=Opfrischen verföögbor -Comment[nl]=Bijwerken is beschikbaar -Comment[nn]=Oppdateringar tilgjengelege -Comment[pa]=ਅੱਪਡੇਟ ਉਪਲੱਬਧ ਹਨ -Comment[pl]=Dostępne uaktualnienia -Comment[pt]=Actualizações Disponíveis -Comment[pt_BR]=Atualizações disponíveis -Comment[ro]=Actualizări disponibile -Comment[ru]=Доступны обновления -Comment[sk]=Dostupné aktualizácie -Comment[sl]=Na voljo so posodobitve -Comment[sr]=Доступне су нове допуне -Comment[sr@ijekavian]=Доступне су нове допуне -Comment[sr@ijekavianlatin]=Dostupne su nove dopune -Comment[sr@latin]=Dostupne su nove dopune -Comment[sv]=Uppdateringar tillgängliga -Comment[tr]=Güncelleştirmeler Var -Comment[ug]=يېڭىلانما بار -Comment[uk]=Доступні оновлення -Comment[x-test]=xxUpdates Availablexx -Comment[zh_CN]=更新可用 -Comment[zh_TW]=有可用的更新 -Action=Popup - diff --git a/notifier/BackendNotifierFactory.cpp b/notifier/BackendNotifierFactory.cpp deleted file mode 100644 index 56a472b..0000000 --- a/notifier/BackendNotifierFactory.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/*************************************************************************** - * Copyright © 2013 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "BackendNotifierFactory.h" -#include <BackendNotifierModule.h> -#include <QDebug> -#include <QCoreApplication> -#include <QDir> -#include <QPluginLoader> - -BackendNotifierFactory::BackendNotifierFactory() -{} - -QList<BackendNotifierModule*> BackendNotifierFactory::allBackends() const -{ - QList<BackendNotifierModule*> ret; - - for(const QString& path : QCoreApplication::instance()->libraryPaths()) { - QDir dir(path+"/muon-notifier/"); - for(const QString& file : dir.entryList(QDir::Files)) { - QString fullPath = dir.absoluteFilePath(file); - QPluginLoader loader(fullPath); - loader.load(); - ret += qobject_cast<BackendNotifierModule*>(loader.instance()); - if (ret.last() == nullptr) { - qWarning() << "couldn't load" << fullPath << "because" << loader.errorString(); - ret.removeLast(); - } - } - } - if (ret.isEmpty()) - qWarning() << "couldn't find any notifier backend" << QCoreApplication::instance()->libraryPaths(); - - return ret; -} diff --git a/notifier/BackendNotifierFactory.h b/notifier/BackendNotifierFactory.h deleted file mode 100644 index 5da90ea..0000000 --- a/notifier/BackendNotifierFactory.h +++ /dev/null @@ -1,37 +0,0 @@ -/*************************************************************************** - * Copyright © 2013 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef BACKENDNOTIFIERFACTORY_H -#define BACKENDNOTIFIERFACTORY_H - -#include <QString> -#include <QList> - -class BackendNotifierModule; - -class BackendNotifierFactory -{ -public: - BackendNotifierFactory(); - - QList<BackendNotifierModule*> allBackends() const; -}; - -#endif // BACKENDNOTIFIERFACTORY_H diff --git a/notifier/CMakeLists.txt b/notifier/CMakeLists.txt deleted file mode 100644 index 9c73a31..0000000 --- a/notifier/CMakeLists.txt +++ /dev/null @@ -1,21 +0,0 @@ -add_definitions(-DTRANSLATION_DOMAIN=\"muon-notifier\") - -add_library(MuonNotifierDeclarativePlugin BackendNotifierFactory.cpp MuonNotifier.cpp MuonNotifierDeclarativePlugin.cpp) -target_link_libraries(MuonNotifierDeclarativePlugin - KF5::Notifications - KF5::ConfigCore - KF5::I18n - KF5::Service - KF5::KIOWidgets - KF5::IconThemes - Qt5::Qml - - MuonNotifiers -) -install(TARGETS MuonNotifierDeclarativePlugin DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/muonnotifier) -install(FILES qmldir DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/muonnotifier) - -find_package(KF5Plasma) -if(KF5Plasma_FOUND) - plasma_install_package(plasmoid org.kde.muonnotifier) -endif() diff --git a/notifier/MuonNotifier.cpp b/notifier/MuonNotifier.cpp deleted file mode 100644 index 4c6f514..0000000 --- a/notifier/MuonNotifier.cpp +++ /dev/null @@ -1,187 +0,0 @@ -/*************************************************************************** - * Copyright © 2014 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "MuonNotifier.h" -#include "BackendNotifierFactory.h" -#include <KConfig> -#include <KConfigGroup> -#include <KRun> -#include <KLocalizedString> -#include <KIconLoader> -#include <KNotification> -#include <KPluginFactory> -#include <QMenu> - -MuonNotifier::MuonNotifier(QObject * parent) - : QObject(parent) - , m_verbose(false) -{ - configurationChanged(); - - m_backends = BackendNotifierFactory().allBackends(); - for(BackendNotifierModule* module : m_backends) { - connect(module, &BackendNotifierModule::foundUpdates, this, &MuonNotifier::updateStatusNotifier); - } - connect(&m_timer, &QTimer::timeout, this, &MuonNotifier::showUpdatesNotification); - m_timer.setSingleShot(true); - m_timer.setInterval(180000); - updateStatusNotifier(); -} - -MuonNotifier::~MuonNotifier() -{ -} - -void MuonNotifier::configurationChanged() -{ - KConfig notifierConfig("muon-notifierrc", KConfig::NoGlobals); - - KConfigGroup notifyTypeGroup(¬ifierConfig, "NotificationType"); - m_verbose = notifyTypeGroup.readEntry("Verbose", false); -} - -void MuonNotifier::showMuon() -{ - KRun::runCommand("muon-discover --mode update", nullptr); -} - -bool MuonNotifier::isSystemUpToDate() const -{ - for(BackendNotifierModule* module : m_backends) { - if(!module->isSystemUpToDate()) - return false; - } - return true; -} - -void MuonNotifier::showUpdatesNotification() -{ - //TODO: Better message strings - QString msg = message(); - if (m_verbose) { - msg += ' ' + extendedMessage(); - } - - KNotification::event("Update", i18n("System update available"), msg, QStringLiteral("system-software-update"), nullptr, KNotification::CloseOnTimeout, "muonabstractnotifier"); -} - -void MuonNotifier::updateStatusNotifier() -{ - if (!isSystemUpToDate()) { - m_timer.start(); - } - emit updatesChanged(); -} - -MuonNotifier::State MuonNotifier::state() const -{ - bool security = false, normal = false; - - for(BackendNotifierModule* module : m_backends) { - security |= module->securityUpdatesCount()>0; - normal |= security || module->updatesCount()>0; - if (security) - break; - } - if (security) - return SecurityUpdates; - else if (normal) - return NormalUpdates; - else - return NoUpdates; -} - -QString MuonNotifier::iconName() const -{ - switch(state()) { - case SecurityUpdates: - return QLatin1String("security-low"); - case NormalUpdates: - return QLatin1String("security-high"); - case NoUpdates: - return QLatin1String("security-high"); - } - return QString(); -} - -QString MuonNotifier::message() const -{ - switch(state()) { - case SecurityUpdates: - return i18n("Security updates available"); - case NormalUpdates: - return i18n("Updates available"); - case NoUpdates: - return i18n("System up to date"); - } - return QString(); -} - -QString MuonNotifier::extendedMessage() const -{ - uint securityCount = securityUpdatesCount(); - uint count = updatesCount() + securityCount; - if (count > 0 && securityCount > 0) { - QString allUpdates = i18ncp("First part of '%1, %2'", - "1 package to update", "%1 packages to update", count); - - QString securityUpdates = i18ncp("Second part of '%1, %2'", - "of which 1 is security update", "of which %1 are security updates", securityCount); - - return i18nc("%1 is '%1 packages to update' and %2 is 'of which %1 is security updates'", - "%1, %2", allUpdates, securityUpdates); - } else if (count > 0) { - return i18np("1 package to update", "%1 packages to update", count); - } else if (securityCount > 0) { - return i18np("1 security update", "%1 security updates", securityCount); - } else { - return i18n("No packages to update"); - } -} - -void MuonNotifier::recheckSystemUpdateNeeded() -{ - for(BackendNotifierModule* module : m_backends) - module->recheckSystemUpdateNeeded(); -} - -uint MuonNotifier::securityUpdatesCount() const -{ - uint ret = 0; - for(BackendNotifierModule* module : m_backends) - ret += module->securityUpdatesCount(); - return ret; -} - -uint MuonNotifier::updatesCount() const -{ - uint ret = 0; - for(BackendNotifierModule* module : m_backends) - ret += module->updatesCount(); - return ret + securityUpdatesCount(); -} - -QStringList MuonNotifier::loadedModules() const -{ - QStringList ret; - for(BackendNotifierModule* module : m_backends) - ret += module->metaObject()->className(); - return ret; -} diff --git a/notifier/MuonNotifier.desktop b/notifier/MuonNotifier.desktop deleted file mode 100644 index 1e9f115..0000000 --- a/notifier/MuonNotifier.desktop +++ /dev/null @@ -1,54 +0,0 @@ -[Desktop Entry] -Name=Muon Notifier -Name[ast]=Tán disponibles anovamientos -Name[bs]=Muon notifikator -Name[ca]=Notificador del Muon -Name[ca@valencia]=Notificador del Muon -Name[cs]=Oznamování pro Muon -Name[da]=Bekendtgørelser fra Muon -Name[de]=Muon-Benachrichtigung -Name[el]=Πρόγραμμα ειδοποιήσεων Muon -Name[en_GB]=Muon Notifier -Name[es]=Notificador de Muon -Name[et]=Muoni märguanded -Name[fi]=Muonin ilmoitukset -Name[fr]=Notifieur de Muon -Name[ga]=Fógróir Muon -Name[gl]=Notificador de Muon -Name[hu]=Muon értesítő -Name[id]=Pemberitahu Muon -Name[it]=Notifiche di Muon -Name[kk]=Muon құлақтандырғышы -Name[ko]=Muon 알림이 -Name[lt]=Muon pranešėjas -Name[mr]=म्युओन डिस्कव्हर -Name[nb]=Muon-varsler -Name[nds]=Muon-Bescheden -Name[nl]=Muon-melder -Name[nn]=Muon-varslar -Name[pa]=ਮੂਓਨ ਨੋਟੀਫਾਇਰ -Name[pl]=Powiadamianie Muon -Name[pt]=Notificação do Muon -Name[pt_BR]=Notificador do Muon -Name[ro]=Notificare Muon -Name[ru]=Уведомления Muon -Name[sk]=Oznamovač Muon -Name[sl]=Obvestilnik Muon -Name[sr]=Муонов извештавач -Name[sr@ijekavian]=Муонов извјештавач -Name[sr@ijekavianlatin]=Muonov izvještavač -Name[sr@latin]=Muonov izveštavač -Name[sv]=Muon underrättelse -Name[tr]=Muon Bildirici -Name[ug]=Muon ئەسكەرتكۈچ -Name[uk]=Сповіщувач Muon -Name[x-test]=xxMuon Notifierxx -Name[zh_CN]=Muon 通知器 -Name[zh_TW]=Muon 通知器 -Type=Service -X-KDE-ServiceTypes=KDEDModule -X-KDE-Library=MuonNotifier -X-KDE-FactoryName=MuonNotifier -X-KDE-DBus-ModuleName=MuonNotifier -X-KDE-Kded-autoload=true -X-KDE-Kded-phase=2 diff --git a/notifier/MuonNotifier.h b/notifier/MuonNotifier.h deleted file mode 100644 index 3c3a94f..0000000 --- a/notifier/MuonNotifier.h +++ /dev/null @@ -1,81 +0,0 @@ -/*************************************************************************** - * Copyright © 2014 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef MUONNOTIFIERMODULE_H -#define MUONNOTIFIERMODULE_H - -#include <BackendNotifierModule.h> -#include <QStringList> -#include <QTimer> - -class KStatusNotifierItem; - -class MuonNotifier : public QObject -{ -Q_OBJECT -Q_PROPERTY(QStringList modules READ loadedModules CONSTANT) -Q_PROPERTY(bool isSystemUpToDate READ isSystemUpToDate NOTIFY updatesChanged) -Q_PROPERTY(QString iconName READ iconName NOTIFY updatesChanged) -Q_PROPERTY(QString message READ message NOTIFY updatesChanged) -Q_PROPERTY(QString extendedMessage READ extendedMessage NOTIFY updatesChanged) -Q_PROPERTY(State state READ state NOTIFY updatesChanged) -public: - enum State { - NoUpdates, - NormalUpdates, - SecurityUpdates - }; - Q_ENUMS(State) - - MuonNotifier(QObject* parent = nullptr); - virtual ~MuonNotifier(); - - bool isSystemUpToDate() const; - - State state() const; - QString iconName() const; - QString message() const; - QString extendedMessage() const; - /*** @returns count of normal updates only **/ - uint updatesCount() const; - /*** @returns count of security updates only **/ - uint securityUpdatesCount() const; - - QStringList loadedModules() const; - -public Q_SLOTS: - void configurationChanged(); - void recheckSystemUpdateNeeded(); - void showMuon(); - -Q_SIGNALS: - void updatesChanged(); - -private: - void showUpdatesNotification(); - void updateStatusNotifier(); - void loadBackends(); - - QList<BackendNotifierModule*> m_backends; - bool m_verbose; - QTimer m_timer; -}; - -#endif //ABSTRACTKDEDMODULE_H diff --git a/notifier/MuonNotifierDeclarativePlugin.cpp b/notifier/MuonNotifierDeclarativePlugin.cpp deleted file mode 100644 index 2229274..0000000 --- a/notifier/MuonNotifierDeclarativePlugin.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2014 Aleix Pol Gonzalez <aleixpol@blue-systems.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library/Lesser General Public License - * version 2, or (at your option) any later version, as published by the - * Free Software Foundation - * - * 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 Library/Lesser 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 "MuonNotifierDeclarativePlugin.h" -#include "MuonNotifier.h" - -#include <qqml.h> - -void MuonNotifierDeclarativePlugin::registerTypes(const char* uri) -{ - qmlRegisterSingletonType<MuonNotifier>(uri, 1, 0, "MuonNotifier", [](QQmlEngine*, QJSEngine*) -> QObject* { return new MuonNotifier; }); -} diff --git a/notifier/MuonNotifierDeclarativePlugin.h b/notifier/MuonNotifierDeclarativePlugin.h deleted file mode 100644 index 3ec4f16..0000000 --- a/notifier/MuonNotifierDeclarativePlugin.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (C) 2014 Aleix Pol Gonzalez <aleixpol@blue-systems.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library/Lesser General Public License - * version 2, or (at your option) any later version, as published by the - * Free Software Foundation - * - * 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 Library/Lesser 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 MUONNOTIFIERDECLARATIVEPLUGIN_H -#define MUONNOTIFIERDECLARATIVEPLUGIN_H - -#include <QtQml/QQmlExtensionPlugin> - -class MuonNotifierDeclarativePlugin : public QQmlExtensionPlugin -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") - public: - virtual void registerTypes(const char*) override; -}; - -#endif diff --git a/notifier/plasmoid/Messages.sh b/notifier/plasmoid/Messages.sh deleted file mode 100755 index f4e9fcf..0000000 --- a/notifier/plasmoid/Messages.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -$XGETTEXT `find . -name \*.qml -o -name \*.js` -o $podir/plasma_applet_org.kde.muonnotifier.pot diff --git a/notifier/plasmoid/contents/ui/Full.qml b/notifier/plasmoid/contents/ui/Full.qml deleted file mode 100644 index 651e488..0000000 --- a/notifier/plasmoid/contents/ui/Full.qml +++ /dev/null @@ -1,62 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2013 by Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU 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 . * - ***************************************************************************/ - -import QtQuick 2.1 -import QtQuick.Layouts 1.1 -import org.kde.plasma.extras 2.0 as PlasmaExtras -import org.kde.plasma.components 2.0 -import org.kde.muonnotifier 1.0 - -Item -{ - Layout.minimumWidth: 300 - Layout.minimumHeight: 200 - - PlasmaExtras.Heading { - id: header - anchors { - left: parent.left - right: parent.right - } - level: 3 - wrapMode: Text.WordWrap - text: MuonNotifier.message - } - - ColumnLayout - { - visible: !MuonNotifier.isSystemUpToDate - anchors { - fill: parent - topMargin: header.height - } - Label { - Layout.fillWidth: true - wrapMode: Text.WordWrap - horizontalAlignment: Text.AlignHCenter - text: MuonNotifier.extendedMessage - } - Button { - anchors.horizontalCenter: parent.horizontalCenter - text: i18n("Update") - tooltip: i18n("Launches the software to perform the update") - onClicked: MuonNotifier.showMuon() - } - } -} diff --git a/notifier/plasmoid/contents/ui/main.qml b/notifier/plasmoid/contents/ui/main.qml deleted file mode 100644 index 5e32b24..0000000 --- a/notifier/plasmoid/contents/ui/main.qml +++ /dev/null @@ -1,56 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2014 by Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU 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 . * - ***************************************************************************/ - -import QtQuick 2.2 -import org.kde.plasma.plasmoid 2.0 -import org.kde.plasma.core 2.0 as PlasmaCore -import org.kde.muonnotifier 1.0 - -Item -{ - Plasmoid.fullRepresentation: Full {} - - Binding { - target: plasmoid - property: "status" - value: switch (MuonNotifier.state) { - case MuonNotifier.NoUpdates: - return PlasmaCore.Types.PassiveStatus; - case MuonNotifier.NormalUpdates: - case MuonNotifier.SecurityUpdates: - return PlasmaCore.Types.ActiveStatus; - } - } - - Component.onCompleted: { - plasmoid.setAction("update", i18n("See Updates..."), "system-software-update"); - } - - function action_update() { - MuonNotifier.showMuon(); - } - - Plasmoid.compactRepresentation: PlasmaCore.IconItem { - source: MuonNotifier.iconName - MouseArea { - anchors.fill: parent - onClicked: plasmoid.expanded = !plasmoid.expanded - } - } -} diff --git a/notifier/plasmoid/metadata.desktop b/notifier/plasmoid/metadata.desktop deleted file mode 100644 index 3a14b03..0000000 --- a/notifier/plasmoid/metadata.desktop +++ /dev/null @@ -1,96 +0,0 @@ -[Desktop Entry] -Name=Updates -Name[ast]=Anovamientos -Name[ca]=Actualitzacions -Name[ca@valencia]=Actualitzacions -Name[cs]=Aktualizace -Name[da]=Opdateringer -Name[de]=Aktualisierungen -Name[el]=Ενημερώσεις -Name[en_GB]=Updates -Name[es]=Actualizaciones -Name[fi]=Päivitykset -Name[fr]=Mises à jour -Name[gl]=Actualizacións -Name[hu]=Frissítések -Name[id]=Pembaruan -Name[it]=Aggiornamenti -Name[ko]=업데이트 -Name[lt]=Atnaujinimai -Name[nb]=Oppdateringer -Name[nl]=Elementen voor bijwerken -Name[nn]=Oppdateringar -Name[pl]=Uaktualnienia -Name[pt]=Actualizações -Name[pt_BR]=Atualizações -Name[ru]=Обновления -Name[sk]=Aktualizácie -Name[sl]=Posodobitve -Name[sr]=Допуне -Name[sr@ijekavian]=Допуне -Name[sr@ijekavianlatin]=Dopune -Name[sr@latin]=Dopune -Name[sv]=Uppdateringar -Name[tr]=Güncellemeler -Name[uk]=Оновлення -Name[x-test]=xxUpdatesxx -Name[zh_CN]=更新 -Name[zh_TW]=更新 -Comment=Helps you keep your system up to date -Comment[ast]=Ayúdate a caltener el to sisema anováu -Comment[ca]=Us ajuda a mantenir el vostre sistema al dia -Comment[ca@valencia]=Vos ajuda a mantindre el vostre sistema al dia -Comment[cs]=Umožňuje vám zachovat systém aktuální -Comment[da]=Hjælper dig med at holde systemet opdateret -Comment[de]=Hilft Ihnen, Ihr System auf dem neusten Stand zu halten -Comment[el]=Βοηθά να διατηρήσετε το σύστημά σας ενημερωμένο -Comment[en_GB]=Helps you keep your system up to date -Comment[es]=Le ayuda a mantener su sistema actualizado -Comment[fi]=Auttaa pitämään järjestelmäsi ajan tasalla -Comment[fr]=Vous aide à maintenir le système à jour -Comment[gl]=Axúdao a manter o seu sistema actualizado. -Comment[hu]=Segít rendszere napra készen tartásában -Comment[id]=Membantu sistem anda tetap mutakhir -Comment[it]=Ti aiuta a mantenere il sistema aggiornato -Comment[ko]=시스템을 최신 상태로 유치합니다 -Comment[lt]=Leidžia Jūsų sistemą palaikyti atnaujinta -Comment[nb]=Hjelper til å holde systemet oppdatert -Comment[nl]=Helpt u om uw system bijgewerkt te houden -Comment[nn]=Hjelper til å halda systemet oppdatert -Comment[pl]=Pomaga utrzymać twój system aktualnym -Comment[pt]=Ajuda-o a manter o seu sistema actualizado -Comment[pt_BR]=Ajuda-o a manter seu sistema atualizado -Comment[ru]=Помогает поддерживать систему в актуальном состоянии -Comment[sk]=Pomôže vám udržiavať váš systém aktuálny -Comment[sl]=Pomaga vam ohraniti posodobljen sistem -Comment[sr]=Помаже вам да одржавате систем ажурним -Comment[sr@ijekavian]=Помаже вам да одржавате систем ажурним -Comment[sr@ijekavianlatin]=Pomaže vam da održavate sistem ažurnim -Comment[sr@latin]=Pomaže vam da održavate sistem ažurnim -Comment[sv]=Hjälper dig hålla systemet uppdaterat -Comment[tr]=Sisteminizi güncel tutmanıza yardım eder -Comment[uk]=Допомагає підтримувати актуальний стан вашої системи -Comment[x-test]=xxHelps you keep your system up to datexx -Comment[zh_CN]=帮助您保持更新 -Comment[zh_TW]=協助您的系統更新到最新狀態 -Encoding=UTF-8 - -Icon=org.kde.muonnotifier -Type=Service - -X-KDE-ServiceTypes=Plasma/Applet -X-KDE-PluginInfo-Author=The Plasma Team -X-KDE-PluginInfo-Email=plasma-devel@kde.org -X-KDE-PluginInfo-Name=org.kde.muonnotifier -X-KDE-PluginInfo-Version=3.0 -X-KDE-PluginInfo-Website=http://plasma.kde.org/ -X-KDE-PluginInfo-Category=Online Services -X-KDE-PluginInfo-Depends= -X-KDE-PluginInfo-License=GPL -X-KDE-PluginInfo-EnabledByDefault=true - -X-Plasma-API=declarativeappletscript -X-Plasma-MainScript=ui/main.qml -X-Plasma-NotificationArea=true -X-Plasma-Requires-FileDialog=Unused -X-Plasma-Requires-LaunchApp=Required diff --git a/notifier/qmldir b/notifier/qmldir deleted file mode 100644 index 263bd4b..0000000 --- a/notifier/qmldir +++ /dev/null @@ -1,3 +0,0 @@ -module org.kde.muonnotifier - -plugin MuonNotifierDeclarativePlugin diff --git a/muon/CMakeLists.txt b/src/CMakeLists.txt index b321bb1..b321bb1 100644 --- a/muon/CMakeLists.txt +++ b/src/CMakeLists.txt diff --git a/muon/DetailsTabs/ChangelogTab.cpp b/src/DetailsTabs/ChangelogTab.cpp index 11daafd..11daafd 100644 --- a/muon/DetailsTabs/ChangelogTab.cpp +++ b/src/DetailsTabs/ChangelogTab.cpp diff --git a/muon/DetailsTabs/ChangelogTab.h b/src/DetailsTabs/ChangelogTab.h index 10d40b6..10d40b6 100644 --- a/muon/DetailsTabs/ChangelogTab.h +++ b/src/DetailsTabs/ChangelogTab.h diff --git a/muon/DetailsTabs/DependsTab.cpp b/src/DetailsTabs/DependsTab.cpp index b83a643..b83a643 100644 --- a/muon/DetailsTabs/DependsTab.cpp +++ b/src/DetailsTabs/DependsTab.cpp diff --git a/muon/DetailsTabs/DependsTab.h b/src/DetailsTabs/DependsTab.h index eb5432f..eb5432f 100644 --- a/muon/DetailsTabs/DependsTab.h +++ b/src/DetailsTabs/DependsTab.h diff --git a/muon/DetailsTabs/DetailsTab.cpp b/src/DetailsTabs/DetailsTab.cpp index 3f92ed0..3f92ed0 100644 --- a/muon/DetailsTabs/DetailsTab.cpp +++ b/src/DetailsTabs/DetailsTab.cpp diff --git a/muon/DetailsTabs/DetailsTab.h b/src/DetailsTabs/DetailsTab.h index 524bc07..524bc07 100644 --- a/muon/DetailsTabs/DetailsTab.h +++ b/src/DetailsTabs/DetailsTab.h diff --git a/muon/DetailsTabs/InstalledFilesTab.cpp b/src/DetailsTabs/InstalledFilesTab.cpp index cf110d9..cf110d9 100644 --- a/muon/DetailsTabs/InstalledFilesTab.cpp +++ b/src/DetailsTabs/InstalledFilesTab.cpp diff --git a/muon/DetailsTabs/InstalledFilesTab.h b/src/DetailsTabs/InstalledFilesTab.h index 8a5bfe4..8a5bfe4 100644 --- a/muon/DetailsTabs/InstalledFilesTab.h +++ b/src/DetailsTabs/InstalledFilesTab.h diff --git a/muon/DetailsTabs/MainTab.cpp b/src/DetailsTabs/MainTab.cpp index b20d7c7..b20d7c7 100644 --- a/muon/DetailsTabs/MainTab.cpp +++ b/src/DetailsTabs/MainTab.cpp diff --git a/muon/DetailsTabs/MainTab.h b/src/DetailsTabs/MainTab.h index f9aa9a6..f9aa9a6 100644 --- a/muon/DetailsTabs/MainTab.h +++ b/src/DetailsTabs/MainTab.h diff --git a/muon/DetailsTabs/TechnicalDetailsTab.cpp b/src/DetailsTabs/TechnicalDetailsTab.cpp index e387cb8..e387cb8 100644 --- a/muon/DetailsTabs/TechnicalDetailsTab.cpp +++ b/src/DetailsTabs/TechnicalDetailsTab.cpp diff --git a/muon/DetailsTabs/TechnicalDetailsTab.h b/src/DetailsTabs/TechnicalDetailsTab.h index bfe042b..bfe042b 100644 --- a/muon/DetailsTabs/TechnicalDetailsTab.h +++ b/src/DetailsTabs/TechnicalDetailsTab.h diff --git a/muon/DetailsTabs/VersionTab.cpp b/src/DetailsTabs/VersionTab.cpp index f3a903f..f3a903f 100644 --- a/muon/DetailsTabs/VersionTab.cpp +++ b/src/DetailsTabs/VersionTab.cpp diff --git a/muon/DetailsTabs/VersionTab.h b/src/DetailsTabs/VersionTab.h index c59d740..c59d740 100644 --- a/muon/DetailsTabs/VersionTab.h +++ b/src/DetailsTabs/VersionTab.h diff --git a/muon/DetailsWidget.cpp b/src/DetailsWidget.cpp index f3b95d9..f3b95d9 100644 --- a/muon/DetailsWidget.cpp +++ b/src/DetailsWidget.cpp diff --git a/muon/DetailsWidget.h b/src/DetailsWidget.h index 80f7a9a..80f7a9a 100644 --- a/muon/DetailsWidget.h +++ b/src/DetailsWidget.h diff --git a/muon/DownloadModel/DownloadDelegate.cpp b/src/DownloadModel/DownloadDelegate.cpp index 4cf01ae..4cf01ae 100644 --- a/muon/DownloadModel/DownloadDelegate.cpp +++ b/src/DownloadModel/DownloadDelegate.cpp diff --git a/muon/DownloadModel/DownloadDelegate.h b/src/DownloadModel/DownloadDelegate.h index 0487365..0487365 100644 --- a/muon/DownloadModel/DownloadDelegate.h +++ b/src/DownloadModel/DownloadDelegate.h diff --git a/muon/DownloadModel/DownloadModel.cpp b/src/DownloadModel/DownloadModel.cpp index 0916ec7..0916ec7 100644 --- a/muon/DownloadModel/DownloadModel.cpp +++ b/src/DownloadModel/DownloadModel.cpp diff --git a/muon/DownloadModel/DownloadModel.h b/src/DownloadModel/DownloadModel.h index d493a64..d493a64 100644 --- a/muon/DownloadModel/DownloadModel.h +++ b/src/DownloadModel/DownloadModel.h diff --git a/muon/FilterWidget/ArchitectureFilter.cpp b/src/FilterWidget/ArchitectureFilter.cpp index 9e7bad0..9e7bad0 100644 --- a/muon/FilterWidget/ArchitectureFilter.cpp +++ b/src/FilterWidget/ArchitectureFilter.cpp diff --git a/muon/FilterWidget/ArchitectureFilter.h b/src/FilterWidget/ArchitectureFilter.h index 355026a..355026a 100644 --- a/muon/FilterWidget/ArchitectureFilter.h +++ b/src/FilterWidget/ArchitectureFilter.h diff --git a/muon/FilterWidget/CategoryFilter.cpp b/src/FilterWidget/CategoryFilter.cpp index 8971e1e..8971e1e 100644 --- a/muon/FilterWidget/CategoryFilter.cpp +++ b/src/FilterWidget/CategoryFilter.cpp diff --git a/muon/FilterWidget/CategoryFilter.h b/src/FilterWidget/CategoryFilter.h index c3782ce..c3782ce 100644 --- a/muon/FilterWidget/CategoryFilter.h +++ b/src/FilterWidget/CategoryFilter.h diff --git a/muon/FilterWidget/FilterModel.cpp b/src/FilterWidget/FilterModel.cpp index 2e4e15b..2e4e15b 100644 --- a/muon/FilterWidget/FilterModel.cpp +++ b/src/FilterWidget/FilterModel.cpp diff --git a/muon/FilterWidget/FilterModel.h b/src/FilterWidget/FilterModel.h index ddc5b3c..ddc5b3c 100644 --- a/muon/FilterWidget/FilterModel.h +++ b/src/FilterWidget/FilterModel.h diff --git a/muon/FilterWidget/FilterWidget.cpp b/src/FilterWidget/FilterWidget.cpp index 93cd890..93cd890 100644 --- a/muon/FilterWidget/FilterWidget.cpp +++ b/src/FilterWidget/FilterWidget.cpp diff --git a/muon/FilterWidget/FilterWidget.h b/src/FilterWidget/FilterWidget.h index c70fca2..c70fca2 100644 --- a/muon/FilterWidget/FilterWidget.h +++ b/src/FilterWidget/FilterWidget.h diff --git a/muon/FilterWidget/OriginFilter.cpp b/src/FilterWidget/OriginFilter.cpp index 04d398f..04d398f 100644 --- a/muon/FilterWidget/OriginFilter.cpp +++ b/src/FilterWidget/OriginFilter.cpp diff --git a/muon/FilterWidget/OriginFilter.h b/src/FilterWidget/OriginFilter.h index 8064e45..8064e45 100644 --- a/muon/FilterWidget/OriginFilter.h +++ b/src/FilterWidget/OriginFilter.h diff --git a/muon/FilterWidget/StatusFilter.cpp b/src/FilterWidget/StatusFilter.cpp index 4989a5b..4989a5b 100644 --- a/muon/FilterWidget/StatusFilter.cpp +++ b/src/FilterWidget/StatusFilter.cpp diff --git a/muon/FilterWidget/StatusFilter.h b/src/FilterWidget/StatusFilter.h index 33e3e5e..33e3e5e 100644 --- a/muon/FilterWidget/StatusFilter.h +++ b/src/FilterWidget/StatusFilter.h diff --git a/muon/MainWindow.cpp b/src/MainWindow.cpp index de068d8..de068d8 100644 --- a/muon/MainWindow.cpp +++ b/src/MainWindow.cpp diff --git a/muon/MainWindow.h b/src/MainWindow.h index 0d6c022..0d6c022 100644 --- a/muon/MainWindow.h +++ b/src/MainWindow.h diff --git a/muon/ManagerWidget.cpp b/src/ManagerWidget.cpp index 930c4af..930c4af 100644 --- a/muon/ManagerWidget.cpp +++ b/src/ManagerWidget.cpp diff --git a/muon/ManagerWidget.h b/src/ManagerWidget.h index 2daad86..2daad86 100644 --- a/muon/ManagerWidget.h +++ b/src/ManagerWidget.h diff --git a/muon/PackageModel/PackageDelegate.cpp b/src/PackageModel/PackageDelegate.cpp index f39cd78..f39cd78 100644 --- a/muon/PackageModel/PackageDelegate.cpp +++ b/src/PackageModel/PackageDelegate.cpp diff --git a/muon/PackageModel/PackageDelegate.h b/src/PackageModel/PackageDelegate.h index 71cd844..71cd844 100644 --- a/muon/PackageModel/PackageDelegate.h +++ b/src/PackageModel/PackageDelegate.h diff --git a/muon/PackageModel/PackageModel.cpp b/src/PackageModel/PackageModel.cpp index 9bde615..9bde615 100644 --- a/muon/PackageModel/PackageModel.cpp +++ b/src/PackageModel/PackageModel.cpp diff --git a/muon/PackageModel/PackageModel.h b/src/PackageModel/PackageModel.h index 7a89845..7a89845 100644 --- a/muon/PackageModel/PackageModel.h +++ b/src/PackageModel/PackageModel.h diff --git a/muon/PackageModel/PackageProxyModel.cpp b/src/PackageModel/PackageProxyModel.cpp index 807ad07..807ad07 100644 --- a/muon/PackageModel/PackageProxyModel.cpp +++ b/src/PackageModel/PackageProxyModel.cpp diff --git a/muon/PackageModel/PackageProxyModel.h b/src/PackageModel/PackageProxyModel.h index fea49b7..fea49b7 100644 --- a/muon/PackageModel/PackageProxyModel.h +++ b/src/PackageModel/PackageProxyModel.h diff --git a/muon/PackageModel/PackageView.cpp b/src/PackageModel/PackageView.cpp index 3b19366..3b19366 100644 --- a/muon/PackageModel/PackageView.cpp +++ b/src/PackageModel/PackageView.cpp diff --git a/muon/PackageModel/PackageView.h b/src/PackageModel/PackageView.h index 89e4db3..89e4db3 100644 --- a/muon/PackageModel/PackageView.h +++ b/src/PackageModel/PackageView.h diff --git a/muon/PackageModel/PackageWidget.cpp b/src/PackageModel/PackageWidget.cpp index bf10d14..bf10d14 100644 --- a/muon/PackageModel/PackageWidget.cpp +++ b/src/PackageModel/PackageWidget.cpp diff --git a/muon/PackageModel/PackageWidget.h b/src/PackageModel/PackageWidget.h index 7e6503b..7e6503b 100644 --- a/muon/PackageModel/PackageWidget.h +++ b/src/PackageModel/PackageWidget.h diff --git a/muon/ReviewWidget.cpp b/src/ReviewWidget.cpp index b7301f2..b7301f2 100644 --- a/muon/ReviewWidget.cpp +++ b/src/ReviewWidget.cpp diff --git a/muon/ReviewWidget.h b/src/ReviewWidget.h index c0aefea..c0aefea 100644 --- a/muon/ReviewWidget.h +++ b/src/ReviewWidget.h diff --git a/muon/StatusWidget.cpp b/src/StatusWidget.cpp index 17e11c1..17e11c1 100644 --- a/muon/StatusWidget.cpp +++ b/src/StatusWidget.cpp diff --git a/muon/StatusWidget.h b/src/StatusWidget.h index bbd6eb8..bbd6eb8 100644 --- a/muon/StatusWidget.h +++ b/src/StatusWidget.h diff --git a/muon/TransactionWidget.cpp b/src/TransactionWidget.cpp index fd25646..fd25646 100644 --- a/muon/TransactionWidget.cpp +++ b/src/TransactionWidget.cpp diff --git a/muon/TransactionWidget.h b/src/TransactionWidget.h index 55afbc7..55afbc7 100644 --- a/muon/TransactionWidget.h +++ b/src/TransactionWidget.h diff --git a/muon/config/GeneralSettingsPage.cpp b/src/config/GeneralSettingsPage.cpp index 42d9f21..42d9f21 100644 --- a/muon/config/GeneralSettingsPage.cpp +++ b/src/config/GeneralSettingsPage.cpp diff --git a/muon/config/GeneralSettingsPage.h b/src/config/GeneralSettingsPage.h index 32f9c57..32f9c57 100644 --- a/muon/config/GeneralSettingsPage.h +++ b/src/config/GeneralSettingsPage.h diff --git a/muon/config/ManagerSettingsDialog.cpp b/src/config/ManagerSettingsDialog.cpp index 0a4e3e2..0a4e3e2 100644 --- a/muon/config/ManagerSettingsDialog.cpp +++ b/src/config/ManagerSettingsDialog.cpp diff --git a/muon/config/ManagerSettingsDialog.h b/src/config/ManagerSettingsDialog.h index 04114e3..04114e3 100644 --- a/muon/config/ManagerSettingsDialog.h +++ b/src/config/ManagerSettingsDialog.h diff --git a/muon/config/MuonSettings.kcfgc b/src/config/MuonSettings.kcfgc index e6082ba..e6082ba 100644 --- a/muon/config/MuonSettings.kcfgc +++ b/src/config/MuonSettings.kcfgc diff --git a/muon/config/muon.kcfg b/src/config/muon.kcfg index f880169..f880169 100644 --- a/muon/config/muon.kcfg +++ b/src/config/muon.kcfg diff --git a/muon/icons/CMakeLists.txt b/src/icons/CMakeLists.txt index ed8b065..ed8b065 100644 --- a/muon/icons/CMakeLists.txt +++ b/src/icons/CMakeLists.txt diff --git a/muon/icons/hi128-apps-muon.png b/src/icons/hi128-apps-muon.png Binary files differindex 6fe4681..6fe4681 100644 --- a/muon/icons/hi128-apps-muon.png +++ b/src/icons/hi128-apps-muon.png diff --git a/muon/icons/hi16-apps-muon.png b/src/icons/hi16-apps-muon.png Binary files differindex 4c753b9..4c753b9 100644 --- a/muon/icons/hi16-apps-muon.png +++ b/src/icons/hi16-apps-muon.png diff --git a/muon/icons/hi22-apps-muon.png b/src/icons/hi22-apps-muon.png Binary files differindex a5ecbf6..a5ecbf6 100644 --- a/muon/icons/hi22-apps-muon.png +++ b/src/icons/hi22-apps-muon.png diff --git a/muon/icons/hi256-apps-muon.png b/src/icons/hi256-apps-muon.png Binary files differindex c91d70f..c91d70f 100644 --- a/muon/icons/hi256-apps-muon.png +++ b/src/icons/hi256-apps-muon.png diff --git a/muon/icons/hi32-apps-muon.png b/src/icons/hi32-apps-muon.png Binary files differindex bb3e976..bb3e976 100644 --- a/muon/icons/hi32-apps-muon.png +++ b/src/icons/hi32-apps-muon.png diff --git a/muon/icons/hi48-apps-muon.png b/src/icons/hi48-apps-muon.png Binary files differindex 14ce82f..14ce82f 100644 --- a/muon/icons/hi48-apps-muon.png +++ b/src/icons/hi48-apps-muon.png diff --git a/muon/icons/hi64-apps-muon.png b/src/icons/hi64-apps-muon.png Binary files differindex 6527193..6527193 100644 --- a/muon/icons/hi64-apps-muon.png +++ b/src/icons/hi64-apps-muon.png diff --git a/muon/icons/hisc-apps-muon.svgz b/src/icons/hisc-apps-muon.svgz Binary files differindex ba64c0e..ba64c0e 100644 --- a/muon/icons/hisc-apps-muon.svgz +++ b/src/icons/hisc-apps-muon.svgz diff --git a/muon/main.cpp b/src/main.cpp index d83e23f..d83e23f 100644 --- a/muon/main.cpp +++ b/src/main.cpp diff --git a/muon/muon.desktop b/src/muon.desktop index 8002d6c..8002d6c 100644 --- a/muon/muon.desktop +++ b/src/muon.desktop diff --git a/muon/muonapt/ChangesDialog.cpp b/src/muonapt/ChangesDialog.cpp index 8bfe5a4..8bfe5a4 100644 --- a/muon/muonapt/ChangesDialog.cpp +++ b/src/muonapt/ChangesDialog.cpp diff --git a/muon/muonapt/ChangesDialog.h b/src/muonapt/ChangesDialog.h index ed17c46..ed17c46 100644 --- a/muon/muonapt/ChangesDialog.h +++ b/src/muonapt/ChangesDialog.h diff --git a/muon/muonapt/HistoryView/HistoryProxyModel.cpp b/src/muonapt/HistoryView/HistoryProxyModel.cpp index 96f9fac..96f9fac 100644 --- a/muon/muonapt/HistoryView/HistoryProxyModel.cpp +++ b/src/muonapt/HistoryView/HistoryProxyModel.cpp diff --git a/muon/muonapt/HistoryView/HistoryProxyModel.h b/src/muonapt/HistoryView/HistoryProxyModel.h index a5fc1e7..a5fc1e7 100644 --- a/muon/muonapt/HistoryView/HistoryProxyModel.h +++ b/src/muonapt/HistoryView/HistoryProxyModel.h diff --git a/muon/muonapt/HistoryView/HistoryView.cpp b/src/muonapt/HistoryView/HistoryView.cpp index 33d5e5d..33d5e5d 100644 --- a/muon/muonapt/HistoryView/HistoryView.cpp +++ b/src/muonapt/HistoryView/HistoryView.cpp diff --git a/muon/muonapt/HistoryView/HistoryView.h b/src/muonapt/HistoryView/HistoryView.h index f63b85b..f63b85b 100644 --- a/muon/muonapt/HistoryView/HistoryView.h +++ b/src/muonapt/HistoryView/HistoryView.h diff --git a/muon/muonapt/MuonStrings.cpp b/src/muonapt/MuonStrings.cpp index 1138610..1138610 100644 --- a/muon/muonapt/MuonStrings.cpp +++ b/src/muonapt/MuonStrings.cpp diff --git a/muon/muonapt/MuonStrings.h b/src/muonapt/MuonStrings.h index 1a0f13d..1a0f13d 100644 --- a/muon/muonapt/MuonStrings.h +++ b/src/muonapt/MuonStrings.h diff --git a/muon/muonapt/QAptActions.cpp b/src/muonapt/QAptActions.cpp index 12d79cd..12d79cd 100644 --- a/muon/muonapt/QAptActions.cpp +++ b/src/muonapt/QAptActions.cpp diff --git a/muon/muonapt/QAptActions.h b/src/muonapt/QAptActions.h index 33db6e1..33db6e1 100644 --- a/muon/muonapt/QAptActions.h +++ b/src/muonapt/QAptActions.h diff --git a/muon/muonui.rc b/src/muonui.rc index 09e4786..09e4786 100644 --- a/muon/muonui.rc +++ b/src/muonui.rc diff --git a/muon/settings/SettingsPageBase.cpp b/src/settings/SettingsPageBase.cpp index 19f9f78..19f9f78 100644 --- a/muon/settings/SettingsPageBase.cpp +++ b/src/settings/SettingsPageBase.cpp diff --git a/muon/settings/SettingsPageBase.h b/src/settings/SettingsPageBase.h index 1c591e3..1c591e3 100644 --- a/muon/settings/SettingsPageBase.h +++ b/src/settings/SettingsPageBase.h diff --git a/updater/CMakeLists.txt b/updater/CMakeLists.txt deleted file mode 100644 index 1a361a7..0000000 --- a/updater/CMakeLists.txt +++ /dev/null @@ -1,38 +0,0 @@ -include_directories(../libmuon) - -set(muon_updater_SRCS - main.cpp - MainWindow.cpp - ChangelogWidget.cpp - ProgressWidget.cpp - UpdaterWidget.cpp - KActionMessageWidget.cpp - UpdateDelegate.cpp) - -ki18n_wrap_ui(muon_updater_SRCS ProgressWidget.ui - UpdaterCentralWidget.ui - UpdaterWidgetNoUpdates.ui -) - -add_executable(muon-updater ${muon_updater_SRCS}) - -target_link_libraries(muon-updater KF5::CoreAddons - KF5::KIOWidgets - KF5::Solid - KF5::I18n - KF5::DBusAddons - KF5::XmlGui - KF5::IconThemes - MuonCommon) - -if (ENABLE_QZEITGEIST) - target_link_libraries(muon-updater ${QZEITGEIST_LIBRARY}) -endif () - -install(TARGETS muon-updater ${INSTALL_TARGETS_DEFAULT_ARGS} ) - -########### install files ############### - -install( FILES muonupdaterui.rc DESTINATION ${KXMLGUI_INSTALL_DIR}/muonupdater ) -install( PROGRAMS muon-updater.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} ) - diff --git a/updater/ChangelogWidget.cpp b/updater/ChangelogWidget.cpp deleted file mode 100644 index 664abc8..0000000 --- a/updater/ChangelogWidget.cpp +++ /dev/null @@ -1,183 +0,0 @@ -/*************************************************************************** - * Copyright © 2011 Jonathan Thomas <echidnaman@kubuntu.org> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "ChangelogWidget.h" -#include <resources/AbstractResource.h> - -// Qt includes -#include <QtCore/QParallelAnimationGroup> -#include <QtCore/QPropertyAnimation> -#include <QtCore/QStringBuilder> -#include <QtCore/QTextStream> -#include <QProcess> -#include <QtWidgets/QToolButton> -#include <QtWidgets/QVBoxLayout> -#include <QtWidgets/QApplication> -#include <QDesktopServices> - -// KDE includes -#include <KIO/Job> -#include <KJob> -#include <KLocalizedString> -#include <KPixmapSequence> -#include <KPixmapSequenceOverlayPainter> -#include <KIconLoader> -#include <QTextBrowser> -#include <QPushButton> -#include <QDebug> - -ChangelogWidget::ChangelogWidget(QWidget *parent) - : QWidget(parent) - , m_package(nullptr) - , m_show(false) -{ - QWidget *sideWidget = new QWidget(this); - - QToolButton *hideButton = new QToolButton(sideWidget); - hideButton->setText(i18nc("@action:button", "Hide")); - hideButton->setArrowType(Qt::DownArrow); - hideButton->setAutoRaise(true); - hideButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); - connect(hideButton, SIGNAL(clicked()), this, SLOT(animatedHide())); - - QVBoxLayout *sideLayout = new QVBoxLayout(sideWidget); - sideLayout->setMargin(0); - sideLayout->setSpacing(0); - sideLayout->addWidget(hideButton); - sideLayout->addStretch(); - sideWidget->setLayout(sideLayout); - - m_changelogBrowser = new QTextBrowser(this); - m_changelogBrowser->setOpenLinks(false); - m_changelogBrowser->setFrameShape(QFrame::NoFrame); - m_changelogBrowser->setFrameShadow(QFrame::Plain); - m_changelogBrowser->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - connect(m_changelogBrowser, &QTextBrowser::anchorClicked, this, &ChangelogWidget::showMore); - - QWidget *viewport = m_changelogBrowser->viewport(); - QPalette palette = viewport->palette(); - palette.setColor(viewport->backgroundRole(), Qt::transparent); - palette.setColor(viewport->foregroundRole(), palette.color(QPalette::WindowText)); - viewport->setPalette(palette); - - m_busyWidget = new KPixmapSequenceOverlayPainter(this); - m_busyWidget->setSequence(KIconLoader::global()->loadPixmapSequence("process-working", KIconLoader::SizeSmallMedium)); - m_busyWidget->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter); - m_busyWidget->setWidget(this); - - QHBoxLayout *mainLayout = new QHBoxLayout(this); - mainLayout->setSpacing(0); - mainLayout->addWidget(sideWidget); - mainLayout->addWidget(m_changelogBrowser); - - int finalHeight = sizeHint().height(); - - QPropertyAnimation *anim1 = new QPropertyAnimation(this, "maximumHeight", this); - anim1->setDuration(500); - anim1->setEasingCurve(QEasingCurve::OutQuart); - anim1->setStartValue(0); - anim1->setEndValue(finalHeight); - - QPropertyAnimation *anim2 = new QPropertyAnimation(this, "minimumHeight", this); - anim2->setDuration(500); - anim2->setEasingCurve(QEasingCurve::OutQuart); - anim2->setStartValue(0); - anim2->setEndValue(finalHeight); - - m_expandWidget = new QParallelAnimationGroup(this); - m_expandWidget->addAnimation(anim1); - m_expandWidget->addAnimation(anim2); -} - -void ChangelogWidget::setResource(AbstractResource* package) -{ - if (m_package==package) - return; - - if(m_package) - disconnect(m_package, SIGNAL(changelogFetched(QString)), this, SLOT(changelogFetched(QString))); - - m_package = package; - if (m_package) { - connect(m_package, SIGNAL(changelogFetched(QString)), SLOT(changelogFetched(QString))); - fetchChangelog(); - } else - animatedHide(); -} - -void ChangelogWidget::show() -{ - QWidget::show(); - - if (!m_show) { - m_show = true; - disconnect(m_expandWidget, SIGNAL(finished()), this, SLOT(hide())); - m_expandWidget->setDirection(QAbstractAnimation::Forward); - m_expandWidget->start(); - } -} - -void ChangelogWidget::animatedHide() -{ - m_show = false; - m_changelogBrowser->clear(); - - m_expandWidget->setDirection(QAbstractAnimation::Backward); - m_expandWidget->start(); - connect(m_expandWidget, SIGNAL(finished()), this, SLOT(hide())); -} - -void ChangelogWidget::changelogFetched(const QString& changelog) -{ - if (m_package) { - // Work around http://bugreports.qt.nokia.com/browse/QTBUG-2533 by forcibly resetting the CharFormat - m_changelogBrowser->setCurrentCharFormat(QTextCharFormat()); - QString fullText; - fullText += xi18nc("@info/rich", "<p><b>Package Name:</b> <a href='package:%1'>%1</a></p>", m_package->packageName()); - fullText += xi18nc("@info/rich", "<p><b>Installed Version:</b> %1</p>", m_package->installedVersion()); - fullText += changelog; - m_changelogBrowser->setHtml(fullText); - } - - m_busyWidget->stop(); - if (!m_show) { - animatedHide(); - } -} - -void ChangelogWidget::fetchChangelog() -{ - show(); - m_changelogBrowser->clear(); - m_busyWidget->start(); - m_package->fetchChangelog(); -} - -void ChangelogWidget::showMore(const QUrl& package) -{ - if (package.scheme() == QLatin1String("package")) { - bool b = QProcess::startDetached("muon-discover", { "--application", package.path() }); - if (!b) { - qWarning() << "Couldn't launch muon-discover"; - } - } else { - QDesktopServices::openUrl(package); - } -} diff --git a/updater/ChangelogWidget.h b/updater/ChangelogWidget.h deleted file mode 100644 index d983181..0000000 --- a/updater/ChangelogWidget.h +++ /dev/null @@ -1,62 +0,0 @@ -/*************************************************************************** - * Copyright © 2011 Jonathan Thomas <echidnaman@kubuntu.org> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef CHANGELOGWIDGET_H -#define CHANGELOGWIDGET_H - -#include <QtCore/QSet> -#include <QtWidgets/QWidget> - -class AbstractResource; -class QParallelAnimationGroup; - -class KJob; -class KPixmapSequenceOverlayPainter; -class KTemporaryFile; -class QPushButton; -class QTextBrowser; - -class ChangelogWidget : public QWidget -{ - Q_OBJECT -public: - explicit ChangelogWidget(QWidget *parent = nullptr); - -private: - AbstractResource *m_package; - QString m_jobFileName; - bool m_show; - - QParallelAnimationGroup *m_expandWidget; - QTextBrowser *m_changelogBrowser; - KPixmapSequenceOverlayPainter *m_busyWidget; - -public Q_SLOTS: - void setResource(AbstractResource *package); - void show(); - void animatedHide(); - -private Q_SLOTS: - void fetchChangelog(); - void changelogFetched(const QString& changelog); - void showMore(const QUrl &package); -}; - -#endif diff --git a/updater/KActionMessageWidget.cpp b/updater/KActionMessageWidget.cpp deleted file mode 100644 index 3287c40..0000000 --- a/updater/KActionMessageWidget.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/*************************************************************************** - * Copyright © 2013 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "KActionMessageWidget.h" -#include <QAction> - -KActionMessageWidget::KActionMessageWidget(QAction* action, QWidget* parent) - : KMessageWidget(parent) - , m_action(action) -{ - setText(action->whatsThis()); - addAction(action); - reconsiderVisibility(); - connect(action, SIGNAL(changed()), SLOT(reconsiderVisibility())); -} - -void KActionMessageWidget::reconsiderVisibility() -{ - setVisible(m_action->isEnabled()); -} diff --git a/updater/KActionMessageWidget.h b/updater/KActionMessageWidget.h deleted file mode 100644 index d92b9a2..0000000 --- a/updater/KActionMessageWidget.h +++ /dev/null @@ -1,40 +0,0 @@ -/*************************************************************************** - * Copyright © 2013 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef KACTIONMESSAGEWIDGET_H -#define KACTIONMESSAGEWIDGET_H - -#include <KMessageWidget> - -class KActionMessageWidget : public KMessageWidget -{ - Q_OBJECT - public: - explicit KActionMessageWidget(QAction* action, QWidget* parent = nullptr); - QAction* action() const { return m_action; } - - public slots: - void reconsiderVisibility(); - - private: - QAction* m_action; -}; - -#endif // KACTIONMESSAGEWIDGET_H diff --git a/updater/MainWindow.cpp b/updater/MainWindow.cpp deleted file mode 100644 index b67bf1a..0000000 --- a/updater/MainWindow.cpp +++ /dev/null @@ -1,212 +0,0 @@ -/*************************************************************************** - * Copyright © 2011 Jonathan Thomas <echidnaman@kubuntu.org> * - * Copyright © 2013 Aleix Pol Gonzalez <aleixpol@blue-systems.com> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "MainWindow.h" - -// Qt includes -#include <QtCore/QTimer> -#include <QtWidgets/QApplication> -#include <QtWidgets/QVBoxLayout> -#include <QtWidgets/QPushButton> -#include <QtWidgets/QToolButton> -#include <QMenu> -#include <QMenuBar> -#include <QLayoutItem> - -// KDE includes -#include <KActionCollection> -#include <KMessageBox> -#include <KMessageWidget> -#include <KProcess> -#include <KProtocolManager> -#include <KToolBar> -#include <KLocalizedString> -#warning TODO, waiting for this new API to finally be accepted -// #include <Solid/Power> -// #include <Solid/AcPluggedJob> - -// Own includes -#include <resources/AbstractResourcesBackend.h> -#include <resources/AbstractBackendUpdater.h> -#include <resources/ResourcesModel.h> -#include <resources/ResourcesUpdatesModel.h> -#include <resources/UIHelper.h> -#include "ProgressWidget.h" -#include "UpdaterWidget.h" -#include "KActionMessageWidget.h" -#include "ui_UpdaterCentralWidget.h" - -MainWindow::MainWindow() - : KXmlGuiWindow() - , m_controls(new QWidget) - { - m_updater = new ResourcesUpdatesModel(this); - connect(m_updater, SIGNAL(progressingChanged(bool)), SLOT(progressingChanged())); - - setupActions(); - initGUI(); -} - -void MainWindow::initGUI() -{ - setWindowTitle(i18nc("@title:window", "Software Updates")); - ResourcesModel* m = ResourcesModel::global(); - m->integrateMainWindow(this); - - QWidget *mainWidget = new QWidget(this); - QVBoxLayout *mainLayout = new QVBoxLayout(mainWidget); - - m_powerMessage = new KMessageWidget(mainWidget); - m_powerMessage->setText(i18nc("@info Warning to plug in laptop before updating", - "It is safer to plug in the power adapter before updating.")); - m_powerMessage->setMessageType(KMessageWidget::Warning); - checkPlugState(); - - m_progressWidget = new ProgressWidget(m_updater, mainWidget); - m_updaterWidget = new UpdaterWidget(m_updater, mainWidget); - m_updaterWidget->setEnabled(false); - connect(m_updaterWidget, SIGNAL(modelPopulated()), - this, SLOT(setActionsEnabled())); - - Ui::UpdaterButtons buttonsUi; - buttonsUi.setupUi(m_controls); - buttonsUi.more->setMenu(m_moreMenu); - buttonsUi.apply->setDefaultAction(m_applyAction); - buttonsUi.quit->setDefaultAction(action("file_quit")); - - mainLayout->addWidget(m_powerMessage); - mainLayout->addWidget(m_updaterWidget); - mainLayout->addWidget(m_progressWidget); - mainLayout->addWidget(m_controls); - - mainWidget->setLayout(mainLayout); - setCentralWidget(mainWidget); - progressingChanged(); - - connect(m, SIGNAL(allInitialized()), SLOT(initBackend())); - menuBar()->setVisible(false); - toolBar()->setVisible(false); - -#warning TODO, waiting for this new API to finally be accepted -// connect(Solid::Power::self(), SIGNAL(acPluggedChanged(bool)), SLOT(updatePlugState(bool))); - updatePlugState(true); -} - -void MainWindow::setupActions() -{ - QAction *quitAction = KStandardAction::quit(QCoreApplication::instance(), SLOT(quit()), actionCollection()); - actionCollection()->addAction("file_quit", quitAction); - - m_applyAction = actionCollection()->addAction("apply"); - m_applyAction->setIcon(QIcon::fromTheme("dialog-ok-apply")); - m_applyAction->setText(i18nc("@action Downloads and installs updates", "Install Updates")); - connect(m_applyAction, SIGNAL(triggered()), m_updater, SLOT(updateAll())); - m_applyAction->setEnabled(false); - - setActionsEnabled(false); - -// setupGUI(StandardWindowOption(KXmlGuiWindow::Default & ~KXmlGuiWindow::StatusBar)); - setupGUI(StandardWindowOption((KXmlGuiWindow::Default & ~KXmlGuiWindow::StatusBar) & ~KXmlGuiWindow::ToolBar)); - - m_moreMenu = new QMenu(this); - m_advancedMenu = new QMenu(i18n("Advanced..."), m_moreMenu); - setupBackendsActions(); -} - -void MainWindow::initBackend() -{ - setupBackendsActions(); - - setActionsEnabled(); -} - -static bool containsAction(QAction* action, QBoxLayout* l) -{ - for(int i=0, count=l->count(); i<count; ++i) { - KActionMessageWidget* w = qobject_cast<KActionMessageWidget*>(l->itemAt(i)->widget()); - if(w && w->action() == action) { - return true; - } - } - return false; -} - -void MainWindow::setupBackendsActions() -{ - m_advancedMenu->clear(); - m_moreMenu->clear(); - - QList<QAction*> highActions = UIHelper::setupMessageActions(m_moreMenu, m_advancedMenu, ResourcesModel::global()->messageActions()); - for (QAction* action: highActions) { - if(!containsAction(action, qobject_cast<QBoxLayout*>(centralWidget()->layout()))) { - KActionMessageWidget* w = new KActionMessageWidget(action, centralWidget()); - qobject_cast<QBoxLayout*>(centralWidget()->layout())->insertWidget(1, w); - } - } - - if (!m_moreMenu->isEmpty()) - m_moreMenu->addSeparator(); - m_moreMenu->addAction(actionCollection()->action("options_configure_keybinding")); - m_moreMenu->addSeparator(); - m_moreMenu->addMenu(m_advancedMenu); - m_moreMenu->addSeparator(); - m_moreMenu->addAction(actionCollection()->action("help_about_app")); - m_moreMenu->addAction(actionCollection()->action("help_about_kde")); - m_moreMenu->addAction(actionCollection()->action("help_report_bug")); -} -QSize MainWindow::sizeHint() const -{ - return KXmlGuiWindow::sizeHint().expandedTo(QSize(900, 500)); -} - -void MainWindow::progressingChanged() -{ - QApplication::restoreOverrideCursor(); - m_updaterWidget->setCurrentIndex(0); - - bool active = m_updater->isProgressing(); - m_progressWidget->setVisible(active); -// m_updaterWidget->setVisible(!active); - setActionsEnabled(!active); -} - -void MainWindow::setActionsEnabled(bool enabled) -{ - m_controls->setEnabled(enabled); - m_applyAction->setEnabled(enabled && m_updater->hasUpdates()); -} - -void MainWindow::checkPlugState() -{ -#warning TODO, waiting for this new API to finally be accepted -// Solid::AcPluggedJob* job = Solid::Power::isAcPlugged(); -// connect(job, &Solid::AcPluggedJob::result, this, [=]() { updatePlugState(job->isPlugged()); }); -} - -void MainWindow::updatePlugState(bool plugged) -{ - m_powerMessage->setVisible(!plugged); -} - -bool MainWindow::queryClose() -{ - return !m_updater->isProgressing() && !ResourcesModel::global()->isBusy(); -} diff --git a/updater/MainWindow.h b/updater/MainWindow.h deleted file mode 100644 index 9ea3816..0000000 --- a/updater/MainWindow.h +++ /dev/null @@ -1,64 +0,0 @@ -/*************************************************************************** - * Copyright © 2011 Jonathan Thomas <echidnaman@kubuntu.org> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef MAINWINDOW_H -#define MAINWINDOW_H - -#include <KXmlGuiWindow> -#include <QPointer> - -class KMessageWidget; -class ResourcesUpdatesModel; -class ProgressWidget; -class UpdaterWidget; - -class MainWindow : public KXmlGuiWindow -{ - Q_OBJECT -public: - MainWindow(); - - QSize sizeHint() const Q_DECL_OVERRIDE; - bool queryClose() Q_DECL_OVERRIDE; - -private: - ResourcesUpdatesModel* m_updater; - - ProgressWidget *m_progressWidget; - UpdaterWidget *m_updaterWidget; - KMessageWidget *m_powerMessage; - QAction *m_applyAction; - QMenu* m_moreMenu; - QMenu* m_advancedMenu; - QWidget* m_controls; - -private Q_SLOTS: - void setActionsEnabled(bool enabled = true); - - void initGUI(); - void initBackend(); - void setupActions(); - void setupBackendsActions(); - void checkPlugState(); - void updatePlugState(bool plugged); - void progressingChanged(); -}; - -#endif // MAINWINDOW_H diff --git a/updater/ProgressWidget.cpp b/updater/ProgressWidget.cpp deleted file mode 100644 index 6129921..0000000 --- a/updater/ProgressWidget.cpp +++ /dev/null @@ -1,158 +0,0 @@ -/*************************************************************************** - * Copyright © 2011 Jonathan Thomas <echidnaman@kubuntu.org> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "ProgressWidget.h" - -// Qt includes -#include <QtCore/QParallelAnimationGroup> -#include <QtCore/QPropertyAnimation> -#include <QtCore/QStringBuilder> -#include <QDebug> -#include <QtWidgets/QLabel> -#include <QtWidgets/QProgressBar> -#include <QtWidgets/QPushButton> -#include <QtWidgets/QVBoxLayout> - -// KDE includes -#include <KFormat> -#include <KMessageBox> -#include <klocalizedstring.h> - -#include <resources/AbstractBackendUpdater.h> -#include <resources/ResourcesUpdatesModel.h> -#include "ui_ProgressWidget.h" - -ProgressWidget::ProgressWidget(ResourcesUpdatesModel* updates, QWidget *parent) - : QWidget(parent) - , m_updater(updates) - , m_lastRealProgress(0) - , m_show(false) - , m_ui(new Ui::ProgressWidget) -{ - m_ui->setupUi(this); - int finalHeight = sizeHint().height() + 20; - - QPropertyAnimation *anim1 = new QPropertyAnimation(this, "maximumHeight", this); - anim1->setDuration(500); - anim1->setEasingCurve(QEasingCurve::OutQuart); - anim1->setStartValue(0); - anim1->setEndValue(finalHeight); - - QPropertyAnimation *anim2 = new QPropertyAnimation(this, "minimumHeight", this); - anim2->setDuration(500); - anim2->setEasingCurve(QEasingCurve::OutQuart); - anim2->setStartValue(0); - anim2->setEndValue(finalHeight); - - m_expandWidget = new QParallelAnimationGroup(this); - m_expandWidget->addAnimation(anim1); - m_expandWidget->addAnimation(anim2); - - QFont f; - f.setPointSizeF(f.pointSizeF()*1.5); - f.setBold(true); - m_ui->header->setFont(f); - - // Connect the transaction all up to our slots - connect(m_updater, SIGNAL(progressChanged()), - this, SLOT(updateProgress())); - connect(m_updater, SIGNAL(downloadSpeedChanged()), - this, SLOT(downloadSpeedChanged())); - connect(m_updater, SIGNAL(etaChanged()), SLOT(etaChanged())); - connect(m_updater, SIGNAL(cancelableChanged()), SLOT(cancelChanged())); - connect(m_updater, SIGNAL(statusMessageChanged(QString)), - m_ui->header, SLOT(setText(QString))); - connect(m_updater, SIGNAL(statusDetailChanged(QString)), - m_ui->details, SLOT(setText(QString))); - connect(m_updater, SIGNAL(progressingChanged(bool)), - SLOT(updateIsProgressing())); - - cancelChanged(); - connect(m_ui->cancel, SIGNAL(clicked()), m_updater, SLOT(cancel())); -} - -ProgressWidget::~ProgressWidget() -{ - delete m_ui; -} - -void ProgressWidget::updateIsProgressing() -{ - m_ui->progress->setMaximum(m_updater->isProgressing() ? 100 : 0); -} - -void ProgressWidget::updateProgress() -{ - qreal progress = m_updater->progress(); - if (progress > 100 || progress<0) { - m_ui->progress->setMaximum(0); - } else if (progress > m_lastRealProgress) { - m_ui->progress->setMaximum(100); - m_ui->progress->setValue(progress); - m_lastRealProgress = progress; - } -} - -void ProgressWidget::downloadSpeedChanged() -{ - quint64 speed = m_updater->downloadSpeed(); - if(speed>0) { - QString downloadSpeed = i18nc("@label Download rate", "Download rate: %1/s", - KFormat().formatByteSize(speed)); - m_ui->downloadSpeed->setText(downloadSpeed); - m_ui->downloadSpeed->show(); - } else { - m_ui->downloadSpeed->clear(); - m_ui->downloadSpeed->hide(); - } -} - -void ProgressWidget::etaChanged() -{ - m_ui->details->setText(m_updater->remainingTime()); -} - -void ProgressWidget::show() -{ - QWidget::show(); - - if (!m_show) { - m_show = true; - // Disconnect from previous animatedHide(), else we'll hide once we finish showing - disconnect(m_expandWidget, SIGNAL(finished()), this, SLOT(hide())); - m_expandWidget->setDirection(QAbstractAnimation::Forward); - m_expandWidget->start(); - } -} - -void ProgressWidget::animatedHide() -{ - m_show = false; - - m_expandWidget->setDirection(QAbstractAnimation::Backward); - m_expandWidget->start(); - connect(m_expandWidget, SIGNAL(finished()), this, SLOT(hide())); - connect(m_expandWidget, SIGNAL(finished()), m_ui->cancel, SLOT(show())); -} - -void ProgressWidget::cancelChanged() -{ - m_ui->cancel->setEnabled(m_updater->isCancelable()); -} diff --git a/updater/ProgressWidget.h b/updater/ProgressWidget.h deleted file mode 100644 index e81b644..0000000 --- a/updater/ProgressWidget.h +++ /dev/null @@ -1,61 +0,0 @@ -/*************************************************************************** - * Copyright © 2011 Jonathan Thomas <echidnaman@kubuntu.org> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef PROGRESSWIDGET_H -#define PROGRESSWIDGET_H - -#include <QtWidgets/QWidget> - -class ResourcesUpdatesModel; -class QLabel; -class QParallelAnimationGroup; -class QPushButton; -class QProgressBar; - -namespace Ui { class ProgressWidget; } - -class ProgressWidget : public QWidget -{ - Q_OBJECT -public: - ProgressWidget(ResourcesUpdatesModel* updates, QWidget *parent); - virtual ~ProgressWidget(); - -private: - ResourcesUpdatesModel* m_updater; - qreal m_lastRealProgress; - bool m_show; - - QParallelAnimationGroup *m_expandWidget; - Ui::ProgressWidget* m_ui; - -public Q_SLOTS: - void show(); - void animatedHide(); - -private Q_SLOTS: - void updateProgress(); - void downloadSpeedChanged(); - void etaChanged(); - void cancelChanged(); - void updateIsProgressing(); -}; - -#endif // PROGRESSWIDGET_H diff --git a/updater/ProgressWidget.ui b/updater/ProgressWidget.ui deleted file mode 100644 index 66fb6cd..0000000 --- a/updater/ProgressWidget.ui +++ /dev/null @@ -1,65 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>ProgressWidget</class> - <widget class="QWidget" name="ProgressWidget"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>400</width> - <height>167</height> - </rect> - </property> - <property name="windowTitle"> - <string>Form</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <widget class="QLabel" name="header"> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <widget class="QProgressBar" name="progress"> - <property name="value"> - <number>24</number> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="cancel"> - <property name="text"> - <string>Cancel</string> - </property> - <property name="icon"> - <iconset theme="dialog-cancel"> - <normaloff/> - </iconset> - </property> - </widget> - </item> - </layout> - </item> - <item> - <widget class="QLabel" name="details"> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="downloadSpeed"> - <property name="text"> - <string/> - </property> - </widget> - </item> - </layout> - </widget> - <resources/> - <connections/> -</ui> diff --git a/updater/UpdateDelegate.cpp b/updater/UpdateDelegate.cpp deleted file mode 100644 index 5d4db41..0000000 --- a/updater/UpdateDelegate.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/*************************************************************************** - * Copyright © 2011 Jonathan Thomas <echidnaman@kubuntu.org> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "UpdateDelegate.h" - -// Qt -#include <QApplication> -#include <QMouseEvent> -#include <QPainter> - -// KDE includes -#include <KIconLoader> - -#define SPACING 4 -#define ICON_SIZE KIconLoader::SizeSmallMedium - -UpdateDelegate::UpdateDelegate(QObject *parent) - : QStyledItemDelegate(parent) -{ -} - -bool UpdateDelegate::editorEvent(QEvent *event, - QAbstractItemModel *model, - const QStyleOptionViewItem &option, - const QModelIndex &index) -{ - bool setData = false; - if (index.column() == 0 && - event->type() == QEvent::MouseButtonRelease) { - } - - const QWidget *widget = nullptr; - if (const QStyleOptionViewItemV4 *v4 = qstyleoption_cast<const QStyleOptionViewItemV4 *>(&option)) { - widget = v4->widget; - } - - QStyle *style = widget ? widget->style() : QApplication::style(); - - // make sure that we have the right event type - if ((event->type() == QEvent::MouseButtonRelease) - || (event->type() == QEvent::MouseButtonDblClick)) { - setData = true; - QStyleOptionViewItemV4 viewOpt(option); - initStyleOption(&viewOpt, index); - QRect checkRect = style->subElementRect(QStyle::SE_ItemViewItemCheckIndicator, &viewOpt, widget); - QMouseEvent *me = static_cast<QMouseEvent*>(event); - if (me->button() != Qt::LeftButton || !checkRect.contains(me->pos())) - return false; - - // eat the double click events inside the check rect - if (event->type() == QEvent::MouseButtonDblClick) - return true; - - setData = true; - } else if (event->type() == QEvent::KeyPress) { - if (static_cast<QKeyEvent*>(event)->key() == Qt::Key_Space - || static_cast<QKeyEvent*>(event)->key() == Qt::Key_Select) { - setData = true; - } - } - - if (setData) { - return model->setData(index, - !index.data(Qt::CheckStateRole).toBool(), - Qt::CheckStateRole); - } - return false; -} - -void UpdateDelegate::initStyleOption(QStyleOptionViewItem *option, const QModelIndex &index) const -{ - QStyledItemDelegate::initStyleOption(option, index); - option->decorationSize = QSize(ICON_SIZE, ICON_SIZE); -} diff --git a/updater/UpdateDelegate.h b/updater/UpdateDelegate.h deleted file mode 100644 index 14357b2..0000000 --- a/updater/UpdateDelegate.h +++ /dev/null @@ -1,43 +0,0 @@ -/*************************************************************************** - * Copyright © 2011 Jonathan Thomas <echidnaman@kubuntu.org> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef UPDATEDELEGATE_H -#define UPDATEDELEGATE_H - -#include <QtWidgets/QStyledItemDelegate> - -class UpdateDelegate : public QStyledItemDelegate -{ - Q_OBJECT -public: - explicit UpdateDelegate(QObject *parent = nullptr); - -protected: - void initStyleOption(QStyleOptionViewItem *option, const QModelIndex &index) const override; - bool editorEvent(QEvent *event, - QAbstractItemModel *model, - const QStyleOptionViewItem &option, - const QModelIndex &index) override; - -private: - int calcItemHeight(const QStyleOptionViewItem &option) const; -}; - -#endif // UPDATEDELEGATE_H diff --git a/updater/UpdaterCentralWidget.ui b/updater/UpdaterCentralWidget.ui deleted file mode 100644 index c5d4804..0000000 --- a/updater/UpdaterCentralWidget.ui +++ /dev/null @@ -1,58 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>UpdaterButtons</class> - <widget class="QWidget" name="UpdaterButtons"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>570</width> - <height>35</height> - </rect> - </property> - <property name="windowTitle"> - <string>Form</string> - </property> - <layout class="QHBoxLayout" name="horizontalLayout"> - <property name="margin"> - <number>0</number> - </property> - <item> - <widget class="QPushButton" name="more"> - <property name="text"> - <string>More...</string> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>427</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QToolButton" name="apply"> - <property name="toolButtonStyle"> - <enum>Qt::ToolButtonTextBesideIcon</enum> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="quit"> - <property name="toolButtonStyle"> - <enum>Qt::ToolButtonTextBesideIcon</enum> - </property> - </widget> - </item> - </layout> - </widget> - <resources/> - <connections/> -</ui> diff --git a/updater/UpdaterWidget.cpp b/updater/UpdaterWidget.cpp deleted file mode 100644 index c7b5033..0000000 --- a/updater/UpdaterWidget.cpp +++ /dev/null @@ -1,240 +0,0 @@ -/*************************************************************************** - * Copyright © 2011 Jonathan Thomas <echidnaman@kubuntu.org> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "UpdaterWidget.h" - -// Qt includes -#include <QStandardItemModel> -#include <QtCore/QDir> -#include <QDateTime> -#include <QtWidgets/QApplication> -#include <QtWidgets/QHeaderView> -#include <QtWidgets/QLabel> -#include <QtWidgets/QTreeView> -#include <QtWidgets/QVBoxLayout> -#include <QAction> -#include <QPushButton> -#include <QDebug> - -// KDE includes -#include <KLocalizedString> -#include <KMessageBox> -#include <KPixmapSequence> -#include <KPixmapSequenceOverlayPainter> -#include <KMessageWidget> -#include <KFormat> -#include <KIconLoader> - -// Libmuon includes -#include <resources/AbstractResourcesBackend.h> -#include <resources/AbstractResource.h> -#include <resources/AbstractBackendUpdater.h> -#include <resources/ResourcesUpdatesModel.h> -#include <resources/ResourcesModel.h> -#include <UpdateModel/UpdateModel.h> -#include <UpdateModel/UpdateItem.h> - -// Own includes -#include "UpdateDelegate.h" -#include "ChangelogWidget.h" -#include "ui_UpdaterWidgetNoUpdates.h" - -UpdaterWidget::UpdaterWidget(ResourcesUpdatesModel* updates, QWidget *parent) : - QStackedWidget(parent), m_updatesBackends(updates) -{ - setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding); - m_updateModel = new UpdateModel(this); - m_updateModel->setBackend(updates); - - // First page (update view) - QWidget *page1 = new QWidget(this); - QVBoxLayout * page1Layout = new QVBoxLayout(page1); - page1Layout->setMargin(0); - page1Layout->setSpacing(0); - page1->setLayout(page1Layout); - - QString text = i18nc("@label", "<em>Some packages were not marked for update.</em><p/>" - "The update of these packages need some others to be installed or removed.<p/>" - "Do you want to update those too?"); - QAction* action = new QAction(QIcon::fromTheme("dialog-ok-apply"), i18n("Mark All"), this); - connect(action, SIGNAL(triggered(bool)), SLOT(markAllPackagesForUpgrade())); - m_markallWidget = new KMessageWidget(this); - m_markallWidget->setText(text); - m_markallWidget->addAction(action); - m_markallWidget->setCloseButtonVisible(true); - m_markallWidget->setVisible(false); - - m_changelogWidget = new ChangelogWidget(this); - m_changelogWidget->hide(); - connect(this, SIGNAL(selectedResourceChanged(AbstractResource*)), - m_changelogWidget, SLOT(setResource(AbstractResource*))); - - QLabel* descriptionLabel = new QLabel(this); - descriptionLabel->setText(i18n("<p><b>New software is available for your computer</b></p><p>Click 'Install Updates' to keep your system up-to-date and safe</p>")); - descriptionLabel->setMinimumHeight(descriptionLabel->fontMetrics().height()*4); - - m_updateView = new QTreeView(page1); - m_updateView->setAlternatingRowColors(true); - m_updateView->setModel(m_updateModel); - m_updateView->header()->setSectionResizeMode(0, QHeaderView::Stretch); - m_updateView->header()->setSectionResizeMode(1, QHeaderView::ResizeToContents); - m_updateView->header()->setSectionResizeMode(2, QHeaderView::ResizeToContents); - m_updateView->header()->setStretchLastSection(false); - connect(m_updateView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), - this, SLOT(selectionChanged(QItemSelection,QItemSelection))); - - page1Layout->addWidget(m_markallWidget); - page1Layout->addWidget(descriptionLabel); - page1Layout->addWidget(m_updateView); - page1Layout->addWidget(m_changelogWidget); - - m_busyWidget = new KPixmapSequenceOverlayPainter(page1); - KPixmapSequence seq = KIconLoader::global()->loadPixmapSequence("process-working", KIconLoader::SizeSmallMedium); - - m_busyWidget->setSequence(seq); - m_busyWidget->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter); - m_busyWidget->setWidget(m_updateView->viewport()); - - UpdateDelegate *delegate = new UpdateDelegate(m_updateView); - m_updateView->setItemDelegate(delegate); - - // Second page (If no updates, show when last check or warn about lack of updates) - QWidget *page2 = new QWidget(this); - m_ui = new Ui::UpdaterWidgetNoUpdates; - m_ui->setupUi(page2); - - addWidget(page1); - addWidget(page2); - setCurrentWidget(page1); - - QApplication::setOverrideCursor(Qt::WaitCursor); - m_busyWidget->start(); - - connect(ResourcesModel::global(), SIGNAL(fetchingChanged()), SLOT(activityChanged())); - connect(ResourcesModel::global(), SIGNAL(updatesCountChanged()), SLOT(activityChanged())); - connect(m_updatesBackends, SIGNAL(progressingChanged(bool)), SLOT(activityChanged())); -} - -UpdaterWidget::~UpdaterWidget() -{ - delete m_ui; -} - -void UpdaterWidget::activityChanged() -{ - if(ResourcesModel::global()->isFetching()) { - m_busyWidget->start(); - setEnabled(false); - setCurrentIndex(0); - } else if(m_updatesBackends->isProgressing()) { - setCurrentIndex(-1); - m_changelogWidget->hide(); - m_busyWidget->start(); - setEnabled(false); - } else { - populateUpdateModel(); - setEnabled(true); - } -} - -void UpdaterWidget::populateUpdateModel() -{ - m_busyWidget->stop(); - QApplication::restoreOverrideCursor(); - setEnabled(true); - checkUpToDate(); - if (!m_updatesBackends->hasUpdates()) { - return; - } - - m_updateView->expand(m_updateModel->index(0,0)); // Expand apps category - m_updateView->resizeColumnToContents(0); - m_updateView->header()->setSectionResizeMode(0, QHeaderView::Stretch); - - checkAllMarked(); - emit modelPopulated(); -} - -void UpdaterWidget::selectionChanged(const QItemSelection &selected, - const QItemSelection &deselected) -{ - Q_UNUSED(deselected); - - QModelIndexList indexes = selected.indexes(); - AbstractResource *res = nullptr; - - if (!indexes.isEmpty()) { - res = m_updateModel->itemFromIndex(indexes.first())->app(); - } - - emit selectedResourceChanged(res); -} - -void UpdaterWidget::checkAllMarked() -{ - m_markallWidget->setVisible(!m_updatesBackends->isAllMarked()); -} - -void UpdaterWidget::markAllPackagesForUpgrade() -{ - m_updatesBackends->prepare(); - m_markallWidget->hide(); - emit modelPopulated(); -} - -void UpdaterWidget::checkUpToDate() -{ - const QDateTime lastUpdate = m_updatesBackends->lastUpdate(); - const qint64 msecSinceUpdate = lastUpdate.msecsTo(QDateTime::currentDateTime()); - const qint64 day = 1000 * 60 * 60 * 24; - const qint64 week = 1000 * 60 * 60 * 24 * 7; - - if((!m_updatesBackends->hasUpdates() && !ResourcesModel::global()->isFetching()) || msecSinceUpdate > week) { - setCurrentIndex(1); - - // Unknown time since last update - if (!lastUpdate.isValid()) { - m_ui->updateStatusIcon->setPixmap(QIcon::fromTheme("security-medium").pixmap(128, 128)); - m_ui->notifyTitle->setText(i18nc("@info", - "It is unknown when the last check for updates was.")); - m_ui->notifyDesc->setText(i18nc("@info", "Please click <em>Check for Updates</em> " - "to check.")); - return; - } - - if (msecSinceUpdate < day) { - m_ui->updateStatusIcon->setPixmap(QIcon::fromTheme("security-high").pixmap(128, 128)); - m_ui->notifyTitle->setText(i18nc("@info", "The software on this computer is up to date.")); - m_ui->notifyDesc->setText(i18nc("@info", "Last checked %1 ago.", - KFormat().formatDecimalDuration(msecSinceUpdate, 0))); - } else if (msecSinceUpdate < week) { - m_ui->updateStatusIcon->setPixmap(QIcon::fromTheme("security-medium").pixmap(128, 128)); - m_ui->notifyTitle->setText(i18nc("@info", "No updates are available.")); - m_ui->notifyDesc->setText(i18nc("@info", "Last checked %1 ago.", - KFormat().formatDecimalDuration(msecSinceUpdate, 0))); - } else { - m_ui->updateStatusIcon->setPixmap(QIcon::fromTheme("security-low").pixmap(128, 128)); - m_ui->notifyTitle->setText(i18nc("@info", "The last check for updates was over a week ago.")); - m_ui->notifyDesc->setText(i18nc("@info", "Please click <em>Check for Updates</em> " - "to check.")); - } - } else - setCurrentIndex(0); -} diff --git a/updater/UpdaterWidget.h b/updater/UpdaterWidget.h deleted file mode 100644 index e778ddd..0000000 --- a/updater/UpdaterWidget.h +++ /dev/null @@ -1,75 +0,0 @@ -/*************************************************************************** - * Copyright © 2011 Jonathan Thomas <echidnaman@kubuntu.org> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#ifndef UPDATERWIDGET_H -#define UPDATERWIDGET_H - -#include <QtWidgets/QStackedWidget> - -class ResourcesUpdatesModel; -class KMessageWidget; -class AbstractResource; -class AbstractResourcesBackend; -class QItemSelection; -class QLabel; -class QStandardItemModel; -class QTreeView; -class ChangelogWidget; - -class KPixmapSequenceOverlayPainter; -class UpdateModel; - -namespace Ui { - class UpdaterWidgetNoUpdates; -} - -class UpdaterWidget : public QStackedWidget -{ - Q_OBJECT -public: - explicit UpdaterWidget(ResourcesUpdatesModel* updates, QWidget* parent = nullptr); - virtual ~UpdaterWidget(); - -private: - UpdateModel *m_updateModel; - - QTreeView *m_updateView; - ChangelogWidget *m_changelogWidget; - KPixmapSequenceOverlayPainter *m_busyWidget; - ResourcesUpdatesModel* m_updatesBackends; - KMessageWidget* m_markallWidget; - Ui::UpdaterWidgetNoUpdates* m_ui; - -private Q_SLOTS: - void populateUpdateModel(); - void selectionChanged(const QItemSelection &selected, - const QItemSelection &deselected); - void checkAllMarked(); - void checkUpToDate(); - void markAllPackagesForUpgrade(); - - void activityChanged(); - -signals: - void selectedResourceChanged(AbstractResource* res); - void modelPopulated(); -}; - -#endif // UPDATERWIDGET_H diff --git a/updater/UpdaterWidgetNoUpdates.ui b/updater/UpdaterWidgetNoUpdates.ui deleted file mode 100644 index e5c0d0b..0000000 --- a/updater/UpdaterWidgetNoUpdates.ui +++ /dev/null @@ -1,61 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>UpdaterWidgetNoUpdates</class> - <widget class="QWidget" name="UpdaterWidgetNoUpdates"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>400</width> - <height>300</height> - </rect> - </property> - <property name="windowTitle"> - <string>Form</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <widget class="QFrame" name="frame"> - <property name="frameShape"> - <enum>QFrame::StyledPanel</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Sunken</enum> - </property> - <layout class="QGridLayout" name="gridLayout"> - <item row="1" column="1"> - <widget class="QLabel" name="notifyDesc"> - <property name="alignment"> - <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> - </property> - </widget> - </item> - <item row="0" column="0" rowspan="2"> - <widget class="QLabel" name="updateStatusIcon"> - <property name="alignment"> - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QLabel" name="notifyTitle"> - <property name="alignment"> - <set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QLabel" name="notifyDesc"> - <property name="alignment"> - <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> - </property> - </widget> - </item> - </layout> - </widget> - </item> - </layout> - </widget> - <resources/> - <connections/> -</ui> diff --git a/updater/main.cpp b/updater/main.cpp deleted file mode 100644 index fb8229b..0000000 --- a/updater/main.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/*************************************************************************** - * Copyright © 2010-2013 Jonathan Thomas <echidnaman@kubuntu.org> * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * 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, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include "MainWindow.h" -#include <MuonBackendsFactory.h> - -#include <QApplication> -#include <QCommandLineParser> -#include <QCommandLineOption> -#include <KAboutData> -#include <klocalizedstring.h> -#include <kdbusservice.h> -#include "../MuonVersion.h" - -int main(int argc, char **argv) -{ - QApplication app(argc, argv); - app.setWindowIcon(QIcon::fromTheme("system-software-update")); - KLocalizedString::setApplicationDomain("muon-updater"); - KAboutData about("muonupdater", i18n("Muon Update Manager"), version, i18n("An update manager"), - KAboutLicense::GPL, i18n("©2010-2013 Jonathan Thomas"), QString(), nullptr); - about.addAuthor(i18n("Jonathan Thomas"), QString(), "echidnaman@kubuntu.org"); - about.addAuthor(i18n("Aleix Pol"), QString(), "aleixpol@kde.org"); - about.setProductName("muon/updater"); - KAboutData::setApplicationData(about); - - { - QCommandLineParser parser; - parser.addOption(QCommandLineOption("backends", i18n("List all the backends we'll want to have loaded, separated by coma ','."), "names")); - MuonBackendsFactory::setupCommandLine(&parser); - about.setupCommandLine(&parser); - parser.addHelpOption(); - parser.addVersionOption(); - parser.process(app); - about.processCommandLine(&parser); - MuonBackendsFactory::processCommandLine(&parser); - } - - KDBusService service(KDBusService::Unique); -// app.disableSessionManagement(); - - - MainWindow *mainWindow = new MainWindow; - mainWindow->show(); - QObject::connect(&service, &KDBusService::activateRequested, mainWindow, &QWidget::raise); - - return app.exec(); -} diff --git a/updater/muon-updater.desktop b/updater/muon-updater.desktop deleted file mode 100644 index 7d61517..0000000 --- a/updater/muon-updater.desktop +++ /dev/null @@ -1,100 +0,0 @@ -[Desktop Entry] -Name=Muon Update Manager -Name[ast]=Xestor d'anovamientos Muon -Name[bg]=Мениджър на обновленията Muon -Name[bs]=Muon menadžer nadogradnje -Name[ca]=Gestor d'actualitzacions Muon -Name[ca@valencia]=Gestor d'actualitzacions Muon -Name[cs]=Správce aktualizací Muon -Name[da]=Muon håndtering af opdateringer -Name[de]=Muon-Aktualisierungsverwaltung -Name[el]=Διαχειριστής ενημερώσεων Muon -Name[en_GB]=Muon Update Manager -Name[es]=Gestor de actualizaciones de Muon -Name[et]=Muoni uuenduste haldur -Name[fi]=Muon-päivitystenhallinta -Name[fr]=Gestionnaire de mises à jour de Muon -Name[ga]=Bainisteoir Nuashonruithe Muon -Name[gl]=Xestor de actualizacións de Muon -Name[hu]=Muon frissítéskezelő -Name[id]=Manajer Pembaruan Muon -Name[it]=Gestore Aggiornamenti Muon -Name[kk]=Muon жаңарту менеджері -Name[ko]=Muon 업데이트 관리자 -Name[lt]=Muon atnaujinimų tvarkyklė -Name[mr]=म्युओन अद्ययावत व्यवस्थापक -Name[nb]=Muon oppdateringsbehandler -Name[nds]=Opfrischen-Pleger „Muon“ -Name[nl]=Muon beheerder voor bijwerken -Name[nn]=Muon oppdateringshandsamar -Name[pa]=ਮੂਉਨ ਅੱਪਡੇਟ ਮੈਨੇਜਰ -Name[pl]=Zarządzanie uaktualnieniami Muon -Name[pt]=Gestor de Actualizações Muon -Name[pt_BR]=Gerenciador de atualizações do Muon -Name[ro]=Administratorul de actualizări Muon -Name[ru]=Менеджер Muon для обновлений -Name[sk]=Správca aktualizácií Muon -Name[sl]=Upravljalnik posodobitev Muon -Name[sr]=Муонов менаџер ажурирања -Name[sr@ijekavian]=Муонов менаџер ажурирања -Name[sr@ijekavianlatin]=Muonov menadžer ažuriranja -Name[sr@latin]=Muonov menadžer ažuriranja -Name[sv]=Muon uppdateringshanterare -Name[tr]=Muon Güncelleştirme Yöneticisi -Name[ug]=يېڭىلانما باشقۇرغۇ Muon -Name[uk]=Керування оновленнями -Name[x-test]=xxMuon Update Managerxx -Name[zh_CN]=Muon 更新管理器 -Name[zh_TW]=Muon 更新管理員 -Exec=muon-updater -Icon=system-software-update -Type=Application -X-DocPath=muon/index.html -GenericName=Update Manager -GenericName[ast]=Xestor d'anovamientos -GenericName[bg]=Мениджър на обновленията -GenericName[bs]=Menadžer nadogradnji -GenericName[ca]=Gestor d'actualitzacions -GenericName[ca@valencia]=Gestor d'actualitzacions -GenericName[cs]=Správce aktualizací -GenericName[da]=Håndtering af opdateringer -GenericName[de]=Aktualisierungsverwaltung -GenericName[el]=Διαχειριστής ενημερώσεων -GenericName[en_GB]=Update Manager -GenericName[es]=Gestor de actualizaciones -GenericName[et]=Uuenduste haldur -GenericName[fi]=Päivitystenhallinta -GenericName[fr]=Gestionnaire de mises à jour -GenericName[ga]=Bainisteoir Nuashonruithe -GenericName[gl]=Xestor de actualizacións -GenericName[hu]=Frissítéskezelő -GenericName[id]=Manajer Pembaruan -GenericName[it]=Gestore degli aggiornamenti -GenericName[kk]=Жаңарту менеджері -GenericName[ko]=업데이트 관리자 -GenericName[lt]=Atnaujinimų tvarkyklė -GenericName[mr]=अद्ययावत व्यवस्थापक -GenericName[nb]=Oppdateringsbehandler -GenericName[nds]=Opfrischen-Pleger -GenericName[nl]=Beheerder voor bijwerken -GenericName[nn]=Oppdateringshandsamar -GenericName[pa]=ਅੱਪਡੇਟ ਮੈਨੇਜਰ -GenericName[pl]=Zarządzanie uaktualnieniami -GenericName[pt]=Gestor de Actualizações -GenericName[pt_BR]=Gerenciador de atualizações -GenericName[ro]=Administrator de actualizări -GenericName[ru]=Менеджер обновлений -GenericName[sk]=Správca aktualizácií -GenericName[sl]=Upravljalnik posodobitev -GenericName[sr]=Менаџер ажурирања -GenericName[sr@ijekavian]=Менаџер ажурирања -GenericName[sr@ijekavianlatin]=Menadžer ažuriranja -GenericName[sr@latin]=Menadžer ažuriranja -GenericName[sv]=Uppdateringshanterare -GenericName[tr]=Güncelleştirme Yöneticisi -GenericName[ug]=يېڭىلانما باشقۇرغۇ(Update Manager) -GenericName[uk]=Керування оновленнями -GenericName[x-test]=xxUpdate Managerxx -GenericName[zh_CN]=更新管理器 -GenericName[zh_TW]=更新管理員 -Categories=Qt;KDE;System; diff --git a/updater/muonupdaterui.rc b/updater/muonupdaterui.rc deleted file mode 100644 index 5ccbce8..0000000 --- a/updater/muonupdaterui.rc +++ /dev/null @@ -1,39 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<gui name="muon-updater" - version="1" - xmlns="http://www.kde.org/standards/kxmlgui/1.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://www.kde.org/standards/kxmlgui/1.0 - http://www.kde.org/standards/kxmlgui/1.0/kxmlgui.xsd"> - <MenuBar> - <Menu name="file" > - <Separator/> - <Action name="save_download_list" /> - <Action name="download_from_list" /> - <Action name="load_archives" /> - <Separator/> - <Action name="file_quit" /> - </Menu> - <Menu name="edit" > - <Action name="undo" /> - <Action name="redo" /> - <Separator/> - <Action name="update" /> - <Separator/> - <Action name="apply" /> - </Menu> - <Menu name="view" > - <Action name="history" /> - </Menu> - <Menu name="settings"> - <Separator /> - <Action name="software_properties" /> - </Menu> - </MenuBar> - <ToolBar name="mainToolBar"> - <Action name="apply" /> - <Action name="file_quit" /> - <Separator/> - <Action name="update" /> - </ToolBar> -</gui> |
