From kde-devel Mon Nov 12 19:20:28 2012 From: Yichao Yu Date: Mon, 12 Nov 2012 19:20:28 +0000 To: kde-devel Subject: Async action with helper in KAuth Message-Id: X-MARC-Message: https://marc.info/?l=kde-devel&m=135274807824550 I am trying to write a pykde4 app that use a kauth helper asynchronously, following the tutorial by code is action = KAuth.Action(action_id) action.setHelperID(helper_id) action.setArguments(args) if hasattr(callback, "__call__"): # the new-style signal connecting somehow doesn't work here.. QObject.connect(action.watcher(), SIGNAL("actionPerformed(const KAuth::ActionReply&)"), lambda reply: callback(reply.succeeded())) action.setExecutesAsync(True) reply = action.execute() if reply.failed(): return False return True however, although synchronous action works perfect, the "early reply" for asynchronous action always fails with error code 3. After googled for solution, I have found someone was having the same problem with me[1] in cpp and claimed the longaction example in the tutorial doesn't works either. I checkout out the code for KAuth and found out the following lines in` ActionReply Action::execute(const QString &helperID) const` if (d->async) { if (hasHelper()) { // It makes no sense return ActionReply::InvalidActionReply; } which gives the right error code and can explain why only the async action fails. The comment says "makes no sense", but doesn't say why.... can anyone explain the reason?? And I cannot found the description for this anywhere in the tutorial (e.g. some backend may not support async action with helper at all.....), if it really doesn't make sense to do this (which I really doubt....) I guess it would be better to add it... THX. [1] http://forum.kde.org/viewtopic.php?f=43&t=94801 >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<