[Touch-packages] [Bug 1468195] Re: action_id() does not return the correct value

2015-06-30 Thread Pawel Stolowski
** Changed in: unity-scopes-api (Ubuntu)
 Assignee: Pawel Stolowski (stolowski) = (unassigned)

-- 
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:
  Invalid

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:  
  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

-- 
Mailing list: https://launchpad.net/~touch-packages
Post to : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp


[Touch-packages] [Bug 1468195] Re: action_id() does not return the correct value

2015-06-25 Thread Pawel Stolowski
The problem is in your scope code. The constructor of your Action class
needs to take widget id and action id arguments (you get them both in
Scope::perform_action() where Action is constructed), and it *needs* to
pass them down to ActivationQueryBase constructor. Only then
ActivationQueryBase::action_id() will give meaningful value.

There is no need to have action_id_ member attribute in your Action
class.


** Changed in: unity-scopes-api (Ubuntu)
   Status: New = Invalid

-- 
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:
  Invalid

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:  
  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

-- 
Mailing list: https://launchpad.net/~touch-packages
Post to : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp


[Touch-packages] [Bug 1468195] Re: action_id() does not return the correct value

2015-06-24 Thread Michi Henning
** 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:  
  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

-- 
Mailing list: https://launchpad.net/~touch-packages
Post to : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp