← Back to team overview

ubuntu-phone team mailing list archive

Re: [Scopes] More button | CannedQuery or Result activation

 

Hi Sam,

On 15.11.2014 01:02, Sam Segers wrote:
Hi

I'm facing a problem with my places scope. I want to have a query result that acts like a "more" button. Or is there a design for it?

I looked into the following:

  * CannedQuery:

This is working, but the options are very limited. I can only set a query string and a department. (Which I found weird as the department tutorial suggests department queries normally don't contain query strings )

I don't want to set a different/strange query string. Cause this is displayed to the user. And I need to keep reference to a long id of the current online search (to get the next x results) and that would look bad/hacky as query string. I would want to avoid having to write it to a cache dir too.

Is it possible to also set arbitrary data in the canned query? Like I can do with a CategoryResult. Something with SearchMetadata hints fi. It would be nice to not discard scope://<id>?*<whatever>* and have the whatever in SearchMetadata's hints.

Unfortunately it's not currently possible to attach arbitrary data to CannedQuery. We decided - for good and bad - that canned query should be 100% transparent and carry all the state that can be easily reflected and reached from the UI (by user selecting a department or entering search query). Also, the decision to not allow search string while in a department was a deliberate design decision where departments should only serve for browsing and as soon as you type a query, it should be global search. I acknowledge this is problematic / limiting and I was also hit by this while implementing some of the sopes. We plan to revisit this API to find a solution (which will likely allow arbitrary data to be attached as I see no other way at the moment). Also, it seems like what you're after is results pagination (showing next chunk of results on 'More'). Pagination is new functionality that we plan to support more directly in the API and shell in the (near?) future.


  * Deriving ActivationQueryBase

This seems to do nothing. I did:

    unity::scopes::ActivationQueryBase::UPtr Scope::activate(const
    unity::scopes::Result &result, const unity::scopes::ActionMetadata
    &metadata)
    {
        return sc::ActivationQueryBase::UPtr(new Activation(result,
    metadata));
    }


from my Scope impl. and:


    sc::ActivationResponse Activation::activate()
    {
        cerr << "activate" << endl;
        return sc::ActivationResponse::NotHandled;
    }


from my ActivationQueryBase impl. but the line is never printed. Only the preview action is called. (I did mark the result with set_intercept_activation)

Right. This part of our API has a bit of legacy (Unity 7 semantics). It was decided for Unity 8 to show previews in practically all cases, except for carefuly chosen exceptions (which are defined in Unity8 dash; one that comes to my mind at the moment is Apps scope), making this API endpoint a no-op for 99% of scopes. So yes, we need to update the documentation and clean this part of API up, and this is also in our plans. Sorry for confusion.

KR,
Pawel


This is done with the unity-scope-tool from the desktop (14.10) if that makes a difference. (the emulator doesn't run on my laptop)

Regards
Sam Segers




Follow ups

References