Skip to content

Commit

Permalink
Updated samples applications to 10.1 Gold.
Browse files Browse the repository at this point in the history
  • Loading branch information
pkjellberg committed Apr 23, 2013
1 parent e2a9735 commit 4064ccc
Show file tree
Hide file tree
Showing 402 changed files with 7,899 additions and 4,041 deletions.
62 changes: 42 additions & 20 deletions bucketlist/.cproject

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bucketlist/BucketList.pro
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ APP_NAME = bucketlist

CONFIG += qt warn_on cascades10

LIBS += -lbbdata
LIBS += -lbbdata
LIBS += -lbbplatformbbm

include(config.pri)
6 changes: 2 additions & 4 deletions bucketlist/assets/BBMConnectSheet.qml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import bb.cascades 1.0

Sheet {
id: bbmConnectSheet

property string waitingMessage
property string waitingImage
property string errorMessage
Expand All @@ -33,7 +32,6 @@ Sheet {
rightPadding: leftPadding

Container {

Label {
horizontalAlignment: HorizontalAlignment.Center
text: "Connect Bucket List to BBM?"
Expand All @@ -47,7 +45,7 @@ Sheet {
Button {
text: "Yes"
onClicked: {
// When yes has been answered the only outcome is sucess or
// When yes has been answered the only outcome is success or
// failure, after failure it is not possible to try again.
enabled = false;
bbmConnectSheet.connectToBBM(true);
Expand Down
22 changes: 11 additions & 11 deletions bucketlist/assets/BucketList.qml
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,23 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import bb.cascades 1.0

// Import the bucketmodel set as a type in the application constructor
import com.bucketlist.bucketdata 1.0

// Import the items folder for the cusom list items
// Import the items folder for the custom list items
import "items"

ListView {
id: bucketList

// Signal that tells the application that the BBM status should be updated
signal newBBMStatus(string message, string icon)

// The data model is defined in the attached object list below.
dataModel: bucketModel


layoutProperties: StackLayoutProperties {
spaceQuota: 1
Expand All @@ -38,6 +37,7 @@ ListView {
listItemComponents: [
ListItemComponent {
type: "todo"

TodoItem {
// List item component (see items/TodoItem.qml for definition).
}
Expand All @@ -54,12 +54,13 @@ ListView {
actions: [
ActionItem {
title: "Todo"

// Since it is only possible to change the state from one state to another,
// ActionItems are disabled if they do not result in a state change.
// For example, todo -> finished is allowed but todo -> todo is not.
enabled: bucketModel.filter == "todo" ? false : true
imageSource: "asset:///images/todo.png"

onTriggered: {
if (enabled) {
// Change the status of the selected items to "todo", clear selection before
Expand All @@ -76,6 +77,7 @@ ListView {
title: "Finished"
enabled: bucketModel.filter == "finished" ? false : true
imageSource: "asset:///images/finished.png"

onTriggered: {
if (enabled) {
// Change the status of the selected items to "finished". Clear selection before items are manipulated to avoid blink.
Expand All @@ -90,13 +92,14 @@ ListView {
title: "Chickened out"
enabled: bucketModel.filter == "chickened" ? false : true
imageSource: "asset:///images/chickened.png"

onTriggered: {
if (enabled) {
// Change the status of the selected items to "chickened". Clear selection before items are manipulated to avoid blink.
var selectionList = bucketList.selectionList();
bucketList.clearSelection();
bucketModel.setStatus(selectionList, "chickened");
updateBBMStatus("Chikened out on some items to my bucket list", "images/chickened.png");
updateBBMStatus("Chickened out on some items to my bucket list", "images/chickened.png");
}
}
},
Expand All @@ -105,6 +108,7 @@ ListView {
// correct place.
DeleteActionItem {
title: "Delete"

onTriggered: {
// Delete the selected items. Clear selection before items are manipulated to avoid blink.
var selectionList = bucketList.selectionList();
Expand All @@ -114,7 +118,6 @@ ListView {
}
]
}

onTriggered: {
// When an item is triggered, a navigation takes place to a detailed
// view of the item where the user can edit the item. The page is created
Expand All @@ -129,17 +132,14 @@ ListView {
page.title = option.text;
nav.push(page);
}

onSelectionChanged: {
// Call a function to update the number of selected items in the multi-select view.
updateMultiStatus();
}

function itemType(data, indexPath) {
// There is only have one type of item in the list, so "todo" is always returned.
return "todo";
}

function updateMultiStatus() {

// The status text of the multi-select handler is updated to show how
Expand Down
37 changes: 30 additions & 7 deletions bucketlist/assets/BucketListPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -12,36 +12,37 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import bb.cascades 1.0

// Import the bucketmodel set as a type in the application constructor
import com.bucketlist.bucketdata 1.0

Page {
id: bucketListPage

// Signal that tells the application that the BBM status should be updated
signal newBBMStatus(string message, string icon)

titleBar: TitleBar {
id: segmentedTitle
kind: TitleBarKind.Segmented
scrollBehavior: TitleBarScrollBehavior.Sticky

// The segmented control decides which filter should be set on the
// dataModel used by the photo bucket list.
options: [
Option {
text: "Todo"
value: "todo"
value: ("todo")
},
Option {
text: "Finished"
value: "finished"
value: ("finished")
},
Option {
text: "Chickened out"
value: "chickened"
value: ("chickened")
}
]

Expand All @@ -58,7 +59,6 @@ Page {
}

Container {
topPadding: 20

// The ListView is a separate QML component kept in BucketList.qml
BucketList {
Expand All @@ -83,6 +83,19 @@ Page {
]
}
}

shortcuts: [
SystemShortcut {

type: SystemShortcuts.CreateNew
onTriggered: {
if(! bucketModel.bucketIsFull) {
addNew.open();
addNew.text = "";
}
}
}
]

// Attached objects of the Bucket List Page
attachedObjects: [
Expand All @@ -92,7 +105,7 @@ Page {

onSaveBucketItem: {
bucketModel.addBucketItem(text);
bucketList.scrollToPosition(ScrollPosition.Top, ScrollAnimation.Default);
bucketList.scrollToPosition(ScrollPosition.Beginning, ScrollAnimation.Default);
}
},
ComponentDefinition {
Expand Down Expand Up @@ -122,5 +135,15 @@ Page {
onCreationCompleted: {
// Connect the list signal to this page signal to reemit it when it is triggered
bucketList.newBBMStatus.connect(newBBMStatus);

// Connect to the application incoming item signal, fired when an item is
// received via the invocation framework
_app.incomingBucketItem.connect(onIncomingBucketItem);
}

//The slot used when the application is invoked with a .buk file.
function onIncomingBucketItem() {
addNew.open();
addNew.text = _app.bucketItemTitle;
}
}
14 changes: 14 additions & 0 deletions bucketlist/assets/BucketPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -47,22 +47,36 @@ Page {
}
}

shortcuts: [
SystemShortcut {
// The edit short cut shows the edit sheet.
type: SystemShortcuts.Edit
onTriggered: {
editSheet.open();
editSheet.text = bucketText.text;
}
}
]

actions: [
ActionItem {
title: "Edit"
imageSource: "asset:///images/edit.png"
ActionBar.placement: ActionBarPlacement.OnBar

onTriggered: {
editSheet.open();
editSheet.text = bucketText.text;
}
}
]

attachedObjects: [
EditSheet {
id: editSheet
title: "Edit"
hintText: "Update bucket item description"

onSaveBucketItem: {
// Call the function to update the item data.
bucketModel.editBucketItem(bucketPage.item, text);
Expand Down
37 changes: 19 additions & 18 deletions bucketlist/assets/EditSheet.qml
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
/* Copyright (c) 2012 Research In Motion Limited.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import bb.cascades 1.0

// This QML sheet is used for editing and adding new items to the Bucket List application.

Sheet {
id: editSheet

Expand All @@ -25,10 +26,8 @@ Sheet {

// A custom signal is triggered when the acceptAction is triggered.
signal saveBucketItem(string text)

Page {
id: addPage

titleBar: TitleBar {
id: addBar
title: "Add"
Expand All @@ -51,7 +50,6 @@ Sheet {
}
}
}

Container {
id: editPane
property real margins: 40
Expand All @@ -69,9 +67,7 @@ Sheet {
base: SystemDefaults.TextStyles.TitleText
}
]

Container {

TextArea {
id: itemText
hintText: "New item on the bucket list"
Expand All @@ -88,4 +84,9 @@ Sheet {
}// Text Area Container
}// Edit pane Container
}// Page

onOpened: {
itemText.requestFocus()
}

}// Sheet
Binary file added bucketlist/assets/images/ic_share.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 4064ccc

Please sign in to comment.