Merge branch 'qml'
authorjakub <jakub.jaszczynski@comarch.com>
Mon, 28 Feb 2011 14:23:49 +0000 (15:23 +0100)
committerjakub <jakub.jaszczynski@comarch.com>
Mon, 28 Feb 2011 14:23:49 +0000 (15:23 +0100)
Conflicts:
src/mdictionary/qml/WordListWidget.qml

1  2 
src/mdictionary/qml/WordListWidget.qml

  import Qt 4.7
  
  Rectangle {
+     id: rectangle1
+     color: myPalette.base
+     anchors.fill: parent
  
      function changeWordState(nr, state) {
 +        console.log("LOOOOOL")
          wordList.currentIndex = nr
          wordModel.setModelProperty(wordList.currentIndex, state, "isBookmarked")
  
      }
  
 -    function setEnabled(Boolean) { wordList.enabled = Boolean }  // slot
 +    function setEnabled(Boolean) { wordList.enabled = Boolean }
 +    function setWordListEmpty(Boolean) { wordList.empty = Boolean }
 +    function setFocus() {
 +        console.log("juhu")
 +        wordList.setFocus()
 +//        activeFocus = true
 +        console.log(focus + "a " + activeFocus)
 +        console.log(wordList.focus + "b " + wordList.activeFocus)
 +    }
  
      signal wordSelected(string word);
+     signal checkFocus();
  
      SystemPalette { id: myPalette; colorGroup: SystemPalette.Active }
  
                      else
                              return check.height;
                  }
                  MouseArea{
                      anchors.fill: parent
-                     onClicked: {
-                         wordList.currentIndex = index// number
 -                    onClicked: wordList.currentIndex = number
++                    onClicked: wordList.currentIndex = index 
+                     onDoubleClicked: {
+                         wordList.currentIndex = number
                          rectangle1.wordSelected(word)
                      }
                  }
                      pathToUncheckedImage: UncheckedPath
                      anchors.right: parent.right
                      anchors.rightMargin: 5
+                     pathToCheckedDicImage: CheckedPath
+                     pathToUncheckedDicImage: UncheckedPath
                      anchors.verticalCenter: parent.verticalCenter
                      onChanged: rectangle1.changeWordState(number, selected)
 -                    visible: {
 -                        if (word == "!@#$%"){
 -                            false
 -                        } else {
 -                            true
 -                        }
 -                    }
                  }
              }
          }
  
 +        Text {
 +            id: emptyText
 +            anchors.top: parent.top
 +            anchors.left: parent.left
 +            text: qsTr("Can't find any matching words")
 +        }
 +
 +        Rectangle {
 +            id: shadeDisable
 +            anchors.centerIn: parent;
 +            color: "grey";
 +            opacity: 0
 +            width:  parent.width;
 +            height: parent.height;
 +        }
 +
          model: wordModel
 +
 +        states: [
 +            State {
 +                name: "empty"
 +                when: (wordList.empty == true);
 +                PropertyChanges { target: emptyText; visible: true}
 +            },
 +            State {
 +                name: "non-empty"
 +                when: (wordList.empty == false);
 +                PropertyChanges { target: emptyText; visible: false}
 +            },
 +            State {
 +                name: "enabled"
 +                when: (wordList.enabled == true);
 +                PropertyChanges { target: shadeDisable; z: 30; opacity: 0.5 }
 +            },
 +            State {
 +                name: "disabled"
 +                when: (wordList.enabled == false);
 +                PropertyChanges { target: shadeDisable; z: 30; opacity: 0.0 }
 +            }
 +        ]
      }
+     states: [
+             State {
+                 name: "noFocus";
+                 when: ((!wordList.focus) && (!rectangle1.focus))
+                 PropertyChanges { target: wordList.highlightItem; opacity:0}
+            }
+     ]
  }