touch-packages team mailing list archive
-
touch-packages team
-
Mailing list archive
-
Message #86007
[Bug 1468195] Re: action_id() does not return the correct value
** Changed in: unity-scopes-api (Ubuntu)
Assignee: (unassigned) => Pawel Stolowski (stolowski)
--
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to unity-scopes-api in
Ubuntu.
https://bugs.launchpad.net/bugs/1468195
Title:
action_id() does not return the correct value
Status in unity-scopes-api package in Ubuntu:
New
Bug description:
I have tried to implement my Action class like. I got the correct
action_id in the constructor. However, I did not get the value in
"activate()". According to the API description:
/**
\brief Get the action identifier for this activation request handler.
Action identifier is empty when using the
unity::scopes::ActivationQueryBase(Result const& result, ActionMetadata const& metadata) constructor.
\return The action identifier passed to the constructor of this object.
*/
std::string action_id() const;
It seems that it is the reverse. Action indentifier is not empty during the construction. The output is like:
================================================
perform_action called
action id: "rated"
action id in activate: ""
review: "ssss"
rating: -1
activate called
================================================
My test code is at: git clone
https://gitcafe.com/ubuntu/scopetemplates_rating_input.git
#include <scope/action.h>
#include <unity/scopes/ActivationResponse.h>
#include <unity/UnityExceptions.h>
#include <QString>
#include <QDebug>
#include <iostream>
namespace sc = unity::scopes;
using namespace std;
QString qstr_(std::string str)
{
return QString::fromStdString(str);
}
Action::Action(const unity::scopes::Result &result,
const unity::scopes::ActionMetadata &metadata,
std::string const& action_id)
: sc::ActivationQueryBase(result, metadata),
action_id_(action_id)
{
qDebug() << "action id: " << qstr_(action_id_);
}
sc::ActivationResponse Action::activate()
{
qDebug() << "action id in activate: " << qstr_(action_id());
QString review = QString("%1").arg(qstr_(action_metadata().scope_data().
get_dict()["review"].get_string()));
double rating = action_metadata().scope_data().
get_dict()["rating"].get_double();
qDebug() << "review: " << review;
qDebug() << "rating: " << rating;
sc::ActivationResponse done(sc::ActivationResponse::ShowDash);
cerr << "activate called" << endl;
return done;
}
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/unity-scopes-api/+bug/1468195/+subscriptions
References