Re: [SailfishDevel] pageStack.pop() - send paramater to prev page

2014-06-06 Thread Christopher Lamb

Hi Michael

I agree with that, in fact that point  was covered in the paragraph 
starting "The downside is ...".  Rather than lazy-loading pages, I 
lazy-load page-content where requried (i.e creating the page takes a 
noticable time). So the Page is static, but lazy-loads its child elements.


Grüsse

Chris


On 05.06.14 17:28, Michael Neufing wrote:

Hi Chris,

one problem I see with your solution is that the App could take long 
time to launch, when there are a bunch of Pages that have to be 
initialized at launch (depending on the structure of the Pages).


So I would prefer lazy loading Pages, which will be initialized when 
it is needed.



Mit freundlichen Grüßen,

Michael Neufing


Christopher Lamb  schrieb am 16:40 
Donnerstag, 5.Juni 2014:



Hi Markus

In my app I chose to instantiate all my Pages in the same place. Each 
of the pages has a declaration in a separate qml file (e.g. 
MainPage.qml, AreaSelectionPage.qml).


With this architecture none of the declarations need to know about the 
previous or next page. It is not their concern. Instead they emit 
signals NextPage, BackPageWithInfo, and Cancelled. In the signal 
handler in the page instantation I do the actual pushing and popping, 
and because all pages are instantiated in the same scope,  they are 
all available to be pushed / popped to. (see code example below).


The downside is that all the pages are created on startup (regardless 
of if they are ever visited). For lightweight pages this is not a 
problem, but for some pages this might be a problem. For these I 
dynamically create the page content when the page is visible.


Grüsse

Chris


ApplicationWindow  {
 id:  appWindow
 ...
 initialPage:  mainPage
 MainPage  {
 id:  mainPage

 onNextPage:  {
  if  (pageType  =="SMS")  {
 console.log("smsType  is:  "  +  smsType)
 if  (smsType  =="Default")  pageStack.push(smsPage,  {lati:  
mainPage.getLati(),  longi:  mainPage.getLongi(),
  alti:  mainPage.getAlt
  i(),  area_id:  area_id,  template_id:  template_id,  msg_status:  msg_status,  
lastPage:  "mainPage"})
 }
 else  {
 pageStack.push(areaSelectionPage)
 }
 }
 }
 AreaSelectionPage  {
 id:  areaSelectionPage
 
 onBackPageWithInfo:  {
 mainPage.areaSet  =  true;
 mainPage.area_id  =  area_id;
 pageStack.pop(mainPage);
 }
 onCancelled:  pageStack.pop(mainPage);
  }
 SMSPage  {
 id:  smsPage
 
 onNextPage:  {
 pageStack.push(contactSelectionPage,  {area_id:  area_id,  
template_id:  template_id})
 }
  }
 ContactSelectionPage  {
 id:  contactSelectionPage
 
 onBackPageWithInfo:  {
 console.log("About  to  pop  smsPage;  contactName:  "  +  contactName  +  
",  contactPhone:  "  +  contactPhone);
 smsPage.contactName  =  contactName;
 smsPage.contactPhone  =  contactPhone;
 smsPage.lastPage  =  "contactSelectionPage";
 pageStack.pop(smsPage);
 }
 onCancelled:  pageStack.pop(smsPage);
  }
}






On 05.06.14 14:43, i...@flyingfischer.ch 
 wrote:

Thanks for your inputs!

Calling

PreviousPage.topic = "MyTopic";
pageStack.pop();

gives me a ReferenceError: PreviousPage is not defined.

PreviousPage.qml and property string topic do exist.

Thanks for your patience!

Markus

___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to 
devel-unsubscr...@lists.sailfishos.org 




___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to 
devel-unsubscr...@lists.sailfishos.org 






___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org


___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

Re: [SailfishDevel] pageStack.pop() - send paramater to prev page

2014-06-06 Thread i...@flyingfischer.ch

Thank you Andrey and Mikko for your very valuable ideas.

This will help me finding my way through QT and JS.

Markus
___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org


Re: [SailfishDevel] pageStack.pop() - send paramater to prev page

2014-06-06 Thread Mikko Leppänen
You could also create a shared (stateless) JS library which you can use to
share variables between different qml documents.


​/Mikko​


2014-06-06 9:47 GMT+03:00 Andrey Kozhevnikov :

