Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cli args #40

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Cli args #40

wants to merge 5 commits into from

Conversation

hsjpekka
Copy link

@hsjpekka hsjpekka commented Aug 7, 2020

read address from command line arguments

search for -q, --query, or --address in the command line arguments, the
next string is either an url or a street address

in case of -q or --query, use url parser for extracting address="string" from the url

paste the address to placeHeader.text and start searching

url parser modified from getAllUrlParams on www.sitepoint.com/get-url-parameters-with-javascript/

search for -q, --query, or --address in the command line arguments, the
next string is either an url or a street address

in case of -q or --query, use url parser for extracting address="string"
from the url

paste the address to placeHeader.text and start searching
search for -q, --query, or --address in the command line arguments, the
next string is either an url or a street address

in case of -q or --query, use url parser for extracting address="string"
from the url

paste the address to placeHeader.text and start searching
Copy link
Owner

@dcaliste dcaliste left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for you're contribution. That's a nice addition. Tell me if you disagree with the minor changes I'm requesting.

src/main.qml Outdated

function startSearch(address) {
if (address > "") {
header.searching = true;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would have done this a bit differently, if you don't mind:
in PlaceHeader.qml, add a function:

function search(text) {
                searching = true
                resultList.model = undefined
                searchRequest(text)
}

and modify the EnterKey.onClicked handler in the PageHeader to call this function.

Then in Header.qml, add a forwarding function:

function search(text) {
  placeHeader.search(text)
}

and call it in the new startSearch() method of main you're introducing.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I modified this a bit to write the address to the search field also.

    function search(text, changeText) {
        if (changeText)
            search.text = text // address from command line

src/Header.qml Outdated Show resolved Hide resolved
src/main.qml Outdated Show resolved Hide resolved
src/main.qml Outdated
}

function schemeComponents(url, decode, sepStr) {
// modified from www.sitepoint.com/get-url-parameters-with-javascript/
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't find any copyright notice from their article, but since you're citing the source, let's say it's fine.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if there is a proper way to do it...

parameters into readParameters(), and rewrite regular expressions
detecting parameter arrays.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants