cleanupanddelete is qgv specific too
This commit is contained in:
parent
abadc77276
commit
c8a1b35f78
1
applet.h
1
applet.h
@ -1020,6 +1020,7 @@ class PLASMA_EXPORT Applet : public QGraphicsWidget
|
||||
friend class AppletHandle;
|
||||
friend class AppletPrivate;
|
||||
friend class AccessAppletJobPrivate;
|
||||
friend class GraphicsViewAppletPrivate;
|
||||
friend class PluginLoader;
|
||||
friend class PopupApplet;
|
||||
friend class PopupAppletPrivate;
|
||||
|
@ -238,6 +238,44 @@ void GraphicsViewAppletPrivate::updateFailedToLaunch(const QString &reason)
|
||||
q->update();
|
||||
}
|
||||
|
||||
void GraphicsViewAppletPrivate::cleanUpAndDelete()
|
||||
{
|
||||
//kDebug() << "???????????????? DESTROYING APPLET" << q->name() << q->scene() << " ???????????????????????????";
|
||||
QGraphicsWidget *parent = dynamic_cast<QGraphicsWidget *>(q->parentItem());
|
||||
//it probably won't matter, but right now if there are applethandles, *they* are the parent.
|
||||
//not the containment.
|
||||
|
||||
//is the applet in a containment and does the containment have a layout?
|
||||
//if yes, we remove the applet in the layout
|
||||
if (parent && parent->layout()) {
|
||||
QGraphicsLayout *l = parent->layout();
|
||||
for (int i = 0; i < l->count(); ++i) {
|
||||
if (q == l->itemAt(i)) {
|
||||
l->removeAt(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (configLoader) {
|
||||
configLoader->setDefaults();
|
||||
}
|
||||
|
||||
resetConfigurationObject();
|
||||
|
||||
if (q->scene()) {
|
||||
if (isContainment) {
|
||||
// prematurely emit our destruction if we are a Containment,
|
||||
// giving Corona a chance to remove this Containment from its collection
|
||||
emit q->QObject::destroyed(q);
|
||||
}
|
||||
|
||||
q->scene()->removeItem(q);
|
||||
}
|
||||
|
||||
q->deleteLater();
|
||||
}
|
||||
|
||||
void GraphicsViewAppletPrivate::showConfigurationRequiredMessage(bool show, const QString &reason)
|
||||
{
|
||||
if (!show) {
|
||||
@ -287,7 +325,6 @@ void GraphicsViewAppletPrivate::showConfigurationRequiredMessage(bool show, cons
|
||||
messageOverlay->show();
|
||||
}
|
||||
|
||||
|
||||
void GraphicsViewAppletPrivate::createMessageOverlay(bool usePopup)
|
||||
{
|
||||
if (messageOverlay) {
|
||||
|
@ -46,6 +46,7 @@ class GraphicsViewAppletPrivate : public QObject, public AppletPrivate
|
||||
|
||||
public:
|
||||
GraphicsViewAppletPrivate(KService::Ptr service, const KPluginInfo *info, int uniqueID, Applet *applet);
|
||||
void cleanUpAndDelete();
|
||||
void showConfigurationRequiredMessage(bool show, const QString &reason);
|
||||
void showMessage(const QIcon &icon, const QString &message, const MessageButtons buttons);
|
||||
void positionMessageOverlay();
|
||||
|
@ -83,6 +83,7 @@ public:
|
||||
|
||||
// the interface
|
||||
virtual void showConfigurationRequiredMessage(bool show, const QString &reason);
|
||||
virtual void cleanUpAndDelete();
|
||||
virtual void showMessage(const QIcon &icon, const QString &message, const MessageButtons buttons);
|
||||
virtual void positionMessageOverlay();
|
||||
virtual void setBusy(bool busy);
|
||||
@ -110,7 +111,6 @@ public:
|
||||
void selectItemToDestroy();
|
||||
void updateRect(const QRectF &rect);
|
||||
void setFocus();
|
||||
void cleanUpAndDelete();
|
||||
void addGlobalShortcutsPage(KConfigDialog *dialog);
|
||||
void addPublishPage(KConfigDialog *dialog);
|
||||
void configDialogFinished();
|
||||
|
@ -231,40 +231,7 @@ void AppletPrivate::updateRect(const QRectF &rect)
|
||||
|
||||
void AppletPrivate::cleanUpAndDelete()
|
||||
{
|
||||
//kDebug() << "???????????????? DESTROYING APPLET" << q->name() << q->scene() << " ???????????????????????????";
|
||||
QGraphicsWidget *parent = dynamic_cast<QGraphicsWidget *>(q->parentItem());
|
||||
//it probably won't matter, but right now if there are applethandles, *they* are the parent.
|
||||
//not the containment.
|
||||
|
||||
//is the applet in a containment and does the containment have a layout?
|
||||
//if yes, we remove the applet in the layout
|
||||
if (parent && parent->layout()) {
|
||||
QGraphicsLayout *l = parent->layout();
|
||||
for (int i = 0; i < l->count(); ++i) {
|
||||
if (q == l->itemAt(i)) {
|
||||
l->removeAt(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (configLoader) {
|
||||
configLoader->setDefaults();
|
||||
}
|
||||
|
||||
resetConfigurationObject();
|
||||
|
||||
if (q->scene()) {
|
||||
if (isContainment) {
|
||||
// prematurely emit our destruction if we are a Containment,
|
||||
// giving Corona a chance to remove this Containment from its collection
|
||||
emit q->QObject::destroyed(q);
|
||||
}
|
||||
|
||||
q->scene()->removeItem(q);
|
||||
}
|
||||
|
||||
q->deleteLater();
|
||||
// reimplemented in the UI specific library
|
||||
}
|
||||
|
||||
void AppletPrivate::showConfigurationRequiredMessage(bool show, const QString &reason)
|
||||
|
Loading…
x
Reference in New Issue
Block a user