> i have an another idea for you:
>
> ...
> var newPage = pageStack.push(Qt.resolvedUrl("newPage.qml"), {...})
> newPage.done.connect(thisPage.pageDone)
> ...
>
> //thisPage
> ...
> function pageDone(var1, var2, var3, ...) {
> //do something with var
> }
> ...
>
> //newPage
> ...
> signal done(string var1, int var2, string var3, ...)
> ...
>
> //Button
> ...
> onClicked: {
> page.done("something", 123, "test", ...)
> }
> ...
>
> 05.06.2014 22:49, i...@flyingfischer.ch пишет:
>
>  Hi Chris
>>
>> thanks for this idea and your code example!
>>
>> I am working on app in a very early stage that will partially talk to a
>> remote server and get dynamic content. In some cases it even will create a
>> little bit of traffic...
>>
>> ...so I will stick for the moment with the solution provided by
>> Konstantin.
>>
>> Regarding the use of Dialog:
>>
>> I come from the Java world and am an absolute newbie on QT. I couldn't
>> figure out how this would work. The documentation from Sailfish OS || QT is
>> not very clear about this, at least not for me.
>>
>> ...but I intend to learn and will certainly restudy the docu and try to
>> check out other use cases from other apps, untill I get it ;-)
>>
>> Thanks to anybody!
>>
>> Markus
>>
>> Am 05.06.2014 16:40, schrieb Christopher Lamb:
>>
>>> Hi Markus
>>>
>>> In my app I chose to instantiate all my Pages in the same place. Each of
>>> the pages has a declaration in a separate qml file (e.g. MainPage.qml,
>>> AreaSelectionPage.qml).
>>>
>>> With this architecture none of the declarations need to know about the
>>> previous or next page. It is not their concern. Instead they emit
>>> signals NextPage, BackPageWithInfo, and Cancelled. In the signal handler
>>> in the page instantation I do the actual pushing and popping, and
>>> because all pages are instantiated in the same scope, they are all
>>> available to be pushed / popped to. (see code example below).
>>>
>>> The downside is that all the pages are created on startup (regardless of
>>> if they are ever visited). For lightweight pages this is not a problem,
>>> but for some pages this might be a problem. For these I dynamically
>>> create the page content when the page is visible.
>>>
>>> Grüsse
>>>
>>> Chris
>>>
>>>
>>> ApplicationWindow {
>>>
>>> id: appWindow
>>>
>>> ...
>>>
>>> initialPage: mainPage
>>>
>>> MainPage {
>>>
>>> id: mainPage
>>>
>>> 
>>>
>>> onNextPage: {
>>>
>>> if (pageType =="SMS") {
>>>
>>> console.log("smsType is: " + smsType)
>>>
>>> if (smsType =="Default") pageStack.push(smsPage, {lati:
>>> mainPage.getLati(), longi: mainPage.getLongi(), alti: mainPage.getAlt
>>> i(), area_id: area_id, template_id: template_id, msg_status: msg_status,
>>> lastPage: "mainPage"})
>>>
>>> }
>>>
>>> else {
>>>
>>> pageStack.push(areaSelectionPage)
>>>
>>> }
>>>
>>> }
>>>
>>> }
>>>
>>> AreaSelectionPage {
>>>
>>> id: areaSelectionPage
>>>
>>> 
>>>
>>> onBackPageWithInfo: {
>>>
>>> mainPage.areaSet = true;
>>>
>>> mainPage.area_id = area_id;
>>>
>>> pageStack.pop(mainPage);
>>>
>>> }
>>>
>>> onCancelled: pageStack.pop(mainPage);
>>>
>>> }
>>>
>>> SMSPage {
>>>
>>> id: smsPage
>>>
>>> 
>>>
>>> onNextPage: {
>>>
>>> pageStack.push(contactSelectionPage, {area_id: area_id, template_id:
>>> template_id})
>>>
>>> }
>>>
>>> }
>>>
>>> ContactSelectionPage {
>>>
>>> id: contactSelectionPage
>>>
>>> 
>>>
>>> onBackPageWithInfo: {
>>>
>>> console.log("About to pop smsPage; contactName: " + contactName + ",
>>> contactPhone: " + contactPhone);
>>>
>>> smsPage.contactName = contactName;
>>>
>>> smsPage.contactPhone = contactPhone;
>>>
>>> smsPage.lastPage = "contactSelectionPage";
>>>
>>> pageStack.pop(smsPage);
>>>
>>> }
>>>
>>> onCancelled: pageStack.pop(smsPage);
>>>
>>> }
>>>
>>> }
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> On 05.06.14 14:43, i...@flyingfischer.ch wrote:
>>>
 Thanks for your inputs!

 Calling

 PreviousPage.topic = "MyTopic";
 pageStack.pop();

 gives me a ReferenceError: PreviousPage is not defined.

 PreviousPage.qml and property string topic do exist.

 Thanks for your patience!

 Markus

 ___
 SailfishOS.org Devel mailing list
 To unsubscribe, please send a mail to
 devel-unsubscr...@lists.sailfishos.org

>>>
>>>
>>>
>>> ___
>>> SailfishOS.org Devel mailing list
>>> To unsubscribe, please send a mail to devel-unsubscribe@lists.
>>> sailfishos.org
>>>
>>>  ___
>> SailfishOS.org Devel mailing list
>> To unsubscribe, please send a mail to devel-unsubscribe@lists.
>> sailfishos.org
>>
>
> ___
> SailfishOS.org Devel mailing list
> To unsubscribe, please send a mail to

Re: [SailfishDevel] pageStack.pop() - send paramater to prev page

2014-06-05 Thread Andrey Kozhevnikov

i have an another idea for you:

...
var newPage = pageStack.push(Qt.resolvedUrl("newPage.qml"), {...})
newPage.done.connect(thisPage.pageDone)
...

//thisPage
...
function pageDone(var1, var2, var3, ...) {
//do something with var
}
...

//newPage
...
signal done(string var1, int var2, string var3, ...)
...

//Button
...
onClicked: {
page.done("something", 123, "test", ...)
}
...

05.06.2014 22:49, i...@flyingfischer.ch пишет:

Hi Chris

thanks for this idea and your code example!

I am working on app in a very early stage that will partially talk to 
a remote server and get dynamic content. In some cases it even will 
create a little bit of traffic...


...so I will stick for the moment with the solution provided by 
Konstantin.


Regarding the use of Dialog:

I come from the Java world and am an absolute newbie on QT. I couldn't 
figure out how this would work. The documentation from Sailfish OS || 
QT is not very clear about this, at least not for me.


...but I intend to learn and will certainly restudy the docu and try 
to check out other use cases from other apps, untill I get it ;-)


Thanks to anybody!

Markus

Am 05.06.2014 16:40, schrieb Christopher Lamb:

Hi Markus

In my app I chose to instantiate all my Pages in the same place. Each of
the pages has a declaration in a separate qml file (e.g. MainPage.qml,
AreaSelectionPage.qml).

With this architecture none of the declarations need to know about the
previous or next page. It is not their concern. Instead they emit
signals NextPage, BackPageWithInfo, and Cancelled. In the signal handler
in the page instantation I do the actual pushing and popping, and
because all pages are instantiated in the same scope, they are all
available to be pushed / popped to. (see code example below).

The downside is that all the pages are created on startup (regardless of
if they are ever visited). For lightweight pages this is not a problem,
but for some pages this might be a problem. For these I dynamically
create the page content when the page is visible.

Grüsse

Chris


ApplicationWindow {

id: appWindow

...

initialPage: mainPage

MainPage {

id: mainPage



onNextPage: {

if (pageType =="SMS") {

console.log("smsType is: " + smsType)

if (smsType =="Default") pageStack.push(smsPage, {lati: 
mainPage.getLati(), longi: mainPage.getLongi(), alti: mainPage.getAlt
i(), area_id: area_id, template_id: template_id, msg_status: 
msg_status, lastPage: "mainPage"})


}

else {

pageStack.push(areaSelectionPage)

}

}

}

AreaSelectionPage {

id: areaSelectionPage



onBackPageWithInfo: {

mainPage.areaSet = true;

mainPage.area_id = area_id;

pageStack.pop(mainPage);

}

onCancelled: pageStack.pop(mainPage);

}

SMSPage {

id: smsPage



onNextPage: {

pageStack.push(contactSelectionPage, {area_id: area_id, template_id: 
template_id})


}

}

ContactSelectionPage {

id: contactSelectionPage



onBackPageWithInfo: {

console.log("About to pop smsPage; contactName: " + contactName + ", 
contactPhone: " + contactPhone);


smsPage.contactName = contactName;

smsPage.contactPhone = contactPhone;

smsPage.lastPage = "contactSelectionPage";

pageStack.pop(smsPage);

}

onCancelled: pageStack.pop(smsPage);

}

}







On 05.06.14 14:43, i...@flyingfischer.ch wrote:

Thanks for your inputs!

Calling

PreviousPage.topic = "MyTopic";
pageStack.pop();

gives me a ReferenceError: PreviousPage is not defined.

PreviousPage.qml and property string topic do exist.

Thanks for your patience!

Markus

___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to
devel-unsubscr...@lists.sailfishos.org




___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to 
devel-unsubscr...@lists.sailfishos.org



___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to 
devel-unsubscr...@lists.sailfishos.org


___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

Re: [SailfishDevel] pageStack.pop() - send paramater to prev page

2014-06-05 Thread i...@flyingfischer.ch

Hi Chris

thanks for this idea and your code example!

I am working on app in a very early stage that will partially talk to a 
remote server and get dynamic content. In some cases it even will create 
a little bit of traffic...


...so I will stick for the moment with the solution provided by Konstantin.

Regarding the use of Dialog:

I come from the Java world and am an absolute newbie on QT. I couldn't 
figure out how this would work. The documentation from Sailfish OS || QT 
is not very clear about this, at least not for me.


...but I intend to learn and will certainly restudy the docu and try to 
check out other use cases from other apps, untill I get it ;-)


Thanks to anybody!

Markus

Am 05.06.2014 16:40, schrieb Christopher Lamb:

Hi Markus

In my app I chose to instantiate all my Pages in the same place. Each of
the pages has a declaration in a separate qml file (e.g. MainPage.qml,
AreaSelectionPage.qml).

With this architecture none of the declarations need to know about the
previous or next page. It is not their concern. Instead they emit
signals NextPage, BackPageWithInfo, and Cancelled. In the signal handler
in the page instantation I do the actual pushing and popping, and
because all pages are instantiated in the same scope, they are all
available to be pushed / popped to. (see code example below).

The downside is that all the pages are created on startup (regardless of
if they are ever visited). For lightweight pages this is not a problem,
but for some pages this might be a problem. For these I dynamically
create the page content when the page is visible.

Grüsse

Chris


ApplicationWindow  {

 id:  appWindow

 ...

 initialPage:  mainPage

 MainPage  {

 id:  mainPage

 

 onNextPage:  {

  if  (pageType  =="SMS")  {

 console.log("smsType  is:  "  +  smsType)

 if  (smsType  =="Default")  pageStack.push(smsPage,  {lati:  
mainPage.getLati(),  longi:  mainPage.getLongi(),  alti:  mainPage.getAlt
  i(),  area_id:  area_id,  template_id:  template_id,  msg_status:  msg_status,  
lastPage:  "mainPage"})

 }

 else  {

 pageStack.push(areaSelectionPage)

 }

 }

 }

 AreaSelectionPage  {

 id:  areaSelectionPage

 

 onBackPageWithInfo:  {

 mainPage.areaSet  =  true;

 mainPage.area_id  =  area_id;

 pageStack.pop(mainPage);

 }

 onCancelled:  pageStack.pop(mainPage);

  }

 SMSPage  {

 id:  smsPage

 

 onNextPage:  {

 pageStack.push(contactSelectionPage,  {area_id:  area_id,  
template_id:  template_id})

 }

  }

 ContactSelectionPage  {

 id:  contactSelectionPage

 

 onBackPageWithInfo:  {

 console.log("About  to  pop  smsPage;  contactName:  "  +  contactName  +  
",  contactPhone:  "  +  contactPhone);

 smsPage.contactName  =  contactName;

 smsPage.contactPhone  =  contactPhone;

 smsPage.lastPage  =  "contactSelectionPage";

 pageStack.pop(smsPage);

 }

 onCancelled:  pageStack.pop(smsPage);

  }

}







On 05.06.14 14:43, i...@flyingfischer.ch wrote:

Thanks for your inputs!

Calling

PreviousPage.topic = "MyTopic";
pageStack.pop();

gives me a ReferenceError: PreviousPage is not defined.

PreviousPage.qml and property string topic do exist.

Thanks for your patience!

Markus

___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to
devel-unsubscr...@lists.sailfishos.org




___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org


___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org


Re: [SailfishDevel] pageStack.pop() - send paramater to prev page

2014-06-05 Thread Michael Neufing
+1 for Dialog



Andrey Kozhevnikov  schrieb am 17:32 Donnerstag, 5.Juni 
2014:
 


why not to use Dialog instead of Page for this use case?


05.06.2014 21:28, Michael Neufing пишет:

Hi Chris,
>
>
>one problem I see with your solution is that the App could take long time to 
>launch, when there are a bunch of Pages that have to be initialized at launch 
>(depending on the structure of the Pages).
>
> 
>So I would prefer lazy loading Pages, which will be
  initialized when it is needed.
>
>
>Mit freundlichen Grüßen,
>
>
>Michael Neufing
>
>
>
>
>Christopher Lamb  schrieb am 16:40 Donnerstag, 
>5.Juni 2014:
> 
>
>
>Hi Markus
>
>In my app I chose to instantiate all my Pages in the
same place. Each of the pages has a declaration in a
separate qml file (e.g. MainPage.qml,
AreaSelectionPage.qml).
>
>With this architecture none of the declarations need
to know about the previous or next page. It is not
their concern. Instead they emit signals NextPage,
BackPageWithInfo, and Cancelled. In the signal
handler in the page instantation I do the actual
pushing and popping, and because all pages are
instantiated in the same scope,  they are all
available to be pushed / popped to. (see code
example below).
>
>The downside is that all the pages are created on
startup (regardless of if they are ever visited).
For lightweight pages this is not a problem, but for
some pages this might be a problem. For these I
dynamically create the page content when the page is
visible.
>
>Grüsse
>
>Chris
>
>
>
>ApplicationWindow{
>id:appWindow
>...
>initialPage:mainPage
>MainPage{
>id:mainPage
            
>
>onNextPage:{
>if(pageType=="SMS"){
>console.log("smsTypeis:"+smsType)
>if(smsType=="Default")pageStack.push(smsPage,{lati:mainPage.getLati(),longi:mainPage.getLongi(),alti:mainPage.getAlt
> 
>i(),area_id:area_id,template_id:template_id,msg_status:msg_status,lastPage:"mainPage"})
>}
>else{
>pageStack.push(areaSelectionPage)
>}
>}
>}
>AreaSelectionPage{
>id:areaSelectionPage
>
>onBackPageWithInfo:{
>mainPage.areaSet=true;
>mainPage.area_id=area_id;
>pageStack.pop(mainPage);
>}
>onCancelled:pageStack.pop(mainPage);
>}
>SMSPage{
>id:smsPage
>
>onNextPage:{
>pageStack.push(contactSelectionPage,{area_id:area_id,template_id:template_id})
>}
>}
>ContactSelectionPage{
>id:contactSelectionPage
>
>onBackPageWithInfo:{
>console.log("AbouttopopsmsPage;contactName:"+contactName+",contactPhone:"+contactPhone);
>smsPage.contactName=contactName;
>smsPage.contactPhone=contactPhone;
>smsPage.lastPage="contactSelectionPage";
>pageStack.pop(smsPage);
>}
>onCancelled:pageStack.pop(smsPage);
>}
>}
>
>
>
>
>
>
>On 05.06.14 14:43, i...@flyingfischer.ch wrote:
>
>Thanks for your inputs! 
>>
>>Calling 
>>
>>PreviousPage.topic = "MyTopic"; 
>>pageStack.pop(); 
>>
>>gives me a ReferenceError: PreviousPage is not
defined. 
>>
>>PreviousPage.qml and property string topic do
exist. 
>>
>>Thanks for your patience! 
>>
>>Markus 
>>
>>___ 
>>SailfishOS.org Devel mailing list 
>>To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org 
>>
>
>
>___
>SailfishOS.org Devel mailing list
>To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org
>
>
>
>
>___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org


___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

Re: [SailfishDevel] pageStack.pop() - send paramater to prev page

2014-06-05 Thread Andrey Kozhevnikov

why not to use Dialog instead of Page for this use case?

05.06.2014 21:28, Michael Neufing ?:

Hi Chris,

one problem I see with your solution is that the App could take long 
time to launch, when there are a bunch of Pages that have to be 
initialized at launch (depending on the structure of the Pages).


So I would prefer lazy loading Pages, which will be initialized when 
it is needed.



Mit freundlichen Grüßen,

Michael Neufing


Christopher Lamb  schrieb am 16:40 
Donnerstag, 5.Juni 2014:



Hi Markus

In my app I chose to instantiate all my Pages in the same place. Each 
of the pages has a declaration in a separate qml file (e.g. 
MainPage.qml, AreaSelectionPage.qml).


With this architecture none of the declarations need to know about the 
previous or next page. It is not their concern. Instead they emit 
signals NextPage, BackPageWithInfo, and Cancelled. In the signal 
handler in the page instantation I do the actual pushing and popping, 
and because all pages are instantiated in the same scope,  they are 
all available to be pushed / popped to. (see code example below).


The downside is that all the pages are created on startup (regardless 
of if they are ever visited). For lightweight pages this is not a 
problem, but for some pages this might be a problem. For these I 
dynamically create the page content when the page is visible.


Grüsse

Chris


ApplicationWindow  {
 id:  appWindow
 ...
 initialPage:  mainPage
 MainPage  {
 id:  mainPage

 onNextPage:  {
  if  (pageType  =="SMS")  {
 console.log("smsType  is:  "  +  smsType)
 if  (smsType  =="Default")  pageStack.push(smsPage,  {lati:  
mainPage.getLati(),  longi:  mainPage.getLongi(),
  alti:  mainPage.getAlt
  i(),  area_id:  area_id,  template_id:  template_id,  msg_status:  msg_status,  
lastPage:  "mainPage"})
 }
 else  {
 pageStack.push(areaSelectionPage)
 }
 }
 }
 AreaSelectionPage  {
 id:  areaSelectionPage
 
 onBackPageWithInfo:  {
 mainPage.areaSet  =  true;
 mainPage.area_id  =  area_id;
 pageStack.pop(mainPage);
 }
 onCancelled:  pageStack.pop(mainPage);
  }
 SMSPage  {
 id:  smsPage
 
 onNextPage:  {
 pageStack.push(contactSelectionPage,  {area_id:  area_id,  
template_id:  template_id})
 }
  }
 ContactSelectionPage  {
 id:  contactSelectionPage
 
 onBackPageWithInfo:  {
 console.log("About  to  pop  smsPage;  contactName:  "  +  contactName  +  
",  contactPhone:  "  +  contactPhone);
 smsPage.contactName  =  contactName;
 smsPage.contactPhone  =  contactPhone;
 smsPage.lastPage  =  "contactSelectionPage";
 pageStack.pop(smsPage);
 }
 onCancelled:  pageStack.pop(smsPage);
  }
}






On 05.06.14 14:43, i...@flyingfischer.ch 
 wrote:

Thanks for your inputs!

Calling

PreviousPage.topic = "MyTopic";
pageStack.pop();

gives me a ReferenceError: PreviousPage is not defined.

PreviousPage.qml and property string topic do exist.

Thanks for your patience!

Markus

___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to 
devel-unsubscr...@lists.sailfishos.org 




___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to 
devel-unsubscr...@lists.sailfishos.org 






___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org


___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

Re: [SailfishDevel] pageStack.pop() - send paramater to prev page

2014-06-05 Thread Michael Neufing
Hi Chris,

one problem I see with your solution is that the App could take long time to 
launch, when there are a bunch of Pages that have to be initialized at launch 
(depending on the structure of the Pages).

 
So I would prefer lazy loading Pages, which will be initialized when it is 
needed.


Mit freundlichen Grüßen,


Michael Neufing



Christopher Lamb  schrieb am 16:40 Donnerstag, 
5.Juni 2014:
 


Hi Markus

In my app I chose to instantiate all my Pages in the same place.
Each of the pages has a declaration in a separate qml file (e.g.
MainPage.qml, AreaSelectionPage.qml).

With this architecture none of the declarations need to know about
the previous or next page. It is not their concern. Instead they
emit signals NextPage, BackPageWithInfo, and Cancelled. In the
signal handler in the page instantation I do the actual pushing and
popping, and because all pages are instantiated in the same scope, 
they are all available to be pushed / popped to. (see code example
below).

The downside is that all the pages are created on startup
(regardless of if they are ever visited). For lightweight pages this
is not a problem, but for some pages this might be a problem. For
these I dynamically create the page content when the page is
visible.

Grüsse

Chris



ApplicationWindow{
id:appWindow
...
initialPage:mainPage
MainPage{
id:mainPage
            

onNextPage:{
if(pageType=="SMS"){
console.log("smsTypeis:"+smsType)
if(smsType=="Default")pageStack.push(smsPage,{lati:mainPage.getLati(),longi:mainPage.getLongi(),alti:mainPage.getAlt
 
i(),area_id:area_id,template_id:template_id,msg_status:msg_status,lastPage:"mainPage"})
}
else{
pageStack.push(areaSelectionPage)
}
}
}
AreaSelectionPage{
id:areaSelectionPage

onBackPageWithInfo:{
mainPage.areaSet=true;
mainPage.area_id=area_id;
pageStack.pop(mainPage);
}
onCancelled:pageStack.pop(mainPage);
}
SMSPage{
id:smsPage

onNextPage:{
pageStack.push(contactSelectionPage,{area_id:area_id,template_id:template_id})
}
}
ContactSelectionPage{
id:contactSelectionPage

onBackPageWithInfo:{
console.log("AbouttopopsmsPage;contactName:"+contactName+",contactPhone:"+contactPhone);
smsPage.contactName=contactName;
smsPage.contactPhone=contactPhone;
smsPage.lastPage="contactSelectionPage";
pageStack.pop(smsPage);
}
onCancelled:pageStack.pop(smsPage);
}
}






On 05.06.14 14:43, i...@flyingfischer.ch wrote:

Thanks for your inputs! 
>
>Calling 
>
>PreviousPage.topic = "MyTopic"; 
>pageStack.pop(); 
>
>gives me a ReferenceError: PreviousPage is not defined. 
>
>PreviousPage.qml and property string topic do exist. 
>
>Thanks for your patience! 
>
>Markus 
>
>___ 
>SailfishOS.org Devel mailing list 
>To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org 
>


___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

Re: [SailfishDevel] pageStack.pop() - send paramater to prev page

2014-06-05 Thread Christopher Lamb

Hi Markus

In my app I chose to instantiate all my Pages in the same place. Each of 
the pages has a declaration in a separate qml file (e.g. MainPage.qml, 
AreaSelectionPage.qml).


With this architecture none of the declarations need to know about the 
previous or next page. It is not their concern. Instead they emit 
signals NextPage, BackPageWithInfo, and Cancelled. In the signal handler 
in the page instantation I do the actual pushing and popping, and 
because all pages are instantiated in the same scope, they are all 
available to be pushed / popped to. (see code example below).


The downside is that all the pages are created on startup (regardless of 
if they are ever visited). For lightweight pages this is not a problem, 
but for some pages this might be a problem. For these I dynamically 
create the page content when the page is visible.


Grüsse

Chris


ApplicationWindow  {

id:  appWindow

...

initialPage:  mainPage

MainPage  {

id:  mainPage



onNextPage:  {

 if  (pageType  =="SMS")  {

console.log("smsType  is:  "  +  smsType)

if  (smsType  =="Default")  pageStack.push(smsPage,  {lati:  
mainPage.getLati(),  longi:  mainPage.getLongi(),  alti:  mainPage.getAlti(),  area_id:  area_id,  
template_id:  template_id,  msg_status:  msg_status,  lastPage:  "mainPage"})

}

else  {

pageStack.push(areaSelectionPage)

}

}

}

AreaSelectionPage  {

id:  areaSelectionPage



onBackPageWithInfo:  {

mainPage.areaSet  =  true;

mainPage.area_id  =  area_id;

pageStack.pop(mainPage);

}

onCancelled:  pageStack.pop(mainPage);

 }

SMSPage  {

id:  smsPage



onNextPage:  {

pageStack.push(contactSelectionPage,  {area_id:  area_id,  
template_id:  template_id})

}

 }

ContactSelectionPage  {

id:  contactSelectionPage



onBackPageWithInfo:  {

console.log("About  to  pop  smsPage;  contactName:  "  +  contactName  +  
",  contactPhone:  "  +  contactPhone);

smsPage.contactName  =  contactName;

smsPage.contactPhone  =  contactPhone;

smsPage.lastPage  =  "contactSelectionPage";

pageStack.pop(smsPage);

}

onCancelled:  pageStack.pop(smsPage);

 }

}







On 05.06.14 14:43, i...@flyingfischer.ch wrote:

Thanks for your inputs!

Calling

PreviousPage.topic = "MyTopic";
pageStack.pop();

gives me a ReferenceError: PreviousPage is not defined.

PreviousPage.qml and property string topic do exist.

Thanks for your patience!

Markus

___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to 
devel-unsubscr...@lists.sailfishos.org


___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

Re: [SailfishDevel] pageStack.pop() - send paramater to prev page

2014-06-05 Thread i...@flyingfischer.ch

Yes! Works perfect!

Thanks a lot!

Somebody dancing right here...

Markus

Am 05.06.2014 15:23, schrieb sfietkonstan...@free.fr:

Hello !

The previous page might not be available (actually components created 
dynamically might not be aware of other dynamically created components, as it's 
the case with pages). You can communicate the page as a property to the new 
page:

Page {
 id: somepage
 ...
 pageStack.push(Qt.resolvedUrl("NewPage.qml"), {"parentPage": somePage})
 ...
}

NewPage.qml

Page {
 property Item parentPage
 ...

  Button {
  onClicked: {
  parentPage.topic = "Test";
  pageStack.pop();
  }
}

- Mail original -
De: i...@flyingfischer.ch
À: "Sailfish OS Developers" 
Envoyé: Jeudi 5 Juin 2014 15:19:38
Objet: Re: [SailfishDevel] pageStack.pop() - send paramater to prev page

Thanks, but I am still stuck. This is what I do

PreviousPage.qml
Page {
  id: previous
  property string topic: "default value"
...

Topics.qml
Page {
  id: topics
  property string topic
...
  Button {
  id: topic0
  text: qsTr("Topic 0")
  anchors.horizontalCenter: parent.horizontalCenter
  onClicked: {
  // PreviousPage.topic = "Test"; // reference error
  previous.topic = "Test"; // reference error
  pageStack.pop();
  }
  }

Thanks again!

Markus
___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org
___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org


___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

Re: [SailfishDevel] pageStack.pop() - send paramater to prev page

2014-06-05 Thread sfietkonstantin
Hello !

The previous page might not be available (actually components created 
dynamically might not be aware of other dynamically created components, as it's 
the case with pages). You can communicate the page as a property to the new 
page:

Page {
id: somepage
...
pageStack.push(Qt.resolvedUrl("NewPage.qml"), {"parentPage": somePage})
...
}

NewPage.qml

Page {
property Item parentPage
...

 Button {
 onClicked: {
 parentPage.topic = "Test";
 pageStack.pop();
 }
}

- Mail original -
De: i...@flyingfischer.ch
À: "Sailfish OS Developers" 
Envoyé: Jeudi 5 Juin 2014 15:19:38
Objet: Re: [SailfishDevel] pageStack.pop() - send paramater to prev page

Thanks, but I am still stuck. This is what I do

PreviousPage.qml
Page {
 id: previous
 property string topic: "default value"
...

Topics.qml
Page {
 id: topics
 property string topic
...
 Button {
 id: topic0
 text: qsTr("Topic 0")
 anchors.horizontalCenter: parent.horizontalCenter
 onClicked: {
 // PreviousPage.topic = "Test"; // reference error
 previous.topic = "Test"; // reference error
 pageStack.pop();
 }
 }

Thanks again!

Markus
___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org
___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

Re: [SailfishDevel] pageStack.pop() - send paramater to prev page

2014-06-05 Thread i...@flyingfischer.ch

Thanks, but I am still stuck. This is what I do

PreviousPage.qml
Page {
id: previous
property string topic: "default value"
...

Topics.qml
Page {
id: topics
property string topic
...
Button {
id: topic0
text: qsTr("Topic 0")
anchors.horizontalCenter: parent.horizontalCenter
onClicked: {
// PreviousPage.topic = "Test"; // reference error
previous.topic = "Test"; // reference error
pageStack.pop();
}
}

Thanks again!

Markus
___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org


Re: [SailfishDevel] pageStack.pop() - send paramater to prev page

2014-06-05 Thread Kalle Lammenoja
you need to give the page id
Id: PreviousPage


2014-06-05 15:43 GMT+03:00 i...@flyingfischer.ch :

> Thanks for your inputs!
>
> Calling
>
> PreviousPage.topic = "MyTopic";
> pageStack.pop();
>
> gives me a ReferenceError: PreviousPage is not defined.
>
> PreviousPage.qml and property string topic do exist.
>
> Thanks for your patience!
>
> Markus
>
>
> ___
> SailfishOS.org Devel mailing list
> To unsubscribe, please send a mail to devel-unsubscribe@lists.
> sailfishos.org
>
___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

Re: [SailfishDevel] pageStack.pop() - send paramater to prev page

2014-06-05 Thread i...@flyingfischer.ch

Thanks for your inputs!

Calling

PreviousPage.topic = "MyTopic";
pageStack.pop();

gives me a ReferenceError: PreviousPage is not defined.

PreviousPage.qml and property string topic do exist.

Thanks for your patience!

Markus

___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org


Re: [SailfishDevel] pageStack.pop() - send paramater to prev page

2014-06-05 Thread Christopher Lamb

Sali Markus

I would also love to see a pop() method with parameters so I can pass info back 
to the previous page, jus like the push()

As a workaround I just set the page's properties directly immediately before 
the pop() call e.g:


   AreaSelectionPage  {


id:  areaSelectionPage



onBackPageWithInfo:  {

mainPage.areaSet  =  true;

mainPage.area_id  =  area_id;

pageStack.pop(mainPage);

}

onCancelled:  pageStack.pop(mainPage);

 }


mfg

Chris




On 05.06.14 13:48, i...@flyingfischer.ch wrote:

Beginners follow up question

Hello

while transfering parameters works fine with

pageStack.push(Qt.resolvedUrl("nextPage.qml", {topic: "myTopic"}))

there seems not to be any method like this in

pageStack.pop()

How can I give back a parameter from the top of the stack to the 
previous page?


Thanks for you inputs and patience!

Markus Fischer

--

I tried:

Page {
id: onTopOfStack
property string topic
...
Column {
id: column
...
Button {
id: myTopic
text: qsTr("MyTopic")
anchors.horizontalCenter: parent.horizontalCenter
onClicked: {
topic: "MyTopic"
pageStack.pop();
}
}
--

Page {
id: previousPage
property string topic
...
SilicaFlickable {
id: mainFlickable
...
Column {
id: mainColumn
...
PageHeader {
id: header
title: qsTr(topic)
}

___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to 
devel-unsubscr...@lists.sailfishos.org


___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

Re: [SailfishDevel] pageStack.pop() - send paramater to prev page

2014-06-05 Thread Andrey Kozhevnikov
if you using Dialog you can set dialog.acceptDestinationProperties = 
{something: true}


05.06.2014 17:48, i...@flyingfischer.ch пишет:

Beginners follow up question

Hello

while transfering parameters works fine with

pageStack.push(Qt.resolvedUrl("nextPage.qml", {topic: "myTopic"}))

there seems not to be any method like this in

pageStack.pop()

How can I give back a parameter from the top of the stack to the 
previous page?


Thanks for you inputs and patience!

Markus Fischer

--

I tried:

Page {
id: onTopOfStack
property string topic
...
Column {
id: column
...
Button {
id: myTopic
text: qsTr("MyTopic")
anchors.horizontalCenter: parent.horizontalCenter
onClicked: {
topic: "MyTopic"
pageStack.pop();
}
}
--

Page {
id: previousPage
property string topic
...
SilicaFlickable {
id: mainFlickable
...
Column {
id: mainColumn
...
PageHeader {
id: header
title: qsTr(topic)
}

___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to 
devel-unsubscr...@lists.sailfishos.org


___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org