implement uninstall()
This commit is contained in:
parent
bf9aefb9ad
commit
d7aa34cc6c
@ -709,6 +709,8 @@ KJob* Package::install(const QString &sourcePackage, const QString &packageRoot)
|
|||||||
|
|
||||||
KJob* Package::uninstall(const QString &packageName, const QString &packageRoot)
|
KJob* Package::uninstall(const QString &packageName, const QString &packageRoot)
|
||||||
{
|
{
|
||||||
|
//FIXME:packageName unused, name taken from metadata().pluginName() ?
|
||||||
|
//can this become either just uninstall() otherwise maintain parameters and be static?
|
||||||
|
|
||||||
const QString pname = metadata().pluginName();
|
const QString pname = metadata().pluginName();
|
||||||
|
|
||||||
|
@ -66,7 +66,6 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void initFilters();
|
void initFilters();
|
||||||
void init(Plasma::Types::Location loc);
|
|
||||||
void initRunningApplets();
|
void initRunningApplets();
|
||||||
void containmentDestroyed();
|
void containmentDestroyed();
|
||||||
void setLocation(Plasma::Types::Location loc);
|
void setLocation(Plasma::Types::Location loc);
|
||||||
@ -149,47 +148,6 @@ void WidgetExplorerPrivate::initFilters()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WidgetExplorerPrivate::init(Plasma::Types::Location loc)
|
|
||||||
{
|
|
||||||
// q->setFocusPolicy(Qt::StrongFocus);
|
|
||||||
|
|
||||||
//init widgets
|
|
||||||
location = loc;
|
|
||||||
orientation = ((location == Plasma::Types::LeftEdge || location == Plasma::Types::RightEdge)?Qt::Vertical:Qt::Horizontal);
|
|
||||||
// mainLayout = new QGraphicsLinearLayout(Qt::Vertical);
|
|
||||||
// mainLayout->setContentsMargins(0, 0, 0, 0);
|
|
||||||
// mainLayout->setSpacing(0);
|
|
||||||
|
|
||||||
//connect
|
|
||||||
//QObject::connect(filteringWidget, SIGNAL(closeClicked()), q, SIGNAL(closeClicked()));
|
|
||||||
|
|
||||||
initRunningApplets();
|
|
||||||
|
|
||||||
filterItemModel.setSortCaseSensitivity(Qt::CaseInsensitive);
|
|
||||||
filterItemModel.setDynamicSortFilter(true);
|
|
||||||
filterItemModel.setSourceModel(&itemModel);
|
|
||||||
filterItemModel.sort(0);
|
|
||||||
// Plasma::PackageStructure::Ptr structure = Plasma::PackageStructure::load("Plasma/Generic");
|
|
||||||
// package = new Plasma::Package(QString(), "org.kde.desktop.widgetexplorer", structure);
|
|
||||||
//
|
|
||||||
// declarativeWidget = new Plasma::DeclarativeWidget(q);
|
|
||||||
// declarativeWidget->setInitializationDelayed(true);
|
|
||||||
// declarativeWidget->setQmlPath(package->filePath("mainscript"));
|
|
||||||
// mainLayout->addItem(declarativeWidget);
|
|
||||||
//
|
|
||||||
// if (declarativeWidget->engine()) {
|
|
||||||
// QDeclarativeContext *ctxt = declarativeWidget->engine()->rootContext();
|
|
||||||
// if (ctxt) {
|
|
||||||
// filterItemModel.setSortCaseSensitivity(Qt::CaseInsensitive);
|
|
||||||
// filterItemModel.setDynamicSortFilter(true);
|
|
||||||
// filterItemModel.setSourceModel(&itemModel);
|
|
||||||
// filterItemModel.sort(0);
|
|
||||||
// ctxt->setContextProperty("widgetExplorer", q);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// q->setLayout(mainLayout);
|
|
||||||
}
|
|
||||||
|
|
||||||
void WidgetExplorerPrivate::setLocation(const Plasma::Types::Location loc)
|
void WidgetExplorerPrivate::setLocation(const Plasma::Types::Location loc)
|
||||||
{
|
{
|
||||||
@ -344,20 +302,17 @@ void WidgetExplorerPrivate::appletRemoved(Plasma::Applet *applet)
|
|||||||
|
|
||||||
//WidgetExplorer
|
//WidgetExplorer
|
||||||
|
|
||||||
WidgetExplorer::WidgetExplorer(Plasma::Types::Location loc, QObject *parent)
|
|
||||||
:QObject(parent),
|
|
||||||
d(new WidgetExplorerPrivate(this))
|
|
||||||
{
|
|
||||||
d->init(loc);
|
|
||||||
populateWidgetList();
|
|
||||||
}
|
|
||||||
|
|
||||||
WidgetExplorer::WidgetExplorer(QObject *parent)
|
WidgetExplorer::WidgetExplorer(QObject *parent)
|
||||||
:QObject(parent),
|
:QObject(parent),
|
||||||
d(new WidgetExplorerPrivate(this))
|
d(new WidgetExplorerPrivate(this))
|
||||||
{
|
{
|
||||||
d->init(Plasma::Types::LeftEdge);
|
setLocation(Plasma::Types::LeftEdge);
|
||||||
populateWidgetList();
|
populateWidgetList();
|
||||||
|
d->initRunningApplets();
|
||||||
|
d->filterItemModel.setSortCaseSensitivity(Qt::CaseInsensitive);
|
||||||
|
d->filterItemModel.setDynamicSortFilter(true);
|
||||||
|
d->filterItemModel.setSourceModel(&d->itemModel);
|
||||||
|
d->filterItemModel.sort(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
WidgetExplorer::~WidgetExplorer()
|
WidgetExplorer::~WidgetExplorer()
|
||||||
@ -475,27 +430,7 @@ void WidgetExplorer::immutabilityChanged(Plasma::Types::ImmutabilityType type)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WidgetExplorer::event(QEvent *event)
|
|
||||||
{
|
|
||||||
switch (event->type()) {
|
|
||||||
case QEvent::ActionAdded:
|
|
||||||
case QEvent::ActionChanged:
|
|
||||||
case QEvent::ActionRemoved:
|
|
||||||
//if (d->declarativeWidget->rootObject()) {
|
|
||||||
emit widgetsMenuActionsChanged();
|
|
||||||
//}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return QObject::event(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
void WidgetExplorer::focusInEvent(QFocusEvent* event)
|
|
||||||
{
|
|
||||||
Q_UNUSED(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
void WidgetExplorer::downloadWidgets(const QString &type)
|
void WidgetExplorer::downloadWidgets(const QString &type)
|
||||||
{
|
{
|
||||||
@ -523,7 +458,6 @@ void WidgetExplorer::downloadWidgets(const QString &type)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
emit closeClicked();
|
|
||||||
if (installer) {
|
if (installer) {
|
||||||
//installer->createNewWidgetBrowser();
|
//installer->createNewWidgetBrowser();
|
||||||
} else {
|
} else {
|
||||||
@ -543,11 +477,11 @@ void WidgetExplorer::downloadWidgets(const QString &type)
|
|||||||
knsDialog->raise();
|
knsDialog->raise();
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WidgetExplorer::openWidgetFile()
|
void WidgetExplorer::openWidgetFile()
|
||||||
{
|
{
|
||||||
emit closeClicked();
|
|
||||||
/*
|
/*
|
||||||
Plasma::OpenWidgetAssistant *assistant = d->openAssistant.data();
|
Plasma::OpenWidgetAssistant *assistant = d->openAssistant.data();
|
||||||
if (!assistant) {
|
if (!assistant) {
|
||||||
@ -561,14 +495,16 @@ void WidgetExplorer::openWidgetFile()
|
|||||||
assistant->raise();
|
assistant->raise();
|
||||||
assistant->setFocus();
|
assistant->setFocus();
|
||||||
*/
|
*/
|
||||||
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WidgetExplorer::uninstall(const QString &pluginName)
|
void WidgetExplorer::uninstall(const QString &pluginName)
|
||||||
{
|
{
|
||||||
Plasma::PackageStructure installer;
|
const QString packageRoot = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/plasma/plasmoids/";
|
||||||
qWarning() << "FIXME: uninstall needs reimplementation";
|
|
||||||
//installer.uninstallPackage(pluginName,
|
Plasma::Package pkg;
|
||||||
// QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1Char('/') + "plasma/plasmoids/");
|
pkg.setPath(packageRoot);
|
||||||
|
pkg.uninstall(pluginName, packageRoot);
|
||||||
|
|
||||||
//FIXME: moreefficient way rather a linear scan?
|
//FIXME: moreefficient way rather a linear scan?
|
||||||
for (int i = 0; i < d->itemModel.rowCount(); ++i) {
|
for (int i = 0; i < d->itemModel.rowCount(); ++i) {
|
||||||
|
@ -102,7 +102,6 @@ public:
|
|||||||
RightEdge /**< Along the right side of the screen */
|
RightEdge /**< Along the right side of the screen */
|
||||||
};
|
};
|
||||||
|
|
||||||
explicit WidgetExplorer(Plasma::Types::Location loc, QObject *parent = 0);
|
|
||||||
explicit WidgetExplorer(QObject *parent = 0);
|
explicit WidgetExplorer(QObject *parent = 0);
|
||||||
~WidgetExplorer();
|
~WidgetExplorer();
|
||||||
|
|
||||||
@ -159,6 +158,9 @@ public:
|
|||||||
QList <QObject *> widgetsMenuActions();
|
QList <QObject *> widgetsMenuActions();
|
||||||
QList <QObject *> extraActions() const;
|
QList <QObject *> extraActions() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uninstall a plasmoid with a given plugin name. only user-installed ones are uninstallable
|
||||||
|
*/
|
||||||
Q_INVOKABLE void uninstall(const QString &pluginName);
|
Q_INVOKABLE void uninstall(const QString &pluginName);
|
||||||
|
|
||||||
Q_INVOKABLE void close();
|
Q_INVOKABLE void close();
|
||||||
@ -167,7 +169,6 @@ public:
|
|||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void locationChanged(Plasma::Types::Location loc);
|
void locationChanged(Plasma::Types::Location loc);
|
||||||
void orientationChanged();
|
void orientationChanged();
|
||||||
void closeClicked();
|
|
||||||
void widgetsMenuActionsChanged();
|
void widgetsMenuActionsChanged();
|
||||||
void extraActionsChanged();
|
void extraActionsChanged();
|
||||||
|
|
||||||
@ -182,11 +183,6 @@ public Q_SLOTS:
|
|||||||
protected Q_SLOTS:
|
protected Q_SLOTS:
|
||||||
void immutabilityChanged(Plasma::Types::ImmutabilityType);
|
void immutabilityChanged(Plasma::Types::ImmutabilityType);
|
||||||
|
|
||||||
protected:
|
|
||||||
void keyPressEvent(QKeyEvent *e);
|
|
||||||
bool event(QEvent *e);
|
|
||||||
void focusInEvent(QFocusEvent * event);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_PRIVATE_SLOT(d, void appletAdded(Plasma::Applet*))
|
Q_PRIVATE_SLOT(d, void appletAdded(Plasma::Applet*))
|
||||||
Q_PRIVATE_SLOT(d, void appletRemoved(Plasma::Applet*))
|
Q_PRIVATE_SLOT(d, void appletRemoved(Plasma::Applet*))
|
||||||
|
Loading…
Reference in New Issue
Block a user