123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161 |
- // import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
- import QtQuick 1.1
- import "../js/core.js" as Core
- import "../delegates"
- import "../parts"
- KPage {
- property int karmaId
- property string currentTitle
- property string currentPoints
- focus:true
- id: listpanel
- ListModel {
- id: itemModel
- }
- Rectangle{
- id: searchBox
- width:parent.width
- height: 60
- color: "transparent"
- anchors.top: titlebar.bottom
- Rectangle{
- width: parent.width*0.9
- height: parent.height*0.8
- anchors.centerIn: parent
- radius: height/2
- color: "transparent"
- border.color:"#8f00FF"
- TextInput{
- id:searchText
- width:parent.width - 2*parent.radius
- anchors.centerIn: parent
- Keys.onReturnPressed: closeSoftwareInputPanel()
- Keys.onPressed: console.log("pressed")
- onTextChanged: {closeSoftwareInputPanel();listpanel.filter(searchText.text)}
- //onCursorPositionChanged: {console.log("key"); accepted()}
- }
- }
- }
- Flickable{
- id: flicklist
- width: parent.width; height: parent.height-titlebar.height
- contentWidth: parent.width;
- //contentHeight: height+100
- anchors.top: searchBox.bottom
- anchors.right: parent.right
- ListView {
- id: view
- model: itemModel
- anchors.fill: parent
- clip:true
- delegate: KarmaPeopleDelegate {
- image: model.image
- name: model.name
- points: Core.getGoodKarma()-Core.getBadKarma();
- onClicked: {
- karmaId=model.id
- currentTitle=model.name
- currentPoints=Core.getGoodKarma()-Core.getBadKarma();
- contexMenu.visible=true;
- }
- }
- }
- }
- //Page layout is divided in 3
- TitleBar{
- id:titlebar
- KButton{
- id:titleButton
- text:"+"
- anchors.right:parent.right
- anchors.top:parent.top
- anchors.rightMargin: 10
- anchors.topMargin: 5
- }
- }
- // TodoCreateDialog to add new todo to the current box
- /*AddKarmaForm {
- id: karmaCreateDialog
- }*/
- KarmaToolBar {
- }
- KContextMenu {
- id: contexMenu
- KMenuItem {
- text: qsTr("View profile")
- onClicked: pageStack.push(Qt.resolvedUrl("PersonPage.qml"))
- }
- KMenuItem {
- text: qsTr("Delete item")
- onClicked:{ deleteItem(karmaId)}
- }
- KMenuItem {
- text: qsTr("Edit item")
- onClicked:{karmaCreateDialog.open() }
- }
- }
- AboutPage {
- id: about
- visible:false
- }
- KarmaMenu {
- id: karmaMenu
- }
- Keys.onMenuPressed: {
- karmaMenu.visible=true
- }
- onVisibleChanged: {
- if(visible == true) {
- updateUi();
- }
- }
- function updateUi() {
- view.model = 0;
- Core.readPeopleList(itemModel);
- view.model = itemModel;
- }
- /*function deleteItem(id){
- Core.deleteKarma(id);
- updateUi();
- }*/
- /*function update()
- {
- // read the TodoItem with the provided karmaId
- var item = Core.readKarmaItem(karmaId);
- // get values from UI fields
- item.title = karmaCreateDialog.title;
- item.points = karmaCreateDialog.points;
- // new Data() will return the current date
- item.modified = new Date();
- // update the todoItem in Database
- Core.updateKarma(item);
- }*/
- }
|