On Tuesday 14 April 2009, Aaron J. Seigo wrote:
> On Tuesday 14 April 2009, Marco Martin wrote:
> > On Tuesday 14 April 2009, Aaron J. Seigo wrote:
> > > * all the dbus calls are synchronous; i think those will need to get
> > > changed to be async otherwise we're going to get some horrific
> > > situations where plasma sits and times out for a few minutes while an
> > > application sits there busy and grinding away ..
> >
> > hmm yeah..
> > how to do it? since when i access a property i actually need the
> > response..
>
> well.. there the ones we need response from and the ones we don't... the
> ones we don't are easy...
>
> e.g. calls to ContextMenu can be replaced with call(QDBus::NoBlock,
> "ContextMenu", x, y) and nothing will really change
>
> the good news for the other ones is that they are all in methods that do
> not return anything. which means they can get called with a callback and
> when the call returns the result can be dealt with then.
>
> it does mean that some of the methods will need to be broken up into an
> annoying cascade of calls :/ in particular, the tooltip calls in
> syncToolTip. perhaps we should have a ToolTip method on the bus that
> returns an array/struct/dict of all the tooltip data at that time?
moved tooltip stuff to a single call.
also the icon stuff has some problems, since i have to check for both an icon
name and an icon picture, hmmm thinking about it with a quite long chain of
callbacks should still be possible...
but the main roblem is that callwithcallback doesn't seem to work with
properties? (this patch hmm doesn't work)
>
> > > * there are dptrs in the classes ... why?
> >
> > hmm, i like how they look (yeah i know an instantiated class more..)
> > is it a problem?
>
> not really, no. :)
>
> i also just noticed that in KNotificationAreaItem there are calls to
> blockSignals when it's really making calls to the dbus object.. does that
> really work? (i'm guessing not ..)
Index: dbussystemtraytask.cpp
===================================================================
--- dbussystemtraytask.cpp (revision 953895)
+++ dbussystemtraytask.cpp (working copy)
@@ -75,6 +75,10 @@
void syncToolTip();
void syncStatus(QString status);
+ //callbacks
+ void categoryCallback(const QString &category);
+ void syncToolTipCallback(const ToolTipStruct &);
+ void syncMovieCallback(const ImageVector &);
DBusSystemTrayTask *q;
@@ -108,11 +112,11 @@
d->notificationAreaItemInterface = new org::kde::NotificationAreaItem(service, "/NotificationAreaItem",
QDBusConnection::sessionBus());
- d->notificationAreaItemInterface->title();
- d->category = (ItemCategory)metaObject()->enumerator(metaObject()->indexOfEnumerator("ItemCategory")).keyToValue(d->notificationAreaItemInterface->category().toLatin1());
+ d->notificationAreaItemInterface->callWithCallback("Category", QList<QVariant>(), this, SLOT(categryCallback(const QString&)));
+
connect(d->notificationAreaItemInterface, SIGNAL(NewIcon()), this, SLOT(syncIcon()));
connect(d->notificationAreaItemInterface, SIGNAL(NewAttentionIcon()), this, SLOT(syncAttentionIcon()));
connect(d->notificationAreaItemInterface, SIGNAL(NewToolTip()), this, SLOT(syncToolTip()));
@@ -278,7 +282,12 @@
void DBusSystemTrayTaskPrivate::syncMovie()
{
- ImageVector movieData = notificationAreaItemInterface->attentionMovie();
+ notificationAreaItemInterface->callWithCallback("AttentionMovie", QList<QVariant>(), q, SLOT(syncMovieCallback(const ImageVector&)));
+
+}
+
+void DBusSystemTrayTaskPrivate::syncMovieCallback(const ImageVector &movieData)
+{
movie = QVector<QPixmap>(movieData.size());
if (!movieData.isEmpty()) {
@@ -288,6 +297,8 @@
}
}
+
+
void DBusSystemTrayTaskPrivate::updateMovieFrame()
{
foreach (Plasma::IconWidget *iconWidget, iconWidgets) {
@@ -301,8 +312,12 @@
void DBusSystemTrayTaskPrivate::syncToolTip()
{
- ToolTipStruct tipStruct = notificationAreaItemInterface->toolTip();
+ ToolTipStruct tipStruct = notificationAreaItemInterface->toolTip();
+ notificationAreaItemInterface->callWithCallback("ToolTip", QList<QVariant>(), q, SLOT(syncToolTipCallback(const ToolTipStruct &)));
+}
+void DBusSystemTrayTaskPrivate::syncToolTipCallback(const ToolTipStruct &tipStruct)
+{
if (tipStruct.title.isEmpty()) {
foreach (Plasma::IconWidget *iconWidget, iconWidgets) {
Plasma::ToolTipManager::self()->clearContent(iconWidget);
@@ -378,6 +393,12 @@
emit q->changed(q);
}
+
+void DBusSystemTrayTaskPrivate::categoryCallback(const QString &cat)
+{kWarning()<<"AAAA";
+ category = (DBusSystemTrayTask::ItemCategory)q->metaObject()->enumerator(q->metaObject()->indexOfEnumerator("ItemCategory")).keyToValue(cat.toLatin1());
}
+}
+
#include "dbussystemtraytask.moc"
Index: dbussystemtraytask.h
===================================================================
--- dbussystemtraytask.h (revision 953636)
+++ dbussystemtraytask.h (working copy)
@@ -74,7 +74,10 @@
Q_PRIVATE_SLOT(d, void syncIcon())
Q_PRIVATE_SLOT(d, void syncAttentionIcon())
Q_PRIVATE_SLOT(d, void syncToolTip())
+ Q_PRIVATE_SLOT(d, void syncToolTipCallback(const ToolTipStruct &))
+ Q_PRIVATE_SLOT(d, void syncMovieCallback(const ImageVector &))
Q_PRIVATE_SLOT(d, void syncStatus(QString status))
+ Q_PRIVATE_SLOT(d, void categoryCallback(const QString &))
Q_PRIVATE_SLOT(d, void updateMovieFrame())
Q_PRIVATE_SLOT(d, void blinkAttention())
};
_______________________________________________
Plasma-devel mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/plasma-devel