API change: instead of Containment having activityId functions, it just
exposes the whole Context*. The activity functions have to be left in for BC, and they still work as they did before. svn path=/trunk/KDE/kdelibs/; revision=1125570
This commit is contained in:
parent
4e07d87284
commit
ffc6ae289e
@ -359,7 +359,7 @@ void Containment::restore(KConfigGroup &group)
|
|||||||
setScreen(group.readEntry("screen", d->screen), group.readEntry("desktop", d->desktop));
|
setScreen(group.readEntry("screen", d->screen), group.readEntry("desktop", d->desktop));
|
||||||
QString activityId = group.readEntry("activityId", QString());
|
QString activityId = group.readEntry("activityId", QString());
|
||||||
if (!activityId.isEmpty()) {
|
if (!activityId.isEmpty()) {
|
||||||
setActivityId(activityId);
|
d->context()->setCurrentActivityId(activityId);
|
||||||
}
|
}
|
||||||
setActivity(group.readEntry("activity", QString()));
|
setActivity(group.readEntry("activity", QString()));
|
||||||
|
|
||||||
@ -1971,39 +1971,34 @@ void Containment::setActivity(const QString &activity)
|
|||||||
Context *context = d->context();
|
Context *context = d->context();
|
||||||
if (context->currentActivity() != activity) {
|
if (context->currentActivity() != activity) {
|
||||||
context->setCurrentActivity(activity);
|
context->setCurrentActivity(activity);
|
||||||
|
|
||||||
foreach (Applet *a, d->applets) {
|
|
||||||
a->updateConstraints(ContextConstraint);
|
|
||||||
}
|
|
||||||
|
|
||||||
KConfigGroup c = config();
|
|
||||||
c.writeEntry("activity", activity);
|
|
||||||
|
|
||||||
if (d->toolBox) {
|
|
||||||
d->toolBox.data()->update();
|
|
||||||
}
|
|
||||||
emit configNeedsSaving();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Containment::setActivityId(const QString &activity)
|
void ContainmentPrivate::onContextChanged(Plasma::Context *con)
|
||||||
{
|
{
|
||||||
Context *context = d->context();
|
foreach (Applet *a, applets) {
|
||||||
if (context->currentActivityId() != activity) {
|
|
||||||
context->setCurrentActivityId(activity);
|
|
||||||
|
|
||||||
foreach (Applet *a, d->applets) {
|
|
||||||
a->updateConstraints(ContextConstraint);
|
a->updateConstraints(ContextConstraint);
|
||||||
}
|
}
|
||||||
|
|
||||||
KConfigGroup c = config();
|
KConfigGroup c = q->config();
|
||||||
c.writeEntry("activityId", activity);
|
QString act = con->currentActivityId();
|
||||||
|
|
||||||
if (d->toolBox) {
|
//save anything that's been set (boy I hope this avoids overwriting things)
|
||||||
d->toolBox.data()->update();
|
//FIXME of course if the user sets the name to an empty string we have a bug
|
||||||
|
//but once we get context retrieving the name as soon as the id is set, this issue should go away
|
||||||
|
if (!act.isEmpty()) {
|
||||||
|
c.writeEntry("activityId", act);
|
||||||
}
|
}
|
||||||
emit configNeedsSaving();
|
act = con->currentActivity();
|
||||||
|
if (!act.isEmpty()) {
|
||||||
|
c.writeEntry("activity", act);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (toolBox) {
|
||||||
|
toolBox.data()->update();
|
||||||
|
}
|
||||||
|
emit q->configNeedsSaving();
|
||||||
|
emit q->contextChanged(con);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Containment::activity() const
|
QString Containment::activity() const
|
||||||
@ -2011,9 +2006,9 @@ QString Containment::activity() const
|
|||||||
return d->context()->currentActivity();
|
return d->context()->currentActivity();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Containment::activityId() const
|
Context *Containment::context() const
|
||||||
{
|
{
|
||||||
return d->context()->currentActivityId();
|
return d->context();
|
||||||
}
|
}
|
||||||
|
|
||||||
Context *ContainmentPrivate::context()
|
Context *ContainmentPrivate::context()
|
||||||
@ -2021,9 +2016,7 @@ Context *ContainmentPrivate::context()
|
|||||||
if (!con) {
|
if (!con) {
|
||||||
con = new Context(q);
|
con = new Context(q);
|
||||||
q->connect(con, SIGNAL(changed(Plasma::Context*)),
|
q->connect(con, SIGNAL(changed(Plasma::Context*)),
|
||||||
q, SIGNAL(contextChanged(Plasma::Context*)));
|
q, SLOT(onContextChanged(Plasma::Context*)));
|
||||||
q->connect(con, SIGNAL(activityChanged(Plasma::Context*)),
|
|
||||||
q, SIGNAL(activityNameChanged(Plasma::Context*)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return con;
|
return con;
|
||||||
|
@ -352,18 +352,10 @@ class PLASMA_EXPORT Containment : public Applet
|
|||||||
QString activity() const;
|
QString activity() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the current activity by id
|
* @return the context for this containment
|
||||||
*
|
|
||||||
* @param activity the id of the activity
|
|
||||||
* @since 4.5
|
* @since 4.5
|
||||||
*/
|
*/
|
||||||
void setActivityId(const QString &activity);
|
Context* context() const;
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the current activity id associated with this containment
|
|
||||||
* @since 4.5
|
|
||||||
*/
|
|
||||||
QString activityId() const;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shows the context menu for the containment directly, bypassing Applets
|
* Shows the context menu for the containment directly, bypassing Applets
|
||||||
@ -464,11 +456,6 @@ class PLASMA_EXPORT Containment : public Applet
|
|||||||
* The context associated to this containment has changed
|
* The context associated to this containment has changed
|
||||||
*/
|
*/
|
||||||
void contextChanged(Plasma::Context *context);
|
void contextChanged(Plasma::Context *context);
|
||||||
/**
|
|
||||||
* The activity name for the context associated to this containment has changed
|
|
||||||
* @since 4.5
|
|
||||||
*/
|
|
||||||
void activityNameChanged(Plasma::Context *context);
|
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
/**
|
/**
|
||||||
@ -632,6 +619,7 @@ class PLASMA_EXPORT Containment : public Applet
|
|||||||
Q_PRIVATE_SLOT(d, void showDropZoneDelayed())
|
Q_PRIVATE_SLOT(d, void showDropZoneDelayed())
|
||||||
Q_PRIVATE_SLOT(d, void checkStatus(Plasma::ItemStatus))
|
Q_PRIVATE_SLOT(d, void checkStatus(Plasma::ItemStatus))
|
||||||
Q_PRIVATE_SLOT(d, void remoteAppletReady(Plasma::AccessAppletJob *))
|
Q_PRIVATE_SLOT(d, void remoteAppletReady(Plasma::AccessAppletJob *))
|
||||||
|
Q_PRIVATE_SLOT(d, void onContextChanged(Plasma::Context *con))
|
||||||
/**
|
/**
|
||||||
* This slot is called when the 'stat' after a job event has finished.
|
* This slot is called when the 'stat' after a job event has finished.
|
||||||
*/
|
*/
|
||||||
|
@ -120,6 +120,11 @@ public:
|
|||||||
*/
|
*/
|
||||||
Context *context();
|
Context *context();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* propogates context changes
|
||||||
|
*/
|
||||||
|
void onContextChanged(Plasma::Context *con);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles dropped/pasted mimetype data
|
* Handles dropped/pasted mimetype data
|
||||||
* @param scenePos scene-relative position
|
* @param scenePos scene-relative position
|
||||||
|
Loading…
Reference in New Issue
Block a user