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));
|
||||
QString activityId = group.readEntry("activityId", QString());
|
||||
if (!activityId.isEmpty()) {
|
||||
setActivityId(activityId);
|
||||
d->context()->setCurrentActivityId(activityId);
|
||||
}
|
||||
setActivity(group.readEntry("activity", QString()));
|
||||
|
||||
@ -1971,39 +1971,34 @@ void Containment::setActivity(const QString &activity)
|
||||
Context *context = d->context();
|
||||
if (context->currentActivity() != 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();
|
||||
if (context->currentActivityId() != activity) {
|
||||
context->setCurrentActivityId(activity);
|
||||
|
||||
foreach (Applet *a, d->applets) {
|
||||
a->updateConstraints(ContextConstraint);
|
||||
}
|
||||
|
||||
KConfigGroup c = config();
|
||||
c.writeEntry("activityId", activity);
|
||||
|
||||
if (d->toolBox) {
|
||||
d->toolBox.data()->update();
|
||||
}
|
||||
emit configNeedsSaving();
|
||||
foreach (Applet *a, applets) {
|
||||
a->updateConstraints(ContextConstraint);
|
||||
}
|
||||
|
||||
KConfigGroup c = q->config();
|
||||
QString act = con->currentActivityId();
|
||||
|
||||
//save anything that's been set (boy I hope this avoids overwriting things)
|
||||
//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);
|
||||
}
|
||||
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
|
||||
@ -2011,9 +2006,9 @@ QString Containment::activity() const
|
||||
return d->context()->currentActivity();
|
||||
}
|
||||
|
||||
QString Containment::activityId() const
|
||||
Context *Containment::context() const
|
||||
{
|
||||
return d->context()->currentActivityId();
|
||||
return d->context();
|
||||
}
|
||||
|
||||
Context *ContainmentPrivate::context()
|
||||
@ -2021,9 +2016,7 @@ Context *ContainmentPrivate::context()
|
||||
if (!con) {
|
||||
con = new Context(q);
|
||||
q->connect(con, SIGNAL(changed(Plasma::Context*)),
|
||||
q, SIGNAL(contextChanged(Plasma::Context*)));
|
||||
q->connect(con, SIGNAL(activityChanged(Plasma::Context*)),
|
||||
q, SIGNAL(activityNameChanged(Plasma::Context*)));
|
||||
q, SLOT(onContextChanged(Plasma::Context*)));
|
||||
}
|
||||
|
||||
return con;
|
||||
|
@ -352,18 +352,10 @@ class PLASMA_EXPORT Containment : public Applet
|
||||
QString activity() const;
|
||||
|
||||
/**
|
||||
* Sets the current activity by id
|
||||
*
|
||||
* @param activity the id of the activity
|
||||
* @return the context for this containment
|
||||
* @since 4.5
|
||||
*/
|
||||
void setActivityId(const QString &activity);
|
||||
|
||||
/**
|
||||
* @return the current activity id associated with this containment
|
||||
* @since 4.5
|
||||
*/
|
||||
QString activityId() const;
|
||||
Context* context() const;
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
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:
|
||||
/**
|
||||
@ -632,6 +619,7 @@ class PLASMA_EXPORT Containment : public Applet
|
||||
Q_PRIVATE_SLOT(d, void showDropZoneDelayed())
|
||||
Q_PRIVATE_SLOT(d, void checkStatus(Plasma::ItemStatus))
|
||||
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.
|
||||
*/
|
||||
|
@ -120,6 +120,11 @@ public:
|
||||
*/
|
||||
Context *context();
|
||||
|
||||
/**
|
||||
* propogates context changes
|
||||
*/
|
||||
void onContextChanged(Plasma::Context *con);
|
||||
|
||||
/**
|
||||
* Handles dropped/pasted mimetype data
|
||||
* @param scenePos scene-relative position
|
||||
|
Loading…
Reference in New Issue
Block a user