title: Cascades NavigationPane: connect to an object signal into another qml file
body: <p>I've created a blackberry application using the wizard with <code>NavigationPane</code> template, and added some components on the DetailsPage.qml (like a <code>Button</code> and a <code>TextField</code>). </p>
  
  <p>I want to connect a slot function on the button in DetailsPage.qml, that when clicked read the text into the <code>TextArea</code> on the same page. </p>
  
  <p>My problem is that when the application is launched, the qml that is loaded is main.qml. 
  If i try to get reference to an object on DetailsPage.qml <code>findChild</code> return 0x0, because it cannot find it. 
  The main.qml file is: </p>
  
  <pre><code>// Navigation pane project template
  import bb.cascades 1.0
  
  NavigationPane {
      id: navigationPane
      Page {
          // page with a picture thumbnail
          Container {
              background: Color.Black
              layout: DockLayout {
              }
              Button {                
                  horizontalAlignment: HorizontalAlignment.Center
                  verticalAlignment: VerticalAlignment.Center
                  text: qsTr("New todo")
                  imageSource: "asset:///images/picture1thumb.png"
                  onClicked: {
                      // show detail page when the button is clicked
                      var page = getSecondPage();
                      console.debug("pushing detail " + page)
                      navigationPane.push(page);
                  }
                  property Page secondPage
                  function getSecondPage() {
                      if (! secondPage) {
                          secondPage = secondPageDefinition.createObject();
                      }
                      return secondPage;
                  }
                  attachedObjects: [
                      ComponentDefinition {
                          id: secondPageDefinition
                          objectName: "secondPageDefinition"
                          source: "DetailsPage.qml"
                      }
                  ]
              }
          }
      }
      onCreationCompleted: {
          // this slot is called when declarative scene is created
          // write post creation initialization here
          console.log("NavigationPane - onCreationCompleted()");
  
          // enable layout to adapt to the device rotation
          // don't forget to enable screen rotation in bar-bescriptor.xml (Application-&gt;Orientation-&gt;Auto-orient)
          OrientationSupport.supportedDisplayOrientation = SupportedDisplayOrientation.All;
      }
  }
  </code></pre>
  
  <p>The detailsPage.qml file is:</p>
  
  <pre><code>// Navigation pane project template
  import bb.cascades 1.0
  
  Page {
      // page with a picture detail
      id: pgDetail
      objectName: "pgDetail"
      actions: [
          // create navigation panel actions here
          ActionItem {
              title: qsTr("Break")
              onTriggered: {
                  imgView.imageSource = "asset:///images/picture1br.png"
              }
          }
      ]
      paneProperties: NavigationPaneProperties {
          backButton: ActionItem {
              onTriggered: {
                  // define what happens when back button is pressed here
                  // in this case is closed the detail page
                  navigationPane.pop()
              }
          }
      }
      Container {
          background: Color.Black
          Label {
              text: qsTr("Page 2")
              horizontalAlignment: HorizontalAlignment.Center
              textStyle {
                  base: SystemDefaults.TextStyles.TitleText
                  color: Color.Yellow
              }
          }
          ImageView {
              id: imgView
              imageSource: "asset:///images/picture1.png"
              horizontalAlignment: HorizontalAlignment.Center
          }
          Label {
              text: qsTr("Picture description")
              horizontalAlignment: HorizontalAlignment.Center
          }
          TextArea {
              objectName: "noteText"
          }
          Button {
              objectName: "insertBtn"
              text: qsTr("Insert Note")
          }
      }
  }
  </code></pre>
  
  <p>I tried to connect the button using the signal <code>pushTransactionEnded</code>, but it has two problems:</p>
  
  <ol>
  <li>The connect method is called every time i change screen (and i want to connect the slot only on startup).</li>
  <li>When i the button is clicked, i have the same problem, i have no reference to the currentPage (but maybe if i save the root pane in that case, using the top() method, i can obtain access to the current Page)</li>
  </ol>
  
  <p>So basically my questions are: 
  When i must connect my slot to a signal? 
  How i do that, if the objects are on a different qml file? </p>
  
  <p>I want to handle the clicked event on C++ not directly in qml File.</p>